@storm-software/unbuild 0.30.5 → 0.31.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 +1 -1
- package/bin/unbuild.cjs +149 -133
- package/bin/unbuild.js +130 -114
- package/dist/build.cjs +8 -8
- package/dist/build.js +7 -7
- package/dist/{chunk-V627S7QU.cjs → chunk-26OHEX55.cjs} +2 -2
- package/dist/{chunk-KPFCICEG.js → chunk-3Q2ZB7CN.js} +1 -1
- package/dist/{chunk-VD6EE7HD.js → chunk-BZJA6TK2.js} +243 -231
- package/dist/{chunk-5E3NJ26L.cjs → chunk-CUQLNBV5.cjs} +3 -3
- package/dist/{chunk-5S4A4OEA.js → chunk-G2BQ6VSR.js} +1 -1
- package/dist/{chunk-CF2C3GEV.cjs → chunk-GVX7LSWK.cjs} +3 -3
- package/dist/{chunk-PSYW5YJB.cjs → chunk-KDTFDJN3.cjs} +2 -2
- package/dist/{chunk-FG6XQ26M.cjs → chunk-LXCK6Y4C.cjs} +20 -16
- package/dist/{chunk-F77T2VZV.cjs → chunk-N2XPKSKO.cjs} +318 -306
- package/dist/{chunk-C5IHRWT3.js → chunk-NYVG7QMW.js} +1 -1
- package/dist/{chunk-Y2DOCJBE.cjs → chunk-O45RUFL3.cjs} +6 -6
- package/dist/{chunk-K2D7TQ7G.js → chunk-OAOLAATA.js} +3 -3
- package/dist/{chunk-TPFSDZCR.js → chunk-VWXW3RW5.js} +18 -14
- package/dist/{chunk-VC7N2YVM.js → chunk-XGZOR6PZ.js} +1 -1
- package/dist/clean.cjs +3 -3
- package/dist/clean.js +2 -2
- package/dist/config.cjs +6 -6
- package/dist/config.js +5 -5
- package/dist/index.cjs +8 -8
- package/dist/index.js +7 -7
- package/package.json +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
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(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await 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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCUQLNBV5cjs = require('./chunk-CUQLNBV5.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkO45RUFL3cjs = require('./chunk-O45RUFL3.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk26OHEX55cjs = require('./chunk-26OHEX55.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -29,7 +29,7 @@ var _chunkV627S7QUcjs = require('./chunk-V627S7QU.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkLXCK6Y4Ccjs = require('./chunk-LXCK6Y4C.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
@@ -54,50 +54,194 @@ var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_reso
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
|
|
59
58
|
var _glob = require('glob');
|
|
60
59
|
var _promises = require('fs/promises'); var _promises2 = _interopRequireDefault(_promises);
|
|
60
|
+
var copyAssets = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
61
|
+
const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
|
|
62
|
+
pendingAssets.push({
|
|
63
|
+
input: projectRoot,
|
|
64
|
+
glob: "*.md",
|
|
65
|
+
output: "."
|
|
66
|
+
});
|
|
67
|
+
pendingAssets.push({
|
|
68
|
+
input: ".",
|
|
69
|
+
glob: "LICENSE",
|
|
70
|
+
output: "."
|
|
71
|
+
});
|
|
72
|
+
if (generatePackageJson2 === false) {
|
|
73
|
+
pendingAssets.push({
|
|
74
|
+
input: projectRoot,
|
|
75
|
+
glob: "package.json",
|
|
76
|
+
output: "."
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (includeSrc === true) {
|
|
80
|
+
pendingAssets.push({
|
|
81
|
+
input: sourceRoot,
|
|
82
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
83
|
+
output: "src/"
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
|
|
87
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
88
|
+
const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
|
|
89
|
+
projectDir: projectRoot,
|
|
90
|
+
rootDir: config.workspaceRoot,
|
|
91
|
+
outputDir: outputPath,
|
|
92
|
+
assets: pendingAssets
|
|
93
|
+
});
|
|
94
|
+
await assetHandler.processAllAssetsOnce();
|
|
95
|
+
if (includeSrc === true) {
|
|
96
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, outputPath, "src")}`, config);
|
|
97
|
+
const files = await _glob.glob.call(void 0, [
|
|
98
|
+
_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
99
|
+
_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
100
|
+
_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
101
|
+
_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
102
|
+
]);
|
|
103
|
+
await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
104
|
+
|
|
105
|
+
${await _promises.readFile.call(void 0, file, "utf8")}
|
|
106
|
+
|
|
107
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
108
|
+
}
|
|
109
|
+
}, "copyAssets");
|
|
110
|
+
|
|
111
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var _projectgraph = require('nx/src/project-graph/project-graph');
|
|
117
|
+
var addPackageDependencies = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
118
|
+
const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
119
|
+
const localPackages = [];
|
|
120
|
+
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
121
|
+
const projectNode = project.node;
|
|
122
|
+
if (projectNode.data.root) {
|
|
123
|
+
const projectPackageJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
|
|
124
|
+
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
125
|
+
const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
126
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
127
|
+
if (projectPackageJson.private !== false) {
|
|
128
|
+
localPackages.push(projectPackageJson);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (localPackages.length > 0) {
|
|
134
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
135
|
+
packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
|
|
136
|
+
if (!ret[localPackage.name]) {
|
|
137
|
+
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
138
|
+
}
|
|
139
|
+
return ret;
|
|
140
|
+
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
141
|
+
packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
|
|
142
|
+
if (!ret[localPackage.name]) {
|
|
143
|
+
ret[localPackage.name] = {
|
|
144
|
+
optional: false
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return ret;
|
|
148
|
+
}, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
|
|
149
|
+
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
150
|
+
if (!ret[localPackage.name]) {
|
|
151
|
+
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
152
|
+
}
|
|
153
|
+
return ret;
|
|
154
|
+
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
155
|
+
} else {
|
|
156
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
157
|
+
}
|
|
158
|
+
return packageJson;
|
|
159
|
+
}, "addPackageDependencies");
|
|
160
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
161
|
+
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkLXCK6Y4Ccjs.findWorkspaceRoot.call(void 0, );
|
|
162
|
+
const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
|
|
163
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
164
|
+
packageJson.type ??= "module";
|
|
165
|
+
packageJson.sideEffects ??= false;
|
|
166
|
+
if (includeSrc === true) {
|
|
167
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
168
|
+
if (distSrc.startsWith("/")) {
|
|
169
|
+
distSrc = distSrc.substring(1);
|
|
170
|
+
}
|
|
171
|
+
packageJson.source ??= `${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
172
|
+
}
|
|
173
|
+
packageJson.files ??= [
|
|
174
|
+
"dist/**/*"
|
|
175
|
+
];
|
|
176
|
+
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
177
|
+
packageJson.files.push("src/**/*");
|
|
178
|
+
}
|
|
179
|
+
packageJson.publishConfig ??= {
|
|
180
|
+
access: "public"
|
|
181
|
+
};
|
|
182
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
183
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
184
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
185
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
186
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
187
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
188
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
189
|
+
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
190
|
+
if (!packageJson.maintainers && packageJson.author) {
|
|
191
|
+
packageJson.maintainers = [
|
|
192
|
+
packageJson.author
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
196
|
+
if (!packageJson.contributors && packageJson.author) {
|
|
197
|
+
packageJson.contributors = [
|
|
198
|
+
packageJson.author
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
202
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, "packages", projectName);
|
|
203
|
+
return packageJson;
|
|
204
|
+
}, "addWorkspacePackageJsonFields");
|
|
61
205
|
|
|
62
206
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
63
207
|
var _c12 = require('c12');
|
|
64
208
|
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
|
|
65
209
|
var getConfigFileByName = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (fileName, filePath, options = {}) => {
|
|
66
|
-
const workspacePath = filePath ||
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
210
|
+
const workspacePath = filePath || _chunkLXCK6Y4Ccjs.findWorkspaceRoot.call(void 0, filePath);
|
|
211
|
+
const configs = await Promise.all([
|
|
212
|
+
_c12.loadConfig.call(void 0, {
|
|
213
|
+
cwd: workspacePath,
|
|
214
|
+
packageJson: true,
|
|
215
|
+
name: fileName,
|
|
216
|
+
envName: _optionalChain([fileName, 'optionalAccess', _2 => _2.toUpperCase, 'call', _3 => _3()]),
|
|
217
|
+
jitiOptions: {
|
|
218
|
+
debug: false,
|
|
219
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
220
|
+
},
|
|
221
|
+
...options
|
|
222
|
+
}),
|
|
223
|
+
_c12.loadConfig.call(void 0, {
|
|
80
224
|
cwd: workspacePath,
|
|
81
225
|
packageJson: true,
|
|
82
226
|
name: fileName,
|
|
83
227
|
envName: _optionalChain([fileName, 'optionalAccess', _4 => _4.toUpperCase, 'call', _5 => _5()]),
|
|
84
228
|
jitiOptions: {
|
|
85
229
|
debug: false,
|
|
86
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false :
|
|
230
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
87
231
|
},
|
|
88
232
|
configFile: fileName,
|
|
89
233
|
...options
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
return
|
|
234
|
+
})
|
|
235
|
+
]);
|
|
236
|
+
return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
|
|
93
237
|
}, "getConfigFileByName");
|
|
94
238
|
var getConfigFile = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (filePath, additionalFileNames = []) => {
|
|
95
|
-
const workspacePath = filePath ? filePath :
|
|
239
|
+
const workspacePath = filePath ? filePath : _chunkLXCK6Y4Ccjs.findWorkspaceRoot.call(void 0, filePath);
|
|
96
240
|
const result = await getConfigFileByName("storm", workspacePath);
|
|
97
241
|
let config = result.config;
|
|
98
242
|
const configFile = result.configFile;
|
|
99
243
|
if (config && configFile && Object.keys(config).length > 0) {
|
|
100
|
-
|
|
244
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
101
245
|
logLevel: "all"
|
|
102
246
|
});
|
|
103
247
|
}
|
|
@@ -105,7 +249,7 @@ var getConfigFile = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async
|
|
|
105
249
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
106
250
|
for (const result2 of results) {
|
|
107
251
|
if (_optionalChain([result2, 'optionalAccess', _6 => _6.config]) && _optionalChain([result2, 'optionalAccess', _7 => _7.configFile]) && Object.keys(result2.config).length > 0) {
|
|
108
|
-
|
|
252
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
109
253
|
logLevel: "all"
|
|
110
254
|
});
|
|
111
255
|
config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
|
|
@@ -123,6 +267,16 @@ var getConfigFile = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async
|
|
|
123
267
|
|
|
124
268
|
|
|
125
269
|
// ../config-tools/src/env/get-env.ts
|
|
270
|
+
var getExtensionEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (extensionName) => {
|
|
271
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
272
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
273
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
274
|
+
if (name) {
|
|
275
|
+
ret[name] = process.env[key];
|
|
276
|
+
}
|
|
277
|
+
return ret;
|
|
278
|
+
}, {});
|
|
279
|
+
}, "getExtensionEnv");
|
|
126
280
|
var getConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, () => {
|
|
127
281
|
const prefix = "STORM_";
|
|
128
282
|
let config = {
|
|
@@ -142,15 +296,15 @@ var getConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, () => {
|
|
|
142
296
|
licensing: process.env[`${prefix}LICENSING`] || void 0,
|
|
143
297
|
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
144
298
|
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
145
|
-
configFile: process.env[`${prefix}CONFIG_FILE`] ?
|
|
146
|
-
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ?
|
|
299
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
300
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
147
301
|
directories: {
|
|
148
|
-
cache: process.env[`${prefix}CACHE_DIR`] ?
|
|
149
|
-
data: process.env[`${prefix}DATA_DIR`] ?
|
|
150
|
-
config: process.env[`${prefix}CONFIG_DIR`] ?
|
|
151
|
-
temp: process.env[`${prefix}TEMP_DIR`] ?
|
|
152
|
-
log: process.env[`${prefix}LOG_DIR`] ?
|
|
153
|
-
build: process.env[`${prefix}BUILD_DIR`] ?
|
|
302
|
+
cache: process.env[`${prefix}CACHE_DIR`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIR`]) : void 0,
|
|
303
|
+
data: process.env[`${prefix}DATA_DIR`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIR`]) : void 0,
|
|
304
|
+
config: process.env[`${prefix}CONFIG_DIR`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIR`]) : void 0,
|
|
305
|
+
temp: process.env[`${prefix}TEMP_DIR`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIR`]) : void 0,
|
|
306
|
+
log: process.env[`${prefix}LOG_DIR`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIR`]) : void 0,
|
|
307
|
+
build: process.env[`${prefix}BUILD_DIR`] ? _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIR`]) : void 0
|
|
154
308
|
},
|
|
155
309
|
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
156
310
|
env: (_nullishCoalesce(_nullishCoalesce(process.env[`${prefix}ENV`], () => ( process.env.NODE_ENV)), () => ( process.env.ENVIRONMENT))) || void 0,
|
|
@@ -173,23 +327,23 @@ var getConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, () => {
|
|
|
173
327
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
174
328
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
175
329
|
},
|
|
176
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ?
|
|
330
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? _chunkLXCK6Y4Ccjs.getLogLevelLabel.call(void 0, Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
|
|
177
331
|
};
|
|
178
|
-
const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) &&
|
|
332
|
+
const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && _chunkLXCK6Y4Ccjs.COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
|
|
179
333
|
config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
|
|
180
334
|
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
181
335
|
return ret;
|
|
182
336
|
}, {}) : getThemeColorConfigEnv(prefix);
|
|
183
|
-
if (config.docs ===
|
|
184
|
-
if (config.homepage ===
|
|
185
|
-
config.docs = `${
|
|
337
|
+
if (config.docs === _chunkLXCK6Y4Ccjs.STORM_DEFAULT_DOCS) {
|
|
338
|
+
if (config.homepage === _chunkLXCK6Y4Ccjs.STORM_DEFAULT_HOMEPAGE) {
|
|
339
|
+
config.docs = `${_chunkLXCK6Y4Ccjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
186
340
|
} else {
|
|
187
341
|
config.docs = `${config.homepage}/docs`;
|
|
188
342
|
}
|
|
189
343
|
}
|
|
190
|
-
if (config.licensing ===
|
|
191
|
-
if (config.homepage ===
|
|
192
|
-
config.licensing = `${
|
|
344
|
+
if (config.licensing === _chunkLXCK6Y4Ccjs.STORM_DEFAULT_LICENSING) {
|
|
345
|
+
if (config.homepage === _chunkLXCK6Y4Ccjs.STORM_DEFAULT_HOMEPAGE) {
|
|
346
|
+
config.licensing = `${_chunkLXCK6Y4Ccjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
193
347
|
} else {
|
|
194
348
|
config.licensing = `${config.homepage}/docs`;
|
|
195
349
|
}
|
|
@@ -282,7 +436,7 @@ var setExtensionEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (ext
|
|
|
282
436
|
var setConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (config) => {
|
|
283
437
|
const prefix = "STORM_";
|
|
284
438
|
if (config.extends) {
|
|
285
|
-
process.env[`${prefix}EXTENDS`] = config.extends;
|
|
439
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
286
440
|
}
|
|
287
441
|
if (config.name) {
|
|
288
442
|
process.env[`${prefix}NAME`] = config.name;
|
|
@@ -327,31 +481,31 @@ var setConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (config
|
|
|
327
481
|
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
328
482
|
}
|
|
329
483
|
if (config.configFile) {
|
|
330
|
-
process.env[`${prefix}CONFIG_FILE`] =
|
|
484
|
+
process.env[`${prefix}CONFIG_FILE`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.configFile);
|
|
331
485
|
}
|
|
332
486
|
if (config.workspaceRoot) {
|
|
333
|
-
process.env[`${prefix}WORKSPACE_ROOT`] =
|
|
334
|
-
process.env.NX_WORKSPACE_ROOT =
|
|
335
|
-
process.env.NX_WORKSPACE_ROOT_PATH =
|
|
487
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
488
|
+
process.env.NX_WORKSPACE_ROOT = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
489
|
+
process.env.NX_WORKSPACE_ROOT_PATH = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
336
490
|
}
|
|
337
491
|
if (config.directories) {
|
|
338
492
|
if (!config.skipCache && config.directories.cache) {
|
|
339
|
-
process.env[`${prefix}CACHE_DIR`] =
|
|
493
|
+
process.env[`${prefix}CACHE_DIR`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.directories.cache);
|
|
340
494
|
}
|
|
341
495
|
if (config.directories.data) {
|
|
342
|
-
process.env[`${prefix}DATA_DIR`] =
|
|
496
|
+
process.env[`${prefix}DATA_DIR`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.directories.data);
|
|
343
497
|
}
|
|
344
498
|
if (config.directories.config) {
|
|
345
|
-
process.env[`${prefix}CONFIG_DIR`] =
|
|
499
|
+
process.env[`${prefix}CONFIG_DIR`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.directories.config);
|
|
346
500
|
}
|
|
347
501
|
if (config.directories.temp) {
|
|
348
|
-
process.env[`${prefix}TEMP_DIR`] =
|
|
502
|
+
process.env[`${prefix}TEMP_DIR`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.directories.temp);
|
|
349
503
|
}
|
|
350
504
|
if (config.directories.log) {
|
|
351
|
-
process.env[`${prefix}LOG_DIR`] =
|
|
505
|
+
process.env[`${prefix}LOG_DIR`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.directories.log);
|
|
352
506
|
}
|
|
353
507
|
if (config.directories.build) {
|
|
354
|
-
process.env[`${prefix}BUILD_DIR`] =
|
|
508
|
+
process.env[`${prefix}BUILD_DIR`] = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, config.directories.build);
|
|
355
509
|
}
|
|
356
510
|
}
|
|
357
511
|
if (config.skipCache !== void 0) {
|
|
@@ -405,8 +559,8 @@ var setConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (config
|
|
|
405
559
|
if (config.logLevel) {
|
|
406
560
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
407
561
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
408
|
-
process.env.NX_VERBOSE_LOGGING = String(
|
|
409
|
-
process.env.RUST_BACKTRACE =
|
|
562
|
+
process.env.NX_VERBOSE_LOGGING = String(_chunkLXCK6Y4Ccjs.getLogLevel.call(void 0, config.logLevel) >= _chunkLXCK6Y4Ccjs.LogLevel.DEBUG ? true : false);
|
|
563
|
+
process.env.RUST_BACKTRACE = _chunkLXCK6Y4Ccjs.getLogLevel.call(void 0, config.logLevel) >= _chunkLXCK6Y4Ccjs.LogLevel.DEBUG ? "full" : "none";
|
|
410
564
|
}
|
|
411
565
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
412
566
|
for (const key of Object.keys(_nullishCoalesce(config.extensions, () => ( {})))) {
|
|
@@ -512,216 +666,74 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(v
|
|
|
512
666
|
}, "setBaseThemeColorConfigEnv");
|
|
513
667
|
|
|
514
668
|
// ../config-tools/src/create-storm-config.ts
|
|
669
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
515
670
|
var _static_cache = void 0;
|
|
516
|
-
var
|
|
517
|
-
let
|
|
518
|
-
if (_optionalChain([_static_cache, 'optionalAccess', _30 => _30.data])
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
671
|
+
var createStormConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (extensionName, schema, workspaceRoot, skipLogs = false) => {
|
|
672
|
+
let result;
|
|
673
|
+
if (!_optionalChain([_static_cache, 'optionalAccess', _30 => _30.data]) || !_optionalChain([_static_cache, 'optionalAccess', _31 => _31.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
|
|
674
|
+
let _workspaceRoot = workspaceRoot;
|
|
675
|
+
if (!_workspaceRoot) {
|
|
676
|
+
_workspaceRoot = _chunkLXCK6Y4Ccjs.findWorkspaceRoot.call(void 0, );
|
|
677
|
+
}
|
|
678
|
+
const configEnv = getConfigEnv();
|
|
679
|
+
const defaultConfig = await _chunkLXCK6Y4Ccjs.getDefaultConfig.call(void 0, _workspaceRoot);
|
|
680
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
681
|
+
if (!configFile && !skipLogs) {
|
|
682
|
+
_chunkLXCK6Y4Ccjs.writeWarning.call(void 0, "No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
|
|
683
|
+
logLevel: "all"
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
result = await _chunkLXCK6Y4Ccjs.StormConfigSchema.parseAsync(_defu2.default.call(void 0, configEnv, configFile, defaultConfig));
|
|
687
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
688
|
+
} else {
|
|
689
|
+
result = _static_cache.data;
|
|
531
690
|
}
|
|
532
|
-
|
|
691
|
+
if (schema && extensionName) {
|
|
692
|
+
result.extensions = {
|
|
693
|
+
...result.extensions,
|
|
694
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
_static_cache = {
|
|
698
|
+
timestamp: Date.now(),
|
|
699
|
+
data: result
|
|
700
|
+
};
|
|
701
|
+
return result;
|
|
702
|
+
}, "createStormConfig");
|
|
703
|
+
var createConfigExtension = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (extensionName, schema) => {
|
|
704
|
+
const extension_cache_key = {
|
|
705
|
+
extensionName
|
|
706
|
+
};
|
|
707
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
708
|
+
return _extension_cache.get(extension_cache_key);
|
|
709
|
+
}
|
|
710
|
+
let extension = getExtensionEnv(extensionName);
|
|
711
|
+
if (schema) {
|
|
712
|
+
extension = schema.parse(extension);
|
|
713
|
+
}
|
|
714
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
715
|
+
return extension;
|
|
716
|
+
}, "createConfigExtension");
|
|
717
|
+
var loadStormConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (workspaceRoot, skipLogs = false) => {
|
|
718
|
+
const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
|
|
533
719
|
setConfigEnv(config);
|
|
534
|
-
|
|
535
|
-
|
|
720
|
+
if (!skipLogs) {
|
|
721
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `\u2699\uFE0F Using Storm configuration:
|
|
722
|
+
${_chunkLXCK6Y4Ccjs.formatLogMessage.call(void 0, config)}`, config);
|
|
723
|
+
}
|
|
536
724
|
return config;
|
|
537
725
|
}, "loadStormConfig");
|
|
538
726
|
|
|
539
|
-
// ../
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
let rootDir = workspaceRoot;
|
|
544
|
-
if (!rootDir) {
|
|
545
|
-
const config = await loadStormConfig();
|
|
546
|
-
rootDir = config.workspaceRoot;
|
|
547
|
-
}
|
|
548
|
-
const nxJsonPath = _chunkFG6XQ26Mcjs.joinPaths.call(void 0, rootDir, "nx.json");
|
|
549
|
-
if (!_fs.existsSync.call(void 0, nxJsonPath)) {
|
|
550
|
-
throw new Error("Cannot find project.json configuration");
|
|
551
|
-
}
|
|
552
|
-
const configContent = await _promises.readFile.call(void 0, nxJsonPath, "utf8");
|
|
553
|
-
return JSON.parse(configContent);
|
|
554
|
-
}, "readNxConfig");
|
|
555
|
-
|
|
556
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
557
|
-
var copyAssets = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
558
|
-
const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
|
|
559
|
-
pendingAssets.push({
|
|
560
|
-
input: projectRoot,
|
|
561
|
-
glob: "*.md",
|
|
562
|
-
output: "."
|
|
563
|
-
});
|
|
564
|
-
pendingAssets.push({
|
|
565
|
-
input: config.workspaceRoot,
|
|
566
|
-
glob: "LICENSE",
|
|
567
|
-
output: "."
|
|
568
|
-
});
|
|
569
|
-
if (generatePackageJson2 === false) {
|
|
570
|
-
pendingAssets.push({
|
|
571
|
-
input: projectRoot,
|
|
572
|
-
glob: "package.json",
|
|
573
|
-
output: "."
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
if (includeSrc === true) {
|
|
577
|
-
pendingAssets.push({
|
|
578
|
-
input: sourceRoot,
|
|
579
|
-
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
580
|
-
output: "src/"
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
584
|
-
const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
585
|
-
const projectsConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
586
|
-
if (!_optionalChain([projectsConfigurations, 'optionalAccess', _32 => _32.projects, 'optionalAccess', _33 => _33[projectName]])) {
|
|
587
|
-
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.");
|
|
588
|
-
}
|
|
589
|
-
const buildTarget = _optionalChain([projectsConfigurations, 'access', _34 => _34.projects, 'access', _35 => _35[projectName], 'access', _36 => _36.targets, 'optionalAccess', _37 => _37.build]);
|
|
590
|
-
if (!buildTarget) {
|
|
591
|
-
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${_chunkFG6XQ26Mcjs.joinPaths.call(void 0, projectRoot, "project.json")}`);
|
|
592
|
-
}
|
|
593
|
-
_chunkFG6XQ26Mcjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
|
|
594
|
-
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkFG6XQ26Mcjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
595
|
-
const result = await _js.copyAssets.call(void 0, {
|
|
596
|
-
assets: pendingAssets,
|
|
597
|
-
watch: false,
|
|
598
|
-
outputPath
|
|
599
|
-
}, {
|
|
600
|
-
root: config.workspaceRoot,
|
|
601
|
-
targetName: "build",
|
|
602
|
-
target: buildTarget,
|
|
603
|
-
projectName,
|
|
604
|
-
projectGraph,
|
|
605
|
-
projectsConfigurations,
|
|
606
|
-
nxJsonConfiguration: nxJson,
|
|
607
|
-
cwd: config.workspaceRoot,
|
|
608
|
-
isVerbose: _chunkFG6XQ26Mcjs.isVerbose.call(void 0, config.logLevel)
|
|
609
|
-
});
|
|
610
|
-
if (!result.success) {
|
|
611
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
612
|
-
}
|
|
613
|
-
if (includeSrc === true) {
|
|
614
|
-
_chunkFG6XQ26Mcjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkFG6XQ26Mcjs.joinPaths.call(void 0, outputPath, "src")}`, config);
|
|
615
|
-
const files = await _glob.glob.call(void 0, [
|
|
616
|
-
_chunkFG6XQ26Mcjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
617
|
-
_chunkFG6XQ26Mcjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
618
|
-
_chunkFG6XQ26Mcjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
619
|
-
_chunkFG6XQ26Mcjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
620
|
-
]);
|
|
621
|
-
await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
622
|
-
|
|
623
|
-
${await _promises.readFile.call(void 0, file, "utf8")}
|
|
624
|
-
|
|
625
|
-
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
626
|
-
}
|
|
627
|
-
}, "copyAssets");
|
|
628
|
-
|
|
629
|
-
// ../build-tools/src/utilities/generate-package-json.ts
|
|
630
|
-
|
|
727
|
+
// ../config-tools/src/get-config.ts
|
|
728
|
+
var getConfig = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, (workspaceRoot, skipLogs = false) => {
|
|
729
|
+
return loadStormConfig(workspaceRoot, skipLogs);
|
|
730
|
+
}, "getConfig");
|
|
631
731
|
|
|
732
|
+
// ../build-tools/src/utilities/get-entry-points.ts
|
|
632
733
|
|
|
633
734
|
|
|
634
|
-
|
|
635
|
-
var addPackageDependencies = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
636
|
-
const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
637
|
-
const localPackages = [];
|
|
638
|
-
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
639
|
-
const projectNode = project.node;
|
|
640
|
-
if (projectNode.data.root) {
|
|
641
|
-
const projectPackageJsonPath = _chunkFG6XQ26Mcjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
|
|
642
|
-
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
643
|
-
const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
644
|
-
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
645
|
-
if (projectPackageJson.private !== false) {
|
|
646
|
-
localPackages.push(projectPackageJson);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
if (localPackages.length > 0) {
|
|
652
|
-
_chunkFG6XQ26Mcjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
653
|
-
packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
|
|
654
|
-
if (!ret[localPackage.name]) {
|
|
655
|
-
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
656
|
-
}
|
|
657
|
-
return ret;
|
|
658
|
-
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
659
|
-
packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
|
|
660
|
-
if (!ret[localPackage.name]) {
|
|
661
|
-
ret[localPackage.name] = {
|
|
662
|
-
optional: false
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
return ret;
|
|
666
|
-
}, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
|
|
667
|
-
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
668
|
-
if (!ret[localPackage.name]) {
|
|
669
|
-
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
670
|
-
}
|
|
671
|
-
return ret;
|
|
672
|
-
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
673
|
-
} else {
|
|
674
|
-
_chunkFG6XQ26Mcjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
675
|
-
}
|
|
676
|
-
return packageJson;
|
|
677
|
-
}, "addPackageDependencies");
|
|
678
|
-
var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
679
|
-
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkFG6XQ26Mcjs.findWorkspaceRoot.call(void 0, );
|
|
680
|
-
const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunkFG6XQ26Mcjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
|
|
681
|
-
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
682
|
-
packageJson.type ??= "module";
|
|
683
|
-
packageJson.sideEffects ??= false;
|
|
684
|
-
if (includeSrc === true) {
|
|
685
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
686
|
-
if (distSrc.startsWith("/")) {
|
|
687
|
-
distSrc = distSrc.substring(1);
|
|
688
|
-
}
|
|
689
|
-
packageJson.source ??= `${_chunkFG6XQ26Mcjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
690
|
-
}
|
|
691
|
-
packageJson.files ??= [
|
|
692
|
-
"dist/**/*"
|
|
693
|
-
];
|
|
694
|
-
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
695
|
-
packageJson.files.push("src/**/*");
|
|
696
|
-
}
|
|
697
|
-
packageJson.publishConfig ??= {
|
|
698
|
-
access: "public"
|
|
699
|
-
};
|
|
700
|
-
packageJson.description ??= workspacePackageJson.description;
|
|
701
|
-
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
702
|
-
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
703
|
-
packageJson.license ??= workspacePackageJson.license;
|
|
704
|
-
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
705
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
706
|
-
packageJson.author ??= workspacePackageJson.author;
|
|
707
|
-
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
708
|
-
if (!packageJson.maintainers && packageJson.author) {
|
|
709
|
-
packageJson.maintainers = [
|
|
710
|
-
packageJson.author
|
|
711
|
-
];
|
|
712
|
-
}
|
|
713
|
-
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
714
|
-
if (!packageJson.contributors && packageJson.author) {
|
|
715
|
-
packageJson.contributors = [
|
|
716
|
-
packageJson.author
|
|
717
|
-
];
|
|
718
|
-
}
|
|
719
|
-
packageJson.repository ??= workspacePackageJson.repository;
|
|
720
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkFG6XQ26Mcjs.joinPaths.call(void 0, "packages", projectName);
|
|
721
|
-
return packageJson;
|
|
722
|
-
}, "addWorkspacePackageJsonFields");
|
|
735
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
723
736
|
|
|
724
|
-
// ../build-tools/src/utilities/get-entry-points.ts
|
|
725
737
|
|
|
726
738
|
|
|
727
739
|
// ../build-tools/src/utilities/task-graph.ts
|
|
@@ -851,7 +863,7 @@ function inferEntries(pkg, sourceFiles, rootDir) {
|
|
|
851
863
|
const SOURCE_RE = new RegExp(
|
|
852
864
|
`(?<=/|$)${d}${isDir ? "" : String.raw`\.\w+`}$`
|
|
853
865
|
);
|
|
854
|
-
return _optionalChain([sourceFiles, 'access',
|
|
866
|
+
return _optionalChain([sourceFiles, 'access', _32 => _32.find, 'call', _33 => _33((i) => SOURCE_RE.test(i)), 'optionalAccess', _34 => _34.replace, 'call', _35 => _35(/(\.d\.(m|c)?ts|\.\w+)$/, "")]);
|
|
855
867
|
}, void 0);
|
|
856
868
|
if (!input) {
|
|
857
869
|
if (!_fs.existsSync.call(void 0, _pathe.resolve.call(void 0, rootDir || ".", output.file))) {
|
|
@@ -1111,7 +1123,7 @@ function shebangPlugin() {
|
|
|
1111
1123
|
if (output.type !== "chunk") {
|
|
1112
1124
|
continue;
|
|
1113
1125
|
}
|
|
1114
|
-
if (_optionalChain([output, 'access',
|
|
1126
|
+
if (_optionalChain([output, 'access', _36 => _36.code, 'optionalAccess', _37 => _37.match, 'call', _38 => _38(SHEBANG_RE)])) {
|
|
1115
1127
|
const outFile = _pathe.resolve.call(void 0, options.dir, fileName);
|
|
1116
1128
|
await makeExecutable(outFile);
|
|
1117
1129
|
}
|
|
@@ -1285,7 +1297,7 @@ function fixCJSExportTypePlugin() {
|
|
|
1285
1297
|
return {
|
|
1286
1298
|
name: "unbuild-fix-cjs-export-type",
|
|
1287
1299
|
renderChunk(code, info, opts) {
|
|
1288
|
-
if (info.type !== "chunk" || !info.fileName.endsWith(".d.cts") || !info.isEntry || _optionalChain([info, 'access',
|
|
1300
|
+
if (info.type !== "chunk" || !info.fileName.endsWith(".d.cts") || !info.isEntry || _optionalChain([info, 'access', _39 => _39.exports, 'optionalAccess', _40 => _40.length]) !== 1 || info.exports[0] !== "default") {
|
|
1289
1301
|
return;
|
|
1290
1302
|
}
|
|
1291
1303
|
return code.replace(
|
|
@@ -1402,7 +1414,7 @@ function getRollupOptions(ctx) {
|
|
|
1402
1414
|
].filter(Boolean),
|
|
1403
1415
|
external(originalId) {
|
|
1404
1416
|
const resolvedId = _utils3.resolveAlias.call(void 0, originalId, _aliases);
|
|
1405
|
-
const pkgName = _optionalChain([_mlly.parseNodeModulePath.call(void 0, resolvedId), 'optionalAccess',
|
|
1417
|
+
const pkgName = _optionalChain([_mlly.parseNodeModulePath.call(void 0, resolvedId), 'optionalAccess', _41 => _41.name]) || _optionalChain([_mlly.parseNodeModulePath.call(void 0, originalId), 'optionalAccess', _42 => _42.name]) || getpkg(originalId);
|
|
1406
1418
|
if (arrayIncludes(ctx.options.externals, pkgName) || arrayIncludes(ctx.options.externals, originalId) || arrayIncludes(ctx.options.externals, resolvedId)) {
|
|
1407
1419
|
return true;
|
|
1408
1420
|
}
|
|
@@ -1463,7 +1475,7 @@ function getRollupOptions(ctx) {
|
|
|
1463
1475
|
}
|
|
1464
1476
|
_chunkYDYGZTJKcjs.__name.call(void 0, getRollupOptions, "getRollupOptions");
|
|
1465
1477
|
async function rollupStub(ctx) {
|
|
1466
|
-
const babelPlugins = _optionalChain([ctx, 'access',
|
|
1478
|
+
const babelPlugins = _optionalChain([ctx, 'access', _43 => _43.options, 'access', _44 => _44.stubOptions, 'access', _45 => _45.jiti, 'access', _46 => _46.transformOptions, 'optionalAccess', _47 => _47.babel, 'optionalAccess', _48 => _48.plugins]);
|
|
1467
1479
|
const importedBabelPlugins = [];
|
|
1468
1480
|
const serializedJitiOptions = JSON.stringify(
|
|
1469
1481
|
{
|
|
@@ -1475,7 +1487,7 @@ async function rollupStub(ctx) {
|
|
|
1475
1487
|
transformOptions: {
|
|
1476
1488
|
...ctx.options.stubOptions.jiti.transformOptions,
|
|
1477
1489
|
babel: {
|
|
1478
|
-
..._optionalChain([ctx, 'access',
|
|
1490
|
+
..._optionalChain([ctx, 'access', _49 => _49.options, 'access', _50 => _50.stubOptions, 'access', _51 => _51.jiti, 'access', _52 => _52.transformOptions, 'optionalAccess', _53 => _53.babel]),
|
|
1479
1491
|
plugins: "__$BABEL_PLUGINS"
|
|
1480
1492
|
}
|
|
1481
1493
|
}
|
|
@@ -1870,7 +1882,7 @@ _chunkYDYGZTJKcjs.__name.call(void 0, copyBuild, "copyBuild");
|
|
|
1870
1882
|
async function build(rootDir, stub, inputConfig = {}) {
|
|
1871
1883
|
rootDir = _pathe.resolve.call(void 0, process.cwd(), rootDir || ".");
|
|
1872
1884
|
const jiti = _jiti.createJiti.call(void 0, rootDir);
|
|
1873
|
-
const _buildConfig = await jiti.import(_optionalChain([inputConfig, 'optionalAccess',
|
|
1885
|
+
const _buildConfig = await jiti.import(_optionalChain([inputConfig, 'optionalAccess', _54 => _54.config]) || "./build.config", {
|
|
1874
1886
|
try: !inputConfig.config,
|
|
1875
1887
|
default: true
|
|
1876
1888
|
}) || {};
|
|
@@ -1897,7 +1909,7 @@ async function build(rootDir, stub, inputConfig = {}) {
|
|
|
1897
1909
|
_chunkYDYGZTJKcjs.__name.call(void 0, build, "build");
|
|
1898
1910
|
async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs, _stubMode, _watchMode) {
|
|
1899
1911
|
const preset = await resolvePreset(
|
|
1900
|
-
buildConfig.preset || _optionalChain([pkg, 'access',
|
|
1912
|
+
buildConfig.preset || _optionalChain([pkg, 'access', _55 => _55.unbuild, 'optionalAccess', _56 => _56.preset]) || _optionalChain([pkg, 'access', _57 => _57.build, 'optionalAccess', _58 => _58.preset]) || inputConfig.preset || "auto",
|
|
1901
1913
|
rootDir
|
|
1902
1914
|
);
|
|
1903
1915
|
const options = _defu.defu.call(void 0,
|
|
@@ -1906,7 +1918,7 @@ async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs,
|
|
|
1906
1918
|
inputConfig,
|
|
1907
1919
|
preset,
|
|
1908
1920
|
{
|
|
1909
|
-
name: (_optionalChain([pkg, 'optionalAccess',
|
|
1921
|
+
name: (_optionalChain([pkg, 'optionalAccess', _59 => _59.name]) || "").split("/").pop() || "default",
|
|
1910
1922
|
rootDir,
|
|
1911
1923
|
entries: [],
|
|
1912
1924
|
clean: true,
|
|
@@ -2087,24 +2099,24 @@ async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs,
|
|
|
2087
2099
|
for (const entry of ctx.buildEntries.filter((e) => !e.chunk)) {
|
|
2088
2100
|
let totalBytes = entry.bytes || 0;
|
|
2089
2101
|
for (const chunk of entry.chunks || []) {
|
|
2090
|
-
totalBytes += _optionalChain([ctx, 'access',
|
|
2102
|
+
totalBytes += _optionalChain([ctx, 'access', _60 => _60.buildEntries, 'access', _61 => _61.find, 'call', _62 => _62((e) => e.path === chunk), 'optionalAccess', _63 => _63.bytes]) || 0;
|
|
2091
2103
|
}
|
|
2092
2104
|
let line = ` ${_utils.colors.bold(rPath(entry.path))} (` + [
|
|
2093
2105
|
totalBytes && `total size: ${_utils.colors.cyan(_prettybytes2.default.call(void 0, totalBytes))}`,
|
|
2094
2106
|
entry.bytes && `chunk size: ${_utils.colors.cyan(_prettybytes2.default.call(void 0, entry.bytes))}`,
|
|
2095
|
-
_optionalChain([entry, 'access',
|
|
2107
|
+
_optionalChain([entry, 'access', _64 => _64.exports, 'optionalAccess', _65 => _65.length]) && `exports: ${_utils.colors.gray(entry.exports.join(", "))}`
|
|
2096
2108
|
].filter(Boolean).join(", ") + ")";
|
|
2097
|
-
if (_optionalChain([entry, 'access',
|
|
2109
|
+
if (_optionalChain([entry, 'access', _66 => _66.chunks, 'optionalAccess', _67 => _67.length])) {
|
|
2098
2110
|
line += "\n" + entry.chunks.map((p) => {
|
|
2099
2111
|
const chunk = ctx.buildEntries.find((e) => e.path === p) || {};
|
|
2100
2112
|
return _utils.colors.gray(
|
|
2101
2113
|
" \u2514\u2500 " + rPath(p) + _utils.colors.bold(
|
|
2102
|
-
chunk.bytes ? ` (${_prettybytes2.default.call(void 0, _optionalChain([chunk, 'optionalAccess',
|
|
2114
|
+
chunk.bytes ? ` (${_prettybytes2.default.call(void 0, _optionalChain([chunk, 'optionalAccess', _68 => _68.bytes]))})` : ""
|
|
2103
2115
|
)
|
|
2104
2116
|
);
|
|
2105
2117
|
}).join("\n");
|
|
2106
2118
|
}
|
|
2107
|
-
if (_optionalChain([entry, 'access',
|
|
2119
|
+
if (_optionalChain([entry, 'access', _69 => _69.modules, 'optionalAccess', _70 => _70.length])) {
|
|
2108
2120
|
line += "\n" + entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.bytes || 0) - (a.bytes || 0)).map((m) => {
|
|
2109
2121
|
return _utils.colors.gray(
|
|
2110
2122
|
" \u{1F4E6} " + rPath(m.id) + _utils.colors.bold(m.bytes ? ` (${_prettybytes2.default.call(void 0, m.bytes)})` : "")
|
|
@@ -2168,24 +2180,24 @@ _chunkYDYGZTJKcjs.__name.call(void 0, _build, "_build");
|
|
|
2168
2180
|
|
|
2169
2181
|
// src/build.ts
|
|
2170
2182
|
async function resolveOptions(options, config) {
|
|
2171
|
-
|
|
2172
|
-
const stopwatch =
|
|
2183
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
|
|
2184
|
+
const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, "Build options resolution");
|
|
2173
2185
|
if (options.configPath) {
|
|
2174
|
-
const configFile = await
|
|
2186
|
+
const configFile = await _chunk26OHEX55cjs.loadConfig.call(void 0, options.configPath);
|
|
2175
2187
|
if (configFile) {
|
|
2176
2188
|
options = _defu2.default.call(void 0, options, configFile);
|
|
2177
2189
|
}
|
|
2178
2190
|
}
|
|
2179
|
-
const outputPath = options.outputPath ||
|
|
2191
|
+
const outputPath = options.outputPath || _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, "dist", options.projectRoot);
|
|
2180
2192
|
const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
2181
|
-
const projectJsonPath =
|
|
2193
|
+
const projectJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, options.projectRoot, "project.json");
|
|
2182
2194
|
if (!_fs.existsSync.call(void 0, projectJsonPath)) {
|
|
2183
2195
|
throw new Error("Cannot find project.json configuration");
|
|
2184
2196
|
}
|
|
2185
2197
|
const projectJsonContent = await _promises.readFile.call(void 0, projectJsonPath, "utf8");
|
|
2186
2198
|
const projectJson = JSON.parse(projectJsonContent);
|
|
2187
2199
|
const projectName = projectJson.name;
|
|
2188
|
-
const packageJsonPath =
|
|
2200
|
+
const packageJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, options.projectRoot, "package.json");
|
|
2189
2201
|
if (!_fs.existsSync.call(void 0, packageJsonPath)) {
|
|
2190
2202
|
throw new Error("Cannot find package.json configuration");
|
|
2191
2203
|
}
|
|
@@ -2193,14 +2205,14 @@ async function resolveOptions(options, config) {
|
|
|
2193
2205
|
const packageJson = JSON.parse(packageJsonContent);
|
|
2194
2206
|
let tsconfig = options.tsconfig;
|
|
2195
2207
|
if (!tsconfig) {
|
|
2196
|
-
tsconfig =
|
|
2208
|
+
tsconfig = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, options.projectRoot, "tsconfig.json");
|
|
2197
2209
|
}
|
|
2198
2210
|
if (!_fs.existsSync.call(void 0, tsconfig)) {
|
|
2199
2211
|
throw new Error("Cannot find tsconfig.json configuration");
|
|
2200
2212
|
}
|
|
2201
2213
|
let sourceRoot = projectJson.sourceRoot;
|
|
2202
2214
|
if (!sourceRoot) {
|
|
2203
|
-
sourceRoot =
|
|
2215
|
+
sourceRoot = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.projectRoot, "src");
|
|
2204
2216
|
}
|
|
2205
2217
|
if (!_fs.existsSync.call(void 0, sourceRoot)) {
|
|
2206
2218
|
throw new Error("Cannot find sourceRoot directory");
|
|
@@ -2232,7 +2244,7 @@ async function resolveOptions(options, config) {
|
|
|
2232
2244
|
while (entryPath.startsWith("/")) {
|
|
2233
2245
|
entryPath = entryPath.substring(1);
|
|
2234
2246
|
}
|
|
2235
|
-
const outDir =
|
|
2247
|
+
const outDir = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, _path.relative.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, config.workspaceRoot, options.projectRoot), config.workspaceRoot), outputPath, "dist");
|
|
2236
2248
|
ret.push({
|
|
2237
2249
|
name: `${name}-esm`,
|
|
2238
2250
|
builder: "mkdist",
|
|
@@ -2305,7 +2317,7 @@ async function resolveOptions(options, config) {
|
|
|
2305
2317
|
splitting: options.splitting !== false,
|
|
2306
2318
|
treeShaking: options.treeShaking !== false,
|
|
2307
2319
|
color: true,
|
|
2308
|
-
logLevel: config.logLevel ===
|
|
2320
|
+
logLevel: config.logLevel === _chunkLXCK6Y4Ccjs.LogLevelLabel.FATAL ? _chunkLXCK6Y4Ccjs.LogLevelLabel.ERROR : _chunkLXCK6Y4Ccjs.isVerbose.call(void 0, ) ? "verbose" : config.logLevel
|
|
2309
2321
|
}
|
|
2310
2322
|
}
|
|
2311
2323
|
};
|
|
@@ -2322,7 +2334,7 @@ async function resolveOptions(options, config) {
|
|
|
2322
2334
|
if (options.rollup) {
|
|
2323
2335
|
let rollup2 = {};
|
|
2324
2336
|
if (typeof options.rollup === "string") {
|
|
2325
|
-
const rollupFile = await
|
|
2337
|
+
const rollupFile = await _chunk26OHEX55cjs.loadConfig.call(void 0, options.rollup);
|
|
2326
2338
|
if (rollupFile) {
|
|
2327
2339
|
rollup2 = rollupFile;
|
|
2328
2340
|
}
|
|
@@ -2333,7 +2345,7 @@ async function resolveOptions(options, config) {
|
|
|
2333
2345
|
}
|
|
2334
2346
|
resolvedOptions.hooks = {
|
|
2335
2347
|
"rollup:options": /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0, async (ctx, opts) => {
|
|
2336
|
-
opts.plugins = await _asyncNullishCoalesce(options.plugins, async () => ( await
|
|
2348
|
+
opts.plugins = await _asyncNullishCoalesce(options.plugins, async () => ( await _chunkO45RUFL3cjs.getDefaultBuildPlugins.call(void 0, options, resolvedOptions)));
|
|
2337
2349
|
}, "rollup:options")
|
|
2338
2350
|
};
|
|
2339
2351
|
stopwatch();
|
|
@@ -2371,14 +2383,14 @@ var addPackageJsonExport = /* @__PURE__ */ _chunkYDYGZTJKcjs.__name.call(void 0,
|
|
|
2371
2383
|
};
|
|
2372
2384
|
}, "addPackageJsonExport");
|
|
2373
2385
|
async function generatePackageJson(options) {
|
|
2374
|
-
if (options.generatePackageJson !== false && _fs.existsSync.call(void 0,
|
|
2375
|
-
|
|
2376
|
-
const stopwatch =
|
|
2377
|
-
const packageJsonPath =
|
|
2386
|
+
if (options.generatePackageJson !== false && _fs.existsSync.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.projectRoot, "package.json"))) {
|
|
2387
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", options.config);
|
|
2388
|
+
const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, "Write package.json file");
|
|
2389
|
+
const packageJsonPath = _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.projectRoot, "project.json");
|
|
2378
2390
|
if (!_fs.existsSync.call(void 0, packageJsonPath)) {
|
|
2379
2391
|
throw new Error("Cannot find package.json configuration");
|
|
2380
2392
|
}
|
|
2381
|
-
let packageJsonContent = await _promises.readFile.call(void 0,
|
|
2393
|
+
let packageJsonContent = await _promises.readFile.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
|
|
2382
2394
|
if (!packageJsonContent) {
|
|
2383
2395
|
throw new Error("Cannot find package.json configuration file");
|
|
2384
2396
|
}
|
|
@@ -2395,7 +2407,7 @@ async function generatePackageJson(options) {
|
|
|
2395
2407
|
while (entryPath.startsWith("/")) {
|
|
2396
2408
|
entryPath = entryPath.substring(1);
|
|
2397
2409
|
}
|
|
2398
|
-
entryPath = `./${
|
|
2410
|
+
entryPath = `./${_chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.projectRoot, entryPath)}`;
|
|
2399
2411
|
if (!ret.includes(entryPath)) {
|
|
2400
2412
|
ret.push(entryPath);
|
|
2401
2413
|
}
|
|
@@ -2426,23 +2438,23 @@ async function generatePackageJson(options) {
|
|
|
2426
2438
|
}, packageJson.exports);
|
|
2427
2439
|
packageJson.exports["./package.json"] ??= "./package.json";
|
|
2428
2440
|
packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot, options.projectRoot);
|
|
2429
|
-
await _devkit.writeJsonFile.call(void 0,
|
|
2441
|
+
await _devkit.writeJsonFile.call(void 0, _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.outDir, "package.json"), packageJson);
|
|
2430
2442
|
stopwatch();
|
|
2431
2443
|
}
|
|
2432
2444
|
return options;
|
|
2433
2445
|
}
|
|
2434
2446
|
_chunkYDYGZTJKcjs.__name.call(void 0, generatePackageJson, "generatePackageJson");
|
|
2435
2447
|
async function executeUnbuild(options) {
|
|
2436
|
-
|
|
2437
|
-
const stopwatch =
|
|
2448
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, ` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
|
|
2449
|
+
const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, `${options.name} (${options.projectRoot}) build`);
|
|
2438
2450
|
try {
|
|
2439
2451
|
const config = {
|
|
2440
2452
|
...options,
|
|
2441
2453
|
config: null,
|
|
2442
|
-
rootDir:
|
|
2454
|
+
rootDir: _chunkLXCK6Y4Ccjs.joinPaths.call(void 0, options.config.workspaceRoot, options.projectRoot)
|
|
2443
2455
|
};
|
|
2444
|
-
|
|
2445
|
-
${
|
|
2456
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, `Running with unbuild configuration:
|
|
2457
|
+
${_chunkLXCK6Y4Ccjs.formatLogMessage.call(void 0, config)}
|
|
2446
2458
|
`, options.config);
|
|
2447
2459
|
await build(options.projectRoot, false, config);
|
|
2448
2460
|
} finally {
|
|
@@ -2452,18 +2464,18 @@ ${_chunkFG6XQ26Mcjs.formatLogMessage.call(void 0, config)}
|
|
|
2452
2464
|
}
|
|
2453
2465
|
_chunkYDYGZTJKcjs.__name.call(void 0, executeUnbuild, "executeUnbuild");
|
|
2454
2466
|
async function copyBuildAssets(options) {
|
|
2455
|
-
|
|
2456
|
-
const stopwatch =
|
|
2457
|
-
await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outDir, options.projectRoot, options.
|
|
2467
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
|
|
2468
|
+
const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, `${options.name} asset copy`);
|
|
2469
|
+
await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
2458
2470
|
stopwatch();
|
|
2459
2471
|
return options;
|
|
2460
2472
|
}
|
|
2461
2473
|
_chunkYDYGZTJKcjs.__name.call(void 0, copyBuildAssets, "copyBuildAssets");
|
|
2462
2474
|
async function cleanOutputPath(options) {
|
|
2463
2475
|
if (options.clean !== false && options.outDir) {
|
|
2464
|
-
|
|
2465
|
-
const stopwatch =
|
|
2466
|
-
await
|
|
2476
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, ` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`, options.config);
|
|
2477
|
+
const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, `${options.name} output clean`);
|
|
2478
|
+
await _chunkCUQLNBV5cjs.cleanDirectories.call(void 0, options.name, options.outDir, options.config);
|
|
2467
2479
|
stopwatch();
|
|
2468
2480
|
}
|
|
2469
2481
|
return options;
|
|
@@ -2478,19 +2490,19 @@ async function build2(options) {
|
|
|
2478
2490
|
if (!workspaceRoot) {
|
|
2479
2491
|
throw new Error("Cannot find workspace root");
|
|
2480
2492
|
}
|
|
2481
|
-
const config = await
|
|
2482
|
-
|
|
2483
|
-
const stopwatch =
|
|
2493
|
+
const config = await getConfig(workspaceRoot.dir);
|
|
2494
|
+
_chunkLXCK6Y4Ccjs.writeDebug.call(void 0, ` \u26A1 Executing Storm Unbuild pipeline`, config);
|
|
2495
|
+
const stopwatch = _chunkLXCK6Y4Ccjs.getStopwatch.call(void 0, "Unbuild pipeline");
|
|
2484
2496
|
try {
|
|
2485
|
-
options.projectRoot =
|
|
2497
|
+
options.projectRoot = _chunkLXCK6Y4Ccjs.correctPaths.call(void 0, projectRoot);
|
|
2486
2498
|
const resolvedOptions = await resolveOptions(options, config);
|
|
2487
2499
|
await cleanOutputPath(resolvedOptions);
|
|
2488
2500
|
await generatePackageJson(resolvedOptions);
|
|
2489
2501
|
await executeUnbuild(resolvedOptions);
|
|
2490
2502
|
await copyBuildAssets(resolvedOptions);
|
|
2491
|
-
|
|
2503
|
+
_chunkLXCK6Y4Ccjs.writeSuccess.call(void 0, ` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`, config);
|
|
2492
2504
|
} catch (error) {
|
|
2493
|
-
|
|
2505
|
+
_chunkLXCK6Y4Ccjs.writeFatal.call(void 0, " \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.", config);
|
|
2494
2506
|
throw error;
|
|
2495
2507
|
} finally {
|
|
2496
2508
|
stopwatch();
|