@flex-development/mlly 1.0.0-alpha.16 → 1.0.0-alpha.18

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 (181) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/index.d.mts +2 -2
  3. package/dist/index.mjs +0 -2
  4. package/dist/index.mjs.map +5 -6
  5. package/dist/internal/dequote.mjs +1 -0
  6. package/dist/internal/dequote.mjs.map +8 -0
  7. package/dist/internal/format-type-map.mjs +1 -0
  8. package/dist/internal/format-type-map.mjs.map +8 -0
  9. package/dist/internal/get-specifier-kind.mjs +1 -0
  10. package/dist/internal/get-specifier-kind.mjs.map +8 -0
  11. package/dist/internal/get-subpaths.mjs +1 -0
  12. package/dist/internal/get-subpaths.mjs.map +8 -0
  13. package/dist/internal/regex-encoded-sep.mjs +1 -0
  14. package/dist/internal/regex-encoded-sep.mjs.map +8 -0
  15. package/dist/internal/regex-internal-specifier.mjs +1 -0
  16. package/dist/internal/regex-internal-specifier.mjs.map +8 -0
  17. package/dist/internal/regex-invalid-segment.mjs +1 -0
  18. package/dist/internal/regex-invalid-segment.mjs.map +8 -0
  19. package/dist/internal/regex-package-name.mjs +1 -0
  20. package/dist/internal/regex-package-name.mjs.map +8 -0
  21. package/dist/internal/regex-package-path.mjs +1 -0
  22. package/dist/internal/regex-package-path.mjs.map +8 -0
  23. package/dist/internal/resolver.mjs +1 -0
  24. package/dist/internal/resolver.mjs.map +8 -0
  25. package/dist/internal/validate-array-set.mjs +1 -0
  26. package/dist/internal/validate-array-set.mjs.map +8 -0
  27. package/dist/internal/validate-boolean.mjs +1 -0
  28. package/dist/internal/validate-boolean.mjs.map +8 -0
  29. package/dist/internal/validate-map.mjs +1 -0
  30. package/dist/internal/validate-map.mjs.map +8 -0
  31. package/dist/internal/validate-object.mjs +1 -0
  32. package/dist/internal/validate-object.mjs.map +8 -0
  33. package/dist/internal/validate-set.mjs +1 -0
  34. package/dist/internal/validate-set.mjs.map +8 -0
  35. package/dist/internal/validate-string.mjs +1 -0
  36. package/dist/internal/validate-string.mjs.map +8 -0
  37. package/dist/internal/validate-url-string.mjs +1 -0
  38. package/dist/internal/validate-url-string.mjs.map +8 -0
  39. package/dist/utils/compare-subpaths.mjs.map +4 -5
  40. package/dist/utils/conditions.mjs.map +4 -5
  41. package/dist/utils/detect-syntax.mjs.map +4 -5
  42. package/dist/utils/extension-format-map.mjs.map +4 -5
  43. package/dist/utils/extract-statements.mjs.map +4 -5
  44. package/dist/utils/fill-modules.mjs.map +5 -8
  45. package/dist/utils/find-dynamic-imports.mjs.map +5 -8
  46. package/dist/utils/find-exports.mjs.map +5 -8
  47. package/dist/utils/find-requires.mjs.map +5 -8
  48. package/dist/utils/find-static-imports.mjs.map +5 -8
  49. package/dist/utils/find-subpath.mjs.map +5 -9
  50. package/dist/utils/get-format.mjs.map +5 -8
  51. package/dist/utils/get-source.mjs.map +4 -5
  52. package/dist/utils/has-cjs-syntax.mjs.map +4 -5
  53. package/dist/utils/has-esm-syntax.mjs.map +4 -5
  54. package/dist/utils/index.mjs.map +5 -8
  55. package/dist/utils/is-absolute-specifier.mjs.map +4 -5
  56. package/dist/utils/is-bare-specifier.mjs.map +4 -5
  57. package/dist/utils/is-directory.mjs.map +4 -5
  58. package/dist/utils/is-exports-sugar.mjs.map +4 -5
  59. package/dist/utils/is-file.mjs.map +4 -5
  60. package/dist/utils/is-relative-specifier.mjs.map +4 -5
  61. package/dist/utils/lookup-package-scope.mjs.map +4 -5
  62. package/dist/utils/parse-data-url.mjs.map +4 -5
  63. package/dist/utils/parse-module-id.mjs.map +5 -9
  64. package/dist/utils/parse-subpath.mjs.map +5 -8
  65. package/dist/utils/pattern-character.mjs.map +4 -5
  66. package/dist/utils/read-package-json.mjs.map +4 -5
  67. package/dist/utils/resolve-alias.mjs.map +5 -9
  68. package/dist/utils/resolve-aliases.mjs.map +4 -5
  69. package/dist/utils/resolve-extensions.mjs.map +4 -5
  70. package/dist/utils/resolve-module.d.mts +1 -1
  71. package/dist/utils/resolve-module.mjs.map +4 -5
  72. package/dist/utils/resolve-modules.mjs.map +4 -5
  73. package/dist/utils/to-absolute-specifier.mjs.map +4 -5
  74. package/dist/utils/to-bare-specifier.mjs +8 -1
  75. package/dist/utils/to-bare-specifier.mjs.map +5 -6
  76. package/dist/utils/to-data-url.mjs.map +4 -5
  77. package/dist/utils/to-node-url.mjs.map +4 -5
  78. package/dist/utils/to-relative-specifier.mjs.map +4 -5
  79. package/dist/utils/to-url.mjs.map +4 -5
  80. package/dist/utils/validate-assertions.mjs.map +5 -8
  81. package/dist/utils/validate-exports.mjs.map +4 -5
  82. package/package.json +16 -17
  83. package/dist/interfaces/index.mjs +0 -0
  84. package/dist/types/index.mjs +0 -0
  85. package/src/enums/assert-type.ts +0 -23
  86. package/src/enums/format.ts +0 -19
  87. package/src/enums/index.ts +0 -11
  88. package/src/enums/kind-specifier-syntax.ts +0 -16
  89. package/src/enums/kind-specifier.ts +0 -19
  90. package/src/enums/kind-statement-syntax.ts +0 -24
  91. package/src/enums/kind-statement.ts +0 -17
  92. package/src/index.ts +0 -9
  93. package/src/interfaces/import-assertions.ts +0 -24
  94. package/src/interfaces/import-dynamic.ts +0 -46
  95. package/src/interfaces/import-static.ts +0 -46
  96. package/src/interfaces/index.ts +0 -25
  97. package/src/interfaces/options-fill-module.ts +0 -26
  98. package/src/interfaces/options-find-subpath.ts +0 -57
  99. package/src/interfaces/options-get-format.ts +0 -80
  100. package/src/interfaces/options-get-source.ts +0 -59
  101. package/src/interfaces/options-parse-module-id.ts +0 -39
  102. package/src/interfaces/options-parse-subpath.ts +0 -57
  103. package/src/interfaces/options-resolve-alias.ts +0 -59
  104. package/src/interfaces/options-resolve-module.ts +0 -72
  105. package/src/interfaces/options-resolve.ts +0 -17
  106. package/src/interfaces/package-scope.ts +0 -30
  107. package/src/interfaces/parsed-data-url.ts +0 -63
  108. package/src/interfaces/parsed-module-id.ts +0 -90
  109. package/src/interfaces/parsed-subpath.ts +0 -56
  110. package/src/interfaces/statement-export.ts +0 -52
  111. package/src/interfaces/statement-import.ts +0 -45
  112. package/src/interfaces/statement-require.ts +0 -45
  113. package/src/interfaces/statement.ts +0 -64
  114. package/src/internal/dequote.ts +0 -18
  115. package/src/internal/format-type-map.ts +0 -28
  116. package/src/internal/get-specifier-kind.ts +0 -41
  117. package/src/internal/get-subpaths.ts +0 -43
  118. package/src/internal/regex-encoded-sep.ts +0 -17
  119. package/src/internal/regex-internal-specifier.ts +0 -19
  120. package/src/internal/regex-invalid-segment.ts +0 -25
  121. package/src/internal/regex-package-name.ts +0 -18
  122. package/src/internal/regex-package-path.ts +0 -20
  123. package/src/internal/resolver.ts +0 -790
  124. package/src/internal/validate-array-set.ts +0 -35
  125. package/src/internal/validate-boolean.ts +0 -30
  126. package/src/internal/validate-map.ts +0 -36
  127. package/src/internal/validate-object.ts +0 -30
  128. package/src/internal/validate-set.ts +0 -32
  129. package/src/internal/validate-string.ts +0 -31
  130. package/src/internal/validate-url-string.ts +0 -34
  131. package/src/types/declaration.ts +0 -22
  132. package/src/types/fn-change-ext.ts +0 -33
  133. package/src/types/index.ts +0 -14
  134. package/src/types/mime-type.ts +0 -19
  135. package/src/types/module-id.ts +0 -15
  136. package/src/types/module-specifier-type.ts +0 -13
  137. package/src/types/protocol.ts +0 -40
  138. package/src/types/syntax-kind-export.ts +0 -20
  139. package/src/types/syntax-kind-import.ts +0 -22
  140. package/src/types/syntax-kind-require.ts +0 -15
  141. package/src/utils/compare-subpaths.ts +0 -100
  142. package/src/utils/conditions.ts +0 -15
  143. package/src/utils/detect-syntax.ts +0 -40
  144. package/src/utils/extension-format-map.ts +0 -34
  145. package/src/utils/extract-statements.ts +0 -46
  146. package/src/utils/fill-modules.ts +0 -133
  147. package/src/utils/find-dynamic-imports.ts +0 -75
  148. package/src/utils/find-exports.ts +0 -156
  149. package/src/utils/find-requires.ts +0 -75
  150. package/src/utils/find-static-imports.ts +0 -86
  151. package/src/utils/find-subpath.ts +0 -251
  152. package/src/utils/get-format.ts +0 -249
  153. package/src/utils/get-source.ts +0 -144
  154. package/src/utils/has-cjs-syntax.ts +0 -44
  155. package/src/utils/has-esm-syntax.ts +0 -40
  156. package/src/utils/index.ts +0 -45
  157. package/src/utils/is-absolute-specifier.ts +0 -53
  158. package/src/utils/is-bare-specifier.ts +0 -36
  159. package/src/utils/is-directory.ts +0 -25
  160. package/src/utils/is-exports-sugar.ts +0 -81
  161. package/src/utils/is-file.ts +0 -25
  162. package/src/utils/is-relative-specifier.ts +0 -34
  163. package/src/utils/lookup-package-scope.ts +0 -97
  164. package/src/utils/parse-data-url.ts +0 -71
  165. package/src/utils/parse-module-id.ts +0 -197
  166. package/src/utils/parse-subpath.ts +0 -331
  167. package/src/utils/pattern-character.ts +0 -13
  168. package/src/utils/read-package-json.ts +0 -113
  169. package/src/utils/resolve-alias.ts +0 -224
  170. package/src/utils/resolve-aliases.ts +0 -58
  171. package/src/utils/resolve-extensions.ts +0 -33
  172. package/src/utils/resolve-module.ts +0 -181
  173. package/src/utils/resolve-modules.ts +0 -60
  174. package/src/utils/to-absolute-specifier.ts +0 -30
  175. package/src/utils/to-bare-specifier.ts +0 -211
  176. package/src/utils/to-data-url.ts +0 -42
  177. package/src/utils/to-node-url.ts +0 -27
  178. package/src/utils/to-relative-specifier.ts +0 -55
  179. package/src/utils/to-url.ts +0 -30
  180. package/src/utils/validate-assertions.ts +0 -126
  181. package/src/utils/validate-exports.ts +0 -131
