@flex-development/mlly 1.0.0-alpha.1

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 (81) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/LICENSE.md +28 -0
  3. package/README.md +17 -0
  4. package/changelog.config.cts +204 -0
  5. package/dist/constants.d.mts +19 -0
  6. package/dist/constants.mjs +24 -0
  7. package/dist/index.d.mts +8 -0
  8. package/dist/index.mjs +4 -0
  9. package/dist/interfaces/import-dynamic.d.mts +23 -0
  10. package/dist/interfaces/import-dynamic.mjs +0 -0
  11. package/dist/interfaces/import-static.d.mts +19 -0
  12. package/dist/interfaces/import-static.mjs +0 -0
  13. package/dist/interfaces/index.d.mts +12 -0
  14. package/dist/interfaces/index.mjs +0 -0
  15. package/dist/interfaces/options-resolve-alias.d.mts +69 -0
  16. package/dist/interfaces/options-resolve-alias.mjs +0 -0
  17. package/dist/interfaces/options-resolve.d.mts +60 -0
  18. package/dist/interfaces/options-resolve.mjs +0 -0
  19. package/dist/interfaces/statement-export.d.mts +31 -0
  20. package/dist/interfaces/statement-export.mjs +0 -0
  21. package/dist/interfaces/statement-import.d.mts +27 -0
  22. package/dist/interfaces/statement-import.mjs +0 -0
  23. package/dist/interfaces/statement-require.d.mts +27 -0
  24. package/dist/interfaces/statement-require.mjs +0 -0
  25. package/dist/interfaces/statement.d.mts +33 -0
  26. package/dist/interfaces/statement.mjs +0 -0
  27. package/dist/internal/compiler-options-json.d.mts +111 -0
  28. package/dist/internal/compiler-options-json.mjs +0 -0
  29. package/dist/internal/constants.d.mts +70 -0
  30. package/dist/internal/constants.mjs +18 -0
  31. package/dist/internal/get-compiler-options.d.mts +21 -0
  32. package/dist/internal/get-compiler-options.mjs +14 -0
  33. package/dist/internal/index.d.mts +7 -0
  34. package/dist/internal/index.mjs +5 -0
  35. package/dist/lib/detect-syntax.d.mts +21 -0
  36. package/dist/lib/detect-syntax.mjs +11 -0
  37. package/dist/lib/extract-statements.d.mts +21 -0
  38. package/dist/lib/extract-statements.mjs +18 -0
  39. package/dist/lib/find-dynamic-imports.d.mts +15 -0
  40. package/dist/lib/find-dynamic-imports.mjs +20 -0
  41. package/dist/lib/find-exports.d.mts +15 -0
  42. package/dist/lib/find-exports.mjs +53 -0
  43. package/dist/lib/find-requires.d.mts +17 -0
  44. package/dist/lib/find-requires.mjs +19 -0
  45. package/dist/lib/find-static-imports.d.mts +15 -0
  46. package/dist/lib/find-static-imports.mjs +20 -0
  47. package/dist/lib/has-cjs-syntax.d.mts +22 -0
  48. package/dist/lib/has-cjs-syntax.mjs +6 -0
  49. package/dist/lib/has-esm-syntax.d.mts +18 -0
  50. package/dist/lib/has-esm-syntax.mjs +6 -0
  51. package/dist/lib/index.d.mts +20 -0
  52. package/dist/lib/index.mjs +34 -0
  53. package/dist/lib/resolve-alias.d.mts +20 -0
  54. package/dist/lib/resolve-alias.mjs +41 -0
  55. package/dist/lib/resolve-aliases.d.mts +17 -0
  56. package/dist/lib/resolve-aliases.mjs +34 -0
  57. package/dist/lib/resolve-module.d.mts +31 -0
  58. package/dist/lib/resolve-module.mjs +74 -0
  59. package/dist/lib/resolve-modules.d.mts +19 -0
  60. package/dist/lib/resolve-modules.mjs +29 -0
  61. package/dist/lib/to-absolute-specifier.d.mts +22 -0
  62. package/dist/lib/to-absolute-specifier.mjs +20 -0
  63. package/dist/lib/to-bare-specifier.d.mts +28 -0
  64. package/dist/lib/to-bare-specifier.mjs +78 -0
  65. package/dist/lib/to-data-url.d.mts +29 -0
  66. package/dist/lib/to-data-url.mjs +7 -0
  67. package/dist/lib/to-relative-specifier.d.mts +22 -0
  68. package/dist/lib/to-relative-specifier.mjs +17 -0
  69. package/dist/types/declaration.d.mts +9 -0
  70. package/dist/types/declaration.mjs +0 -0
  71. package/dist/types/ext.d.mts +9 -0
  72. package/dist/types/ext.mjs +0 -0
  73. package/dist/types/index.d.mts +9 -0
  74. package/dist/types/index.mjs +0 -0
  75. package/dist/types/mime-type.d.mts +11 -0
  76. package/dist/types/mime-type.mjs +0 -0
  77. package/dist/types/specifier-type.d.mts +11 -0
  78. package/dist/types/specifier-type.mjs +0 -0
  79. package/dist/types/statement-type.d.mts +9 -0
  80. package/dist/types/statement-type.mjs +0 -0
  81. package/package.json +197 -0
