@flex-development/mlly 1.0.0-alpha.9 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/CHANGELOG.md +1120 -376
  2. package/README.md +1555 -12
  3. package/dist/index.d.mts +3 -4
  4. package/dist/index.mjs +5 -5
  5. package/dist/interfaces/aliases.d.mts +21 -0
  6. package/dist/interfaces/condition-map.d.mts +24 -0
  7. package/dist/interfaces/file-system.d.mts +29 -0
  8. package/dist/interfaces/get-source-context.d.mts +44 -0
  9. package/dist/interfaces/get-source-options.d.mts +48 -0
  10. package/dist/interfaces/index.d.mts +18 -21
  11. package/dist/interfaces/is-directory.d.mts +17 -0
  12. package/dist/interfaces/is-file.d.mts +17 -0
  13. package/dist/interfaces/main-field-map.d.mts +22 -0
  14. package/dist/interfaces/module-format-map.d.mts +26 -0
  15. package/dist/interfaces/pattern-key-comparison-map.d.mts +31 -0
  16. package/dist/interfaces/protocol-map.d.mts +44 -0
  17. package/dist/interfaces/read-file.d.mts +28 -0
  18. package/dist/interfaces/realpath.d.mts +30 -0
  19. package/dist/interfaces/resolve-alias-options.d.mts +43 -0
  20. package/dist/interfaces/resolve-module-options.d.mts +79 -0
  21. package/dist/interfaces/stat.d.mts +28 -0
  22. package/dist/interfaces/stats.d.mts +23 -0
  23. package/dist/internal/chain-or-call.mjs +34 -0
  24. package/dist/internal/chars.mjs +17 -0
  25. package/dist/internal/check-invalid-segments.mjs +49 -0
  26. package/dist/internal/constant.mjs +23 -0
  27. package/dist/internal/fs.browser.mjs +42 -0
  28. package/dist/internal/fs.node.mjs +16 -0
  29. package/dist/internal/identity.mjs +23 -0
  30. package/dist/internal/invalid-package-target.mjs +36 -0
  31. package/dist/internal/invalid-subpath.mjs +37 -0
  32. package/dist/internal/is-promise.mjs +26 -0
  33. package/dist/internal/process.browser.mjs +8 -0
  34. package/dist/lib/can-parse-url.d.mts +23 -0
  35. package/dist/lib/can-parse-url.mjs +31 -0
  36. package/dist/lib/cwd.d.mts +14 -0
  37. package/dist/lib/cwd.mjs +17 -0
  38. package/dist/lib/default-conditions.d.mts +15 -0
  39. package/dist/lib/default-conditions.mjs +14 -0
  40. package/dist/lib/default-extensions.d.mts +14 -0
  41. package/dist/lib/default-extensions.mjs +29 -0
  42. package/dist/lib/default-main-fields.d.mts +14 -0
  43. package/dist/lib/default-main-fields.mjs +13 -0
  44. package/dist/lib/extension-format-map.d.mts +16 -0
  45. package/dist/lib/extension-format-map.mjs +31 -0
  46. package/dist/lib/formats.d.mts +21 -0
  47. package/dist/lib/formats.mjs +22 -0
  48. package/dist/lib/get-source.d.mts +46 -0
  49. package/dist/lib/get-source.mjs +156 -0
  50. package/dist/lib/index.d.mts +41 -0
  51. package/dist/lib/index.mjs +41 -0
  52. package/dist/lib/is-absolute-specifier.d.mts +23 -0
  53. package/dist/lib/is-absolute-specifier.mjs +34 -0
  54. package/dist/lib/is-array-index.d.mts +19 -0
  55. package/dist/lib/is-array-index.mjs +28 -0
  56. package/dist/lib/is-bare-specifier.d.mts +23 -0
  57. package/dist/lib/is-bare-specifier.mjs +33 -0
  58. package/dist/lib/is-directory.d.mts +27 -0
  59. package/dist/lib/is-directory.mjs +54 -0
  60. package/dist/lib/is-file.d.mts +27 -0
  61. package/dist/lib/is-file.mjs +54 -0
  62. package/dist/lib/is-imports-subpath.d.mts +26 -0
  63. package/dist/lib/is-imports-subpath.mjs +28 -0
  64. package/dist/lib/is-module-id.d.mts +23 -0
  65. package/dist/lib/is-module-id.mjs +24 -0
  66. package/dist/lib/is-relative-specifier.d.mts +23 -0
  67. package/dist/lib/is-relative-specifier.mjs +36 -0
  68. package/dist/lib/lookup-package-scope.d.mts +49 -0
  69. package/dist/lib/lookup-package-scope.mjs +102 -0
  70. package/dist/lib/pattern-key-compare.d.mts +28 -0
  71. package/dist/lib/pattern-key-compare.mjs +71 -0
  72. package/dist/lib/pattern-match.d.mts +22 -0
  73. package/dist/lib/pattern-match.mjs +85 -0
  74. package/dist/lib/read-package-json.d.mts +63 -0
  75. package/dist/lib/read-package-json.mjs +115 -0
  76. package/dist/lib/resolve-alias.d.mts +21 -0
  77. package/dist/lib/resolve-alias.mjs +102 -0
  78. package/dist/lib/resolve-module.d.mts +43 -0
  79. package/dist/lib/resolve-module.mjs +186 -0
  80. package/dist/lib/resolver.d.mts +346 -0
  81. package/dist/lib/resolver.mjs +1015 -0
  82. package/dist/lib/root.d.mts +11 -0
  83. package/dist/lib/root.mjs +12 -0
  84. package/dist/lib/to-relative-specifier.d.mts +27 -0
  85. package/dist/lib/to-relative-specifier.mjs +63 -0
  86. package/dist/lib/to-url.d.mts +26 -0
  87. package/dist/lib/to-url.mjs +34 -0
  88. package/dist/types/awaitable.d.mts +12 -0
  89. package/dist/types/change-ext-fn.d.mts +29 -0
  90. package/dist/types/condition.d.mts +13 -0
  91. package/dist/types/dot.d.mts +9 -0
  92. package/dist/types/empty-array.d.mts +9 -0
  93. package/dist/types/empty-object.d.mts +19 -0
  94. package/dist/types/empty-string.d.mts +9 -0
  95. package/dist/types/ext.d.mts +12 -0
  96. package/dist/types/get-source-handler.d.mts +22 -0
  97. package/dist/types/get-source-handlers.d.mts +15 -0
  98. package/dist/types/index.d.mts +19 -10
  99. package/dist/types/list.d.mts +12 -0
  100. package/dist/types/main-field.d.mts +13 -0
  101. package/dist/types/module-format.d.mts +13 -0
  102. package/dist/types/module-id.d.mts +3 -4
  103. package/dist/types/numeric.d.mts +9 -0
  104. package/dist/types/pattern-key-comparison.d.mts +14 -0
  105. package/dist/types/pattern-match.d.mts +10 -0
  106. package/dist/types/protocol.d.mts +6 -7
  107. package/package.json +151 -158
  108. package/changelog.config.ts +0 -404
  109. package/dist/enums/assert-type.d.mts +0 -21
  110. package/dist/enums/assert-type.mjs +0 -10
  111. package/dist/enums/assert-type.mjs.map +0 -6
  112. package/dist/enums/format.d.mts +0 -17
  113. package/dist/enums/format.mjs +0 -13
  114. package/dist/enums/format.mjs.map +0 -6
  115. package/dist/enums/index.d.mts +0 -10
  116. package/dist/enums/index.mjs +0 -15
  117. package/dist/enums/index.mjs.map +0 -6
  118. package/dist/enums/kind-specifier-syntax.d.mts +0 -14
  119. package/dist/enums/kind-specifier-syntax.mjs +0 -10
  120. package/dist/enums/kind-specifier-syntax.mjs.map +0 -6
  121. package/dist/enums/kind-specifier.d.mts +0 -17
  122. package/dist/enums/kind-specifier.mjs +0 -11
  123. package/dist/enums/kind-specifier.mjs.map +0 -6
  124. package/dist/enums/kind-statement-syntax.d.mts +0 -22
  125. package/dist/enums/kind-statement-syntax.mjs +0 -18
  126. package/dist/enums/kind-statement-syntax.mjs.map +0 -6
  127. package/dist/enums/kind-statement.d.mts +0 -15
  128. package/dist/enums/kind-statement.mjs +0 -11
  129. package/dist/enums/kind-statement.mjs.map +0 -6
  130. package/dist/index.mjs.map +0 -6
  131. package/dist/interfaces/import-assertions.d.mts +0 -20
  132. package/dist/interfaces/import-dynamic.d.mts +0 -43
  133. package/dist/interfaces/import-static.d.mts +0 -37
  134. package/dist/interfaces/index.mjs +0 -1
  135. package/dist/interfaces/index.mjs.map +0 -6
  136. package/dist/interfaces/options-fill-module.d.mts +0 -23
  137. package/dist/interfaces/options-find-subpath.d.mts +0 -49
  138. package/dist/interfaces/options-get-format.d.mts +0 -83
  139. package/dist/interfaces/options-get-source.d.mts +0 -63
  140. package/dist/interfaces/options-parse-module-id.d.mts +0 -33
  141. package/dist/interfaces/options-parse-subpath.d.mts +0 -31
  142. package/dist/interfaces/options-resolve-alias.d.mts +0 -53
  143. package/dist/interfaces/options-resolve-module.d.mts +0 -64
  144. package/dist/interfaces/options-resolve.d.mts +0 -15
  145. package/dist/interfaces/package-scope.d.mts +0 -25
  146. package/dist/interfaces/parsed-data-url.d.mts +0 -56
  147. package/dist/interfaces/parsed-module-id.d.mts +0 -80
  148. package/dist/interfaces/parsed-subpath.d.mts +0 -40
  149. package/dist/interfaces/statement-export.d.mts +0 -44
  150. package/dist/interfaces/statement-import.d.mts +0 -38
  151. package/dist/interfaces/statement-require.d.mts +0 -38
  152. package/dist/interfaces/statement.d.mts +0 -49
  153. package/dist/internal/escape-reg-exp.d.mts +0 -16
  154. package/dist/internal/escape-reg-exp.mjs +0 -10
  155. package/dist/internal/escape-reg-exp.mjs.map +0 -6
  156. package/dist/internal/format-type-map.d.mts +0 -17
  157. package/dist/internal/format-type-map.mjs +0 -13
  158. package/dist/internal/format-type-map.mjs.map +0 -6
  159. package/dist/internal/get-specifier-kind.d.mts +0 -17
  160. package/dist/internal/get-specifier-kind.mjs +0 -14
  161. package/dist/internal/get-specifier-kind.mjs.map +0 -6
  162. package/dist/internal/get-subpaths.d.mts +0 -25
  163. package/dist/internal/get-subpaths.mjs +0 -10
  164. package/dist/internal/get-subpaths.mjs.map +0 -6
  165. package/dist/internal/is-array-index.d.mts +0 -15
  166. package/dist/internal/is-array-index.mjs +0 -9
  167. package/dist/internal/is-array-index.mjs.map +0 -6
  168. package/dist/internal/is-directory.d.mts +0 -13
  169. package/dist/internal/is-directory.mjs +0 -16
  170. package/dist/internal/is-directory.mjs.map +0 -6
  171. package/dist/internal/is-file.d.mts +0 -13
  172. package/dist/internal/is-file.mjs +0 -16
  173. package/dist/internal/is-file.mjs.map +0 -6
  174. package/dist/internal/is-function.d.mts +0 -12
  175. package/dist/internal/is-function.mjs +0 -8
  176. package/dist/internal/is-function.mjs.map +0 -6
  177. package/dist/internal/regex-encoded-sep.d.mts +0 -13
  178. package/dist/internal/regex-encoded-sep.mjs +0 -6
  179. package/dist/internal/regex-encoded-sep.mjs.map +0 -6
  180. package/dist/internal/regex-internal-specifier.d.mts +0 -14
  181. package/dist/internal/regex-internal-specifier.mjs +0 -6
  182. package/dist/internal/regex-internal-specifier.mjs.map +0 -6
  183. package/dist/internal/regex-package-name.d.mts +0 -13
  184. package/dist/internal/regex-package-name.mjs +0 -6
  185. package/dist/internal/regex-package-name.mjs.map +0 -6
  186. package/dist/internal/regex-package-path.d.mts +0 -15
  187. package/dist/internal/regex-package-path.mjs +0 -6
  188. package/dist/internal/regex-package-path.mjs.map +0 -6
  189. package/dist/internal/resolver.d.mts +0 -130
  190. package/dist/internal/resolver.mjs +0 -500
  191. package/dist/internal/resolver.mjs.map +0 -6
  192. package/dist/internal/validate-boolean.d.mts +0 -20
  193. package/dist/internal/validate-boolean.mjs +0 -11
  194. package/dist/internal/validate-boolean.mjs.map +0 -6
  195. package/dist/internal/validate-object.d.mts +0 -23
  196. package/dist/internal/validate-object.mjs +0 -11
  197. package/dist/internal/validate-object.mjs.map +0 -6
  198. package/dist/internal/validate-set.d.mts +0 -23
  199. package/dist/internal/validate-set.mjs +0 -11
  200. package/dist/internal/validate-set.mjs.map +0 -6
  201. package/dist/internal/validate-string.d.mts +0 -20
  202. package/dist/internal/validate-string.mjs +0 -11
  203. package/dist/internal/validate-string.mjs.map +0 -6
  204. package/dist/internal/validate-url-string.d.mts +0 -22
  205. package/dist/internal/validate-url-string.mjs +0 -12
  206. package/dist/internal/validate-url-string.mjs.map +0 -6
  207. package/dist/types/declaration.d.mts +0 -9
  208. package/dist/types/fn-change-ext.d.mts +0 -28
  209. package/dist/types/index.mjs +0 -1
  210. package/dist/types/index.mjs.map +0 -6
  211. package/dist/types/mime-type.d.mts +0 -13
  212. package/dist/types/module-specifier-type.d.mts +0 -11
  213. package/dist/types/syntax-kind-export.d.mts +0 -12
  214. package/dist/types/syntax-kind-import.d.mts +0 -12
  215. package/dist/types/syntax-kind-require.d.mts +0 -12
  216. package/dist/utils/compare-subpaths.d.mts +0 -25
  217. package/dist/utils/compare-subpaths.mjs +0 -24
  218. package/dist/utils/compare-subpaths.mjs.map +0 -6
  219. package/dist/utils/conditions.d.mts +0 -13
  220. package/dist/utils/conditions.mjs +0 -6
  221. package/dist/utils/conditions.mjs.map +0 -6
  222. package/dist/utils/detect-syntax.d.mts +0 -21
  223. package/dist/utils/detect-syntax.mjs +0 -12
  224. package/dist/utils/detect-syntax.mjs.map +0 -6
  225. package/dist/utils/extension-format-map.d.mts +0 -16
  226. package/dist/utils/extension-format-map.mjs +0 -22
  227. package/dist/utils/extension-format-map.mjs.map +0 -6
  228. package/dist/utils/extract-statements.d.mts +0 -21
  229. package/dist/utils/extract-statements.mjs +0 -21
  230. package/dist/utils/extract-statements.mjs.map +0 -6
  231. package/dist/utils/fill-modules.d.mts +0 -23
  232. package/dist/utils/fill-modules.mjs +0 -62
  233. package/dist/utils/fill-modules.mjs.map +0 -6
  234. package/dist/utils/find-dynamic-imports.d.mts +0 -18
  235. package/dist/utils/find-dynamic-imports.mjs +0 -39
  236. package/dist/utils/find-dynamic-imports.mjs.map +0 -6
  237. package/dist/utils/find-exports.d.mts +0 -21
  238. package/dist/utils/find-exports.mjs +0 -95
  239. package/dist/utils/find-exports.mjs.map +0 -6
  240. package/dist/utils/find-requires.d.mts +0 -18
  241. package/dist/utils/find-requires.mjs +0 -32
  242. package/dist/utils/find-requires.mjs.map +0 -6
  243. package/dist/utils/find-static-imports.d.mts +0 -18
  244. package/dist/utils/find-static-imports.mjs +0 -34
  245. package/dist/utils/find-static-imports.mjs.map +0 -6
  246. package/dist/utils/find-subpath.d.mts +0 -30
  247. package/dist/utils/find-subpath.mjs +0 -106
  248. package/dist/utils/find-subpath.mjs.map +0 -6
  249. package/dist/utils/get-format.d.mts +0 -24
  250. package/dist/utils/get-format.mjs +0 -111
  251. package/dist/utils/get-format.mjs.map +0 -6
  252. package/dist/utils/get-source.d.mts +0 -22
  253. package/dist/utils/get-source.mjs +0 -63
  254. package/dist/utils/get-source.mjs.map +0 -6
  255. package/dist/utils/has-cjs-syntax.d.mts +0 -25
  256. package/dist/utils/has-cjs-syntax.mjs +0 -11
  257. package/dist/utils/has-cjs-syntax.mjs.map +0 -6
  258. package/dist/utils/has-esm-syntax.d.mts +0 -21
  259. package/dist/utils/has-esm-syntax.mjs +0 -11
  260. package/dist/utils/has-esm-syntax.mjs.map +0 -6
  261. package/dist/utils/index.d.mts +0 -42
  262. package/dist/utils/index.mjs +0 -79
  263. package/dist/utils/index.mjs.map +0 -6
  264. package/dist/utils/is-absolute-specifier.d.mts +0 -19
  265. package/dist/utils/is-absolute-specifier.mjs +0 -25
  266. package/dist/utils/is-absolute-specifier.mjs.map +0 -6
  267. package/dist/utils/is-bare-specifier.d.mts +0 -19
  268. package/dist/utils/is-bare-specifier.mjs +0 -10
  269. package/dist/utils/is-bare-specifier.mjs.map +0 -6
  270. package/dist/utils/is-exports-sugar.d.mts +0 -25
  271. package/dist/utils/is-exports-sugar.mjs +0 -26
  272. package/dist/utils/is-exports-sugar.mjs.map +0 -6
  273. package/dist/utils/is-relative-specifier.d.mts +0 -20
  274. package/dist/utils/is-relative-specifier.mjs +0 -11
  275. package/dist/utils/is-relative-specifier.mjs.map +0 -6
  276. package/dist/utils/lookup-package-scope.d.mts +0 -26
  277. package/dist/utils/lookup-package-scope.mjs +0 -38
  278. package/dist/utils/lookup-package-scope.mjs.map +0 -6
  279. package/dist/utils/parse-data-url.d.mts +0 -25
  280. package/dist/utils/parse-data-url.mjs +0 -25
  281. package/dist/utils/parse-data-url.mjs.map +0 -6
  282. package/dist/utils/parse-module-id.d.mts +0 -22
  283. package/dist/utils/parse-module-id.mjs +0 -122
  284. package/dist/utils/parse-module-id.mjs.map +0 -6
  285. package/dist/utils/parse-subpath.d.mts +0 -35
  286. package/dist/utils/parse-subpath.mjs +0 -54
  287. package/dist/utils/parse-subpath.mjs.map +0 -6
  288. package/dist/utils/pattern-character.d.mts +0 -11
  289. package/dist/utils/pattern-character.mjs +0 -6
  290. package/dist/utils/pattern-character.mjs.map +0 -6
  291. package/dist/utils/read-package-json.d.mts +0 -26
  292. package/dist/utils/read-package-json.mjs +0 -43
  293. package/dist/utils/read-package-json.mjs.map +0 -6
  294. package/dist/utils/resolve-alias.d.mts +0 -20
  295. package/dist/utils/resolve-alias.mjs +0 -106
  296. package/dist/utils/resolve-alias.mjs.map +0 -6
  297. package/dist/utils/resolve-aliases.d.mts +0 -19
  298. package/dist/utils/resolve-aliases.mjs +0 -28
  299. package/dist/utils/resolve-aliases.mjs.map +0 -6
  300. package/dist/utils/resolve-extensions.d.mts +0 -14
  301. package/dist/utils/resolve-extensions.mjs +0 -22
  302. package/dist/utils/resolve-extensions.mjs.map +0 -6
  303. package/dist/utils/resolve-module.d.mts +0 -39
  304. package/dist/utils/resolve-module.mjs +0 -64
  305. package/dist/utils/resolve-module.mjs.map +0 -6
  306. package/dist/utils/resolve-modules.d.mts +0 -25
  307. package/dist/utils/resolve-modules.mjs +0 -26
  308. package/dist/utils/resolve-modules.mjs.map +0 -6
  309. package/dist/utils/to-absolute-specifier.d.mts +0 -22
  310. package/dist/utils/to-absolute-specifier.mjs +0 -8
  311. package/dist/utils/to-absolute-specifier.mjs.map +0 -6
  312. package/dist/utils/to-bare-specifier.d.mts +0 -42
  313. package/dist/utils/to-bare-specifier.mjs +0 -90
  314. package/dist/utils/to-bare-specifier.mjs.map +0 -6
  315. package/dist/utils/to-data-url.d.mts +0 -30
  316. package/dist/utils/to-data-url.mjs +0 -11
  317. package/dist/utils/to-data-url.mjs.map +0 -6
  318. package/dist/utils/to-node-url.d.mts +0 -19
  319. package/dist/utils/to-node-url.mjs +0 -10
  320. package/dist/utils/to-node-url.mjs.map +0 -6
  321. package/dist/utils/to-relative-specifier.d.mts +0 -22
  322. package/dist/utils/to-relative-specifier.mjs +0 -21
  323. package/dist/utils/to-relative-specifier.mjs.map +0 -6
  324. package/dist/utils/to-url.d.mts +0 -22
  325. package/dist/utils/to-url.mjs +0 -12
  326. package/dist/utils/to-url.mjs.map +0 -6
  327. package/dist/utils/validate-assertions.d.mts +0 -23
  328. package/dist/utils/validate-assertions.mjs +0 -52
  329. package/dist/utils/validate-assertions.mjs.map +0 -6
  330. package/dist/utils/validate-exports.d.mts +0 -24
  331. package/dist/utils/validate-exports.mjs +0 -72
  332. package/dist/utils/validate-exports.mjs.map +0 -6
