@flex-development/mlly 1.0.0-beta.3 → 1.0.0-beta.5

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +172 -89
  3. package/dist/index.d.mts +1885 -5
  4. package/dist/index.mjs +1 -5
  5. package/dist/internal/chain-or-call.d.mts +51 -0
  6. package/dist/internal/chain-or-call.mjs +1 -34
  7. package/dist/internal/chars.d.mts +16 -0
  8. package/dist/internal/chars.mjs +1 -17
  9. package/dist/internal/check-invalid-segments.d.mts +18 -0
  10. package/dist/internal/check-invalid-segments.mjs +1 -49
  11. package/dist/internal/constant.d.mts +21 -0
  12. package/dist/internal/constant.mjs +1 -23
  13. package/dist/internal/fs.browser.d.mts +12 -0
  14. package/dist/internal/fs.browser.mjs +1 -42
  15. package/dist/internal/fs.node.d.mts +12 -0
  16. package/dist/internal/fs.node.mjs +1 -16
  17. package/dist/internal/identity.d.mts +21 -0
  18. package/dist/internal/identity.mjs +1 -23
  19. package/dist/internal/invalid-package-target.d.mts +31 -0
  20. package/dist/internal/invalid-package-target.mjs +1 -36
  21. package/dist/internal/invalid-subpath.d.mts +32 -0
  22. package/dist/internal/invalid-subpath.mjs +1 -37
  23. package/dist/internal/is-promise.d.mts +21 -0
  24. package/dist/internal/is-promise.mjs +1 -26
  25. package/dist/internal/process.browser.d.mts +9 -0
  26. package/dist/internal/process.browser.mjs +1 -8
  27. package/dist/lib/can-parse-url.mjs +1 -31
  28. package/dist/lib/cwd.mjs +1 -17
  29. package/dist/lib/default-conditions.mjs +1 -14
  30. package/dist/lib/default-extensions.mjs +1 -29
  31. package/dist/lib/default-main-fields.mjs +1 -13
  32. package/dist/lib/extension-format-map.mjs +1 -31
  33. package/dist/lib/formats.mjs +1 -22
  34. package/dist/lib/get-source.mjs +1 -153
  35. package/dist/lib/index.mjs +1 -41
  36. package/dist/lib/is-absolute-specifier.mjs +1 -34
  37. package/dist/lib/is-array-index.mjs +1 -28
  38. package/dist/lib/is-bare-specifier.mjs +1 -33
  39. package/dist/lib/is-directory.mjs +1 -54
  40. package/dist/lib/is-file.mjs +1 -54
  41. package/dist/lib/is-imports-subpath.mjs +1 -28
  42. package/dist/lib/is-module-id.mjs +1 -24
  43. package/dist/lib/is-relative-specifier.mjs +1 -36
  44. package/dist/lib/lookup-package-scope.mjs +1 -102
  45. package/dist/lib/pattern-key-compare.mjs +1 -71
  46. package/dist/lib/pattern-match.mjs +1 -85
  47. package/dist/lib/read-package-json.mjs +1 -114
  48. package/dist/lib/resolve-alias.mjs +1 -102
  49. package/dist/lib/resolve-module.mjs +1 -186
  50. package/dist/lib/resolver.mjs +1 -1015
  51. package/dist/lib/root.mjs +1 -12
  52. package/dist/lib/to-relative-specifier.mjs +1 -63
  53. package/dist/lib/to-url.mjs +1 -34
  54. package/package.json +30 -12
  55. package/dist/interfaces/aliases.d.mts +0 -21
  56. package/dist/interfaces/buffer-encoding-map.d.mts +0 -29
  57. package/dist/interfaces/condition-map.d.mts +0 -24
  58. package/dist/interfaces/file-system.d.mts +0 -29
  59. package/dist/interfaces/get-source-context.d.mts +0 -44
  60. package/dist/interfaces/get-source-options.d.mts +0 -56
  61. package/dist/interfaces/index.d.mts +0 -22
  62. package/dist/interfaces/is-directory.d.mts +0 -17
  63. package/dist/interfaces/is-file.d.mts +0 -17
  64. package/dist/interfaces/main-field-map.d.mts +0 -22
  65. package/dist/interfaces/module-format-map.d.mts +0 -26
  66. package/dist/interfaces/pattern-key-comparison-map.d.mts +0 -31
  67. package/dist/interfaces/protocol-map.d.mts +0 -44
  68. package/dist/interfaces/read-file.d.mts +0 -43
  69. package/dist/interfaces/realpath.d.mts +0 -30
  70. package/dist/interfaces/resolve-alias-options.d.mts +0 -43
  71. package/dist/interfaces/resolve-module-options.d.mts +0 -79
  72. package/dist/interfaces/stat.d.mts +0 -28
  73. package/dist/interfaces/stats.d.mts +0 -23
  74. package/dist/lib/can-parse-url.d.mts +0 -23
  75. package/dist/lib/cwd.d.mts +0 -14
  76. package/dist/lib/default-conditions.d.mts +0 -15
  77. package/dist/lib/default-extensions.d.mts +0 -14
  78. package/dist/lib/default-main-fields.d.mts +0 -14
  79. package/dist/lib/extension-format-map.d.mts +0 -16
  80. package/dist/lib/formats.d.mts +0 -21
  81. package/dist/lib/get-source.d.mts +0 -46
  82. package/dist/lib/index.d.mts +0 -41
  83. package/dist/lib/is-absolute-specifier.d.mts +0 -23
  84. package/dist/lib/is-array-index.d.mts +0 -19
  85. package/dist/lib/is-bare-specifier.d.mts +0 -23
  86. package/dist/lib/is-directory.d.mts +0 -27
  87. package/dist/lib/is-file.d.mts +0 -27
  88. package/dist/lib/is-imports-subpath.d.mts +0 -26
  89. package/dist/lib/is-module-id.d.mts +0 -23
  90. package/dist/lib/is-relative-specifier.d.mts +0 -23
  91. package/dist/lib/lookup-package-scope.d.mts +0 -49
  92. package/dist/lib/pattern-key-compare.d.mts +0 -28
  93. package/dist/lib/pattern-match.d.mts +0 -22
  94. package/dist/lib/read-package-json.d.mts +0 -63
  95. package/dist/lib/resolve-alias.d.mts +0 -21
  96. package/dist/lib/resolve-module.d.mts +0 -43
  97. package/dist/lib/resolver.d.mts +0 -346
  98. package/dist/lib/root.d.mts +0 -11
  99. package/dist/lib/to-relative-specifier.d.mts +0 -27
  100. package/dist/lib/to-url.d.mts +0 -26
  101. package/dist/types/awaitable.d.mts +0 -12
  102. package/dist/types/buffer-encoding.d.mts +0 -13
  103. package/dist/types/change-ext-fn.d.mts +0 -29
  104. package/dist/types/condition.d.mts +0 -13
  105. package/dist/types/dot.d.mts +0 -9
  106. package/dist/types/empty-array.d.mts +0 -9
  107. package/dist/types/empty-object.d.mts +0 -19
  108. package/dist/types/empty-string.d.mts +0 -9
  109. package/dist/types/ext.d.mts +0 -12
  110. package/dist/types/file-content.d.mts +0 -11
  111. package/dist/types/get-source-handler.d.mts +0 -23
  112. package/dist/types/get-source-handlers.d.mts +0 -15
  113. package/dist/types/index.d.mts +0 -24
  114. package/dist/types/list.d.mts +0 -12
  115. package/dist/types/main-field.d.mts +0 -13
  116. package/dist/types/module-format.d.mts +0 -13
  117. package/dist/types/module-id.d.mts +0 -12
  118. package/dist/types/numeric.d.mts +0 -9
  119. package/dist/types/pattern-key-comparison.d.mts +0 -14
  120. package/dist/types/pattern-match.d.mts +0 -10
  121. package/dist/types/protocol.d.mts +0 -13
