-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
fix(config): resolve externalized specifier with internal resolver #10683
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 |
---|---|---|
|
@@ -1651,88 +1651,6 @@ Repository: git+https://github.com/css-modules/icss-utils.git | |
|
||
--------------------------------------- | ||
|
||
## import-meta-resolve | ||
License: MIT | ||
By: Titus Wormer | ||
Repository: wooorm/import-meta-resolve | ||
|
||
> (The MIT License) | ||
> | ||
> Copyright (c) 2021 Titus Wormer <mailto:[email protected]> | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining | ||
> a copy of this software and associated documentation files (the | ||
> 'Software'), to deal in the Software without restriction, including | ||
> without limitation the rights to use, copy, modify, merge, publish, | ||
> distribute, sublicense, and/or sell copies of the Software, and to | ||
> permit persons to whom the Software is furnished to do so, subject to | ||
> the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be | ||
> included in all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, | ||
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
> | ||
> --- | ||
> | ||
> This is a derivative work based on: | ||
> <https://github.com/nodejs/node>. | ||
> Which is licensed: | ||
> | ||
> """ | ||
> Copyright Node.js contributors. All rights reserved. | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to | ||
> deal in the Software without restriction, including without limitation the | ||
> rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
> sell copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
> IN THE SOFTWARE. | ||
> """ | ||
> | ||
> This license applies to parts of Node.js originating from the | ||
> https://github.com/joyent/node repository: | ||
> | ||
> """ | ||
> Copyright Joyent, Inc. and other Node contributors. All rights reserved. | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to | ||
> deal in the Software without restriction, including without limitation the | ||
> rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
> sell copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
> IN THE SOFTWARE. | ||
> """ | ||
|
||
--------------------------------------- | ||
|
||
## inflight | ||
License: ISC | ||
By: Isaac Z. Schlueter | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -580,12 +580,21 @@ function tryResolveFile( | |
} | ||
} | ||
|
||
export type InternalResolveOptionsWithOverrideConditions = | ||
InternalResolveOptions & { | ||
/** | ||
* @deprecated In future, `conditions` will work like this. | ||
* @internal | ||
*/ | ||
overrideConditions?: string[] | ||
} | ||
|
||
export const idToPkgMap = new Map<string, PackageData>() | ||
|
||
export function tryNodeResolve( | ||
id: string, | ||
importer: string | null | undefined, | ||
options: InternalResolveOptions, | ||
options: InternalResolveOptionsWithOverrideConditions, | ||
targetWeb: boolean, | ||
depsOptimizer?: DepsOptimizer, | ||
ssr?: boolean, | ||
|
@@ -1031,17 +1040,44 @@ function packageEntryFailure(id: string, details?: string) { | |
) | ||
} | ||
|
||
const conditionalConditions = new Set(['production', 'development', 'module']) | ||
|
||
function resolveExports( | ||
pkg: PackageData['data'], | ||
key: string, | ||
options: InternalResolveOptions, | ||
options: InternalResolveOptionsWithOverrideConditions, | ||
targetWeb: boolean | ||
) { | ||
const conditions = [options.isProduction ? 'production' : 'development'] | ||
if (!options.isRequire) { | ||
const overrideConditions = options.overrideConditions | ||
? new Set(options.overrideConditions) | ||
: undefined | ||
|
||
const conditions = [] | ||
if ( | ||
(!overrideConditions || overrideConditions.has('production')) && | ||
options.isProduction | ||
) { | ||
conditions.push('production') | ||
} | ||
if ( | ||
(!overrideConditions || overrideConditions.has('development')) && | ||
!options.isProduction | ||
) { | ||
conditions.push('development') | ||
} | ||
if ( | ||
(!overrideConditions || overrideConditions.has('module')) && | ||
!options.isRequire | ||
) { | ||
conditions.push('module') | ||
} | ||
if (options.conditions.length > 0) { | ||
if (options.overrideConditions) { | ||
conditions.push( | ||
...options.overrideConditions.filter((condition) => | ||
conditionalConditions.has(condition) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a typo. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! Thanks. I'll fix it with some refactor around this. |
||
) | ||
) | ||
} else if (options.conditions.length > 0) { | ||
conditions.push(...options.conditions) | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
What does this do? Hard to know from just reading the code.
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.
Ok I think I get it.
This option decides which of the default conditions (
production
,development
,module
) are allowed. It may also add custom conditions, and it prevents theconditions
option from being used.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.
Yes, that's correct.