@flex-development/mlly 1.0.0-alpha.1 → 1.0.0-alpha.11
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 +431 -3
- package/README.md +6 -4
- package/changelog.config.ts +404 -0
- package/dist/enums/assert-type.d.mts +21 -0
- package/dist/enums/assert-type.mjs +10 -0
- package/dist/enums/assert-type.mjs.map +6 -0
- package/dist/enums/format.d.mts +17 -0
- package/dist/enums/format.mjs +13 -0
- package/dist/enums/format.mjs.map +6 -0
- package/dist/enums/index.d.mts +10 -0
- package/dist/enums/index.mjs +15 -0
- package/dist/enums/index.mjs.map +6 -0
- package/dist/enums/kind-specifier-syntax.d.mts +14 -0
- package/dist/enums/kind-specifier-syntax.mjs +10 -0
- package/dist/enums/kind-specifier-syntax.mjs.map +6 -0
- package/dist/enums/kind-specifier.d.mts +17 -0
- package/dist/enums/kind-specifier.mjs +11 -0
- package/dist/enums/kind-specifier.mjs.map +6 -0
- package/dist/enums/kind-statement-syntax.d.mts +22 -0
- package/dist/enums/kind-statement-syntax.mjs +18 -0
- package/dist/enums/kind-statement-syntax.mjs.map +6 -0
- package/dist/enums/kind-statement.d.mts +15 -0
- package/dist/enums/kind-statement.mjs +11 -0
- package/dist/enums/kind-statement.mjs.map +6 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +6 -0
- package/dist/interfaces/import-assertions.d.mts +20 -0
- package/dist/interfaces/import-dynamic.d.mts +26 -6
- package/dist/interfaces/import-static.d.mts +22 -4
- package/dist/interfaces/index.d.mts +12 -0
- package/dist/interfaces/index.mjs +1 -0
- package/dist/interfaces/index.mjs.map +6 -0
- package/dist/interfaces/options-fill-module.d.mts +23 -0
- package/dist/interfaces/options-find-subpath.d.mts +49 -0
- package/dist/interfaces/options-get-format.d.mts +83 -0
- package/dist/interfaces/options-get-source.d.mts +63 -0
- package/dist/interfaces/options-parse-module-id.d.mts +33 -0
- package/dist/interfaces/options-parse-subpath.d.mts +31 -0
- package/dist/interfaces/options-resolve-alias.d.mts +26 -42
- package/dist/interfaces/options-resolve-module.d.mts +64 -0
- package/dist/interfaces/options-resolve.d.mts +7 -52
- package/dist/interfaces/package-scope.d.mts +25 -0
- package/dist/interfaces/parsed-data-url.d.mts +56 -0
- package/dist/interfaces/parsed-module-id.d.mts +80 -0
- package/dist/interfaces/parsed-subpath.d.mts +40 -0
- package/dist/interfaces/statement-export.d.mts +22 -9
- package/dist/interfaces/statement-import.d.mts +15 -4
- package/dist/interfaces/statement-require.d.mts +15 -4
- package/dist/interfaces/statement.d.mts +24 -8
- package/dist/internal/escape-reg-exp.d.mts +16 -0
- package/dist/internal/escape-reg-exp.mjs +10 -0
- package/dist/internal/escape-reg-exp.mjs.map +6 -0
- package/dist/internal/format-type-map.d.mts +17 -0
- package/dist/internal/format-type-map.mjs +13 -0
- package/dist/internal/format-type-map.mjs.map +6 -0
- package/dist/internal/get-specifier-kind.d.mts +17 -0
- package/dist/internal/get-specifier-kind.mjs +14 -0
- package/dist/internal/get-specifier-kind.mjs.map +6 -0
- package/dist/internal/get-subpaths.d.mts +25 -0
- package/dist/internal/get-subpaths.mjs +10 -0
- package/dist/internal/get-subpaths.mjs.map +6 -0
- package/dist/internal/is-array-index.d.mts +15 -0
- package/dist/internal/is-array-index.mjs +9 -0
- package/dist/internal/is-array-index.mjs.map +6 -0
- package/dist/internal/is-directory.d.mts +13 -0
- package/dist/internal/is-directory.mjs +16 -0
- package/dist/internal/is-directory.mjs.map +6 -0
- package/dist/internal/is-file.d.mts +13 -0
- package/dist/internal/is-file.mjs +16 -0
- package/dist/internal/is-file.mjs.map +6 -0
- package/dist/internal/is-function.d.mts +12 -0
- package/dist/internal/is-function.mjs +8 -0
- package/dist/internal/is-function.mjs.map +6 -0
- package/dist/internal/regex-encoded-sep.d.mts +13 -0
- package/dist/internal/regex-encoded-sep.mjs +6 -0
- package/dist/internal/regex-encoded-sep.mjs.map +6 -0
- package/dist/internal/regex-internal-specifier.d.mts +14 -0
- package/dist/internal/regex-internal-specifier.mjs +6 -0
- package/dist/internal/regex-internal-specifier.mjs.map +6 -0
- package/dist/internal/regex-package-name.d.mts +13 -0
- package/dist/internal/regex-package-name.mjs +6 -0
- package/dist/internal/regex-package-name.mjs.map +6 -0
- package/dist/internal/regex-package-path.d.mts +15 -0
- package/dist/internal/regex-package-path.mjs +6 -0
- package/dist/internal/regex-package-path.mjs.map +6 -0
- package/dist/internal/resolver.d.mts +130 -0
- package/dist/internal/resolver.mjs +500 -0
- package/dist/internal/resolver.mjs.map +6 -0
- package/dist/internal/validate-boolean.d.mts +20 -0
- package/dist/internal/validate-boolean.mjs +11 -0
- package/dist/internal/validate-boolean.mjs.map +6 -0
- package/dist/internal/validate-object.d.mts +23 -0
- package/dist/internal/validate-object.mjs +11 -0
- package/dist/internal/validate-object.mjs.map +6 -0
- package/dist/internal/validate-set.d.mts +23 -0
- package/dist/internal/validate-set.mjs +11 -0
- package/dist/internal/validate-set.mjs.map +6 -0
- package/dist/internal/validate-string.d.mts +20 -0
- package/dist/internal/validate-string.mjs +11 -0
- package/dist/internal/validate-string.mjs.map +6 -0
- package/dist/internal/validate-url-string.d.mts +22 -0
- package/dist/internal/validate-url-string.mjs +12 -0
- package/dist/internal/validate-url-string.mjs.map +6 -0
- package/dist/types/declaration.d.mts +1 -1
- package/dist/types/fn-change-ext.d.mts +28 -0
- package/dist/types/index.d.mts +8 -4
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +6 -0
- package/dist/types/mime-type.d.mts +7 -5
- package/dist/types/module-id.d.mts +13 -0
- package/dist/types/module-specifier-type.d.mts +11 -0
- package/dist/types/protocol.d.mts +14 -0
- package/dist/types/syntax-kind-export.d.mts +12 -0
- package/dist/types/syntax-kind-import.d.mts +12 -0
- package/dist/types/syntax-kind-require.d.mts +12 -0
- package/dist/utils/compare-subpaths.d.mts +25 -0
- package/dist/utils/compare-subpaths.mjs +24 -0
- package/dist/utils/compare-subpaths.mjs.map +6 -0
- package/dist/utils/conditions.d.mts +13 -0
- package/dist/utils/conditions.mjs +6 -0
- package/dist/utils/conditions.mjs.map +6 -0
- package/dist/{lib → utils}/detect-syntax.d.mts +4 -4
- package/dist/{lib → utils}/detect-syntax.mjs +1 -0
- package/dist/utils/detect-syntax.mjs.map +6 -0
- package/dist/utils/extension-format-map.d.mts +16 -0
- package/dist/utils/extension-format-map.mjs +22 -0
- package/dist/utils/extension-format-map.mjs.map +6 -0
- package/dist/utils/extract-statements.d.mts +21 -0
- package/dist/{lib → utils}/extract-statements.mjs +4 -1
- package/dist/utils/extract-statements.mjs.map +6 -0
- package/dist/utils/fill-modules.d.mts +23 -0
- package/dist/utils/fill-modules.mjs +64 -0
- package/dist/utils/fill-modules.mjs.map +6 -0
- package/dist/utils/find-dynamic-imports.d.mts +18 -0
- package/dist/utils/find-dynamic-imports.mjs +39 -0
- package/dist/utils/find-dynamic-imports.mjs.map +6 -0
- package/dist/utils/find-exports.d.mts +21 -0
- package/dist/utils/find-exports.mjs +95 -0
- package/dist/utils/find-exports.mjs.map +6 -0
- package/dist/utils/find-requires.d.mts +18 -0
- package/dist/utils/find-requires.mjs +32 -0
- package/dist/utils/find-requires.mjs.map +6 -0
- package/dist/utils/find-static-imports.d.mts +18 -0
- package/dist/utils/find-static-imports.mjs +34 -0
- package/dist/utils/find-static-imports.mjs.map +6 -0
- package/dist/utils/find-subpath.d.mts +30 -0
- package/dist/utils/find-subpath.mjs +106 -0
- package/dist/utils/find-subpath.mjs.map +6 -0
- package/dist/utils/get-format.d.mts +24 -0
- package/dist/utils/get-format.mjs +111 -0
- package/dist/utils/get-format.mjs.map +6 -0
- package/dist/utils/get-source.d.mts +22 -0
- package/dist/utils/get-source.mjs +63 -0
- package/dist/utils/get-source.mjs.map +6 -0
- package/dist/{lib → utils}/has-cjs-syntax.d.mts +5 -2
- package/dist/utils/has-cjs-syntax.mjs +11 -0
- package/dist/utils/has-cjs-syntax.mjs.map +6 -0
- package/dist/{lib → utils}/has-esm-syntax.d.mts +5 -2
- package/dist/utils/has-esm-syntax.mjs +11 -0
- package/dist/utils/has-esm-syntax.mjs.map +6 -0
- package/dist/utils/index.d.mts +42 -0
- package/dist/utils/index.mjs +79 -0
- package/dist/utils/index.mjs.map +6 -0
- package/dist/utils/is-absolute-specifier.d.mts +19 -0
- package/dist/utils/is-absolute-specifier.mjs +25 -0
- package/dist/utils/is-absolute-specifier.mjs.map +6 -0
- package/dist/utils/is-bare-specifier.d.mts +19 -0
- package/dist/utils/is-bare-specifier.mjs +10 -0
- package/dist/utils/is-bare-specifier.mjs.map +6 -0
- package/dist/utils/is-exports-sugar.d.mts +25 -0
- package/dist/utils/is-exports-sugar.mjs +26 -0
- package/dist/utils/is-exports-sugar.mjs.map +6 -0
- package/dist/utils/is-relative-specifier.d.mts +20 -0
- package/dist/utils/is-relative-specifier.mjs +11 -0
- package/dist/utils/is-relative-specifier.mjs.map +6 -0
- package/dist/utils/lookup-package-scope.d.mts +26 -0
- package/dist/utils/lookup-package-scope.mjs +38 -0
- package/dist/utils/lookup-package-scope.mjs.map +6 -0
- package/dist/utils/parse-data-url.d.mts +25 -0
- package/dist/utils/parse-data-url.mjs +25 -0
- package/dist/utils/parse-data-url.mjs.map +6 -0
- package/dist/utils/parse-module-id.d.mts +22 -0
- package/dist/utils/parse-module-id.mjs +122 -0
- package/dist/utils/parse-module-id.mjs.map +6 -0
- package/dist/utils/parse-subpath.d.mts +35 -0
- package/dist/utils/parse-subpath.mjs +54 -0
- package/dist/utils/parse-subpath.mjs.map +6 -0
- package/dist/utils/pattern-character.d.mts +11 -0
- package/dist/utils/pattern-character.mjs +6 -0
- package/dist/utils/pattern-character.mjs.map +6 -0
- package/dist/utils/read-package-json.d.mts +26 -0
- package/dist/utils/read-package-json.mjs +43 -0
- package/dist/utils/read-package-json.mjs.map +6 -0
- package/dist/utils/resolve-alias.d.mts +20 -0
- package/dist/utils/resolve-alias.mjs +106 -0
- package/dist/utils/resolve-alias.mjs.map +6 -0
- package/dist/utils/resolve-aliases.d.mts +19 -0
- package/dist/utils/resolve-aliases.mjs +28 -0
- package/dist/utils/resolve-aliases.mjs.map +6 -0
- package/dist/utils/resolve-extensions.d.mts +14 -0
- package/dist/utils/resolve-extensions.mjs +22 -0
- package/dist/utils/resolve-extensions.mjs.map +6 -0
- package/dist/utils/resolve-module.d.mts +39 -0
- package/dist/utils/resolve-module.mjs +64 -0
- package/dist/utils/resolve-module.mjs.map +6 -0
- package/dist/utils/resolve-modules.d.mts +25 -0
- package/dist/{lib → utils}/resolve-modules.mjs +7 -10
- package/dist/utils/resolve-modules.mjs.map +6 -0
- package/dist/{lib → utils}/to-absolute-specifier.d.mts +6 -6
- package/dist/utils/to-absolute-specifier.mjs +8 -0
- package/dist/utils/to-absolute-specifier.mjs.map +6 -0
- package/dist/utils/to-bare-specifier.d.mts +42 -0
- package/dist/utils/to-bare-specifier.mjs +90 -0
- package/dist/utils/to-bare-specifier.mjs.map +6 -0
- package/dist/{lib → utils}/to-data-url.d.mts +6 -5
- package/dist/{lib → utils}/to-data-url.mjs +4 -0
- package/dist/utils/to-data-url.mjs.map +6 -0
- package/dist/utils/to-node-url.d.mts +19 -0
- package/dist/utils/to-node-url.mjs +10 -0
- package/dist/utils/to-node-url.mjs.map +6 -0
- package/dist/{lib → utils}/to-relative-specifier.d.mts +6 -6
- package/dist/{lib → utils}/to-relative-specifier.mjs +7 -3
- package/dist/utils/to-relative-specifier.mjs.map +6 -0
- package/dist/utils/to-url.d.mts +22 -0
- package/dist/utils/to-url.mjs +12 -0
- package/dist/utils/to-url.mjs.map +6 -0
- package/dist/utils/validate-assertions.d.mts +23 -0
- package/dist/utils/validate-assertions.mjs +52 -0
- package/dist/utils/validate-assertions.mjs.map +6 -0
- package/dist/utils/validate-exports.d.mts +24 -0
- package/dist/utils/validate-exports.mjs +72 -0
- package/dist/utils/validate-exports.mjs.map +6 -0
- package/package.json +106 -83
- package/src/enums/assert-type.ts +23 -0
- package/src/enums/format.ts +19 -0
- package/src/enums/index.ts +11 -0
- package/src/enums/kind-specifier-syntax.ts +16 -0
- package/src/enums/kind-specifier.ts +19 -0
- package/src/enums/kind-statement-syntax.ts +24 -0
- package/src/enums/kind-statement.ts +17 -0
- package/src/index.ts +9 -0
- package/src/interfaces/import-assertions.ts +24 -0
- package/src/interfaces/import-dynamic.ts +48 -0
- package/src/interfaces/import-static.ts +50 -0
- package/src/interfaces/index.ts +25 -0
- package/src/interfaces/options-fill-module.ts +26 -0
- package/src/interfaces/options-find-subpath.ts +56 -0
- package/src/interfaces/options-get-format.ts +92 -0
- package/src/interfaces/options-get-source.ts +70 -0
- package/src/interfaces/options-parse-module-id.ts +38 -0
- package/src/interfaces/options-parse-subpath.ts +36 -0
- package/src/interfaces/options-resolve-alias.ts +59 -0
- package/src/interfaces/options-resolve-module.ts +72 -0
- package/src/interfaces/options-resolve.ts +17 -0
- package/src/interfaces/package-scope.ts +30 -0
- package/src/interfaces/parsed-data-url.ts +63 -0
- package/src/interfaces/parsed-module-id.ts +90 -0
- package/src/interfaces/parsed-subpath.ts +47 -0
- package/src/interfaces/statement-export.ts +52 -0
- package/src/interfaces/statement-import.ts +45 -0
- package/src/interfaces/statement-require.ts +45 -0
- package/src/interfaces/statement.ts +64 -0
- package/src/internal/escape-reg-exp.ts +24 -0
- package/src/internal/format-type-map.ts +26 -0
- package/src/internal/get-specifier-kind.ts +38 -0
- package/src/internal/get-subpaths.ts +41 -0
- package/src/internal/is-array-index.ts +28 -0
- package/src/internal/is-directory.ts +25 -0
- package/src/internal/is-file.ts +25 -0
- package/src/internal/is-function.ts +16 -0
- package/src/internal/regex-encoded-sep.ts +15 -0
- package/src/internal/regex-internal-specifier.ts +17 -0
- package/src/internal/regex-package-name.ts +16 -0
- package/src/internal/regex-package-path.ts +18 -0
- package/src/internal/resolver.ts +783 -0
- package/src/internal/validate-boolean.ts +27 -0
- package/src/internal/validate-object.ts +30 -0
- package/src/internal/validate-set.ts +33 -0
- package/src/internal/validate-string.ts +27 -0
- package/src/internal/validate-url-string.ts +31 -0
- package/src/types/declaration.ts +22 -0
- package/src/types/fn-change-ext.ts +33 -0
- package/src/types/index.ts +14 -0
- package/src/types/mime-type.ts +19 -0
- package/src/types/module-id.ts +15 -0
- package/src/types/module-specifier-type.ts +13 -0
- package/src/types/protocol.ts +40 -0
- package/src/types/syntax-kind-export.ts +20 -0
- package/src/types/syntax-kind-import.ts +22 -0
- package/src/types/syntax-kind-require.ts +15 -0
- package/src/utils/compare-subpaths.ts +100 -0
- package/src/utils/conditions.ts +15 -0
- package/src/utils/detect-syntax.ts +40 -0
- package/src/utils/extension-format-map.ts +34 -0
- package/src/utils/extract-statements.ts +42 -0
- package/src/utils/fill-modules.ts +116 -0
- package/src/utils/find-dynamic-imports.ts +75 -0
- package/src/utils/find-exports.ts +164 -0
- package/src/utils/find-requires.ts +75 -0
- package/src/utils/find-static-imports.ts +89 -0
- package/src/utils/find-subpath.ts +241 -0
- package/src/utils/get-format.ts +222 -0
- package/src/utils/get-source.ts +129 -0
- package/src/utils/has-cjs-syntax.ts +44 -0
- package/src/utils/has-esm-syntax.ts +40 -0
- package/src/utils/index.ts +43 -0
- package/src/utils/is-absolute-specifier.ts +48 -0
- package/src/utils/is-bare-specifier.ts +30 -0
- package/src/utils/is-exports-sugar.ts +74 -0
- package/src/utils/is-relative-specifier.ts +34 -0
- package/src/utils/lookup-package-scope.ts +97 -0
- package/src/utils/parse-data-url.ts +71 -0
- package/src/utils/parse-module-id.ts +186 -0
- package/src/utils/parse-subpath.ts +173 -0
- package/src/utils/pattern-character.ts +13 -0
- package/src/utils/read-package-json.ts +101 -0
- package/src/utils/resolve-alias.ts +219 -0
- package/src/utils/resolve-aliases.ts +58 -0
- package/src/utils/resolve-extensions.ts +33 -0
- package/src/utils/resolve-module.ts +153 -0
- package/src/utils/resolve-modules.ts +62 -0
- package/src/utils/to-absolute-specifier.ts +30 -0
- package/src/utils/to-bare-specifier.ts +201 -0
- package/src/utils/to-data-url.ts +42 -0
- package/src/utils/to-node-url.ts +27 -0
- package/src/utils/to-relative-specifier.ts +47 -0
- package/src/utils/to-url.ts +31 -0
- package/src/utils/validate-assertions.ts +119 -0
- package/src/utils/validate-exports.ts +124 -0
- package/changelog.config.cts +0 -204
- package/dist/constants.d.mts +0 -19
- package/dist/constants.mjs +0 -24
- package/dist/interfaces/import-dynamic.mjs +0 -0
- package/dist/interfaces/import-static.mjs +0 -0
- package/dist/interfaces/options-resolve-alias.mjs +0 -0
- package/dist/interfaces/options-resolve.mjs +0 -0
- package/dist/interfaces/statement-export.mjs +0 -0
- package/dist/interfaces/statement-import.mjs +0 -0
- package/dist/interfaces/statement-require.mjs +0 -0
- package/dist/interfaces/statement.mjs +0 -0
- package/dist/internal/compiler-options-json.d.mts +0 -111
- package/dist/internal/compiler-options-json.mjs +0 -0
- package/dist/internal/constants.d.mts +0 -70
- package/dist/internal/constants.mjs +0 -18
- package/dist/internal/get-compiler-options.d.mts +0 -21
- package/dist/internal/get-compiler-options.mjs +0 -14
- package/dist/internal/index.d.mts +0 -7
- package/dist/internal/index.mjs +0 -5
- package/dist/lib/extract-statements.d.mts +0 -21
- package/dist/lib/find-dynamic-imports.d.mts +0 -15
- package/dist/lib/find-dynamic-imports.mjs +0 -20
- package/dist/lib/find-exports.d.mts +0 -15
- package/dist/lib/find-exports.mjs +0 -53
- package/dist/lib/find-requires.d.mts +0 -17
- package/dist/lib/find-requires.mjs +0 -19
- package/dist/lib/find-static-imports.d.mts +0 -15
- package/dist/lib/find-static-imports.mjs +0 -20
- package/dist/lib/has-cjs-syntax.mjs +0 -6
- package/dist/lib/has-esm-syntax.mjs +0 -6
- package/dist/lib/index.d.mts +0 -20
- package/dist/lib/index.mjs +0 -34
- package/dist/lib/resolve-alias.d.mts +0 -20
- package/dist/lib/resolve-alias.mjs +0 -41
- package/dist/lib/resolve-aliases.d.mts +0 -17
- package/dist/lib/resolve-aliases.mjs +0 -34
- package/dist/lib/resolve-module.d.mts +0 -31
- package/dist/lib/resolve-module.mjs +0 -74
- package/dist/lib/resolve-modules.d.mts +0 -19
- package/dist/lib/to-absolute-specifier.mjs +0 -20
- package/dist/lib/to-bare-specifier.d.mts +0 -28
- package/dist/lib/to-bare-specifier.mjs +0 -78
- package/dist/types/declaration.mjs +0 -0
- package/dist/types/ext.d.mts +0 -9
- package/dist/types/ext.mjs +0 -0
- package/dist/types/mime-type.mjs +0 -0
- package/dist/types/specifier-type.d.mts +0 -11
- package/dist/types/specifier-type.mjs +0 -0
- package/dist/types/statement-type.d.mts +0 -9
- package/dist/types/statement-type.mjs +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file Package Entry Point
|
|
3
3
|
* @module mlly
|
|
4
4
|
*/
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './enums/index.mjs';
|
|
6
6
|
export * from './interfaces/index.mjs';
|
|
7
|
-
export * from './lib/index.mjs';
|
|
8
7
|
export * from './types/index.mjs';
|
|
8
|
+
export * from './utils/index.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - ImportAssertions
|
|
3
|
+
* @module mlly/interfaces/ImportAssertions
|
|
4
|
+
*/
|
|
5
|
+
import type { AssertType } from '../enums/index.mjs';
|
|
6
|
+
import type { LiteralUnion } from '@flex-development/tutils';
|
|
7
|
+
/**
|
|
8
|
+
* `import` assertions schema.
|
|
9
|
+
*
|
|
10
|
+
* @see {@linkcode AssertType}
|
|
11
|
+
* @see https://github.com/tc39/proposal-import-assertions
|
|
12
|
+
*/
|
|
13
|
+
interface ImportAssertions {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
/**
|
|
16
|
+
* Assertion type.
|
|
17
|
+
*/
|
|
18
|
+
type?: LiteralUnion<AssertType, string>;
|
|
19
|
+
}
|
|
20
|
+
export type { ImportAssertions as default };
|
|
@@ -2,22 +2,42 @@
|
|
|
2
2
|
* @file Interfaces - DynamicImport
|
|
3
3
|
* @module mlly/interfaces/DynamicImport
|
|
4
4
|
*/
|
|
5
|
+
import type { StatementSyntaxKind } from '../enums/index.mjs';
|
|
6
|
+
import type { SyntaxKindImport } from '../types/index.mjs';
|
|
7
|
+
import type { EmptyString, LiteralUnion } from '@flex-development/tutils';
|
|
5
8
|
import type ImportStatement from './statement-import.mjs';
|
|
6
9
|
/**
|
|
7
|
-
* Dynamic import statement object
|
|
10
|
+
* Dynamic import statement object.
|
|
8
11
|
*
|
|
9
|
-
* @see {@
|
|
12
|
+
* @see {@linkcode ImportStatement}
|
|
13
|
+
* @see {@linkcode StatementSyntaxKind}
|
|
14
|
+
* @see {@linkcode SyntaxKindImport}
|
|
15
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import
|
|
10
16
|
*
|
|
11
17
|
* @extends {ImportStatement}
|
|
12
18
|
*/
|
|
13
19
|
interface DynamicImport extends ImportStatement {
|
|
14
20
|
/**
|
|
15
|
-
*
|
|
21
|
+
* Import expression.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* 'import("foo.json")'
|
|
25
|
+
* @example
|
|
26
|
+
* 'import(foo)'
|
|
16
27
|
*/
|
|
17
|
-
|
|
28
|
+
expression: LiteralUnion<EmptyString, string>;
|
|
18
29
|
/**
|
|
19
|
-
*
|
|
30
|
+
* Options bag.
|
|
31
|
+
*
|
|
32
|
+
* @see https://github.com/tc39/proposal-import-assertions#dynamic-import
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* '{ assert: { type: "json" } }'
|
|
20
36
|
*/
|
|
21
|
-
|
|
37
|
+
options: LiteralUnion<EmptyString, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Statement syntax kind.
|
|
40
|
+
*/
|
|
41
|
+
syntax: Extract<SyntaxKindImport, StatementSyntaxKind.DYNAMIC>;
|
|
22
42
|
}
|
|
23
43
|
export type { DynamicImport as default };
|
|
@@ -2,18 +2,36 @@
|
|
|
2
2
|
* @file Interfaces - StaticImport
|
|
3
3
|
* @module mlly/interfaces/StaticImport
|
|
4
4
|
*/
|
|
5
|
+
import type { StatementSyntaxKind } from '../enums/index.mjs';
|
|
6
|
+
import type { SyntaxKindImport } from '../types/index.mjs';
|
|
7
|
+
import type { EmptyString, LiteralUnion } from '@flex-development/tutils';
|
|
5
8
|
import type ImportStatement from './statement-import.mjs';
|
|
6
9
|
/**
|
|
7
|
-
* Static import statement object
|
|
10
|
+
* Static import statement object.
|
|
8
11
|
*
|
|
9
|
-
* @see {@
|
|
12
|
+
* @see {@linkcode ImportStatement}
|
|
13
|
+
* @see {@linkcode StatementSyntaxKind}
|
|
14
|
+
* @see {@linkcode SyntaxKindImport}
|
|
10
15
|
*
|
|
11
16
|
* @extends {ImportStatement}
|
|
12
17
|
*/
|
|
13
18
|
interface StaticImport extends ImportStatement {
|
|
14
19
|
/**
|
|
15
|
-
*
|
|
20
|
+
* Assertion options.
|
|
21
|
+
*
|
|
22
|
+
* @see https://github.com/tc39/proposal-import-assertions#import-statements
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* '{ type: "json" }'
|
|
16
26
|
*/
|
|
17
|
-
|
|
27
|
+
assertion: LiteralUnion<EmptyString, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Statement syntax kind.
|
|
30
|
+
*/
|
|
31
|
+
syntax: Extract<SyntaxKindImport, StatementSyntaxKind.DEFAULT | StatementSyntaxKind.DEFAULT_WITH_NAMED | StatementSyntaxKind.DEFAULT_WITH_NAMESPACE | StatementSyntaxKind.NAMED | StatementSyntaxKind.NAMESPACE | StatementSyntaxKind.SIDE_EFFECT>;
|
|
32
|
+
/**
|
|
33
|
+
* Type-only import statement check.
|
|
34
|
+
*/
|
|
35
|
+
type: boolean;
|
|
18
36
|
}
|
|
19
37
|
export type { StaticImport as default };
|
|
@@ -2,10 +2,22 @@
|
|
|
2
2
|
* @file Interfaces
|
|
3
3
|
* @module mlly/interfaces
|
|
4
4
|
*/
|
|
5
|
+
export type { default as ImportAssertions } from './import-assertions.mjs';
|
|
5
6
|
export type { default as DynamicImport } from './import-dynamic.mjs';
|
|
6
7
|
export type { default as StaticImport } from './import-static.mjs';
|
|
8
|
+
export type { default as FillModuleOptions } from './options-fill-module.mjs';
|
|
9
|
+
export type { default as FindSubpathOptions } from './options-find-subpath.mjs';
|
|
10
|
+
export type { default as GetFormatOptions } from './options-get-format.mjs';
|
|
11
|
+
export type { default as GetSourceOptions } from './options-get-source.mjs';
|
|
12
|
+
export type { default as ParseModuleIdOptions } from './options-parse-module-id.mjs';
|
|
13
|
+
export type { default as ParseSubpathOptions } from './options-parse-subpath.mjs';
|
|
7
14
|
export type { default as ResolveOptions } from './options-resolve.mjs';
|
|
8
15
|
export type { default as ResolveAliasOptions } from './options-resolve-alias.mjs';
|
|
16
|
+
export type { default as ResolveModuleOptions } from './options-resolve-module.mjs';
|
|
17
|
+
export type { default as PackageScope } from './package-scope.mjs';
|
|
18
|
+
export type { default as ParsedDataUrl } from './parsed-data-url.mjs';
|
|
19
|
+
export type { default as ParsedModuleId } from './parsed-module-id.mjs';
|
|
20
|
+
export type { default as ParsedSubpath } from './parsed-subpath.mjs';
|
|
9
21
|
export type { default as Statement } from './statement.mjs';
|
|
10
22
|
export type { default as ExportStatement } from './statement-export.mjs';
|
|
11
23
|
export type { default as ImportStatement } from './statement-import.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - FillModuleOptions
|
|
3
|
+
* @module mlly/interfaces/FillModuleOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { ChangeExtFn } from '../types/index.mjs';
|
|
6
|
+
import type ResolveModuleOptions from './options-resolve-module.mjs';
|
|
7
|
+
/**
|
|
8
|
+
* Options for fully specifying modules.
|
|
9
|
+
*
|
|
10
|
+
* @see {@linkcode ChangeExtFn}
|
|
11
|
+
* @see {@linkcode ResolveModuleOptions}
|
|
12
|
+
* @see https://nodejs.org/api/esm.html#mandatory-file-extensions
|
|
13
|
+
*
|
|
14
|
+
* @extends {ResolveModuleOptions}
|
|
15
|
+
*/
|
|
16
|
+
interface FillModuleOptions extends ResolveModuleOptions {
|
|
17
|
+
/**
|
|
18
|
+
* File extension to add to absolute and relative specifiers or a function
|
|
19
|
+
* that returns a file extension.
|
|
20
|
+
*/
|
|
21
|
+
ext: ChangeExtFn<string> | string;
|
|
22
|
+
}
|
|
23
|
+
export type { FillModuleOptions as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - FindSubpathOptions
|
|
3
|
+
* @module mlly/interfaces/FindSubpathOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { ModuleId } from '../types/index.mjs';
|
|
6
|
+
/**
|
|
7
|
+
* Subpath search options.
|
|
8
|
+
*
|
|
9
|
+
* @see {@linkcode ModuleId}
|
|
10
|
+
*/
|
|
11
|
+
interface FindSubpathOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Export condition to apply.
|
|
14
|
+
*
|
|
15
|
+
* @see https://nodejs.org/api/packages.html#conditional-exports
|
|
16
|
+
*
|
|
17
|
+
* @default 'default'
|
|
18
|
+
*/
|
|
19
|
+
condition?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Export conditions.
|
|
22
|
+
*
|
|
23
|
+
* **Note**: Should be sorted by priority.
|
|
24
|
+
*
|
|
25
|
+
* @see https://nodejs.org/api/packages.html#conditional-exports
|
|
26
|
+
*
|
|
27
|
+
* @default CONDITIONS
|
|
28
|
+
*/
|
|
29
|
+
conditions?: Set<string> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* URL of directory containing relevant `package.json` file.
|
|
32
|
+
*/
|
|
33
|
+
dir: ModuleId;
|
|
34
|
+
/**
|
|
35
|
+
* Package [`imports`][1] hint.
|
|
36
|
+
*
|
|
37
|
+
* [1]: https://nodejs.org/api/packages.html#imports
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
internal?: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* URL of module to resolve from.
|
|
44
|
+
*
|
|
45
|
+
* **Note**: Used for error reporting only.
|
|
46
|
+
*/
|
|
47
|
+
parent: ModuleId;
|
|
48
|
+
}
|
|
49
|
+
export type { FindSubpathOptions as default };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - GetFormatOptions
|
|
3
|
+
* @module mlly/interfaces/GetFormatOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { Format } from '../enums/index.mjs';
|
|
6
|
+
import type { ModuleId } from '../types/index.mjs';
|
|
7
|
+
import type { Ext } from '@flex-development/pathe';
|
|
8
|
+
import type { EmptyString } from '@flex-development/tutils';
|
|
9
|
+
import type { RequestInit } from 'node-fetch';
|
|
10
|
+
/**
|
|
11
|
+
* Module format retrieval options.
|
|
12
|
+
*
|
|
13
|
+
* @see {@linkcode Ext}
|
|
14
|
+
* @see {@linkcode Format}
|
|
15
|
+
* @see {@linkcode ModuleId}
|
|
16
|
+
* @see {@linkcode RequestInit}
|
|
17
|
+
*/
|
|
18
|
+
interface GetFormatOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Base URL to resolve module id against if module id is not absolute.
|
|
21
|
+
*
|
|
22
|
+
* @see {@linkcode ModuleId}
|
|
23
|
+
*
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
base?: ModuleId | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Enable support for JSON modules.
|
|
29
|
+
*
|
|
30
|
+
* @see https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_json_modules
|
|
31
|
+
*
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
experimental_json_modules?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Enable support for network based modules.
|
|
37
|
+
*
|
|
38
|
+
* **Note**: Requires [`node-fetch`][1].
|
|
39
|
+
*
|
|
40
|
+
* [1]: https://github.com/node-fetch/node-fetch
|
|
41
|
+
*
|
|
42
|
+
* @see https://nodejs.org/docs/latest-v16.x/api/esm.html#https-and-http-imports
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
experimental_network_imports?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Enable support for WebAssembly modules.
|
|
49
|
+
*
|
|
50
|
+
* @see https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_wasm_modules
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
experimental_wasm_modules?: boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Map file extensions to module formats.
|
|
57
|
+
*
|
|
58
|
+
* @default EXTENSION_FORMAT_MAP
|
|
59
|
+
*/
|
|
60
|
+
extension_format_map?: Map<EmptyString | Ext, Format> | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Return `undefined` when module format is not found, rather than `null`.
|
|
63
|
+
*
|
|
64
|
+
* An explicit `undefined` return value indicates [`load`][1] hooks should
|
|
65
|
+
* re-run module format checks.
|
|
66
|
+
*
|
|
67
|
+
* [1]: https://nodejs.org/docs/latest-v16.x/api/esm.html#loadurl-context-nextload
|
|
68
|
+
*
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
ignore_errors?: boolean | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Request options for network based modules.
|
|
74
|
+
*
|
|
75
|
+
* Only applicable if {@linkcode experimental_network_imports} is enabled.
|
|
76
|
+
*
|
|
77
|
+
* @see {@linkcode RequestInit}
|
|
78
|
+
*
|
|
79
|
+
* @default undefined
|
|
80
|
+
*/
|
|
81
|
+
req?: RequestInit | undefined;
|
|
82
|
+
}
|
|
83
|
+
export type { GetFormatOptions as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - GetSourceOptions
|
|
3
|
+
* @module mlly/interfaces/GetSourceOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { Format } from '../enums/index.mjs';
|
|
6
|
+
import type { ModuleId } from '../types/index.mjs';
|
|
7
|
+
import type { RequestInit } from 'node-fetch';
|
|
8
|
+
/**
|
|
9
|
+
* Source code retrieval options.
|
|
10
|
+
*
|
|
11
|
+
* @see {@linkcode Format}
|
|
12
|
+
* @see {@linkcode ModuleId}
|
|
13
|
+
* @see {@linkcode RequestInit}
|
|
14
|
+
*/
|
|
15
|
+
interface GetSourceOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Base URL to resolve module id against if module id is not absolute.
|
|
18
|
+
*
|
|
19
|
+
* @see {@linkcode ModuleId}
|
|
20
|
+
*
|
|
21
|
+
* @default undefined
|
|
22
|
+
*/
|
|
23
|
+
base?: ModuleId | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Enable support for network based modules.
|
|
26
|
+
*
|
|
27
|
+
* **Note**: Requires [`node-fetch`][1].
|
|
28
|
+
*
|
|
29
|
+
* [1]: https://github.com/node-fetch/node-fetch
|
|
30
|
+
*
|
|
31
|
+
* @see https://nodejs.org/docs/latest-v16.x/api/esm.html#https-and-http-imports
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
experimental_network_imports?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Module format hint.
|
|
38
|
+
*
|
|
39
|
+
* @see {@linkcode Format}
|
|
40
|
+
*
|
|
41
|
+
* @default undefined
|
|
42
|
+
*/
|
|
43
|
+
format?: Format | Lowercase<keyof typeof Format> | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Ignore [`ERR_UNSUPPORTED_ESM_URL_SCHEME`][1] if thrown.
|
|
46
|
+
*
|
|
47
|
+
* [1]: https://nodejs.org/api/errors.html#err_unsupported_esm_url_scheme
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
ignore_errors?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Request options for network based modules.
|
|
54
|
+
*
|
|
55
|
+
* Only applicable if {@linkcode experimental_network_imports} is enabled.
|
|
56
|
+
*
|
|
57
|
+
* @see {@linkcode RequestInit}
|
|
58
|
+
*
|
|
59
|
+
* @default undefined
|
|
60
|
+
*/
|
|
61
|
+
req?: RequestInit | undefined;
|
|
62
|
+
}
|
|
63
|
+
export type { GetSourceOptions as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - ParseModuleIdOptions
|
|
3
|
+
* @module mlly/interfaces/ParseModuleIdOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { ModuleId } from '../types/index.mjs';
|
|
6
|
+
/**
|
|
7
|
+
* Module id parsing options.
|
|
8
|
+
*
|
|
9
|
+
* @see {@linkcode ModuleId}
|
|
10
|
+
*/
|
|
11
|
+
interface ParseModuleIdOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Ensure module id is a valid internal specifier, syntactically.
|
|
14
|
+
*
|
|
15
|
+
* @see https://nodejs.org/api/packages.html#subpath-imports
|
|
16
|
+
*
|
|
17
|
+
* @default id instanceof URL ? false : id.startsWith('#')
|
|
18
|
+
*/
|
|
19
|
+
internal?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* URL of module to resolve from.
|
|
22
|
+
*
|
|
23
|
+
* **Note**: Used for error reporting only.
|
|
24
|
+
*
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
parent?: ModuleId | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Ensure module id begins with a valid package name.
|
|
30
|
+
*/
|
|
31
|
+
pkgname?: boolean | undefined;
|
|
32
|
+
}
|
|
33
|
+
export type { ParseModuleIdOptions as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - ParseSubpathOptions
|
|
3
|
+
* @module mlly/interfaces/ParseSubpathOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { ModuleId } from '../types/index.mjs';
|
|
6
|
+
/**
|
|
7
|
+
* Subpath parsing options.
|
|
8
|
+
*
|
|
9
|
+
* @see {@linkcode ModuleId}
|
|
10
|
+
*/
|
|
11
|
+
interface ParseSubpathOptions {
|
|
12
|
+
/**
|
|
13
|
+
* URL of directory containing relevant `package.json` file.
|
|
14
|
+
*/
|
|
15
|
+
dir: ModuleId;
|
|
16
|
+
/**
|
|
17
|
+
* Package [`imports`][1] hint.
|
|
18
|
+
*
|
|
19
|
+
* [1]: https://nodejs.org/api/packages.html#imports
|
|
20
|
+
*
|
|
21
|
+
* @default specifier.startsWith('#')
|
|
22
|
+
*/
|
|
23
|
+
internal?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* URL of module to resolve from.
|
|
26
|
+
*
|
|
27
|
+
* **Note**: Used for error reporting only.
|
|
28
|
+
*/
|
|
29
|
+
parent: ModuleId;
|
|
30
|
+
}
|
|
31
|
+
export type { ParseSubpathOptions as default };
|
|
@@ -2,68 +2,52 @@
|
|
|
2
2
|
* @file Interfaces - ResolveAliasOptions
|
|
3
3
|
* @module mlly/interfaces/ResolveAliasOptions
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ModuleId } from '../types/index.mjs';
|
|
6
|
+
import type { MapLike, OneOrMany } from '@flex-development/tutils';
|
|
7
|
+
import type ResolveModuleOptions from './options-resolve-module.mjs';
|
|
6
8
|
/**
|
|
7
9
|
* Path alias resolution options.
|
|
8
10
|
*
|
|
9
|
-
* @see
|
|
11
|
+
* @see {@linkcode ModuleId}
|
|
12
|
+
*
|
|
13
|
+
* @extends {ResolveModuleOptions}
|
|
10
14
|
*/
|
|
11
|
-
interface ResolveAliasOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Base directory to resolve non-absolute module names.
|
|
14
|
-
*
|
|
15
|
-
* @see https://www.typescriptlang.org/tsconfig#baseUrl
|
|
16
|
-
*
|
|
17
|
-
* @default process.cwd()
|
|
18
|
-
*/
|
|
19
|
-
baseUrl?: string;
|
|
15
|
+
interface ResolveAliasOptions extends ResolveModuleOptions {
|
|
20
16
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* **Note**: Should be sorted by priority.
|
|
17
|
+
* Return resolved module URL as absolute specifier (a [`file:` URL][1]).
|
|
24
18
|
*
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
extensions?: string[] | readonly string[];
|
|
28
|
-
/**
|
|
29
|
-
* Checks for the existence of a file at `path`.
|
|
19
|
+
* If `false`, return resolved module URL as bare or relative specifier.
|
|
30
20
|
*
|
|
31
|
-
*
|
|
32
|
-
* @return {boolean} `true` if file exists, `false` otherwise
|
|
33
|
-
*/
|
|
34
|
-
fileExists?(this: void, path: string): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* `package.json` fields to check when resolving modules.
|
|
21
|
+
* [1]: https://nodejs.org/api/esm.html#file-urls
|
|
37
22
|
*
|
|
38
|
-
*
|
|
23
|
+
* @see https://nodejs.org/api/esm.html#terminology
|
|
39
24
|
*
|
|
40
|
-
* @default
|
|
41
|
-
*/
|
|
42
|
-
mainFields?: OneOrMany<string>[];
|
|
43
|
-
/**
|
|
44
|
-
* Absolute path to file containing path alias.
|
|
25
|
+
* @default true
|
|
45
26
|
*/
|
|
46
|
-
|
|
27
|
+
absolute?: boolean | undefined;
|
|
47
28
|
/**
|
|
48
29
|
* Path mappings.
|
|
49
30
|
*
|
|
50
|
-
* **Note**:
|
|
51
|
-
*
|
|
52
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
31
|
+
* **Note**: Paths should be relative to {@linkcode cwd}.
|
|
53
32
|
*
|
|
54
33
|
* @default {}
|
|
55
34
|
*/
|
|
56
|
-
|
|
35
|
+
aliases?: MapLike<OneOrMany<string>> | undefined;
|
|
57
36
|
/**
|
|
58
|
-
*
|
|
37
|
+
* Directory to resolve non-absolute modules from.
|
|
59
38
|
*
|
|
60
|
-
* @
|
|
61
|
-
* @return {string} Contents of `filename`
|
|
39
|
+
* @default pathToFileURL('.')
|
|
62
40
|
*/
|
|
63
|
-
|
|
41
|
+
cwd?: ModuleId | undefined;
|
|
64
42
|
/**
|
|
65
|
-
*
|
|
43
|
+
* Id of module to resolve from.
|
|
44
|
+
*
|
|
45
|
+
* **Note**: Should be an absolute path or [`file:` URL][1].
|
|
46
|
+
*
|
|
47
|
+
* [1]: https://nodejs.org/api/esm.html#file-urls
|
|
48
|
+
*
|
|
49
|
+
* @default import.meta.url
|
|
66
50
|
*/
|
|
67
|
-
|
|
51
|
+
parent?: ModuleId | undefined;
|
|
68
52
|
}
|
|
69
53
|
export type { ResolveAliasOptions as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Interfaces - ResolveModuleOptions
|
|
3
|
+
* @module mlly/interfaces/ResolveModuleOptions
|
|
4
|
+
*/
|
|
5
|
+
import type { ChangeExtFn, ModuleId } from '../types/index.mjs';
|
|
6
|
+
import type { Nilable } from '@flex-development/tutils';
|
|
7
|
+
/**
|
|
8
|
+
* Module resolution options.
|
|
9
|
+
*
|
|
10
|
+
* @see {@linkcode ChangeExtFn}
|
|
11
|
+
* @see {@linkcode ModuleId}
|
|
12
|
+
*/
|
|
13
|
+
interface ResolveModuleOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Export condition to apply.
|
|
16
|
+
*
|
|
17
|
+
* @see https://nodejs.org/api/packages.html#conditional-exports
|
|
18
|
+
*
|
|
19
|
+
* @default 'default'
|
|
20
|
+
*/
|
|
21
|
+
condition?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Export conditions.
|
|
24
|
+
*
|
|
25
|
+
* **Note**: Should be sorted by priority.
|
|
26
|
+
*
|
|
27
|
+
* @see https://nodejs.org/api/packages.html#conditional-exports
|
|
28
|
+
*
|
|
29
|
+
* @default CONDITIONS
|
|
30
|
+
*/
|
|
31
|
+
conditions?: Set<string> | string[] | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Replacement file extension or function that returns a file extension.
|
|
34
|
+
*
|
|
35
|
+
* An empty string (`''`) will remove a file extension; `null` or `undefined`
|
|
36
|
+
* will skip extension replacement.
|
|
37
|
+
*
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
ext?: ChangeExtFn | Nilable<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Module extensions to probe for.
|
|
43
|
+
*
|
|
44
|
+
* **Note**: Should be sorted by priority.
|
|
45
|
+
*
|
|
46
|
+
* @default RESOLVE_EXTENSIONS
|
|
47
|
+
*/
|
|
48
|
+
extensions?: Set<string> | string[] | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* URL of module to resolve from.
|
|
51
|
+
*
|
|
52
|
+
* @see {@linkcode ModuleId}
|
|
53
|
+
*
|
|
54
|
+
* @default import.meta.url
|
|
55
|
+
*/
|
|
56
|
+
parent?: ModuleId | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Keep symlinks instead of resolving them.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
preserveSymlinks?: boolean | undefined;
|
|
63
|
+
}
|
|
64
|
+
export type { ResolveModuleOptions as default };
|