package/dist/index.mjs CHANGED
@@ -1,5 +1 @@
1
- /**
2
- * @file Package Entry Point
3
- * @module mlly
4
- */
5
- export * from '#lib/index';
1
+ export*from"#lib/index";
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @file Internal - chainOrCall
3
+ * @module mlly/internal/chainOrCall
4
+ */
5
+ import type { Awaitable } from '@flex-development/mlly';
6
+ export default chainOrCall;
7
+ /**
8
+ * Chain function parameters.
9
+ *
10
+ * @internal
11
+ *
12
+ * @template {any} R
13
+ * The previous resolved value
14
+ * @template {any[]} P
15
+ * The function parameters
16
+ */
17
+ type ChainParams<R, P extends any[]> = [...P, R?];
18
+ /**
19
+ * Chain a callback, calling the function after `promise` is resolved,
20
+ * otherwise synchronously call `fn`.
21
+ *
22
+ * @see {@linkcode Awaitable}
23
+ * @see {@linkcode ChainParams}
24
+ *
25
+ * @internal
26
+ *
27
+ * @template {any} T
28
+ * The resolved value of `fn`
29
+ * @template {any} [R=unknown]
30
+ * The previous resolved value
31
+ * @template {any[]} [P=any[]]
32
+ * The function parameters
33
+ * @template {any} [Self=unknown]
34
+ * The `this` context of `fn`
35
+ *
36
+ * @this {void}
37
+ *
38
+ * @param {Awaitable<R>} promise
39
+ * The promise to chain or the resolved value
40
+ * @param {(this: Self, ...params: ChainParams<R, P>) => Awaitable<T>} fn
41
+ * The function to call
42
+ * @param {(e: unknown) => Awaitable<T>} [reject]
43
+ * The callback to fire when a promise is rejected
44
+ * @param {Self | null | undefined} [self]
45
+ * The `this` context of `fn`
46
+ * @param {P} params
47
+ * The arguments to pass to `fn`
48
+ * @return {Awaitable<T>}
49
+ * A new promise to resolve or the result of `fn`
50
+ */
51
+ declare function chainOrCall<T = unknown, R = unknown, P extends any[] = any[], Self = unknown>(this: void, promise: Awaitable<R>, fn: (this: Self, ...params: ChainParams<R, P>) => Awaitable<T>, reject?: (e: unknown) => Awaitable<T>, self?: Self | null | undefined, ...params: P): Awaitable<T>;
@@ -1,34 +1 @@
1
- /**
2
- * @file Internal - chainOrCall
3
- * @module mlly/internal/chainOrCall
4
- */
5
- import isPromise from '#internal/is-promise';
6
- export default chainOrCall;
7
- /**
8
- * Chain a callback, calling the function after `promise` is resolved,
9
- * otherwise synchronously call `fn`.
10
- *
11
- * @internal
12
- *
13
- * @see {@linkcode Awaitable}
14
- *
15
- * @this {void}
16
- *
17
- * @param {unknown} promise
18
- * The promise to chain or the resolved value
19
- * @param {(...params: any[]) => unknown} fn
20
- * The function to call
21
- * @param {(e: unknown) => unknown} [reject]
22
- * The callback to fire when a promise is rejected
23
- * @param {unknown} [self]
24
- * The `this` context of `fn`
25
- * @param {unknown[]} params
26
- * The arguments to pass to `fn`
27
- * @return {unknown}
28
- * A new promise to resolve or the result of `fn`
29
- */
30
- function chainOrCall(promise, fn, reject, self, ...params) {
31
- return isPromise(promise) // already have a promise, chain callback.
32
- ? promise.then(resolved => fn.call(self, ...params, resolved), reject)
33
- : fn.call(self, ...params);
34
- }
1
+ var a=Object.defineProperty;var i=(l,t)=>a(l,"name",{value:t,configurable:!0});import e from"#internal/is-promise";var f=u;function u(l,t,n,r,...c){return e(l)?l.then(o=>t.call(r,...c,o),n):t.call(r,...c)}i(u,"chainOrCall");export{f as default};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Internal - chars
3
+ * @module mlly/internal/chars
4
+ */
5
+ /**
6
+ * Characters that may have special meaning.
7
+ *
8
+ * @enum {string}
9
+ */
10
+ declare enum chars {
11
+ asterisk = "*",
12
+ at = "@",
13
+ empty = "",
14
+ hash = "#"
15
+ }
16
+ export default chars;
@@ -1,17 +1 @@
1
- /**
2
- * @file Internal - chars
3
- * @module mlly/internal/chars
4
- */
5
- /**
6
- * Characters that may have special meaning.
7
- *
8
- * @enum {string}
9
- */
10
- var chars;
11
- (function (chars) {
12
- chars["asterisk"] = "*";
13
- chars["at"] = "@";
14
- chars["empty"] = "";
15
- chars["hash"] = "#";
16
- })(chars || (chars = {}));
17
- export default chars;
1
+ var e;(function(t){t.asterisk="*",t.at="@",t.empty="",t.hash="#"})(e||(e={}));var a=e;export{a as default};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file Internal - checkInvalidSegments
3
+ * @module mlly/internal/checkInvalidSegments
4
+ */
5
+ /**
6
+ * Check `str` for invalid path segments.
7
+ *
8
+ * @internal
9
+ *
10
+ * @this {void}
11
+ *
12
+ * @param {string} str
13
+ * The package target or subpath pattern match to check
14
+ * @return {boolean}
15
+ * `true` if `str` contains invalid path segments, `false` otherwise
16
+ */
17
+ declare function checkInvalidSegments(this: void, str: string): boolean;
18
+ export default checkInvalidSegments;
@@ -1,49 +1 @@
1
- /**
2
- * @file Internal - checkInvalidSegments
3
- * @module mlly/internal/checkInvalidSegments
4
- */
5
- import chars from '#internal/chars';
6
- /**
7
- * Check `str` for invalid path segments.
8
- *
9
- * @internal
10
- *
11
- * @this {void}
12
- *
13
- * @param {string} str
14
- * The package target or subpath pattern match to check
15
- * @return {boolean}
16
- * `true` if `str` contains invalid path segments, `false` otherwise
17
- */
18
- function checkInvalidSegments(str) {
19
- /**
20
- * The regular expression matching path separators.
21
- *
22
- * @const {RegExp} separator
23
- */
24
- const separator = /\/|\\/;
25
- /**
26
- * The list of path segments.
27
- *
28
- * @const {string[]} segments
29
- */
30
- const segments = str.startsWith('./')
31
- ? str.slice(2).split(separator)
32
- : str.split(separator);
33
- /**
34
- * The list of regular expressions matching invalid segments.
35
- *
36
- * @const {RegExp[]} checks
37
- */
38
- const checks = [
39
- /^(\.|%2e)(\.|%2e)?/i,
40
- /^(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53)/i
41
- ];
42
- for (const segment of segments) {
43
- if (segment === chars.empty || checks.some(check => check.test(segment))) {
44
- return true;
45
- }
46
- }
47
- return false;
48
- }
49
- export default checkInvalidSegments;
1
+ var r=Object.defineProperty;var o=(e,t)=>r(e,"name",{value:t,configurable:!0});import i from"#internal/chars";function m(e){const t=/\/|\\/,c=e.startsWith("./")?e.slice(2).split(t):e.split(t),n=[/^(\.|%2e)(\.|%2e)?/i,/^(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53)/i];for(const s of c)if(s===i.empty||n.some(f=>f.test(s)))return!0;return!1}o(m,"checkInvalidSegments");var d=m;export{d as default};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @file Internal - constant
3
+ * @module mlly/internal/constant
4
+ */
5
+ /**
6
+ * Create a function that returns a constant value.
7
+ *
8
+ * @internal
9
+ *
10
+ * @template {unknown} T
11
+ * The value
12
+ *
13
+ * @this {void}
14
+ *
15
+ * @param {T} value
16
+ * The value
17
+ * @return {(this: void) => T}
18
+ * `value`
19
+ */
20
+ declare function constant<T>(this: void, value: T): (this: void) => T;
21
+ export default constant;
@@ -1,23 +1 @@
1
- /**
2
- * @file Internal - constant
3
- * @module mlly/internal/constant
4
- */
5
- /**
6
- * Create a function that returns a constant value.
7
- *
8
- * @internal
9
- *
10
- * @template {unknown} T
11
- * The value
12
- *
13
- * @this {void}
14
- *
15
- * @param {T} value
16
- * The value
17
- * @return {(this: void) => T}
18
- * `value`
19
- */
20
- function constant(value) {
21
- return () => value;
22
- }
23
- export default constant;
1
+ var o=Object.defineProperty;var n=(t,e)=>o(t,"name",{value:e,configurable:!0});function r(t){return()=>t}n(r,"constant");var a=r;export{a as default};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file Internal - fs/browser
3
+ * @module mlly/internal/fs/browser
4
+ */
5
+ import type { FileSystem } from '@flex-development/mlly';
6
+ /**
7
+ * The file system API.
8
+ *
9
+ * @const {FileSystem} fs
10
+ */
11
+ declare const fs: FileSystem;
12
+ export default fs;
@@ -1,42 +1 @@
1
- /**
2
- * @file Internal - fs/browser
3
- * @module mlly/internal/fs/browser
4
- */
5
- /**
6
- * The file system API.
7
- *
8
- * @const {FileSystem} fs
9
- */
10
- const fs = {
11
- /**
12
- * Get the contents of a file.
13
- *
14
- * @return {never}
15
- * Never; not implemented
16
- * @throws {Error}
17
- */
18
- readFile() {
19
- throw new Error('[readFile] not implemented');
20
- },
21
- /**
22
- * Get the resolved pathname of a file.
23
- *
24
- * @return {never}
25
- * Never; not implemented
26
- * @throws {Error}
27
- */
28
- realpath() {
29
- throw new Error('[realpathSync] not implemented');
30
- },
31
- /**
32
- * Get information about a file.
33
- *
34
- * @return {never}
35
- * Never; not implemented
36
- * @throws {Error}
37
- */
38
- stat() {
39
- throw new Error('[stat] not implemented');
40
- }
41
- };
42
- export default fs;
1
+ const e={readFile(){throw new Error("[readFile] not implemented")},realpath(){throw new Error("[realpath] not implemented")},stat(){throw new Error("[stat] not implemented")}};var t=e;export{t as default};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file Internal - fs/node
3
+ * @module mlly/internal/fs/node
4
+ */
5
+ import type { FileSystem } from '@flex-development/mlly';
6
+ /**
7
+ * The file system API.
8
+ *
9
+ * @const {FileSystem} fs
10
+ */
11
+ declare const fs: FileSystem;
12
+ export default fs;
@@ -1,16 +1 @@
1
- /**
2
- * @file Internal - fs/node
3
- * @module mlly/internal/fs/node
4
- */
5
- import nfs from 'node:fs';
6
- /**
7
- * The file system API.
8
- *
9
- * @const {FileSystem} fs
10
- */
11
- const fs = {
12
- readFile: nfs.readFileSync,
13
- realpath: nfs.realpathSync,
14
- stat: nfs.statSync
15
- };
16
- export default fs;
1
+ import t from"node:fs";const a={readFile:t.readFileSync,realpath:t.realpathSync,stat:t.statSync};var r=a;export{r as default};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @file Internal - identity
3
+ * @module mlly/internal/identity
4
+ */
5
+ /**
6
+ * Return a constant value.
7
+ *
8
+ * @internal
9
+ *
10
+ * @template {unknown} T
11
+ * The value
12
+ *
13
+ * @this {void}
14
+ *
15
+ * @param {T} value
16
+ * The value
17
+ * @return {T}
18
+ * `value`
19
+ */
20
+ declare function identity<T>(this: void, value: T): T;
21
+ export default identity;
@@ -1,23 +1 @@
1
- /**
2
- * @file Internal - identity
3
- * @module mlly/internal/identity
4
- */
5
- /**
6
- * Return a constant value.
7
- *
8
- * @internal
9
- *
10
- * @template {unknown} T
11
- * The value
12
- *
13
- * @this {void}
14
- *
15
- * @param {T} value
16
- * The value
17
- * @return {T}
18
- * `value`
19
- */
20
- function identity(value) {
21
- return value;
22
- }
23
- export default identity;
1
+ var i=Object.defineProperty;var e=(t,n)=>i(t,"name",{value:n,configurable:!0});function r(t){return t}e(r,"identity");var d=r;export{d as default};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @file Internal - invalidPackageTarget
3
+ * @module mlly/internal/invalidPackageTarget
4
+ */
5
+ import { type ErrInvalidPackageTarget } from '@flex-development/errnode';
6
+ import type { ModuleId } from '@flex-development/mlly';
7
+ /**
8
+ * Create an {@linkcode ERR_INVALID_PACKAGE_TARGET} error.
9
+ *
10
+ * @see {@linkcode ErrInvalidPackageTarget}
11
+ * @see {@linkcode ModuleId}
12
+ *
13
+ * @internal
14
+ *
15
+ * @this {void}
16
+ *
17
+ * @param {ModuleId} packageUrl
18
+ * The URL of the directory containing the `package.json` file
19
+ * @param {string} subpath
20
+ * The subpath pattern
21
+ * @param {unknown} target
22
+ * The invalid package target
23
+ * @param {boolean | null | undefined} [isImports]
24
+ * Whether `target` is internal to the package
25
+ * @param {ModuleId | null | undefined} [parent]
26
+ * The URL of the parent module
27
+ * @return {ErrInvalidPackageTarget}
28
+ * New node error
29
+ */
30
+ declare function invalidPackageTarget(this: void, packageUrl: ModuleId, subpath: string, target: unknown, isImports?: boolean | null | undefined, parent?: ModuleId | null | undefined): ErrInvalidPackageTarget;
31
+ export default invalidPackageTarget;
@@ -1,36 +1 @@
1
- /**
2
- * @file Internal - invalidPackageTarget
3
- * @module mlly/internal/invalidPackageTarget
4
- */
5
- import chars from '#internal/chars';
6
- import { ERR_INVALID_PACKAGE_TARGET } from '@flex-development/errnode';
7
- import { fileURLToPath } from '@flex-development/pathe';
8
- /**
9
- * Create an {@linkcode ERR_INVALID_PACKAGE_TARGET} error.
10
- *
11
- * @see {@linkcode ErrInvalidPackageTarget}
12
- * @see {@linkcode ModuleId}
13
- *
14
- * @internal
15
- *
16
- * @this {void}
17
- *
18
- * @param {ModuleId} packageUrl
19
- * The URL of the directory containing the `package.json` file
20
- * @param {string} subpath
21
- * The subpath pattern
22
- * @param {unknown} target
23
- * The invalid package target
24
- * @param {boolean | null | undefined} [isImports]
25
- * Whether `target` is internal to the package
26
- * @param {ModuleId | null | undefined} [parent]
27
- * The URL of the parent module
28
- * @return {ErrInvalidPackageTarget}
29
- * New node error
30
- */
31
- function invalidPackageTarget(packageUrl, subpath, target, isImports, parent) {
32
- return new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(packageUrl), subpath, typeof target === 'object' && target !== null
33
- ? JSON.stringify(target, null, '')
34
- : String(target) + (typeof target === 'bigint' ? 'n' : chars.empty), isImports, parent && fileURLToPath(parent));
35
- }
36
- export default invalidPackageTarget;
1
+ var t=Object.defineProperty;var r=(o,n)=>t(o,"name",{value:n,configurable:!0});import e from"#internal/chars";import{ERR_INVALID_PACKAGE_TARGET as p}from"@flex-development/errnode";import{fileURLToPath as l}from"@flex-development/pathe";function u(o,n,i,m,f){return new p(l(o),n,typeof i=="object"&&i!==null?JSON.stringify(i,null,""):String(i)+(typeof i=="bigint"?"n":e.empty),m,f&&l(f))}r(u,"invalidPackageTarget");var T=u;export{T as default};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file Internal - invalidSubpath
3
+ * @module mlly/internal/invalidSubpath
4
+ */
5
+ import { type ErrInvalidModuleSpecifier } from '@flex-development/errnode';
6
+ import type { ModuleId } from '@flex-development/mlly';
7
+ /**
8
+ * Create an {@linkcode ERR_INVALID_MODULE_SPECIFIER} error for an invalid
9
+ * subpath pattern match.
10
+ *
11
+ * @see {@linkcode ErrInvalidModuleSpecifier}
12
+ * @see {@linkcode ModuleId}
13
+ *
14
+ * @internal
15
+ *
16
+ * @this {void}
17
+ *
18
+ * @param {string} subpath
19
+ * The subpath pattern
20
+ * @param {string} patternMatch
21
+ * The subpath pattern match
22
+ * @param {ModuleId} packageUrl
23
+ * The URL of the directory containing the `package.json` file
24
+ * @param {boolean | null | undefined} [isImports]
25
+ * Whether `target` is internal to the package
26
+ * @param {ModuleId | null | undefined} [parent]
27
+ * The URL of the parent module
28
+ * @return {ErrInvalidModuleSpecifier}
29
+ * New node error
30
+ */
31
+ declare function invalidSubpath(this: void, subpath: string, patternMatch: string, packageUrl: ModuleId, isImports?: boolean | null | undefined, parent?: ModuleId | null | undefined): ErrInvalidModuleSpecifier;
32
+ export default invalidSubpath;
@@ -1,37 +1 @@
1
- /**
2
- * @file Internal - invalidSubpath
3
- * @module mlly/internal/invalidSubpath
4
- */
5
- import chars from '#internal/chars';
6
- import { ERR_INVALID_MODULE_SPECIFIER } from '@flex-development/errnode';
7
- import pathe from '@flex-development/pathe';
8
- /**
9
- * Create an {@linkcode ERR_INVALID_MODULE_SPECIFIER} error for an invalid
10
- * subpath pattern match.
11
- *
12
- * @see {@linkcode ErrInvalidModuleSpecifier}
13
- * @see {@linkcode ModuleId}
14
- *
15
- * @internal
16
- *
17
- * @this {void}
18
- *
19
- * @param {string} subpath
20
- * The subpath pattern
21
- * @param {string} patternMatch
22
- * The subpath pattern match
23
- * @param {ModuleId} packageUrl
24
- * The URL of the directory containing the `package.json` file
25
- * @param {boolean | null | undefined} [isImports]
26
- * Whether `target` is internal to the package
27
- * @param {ModuleId | null | undefined} [parent]
28
- * The URL of the parent module
29
- * @return {ErrInvalidModuleSpecifier}
30
- * New node error
31
- */
32
- function invalidSubpath(subpath, patternMatch, packageUrl, isImports, parent) {
33
- return new ERR_INVALID_MODULE_SPECIFIER(subpath.replace(chars.asterisk, () => patternMatch), `request is not a valid match in pattern "${subpath}" for the ` +
34
- `"${isImports ? 'imports' : 'exports'}" resolution of ` +
35
- `${pathe.fileURLToPath(new URL('package.json', packageUrl))}`, parent && pathe.fileURLToPath(parent));
36
- }
37
- export default invalidSubpath;
1
+ var f=Object.defineProperty;var r=(t,o)=>f(t,"name",{value:o,configurable:!0});import p from"#internal/chars";import{ERR_INVALID_MODULE_SPECIFIER as m}from"@flex-development/errnode";import i from"@flex-development/pathe";function s(t,o,a,n,e){return new m(t.replace(p.asterisk,()=>o),`request is not a valid match in pattern "${t}" for the "${n?"imports":"exports"}" resolution of ${i.fileURLToPath(new URL("package.json",a))}`,e&&i.fileURLToPath(e))}r(s,"invalidSubpath");var u=s;export{u as default};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @file Internal - isPromise
3
+ * @module mlly/internal/isPromise
4
+ */
5
+ /**
6
+ * Check if `value` is a {@linkcode PromiseLike} object.
7
+ *
8
+ * @internal
9
+ *
10
+ * @template {any} T
11
+ * The resolved value of the promise
12
+ *
13
+ * @this {void}
14
+ *
15
+ * @param {unknown} value
16
+ * The thing to check
17
+ * @return {value is PromiseLike<T>}
18
+ * `true` if `value` is {@linkcode PromiseLike}, `false` otherwise
19
+ */
20
+ declare function isPromise<T>(this: void, value: unknown): value is PromiseLike<T>;
21
+ export default isPromise;
@@ -1,26 +1 @@
1
- /**
2
- * @file Internal - isPromise
3
- * @module mlly/internal/isPromise
4
- */
5
- /**
6
- * Check if `value` is a {@linkcode PromiseLike} object.
7
- *
8
- * @internal
9
- *
10
- * @template {any} T
11
- * The resolved value of the promise
12
- *
13
- * @this {void}
14
- *
15
- * @param {unknown} value
16
- * The thing to check
17
- * @return {value is PromiseLike<T>}
18
- * `true` if `value` is {@linkcode PromiseLike}, `false` otherwise
19
- */
20
- function isPromise(value) {
21
- return (typeof value === 'object' &&
22
- value !== null &&
23
- 'then' in value &&
24
- typeof value.then === 'function');
25
- }
26
- export default isPromise;
1
+ var e=Object.defineProperty;var n=(t,o)=>e(t,"name",{value:o,configurable:!0});function f(t){return typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"}n(f,"isPromise");var r=f;export{r as default};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file Internal - process/browser
3
+ * @module mlly/internal/process/browser
4
+ */
5
+ declare const _default: {
6
+ browser: boolean;
7
+ platform: string;
8
+ };
9
+ export default _default;
@@ -1,8 +1 @@
1
- /**
2
- * @file Internal - process/browser
3
- * @module mlly/internal/process/browser
4
- */
5
- export default {
6
- browser: true,
7
- platform: 'browser'
8
- };
1
+ var r={browser:!0,platform:"browser"};export{r as default};
@@ -1,31 +1 @@
1
- /**
2
- * @file canParseUrl
3
- * @module mlly/lib/canParseUrl
4
- */
5
- /**
6
- * Check if `input` can be parsed to a {@linkcode URL}.
7
- *
8
- * > 👉 **Note**: If `input` is relative, `base` is required.
9
- * > If `input` is absolute, `base` is ignored.
10
- *
11
- * @see {@linkcode ModuleId}
12
- *
13
- * @this {void}
14
- *
15
- * @param {unknown} input
16
- * The input URL
17
- * @param {unknown} [base]
18
- * The base URL to resolve against if `input` is not absolute
19
- * @return {boolean}
20
- * `true` if `input` can be parsed to a `URL`, `false` otherwise
21
- */
22
- function canParseUrl(input, base) {
23
- try {
24
- new URL(input, (base ?? undefined));
25
- return true;
26
- }
27
- catch {
28
- return false;
29
- }
30
- }
31
- export default canParseUrl;
1
+ var t=Object.defineProperty;var n=(e,r)=>t(e,"name",{value:r,configurable:!0});function u(e,r){try{return new URL(e,r??void 0),!0}catch{return!1}}n(u,"canParseUrl");var c=u;export{c as default};
package/dist/lib/cwd.mjs CHANGED
@@ -1,17 +1 @@
1
- /**
2
- * @file cwd
3
- * @module mlly/lib/cwd
4
- */
5
- import pathe from '@flex-development/pathe';
6
- /**
7
- * Get the URL of the current working directory.
8
- *
9
- * @this {void}
10
- *
11
- * @return {URL}
12
- * The current working directory URL
13
- */
14
- function cwd() {
15
- return pathe.pathToFileURL(pathe.cwd() + pathe.sep);
16
- }
17
- export default cwd;
1
+ var r=Object.defineProperty;var e=(o,p)=>r(o,"name",{value:p,configurable:!0});import t from"@flex-development/pathe";function a(){return t.pathToFileURL(t.cwd()+t.sep)}e(a,"cwd");var f=a;export{f as default};
@@ -1,14 +1 @@
1
- /**
2
- * @file defaultConditions
3
- * @module mlly/lib/defaultConditions
4
- */
5
- /**
6
- * The default list of conditions.
7
- *
8
- * @see {@linkcode Condition}
9
- * @see https://nodejs.org/api/packages.html#conditional-exports
10
- *
11
- * @const {Set<Condition>} defaultConditions
12
- */
13
- const defaultConditions = new Set(['node', 'import']);
14
- export default defaultConditions;
1
+ const t=new Set(["node","import"]);var e=t;export{e as default};