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

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 (175) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.mjs.map +4 -5
  3. package/dist/internal/dequote.mjs +1 -0
  4. package/dist/internal/dequote.mjs.map +8 -0
  5. package/dist/internal/format-type-map.mjs +1 -0
  6. package/dist/internal/format-type-map.mjs.map +8 -0
  7. package/dist/internal/get-specifier-kind.mjs +1 -0
  8. package/dist/internal/get-specifier-kind.mjs.map +8 -0
  9. package/dist/internal/get-subpaths.mjs +1 -0
  10. package/dist/internal/get-subpaths.mjs.map +8 -0
  11. package/dist/internal/regex-encoded-sep.mjs +1 -0
  12. package/dist/internal/regex-encoded-sep.mjs.map +8 -0
  13. package/dist/internal/regex-internal-specifier.mjs +1 -0
  14. package/dist/internal/regex-internal-specifier.mjs.map +8 -0
  15. package/dist/internal/regex-invalid-segment.mjs +1 -0
  16. package/dist/internal/regex-invalid-segment.mjs.map +8 -0
  17. package/dist/internal/regex-package-name.mjs +1 -0
  18. package/dist/internal/regex-package-name.mjs.map +8 -0
  19. package/dist/internal/regex-package-path.mjs +1 -0
  20. package/dist/internal/regex-package-path.mjs.map +8 -0
  21. package/dist/internal/resolver.mjs +1 -0
  22. package/dist/internal/resolver.mjs.map +8 -0
  23. package/dist/internal/validate-array-set.mjs +1 -0
  24. package/dist/internal/validate-array-set.mjs.map +8 -0
  25. package/dist/internal/validate-boolean.mjs +1 -0
  26. package/dist/internal/validate-boolean.mjs.map +8 -0
  27. package/dist/internal/validate-map.mjs +1 -0
  28. package/dist/internal/validate-map.mjs.map +8 -0
  29. package/dist/internal/validate-object.mjs +1 -0
  30. package/dist/internal/validate-object.mjs.map +8 -0
  31. package/dist/internal/validate-set.mjs +1 -0
  32. package/dist/internal/validate-set.mjs.map +8 -0
  33. package/dist/internal/validate-string.mjs +1 -0
  34. package/dist/internal/validate-string.mjs.map +8 -0
  35. package/dist/internal/validate-url-string.mjs +1 -0
  36. package/dist/internal/validate-url-string.mjs.map +8 -0
  37. package/dist/utils/compare-subpaths.mjs.map +4 -5
  38. package/dist/utils/conditions.mjs.map +4 -5
  39. package/dist/utils/detect-syntax.mjs.map +4 -5
  40. package/dist/utils/extension-format-map.mjs.map +4 -5
  41. package/dist/utils/extract-statements.mjs.map +4 -5
  42. package/dist/utils/fill-modules.mjs.map +5 -8
  43. package/dist/utils/find-dynamic-imports.mjs.map +5 -8
  44. package/dist/utils/find-exports.mjs.map +5 -8
  45. package/dist/utils/find-requires.mjs.map +5 -8
  46. package/dist/utils/find-static-imports.mjs.map +5 -8
  47. package/dist/utils/find-subpath.mjs.map +5 -9
  48. package/dist/utils/get-format.mjs.map +5 -8
  49. package/dist/utils/get-source.mjs.map +4 -5
  50. package/dist/utils/has-cjs-syntax.mjs.map +4 -5
  51. package/dist/utils/has-esm-syntax.mjs.map +4 -5
  52. package/dist/utils/index.mjs.map +5 -8
  53. package/dist/utils/is-absolute-specifier.mjs.map +4 -5
  54. package/dist/utils/is-bare-specifier.mjs.map +4 -5
  55. package/dist/utils/is-directory.mjs.map +4 -5
  56. package/dist/utils/is-exports-sugar.mjs.map +4 -5
  57. package/dist/utils/is-file.mjs.map +4 -5
  58. package/dist/utils/is-relative-specifier.mjs.map +4 -5
  59. package/dist/utils/lookup-package-scope.mjs.map +4 -5
  60. package/dist/utils/parse-data-url.mjs.map +4 -5
  61. package/dist/utils/parse-module-id.mjs.map +5 -9
  62. package/dist/utils/parse-subpath.mjs.map +5 -8
  63. package/dist/utils/pattern-character.mjs.map +4 -5
  64. package/dist/utils/read-package-json.mjs.map +4 -5
  65. package/dist/utils/resolve-alias.mjs.map +5 -9
  66. package/dist/utils/resolve-aliases.mjs.map +4 -5
  67. package/dist/utils/resolve-extensions.mjs.map +4 -5
  68. package/dist/utils/resolve-module.mjs.map +4 -5
  69. package/dist/utils/resolve-modules.mjs.map +4 -5
  70. package/dist/utils/to-absolute-specifier.mjs.map +4 -5
  71. package/dist/utils/to-bare-specifier.mjs.map +4 -5
  72. package/dist/utils/to-data-url.mjs.map +4 -5
  73. package/dist/utils/to-node-url.mjs.map +4 -5
  74. package/dist/utils/to-relative-specifier.mjs.map +4 -5
  75. package/dist/utils/to-url.mjs.map +4 -5
  76. package/dist/utils/validate-assertions.mjs.map +5 -8
  77. package/dist/utils/validate-exports.mjs.map +4 -5
  78. package/package.json +8 -9
  79. package/src/enums/assert-type.ts +0 -23
  80. package/src/enums/format.ts +0 -19
  81. package/src/enums/index.ts +0 -11
  82. package/src/enums/kind-specifier-syntax.ts +0 -16
  83. package/src/enums/kind-specifier.ts +0 -19
  84. package/src/enums/kind-statement-syntax.ts +0 -24
  85. package/src/enums/kind-statement.ts +0 -17
  86. package/src/index.ts +0 -9
  87. package/src/interfaces/import-assertions.ts +0 -24
  88. package/src/interfaces/import-dynamic.ts +0 -46
  89. package/src/interfaces/import-static.ts +0 -46
  90. package/src/interfaces/index.ts +0 -25
  91. package/src/interfaces/options-fill-module.ts +0 -26
  92. package/src/interfaces/options-find-subpath.ts +0 -57
  93. package/src/interfaces/options-get-format.ts +0 -80
  94. package/src/interfaces/options-get-source.ts +0 -59
  95. package/src/interfaces/options-parse-module-id.ts +0 -39
  96. package/src/interfaces/options-parse-subpath.ts +0 -57
  97. package/src/interfaces/options-resolve-alias.ts +0 -59
  98. package/src/interfaces/options-resolve-module.ts +0 -72
  99. package/src/interfaces/options-resolve.ts +0 -17
  100. package/src/interfaces/package-scope.ts +0 -30
  101. package/src/interfaces/parsed-data-url.ts +0 -63
  102. package/src/interfaces/parsed-module-id.ts +0 -90
  103. package/src/interfaces/parsed-subpath.ts +0 -56
  104. package/src/interfaces/statement-export.ts +0 -52
  105. package/src/interfaces/statement-import.ts +0 -45
  106. package/src/interfaces/statement-require.ts +0 -45
  107. package/src/interfaces/statement.ts +0 -64
  108. package/src/internal/dequote.ts +0 -18
  109. package/src/internal/format-type-map.ts +0 -28
  110. package/src/internal/get-specifier-kind.ts +0 -41
  111. package/src/internal/get-subpaths.ts +0 -43
  112. package/src/internal/regex-encoded-sep.ts +0 -17
  113. package/src/internal/regex-internal-specifier.ts +0 -19
  114. package/src/internal/regex-invalid-segment.ts +0 -25
  115. package/src/internal/regex-package-name.ts +0 -18
  116. package/src/internal/regex-package-path.ts +0 -20
  117. package/src/internal/resolver.ts +0 -790
  118. package/src/internal/validate-array-set.ts +0 -35
  119. package/src/internal/validate-boolean.ts +0 -30
  120. package/src/internal/validate-map.ts +0 -36
  121. package/src/internal/validate-object.ts +0 -30
  122. package/src/internal/validate-set.ts +0 -32
  123. package/src/internal/validate-string.ts +0 -31
  124. package/src/internal/validate-url-string.ts +0 -34
  125. package/src/types/declaration.ts +0 -22
  126. package/src/types/fn-change-ext.ts +0 -33
  127. package/src/types/index.ts +0 -14
  128. package/src/types/mime-type.ts +0 -19
  129. package/src/types/module-id.ts +0 -15
  130. package/src/types/module-specifier-type.ts +0 -13
  131. package/src/types/protocol.ts +0 -40
  132. package/src/types/syntax-kind-export.ts +0 -20
  133. package/src/types/syntax-kind-import.ts +0 -22
  134. package/src/types/syntax-kind-require.ts +0 -15
  135. package/src/utils/compare-subpaths.ts +0 -100
  136. package/src/utils/conditions.ts +0 -15
  137. package/src/utils/detect-syntax.ts +0 -40
  138. package/src/utils/extension-format-map.ts +0 -34
  139. package/src/utils/extract-statements.ts +0 -46
  140. package/src/utils/fill-modules.ts +0 -133
  141. package/src/utils/find-dynamic-imports.ts +0 -75
  142. package/src/utils/find-exports.ts +0 -156
  143. package/src/utils/find-requires.ts +0 -75
  144. package/src/utils/find-static-imports.ts +0 -86
  145. package/src/utils/find-subpath.ts +0 -251
  146. package/src/utils/get-format.ts +0 -249
  147. package/src/utils/get-source.ts +0 -144
  148. package/src/utils/has-cjs-syntax.ts +0 -44
  149. package/src/utils/has-esm-syntax.ts +0 -40
  150. package/src/utils/index.ts +0 -45
  151. package/src/utils/is-absolute-specifier.ts +0 -53
  152. package/src/utils/is-bare-specifier.ts +0 -36
  153. package/src/utils/is-directory.ts +0 -25
  154. package/src/utils/is-exports-sugar.ts +0 -81
  155. package/src/utils/is-file.ts +0 -25
  156. package/src/utils/is-relative-specifier.ts +0 -34
  157. package/src/utils/lookup-package-scope.ts +0 -97
  158. package/src/utils/parse-data-url.ts +0 -71
  159. package/src/utils/parse-module-id.ts +0 -197
  160. package/src/utils/parse-subpath.ts +0 -331
  161. package/src/utils/pattern-character.ts +0 -13
  162. package/src/utils/read-package-json.ts +0 -113
  163. package/src/utils/resolve-alias.ts +0 -224
  164. package/src/utils/resolve-aliases.ts +0 -58
  165. package/src/utils/resolve-extensions.ts +0 -33
  166. package/src/utils/resolve-module.ts +0 -181
  167. package/src/utils/resolve-modules.ts +0 -60
  168. package/src/utils/to-absolute-specifier.ts +0 -30
  169. package/src/utils/to-bare-specifier.ts +0 -211
  170. package/src/utils/to-data-url.ts +0 -42
  171. package/src/utils/to-node-url.ts +0 -27
  172. package/src/utils/to-relative-specifier.ts +0 -55
  173. package/src/utils/to-url.ts +0 -30
  174. package/src/utils/validate-assertions.ts +0 -126
  175. package/src/utils/validate-exports.ts +0 -131