@@ -0,0 +1,17 @@
1
+ import { fileURLToPath, URL } from "node:url";
2
+ import upath from "upath";
3
+ const toRelativeSpecifier = (specifier, parent) => {
4
+ if (parent instanceof URL)
5
+ parent = parent.href;
6
+ if (specifier instanceof URL)
7
+ specifier = specifier.href;
8
+ if (parent.startsWith("file:"))
9
+ parent = fileURLToPath(parent);
10
+ if (specifier.startsWith("file:"))
11
+ specifier = fileURLToPath(specifier);
12
+ return upath.relative(upath.dirname(parent), specifier).replace(/^(\w)/, "./$1");
13
+ };
14
+ var to_relative_specifier_default = toRelativeSpecifier;
15
+ export {
16
+ to_relative_specifier_default as default
17
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file Type Definitions - Declaration
3
+ * @module mlly/types/Declaration
4
+ */
5
+ /**
6
+ * Export declaration kinds.
7
+ */
8
+ declare type Declaration = 'abstract class' | 'async function' | 'async function*' | 'class' | 'const enum' | 'const' | 'default async function' | 'default async function*' | 'default async' | 'default function' | 'default function*' | 'default' | 'enum' | 'function' | 'function*' | 'interface' | 'let' | 'namespace' | 'type' | 'var';
9
+ export type { Declaration as default };
File without changes
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file Type Definitions - Ext
3
+ * @module mlly/types/Ext
4
+ */
5
+ /**
6
+ * File extension type.
7
+ */
8
+ declare type Ext = `.${string}`;
9
+ export type { Ext as default };
File without changes
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file Type Definitions
3
+ * @module mlly/types
4
+ */
5
+ export type { default as Declaration } from './declaration.mjs';
6
+ export type { default as Ext } from './ext.mjs';
7
+ export type { default as MIMEType } from './mime-type.mjs';
8
+ export type { default as SpecifierType } from './specifier-type.mjs';
9
+ export type { default as StatementType } from './statement-type.mjs';
File without changes
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file Type Definitions - MIMEType
3
+ * @module mlly/types/MIMEType
4
+ */
5
+ /**
6
+ * Supported MIME types.
7
+ *
8
+ * @see https://nodejs.org/api/esm.html#esm_data_imports
9
+ */
10
+ declare type MIMEType = 'application/json' | 'application/wasm' | 'text/javascript';
11
+ export type { MIMEType as default };
File without changes
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file Type Definitions - SpecifierType
3
+ * @module mlly/types/SpecifierType
4
+ */
5
+ /**
6
+ * Module specifier types.
7
+ *
8
+ * @see https://nodejs.org/api/esm.html#terminology
9
+ */
10
+ declare type SpecifierType = 'absolute' | 'bare' | 'relative';
11
+ export type { SpecifierType as default };
File without changes
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file Type Definitions - StatementType
3
+ * @module mlly/types/StatementType
4
+ */
5
+ /**
6
+ * CommonJS and ESM statement types.
7
+ */
8
+ declare type StatementType = 'declaration' | 'default' | 'dynamic' | 'named' | 'require.resolve' | 'require' | 'star';
9
+ export type { StatementType as default };
File without changes
package/package.json ADDED
@@ -0,0 +1,197 @@
1
+ {
2
+ "name": "@flex-development/mlly",
3
+ "description": "ECMAScript module utilities",
4
+ "version": "1.0.0-alpha.1",
5
+ "keywords": [
6
+ "esm",
7
+ "module",
8
+ "typescript"
9
+ ],
10
+ "license": "BSD-3-Clause",
11
+ "homepage": "https://github.com/flex-development/mlly",
12
+ "repository": "https://github.com/flex-development/mlly.git",
13
+ "bugs": "https://github.com/flex-development/mlly/issues",
14
+ "author": {
15
+ "name": "Lexus Drumgold",
16
+ "url": "https://github.com/unicornware"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "directory": "./"
21
+ },
22
+ "type": "module",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "exports": {
27
+ ".": "./dist/index.mjs",
28
+ "./lib/*": "./dist/lib/*.mjs",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "module": "./dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
33
+ "typesVersions": {
34
+ "*": {
35
+ "./lib/*": [
36
+ "./dist/lib/*.d.mts"
37
+ ]
38
+ }
39
+ },
40
+ "scripts": {
41
+ "build": "mkbuild",
42
+ "check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn check:types && yarn check:types:build && yarn test:cov && NODE_ENV=production yarn pack -o %s-%v.tgz && yarn clean:pack",
43
+ "check:format": "prettier --check .",
44
+ "check:lint": "eslint --exit-on-fatal-error --ext cjs,cts,gql,json,jsonc,md,mjs,ts,vue,yml --max-warnings 0 .",
45
+ "check:spelling": "cspell lint --color --no-progress --relative $@ \"**\"",
46
+ "check:types": "vue-tsc -p tsconfig.json",
47
+ "check:types:build": "vue-tsc -p tsconfig.build.json",
48
+ "check:upgrades": "yarn upgrade-interactive",
49
+ "clean:build": "trash ./{dist,*.tgz}",
50
+ "clean:modules": "trash ./.yarn/{cache,*.gz} ./node_modules",
51
+ "clean:pack": "trash ./*.tgz",
52
+ "clean:test": "trash ./coverage",
53
+ "conventional-changelog": "node --loader=./loader.mjs ./node_modules/.bin/conventional-changelog -n ./changelog.config.cts",
54
+ "docs:build": "vc pull --environment=preview && vc build",
55
+ "docs:build:prod": "vc pull --environment=production && vc build --prod",
56
+ "docs:deploy": "yarn docs:build && vc deploy --prebuilt",
57
+ "docs:deploy:prod": "yarn docs:build:prod && vc deploy --prebuilt --prod",
58
+ "docs:dev": "vc env pull ./docs/.vitepress/.env && vitepress dev docs",
59
+ "docs:serve": "vitepress serve docs --port 8080",
60
+ "fix:cg": "yarn fix:format && yarn fix:lint",
61
+ "fix:dedupe": "yarn dedupe --strategy=highest",
62
+ "fix:format": "prettier --cache --write .",
63
+ "fix:lint": "yarn check:lint --cache --fix",
64
+ "_postinstall": "chmod +x .husky/* && husky install",
65
+ "postpack": "toggle-scripts +postinstall",
66
+ "postpublish": "toggle-scripts +prepack",
67
+ "prepack": "toggle-scripts -postinstall && yarn build",
68
+ "prepublishOnly": "toggle-scripts -prepack",
69
+ "recommended-bump": "conventional-recommended-bump --preset=conventionalcommits --tag-prefix=$(jq .tagPrefix package.json -r) --verbose",
70
+ "release": "bash ./scripts/release.sh",
71
+ "test": "vitest run",
72
+ "test:cov": "yarn test --coverage",
73
+ "test:watch": "vitest"
74
+ },
75
+ "dependencies": {
76
+ "@flex-development/is-builtin": "1.0.1",
77
+ "@flex-development/tutils": "5.0.1",
78
+ "import-meta-resolve": "2.1.0",
79
+ "node-package-exports": "1.0.2",
80
+ "read-pkg-up": "9.1.0",
81
+ "tsconfig-paths": "4.1.0",
82
+ "upath": "2.0.1"
83
+ },
84
+ "devDependencies": {
85
+ "@commitlint/cli": "17.2.0",
86
+ "@commitlint/config-conventional": "17.2.0",
87
+ "@commitlint/types": "17.0.0",
88
+ "@faker-js/faker": "7.6.0",
89
+ "@flex-development/docast": "github:flex-development/docast",
90
+ "@flex-development/mkbuild": "1.0.0-alpha.8",
91
+ "@graphql-eslint/eslint-plugin": "3.13.0",
92
+ "@sindresorhus/slugify": "2.1.1",
93
+ "@types/chai": "4.3.3",
94
+ "@types/chai-string": "1.4.2",
95
+ "@types/conventional-changelog": "3.1.1",
96
+ "@types/conventional-changelog-config-spec": "2.1.2",
97
+ "@types/conventional-changelog-writer": "4.0.1",
98
+ "@types/conventional-commits-parser": "3.0.2",
99
+ "@types/dateformat": "5.0.0",
100
+ "@types/dotenv-defaults": "2.0.1",
101
+ "@types/eslint": "8.4.9",
102
+ "@types/git-raw-commits": "2.0.1",
103
+ "@types/is-ci": "3.0.0",
104
+ "@types/markdown-it": "12.2.3",
105
+ "@types/node": "16.18.3",
106
+ "@types/node-notifier": "8.0.2",
107
+ "@types/prettier": "2.7.1",
108
+ "@types/unist": "2.0.6",
109
+ "@typescript-eslint/eslint-plugin": "5.42.0",
110
+ "@typescript-eslint/parser": "5.42.0",
111
+ "@vates/toggle-scripts": "1.0.0",
112
+ "@vitest/coverage-c8": "0.24.5",
113
+ "@vitest/ui": "0.24.5",
114
+ "@vuedx/typescript-plugin-vue": "0.7.6-next-1666251997.0",
115
+ "chai": "4.3.6",
116
+ "chai-each": "0.0.1",
117
+ "chai-quantifiers": "1.0.17",
118
+ "chai-string": "1.5.0",
119
+ "cheerio": "1.0.0-rc.12",
120
+ "conventional-changelog-cli": "2.2.2",
121
+ "conventional-recommended-bump": "6.1.0",
122
+ "cspell": "6.14.0",
123
+ "dotenv": "16.0.3",
124
+ "esbuild": "0.15.13",
125
+ "escape-string-regexp": "5.0.0",
126
+ "eslint": "8.26.0",
127
+ "eslint-config-prettier": "8.5.0",
128
+ "eslint-plugin-chai-expect": "3.0.0",
129
+ "eslint-plugin-jest-formatting": "3.1.0",
130
+ "eslint-plugin-jsdoc": "39.6.2",
131
+ "eslint-plugin-jsonc": "2.5.0",
132
+ "eslint-plugin-markdown": "3.0.0",
133
+ "eslint-plugin-markdownlint": "0.4.0",
134
+ "eslint-plugin-node": "11.1.0",
135
+ "eslint-plugin-prettier": "4.2.1",
136
+ "eslint-plugin-promise": "6.1.1",
137
+ "eslint-plugin-unicorn": "44.0.2",
138
+ "eslint-plugin-vue": "9.7.0",
139
+ "eslint-plugin-yml": "1.2.0",
140
+ "globby": "13.1.2",
141
+ "graphql": "16.6.0",
142
+ "graphql-config": "4.3.6",
143
+ "growl": "1.10.5",
144
+ "husky": "8.0.1",
145
+ "is-ci": "3.0.1",
146
+ "jsonc-eslint-parser": "2.1.0",
147
+ "lint-staged": "13.0.3",
148
+ "node-notifier": "10.0.1",
149
+ "prettier": "2.7.1",
150
+ "prettier-plugin-sh": "0.12.8",
151
+ "pretty-format": "29.2.1",
152
+ "pupa": "3.1.0",
153
+ "serve": "14.0.1",
154
+ "sitemap": "7.1.1",
155
+ "trash-cli": "5.0.0",
156
+ "ts-dedent": "2.2.0",
157
+ "ts-node": "10.9.1",
158
+ "typescript": "4.8.4",
159
+ "unified": "10.1.2",
160
+ "unist-util-remove": "3.1.0",
161
+ "unist-util-source": "4.0.1",
162
+ "unist-util-visit": "4.1.1",
163
+ "vercel": "28.4.14",
164
+ "version-bump-prompt": "6.1.0",
165
+ "vite": "3.2.2",
166
+ "vite-tsconfig-paths": "3.5.2",
167
+ "vitepress": "1.0.0-alpha.27",
168
+ "vitest": "0.24.5",
169
+ "vitest-github-actions-reporter": "0.9.0",
170
+ "vue": "3.2.41",
171
+ "vue-eslint-parser": "9.1.0",
172
+ "vue-tsc": "1.0.9",
173
+ "yaml-eslint-parser": "1.1.0"
174
+ },
175
+ "peerDependencies": {
176
+ "typescript": "*"
177
+ },
178
+ "peerDependenciesMeta": {
179
+ "typescript": {
180
+ "optional": true
181
+ }
182
+ },
183
+ "resolutions": {
184
+ "@ardatan/sync-fetch": "larsgw/sync-fetch#head=worker_threads",
185
+ "esbuild": "0.15.12",
186
+ "vite": "3.2.2",
187
+ "vitepress@npm:1.0.0-alpha.27": "patch:vitepress@npm%3A1.0.0-alpha.27#patches/vitepress+1.0.0-alpha.27.dev.patch"
188
+ },
189
+ "engines": {
190
+ "node": ">=14.16",
191
+ "yarn": "4.0.0-rc.14"
192
+ },
193
+ "packageManager": "yarn@4.0.0-rc.14",
194
+ "readme": "README.md",
195
+ "sideEffects": false,
196
+ "tagPrefix": ""
197
+ }