@flex-development/mlly 1.0.0-alpha.2 → 1.0.0-alpha.4
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.
- package/CHANGELOG.md +91 -3
- package/README.md +6 -4
- package/dist/constants.d.mts +3 -1
- package/dist/enums/index.d.mts +7 -0
- package/dist/enums/index.mjs +8 -0
- package/dist/enums/kind-specifier.d.mts +14 -0
- package/dist/enums/kind-specifier.mjs +9 -0
- package/dist/enums/kind-statement.d.mts +15 -0
- package/dist/enums/kind-statement.mjs +10 -0
- package/dist/enums/kind-syntax.d.mts +22 -0
- package/dist/enums/kind-syntax.mjs +17 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/interfaces/import-dynamic.d.mts +24 -6
- package/dist/interfaces/import-static.d.mts +20 -4
- package/dist/interfaces/options-resolve-alias.d.mts +7 -7
- package/dist/interfaces/options-resolve.d.mts +11 -10
- package/dist/interfaces/statement-export.d.mts +22 -9
- package/dist/interfaces/statement-import.d.mts +15 -4
- package/dist/interfaces/statement-require.d.mts +15 -4
- package/dist/interfaces/statement.d.mts +20 -9
- package/dist/internal/get-compiler-options.d.mts +4 -4
- package/dist/internal/get-compiler-options.mjs +2 -2
- package/dist/lib/detect-syntax.d.mts +3 -3
- package/dist/lib/extract-statements.d.mts +6 -7
- package/dist/lib/extract-statements.mjs +1 -1
- package/dist/lib/find-dynamic-imports.d.mts +4 -2
- package/dist/lib/find-dynamic-imports.mjs +18 -9
- package/dist/lib/find-exports.d.mts +7 -2
- package/dist/lib/find-exports.mjs +57 -32
- package/dist/lib/find-requires.d.mts +5 -5
- package/dist/lib/find-requires.mjs +12 -9
- package/dist/lib/find-static-imports.d.mts +4 -2
- package/dist/lib/find-static-imports.mjs +13 -8
- package/dist/lib/has-cjs-syntax.d.mts +3 -1
- package/dist/lib/has-cjs-syntax.mjs +4 -2
- package/dist/lib/has-esm-syntax.d.mts +3 -1
- package/dist/lib/has-esm-syntax.mjs +4 -2
- package/dist/lib/resolve-alias.d.mts +1 -1
- package/dist/lib/resolve-alias.mjs +3 -3
- package/dist/lib/resolve-aliases.d.mts +2 -2
- package/dist/lib/resolve-aliases.mjs +3 -3
- package/dist/lib/resolve-module.d.mts +4 -4
- package/dist/lib/resolve-module.mjs +3 -3
- package/dist/lib/resolve-modules.d.mts +2 -2
- package/dist/lib/resolve-modules.mjs +4 -3
- package/dist/lib/to-absolute-specifier.d.mts +1 -1
- package/dist/lib/to-absolute-specifier.mjs +3 -3
- package/dist/lib/to-bare-specifier.d.mts +3 -3
- package/dist/lib/to-bare-specifier.mjs +7 -7
- package/dist/lib/to-data-url.d.mts +1 -1
- package/dist/lib/to-relative-specifier.d.mts +1 -1
- package/dist/lib/to-relative-specifier.mjs +2 -2
- package/dist/types/declaration.d.mts +1 -1
- package/dist/types/index.d.mts +4 -3
- package/dist/types/mime-type.d.mts +1 -1
- package/dist/types/module-specifier-type.d.mts +11 -0
- package/dist/{internal/compiler-options-json.mjs → types/module-specifier-type.mjs} +0 -0
- package/dist/types/syntax-kind-export.d.mts +12 -0
- package/dist/types/{ext.mjs → syntax-kind-export.mjs} +0 -0
- package/dist/types/syntax-kind-import.d.mts +12 -0
- package/dist/types/{specifier-type.mjs → syntax-kind-import.mjs} +0 -0
- package/dist/types/syntax-kind-require.d.mts +12 -0
- package/dist/types/{statement-type.mjs → syntax-kind-require.mjs} +0 -0
- package/package.json +66 -59
- package/dist/internal/compiler-options-json.d.mts +0 -111
- package/dist/internal/constants.d.mts +0 -70
- package/dist/internal/constants.mjs +0 -18
- package/dist/internal/index.d.mts +0 -7
- package/dist/internal/index.mjs +0 -5
- package/dist/types/ext.d.mts +0 -9
- package/dist/types/specifier-type.d.mts +0 -11
- package/dist/types/statement-type.d.mts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,92 @@
|
|
|
1
|
+
## [1.0.0-alpha.4](https://github.com/flex-development/mlly/compare/1.0.0-alpha.3...1.0.0-alpha.4) (2022-12-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### :robot: Continuous Integration
|
|
5
|
+
|
|
6
|
+
* **workflows:** [`publish`] fix registry url ([c06d3ca](https://github.com/flex-development/mlly/commit/c06d3ca72de415e507d901864afc410c9f5239b3))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :pencil: Documentation
|
|
10
|
+
|
|
11
|
+
* fix changelog entries ([128f8f4](https://github.com/flex-development/mlly/commit/128f8f450eda1fc10ff89ac272fbe8bde870c516))
|
|
12
|
+
|
|
13
|
+
## [1.0.0-alpha.3](https://github.com/flex-development/mlly/compare/1.0.0-alpha.2...1.0.0-alpha.3) (2022-12-26)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### ⚠ BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* **types:** remove `Ext`
|
|
19
|
+
* **types:** `SpecifierType` -> `ModuleSpecifierType`
|
|
20
|
+
* statements
|
|
21
|
+
|
|
22
|
+
### :package: Build
|
|
23
|
+
|
|
24
|
+
* **deps-dev:** add @flex-development/docast ([42b8ed2](https://github.com/flex-development/mlly/commit/42b8ed2360e8b4478202ba7db7e2b5cacae9ec90))
|
|
25
|
+
* **deps-dev:** bump @flex-development/docast-parse to 1.0.0-alpha.4 ([9634f8d](https://github.com/flex-development/mlly/commit/9634f8d4ec4375e7d29ad709c36ce1d398293718))
|
|
26
|
+
* **deps-dev:** bump @flex-development/mkbuild from 1.0.0-alpha.8 to 1.0.0-alpha.9 ([0262207](https://github.com/flex-development/mlly/commit/026220768f780149e143c0a5e6d35f9c2a4f0215))
|
|
27
|
+
* **deps-dev:** bump deps according to `yarn upgrade-interactive` ([ab0b8ce](https://github.com/flex-development/mlly/commit/ab0b8ced1e664a9bb6a9f4a7189d870bdf76c8c0))
|
|
28
|
+
* **deps-dev:** bump deps according to `yarn upgrade-interactive` ([bddfa7c](https://github.com/flex-development/mlly/commit/bddfa7c3f8864ab38fe35dc295ab46e472df187e))
|
|
29
|
+
* **deps:** add @flex-development/tsconfig-types ([a7c38e5](https://github.com/flex-development/mlly/commit/a7c38e50ea583dde948078569b41e0aebde8cfbf))
|
|
30
|
+
* **deps:** replace upath with @flex-development/pathe ([8a584d6](https://github.com/flex-development/mlly/commit/8a584d6dc2fed8c4cae491c290cf58ded9ca038e))
|
|
31
|
+
* **docs:** [site] use flex-development/docast-parse@27c73c7c03df4d92585c538c1f8214886b1fd0a9 ([b696cf6](https://github.com/flex-development/mlly/commit/b696cf676ecb0ace14647727415a49d03092d0d5))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### :robot: Continuous Integration
|
|
35
|
+
|
|
36
|
+
* configure private package registry for [@dependabot](https://github.com/dependabot) ([e188761](https://github.com/flex-development/mlly/commit/e1887618c8a2c5fe9cb69babd15498b618e64e66))
|
|
37
|
+
* fix [@dependabot](https://github.com/dependabot) npm package-ecosystem x yarn integration ([126dfab](https://github.com/flex-development/mlly/commit/126dfab8d937f3526ea109acc91565accf3b2653))
|
|
38
|
+
* **deps:** bump actions/add-to-project from 0.3.0 to 0.4.0 ([b5e8279](https://github.com/flex-development/mlly/commit/b5e8279269f75cee5076d86b7c34578b74f306df))
|
|
39
|
+
* **deps:** bump actions/checkout from 3.1.0 to 3.2.0 ([0637831](https://github.com/flex-development/mlly/commit/063783140fb475f29f821408837389219c471625))
|
|
40
|
+
* **deps:** bump dessant/lock-threads from 3.0.0 to 4.0.0 ([ba6063c](https://github.com/flex-development/mlly/commit/ba6063cb88556d106fb01c3948ba03d8f4848a47))
|
|
41
|
+
* **deps:** bump flex-development/dist-tag-action from 1.1.1 to 1.1.2 ([e19b975](https://github.com/flex-development/mlly/commit/e19b97514d655b2c89e7fa4b09aa3ea93a0f8415))
|
|
42
|
+
* **workflows:** [`add-to-project`] add items from repo admin account ([e271e8a](https://github.com/flex-development/mlly/commit/e271e8afe22244e3d270aa02a833ccb4b077f296))
|
|
43
|
+
* **workflows:** [`ci`] add node.js matrix ([28a0fa6](https://github.com/flex-development/mlly/commit/28a0fa6d809c94af458c6d5c9b661bb9d564b70a))
|
|
44
|
+
* **workflows:** [`ci`] archive production artifacts ([701caea](https://github.com/flex-development/mlly/commit/701caea0edc1e2d36d7a1323a88e1e714e88743d))
|
|
45
|
+
* **workflows:** [`ci`] let [@dependabot](https://github.com/dependabot) modify lockfile ([74ec538](https://github.com/flex-development/mlly/commit/74ec5381fd5339d0d29b1a5529e48d8b86fc2419))
|
|
46
|
+
* **workflows:** [`ci`] re-add node14 to matrix ([44801d8](https://github.com/flex-development/mlly/commit/44801d803774588c46299050ff858027605a2079))
|
|
47
|
+
* **workflows:** [`ci`] update codecov environment ([32518bd](https://github.com/flex-development/mlly/commit/32518bdd2650e01bc92dd6e212ef9420f239ac9f))
|
|
48
|
+
* **workflows:** [`ci`] update node setup ([b326f5d](https://github.com/flex-development/mlly/commit/b326f5d35c968fd4f1145a50a769e8d645190941))
|
|
49
|
+
* **workflows:** [`ci`] upload coverage reports to codecov ([a24776b](https://github.com/flex-development/mlly/commit/a24776ba0c3aad87e36881f5558eba58f5f7a866))
|
|
50
|
+
* **workflows:** [`publish`] cleanup registry scope ([ba5b355](https://github.com/flex-development/mlly/commit/ba5b355f30e62cb863abd35eddaa28b5b0885f56))
|
|
51
|
+
* **workflows:** [`publish`] print contents of `.npmrc` file ([2c16ff6](https://github.com/flex-development/mlly/commit/2c16ff62786d8ecc1f403d364af4d6db372e5a75))
|
|
52
|
+
* **workflows:** [`publish`] use node version file ([80d68c1](https://github.com/flex-development/mlly/commit/80d68c13aac5cdb0005c236d56bb8db90bd831a0))
|
|
53
|
+
* **workflows:** [`release`] publish releases from repo admin account ([bbda19c](https://github.com/flex-development/mlly/commit/bbda19ca37155411a0a4e9bf4e734a7b7ad959c8))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### :pencil: Documentation
|
|
57
|
+
|
|
58
|
+
* add "contributor covenant code of conduct" ([8f1285b](https://github.com/flex-development/mlly/commit/8f1285b12b7c74401c962d614e2c79a6a0c89585))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### :bug: Fixes
|
|
62
|
+
|
|
63
|
+
* **install:** [git] make `postinstall` script work with git install ([1a70af2](https://github.com/flex-development/mlly/commit/1a70af2bed20cbb6667ca0dd3e8d2e7d6a38da4b))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### :house_with_garden: Housekeeping
|
|
67
|
+
|
|
68
|
+
* project qa ([4acf639](https://github.com/flex-development/mlly/commit/4acf639b6b28c20a782e39d6f4a8c4b2adb0ae20))
|
|
69
|
+
* project qa ([3120990](https://github.com/flex-development/mlly/commit/312099035d0a90f044688e6619ec84dd6049d8bb))
|
|
70
|
+
* **github:** add commit scope `install` ([065dbbb](https://github.com/flex-development/mlly/commit/065dbbbfd271e576d5031fcd155e91007cb95f62))
|
|
71
|
+
* **github:** add label `scope:install` ([3ddc9c2](https://github.com/flex-development/mlly/commit/3ddc9c29e92e0e254f48f87ce7052196b79c9cc1))
|
|
72
|
+
* **internal:** remove barrel file ([e0ba89c](https://github.com/flex-development/mlly/commit/e0ba89cceee97e99111dd4ab7c63601b593a24d5))
|
|
73
|
+
* **pkg:** add keywords `ecmascript-modules` and `esmodules` ([e994f4b](https://github.com/flex-development/mlly/commit/e994f4bb182f0861f3c1c3c68c1a9d0a9a3d6631))
|
|
74
|
+
* **tests:** local codecov integration ([bdbae1d](https://github.com/flex-development/mlly/commit/bdbae1d44cc60409a3dabb23acae79f8180b187a))
|
|
75
|
+
* **yarn:** bump yarn from 4.0.0-rc.14 to 4.0.0-rc.34 ([045ee62](https://github.com/flex-development/mlly/commit/045ee6252342027657771d7bbdab6748fbb9a36a))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### :zap: Refactors
|
|
79
|
+
|
|
80
|
+
* statements ([731bd2a](https://github.com/flex-development/mlly/commit/731bd2a770671ad771ff38e8b12fce513034db27))
|
|
81
|
+
* **ts:** enforce `exactOptionalPropertyTypes` ([f3109b4](https://github.com/flex-development/mlly/commit/f3109b4cb6b33528ac2655e9c90eb86a2512b00d))
|
|
82
|
+
* **types:** `SpecifierType` -> `ModuleSpecifierType` ([263e98b](https://github.com/flex-development/mlly/commit/263e98b4e8189315157dfb4940df76e61a661922))
|
|
83
|
+
* **types:** remove `Ext` ([303de20](https://github.com/flex-development/mlly/commit/303de200e3eddf4c6c33fd41db6f6f0ad84fe8ec))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### :white_check_mark: Testing
|
|
87
|
+
|
|
88
|
+
* **ts:** add remaining type tests ([7a5430f](https://github.com/flex-development/mlly/commit/7a5430f4d95392b9fa6637d09765dcdd79d275b4))
|
|
89
|
+
|
|
1
90
|
## [1.0.0-alpha.2](https://github.com/flex-development/mlly/compare/1.0.0-alpha.1...1.0.0-alpha.2) (2022-11-06)
|
|
2
91
|
|
|
3
92
|
|
|
@@ -120,10 +209,10 @@
|
|
|
120
209
|
### :house_with_garden: Housekeeping
|
|
121
210
|
|
|
122
211
|
* add empty changelog ([7dfb431](https://github.com/flex-development/mlly/commit/7dfb431e5f7ced07d6a9a5028347016f2dd5b4c9))
|
|
123
|
-
* disable eslint rule `unicorn/no-unsafe-regex` ([8d24eda](https://github.com/flex-development/mlly/commit/8d24edada5a7c6edfee6d316239cd29dc076531c))
|
|
212
|
+
* disable eslint rule `unicorn/no-unsafe-regex` ([8d24eda](https://github.com/flex-development/mlly/commit/8d24edada5a7c6edfee6d316239cd29dc076531c))
|
|
124
213
|
* improve vercel integration ([1db75bc](https://github.com/flex-development/mlly/commit/1db75bc420b42652c440ec0a09742dc319c857f5))
|
|
125
214
|
* update editorconfig properties ([60256a8](https://github.com/flex-development/mlly/commit/60256a822ddc721781fe6d6579459fcc9e51a2ec))
|
|
126
|
-
* **docs:** scrap `vc dev` usage ([5ce8c0f](https://github.com/flex-development/mlly/commit/5ce8c0f0468b2def494922f8f3b58ebb60a5a19c))
|
|
215
|
+
* **docs:** scrap `vc dev` usage ([5ce8c0f](https://github.com/flex-development/mlly/commit/5ce8c0f0468b2def494922f8f3b58ebb60a5a19c))
|
|
127
216
|
* **github:** add commit scope `analyze` ([f3aaee9](https://github.com/flex-development/mlly/commit/f3aaee92ddbac08744d671cb7b905dbb36dba0f6))
|
|
128
217
|
* **github:** add commit scope `docs` ([6111249](https://github.com/flex-development/mlly/commit/61112490c88de111f1906a4725d98abaa5c7247a))
|
|
129
218
|
* **github:** add commit scope `interfaces` ([15fc6d9](https://github.com/flex-development/mlly/commit/15fc6d97ff06304710b55bf67768cb14e4ba4295))
|
|
@@ -153,4 +242,3 @@
|
|
|
153
242
|
* **resolve:** [options] pass original module specifier to `ext` ([4615851](https://github.com/flex-development/mlly/commit/46158510fdd0e3d8e0e60757290a655606ad836e))
|
|
154
243
|
* **resolve:** sort `RESOLVE_EXTENSIONS` according to priority ([0266ca9](https://github.com/flex-development/mlly/commit/0266ca9a5593d0c66e950ba1fe2c8f6df8422ff9))
|
|
155
244
|
* **specifiers:** [`toBareSpecifier`] improve `exports` path search ([36c4b74](https://github.com/flex-development/mlly/commit/36c4b7475c9bb6c924f5e75c8d6d215a8d23e79c))
|
|
156
|
-
|
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# mlly
|
|
2
2
|
|
|
3
|
-
[](https://conventionalcommits.org)
|
|
4
|
-
[](https://github.com/prettier/prettier)
|
|
5
|
-
[](https://github.com/voxpelli/badges-cjs-esm)
|
|
6
3
|
[](https://npmjs.com/package/@flex-development/mlly)
|
|
4
|
+
[](https://codecov.io/gh/flex-development/mlly)
|
|
7
5
|
[](LICENSE.md)
|
|
8
|
-
[](https://github.com/voxpelli/badges-cjs-esm)
|
|
7
|
+
[](https://conventionalcommits.org/)
|
|
8
|
+
[](https://typescriptlang.org/)
|
|
9
|
+
[](https://vitest.dev/)
|
|
10
|
+
[](https://yarnpkg.com/)
|
|
9
11
|
|
|
10
12
|
> [ECMAScript module][1] utilities.
|
|
11
13
|
|
package/dist/constants.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file Constants
|
|
3
3
|
* @module mlly/constants
|
|
4
4
|
*/
|
|
5
|
-
import type { Ext } from '
|
|
5
|
+
import type { Ext } from '@flex-development/pathe';
|
|
6
6
|
/**
|
|
7
7
|
* Default export conditions.
|
|
8
8
|
*
|
|
@@ -14,6 +14,8 @@ export declare const CONDITIONS: Readonly<Set<string>>;
|
|
|
14
14
|
/**
|
|
15
15
|
* Default resolvable file extensions.
|
|
16
16
|
*
|
|
17
|
+
* @see {@linkcode Ext}
|
|
18
|
+
*
|
|
17
19
|
* @const {ReadonlyArray<Ext>} RESOLVE_EXTENSIONS
|
|
18
20
|
*/
|
|
19
21
|
export declare const RESOLVE_EXTENSIONS: readonly Ext[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as default2 } from "./kind-specifier.mjs";
|
|
2
|
+
import { default as default3 } from "./kind-statement.mjs";
|
|
3
|
+
import { default as default4 } from "./kind-syntax.mjs";
|
|
4
|
+
export {
|
|
5
|
+
default2 as SpecifierKind,
|
|
6
|
+
default3 as StatementKind,
|
|
7
|
+
default4 as SyntaxKind
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Enums - SpecifierKind
|
|
3
|
+
* @module mlly/enums/SpecifierKind
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Specifier kinds.
|
|
7
|
+
*
|
|
8
|
+
* @enum {Lowercase<string>}
|
|
9
|
+
*/
|
|
10
|
+
declare enum SpecifierKind {
|
|
11
|
+
DYNAMIC = "dynamic",
|
|
12
|
+
STATIC = "static"
|
|
13
|
+
}
|
|
14
|
+
export default SpecifierKind;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var SpecifierKind = /* @__PURE__ */ ((SpecifierKind2) => {
|
|
2
|
+
SpecifierKind2["DYNAMIC"] = "dynamic";
|
|
3
|
+
SpecifierKind2["STATIC"] = "static";
|
|
4
|
+
return SpecifierKind2;
|
|
5
|
+
})(SpecifierKind || {});
|
|
6
|
+
var kind_specifier_default = SpecifierKind;
|
|
7
|
+
export {
|
|
8
|
+
kind_specifier_default as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Enums - StatementKind
|
|
3
|
+
* @module mlly/enums/StatementKind
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* CommonJS and ESM statement kinds.
|
|
7
|
+
*
|
|
8
|
+
* @enum {Lowercase<string>}
|
|
9
|
+
*/
|
|
10
|
+
declare enum StatementKind {
|
|
11
|
+
EXPORT = "export",
|
|
12
|
+
IMPORT = "import",
|
|
13
|
+
REQUIRE = "require"
|
|
14
|
+
}
|
|
15
|
+
export default StatementKind;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var StatementKind = /* @__PURE__ */ ((StatementKind2) => {
|
|
2
|
+
StatementKind2["EXPORT"] = "export";
|
|
3
|
+
StatementKind2["IMPORT"] = "import";
|
|
4
|
+
StatementKind2["REQUIRE"] = "require";
|
|
5
|
+
return StatementKind2;
|
|
6
|
+
})(StatementKind || {});
|
|
7
|
+
var kind_statement_default = StatementKind;
|
|
8
|
+
export {
|
|
9
|
+
kind_statement_default as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Enums - SyntaxKind
|
|
3
|
+
* @module mlly/enums/SyntaxKind
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* CommonJS and ESM statement syntax kinds.
|
|
7
|
+
*
|
|
8
|
+
* @enum {Lowercase<string>}
|
|
9
|
+
*/
|
|
10
|
+
declare enum SyntaxKind {
|
|
11
|
+
DECLARATION = "declaration",
|
|
12
|
+
DEFAULT = "default",
|
|
13
|
+
DEFAULT_WITH_NAMED = "default-with-named",
|
|
14
|
+
DEFAULT_WITH_NAMESPACE = "default-with-namespace",
|
|
15
|
+
DYNAMIC = "dynamic",
|
|
16
|
+
LIST = "list",
|
|
17
|
+
NAMED = "named",
|
|
18
|
+
NAMESPACE = "namespace",
|
|
19
|
+
REQUIRE = "require",
|
|
20
|
+
SIDE_EFFECT = "side-effect"
|
|
21
|
+
}
|
|
22
|
+
export default SyntaxKind;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var SyntaxKind = /* @__PURE__ */ ((SyntaxKind2) => {
|
|
2
|
+
SyntaxKind2["DECLARATION"] = "declaration";
|
|
3
|
+
SyntaxKind2["DEFAULT"] = "default";
|
|
4
|
+
SyntaxKind2["DEFAULT_WITH_NAMED"] = "default-with-named";
|
|
5
|
+
SyntaxKind2["DEFAULT_WITH_NAMESPACE"] = "default-with-namespace";
|
|
6
|
+
SyntaxKind2["DYNAMIC"] = "dynamic";
|
|
7
|
+
SyntaxKind2["LIST"] = "list";
|
|
8
|
+
SyntaxKind2["NAMED"] = "named";
|
|
9
|
+
SyntaxKind2["NAMESPACE"] = "namespace";
|
|
10
|
+
SyntaxKind2["REQUIRE"] = "require";
|
|
11
|
+
SyntaxKind2["SIDE_EFFECT"] = "side-effect";
|
|
12
|
+
return SyntaxKind2;
|
|
13
|
+
})(SyntaxKind || {});
|
|
14
|
+
var kind_syntax_default = SyntaxKind;
|
|
15
|
+
export {
|
|
16
|
+
kind_syntax_default as default
|
|
17
|
+
};
|
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -2,22 +2,40 @@
|
|
|
2
2
|
* @file Interfaces - DynamicImport
|
|
3
3
|
* @module mlly/interfaces/DynamicImport
|
|
4
4
|
*/
|
|
5
|
+
import type { SyntaxKind } from '../enums/index.mjs';
|
|
6
|
+
import type { SyntaxKindImport } from '../types/index.mjs';
|
|
7
|
+
import type { EmptyString, LiteralUnion } from '@flex-development/tutils';
|
|
5
8
|
import type ImportStatement from './statement-import.mjs';
|
|
6
9
|
/**
|
|
7
|
-
* Dynamic import statement object
|
|
10
|
+
* Dynamic import statement object.
|
|
8
11
|
*
|
|
9
|
-
* @see {@
|
|
12
|
+
* @see {@linkcode ImportStatement}
|
|
13
|
+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import
|
|
10
14
|
*
|
|
11
15
|
* @extends {ImportStatement}
|
|
12
16
|
*/
|
|
13
17
|
interface DynamicImport extends ImportStatement {
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
19
|
+
* Import expression.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* 'import("foo.json")'
|
|
23
|
+
* @example
|
|
24
|
+
* 'import(foo)'
|
|
16
25
|
*/
|
|
17
|
-
|
|
26
|
+
expression: LiteralUnion<EmptyString, string>;
|
|
18
27
|
/**
|
|
19
|
-
*
|
|
28
|
+
* Options bag.
|
|
29
|
+
*
|
|
30
|
+
* @see https://github.com/tc39/proposal-import-assertions#dynamic-import
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* '{ assert: { type: "json" } }'
|
|
20
34
|
*/
|
|
21
|
-
|
|
35
|
+
options: LiteralUnion<EmptyString, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Statement syntax kind.
|
|
38
|
+
*/
|
|
39
|
+
syntax: Extract<SyntaxKindImport, SyntaxKind.DYNAMIC>;
|
|
22
40
|
}
|
|
23
41
|
export type { DynamicImport as default };
|
|
@@ -2,18 +2,34 @@
|
|
|
2
2
|
* @file Interfaces - StaticImport
|
|
3
3
|
* @module mlly/interfaces/StaticImport
|
|
4
4
|
*/
|
|
5
|
+
import type { SyntaxKind } from '../enums/index.mjs';
|
|
6
|
+
import type { SyntaxKindImport } from '../types/index.mjs';
|
|
7
|
+
import type { EmptyString, LiteralUnion } from '@flex-development/tutils';
|
|
5
8
|
import type ImportStatement from './statement-import.mjs';
|
|
6
9
|
/**
|
|
7
|
-
* Static import statement object
|
|
10
|
+
* Static import statement object.
|
|
8
11
|
*
|
|
9
|
-
* @see {@
|
|
12
|
+
* @see {@linkcode ImportStatement}
|
|
10
13
|
*
|
|
11
14
|
* @extends {ImportStatement}
|
|
12
15
|
*/
|
|
13
16
|
interface StaticImport extends ImportStatement {
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
18
|
+
* Assertion options.
|
|
19
|
+
*
|
|
20
|
+
* @see https://github.com/tc39/proposal-import-assertions#import-statements
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* '{ type: "json" }'
|
|
16
24
|
*/
|
|
17
|
-
|
|
25
|
+
assertion: LiteralUnion<EmptyString, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Statement syntax kind.
|
|
28
|
+
*/
|
|
29
|
+
syntax: Extract<SyntaxKindImport, SyntaxKind.DEFAULT | SyntaxKind.DEFAULT_WITH_NAMED | SyntaxKind.DEFAULT_WITH_NAMESPACE | SyntaxKind.NAMED | SyntaxKind.NAMESPACE | SyntaxKind.SIDE_EFFECT>;
|
|
30
|
+
/**
|
|
31
|
+
* Type-only import statement check.
|
|
32
|
+
*/
|
|
33
|
+
type: boolean;
|
|
18
34
|
}
|
|
19
35
|
export type { StaticImport as default };
|
|
@@ -16,7 +16,7 @@ interface ResolveAliasOptions {
|
|
|
16
16
|
*
|
|
17
17
|
* @default process.cwd()
|
|
18
18
|
*/
|
|
19
|
-
baseUrl?: string;
|
|
19
|
+
baseUrl?: string | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* Module extensions to probe for.
|
|
22
22
|
*
|
|
@@ -24,7 +24,7 @@ interface ResolveAliasOptions {
|
|
|
24
24
|
*
|
|
25
25
|
* @default RESOLVE_EXTENSIONS
|
|
26
26
|
*/
|
|
27
|
-
extensions?: string[] | readonly string[];
|
|
27
|
+
extensions?: string[] | readonly string[] | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* Checks for the existence of a file at `path`.
|
|
30
30
|
*
|
|
@@ -39,21 +39,21 @@ interface ResolveAliasOptions {
|
|
|
39
39
|
*
|
|
40
40
|
* @default ['main', 'module']
|
|
41
41
|
*/
|
|
42
|
-
mainFields?: OneOrMany<string>[];
|
|
42
|
+
mainFields?: OneOrMany<string>[] | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* Absolute path to file containing path alias.
|
|
45
45
|
*/
|
|
46
|
-
parent?: string;
|
|
46
|
+
parent?: string | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* Path mappings.
|
|
49
49
|
*
|
|
50
|
-
* **Note**: Should be relative to {@
|
|
50
|
+
* **Note**: Should be relative to {@linkcode baseUrl}.
|
|
51
51
|
*
|
|
52
52
|
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
53
53
|
*
|
|
54
54
|
* @default {}
|
|
55
55
|
*/
|
|
56
|
-
paths?: Record<string, string[]
|
|
56
|
+
paths?: Record<string, string[]> | undefined;
|
|
57
57
|
/**
|
|
58
58
|
* Synchronously returns the contents of `filename`.
|
|
59
59
|
*
|
|
@@ -64,6 +64,6 @@ interface ResolveAliasOptions {
|
|
|
64
64
|
/**
|
|
65
65
|
* Absolute path to tsconfig file.
|
|
66
66
|
*/
|
|
67
|
-
tsconfig?: string;
|
|
67
|
+
tsconfig?: string | undefined;
|
|
68
68
|
}
|
|
69
69
|
export type { ResolveAliasOptions as default };
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @module mlly/interfaces/ResolveOptions
|
|
4
4
|
*/
|
|
5
5
|
/// <reference types="node" />
|
|
6
|
-
import type {
|
|
6
|
+
import type { ModuleSpecifierType } from '../types/index.mjs';
|
|
7
|
+
import type { Ext } from '@flex-development/pathe';
|
|
7
8
|
import type { EmptyString } from '@flex-development/tutils';
|
|
8
9
|
import type { URL } from 'node:url';
|
|
9
10
|
/**
|
|
@@ -19,15 +20,15 @@ interface ResolveOptions {
|
|
|
19
20
|
*
|
|
20
21
|
* @default CONDITIONS
|
|
21
22
|
*/
|
|
22
|
-
conditions?: Set<string> | string[] | readonly string[];
|
|
23
|
+
conditions?: Set<string> | string[] | readonly string[] | undefined;
|
|
23
24
|
/**
|
|
24
25
|
* Remove or replace file extension.
|
|
25
26
|
*
|
|
26
|
-
* **Note**: {@
|
|
27
|
+
* **Note**: {@linkcode type} must be set to `relative`.
|
|
27
28
|
*
|
|
28
|
-
* @see {@
|
|
29
|
+
* @see {@linkcode Ext}
|
|
29
30
|
*/
|
|
30
|
-
ext?: Ext | false | ((specifier: string, resolved: string) => EmptyString | Ext | PromiseLike<EmptyString | Ext>);
|
|
31
|
+
ext?: Ext | false | ((specifier: string, resolved: string) => EmptyString | Ext | PromiseLike<EmptyString | Ext>) | undefined;
|
|
31
32
|
/**
|
|
32
33
|
* Module extensions to probe for.
|
|
33
34
|
*
|
|
@@ -35,26 +36,26 @@ interface ResolveOptions {
|
|
|
35
36
|
*
|
|
36
37
|
* @default RESOLVE_EXTENSIONS
|
|
37
38
|
*/
|
|
38
|
-
extensions?: string[] | readonly string[];
|
|
39
|
+
extensions?: string[] | readonly string[] | undefined;
|
|
39
40
|
/**
|
|
40
41
|
* Parent module URL or path to resolve from.
|
|
41
42
|
*
|
|
42
43
|
* @default import.meta.url
|
|
43
44
|
*/
|
|
44
|
-
parent?: URL | string;
|
|
45
|
+
parent?: URL | string | undefined;
|
|
45
46
|
/**
|
|
46
47
|
* Keep symlinks instead of resolving them.
|
|
47
48
|
*
|
|
48
49
|
* @default false
|
|
49
50
|
*/
|
|
50
|
-
preserveSymlinks?: boolean;
|
|
51
|
+
preserveSymlinks?: boolean | undefined;
|
|
51
52
|
/**
|
|
52
53
|
* Module specifier type or a function to determine module specifier type.
|
|
53
54
|
*
|
|
54
|
-
* @see {@
|
|
55
|
+
* @see {@linkcode ModuleSpecifierType}
|
|
55
56
|
*
|
|
56
57
|
* @default 'absolute'
|
|
57
58
|
*/
|
|
58
|
-
type?:
|
|
59
|
+
type?: ModuleSpecifierType | ((resolved: string) => ModuleSpecifierType | PromiseLike<ModuleSpecifierType>) | undefined;
|
|
59
60
|
}
|
|
60
61
|
export type { ResolveOptions as default };
|
|
@@ -2,30 +2,43 @@
|
|
|
2
2
|
* @file Interfaces - ExportStatement
|
|
3
3
|
* @module mlly/interfaces/ExportStatement
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
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';
|
|
6
8
|
import type Statement from './statement.mjs';
|
|
7
9
|
/**
|
|
8
|
-
* Export statement object
|
|
10
|
+
* Export statement object.
|
|
9
11
|
*
|
|
10
|
-
* @see {@
|
|
11
|
-
* @see {@
|
|
12
|
+
* @see {@linkcode Declaration}
|
|
13
|
+
* @see {@linkcode Statement}
|
|
14
|
+
* @see {@linkcode SyntaxKindExport}
|
|
12
15
|
*
|
|
13
16
|
* @extends {Statement}
|
|
14
17
|
*/
|
|
15
18
|
interface ExportStatement extends Statement {
|
|
16
19
|
/**
|
|
17
20
|
* Export declaration, if any.
|
|
18
|
-
*
|
|
19
|
-
* @see {@link Declaration}
|
|
20
21
|
*/
|
|
21
|
-
declaration: Declaration
|
|
22
|
+
declaration: Nullable<Declaration>;
|
|
22
23
|
/**
|
|
23
24
|
* Export names.
|
|
24
25
|
*/
|
|
25
26
|
exports: string[];
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Statement kind.
|
|
28
29
|
*/
|
|
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;
|
|
30
43
|
}
|
|
31
44
|
export type { ExportStatement as default };
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* @file Interfaces - ImportStatement
|
|
3
3
|
* @module mlly/interfaces/ImportStatement
|
|
4
4
|
*/
|
|
5
|
+
import type { StatementKind } from '../enums/index.mjs';
|
|
6
|
+
import type { SyntaxKindImport } from '../types/index.mjs';
|
|
5
7
|
import type Statement from './statement.mjs';
|
|
6
8
|
/**
|
|
7
|
-
* Import statement object
|
|
9
|
+
* Import statement object.
|
|
8
10
|
*
|
|
9
|
-
* @see {@
|
|
11
|
+
* @see {@linkcode Statement}
|
|
12
|
+
* @see {@linkcode SyntaxKindImport}
|
|
10
13
|
*
|
|
11
14
|
* @extends {Statement}
|
|
12
15
|
*/
|
|
@@ -15,13 +18,21 @@ interface ImportStatement extends Statement {
|
|
|
15
18
|
* Import names.
|
|
16
19
|
*/
|
|
17
20
|
imports: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Statement kind.
|
|
23
|
+
*/
|
|
24
|
+
kind: StatementKind.IMPORT;
|
|
18
25
|
/**
|
|
19
26
|
* Module specifier.
|
|
20
27
|
*/
|
|
21
28
|
specifier: NonNullable<Statement['specifier']>;
|
|
22
29
|
/**
|
|
23
|
-
*
|
|
30
|
+
* Module specifier kind.
|
|
31
|
+
*/
|
|
32
|
+
specifier_kind: NonNullable<Statement['specifier_kind']>;
|
|
33
|
+
/**
|
|
34
|
+
* Statement syntax kind.
|
|
24
35
|
*/
|
|
25
|
-
|
|
36
|
+
syntax: SyntaxKindImport;
|
|
26
37
|
}
|
|
27
38
|
export type { ImportStatement as default };
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* @file Interfaces - RequireStatement
|
|
3
3
|
* @module mlly/interfaces/RequireStatement
|
|
4
4
|
*/
|
|
5
|
+
import type { StatementKind } from '../enums/index.mjs';
|
|
6
|
+
import type { SyntaxKindRequire } from '../types/index.mjs';
|
|
5
7
|
import type Statement from './statement.mjs';
|
|
6
8
|
/**
|
|
7
|
-
* Require statement object
|
|
9
|
+
* Require statement object.
|
|
8
10
|
*
|
|
9
|
-
* @see {@
|
|
11
|
+
* @see {@linkcode Statement}
|
|
12
|
+
* @see {@linkcode SyntaxKindRequire}
|
|
10
13
|
*
|
|
11
14
|
* @extends {Statement}
|
|
12
15
|
*/
|
|
@@ -15,13 +18,21 @@ interface RequireStatement extends Statement {
|
|
|
15
18
|
* Import names.
|
|
16
19
|
*/
|
|
17
20
|
imports: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Statement kind.
|
|
23
|
+
*/
|
|
24
|
+
kind: StatementKind.REQUIRE;
|
|
18
25
|
/**
|
|
19
26
|
* Module specifier.
|
|
20
27
|
*/
|
|
21
28
|
specifier: NonNullable<Statement['specifier']>;
|
|
22
29
|
/**
|
|
23
|
-
*
|
|
30
|
+
* Module specifier kind.
|
|
31
|
+
*/
|
|
32
|
+
specifier_kind: NonNullable<Statement['specifier_kind']>;
|
|
33
|
+
/**
|
|
34
|
+
* Statement syntax kind.
|
|
24
35
|
*/
|
|
25
|
-
|
|
36
|
+
syntax: SyntaxKindRequire;
|
|
26
37
|
}
|
|
27
38
|
export type { RequireStatement as default };
|