@@ -1,57 +0,0 @@
1
- /**
2
- * @file Interfaces - FindSubpathOptions
3
- * @module mlly/interfaces/FindSubpathOptions
4
- */
5
-
6
- import type { ModuleId } from '#src/types'
7
- import type { Optional } from '@flex-development/tutils'
8
-
9
- /**
10
- * Subpath search options.
11
- *
12
- * @see {@linkcode ModuleId}
13
- */
14
- interface FindSubpathOptions {
15
- /**
16
- * Export condition to apply.
17
- *
18
- * @see https://nodejs.org/api/packages.html#conditional-exports
19
- *
20
- * @default 'default'
21
- */
22
- condition?: Optional<string>
23
-
24
- /**
25
- * Export conditions.
26
- *
27
- * **Note**: Should be sorted by priority.
28
- *
29
- * @see https://nodejs.org/api/packages.html#conditional-exports
30
- *
31
- * @default CONDITIONS
32
- */
33
- conditions?: Optional<Set<string>>
34
-
35
- /**
36
- * URL of directory containing relevant `package.json` file.
37
- */
38
- dir: ModuleId
39
-
40
- /**
41
- * Package [`imports`][1] hint.
42
- *
43
- * [1]: https://nodejs.org/api/packages.html#imports
44
- *
45
- * @default false
46
- */
47
- internal?: Optional<boolean>
48
-
49
- /**
50
- * URL of module to resolve from.
51
- *
52
- * **Note**: Used for error reporting only.
53
- */
54
- parent: ModuleId
55
- }
56
-
57
- export type { FindSubpathOptions as default }
@@ -1,80 +0,0 @@
1
- /**
2
- * @file Interfaces - GetFormatOptions
3
- * @module mlly/interfaces/GetFormatOptions
4
- */
5
-
6
- import type { Format } from '#src/enums'
7
- import type { Ext } from '@flex-development/pathe'
8
- import type { EmptyString, Optional } from '@flex-development/tutils'
9
-
10
- /**
11
- * Module format retrieval options.
12
- *
13
- * @see {@linkcode Ext}
14
- * @see {@linkcode Format}
15
- * @see {@linkcode RequestInit}
16
- */
17
- interface GetFormatOptions {
18
- /**
19
- * Enable support for JSON modules.
20
- *
21
- * @see https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_json_modules
22
- *
23
- * @default true
24
- */
25
- experimental_json_modules?: Optional<boolean>
26
-
27
- /**
28
- * Enable support for network based modules.
29
- *
30
- * **Note**: Requires [`node-fetch`][1].
31
- *
32
- * [1]: https://github.com/node-fetch/node-fetch
33
- *
34
- * @see https://nodejs.org/docs/latest-v16.x/api/esm.html#https-and-http-imports
35
- *
36
- * @default false
37
- */
38
- experimental_network_imports?: Optional<boolean>
39
-
40
- /**
41
- * Enable support for WebAssembly modules.
42
- *
43
- * @see https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_wasm_modules
44
- *
45
- * @default false
46
- */
47
- experimental_wasm_modules?: Optional<boolean>
48
-
49
- /**
50
- * Map file extensions to module formats.
51
- *
52
- * @default EXTENSION_FORMAT_MAP
53
- */
54
- extension_format_map?: Optional<Map<EmptyString | Ext, Format>>
55
-
56
- /**
57
- * Return `undefined` when module format is not found, rather than `null`.
58
- *
59
- * An explicit `undefined` return value indicates [`load`][1] hooks should
60
- * re-run module format checks.
61
- *
62
- * [1]: https://nodejs.org/docs/latest-v16.x/api/esm.html#loadurl-context-nextload
63
- *
64
- * @default false
65
- */
66
- ignore_errors?: Optional<boolean>
67
-
68
- /**
69
- * Request options for network based modules.
70
- *
71
- * Only applicable if {@linkcode experimental_network_imports} is enabled.
72
- *
73
- * @see {@linkcode RequestInit}
74
- *
75
- * @default {}
76
- */
77
- req?: Optional<import('node-fetch').RequestInit>
78
- }
79
-
80
- export type { GetFormatOptions as default }
@@ -1,59 +0,0 @@
1
- /**
2
- * @file Interfaces - GetSourceOptions
3
- * @module mlly/interfaces/GetSourceOptions
4
- */
5
-
6
- import type { Format } from '#src/enums'
7
- import type { Optional, OrLowercase } from '@flex-development/tutils'
8
-
9
- /**
10
- * Source code retrieval options.
11
- *
12
- * @see {@linkcode Format}
13
- * @see {@linkcode RequestInit}
14
- */
15
- interface GetSourceOptions {
16
- /**
17
- * Enable support for network based modules.
18
- *
19
- * **Note**: Requires [`node-fetch`][1].
20
- *
21
- * [1]: https://github.com/node-fetch/node-fetch
22
- *
23
- * @see https://nodejs.org/docs/latest-v16.x/api/esm.html#https-and-http-imports
24
- *
25
- * @default false
26
- */
27
- experimental_network_imports?: Optional<boolean>
28
-
29
- /**
30
- * Module format hint.
31
- *
32
- * @see {@linkcode Format}
33
- *
34
- * @default undefined
35
- */
36
- format?: Optional<OrLowercase<Format>>
37
-
38
- /**
39
- * Ignore [`ERR_UNSUPPORTED_ESM_URL_SCHEME`][1] if thrown.
40
- *
41
- * [1]: https://nodejs.org/api/errors.html#err_unsupported_esm_url_scheme
42
- *
43
- * @default false
44
- */
45
- ignore_errors?: Optional<boolean>
46
-
47
- /**
48
- * Request options for network based modules.
49
- *
50
- * Only applicable if {@linkcode experimental_network_imports} is enabled.
51
- *
52
- * @see {@linkcode RequestInit}
53
- *
54
- * @default {}
55
- */
56
- req?: Optional<import('node-fetch').RequestInit>
57
- }
58
-
59
- export type { GetSourceOptions as default }
@@ -1,39 +0,0 @@
1
- /**
2
- * @file Interfaces - ParseModuleIdOptions
3
- * @module mlly/interfaces/ParseModuleIdOptions
4
- */
5
-
6
- import type { ModuleId } from '#src/types'
7
- import type { Optional } from '@flex-development/tutils'
8
-
9
- /**
10
- * Module id parsing options.
11
- *
12
- * @see {@linkcode ModuleId}
13
- */
14
- interface ParseModuleIdOptions {
15
- /**
16
- * Ensure module id is a valid internal specifier, syntactically.
17
- *
18
- * @see https://nodejs.org/api/packages.html#subpath-imports
19
- *
20
- * @default id instanceof URL ? false : id.startsWith('#')
21
- */
22
- internal?: Optional<boolean>
23
-
24
- /**
25
- * URL of module to resolve from.
26
- *
27
- * **Note**: Used for error reporting only.
28
- *
29
- * @default undefined
30
- */
31
- parent?: Optional<ModuleId>
32
-
33
- /**
34
- * Ensure module id begins with a valid package name.
35
- */
36
- pkgname?: Optional<boolean>
37
- }
38
-
39
- export type { ParseModuleIdOptions as default }
@@ -1,57 +0,0 @@
1
- /**
2
- * @file Interfaces - ParseSubpathOptions
3
- * @module mlly/interfaces/ParseSubpathOptions
4
- */
5
-
6
- import type { ModuleId } from '#src/types'
7
- import type { Optional } from '@flex-development/tutils'
8
-
9
- /**
10
- * Subpath parsing options.
11
- *
12
- * @see {@linkcode ModuleId}
13
- */
14
- interface ParseSubpathOptions {
15
- /**
16
- * Export condition to apply.
17
- *
18
- * @see https://nodejs.org/api/packages.html#conditional-exports
19
- *
20
- * @default 'default'
21
- */
22
- condition?: Optional<string>
23
-
24
- /**
25
- * Export conditions.
26
- *
27
- * **Note**: Should be sorted by priority.
28
- *
29
- * @see https://nodejs.org/api/packages.html#conditional-exports
30
- *
31
- * @default CONDITIONS
32
- */
33
- conditions?: Optional<Set<string> | string[]>
34
-
35
- /**
36
- * URL of directory containing relevant `package.json` file.
37
- */
38
- dir: ModuleId
39
-
40
- /**
41
- * Package [`imports`][1] hint.
42
- *
43
- * [1]: https://nodejs.org/api/packages.html#imports
44
- *
45
- * @default specifier.startsWith('#')
46
- */
47
- internal?: Optional<boolean>
48
-
49
- /**
50
- * URL of module to resolve from.
51
- *
52
- * **Note**: Used for error reporting only.
53
- */
54
- parent: ModuleId
55
- }
56
-
57
- export type { ParseSubpathOptions as default }
@@ -1,59 +0,0 @@
1
- /**
2
- * @file Interfaces - ResolveAliasOptions
3
- * @module mlly/interfaces/ResolveAliasOptions
4
- */
5
-
6
- import type { ModuleId } from '#src/types'
7
- import type { MapLike, OneOrMany, Optional } from '@flex-development/tutils'
8
- import type ResolveModuleOptions from './options-resolve-module'
9
-
10
- /**
11
- * Path alias resolution options.
12
- *
13
- * @see {@linkcode ModuleId}
14
- *
15
- * @extends {ResolveModuleOptions}
16
- */
17
- interface ResolveAliasOptions extends ResolveModuleOptions {
18
- /**
19
- * Return resolved module URL as absolute specifier (a [`file:` URL][1]).
20
- *
21
- * If `false`, return resolved module URL as bare or relative specifier.
22
- *
23
- * [1]: https://nodejs.org/api/esm.html#file-urls
24
- *
25
- * @see https://nodejs.org/api/esm.html#terminology
26
- *
27
- * @default true
28
- */
29
- absolute?: Optional<boolean>
30
-
31
- /**
32
- * Path mappings.
33
- *
34
- * **Note**: Paths should be relative to {@linkcode cwd}.
35
- *
36
- * @default {}
37
- */
38
- aliases?: Optional<MapLike<OneOrMany<string>>>
39
-
40
- /**
41
- * Directory to resolve non-absolute modules from.
42
- *
43
- * @default pathToFileURL('.')
44
- */
45
- cwd?: Optional<ModuleId>
46
-
47
- /**
48
- * Id of module to resolve from.
49
- *
50
- * **Note**: Should be an absolute path or [`file:` URL][1].
51
- *
52
- * [1]: https://nodejs.org/api/esm.html#file-urls
53
- *
54
- * @default import.meta.url
55
- */
56
- parent?: Optional<ModuleId>
57
- }
58
-
59
- export type { ResolveAliasOptions as default }
@@ -1,72 +0,0 @@
1
- /**
2
- * @file Interfaces - ResolveModuleOptions
3
- * @module mlly/interfaces/ResolveModuleOptions
4
- */
5
-
6
- import type { ChangeExtFn, ModuleId } from '#src/types'
7
- import type { Nilable, Optional } from '@flex-development/tutils'
8
-
9
- /**
10
- * Module resolution options.
11
- *
12
- * @see {@linkcode ChangeExtFn}
13
- * @see {@linkcode ModuleId}
14
- */
15
- interface ResolveModuleOptions {
16
- /**
17
- * Export condition to apply.
18
- *
19
- * @see https://nodejs.org/api/packages.html#conditional-exports
20
- *
21
- * @default 'default'
22
- */
23
- condition?: Optional<string>
24
-
25
- /**
26
- * Export conditions.
27
- *
28
- * **Note**: Should be sorted by priority.
29
- *
30
- * @see https://nodejs.org/api/packages.html#conditional-exports
31
- *
32
- * @default CONDITIONS
33
- */
34
- conditions?: Optional<Set<string> | string[]>
35
-
36
- /**
37
- * Replacement file extension or function that returns a file extension.
38
- *
39
- * An empty string (`''`) will remove a file extension; `null` or `undefined`
40
- * will skip extension replacement.
41
- *
42
- * @default undefined
43
- */
44
- ext?: ChangeExtFn | Nilable<string>
45
-
46
- /**
47
- * Module extensions to probe for.
48
- *
49
- * **Note**: Should be sorted by priority.
50
- *
51
- * @default RESOLVE_EXTENSIONS
52
- */
53
- extensions?: Optional<Set<string> | string[]>
54
-
55
- /**
56
- * URL of module to resolve from.
57
- *
58
- * @see {@linkcode ModuleId}
59
- *
60
- * @default import.meta.url
61
- */
62
- parent?: Optional<ModuleId>
63
-
64
- /**
65
- * Keep symlinks instead of resolving them.
66
- *
67
- * @default false
68
- */
69
- preserveSymlinks?: Optional<boolean>
70
- }
71
-
72
- export type { ResolveModuleOptions as default }
@@ -1,17 +0,0 @@
1
- /**
2
- * @file Interfaces - ResolveOptions
3
- * @module mlly/interfaces/ResolveOptions
4
- */
5
-
6
- import type ResolveModuleOptions from './options-resolve-module'
7
-
8
- /**
9
- * Resolution options.
10
- *
11
- * @see {@linkcode ResolveModuleOptions}
12
- *
13
- * @extends {ResolveModuleOptions}
14
- */
15
- interface ResolveOptions extends ResolveModuleOptions {}
16
-
17
- export type { ResolveOptions as default }
@@ -1,30 +0,0 @@
1
- /**
2
- * @file Interfaces - PackageScope
3
- * @module mlly/interfaces/PackageScope
4
- */
5
-
6
- import type { PackageJson } from '@flex-development/pkg-types'
7
-
8
- /**
9
- * Object representing a package scope.
10
- *
11
- * @see {@linkcode PackageJson}
12
- */
13
- interface PackageScope {
14
- /**
15
- * URL of directory containing `package.json` file.
16
- */
17
- dir: string
18
-
19
- /**
20
- * URL of `package.json` file.
21
- */
22
- pkg: string
23
-
24
- /**
25
- * `package.json` object.
26
- */
27
- pkgjson: PackageJson
28
- }
29
-
30
- export type { PackageScope as default }
@@ -1,63 +0,0 @@
1
- /**
2
- * @file Interfaces - ParsedDataUrl
3
- * @module mlly/interfaces/ParsedDataUrl
4
- */
5
-
6
- import type { MimeType, Protocol } from '#src/types'
7
- import type { EmptyString, LiteralUnion } from '@flex-development/tutils'
8
- import type { URL } from 'node:url'
9
-
10
- /**
11
- * Object representing a [`data:` URL][1].
12
- *
13
- * [1]: https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
14
- *
15
- * @see {@linkcode Protocol}
16
- * @see {@linkcode MimeType}
17
- * @see https://nodejs.org/api/esm.html#data-imports
18
- */
19
- interface ParsedDataUrl {
20
- /**
21
- * [base64][1] encoding check.
22
- *
23
- * [1]: https://developer.mozilla.org/docs/Glossary/Base64
24
- */
25
- base64: boolean
26
-
27
- /**
28
- * Data portion of URL.
29
- *
30
- * If {@linkcode base64} is `true`, `data` is base64-encoded.
31
- */
32
- data: LiteralUnion<EmptyString, string>
33
-
34
- /**
35
- * Serialized `data:` URL.
36
- *
37
- * @see https://nodejs.org/api/url.html#urlhref
38
- */
39
- href: URL['href']
40
-
41
- /**
42
- * MIME type.
43
- *
44
- * @see https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types
45
- */
46
- mime: LiteralUnion<MimeType, string>
47
-
48
- /**
49
- * Path portion of URL.
50
- *
51
- * @see https://nodejs.org/api/url.html#urlpathname
52
- */
53
- pathname: URL['pathname']
54
-
55
- /**
56
- * Protocol portion of URL.
57
- *
58
- * @see https://nodejs.org/api/url.html#urlprotocol
59
- */
60
- protocol: Extract<Protocol, 'data:'>
61
- }
62
-
63
- export type { ParsedDataUrl as default }
@@ -1,90 +0,0 @@
1
- /**
2
- * @file Interfaces - ParsedModuleId
3
- * @module mlly/interfaces/ParsedModuleId
4
- */
5
-
6
- import type { Protocol } from '#src/types'
7
- import type { SemanticVersion } from '@flex-development/pkg-types'
8
- import type { EmptyString, LiteralUnion } from '@flex-development/tutils'
9
-
10
- /**
11
- * Object representing a ECMAScript module id.
12
- *
13
- * @see {@linkcode Protocol}
14
- * @see {@linkcode SemanticVersion}
15
- */
16
- interface ParsedModuleId {
17
- /**
18
- * Subpath import (internal specifier) 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
- /**
26
- * One of the following:
27
- *
28
- * - Possible [subpath export][1] (includes leading `'.'`)
29
- * - Possible [subpath import][2]
30
- * - URL [`host`][3], [`pathname`][4], and [`port`][5]
31
- * - Raw module id ({@linkcode raw})
32
- *
33
- * [1]: https://nodejs.org/api/packages.html#subpath-exports
34
- * [2]: https://nodejs.org/api/packages.html#subpath-imports
35
- * [3]: https://nodejs.org/api/url.html#urlhost
36
- * [4]: https://nodejs.org/api/url.html#urlpathname
37
- * [5]: https://nodejs.org/api/url.html#urlport
38
- */
39
- path: string
40
-
41
- /**
42
- * Package name if module id begins with valid package name (e.g. is a [bare
43
- * specifier][1]).
44
- *
45
- * If the module id is a bare specifier *and* [internal][2], this value will
46
- * instead be the first path segement in the module id (i.e. `'#src'` given
47
- * `'#src/foo'`). This **may or may not** be the subpath defined by the
48
- * package maintainer.
49
- *
50
- * [1]: https://nodejs.org/api/esm.html#terminology
51
- * [2]: https://nodejs.org/api/packages.html#subpath-imports
52
- */
53
- pkg: LiteralUnion<EmptyString, string>
54
-
55
- /**
56
- * URL scheme if module id is a URL.
57
- */
58
- protocol: LiteralUnion<EmptyString | Protocol, string>
59
-
60
- /**
61
- * Raw module id.
62
- */
63
- raw: string
64
-
65
- /**
66
- * Package scope if module id begins with valid package name (e.g. is a [bare
67
- * specifier][1]).
68
- *
69
- * [1]: https://nodejs.org/api/esm.html#terminology
70
- */
71
- scope: LiteralUnion<EmptyString, string>
72
-
73
- /**
74
- * Package version if specified and module id begins with valid package name
75
- * (e.g. is a [bare specifier][1]).
76
- *
77
- * **Note**: Version follows [Semantic Versioning 2.0.0][2] specification.
78
- *
79
- * [1]: https://nodejs.org/api/esm.html#terminology
80
- * [2]: https://semver.org/spec/v2.0.0.html
81
- */
82
- version: LiteralUnion<EmptyString | SemanticVersion, string>
83
-
84
- /**
85
- * Package {@linkcode version} prefix.
86
- */
87
- version_prefix: LiteralUnion<EmptyString | 'v', string>
88
- }
89
-
90
- export type { ParsedModuleId as default }
@@ -1,56 +0,0 @@
1
- /**
2
- * @file Interfaces - ParsedSubpath
3
- * @module mlly/interfaces/ParsedSubpath
4
- */
5
-
6
- import type {
7
- EmptyString,
8
- LiteralUnion,
9
- Nullable
10
- } from '@flex-development/tutils'
11
-
12
- /**
13
- * Object representing a package subpath.
14
- *
15
- * @see https://nodejs.org/api/packages.html#subpath-exports
16
- * @see https://nodejs.org/api/packages.html#subpath-imports
17
- */
18
- interface ParsedSubpath {
19
- /**
20
- * Subpath without entry prefix ({@linkcode key}).
21
- */
22
- base: LiteralUnion<EmptyString, string>
23
-
24
- /**
25
- * Subpath import check.
26
- *
27
- * @see https://nodejs.org/api/packages.html#imports
28
- * @see https://nodejs.org/api/packages.html#subpath-imports
29
- */
30
- internal: boolean
31
-
32
- /**
33
- * Subpath defined in `package.json` file.
34
- *
35
- * @see https://nodejs.org/api/packages.html#exports
36
- * @see https://nodejs.org/api/packages.html#imports
37
- */
38
- key: string
39
-
40
- /**
41
- * Subpath passed by user in module specifier.
42
- */
43
- raw: string
44
-
45
- /**
46
- * Module specifier passed by user.
47
- */
48
- specifier: string
49
-
50
- /**
51
- * Package target as documented in `package.json` file.
52
- */
53
- target: Nullable<string>
54
- }
55
-
56
- export type { ParsedSubpath as default }