@@ -1,80 +0,0 @@
1
- /**
2
- * @file Interfaces - ParsedModuleId
3
- * @module mlly/interfaces/ParsedModuleId
4
- */
5
- import type { Protocol } from '../types/index.mjs';
6
- import type { SemanticVersion } from '@flex-development/pkg-types';
7
- import type { EmptyString, LiteralUnion } from '@flex-development/tutils';
8
- /**
9
- * Object representing a ECMAScript module id.
10
- *
11
- * @see {@linkcode Protocol}
12
- * @see {@linkcode SemanticVersion}
13
- */
14
- interface ParsedModuleId {
15
- /**
16
- * Subpath import (internal specifier) check.
17
- *
18
- * @see https://nodejs.org/api/packages.html#imports
19
- * @see https://nodejs.org/api/packages.html#subpath-imports
20
- */
21
- internal: boolean;
22
- /**
23
- * One of the following:
24
- *
25
- * - Possible [subpath export][1] (includes leading `'.'`)
26
- * - Possible [subpath import][2]
27
- * - URL [`host`][3], [`pathname`][4], and [`port`][5]
28
- * - Raw module id ({@linkcode raw})
29
- *
30
- * [1]: https://nodejs.org/api/packages.html#subpath-exports
31
- * [2]: https://nodejs.org/api/packages.html#subpath-imports
32
- * [3]: https://nodejs.org/api/url.html#urlhost
33
- * [4]: https://nodejs.org/api/url.html#urlpathname
34
- * [5]: https://nodejs.org/api/url.html#urlport
35
- */
36
- path: string;
37
- /**
38
- * Package name if module id begins with valid package name (e.g. is a [bare
39
- * specifier][1]).
40
- *
41
- * If the module id is a bare specifier *and* [internal][2], this value will
42
- * instead be the first path segement in the module id (i.e. `'#src'` given
43
- * `'#src/foo'`). This **may or may not** be the subpath defined by the
44
- * package maintainer.
45
- *
46
- * [1]: https://nodejs.org/api/esm.html#terminology
47
- * [2]: https://nodejs.org/api/packages.html#subpath-imports
48
- */
49
- pkg: LiteralUnion<EmptyString, string>;
50
- /**
51
- * URL scheme if module id is a URL.
52
- */
53
- protocol: LiteralUnion<EmptyString | Protocol, string>;
54
- /**
55
- * Raw module id.
56
- */
57
- raw: string;
58
- /**
59
- * Package scope if module id begins with valid package name (e.g. is a [bare
60
- * specifier][1]).
61
- *
62
- * [1]: https://nodejs.org/api/esm.html#terminology
63
- */
64
- scope: LiteralUnion<EmptyString, string>;
65
- /**
66
- * Package version if specified and module id begins with valid package name
67
- * (e.g. is a [bare specifier][1]).
68
- *
69
- * **Note**: Version follows [Semantic Versioning 2.0.0][2] specification.
70
- *
71
- * [1]: https://nodejs.org/api/esm.html#terminology
72
- * [2]: https://semver.org/spec/v2.0.0.html
73
- */
74
- version: LiteralUnion<EmptyString | SemanticVersion, string>;
75
- /**
76
- * Package {@linkcode version} prefix.
77
- */
78
- version_prefix: LiteralUnion<EmptyString | 'v', string>;
79
- }
80
- export type { ParsedModuleId as default };
@@ -1,40 +0,0 @@
1
- /**
2
- * @file Interfaces - ParsedSubpath
3
- * @module mlly/interfaces/ParsedSubpath
4
- */
5
- import type { EmptyString, LiteralUnion } from '@flex-development/tutils';
6
- /**
7
- * Object representing a package subpath.
8
- *
9
- * @see https://nodejs.org/api/packages.html#subpath-exports
10
- * @see https://nodejs.org/api/packages.html#subpath-imports
11
- */
12
- interface ParsedSubpath {
13
- /**
14
- * Subpath without entry prefix ({@linkcode key}).
15
- */
16
- base: LiteralUnion<EmptyString, string>;
17
- /**
18
- * Subpath import check.
19
- *
20
- * @see https://nodejs.org/api/packages.html#imports
21
- * @see https://nodejs.org/api/packages.html#subpath-imports
22
- */
23
- internal: boolean;
24
- /**
25
- * Subpath defined in `package.json` file.
26
- *
27
- * @see https://nodejs.org/api/packages.html#exports
28
- * @see https://nodejs.org/api/packages.html#imports
29
- */
30
- key: string;
31
- /**
32
- * Subpath passed by user in module specifier.
33
- */
34
- raw: string;
35
- /**
36
- * Module specifier passed by user.
37
- */
38
- specifier: string;
39
- }
40
- export type { ParsedSubpath as default };
@@ -1,44 +0,0 @@
1
- /**
2
- * @file Interfaces - ExportStatement
3
- * @module mlly/interfaces/ExportStatement
4
- */
5
- import type { StatementKind } from '../enums/index.mjs';
6
- import type { Declaration, SyntaxKindExport } from '../types/index.mjs';
7
- import type { Nullable } from '@flex-development/tutils';
8
- import type Statement from './statement.mjs';
9
- /**
10
- * Export statement object.
11
- *
12
- * @see {@linkcode Declaration}
13
- * @see {@linkcode Statement}
14
- * @see {@linkcode SyntaxKindExport}
15
- *
16
- * @extends {Statement}
17
- */
18
- interface ExportStatement extends Statement {
19
- /**
20
- * Export declaration, if any.
21
- */
22
- declaration: Nullable<Declaration>;
23
- /**
24
- * Export names.
25
- */
26
- exports: string[];
27
- /**
28
- * Statement kind.
29
- */
30
- kind: StatementKind.EXPORT;
31
- /**
32
- * Modifier keywords.
33
- */
34
- modifiers: string[];
35
- /**
36
- * Statement syntax kind.
37
- */
38
- syntax: SyntaxKindExport;
39
- /**
40
- * Type-only export statement check.
41
- */
42
- type: boolean;
43
- }
44
- export type { ExportStatement as default };
@@ -1,38 +0,0 @@
1
- /**
2
- * @file Interfaces - ImportStatement
3
- * @module mlly/interfaces/ImportStatement
4
- */
5
- import type { StatementKind } from '../enums/index.mjs';
6
- import type { SyntaxKindImport } from '../types/index.mjs';
7
- import type Statement from './statement.mjs';
8
- /**
9
- * Import statement object.
10
- *
11
- * @see {@linkcode Statement}
12
- * @see {@linkcode SyntaxKindImport}
13
- *
14
- * @extends {Statement}
15
- */
16
- interface ImportStatement extends Statement {
17
- /**
18
- * Import names.
19
- */
20
- imports: string[];
21
- /**
22
- * Statement kind.
23
- */
24
- kind: StatementKind.IMPORT;
25
- /**
26
- * Module specifier.
27
- */
28
- specifier: NonNullable<Statement['specifier']>;
29
- /**
30
- * Module specifier syntax type.
31
- */
32
- specifier_syntax: NonNullable<Statement['specifier_syntax']>;
33
- /**
34
- * Statement syntax kind.
35
- */
36
- syntax: SyntaxKindImport;
37
- }
38
- export type { ImportStatement as default };
@@ -1,38 +0,0 @@
1
- /**
2
- * @file Interfaces - RequireStatement
3
- * @module mlly/interfaces/RequireStatement
4
- */
5
- import type { StatementKind } from '../enums/index.mjs';
6
- import type { SyntaxKindRequire } from '../types/index.mjs';
7
- import type Statement from './statement.mjs';
8
- /**
9
- * Require statement object.
10
- *
11
- * @see {@linkcode Statement}
12
- * @see {@linkcode SyntaxKindRequire}
13
- *
14
- * @extends {Statement}
15
- */
16
- interface RequireStatement extends Statement {
17
- /**
18
- * Import names.
19
- */
20
- imports: string[];
21
- /**
22
- * Statement kind.
23
- */
24
- kind: StatementKind.REQUIRE;
25
- /**
26
- * Module specifier.
27
- */
28
- specifier: NonNullable<Statement['specifier']>;
29
- /**
30
- * Module specifier syntax type.
31
- */
32
- specifier_syntax: NonNullable<Statement['specifier_syntax']>;
33
- /**
34
- * Statement syntax kind.
35
- */
36
- syntax: SyntaxKindRequire;
37
- }
38
- export type { RequireStatement as default };
@@ -1,49 +0,0 @@
1
- /**
2
- * @file Interfaces - Statement
3
- * @module mlly/interfaces/Statement
4
- */
5
- import type { SpecifierKind, SpecifierSyntaxKind, StatementKind, StatementSyntaxKind } from '../enums/index.mjs';
6
- import type { Nullable } from '@flex-development/tutils';
7
- /**
8
- * CommonJS or ESM statement object.
9
- *
10
- * @see {@linkcode SpecifierKind}
11
- * @see {@linkcode SpecifierSyntaxKind}
12
- * @see {@linkcode StatementKind}
13
- * @see {@linkcode StatementSyntaxKind}
14
- */
15
- interface Statement {
16
- /**
17
- * Statement snippet.
18
- */
19
- code: string;
20
- /**
21
- * End index of {@linkcode code} in source content.
22
- */
23
- end: number;
24
- /**
25
- * Statement kind.
26
- */
27
- kind: StatementKind;
28
- /**
29
- * Module specifier.
30
- */
31
- specifier: Nullable<string>;
32
- /**
33
- * Module specifier type.
34
- */
35
- specifier_kind: Nullable<SpecifierKind>;
36
- /**
37
- * Module specifier syntax type.
38
- */
39
- specifier_syntax: Nullable<SpecifierSyntaxKind>;
40
- /**
41
- * Start index of {@linkcode code} in source content.
42
- */
43
- start: number;
44
- /**
45
- * Statement syntax kind.
46
- */
47
- syntax: StatementSyntaxKind;
48
- }
49
- export type { Statement as default };
@@ -1,16 +0,0 @@
1
- /**
2
- * @file Internal - escapeRegExp
3
- * @module mlly/internal/escapeRegExp
4
- */
5
- /**
6
- * Escapes special characters in the given regex `pattern`.
7
- *
8
- * A backslash escape (`\\`) is used when valid. A `\x2d` escape is used when
9
- * the former would be disallowed by stricter Unicode pattern grammar.
10
- *
11
- * @param {string} pattern - Regex pattern to escape
12
- * @return {string} `pattern` with special characters escaped
13
- * @throws {NodeError<TypeError>} If `pattern` is not a string
14
- */
15
- declare const escapeRegExp: (pattern: string) => string;
16
- export default escapeRegExp;
@@ -1,10 +0,0 @@
1
- import validateString from "./validate-string.mjs";
2
- const escapeRegExp = (pattern) => {
3
- validateString(pattern, "pattern");
4
- return pattern.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&").replace(/-/g, "\\x2d");
5
- };
6
- var escape_reg_exp_default = escapeRegExp;
7
- export {
8
- escape_reg_exp_default as default
9
- };
10
- //# sourceMappingURL=escape-reg-exp.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/escape-reg-exp.ts"],
4
- "mappings": "AAMA,OAAO,oBAAoB;AAY3B,MAAM,eAAe,CAAC,YAA4B;AAChD,iBAAe,SAAS,SAAS;AACjC,SAAO,QAAQ,QAAQ,uBAAuB,MAAM,EAAE,QAAQ,MAAM,OAAO;AAC7E;AAEA,IAAO,yBAAQ;",
5
- "names": []
6
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * @file Internal - FORMAT_TYPE_MAP
3
- * @module mlly/internal/FORMAT_TYPE_MAP
4
- */
5
- import { AssertType, Format } from '../enums/index.mjs';
6
- /**
7
- * Module format to `import` assertion type map.
8
- *
9
- * **Note**: It's unclear whether or not the HTML spec will require assertion
10
- * types for WebAssembly modules.
11
- *
12
- * @see https://github.com/WebAssembly/esm-integration/issues/42
13
- *
14
- * @const {Map<Format, AssertType>} FORMAT_TYPE_MAP
15
- */
16
- declare const FORMAT_TYPE_MAP: Map<Format, AssertType>;
17
- export default FORMAT_TYPE_MAP;
@@ -1,13 +0,0 @@
1
- import { AssertType, Format } from "../enums/index.mjs";
2
- const FORMAT_TYPE_MAP = /* @__PURE__ */ new Map([
3
- [Format.BUILTIN, AssertType.IMPLICIT],
4
- [Format.COMMONJS, AssertType.IMPLICIT],
5
- [Format.JSON, AssertType.JSON],
6
- [Format.MODULE, AssertType.IMPLICIT],
7
- [Format.WASM, AssertType.IMPLICIT]
8
- ]);
9
- var format_type_map_default = FORMAT_TYPE_MAP;
10
- export {
11
- format_type_map_default as default
12
- };
13
- //# sourceMappingURL=format-type-map.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/format-type-map.ts"],
4
- "mappings": "AAKA,SAAS,YAAY,cAAc;AAYnC,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;",
5
- "names": []
6
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * @file Internal - getSpecifierKind
3
- * @module mlly/internal/getSpecifierKind
4
- */
5
- import { SpecifierKind } from '../enums/index.mjs';
6
- import type { Nullable } from '@flex-development/tutils';
7
- /**
8
- * Determines a specifier type for the given module `specifier`.
9
- *
10
- * @see {@linkcode SpecifierKind}
11
- *
12
- * @param {string} specifier - Module specifier to evaluate
13
- * @return {Nullable<SpecifierKind>} Module `specifier` type or `null`
14
- * @throws {NodeError<TypeError>} If `specifier` is not a string
15
- */
16
- declare const getSpecifierKind: (specifier: string) => Nullable<SpecifierKind>;
17
- export default getSpecifierKind;
@@ -1,14 +0,0 @@
1
- import { SpecifierKind } from "../enums/index.mjs";
2
- import validateString from "./validate-string.mjs";
3
- import isAbsoluteSpecifier from "../utils/is-absolute-specifier.mjs";
4
- import isRelativeSpecifier from "../utils/is-relative-specifier.mjs";
5
- const getSpecifierKind = (specifier) => {
6
- validateString(specifier, "specifier");
7
- specifier = specifier.trim().replace(/^["']|["']$/g, "");
8
- return specifier ? isAbsoluteSpecifier(specifier) ? SpecifierKind.ABSOLUTE : isRelativeSpecifier(specifier) ? SpecifierKind.RELATIVE : SpecifierKind.BARE : null;
9
- };
10
- var get_specifier_kind_default = getSpecifierKind;
11
- export {
12
- get_specifier_kind_default as default
13
- };
14
- //# sourceMappingURL=get-specifier-kind.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/get-specifier-kind.ts"],
4
- "mappings": "AAKA,SAAS,qBAAqB;AAC9B,OAAO,oBAAoB;AAC3B,OAAO,yBAAyB;AAChC,OAAO,yBAAyB;AAahC,MAAM,mBAAmB,CAAC,cAA+C;AACvE,iBAAe,WAAW,WAAW;AAIrC,cAAY,UAAU,KAAK,EAAE,QAAQ,gBAAgB,EAAE;AAEvD,SAAO,YACH,oBAAoB,SAAS,IAC3B,cAAc,WACd,oBAAoB,SAAS,IAC7B,cAAc,WACd,cAAc,OAChB;AACN;AAEA,IAAO,6BAAQ;",
5
- "names": []
6
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * @file Internal - getSubpaths
3
- * @module mlly/internal/getSubpaths
4
- */
5
- import type { ModuleId } from '../types/index.mjs';
6
- import type { Exports, Imports } from '@flex-development/pkg-types';
7
- /**
8
- * Returns an array containing subpaths defined in the given package `context`,
9
- * a `package.json` [`exports`][1] or [`imports`][2] field.
10
- *
11
- * If `context` is using [exports sugar][3], the array will contain a single
12
- * subpath, `'.'`.
13
- *
14
- * [1]: https://nodejs.org/api/packages.html#exports
15
- * [2]: https://nodejs.org/api/packages.html#imports
16
- * [3]: https://nodejs.org/api/packages.html#exports-sugar
17
- *
18
- * @param {Exports | Imports | undefined} context - Package context
19
- * @param {boolean} internal - Package `imports` hint
20
- * @param {ModuleId} pkg - URL of relevant `package.json` file
21
- * @param {ModuleId} parent - URL of module to resolve from
22
- * @return {string[]} Subpaths defined in `context`
23
- */
24
- declare const getSubpaths: (context: Exports | Imports | undefined, internal: boolean, pkg: ModuleId, parent: ModuleId) => string[];
25
- export default getSubpaths;
@@ -1,10 +0,0 @@
1
- import isExportsSugar from "../utils/is-exports-sugar.mjs";
2
- import { isNIL } from "@flex-development/tutils";
3
- const getSubpaths = (context, internal, pkg, parent) => {
4
- return isNIL(context) ? [] : !internal && isExportsSugar(context, pkg, parent) ? ["."] : Object.keys(context);
5
- };
6
- var get_subpaths_default = getSubpaths;
7
- export {
8
- get_subpaths_default as default
9
- };
10
- //# sourceMappingURL=get-subpaths.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/get-subpaths.ts"],
4
- "mappings": "AAMA,OAAO,oBAAoB;AAE3B,SAAS,aAAa;AAmBtB,MAAM,cAAc,CAClB,SACA,UACA,KACA,WACa;AACb,SAAO,MAAM,OAAO,IAChB,CAAC,IACD,CAAC,YAAY,eAAe,SAAS,KAAK,MAAM,IAChD,CAAC,GAAG,IACJ,OAAO,KAAK,OAA4C;AAC9D;AAEA,IAAO,uBAAQ;",
5
- "names": []
6
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * @file Internals - isArrayIndex
3
- * @module mlly/internal/isArrayIndex
4
- */
5
- /**
6
- * Checks if if the given `key` is a numeric property key as defined in ECMA-262
7
- * [6.1.7 Array Index][1].
8
- *
9
- * [1]: https://tc39.es/ecma262/#integer-index
10
- *
11
- * @param {string} key - Property key to evaluate
12
- * @return {key is Numeric} `true` if `key` is numeric property key
13
- */
14
- declare const isArrayIndex: (key: string) => key is `${number}`;
15
- export default isArrayIndex;
@@ -1,9 +0,0 @@
1
- const isArrayIndex = (key) => {
2
- const num = +key;
3
- return `${num}` !== key ? false : num >= 0 && num < 4294967295;
4
- };
5
- var is_array_index_default = isArrayIndex;
6
- export {
7
- is_array_index_default as default
8
- };
9
- //# sourceMappingURL=is-array-index.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/is-array-index.ts"],
4
- "mappings": "AAgBA,MAAM,eAAe,CAAC,QAAgC;AAMpD,QAAM,MAAc,CAAC;AAErB,SAAO,GAAG,UAAU,MAAM,QAAQ,OAAO,KAAK,MAAM;AACtD;AAEA,IAAO,yBAAQ;",
5
- "names": []
6
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * @file Internal - isDirectory
3
- * @module mlly/internal/isDirectory
4
- */
5
- import type { ModuleId } from '../types/index.mjs';
6
- /**
7
- * Checks if a directory exists at the given module `id`.
8
- *
9
- * @param {ModuleId} id - Module id to evaluate
10
- * @return {boolean} `true` if directory exists at `id`
11
- */
12
- declare const isDirectory: (id: ModuleId) => boolean;
13
- export default isDirectory;
@@ -1,16 +0,0 @@
1
- import fs from "node:fs";
2
- import validateURLString from "./validate-url-string.mjs";
3
- const isDirectory = (id) => {
4
- var _a;
5
- try {
6
- validateURLString(id, "id");
7
- return ((_a = fs.statSync(id, { throwIfNoEntry: false })) == null ? void 0 : _a.isDirectory()) ?? false;
8
- } catch {
9
- return false;
10
- }
11
- };
12
- var is_directory_default = isDirectory;
13
- export {
14
- is_directory_default as default
15
- };
16
- //# sourceMappingURL=is-directory.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/is-directory.ts"],
4
- "mappings": "AAMA,OAAO,QAAQ;AACf,OAAO,uBAAuB;AAQ9B,MAAM,cAAc,CAAC,OAA0B;AAf/C;AAgBE,MAAI;AACF,sBAAkB,IAAI,IAAI;AAC1B,aAAO,QAAG,SAAS,IAAI,EAAE,gBAAgB,MAAM,CAAC,MAAzC,mBAA4C,kBAAiB;AAAA,EACtE,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,uBAAQ;",
5
- "names": []
6
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * @file Internal - isFile
3
- * @module mlly/internal/isFile
4
- */
5
- import type { ModuleId } from '../types/index.mjs';
6
- /**
7
- * Checks if a file exists at the given module `id`.
8
- *
9
- * @param {ModuleId} id - Module id to evaluate
10
- * @return {boolean} `true` if file exists at `id`
11
- */
12
- declare const isFile: (id: ModuleId) => boolean;
13
- export default isFile;
@@ -1,16 +0,0 @@
1
- import fs from "node:fs";
2
- import validateURLString from "./validate-url-string.mjs";
3
- const isFile = (id) => {
4
- var _a;
5
- try {
6
- validateURLString(id, "id");
7
- return ((_a = fs.statSync(id, { throwIfNoEntry: false })) == null ? void 0 : _a.isFile()) ?? false;
8
- } catch {
9
- return false;
10
- }
11
- };
12
- var is_file_default = isFile;
13
- export {
14
- is_file_default as default
15
- };
16
- //# sourceMappingURL=is-file.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/is-file.ts"],
4
- "mappings": "AAMA,OAAO,QAAQ;AACf,OAAO,uBAAuB;AAQ9B,MAAM,SAAS,CAAC,OAA0B;AAf1C;AAgBE,MAAI;AACF,sBAAkB,IAAI,IAAI;AAC1B,aAAO,QAAG,SAAS,IAAI,EAAE,gBAAgB,MAAM,CAAC,MAAzC,mBAA4C,aAAY;AAAA,EACjE,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,kBAAQ;",
5
- "names": []
6
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * @file Internal - isFunction
3
- * @module mlly/internal/isFunction
4
- */
5
- /**
6
- * Checks if the given `value` is a function.
7
- *
8
- * @param {unknown} value - Value to check
9
- * @return {value is (...args: any[]) => any} `true` if `value` is a unction
10
- */
11
- declare const isFunction: (value: unknown) => value is (...args: any[]) => any;
12
- export default isFunction;
@@ -1,8 +0,0 @@
1
- const isFunction = (value) => {
2
- return typeof value === "function";
3
- };
4
- var is_function_default = isFunction;
5
- export {
6
- is_function_default as default
7
- };
8
- //# sourceMappingURL=is-function.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/is-function.ts"],
4
- "mappings": "AAWA,MAAM,aAAa,CAAC,UAAqD;AACvE,SAAO,OAAO,UAAU;AAC1B;AAEA,IAAO,sBAAQ;",
5
- "names": []
6
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * @file Internal - ENCODED_SEP_REGEX
3
- * @module mlly/internal/ENCODED_SEP_REGEX
4
- */
5
- /**
6
- * Regex pattern matching encoded path separators (e.g `/`, `\\`).
7
- *
8
- * @see https://regex101.com/r/XV7HzM
9
- *
10
- * @const {RegExp} ENCODED_SEP_REGEX
11
- */
12
- declare const ENCODED_SEP_REGEX: RegExp;
13
- export default ENCODED_SEP_REGEX;
@@ -1,6 +0,0 @@
1
- const ENCODED_SEP_REGEX = /%2f|%5c/i;
2
- var regex_encoded_sep_default = ENCODED_SEP_REGEX;
3
- export {
4
- regex_encoded_sep_default as default
5
- };
6
- //# sourceMappingURL=regex-encoded-sep.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/internal/regex-encoded-sep.ts"],
4
- "mappings": "AAYA,MAAM,oBAA4B;AAElC,IAAO,4BAAQ;",
5
- "names": []
6
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @file Internal - INTERNAL_SPECIFIER_REGEX
3
- * @module mlly/internal/INTERNAL_SPECIFIER_REGEX
4
- */
5
- /**
6
- * Regex pattern matching subpath imports.
7
- *
8
- * @see https://regex101.com/r/ppVRw7
9
- * @see https://nodejs.org/api/packages.html#subpath-imports
10
- *
11
- * @const {RegExp} INTERNAL_SPECIFIER_REGEX
12
- */
13
- declare const INTERNAL_SPECIFIER_REGEX: RegExp;
14
- export default INTERNAL_SPECIFIER_REGEX;
@@ -1,6 +0,0 @@
1
- const INTERNAL_SPECIFIER_REGEX = /^(?!.*(?:%2[Ff]|%5[Cc]))(?<root>#[^\s/]+?(?=\s|$|\/))(?<path>\/.+[^/](?=\s|$))?(?!\/)/;
2
- var regex_internal_specifier_default = INTERNAL_SPECIFIER_REGEX;
3
- export {
4
- regex_internal_specifier_default as default
5
- };
6
- //# sourceMappingURL=regex-internal-specifier.mjs.map