@storm-software/esbuild 0.34.2 → 0.34.3
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 +2 -1
- package/bin/esbuild.cjs +12143 -158
- package/dist/assets.cjs +9 -0
- package/dist/assets.d.cts +16 -0
- package/dist/assets.d.ts +16 -0
- package/dist/assets.js +9 -0
- package/dist/build.cjs +13 -17
- package/dist/build.d.cts +3 -13
- package/dist/build.d.ts +3 -13
- package/dist/build.js +14 -18
- package/dist/chunk-2CM3VAO5.cjs +119 -0
- package/dist/{chunk-Y7JBB452.js → chunk-4D6ICA75.js} +36 -3
- package/dist/{chunk-5RVOO3YF.js → chunk-ABRK5MYP.js} +3 -5
- package/dist/chunk-CVOQEYHW.cjs +117 -0
- package/dist/{chunk-3PF5YMWK.js → chunk-DNZNN5SK.js} +2 -2
- package/dist/chunk-EBTMX5WL.js +117 -0
- package/dist/chunk-ECCVVXNX.js +100 -0
- package/dist/chunk-EDLA3ZZN.js +26 -0
- package/dist/{chunk-GJHRTQAS.cjs → chunk-EVDNG72R.cjs} +35 -37
- package/dist/{chunk-TDBBRZTC.cjs → chunk-FQQYNAPT.cjs} +111 -189
- package/dist/{chunk-QKJ7KLDL.cjs → chunk-G66JI4BS.cjs} +5 -7
- package/dist/{chunk-SKJRUPDP.js → chunk-NJJBR57W.js} +24 -102
- package/dist/{chunk-STCE44IS.js → chunk-OCDIIBBZ.js} +2 -2
- package/dist/{chunk-M3AOQRGN.cjs → chunk-PTHYT3U2.cjs} +188 -582
- package/dist/chunk-QVMJLFU5.cjs +26 -0
- package/dist/{chunk-DPRINYB6.js → chunk-QWTKBUQW.js} +40 -434
- package/dist/chunk-R2KKGNQL.js +119 -0
- package/dist/{chunk-TH2QFJHI.cjs → chunk-RK34D7S5.cjs} +6 -6
- package/dist/chunk-SLSBBNRF.cjs +52 -0
- package/dist/{chunk-VQHKIS7J.js → chunk-TSQT5MWW.js} +2 -4
- package/dist/{chunk-BNPCRQK4.cjs → chunk-VTBMJYSM.cjs} +6 -6
- package/dist/chunk-WLJT52I3.cjs +100 -0
- package/dist/chunk-WXURMFT7.js +52 -0
- package/dist/{chunk-VPTKC3UK.cjs → chunk-YHMM6RY5.cjs} +42 -9
- package/dist/clean.cjs +4 -5
- package/dist/clean.d.cts +1 -2
- package/dist/clean.d.ts +1 -2
- package/dist/clean.js +3 -4
- package/dist/config.cjs +5 -14
- package/dist/config.d.cts +4 -6
- package/dist/config.d.ts +4 -6
- package/dist/config.js +6 -15
- package/dist/context.cjs +11 -0
- package/dist/context.d.cts +16 -0
- package/dist/context.d.ts +16 -0
- package/dist/context.js +11 -0
- package/dist/index.cjs +14 -52
- package/dist/index.d.cts +3 -216
- package/dist/index.d.ts +3 -216
- package/dist/index.js +15 -53
- package/dist/package-json.cjs +9 -0
- package/dist/package-json.d.cts +16 -0
- package/dist/package-json.d.ts +16 -0
- package/dist/package-json.js +9 -0
- package/dist/plugins/deps-check.cjs +4 -5
- package/dist/plugins/deps-check.js +3 -4
- package/dist/plugins/resolve-paths.cjs +3 -4
- package/dist/plugins/resolve-paths.d.cts +3 -4
- package/dist/plugins/resolve-paths.d.ts +3 -4
- package/dist/plugins/resolve-paths.js +2 -3
- package/dist/tsup.cjs +8 -0
- package/dist/tsup.d.cts +16 -0
- package/dist/tsup.d.ts +16 -0
- package/dist/tsup.js +8 -0
- package/dist/types.d.cts +1 -2
- package/dist/types.d.ts +1 -2
- package/dist/watch.cjs +111 -0
- package/dist/watch.d.cts +18 -0
- package/dist/watch.d.ts +18 -0
- package/dist/watch.js +111 -0
- package/package.json +59 -38
- package/dist/chunk-27VOV3G4.cjs +0 -23
- package/dist/chunk-2TG2H4XL.js +0 -29
- package/dist/chunk-2X5ZMEAN.js +0 -167
- package/dist/chunk-3QHFCKSI.js +0 -140
- package/dist/chunk-AZON722Q.js +0 -23
- package/dist/chunk-B4CUDMY2.cjs +0 -39
- package/dist/chunk-BOFHC4OE.cjs +0 -26
- package/dist/chunk-BWSIRV3D.js +0 -26
- package/dist/chunk-CCEWV2BR.js +0 -39
- package/dist/chunk-CGMLIVTB.cjs +0 -167
- package/dist/chunk-ILJQ4NCE.cjs +0 -29
- package/dist/chunk-N62ZR7UV.cjs +0 -140
- package/dist/chunk-RLQJRD62.cjs +0 -27
- package/dist/chunk-UYE6LM4C.js +0 -60
- package/dist/chunk-XLUZXKDY.js +0 -27
- package/dist/chunk-Y5SBBYX3.cjs +0 -60
- package/dist/plugins/esm-split-code-to-cjs.cjs +0 -7
- package/dist/plugins/esm-split-code-to-cjs.d.cts +0 -15
- package/dist/plugins/esm-split-code-to-cjs.d.ts +0 -15
- package/dist/plugins/esm-split-code-to-cjs.js +0 -7
- package/dist/plugins/fix-imports.cjs +0 -7
- package/dist/plugins/fix-imports.d.cts +0 -14
- package/dist/plugins/fix-imports.d.ts +0 -14
- package/dist/plugins/fix-imports.js +0 -7
- package/dist/plugins/native-node-module.cjs +0 -7
- package/dist/plugins/native-node-module.d.cts +0 -11
- package/dist/plugins/native-node-module.d.ts +0 -11
- package/dist/plugins/native-node-module.js +0 -7
- package/dist/plugins/node-protocol.cjs +0 -7
- package/dist/plugins/node-protocol.d.cts +0 -15
- package/dist/plugins/node-protocol.d.ts +0 -15
- package/dist/plugins/node-protocol.js +0 -7
- package/dist/plugins/on-error.cjs +0 -9
- package/dist/plugins/on-error.d.cts +0 -14
- package/dist/plugins/on-error.d.ts +0 -14
- package/dist/plugins/on-error.js +0 -9
- package/dist/plugins/tsc.cjs +0 -9
- package/dist/plugins/tsc.d.cts +0 -14
- package/dist/plugins/tsc.d.ts +0 -14
- package/dist/plugins/tsc.js +0 -9
- package/dist/tsc.cjs +0 -17
- package/dist/tsc.d.cts +0 -21
- package/dist/tsc.d.ts +0 -21
- package/dist/tsc.js +0 -17
- package/dist/types-B4jbZA4j.d.cts +0 -1286
- package/dist/types-B4jbZA4j.d.ts +0 -1286
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addPackageDependencies,
|
|
3
|
+
addWorkspacePackageJsonFields
|
|
4
|
+
} from "./chunk-NJJBR57W.js";
|
|
5
|
+
import {
|
|
6
|
+
getStopwatch,
|
|
7
|
+
writeDebug
|
|
8
|
+
} from "./chunk-TSQT5MWW.js";
|
|
9
|
+
import {
|
|
10
|
+
__name,
|
|
11
|
+
joinPaths
|
|
12
|
+
} from "./chunk-4D6ICA75.js";
|
|
13
|
+
|
|
14
|
+
// src/package-json.ts
|
|
15
|
+
import { writeJsonFile } from "@nx/devkit";
|
|
16
|
+
import { existsSync } from "node:fs";
|
|
17
|
+
import hf from "node:fs/promises";
|
|
18
|
+
async function generatePackageJson(context) {
|
|
19
|
+
if (context.options.generatePackageJson !== false && existsSync(joinPaths(context.options.projectRoot, "package.json"))) {
|
|
20
|
+
writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
|
|
21
|
+
const stopwatch = getStopwatch("Write package.json file");
|
|
22
|
+
const packageJsonPath = joinPaths(context.options.projectRoot, "project.json");
|
|
23
|
+
if (!existsSync(packageJsonPath)) {
|
|
24
|
+
throw new Error("Cannot find package.json configuration");
|
|
25
|
+
}
|
|
26
|
+
const packageJsonFile = await hf.readFile(joinPaths(context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
|
|
27
|
+
let packageJson = JSON.parse(packageJsonFile);
|
|
28
|
+
if (!packageJson) {
|
|
29
|
+
throw new Error("Cannot find package.json configuration file");
|
|
30
|
+
}
|
|
31
|
+
packageJson = await addPackageDependencies(context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
|
|
32
|
+
packageJson = await addWorkspacePackageJsonFields(context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
|
|
33
|
+
if (context.options.entry) {
|
|
34
|
+
packageJson.exports ??= {};
|
|
35
|
+
packageJson.exports["./package.json"] ??= "./package.json";
|
|
36
|
+
const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
|
|
37
|
+
if (entryPoints.length > 0) {
|
|
38
|
+
const defaultEntry = entryPoints.includes("index") ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entryPoints[0]}`;
|
|
39
|
+
const isEsm = Array.isArray(context.options.format) ? context.options.format.includes("esm") : context.options.format === "esm";
|
|
40
|
+
const isCjs = Array.isArray(context.options.format) ? context.options.format.includes("cjs") : context.options.format === "cjs";
|
|
41
|
+
const isDts = context.options.dts || context.options.experimentalDts;
|
|
42
|
+
packageJson.exports["."] ??= `${defaultEntry}.${isEsm ? "mjs" : isCjs ? "cjs" : "js"}`;
|
|
43
|
+
for (const entryPoint of entryPoints) {
|
|
44
|
+
packageJson.exports[`./${entryPoint}`] ??= {};
|
|
45
|
+
if (isEsm) {
|
|
46
|
+
if (isDts) {
|
|
47
|
+
packageJson.exports[`./${entryPoint}`].import = {
|
|
48
|
+
types: `./dist/${entryPoint}.d.mts`,
|
|
49
|
+
default: `./dist/${entryPoint}.mjs`
|
|
50
|
+
};
|
|
51
|
+
} else {
|
|
52
|
+
packageJson.exports[`./${entryPoint}`].import = `./dist/${entryPoint}.mjs`;
|
|
53
|
+
}
|
|
54
|
+
if (isDts) {
|
|
55
|
+
packageJson.exports[`./${entryPoint}`].default = {
|
|
56
|
+
types: `./dist/${entryPoint}.d.mts`,
|
|
57
|
+
default: `./dist/${entryPoint}.mjs`
|
|
58
|
+
};
|
|
59
|
+
} else {
|
|
60
|
+
packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.mjs`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (isCjs) {
|
|
64
|
+
if (isDts) {
|
|
65
|
+
packageJson.exports[`./${entryPoint}`].require = {
|
|
66
|
+
types: `./dist/${entryPoint}.d.cts`,
|
|
67
|
+
default: `./dist/${entryPoint}.cjs`
|
|
68
|
+
};
|
|
69
|
+
} else {
|
|
70
|
+
packageJson.exports[`./${entryPoint}`].require = `./dist/${entryPoint}.cjs`;
|
|
71
|
+
}
|
|
72
|
+
if (!isEsm) {
|
|
73
|
+
if (isDts) {
|
|
74
|
+
packageJson.exports[`./${entryPoint}`].default = {
|
|
75
|
+
types: `./dist/${entryPoint}.d.cts`,
|
|
76
|
+
default: `./dist/${entryPoint}.cjs`
|
|
77
|
+
};
|
|
78
|
+
} else {
|
|
79
|
+
packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.cjs`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!isEsm && !isCjs) {
|
|
84
|
+
if (isDts) {
|
|
85
|
+
packageJson.exports[`./${entryPoint}`].default = {
|
|
86
|
+
types: `./dist/${entryPoint}.d.ts`,
|
|
87
|
+
default: `./dist/${entryPoint}.js`
|
|
88
|
+
};
|
|
89
|
+
} else {
|
|
90
|
+
packageJson.exports[`./${entryPoint}`].default = `./dist/${entryPoint}.js`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (isEsm) {
|
|
95
|
+
packageJson.module = `${defaultEntry}.mjs`;
|
|
96
|
+
} else {
|
|
97
|
+
packageJson.main = `${defaultEntry}.cjs`;
|
|
98
|
+
}
|
|
99
|
+
if (isDts) {
|
|
100
|
+
packageJson.types = `${defaultEntry}.d.${isEsm ? "mts" : isCjs ? "cts" : "ts"}`;
|
|
101
|
+
}
|
|
102
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
103
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
104
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
105
|
+
}
|
|
106
|
+
return ret;
|
|
107
|
+
}, packageJson.exports);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
await writeJsonFile(joinPaths(context.outputPath, "package.json"), packageJson);
|
|
111
|
+
stopwatch();
|
|
112
|
+
}
|
|
113
|
+
return context;
|
|
114
|
+
}
|
|
115
|
+
__name(generatePackageJson, "generatePackageJson");
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
generatePackageJson
|
|
119
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkEVDNG72Rcjs = require('./chunk-EVDNG72R.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkYHMM6RY5cjs = require('./chunk-YHMM6RY5.cjs');
|
|
8
8
|
|
|
9
9
|
// src/clean.ts
|
|
10
10
|
var _promises = require('fs/promises');
|
|
11
11
|
async function clean(name = "ESBuild", directory, config) {
|
|
12
|
-
|
|
13
|
-
const stopwatch =
|
|
12
|
+
_chunkEVDNG72Rcjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
|
|
13
|
+
const stopwatch = _chunkEVDNG72Rcjs.getStopwatch.call(void 0, `${name} output clean`);
|
|
14
14
|
await cleanDirectories(directory);
|
|
15
15
|
stopwatch();
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
_chunkYHMM6RY5cjs.__name.call(void 0, clean, "clean");
|
|
18
18
|
async function cleanDirectories(directory) {
|
|
19
19
|
await _promises.rm.call(void 0, directory, {
|
|
20
20
|
recursive: true,
|
|
21
21
|
force: true
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
_chunkYHMM6RY5cjs.__name.call(void 0, cleanDirectories, "cleanDirectories");
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkFQQYNAPTcjs = require('./chunk-FQQYNAPT.cjs');
|
|
4
|
+
|
|
5
|
+
// src/config.ts
|
|
6
|
+
var DEFAULT_BUILD_OPTIONS = {
|
|
7
|
+
assets: [],
|
|
8
|
+
platform: "node",
|
|
9
|
+
target: "node22",
|
|
10
|
+
format: "esm",
|
|
11
|
+
tsconfig: "tsconfig.json",
|
|
12
|
+
mode: "production",
|
|
13
|
+
generatePackageJson: true,
|
|
14
|
+
includeSrc: false,
|
|
15
|
+
keepNames: true,
|
|
16
|
+
metafile: false,
|
|
17
|
+
treeshake: true,
|
|
18
|
+
splitting: true,
|
|
19
|
+
shims: false,
|
|
20
|
+
watch: false,
|
|
21
|
+
bundle: true,
|
|
22
|
+
distDir: "dist",
|
|
23
|
+
loader: {
|
|
24
|
+
".aac": "file",
|
|
25
|
+
".css": "file",
|
|
26
|
+
".eot": "file",
|
|
27
|
+
".flac": "file",
|
|
28
|
+
".gif": "file",
|
|
29
|
+
".jpeg": "file",
|
|
30
|
+
".jpg": "file",
|
|
31
|
+
".mp3": "file",
|
|
32
|
+
".mp4": "file",
|
|
33
|
+
".ogg": "file",
|
|
34
|
+
".otf": "file",
|
|
35
|
+
".png": "file",
|
|
36
|
+
".svg": "file",
|
|
37
|
+
".ttf": "file",
|
|
38
|
+
".wav": "file",
|
|
39
|
+
".webm": "file",
|
|
40
|
+
".webp": "file",
|
|
41
|
+
".woff": "file",
|
|
42
|
+
".woff2": "file"
|
|
43
|
+
},
|
|
44
|
+
banner: {
|
|
45
|
+
js: _chunkFQQYNAPTcjs.DEFAULT_COMPILED_BANNER,
|
|
46
|
+
css: _chunkFQQYNAPTcjs.DEFAULT_COMPILED_BANNER
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
exports.DEFAULT_BUILD_OPTIONS = DEFAULT_BUILD_OPTIONS;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
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
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkEVDNG72Rcjs = require('./chunk-EVDNG72R.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkYHMM6RY5cjs = require('./chunk-YHMM6RY5.cjs');
|
|
9
9
|
|
|
10
10
|
// src/plugins/deps-check.ts
|
|
11
11
|
var _module = require('module');
|
|
@@ -39,11 +39,11 @@ var missingIgnore = [
|
|
|
39
39
|
"@prisma/client",
|
|
40
40
|
"ts-toolbelt"
|
|
41
41
|
];
|
|
42
|
-
var depsCheckPlugin = /* @__PURE__ */
|
|
42
|
+
var depsCheckPlugin = /* @__PURE__ */ _chunkYHMM6RY5cjs.__name.call(void 0, (bundle) => ({
|
|
43
43
|
name: "storm:deps-check",
|
|
44
44
|
setup(build) {
|
|
45
45
|
const pkgJsonPath = _path2.default.join(process.cwd(), "package.json");
|
|
46
|
-
const pkgContents =
|
|
46
|
+
const pkgContents = _chunkYHMM6RY5cjs.__require.call(void 0, pkgJsonPath);
|
|
47
47
|
const regDependencies = Object.keys(_nullishCoalesce(pkgContents["dependencies"], () => ( {})));
|
|
48
48
|
const devDependencies = Object.keys(_nullishCoalesce(pkgContents["devDependencies"], () => ( {})));
|
|
49
49
|
const peerDependencies = Object.keys(_nullishCoalesce(pkgContents["peerDependencies"], () => ( {})));
|
|
@@ -86,8 +86,8 @@ var depsCheckPlugin = /* @__PURE__ */ _chunkB4CUDMY2cjs.__name.call(void 0, (bun
|
|
|
86
86
|
const filteredMissingDeps = missingDependencies.filter((dep) => {
|
|
87
87
|
return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
|
|
88
88
|
});
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
_chunkEVDNG72Rcjs.writeWarning.call(void 0, `Unused Dependencies: ${JSON.stringify(filteredUnusedDeps)}`);
|
|
90
|
+
_chunkEVDNG72Rcjs.writeError.call(void 0, `Missing Dependencies: ${JSON.stringify(filteredMissingDeps)}`);
|
|
91
91
|
if (filteredMissingDeps.length > 0) {
|
|
92
92
|
throw new Error(`Missing dependencies detected - please install them:
|
|
93
93
|
${JSON.stringify(filteredMissingDeps)}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 _chunkG66JI4BScjs = require('./chunk-G66JI4BS.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkSLSBBNRFcjs = require('./chunk-SLSBBNRF.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkFQQYNAPTcjs = require('./chunk-FQQYNAPT.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkEVDNG72Rcjs = require('./chunk-EVDNG72R.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkYHMM6RY5cjs = require('./chunk-YHMM6RY5.cjs');
|
|
19
|
+
|
|
20
|
+
// src/context.ts
|
|
21
|
+
var _devkit = require('@nx/devkit');
|
|
22
|
+
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
|
|
23
|
+
var _fs = require('fs');
|
|
24
|
+
var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
|
|
25
|
+
var _findworkspaceroot = require('nx/src/utils/find-workspace-root');
|
|
26
|
+
async function resolveContext(userOptions) {
|
|
27
|
+
const projectRoot = userOptions.projectRoot;
|
|
28
|
+
const workspaceRoot = _findworkspaceroot.findWorkspaceRoot.call(void 0, projectRoot);
|
|
29
|
+
if (!workspaceRoot) {
|
|
30
|
+
throw new Error("Cannot find Nx workspace root");
|
|
31
|
+
}
|
|
32
|
+
const workspaceConfig = await _chunkFQQYNAPTcjs.getWorkspaceConfig.call(void 0, true, {
|
|
33
|
+
workspaceRoot: workspaceRoot.dir
|
|
34
|
+
});
|
|
35
|
+
_chunkEVDNG72Rcjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", workspaceConfig);
|
|
36
|
+
const stopwatch = _chunkEVDNG72Rcjs.getStopwatch.call(void 0, "Build options resolution");
|
|
37
|
+
const projectGraph = await _devkit.createProjectGraphAsync.call(void 0, {
|
|
38
|
+
exitOnError: true
|
|
39
|
+
});
|
|
40
|
+
const projectJsonPath = _chunkYHMM6RY5cjs.joinPaths.call(void 0, workspaceRoot.dir, projectRoot, "project.json");
|
|
41
|
+
if (!_fs.existsSync.call(void 0, projectJsonPath)) {
|
|
42
|
+
throw new Error("Cannot find project.json configuration");
|
|
43
|
+
}
|
|
44
|
+
const projectJsonFile = await _promises2.default.readFile(projectJsonPath, "utf8");
|
|
45
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
46
|
+
const projectName = projectJson.name || userOptions.name;
|
|
47
|
+
const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
48
|
+
if (!_optionalChain([projectConfigurations, 'optionalAccess', _ => _.projects, 'optionalAccess', _2 => _2[projectName]])) {
|
|
49
|
+
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
50
|
+
}
|
|
51
|
+
const options = _defu2.default.call(void 0, userOptions, _chunkSLSBBNRFcjs.DEFAULT_BUILD_OPTIONS);
|
|
52
|
+
options.name ??= projectName;
|
|
53
|
+
const packageJsonPath = _chunkYHMM6RY5cjs.joinPaths.call(void 0, workspaceRoot.dir, options.projectRoot, "package.json");
|
|
54
|
+
if (!_fs.existsSync.call(void 0, packageJsonPath)) {
|
|
55
|
+
throw new Error("Cannot find package.json configuration");
|
|
56
|
+
}
|
|
57
|
+
const env = _chunkFQQYNAPTcjs.getEnv.call(void 0, "esbuild", options);
|
|
58
|
+
const define = _defu2.default.call(void 0, _nullishCoalesce(options.define, () => ( {})), _nullishCoalesce(env, () => ( {})));
|
|
59
|
+
const resolvedOptions = {
|
|
60
|
+
...options,
|
|
61
|
+
tsconfig: _chunkYHMM6RY5cjs.joinPaths.call(void 0, projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
|
|
62
|
+
metafile: userOptions.mode === "development",
|
|
63
|
+
clean: false,
|
|
64
|
+
env,
|
|
65
|
+
define: {
|
|
66
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
67
|
+
...Object.keys(define).filter((key) => define[key] !== void 0).reduce((res, key) => {
|
|
68
|
+
const value = JSON.stringify(define[key]);
|
|
69
|
+
const safeKey = key.replaceAll("(", "").replaceAll(")", "");
|
|
70
|
+
return {
|
|
71
|
+
...res,
|
|
72
|
+
[`process.env.${safeKey}`]: value,
|
|
73
|
+
[`import.meta.env.${safeKey}`]: value
|
|
74
|
+
};
|
|
75
|
+
}, {})
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
stopwatch();
|
|
79
|
+
const context = {
|
|
80
|
+
options: resolvedOptions,
|
|
81
|
+
clean: userOptions.clean !== false,
|
|
82
|
+
workspaceConfig,
|
|
83
|
+
projectConfigurations,
|
|
84
|
+
projectName,
|
|
85
|
+
projectGraph,
|
|
86
|
+
sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || _chunkYHMM6RY5cjs.joinPaths.call(void 0, resolvedOptions.projectRoot, "src"),
|
|
87
|
+
outputPath: resolvedOptions.outputPath || _chunkYHMM6RY5cjs.joinPaths.call(void 0, workspaceConfig.workspaceRoot, "dist", resolvedOptions.projectRoot),
|
|
88
|
+
minify: resolvedOptions.minify || resolvedOptions.mode === "production"
|
|
89
|
+
};
|
|
90
|
+
context.options.esbuildPlugins = [
|
|
91
|
+
_chunkG66JI4BScjs.resolvePathsPlugin.call(void 0, context),
|
|
92
|
+
..._nullishCoalesce(context.options.esbuildPlugins, () => ( []))
|
|
93
|
+
];
|
|
94
|
+
return context;
|
|
95
|
+
}
|
|
96
|
+
_chunkYHMM6RY5cjs.__name.call(void 0, resolveContext, "resolveContext");
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
exports.resolveContext = resolveContext;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_COMPILED_BANNER
|
|
3
|
+
} from "./chunk-NJJBR57W.js";
|
|
4
|
+
|
|
5
|
+
// src/config.ts
|
|
6
|
+
var DEFAULT_BUILD_OPTIONS = {
|
|
7
|
+
assets: [],
|
|
8
|
+
platform: "node",
|
|
9
|
+
target: "node22",
|
|
10
|
+
format: "esm",
|
|
11
|
+
tsconfig: "tsconfig.json",
|
|
12
|
+
mode: "production",
|
|
13
|
+
generatePackageJson: true,
|
|
14
|
+
includeSrc: false,
|
|
15
|
+
keepNames: true,
|
|
16
|
+
metafile: false,
|
|
17
|
+
treeshake: true,
|
|
18
|
+
splitting: true,
|
|
19
|
+
shims: false,
|
|
20
|
+
watch: false,
|
|
21
|
+
bundle: true,
|
|
22
|
+
distDir: "dist",
|
|
23
|
+
loader: {
|
|
24
|
+
".aac": "file",
|
|
25
|
+
".css": "file",
|
|
26
|
+
".eot": "file",
|
|
27
|
+
".flac": "file",
|
|
28
|
+
".gif": "file",
|
|
29
|
+
".jpeg": "file",
|
|
30
|
+
".jpg": "file",
|
|
31
|
+
".mp3": "file",
|
|
32
|
+
".mp4": "file",
|
|
33
|
+
".ogg": "file",
|
|
34
|
+
".otf": "file",
|
|
35
|
+
".png": "file",
|
|
36
|
+
".svg": "file",
|
|
37
|
+
".ttf": "file",
|
|
38
|
+
".wav": "file",
|
|
39
|
+
".webm": "file",
|
|
40
|
+
".webp": "file",
|
|
41
|
+
".woff": "file",
|
|
42
|
+
".woff2": "file"
|
|
43
|
+
},
|
|
44
|
+
banner: {
|
|
45
|
+
js: DEFAULT_COMPILED_BANNER,
|
|
46
|
+
css: DEFAULT_COMPILED_BANNER
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
DEFAULT_BUILD_OPTIONS
|
|
52
|
+
};
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
4
33
|
|
|
5
34
|
// ../config-tools/src/utilities/correct-paths.ts
|
|
6
35
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
@@ -10,11 +39,11 @@ function normalizeWindowsPath(input = "") {
|
|
|
10
39
|
}
|
|
11
40
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
12
41
|
}
|
|
13
|
-
|
|
42
|
+
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
14
43
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
15
44
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
16
45
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
17
|
-
var correctPaths = /* @__PURE__ */
|
|
46
|
+
var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
18
47
|
if (!path || path.length === 0) {
|
|
19
48
|
return ".";
|
|
20
49
|
}
|
|
@@ -43,7 +72,7 @@ var correctPaths = /* @__PURE__ */ _chunkB4CUDMY2cjs.__name.call(void 0, functio
|
|
|
43
72
|
}
|
|
44
73
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
45
74
|
}, "correctPaths");
|
|
46
|
-
var joinPaths = /* @__PURE__ */
|
|
75
|
+
var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
47
76
|
let path = "";
|
|
48
77
|
for (const seg of segments) {
|
|
49
78
|
if (!seg) {
|
|
@@ -124,12 +153,16 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
124
153
|
}
|
|
125
154
|
return res;
|
|
126
155
|
}
|
|
127
|
-
|
|
128
|
-
var isAbsolute = /* @__PURE__ */
|
|
156
|
+
__name(normalizeString, "normalizeString");
|
|
157
|
+
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
129
158
|
return _IS_ABSOLUTE_RE.test(p);
|
|
130
159
|
}, "isAbsolute");
|
|
131
160
|
|
|
132
161
|
|
|
133
162
|
|
|
134
163
|
|
|
135
|
-
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
exports.__name = __name; exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.correctPaths = correctPaths; exports.joinPaths = joinPaths;
|
package/dist/clean.cjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-B4CUDMY2.cjs');
|
|
4
|
+
var _chunkRK34D7S5cjs = require('./chunk-RK34D7S5.cjs');
|
|
5
|
+
require('./chunk-EVDNG72R.cjs');
|
|
6
|
+
require('./chunk-YHMM6RY5.cjs');
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
exports.clean =
|
|
10
|
+
exports.clean = _chunkRK34D7S5cjs.clean; exports.cleanDirectories = _chunkRK34D7S5cjs.cleanDirectories;
|
package/dist/clean.d.cts
CHANGED
package/dist/clean.d.ts
CHANGED
package/dist/clean.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clean,
|
|
3
3
|
cleanDirectories
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-CCEWV2BR.js";
|
|
4
|
+
} from "./chunk-DNZNN5SK.js";
|
|
5
|
+
import "./chunk-TSQT5MWW.js";
|
|
6
|
+
import "./chunk-4D6ICA75.js";
|
|
8
7
|
export {
|
|
9
8
|
clean,
|
|
10
9
|
cleanDirectories
|
package/dist/config.cjs
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
+
var _chunkSLSBBNRFcjs = require('./chunk-SLSBBNRF.cjs');
|
|
4
|
+
require('./chunk-FQQYNAPT.cjs');
|
|
5
|
+
require('./chunk-EVDNG72R.cjs');
|
|
6
|
+
require('./chunk-YHMM6RY5.cjs');
|
|
3
7
|
|
|
4
|
-
var _chunkTDBBRZTCcjs = require('./chunk-TDBBRZTC.cjs');
|
|
5
|
-
require('./chunk-ILJQ4NCE.cjs');
|
|
6
|
-
require('./chunk-Y5SBBYX3.cjs');
|
|
7
|
-
require('./chunk-27VOV3G4.cjs');
|
|
8
|
-
require('./chunk-BOFHC4OE.cjs');
|
|
9
|
-
require('./chunk-QKJ7KLDL.cjs');
|
|
10
|
-
require('./chunk-N62ZR7UV.cjs');
|
|
11
|
-
require('./chunk-GJHRTQAS.cjs');
|
|
12
|
-
require('./chunk-VPTKC3UK.cjs');
|
|
13
|
-
require('./chunk-RLQJRD62.cjs');
|
|
14
|
-
require('./chunk-B4CUDMY2.cjs');
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.DEFAULT_BUILD_OPTIONS = _chunkTDBBRZTCcjs.DEFAULT_BUILD_OPTIONS; exports.getDefaultBuildPlugins = _chunkTDBBRZTCcjs.getDefaultBuildPlugins;
|
|
9
|
+
exports.DEFAULT_BUILD_OPTIONS = _chunkSLSBBNRFcjs.DEFAULT_BUILD_OPTIONS;
|
package/dist/config.d.cts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ESBuildOptions, ESBuildContext } from './types.cjs';
|
|
1
|
+
import { ESBuildOptions } from './types.cjs';
|
|
3
2
|
import '@nx/devkit';
|
|
4
3
|
import '@storm-software/build-tools';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@storm-software/config';
|
|
5
|
+
import 'esbuild';
|
|
7
6
|
import 'tsup';
|
|
8
7
|
|
|
9
|
-
declare const getDefaultBuildPlugins: (options: ESBuildOptions, context: ESBuildContext) => esbuild.Plugin[];
|
|
10
8
|
declare const DEFAULT_BUILD_OPTIONS: Required<Pick<ESBuildOptions, "assets" | "format" | "platform" | "target" | "tsconfig" | "mode" | "includeSrc" | "generatePackageJson" | "keepNames" | "metafile" | "treeshake" | "splitting" | "shims" | "watch" | "bundle" | "loader" | "banner" | "distDir">>;
|
|
11
9
|
|
|
12
|
-
export { DEFAULT_BUILD_OPTIONS
|
|
10
|
+
export { DEFAULT_BUILD_OPTIONS };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ESBuildOptions, ESBuildContext } from './types.js';
|
|
1
|
+
import { ESBuildOptions } from './types.js';
|
|
3
2
|
import '@nx/devkit';
|
|
4
3
|
import '@storm-software/build-tools';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
4
|
+
import '@storm-software/config';
|
|
5
|
+
import 'esbuild';
|
|
7
6
|
import 'tsup';
|
|
8
7
|
|
|
9
|
-
declare const getDefaultBuildPlugins: (options: ESBuildOptions, context: ESBuildContext) => esbuild.Plugin[];
|
|
10
8
|
declare const DEFAULT_BUILD_OPTIONS: Required<Pick<ESBuildOptions, "assets" | "format" | "platform" | "target" | "tsconfig" | "mode" | "includeSrc" | "generatePackageJson" | "keepNames" | "metafile" | "treeshake" | "splitting" | "shims" | "watch" | "bundle" | "loader" | "banner" | "distDir">>;
|
|
11
9
|
|
|
12
|
-
export { DEFAULT_BUILD_OPTIONS
|
|
10
|
+
export { DEFAULT_BUILD_OPTIONS };
|
package/dist/config.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DEFAULT_BUILD_OPTIONS
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-AZON722Q.js";
|
|
8
|
-
import "./chunk-BWSIRV3D.js";
|
|
9
|
-
import "./chunk-5RVOO3YF.js";
|
|
10
|
-
import "./chunk-3QHFCKSI.js";
|
|
11
|
-
import "./chunk-VQHKIS7J.js";
|
|
12
|
-
import "./chunk-Y7JBB452.js";
|
|
13
|
-
import "./chunk-XLUZXKDY.js";
|
|
14
|
-
import "./chunk-CCEWV2BR.js";
|
|
2
|
+
DEFAULT_BUILD_OPTIONS
|
|
3
|
+
} from "./chunk-WXURMFT7.js";
|
|
4
|
+
import "./chunk-NJJBR57W.js";
|
|
5
|
+
import "./chunk-TSQT5MWW.js";
|
|
6
|
+
import "./chunk-4D6ICA75.js";
|
|
15
7
|
export {
|
|
16
|
-
DEFAULT_BUILD_OPTIONS
|
|
17
|
-
getDefaultBuildPlugins
|
|
8
|
+
DEFAULT_BUILD_OPTIONS
|
|
18
9
|
};
|
package/dist/context.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWLJT52I3cjs = require('./chunk-WLJT52I3.cjs');
|
|
4
|
+
require('./chunk-G66JI4BS.cjs');
|
|
5
|
+
require('./chunk-SLSBBNRF.cjs');
|
|
6
|
+
require('./chunk-FQQYNAPT.cjs');
|
|
7
|
+
require('./chunk-EVDNG72R.cjs');
|
|
8
|
+
require('./chunk-YHMM6RY5.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.resolveContext = _chunkWLJT52I3cjs.resolveContext;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ESBuildOptions, ESBuildContext } from './types.cjs';
|
|
2
|
+
import '@nx/devkit';
|
|
3
|
+
import '@storm-software/build-tools';
|
|
4
|
+
import '@storm-software/config';
|
|
5
|
+
import 'esbuild';
|
|
6
|
+
import 'tsup';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Apply defaults to the original build options
|
|
10
|
+
*
|
|
11
|
+
* @param userOptions - the original build options provided by the user
|
|
12
|
+
* @returns the build options with defaults applied
|
|
13
|
+
*/
|
|
14
|
+
declare function resolveContext(userOptions: ESBuildOptions): Promise<ESBuildContext>;
|
|
15
|
+
|
|
16
|
+
export { resolveContext };
|