feat: assets copying#753
Conversation
PR SummaryLow Risk Overview After HTML, JS chunks, and Default global config now sets Reviewed by Cursor Bugbot for commit 99ac172. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #753 +/- ##
==========================================
- Coverage 84.48% 84.29% -0.19%
==========================================
Files 174 175 +1
Lines 15634 15684 +50
Branches 1387 1388 +1
==========================================
+ Hits 13208 13221 +13
- Misses 2416 2453 +37
Partials 10 10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Why can't the user specify "all my assets are in |
If you mean as what do you think? |
Say wdyt @nodejs/web-infra I want opinions |
|
I'll hold off on fixing the bot's comments, Waiting for the final decision. |
yeah this is a really common pattern |
|
@moshams272 We've decided to use the We think the default should be |
536ed59 to
56ae71a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 56ae71a. Configure here.
| const fileStats = await stat(src); | ||
|
|
||
| if (fileStats.isDirectory()) { | ||
| await cp(src, dest, { recursive: true, force: true }); |
There was a problem hiding this comment.
Do we need to check isDirectory()? Won't await cp(src, dest, { recursive: true, force: true }) work on files and folders?
There was a problem hiding this comment.
Yeah, but the automated Cursor Bot previously flagged the use of cp for individual files.

Description
Local images referenced in Markdown files were not resolved correctly or copied to the final build, this PR will solve this by copying the images in the
output/assets/.I solved this from root from the jsx-ast phase as they are markdown AST because we can iterate on them easier than JSX elements.
Steps:
Updated
src/generators/ast/generate.mjsto include the absolutefullPathof each Markdown file.Updated
src/generators/metadata/utils/parse.mjsto include thefullPathinto the metadata entries.Implemented
extractAssetsFromASTinsrc/generators/jsx-ast/utils/buildContent.mjs, that identifies local images, rewrites their URLs to a centralized /assets/ directory, and collects the source paths.Implemented
copyProjectAssetsto the web generatorsrc/generators/web/generate.mjsto aggregate all unique assets and copy them to the output directory.Validation
Added tests in
src/generators/jsx-ast/utils/__tests__/buildContent.test.mjsto verify that theassetsMapis populated with absolute paths.Tested against Node.js API documentation; local images (like
logo.png) are now correctly copied to the out/assets folder and displayed in the web generated.Related Issues
#748
Check List
node --run testand all tests passed.node --run format&node --run lint.