@storm-software/esbuild 0.0.1 → 0.1.0
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/README.md +9 -8
- package/dist/build.cjs +14 -0
- package/dist/build.d.cts +14 -0
- package/dist/build.d.ts +14 -0
- package/dist/build.js +14 -0
- package/dist/chunk-3C3PXJUM.cjs +28 -0
- package/dist/chunk-3GQAWCBQ.js +13 -0
- package/dist/chunk-4TW4ZA3I.js +52 -0
- package/dist/chunk-5JHKW6MG.js +126 -0
- package/dist/chunk-5S2XTAF2.cjs +337 -0
- package/dist/chunk-A6CGWMV7.cjs +126 -0
- package/dist/chunk-BGYQAVKQ.cjs +13 -0
- package/dist/chunk-DCWECOOS.cjs +22 -0
- package/dist/chunk-ELGZJRET.js +39 -0
- package/dist/chunk-GGNOJ77I.js +0 -0
- package/dist/chunk-LVDPGHWK.js +28 -0
- package/dist/chunk-MTKAAECG.cjs +101 -0
- package/dist/chunk-NVGEXPTG.cjs +39 -0
- package/dist/chunk-PCGRI6Z6.js +101 -0
- package/dist/chunk-RJQ3LCGJ.cjs +14 -0
- package/dist/chunk-RKSGVSXZ.js +22 -0
- package/dist/chunk-SFZRYJZ2.cjs +1 -0
- package/dist/chunk-WLHWKRZB.cjs +52 -0
- package/dist/chunk-YGD5JBOH.js +337 -0
- package/dist/chunk-YIAZ64WG.js +14 -0
- package/dist/config.cjs +9 -0
- package/dist/config.d.cts +15 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +9 -0
- package/dist/index.cjs +38 -0
- package/dist/index.d.cts +230 -0
- package/dist/index.d.ts +230 -0
- package/dist/index.js +38 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +19 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.js +1 -0
- package/package.json +149 -3
- package/index.cjs +0 -19751
- package/index.js +0 -19748
- package/meta.cjs.json +0 -12657
- package/meta.esm.json +0 -12669
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkRJQ3LCGJcjs = require('./chunk-RJQ3LCGJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
8
|
+
|
|
9
|
+
// src/plugins/tsc.ts
|
|
10
|
+
var _node = require('@humanfs/node');
|
|
11
|
+
var _apiextractor = require('@microsoft/api-extractor');
|
|
12
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
13
|
+
|
|
14
|
+
// src/utilities/run.ts
|
|
15
|
+
var _execa = require('execa');
|
|
16
|
+
function run(command) {
|
|
17
|
+
return _execa.execaCommand.call(void 0, command, {
|
|
18
|
+
preferLocal: true,
|
|
19
|
+
shell: true,
|
|
20
|
+
stdio: "inherit"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_chunkBGYQAVKQcjs.__name.call(void 0, run, "run");
|
|
24
|
+
|
|
25
|
+
// src/plugins/tsc.ts
|
|
26
|
+
function bundleTypeDefinitions(filename, outfile, externals) {
|
|
27
|
+
const { dependencies, peerDependencies, devDependencies } = _chunkBGYQAVKQcjs.__require.call(void 0, `${process.cwd()}/package.json`);
|
|
28
|
+
const dependenciesKeys = Object.keys(_nullishCoalesce(dependencies, () => ( {}))).flatMap((p) => [
|
|
29
|
+
p,
|
|
30
|
+
getTypeDependencyPackageName(p)
|
|
31
|
+
]);
|
|
32
|
+
const peerDependenciesKeys = Object.keys(_nullishCoalesce(peerDependencies, () => ( {}))).flatMap((p) => [
|
|
33
|
+
p,
|
|
34
|
+
getTypeDependencyPackageName(p)
|
|
35
|
+
]);
|
|
36
|
+
const devDependenciesKeys = Object.keys(_nullishCoalesce(devDependencies, () => ( {}))).flatMap((p) => [
|
|
37
|
+
p,
|
|
38
|
+
getTypeDependencyPackageName(p)
|
|
39
|
+
]);
|
|
40
|
+
const includeDeps = devDependenciesKeys;
|
|
41
|
+
const excludeDeps = /* @__PURE__ */ new Set([
|
|
42
|
+
...dependenciesKeys,
|
|
43
|
+
...peerDependenciesKeys,
|
|
44
|
+
...externals
|
|
45
|
+
]);
|
|
46
|
+
const bundledPackages = includeDeps.filter((dep) => !excludeDeps.has(dep));
|
|
47
|
+
const extractorConfig = _apiextractor.ExtractorConfig.prepare({
|
|
48
|
+
configObject: {
|
|
49
|
+
projectFolder: process.cwd(),
|
|
50
|
+
mainEntryPointFilePath: filename,
|
|
51
|
+
bundledPackages,
|
|
52
|
+
compiler: {
|
|
53
|
+
tsconfigFilePath: _path2.default.join(process.cwd(), "tsconfig.build.json"),
|
|
54
|
+
overrideTsconfig: {
|
|
55
|
+
compilerOptions: {
|
|
56
|
+
paths: {}
|
|
57
|
+
// bug with api extract + paths
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
dtsRollup: {
|
|
62
|
+
enabled: true,
|
|
63
|
+
untrimmedFilePath: _path2.default.join(process.cwd(), `${outfile}.d.ts`)
|
|
64
|
+
},
|
|
65
|
+
tsdocMetadata: {
|
|
66
|
+
enabled: false
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
packageJsonFullPath: _path2.default.join(process.cwd(), "package.json"),
|
|
70
|
+
configObjectFullPath: void 0
|
|
71
|
+
});
|
|
72
|
+
const extractorResult = _apiextractor.Extractor.invoke(extractorConfig, {
|
|
73
|
+
showVerboseMessages: true,
|
|
74
|
+
localBuild: true
|
|
75
|
+
});
|
|
76
|
+
if (extractorResult.succeeded === false) {
|
|
77
|
+
_chunkRJQ3LCGJcjs.writeLog.call(void 0, "error", `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
|
|
78
|
+
throw new Error("API Extractor completed with errors");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
_chunkBGYQAVKQcjs.__name.call(void 0, bundleTypeDefinitions, "bundleTypeDefinitions");
|
|
82
|
+
var tscPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (emitTypes) => ({
|
|
83
|
+
name: "tscPlugin",
|
|
84
|
+
setup(build) {
|
|
85
|
+
const options = build.initialOptions;
|
|
86
|
+
if (emitTypes === false) return;
|
|
87
|
+
build.onStart(async () => {
|
|
88
|
+
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
89
|
+
await run(`tsc --project ${options.tsconfig} --paths null`);
|
|
90
|
+
}
|
|
91
|
+
if (options.bundle && options.outfile && _optionalChain([options, 'access', _ => _.entryPoints, 'optionalAccess', _2 => _2[0], 'access', _3 => _3.endsWith, 'call', _4 => _4(".ts")])) {
|
|
92
|
+
const tsconfig = _chunkBGYQAVKQcjs.__require.call(void 0, `${process.cwd()}/${options.tsconfig}`);
|
|
93
|
+
const typeOutDir = _nullishCoalesce(_optionalChain([tsconfig, 'optionalAccess', _5 => _5.compilerOptions, 'optionalAccess', _6 => _6.outDir]), () => ( "."));
|
|
94
|
+
const entryPoint = _optionalChain([options, 'access', _7 => _7.entryPoints, 'optionalAccess', _8 => _8[0], 'access', _9 => _9.replace, 'call', _10 => _10(/\.ts$/, "")]);
|
|
95
|
+
const bundlePath = options.outfile.replace(/\.m?js$/, "");
|
|
96
|
+
let dtsPath;
|
|
97
|
+
if (await _node.hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`)) {
|
|
98
|
+
dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint}.d.ts`;
|
|
99
|
+
} else if (await _node.hfs.isFile(`${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`)) {
|
|
100
|
+
dtsPath = `${process.cwd()}/${typeOutDir}/${entryPoint.replace(/^src\//, "")}.d.ts`;
|
|
101
|
+
}
|
|
102
|
+
const ext = options.format === "esm" ? "d.mts" : "d.ts";
|
|
103
|
+
if (process.env.WATCH !== "true" && process.env.DEV !== "true") {
|
|
104
|
+
bundleTypeDefinitions(dtsPath, bundlePath, _nullishCoalesce(options.external, () => ( [])));
|
|
105
|
+
const dtsContents = await _node.hfs.text(`${bundlePath}.d.ts`);
|
|
106
|
+
await _node.hfs.write(`${bundlePath}.${ext}`, dtsContents);
|
|
107
|
+
} else {
|
|
108
|
+
await _node.hfs.write(`${bundlePath}.${ext}`, `export * from '${process.cwd()}/${entryPoint}'`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}), "tscPlugin");
|
|
114
|
+
function getTypeDependencyPackageName(npmPackage) {
|
|
115
|
+
if (npmPackage.startsWith("@")) {
|
|
116
|
+
const [scope, name] = npmPackage.split("/");
|
|
117
|
+
return `@types/${_optionalChain([scope, 'optionalAccess', _11 => _11.slice, 'call', _12 => _12(1)])}__${name}`;
|
|
118
|
+
}
|
|
119
|
+
return `@types/${npmPackage}`;
|
|
120
|
+
}
|
|
121
|
+
_chunkBGYQAVKQcjs.__name.call(void 0, getTypeDependencyPackageName, "getTypeDependencyPackageName");
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
exports.run = run; exports.tscPlugin = tscPlugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.__name = __name; exports.__require = __require;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkRJQ3LCGJcjs = require('./chunk-RJQ3LCGJ.cjs');
|
|
4
|
+
|
|
5
|
+
// src/plugins/on-error.ts
|
|
6
|
+
var onErrorPlugin = {
|
|
7
|
+
name: "storm:on-error",
|
|
8
|
+
setup(build) {
|
|
9
|
+
build.onEnd((result) => {
|
|
10
|
+
if (result.errors.length > 0 && process.env.WATCH !== "true") {
|
|
11
|
+
_chunkRJQ3LCGJcjs.writeLog.call(void 0, "error", `The following errors occurred during the build:
|
|
12
|
+
${result.errors.map((error) => error.text).join("\n")}
|
|
13
|
+
`);
|
|
14
|
+
throw new Error("ESBuild process failed with errors.");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.onErrorPlugin = onErrorPlugin;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
var DEFAULT_BUILD_OPTIONS = {
|
|
3
|
+
platform: "node",
|
|
4
|
+
target: "ES2021",
|
|
5
|
+
logLevel: "error",
|
|
6
|
+
tsconfig: "tsconfig.json",
|
|
7
|
+
metafile: true
|
|
8
|
+
};
|
|
9
|
+
var adapterConfig = [
|
|
10
|
+
{
|
|
11
|
+
name: "cjs",
|
|
12
|
+
format: "cjs",
|
|
13
|
+
bundle: true,
|
|
14
|
+
entryPoints: [
|
|
15
|
+
"src/index.ts"
|
|
16
|
+
],
|
|
17
|
+
outExtension: {
|
|
18
|
+
".js": ".js"
|
|
19
|
+
},
|
|
20
|
+
emitTypes: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "esm",
|
|
24
|
+
format: "esm",
|
|
25
|
+
bundle: true,
|
|
26
|
+
entryPoints: [
|
|
27
|
+
"src/index.ts"
|
|
28
|
+
],
|
|
29
|
+
outExtension: {
|
|
30
|
+
".js": ".mjs"
|
|
31
|
+
},
|
|
32
|
+
emitTypes: true
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
DEFAULT_BUILD_OPTIONS,
|
|
38
|
+
adapterConfig
|
|
39
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./chunk-3GQAWCBQ.js";
|
|
4
|
+
|
|
5
|
+
// src/plugins/fix-imports.ts
|
|
6
|
+
var fixImportsPlugin = {
|
|
7
|
+
name: "storm:fix-imports",
|
|
8
|
+
setup(build) {
|
|
9
|
+
build.onResolve({
|
|
10
|
+
filter: /^spdx-exceptions/
|
|
11
|
+
}, () => {
|
|
12
|
+
return {
|
|
13
|
+
path: __require.resolve("spdx-exceptions")
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
build.onResolve({
|
|
17
|
+
filter: /^spdx-license-ids/
|
|
18
|
+
}, () => {
|
|
19
|
+
return {
|
|
20
|
+
path: __require.resolve("spdx-license-ids")
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
fixImportsPlugin
|
|
28
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkRJQ3LCGJcjs = require('./chunk-RJQ3LCGJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
8
|
+
|
|
9
|
+
// src/plugins/deps-check.ts
|
|
10
|
+
var _module = require('module');
|
|
11
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
12
|
+
var unusedIgnore = [
|
|
13
|
+
// these are our dev dependencies
|
|
14
|
+
/@types\/.*?/,
|
|
15
|
+
/@typescript-eslint.*?/,
|
|
16
|
+
/eslint.*?/,
|
|
17
|
+
"esbuild",
|
|
18
|
+
"husky",
|
|
19
|
+
"is-ci",
|
|
20
|
+
"lint-staged",
|
|
21
|
+
"prettier",
|
|
22
|
+
"typescript",
|
|
23
|
+
"ts-node",
|
|
24
|
+
"ts-jest",
|
|
25
|
+
"@swc/core",
|
|
26
|
+
"@swc/jest",
|
|
27
|
+
"jest",
|
|
28
|
+
// these are missing 3rd party deps
|
|
29
|
+
"spdx-exceptions",
|
|
30
|
+
"spdx-license-ids",
|
|
31
|
+
// type-only, so it is not detected
|
|
32
|
+
"ts-toolbelt",
|
|
33
|
+
// these are indirectly used by build
|
|
34
|
+
"buffer"
|
|
35
|
+
];
|
|
36
|
+
var missingIgnore = [
|
|
37
|
+
".prisma",
|
|
38
|
+
"@prisma/client",
|
|
39
|
+
"ts-toolbelt"
|
|
40
|
+
];
|
|
41
|
+
var depsCheckPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (bundle) => ({
|
|
42
|
+
name: "storm:deps-check",
|
|
43
|
+
setup(build) {
|
|
44
|
+
const pkgJsonPath = _path2.default.join(process.cwd(), "package.json");
|
|
45
|
+
const pkgContents = _chunkBGYQAVKQcjs.__require.call(void 0, pkgJsonPath);
|
|
46
|
+
const regDependencies = Object.keys(_nullishCoalesce(pkgContents["dependencies"], () => ( {})));
|
|
47
|
+
const devDependencies = Object.keys(_nullishCoalesce(pkgContents["devDependencies"], () => ( {})));
|
|
48
|
+
const peerDependencies = Object.keys(_nullishCoalesce(pkgContents["peerDependencies"], () => ( {})));
|
|
49
|
+
const dependencies = [
|
|
50
|
+
...regDependencies,
|
|
51
|
+
...bundle ? devDependencies : []
|
|
52
|
+
];
|
|
53
|
+
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
54
|
+
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
55
|
+
build.onResolve({
|
|
56
|
+
filter: onlyPackages
|
|
57
|
+
}, (args) => {
|
|
58
|
+
if (args.importer.includes(process.cwd())) {
|
|
59
|
+
if (args.path[0] === "@") {
|
|
60
|
+
const [org, pkg] = args.path.split("/");
|
|
61
|
+
collectedDependencies.add(`${org}/${pkg}`);
|
|
62
|
+
} else {
|
|
63
|
+
const [pkg] = args.path.split("/");
|
|
64
|
+
collectedDependencies.add(pkg);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
external: true
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
build.onEnd(() => {
|
|
72
|
+
const unusedDependencies = [
|
|
73
|
+
...dependencies
|
|
74
|
+
].filter((dep) => {
|
|
75
|
+
return !collectedDependencies.has(dep) || _module.builtinModules.includes(dep);
|
|
76
|
+
});
|
|
77
|
+
const missingDependencies = [
|
|
78
|
+
...collectedDependencies
|
|
79
|
+
].filter((dep) => {
|
|
80
|
+
return !dependencies.includes(dep) && !_module.builtinModules.includes(dep);
|
|
81
|
+
});
|
|
82
|
+
const filteredUnusedDeps = unusedDependencies.filter((dep) => {
|
|
83
|
+
return !unusedIgnore.some((pattern) => dep.match(pattern));
|
|
84
|
+
});
|
|
85
|
+
const filteredMissingDeps = missingDependencies.filter((dep) => {
|
|
86
|
+
return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
|
|
87
|
+
});
|
|
88
|
+
_chunkRJQ3LCGJcjs.writeLog.call(void 0, "warn", `unusedDependencies: ${JSON.stringify(filteredUnusedDeps)}`);
|
|
89
|
+
_chunkRJQ3LCGJcjs.writeLog.call(void 0, "warn", `missingDependencies: ${JSON.stringify(filteredMissingDeps)}`);
|
|
90
|
+
if (filteredMissingDeps.length > 0) {
|
|
91
|
+
throw new Error(`Missing dependencies detected - please install them:
|
|
92
|
+
${JSON.stringify(filteredMissingDeps)}
|
|
93
|
+
`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}), "depsCheckPlugin");
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
exports.depsCheckPlugin = depsCheckPlugin;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/config.ts
|
|
2
|
+
var DEFAULT_BUILD_OPTIONS = {
|
|
3
|
+
platform: "node",
|
|
4
|
+
target: "ES2021",
|
|
5
|
+
logLevel: "error",
|
|
6
|
+
tsconfig: "tsconfig.json",
|
|
7
|
+
metafile: true
|
|
8
|
+
};
|
|
9
|
+
var adapterConfig = [
|
|
10
|
+
{
|
|
11
|
+
name: "cjs",
|
|
12
|
+
format: "cjs",
|
|
13
|
+
bundle: true,
|
|
14
|
+
entryPoints: [
|
|
15
|
+
"src/index.ts"
|
|
16
|
+
],
|
|
17
|
+
outExtension: {
|
|
18
|
+
".js": ".js"
|
|
19
|
+
},
|
|
20
|
+
emitTypes: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "esm",
|
|
24
|
+
format: "esm",
|
|
25
|
+
bundle: true,
|
|
26
|
+
entryPoints: [
|
|
27
|
+
"src/index.ts"
|
|
28
|
+
],
|
|
29
|
+
outExtension: {
|
|
30
|
+
".js": ".mjs"
|
|
31
|
+
},
|
|
32
|
+
emitTypes: true
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
exports.DEFAULT_BUILD_OPTIONS = DEFAULT_BUILD_OPTIONS; exports.adapterConfig = adapterConfig;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeLog
|
|
3
|
+
} from "./chunk-YIAZ64WG.js";
|
|
4
|
+
import {
|
|
5
|
+
__name,
|
|
6
|
+
__require
|
|
7
|
+
} from "./chunk-3GQAWCBQ.js";
|
|
8
|
+
|
|
9
|
+
// src/plugins/deps-check.ts
|
|
10
|
+
import { builtinModules } from "node:module";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
var unusedIgnore = [
|
|
13
|
+
// these are our dev dependencies
|
|
14
|
+
/@types\/.*?/,
|
|
15
|
+
/@typescript-eslint.*?/,
|
|
16
|
+
/eslint.*?/,
|
|
17
|
+
"esbuild",
|
|
18
|
+
"husky",
|
|
19
|
+
"is-ci",
|
|
20
|
+
"lint-staged",
|
|
21
|
+
"prettier",
|
|
22
|
+
"typescript",
|
|
23
|
+
"ts-node",
|
|
24
|
+
"ts-jest",
|
|
25
|
+
"@swc/core",
|
|
26
|
+
"@swc/jest",
|
|
27
|
+
"jest",
|
|
28
|
+
// these are missing 3rd party deps
|
|
29
|
+
"spdx-exceptions",
|
|
30
|
+
"spdx-license-ids",
|
|
31
|
+
// type-only, so it is not detected
|
|
32
|
+
"ts-toolbelt",
|
|
33
|
+
// these are indirectly used by build
|
|
34
|
+
"buffer"
|
|
35
|
+
];
|
|
36
|
+
var missingIgnore = [
|
|
37
|
+
".prisma",
|
|
38
|
+
"@prisma/client",
|
|
39
|
+
"ts-toolbelt"
|
|
40
|
+
];
|
|
41
|
+
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
42
|
+
name: "storm:deps-check",
|
|
43
|
+
setup(build) {
|
|
44
|
+
const pkgJsonPath = path.join(process.cwd(), "package.json");
|
|
45
|
+
const pkgContents = __require(pkgJsonPath);
|
|
46
|
+
const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
|
|
47
|
+
const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
|
|
48
|
+
const peerDependencies = Object.keys(pkgContents["peerDependencies"] ?? {});
|
|
49
|
+
const dependencies = [
|
|
50
|
+
...regDependencies,
|
|
51
|
+
...bundle ? devDependencies : []
|
|
52
|
+
];
|
|
53
|
+
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
54
|
+
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
55
|
+
build.onResolve({
|
|
56
|
+
filter: onlyPackages
|
|
57
|
+
}, (args) => {
|
|
58
|
+
if (args.importer.includes(process.cwd())) {
|
|
59
|
+
if (args.path[0] === "@") {
|
|
60
|
+
const [org, pkg] = args.path.split("/");
|
|
61
|
+
collectedDependencies.add(`${org}/${pkg}`);
|
|
62
|
+
} else {
|
|
63
|
+
const [pkg] = args.path.split("/");
|
|
64
|
+
collectedDependencies.add(pkg);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
external: true
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
build.onEnd(() => {
|
|
72
|
+
const unusedDependencies = [
|
|
73
|
+
...dependencies
|
|
74
|
+
].filter((dep) => {
|
|
75
|
+
return !collectedDependencies.has(dep) || builtinModules.includes(dep);
|
|
76
|
+
});
|
|
77
|
+
const missingDependencies = [
|
|
78
|
+
...collectedDependencies
|
|
79
|
+
].filter((dep) => {
|
|
80
|
+
return !dependencies.includes(dep) && !builtinModules.includes(dep);
|
|
81
|
+
});
|
|
82
|
+
const filteredUnusedDeps = unusedDependencies.filter((dep) => {
|
|
83
|
+
return !unusedIgnore.some((pattern) => dep.match(pattern));
|
|
84
|
+
});
|
|
85
|
+
const filteredMissingDeps = missingDependencies.filter((dep) => {
|
|
86
|
+
return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
|
|
87
|
+
});
|
|
88
|
+
writeLog("warn", `unusedDependencies: ${JSON.stringify(filteredUnusedDeps)}`);
|
|
89
|
+
writeLog("warn", `missingDependencies: ${JSON.stringify(filteredMissingDeps)}`);
|
|
90
|
+
if (filteredMissingDeps.length > 0) {
|
|
91
|
+
throw new Error(`Missing dependencies detected - please install them:
|
|
92
|
+
${JSON.stringify(filteredMissingDeps)}
|
|
93
|
+
`);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}), "depsCheckPlugin");
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
depsCheckPlugin
|
|
101
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
4
|
+
|
|
5
|
+
// src/utilities/log.ts
|
|
6
|
+
var _consola = require('consola');
|
|
7
|
+
function writeLog(type, ...args) {
|
|
8
|
+
_consola.consola[type]("[Storm]", ...args);
|
|
9
|
+
}
|
|
10
|
+
_chunkBGYQAVKQcjs.__name.call(void 0, writeLog, "writeLog");
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.writeLog = writeLog;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeLog
|
|
3
|
+
} from "./chunk-YIAZ64WG.js";
|
|
4
|
+
|
|
5
|
+
// src/plugins/on-error.ts
|
|
6
|
+
var onErrorPlugin = {
|
|
7
|
+
name: "storm:on-error",
|
|
8
|
+
setup(build) {
|
|
9
|
+
build.onEnd((result) => {
|
|
10
|
+
if (result.errors.length > 0 && process.env.WATCH !== "true") {
|
|
11
|
+
writeLog("error", `The following errors occurred during the build:
|
|
12
|
+
${result.errors.map((error) => error.text).join("\n")}
|
|
13
|
+
`);
|
|
14
|
+
throw new Error("ESBuild process failed with errors.");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
onErrorPlugin
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
|
|
5
|
+
|
|
6
|
+
// src/plugins/resolve-paths.ts
|
|
7
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
8
|
+
function resolvePathsConfig(options, cwd) {
|
|
9
|
+
if (_optionalChain([options, 'optionalAccess', _ => _.compilerOptions, 'optionalAccess', _2 => _2.paths])) {
|
|
10
|
+
const paths = Object.entries(options.compilerOptions.paths);
|
|
11
|
+
const resolvedPaths = paths.map(([key, paths2]) => {
|
|
12
|
+
return [
|
|
13
|
+
key,
|
|
14
|
+
paths2.map((v) => _path2.default.resolve(cwd, v))
|
|
15
|
+
];
|
|
16
|
+
});
|
|
17
|
+
return Object.fromEntries(resolvedPaths);
|
|
18
|
+
}
|
|
19
|
+
if (options.extends) {
|
|
20
|
+
const extendsPath = _path2.default.resolve(cwd, options.extends);
|
|
21
|
+
const extendsDir = _path2.default.dirname(extendsPath);
|
|
22
|
+
const extendsConfig = _chunkBGYQAVKQcjs.__require.call(void 0, extendsPath);
|
|
23
|
+
return resolvePathsConfig(extendsConfig, extendsDir);
|
|
24
|
+
}
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
_chunkBGYQAVKQcjs.__name.call(void 0, resolvePathsConfig, "resolvePathsConfig");
|
|
28
|
+
var resolvePathsPlugin = {
|
|
29
|
+
name: "storm:resolve-paths",
|
|
30
|
+
setup(build) {
|
|
31
|
+
const parentTsConfig = _chunkBGYQAVKQcjs.__require.call(void 0, `${process.cwd()}/${build.initialOptions.tsconfig}`);
|
|
32
|
+
const resolvedTsPaths = resolvePathsConfig(parentTsConfig, process.cwd());
|
|
33
|
+
const packagesRegex = new RegExp(`^(${Object.keys(resolvedTsPaths).join("|")})$`);
|
|
34
|
+
build.onResolve({
|
|
35
|
+
filter: packagesRegex
|
|
36
|
+
}, (args) => {
|
|
37
|
+
if (_optionalChain([build, 'access', _3 => _3.initialOptions, 'access', _4 => _4.external, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6(args.path)])) {
|
|
38
|
+
return {
|
|
39
|
+
path: args.path,
|
|
40
|
+
external: true
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
path: `${resolvedTsPaths[args.path][0]}/index.ts`
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
exports.resolvePathsPlugin = resolvePathsPlugin;
|