package/CHANGELOG.md CHANGED
@@ -1,3 +1,64 @@
1
+ ## [1.0.0-alpha.18](https://github.com/flex-development/mlly/compare/1.0.0-alpha.17...1.0.0-alpha.18) (2023-08-14)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * **ts:** use `export type *`
7
+
8
+ ### :package: Build
9
+
10
+ * **deps-dev:** Bump @commitlint/cli from 17.6.7 to 17.7.0 ([#405](https://github.com/flex-development/mlly/issues/405)) ([6e3e9c7](https://github.com/flex-development/mlly/commit/6e3e9c71ecd58f20a74b782c629914ecb404f5d8))
11
+ * **deps-dev:** Bump @commitlint/cli from 17.7.0 to 17.7.1 ([#409](https://github.com/flex-development/mlly/issues/409)) ([060725c](https://github.com/flex-development/mlly/commit/060725c8d5c6c8002f197e360697a22c35bc1145))
12
+ * **deps-dev:** Bump cspell from 7.0.1-alpha.8 to 7.0.1-alpha.9 ([#408](https://github.com/flex-development/mlly/issues/408)) ([772778a](https://github.com/flex-development/mlly/commit/772778a3df76d005e9b765275b275d8e1e91498a))
13
+ * **deps-dev:** Bump esbuild from 0.19.0 to 0.19.1 ([#410](https://github.com/flex-development/mlly/issues/410)) ([d3804d7](https://github.com/flex-development/mlly/commit/d3804d76d76afbc5a9172a1cacce22f6c8a42a8c))
14
+ * **deps-dev:** Bump esbuild from 0.19.1 to 0.19.2 ([#416](https://github.com/flex-development/mlly/issues/416)) ([eaf8d51](https://github.com/flex-development/mlly/commit/eaf8d5182f47c6855f80eed73e25f0e3f0dba1e4))
15
+ * **deps-dev:** Bump eslint from 8.46.0 to 8.47.0 ([#411](https://github.com/flex-development/mlly/issues/411)) ([a3374af](https://github.com/flex-development/mlly/commit/a3374af2b18028ff56cd17ef4b145169fff1e640))
16
+ * **deps-dev:** Bump eslint-import-resolver-typescript from 3.5.5 to 3.6.0 ([#406](https://github.com/flex-development/mlly/issues/406)) ([c2dbf48](https://github.com/flex-development/mlly/commit/c2dbf483ec9ce4581306c7c41608dd2fa9a04631))
17
+ * **deps-dev:** Bump eslint-plugin-vue from 9.16.1 to 9.17.0 ([#404](https://github.com/flex-development/mlly/issues/404)) ([f0892eb](https://github.com/flex-development/mlly/commit/f0892eb5ec7bc66311b168bf118cb4d11b0b2185))
18
+ * **deps-dev:** Bump graphql from 16.7.1 to 16.8.0 ([#415](https://github.com/flex-development/mlly/issues/415)) ([6f2a71d](https://github.com/flex-development/mlly/commit/6f2a71d2aedc265ac79770a77716a073a53f3407))
19
+ * **deps-dev:** Bump lint-staged from 13.2.3 to 14.0.0 ([#417](https://github.com/flex-development/mlly/issues/417)) ([a2443bd](https://github.com/flex-development/mlly/commit/a2443bd75c4386601b8c67f106a5a0656ce1730b))
20
+ * **deps-dev:** Bump the flex-development group with 1 update ([#403](https://github.com/flex-development/mlly/issues/403)) ([f6e4fb7](https://github.com/flex-development/mlly/commit/f6e4fb74e86c98b784b55ef8880259fd1a1cfb7f))
21
+ * **deps-dev:** Bump the typescript-eslint group with 2 updates ([#413](https://github.com/flex-development/mlly/issues/413)) ([099b5ae](https://github.com/flex-development/mlly/commit/099b5aec18c9bb92608619d4e0c8259533ac6882))
22
+ * **deps:** bump @flex-development/tutils from 6.0.0-alpha.20 to 6.0.0-alpha.21 ([1992970](https://github.com/flex-development/mlly/commit/199297040a08963491aef355fbfcf7c0c0120e9b))
23
+ * **deps:** Bump the flex-development group with 1 update ([#407](https://github.com/flex-development/mlly/issues/407)) ([41be3a2](https://github.com/flex-development/mlly/commit/41be3a267ea674fec6a2e2092c350a6783f0c026))
24
+ * **deps:** Bump the flex-development group with 1 update ([#414](https://github.com/flex-development/mlly/issues/414)) ([2d07755](https://github.com/flex-development/mlly/commit/2d07755998172d705f92c6d1669bc1b0df8fc2fc))
25
+ * **ts:** use `export type *` ([e0a1dce](https://github.com/flex-development/mlly/commit/e0a1dce59094797a7bc0ddf7b26840a43765155c))
26
+
27
+
28
+ ### :robot: Continuous Integration
29
+
30
+ * [[@dependabot](https://github.com/dependabot)] add group `flex-development` ([5a4e169](https://github.com/flex-development/mlly/commit/5a4e169100278e773d78c8e2b1c3b921fb240394))
31
+ * **deps:** Bump actions/setup-node from 3.7.0 to 3.8.0 ([#412](https://github.com/flex-development/mlly/issues/412)) ([3465e63](https://github.com/flex-development/mlly/commit/3465e63ba2cea348833de890a71a21ff16472897))
32
+
33
+
34
+ ### :pencil: Documentation
35
+
36
+ * **utils:** [`resolveModule`] fix valid npm package name note ([e869100](https://github.com/flex-development/mlly/commit/e8691007ada207792915130997917d98d5aebc19))
37
+
38
+
39
+ ### :bug: Fixes
40
+
41
+ * **utils:** [`toBareSpecifier`] specifier conversion ([4d9fdaf](https://github.com/flex-development/mlly/commit/4d9fdaff221109a6fd90fc046fdcf61296bccbd0))
42
+
43
+
44
+ ### :house_with_garden: Housekeeping
45
+
46
+ * **tests:** remove `serve.json` ([7e6d3b8](https://github.com/flex-development/mlly/commit/7e6d3b8cfb0915cb0ed4dfd37f4d21c3da926545))
47
+
48
+ ## [1.0.0-alpha.17](https://github.com/flex-development/mlly/compare/1.0.0-alpha.16...1.0.0-alpha.17) (2023-08-08)
49
+
50
+
51
+ ### :package: Build
52
+
53
+ * ensure resolved source map url is absolute ([1c2f10d](https://github.com/flex-development/mlly/commit/1c2f10d50b305a6beaab9fd526da2a008dd753fc))
54
+ * **deps-dev:** Bump esbuild from 0.18.19 to 0.19.0 ([#399](https://github.com/flex-development/mlly/issues/399)) ([ad57979](https://github.com/flex-development/mlly/commit/ad579797a21b739a88e1804a0f75ab14c1db97da))
55
+ * **deps-dev:** Bump the typescript-eslint group with 2 updates ([#396](https://github.com/flex-development/mlly/issues/396)) ([c65b229](https://github.com/flex-development/mlly/commit/c65b229ab16df80422fcf506732e32ebe1f88a92))
56
+ * **deps-dev:** Bump vercel from 31.2.2 to 31.2.3 ([#400](https://github.com/flex-development/mlly/issues/400)) ([2c26647](https://github.com/flex-development/mlly/commit/2c26647c3a6f9be48e03e42cf78216f4ead7a0cb))
57
+ * **deps-dev:** Bump vite from 4.4.8 to 4.4.9 ([#398](https://github.com/flex-development/mlly/issues/398)) ([477d65e](https://github.com/flex-development/mlly/commit/477d65e745237bf804a903de75d4aa3f19ae59f3))
58
+ * **deps:** Bump @flex-development/tutils from 6.0.0-alpha.15 to 6.0.0-alpha.16 ([#397](https://github.com/flex-development/mlly/issues/397)) ([f0f36f0](https://github.com/flex-development/mlly/commit/f0f36f0a029ae5d3553fb225f5c16fe65f53b0ea))
59
+ * **deps:** Bump @flex-development/tutils from 6.0.0-alpha.16 to 6.0.0-alpha.17 ([#401](https://github.com/flex-development/mlly/issues/401)) ([2e621ce](https://github.com/flex-development/mlly/commit/2e621ce4941e0454174b089ba5a92cad55d3b572))
60
+ * **deps:** bump @flex-development/tutils from 6.0.0-alpha.17 to 6.0.0-alpha.18 ([66db112](https://github.com/flex-development/mlly/commit/66db1127dbdff30a056c3d76e35c37029e1451d0))
61
+
1
62
  ## [1.0.0-alpha.16](https://github.com/flex-development/mlly/compare/1.0.0-alpha.15...1.0.0-alpha.16) (2023-08-07)
2
63
 
3
64
 
package/dist/index.d.mts CHANGED
@@ -3,6 +3,6 @@
3
3
  * @module mlly
4
4
  */
5
5
  export * from './enums/index.mjs';
6
- export * from './interfaces/index.mjs';
7
- export * from './types/index.mjs';
6
+ export type * from './interfaces/index.mjs';
7
+ export type * from './types/index.mjs';
8
8
  export * from './utils/index.mjs';
package/dist/index.mjs CHANGED
@@ -1,5 +1,3 @@
1
1
  export * from "./enums/index.mjs";
2
- export * from "./interfaces/index.mjs";
3
- export * from "./types/index.mjs";
4
2
  export * from "./utils/index.mjs";
5
3
  //# sourceMappingURL=index.mjs.map
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/index.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
7
- "mappings": "AAKA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
3
+ "sources": ["../src/index.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Package Entry Point\n * @module mlly\n */\n\nexport * from './enums'\nexport type * from './interfaces'\nexport type * from './types'\nexport * from './utils'\n"],
6
+ "mappings": "AAKA,cAAc;AAGd,cAAc;",
8
7
  "names": []
9
- }
8
+ }
@@ -4,3 +4,4 @@ var dequote_default = dequote;
4
4
  export {
5
5
  dequote_default as default
6
6
  };
7
+ //# sourceMappingURL=dequote.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/dequote.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - dequote\n * @module mlly/internal/dequote\n */\n\nimport { trim } from '@flex-development/tutils'\n\n/**\n * Removes quotes from the beginning and end of a string.\n *\n * @internal\n *\n * @param {string} str - String to dequote\n * @return {string} String with quotes removed\n */\nconst dequote = (str: string): string => trim(str).replace(/^[\"']|[\"']$/g, '')\n\nexport default dequote\n"],
6
+ "mappings": "AAKA,SAAS,YAAY;AAUrB,MAAM,UAAU,CAAC,QAAwB,KAAK,GAAG,EAAE,QAAQ,gBAAgB,EAAE;AAE7E,IAAO,kBAAQ;",
7
+ "names": []
8
+ }
@@ -10,3 +10,4 @@ var format_type_map_default = FORMAT_TYPE_MAP;
10
10
  export {
11
11
  format_type_map_default as default
12
12
  };
13
+ //# sourceMappingURL=format-type-map.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/format-type-map.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - FORMAT_TYPE_MAP\n * @module mlly/internal/FORMAT_TYPE_MAP\n */\n\nimport { AssertType, Format } from '#src/enums'\n\n/**\n * Module format to `import` assertion type map.\n *\n * **Note**: It's unclear whether or not the HTML spec will require assertion\n * types for WebAssembly modules.\n *\n * @see https://github.com/WebAssembly/esm-integration/issues/42\n *\n * @internal\n *\n * @const {Map<Format, AssertType>} FORMAT_TYPE_MAP\n */\nconst FORMAT_TYPE_MAP: Map<Format, AssertType> = new Map<Format, AssertType>([\n [Format.BUILTIN, AssertType.IMPLICIT],\n [Format.COMMONJS, AssertType.IMPLICIT],\n [Format.JSON, AssertType.JSON],\n [Format.MODULE, AssertType.IMPLICIT],\n [Format.WASM, AssertType.IMPLICIT]\n])\n\nexport default FORMAT_TYPE_MAP\n"],
6
+ "mappings": "AAKA,SAAS,YAAY,cAAc;AAcnC,MAAM,kBAA2C,oBAAI,IAAwB;AAAA,EAC3E,CAAC,OAAO,SAAS,WAAW,QAAQ;AAAA,EACpC,CAAC,OAAO,UAAU,WAAW,QAAQ;AAAA,EACrC,CAAC,OAAO,MAAM,WAAW,IAAI;AAAA,EAC7B,CAAC,OAAO,QAAQ,WAAW,QAAQ;AAAA,EACnC,CAAC,OAAO,MAAM,WAAW,QAAQ;AACnC,CAAC;AAED,IAAO,0BAAQ;",
7
+ "names": []
8
+ }
@@ -8,3 +8,4 @@ var get_specifier_kind_default = getSpecifierKind;
8
8
  export {
9
9
  get_specifier_kind_default as default
10
10
  };
11
+ //# sourceMappingURL=get-specifier-kind.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/get-specifier-kind.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - getSpecifierKind\n * @module mlly/internal/getSpecifierKind\n */\n\nimport { SpecifierKind } from '#src/enums'\nimport isAbsoluteSpecifier from '#src/utils/is-absolute-specifier'\nimport isRelativeSpecifier from '#src/utils/is-relative-specifier'\nimport type { NodeError } from '@flex-development/errnode'\nimport type { Nullable } from '@flex-development/tutils'\nimport dequote from './dequote'\nimport validateString from './validate-string'\n\n/**\n * Determines a specifier type for the given module `specifier`.\n *\n * @see {@linkcode SpecifierKind}\n *\n * @internal\n *\n * @param {string} specifier - Module specifier to evaluate\n * @return {Nullable<SpecifierKind>} Module `specifier` type or `null`\n * @throws {NodeError<TypeError>} If `specifier` is not a string\n */\nconst getSpecifierKind = (specifier: string): Nullable<SpecifierKind> => {\n validateString(specifier, 'specifier')\n\n // dequote specifier (quotes could lead to a specifier being classified as\n // 'bare' when it is actually absolute or relative)\n specifier = dequote(specifier)\n\n return specifier\n ? isAbsoluteSpecifier(specifier)\n ? SpecifierKind.ABSOLUTE\n : isRelativeSpecifier(specifier)\n ? SpecifierKind.RELATIVE\n : SpecifierKind.BARE\n : null\n}\n\nexport default getSpecifierKind\n"],
6
+ "mappings": "AAKA,SAAS,qBAAqB;AAC9B,OAAO,yBAAyB;AAChC,OAAO,yBAAyB;AAGhC,OAAO,aAAa;AACpB,OAAO,oBAAoB;AAa3B,MAAM,mBAAmB,CAAC,eACxB,eAAe,WAAW,WAAW,GAIrC,YAAY,QAAQ,SAAS,GAEtB,YACH,oBAAoB,SAAS,IAC3B,cAAc,WACd,oBAAoB,SAAS,IAC7B,cAAc,WACd,cAAc,OAChB;AAGN,IAAO,6BAAQ;",
7
+ "names": []
8
+ }
@@ -5,3 +5,4 @@ var get_subpaths_default = getSubpaths;
5
5
  export {
6
6
  get_subpaths_default as default
7
7
  };
8
+ //# sourceMappingURL=get-subpaths.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/get-subpaths.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - getSubpaths\n * @module mlly/internal/getSubpaths\n */\n\nimport type { ModuleId } from '#src/types'\nimport isExportsSugar from '#src/utils/is-exports-sugar'\nimport type { Exports, Imports } from '@flex-development/pkg-types'\nimport { DOT, isNIL, keys, type Nilable } from '@flex-development/tutils'\n\n/**\n * Returns an array containing subpaths defined in the given package `context`,\n * a `package.json` [`exports`][1] or [`imports`][2] field.\n *\n * If `context` is using [exports sugar][3], the array will contain a single\n * subpath, `'.'`.\n *\n * [1]: https://nodejs.org/api/packages.html#exports\n * [2]: https://nodejs.org/api/packages.html#imports\n * [3]: https://nodejs.org/api/packages.html#exports-sugar\n *\n * @internal\n *\n * @param {Nilable<Exports | Imports>} context - Package context\n * @param {boolean} internal - Package `imports` hint\n * @param {ModuleId} pkg - URL of relevant `package.json` file\n * @param {ModuleId} parent - URL of module to resolve from\n * @return {string[]} Subpaths defined in `context`\n */\nconst getSubpaths = (\n context: Nilable<Exports | Imports>,\n internal: boolean,\n pkg: ModuleId,\n parent: ModuleId\n): string[] => {\n return isNIL(context)\n ? []\n : !internal && isExportsSugar(context, pkg, parent)\n ? [DOT]\n : keys(context)\n}\n\nexport default getSubpaths\n"],
6
+ "mappings": "AAMA,OAAO,oBAAoB;AAE3B,SAAS,KAAK,OAAO,YAA0B;AAqB/C,MAAM,cAAc,CAClB,SACA,UACA,KACA,WAEO,MAAM,OAAO,IAChB,CAAC,IACD,CAAC,YAAY,eAAe,SAAS,KAAK,MAAM,IAChD,CAAC,GAAG,IACJ,KAAK,OAAO;AAGlB,IAAO,uBAAQ;",
7
+ "names": []
8
+ }
@@ -3,3 +3,4 @@ var regex_encoded_sep_default = ENCODED_SEP_REGEX;
3
3
  export {
4
4
  regex_encoded_sep_default as default
5
5
  };
6
+ //# sourceMappingURL=regex-encoded-sep.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/regex-encoded-sep.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - ENCODED_SEP_REGEX\n * @module mlly/internal/ENCODED_SEP_REGEX\n */\n\n/**\n * Regex pattern matching encoded path separators (e.g `/`, `\\\\`).\n *\n * @see https://regex101.com/r/XV7HzM\n *\n * @internal\n *\n * @const {RegExp} ENCODED_SEP_REGEX\n */\nconst ENCODED_SEP_REGEX: RegExp = /%2f|%5c/i\n\nexport default ENCODED_SEP_REGEX\n"],
6
+ "mappings": "AAcA,MAAM,oBAA4B;AAElC,IAAO,4BAAQ;",
7
+ "names": []
8
+ }
@@ -3,3 +3,4 @@ var regex_internal_specifier_default = INTERNAL_SPECIFIER_REGEX;
3
3
  export {
4
4
  regex_internal_specifier_default as default
5
5
  };
6
+ //# sourceMappingURL=regex-internal-specifier.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/regex-internal-specifier.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - INTERNAL_SPECIFIER_REGEX\n * @module mlly/internal/INTERNAL_SPECIFIER_REGEX\n */\n\n/**\n * Regex pattern matching subpath imports.\n *\n * @see https://regex101.com/r/ppVRw7\n * @see https://nodejs.org/api/packages.html#subpath-imports\n *\n * @internal\n *\n * @const {RegExp} INTERNAL_SPECIFIER_REGEX\n */\nconst INTERNAL_SPECIFIER_REGEX: RegExp =\n /^(?!.*(?:%2[Ff]|%5[Cc]))(?<root>#[^\\s/]+?(?=\\s|$|\\/))(?<path>\\/.+[^/](?=\\s|$))?(?!\\/)/\n\nexport default INTERNAL_SPECIFIER_REGEX\n"],
6
+ "mappings": "AAeA,MAAM,2BACJ;AAEF,IAAO,mCAAQ;",
7
+ "names": []
8
+ }
@@ -6,3 +6,4 @@ var regex_invalid_segment_default = invalidSegmentRegex;
6
6
  export {
7
7
  regex_invalid_segment_default as default
8
8
  };
9
+ //# sourceMappingURL=regex-invalid-segment.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/regex-invalid-segment.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - invalidSegmentRegex\n * @module mlly/internal/invalidSegmentRegex\n */\n\n/**\n * Returns a regular expression matching invalid path segments.\n *\n * @see https://github.com/nodejs/node/blob/v19.6.1/lib/internal/modules/esm/resolve.js#L299-L300\n *\n * @internal\n *\n * @param {'deprecated'?} type - Pattern type\n * @return {RegExp} Regular expression matching invalid path segments\n */\nconst invalidSegmentRegex = (type?: 'deprecated'): RegExp => {\n return new RegExp(\n `(^|\\\\\\\\|\\\\/)((\\\\.|%2e)(\\\\.|%2e)?|(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))${\n type === 'deprecated' ? '' : '?'\n }(\\\\\\\\|\\\\/|$)`,\n 'i'\n )\n}\n\nexport default invalidSegmentRegex\n"],
6
+ "mappings": "AAeA,MAAM,sBAAsB,CAAC,SACpB,IAAI;AAAA,EACT,qKACE,SAAS,eAAe,KAAK,GAC/B;AAAA,EACA;AACF;AAGF,IAAO,gCAAQ;",
7
+ "names": []
8
+ }
@@ -3,3 +3,4 @@ var regex_package_name_default = PACKAGE_NAME_REGEX;
3
3
  export {
4
4
  regex_package_name_default as default
5
5
  };
6
+ //# sourceMappingURL=regex-package-name.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/regex-package-name.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - PACKAGE_NAME_REGEX\n * @module mlly/internal/PACKAGE_NAME_REGEX\n */\n\n/**\n * Regex pattern matching package names.\n *\n * @see https://regex101.com/r/BHcJfc\n *\n * @internal\n *\n * @const {RegExp} PACKAGE_NAME_REGEX\n */\nconst PACKAGE_NAME_REGEX: RegExp =\n /^(?:(?<scope>@[\\d*a-z~-][\\w*.~-]*)\\/)?[\\da-z~-][\\w.~-]*$/\n\nexport default PACKAGE_NAME_REGEX\n"],
6
+ "mappings": "AAcA,MAAM,qBACJ;AAEF,IAAO,6BAAQ;",
7
+ "names": []
8
+ }
@@ -3,3 +3,4 @@ var regex_package_path_default = PACKAGE_PATH_REGEX;
3
3
  export {
4
4
  regex_package_path_default as default
5
5
  };
6
+ //# sourceMappingURL=regex-package-path.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/regex-package-path.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - PACKAGE_PATH_REGEX\n * @module mlly/internal/PACKAGE_PATH_REGEX\n */\n\n/**\n * Regex pattern matching bare specifiers beginning with valid package names.\n *\n * **Note**: Does **not** match specifiers beginning with `'node_modules'`.\n *\n * @see https://regex101.com/r/z0MPgj\n *\n * @internal\n *\n * @const {RegExp} PACKAGE_PATH_REGEX\n */\nconst PACKAGE_PATH_REGEX: RegExp =\n /^(?!\\S+:|node_modules)(?<pkg>(?:(?:(?<scope>@[\\d*a-z~-][\\w*.~-]*)\\/)?[\\da-z~-][\\w.~-]*))@?(?<version_prefix>v)?(?<version>(?:(?:0|[1-9]\\d*)\\.){2}(?:0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[a-z-][\\da-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][\\da-z-]*))*)?(?:\\+[\\da-z-]+(?:\\.[\\da-z-]+)*)?)?(?<subpath>\\/.*)?(?<!.*(?:%2[Ff]|%5[Cc]))/\n\nexport default PACKAGE_PATH_REGEX\n"],
6
+ "mappings": "AAgBA,MAAM,qBACJ;AAEF,IAAO,6BAAQ;",
7
+ "names": []
8
+ }
@@ -480,3 +480,4 @@ var resolver_default = Resolver;
480
480
  export {
481
481
  resolver_default as default
482
482
  };
483
+ //# sourceMappingURL=resolver.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/resolver.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - Resolver\n * @module mlly/internal/Resolver\n */\n\nimport type {\n PackageScope,\n ParsedModuleId,\n ParsedSubpath\n} from '#src/interfaces'\nimport type { ModuleId } from '#src/types'\nimport {\n CONDITIONS,\n PATTERN_CHARACTER,\n isDirectory,\n isExportsSugar,\n isFile,\n isRelativeSpecifier,\n lookupPackageScope,\n parseModuleId,\n parseSubpath,\n readPackageJson,\n toNodeURL,\n toURL\n} from '#src/utils'\nimport {\n ERR_INVALID_MODULE_SPECIFIER,\n ERR_INVALID_PACKAGE_CONFIG,\n ERR_INVALID_PACKAGE_TARGET,\n ERR_MODULE_NOT_FOUND,\n ERR_PACKAGE_IMPORT_NOT_DEFINED,\n ERR_PACKAGE_PATH_NOT_EXPORTED,\n ERR_UNSUPPORTED_DIR_IMPORT,\n ErrorCode,\n type NodeError\n} from '@flex-development/errnode'\nimport { isBuiltin } from '@flex-development/is-builtin'\nimport pathe from '@flex-development/pathe'\nimport type {\n Exports,\n Imports,\n ImportsKey,\n PackageJson\n} from '@flex-development/pkg-types'\nimport {\n DOT,\n cast,\n get,\n ifelse,\n includes,\n isArray,\n isArrayIndex,\n isNIL,\n isNull,\n isObjectCurly,\n isString,\n join,\n regexp,\n type Nullable,\n type Optional\n} from '@flex-development/tutils'\nimport fs from 'node:fs'\nimport { URL, fileURLToPath, pathToFileURL } from 'node:url'\nimport invalidSegmentRegex from './regex-invalid-segment'\nimport PACKAGE_NAME_REGEX from './regex-package-name'\nimport PACKAGE_PATH_REGEX from './regex-package-path'\n\n/**\n * ECMAScript (ES) module resolver.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm\n *\n * @internal\n *\n * @class\n */\nclass Resolver {\n /**\n * Resolves `specifier` according to the [ESM Resolver algorithm][1].\n *\n * [1]: https://nodejs.org/api/esm.html#esm_resolver_algorithm\n *\n * @public\n *\n * @param {string} specifier - Module specifier to resolve\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @param {boolean?} [preserveSymlinks=false] - Skip resolving symlinks\n * @return {URL} Resolved module URL\n * @throws {NodeError}\n */\n public resolveModule(\n specifier: string,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS,\n preserveSymlinks: boolean = false\n ): URL {\n // ensure parent is an instance of URL\n parent = toURL(parent)\n\n /**\n * Remote module check for {@linkcode parent}.\n *\n * @const {boolean} remote\n */\n const remote: boolean = /^https?:$/.test(parent.protocol)\n\n /**\n * Module resolution error.\n *\n * @var {NodeError} error\n */\n let error: NodeError = new ERR_MODULE_NOT_FOUND(\n specifier,\n remote ? parent.href : fileURLToPath(parent),\n PACKAGE_PATH_REGEX.test(specifier) ? 'package' : 'module'\n )\n\n /**\n * Resolved module URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving module\n try {\n switch (true) {\n case isRelativeSpecifier(specifier):\n case pathe.isAbsolute(specifier):\n url = new URL(specifier, parent)\n break\n case !remote && specifier.startsWith('#'):\n url = this.resolvePackageImport(\n specifier,\n parent,\n condition,\n conditions\n )\n break\n default:\n try {\n url = new URL(specifier)\n } catch {\n if (!remote) {\n url = this.resolvePackage(\n specifier,\n parent,\n condition,\n conditions\n )\n }\n }\n\n break\n }\n\n // finalize resolution\n if (url && url.protocol === 'file:') {\n /**\n * Absolute path to resolved module.\n *\n * @var {string} path\n */\n const path: string = fileURLToPath(url)\n\n // throw if resolved module is not a file\n if (!isFile(path)) {\n throw isDirectory(path)\n ? new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(parent))\n : new ERR_MODULE_NOT_FOUND(path, fileURLToPath(parent), 'module')\n }\n\n // resolve symlinks\n if (!preserveSymlinks) {\n // preserve fragment and query portions of module url\n const { hash, search } = url\n\n // remove symlinks in module url\n url = pathToFileURL(fs.realpathSync(path))\n\n // re-add fragment and query portions of module url\n url.hash = hash\n url.search = search\n }\n }\n } catch (e: unknown) {\n error = cast(e)\n url = null\n }\n\n // throw if specifier could not be resolved\n if (!url) throw error\n\n return url\n }\n\n /**\n * Resolves a package path using a combination of the following algorithms:\n *\n * - `PACKAGE_RESOLVE`\n * - `PACKAGE_SELF_RESOLVE`\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n *\n * @public\n *\n * @param {string} specifier - Module specifier to resolve\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {URL} Resolved package path URL\n * @throws {NodeError}\n */\n public resolvePackage(\n specifier: string,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): URL {\n /**\n * Object representation of {@linkcode specifier}.\n *\n * @const {ParsedModuleId} id\n */\n const id: ParsedModuleId = parseModuleId(specifier, {\n parent,\n pkgname: !isBuiltin(specifier)\n })\n\n // exit early if specifier is builtin module\n if (isBuiltin(id.raw)) return new URL(toNodeURL(id.raw))\n\n /**\n * Directory to end package scope search.\n *\n * @const {URL} stopdir\n */\n const stopdir: URL = pathToFileURL(DOT + pathe.sep)\n\n /**\n * Package scope lookup result.\n *\n * @var {Nullable<PackageScope>} scope\n */\n let scope: Nullable<PackageScope> = lookupPackageScope(\n parent,\n stopdir,\n specifier,\n parent\n )\n\n // try self resolve\n if (scope?.pkgjson.name === id.pkg && !isNIL(scope.pkgjson.exports)) {\n return this.resolvePackageExport(\n id.raw,\n scope.pkg,\n parent,\n condition,\n conditions\n )\n }\n\n /**\n * Resolved package path URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // reset scope to try resolving external package\n if (scope) {\n let { dir: pkgdir } = scope\n\n // lookup package scope for external package\n while (pkgdir !== DOT) {\n scope = lookupPackageScope(\n new URL(`node_modules/${id.raw}`, pkgdir + pathe.sep),\n stopdir,\n specifier,\n parent\n )\n\n // stop search if package scope was found for external package\n if (scope) break\n\n // continue package scope search\n pkgdir = pathe.dirname(pkgdir)\n }\n }\n\n // try resolving external package\n switch (true) {\n case scope && !isNIL(scope.pkgjson.exports):\n url = this.resolvePackageExport(\n specifier,\n scope!.pkg,\n parent,\n condition,\n conditions\n )\n break\n case scope && id.path === DOT:\n url = this.resolvePackageMain(scope!.pkg, scope!.pkgjson, parent)\n break\n case !!scope:\n url = new URL(id.path, scope!.pkg)\n break\n }\n\n // throw if package url was not resolved\n if (!url) throw new ERR_MODULE_NOT_FOUND(id.pkg, fileURLToPath(parent))\n\n return url\n }\n\n /**\n * Resolves a subpath export according to the `PACKAGE_EXPORTS_RESOLVE`\n * algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n * @see https://nodejs.org/api/packages.html#subpath-exports\n *\n * @public\n *\n * @param {string} specifier - Module specifier containing subpath\n * @param {ModuleId} pkg - URL of relevant `package.json` file\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {URL} Resolved package export URL\n * @throws {NodeError<Error | TypeError>}\n */\n public resolvePackageExport(\n specifier: string,\n pkg: ModuleId,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): URL {\n /**\n * URL of directory containing `package.json` file.\n *\n * @var {URL} dir\n */\n const dir: URL = new URL(DOT, pkg)\n\n /**\n * Possible `package.json` object.\n *\n * @const {PackageJson} pkgjson\n */\n const pkgjson: Nullable<PackageJson> = readPackageJson(\n dir,\n specifier,\n parent\n )\n\n /**\n * Package `exports`.\n *\n * @var {Optional<Exports>} exports\n */\n let exports: Optional<Exports> = pkgjson?.exports\n\n /**\n * Object representation of package subpath.\n *\n * @const {ParsedSubpath} subpath\n */\n const subpath: ParsedSubpath = parseSubpath(specifier, exports, {\n dir,\n parent\n })\n\n // convert exports to object if using exports main sugar\n if (!subpath.internal && isExportsSugar(exports, pkg, parent)) {\n exports = cast({ [DOT]: exports })\n }\n\n /**\n * Resolved package export URL.\n *\n * @const {Nullable<URL>} url\n */\n const url: Nullable<URL> = this.resolvePackageTarget(\n dir,\n get(exports, subpath.key),\n subpath.base,\n subpath.key,\n parent,\n subpath.internal,\n condition,\n conditions\n )\n\n // throw if subpath export was not resolved\n if (!url) {\n throw new ERR_PACKAGE_PATH_NOT_EXPORTED(\n fileURLToPath(dir),\n subpath.raw,\n fileURLToPath(parent)\n )\n }\n\n return url\n }\n\n /**\n * Resolves a subpath import according to the `PACKAGE_IMPORTS_RESOLVE`\n * algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n * @see https://nodejs.org/api/packages.html#subpath-imports\n *\n * @public\n *\n * @param {string} specifier - Module specifier containing subpath\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {URL} Resolved package import URL\n * @throws {NodeError<Error | TypeError>}\n */\n public resolvePackageImport(\n specifier: string,\n parent: ModuleId,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): URL {\n /**\n * Parsed module id.\n *\n * Ensures {@linkcode specifier} is a valid internal specifier.\n *\n * @const {ParsedModuleId} id\n */\n const id: ParsedModuleId = parseModuleId(specifier, {\n internal: true,\n parent\n })\n\n /**\n * Package scope result for {@linkcode parent}.\n *\n * @const {Nullable<PackageScope>} scope\n */\n const scope: Nullable<PackageScope> = lookupPackageScope(\n parent,\n pathToFileURL(DOT),\n specifier,\n parent\n )\n\n /**\n * Resolved package import URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving subpath import\n if (scope) {\n /**\n * Package `imports`.\n *\n * @const {Optional<Imports>} imports\n */\n const imports: Optional<Imports> = scope.pkgjson.imports\n\n /**\n * Object representation of package subpath.\n *\n * @const {ParsedSubpath} subpath\n */\n const subpath: ParsedSubpath = parseSubpath(id.raw, imports, {\n dir: scope.dir,\n internal: true,\n parent\n })\n\n url = this.resolvePackageTarget(\n scope.dir,\n get(imports, cast<ImportsKey>(subpath.key)),\n subpath.base,\n subpath.key,\n parent,\n subpath.internal,\n condition,\n conditions\n )\n }\n\n // throw if subpath import was not resolved\n if (!url) {\n throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(\n specifier,\n fileURLToPath(parent),\n /* c8 ignore next */ scope?.dir ? fileURLToPath(scope.dir) : undefined\n )\n }\n\n return url\n }\n\n /**\n * Resolves a package entry point using the legacy CommonJS `main` resolution\n * alogirthm:\n *\n * 1. let M = pkgdir `pkgjson.main`\n * 2. TRY(M, M.js, M.json, M.node, M/index.js, M/index.json, M/index.node)\n * 4. TRY(pkgdir/index.js, pkgdir/index.json, pkgdir/index.node)\n * 5. ERR_MODULE_NOT_FOUND\n *\n * @todo emit deprecation messages\n *\n * @public\n *\n * @param {ModuleId} pkg - URL of relevant `package.json` file\n * @param {PackageJson} pkgjson - Relevant `package.json` object\n * @param {ModuleId} parent - URL of module to resolve from\n * @return {URL} Package entry point URL\n * @throws {NodeError} If package entry point is not found\n */\n public resolvePackageMain(\n pkg: ModuleId,\n pkgjson: PackageJson,\n parent: ModuleId\n ): URL {\n /**\n * Possible inputs for package entry point URL.\n *\n * @const {string[]} tries\n */\n const tries: string[] = [\n ...(pkgjson.main\n ? [\n pkgjson.main,\n `./${pkgjson.main}.js`,\n `./${pkgjson.main}.json`,\n `./${pkgjson.main}.node`,\n `./${pkgjson.main}/index.js`,\n `./${pkgjson.main}/index.json`,\n `./${pkgjson.main}/index.node`\n ]\n : []),\n './index.js',\n './index.json',\n './index.node'\n ]\n\n /**\n * Package entry point URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving package entry point\n for (const input of tries) {\n if (isFile((url = new URL(input, pkg)))) break\n url = null\n }\n\n // throw if package entry point was not resolved\n if (!url) {\n throw new ERR_MODULE_NOT_FOUND(\n fileURLToPath(new URL(DOT, pkg)),\n fileURLToPath(parent)\n )\n }\n\n return url\n }\n\n /**\n * Resolves a package target according to the `PACKAGE_TARGET_RESOLVE`\n * algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolver-algorithm-specification\n *\n * @todo emit deprecation messages\n *\n * @public\n *\n * @param {ModuleId} dir - URL of directory containing relevant `package.json`\n * @param {Optional<Exports>} target - Package `exports` or `imports` target\n * @param {string} subpath - Package subpath without entry prefix (`key`)\n * @param {string} key - Subpath defined in relevant `package.json` file\n * @param {ModuleId} parent - URL of module to resolve from\n * @param {boolean?} [internal=false] - Package `imports` hint\n * @param {string?} [condition='default'] - Export condition to apply\n * @param {Set<string>?} [conditions=CONDITIONS] - Export conditions\n * @return {Nullable<URL>} Resolved package target URL or `null`\n * @throws {NodeError<Error | TypeError>}\n */\n public resolvePackageTarget(\n dir: ModuleId,\n target: Optional<Exports>,\n subpath: string,\n key: string,\n parent: ModuleId,\n internal: boolean = false,\n condition: string = 'default',\n conditions: Set<string> = CONDITIONS\n ): Nullable<URL> {\n /**\n * Resolved package target URL.\n *\n * @var {Nullable<URL>} url\n */\n let url: Nullable<URL> = null\n\n // try resolving package target\n switch (true) {\n case isNull(target):\n break\n case isArray(target):\n /**\n * Possible package target resolution error.\n *\n * @var {Optional<NodeError>} error\n */\n let error: Optional<NodeError>\n\n // try resolving package target based on first match in target array\n for (const item of cast<string[]>(target)) {\n try {\n url = this.resolvePackageTarget(\n dir,\n item,\n subpath,\n key,\n parent,\n internal,\n condition,\n conditions\n )\n } catch (e: unknown) {\n error = cast<NodeError>(e)\n\n /* c8 ignore next */\n if (error.code !== ErrorCode.ERR_INVALID_PACKAGE_TARGET) throw error\n\n continue\n }\n\n // stop resolution attempts if target was resolved\n if (url) {\n error = undefined\n break\n }\n }\n\n // throw if error was encountered and package target was not resolved\n if (error) throw error\n\n break\n case isObjectCurly(target):\n target = cast<Record<string, Exports>>(target)\n\n for (const prop of Object.getOwnPropertyNames(target)) {\n // ensure prop is not an array index\n if (isArrayIndex(prop)) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(dir).replace(/\\/$/, '') + '/package.json',\n fileURLToPath(parent),\n '\"exports\" cannot contain numeric property keys'\n )\n }\n\n // try resolving package target based on condition\n if (prop === condition || conditions.has(prop)) {\n url = this.resolvePackageTarget(\n dir,\n get(target, prop),\n subpath,\n key,\n parent,\n internal,\n condition,\n conditions\n )\n\n // stop resolution attempts if target was resolved\n if (url) break\n }\n }\n\n break\n case isString(target):\n target = cast<string>(target)\n\n /**\n * Subpath pattern check.\n *\n * @const {boolean} pattern\n */\n const pattern: boolean = includes(key, PATTERN_CHARACTER)\n\n switch (true) {\n case subpath && !pattern && !target.endsWith(pathe.sep):\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n case internal && PACKAGE_NAME_REGEX.test(target):\n url = this.resolvePackage(target, parent, condition, conditions)\n break\n case target.startsWith(DOT + pathe.sep):\n // check target for invalid segments\n if (invalidSegmentRegex().test(target.slice(2))) {\n if (invalidSegmentRegex('deprecated').test(target.slice(2))) {\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n }\n }\n\n // set resolved package target url using target\n url = new URL(\n target,\n pathToFileURL(fileURLToPath(dir).replace(/\\/$/, '') + pathe.sep)\n )\n\n // check subpath for invalid segments\n if (subpath) {\n if (invalidSegmentRegex().test(subpath)) {\n if (invalidSegmentRegex('deprecated').test(subpath)) {\n throw new ERR_INVALID_MODULE_SPECIFIER(\n key.replace(PATTERN_CHARACTER, subpath),\n join(\n [\n `request is not a valid match in pattern \"${key}\" for`,\n `the \"${ifelse(internal, 'imports', 'exports')}\"`,\n 'resolution of',\n `${fileURLToPath(dir).replace(/\\/$/, '')}/package.json`\n ],\n ' '\n ),\n fileURLToPath(parent)\n )\n }\n }\n\n // set resolved package target url using subpath\n url = new URL(\n url.href.replace(\n new RegExp(regexp(PATTERN_CHARACTER), 'g'),\n subpath\n )\n )\n }\n\n break\n default:\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n }\n\n break\n default:\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(dir),\n key,\n target,\n internal,\n fileURLToPath(parent)\n )\n }\n\n return url\n }\n}\n\nexport default Resolver\n"],
6
+ "mappings": "AAWA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAC1B,OAAO,WAAW;AAOlB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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Q,OAAO,UAAU,WAAW,SAAS,CAAC;AAAA,sBAC9C;AAAA,sBACA,GAAG,cAAc,GAAG,EAAE,QAAQ,OAAO,EAAE,CAAC;AAAA,oBAC1C;AAAA,oBACA;AAAA,kBACF;AAAA,kBACA,cAAc,MAAM;AAAA,gBACtB;AAKJ,oBAAM,IAAI;AAAA,gBACR,IAAI,KAAK;AAAA,kBACP,IAAI,OAAO,OAAO,iBAAiB,GAAG,GAAG;AAAA,kBACzC;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAEA;AAAA,UACF;AACE,kBAAM,IAAI;AAAA,cACR,cAAc,GAAG;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA,cAAc,MAAM;AAAA,YACtB;AAAA,QACJ;AAEA;AAAA,MACF;AACE,cAAM,IAAI;AAAA,UACR,cAAc,GAAG;AAAA,UACjB;AAAA,UACA;AAAA,UACA;AAAA,UACA,cAAc,MAAM;AAAA,QACtB;AAAA,IACJ;AAEA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,mBAAQ;",
7
+ "names": []
8
+ }
@@ -9,3 +9,4 @@ var validate_array_set_default = validateArraySet;
9
9
  export {
10
10
  validate_array_set_default as default
11
11
  };
12
+ //# sourceMappingURL=validate-array-set.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-array-set.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateArraySet\n * @module mlly/internal/validateArraySet\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isArray, isSet } from '@flex-development/tutils'\n\n/**\n * Checks if `value` is an array or an instance of {@linkcode Set}.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if the `value` is of neither type.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode ERR_INVALID_ARG_TYPE}\n *\n * @internal\n *\n * @template T - Item type\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is Set<T> | T[]} `true` if `value` is array or `Set`\n * @throws {NodeError<TypeError>} If `value` is not an array or `Set`\n */\nconst validateArraySet = <T>(\n value: unknown,\n name: string\n): value is Set<T> | T[] => {\n if (isArray<T>(value) || isSet<T>(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, ['Array', 'Set'], value)\n}\n\nexport default validateArraySet\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,SAAS,aAAa;AAoB/B,MAAM,mBAAmB,CACvB,OACA,SAC0B;AAC1B,MAAI,QAAW,KAAK,KAAK,MAAS,KAAK;AAAG,WAAO;AACjD,QAAM,IAAI,qBAAqB,MAAM,CAAC,SAAS,KAAK,GAAG,KAAK;AAC9D;AAEA,IAAO,6BAAQ;",
7
+ "names": []
8
+ }
@@ -9,3 +9,4 @@ var validate_boolean_default = validateBoolean;
9
9
  export {
10
10
  validate_boolean_default as default
11
11
  };
12
+ //# sourceMappingURL=validate-boolean.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-boolean.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateBoolean\n * @module mlly/internal/validateBoolean\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isBoolean } from '@flex-development/tutils'\n\n/**\n * Checks if `value` is a boolean.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if `value` is not a boolean.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode ERR_INVALID_ARG_TYPE}\n *\n * @internal\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is boolean} `true` if `value` is a boolean\n * @throws {NodeError<TypeError>} If `value` is not a boolean\n */\nconst validateBoolean = (value: unknown, name: string): value is boolean => {\n if (isBoolean(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value)\n}\n\nexport default validateBoolean\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,iBAAiB;AAkB1B,MAAM,kBAAkB,CAAC,OAAgB,SAAmC;AAC1E,MAAI,UAAU,KAAK;AAAG,WAAO;AAC7B,QAAM,IAAI,qBAAqB,MAAM,WAAW,KAAK;AACvD;AAEA,IAAO,2BAAQ;",
7
+ "names": []
8
+ }
@@ -9,3 +9,4 @@ var validate_map_default = validateMap;
9
9
  export {
10
10
  validate_map_default as default
11
11
  };
12
+ //# sourceMappingURL=validate-map.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-map.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateMap\n * @module mlly/internal/validateMap\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isMap, type PropertyKey } from '@flex-development/tutils'\n\n/**\n * Checks if `value` is a {@linkcode Map} instance.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if `value` is not a {@linkcode Map}.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode ERR_INVALID_ARG_TYPE}\n *\n * @internal\n *\n * @template K - Map key type\n * @template V - Map item type\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is Map<K, V>} `true` if `value` is a `Map`\n * @throws {NodeError<TypeError>} If `value` is not a `Map`\n */\nconst validateMap = <K = PropertyKey, V = unknown>(\n value: unknown,\n name: string\n): value is Map<K, V> => {\n if (isMap<K, V>(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, ['Map'], value)\n}\n\nexport default validateMap\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,aAA+B;AAqBxC,MAAM,cAAc,CAClB,OACA,SACuB;AACvB,MAAI,MAAY,KAAK;AAAG,WAAO;AAC/B,QAAM,IAAI,qBAAqB,MAAM,CAAC,KAAK,GAAG,KAAK;AACrD;AAEA,IAAO,uBAAQ;",
7
+ "names": []
8
+ }
@@ -9,3 +9,4 @@ var validate_object_default = validateObject;
9
9
  export {
10
10
  validate_object_default as default
11
11
  };
12
+ //# sourceMappingURL=validate-object.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-object.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateObject\n * @module mlly/internal/validateObject\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isObjectCurly, type ObjectCurly } from '@flex-development/tutils'\n\n/**\n * Checks if `value` is a curly-braced object.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if `value` is not a curly-braced object.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode isObjectCurly}\n *\n * @internal\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is ObjectCurly} `true` if `value` is a curly-braced object\n * @throws {NodeError<TypeError>} If `value` is not a curly-braced object\n */\nconst validateObject = (value: unknown, name: string): value is ObjectCurly => {\n if (isObjectCurly(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, 'object', value)\n}\n\nexport default validateObject\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,qBAAuC;AAkBhD,MAAM,iBAAiB,CAAC,OAAgB,SAAuC;AAC7E,MAAI,cAAc,KAAK;AAAG,WAAO;AACjC,QAAM,IAAI,qBAAqB,MAAM,UAAU,KAAK;AACtD;AAEA,IAAO,0BAAQ;",
7
+ "names": []
8
+ }
@@ -9,3 +9,4 @@ var validate_set_default = validateSet;
9
9
  export {
10
10
  validate_set_default as default
11
11
  };
12
+ //# sourceMappingURL=validate-set.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-set.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateSet\n * @module mlly/internal/validateSet\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isSet } from '@flex-development/tutils'\n\n/**\n * Checks if given `value` is a {@linkcode Set}.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if `value` is not a {@linkcode Set}.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode ERR_INVALID_ARG_TYPE}\n *\n * @internal\n *\n * @template T - Set item type\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is Set<T>} `true` if `value` is a `Set`\n * @throws {NodeError<TypeError>} If `value` is not a `Set`\n */\nconst validateSet = <T>(value: unknown, name: string): value is Set<T> => {\n if (isSet<T>(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, ['Set'], value)\n}\n\nexport default validateSet\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,aAAa;AAoBtB,MAAM,cAAc,CAAI,OAAgB,SAAkC;AACxE,MAAI,MAAS,KAAK;AAAG,WAAO;AAC5B,QAAM,IAAI,qBAAqB,MAAM,CAAC,KAAK,GAAG,KAAK;AACrD;AAEA,IAAO,uBAAQ;",
7
+ "names": []
8
+ }
@@ -9,3 +9,4 @@ var validate_string_default = validateString;
9
9
  export {
10
10
  validate_string_default as default
11
11
  };
12
+ //# sourceMappingURL=validate-string.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-string.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateString\n * @module mlly/internal/validateString\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isString } from '@flex-development/tutils'\n\n/**\n * Checks if `value` is a string.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if `value` is not a string.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode ERR_INVALID_ARG_TYPE}\n * @see {@linkcode NodeError}\n *\n * @internal\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is string} `true` if `value` is a string\n * @throws {NodeError<TypeError>} If `value` is not a string\n */\nconst validateString = (value: unknown, name: string): value is string => {\n if (isString(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, 'string', value)\n}\n\nexport default validateString\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,gBAAgB;AAmBzB,MAAM,iBAAiB,CAAC,OAAgB,SAAkC;AACxE,MAAI,SAAS,KAAK;AAAG,WAAO;AAC5B,QAAM,IAAI,qBAAqB,MAAM,UAAU,KAAK;AACtD;AAEA,IAAO,0BAAQ;",
7
+ "names": []
8
+ }
@@ -10,3 +10,4 @@ var validate_url_string_default = validateURLString;
10
10
  export {
11
11
  validate_url_string_default as default
12
12
  };
13
+ //# sourceMappingURL=validate-url-string.mjs.map
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/validate-url-string.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file Internal - validateURLString\n * @module mlly/internal/validateURLString\n */\n\nimport { ERR_INVALID_ARG_TYPE, type NodeError } from '@flex-development/errnode'\nimport { isString } from '@flex-development/tutils'\nimport { URL } from 'node:url'\n\n/**\n * Checks if `value` is an instance of {@linkcode URL} or a string.\n *\n * Throws [`ERR_INVALID_ARG_TYPE`][1] if `value` is of neither type.\n *\n * [1]: https://nodejs.org/api/errors.html#err_invalid_arg_value\n *\n * @see {@linkcode ERR_INVALID_ARG_TYPE}\n *\n * @internal\n *\n * @param {unknown} value - Value supplied by user\n * @param {string} name - Name of invalid argument or property\n * @return {value is URL | string} `true` if `value` is `URL` instance or string\n * @throws {NodeError<TypeError>} If `value` is not `URL` instance or string\n */\nconst validateURLString = (\n value: unknown,\n name: string\n): value is URL | string => {\n if (value instanceof URL || isString(value)) return true\n throw new ERR_INVALID_ARG_TYPE(name, ['URL', 'string'], value)\n}\n\nexport default validateURLString\n"],
6
+ "mappings": "AAKA,SAAS,4BAA4C;AACrD,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAkBpB,MAAM,oBAAoB,CACxB,OACA,SAC0B;AAC1B,MAAI,iBAAiB,OAAO,SAAS,KAAK;AAAG,WAAO;AACpD,QAAM,IAAI,qBAAqB,MAAM,CAAC,OAAO,QAAQ,GAAG,KAAK;AAC/D;AAEA,IAAO,8BAAQ;",
7
+ "names": []
8
+ }
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/utils/compare-subpaths.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
3
+ "sources": ["../../src/utils/compare-subpaths.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file compareSubpaths\n * @module mlly/utils/compareSubpaths\n */\n\nimport validateString from '#src/internal/validate-string'\nimport type { NodeError } from '@flex-development/errnode'\nimport { CompareResult } from '@flex-development/tutils'\nimport assert from 'node:assert'\nimport PATTERN_CHARACTER from './pattern-character'\n\n/**\n * Returns a number indicating if a subpath pattern is equal to, greater than,\n * or less than another subpath pattern.\n *\n * - `-1`: `subpath2` is less than `subpath1`\n * - `0`: `subpath2` is equal to `subpath1`\n * - `1`: `subpath2` is greater than `subpath1`\n *\n * Implements the `PATTERN_KEY_COMPARE` algorithm.\n *\n * @see https://nodejs.org/api/esm.html#resolution-algorithm\n *\n * @param {string} subpath1 - Subpath to be compared\n * @param {string} subpath2 - Subpath to compare `subpath1` to\n * @return {CompareResult} Comparsion result\n * @throws {NodeError<Error | TypeError>} If either either subpath contains more\n * than pattern character (`'*'`) or is not a string\n */\nconst compareSubpaths = (subpath1: string, subpath2: string): CompareResult => {\n validateString(subpath1, 'subpath1')\n validateString(subpath2, 'subpath2')\n\n /**\n * Index of {@linkcode pattern_char} in {@linkcode subpath1}.\n *\n * @const {number} pattern1\n */\n let pattern1: number = -1\n\n /**\n * Index of {@linkcode pattern_char} in {@linkcode subpath2}.\n *\n * @const {number} pattern2\n */\n let pattern2: number = -1\n\n // ensure subpaths contain a single '*'\n for (const [index, subpath] of [subpath1, subpath2].entries()) {\n /**\n * Error message thrown if {@linkcode subpath} contains more than one `'*'`.\n *\n * @const {string} message\n */\n const message: string = `'${subpath}' is expected to contain a single '*'`\n\n /**\n * Index of {@linkcode PATTERN_CHARACTER} in {@linkcode subpath}.\n *\n * @const {number} pattern\n */\n const pattern_index: number = subpath.indexOf(PATTERN_CHARACTER)\n\n // ensure respective subpath contains no more than one '*'\n assert(pattern_index === subpath.lastIndexOf(PATTERN_CHARACTER), message)\n\n // set index of pattern character in respective subpath\n index === 0 ? (pattern1 = pattern_index) : (pattern2 = pattern_index)\n }\n\n /**\n * Base length of {@linkcode subpath1}.\n *\n * @const {number} length1\n */\n const length1: number = pattern1 === -1 ? subpath1.length : pattern1 + 1\n\n /**\n * Base length of {@linkcode subpath2}.\n *\n * @const {number} length2\n */\n const length2: number = pattern2 === -1 ? subpath2.length : pattern2 + 1\n\n return length1 > length2\n ? CompareResult.LESS_THAN\n : length2 > length1\n ? CompareResult.GREATER_THAN\n : pattern1 === -1\n ? CompareResult.GREATER_THAN\n : pattern2 === -1\n ? CompareResult.LESS_THAN\n : subpath1.length > subpath2.length\n ? CompareResult.LESS_THAN\n : subpath2.length > subpath1.length\n ? CompareResult.GREATER_THAN\n : CompareResult.EQUAL\n}\n\nexport default compareSubpaths\n"],
7
6
  "mappings": "AAKA,OAAO,oBAAoB;AAE3B,SAAS,qBAAqB;AAC9B,OAAO,YAAY;AACnB,OAAO,uBAAuB;AAoB9B,MAAM,kBAAkB,CAAC,UAAkB,aAAoC;AAC7E,iBAAe,UAAU,UAAU,GACnC,eAAe,UAAU,UAAU;AAOnC,MAAI,WAAmB,IAOnB,WAAmB;AAGvB,aAAW,CAAC,OAAO,OAAO,KAAK,CAAC,UAAU,QAAQ,EAAE,QAAQ,GAAG;AAM7D,UAAM,UAAkB,IAAI,OAAO,yCAO7B,gBAAwB,QAAQ,QAAQ,iBAAiB;AAG/D,WAAO,kBAAkB,QAAQ,YAAY,iBAAiB,GAAG,OAAO,GAGxE,UAAU,IAAK,WAAW,gBAAkB,WAAW;AAAA,EACzD;AAOA,QAAM,UAAkB,aAAa,KAAK,SAAS,SAAS,WAAW,GAOjE,UAAkB,aAAa,KAAK,SAAS,SAAS,WAAW;AAEvE,SAAO,UAAU,UACb,cAAc,YACd,UAAU,UACV,cAAc,eACd,aAAa,KACb,cAAc,eACd,aAAa,KACb,cAAc,YACd,SAAS,SAAS,SAAS,SAC3B,cAAc,YACd,SAAS,SAAS,SAAS,SAC3B,cAAc,eACd,cAAc;AACpB;AAEA,IAAO,2BAAQ;",
8
7
  "names": []
9
- }
8
+ }
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/utils/conditions.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
3
+ "sources": ["../../src/utils/conditions.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file CONDITIONS\n * @module mlly/utils/CONDITIONS\n */\n\n/**\n * Default export conditions.\n *\n * @see https://nodejs.org/api/packages.html#conditional-exports\n *\n * @const {Set<string>} CONDITIONS\n */\nconst CONDITIONS: Set<string> = new Set(['node', 'import'])\n\nexport default CONDITIONS\n"],
7
6
  "mappings": "AAYA,MAAM,aAA0B,oBAAI,IAAI,CAAC,QAAQ,QAAQ,CAAC;AAE1D,IAAO,qBAAQ;",
8
7
  "names": []
9
- }
8
+ }
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/utils/detect-syntax.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
3
+ "sources": ["../../src/utils/detect-syntax.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file detectSyntax\n * @module mlly/utils/detectSyntax\n */\n\nimport hasCJSSyntax from './has-cjs-syntax'\nimport hasESMSyntax from './has-esm-syntax'\n\n/**\n * Detects if `code` contains CommonJS syntax, ESM syntax, or a mixture of both.\n *\n * Ignores matches in comments.\n *\n * @see {@linkcode hasCJSSyntax}\n * @see {@linkcode hasESMSyntax}\n *\n * @param {string} code - Code to evaluate\n * @return {{ cjs: boolean; esm: boolean; mixed: boolean }} Detection result\n */\nconst detectSyntax = (\n code: string\n): { cjs: boolean; esm: boolean; mixed: boolean } => {\n /**\n * CommonJS syntax check.\n *\n * @const {boolean} cjs\n */\n const cjs: boolean = hasCJSSyntax(code)\n\n /**\n * ESM syntax check.\n *\n * @const {boolean} esm\n */\n const esm: boolean = hasESMSyntax(code)\n\n return { cjs, esm, mixed: cjs && esm }\n}\n\nexport default detectSyntax\n"],
7
6
  "mappings": "AAKA,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AAazB,MAAM,eAAe,CACnB,SACmD;AAMnD,QAAM,MAAe,aAAa,IAAI,GAOhC,MAAe,aAAa,IAAI;AAEtC,SAAO,EAAE,KAAK,KAAK,OAAO,OAAO,IAAI;AACvC;AAEA,IAAO,wBAAQ;",
8
7
  "names": []
9
- }
8
+ }
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/utils/extension-format-map.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
3
+ "sources": ["../../src/utils/extension-format-map.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file EXTENSION_FORMAT_MAP\n * @module mlly/utils/EXTENSION_FORMAT_MAP\n */\n\nimport { Format } from '#src/enums'\nimport type { Ext } from '@flex-development/pathe'\n\n/**\n * Default file extension to module formats map.\n *\n * @see {@linkcode Ext}\n * @see {@linkcode Format}\n *\n * @const {Map<Ext, Format>} EXTENSION_FORMAT_MAP\n */\nconst EXTENSION_FORMAT_MAP: Map<Ext, Format> = new Map<Ext, Format>([\n ['.cjs', Format.COMMONJS],\n ['.cts', Format.COMMONJS],\n ['.d.cts', Format.COMMONJS],\n ['.d.mts', Format.MODULE],\n ['.d.ts', Format.MODULE],\n ['.js', Format.MODULE],\n ['.json', Format.JSON],\n ['.jsx', Format.MODULE],\n ['.mjs', Format.MODULE],\n ['.mts', Format.MODULE],\n ['.node', Format.COMMONJS],\n ['.ts', Format.MODULE],\n ['.tsx', Format.MODULE],\n ['.wasm', Format.WASM]\n])\n\nexport default EXTENSION_FORMAT_MAP\n"],
7
6
  "mappings": "AAKA,SAAS,cAAc;AAWvB,MAAM,uBAAyC,oBAAI,IAAiB;AAAA,EAClE,CAAC,QAAQ,OAAO,QAAQ;AAAA,EACxB,CAAC,QAAQ,OAAO,QAAQ;AAAA,EACxB,CAAC,UAAU,OAAO,QAAQ;AAAA,EAC1B,CAAC,UAAU,OAAO,MAAM;AAAA,EACxB,CAAC,SAAS,OAAO,MAAM;AAAA,EACvB,CAAC,OAAO,OAAO,MAAM;AAAA,EACrB,CAAC,SAAS,OAAO,IAAI;AAAA,EACrB,CAAC,QAAQ,OAAO,MAAM;AAAA,EACtB,CAAC,QAAQ,OAAO,MAAM;AAAA,EACtB,CAAC,QAAQ,OAAO,MAAM;AAAA,EACtB,CAAC,SAAS,OAAO,QAAQ;AAAA,EACzB,CAAC,OAAO,OAAO,MAAM;AAAA,EACrB,CAAC,QAAQ,OAAO,MAAM;AAAA,EACtB,CAAC,SAAS,OAAO,IAAI;AACvB,CAAC;AAED,IAAO,+BAAQ;",
8
7
  "names": []
9
- }
8
+ }
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/utils/extract-statements.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
3
+ "sources": ["../../src/utils/extract-statements.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file extractStatements\n * @module mlly/utils/extractStatements\n */\n\nimport type { Statement } from '#src/interfaces'\nimport validateString from '#src/internal/validate-string'\nimport type { NodeError } from '@flex-development/errnode'\nimport { sort, trim } from '@flex-development/tutils'\nimport findDynamicImports from './find-dynamic-imports'\nimport findExports from './find-exports'\nimport findRequires from './find-requires'\nimport findStaticImports from './find-static-imports'\n\n/**\n * Finds all `export`, `import`, and/or `require` statements in `code`.\n *\n * Ignores matches in comments.\n *\n * @see {@linkcode findDynamicImports}\n * @see {@linkcode findExports}\n * @see {@linkcode findRequires}\n * @see {@linkcode findStaticImports}\n *\n * @param {string} [code=''] - Code to evaluate\n * @return {Statement[]} Extracted statements\n * @throws {NodeError<TypeError>} If `code` is not a string\n */\nconst extractStatements = (code: string = ''): Statement[] => {\n validateString(code, 'code')\n\n // code shorter than first shortest keyword => no possible matches\n if (trim(code).length < 'export'.length) return []\n\n return sort(\n [\n ...findDynamicImports(code),\n ...findExports(code),\n ...findRequires(code),\n ...findStaticImports(code)\n ],\n (s1: Statement, s2: Statement): number => s1.start - s2.start\n )\n}\n\nexport default extractStatements\n"],
7
6
  "mappings": "AAMA,OAAO,oBAAoB;AAE3B,SAAS,MAAM,YAAY;AAC3B,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;AACzB,OAAO,uBAAuB;AAgB9B,MAAM,oBAAoB,CAAC,OAAe,QACxC,eAAe,MAAM,MAAM,GAGvB,KAAK,IAAI,EAAE,SAAS,IAAwB,CAAC,IAE1C;AAAA,EACL;AAAA,IACE,GAAG,mBAAmB,IAAI;AAAA,IAC1B,GAAG,YAAY,IAAI;AAAA,IACnB,GAAG,aAAa,IAAI;AAAA,IACpB,GAAG,kBAAkB,IAAI;AAAA,EAC3B;AAAA,EACA,CAAC,IAAe,OAA0B,GAAG,QAAQ,GAAG;AAC1D;AAGF,IAAO,6BAAQ;",
8
7
  "names": []
9
- }
8
+ }
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [
4
- "src/utils/fill-modules.ts"
5
- ],
6
- "sourceRoot": "https:/github.com/flex-development/mlly/blob/1.0.0-alpha.16",
3
+ "sources": ["../../src/utils/fill-modules.ts"],
4
+ "sourceRoot": "file://",
5
+ "sourcesContent": ["/**\n * @file fillModules\n * @module mlly/utils/fillModules\n */\n\nimport { SpecifierSyntaxKind } from '#src/enums'\nimport type { FillModuleOptions } from '#src/interfaces'\nimport validateArraySet from '#src/internal/validate-array-set'\nimport validateURLString from '#src/internal/validate-url-string'\nimport {\n ERR_UNKNOWN_FILE_EXTENSION,\n type NodeError\n} from '@flex-development/errnode'\nimport pathe from '@flex-development/pathe'\nimport {\n DOT,\n isFunction,\n regexp,\n trim,\n type Optional\n} from '@flex-development/tutils'\nimport type { URL } from 'node:url'\nimport CONDITIONS from './conditions'\nimport extractStatements from './extract-statements'\nimport isAbsoluteSpecifier from './is-absolute-specifier'\nimport isBareSpecifier from './is-bare-specifier'\nimport resolveModule from './resolve-module'\nimport toBareSpecifier from './to-bare-specifier'\nimport toRelativeSpecifier from './to-relative-specifier'\n\n/**\n * Ensures all absolute and relative module specifiers in the given piece of\n * source `code` are fully specified.\n *\n * Ignores specifiers that already have file extensions.\n *\n * @see {@linkcode FillModuleOptions}\n * @see https://nodejs.org/api/esm.html#mandatory-file-extensions\n * @see https://nodejs.org/api/esm.html#terminology\n *\n * @async\n *\n * @param {string} code - Code to evaluate\n * @param {FillModuleOptions} options - Module fill options\n * @return {Promise<string>} `code` with fully specified module specifiers\n * @throws {NodeError<TypeError>}\n */\nconst fillModules = async (\n code: string,\n options: FillModuleOptions\n): Promise<string> => {\n const { conditions = CONDITIONS, ext, parent = import.meta.url } = options\n\n // validate options\n validateArraySet(conditions, 'options.conditions')\n validateURLString(parent, 'options.parent')\n\n // ensure specifiers have file extensions\n for (const statement of extractStatements(code)) {\n if (statement.specifier) {\n if (statement.specifier_syntax !== SpecifierSyntaxKind.DYNAMIC) {\n /**\n * Resolved module URL.\n *\n * @const {URL} url\n */\n const url: URL = await resolveModule(statement.specifier, {\n ...options,\n /**\n * Returns a replacement file extension for the given `specifier` if\n * it is non-bare and does not already have an extension.\n *\n * Throws [`ERR_UNKNOWN_FILE_EXTENSION`][1] if the new extension is\n * `null`, `undefined`, an empty string, or a dot character (`'.'`).\n *\n * [1]: https://nodejs.org/api/errors.html#err_unknown_file_extension\n *\n * @async\n *\n * @param {string} specifier - Module specifier\n * @param {URL} url - Resolved module URL\n * @return {Promise<Optional<string>>} New file extension\n */\n async ext(specifier: string, url: URL): Promise<Optional<string>> {\n // skip replacement for bare specifiers\n if (isBareSpecifier(specifier)) return void 0\n\n // skip replacement for specifiers that are already fully specified\n if (pathe.extname(specifier) === pathe.extname(url.href)) {\n return void 0\n }\n\n /**\n * Replacement file extension.\n *\n * @var {string} rext\n */\n const rext: string = isFunction(ext)\n ? await ext(specifier, url)\n : ext\n\n // ensure replacement extension is non-empty and non-dot ('.')\n if (!(rext && trim(rext).length > (rext.startsWith(DOT) ? 1 : 0))) {\n throw new ERR_UNKNOWN_FILE_EXTENSION(rext, specifier)\n }\n\n return rext\n }\n })\n\n // replace original module specifier\n code = code.replace(\n statement.code,\n statement.code.replace(\n new RegExp(`(?<=[\"'])${regexp(statement.specifier)}(?=[\"'])`),\n // convert module url back to absolute, bare, or relative specifier\n statement.specifier.startsWith('#')\n ? statement.specifier\n : isAbsoluteSpecifier(statement.specifier)\n ? url.href\n : isBareSpecifier(statement.specifier)\n ? toBareSpecifier(url, parent, new Set(conditions))\n : toRelativeSpecifier(url, parent)\n )\n )\n }\n }\n }\n\n return code\n}\n\nexport default fillModules\n"],
7
6
  "mappings": "AAKA,SAAS,2BAA2B;AAEpC,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B;AAAA,EACE;AAAA,OAEK;AACP,OAAO,WAA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