@flex-development/mlly 1.0.0-alpha.9 → 1.0.0-beta.2
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 +1120 -376
- package/README.md +1555 -12
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +5 -5
- package/dist/interfaces/aliases.d.mts +21 -0
- package/dist/interfaces/condition-map.d.mts +24 -0
- package/dist/interfaces/file-system.d.mts +29 -0
- package/dist/interfaces/get-source-context.d.mts +44 -0
- package/dist/interfaces/get-source-options.d.mts +48 -0
- package/dist/interfaces/index.d.mts +18 -21
- package/dist/interfaces/is-directory.d.mts +17 -0
- package/dist/interfaces/is-file.d.mts +17 -0
- package/dist/interfaces/main-field-map.d.mts +22 -0
- package/dist/interfaces/module-format-map.d.mts +26 -0
- package/dist/interfaces/pattern-key-comparison-map.d.mts +31 -0
- package/dist/interfaces/protocol-map.d.mts +44 -0
- package/dist/interfaces/read-file.d.mts +28 -0
- package/dist/interfaces/realpath.d.mts +30 -0
- package/dist/interfaces/resolve-alias-options.d.mts +43 -0
- package/dist/interfaces/resolve-module-options.d.mts +79 -0
- package/dist/interfaces/stat.d.mts +28 -0
- package/dist/interfaces/stats.d.mts +23 -0
- package/dist/internal/chain-or-call.mjs +34 -0
- package/dist/internal/chars.mjs +17 -0
- package/dist/internal/check-invalid-segments.mjs +49 -0
- package/dist/internal/constant.mjs +23 -0
- package/dist/internal/fs.browser.mjs +42 -0
- package/dist/internal/fs.node.mjs +16 -0
- package/dist/internal/identity.mjs +23 -0
- package/dist/internal/invalid-package-target.mjs +36 -0
- package/dist/internal/invalid-subpath.mjs +37 -0
- package/dist/internal/is-promise.mjs +26 -0
- package/dist/internal/process.browser.mjs +8 -0
- package/dist/lib/can-parse-url.d.mts +23 -0
- package/dist/lib/can-parse-url.mjs +31 -0
- package/dist/lib/cwd.d.mts +14 -0
- package/dist/lib/cwd.mjs +17 -0
- package/dist/lib/default-conditions.d.mts +15 -0
- package/dist/lib/default-conditions.mjs +14 -0
- package/dist/lib/default-extensions.d.mts +14 -0
- package/dist/lib/default-extensions.mjs +29 -0
- package/dist/lib/default-main-fields.d.mts +14 -0
- package/dist/lib/default-main-fields.mjs +13 -0
- package/dist/lib/extension-format-map.d.mts +16 -0
- package/dist/lib/extension-format-map.mjs +31 -0
- package/dist/lib/formats.d.mts +21 -0
- package/dist/lib/formats.mjs +22 -0
- package/dist/lib/get-source.d.mts +46 -0
- package/dist/lib/get-source.mjs +156 -0
- package/dist/lib/index.d.mts +41 -0
- package/dist/lib/index.mjs +41 -0
- package/dist/lib/is-absolute-specifier.d.mts +23 -0
- package/dist/lib/is-absolute-specifier.mjs +34 -0
- package/dist/lib/is-array-index.d.mts +19 -0
- package/dist/lib/is-array-index.mjs +28 -0
- package/dist/lib/is-bare-specifier.d.mts +23 -0
- package/dist/lib/is-bare-specifier.mjs +33 -0
- package/dist/lib/is-directory.d.mts +27 -0
- package/dist/lib/is-directory.mjs +54 -0
- package/dist/lib/is-file.d.mts +27 -0
- package/dist/lib/is-file.mjs +54 -0
- package/dist/lib/is-imports-subpath.d.mts +26 -0
- package/dist/lib/is-imports-subpath.mjs +28 -0
- package/dist/lib/is-module-id.d.mts +23 -0
- package/dist/lib/is-module-id.mjs +24 -0
- package/dist/lib/is-relative-specifier.d.mts +23 -0
- package/dist/lib/is-relative-specifier.mjs +36 -0
- package/dist/lib/lookup-package-scope.d.mts +49 -0
- package/dist/lib/lookup-package-scope.mjs +102 -0
- package/dist/lib/pattern-key-compare.d.mts +28 -0
- package/dist/lib/pattern-key-compare.mjs +71 -0
- package/dist/lib/pattern-match.d.mts +22 -0
- package/dist/lib/pattern-match.mjs +85 -0
- package/dist/lib/read-package-json.d.mts +63 -0
- package/dist/lib/read-package-json.mjs +115 -0
- package/dist/lib/resolve-alias.d.mts +21 -0
- package/dist/lib/resolve-alias.mjs +102 -0
- package/dist/lib/resolve-module.d.mts +43 -0
- package/dist/lib/resolve-module.mjs +186 -0
- package/dist/lib/resolver.d.mts +346 -0
- package/dist/lib/resolver.mjs +1015 -0
- package/dist/lib/root.d.mts +11 -0
- package/dist/lib/root.mjs +12 -0
- package/dist/lib/to-relative-specifier.d.mts +27 -0
- package/dist/lib/to-relative-specifier.mjs +63 -0
- package/dist/lib/to-url.d.mts +26 -0
- package/dist/lib/to-url.mjs +34 -0
- package/dist/types/awaitable.d.mts +12 -0
- package/dist/types/change-ext-fn.d.mts +29 -0
- package/dist/types/condition.d.mts +13 -0
- package/dist/types/dot.d.mts +9 -0
- package/dist/types/empty-array.d.mts +9 -0
- package/dist/types/empty-object.d.mts +19 -0
- package/dist/types/empty-string.d.mts +9 -0
- package/dist/types/ext.d.mts +12 -0
- package/dist/types/get-source-handler.d.mts +22 -0
- package/dist/types/get-source-handlers.d.mts +15 -0
- package/dist/types/index.d.mts +19 -10
- package/dist/types/list.d.mts +12 -0
- 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 +3 -4
- package/dist/types/numeric.d.mts +9 -0
- package/dist/types/pattern-key-comparison.d.mts +14 -0
- package/dist/types/pattern-match.d.mts +10 -0
- package/dist/types/protocol.d.mts +6 -7
- package/package.json +151 -158
- package/changelog.config.ts +0 -404
- package/dist/enums/assert-type.d.mts +0 -21
- package/dist/enums/assert-type.mjs +0 -10
- package/dist/enums/assert-type.mjs.map +0 -6
- package/dist/enums/format.d.mts +0 -17
- package/dist/enums/format.mjs +0 -13
- package/dist/enums/format.mjs.map +0 -6
- package/dist/enums/index.d.mts +0 -10
- package/dist/enums/index.mjs +0 -15
- package/dist/enums/index.mjs.map +0 -6
- package/dist/enums/kind-specifier-syntax.d.mts +0 -14
- package/dist/enums/kind-specifier-syntax.mjs +0 -10
- package/dist/enums/kind-specifier-syntax.mjs.map +0 -6
- package/dist/enums/kind-specifier.d.mts +0 -17
- package/dist/enums/kind-specifier.mjs +0 -11
- package/dist/enums/kind-specifier.mjs.map +0 -6
- package/dist/enums/kind-statement-syntax.d.mts +0 -22
- package/dist/enums/kind-statement-syntax.mjs +0 -18
- package/dist/enums/kind-statement-syntax.mjs.map +0 -6
- package/dist/enums/kind-statement.d.mts +0 -15
- package/dist/enums/kind-statement.mjs +0 -11
- package/dist/enums/kind-statement.mjs.map +0 -6
- package/dist/index.mjs.map +0 -6
- package/dist/interfaces/import-assertions.d.mts +0 -20
- package/dist/interfaces/import-dynamic.d.mts +0 -43
- package/dist/interfaces/import-static.d.mts +0 -37
- package/dist/interfaces/index.mjs +0 -1
- package/dist/interfaces/index.mjs.map +0 -6
- package/dist/interfaces/options-fill-module.d.mts +0 -23
- package/dist/interfaces/options-find-subpath.d.mts +0 -49
- package/dist/interfaces/options-get-format.d.mts +0 -83
- package/dist/interfaces/options-get-source.d.mts +0 -63
- package/dist/interfaces/options-parse-module-id.d.mts +0 -33
- package/dist/interfaces/options-parse-subpath.d.mts +0 -31
- package/dist/interfaces/options-resolve-alias.d.mts +0 -53
- package/dist/interfaces/options-resolve-module.d.mts +0 -64
- 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 -40
- 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/escape-reg-exp.d.mts +0 -16
- package/dist/internal/escape-reg-exp.mjs +0 -10
- package/dist/internal/escape-reg-exp.mjs.map +0 -6
- package/dist/internal/format-type-map.d.mts +0 -17
- package/dist/internal/format-type-map.mjs +0 -13
- package/dist/internal/format-type-map.mjs.map +0 -6
- package/dist/internal/get-specifier-kind.d.mts +0 -17
- package/dist/internal/get-specifier-kind.mjs +0 -14
- package/dist/internal/get-specifier-kind.mjs.map +0 -6
- package/dist/internal/get-subpaths.d.mts +0 -25
- package/dist/internal/get-subpaths.mjs +0 -10
- package/dist/internal/get-subpaths.mjs.map +0 -6
- package/dist/internal/is-array-index.d.mts +0 -15
- package/dist/internal/is-array-index.mjs +0 -9
- package/dist/internal/is-array-index.mjs.map +0 -6
- package/dist/internal/is-directory.d.mts +0 -13
- package/dist/internal/is-directory.mjs +0 -16
- package/dist/internal/is-directory.mjs.map +0 -6
- package/dist/internal/is-file.d.mts +0 -13
- package/dist/internal/is-file.mjs +0 -16
- package/dist/internal/is-file.mjs.map +0 -6
- package/dist/internal/is-function.d.mts +0 -12
- package/dist/internal/is-function.mjs +0 -8
- package/dist/internal/is-function.mjs.map +0 -6
- package/dist/internal/regex-encoded-sep.d.mts +0 -13
- package/dist/internal/regex-encoded-sep.mjs +0 -6
- package/dist/internal/regex-encoded-sep.mjs.map +0 -6
- package/dist/internal/regex-internal-specifier.d.mts +0 -14
- package/dist/internal/regex-internal-specifier.mjs +0 -6
- package/dist/internal/regex-internal-specifier.mjs.map +0 -6
- package/dist/internal/regex-package-name.d.mts +0 -13
- package/dist/internal/regex-package-name.mjs +0 -6
- package/dist/internal/regex-package-name.mjs.map +0 -6
- package/dist/internal/regex-package-path.d.mts +0 -15
- package/dist/internal/regex-package-path.mjs +0 -6
- package/dist/internal/regex-package-path.mjs.map +0 -6
- package/dist/internal/resolver.d.mts +0 -130
- package/dist/internal/resolver.mjs +0 -500
- package/dist/internal/resolver.mjs.map +0 -6
- package/dist/internal/validate-boolean.d.mts +0 -20
- package/dist/internal/validate-boolean.mjs +0 -11
- package/dist/internal/validate-boolean.mjs.map +0 -6
- package/dist/internal/validate-object.d.mts +0 -23
- package/dist/internal/validate-object.mjs +0 -11
- package/dist/internal/validate-object.mjs.map +0 -6
- package/dist/internal/validate-set.d.mts +0 -23
- package/dist/internal/validate-set.mjs +0 -11
- package/dist/internal/validate-set.mjs.map +0 -6
- package/dist/internal/validate-string.d.mts +0 -20
- package/dist/internal/validate-string.mjs +0 -11
- package/dist/internal/validate-string.mjs.map +0 -6
- package/dist/internal/validate-url-string.d.mts +0 -22
- package/dist/internal/validate-url-string.mjs +0 -12
- package/dist/internal/validate-url-string.mjs.map +0 -6
- package/dist/types/declaration.d.mts +0 -9
- package/dist/types/fn-change-ext.d.mts +0 -28
- package/dist/types/index.mjs +0 -1
- package/dist/types/index.mjs.map +0 -6
- 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 -24
- package/dist/utils/compare-subpaths.mjs.map +0 -6
- package/dist/utils/conditions.d.mts +0 -13
- package/dist/utils/conditions.mjs +0 -6
- package/dist/utils/conditions.mjs.map +0 -6
- package/dist/utils/detect-syntax.d.mts +0 -21
- package/dist/utils/detect-syntax.mjs +0 -12
- package/dist/utils/detect-syntax.mjs.map +0 -6
- 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 -6
- package/dist/utils/extract-statements.d.mts +0 -21
- package/dist/utils/extract-statements.mjs +0 -21
- package/dist/utils/extract-statements.mjs.map +0 -6
- package/dist/utils/fill-modules.d.mts +0 -23
- package/dist/utils/fill-modules.mjs +0 -62
- package/dist/utils/fill-modules.mjs.map +0 -6
- package/dist/utils/find-dynamic-imports.d.mts +0 -18
- package/dist/utils/find-dynamic-imports.mjs +0 -39
- package/dist/utils/find-dynamic-imports.mjs.map +0 -6
- package/dist/utils/find-exports.d.mts +0 -21
- package/dist/utils/find-exports.mjs +0 -95
- package/dist/utils/find-exports.mjs.map +0 -6
- 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 -6
- package/dist/utils/find-static-imports.d.mts +0 -18
- package/dist/utils/find-static-imports.mjs +0 -34
- package/dist/utils/find-static-imports.mjs.map +0 -6
- package/dist/utils/find-subpath.d.mts +0 -30
- package/dist/utils/find-subpath.mjs +0 -106
- package/dist/utils/find-subpath.mjs.map +0 -6
- package/dist/utils/get-format.d.mts +0 -24
- package/dist/utils/get-format.mjs +0 -111
- package/dist/utils/get-format.mjs.map +0 -6
- package/dist/utils/get-source.d.mts +0 -22
- package/dist/utils/get-source.mjs +0 -63
- package/dist/utils/get-source.mjs.map +0 -6
- 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 -6
- 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 -6
- package/dist/utils/index.d.mts +0 -42
- package/dist/utils/index.mjs +0 -79
- package/dist/utils/index.mjs.map +0 -6
- package/dist/utils/is-absolute-specifier.d.mts +0 -19
- package/dist/utils/is-absolute-specifier.mjs +0 -25
- package/dist/utils/is-absolute-specifier.mjs.map +0 -6
- package/dist/utils/is-bare-specifier.d.mts +0 -19
- package/dist/utils/is-bare-specifier.mjs +0 -10
- package/dist/utils/is-bare-specifier.mjs.map +0 -6
- package/dist/utils/is-exports-sugar.d.mts +0 -25
- package/dist/utils/is-exports-sugar.mjs +0 -26
- package/dist/utils/is-exports-sugar.mjs.map +0 -6
- package/dist/utils/is-relative-specifier.d.mts +0 -20
- package/dist/utils/is-relative-specifier.mjs +0 -11
- package/dist/utils/is-relative-specifier.mjs.map +0 -6
- package/dist/utils/lookup-package-scope.d.mts +0 -26
- package/dist/utils/lookup-package-scope.mjs +0 -38
- package/dist/utils/lookup-package-scope.mjs.map +0 -6
- 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 -6
- package/dist/utils/parse-module-id.d.mts +0 -22
- package/dist/utils/parse-module-id.mjs +0 -122
- package/dist/utils/parse-module-id.mjs.map +0 -6
- package/dist/utils/parse-subpath.d.mts +0 -35
- package/dist/utils/parse-subpath.mjs +0 -54
- package/dist/utils/parse-subpath.mjs.map +0 -6
- 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 -6
- package/dist/utils/read-package-json.d.mts +0 -26
- package/dist/utils/read-package-json.mjs +0 -43
- package/dist/utils/read-package-json.mjs.map +0 -6
- package/dist/utils/resolve-alias.d.mts +0 -20
- package/dist/utils/resolve-alias.mjs +0 -106
- package/dist/utils/resolve-alias.mjs.map +0 -6
- package/dist/utils/resolve-aliases.d.mts +0 -19
- package/dist/utils/resolve-aliases.mjs +0 -28
- package/dist/utils/resolve-aliases.mjs.map +0 -6
- 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 -6
- package/dist/utils/resolve-module.d.mts +0 -39
- package/dist/utils/resolve-module.mjs +0 -64
- package/dist/utils/resolve-module.mjs.map +0 -6
- package/dist/utils/resolve-modules.d.mts +0 -25
- package/dist/utils/resolve-modules.mjs +0 -26
- package/dist/utils/resolve-modules.mjs.map +0 -6
- 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 -6
- package/dist/utils/to-bare-specifier.d.mts +0 -42
- package/dist/utils/to-bare-specifier.mjs +0 -90
- package/dist/utils/to-bare-specifier.mjs.map +0 -6
- package/dist/utils/to-data-url.d.mts +0 -30
- package/dist/utils/to-data-url.mjs +0 -11
- package/dist/utils/to-data-url.mjs.map +0 -6
- package/dist/utils/to-node-url.d.mts +0 -19
- package/dist/utils/to-node-url.mjs +0 -10
- package/dist/utils/to-node-url.mjs.map +0 -6
- package/dist/utils/to-relative-specifier.d.mts +0 -22
- package/dist/utils/to-relative-specifier.mjs +0 -21
- package/dist/utils/to-relative-specifier.mjs.map +0 -6
- package/dist/utils/to-url.d.mts +0 -22
- package/dist/utils/to-url.mjs +0 -12
- package/dist/utils/to-url.mjs.map +0 -6
- package/dist/utils/validate-assertions.d.mts +0 -23
- package/dist/utils/validate-assertions.mjs +0 -52
- package/dist/utils/validate-assertions.mjs.map +0 -6
- package/dist/utils/validate-exports.d.mts +0 -24
- package/dist/utils/validate-exports.mjs +0 -72
- package/dist/utils/validate-exports.mjs.map +0 -6
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file lookupPackageScope
|
|
3
|
-
* @module mlly/utils/lookupPackageScope
|
|
4
|
-
*/
|
|
5
|
-
import type { PackageScope } from '../interfaces/index.mjs';
|
|
6
|
-
import type { ModuleId } from '../types/index.mjs';
|
|
7
|
-
import type { Nullable } from '@flex-development/tutils';
|
|
8
|
-
/**
|
|
9
|
-
* Finds a `package.json` file for the given module `id`. Ends the search at the
|
|
10
|
-
* given end point **after** checking for a `package.json` file.
|
|
11
|
-
*
|
|
12
|
-
* Returns `null` if a `package.json` file is not found.
|
|
13
|
-
*
|
|
14
|
-
* @see {@linkcode ModuleId}
|
|
15
|
-
* @see {@linkcode PackageScope}
|
|
16
|
-
*
|
|
17
|
-
* @param {ModuleId} id - Id of module to get package scope for
|
|
18
|
-
* @param {ModuleId?} [stopdir=pathe.sep] - Directory to end search
|
|
19
|
-
* @param {string?} [specifier] - Module specifier passed by user
|
|
20
|
-
* @param {ModuleId?} [parent] - Id of module to resolve from
|
|
21
|
-
* @return {?PackageScope} Package scope result or `null`
|
|
22
|
-
* @throws {NodeError<TypeError>} If either `id` or `stopdir` is not an instance
|
|
23
|
-
* of {@linkcode URL} or a string
|
|
24
|
-
*/
|
|
25
|
-
declare const lookupPackageScope: (id: ModuleId, stopdir?: ModuleId, specifier?: string, parent?: ModuleId) => Nullable<PackageScope>;
|
|
26
|
-
export default lookupPackageScope;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import validateURLString from "../internal/validate-url-string.mjs";
|
|
2
|
-
import pathe from "@flex-development/pathe";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import readPackageJson from "./read-package-json.mjs";
|
|
5
|
-
import toURL from "./to-url.mjs";
|
|
6
|
-
const lookupPackageScope = (id, stopdir = pathe.sep, specifier, parent) => {
|
|
7
|
-
validateURLString(id, "id");
|
|
8
|
-
validateURLString(stopdir, "stopdir");
|
|
9
|
-
stopdir = toURL(stopdir).pathname;
|
|
10
|
-
let dir = toURL(id).pathname;
|
|
11
|
-
let scope = null;
|
|
12
|
-
while (dir && !dir.endsWith("node_modules")) {
|
|
13
|
-
if (pathe.relative(stopdir, dir).startsWith("../"))
|
|
14
|
-
break;
|
|
15
|
-
const pkgjson = readPackageJson(
|
|
16
|
-
dir,
|
|
17
|
-
specifier,
|
|
18
|
-
parent
|
|
19
|
-
);
|
|
20
|
-
if (pkgjson) {
|
|
21
|
-
scope = {
|
|
22
|
-
dir: pathToFileURL(dir = pathe.resolve(process.cwd(), dir)).href,
|
|
23
|
-
pkg: pathToFileURL(pathe.join(dir, "package.json")).href,
|
|
24
|
-
pkgjson
|
|
25
|
-
};
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
if (dir === stopdir.replace(/\/$/, ""))
|
|
29
|
-
break;
|
|
30
|
-
dir = pathe.dirname(dir);
|
|
31
|
-
}
|
|
32
|
-
return scope;
|
|
33
|
-
};
|
|
34
|
-
var lookup_package_scope_default = lookupPackageScope;
|
|
35
|
-
export {
|
|
36
|
-
lookup_package_scope_default as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=lookup-package-scope.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/lookup-package-scope.ts"],
|
|
4
|
-
"mappings": "AAMA,OAAO,uBAAuB;AAG9B,OAAO,WAAW;AAGlB,SAAS,qBAAqB;AAC9B,OAAO,qBAAqB;AAC5B,OAAO,WAAW;AAmBlB,MAAM,qBAAqB,CACzB,IACA,UAAoB,MAAM,KAC1B,WACA,WAC2B;AAC3B,oBAAkB,IAAI,IAAI;AAC1B,oBAAkB,SAAS,SAAS;AAGpC,YAAU,MAAM,OAAO,EAAE;AAOzB,MAAI,MAAc,MAAM,EAAE,EAAE;AAO5B,MAAI,QAAgC;AAGpC,SAAO,OAAO,CAAC,IAAI,SAAS,cAAc,GAAG;AAE3C,QAAI,MAAM,SAAS,SAAS,GAAG,EAAE,WAAW,KAAK;AAAG;AAOpD,UAAM,UAAiC;AAAA,MACrC;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAGA,QAAI,SAAS;AACX,cAAQ;AAAA,QACN,KAAK,cAAe,MAAM,MAAM,QAAQ,QAAQ,IAAI,GAAG,GAAG,CAAE,EAAE;AAAA,QAC9D,KAAK,cAAc,MAAM,KAAK,KAAK,cAAc,CAAC,EAAE;AAAA,QACpD;AAAA,MACF;AAEA;AAAA,IACF;AAGA,QAAI,QAAQ,QAAQ,QAAQ,OAAO,EAAE;AAAG;AAGxC,UAAM,MAAM,QAAQ,GAAG;AAAA,EACzB;AAEA,SAAO;AACT;AAEA,IAAO,+BAAQ;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file parseDataURL
|
|
3
|
-
* @module mlly/utils/parseDataURL
|
|
4
|
-
*/
|
|
5
|
-
import type { ParsedDataUrl } from '../interfaces/index.mjs';
|
|
6
|
-
import type { URL } from 'node:url';
|
|
7
|
-
/**
|
|
8
|
-
* Parses a [`data:` URL][1].
|
|
9
|
-
*
|
|
10
|
-
* If valid, returns an object representing the given `url`.
|
|
11
|
-
*
|
|
12
|
-
* **Note**: A [MIME type][2] string is required.
|
|
13
|
-
*
|
|
14
|
-
* [1]: https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
|
|
15
|
-
* [2]: https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types
|
|
16
|
-
*
|
|
17
|
-
* @see https://nodejs.org/api/esm.html#data-imports
|
|
18
|
-
*
|
|
19
|
-
* @param {URL | string} url - URL to evaluate
|
|
20
|
-
* @return {ParsedDataUrl} Object representing `url`
|
|
21
|
-
* @throws {ErrInvalidUrl | NodeError<TypeError>} If `url` is not a string or
|
|
22
|
-
* instance of {@linkcode URL}, or if `url` not a valid `data:` URL
|
|
23
|
-
*/
|
|
24
|
-
declare const parseDataURL: (url: URL | string) => ParsedDataUrl;
|
|
25
|
-
export default parseDataURL;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ERR_INVALID_URL
|
|
3
|
-
} from "@flex-development/errnode";
|
|
4
|
-
import toURL from "./to-url.mjs";
|
|
5
|
-
const parseDataURL = (url) => {
|
|
6
|
-
url = toURL(url);
|
|
7
|
-
const regex = /^(?<protocol>data:)(?<mime>[^/]+\/[^,;]+)[^,]*?(?:;(?<base64>base64))?,(?<data>[\S\s]*?)$/;
|
|
8
|
-
const match = regex.exec(url.href);
|
|
9
|
-
if (!match)
|
|
10
|
-
throw new ERR_INVALID_URL(url.href);
|
|
11
|
-
const [, , mime = "", base64, data = ""] = match;
|
|
12
|
-
return {
|
|
13
|
-
base64: !!base64,
|
|
14
|
-
data: data.trim(),
|
|
15
|
-
href: url.href,
|
|
16
|
-
mime,
|
|
17
|
-
pathname: url.pathname,
|
|
18
|
-
protocol: url.protocol
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
var parse_data_url_default = parseDataURL;
|
|
22
|
-
export {
|
|
23
|
-
parse_data_url_default as default
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=parse-data-url.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/parse-data-url.ts"],
|
|
4
|
-
"mappings": "AAMA;AAAA,EACE;AAAA,OAGK;AAGP,OAAO,WAAW;AAmBlB,MAAM,eAAe,CAAC,QAAqC;AAEzD,QAAM,MAAM,GAAG;AAUf,QAAM,QACJ;AAOF,QAAM,QAAmC,MAAM,KAAK,IAAI,IAAI;AAG5D,MAAI,CAAC;AAAO,UAAM,IAAI,gBAAgB,IAAI,IAAI;AAG9C,QAAM,CAAC,EAAE,EAAE,OAAO,IAAI,QAAQ,OAAO,EAAE,IAAI;AAE3C,SAAO;AAAA,IACL,QAAQ,CAAC,CAAC;AAAA,IACV,MAAM,KAAK,KAAK;AAAA,IAChB,MAAM,IAAI;AAAA,IACV;AAAA,IACA,UAAU,IAAI;AAAA,IACd,UAAU,IAAI;AAAA,EAChB;AACF;AAEA,IAAO,yBAAQ;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file parseModuleId
|
|
3
|
-
* @module mlly/lib/parseModuleId
|
|
4
|
-
*/
|
|
5
|
-
import type { ParseModuleIdOptions, ParsedModuleId } from '../interfaces/index.mjs';
|
|
6
|
-
import type { ModuleId } from '../types/index.mjs';
|
|
7
|
-
/**
|
|
8
|
-
* Creates an object representation the given module `id`.
|
|
9
|
-
*
|
|
10
|
-
* @see {@linkcode ModuleId}
|
|
11
|
-
* @see {@linkcode ParseModuleIdOptions}
|
|
12
|
-
* @see {@linkcode ParsedModuleId}
|
|
13
|
-
*
|
|
14
|
-
* @param {ModuleId} id - Module id to parse
|
|
15
|
-
* @param {ParseModuleIdOptions?} [options={}] - Parsing options
|
|
16
|
-
* @return {ParsedModuleId} Object representing `id`
|
|
17
|
-
* @throws {NodeError<TypeError>} If `id` is not an instance of {@linkcode URL}
|
|
18
|
-
* or a string, if `id` includes encoded path separators, or if `id` is invalid
|
|
19
|
-
* according to `options.internal` or `options.pkgname`
|
|
20
|
-
*/
|
|
21
|
-
declare const parseModuleId: (id: ModuleId, options?: ParseModuleIdOptions) => ParsedModuleId;
|
|
22
|
-
export default parseModuleId;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import ENCODED_SEP_REGEX from "../internal/regex-encoded-sep.mjs";
|
|
2
|
-
import INTERNAL_SPECIFIER_REGEX from "../internal/regex-internal-specifier.mjs";
|
|
3
|
-
import PACKAGE_PATH_REGEX from "../internal/regex-package-path.mjs";
|
|
4
|
-
import validateURLString from "../internal/validate-url-string.mjs";
|
|
5
|
-
import {
|
|
6
|
-
ERR_INVALID_MODULE_SPECIFIER
|
|
7
|
-
} from "@flex-development/errnode";
|
|
8
|
-
import { isBuiltin } from "@flex-development/is-builtin";
|
|
9
|
-
import pathe from "@flex-development/pathe";
|
|
10
|
-
import { URL, fileURLToPath } from "node:url";
|
|
11
|
-
import isBareSpecifier from "./is-bare-specifier.mjs";
|
|
12
|
-
import isRelativeSpecifier from "./is-relative-specifier.mjs";
|
|
13
|
-
import toNodeURL from "./to-node-url.mjs";
|
|
14
|
-
const parseModuleId = (id, options = {}) => {
|
|
15
|
-
const {
|
|
16
|
-
internal = id instanceof URL ? false : id.startsWith("#"),
|
|
17
|
-
pkgname = false
|
|
18
|
-
} = options;
|
|
19
|
-
validateURLString(id, "id");
|
|
20
|
-
id = id instanceof URL ? id.href : id.trim();
|
|
21
|
-
let error;
|
|
22
|
-
let parsed = {
|
|
23
|
-
internal: false,
|
|
24
|
-
path: id,
|
|
25
|
-
pkg: "",
|
|
26
|
-
protocol: "",
|
|
27
|
-
raw: id,
|
|
28
|
-
scope: "",
|
|
29
|
-
version: "",
|
|
30
|
-
version_prefix: ""
|
|
31
|
-
};
|
|
32
|
-
switch (true) {
|
|
33
|
-
case ENCODED_SEP_REGEX.test(id):
|
|
34
|
-
error = `must not include encoded '${pathe.sep}' or '\\' characters`;
|
|
35
|
-
break;
|
|
36
|
-
case isBuiltin(id):
|
|
37
|
-
const { href, protocol, pathname } = new URL(toNodeURL(id));
|
|
38
|
-
parsed = {
|
|
39
|
-
internal: false,
|
|
40
|
-
path: pathname.replace(/^\S+?(?=\/|$)/, ""),
|
|
41
|
-
pkg: href.replace(/\/.*$/, ""),
|
|
42
|
-
protocol: id.startsWith("node:") ? protocol : "",
|
|
43
|
-
raw: id,
|
|
44
|
-
scope: "",
|
|
45
|
-
version: "",
|
|
46
|
-
version_prefix: ""
|
|
47
|
-
};
|
|
48
|
-
break;
|
|
49
|
-
case INTERNAL_SPECIFIER_REGEX.test(id):
|
|
50
|
-
const [, root = ""] = INTERNAL_SPECIFIER_REGEX.exec(id);
|
|
51
|
-
parsed = {
|
|
52
|
-
internal: true,
|
|
53
|
-
path: id,
|
|
54
|
-
pkg: root,
|
|
55
|
-
protocol: "",
|
|
56
|
-
raw: id,
|
|
57
|
-
scope: "",
|
|
58
|
-
version: "",
|
|
59
|
-
version_prefix: ""
|
|
60
|
-
};
|
|
61
|
-
break;
|
|
62
|
-
case PACKAGE_PATH_REGEX.test(id):
|
|
63
|
-
const [
|
|
64
|
-
,
|
|
65
|
-
pkg = "",
|
|
66
|
-
scope = "",
|
|
67
|
-
version_prefix = "",
|
|
68
|
-
version = "",
|
|
69
|
-
subpath = ""
|
|
70
|
-
] = PACKAGE_PATH_REGEX.exec(id);
|
|
71
|
-
parsed = {
|
|
72
|
-
internal: false,
|
|
73
|
-
path: "." + subpath,
|
|
74
|
-
pkg,
|
|
75
|
-
protocol: "",
|
|
76
|
-
raw: id,
|
|
77
|
-
scope,
|
|
78
|
-
version,
|
|
79
|
-
version_prefix
|
|
80
|
-
};
|
|
81
|
-
break;
|
|
82
|
-
case /^[\w-]{2,}:/.test(id):
|
|
83
|
-
try {
|
|
84
|
-
const { host, protocol: protocol2, pathname: pathname2 } = new URL(id);
|
|
85
|
-
parsed = {
|
|
86
|
-
internal: false,
|
|
87
|
-
path: host + pathname2,
|
|
88
|
-
pkg: "",
|
|
89
|
-
protocol: protocol2,
|
|
90
|
-
raw: id,
|
|
91
|
-
scope: "",
|
|
92
|
-
version: "",
|
|
93
|
-
version_prefix: ""
|
|
94
|
-
};
|
|
95
|
-
} catch {
|
|
96
|
-
error = "is not a valid URL";
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
case isBareSpecifier(id):
|
|
100
|
-
case isRelativeSpecifier(id):
|
|
101
|
-
case pathe.isAbsolute(id):
|
|
102
|
-
break;
|
|
103
|
-
default:
|
|
104
|
-
error = "";
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
error = ENCODED_SEP_REGEX.test(id) ? error : internal && !INTERNAL_SPECIFIER_REGEX.test(id) ? "is not a valid internal imports specifier name" : pkgname && !PACKAGE_PATH_REGEX.test(id) ? "does not start with a valid package name" : error;
|
|
108
|
-
if (error !== void 0) {
|
|
109
|
-
let { parent } = options;
|
|
110
|
-
if (parent !== void 0) {
|
|
111
|
-
validateURLString(parent, "options.parent");
|
|
112
|
-
parent = fileURLToPath(parent);
|
|
113
|
-
}
|
|
114
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(id, error, parent);
|
|
115
|
-
}
|
|
116
|
-
return parsed;
|
|
117
|
-
};
|
|
118
|
-
var parse_module_id_default = parseModuleId;
|
|
119
|
-
export {
|
|
120
|
-
parse_module_id_default as default
|
|
121
|
-
};
|
|
122
|
-
//# sourceMappingURL=parse-module-id.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/parse-module-id.ts"],
|
|
4
|
-
"mappings": "AAMA,OAAO,uBAAuB;AAC9B,OAAO,8BAA8B;AACrC,OAAO,wBAAwB;AAC/B,OAAO,uBAAuB;AAE9B;AAAA,EACE;AAAA,OAEK;AACP,SAAS,iBAAiB;AAC1B,OAAO,WAAW;AAClB,SAAS,KAAK,qBAAqB;AACnC,OAAO,qBAAqB;AAC5B,OAAO,yBAAyB;AAChC,OAAO,eAAe;AAgBtB,MAAM,gBAAgB,CACpB,IACA,UAAgC,CAAC,MACd;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import type { ParseSubpathOptions, ParsedSubpath } from '../interfaces/index.mjs';
|
|
6
|
-
import type { Exports, Imports } from '@flex-development/pkg-types';
|
|
7
|
-
/**
|
|
8
|
-
* Creates an object representation of a subpath export or import from the given
|
|
9
|
-
* module `specifier` after ensuring the subpath defined in `specifier` is also
|
|
10
|
-
* defined in the given package `context`, a `package.json` [`exports`][1] or
|
|
11
|
-
* [`imports`][2] field.
|
|
12
|
-
*
|
|
13
|
-
* ::: warning
|
|
14
|
-
* Does **not** guarantee `specifier` resolves to an existing module.
|
|
15
|
-
* :::
|
|
16
|
-
*
|
|
17
|
-
* [1]: https://nodejs.org/api/packages.html#exports
|
|
18
|
-
* [2]: https://nodejs.org/api/packages.html#imports
|
|
19
|
-
*
|
|
20
|
-
* @see {@linkcode Exports}
|
|
21
|
-
* @see {@linkcode Imports}
|
|
22
|
-
* @see {@linkcode ParseSubpathOptions}
|
|
23
|
-
* @see {@linkcode ParsedSubpath}
|
|
24
|
-
* @see https://nodejs.org/api/packages.html#subpath-exports
|
|
25
|
-
* @see https://nodejs.org/api/packages.html#subpath-imports
|
|
26
|
-
*
|
|
27
|
-
* @param {string} specifier - Module specifier to evaluate
|
|
28
|
-
* @param {Exports | Imports | undefined} context - Package context
|
|
29
|
-
* @param {ParseSubpathOptions} options - Parsing options
|
|
30
|
-
* @return {ParsedSubpath} Object representing package subpath
|
|
31
|
-
* @throws {NodeError<Error | TypeError>} If `specifier` is not a string or the
|
|
32
|
-
* subpath defined in `specifier` is not defined in `context`
|
|
33
|
-
*/
|
|
34
|
-
declare const parseSubpath: (specifier: string, context: Exports | Imports | undefined, options: ParseSubpathOptions) => ParsedSubpath;
|
|
35
|
-
export default parseSubpath;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import getSubpaths from "../internal/get-subpaths.mjs";
|
|
2
|
-
import validateString from "../internal/validate-string.mjs";
|
|
3
|
-
import validateURLString from "../internal/validate-url-string.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ERR_PACKAGE_IMPORT_NOT_DEFINED,
|
|
6
|
-
ERR_PACKAGE_PATH_NOT_EXPORTED
|
|
7
|
-
} from "@flex-development/errnode";
|
|
8
|
-
import pathe from "@flex-development/pathe";
|
|
9
|
-
import { CompareResult } from "@flex-development/tutils";
|
|
10
|
-
import { URL, fileURLToPath, pathToFileURL } from "node:url";
|
|
11
|
-
import compareSubpaths from "./compare-subpaths.mjs";
|
|
12
|
-
import parseModuleId from "./parse-module-id.mjs";
|
|
13
|
-
import PATTERN_CHARACTER from "./pattern-character.mjs";
|
|
14
|
-
const parseSubpath = (specifier, context, options) => {
|
|
15
|
-
const { dir, internal = specifier.startsWith("#"), parent } = options;
|
|
16
|
-
validateString(specifier, "specifier");
|
|
17
|
-
validateURLString(dir, "options.dir");
|
|
18
|
-
const id = parseModuleId(specifier, {
|
|
19
|
-
internal,
|
|
20
|
-
parent,
|
|
21
|
-
pkgname: !internal
|
|
22
|
-
});
|
|
23
|
-
const pkgdir = fileURLToPath(dir).replace(/\/$/, "") + pathe.sep;
|
|
24
|
-
const pkg = new URL("package.json", pathToFileURL(pkgdir));
|
|
25
|
-
const keys = getSubpaths(context, id.internal, pkg, parent);
|
|
26
|
-
let key = null;
|
|
27
|
-
let base = "";
|
|
28
|
-
for (const pkgsubpath of keys) {
|
|
29
|
-
const pattern = pkgsubpath.indexOf(PATTERN_CHARACTER);
|
|
30
|
-
if (pattern === -1 && pkgsubpath === id.path) {
|
|
31
|
-
key = pkgsubpath;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
if (pattern !== -1 && id.path.startsWith(pkgsubpath.slice(0, pattern))) {
|
|
35
|
-
const trailer = pkgsubpath.slice(pattern + 1);
|
|
36
|
-
if (id.path.length >= pkgsubpath.length && id.path.endsWith(trailer) && compareSubpaths(key ?? "", pkgsubpath) === CompareResult.GREATER_THAN && pkgsubpath.lastIndexOf(PATTERN_CHARACTER) === pattern) {
|
|
37
|
-
key = pkgsubpath;
|
|
38
|
-
base = id.path.slice(pattern, id.path.length - trailer.length);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (key === null) {
|
|
43
|
-
let { parent: parent2 } = options;
|
|
44
|
-
validateURLString(parent2, "options.parent");
|
|
45
|
-
parent2 = fileURLToPath(parent2);
|
|
46
|
-
throw internal ? new ERR_PACKAGE_IMPORT_NOT_DEFINED(id.path, parent2, pkgdir) : new ERR_PACKAGE_PATH_NOT_EXPORTED(pkgdir, id.path, parent2);
|
|
47
|
-
}
|
|
48
|
-
return { base, internal, key, raw: id.path, specifier: id.raw };
|
|
49
|
-
};
|
|
50
|
-
var parse_subpath_default = parseSubpath;
|
|
51
|
-
export {
|
|
52
|
-
parse_subpath_default as default
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=parse-subpath.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/parse-subpath.ts"],
|
|
4
|
-
"mappings": "AAUA,OAAO,iBAAiB;AACxB,OAAO,oBAAoB;AAC3B,OAAO,uBAAuB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,OAAO,WAAW;AAElB,SAAS,qBAAoC;AAC7C,SAAS,KAAK,eAAe,qBAAqB;AAClD,OAAO,qBAAqB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO,uBAAuB;AA6B9B,MAAM,eAAe,CACnB,WACA,SACA,YACkB;AAClB,QAAM,EAAE,KAAK,WAAW,UAAU,WAAW,GAAG,GAAG,OAAO,IAAI;AAG9D,iBAAe,WAAW,WAAW;AAGrC,oBAAkB,KAAK,aAAa;AAYpC,QAAM,KAAqB,cAAc,WAAW;AAAA,IAClD;AAAA,IACA;AAAA,IACA,SAAS,CAAC;AAAA,EACZ,CAAC;AAOD,QAAM,SAAiB,cAAc,GAAG,EAAE,QAAQ,OAAO,EAAE,IAAI,MAAM;AAOrE,QAAM,MAAW,IAAI,IAAI,gBAAgB,cAAc,MAAM,CAAC;AAO9D,QAAM,OAAiB,YAAY,SAAS,GAAG,UAAU,KAAK,MAAM;AAOpE,MAAI,MAAwB;AAO5B,MAAI,OAAe;AAGnB,aAAW,cAAc,MAAM;AAM7B,UAAM,UAAkB,WAAW,QAAQ,iBAAiB;AAG5D,QAAI,YAAY,MAAM,eAAe,GAAG,MAAM;AAC5C,YAAM;AACN;AAAA,IACF;AAGA,QAAI,YAAY,MAAM,GAAG,KAAK,WAAW,WAAW,MAAM,GAAG,OAAO,CAAC,GAAG;AAMtE,YAAM,UAAkB,WAAW,MAAM,UAAU,CAAC;AAGpD,UACE,GAAG,KAAK,UAAU,WAAW,UAC7B,GAAG,KAAK,SAAS,OAAO,KACxB,gBAAgB,OAAO,IAAI,UAAU,MAAM,cAAc,gBACzD,WAAW,YAAY,iBAAiB,MAAM,SAC9C;AACA,cAAM;AACN,eAAO,GAAG,KAAK,MAAM,SAAS,GAAG,KAAK,SAAS,QAAQ,MAAM;AAAA,MAC/D;AAAA,IACF;AAAA,EACF;AAGA,MAAI,QAAQ,MAAM;AAChB,QAAI,EAAE,QAAAA,QAAO,IAAI;AAGjB,sBAAkBA,SAAQ,gBAAgB;AAG1C,IAAAA,UAAS,cAAcA,OAAM;AAE7B,UAAM,WACF,IAAI,+BAA+B,GAAG,MAAMA,SAAQ,MAAM,IAC1D,IAAI,8BAA8B,QAAQ,GAAG,MAAMA,OAAM;AAAA,EAC/D;AAEA,SAAO,EAAE,MAAM,UAAU,KAAK,KAAK,GAAG,MAAM,WAAW,GAAG,IAAI;AAChE;AAEA,IAAO,wBAAQ;",
|
|
5
|
-
"names": ["parent"]
|
|
6
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file readPackageJson
|
|
3
|
-
* @module mlly/utils/readPackageJson
|
|
4
|
-
*/
|
|
5
|
-
import type { ModuleId } from '../types/index.mjs';
|
|
6
|
-
import type { PackageJson } from '@flex-development/pkg-types';
|
|
7
|
-
import { type Nullable } from '@flex-development/tutils';
|
|
8
|
-
/**
|
|
9
|
-
* Reads a `package.json` file from the given directory.
|
|
10
|
-
*
|
|
11
|
-
* Returns `null` if a file is not found.
|
|
12
|
-
*
|
|
13
|
-
* @see {@linkcode ModuleId}
|
|
14
|
-
* @see {@linkcode PackageJson}
|
|
15
|
-
*
|
|
16
|
-
* @param {ModuleId} [dir='.'] - Id of directory containing `package.json` file
|
|
17
|
-
* @param {string?} [specifier] - Module specifier passed by user to initiate
|
|
18
|
-
* reading of `package.json` file
|
|
19
|
-
* @param {ModuleId?} [parent] - Id of module to resolve from
|
|
20
|
-
* @return {?PackageJson} `package.json` object or `null` if file is not found
|
|
21
|
-
* @throws {NodeError<Error | TypeError>} If `dir` is not a string or instance
|
|
22
|
-
* of {@linkcode URL}, if `specifier` is not a string, if `parent` is not a
|
|
23
|
-
* string, or if a `package.json` is file found and does not contain valid JSON
|
|
24
|
-
*/
|
|
25
|
-
declare const readPackageJson: (dir?: ModuleId, specifier?: string, parent?: ModuleId) => Nullable<PackageJson>;
|
|
26
|
-
export default readPackageJson;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import isFile from "../internal/is-file.mjs";
|
|
2
|
-
import validateString from "../internal/validate-string.mjs";
|
|
3
|
-
import validateURLString from "../internal/validate-url-string.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ERR_INVALID_PACKAGE_CONFIG
|
|
6
|
-
} from "@flex-development/errnode";
|
|
7
|
-
import pathe from "@flex-development/pathe";
|
|
8
|
-
import { isEmptyString, isNIL } from "@flex-development/tutils";
|
|
9
|
-
import fs from "node:fs";
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
11
|
-
import toURL from "./to-url.mjs";
|
|
12
|
-
const readPackageJson = (dir = ".", specifier, parent) => {
|
|
13
|
-
validateURLString(dir, "dir");
|
|
14
|
-
if (specifier !== void 0)
|
|
15
|
-
validateString(specifier, "specifier");
|
|
16
|
-
if (parent !== void 0)
|
|
17
|
-
validateURLString(parent, "parent");
|
|
18
|
-
dir = fileURLToPath(toURL(dir));
|
|
19
|
-
const path = pathe.toNamespacedPath(pathe.join(dir, "package.json"));
|
|
20
|
-
if (!isFile(path))
|
|
21
|
-
return null;
|
|
22
|
-
let pkg;
|
|
23
|
-
try {
|
|
24
|
-
pkg = JSON.parse(fs.readFileSync(path, "utf8"));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
let base;
|
|
27
|
-
switch (true) {
|
|
28
|
-
case (specifier && !isNIL(parent) && !isEmptyString(parent)):
|
|
29
|
-
base = `'${specifier}' from ${fileURLToPath(toURL(parent))}`;
|
|
30
|
-
break;
|
|
31
|
-
case (specifier == null ? void 0 : specifier.startsWith("file:")):
|
|
32
|
-
base = fileURLToPath(specifier);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
throw new ERR_INVALID_PACKAGE_CONFIG(path, base, e.message);
|
|
36
|
-
}
|
|
37
|
-
return pkg;
|
|
38
|
-
};
|
|
39
|
-
var read_package_json_default = readPackageJson;
|
|
40
|
-
export {
|
|
41
|
-
read_package_json_default as default
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=read-package-json.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/read-package-json.ts"],
|
|
4
|
-
"mappings": "AAKA,OAAO,YAAY;AACnB,OAAO,oBAAoB;AAC3B,OAAO,uBAAuB;AAE9B;AAAA,EACE;AAAA,OAEK;AACP,OAAO,WAAW;AAElB,SAAS,eAAe,aAA4B;AACpD,OAAO,QAAQ;AACf,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAmBlB,MAAM,kBAAkB,CACtB,MAAgB,KAChB,WACA,WAC0B;AAE1B,oBAAkB,KAAK,KAAK;AAG5B,MAAI,cAAc;AAAW,mBAAe,WAAW,WAAW;AAGlE,MAAI,WAAW;AAAW,sBAAkB,QAAQ,QAAQ;AAG5D,QAAM,cAAc,MAAM,GAAG,CAAC;AAO9B,QAAM,OAAe,MAAM,iBAAiB,MAAM,KAAK,KAAK,cAAc,CAAC;AAG3E,MAAI,CAAC,OAAO,IAAI;AAAG,WAAO;AAO1B,MAAI;AAGJ,MAAI;AACF,UAAM,KAAK,MAAM,GAAG,aAAa,MAAM,MAAM,CAAC;AAAA,EAChD,SAAS,GAAP;AAQA,QAAI;AAGJ,YAAQ,MAAM;AAAA,MACZ,MAAK,aAAa,CAAC,MAAM,MAAM,KAAK,CAAC,cAAc,MAAM;AACvD,eAAO,IAAI,mBAAmB,cAAc,MAAM,MAAO,CAAC;AAC1D;AAAA,MACF,MAAK,uCAAW,WAAW;AACzB,eAAO,cAAc,SAAU;AAC/B;AAAA,IACJ;AAEA,UAAM,IAAI,2BAA2B,MAAM,MAAO,EAAkB,OAAO;AAAA,EAC7E;AAEA,SAAO;AACT;AAEA,IAAO,4BAAQ;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file resolveAlias
|
|
3
|
-
* @module mlly/utils/resolveAlias
|
|
4
|
-
*/
|
|
5
|
-
import type { ResolveAliasOptions } from '../interfaces/index.mjs';
|
|
6
|
-
/**
|
|
7
|
-
* Resolves a path alias in the given module `specifier`; does nothing if a path
|
|
8
|
-
* match isn't found.
|
|
9
|
-
*
|
|
10
|
-
* @see {@linkcode ResolveAliasOptions}
|
|
11
|
-
*
|
|
12
|
-
* @async
|
|
13
|
-
*
|
|
14
|
-
* @param {string} specifier - Module specifier to evaluate
|
|
15
|
-
* @param {ResolveAliasOptions} [options={}] - Resolution options
|
|
16
|
-
* @return {Promise<string>} Resolved specifier or original module specifier
|
|
17
|
-
* @throws {NodeError}
|
|
18
|
-
*/
|
|
19
|
-
declare const resolveAlias: (specifier: string, options?: ResolveAliasOptions) => Promise<string>;
|
|
20
|
-
export default resolveAlias;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import regexp from "../internal/escape-reg-exp.mjs";
|
|
2
|
-
import validateBoolean from "../internal/validate-boolean.mjs";
|
|
3
|
-
import validateObject from "../internal/validate-object.mjs";
|
|
4
|
-
import validateSet from "../internal/validate-set.mjs";
|
|
5
|
-
import validateString from "../internal/validate-string.mjs";
|
|
6
|
-
import validateURLString from "../internal/validate-url-string.mjs";
|
|
7
|
-
import pathe from "@flex-development/pathe";
|
|
8
|
-
import { CompareResult, isNIL } from "@flex-development/tutils";
|
|
9
|
-
import { URL, pathToFileURL } from "node:url";
|
|
10
|
-
import compareSubpaths from "./compare-subpaths.mjs";
|
|
11
|
-
import CONDITIONS from "./conditions.mjs";
|
|
12
|
-
import parseModuleId from "./parse-module-id.mjs";
|
|
13
|
-
import PATTERN_CHARACTER from "./pattern-character.mjs";
|
|
14
|
-
import RESOLVE_EXTENSIONS from "./resolve-extensions.mjs";
|
|
15
|
-
import resolveModule from "./resolve-module.mjs";
|
|
16
|
-
import toBareSpecifier from "./to-bare-specifier.mjs";
|
|
17
|
-
import toRelativeSpecifier from "./to-relative-specifier.mjs";
|
|
18
|
-
import toURL from "./to-url.mjs";
|
|
19
|
-
const resolveAlias = async (specifier, options = {}) => {
|
|
20
|
-
const {
|
|
21
|
-
absolute = true,
|
|
22
|
-
aliases = {},
|
|
23
|
-
condition = "default",
|
|
24
|
-
conditions = CONDITIONS,
|
|
25
|
-
cwd = pathToFileURL("."),
|
|
26
|
-
ext,
|
|
27
|
-
extensions = RESOLVE_EXTENSIONS,
|
|
28
|
-
parent = import.meta.url,
|
|
29
|
-
preserveSymlinks = false
|
|
30
|
-
} = options;
|
|
31
|
-
validateString(specifier, "specifier");
|
|
32
|
-
validateBoolean(absolute, "options.absolute");
|
|
33
|
-
validateObject(aliases, "options.aliases");
|
|
34
|
-
validateString(condition, "options.condition");
|
|
35
|
-
validateURLString(cwd, "options.cwd");
|
|
36
|
-
validateSet(extensions, "options.extensions");
|
|
37
|
-
validateURLString(parent, "options.parent");
|
|
38
|
-
validateBoolean(preserveSymlinks, "options.preserveSymlinks");
|
|
39
|
-
const id = parseModuleId(specifier, {
|
|
40
|
-
parent: toURL(parent),
|
|
41
|
-
pkgname: false
|
|
42
|
-
});
|
|
43
|
-
const keys = Object.keys(aliases).sort(compareSubpaths);
|
|
44
|
-
let alias = null;
|
|
45
|
-
let trail = "";
|
|
46
|
-
for (const key of keys) {
|
|
47
|
-
const pattern = key.indexOf(PATTERN_CHARACTER);
|
|
48
|
-
if (pattern === -1 && key === id.raw) {
|
|
49
|
-
alias = key;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
if (pattern !== -1 && id.raw.startsWith(key.slice(0, pattern))) {
|
|
53
|
-
const trailer = key.slice(pattern + 1);
|
|
54
|
-
if (id.raw.length >= key.length && id.raw.endsWith(trailer) && compareSubpaths(alias ?? "", key) === CompareResult.GREATER_THAN && key.lastIndexOf(PATTERN_CHARACTER) === pattern) {
|
|
55
|
-
alias = key;
|
|
56
|
-
trail = id.raw.slice(pattern, id.raw.length - trailer.length);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (alias === null || isNIL(aliases[alias]))
|
|
61
|
-
return specifier;
|
|
62
|
-
const base = toURL(cwd).href.replace(/\/$/, "") + pathe.sep;
|
|
63
|
-
let url = null;
|
|
64
|
-
for (let segment of [aliases[alias]].flat()) {
|
|
65
|
-
if (segment.includes(PATTERN_CHARACTER)) {
|
|
66
|
-
segment = segment.replace(
|
|
67
|
-
new RegExp(`${regexp(PATTERN_CHARACTER)}$`),
|
|
68
|
-
trail
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
let tries = new Set(
|
|
72
|
-
[
|
|
73
|
-
"",
|
|
74
|
-
...[...extensions].map((ext2) => pathe.formatExt(ext2)),
|
|
75
|
-
...[...extensions].map((ext2) => "/index" + pathe.formatExt(ext2))
|
|
76
|
-
].map((suffix) => segment + suffix).filter((segment2) => segment2.length > 0).map((segment2) => new URL(segment2, base).pathname)
|
|
77
|
-
);
|
|
78
|
-
if (segment.startsWith("node_modules")) {
|
|
79
|
-
const [trypath = ""] = [...tries];
|
|
80
|
-
tries = /* @__PURE__ */ new Set([trypath.replace(/.*\/node_modules\//, ""), ...tries]);
|
|
81
|
-
}
|
|
82
|
-
for (const trypath of tries) {
|
|
83
|
-
try {
|
|
84
|
-
url = await resolveModule(trypath, {
|
|
85
|
-
condition,
|
|
86
|
-
conditions,
|
|
87
|
-
ext,
|
|
88
|
-
extensions,
|
|
89
|
-
parent: toURL(parent),
|
|
90
|
-
preserveSymlinks
|
|
91
|
-
});
|
|
92
|
-
break;
|
|
93
|
-
} catch {
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (url)
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
return url ? absolute ? url.href : /\/node_modules\//.test(url.href) ? toBareSpecifier(url, toURL(parent), new Set(conditions)) : toRelativeSpecifier(url, toURL(parent)) : specifier;
|
|
101
|
-
};
|
|
102
|
-
var resolve_alias_default = resolveAlias;
|
|
103
|
-
export {
|
|
104
|
-
resolve_alias_default as default
|
|
105
|
-
};
|
|
106
|
-
//# sourceMappingURL=resolve-alias.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/resolve-alias.ts"],
|
|
4
|
-
"mappings": "AAMA,OAAO,YAAY;AACnB,OAAO,qBAAqB;AAC5B,OAAO,oBAAoB;AAC3B,OAAO,iBAAiB;AACxB,OAAO,oBAAoB;AAC3B,OAAO,uBAAuB;AAE9B,OAAO,WAAW;AAClB,SAAS,eAAe,aAA4B;AACpD,SAAS,KAAK,qBAAqB;AACnC,OAAO,qBAAqB;AAC5B,OAAO,gBAAgB;AACvB,OAAO,mBAAmB;AAC1B,OAAO,uBAAuB;AAC9B,OAAO,wBAAwB;AAC/B,OAAO,mBAAmB;AAC1B,OAAO,qBAAqB;AAC5B,OAAO,y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AAI,OACJ,mBAAmB,KAAK,IAAI,IAAI,IAChC,gBAAgB,KAAK,MAAM,MAAM,GAAG,IAAI,IAAI,UAAU,CAAC,IACvD,oBAAoB,KAAK,MAAM,MAAM,CAAC,IACxC;AACN;AAEA,IAAO,wBAAQ;",
|
|
5
|
-
"names": ["ext", "segment"]
|
|
6
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file resolveAliases
|
|
3
|
-
* @module mlly/utils/resolveAliases
|
|
4
|
-
*/
|
|
5
|
-
import type { ResolveAliasOptions } from '../interfaces/index.mjs';
|
|
6
|
-
/**
|
|
7
|
-
* Resolves path aliases in the given piece of source `code`.
|
|
8
|
-
*
|
|
9
|
-
* @see {@linkcode ResolveAliasOptions}
|
|
10
|
-
* @see {@linkcode resolveAlias}
|
|
11
|
-
*
|
|
12
|
-
* @async
|
|
13
|
-
*
|
|
14
|
-
* @param {string} code - Code to evaluate
|
|
15
|
-
* @param {ResolveAliasOptions} [options={}] - Resolve alias options
|
|
16
|
-
* @return {Promise<string>} `code` unmodified or with path aliases resolved
|
|
17
|
-
*/
|
|
18
|
-
declare const resolveAliases: (code: string, options?: ResolveAliasOptions) => Promise<string>;
|
|
19
|
-
export default resolveAliases;
|