-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "exports" proposal #28568
Implement "exports" proposal #28568
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Flags: --experimental-modules --experimental-exports | ||
|
||
import { mustCall } from '../common/index.mjs'; | ||
import { ok, strictEqual } from 'assert'; | ||
|
||
import { asdf, asdf2 } from '../fixtures/pkgexports.mjs'; | ||
import { | ||
loadMissing, | ||
loadFromNumber, | ||
loadDot, | ||
} from '../fixtures/pkgexports-missing.mjs'; | ||
|
||
strictEqual(asdf, 'asdf'); | ||
strictEqual(asdf2, 'asdf'); | ||
|
||
loadMissing().catch(mustCall((err) => { | ||
ok(err.message.toString().startsWith('Package exports')); | ||
ok(err.message.toString().indexOf('do not define a \'./missing\' subpath')); | ||
})); | ||
|
||
loadFromNumber().catch(mustCall((err) => { | ||
ok(err.message.toString().startsWith('Package exports')); | ||
ok(err.message.toString().indexOf('do not define a \'./missing\' subpath')); | ||
})); | ||
|
||
loadDot().catch(mustCall((err) => { | ||
ok(err.message.toString().startsWith('Cannot find main entry point')); | ||
})); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export function loadMissing() { | ||
return import('pkgexports/missing'); | ||
} | ||
|
||
export function loadFromNumber() { | ||
return import('pkgexports-number/hidden.js'); | ||
} | ||
|
||
export function loadDot() { | ||
return import('pkgexports'); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as asdf } from 'pkgexports/asdf'; | ||
export { default as asdf2 } from 'pkgexports/sub/asdf.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we document what happens if an exports:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the values/targets of an export mapping? In any case - this is something we want to dig into in a dedicated change for both keys and values. I'd be concerned of missing important cases in the noise if we try to address it in this initial PR. It's listed as one of the blockers to unflagging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine to push off until unflagging.