Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"p-map": "^4.0.0",
"path-exists": "^4.0.0",
"pkg-dir": "^5.0.0",
"precinct": "^8.0.0",
"precinct": "^8.2.0",
"read-package-json-fast": "^2.0.2",
"require-package-name": "^2.0.1",
"resolve": "^2.0.0-next.1",
Expand Down
6 changes: 6 additions & 0 deletions tests/fixtures/require-stream/function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const streams = require('node:stream/web')

exports.handler = () => ({
statusCode: 200,
body: 'streams type is ' + typeof streams,
})
6 changes: 6 additions & 0 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2234,3 +2234,9 @@ testMany(
files.every(({ size }) => Number.isInteger(size) && size > 0)
},
)

testMany('Ignores node:-prefixed imports (repro #743)', ['bundler_default', 'bundler_nft'], async (options, t) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not really ignoring these imports, we're just treating them as imports for built-in modules, right?

Also added two test variations:

  • bundler_default_nft
  • todo:bundler_esbuild (so support in esbuild is on our radar)
Suggested change
testMany('Ignores node:-prefixed imports (repro #743)', ['bundler_default', 'bundler_nft'], async (options, t) => {
testMany('Handles imports of built-in modules with the `node:` prefix', ['bundler_default', 'bundler_default_nft', 'bundler_nft', 'todo:bundler_esbuild'], async (options, t) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, #698 adds a test for the node: prefix. It uses fs rather than stream/web, which might be a better test because it doesn't rely on Node 16.

We could let #773 upgrade precinct and then merge #698 for the test.

@netlify-team-account-1 what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

await zipFixture(t, 'require-stream', {
opts: options,
})
})