@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,52 +0,0 @@
1
- /**
2
- * @file Interfaces - ExportStatement
3
- * @module mlly/interfaces/ExportStatement
4
- */
5
-
6
- import type { StatementKind } from '#src/enums'
7
- import type { Declaration, SyntaxKindExport } from '#src/types'
8
- import type { Nullable } from '@flex-development/tutils'
9
- import type Statement from './statement'
10
-
11
- /**
12
- * Export statement object.
13
- *
14
- * @see {@linkcode Declaration}
15
- * @see {@linkcode Statement}
16
- * @see {@linkcode SyntaxKindExport}
17
- *
18
- * @extends {Statement}
19
- */
20
- interface ExportStatement extends Statement {
21
- /**
22
- * Export declaration, if any.
23
- */
24
- declaration: Nullable<Declaration>
25
-
26
- /**
27
- * Export names.
28
- */
29
- exports: string[]
30
-
31
- /**
32
- * Statement kind.
33
- */
34
- kind: StatementKind.EXPORT
35
-
36
- /**
37
- * Modifier keywords.
38
- */
39
- modifiers: string[]
40
-
41
- /**
42
- * Statement syntax kind.
43
- */
44
- syntax: SyntaxKindExport
45
-
46
- /**
47
- * Type-only export statement check.
48
- */
49
- type: boolean
50
- }
51
-
52
- export type { ExportStatement as default }
@@ -1,45 +0,0 @@
1
- /**
2
- * @file Interfaces - ImportStatement
3
- * @module mlly/interfaces/ImportStatement
4
- */
5
-
6
- import type { StatementKind } from '#src/enums'
7
- import type { SyntaxKindImport } from '#src/types'
8
- import type Statement from './statement'
9
-
10
- /**
11
- * Import statement object.
12
- *
13
- * @see {@linkcode Statement}
14
- * @see {@linkcode SyntaxKindImport}
15
- *
16
- * @extends {Statement}
17
- */
18
- interface ImportStatement extends Statement {
19
- /**
20
- * Import names.
21
- */
22
- imports: string[]
23
-
24
- /**
25
- * Statement kind.
26
- */
27
- kind: StatementKind.IMPORT
28
-
29
- /**
30
- * Module specifier.
31
- */
32
- specifier: NonNullable<Statement['specifier']>
33
-
34
- /**
35
- * Module specifier syntax type.
36
- */
37
- specifier_syntax: NonNullable<Statement['specifier_syntax']>
38
-
39
- /**
40
- * Statement syntax kind.
41
- */
42
- syntax: SyntaxKindImport
43
- }
44
-
45
- export type { ImportStatement as default }
@@ -1,45 +0,0 @@
1
- /**
2
- * @file Interfaces - RequireStatement
3
- * @module mlly/interfaces/RequireStatement
4
- */
5
-
6
- import type { StatementKind } from '#src/enums'
7
- import type { SyntaxKindRequire } from '#src/types'
8
- import type Statement from './statement'
9
-
10
- /**
11
- * Require statement object.
12
- *
13
- * @see {@linkcode Statement}
14
- * @see {@linkcode SyntaxKindRequire}
15
- *
16
- * @extends {Statement}
17
- */
18
- interface RequireStatement extends Statement {
19
- /**
20
- * Import names.
21
- */
22
- imports: string[]
23
-
24
- /**
25
- * Statement kind.
26
- */
27
- kind: StatementKind.REQUIRE
28
-
29
- /**
30
- * Module specifier.
31
- */
32
- specifier: NonNullable<Statement['specifier']>
33
-
34
- /**
35
- * Module specifier syntax type.
36
- */
37
- specifier_syntax: NonNullable<Statement['specifier_syntax']>
38
-
39
- /**
40
- * Statement syntax kind.
41
- */
42
- syntax: SyntaxKindRequire
43
- }
44
-
45
- export type { RequireStatement as default }
@@ -1,64 +0,0 @@
1
- /**
2
- * @file Interfaces - Statement
3
- * @module mlly/interfaces/Statement
4
- */
5
-
6
- import type {
7
- SpecifierKind,
8
- SpecifierSyntaxKind,
9
- StatementKind,
10
- StatementSyntaxKind
11
- } from '#src/enums'
12
- import type { Nullable } from '@flex-development/tutils'
13
-
14
- /**
15
- * CommonJS or ESM statement object.
16
- *
17
- * @see {@linkcode SpecifierKind}
18
- * @see {@linkcode SpecifierSyntaxKind}
19
- * @see {@linkcode StatementKind}
20
- * @see {@linkcode StatementSyntaxKind}
21
- */
22
- interface Statement {
23
- /**
24
- * Statement snippet.
25
- */
26
- code: string
27
-
28
- /**
29
- * End index of {@linkcode code} in source content.
30
- */
31
- end: number
32
-
33
- /**
34
- * Statement kind.
35
- */
36
- kind: StatementKind
37
-
38
- /**
39
- * Module specifier.
40
- */
41
- specifier: Nullable<string>
42
-
43
- /**
44
- * Module specifier type.
45
- */
46
- specifier_kind: Nullable<SpecifierKind>
47
-
48
- /**
49
- * Module specifier syntax type.
50
- */
51
- specifier_syntax: Nullable<SpecifierSyntaxKind>
52
-
53
- /**
54
- * Start index of {@linkcode code} in source content.
55
- */
56
- start: number
57
-
58
- /**
59
- * Statement syntax kind.
60
- */
61
- syntax: StatementSyntaxKind
62
- }
63
-
64
- export type { Statement as default }
@@ -1,18 +0,0 @@
1
- /**
2
- * @file Internal - dequote
3
- * @module mlly/internal/dequote
4
- */
5
-
6
- import { trim } from '@flex-development/tutils'
7
-
8
- /**
9
- * Removes quotes from the beginning and end of a string.
10
- *
11
- * @internal
12
- *
13
- * @param {string} str - String to dequote
14
- * @return {string} String with quotes removed
15
- */
16
- const dequote = (str: string): string => trim(str).replace(/^["']|["']$/g, '')
17
-
18
- export default dequote
@@ -1,28 +0,0 @@
1
- /**
2
- * @file Internal - FORMAT_TYPE_MAP
3
- * @module mlly/internal/FORMAT_TYPE_MAP
4
- */
5
-
6
- import { AssertType, Format } from '#src/enums'
7
-
8
- /**
9
- * Module format to `import` assertion type map.
10
- *
11
- * **Note**: It's unclear whether or not the HTML spec will require assertion
12
- * types for WebAssembly modules.
13
- *
14
- * @see https://github.com/WebAssembly/esm-integration/issues/42
15
- *
16
- * @internal
17
- *
18
- * @const {Map<Format, AssertType>} FORMAT_TYPE_MAP
19
- */
20
- const FORMAT_TYPE_MAP: Map<Format, AssertType> = new Map<Format, AssertType>([
21
- [Format.BUILTIN, AssertType.IMPLICIT],
22
- [Format.COMMONJS, AssertType.IMPLICIT],
23
- [Format.JSON, AssertType.JSON],
24
- [Format.MODULE, AssertType.IMPLICIT],
25
- [Format.WASM, AssertType.IMPLICIT]
26
- ])
27
-
28
- export default FORMAT_TYPE_MAP
@@ -1,41 +0,0 @@
1
- /**
2
- * @file Internal - getSpecifierKind
3
- * @module mlly/internal/getSpecifierKind
4
- */
5
-
6
- import { SpecifierKind } from '#src/enums'
7
- import isAbsoluteSpecifier from '#src/utils/is-absolute-specifier'
8
- import isRelativeSpecifier from '#src/utils/is-relative-specifier'
9
- import type { NodeError } from '@flex-development/errnode'
10
- import type { Nullable } from '@flex-development/tutils'
11
- import dequote from './dequote'
12
- import validateString from './validate-string'
13
-
14
- /**
15
- * Determines a specifier type for the given module `specifier`.
16
- *
17
- * @see {@linkcode SpecifierKind}
18
- *
19
- * @internal
20
- *
21
- * @param {string} specifier - Module specifier to evaluate
22
- * @return {Nullable<SpecifierKind>} Module `specifier` type or `null`
23
- * @throws {NodeError<TypeError>} If `specifier` is not a string
24
- */
25
- const getSpecifierKind = (specifier: string): Nullable<SpecifierKind> => {
26
- validateString(specifier, 'specifier')
27
-
28
- // dequote specifier (quotes could lead to a specifier being classified as
29
- // 'bare' when it is actually absolute or relative)
30
- specifier = dequote(specifier)
31
-
32
- return specifier
33
- ? isAbsoluteSpecifier(specifier)
34
- ? SpecifierKind.ABSOLUTE
35
- : isRelativeSpecifier(specifier)
36
- ? SpecifierKind.RELATIVE
37
- : SpecifierKind.BARE
38
- : null
39
- }
40
-
41
- export default getSpecifierKind
@@ -1,43 +0,0 @@
1
- /**
2
- * @file Internal - getSubpaths
3
- * @module mlly/internal/getSubpaths
4
- */
5
-
6
- import type { ModuleId } from '#src/types'
7
- import isExportsSugar from '#src/utils/is-exports-sugar'
8
- import type { Exports, Imports } from '@flex-development/pkg-types'
9
- import { DOT, isNIL, keys, type Nilable } from '@flex-development/tutils'
10
-
11
- /**
12
- * Returns an array containing subpaths defined in the given package `context`,
13
- * a `package.json` [`exports`][1] or [`imports`][2] field.
14
- *
15
- * If `context` is using [exports sugar][3], the array will contain a single
16
- * subpath, `'.'`.
17
- *
18
- * [1]: https://nodejs.org/api/packages.html#exports
19
- * [2]: https://nodejs.org/api/packages.html#imports
20
- * [3]: https://nodejs.org/api/packages.html#exports-sugar
21
- *
22
- * @internal
23
- *
24
- * @param {Nilable<Exports | Imports>} context - Package context
25
- * @param {boolean} internal - Package `imports` hint
26
- * @param {ModuleId} pkg - URL of relevant `package.json` file
27
- * @param {ModuleId} parent - URL of module to resolve from
28
- * @return {string[]} Subpaths defined in `context`
29
- */
30
- const getSubpaths = (
31
- context: Nilable<Exports | Imports>,
32
- internal: boolean,
33
- pkg: ModuleId,
34
- parent: ModuleId
35
- ): string[] => {
36
- return isNIL(context)
37
- ? []
38
- : !internal && isExportsSugar(context, pkg, parent)
39
- ? [DOT]
40
- : keys(context)
41
- }
42
-
43
- export default getSubpaths
@@ -1,17 +0,0 @@
1
- /**
2
- * @file Internal - ENCODED_SEP_REGEX
3
- * @module mlly/internal/ENCODED_SEP_REGEX
4
- */
5
-
6
- /**
7
- * Regex pattern matching encoded path separators (e.g `/`, `\\`).
8
- *
9
- * @see https://regex101.com/r/XV7HzM
10
- *
11
- * @internal
12
- *
13
- * @const {RegExp} ENCODED_SEP_REGEX
14
- */
15
- const ENCODED_SEP_REGEX: RegExp = /%2f|%5c/i
16
-
17
- export default ENCODED_SEP_REGEX
@@ -1,19 +0,0 @@
1
- /**
2
- * @file Internal - INTERNAL_SPECIFIER_REGEX
3
- * @module mlly/internal/INTERNAL_SPECIFIER_REGEX
4
- */
5
-
6
- /**
7
- * Regex pattern matching subpath imports.
8
- *
9
- * @see https://regex101.com/r/ppVRw7
10
- * @see https://nodejs.org/api/packages.html#subpath-imports
11
- *
12
- * @internal
13
- *
14
- * @const {RegExp} INTERNAL_SPECIFIER_REGEX
15
- */
16
- const INTERNAL_SPECIFIER_REGEX: RegExp =
17
- /^(?!.*(?:%2[Ff]|%5[Cc]))(?<root>#[^\s/]+?(?=\s|$|\/))(?<path>\/.+[^/](?=\s|$))?(?!\/)/
18
-
19
- export default INTERNAL_SPECIFIER_REGEX
@@ -1,25 +0,0 @@
1
- /**
2
- * @file Internal - invalidSegmentRegex
3
- * @module mlly/internal/invalidSegmentRegex
4
- */
5
-
6
- /**
7
- * Returns a regular expression matching invalid path segments.
8
- *
9
- * @see https://github.com/nodejs/node/blob/v19.6.1/lib/internal/modules/esm/resolve.js#L299-L300
10
- *
11
- * @internal
12
- *
13
- * @param {'deprecated'?} type - Pattern type
14
- * @return {RegExp} Regular expression matching invalid path segments
15
- */
16
- const invalidSegmentRegex = (type?: 'deprecated'): RegExp => {
17
- return new RegExp(
18
- `(^|\\\\|\\/)((\\.|%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))${
19
- type === 'deprecated' ? '' : '?'
20
- }(\\\\|\\/|$)`,
21
- 'i'
22
- )
23
- }
24
-
25
- export default invalidSegmentRegex
@@ -1,18 +0,0 @@
1
- /**
2
- * @file Internal - PACKAGE_NAME_REGEX
3
- * @module mlly/internal/PACKAGE_NAME_REGEX
4
- */
5
-
6
- /**
7
- * Regex pattern matching package names.
8
- *
9
- * @see https://regex101.com/r/BHcJfc
10
- *
11
- * @internal
12
- *
13
- * @const {RegExp} PACKAGE_NAME_REGEX
14
- */
15
- const PACKAGE_NAME_REGEX: RegExp =
16
- /^(?:(?<scope>@[\d*a-z~-][\w*.~-]*)\/)?[\da-z~-][\w.~-]*$/
17
-
18
- export default PACKAGE_NAME_REGEX
@@ -1,20 +0,0 @@
1
- /**
2
- * @file Internal - PACKAGE_PATH_REGEX
3
- * @module mlly/internal/PACKAGE_PATH_REGEX
4
- */
5
-
6
- /**
7
- * Regex pattern matching bare specifiers beginning with valid package names.
8
- *
9
- * **Note**: Does **not** match specifiers beginning with `'node_modules'`.
10
- *
11
- * @see https://regex101.com/r/z0MPgj
12
- *
13
- * @internal
14
- *
15
- * @const {RegExp} PACKAGE_PATH_REGEX
16
- */
17
- const PACKAGE_PATH_REGEX: RegExp =
18
- /^(?!\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]))/
19
-
20
- export default PACKAGE_PATH_REGEX