@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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file validateAssertions
|
|
3
|
+
* @module mlly/utils/validateAssertions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { Format } from '#src/enums'
|
|
7
|
+
import { AssertType } from '#src/enums'
|
|
8
|
+
import type { ImportAssertions } from '#src/interfaces'
|
|
9
|
+
import FORMAT_TYPE_MAP from '#src/internal/format-type-map'
|
|
10
|
+
import validateString from '#src/internal/validate-string'
|
|
11
|
+
import validateURLString from '#src/internal/validate-url-string'
|
|
12
|
+
import type { ModuleId } from '#src/types'
|
|
13
|
+
import {
|
|
14
|
+
ERR_IMPORT_ASSERTION_TYPE_FAILED,
|
|
15
|
+
ERR_IMPORT_ASSERTION_TYPE_MISSING,
|
|
16
|
+
ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED,
|
|
17
|
+
type NodeError
|
|
18
|
+
} from '@flex-development/errnode'
|
|
19
|
+
import type { LiteralUnion } from '@flex-development/tutils'
|
|
20
|
+
import { URL } from 'node:url'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Test a module's `import` assertions.
|
|
24
|
+
*
|
|
25
|
+
* @see {@linkcode Format}
|
|
26
|
+
* @see {@linkcode ImportAssertions}
|
|
27
|
+
* @see {@linkcode ModuleId}
|
|
28
|
+
*
|
|
29
|
+
* @param {ModuleId} url - Module URL of imported module (for error reporting)
|
|
30
|
+
* @param {LiteralUnion<Format, string>} format - Module format
|
|
31
|
+
* @param {ImportAssertions} [assertions={}] - `import` assertions
|
|
32
|
+
* @return {true} `true` if `assertions` are valid
|
|
33
|
+
* @throws {NodeError<TypeError>}
|
|
34
|
+
*/
|
|
35
|
+
const validateAssertions = (
|
|
36
|
+
url: ModuleId,
|
|
37
|
+
format: LiteralUnion<Format, string>,
|
|
38
|
+
assertions: ImportAssertions = {}
|
|
39
|
+
): true => {
|
|
40
|
+
validateURLString(url, 'url')
|
|
41
|
+
validateString(format, 'format')
|
|
42
|
+
|
|
43
|
+
// ensure url is a string
|
|
44
|
+
if (url instanceof URL) url = url.href
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `type` property check for {@linkcode assertions}.
|
|
48
|
+
*
|
|
49
|
+
* @const {boolean} has_type
|
|
50
|
+
*/
|
|
51
|
+
const has_type: boolean = Object.hasOwnProperty.call(assertions, 'type')
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* `import` assertion type.
|
|
55
|
+
*
|
|
56
|
+
* @const {AssertType | undefined} type
|
|
57
|
+
*/
|
|
58
|
+
const type: AssertType | undefined = FORMAT_TYPE_MAP.get(format as Format)
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* `import` assertion error check.
|
|
62
|
+
*
|
|
63
|
+
* @var {boolean} err
|
|
64
|
+
*/
|
|
65
|
+
let err: boolean = false
|
|
66
|
+
|
|
67
|
+
// validate import assertions
|
|
68
|
+
switch (type) {
|
|
69
|
+
case undefined:
|
|
70
|
+
// ignore assertions for unrecognized module formats to allow for new
|
|
71
|
+
// formats in the future
|
|
72
|
+
break
|
|
73
|
+
case AssertType.IMPLICIT:
|
|
74
|
+
// format doesn't allow an import assertion type, so the `type` property
|
|
75
|
+
// must not be set on the import assertions object
|
|
76
|
+
if (has_type) err = true
|
|
77
|
+
break
|
|
78
|
+
case assertions.type:
|
|
79
|
+
// asserted type is compatible with format
|
|
80
|
+
break
|
|
81
|
+
default:
|
|
82
|
+
// format has an expected type, but asserted type is not compatible
|
|
83
|
+
err = true
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// throw if error was encountered
|
|
87
|
+
if (err) {
|
|
88
|
+
// import assertion type was not specified
|
|
89
|
+
if (!has_type) throw new ERR_IMPORT_ASSERTION_TYPE_MISSING(url, type!)
|
|
90
|
+
|
|
91
|
+
// import assertion type may have not been a string
|
|
92
|
+
validateString(assertions.type, 'assertions.type')
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Supported `import` assertion types.
|
|
96
|
+
*
|
|
97
|
+
* @const {AssertType[]} supported
|
|
98
|
+
*/
|
|
99
|
+
const supported: AssertType[] = []
|
|
100
|
+
|
|
101
|
+
// get supported import assertion types
|
|
102
|
+
for (const [, type] of FORMAT_TYPE_MAP) {
|
|
103
|
+
if (type === AssertType.IMPLICIT) continue
|
|
104
|
+
supported.push(type)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// throw if asserted type is not supported
|
|
108
|
+
if (!supported.includes(assertions.type as AssertType)) {
|
|
109
|
+
throw new ERR_IMPORT_ASSERTION_TYPE_UNSUPPORTED(assertions.type!)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// unknown error
|
|
113
|
+
throw new ERR_IMPORT_ASSERTION_TYPE_FAILED(url, assertions.type!)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default validateAssertions
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file validateExports
|
|
3
|
+
* @module mlly/utils/validateExports
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import isArrayIndex from '#src/internal/is-array-index'
|
|
7
|
+
import validateURLString from '#src/internal/validate-url-string'
|
|
8
|
+
import type { ModuleId } from '#src/types'
|
|
9
|
+
import {
|
|
10
|
+
ERR_INVALID_PACKAGE_CONFIG,
|
|
11
|
+
type NodeError
|
|
12
|
+
} from '@flex-development/errnode'
|
|
13
|
+
import type { Exports } from '@flex-development/pkg-types'
|
|
14
|
+
import { isNIL } from '@flex-development/tutils'
|
|
15
|
+
import { URL, fileURLToPath } from 'node:url'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Validates the given package [`exports`][1] configuration and schema.
|
|
19
|
+
*
|
|
20
|
+
* [1]: https://nodejs.org/api/packages.html#exports
|
|
21
|
+
*
|
|
22
|
+
* @see {@linkcode Exports}
|
|
23
|
+
* @see {@linkcode ModuleId}
|
|
24
|
+
*
|
|
25
|
+
* @param {Exports | undefined} exports - Package `exports`
|
|
26
|
+
* @param {ModuleId} pkg - URL of relevant `package.json` file
|
|
27
|
+
* @param {ModuleId} parent - URL of module to resolve from
|
|
28
|
+
* @return {true} `true` if `exports` configuration and schema are valid
|
|
29
|
+
* @throws {NodeError<Error | TypeError>} If either `pkg` or `parent` is not an
|
|
30
|
+
* instance of {@linkcode URL} or a string, or if `exports` configuration or
|
|
31
|
+
* schema is invalid
|
|
32
|
+
*/
|
|
33
|
+
const validateExports = (
|
|
34
|
+
exports: Exports | undefined,
|
|
35
|
+
pkg: ModuleId,
|
|
36
|
+
parent: ModuleId
|
|
37
|
+
): true => {
|
|
38
|
+
switch (true) {
|
|
39
|
+
case Array.isArray(exports):
|
|
40
|
+
for (const item of exports as unknown[]) {
|
|
41
|
+
switch (true) {
|
|
42
|
+
case Array.isArray(item):
|
|
43
|
+
case isNIL(item):
|
|
44
|
+
case typeof item !== 'object' && typeof item !== 'string':
|
|
45
|
+
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
46
|
+
fileURLToPath(pkg),
|
|
47
|
+
fileURLToPath(parent),
|
|
48
|
+
'The "exports" array must contain either objects of package subpath keys, objects of condition name keys, or strings'
|
|
49
|
+
)
|
|
50
|
+
default:
|
|
51
|
+
validateExports(
|
|
52
|
+
item as Record<string, Exports> | string,
|
|
53
|
+
pkg,
|
|
54
|
+
parent
|
|
55
|
+
)
|
|
56
|
+
break
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
break
|
|
61
|
+
case isNIL(exports):
|
|
62
|
+
case typeof exports === 'string':
|
|
63
|
+
break
|
|
64
|
+
case typeof exports !== 'object':
|
|
65
|
+
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
66
|
+
fileURLToPath(pkg),
|
|
67
|
+
fileURLToPath(parent),
|
|
68
|
+
'"exports" must be null, undefined, a string, an object of package subpath keys or condition name keys, or an array containing objects of package subpath keys, objects of condition name keys, or strings'
|
|
69
|
+
)
|
|
70
|
+
default:
|
|
71
|
+
exports = exports as Record<string, Exports>
|
|
72
|
+
|
|
73
|
+
validateURLString(pkg, 'pkg')
|
|
74
|
+
validateURLString(parent, 'parent')
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Keys defined in {@linkcode exports}.
|
|
78
|
+
*
|
|
79
|
+
* @const {string[]} keys
|
|
80
|
+
*/
|
|
81
|
+
const keys: string[] = Object.getOwnPropertyNames(exports)
|
|
82
|
+
|
|
83
|
+
// validate keys
|
|
84
|
+
for (const [index, key] of keys.entries()) {
|
|
85
|
+
// ensure key is not an array index
|
|
86
|
+
if (isArrayIndex(key)) {
|
|
87
|
+
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
88
|
+
fileURLToPath(new URL('.', pkg)),
|
|
89
|
+
fileURLToPath(parent),
|
|
90
|
+
'"exports" cannot contain numeric property keys'
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// if more than one key in keys, ensure all keys are either syntactical
|
|
95
|
+
// export conditions or subpath exports
|
|
96
|
+
if (index > 0) {
|
|
97
|
+
/**
|
|
98
|
+
* Key before {@linkcode key} in {@linkcode keys}.
|
|
99
|
+
*
|
|
100
|
+
* @const {string} prev
|
|
101
|
+
*/
|
|
102
|
+
const prev: string = keys[index - 1]!
|
|
103
|
+
|
|
104
|
+
// ensure keys are syntactical export conditions or subpath exports
|
|
105
|
+
if (
|
|
106
|
+
(!key.startsWith('.') && prev.startsWith('.')) ||
|
|
107
|
+
(key.startsWith('.') && !prev.startsWith('.'))
|
|
108
|
+
) {
|
|
109
|
+
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
110
|
+
fileURLToPath(pkg),
|
|
111
|
+
fileURLToPath(parent),
|
|
112
|
+
'"exports" cannot contain some keys starting with \'.\' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.'
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
break
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return true
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export default validateExports
|
package/changelog.config.cts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Changelog Configuration
|
|
3
|
-
* @module config/changelog
|
|
4
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { Config } from 'conventional-changelog-cli'
|
|
8
|
-
import type { Options } from 'conventional-changelog-core'
|
|
9
|
-
import type {
|
|
10
|
-
CommitGroup,
|
|
11
|
-
GeneratedContext
|
|
12
|
-
} from 'conventional-changelog-writer'
|
|
13
|
-
import type { Commit, CommitRaw } from 'conventional-commits-parser'
|
|
14
|
-
import dateformat from 'dateformat'
|
|
15
|
-
import fs from 'node:fs'
|
|
16
|
-
import pkg from './package.json'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Changlog context.
|
|
20
|
-
*
|
|
21
|
-
* @extends {GeneratedContext}
|
|
22
|
-
*/
|
|
23
|
-
interface Context extends GeneratedContext {
|
|
24
|
-
currentTag: string
|
|
25
|
-
linkCompare: boolean
|
|
26
|
-
previousTag: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Changelog configuration options.
|
|
31
|
-
*
|
|
32
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits
|
|
33
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core
|
|
34
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer
|
|
35
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser
|
|
36
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/git-raw-commits
|
|
37
|
-
*
|
|
38
|
-
* @const {Config} config
|
|
39
|
-
*/
|
|
40
|
-
const config: Config = {
|
|
41
|
-
options: {
|
|
42
|
-
preset: {
|
|
43
|
-
header: '',
|
|
44
|
-
name: 'conventionalcommits',
|
|
45
|
-
releaseCommitMessageFormat: 'release: {{currentTag}}',
|
|
46
|
-
types: [
|
|
47
|
-
{ section: ':package: Build', type: 'build' },
|
|
48
|
-
{ section: ':house_with_garden: Housekeeping', type: 'chore' },
|
|
49
|
-
{ section: ':robot: Continuous Integration', type: 'ci' },
|
|
50
|
-
{ section: ':pencil: Documentation', type: 'docs' },
|
|
51
|
-
{ section: ':sparkles: Features', type: 'feat' },
|
|
52
|
-
{ section: ':bug: Fixes', type: 'fix' },
|
|
53
|
-
{ section: ':fire: Performance Improvements', type: 'perf' },
|
|
54
|
-
{ section: ':zap: Refactors', type: 'refactor' },
|
|
55
|
-
{ section: ':rewind: Reverts', type: 'revert' },
|
|
56
|
-
{ hidden: true, type: 'style' },
|
|
57
|
-
{ section: ':white_check_mark: Testing', type: 'test' },
|
|
58
|
-
{ hidden: true, type: 'wip' }
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
skipUnstable: false,
|
|
62
|
-
tagPrefix: pkg.tagPrefix,
|
|
63
|
-
/**
|
|
64
|
-
* Raw commit transformer.
|
|
65
|
-
*
|
|
66
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core#transform-1
|
|
67
|
-
*
|
|
68
|
-
* @param {CommitRaw} commit - Raw commit object
|
|
69
|
-
* @param {Options.Transform.Callback} apply - Commit handler
|
|
70
|
-
* @return {void} Nothing when complete
|
|
71
|
-
*/
|
|
72
|
-
transform(commit: CommitRaw, apply: Options.Transform.Callback): void {
|
|
73
|
-
commit.committerDate = dateformat(commit.committerDate, 'yyyy-mm-dd')
|
|
74
|
-
|
|
75
|
-
if (commit.gitTags) {
|
|
76
|
-
/**
|
|
77
|
-
* Regex expression used to check {@link commit.gitTags} for the release
|
|
78
|
-
* {@link commit} belongs to.
|
|
79
|
-
*
|
|
80
|
-
* @const {RegExp} vgx
|
|
81
|
-
*/
|
|
82
|
-
const vgx: RegExp = pkg.tagPrefix
|
|
83
|
-
? new RegExp(`tag:\\s*[=]?${pkg.tagPrefix}(.+?)[,)]`, 'gi')
|
|
84
|
-
: /tag:\s*[=v]?(.+?)[),]/gi
|
|
85
|
-
|
|
86
|
-
commit = Object.assign({}, commit, {
|
|
87
|
-
version: vgx.exec(commit.gitTags)?.[1] ?? undefined
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
commit.notes = commit.notes.map(note => ({
|
|
92
|
-
...note,
|
|
93
|
-
text: note.text.replace(/(\n?\n?Signed-off-by:).+/gm, '')
|
|
94
|
-
}))
|
|
95
|
-
|
|
96
|
-
return void apply(null, {
|
|
97
|
-
...commit,
|
|
98
|
-
raw: commit,
|
|
99
|
-
shortHash: commit.hash.slice(0, 7)
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
parserOpts: {
|
|
104
|
-
issuePrefixesCaseSensitive: true
|
|
105
|
-
},
|
|
106
|
-
writerOpts: {
|
|
107
|
-
/**
|
|
108
|
-
* Sorts commit groups in descending order by group title.
|
|
109
|
-
*
|
|
110
|
-
* GitHub emojis in titles will be ignored.
|
|
111
|
-
*
|
|
112
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commitgroupssort
|
|
113
|
-
*
|
|
114
|
-
* @param {CommitGroup} a - Commit group object
|
|
115
|
-
* @param {CommitGroup} b - Commit group object to compare to `a`
|
|
116
|
-
* @return {number} Compare result
|
|
117
|
-
*/
|
|
118
|
-
commitGroupsSort(a: CommitGroup, b: CommitGroup): number {
|
|
119
|
-
if (a.title === false) return 1
|
|
120
|
-
if (b.title === false) return -1
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Regex used to extract commit group titles without GitHub emojis.
|
|
124
|
-
*
|
|
125
|
-
* @const {RegExp} tgx - Regex used to extract commit group title
|
|
126
|
-
*/
|
|
127
|
-
const tgx: RegExp = /([A-Z])\w+/
|
|
128
|
-
|
|
129
|
-
return tgx.exec(a.title)![0]!.localeCompare(tgx.exec(b.title)![0]!)
|
|
130
|
-
},
|
|
131
|
-
/**
|
|
132
|
-
* Sorts commits in descending order by commit header and date.
|
|
133
|
-
*
|
|
134
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commitssort
|
|
135
|
-
*
|
|
136
|
-
* @param {Commit} a - Commit object
|
|
137
|
-
* @param {Commit} b - Commit object to compare to `b`
|
|
138
|
-
* @return {number} Compare result
|
|
139
|
-
*/
|
|
140
|
-
commitsSort(a: Commit, b: Commit): number {
|
|
141
|
-
/**
|
|
142
|
-
* Compare result for {@link b.committerDate} & {@link a.committerDate}.
|
|
143
|
-
*
|
|
144
|
-
* @const {number} by_date
|
|
145
|
-
*/
|
|
146
|
-
const by_date: number =
|
|
147
|
-
new Date(b.committerDate).getTime() -
|
|
148
|
-
new Date(a.committerDate).getTime()
|
|
149
|
-
|
|
150
|
-
return a.header && b.header
|
|
151
|
-
? a.header.localeCompare(b.header) || by_date
|
|
152
|
-
: by_date
|
|
153
|
-
},
|
|
154
|
-
/**
|
|
155
|
-
* Modifies `context` before the changelog is generated.
|
|
156
|
-
*
|
|
157
|
-
* This includes:
|
|
158
|
-
*
|
|
159
|
-
* - Setting the release date to the current date
|
|
160
|
-
* - Setting the current release tag
|
|
161
|
-
* - Setting the previous release tag
|
|
162
|
-
* - Setting compare link generation
|
|
163
|
-
*
|
|
164
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core#finalizecontext
|
|
165
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#finalizecontext
|
|
166
|
-
*
|
|
167
|
-
* @param {GeneratedContext} context - Generated changelog context
|
|
168
|
-
* @return {Context} Final changelog context
|
|
169
|
-
*/
|
|
170
|
-
finalizeContext(context: GeneratedContext): Context {
|
|
171
|
-
/**
|
|
172
|
-
* Use current date as release date instead of date of most recent commit.
|
|
173
|
-
*
|
|
174
|
-
* @see https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-writer/lib/util.js#L194-L196
|
|
175
|
-
*/
|
|
176
|
-
context.date = dateformat(new Date(), 'yyyy-mm-dd')
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Release tag for upcoming version.
|
|
180
|
-
*
|
|
181
|
-
* @const {string} currentTag
|
|
182
|
-
*/
|
|
183
|
-
const currentTag: string = pkg.tagPrefix + pkg.version
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Release tag for previous version.
|
|
187
|
-
*
|
|
188
|
-
* @const {string} previousTag
|
|
189
|
-
*/
|
|
190
|
-
const previousTag: string = context.gitSemverTags[0]!
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
...context,
|
|
194
|
-
currentTag,
|
|
195
|
-
linkCompare: currentTag !== previousTag,
|
|
196
|
-
previousTag
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
headerPartial: fs.readFileSync('templates/changelog/header.hbs', 'utf8'),
|
|
200
|
-
ignoreReverted: false
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
module.exports = config
|
package/dist/constants.d.mts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Constants
|
|
3
|
-
* @module mlly/constants
|
|
4
|
-
*/
|
|
5
|
-
import type { Ext } from './types/index.mjs';
|
|
6
|
-
/**
|
|
7
|
-
* Default export conditions.
|
|
8
|
-
*
|
|
9
|
-
* @see https://nodejs.org/api/packages.html#conditional-exports
|
|
10
|
-
*
|
|
11
|
-
* @const {Readonly<Set<string>>} CONDITIONS
|
|
12
|
-
*/
|
|
13
|
-
export declare const CONDITIONS: Readonly<Set<string>>;
|
|
14
|
-
/**
|
|
15
|
-
* Default resolvable file extensions.
|
|
16
|
-
*
|
|
17
|
-
* @const {ReadonlyArray<Ext>} RESOLVE_EXTENSIONS
|
|
18
|
-
*/
|
|
19
|
-
export declare const RESOLVE_EXTENSIONS: readonly Ext[];
|
package/dist/constants.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const CONDITIONS = Object.freeze(
|
|
2
|
-
/* @__PURE__ */ new Set(["node", "import"])
|
|
3
|
-
);
|
|
4
|
-
const RESOLVE_EXTENSIONS = Object.freeze([
|
|
5
|
-
".mjs",
|
|
6
|
-
".mts",
|
|
7
|
-
".cjs",
|
|
8
|
-
".cts",
|
|
9
|
-
".js",
|
|
10
|
-
".ts",
|
|
11
|
-
".jsx",
|
|
12
|
-
".tsx",
|
|
13
|
-
".css",
|
|
14
|
-
".json",
|
|
15
|
-
".node",
|
|
16
|
-
".wasm",
|
|
17
|
-
".d.mts",
|
|
18
|
-
".d.cts",
|
|
19
|
-
".d.ts"
|
|
20
|
-
]);
|
|
21
|
-
export {
|
|
22
|
-
CONDITIONS,
|
|
23
|
-
RESOLVE_EXTENSIONS
|
|
24
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Internals - CompilerOptionsJson
|
|
3
|
-
* @module mlly/internal/CompilerOptionsJson
|
|
4
|
-
*/
|
|
5
|
-
import type { CompilerOptionsValue, MapLike } from 'typescript';
|
|
6
|
-
/**
|
|
7
|
-
* TypeScript compiler options provided by a user.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*
|
|
11
|
-
* @see https://www.typescriptlang.org/tsconfig
|
|
12
|
-
*/
|
|
13
|
-
interface CompilerOptionsJson {
|
|
14
|
-
allowJs?: boolean;
|
|
15
|
-
allowSyntheticDefaultImports?: boolean;
|
|
16
|
-
allowUmdGlobalAccess?: boolean;
|
|
17
|
-
allowUnreachableCode?: boolean;
|
|
18
|
-
allowUnusedLabels?: boolean;
|
|
19
|
-
alwaysStrict?: boolean;
|
|
20
|
-
assumeChangesOnlyAffectDirectDependencies?: boolean;
|
|
21
|
-
baseUrl?: string;
|
|
22
|
-
charset?: string;
|
|
23
|
-
checkJs?: boolean;
|
|
24
|
-
composite?: boolean;
|
|
25
|
-
declaration?: boolean;
|
|
26
|
-
declarationDir?: string;
|
|
27
|
-
declarationMap?: boolean;
|
|
28
|
-
disableReferencedProjectLoad?: boolean;
|
|
29
|
-
disableSizeLimit?: boolean;
|
|
30
|
-
disableSolutionSearching?: boolean;
|
|
31
|
-
disableSourceOfProjectReferenceRedirect?: boolean;
|
|
32
|
-
downlevelIteration?: boolean;
|
|
33
|
-
emitBOM?: boolean;
|
|
34
|
-
emitDeclarationOnly?: boolean;
|
|
35
|
-
emitDecoratorMetadata?: boolean;
|
|
36
|
-
esModuleInterop?: boolean;
|
|
37
|
-
exactOptionalPropertyTypes?: boolean;
|
|
38
|
-
experimentalDecorators?: boolean;
|
|
39
|
-
forceConsistentCasingInFileNames?: boolean;
|
|
40
|
-
importHelpers?: boolean;
|
|
41
|
-
importsNotUsedAsValues?: 'error' | 'preserve' | 'remove';
|
|
42
|
-
incremental?: boolean;
|
|
43
|
-
inlineSourceMap?: boolean;
|
|
44
|
-
inlineSources?: boolean;
|
|
45
|
-
isolatedModules?: boolean;
|
|
46
|
-
jsx?: 'preserve' | 'react-jsx' | 'react-jsxdev' | 'react-native' | 'react';
|
|
47
|
-
jsxFactory?: string;
|
|
48
|
-
jsxFragmentFactory?: string;
|
|
49
|
-
jsxImportSource?: string;
|
|
50
|
-
keyofStringsOnly?: boolean;
|
|
51
|
-
lib?: ('DOM.Iterable' | 'dom.iterable' | 'DOM' | 'dom' | 'ES5' | 'es5' | 'ES6' | 'es6' | 'ES7' | 'es7' | 'ES2015.Collection' | 'es2015.collection' | 'ES2015.Core' | 'es2015.core' | 'ES2015.Generator' | 'es2015.generator' | 'ES2015.Iterable' | 'es2015.iterable' | 'ES2015.Promise' | 'es2015.promise' | 'ES2015.Proxy' | 'es2015.proxy' | 'ES2015.Reflect' | 'es2015.reflect' | 'ES2015.Symbol.WellKnown' | 'es2015.symbol.wellknown' | 'ES2015.Symbol' | 'es2015.symbol' | 'ES2015' | 'es2015' | 'ES2016.Array.Include' | 'es2016.array.include' | 'ES2016' | 'es2016' | 'ES2017.Intl' | 'es2017.intl' | 'ES2017.Object' | 'es2017.object' | 'ES2017.SharedMemory' | 'es2017.sharedmemory' | 'ES2017.String' | 'es2017.string' | 'ES2017.TypedArrays' | 'es2017.typedarrays' | 'ES2017' | 'es2017' | 'ES2018.AsyncGenerator' | 'es2018.asyncgenerator' | 'ES2018.AsyncIterable' | 'es2018.asynciterable' | 'ES2018.Intl' | 'es2018.intl' | 'ES2018.Promise' | 'es2018.promise' | 'ES2018.Regexp' | 'es2018.regexp' | 'ES2018' | 'es2018' | 'ES2019.Array' | 'es2019.array' | 'ES2019.Object' | 'es2019.object' | 'ES2019.String' | 'es2019.string' | 'ES2019.Symbol' | 'es2019.symbol' | 'ES2019' | 'es2019' | 'ES2020.BigInt' | 'es2020.bigint' | 'ES2020.Intl' | 'es2020.intl' | 'ES2020.Promise' | 'es2020.promise' | 'ES2020.SharedMemory' | 'es2020.sharedmemory' | 'ES2020.String' | 'es2020.string' | 'ES2020.Symbol.WellKnown' | 'es2020.symbol.wellknown' | 'ES2020' | 'es2020' | 'ES2021.Promise' | 'es2021.promise' | 'ES2021.String' | 'es2021.string' | 'ES2021.WeakRef' | 'es2021.weakref' | 'ES2021' | 'es2021' | 'ESNext.Array' | 'esnext.array' | 'ESNext.AsyncIterable' | 'esnext.asynciterable' | 'ESNext.BigInt' | 'esnext.bigint' | 'ESNext.Intl' | 'esnext.intl' | 'ESNext.Promise' | 'esnext.promise' | 'ESNext.String' | 'esnext.string' | 'ESNext.Symbol' | 'esnext.symbol' | 'ESNext.WeakRef' | 'esnext.weakref' | 'ESNext' | 'esnext' | 'ScriptHost' | 'scripthost' | 'WebWorker.ImportScripts' | 'webworker.importscripts' | 'WebWorker.Iterable' | 'webworker.iterable' | 'WebWorker' | 'webworker')[];
|
|
52
|
-
locale?: string;
|
|
53
|
-
mapRoot?: string;
|
|
54
|
-
maxNodeModuleJsDepth?: number;
|
|
55
|
-
module?: 'AMD' | 'amd' | 'CommonJS' | 'commonjs' | 'ES6' | 'es6' | 'ES2015' | 'es2015' | 'ES2020' | 'es2020' | 'ES2022' | 'es2022' | 'ESNext' | 'esnext' | 'Node16' | 'node16' | 'NodeNext' | 'nodenext' | 'None' | 'none' | 'System' | 'system' | 'UMD' | 'umd';
|
|
56
|
-
moduleDetection?: 'auto' | 'force' | 'legacy';
|
|
57
|
-
moduleResolution?: 'classic' | 'node' | 'node16' | 'nodenext';
|
|
58
|
-
moduleSuffixes?: string[];
|
|
59
|
-
newLine?: 'CRLF' | 'crlf' | 'LF' | 'lf';
|
|
60
|
-
noEmit?: boolean;
|
|
61
|
-
noEmitHelpers?: boolean;
|
|
62
|
-
noEmitOnError?: boolean;
|
|
63
|
-
noErrorTruncation?: boolean;
|
|
64
|
-
noFallthroughCasesInSwitch?: boolean;
|
|
65
|
-
noImplicitAny?: boolean;
|
|
66
|
-
noImplicitOverride?: boolean;
|
|
67
|
-
noImplicitReturns?: boolean;
|
|
68
|
-
noImplicitThis?: boolean;
|
|
69
|
-
noImplicitUseStrict?: boolean;
|
|
70
|
-
noLib?: boolean;
|
|
71
|
-
noPropertyAccessFromIndexSignature?: boolean;
|
|
72
|
-
noResolve?: boolean;
|
|
73
|
-
noStrictGenericChecks?: boolean;
|
|
74
|
-
noUncheckedIndexedAccess?: boolean;
|
|
75
|
-
noUnusedLocals?: boolean;
|
|
76
|
-
noUnusedParameters?: boolean;
|
|
77
|
-
out?: string;
|
|
78
|
-
outDir?: string;
|
|
79
|
-
outFile?: string;
|
|
80
|
-
paths?: MapLike<string[]>;
|
|
81
|
-
preserveConstEnums?: boolean;
|
|
82
|
-
preserveSymlinks?: boolean;
|
|
83
|
-
preserveValueImports?: boolean;
|
|
84
|
-
project?: string;
|
|
85
|
-
reactNamespace?: string;
|
|
86
|
-
removeComments?: boolean;
|
|
87
|
-
resolveJsonModule?: boolean;
|
|
88
|
-
rootDir?: string;
|
|
89
|
-
rootDirs?: string[];
|
|
90
|
-
skipDefaultLibCheck?: boolean;
|
|
91
|
-
skipLibCheck?: boolean;
|
|
92
|
-
sourceMap?: boolean;
|
|
93
|
-
sourceRoot?: string;
|
|
94
|
-
strict?: boolean;
|
|
95
|
-
strictBindCallApply?: boolean;
|
|
96
|
-
strictFunctionTypes?: boolean;
|
|
97
|
-
strictNullChecks?: boolean;
|
|
98
|
-
strictPropertyInitialization?: boolean;
|
|
99
|
-
stripInternal?: boolean;
|
|
100
|
-
suppressExcessPropertyErrors?: boolean;
|
|
101
|
-
suppressImplicitAnyIndexErrors?: boolean;
|
|
102
|
-
target?: 'ES3' | 'es3' | 'ES5' | 'es5' | 'ES6' | 'es6' | 'ES2015' | 'es2015' | 'ES2016' | 'es2016' | 'ES2017' | 'es2017' | 'ES2018' | 'es2018' | 'ES2019' | 'es2019' | 'ES2020' | 'es2020' | 'ES2021' | 'es2021' | 'ESNext' | 'esnext';
|
|
103
|
-
traceResolution?: boolean;
|
|
104
|
-
tsBuildInfoFile?: string;
|
|
105
|
-
typeRoots?: string[];
|
|
106
|
-
types?: string[];
|
|
107
|
-
useDefineForClassFields?: boolean;
|
|
108
|
-
useUnknownInCatchVariables?: boolean;
|
|
109
|
-
[option: string]: CompilerOptionsValue | undefined;
|
|
110
|
-
}
|
|
111
|
-
export type { CompilerOptionsJson as default };
|
|
File without changes
|