@flex-development/mlly 1.0.0-beta.4 → 1.0.0-beta.5
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 +15 -0
- package/README.md +162 -79
- package/dist/index.d.mts +1885 -5
- package/dist/index.mjs +1 -5
- package/dist/internal/chain-or-call.d.mts +51 -0
- package/dist/internal/chain-or-call.mjs +1 -34
- package/dist/internal/chars.d.mts +16 -0
- package/dist/internal/chars.mjs +1 -17
- package/dist/internal/check-invalid-segments.d.mts +18 -0
- package/dist/internal/check-invalid-segments.mjs +1 -49
- package/dist/internal/constant.d.mts +21 -0
- package/dist/internal/constant.mjs +1 -23
- package/dist/internal/fs.browser.d.mts +12 -0
- package/dist/internal/fs.browser.mjs +1 -42
- package/dist/internal/fs.node.d.mts +12 -0
- package/dist/internal/fs.node.mjs +1 -16
- package/dist/internal/identity.d.mts +21 -0
- package/dist/internal/identity.mjs +1 -23
- package/dist/internal/invalid-package-target.d.mts +31 -0
- package/dist/internal/invalid-package-target.mjs +1 -36
- package/dist/internal/invalid-subpath.d.mts +32 -0
- package/dist/internal/invalid-subpath.mjs +1 -37
- package/dist/internal/is-promise.d.mts +21 -0
- package/dist/internal/is-promise.mjs +1 -26
- package/dist/internal/process.browser.d.mts +9 -0
- package/dist/internal/process.browser.mjs +1 -8
- package/dist/lib/can-parse-url.mjs +1 -31
- package/dist/lib/cwd.mjs +1 -17
- package/dist/lib/default-conditions.mjs +1 -14
- package/dist/lib/default-extensions.mjs +1 -29
- package/dist/lib/default-main-fields.mjs +1 -13
- package/dist/lib/extension-format-map.mjs +1 -31
- package/dist/lib/formats.mjs +1 -22
- package/dist/lib/get-source.mjs +1 -153
- package/dist/lib/index.mjs +1 -41
- package/dist/lib/is-absolute-specifier.mjs +1 -34
- package/dist/lib/is-array-index.mjs +1 -28
- package/dist/lib/is-bare-specifier.mjs +1 -33
- package/dist/lib/is-directory.mjs +1 -54
- package/dist/lib/is-file.mjs +1 -54
- package/dist/lib/is-imports-subpath.mjs +1 -28
- package/dist/lib/is-module-id.mjs +1 -24
- package/dist/lib/is-relative-specifier.mjs +1 -36
- package/dist/lib/lookup-package-scope.mjs +1 -102
- package/dist/lib/pattern-key-compare.mjs +1 -71
- package/dist/lib/pattern-match.mjs +1 -85
- package/dist/lib/read-package-json.mjs +1 -114
- package/dist/lib/resolve-alias.mjs +1 -102
- package/dist/lib/resolve-module.mjs +1 -186
- package/dist/lib/resolver.mjs +1 -1015
- package/dist/lib/root.mjs +1 -12
- package/dist/lib/to-relative-specifier.mjs +1 -63
- package/dist/lib/to-url.mjs +1 -34
- package/package.json +28 -10
- package/dist/interfaces/aliases.d.mts +0 -21
- package/dist/interfaces/buffer-encoding-map.d.mts +0 -29
- package/dist/interfaces/condition-map.d.mts +0 -24
- package/dist/interfaces/file-system.d.mts +0 -29
- package/dist/interfaces/get-source-context.d.mts +0 -44
- package/dist/interfaces/get-source-options.d.mts +0 -56
- package/dist/interfaces/index.d.mts +0 -22
- package/dist/interfaces/is-directory.d.mts +0 -17
- package/dist/interfaces/is-file.d.mts +0 -17
- package/dist/interfaces/main-field-map.d.mts +0 -22
- package/dist/interfaces/module-format-map.d.mts +0 -26
- package/dist/interfaces/pattern-key-comparison-map.d.mts +0 -31
- package/dist/interfaces/protocol-map.d.mts +0 -44
- package/dist/interfaces/read-file.d.mts +0 -42
- package/dist/interfaces/realpath.d.mts +0 -29
- package/dist/interfaces/resolve-alias-options.d.mts +0 -43
- package/dist/interfaces/resolve-module-options.d.mts +0 -79
- package/dist/interfaces/stat.d.mts +0 -27
- package/dist/interfaces/stats.d.mts +0 -23
- package/dist/lib/can-parse-url.d.mts +0 -23
- package/dist/lib/cwd.d.mts +0 -14
- package/dist/lib/default-conditions.d.mts +0 -15
- package/dist/lib/default-extensions.d.mts +0 -14
- package/dist/lib/default-main-fields.d.mts +0 -14
- package/dist/lib/extension-format-map.d.mts +0 -16
- package/dist/lib/formats.d.mts +0 -21
- package/dist/lib/get-source.d.mts +0 -46
- package/dist/lib/index.d.mts +0 -41
- package/dist/lib/is-absolute-specifier.d.mts +0 -23
- package/dist/lib/is-array-index.d.mts +0 -19
- package/dist/lib/is-bare-specifier.d.mts +0 -23
- package/dist/lib/is-directory.d.mts +0 -27
- package/dist/lib/is-file.d.mts +0 -27
- package/dist/lib/is-imports-subpath.d.mts +0 -26
- package/dist/lib/is-module-id.d.mts +0 -23
- package/dist/lib/is-relative-specifier.d.mts +0 -23
- package/dist/lib/lookup-package-scope.d.mts +0 -49
- package/dist/lib/pattern-key-compare.d.mts +0 -28
- package/dist/lib/pattern-match.d.mts +0 -22
- package/dist/lib/read-package-json.d.mts +0 -63
- package/dist/lib/resolve-alias.d.mts +0 -21
- package/dist/lib/resolve-module.d.mts +0 -43
- package/dist/lib/resolver.d.mts +0 -346
- package/dist/lib/root.d.mts +0 -11
- package/dist/lib/to-relative-specifier.d.mts +0 -27
- package/dist/lib/to-url.d.mts +0 -26
- package/dist/types/awaitable.d.mts +0 -12
- package/dist/types/buffer-encoding.d.mts +0 -13
- package/dist/types/change-ext-fn.d.mts +0 -29
- package/dist/types/condition.d.mts +0 -13
- package/dist/types/dot.d.mts +0 -9
- package/dist/types/empty-array.d.mts +0 -9
- package/dist/types/empty-object.d.mts +0 -19
- package/dist/types/empty-string.d.mts +0 -9
- package/dist/types/ext.d.mts +0 -12
- package/dist/types/file-content.d.mts +0 -11
- package/dist/types/get-source-handler.d.mts +0 -23
- package/dist/types/get-source-handlers.d.mts +0 -15
- package/dist/types/index.d.mts +0 -24
- package/dist/types/list.d.mts +0 -12
- package/dist/types/main-field.d.mts +0 -13
- package/dist/types/module-format.d.mts +0 -13
- package/dist/types/module-id.d.mts +0 -12
- package/dist/types/numeric.d.mts +0 -9
- package/dist/types/pattern-key-comparison.d.mts +0 -14
- package/dist/types/pattern-match.d.mts +0 -10
- package/dist/types/protocol.d.mts +0 -13
package/dist/lib/root.mjs
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @file root
|
|
3
|
-
* @module mlly/lib/root
|
|
4
|
-
*/
|
|
5
|
-
import { dot, parse, pathToFileURL, resolve } from '@flex-development/pathe';
|
|
6
|
-
/**
|
|
7
|
-
* The URL of the file system root.
|
|
8
|
-
*
|
|
9
|
-
* @const {URL} root
|
|
10
|
-
*/
|
|
11
|
-
const root = pathToFileURL(parse(resolve(dot)).root);
|
|
12
|
-
export default root;
|
|
1
|
+
import{dot as o,parse as t,pathToFileURL as r,resolve as e}from"@flex-development/pathe";const p=r(t(e(o)).root);var l=p;export{l as default};
|
|
@@ -1,63 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @file toRelativeSpecifier
|
|
3
|
-
* @module mlly/lib/toRelativeSpecifier
|
|
4
|
-
*/
|
|
5
|
-
import pathe from '@flex-development/pathe';
|
|
6
|
-
import { ok } from 'devlop';
|
|
7
|
-
/**
|
|
8
|
-
* Turn `url` into a *relative specifier*.
|
|
9
|
-
*
|
|
10
|
-
* ::: info
|
|
11
|
-
* The relative specifier will only have a file extension
|
|
12
|
-
* if `specifier` also has an extension.
|
|
13
|
-
* :::
|
|
14
|
-
*
|
|
15
|
-
* @see {@linkcode ModuleId}
|
|
16
|
-
* @see https://nodejs.org/api/esm.html#terminology
|
|
17
|
-
*
|
|
18
|
-
* @this {void}
|
|
19
|
-
*
|
|
20
|
-
* @param {ModuleId} url
|
|
21
|
-
* The `file:` URL to convert
|
|
22
|
-
* @param {ModuleId} parent
|
|
23
|
-
* The parent module id
|
|
24
|
-
* @return {string}
|
|
25
|
-
* The relative specifier
|
|
26
|
-
*/
|
|
27
|
-
function toRelativeSpecifier(url, parent) {
|
|
28
|
-
parent = pathe.fileURLToPath(parent);
|
|
29
|
-
url = pathe.fileURLToPath(url);
|
|
30
|
-
/**
|
|
31
|
-
* The directory name of the {@linkcode parent} path.
|
|
32
|
-
*
|
|
33
|
-
* @const {string} dirname
|
|
34
|
-
*/
|
|
35
|
-
const dirname = pathe.dirname(parent);
|
|
36
|
-
/**
|
|
37
|
-
* The relative specifier.
|
|
38
|
-
*
|
|
39
|
-
* @var {string} specifier
|
|
40
|
-
*/
|
|
41
|
-
let specifier;
|
|
42
|
-
if (url.startsWith(parent) && parent.endsWith(pathe.sep)) {
|
|
43
|
-
// inside same directory as parent
|
|
44
|
-
specifier = pathe.dot + pathe.sep + url.slice(parent.length);
|
|
45
|
-
}
|
|
46
|
-
else if (url === dirname || url.startsWith(dirname + pathe.sep)) {
|
|
47
|
-
// directory name of parent or inside same directory as parent
|
|
48
|
-
specifier = pathe.dot + pathe.sep + url.slice(dirname.length + 1);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
// outside directory of parent
|
|
52
|
-
specifier = pathe.relative(parent, url);
|
|
53
|
-
ok(specifier.startsWith(pathe.dot), 'expected result to start with `.`');
|
|
54
|
-
/* v8 ignore else -- @preserve */
|
|
55
|
-
if (/(?:\.\.\/){2,}/.test(specifier)) {
|
|
56
|
-
// remove first '../' segment:
|
|
57
|
-
// pathe.relative backs out of an extra directory
|
|
58
|
-
specifier = specifier.slice(specifier.indexOf(pathe.sep) + 1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return specifier;
|
|
62
|
-
}
|
|
63
|
-
export default toRelativeSpecifier;
|
|
1
|
+
var h=Object.defineProperty;var f=(t,i)=>h(t,"name",{value:i,configurable:!0});import e from"@flex-development/pathe";import{ok as d}from"devlop";function c(t,i){i=e.fileURLToPath(i),t=e.fileURLToPath(t);const o=e.dirname(i);let s;if(t.startsWith(i)&&i.endsWith(e.sep))s=e.dot+e.sep+t.slice(i.length);else if(t===o||t.startsWith(o+e.sep))s=e.dot+e.sep+t.slice(o.length+1);else{s=e.relative(i,t),d(s.startsWith(e.dot),"expected result to start with `.`");/* v8 ignore else -- @preserve */ /(?:\.\.\/){2,}/.test(s)&&(s=s.slice(s.indexOf(e.sep)+1))}return s}f(c,"toRelativeSpecifier");var p=c;export{p as default};
|
package/dist/lib/to-url.mjs
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @file toUrl
|
|
3
|
-
* @module mlly/lib/toUrl
|
|
4
|
-
*/
|
|
5
|
-
import canParseUrl from '#lib/can-parse-url';
|
|
6
|
-
import { isBuiltin } from '@flex-development/is-builtin';
|
|
7
|
-
import pathe from '@flex-development/pathe';
|
|
8
|
-
/**
|
|
9
|
-
* Convert `id` to a {@linkcode URL}.
|
|
10
|
-
*
|
|
11
|
-
* > 👉 **Note**: If `id` cannot be parsed as a `URL`, and is also not a
|
|
12
|
-
* > [builtin module][builtin-module], it will be assumed to be a path and
|
|
13
|
-
* > converted to a [`file:` URL][file-url].
|
|
14
|
-
*
|
|
15
|
-
* [builtin-module]: https://nodejs.org/api/esm.html#builtin-modules
|
|
16
|
-
* [file-url]: https://nodejs.org/api/esm.html#file-urls
|
|
17
|
-
*
|
|
18
|
-
* @this {void}
|
|
19
|
-
*
|
|
20
|
-
* @param {ModuleId} id
|
|
21
|
-
* The module id to convert
|
|
22
|
-
* @param {ModuleId | null | undefined} [parent]
|
|
23
|
-
* The base URL to resolve against if `id` is not absolute
|
|
24
|
-
* @return {URL}
|
|
25
|
-
* The new URL
|
|
26
|
-
*/
|
|
27
|
-
function toUrl(id, parent) {
|
|
28
|
-
return canParseUrl(id, parent)
|
|
29
|
-
? new URL(id, parent ?? undefined)
|
|
30
|
-
: isBuiltin(id)
|
|
31
|
-
? new URL('node:' + String(id))
|
|
32
|
-
: pathe.pathToFileURL(String(id));
|
|
33
|
-
}
|
|
34
|
-
export default toUrl;
|
|
1
|
+
var o=Object.defineProperty;var n=(r,t)=>o(r,"name",{value:t,configurable:!0});import e from"#lib/can-parse-url";import{isBuiltin as i}from"@flex-development/is-builtin";import f from"@flex-development/pathe";function m(r,t){return e(r,t)?new URL(r,t??void 0):i(r)?new URL("node:"+String(r)):f.pathToFileURL(String(r))}n(m,"toUrl");var a=m;export{a as default};
|
package/package.json
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flex-development/mlly",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"description": "ESM utilities for modern tooling — spec-compliant, developer-friendly, and fully typed",
|
|
4
|
+
"version": "1.0.0-beta.5",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"bundle",
|
|
7
|
+
"cli",
|
|
6
8
|
"ecmascript",
|
|
9
|
+
"ecmascript-modules",
|
|
7
10
|
"esm",
|
|
8
11
|
"esmodules",
|
|
12
|
+
"exports",
|
|
13
|
+
"import",
|
|
14
|
+
"import.meta.resolve",
|
|
15
|
+
"imports",
|
|
16
|
+
"meta",
|
|
9
17
|
"module",
|
|
18
|
+
"modules",
|
|
19
|
+
"node",
|
|
20
|
+
"nodejs",
|
|
21
|
+
"package-json",
|
|
22
|
+
"resolution",
|
|
23
|
+
"resolve",
|
|
24
|
+
"resolver",
|
|
25
|
+
"tooling",
|
|
26
|
+
"transpile",
|
|
10
27
|
"typescript"
|
|
11
28
|
],
|
|
12
29
|
"license": "BSD-3-Clause",
|
|
@@ -42,11 +59,7 @@
|
|
|
42
59
|
"mlly": "./src/index.mts",
|
|
43
60
|
"default": "./dist/index.mjs"
|
|
44
61
|
},
|
|
45
|
-
"./package.json": "./package.json"
|
|
46
|
-
"./*": {
|
|
47
|
-
"mlly": "./src/lib/*.mts",
|
|
48
|
-
"default": "./dist/lib/*.mjs"
|
|
49
|
-
}
|
|
62
|
+
"./package.json": "./package.json"
|
|
50
63
|
},
|
|
51
64
|
"imports": {
|
|
52
65
|
"#fixtures/tsconfig*.json": {
|
|
@@ -110,7 +123,8 @@
|
|
|
110
123
|
]
|
|
111
124
|
},
|
|
112
125
|
"scripts": {
|
|
113
|
-
"build": "yarn clean:build && tsc -p tsconfig.build.json --noEmit false &&
|
|
126
|
+
"build": "yarn clean:build && tsc -p tsconfig.build.json --noEmit false && yarn bundle:dts && yarn minify:build",
|
|
127
|
+
"bundle:dts": "dtsroll --conditions=mlly && trash ./dist/{interfaces,types} && trash ./dist/{internal,lib}/index.d.mts || exit 0",
|
|
114
128
|
"check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn check:types && yarn test:cov && yarn pack && yarn check:types:build && attw package.tgz && yarn clean:pack",
|
|
115
129
|
"check:format": "dprint check --incremental=false",
|
|
116
130
|
"check:lint": "eslint --exit-on-fatal-error --max-warnings 0 .",
|
|
@@ -130,6 +144,7 @@
|
|
|
130
144
|
"fix:dedupe": "yarn dedupe --strategy=highest",
|
|
131
145
|
"fix:format": "dprint fmt",
|
|
132
146
|
"fix:lint": "yarn check:lint --cache --fix",
|
|
147
|
+
"minify:build": "esbuild dist/**/*.mjs --allow-overwrite --minify --keep-names --outdir=dist --format=esm --out-extension:.js=.mjs --log-level=warning",
|
|
133
148
|
"_postinstall": "[ -f ./.git ] && [ -f ./node_modules/.bin/husky ] && chmod +x .husky/_/* && husky || exit 0",
|
|
134
149
|
"postpack": "toggle-scripts +postinstall",
|
|
135
150
|
"postpublish": "toggle-scripts +prepack",
|
|
@@ -182,14 +197,17 @@
|
|
|
182
197
|
"cross-env": "10.1.0",
|
|
183
198
|
"cspell": "9.6.4",
|
|
184
199
|
"dprint": "0.51.1",
|
|
200
|
+
"dtsroll": "1.7.6",
|
|
185
201
|
"editorconfig": "3.0.1",
|
|
202
|
+
"esbuild": "0.27.3",
|
|
186
203
|
"eslint": "9.39.2",
|
|
187
204
|
"growl": "1.10.5",
|
|
188
205
|
"husky": "9.1.7",
|
|
189
206
|
"import-meta-resolve": "4.2.0",
|
|
190
207
|
"is-ci": "4.1.0",
|
|
191
|
-
"msw": "2.12.
|
|
208
|
+
"msw": "2.12.10",
|
|
192
209
|
"node-notifier": "10.0.1",
|
|
210
|
+
"pkg-size": "2.4.0",
|
|
193
211
|
"remark": "15.0.1",
|
|
194
212
|
"remark-cli": "12.0.1",
|
|
195
213
|
"remark-lint-maximum-heading-length": "4.1.1",
|
|
@@ -198,7 +216,7 @@
|
|
|
198
216
|
"typescript": "5.9.3",
|
|
199
217
|
"unified": "11.0.5",
|
|
200
218
|
"vfile": "6.0.3",
|
|
201
|
-
"vite-tsconfig-paths": "6.0
|
|
219
|
+
"vite-tsconfig-paths": "6.1.0",
|
|
202
220
|
"vitest": "4.0.18"
|
|
203
221
|
},
|
|
204
222
|
"resolutions": {
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - Aliases
|
|
3
|
-
* @module mlly/interfaces/Aliases
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Record, where each key is a path alias or pattern and each value
|
|
7
|
-
* is a path mapping configuration.
|
|
8
|
-
*
|
|
9
|
-
* This interface can be augmented to register custom aliases.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* declare module '@flex-development/mlly' {
|
|
13
|
-
* interface Aliases {
|
|
14
|
-
* custom?: string[] | string | null
|
|
15
|
-
* }
|
|
16
|
-
* }
|
|
17
|
-
*/
|
|
18
|
-
interface Aliases {
|
|
19
|
-
[alias: string]: (string | null | undefined)[] | string | null | undefined;
|
|
20
|
-
}
|
|
21
|
-
export type { Aliases as default };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - BufferEncodingMap
|
|
3
|
-
* @module mlly/interfaces/BufferEncodingMap
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Registry of character encodings that can be used when working
|
|
7
|
-
* with {@linkcode Buffer} objects.
|
|
8
|
-
*
|
|
9
|
-
* This interface can be augmented to register custom encodings.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* declare module '@flex-development/mlly' {
|
|
13
|
-
* interface BufferEncodingMap {
|
|
14
|
-
* custom: 'custom'
|
|
15
|
-
* }
|
|
16
|
-
* }
|
|
17
|
-
*/
|
|
18
|
-
interface BufferEncodingMap {
|
|
19
|
-
ascii: 'ascii';
|
|
20
|
-
base64: 'base64';
|
|
21
|
-
base64url: 'base64url';
|
|
22
|
-
binary: 'binary';
|
|
23
|
-
hex: 'hex';
|
|
24
|
-
latin1: 'latin1';
|
|
25
|
-
ucs2: 'ucs2' | 'ucs-2';
|
|
26
|
-
utf16le: 'utf16le' | 'utf-16le';
|
|
27
|
-
utf8: 'utf8' | 'utf-8';
|
|
28
|
-
}
|
|
29
|
-
export type { BufferEncodingMap as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - ConditionMap
|
|
3
|
-
* @module mlly/interfaces/ConditionMap
|
|
4
|
-
*/
|
|
5
|
-
import type * as pkgTypes from '@flex-development/pkg-types';
|
|
6
|
-
/**
|
|
7
|
-
* Registry of export/import conditions.
|
|
8
|
-
*
|
|
9
|
-
* This interface can be augmented to register custom conditions.
|
|
10
|
-
*
|
|
11
|
-
* @see {@linkcode pkgTypes.ConditionMap}
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* declare module '@flex-development/mlly' {
|
|
15
|
-
* interface ConditionMap {
|
|
16
|
-
* custom: 'custom'
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
* @extends {pkgTypes.ConditionMap}
|
|
21
|
-
*/
|
|
22
|
-
interface ConditionMap extends pkgTypes.ConditionMap {
|
|
23
|
-
}
|
|
24
|
-
export type { ConditionMap as default };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - FileSystem
|
|
3
|
-
* @module mlly/interfaces/FileSystem
|
|
4
|
-
*/
|
|
5
|
-
import type { ReadFile, Realpath, Stat } from '@flex-development/mlly';
|
|
6
|
-
/**
|
|
7
|
-
* The file system API.
|
|
8
|
-
*/
|
|
9
|
-
interface FileSystem {
|
|
10
|
-
/**
|
|
11
|
-
* Read the entire contents of a file.
|
|
12
|
-
*
|
|
13
|
-
* @see {@linkcode ReadFile}
|
|
14
|
-
*/
|
|
15
|
-
readFile: ReadFile;
|
|
16
|
-
/**
|
|
17
|
-
* Compute a canonical pathname by resolving `.`, `..`, and symbolic links.
|
|
18
|
-
*
|
|
19
|
-
* @see {@linkcode Realpath}
|
|
20
|
-
*/
|
|
21
|
-
realpath: Realpath;
|
|
22
|
-
/**
|
|
23
|
-
* Get information about a directory or file.
|
|
24
|
-
*
|
|
25
|
-
* @see {@linkcode Stat}
|
|
26
|
-
*/
|
|
27
|
-
stat: Stat;
|
|
28
|
-
}
|
|
29
|
-
export type { FileSystem as default };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - GetSourceContext
|
|
3
|
-
* @module mlly/interfaces/GetSourceContext
|
|
4
|
-
*/
|
|
5
|
-
import type { FileSystem, GetSourceHandlers, GetSourceOptions } from '@flex-development/mlly';
|
|
6
|
-
/**
|
|
7
|
-
* Source code retrieval context.
|
|
8
|
-
*
|
|
9
|
-
* @see {@linkcode GetSourceOptions}
|
|
10
|
-
*
|
|
11
|
-
* @extends {GetSourceOptions}
|
|
12
|
-
*/
|
|
13
|
-
interface GetSourceContext extends GetSourceOptions {
|
|
14
|
-
/**
|
|
15
|
-
* The file system API.
|
|
16
|
-
*
|
|
17
|
-
* @see {@linkcode FileSystem}
|
|
18
|
-
*
|
|
19
|
-
* @override
|
|
20
|
-
*/
|
|
21
|
-
fs: FileSystem;
|
|
22
|
-
/**
|
|
23
|
-
* Record, where each key is a URL protocol
|
|
24
|
-
* and each value is a source code handler.
|
|
25
|
-
*
|
|
26
|
-
* @see {@linkcode GetSourceHandlers}
|
|
27
|
-
*
|
|
28
|
-
* @override
|
|
29
|
-
*/
|
|
30
|
-
handlers: GetSourceHandlers;
|
|
31
|
-
/**
|
|
32
|
-
* Request options for network based modules.
|
|
33
|
-
*
|
|
34
|
-
* @override
|
|
35
|
-
*/
|
|
36
|
-
req: RequestInit;
|
|
37
|
-
/**
|
|
38
|
-
* The list of supported URL schemes.
|
|
39
|
-
*
|
|
40
|
-
* @override
|
|
41
|
-
*/
|
|
42
|
-
schemes: Set<string>;
|
|
43
|
-
}
|
|
44
|
-
export type { GetSourceContext as default };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - GetSourceOptions
|
|
3
|
-
* @module mlly/interfaces/GetSourceOptions
|
|
4
|
-
*/
|
|
5
|
-
import type { BufferEncoding, FileSystem, GetSourceHandlers, List, ModuleFormat } from '@flex-development/mlly';
|
|
6
|
-
/**
|
|
7
|
-
* Options for retrieving source code.
|
|
8
|
-
*/
|
|
9
|
-
interface GetSourceOptions {
|
|
10
|
-
/**
|
|
11
|
-
* The encoding of the result.
|
|
12
|
-
*
|
|
13
|
-
* > 👉 **Note**: Used when the `file:` handler is called.
|
|
14
|
-
*
|
|
15
|
-
* @see {@linkcode BufferEncoding}
|
|
16
|
-
*/
|
|
17
|
-
encoding?: BufferEncoding | null | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* The module format hint.
|
|
20
|
-
*
|
|
21
|
-
* @see {@linkcode ModuleFormat}
|
|
22
|
-
*/
|
|
23
|
-
format?: ModuleFormat | null | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The file system API.
|
|
26
|
-
*
|
|
27
|
-
* @see {@linkcode FileSystem}
|
|
28
|
-
*/
|
|
29
|
-
fs?: FileSystem | null | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Record, where each key is a URL protocol
|
|
32
|
-
* and each value is a source code handler.
|
|
33
|
-
*
|
|
34
|
-
* @see {@linkcode GetSourceHandlers}
|
|
35
|
-
*/
|
|
36
|
-
handlers?: GetSourceHandlers | null | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Whether to ignore [`ERR_UNSUPPORTED_ESM_URL_SCHEME`][err] if thrown.
|
|
39
|
-
*
|
|
40
|
-
* [err]: https://nodejs.org/api/errors.html#err_unsupported_esm_url_scheme
|
|
41
|
-
*/
|
|
42
|
-
ignoreErrors?: boolean | null | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Request options for network based modules.
|
|
45
|
-
*/
|
|
46
|
-
req?: RequestInit | null | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* The list of supported URL schemes.
|
|
49
|
-
*
|
|
50
|
-
* @see {@linkcode List}
|
|
51
|
-
*
|
|
52
|
-
* @default ['data','file','http','https','node']
|
|
53
|
-
*/
|
|
54
|
-
schemes?: List<string> | null | undefined;
|
|
55
|
-
}
|
|
56
|
-
export type { GetSourceOptions as default };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Entry Point - Interfaces
|
|
3
|
-
* @module mlly/interfaces
|
|
4
|
-
*/
|
|
5
|
-
export type { default as Aliases } from '#interfaces/aliases';
|
|
6
|
-
export type { default as BufferEncodingMap } from '#interfaces/buffer-encoding-map';
|
|
7
|
-
export type { default as ConditionMap } from '#interfaces/condition-map';
|
|
8
|
-
export type { default as FileSystem } from '#interfaces/file-system';
|
|
9
|
-
export type { default as GetSourceContext } from '#interfaces/get-source-context';
|
|
10
|
-
export type { default as GetSourceOptions } from '#interfaces/get-source-options';
|
|
11
|
-
export type { default as IsDirectory } from '#interfaces/is-directory';
|
|
12
|
-
export type { default as IsFile } from '#interfaces/is-file';
|
|
13
|
-
export type { default as MainFieldMap } from '#interfaces/main-field-map';
|
|
14
|
-
export type { default as ModuleFormatMap } from '#interfaces/module-format-map';
|
|
15
|
-
export type { default as PatternKeyComparisonMap } from '#interfaces/pattern-key-comparison-map';
|
|
16
|
-
export type { default as ProtocolMap } from '#interfaces/protocol-map';
|
|
17
|
-
export type { default as ReadFile } from '#interfaces/read-file';
|
|
18
|
-
export type { default as Realpath } from '#interfaces/realpath';
|
|
19
|
-
export type { default as ResolveAliasOptions } from '#interfaces/resolve-alias-options';
|
|
20
|
-
export type { default as ResolveModuleOptions } from '#interfaces/resolve-module-options';
|
|
21
|
-
export type { default as Stat } from '#interfaces/stat';
|
|
22
|
-
export type { default as Stats } from '#interfaces/stats';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - IsDirectory
|
|
3
|
-
* @module mlly/interfaces/IsDirectory
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Check if a stats object describes a directory.
|
|
7
|
-
*/
|
|
8
|
-
interface IsDirectory {
|
|
9
|
-
/**
|
|
10
|
-
* @this {unknown}
|
|
11
|
-
*
|
|
12
|
-
* @return {boolean}
|
|
13
|
-
* `true` if stats describes directory, `false` otherwise
|
|
14
|
-
*/
|
|
15
|
-
(): boolean;
|
|
16
|
-
}
|
|
17
|
-
export type { IsDirectory as default };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - IsFile
|
|
3
|
-
* @module mlly/interfaces/IsFile
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Check if a stats object describes a file.
|
|
7
|
-
*/
|
|
8
|
-
interface IsFile {
|
|
9
|
-
/**
|
|
10
|
-
* @this {void}
|
|
11
|
-
*
|
|
12
|
-
* @return {boolean}
|
|
13
|
-
* `true` if stats object describes regular file, `false` otherwise
|
|
14
|
-
*/
|
|
15
|
-
(): boolean;
|
|
16
|
-
}
|
|
17
|
-
export type { IsFile as default };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - MainFieldMap
|
|
3
|
-
* @module mlly/interfaces/MainFieldMap
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Registry of main fields.
|
|
7
|
-
*
|
|
8
|
-
* This interface can be augmented to register custom main fields.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* declare module '@flex-development/mlly' {
|
|
12
|
-
* interface MainFieldMap {
|
|
13
|
-
* unpkg: 'unpkg'
|
|
14
|
-
* }
|
|
15
|
-
* }
|
|
16
|
-
*/
|
|
17
|
-
interface MainFieldMap {
|
|
18
|
-
main: 'main';
|
|
19
|
-
module: 'module';
|
|
20
|
-
types: 'types';
|
|
21
|
-
}
|
|
22
|
-
export type { MainFieldMap as default };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - ModuleFormatMap
|
|
3
|
-
* @module mlly/interfaces/ModuleFormatMap
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Registry of module formats.
|
|
7
|
-
*
|
|
8
|
-
* This interface can be augmented to register custom module formats.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* declare module '@flex-development/mlly' {
|
|
12
|
-
* interface ModuleFormatMap {
|
|
13
|
-
* custom: 'custom'
|
|
14
|
-
* }
|
|
15
|
-
* }
|
|
16
|
-
*/
|
|
17
|
-
interface ModuleFormatMap {
|
|
18
|
-
builtin: 'builtin';
|
|
19
|
-
commonjs: 'commonjs';
|
|
20
|
-
cts: 'commonjs-typescript';
|
|
21
|
-
json: 'json';
|
|
22
|
-
module: 'module';
|
|
23
|
-
mts: 'module-typescript';
|
|
24
|
-
wasm: 'wasm';
|
|
25
|
-
}
|
|
26
|
-
export type { ModuleFormatMap as default };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - PatternKeyComparisonMap
|
|
3
|
-
* @module mlly/interfaces/PatternKeyComparisonMap
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Registry of `PATTERN_KEY_COMPARE` algorithm results.
|
|
7
|
-
*
|
|
8
|
-
* This interface can be augmented to register custom results.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* declare module '@flex-development/mlly' {
|
|
12
|
-
* interface PatternKeyComparisonMap {
|
|
13
|
-
* afterThree: 3
|
|
14
|
-
* }
|
|
15
|
-
* }
|
|
16
|
-
*/
|
|
17
|
-
interface PatternKeyComparisonMap {
|
|
18
|
-
/**
|
|
19
|
-
* `a` should come after `b`.
|
|
20
|
-
*/
|
|
21
|
-
after: 1;
|
|
22
|
-
/**
|
|
23
|
-
* `a` should come before `b`.
|
|
24
|
-
*/
|
|
25
|
-
before: -1;
|
|
26
|
-
/**
|
|
27
|
-
* `a` and `b` are equal.
|
|
28
|
-
*/
|
|
29
|
-
equal: 0;
|
|
30
|
-
}
|
|
31
|
-
export type { PatternKeyComparisonMap as default };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - ProtocolMap
|
|
3
|
-
* @module mlly/interfaces/ProtocolMap
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Registry of URL protocols.
|
|
7
|
-
*
|
|
8
|
-
* This interface can be augmented to register custom protocols.
|
|
9
|
-
*
|
|
10
|
-
* @see https://nodejs.org/api/url.html#urlprotocol
|
|
11
|
-
* @see https://iana.org/assignments/uri-schemes/uri-schemes.xhtml
|
|
12
|
-
* @see https://url.spec.whatwg.org/#special-scheme
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* declare module '@flex-development/mlly' {
|
|
16
|
-
* interface ProtocolMap {
|
|
17
|
-
* custom: 'custom:'
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
*/
|
|
21
|
-
interface ProtocolMap {
|
|
22
|
-
blob: 'blob:';
|
|
23
|
-
content: 'content:';
|
|
24
|
-
cvs: 'cvs:';
|
|
25
|
-
data: 'data:';
|
|
26
|
-
dns: 'dns:';
|
|
27
|
-
file: 'file:';
|
|
28
|
-
fish: 'fish:';
|
|
29
|
-
ftp: 'ftp:';
|
|
30
|
-
git: 'git:';
|
|
31
|
-
http: 'http:';
|
|
32
|
-
https: 'https:';
|
|
33
|
-
mvn: 'mvn:';
|
|
34
|
-
node: 'node:';
|
|
35
|
-
redis: 'redis:';
|
|
36
|
-
sftp: 'sftp:';
|
|
37
|
-
ssh: 'ssh:';
|
|
38
|
-
svn: 'svn:';
|
|
39
|
-
urn: 'urn:';
|
|
40
|
-
viewSource: 'view-source:';
|
|
41
|
-
ws: 'ws:';
|
|
42
|
-
wss: 'wss:';
|
|
43
|
-
}
|
|
44
|
-
export type { ProtocolMap as default };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - ReadFile
|
|
3
|
-
* @module mlly/interfaces/ReadFile
|
|
4
|
-
*/
|
|
5
|
-
import type { Awaitable, BufferEncoding, FileContent, ModuleId } from '@flex-development/mlly';
|
|
6
|
-
/**
|
|
7
|
-
* Read the entire contents of a file.
|
|
8
|
-
*/
|
|
9
|
-
interface ReadFile {
|
|
10
|
-
/**
|
|
11
|
-
* @see {@linkcode ModuleId}
|
|
12
|
-
*
|
|
13
|
-
* @this {unknown}
|
|
14
|
-
*
|
|
15
|
-
* @param {ModuleId} id
|
|
16
|
-
* The module id
|
|
17
|
-
* @param {BufferEncoding} encoding
|
|
18
|
-
* The encoding of the file contents
|
|
19
|
-
* @return {Awaitable<string>}
|
|
20
|
-
* The file contents
|
|
21
|
-
*/
|
|
22
|
-
(id: ModuleId, encoding: BufferEncoding): Awaitable<string>;
|
|
23
|
-
/**
|
|
24
|
-
* @see {@linkcode Awaitable}
|
|
25
|
-
* @see {@linkcode FileContent}
|
|
26
|
-
* @see {@linkcode ModuleId}
|
|
27
|
-
*
|
|
28
|
-
* @template {Awaitable<FileContent | null | undefined>} T
|
|
29
|
-
* The file contents
|
|
30
|
-
*
|
|
31
|
-
* @this {unknown}
|
|
32
|
-
*
|
|
33
|
-
* @param {ModuleId} id
|
|
34
|
-
* The module id
|
|
35
|
-
* @param {BufferEncoding | null | undefined} [encoding]
|
|
36
|
-
* The encoding of the file contents
|
|
37
|
-
* @return {T}
|
|
38
|
-
* The file contents
|
|
39
|
-
*/
|
|
40
|
-
<T extends Awaitable<FileContent | null | undefined>>(id: ModuleId, encoding?: BufferEncoding | null | undefined): T;
|
|
41
|
-
}
|
|
42
|
-
export type { ReadFile as default };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Interfaces - Realpath
|
|
3
|
-
* @module mlly/interfaces/Realpath
|
|
4
|
-
*/
|
|
5
|
-
import type { Awaitable, ModuleId } from '@flex-development/mlly';
|
|
6
|
-
/**
|
|
7
|
-
* Compute a canonical pathname by resolving `.`, `..`, and symbolic links.
|
|
8
|
-
*
|
|
9
|
-
* > 👉 **Note**: A canonical pathname is not necessarily unique.
|
|
10
|
-
* > Hard links and bind mounts can expose an entity through many pathnames.
|
|
11
|
-
*/
|
|
12
|
-
interface Realpath {
|
|
13
|
-
/**
|
|
14
|
-
* @see {@linkcode Awaitable}
|
|
15
|
-
* @see {@linkcode ModuleId}
|
|
16
|
-
*
|
|
17
|
-
* @template {Awaitable<string>} T
|
|
18
|
-
* The canonical pathname
|
|
19
|
-
*
|
|
20
|
-
* @this {unknown}
|
|
21
|
-
*
|
|
22
|
-
* @param {ModuleId} id
|
|
23
|
-
* The module id
|
|
24
|
-
* @return {T}
|
|
25
|
-
* The canonical pathname
|
|
26
|
-
*/
|
|
27
|
-
<T extends Awaitable<string>>(id: ModuleId): T;
|
|
28
|
-
}
|
|
29
|
-
export type { Realpath as default };
|