@flex-development/mlly 1.0.0-alpha.18 → 1.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +810 -709
- package/README.md +173 -12
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +1 -3
- package/dist/interfaces/aliases.d.mts +11 -0
- package/dist/interfaces/context-get-source.d.mts +52 -0
- package/dist/interfaces/file-system.d.mts +57 -0
- package/dist/interfaces/index.d.mts +11 -21
- package/dist/interfaces/main-field-map.d.mts +13 -0
- package/dist/interfaces/module-format-map.d.mts +17 -0
- package/dist/interfaces/options-get-source.d.mts +22 -29
- package/dist/interfaces/options-resolve-alias.d.mts +14 -26
- package/dist/interfaces/options-resolve-module.d.mts +38 -27
- package/dist/interfaces/protocol-map.d.mts +35 -0
- package/dist/interfaces/stats.d.mts +28 -0
- package/dist/internal/chars.mjs +11 -0
- package/dist/internal/check-invalid-segments.mjs +19 -0
- package/dist/internal/fs.browser.mjs +36 -0
- package/dist/internal/fs.d.mts +7 -0
- package/dist/internal/invalid-package-target.mjs +18 -0
- package/dist/internal/invalid-subpath.mjs +16 -0
- package/dist/internal/process.browser.mjs +7 -0
- package/dist/internal/process.d.mts +4 -0
- package/dist/lib/can-parse-url.d.mts +21 -0
- package/dist/lib/can-parse-url.mjs +12 -0
- package/dist/lib/cwd.d.mts +12 -0
- package/dist/lib/cwd.mjs +8 -0
- package/dist/lib/default-conditions.d.mts +15 -0
- package/dist/lib/default-conditions.mjs +5 -0
- package/dist/lib/default-extensions.d.mts +14 -0
- package/dist/lib/default-extensions.mjs +21 -0
- package/dist/lib/default-main-fields.d.mts +14 -0
- package/dist/lib/default-main-fields.mjs +5 -0
- package/dist/lib/extension-format-map.d.mts +16 -0
- package/dist/lib/extension-format-map.mjs +21 -0
- package/dist/lib/formats.d.mts +21 -0
- package/dist/lib/formats.mjs +14 -0
- package/dist/lib/get-source.d.mts +26 -0
- package/dist/lib/get-source.mjs +70 -0
- package/dist/lib/index.d.mts +40 -0
- package/dist/lib/index.mjs +53 -0
- package/dist/lib/is-absolute-specifier.d.mts +23 -0
- package/dist/lib/is-absolute-specifier.mjs +9 -0
- package/dist/lib/is-array-index.d.mts +17 -0
- package/dist/lib/is-array-index.mjs +11 -0
- package/dist/lib/is-bare-specifier.d.mts +23 -0
- package/dist/lib/is-bare-specifier.mjs +11 -0
- package/dist/lib/is-directory.d.mts +22 -0
- package/dist/lib/is-directory.mjs +13 -0
- package/dist/lib/is-file.d.mts +22 -0
- package/dist/lib/is-file.mjs +13 -0
- package/dist/lib/is-imports-subpath.d.mts +19 -0
- package/dist/lib/is-imports-subpath.mjs +8 -0
- package/dist/lib/is-relative-specifier.d.mts +21 -0
- package/dist/lib/is-relative-specifier.mjs +16 -0
- package/dist/lib/lookup-package-scope.d.mts +26 -0
- package/dist/lib/lookup-package-scope.mjs +16 -0
- package/dist/lib/pattern-key-compare.d.mts +31 -0
- package/dist/lib/pattern-key-compare.mjs +18 -0
- package/dist/lib/pattern-match.d.mts +19 -0
- package/dist/lib/pattern-match.mjs +36 -0
- package/dist/lib/read-package-json.d.mts +35 -0
- package/dist/lib/read-package-json.mjs +29 -0
- package/dist/lib/resolve-alias.d.mts +19 -0
- package/dist/lib/resolve-alias.mjs +50 -0
- package/dist/lib/resolve-module.d.mts +37 -0
- package/dist/lib/resolve-module.mjs +75 -0
- package/dist/lib/resolver.d.mts +280 -0
- package/dist/lib/resolver.mjs +462 -0
- package/dist/lib/root.d.mts +11 -0
- package/dist/lib/root.mjs +6 -0
- package/dist/lib/to-relative-specifier.d.mts +25 -0
- package/dist/lib/to-relative-specifier.mjs +26 -0
- package/dist/lib/to-url.d.mts +24 -0
- package/dist/lib/to-url.mjs +10 -0
- package/dist/types/awaitable.d.mts +14 -0
- package/dist/types/change-ext-fn.d.mts +29 -0
- package/dist/types/get-source-handler.d.mts +21 -0
- package/dist/types/get-source-handlers.d.mts +14 -0
- package/dist/types/index.d.mts +12 -10
- package/dist/types/main-field.d.mts +13 -0
- package/dist/types/module-format.d.mts +13 -0
- package/dist/types/module-id.d.mts +2 -4
- package/dist/types/numeric.d.mts +9 -0
- package/dist/types/pattern-key-compare-result.d.mts +9 -0
- package/dist/types/pattern-match.d.mts +10 -0
- package/dist/types/protocol.d.mts +6 -7
- package/package.json +227 -155
- package/dist/enums/assert-type.d.mts +0 -21
- package/dist/enums/assert-type.mjs +0 -4
- package/dist/enums/format.d.mts +0 -17
- package/dist/enums/format.mjs +0 -4
- package/dist/enums/index.d.mts +0 -10
- package/dist/enums/index.mjs +0 -14
- package/dist/enums/kind-specifier-syntax.d.mts +0 -14
- package/dist/enums/kind-specifier-syntax.mjs +0 -4
- package/dist/enums/kind-specifier.d.mts +0 -17
- package/dist/enums/kind-specifier.mjs +0 -4
- package/dist/enums/kind-statement-syntax.d.mts +0 -22
- package/dist/enums/kind-statement-syntax.mjs +0 -4
- package/dist/enums/kind-statement.d.mts +0 -15
- package/dist/enums/kind-statement.mjs +0 -4
- package/dist/index.mjs.map +0 -8
- package/dist/interfaces/import-assertions.d.mts +0 -20
- package/dist/interfaces/import-dynamic.d.mts +0 -41
- package/dist/interfaces/import-static.d.mts +0 -35
- package/dist/interfaces/options-fill-module.d.mts +0 -23
- package/dist/interfaces/options-find-subpath.d.mts +0 -50
- package/dist/interfaces/options-get-format.d.mts +0 -73
- package/dist/interfaces/options-parse-module-id.d.mts +0 -34
- package/dist/interfaces/options-parse-subpath.d.mts +0 -50
- package/dist/interfaces/options-resolve.d.mts +0 -15
- package/dist/interfaces/package-scope.d.mts +0 -25
- package/dist/interfaces/parsed-data-url.d.mts +0 -56
- package/dist/interfaces/parsed-module-id.d.mts +0 -80
- package/dist/interfaces/parsed-subpath.d.mts +0 -44
- package/dist/interfaces/statement-export.d.mts +0 -44
- package/dist/interfaces/statement-import.d.mts +0 -38
- package/dist/interfaces/statement-require.d.mts +0 -38
- package/dist/interfaces/statement.d.mts +0 -49
- package/dist/internal/dequote.d.mts +0 -14
- package/dist/internal/dequote.mjs +0 -7
- package/dist/internal/dequote.mjs.map +0 -8
- package/dist/internal/format-type-map.d.mts +0 -19
- package/dist/internal/format-type-map.mjs +0 -13
- package/dist/internal/format-type-map.mjs.map +0 -8
- package/dist/internal/get-specifier-kind.d.mts +0 -19
- package/dist/internal/get-specifier-kind.mjs +0 -11
- package/dist/internal/get-specifier-kind.mjs.map +0 -8
- package/dist/internal/get-subpaths.d.mts +0 -28
- package/dist/internal/get-subpaths.mjs +0 -8
- package/dist/internal/get-subpaths.mjs.map +0 -8
- package/dist/internal/regex-encoded-sep.d.mts +0 -15
- package/dist/internal/regex-encoded-sep.mjs +0 -6
- package/dist/internal/regex-encoded-sep.mjs.map +0 -8
- package/dist/internal/regex-internal-specifier.d.mts +0 -16
- package/dist/internal/regex-internal-specifier.mjs +0 -6
- package/dist/internal/regex-internal-specifier.mjs.map +0 -8
- package/dist/internal/regex-invalid-segment.d.mts +0 -16
- package/dist/internal/regex-invalid-segment.mjs +0 -9
- package/dist/internal/regex-invalid-segment.mjs.map +0 -8
- package/dist/internal/regex-package-name.d.mts +0 -15
- package/dist/internal/regex-package-name.mjs +0 -6
- package/dist/internal/regex-package-name.mjs.map +0 -8
- package/dist/internal/regex-package-path.d.mts +0 -17
- package/dist/internal/regex-package-path.mjs +0 -6
- package/dist/internal/regex-package-path.mjs.map +0 -8
- package/dist/internal/resolver.d.mts +0 -132
- package/dist/internal/resolver.mjs +0 -483
- package/dist/internal/resolver.mjs.map +0 -8
- package/dist/internal/validate-array-set.d.mts +0 -24
- package/dist/internal/validate-array-set.mjs +0 -12
- package/dist/internal/validate-array-set.mjs.map +0 -8
- package/dist/internal/validate-boolean.d.mts +0 -22
- package/dist/internal/validate-boolean.mjs +0 -12
- package/dist/internal/validate-boolean.mjs.map +0 -8
- package/dist/internal/validate-map.d.mts +0 -26
- package/dist/internal/validate-map.mjs +0 -12
- package/dist/internal/validate-map.mjs.map +0 -8
- package/dist/internal/validate-object.d.mts +0 -23
- package/dist/internal/validate-object.mjs +0 -12
- package/dist/internal/validate-object.mjs.map +0 -8
- package/dist/internal/validate-set.d.mts +0 -24
- package/dist/internal/validate-set.mjs +0 -12
- package/dist/internal/validate-set.mjs.map +0 -8
- package/dist/internal/validate-string.d.mts +0 -23
- package/dist/internal/validate-string.mjs +0 -12
- package/dist/internal/validate-string.mjs.map +0 -8
- package/dist/internal/validate-url-string.d.mts +0 -24
- package/dist/internal/validate-url-string.mjs +0 -13
- package/dist/internal/validate-url-string.mjs.map +0 -8
- package/dist/types/declaration.d.mts +0 -9
- package/dist/types/fn-change-ext.d.mts +0 -31
- package/dist/types/mime-type.d.mts +0 -13
- package/dist/types/module-specifier-type.d.mts +0 -11
- package/dist/types/syntax-kind-export.d.mts +0 -12
- package/dist/types/syntax-kind-import.d.mts +0 -12
- package/dist/types/syntax-kind-require.d.mts +0 -12
- package/dist/utils/compare-subpaths.d.mts +0 -25
- package/dist/utils/compare-subpaths.mjs +0 -19
- package/dist/utils/compare-subpaths.mjs.map +0 -8
- package/dist/utils/conditions.d.mts +0 -13
- package/dist/utils/conditions.mjs +0 -6
- package/dist/utils/conditions.mjs.map +0 -8
- package/dist/utils/detect-syntax.d.mts +0 -21
- package/dist/utils/detect-syntax.mjs +0 -11
- package/dist/utils/detect-syntax.mjs.map +0 -8
- package/dist/utils/extension-format-map.d.mts +0 -16
- package/dist/utils/extension-format-map.mjs +0 -22
- package/dist/utils/extension-format-map.mjs.map +0 -8
- package/dist/utils/extract-statements.d.mts +0 -21
- package/dist/utils/extract-statements.mjs +0 -20
- package/dist/utils/extract-statements.mjs.map +0 -8
- package/dist/utils/fill-modules.d.mts +0 -24
- package/dist/utils/fill-modules.mjs +0 -67
- package/dist/utils/fill-modules.mjs.map +0 -8
- package/dist/utils/find-dynamic-imports.d.mts +0 -18
- package/dist/utils/find-dynamic-imports.mjs +0 -36
- package/dist/utils/find-dynamic-imports.mjs.map +0 -8
- package/dist/utils/find-exports.d.mts +0 -21
- package/dist/utils/find-exports.mjs +0 -92
- package/dist/utils/find-exports.mjs.map +0 -8
- package/dist/utils/find-requires.d.mts +0 -18
- package/dist/utils/find-requires.mjs +0 -32
- package/dist/utils/find-requires.mjs.map +0 -8
- package/dist/utils/find-static-imports.d.mts +0 -18
- package/dist/utils/find-static-imports.mjs +0 -30
- package/dist/utils/find-static-imports.mjs.map +0 -8
- package/dist/utils/find-subpath.d.mts +0 -31
- package/dist/utils/find-subpath.mjs +0 -86
- package/dist/utils/find-subpath.mjs.map +0 -8
- package/dist/utils/get-format.d.mts +0 -31
- package/dist/utils/get-format.mjs +0 -107
- package/dist/utils/get-format.mjs.map +0 -8
- package/dist/utils/get-source.d.mts +0 -30
- package/dist/utils/get-source.mjs +0 -61
- package/dist/utils/get-source.mjs.map +0 -8
- package/dist/utils/has-cjs-syntax.d.mts +0 -25
- package/dist/utils/has-cjs-syntax.mjs +0 -11
- package/dist/utils/has-cjs-syntax.mjs.map +0 -8
- package/dist/utils/has-esm-syntax.d.mts +0 -21
- package/dist/utils/has-esm-syntax.mjs +0 -11
- package/dist/utils/has-esm-syntax.mjs.map +0 -8
- package/dist/utils/index.d.mts +0 -44
- package/dist/utils/index.mjs +0 -83
- package/dist/utils/index.mjs.map +0 -8
- package/dist/utils/is-absolute-specifier.d.mts +0 -20
- package/dist/utils/is-absolute-specifier.mjs +0 -26
- package/dist/utils/is-absolute-specifier.mjs.map +0 -8
- package/dist/utils/is-bare-specifier.d.mts +0 -20
- package/dist/utils/is-bare-specifier.mjs +0 -10
- package/dist/utils/is-bare-specifier.mjs.map +0 -8
- package/dist/utils/is-directory.d.mts +0 -13
- package/dist/utils/is-directory.mjs +0 -14
- package/dist/utils/is-directory.mjs.map +0 -8
- package/dist/utils/is-exports-sugar.d.mts +0 -26
- package/dist/utils/is-exports-sugar.mjs +0 -29
- package/dist/utils/is-exports-sugar.mjs.map +0 -8
- package/dist/utils/is-file.d.mts +0 -13
- package/dist/utils/is-file.mjs +0 -14
- package/dist/utils/is-file.mjs.map +0 -8
- package/dist/utils/is-relative-specifier.d.mts +0 -19
- package/dist/utils/is-relative-specifier.mjs +0 -9
- package/dist/utils/is-relative-specifier.mjs.map +0 -8
- package/dist/utils/lookup-package-scope.d.mts +0 -26
- package/dist/utils/lookup-package-scope.mjs +0 -34
- package/dist/utils/lookup-package-scope.mjs.map +0 -8
- package/dist/utils/parse-data-url.d.mts +0 -25
- package/dist/utils/parse-data-url.mjs +0 -25
- package/dist/utils/parse-data-url.mjs.map +0 -8
- package/dist/utils/parse-module-id.d.mts +0 -20
- package/dist/utils/parse-module-id.mjs +0 -123
- package/dist/utils/parse-module-id.mjs.map +0 -8
- package/dist/utils/parse-subpath.d.mts +0 -35
- package/dist/utils/parse-subpath.mjs +0 -149
- package/dist/utils/parse-subpath.mjs.map +0 -8
- package/dist/utils/pattern-character.d.mts +0 -11
- package/dist/utils/pattern-character.mjs +0 -6
- package/dist/utils/pattern-character.mjs.map +0 -8
- package/dist/utils/read-package-json.d.mts +0 -26
- package/dist/utils/read-package-json.mjs +0 -48
- package/dist/utils/read-package-json.mjs.map +0 -8
- package/dist/utils/resolve-alias.d.mts +0 -20
- package/dist/utils/resolve-alias.mjs +0 -101
- package/dist/utils/resolve-alias.mjs.map +0 -8
- package/dist/utils/resolve-aliases.d.mts +0 -19
- package/dist/utils/resolve-aliases.mjs +0 -26
- package/dist/utils/resolve-aliases.mjs.map +0 -8
- package/dist/utils/resolve-extensions.d.mts +0 -14
- package/dist/utils/resolve-extensions.mjs +0 -22
- package/dist/utils/resolve-extensions.mjs.map +0 -8
- package/dist/utils/resolve-module.d.mts +0 -39
- package/dist/utils/resolve-module.mjs +0 -63
- package/dist/utils/resolve-module.mjs.map +0 -8
- package/dist/utils/resolve-modules.d.mts +0 -25
- package/dist/utils/resolve-modules.mjs +0 -23
- package/dist/utils/resolve-modules.mjs.map +0 -8
- package/dist/utils/to-absolute-specifier.d.mts +0 -22
- package/dist/utils/to-absolute-specifier.mjs +0 -8
- package/dist/utils/to-absolute-specifier.mjs.map +0 -8
- package/dist/utils/to-bare-specifier.d.mts +0 -42
- package/dist/utils/to-bare-specifier.mjs +0 -79
- package/dist/utils/to-bare-specifier.mjs.map +0 -8
- package/dist/utils/to-data-url.d.mts +0 -30
- package/dist/utils/to-data-url.mjs +0 -7
- package/dist/utils/to-data-url.mjs.map +0 -8
- package/dist/utils/to-node-url.d.mts +0 -19
- package/dist/utils/to-node-url.mjs +0 -7
- package/dist/utils/to-node-url.mjs.map +0 -8
- package/dist/utils/to-relative-specifier.d.mts +0 -24
- package/dist/utils/to-relative-specifier.mjs +0 -10
- package/dist/utils/to-relative-specifier.mjs.map +0 -8
- package/dist/utils/to-url.d.mts +0 -21
- package/dist/utils/to-url.mjs +0 -8
- package/dist/utils/to-url.mjs.map +0 -8
- package/dist/utils/validate-assertions.d.mts +0 -23
- package/dist/utils/validate-assertions.mjs +0 -47
- package/dist/utils/validate-assertions.mjs.map +0 -8
- package/dist/utils/validate-exports.d.mts +0 -25
- package/dist/utils/validate-exports.mjs +0 -73
- package/dist/utils/validate-exports.mjs.map +0 -8
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Internal - Resolver
|
|
3
|
-
* @module mlly/internal/Resolver
|
|
4
|
-
*/
|
|
5
|
-
/// <reference types="node" />
|
|
6
|
-
import type { ModuleId } from '../types/index.mjs';
|
|
7
|
-
import type { Exports, PackageJson } from '@flex-development/pkg-types';
|
|
8
|
-
import { type Nullable, type Optional } from '@flex-development/tutils';
|
|
9
|
-
import { URL } from 'node:url';
|
|
10
|
-
/**
|
|
11
|
-
* ECMAScript (ES) module resolver.
|
|
12
|
-
*
|
|
13
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*
|
|
17
|
-
* @class
|
|
18
|
-
*/
|
|
19
|
-
declare class Resolver {
|
|
20
|
-
/**
|
|
21
|
-
* Resolves `specifier` according to the [ESM Resolver algorithm][1].
|
|
22
|
-
*
|
|
23
|
-
* [1]: https://nodejs.org/api/esm.html#esm_resolver_algorithm
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
26
|
-
*
|
|
27
|
-
* @param {string} specifier - Module specifier to resolve
|
|
28
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
29
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
30
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
31
|
-
* @param {boolean?} [preserveSymlinks=false] - Skip resolving symlinks
|
|
32
|
-
* @return {URL} Resolved module URL
|
|
33
|
-
* @throws {NodeError}
|
|
34
|
-
*/
|
|
35
|
-
resolveModule(specifier: string, parent: ModuleId, condition?: string, conditions?: Set<string>, preserveSymlinks?: boolean): URL;
|
|
36
|
-
/**
|
|
37
|
-
* Resolves a package path using a combination of the following algorithms:
|
|
38
|
-
*
|
|
39
|
-
* - `PACKAGE_RESOLVE`
|
|
40
|
-
* - `PACKAGE_SELF_RESOLVE`
|
|
41
|
-
*
|
|
42
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
*
|
|
46
|
-
* @param {string} specifier - Module specifier to resolve
|
|
47
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
48
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
49
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
50
|
-
* @return {URL} Resolved package path URL
|
|
51
|
-
* @throws {NodeError}
|
|
52
|
-
*/
|
|
53
|
-
resolvePackage(specifier: string, parent: ModuleId, condition?: string, conditions?: Set<string>): URL;
|
|
54
|
-
/**
|
|
55
|
-
* Resolves a subpath export according to the `PACKAGE_EXPORTS_RESOLVE`
|
|
56
|
-
* algorithm.
|
|
57
|
-
*
|
|
58
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
59
|
-
* @see https://nodejs.org/api/packages.html#subpath-exports
|
|
60
|
-
*
|
|
61
|
-
* @public
|
|
62
|
-
*
|
|
63
|
-
* @param {string} specifier - Module specifier containing subpath
|
|
64
|
-
* @param {ModuleId} pkg - URL of relevant `package.json` file
|
|
65
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
66
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
67
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
68
|
-
* @return {URL} Resolved package export URL
|
|
69
|
-
* @throws {NodeError<Error | TypeError>}
|
|
70
|
-
*/
|
|
71
|
-
resolvePackageExport(specifier: string, pkg: ModuleId, parent: ModuleId, condition?: string, conditions?: Set<string>): URL;
|
|
72
|
-
/**
|
|
73
|
-
* Resolves a subpath import according to the `PACKAGE_IMPORTS_RESOLVE`
|
|
74
|
-
* algorithm.
|
|
75
|
-
*
|
|
76
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
77
|
-
* @see https://nodejs.org/api/packages.html#subpath-imports
|
|
78
|
-
*
|
|
79
|
-
* @public
|
|
80
|
-
*
|
|
81
|
-
* @param {string} specifier - Module specifier containing subpath
|
|
82
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
83
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
84
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
85
|
-
* @return {URL} Resolved package import URL
|
|
86
|
-
* @throws {NodeError<Error | TypeError>}
|
|
87
|
-
*/
|
|
88
|
-
resolvePackageImport(specifier: string, parent: ModuleId, condition?: string, conditions?: Set<string>): URL;
|
|
89
|
-
/**
|
|
90
|
-
* Resolves a package entry point using the legacy CommonJS `main` resolution
|
|
91
|
-
* alogirthm:
|
|
92
|
-
*
|
|
93
|
-
* 1. let M = pkgdir `pkgjson.main`
|
|
94
|
-
* 2. TRY(M, M.js, M.json, M.node, M/index.js, M/index.json, M/index.node)
|
|
95
|
-
* 4. TRY(pkgdir/index.js, pkgdir/index.json, pkgdir/index.node)
|
|
96
|
-
* 5. ERR_MODULE_NOT_FOUND
|
|
97
|
-
*
|
|
98
|
-
* @todo emit deprecation messages
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
*
|
|
102
|
-
* @param {ModuleId} pkg - URL of relevant `package.json` file
|
|
103
|
-
* @param {PackageJson} pkgjson - Relevant `package.json` object
|
|
104
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
105
|
-
* @return {URL} Package entry point URL
|
|
106
|
-
* @throws {NodeError} If package entry point is not found
|
|
107
|
-
*/
|
|
108
|
-
resolvePackageMain(pkg: ModuleId, pkgjson: PackageJson, parent: ModuleId): URL;
|
|
109
|
-
/**
|
|
110
|
-
* Resolves a package target according to the `PACKAGE_TARGET_RESOLVE`
|
|
111
|
-
* algorithm.
|
|
112
|
-
*
|
|
113
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
114
|
-
*
|
|
115
|
-
* @todo emit deprecation messages
|
|
116
|
-
*
|
|
117
|
-
* @public
|
|
118
|
-
*
|
|
119
|
-
* @param {ModuleId} dir - URL of directory containing relevant `package.json`
|
|
120
|
-
* @param {Optional<Exports>} target - Package `exports` or `imports` target
|
|
121
|
-
* @param {string} subpath - Package subpath without entry prefix (`key`)
|
|
122
|
-
* @param {string} key - Subpath defined in relevant `package.json` file
|
|
123
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
124
|
-
* @param {boolean?} [internal=false] - Package `imports` hint
|
|
125
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
126
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
127
|
-
* @return {Nullable<URL>} Resolved package target URL or `null`
|
|
128
|
-
* @throws {NodeError<Error | TypeError>}
|
|
129
|
-
*/
|
|
130
|
-
resolvePackageTarget(dir: ModuleId, target: Optional<Exports>, subpath: string, key: string, parent: ModuleId, internal?: boolean, condition?: string, conditions?: Set<string>): Nullable<URL>;
|
|
131
|
-
}
|
|
132
|
-
export default Resolver;
|
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CONDITIONS,
|
|
3
|
-
PATTERN_CHARACTER,
|
|
4
|
-
isDirectory,
|
|
5
|
-
isExportsSugar,
|
|
6
|
-
isFile,
|
|
7
|
-
isRelativeSpecifier,
|
|
8
|
-
lookupPackageScope,
|
|
9
|
-
parseModuleId,
|
|
10
|
-
parseSubpath,
|
|
11
|
-
readPackageJson,
|
|
12
|
-
toNodeURL,
|
|
13
|
-
toURL
|
|
14
|
-
} from "../utils/index.mjs";
|
|
15
|
-
import {
|
|
16
|
-
ERR_INVALID_MODULE_SPECIFIER,
|
|
17
|
-
ERR_INVALID_PACKAGE_CONFIG,
|
|
18
|
-
ERR_INVALID_PACKAGE_TARGET,
|
|
19
|
-
ERR_MODULE_NOT_FOUND,
|
|
20
|
-
ERR_PACKAGE_IMPORT_NOT_DEFINED,
|
|
21
|
-
ERR_PACKAGE_PATH_NOT_EXPORTED,
|
|
22
|
-
ERR_UNSUPPORTED_DIR_IMPORT,
|
|
23
|
-
ErrorCode
|
|
24
|
-
} from "@flex-development/errnode";
|
|
25
|
-
import { isBuiltin } from "@flex-development/is-builtin";
|
|
26
|
-
import pathe from "@flex-development/pathe";
|
|
27
|
-
import {
|
|
28
|
-
DOT,
|
|
29
|
-
cast,
|
|
30
|
-
get,
|
|
31
|
-
ifelse,
|
|
32
|
-
includes,
|
|
33
|
-
isArray,
|
|
34
|
-
isArrayIndex,
|
|
35
|
-
isNIL,
|
|
36
|
-
isNull,
|
|
37
|
-
isObjectCurly,
|
|
38
|
-
isString,
|
|
39
|
-
join,
|
|
40
|
-
regexp
|
|
41
|
-
} from "@flex-development/tutils";
|
|
42
|
-
import fs from "node:fs";
|
|
43
|
-
import { URL, fileURLToPath, pathToFileURL } from "node:url";
|
|
44
|
-
import invalidSegmentRegex from "./regex-invalid-segment.mjs";
|
|
45
|
-
import PACKAGE_NAME_REGEX from "./regex-package-name.mjs";
|
|
46
|
-
import PACKAGE_PATH_REGEX from "./regex-package-path.mjs";
|
|
47
|
-
class Resolver {
|
|
48
|
-
/**
|
|
49
|
-
* Resolves `specifier` according to the [ESM Resolver algorithm][1].
|
|
50
|
-
*
|
|
51
|
-
* [1]: https://nodejs.org/api/esm.html#esm_resolver_algorithm
|
|
52
|
-
*
|
|
53
|
-
* @public
|
|
54
|
-
*
|
|
55
|
-
* @param {string} specifier - Module specifier to resolve
|
|
56
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
57
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
58
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
59
|
-
* @param {boolean?} [preserveSymlinks=false] - Skip resolving symlinks
|
|
60
|
-
* @return {URL} Resolved module URL
|
|
61
|
-
* @throws {NodeError}
|
|
62
|
-
*/
|
|
63
|
-
resolveModule(specifier, parent, condition = "default", conditions = CONDITIONS, preserveSymlinks = !1) {
|
|
64
|
-
parent = toURL(parent);
|
|
65
|
-
const remote = /^https?:$/.test(parent.protocol);
|
|
66
|
-
let error = new ERR_MODULE_NOT_FOUND(
|
|
67
|
-
specifier,
|
|
68
|
-
remote ? parent.href : fileURLToPath(parent),
|
|
69
|
-
PACKAGE_PATH_REGEX.test(specifier) ? "package" : "module"
|
|
70
|
-
), url = null;
|
|
71
|
-
try {
|
|
72
|
-
switch (!0) {
|
|
73
|
-
case isRelativeSpecifier(specifier):
|
|
74
|
-
case pathe.isAbsolute(specifier):
|
|
75
|
-
url = new URL(specifier, parent);
|
|
76
|
-
break;
|
|
77
|
-
case (!remote && specifier.startsWith("#")):
|
|
78
|
-
url = this.resolvePackageImport(
|
|
79
|
-
specifier,
|
|
80
|
-
parent,
|
|
81
|
-
condition,
|
|
82
|
-
conditions
|
|
83
|
-
);
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
try {
|
|
87
|
-
url = new URL(specifier);
|
|
88
|
-
} catch {
|
|
89
|
-
remote || (url = this.resolvePackage(
|
|
90
|
-
specifier,
|
|
91
|
-
parent,
|
|
92
|
-
condition,
|
|
93
|
-
conditions
|
|
94
|
-
));
|
|
95
|
-
}
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
if (url && url.protocol === "file:") {
|
|
99
|
-
const path = fileURLToPath(url);
|
|
100
|
-
if (!isFile(path))
|
|
101
|
-
throw isDirectory(path) ? new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(parent)) : new ERR_MODULE_NOT_FOUND(path, fileURLToPath(parent), "module");
|
|
102
|
-
if (!preserveSymlinks) {
|
|
103
|
-
const { hash, search } = url;
|
|
104
|
-
url = pathToFileURL(fs.realpathSync(path)), url.hash = hash, url.search = search;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
} catch (e) {
|
|
108
|
-
error = cast(e), url = null;
|
|
109
|
-
}
|
|
110
|
-
if (!url)
|
|
111
|
-
throw error;
|
|
112
|
-
return url;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Resolves a package path using a combination of the following algorithms:
|
|
116
|
-
*
|
|
117
|
-
* - `PACKAGE_RESOLVE`
|
|
118
|
-
* - `PACKAGE_SELF_RESOLVE`
|
|
119
|
-
*
|
|
120
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
121
|
-
*
|
|
122
|
-
* @public
|
|
123
|
-
*
|
|
124
|
-
* @param {string} specifier - Module specifier to resolve
|
|
125
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
126
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
127
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
128
|
-
* @return {URL} Resolved package path URL
|
|
129
|
-
* @throws {NodeError}
|
|
130
|
-
*/
|
|
131
|
-
resolvePackage(specifier, parent, condition = "default", conditions = CONDITIONS) {
|
|
132
|
-
const id = parseModuleId(specifier, {
|
|
133
|
-
parent,
|
|
134
|
-
pkgname: !isBuiltin(specifier)
|
|
135
|
-
});
|
|
136
|
-
if (isBuiltin(id.raw))
|
|
137
|
-
return new URL(toNodeURL(id.raw));
|
|
138
|
-
const stopdir = pathToFileURL(DOT + pathe.sep);
|
|
139
|
-
let scope = lookupPackageScope(
|
|
140
|
-
parent,
|
|
141
|
-
stopdir,
|
|
142
|
-
specifier,
|
|
143
|
-
parent
|
|
144
|
-
);
|
|
145
|
-
if (scope?.pkgjson.name === id.pkg && !isNIL(scope.pkgjson.exports))
|
|
146
|
-
return this.resolvePackageExport(
|
|
147
|
-
id.raw,
|
|
148
|
-
scope.pkg,
|
|
149
|
-
parent,
|
|
150
|
-
condition,
|
|
151
|
-
conditions
|
|
152
|
-
);
|
|
153
|
-
let url = null;
|
|
154
|
-
if (scope) {
|
|
155
|
-
let { dir: pkgdir } = scope;
|
|
156
|
-
for (; pkgdir !== DOT && (scope = lookupPackageScope(
|
|
157
|
-
new URL(`node_modules/${id.raw}`, pkgdir + pathe.sep),
|
|
158
|
-
stopdir,
|
|
159
|
-
specifier,
|
|
160
|
-
parent
|
|
161
|
-
), !scope); )
|
|
162
|
-
pkgdir = pathe.dirname(pkgdir);
|
|
163
|
-
}
|
|
164
|
-
switch (!0) {
|
|
165
|
-
case (scope && !isNIL(scope.pkgjson.exports)):
|
|
166
|
-
url = this.resolvePackageExport(
|
|
167
|
-
specifier,
|
|
168
|
-
scope.pkg,
|
|
169
|
-
parent,
|
|
170
|
-
condition,
|
|
171
|
-
conditions
|
|
172
|
-
);
|
|
173
|
-
break;
|
|
174
|
-
case (scope && id.path === DOT):
|
|
175
|
-
url = this.resolvePackageMain(scope.pkg, scope.pkgjson, parent);
|
|
176
|
-
break;
|
|
177
|
-
case !!scope:
|
|
178
|
-
url = new URL(id.path, scope.pkg);
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
if (!url)
|
|
182
|
-
throw new ERR_MODULE_NOT_FOUND(id.pkg, fileURLToPath(parent));
|
|
183
|
-
return url;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Resolves a subpath export according to the `PACKAGE_EXPORTS_RESOLVE`
|
|
187
|
-
* algorithm.
|
|
188
|
-
*
|
|
189
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
190
|
-
* @see https://nodejs.org/api/packages.html#subpath-exports
|
|
191
|
-
*
|
|
192
|
-
* @public
|
|
193
|
-
*
|
|
194
|
-
* @param {string} specifier - Module specifier containing subpath
|
|
195
|
-
* @param {ModuleId} pkg - URL of relevant `package.json` file
|
|
196
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
197
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
198
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
199
|
-
* @return {URL} Resolved package export URL
|
|
200
|
-
* @throws {NodeError<Error | TypeError>}
|
|
201
|
-
*/
|
|
202
|
-
resolvePackageExport(specifier, pkg, parent, condition = "default", conditions = CONDITIONS) {
|
|
203
|
-
const dir = new URL(DOT, pkg);
|
|
204
|
-
let exports = readPackageJson(
|
|
205
|
-
dir,
|
|
206
|
-
specifier,
|
|
207
|
-
parent
|
|
208
|
-
)?.exports;
|
|
209
|
-
const subpath = parseSubpath(specifier, exports, {
|
|
210
|
-
dir,
|
|
211
|
-
parent
|
|
212
|
-
});
|
|
213
|
-
!subpath.internal && isExportsSugar(exports, pkg, parent) && (exports = cast({ [DOT]: exports }));
|
|
214
|
-
const url = this.resolvePackageTarget(
|
|
215
|
-
dir,
|
|
216
|
-
get(exports, subpath.key),
|
|
217
|
-
subpath.base,
|
|
218
|
-
subpath.key,
|
|
219
|
-
parent,
|
|
220
|
-
subpath.internal,
|
|
221
|
-
condition,
|
|
222
|
-
conditions
|
|
223
|
-
);
|
|
224
|
-
if (!url)
|
|
225
|
-
throw new ERR_PACKAGE_PATH_NOT_EXPORTED(
|
|
226
|
-
fileURLToPath(dir),
|
|
227
|
-
subpath.raw,
|
|
228
|
-
fileURLToPath(parent)
|
|
229
|
-
);
|
|
230
|
-
return url;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Resolves a subpath import according to the `PACKAGE_IMPORTS_RESOLVE`
|
|
234
|
-
* algorithm.
|
|
235
|
-
*
|
|
236
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
237
|
-
* @see https://nodejs.org/api/packages.html#subpath-imports
|
|
238
|
-
*
|
|
239
|
-
* @public
|
|
240
|
-
*
|
|
241
|
-
* @param {string} specifier - Module specifier containing subpath
|
|
242
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
243
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
244
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
245
|
-
* @return {URL} Resolved package import URL
|
|
246
|
-
* @throws {NodeError<Error | TypeError>}
|
|
247
|
-
*/
|
|
248
|
-
resolvePackageImport(specifier, parent, condition = "default", conditions = CONDITIONS) {
|
|
249
|
-
const id = parseModuleId(specifier, {
|
|
250
|
-
internal: !0,
|
|
251
|
-
parent
|
|
252
|
-
}), scope = lookupPackageScope(
|
|
253
|
-
parent,
|
|
254
|
-
pathToFileURL(DOT),
|
|
255
|
-
specifier,
|
|
256
|
-
parent
|
|
257
|
-
);
|
|
258
|
-
let url = null;
|
|
259
|
-
if (scope) {
|
|
260
|
-
const imports = scope.pkgjson.imports, subpath = parseSubpath(id.raw, imports, {
|
|
261
|
-
dir: scope.dir,
|
|
262
|
-
internal: !0,
|
|
263
|
-
parent
|
|
264
|
-
});
|
|
265
|
-
url = this.resolvePackageTarget(
|
|
266
|
-
scope.dir,
|
|
267
|
-
get(imports, cast(subpath.key)),
|
|
268
|
-
subpath.base,
|
|
269
|
-
subpath.key,
|
|
270
|
-
parent,
|
|
271
|
-
subpath.internal,
|
|
272
|
-
condition,
|
|
273
|
-
conditions
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
if (!url)
|
|
277
|
-
throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(
|
|
278
|
-
specifier,
|
|
279
|
-
fileURLToPath(parent),
|
|
280
|
-
/* c8 ignore next */
|
|
281
|
-
scope?.dir ? fileURLToPath(scope.dir) : void 0
|
|
282
|
-
);
|
|
283
|
-
return url;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Resolves a package entry point using the legacy CommonJS `main` resolution
|
|
287
|
-
* alogirthm:
|
|
288
|
-
*
|
|
289
|
-
* 1. let M = pkgdir `pkgjson.main`
|
|
290
|
-
* 2. TRY(M, M.js, M.json, M.node, M/index.js, M/index.json, M/index.node)
|
|
291
|
-
* 4. TRY(pkgdir/index.js, pkgdir/index.json, pkgdir/index.node)
|
|
292
|
-
* 5. ERR_MODULE_NOT_FOUND
|
|
293
|
-
*
|
|
294
|
-
* @todo emit deprecation messages
|
|
295
|
-
*
|
|
296
|
-
* @public
|
|
297
|
-
*
|
|
298
|
-
* @param {ModuleId} pkg - URL of relevant `package.json` file
|
|
299
|
-
* @param {PackageJson} pkgjson - Relevant `package.json` object
|
|
300
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
301
|
-
* @return {URL} Package entry point URL
|
|
302
|
-
* @throws {NodeError} If package entry point is not found
|
|
303
|
-
*/
|
|
304
|
-
resolvePackageMain(pkg, pkgjson, parent) {
|
|
305
|
-
const tries = [
|
|
306
|
-
...pkgjson.main ? [
|
|
307
|
-
pkgjson.main,
|
|
308
|
-
`./${pkgjson.main}.js`,
|
|
309
|
-
`./${pkgjson.main}.json`,
|
|
310
|
-
`./${pkgjson.main}.node`,
|
|
311
|
-
`./${pkgjson.main}/index.js`,
|
|
312
|
-
`./${pkgjson.main}/index.json`,
|
|
313
|
-
`./${pkgjson.main}/index.node`
|
|
314
|
-
] : [],
|
|
315
|
-
"./index.js",
|
|
316
|
-
"./index.json",
|
|
317
|
-
"./index.node"
|
|
318
|
-
];
|
|
319
|
-
let url = null;
|
|
320
|
-
for (const input of tries) {
|
|
321
|
-
if (isFile(url = new URL(input, pkg)))
|
|
322
|
-
break;
|
|
323
|
-
url = null;
|
|
324
|
-
}
|
|
325
|
-
if (!url)
|
|
326
|
-
throw new ERR_MODULE_NOT_FOUND(
|
|
327
|
-
fileURLToPath(new URL(DOT, pkg)),
|
|
328
|
-
fileURLToPath(parent)
|
|
329
|
-
);
|
|
330
|
-
return url;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Resolves a package target according to the `PACKAGE_TARGET_RESOLVE`
|
|
334
|
-
* algorithm.
|
|
335
|
-
*
|
|
336
|
-
* @see https://nodejs.org/api/esm.html#resolver-algorithm-specification
|
|
337
|
-
*
|
|
338
|
-
* @todo emit deprecation messages
|
|
339
|
-
*
|
|
340
|
-
* @public
|
|
341
|
-
*
|
|
342
|
-
* @param {ModuleId} dir - URL of directory containing relevant `package.json`
|
|
343
|
-
* @param {Optional<Exports>} target - Package `exports` or `imports` target
|
|
344
|
-
* @param {string} subpath - Package subpath without entry prefix (`key`)
|
|
345
|
-
* @param {string} key - Subpath defined in relevant `package.json` file
|
|
346
|
-
* @param {ModuleId} parent - URL of module to resolve from
|
|
347
|
-
* @param {boolean?} [internal=false] - Package `imports` hint
|
|
348
|
-
* @param {string?} [condition='default'] - Export condition to apply
|
|
349
|
-
* @param {Set<string>?} [conditions=CONDITIONS] - Export conditions
|
|
350
|
-
* @return {Nullable<URL>} Resolved package target URL or `null`
|
|
351
|
-
* @throws {NodeError<Error | TypeError>}
|
|
352
|
-
*/
|
|
353
|
-
resolvePackageTarget(dir, target, subpath, key, parent, internal = !1, condition = "default", conditions = CONDITIONS) {
|
|
354
|
-
let url = null;
|
|
355
|
-
switch (!0) {
|
|
356
|
-
case isNull(target):
|
|
357
|
-
break;
|
|
358
|
-
case isArray(target):
|
|
359
|
-
let error;
|
|
360
|
-
for (const item of cast(target)) {
|
|
361
|
-
try {
|
|
362
|
-
url = this.resolvePackageTarget(
|
|
363
|
-
dir,
|
|
364
|
-
item,
|
|
365
|
-
subpath,
|
|
366
|
-
key,
|
|
367
|
-
parent,
|
|
368
|
-
internal,
|
|
369
|
-
condition,
|
|
370
|
-
conditions
|
|
371
|
-
);
|
|
372
|
-
} catch (e) {
|
|
373
|
-
if (error = cast(e), error.code !== ErrorCode.ERR_INVALID_PACKAGE_TARGET)
|
|
374
|
-
throw error;
|
|
375
|
-
continue;
|
|
376
|
-
}
|
|
377
|
-
if (url) {
|
|
378
|
-
error = void 0;
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
if (error)
|
|
383
|
-
throw error;
|
|
384
|
-
break;
|
|
385
|
-
case isObjectCurly(target):
|
|
386
|
-
target = cast(target);
|
|
387
|
-
for (const prop of Object.getOwnPropertyNames(target)) {
|
|
388
|
-
if (isArrayIndex(prop))
|
|
389
|
-
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
390
|
-
fileURLToPath(dir).replace(/\/$/, "") + "/package.json",
|
|
391
|
-
fileURLToPath(parent),
|
|
392
|
-
'"exports" cannot contain numeric property keys'
|
|
393
|
-
);
|
|
394
|
-
if ((prop === condition || conditions.has(prop)) && (url = this.resolvePackageTarget(
|
|
395
|
-
dir,
|
|
396
|
-
get(target, prop),
|
|
397
|
-
subpath,
|
|
398
|
-
key,
|
|
399
|
-
parent,
|
|
400
|
-
internal,
|
|
401
|
-
condition,
|
|
402
|
-
conditions
|
|
403
|
-
), url))
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
break;
|
|
407
|
-
case isString(target):
|
|
408
|
-
target = cast(target);
|
|
409
|
-
const pattern = includes(key, PATTERN_CHARACTER);
|
|
410
|
-
switch (!0) {
|
|
411
|
-
case (subpath && !pattern && !target.endsWith(pathe.sep)):
|
|
412
|
-
throw new ERR_INVALID_PACKAGE_TARGET(
|
|
413
|
-
fileURLToPath(dir),
|
|
414
|
-
key,
|
|
415
|
-
target,
|
|
416
|
-
internal,
|
|
417
|
-
fileURLToPath(parent)
|
|
418
|
-
);
|
|
419
|
-
case (internal && PACKAGE_NAME_REGEX.test(target)):
|
|
420
|
-
url = this.resolvePackage(target, parent, condition, conditions);
|
|
421
|
-
break;
|
|
422
|
-
case target.startsWith(DOT + pathe.sep):
|
|
423
|
-
if (invalidSegmentRegex().test(target.slice(2)) && invalidSegmentRegex("deprecated").test(target.slice(2)))
|
|
424
|
-
throw new ERR_INVALID_PACKAGE_TARGET(
|
|
425
|
-
fileURLToPath(dir),
|
|
426
|
-
key,
|
|
427
|
-
target,
|
|
428
|
-
internal,
|
|
429
|
-
fileURLToPath(parent)
|
|
430
|
-
);
|
|
431
|
-
if (url = new URL(
|
|
432
|
-
target,
|
|
433
|
-
pathToFileURL(fileURLToPath(dir).replace(/\/$/, "") + pathe.sep)
|
|
434
|
-
), subpath) {
|
|
435
|
-
if (invalidSegmentRegex().test(subpath) && invalidSegmentRegex("deprecated").test(subpath))
|
|
436
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
437
|
-
key.replace(PATTERN_CHARACTER, subpath),
|
|
438
|
-
join(
|
|
439
|
-
[
|
|
440
|
-
`request is not a valid match in pattern "${key}" for`,
|
|
441
|
-
`the "${ifelse(internal, "imports", "exports")}"`,
|
|
442
|
-
"resolution of",
|
|
443
|
-
`${fileURLToPath(dir).replace(/\/$/, "")}/package.json`
|
|
444
|
-
],
|
|
445
|
-
" "
|
|
446
|
-
),
|
|
447
|
-
fileURLToPath(parent)
|
|
448
|
-
);
|
|
449
|
-
url = new URL(
|
|
450
|
-
url.href.replace(
|
|
451
|
-
new RegExp(regexp(PATTERN_CHARACTER), "g"),
|
|
452
|
-
subpath
|
|
453
|
-
)
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
|
-
break;
|
|
457
|
-
default:
|
|
458
|
-
throw new ERR_INVALID_PACKAGE_TARGET(
|
|
459
|
-
fileURLToPath(dir),
|
|
460
|
-
key,
|
|
461
|
-
target,
|
|
462
|
-
internal,
|
|
463
|
-
fileURLToPath(parent)
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
break;
|
|
467
|
-
default:
|
|
468
|
-
throw new ERR_INVALID_PACKAGE_TARGET(
|
|
469
|
-
fileURLToPath(dir),
|
|
470
|
-
key,
|
|
471
|
-
target,
|
|
472
|
-
internal,
|
|
473
|
-
fileURLToPath(parent)
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
return url;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
var resolver_default = Resolver;
|
|
480
|
-
export {
|
|
481
|
-
resolver_default as default
|
|
482
|
-
};
|
|
483
|
-
//# sourceMappingURL=resolver.mjs.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/internal/resolver.ts"],
|
|
4
|
-
"sourceRoot": "file://",
|
|
5
|
-
"sourcesContent": ["/**\n * @file Internal - Resolver\n * @module mlly/internal/Resolver\n */\n\nimport type {\n PackageScope,\n ParsedModuleId,\n ParsedSubpath\n} from '#src/interfaces'\nimport type { ModuleId } from '#src/types'\nimport {\n CONDITIONS,\n PATTERN_CHARACTER,\n isDirectory,\n isExportsSugar,\n isFile,\n isRelativeSpecifier,\n lookupPackageScope,\n parseModuleId,\n parseSubpath,\n readPackageJson,\n toNodeURL,\n toURL\n} from '#src/utils'\nimport {\n ERR_INVALID_MODULE_SPECIFIER,\n ERR_INVALID_PACKAGE_CONFIG,\n ERR_INVALID_PACKAGE_TARGET,\n ERR_MODULE_NOT_FOUND,\n ERR_PACKAGE_IMPORT_NOT_DEFINED,\n ERR_PACKAGE_PATH_NOT_EXPORTED,\n ERR_UNSUPPORTED_DIR_IMPORT,\n ErrorCode,\n type NodeError\n} from '@flex-development/errnode'\nimport { isBuiltin } from '@flex-development/is-builtin'\nimport pathe from '@flex-development/pathe'\nimport type {\n Exports,\n Imports,\n ImportsKey,\n PackageJson\n} from '@flex-development/pkg-types'\nimport {\n DOT,\n cast,\n get,\n ifelse,\n includes,\n isArray,\n isArrayIndex,\n isNIL,\n isNull,\n isObjectCurly,\n isString,\n join,\n regexp,\n type Nullable,\n type Optional\n} from '@flex-development/tutils'\nimport fs from 'node:fs'\nimport { URL, fileURLToPath, pathToFileURL } from 'node:url'\nimport invalidSegmentRegex from './regex-invalid-segment'\nimport PACKAGE_NAME_REGEX from './regex-package-name'\nimport PACKAGE_PATH_REGEX from './regex-package-path'\n\n/**\n * ECMAScript (ES) module resolver.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm\n *\n * @internal\n *\n * @class\n */\nclass Resolver {\n /**\n * Resolves `specifier` according to the [ESM Resolver algorithm][1].\n *\n * [1]: https://nodejs.org/api/esm.html#esm_resolver_algorithm\n *\n * @public\n *\n * @param {string} specifier - Module specifier to resolve\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @param {boolean?} [preserveSymlinks=false] - Skip resolving symlinks\n * @return {URL} Resolved module URL\n * @throws {NodeError}\n */\n public resolveModule(\n specifier: string,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS,\n preserveSymlinks: boolean = false\n ): URL {\n // ensure parent is an instance of URL\n parent = toURL(parent)\n\n /**\n * Remote module check for {@linkcode parent}.\n *\n * @const {boolean} remote\n */\n const remote: boolean = /^https?:$/.test(parent.protocol)\n\n /**\n * Module resolution error.\n *\n * @var {NodeError} error\n */\n let error: NodeError = new ERR_MODULE_NOT_FOUND(\n specifier,\n remote ? parent.href : fileURLToPath(parent),\n PACKAGE_PATH_REGEX.test(specifier) ? 'package' : 'module'\n )\n\n /**\n * Resolved module URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving module\n try {\n switch (true) {\n case isRelativeSpecifier(specifier):\n case pathe.isAbsolute(specifier):\n url = new URL(specifier, parent)\n break\n case !remote && specifier.startsWith('#'):\n url = this.resolvePackageImport(\n specifier,\n parent,\n condition,\n conditions\n )\n break\n default:\n try {\n url = new URL(specifier)\n } catch {\n if (!remote) {\n url = this.resolvePackage(\n specifier,\n parent,\n condition,\n conditions\n )\n }\n }\n\n break\n }\n\n // finalize resolution\n if (url && url.protocol === 'file:') {\n /**\n * Absolute path to resolved module.\n *\n * @var {string} path\n */\n const path: string = fileURLToPath(url)\n\n // throw if resolved module is not a file\n if (!isFile(path)) {\n throw isDirectory(path)\n ? new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(parent))\n : new ERR_MODULE_NOT_FOUND(path, fileURLToPath(parent), 'module')\n }\n\n // resolve symlinks\n if (!preserveSymlinks) {\n // preserve fragment and query portions of module url\n const { hash, search } = url\n\n // remove symlinks in module url\n url = pathToFileURL(fs.realpathSync(path))\n\n // re-add fragment and query portions of module url\n url.hash = hash\n url.search = search\n }\n }\n } catch (e: unknown) {\n error = cast(e)\n url = null\n }\n\n // throw if specifier could not be resolved\n if (!url) throw error\n\n return url\n }\n\n /**\n * Resolves a package path using a combination of the following algorithms:\n *\n * - `PACKAGE_RESOLVE`\n * - `PACKAGE_SELF_RESOLVE`\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n *\n * @public\n *\n * @param {string} specifier - Module specifier to resolve\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {URL} Resolved package path URL\n * @throws {NodeError}\n */\n public resolvePackage(\n specifier: string,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): URL {\n /**\n * Object representation of {@linkcode specifier}.\n *\n * @const {ParsedModuleId} id\n */\n const id: ParsedModuleId = parseModuleId(specifier, {\n parent,\n pkgname: !isBuiltin(specifier)\n })\n\n // exit early if specifier is builtin module\n if (isBuiltin(id.raw)) return new URL(toNodeURL(id.raw))\n\n /**\n * Directory to end package scope search.\n *\n * @const {URL} stopdir\n */\n const stopdir: URL = pathToFileURL(DOT + pathe.sep)\n\n /**\n * Package scope lookup result.\n *\n * @var {Nullable<PackageScope>} scope\n */\n let scope: Nullable<PackageScope> = lookupPackageScope(\n parent,\n stopdir,\n specifier,\n parent\n )\n\n // try self resolve\n if (scope?.pkgjson.name === id.pkg && !isNIL(scope.pkgjson.exports)) {\n return this.resolvePackageExport(\n id.raw,\n scope.pkg,\n parent,\n condition,\n conditions\n )\n }\n\n /**\n * Resolved package path URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // reset scope to try resolving external package\n if (scope) {\n let { dir: pkgdir } = scope\n\n // lookup package scope for external package\n while (pkgdir !== DOT) {\n scope = lookupPackageScope(\n new URL(`node_modules/${id.raw}`, pkgdir + pathe.sep),\n stopdir,\n specifier,\n parent\n )\n\n // stop search if package scope was found for external package\n if (scope) break\n\n // continue package scope search\n pkgdir = pathe.dirname(pkgdir)\n }\n }\n\n // try resolving external package\n switch (true) {\n case scope && !isNIL(scope.pkgjson.exports):\n url = this.resolvePackageExport(\n specifier,\n scope!.pkg,\n parent,\n condition,\n conditions\n )\n break\n case scope && id.path === DOT:\n url = this.resolvePackageMain(scope!.pkg, scope!.pkgjson, parent)\n break\n case !!scope:\n url = new URL(id.path, scope!.pkg)\n break\n }\n\n // throw if package url was not resolved\n if (!url) throw new ERR_MODULE_NOT_FOUND(id.pkg, fileURLToPath(parent))\n\n return url\n }\n\n /**\n * Resolves a subpath export according to the `PACKAGE_EXPORTS_RESOLVE`\n * algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n * @see https://nodejs.org/api/packages.html#subpath-exports\n *\n * @public\n *\n * @param {string} specifier - Module specifier containing subpath\n * @param {ModuleId} pkg - URL of relevant `package.json` file\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {URL} Resolved package export URL\n * @throws {NodeError<Error | TypeError>}\n */\n public resolvePackageExport(\n specifier: string,\n pkg: ModuleId,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): URL {\n /**\n * URL of directory containing `package.json` file.\n *\n * @var {URL} dir\n */\n const dir: URL = new URL(DOT, pkg)\n\n /**\n * Possible `package.json` object.\n *\n * @const {PackageJson} pkgjson\n */\n const pkgjson: Nullable<PackageJson> = readPackageJson(\n dir,\n specifier,\n parent\n )\n\n /**\n * Package `exports`.\n *\n * @var {Optional<Exports>} exports\n */\n let exports: Optional<Exports> = pkgjson?.exports\n\n /**\n * Object representation of package subpath.\n *\n * @const {ParsedSubpath} subpath\n */\n const subpath: ParsedSubpath = parseSubpath(specifier, exports, {\n dir,\n parent\n })\n\n // convert exports to object if using exports main sugar\n if (!subpath.internal && isExportsSugar(exports, pkg, parent)) {\n exports = cast({ [DOT]: exports })\n }\n\n /**\n * Resolved package export URL.\n *\n * @const {Nullable<URL>} url\n */\n const url: Nullable<URL> = this.resolvePackageTarget(\n dir,\n get(exports, subpath.key),\n subpath.base,\n subpath.key,\n parent,\n subpath.internal,\n condition,\n conditions\n )\n\n // throw if subpath export was not resolved\n if (!url) {\n throw new ERR_PACKAGE_PATH_NOT_EXPORTED(\n fileURLToPath(dir),\n subpath.raw,\n fileURLToPath(parent)\n )\n }\n\n return url\n }\n\n /**\n * Resolves a subpath import according to the `PACKAGE_IMPORTS_RESOLVE`\n * algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n * @see https://nodejs.org/api/packages.html#subpath-imports\n *\n * @public\n *\n * @param {string} specifier - Module specifier containing subpath\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {URL} Resolved package import URL\n * @throws {NodeError<Error | TypeError>}\n */\n public resolvePackageImport(\n specifier: string,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): URL {\n /**\n * Parsed module id.\n *\n * Ensures {@linkcode specifier} is a valid internal specifier.\n *\n * @const {ParsedModuleId} id\n */\n const id: ParsedModuleId = parseModuleId(specifier, {\n internal: true,\n parent\n })\n\n /**\n * Package scope result for {@linkcode parent}.\n *\n * @const {Nullable<PackageScope>} scope\n */\n const scope: Nullable<PackageScope> = lookupPackageScope(\n parent,\n pathToFileURL(DOT),\n specifier,\n parent\n )\n\n /**\n * Resolved package import URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving subpath import\n if (scope) {\n /**\n * Package `imports`.\n *\n * @const {Optional<Imports>} imports\n */\n const imports: Optional<Imports> = scope.pkgjson.imports\n\n /**\n * Object representation of package subpath.\n *\n * @const {ParsedSubpath} subpath\n */\n const subpath: ParsedSubpath = parseSubpath(id.raw, imports, {\n dir: scope.dir,\n internal: true,\n parent\n })\n\n url = this.resolvePackageTarget(\n scope.dir,\n get(imports, cast<ImportsKey>(subpath.key)),\n subpath.base,\n subpath.key,\n parent,\n subpath.internal,\n condition,\n conditions\n )\n }\n\n // throw if subpath import was not resolved\n if (!url) {\n throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(\n specifier,\n fileURLToPath(parent),\n /* c8 ignore next */ scope?.dir ? fileURLToPath(scope.dir) : undefined\n )\n }\n\n return url\n }\n\n /**\n * Resolves a package entry point using the legacy CommonJS `main` resolution\n * alogirthm:\n *\n * 1. let M = pkgdir `pkgjson.main`\n * 2. TRY(M, M.js, M.json, M.node, M/index.js, M/index.json, M/index.node)\n * 4. TRY(pkgdir/index.js, pkgdir/index.json, pkgdir/index.node)\n * 5. ERR_MODULE_NOT_FOUND\n *\n * @todo emit deprecation messages\n *\n * @public\n *\n * @param {ModuleId} pkg - URL of relevant `package.json` file\n * @param {PackageJson} pkgjson - Relevant `package.json` object\n * @param {ModuleId} parent - URL of module to resolve from\n * @return {URL} Package entry point URL\n * @throws {NodeError} If package entry point is not found\n */\n public resolvePackageMain(\n pkg: ModuleId,\n pkgjson: PackageJson,\n parent: ModuleId\n ): URL {\n /**\n * Possible inputs for package entry point URL.\n *\n * @const {string[]} tries\n */\n const tries: string[] = [\n ...(pkgjson.main\n ? [\n pkgjson.main,\n `./${pkgjson.main}.js`,\n `./${pkgjson.main}.json`,\n `./${pkgjson.main}.node`,\n `./${pkgjson.main}/index.js`,\n `./${pkgjson.main}/index.json`,\n `./${pkgjson.main}/index.node`\n ]\n : []),\n './index.js',\n './index.json',\n './index.node'\n ]\n\n /**\n * Package entry point URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving package entry point\n for (const input of tries) {\n if (isFile((url = new URL(input, pkg)))) break\n url = null\n }\n\n // throw if package entry point was not resolved\n if (!url) {\n throw new ERR_MODULE_NOT_FOUND(\n fileURLToPath(new URL(DOT, pkg)),\n fileURLToPath(parent)\n )\n }\n\n return url\n }\n\n /**\n * Resolves a package target according to the `PACKAGE_TARGET_RESOLVE`\n * algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n *\n * @todo emit deprecation messages\n *\n * @public\n *\n * @param {ModuleId} dir - URL of directory containing relevant `package.json`\n * @param {Optional<Exports>} target - Package `exports` or `imports` target\n * @param {string} subpath - Package subpath without entry prefix (`key`)\n * @param {string} key - Subpath defined in relevant `package.json` file\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {boolean?} [internal=false] - Package `imports` hint\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {Nullable<URL>} Resolved package target URL or `null`\n * @throws {NodeError<Error | TypeError>}\n */\n public resolvePackageTarget(\n dir: ModuleId,\n target: Optional<Exports>,\n subpath: string,\n key: string,\n parent: ModuleId,\n internal: boolean = false,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): Nullable<URL> {\n /**\n * Resolved package target URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving package target\n switch (true) {\n case isNull(target):\n break\n case isArray(target):\n /**\n * Possible package target resolution error.\n *\n * @var {Optional<NodeError>} error\n */\n let error: Optional<NodeError>\n\n // try resolving package target based on first match in target array\n for (const item of cast<string[]>(target)) {\n try {\n url = this.resolvePackageTarget(\n dir,\n item,\n subpath,\n key,\n parent,\n internal,\n condition,\n conditions\n )\n } catch (e: unknown) {\n error = cast<NodeError>(e)\n\n /* c8 ignore next */\n if (error.code !== ErrorCode.ERR_INVALID_PACKAGE_TARGET) throw error\n\n continue\n }\n\n // stop resolution attempts if target was resolved\n if (url) {\n error = undefined\n break\n }\n }\n\n // throw if error was encountered and package target was not resolved\n if (error) throw error\n\n break\n case isObjectCurly(target):\n target = cast<Record<string, Exports>>(target)\n\n for (const prop of Object.getOwnPropertyNames(target)) {\n // ensure prop is not an array index\n if (isArrayIndex(prop)) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(dir).replace(/\\/$/, '') + '/package.json',\n fileURLToPath(parent),\n '\"exports\" cannot contain numeric property keys'\n )\n }\n\n // try resolving package target based on condition\n if (prop === condition || conditions.has(prop)) {\n url = this.resolvePackageTarget(\n dir,\n get(target, prop),\n subpath,\n key,\n parent,\n internal,\n condition,\n conditions\n )\n\n // stop resolution attempts if target was resolved\n if (url) break\n }\n }\n\n break\n case isString(target):\n target = cast<string>(target)\n\n /**\n * Subpath pattern check.\n *\n * @const {boolean} pattern\n */\n const pattern: boolean = includes(key, PATTERN_CHARACTER)\n\n switch (true) {\n case subpath && !pattern && !target.endsWith(pathe.sep):\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n case internal && PACKAGE_NAME_REGEX.test(target):\n url = this.resolvePackage(target, parent, condition, conditions)\n break\n case target.startsWith(DOT + pathe.sep):\n // check target for invalid segments\n if (invalidSegmentRegex().test(target.slice(2))) {\n if (invalidSegmentRegex('deprecated').test(target.slice(2))) {\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n }\n }\n\n // set resolved package target url using target\n url = new URL(\n target,\n pathToFileURL(fileURLToPath(dir).replace(/\\/$/, '') + pathe.sep)\n )\n\n // check subpath for invalid segments\n if (subpath) {\n if (invalidSegmentRegex().test(subpath)) {\n if (invalidSegmentRegex('deprecated').test(subpath)) {\n throw new ERR_INVALID_MODULE_SPECIFIER(\n key.replace(PATTERN_CHARACTER, subpath),\n join(\n [\n `request is not a valid match in pattern \"${key}\" for`,\n `the \"${ifelse(internal, 'imports', 'exports')}\"`,\n 'resolution of',\n `${fileURLToPath(dir).replace(/\\/$/, '')}/package.json`\n ],\n ' '\n ),\n fileURLToPath(parent)\n )\n }\n }\n\n // set resolved package target url using subpath\n url = new URL(\n url.href.replace(\n new RegExp(regexp(PATTERN_CHARACTER), 'g'),\n subpath\n )\n )\n }\n\n break\n default:\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n }\n\n break\n default:\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n }\n\n return url\n }\n}\n\nexport default Resolver\n"],
|
|
6
|
-
"mappings": "AAWA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAC1B,OAAO,WAAW;AAOlB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,OAAO,QAAQ;AACf,SAAS,KAAK,eAAe,qBAAqB;AAClD,OAAO,y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