@storm-software/unbuild 0.41.21 → 0.41.23
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 -2
- package/bin/unbuild.cjs +798 -412
- package/bin/unbuild.js +826 -420
- package/dist/build.cjs +8 -8
- package/dist/build.js +7 -7
- package/dist/{chunk-3GQAWCBQ.js → chunk-3RG5ZIWI.js} +0 -3
- package/dist/{chunk-HZNOKNKE.js → chunk-4KHUAP4R.js} +13 -10
- package/dist/{chunk-BFBEOACU.cjs → chunk-ALGMIE4E.cjs} +471 -257
- package/dist/{chunk-5FQ2QYFQ.js → chunk-ATN45QRM.js} +418 -204
- package/dist/{chunk-F4MPFQDI.cjs → chunk-FAW45G3E.cjs} +13 -10
- package/dist/{chunk-3BXXHK3F.cjs → chunk-MO3MUSJO.cjs} +7 -15
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/{chunk-DUDE4LYM.js → chunk-PCGRQKDH.js} +2 -10
- package/dist/{chunk-PWE7CANF.cjs → chunk-Q2G4VMOW.cjs} +198 -130
- package/dist/{chunk-ITHOVA3D.cjs → chunk-Q3NBYYR4.cjs} +4 -12
- package/dist/{chunk-ZB2JWLJS.cjs → chunk-Q4VUCJPK.cjs} +51 -16
- package/dist/chunk-WQLDD6CA.js +106 -0
- package/dist/{chunk-3BDIPKMO.js → chunk-XQLLOGJZ.js} +197 -129
- package/dist/{chunk-SMAV5VSP.js → chunk-XWLZOFQ4.js} +6 -14
- package/dist/clean.cjs +4 -4
- package/dist/clean.js +3 -3
- package/dist/index.cjs +9 -9
- package/dist/index.js +8 -8
- package/dist/plugins/analyze.cjs +4 -4
- package/dist/plugins/analyze.js +3 -3
- package/dist/plugins/on-error.cjs +4 -4
- package/dist/plugins/on-error.js +3 -3
- package/dist/plugins/swc.cjs +5 -8
- package/dist/plugins/swc.js +4 -7
- package/dist/plugins/tsc.cjs +4 -4
- package/dist/plugins/tsc.js +3 -3
- package/dist/plugins/type-definitions.cjs +9 -6
- package/dist/plugins/type-definitions.js +9 -6
- package/dist/types.cjs +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BGYQAVKQ.cjs +0 -13
- package/dist/chunk-XXRSY6EE.js +0 -71
- /package/dist/{chunk-OULCUN6I.js → chunk-GGNOJ77I.js} +0 -0
- /package/dist/{chunk-ORA4UQMU.cjs → chunk-SFZRYJZ2.cjs} +0 -0
package/bin/unbuild.cjs
CHANGED
|
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
8
|
var __copyProps = (to, from, except, desc) => {
|
|
10
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
10
|
for (let key of __getOwnPropNames(from))
|
|
@@ -123,23 +122,39 @@ var RegistryConfigSchema = import_zod.default.object({
|
|
|
123
122
|
cyclone: RegistryUrlConfigSchema,
|
|
124
123
|
container: RegistryUrlConfigSchema
|
|
125
124
|
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
126
|
-
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
125
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
126
|
+
MultiThemeColorConfigSchema
|
|
127
|
+
).describe("Colors used for various workspace elements");
|
|
127
128
|
var ColorConfigMapSchema = import_zod.default.union([
|
|
128
|
-
import_zod.default.object({
|
|
129
|
-
base: ColorConfigSchema
|
|
130
|
-
}),
|
|
129
|
+
import_zod.default.object({ base: ColorConfigSchema }),
|
|
131
130
|
import_zod.default.record(import_zod.default.string(), ColorConfigSchema)
|
|
132
131
|
]);
|
|
133
|
-
var ExtendsItemSchema = import_zod.default.string().trim().describe(
|
|
134
|
-
|
|
132
|
+
var ExtendsItemSchema = import_zod.default.string().trim().describe(
|
|
133
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
134
|
+
);
|
|
135
|
+
var ExtendsSchema = ExtendsItemSchema.or(
|
|
136
|
+
import_zod.default.array(ExtendsItemSchema)
|
|
137
|
+
).describe(
|
|
138
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
139
|
+
);
|
|
135
140
|
var WorkspaceBotConfigSchema = import_zod.default.object({
|
|
136
|
-
name: import_zod.default.string().trim().default("stormie-bot").describe(
|
|
141
|
+
name: import_zod.default.string().trim().default("stormie-bot").describe(
|
|
142
|
+
"The workspace bot user's name (this is the bot that will be used to perform various tasks)"
|
|
143
|
+
),
|
|
137
144
|
email: import_zod.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
138
|
-
}).describe(
|
|
145
|
+
}).describe(
|
|
146
|
+
"The workspace's bot user's config used to automated various operations tasks"
|
|
147
|
+
);
|
|
139
148
|
var WorkspaceReleaseConfigSchema = import_zod.default.object({
|
|
140
|
-
banner: import_zod.default.string().trim().default(STORM_DEFAULT_RELEASE_BANNER).describe(
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
banner: import_zod.default.string().trim().default(STORM_DEFAULT_RELEASE_BANNER).describe(
|
|
150
|
+
"A URL to a banner image used to display the workspace's release"
|
|
151
|
+
),
|
|
152
|
+
header: import_zod.default.string().trim().optional().describe(
|
|
153
|
+
"A header message appended to the start of the workspace's release notes"
|
|
154
|
+
),
|
|
155
|
+
footer: import_zod.default.string().trim().default(STORM_DEFAULT_RELEASE_FOOTER).describe(
|
|
156
|
+
"A footer message appended to the end of the workspace's release notes"
|
|
157
|
+
)
|
|
143
158
|
}).describe("The workspace's release config used during the release process");
|
|
144
159
|
var WorkspaceAccountConfigSchema = import_zod.default.object({
|
|
145
160
|
twitter: import_zod.default.string().trim().default(STORM_DEFAULT_ACCOUNT_TWITTER).describe("A Twitter/X account associated with the organization/project"),
|
|
@@ -148,23 +163,41 @@ var WorkspaceAccountConfigSchema = import_zod.default.object({
|
|
|
148
163
|
slack: import_zod.default.string().trim().default(STORM_DEFAULT_ACCOUNT_SLACK).describe("A Slack account associated with the organization/project"),
|
|
149
164
|
medium: import_zod.default.string().trim().default(STORM_DEFAULT_ACCOUNT_MEDIUM).describe("A Medium account associated with the organization/project"),
|
|
150
165
|
github: import_zod.default.string().trim().default(STORM_DEFAULT_ACCOUNT_GITHUB).describe("A GitHub account associated with the organization/project")
|
|
151
|
-
}).describe(
|
|
166
|
+
}).describe(
|
|
167
|
+
"The workspace's account config used to store various social media links"
|
|
168
|
+
);
|
|
152
169
|
var WorkspaceDirectoryConfigSchema = import_zod.default.object({
|
|
153
|
-
cache: import_zod.default.string().trim().optional().describe(
|
|
170
|
+
cache: import_zod.default.string().trim().optional().describe(
|
|
171
|
+
"The directory used to store the environment's cached file data"
|
|
172
|
+
),
|
|
154
173
|
data: import_zod.default.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
155
|
-
config: import_zod.default.string().trim().optional().describe(
|
|
174
|
+
config: import_zod.default.string().trim().optional().describe(
|
|
175
|
+
"The directory used to store the environment's configuration files"
|
|
176
|
+
),
|
|
156
177
|
temp: import_zod.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
157
178
|
log: import_zod.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
158
|
-
build: import_zod.default.string().trim().default("dist").describe(
|
|
159
|
-
|
|
179
|
+
build: import_zod.default.string().trim().default("dist").describe(
|
|
180
|
+
"The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
|
|
181
|
+
)
|
|
182
|
+
}).describe(
|
|
183
|
+
"Various directories used by the workspace to store data, cache, and configuration files"
|
|
184
|
+
);
|
|
160
185
|
var errorConfigSchema = import_zod.default.object({
|
|
161
186
|
codesFile: import_zod.default.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
|
|
162
|
-
url: import_zod.default.string().trim().url().optional().describe(
|
|
187
|
+
url: import_zod.default.string().trim().url().optional().describe(
|
|
188
|
+
"A URL to a page that looks up the workspace's error messages given a specific error code"
|
|
189
|
+
)
|
|
163
190
|
}).describe("The workspace's error config used during the error process");
|
|
164
191
|
var stormWorkspaceConfigSchema = import_zod.default.object({
|
|
165
|
-
$schema: import_zod.default.string().trim().default(
|
|
192
|
+
$schema: import_zod.default.string().trim().default(
|
|
193
|
+
"https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm-workspace.schema.json"
|
|
194
|
+
).optional().nullish().describe(
|
|
195
|
+
"The URL to the JSON schema file that describes the Storm configuration file"
|
|
196
|
+
),
|
|
166
197
|
extends: ExtendsSchema.optional(),
|
|
167
|
-
name: import_zod.default.string().trim().toLowerCase().optional().describe(
|
|
198
|
+
name: import_zod.default.string().trim().toLowerCase().optional().describe(
|
|
199
|
+
"The name of the service/package/scope using this configuration"
|
|
200
|
+
),
|
|
168
201
|
namespace: import_zod.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
169
202
|
organization: import_zod.default.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
170
203
|
repository: import_zod.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
@@ -180,21 +213,16 @@ var stormWorkspaceConfigSchema = import_zod.default.object({
|
|
|
180
213
|
release: WorkspaceReleaseConfigSchema,
|
|
181
214
|
account: WorkspaceAccountConfigSchema,
|
|
182
215
|
error: errorConfigSchema,
|
|
183
|
-
mode: import_zod.default.enum([
|
|
184
|
-
"development",
|
|
185
|
-
"staging",
|
|
186
|
-
"production"
|
|
187
|
-
]).default("production").describe("The current runtime environment mode for the package"),
|
|
216
|
+
mode: import_zod.default.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment mode for the package"),
|
|
188
217
|
workspaceRoot: import_zod.default.string().trim().describe("The root directory of the workspace"),
|
|
189
|
-
externalPackagePatterns: import_zod.default.array(import_zod.default.string()).default([]).describe(
|
|
218
|
+
externalPackagePatterns: import_zod.default.array(import_zod.default.string()).default([]).describe(
|
|
219
|
+
"The build will use these package patterns to determine if they should be external to the bundle"
|
|
220
|
+
),
|
|
190
221
|
skipCache: import_zod.default.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
191
222
|
directories: WorkspaceDirectoryConfigSchema,
|
|
192
|
-
packageManager: import_zod.default.enum([
|
|
193
|
-
"
|
|
194
|
-
|
|
195
|
-
"pnpm",
|
|
196
|
-
"bun"
|
|
197
|
-
]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
|
|
223
|
+
packageManager: import_zod.default.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
|
|
224
|
+
"The JavaScript/TypeScript package manager used by the repository"
|
|
225
|
+
),
|
|
198
226
|
timezone: import_zod.default.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
199
227
|
locale: import_zod.default.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
200
228
|
logLevel: import_zod.default.enum([
|
|
@@ -207,13 +235,23 @@ var stormWorkspaceConfigSchema = import_zod.default.object({
|
|
|
207
235
|
"debug",
|
|
208
236
|
"trace",
|
|
209
237
|
"all"
|
|
210
|
-
]).default("info").describe(
|
|
211
|
-
|
|
238
|
+
]).default("info").describe(
|
|
239
|
+
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
240
|
+
),
|
|
241
|
+
skipConfigLogging: import_zod.default.boolean().optional().describe(
|
|
242
|
+
"Should the logging of the current Storm Workspace configuration be skipped?"
|
|
243
|
+
),
|
|
212
244
|
registry: RegistryConfigSchema,
|
|
213
|
-
configFile: import_zod.default.string().trim().nullable().default(null).describe(
|
|
214
|
-
|
|
245
|
+
configFile: import_zod.default.string().trim().nullable().default(null).describe(
|
|
246
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
247
|
+
),
|
|
248
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
|
|
249
|
+
"Storm theme config values used for styling various package elements"
|
|
250
|
+
),
|
|
215
251
|
extensions: import_zod.default.record(import_zod.default.any()).optional().default({}).describe("Configuration of each used extension")
|
|
216
|
-
}).describe(
|
|
252
|
+
}).describe(
|
|
253
|
+
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
254
|
+
);
|
|
217
255
|
|
|
218
256
|
// ../config-tools/src/create-storm-config.ts
|
|
219
257
|
var import_defu2 = __toESM(require("defu"), 1);
|
|
@@ -278,11 +316,10 @@ function normalizeWindowsPath(input = "") {
|
|
|
278
316
|
}
|
|
279
317
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
280
318
|
}
|
|
281
|
-
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
282
319
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
283
320
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
284
321
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
285
|
-
var correctPaths =
|
|
322
|
+
var correctPaths = function(path2) {
|
|
286
323
|
if (!path2 || path2.length === 0) {
|
|
287
324
|
return ".";
|
|
288
325
|
}
|
|
@@ -310,8 +347,8 @@ var correctPaths = /* @__PURE__ */ __name(function(path2) {
|
|
|
310
347
|
return `//${path2}`;
|
|
311
348
|
}
|
|
312
349
|
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
313
|
-
}
|
|
314
|
-
var joinPaths =
|
|
350
|
+
};
|
|
351
|
+
var joinPaths = function(...segments) {
|
|
315
352
|
let path2 = "";
|
|
316
353
|
for (const seg of segments) {
|
|
317
354
|
if (!seg) {
|
|
@@ -331,7 +368,7 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
|
331
368
|
}
|
|
332
369
|
}
|
|
333
370
|
return correctPaths(path2);
|
|
334
|
-
}
|
|
371
|
+
};
|
|
335
372
|
function normalizeString(path2, allowAboveRoot) {
|
|
336
373
|
let res = "";
|
|
337
374
|
let lastSegmentLength = 0;
|
|
@@ -392,10 +429,9 @@ function normalizeString(path2, allowAboveRoot) {
|
|
|
392
429
|
}
|
|
393
430
|
return res;
|
|
394
431
|
}
|
|
395
|
-
|
|
396
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
432
|
+
var isAbsolute = function(p) {
|
|
397
433
|
return _IS_ABSOLUTE_RE.test(p);
|
|
398
|
-
}
|
|
434
|
+
};
|
|
399
435
|
|
|
400
436
|
// ../config-tools/src/utilities/find-up.ts
|
|
401
437
|
var import_node_fs = require("fs");
|
|
@@ -404,10 +440,14 @@ var MAX_PATH_SEARCH_DEPTH = 30;
|
|
|
404
440
|
var depth = 0;
|
|
405
441
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
406
442
|
const _startPath = startPath ?? process.cwd();
|
|
407
|
-
if (endDirectoryNames.some(
|
|
443
|
+
if (endDirectoryNames.some(
|
|
444
|
+
(endDirName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endDirName))
|
|
445
|
+
)) {
|
|
408
446
|
return _startPath;
|
|
409
447
|
}
|
|
410
|
-
if (endFileNames.some(
|
|
448
|
+
if (endFileNames.some(
|
|
449
|
+
(endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName))
|
|
450
|
+
)) {
|
|
411
451
|
return _startPath;
|
|
412
452
|
}
|
|
413
453
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
@@ -416,7 +456,6 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
|
416
456
|
}
|
|
417
457
|
return void 0;
|
|
418
458
|
}
|
|
419
|
-
__name(findFolderUp, "findFolderUp");
|
|
420
459
|
|
|
421
460
|
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
422
461
|
var rootFiles = [
|
|
@@ -463,21 +502,31 @@ var rootDirectories = [
|
|
|
463
502
|
];
|
|
464
503
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
465
504
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
466
|
-
return correctPaths(
|
|
467
|
-
|
|
468
|
-
|
|
505
|
+
return correctPaths(
|
|
506
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
return correctPaths(
|
|
510
|
+
findFolderUp(
|
|
511
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
512
|
+
rootFiles,
|
|
513
|
+
rootDirectories
|
|
514
|
+
)
|
|
515
|
+
);
|
|
469
516
|
}
|
|
470
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
471
517
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
472
518
|
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
473
519
|
if (!result) {
|
|
474
|
-
throw new Error(
|
|
475
|
-
|
|
476
|
-
|
|
520
|
+
throw new Error(
|
|
521
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
522
|
+
${rootFiles.join(
|
|
523
|
+
"\n"
|
|
524
|
+
)}
|
|
525
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
526
|
+
);
|
|
477
527
|
}
|
|
478
528
|
return result;
|
|
479
529
|
}
|
|
480
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
481
530
|
|
|
482
531
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
483
532
|
var DEFAULT_COLOR_CONFIG = {
|
|
@@ -508,7 +557,7 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
508
557
|
negative: "#dc2626"
|
|
509
558
|
}
|
|
510
559
|
};
|
|
511
|
-
var getDefaultConfig =
|
|
560
|
+
var getDefaultConfig = async (root) => {
|
|
512
561
|
let license = STORM_DEFAULT_LICENSE;
|
|
513
562
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
514
563
|
let name = void 0;
|
|
@@ -516,7 +565,10 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
516
565
|
let repository = void 0;
|
|
517
566
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
518
567
|
if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
|
|
519
|
-
const file = await (0, import_promises.readFile)(
|
|
568
|
+
const file = await (0, import_promises.readFile)(
|
|
569
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
570
|
+
"utf8"
|
|
571
|
+
);
|
|
520
572
|
if (file) {
|
|
521
573
|
const packageJson = JSON.parse(file);
|
|
522
574
|
if (packageJson.name) {
|
|
@@ -553,36 +605,36 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
553
605
|
url: `${homepage || STORM_DEFAULT_HOMEPAGE}/errors`
|
|
554
606
|
}
|
|
555
607
|
};
|
|
556
|
-
}
|
|
608
|
+
};
|
|
557
609
|
|
|
558
610
|
// ../config-tools/src/logger/chalk.ts
|
|
559
611
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
560
612
|
var chalkDefault = {
|
|
561
|
-
hex:
|
|
562
|
-
bgHex:
|
|
563
|
-
whiteBright:
|
|
564
|
-
}),
|
|
565
|
-
whiteBright:
|
|
566
|
-
gray:
|
|
613
|
+
hex: (_) => (message) => message,
|
|
614
|
+
bgHex: (_) => ({
|
|
615
|
+
whiteBright: (message) => message
|
|
616
|
+
}),
|
|
617
|
+
whiteBright: (message) => message,
|
|
618
|
+
gray: (message) => message,
|
|
567
619
|
bold: {
|
|
568
|
-
hex:
|
|
569
|
-
bgHex:
|
|
570
|
-
whiteBright:
|
|
571
|
-
}),
|
|
572
|
-
whiteBright:
|
|
620
|
+
hex: (_) => (message) => message,
|
|
621
|
+
bgHex: (_) => ({
|
|
622
|
+
whiteBright: (message) => message
|
|
623
|
+
}),
|
|
624
|
+
whiteBright: (message) => message
|
|
573
625
|
},
|
|
574
626
|
dim: {
|
|
575
|
-
hex:
|
|
576
|
-
gray:
|
|
627
|
+
hex: (_) => (message) => message,
|
|
628
|
+
gray: (message) => message
|
|
577
629
|
}
|
|
578
630
|
};
|
|
579
|
-
var getChalk =
|
|
631
|
+
var getChalk = () => {
|
|
580
632
|
let _chalk = import_chalk.default;
|
|
581
633
|
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
582
634
|
_chalk = chalkDefault;
|
|
583
635
|
}
|
|
584
636
|
return _chalk;
|
|
585
|
-
}
|
|
637
|
+
};
|
|
586
638
|
|
|
587
639
|
// ../config-tools/src/logger/is-unicode-supported.ts
|
|
588
640
|
function isUnicodeSupported() {
|
|
@@ -594,10 +646,9 @@ function isUnicodeSupported() {
|
|
|
594
646
|
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
595
647
|
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
596
648
|
}
|
|
597
|
-
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
598
649
|
|
|
599
650
|
// ../config-tools/src/logger/console-icons.ts
|
|
600
|
-
var useIcon =
|
|
651
|
+
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
601
652
|
var CONSOLE_ICONS = {
|
|
602
653
|
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
603
654
|
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
@@ -610,12 +661,12 @@ var CONSOLE_ICONS = {
|
|
|
610
661
|
};
|
|
611
662
|
|
|
612
663
|
// ../config-tools/src/logger/format-timestamp.ts
|
|
613
|
-
var formatTimestamp =
|
|
664
|
+
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
614
665
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
615
|
-
}
|
|
666
|
+
};
|
|
616
667
|
|
|
617
668
|
// ../config-tools/src/logger/get-log-level.ts
|
|
618
|
-
var getLogLevel =
|
|
669
|
+
var getLogLevel = (label) => {
|
|
619
670
|
switch (label) {
|
|
620
671
|
case "all":
|
|
621
672
|
return LogLevel.ALL;
|
|
@@ -636,8 +687,8 @@ var getLogLevel = /* @__PURE__ */ __name((label) => {
|
|
|
636
687
|
default:
|
|
637
688
|
return LogLevel.INFO;
|
|
638
689
|
}
|
|
639
|
-
}
|
|
640
|
-
var getLogLevelLabel =
|
|
690
|
+
};
|
|
691
|
+
var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
|
|
641
692
|
if (logLevel >= LogLevel.ALL) {
|
|
642
693
|
return LogLevelLabel.ALL;
|
|
643
694
|
}
|
|
@@ -663,14 +714,14 @@ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
|
|
|
663
714
|
return LogLevelLabel.SILENT;
|
|
664
715
|
}
|
|
665
716
|
return LogLevelLabel.INFO;
|
|
666
|
-
}
|
|
667
|
-
var isVerbose =
|
|
717
|
+
};
|
|
718
|
+
var isVerbose = (label = LogLevelLabel.SILENT) => {
|
|
668
719
|
const logLevel = typeof label === "string" ? getLogLevel(label) : label;
|
|
669
720
|
return logLevel >= LogLevel.DEBUG;
|
|
670
|
-
}
|
|
721
|
+
};
|
|
671
722
|
|
|
672
723
|
// ../config-tools/src/logger/console.ts
|
|
673
|
-
var getLogFn =
|
|
724
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
674
725
|
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
675
726
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
676
727
|
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
@@ -679,118 +730,147 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _c
|
|
|
679
730
|
}
|
|
680
731
|
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
681
732
|
return (message) => {
|
|
682
|
-
console.error(
|
|
733
|
+
console.error(
|
|
734
|
+
`
|
|
683
735
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
684
|
-
`
|
|
736
|
+
`
|
|
737
|
+
);
|
|
685
738
|
};
|
|
686
739
|
}
|
|
687
740
|
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
688
741
|
return (message) => {
|
|
689
|
-
console.error(
|
|
742
|
+
console.error(
|
|
743
|
+
`
|
|
690
744
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
691
|
-
`
|
|
745
|
+
`
|
|
746
|
+
);
|
|
692
747
|
};
|
|
693
748
|
}
|
|
694
749
|
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
695
750
|
return (message) => {
|
|
696
|
-
console.warn(
|
|
751
|
+
console.warn(
|
|
752
|
+
`
|
|
697
753
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
698
|
-
`
|
|
754
|
+
`
|
|
755
|
+
);
|
|
699
756
|
};
|
|
700
757
|
}
|
|
701
758
|
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
702
759
|
return (message) => {
|
|
703
|
-
console.info(
|
|
760
|
+
console.info(
|
|
761
|
+
`
|
|
704
762
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
705
|
-
`
|
|
763
|
+
`
|
|
764
|
+
);
|
|
706
765
|
};
|
|
707
766
|
}
|
|
708
767
|
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
709
768
|
return (message) => {
|
|
710
|
-
console.info(
|
|
769
|
+
console.info(
|
|
770
|
+
`
|
|
711
771
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
712
|
-
`
|
|
772
|
+
`
|
|
773
|
+
);
|
|
713
774
|
};
|
|
714
775
|
}
|
|
715
776
|
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
716
777
|
return (message) => {
|
|
717
|
-
console.debug(
|
|
778
|
+
console.debug(
|
|
779
|
+
`
|
|
718
780
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
719
|
-
`
|
|
781
|
+
`
|
|
782
|
+
);
|
|
720
783
|
};
|
|
721
784
|
}
|
|
722
785
|
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
723
786
|
return (message) => {
|
|
724
|
-
console.debug(
|
|
787
|
+
console.debug(
|
|
788
|
+
`
|
|
725
789
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
726
|
-
`
|
|
790
|
+
`
|
|
791
|
+
);
|
|
727
792
|
};
|
|
728
793
|
}
|
|
729
794
|
return (message) => {
|
|
730
|
-
console.log(
|
|
795
|
+
console.log(
|
|
796
|
+
`
|
|
731
797
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
732
|
-
`
|
|
798
|
+
`
|
|
799
|
+
);
|
|
733
800
|
};
|
|
734
|
-
}
|
|
735
|
-
var writeFatal =
|
|
736
|
-
var writeError =
|
|
737
|
-
var writeWarning =
|
|
738
|
-
var writeInfo =
|
|
739
|
-
var writeSuccess =
|
|
740
|
-
var writeDebug =
|
|
741
|
-
var writeTrace =
|
|
742
|
-
var getStopwatch =
|
|
801
|
+
};
|
|
802
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
803
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
804
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
805
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
806
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
807
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
808
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
809
|
+
var getStopwatch = (name) => {
|
|
743
810
|
const start = process.hrtime();
|
|
744
811
|
return () => {
|
|
745
812
|
const end = process.hrtime(start);
|
|
746
|
-
console.info(
|
|
747
|
-
|
|
748
|
-
`
|
|
813
|
+
console.info(
|
|
814
|
+
`
|
|
815
|
+
> \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
816
|
+
end[0] * 1e3 + end[1] / 1e6
|
|
817
|
+
)}ms to complete
|
|
818
|
+
`
|
|
819
|
+
);
|
|
749
820
|
};
|
|
750
|
-
}
|
|
821
|
+
};
|
|
751
822
|
var MAX_DEPTH = 4;
|
|
752
|
-
var formatLogMessage =
|
|
823
|
+
var formatLogMessage = (message, options = {}, depth2 = 0) => {
|
|
753
824
|
if (depth2 > MAX_DEPTH) {
|
|
754
825
|
return "<max depth>";
|
|
755
826
|
}
|
|
756
827
|
const prefix = options.prefix ?? "-";
|
|
757
828
|
const skip = options.skip ?? [];
|
|
758
829
|
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
759
|
-
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
var _isFunction =
|
|
830
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
831
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
832
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
833
|
+
message[key],
|
|
834
|
+
{ prefix: `${prefix}-`, skip },
|
|
835
|
+
depth2 + 1
|
|
836
|
+
) : message[key]}`
|
|
837
|
+
).join("\n")}` : message;
|
|
838
|
+
};
|
|
839
|
+
var _isFunction = (value) => {
|
|
769
840
|
try {
|
|
770
841
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
771
842
|
} catch (e) {
|
|
772
843
|
return false;
|
|
773
844
|
}
|
|
774
|
-
}
|
|
845
|
+
};
|
|
775
846
|
|
|
776
847
|
// ../config-tools/src/utilities/process-handler.ts
|
|
777
|
-
var exitWithError =
|
|
848
|
+
var exitWithError = (config) => {
|
|
778
849
|
writeFatal("Exiting script with an error status...", config);
|
|
779
850
|
process.exit(1);
|
|
780
|
-
}
|
|
781
|
-
var exitWithSuccess =
|
|
851
|
+
};
|
|
852
|
+
var exitWithSuccess = (config) => {
|
|
782
853
|
writeSuccess("Script completed successfully. Exiting...", config);
|
|
783
854
|
process.exit(0);
|
|
784
|
-
}
|
|
785
|
-
var handleProcess =
|
|
786
|
-
writeTrace(
|
|
855
|
+
};
|
|
856
|
+
var handleProcess = (config) => {
|
|
857
|
+
writeTrace(
|
|
858
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
859
|
+
config
|
|
860
|
+
);
|
|
787
861
|
process.on("unhandledRejection", (error) => {
|
|
788
|
-
writeError(
|
|
862
|
+
writeError(
|
|
863
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
864
|
+
config
|
|
865
|
+
);
|
|
789
866
|
exitWithError(config);
|
|
790
867
|
});
|
|
791
868
|
process.on("uncaughtException", (error) => {
|
|
792
|
-
writeError(
|
|
793
|
-
|
|
869
|
+
writeError(
|
|
870
|
+
`An Uncaught Exception occurred while running the program: ${error.message}
|
|
871
|
+
Stacktrace: ${error.stack}`,
|
|
872
|
+
config
|
|
873
|
+
);
|
|
794
874
|
exitWithError(config);
|
|
795
875
|
});
|
|
796
876
|
process.on("SIGTERM", (signal) => {
|
|
@@ -805,10 +885,10 @@ Stacktrace: ${error.stack}`, config);
|
|
|
805
885
|
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
806
886
|
exitWithError(config);
|
|
807
887
|
});
|
|
808
|
-
}
|
|
888
|
+
};
|
|
809
889
|
|
|
810
890
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
811
|
-
var getConfigFileByName =
|
|
891
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
812
892
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
813
893
|
const configs = await Promise.all([
|
|
814
894
|
(0, import_c12.loadConfig)({
|
|
@@ -818,7 +898,10 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
818
898
|
envName: fileName?.toUpperCase(),
|
|
819
899
|
jitiOptions: {
|
|
820
900
|
debug: false,
|
|
821
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
901
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
902
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
903
|
+
"jiti"
|
|
904
|
+
)
|
|
822
905
|
},
|
|
823
906
|
...options
|
|
824
907
|
}),
|
|
@@ -829,32 +912,45 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
829
912
|
envName: fileName?.toUpperCase(),
|
|
830
913
|
jitiOptions: {
|
|
831
914
|
debug: false,
|
|
832
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
915
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
916
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
917
|
+
"jiti"
|
|
918
|
+
)
|
|
833
919
|
},
|
|
834
920
|
configFile: fileName,
|
|
835
921
|
...options
|
|
836
922
|
})
|
|
837
923
|
]);
|
|
838
924
|
return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
|
|
839
|
-
}
|
|
840
|
-
var getConfigFile =
|
|
925
|
+
};
|
|
926
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
841
927
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
842
928
|
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
843
929
|
let config = result.config;
|
|
844
930
|
const configFile = result.configFile;
|
|
845
931
|
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
846
|
-
writeTrace(
|
|
847
|
-
|
|
848
|
-
|
|
932
|
+
writeTrace(
|
|
933
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
934
|
+
{
|
|
935
|
+
logLevel: "all"
|
|
936
|
+
}
|
|
937
|
+
);
|
|
849
938
|
}
|
|
850
939
|
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
851
|
-
const results = await Promise.all(
|
|
940
|
+
const results = await Promise.all(
|
|
941
|
+
additionalFileNames.map(
|
|
942
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
943
|
+
)
|
|
944
|
+
);
|
|
852
945
|
for (const result2 of results) {
|
|
853
946
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
854
947
|
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
855
|
-
writeTrace(
|
|
856
|
-
|
|
857
|
-
|
|
948
|
+
writeTrace(
|
|
949
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
950
|
+
{
|
|
951
|
+
logLevel: "all"
|
|
952
|
+
}
|
|
953
|
+
);
|
|
858
954
|
}
|
|
859
955
|
config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
|
|
860
956
|
}
|
|
@@ -865,20 +961,22 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
865
961
|
}
|
|
866
962
|
config.configFile = configFile;
|
|
867
963
|
return config;
|
|
868
|
-
}
|
|
964
|
+
};
|
|
869
965
|
|
|
870
966
|
// ../config-tools/src/env/get-env.ts
|
|
871
|
-
var getExtensionEnv =
|
|
967
|
+
var getExtensionEnv = (extensionName) => {
|
|
872
968
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
873
969
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
874
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
970
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
971
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
972
|
+
).join("");
|
|
875
973
|
if (name) {
|
|
876
974
|
ret[name] = process.env[key];
|
|
877
975
|
}
|
|
878
976
|
return ret;
|
|
879
977
|
}, {});
|
|
880
|
-
}
|
|
881
|
-
var getConfigEnv =
|
|
978
|
+
};
|
|
979
|
+
var getConfigEnv = () => {
|
|
882
980
|
const prefix = "STORM_";
|
|
883
981
|
let config = {
|
|
884
982
|
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
@@ -946,14 +1044,25 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
946
1044
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
947
1045
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
948
1046
|
},
|
|
949
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
1047
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
1048
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
1049
|
+
) ? getLogLevelLabel(
|
|
1050
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
1051
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
950
1052
|
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
951
1053
|
};
|
|
952
|
-
const themeNames = Object.keys(process.env).filter(
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1054
|
+
const themeNames = Object.keys(process.env).filter(
|
|
1055
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
1056
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
1057
|
+
)
|
|
1058
|
+
);
|
|
1059
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
1060
|
+
(ret, themeName) => {
|
|
1061
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
1062
|
+
return ret;
|
|
1063
|
+
},
|
|
1064
|
+
{}
|
|
1065
|
+
) : getThemeColorConfigEnv(prefix);
|
|
957
1066
|
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
958
1067
|
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
959
1068
|
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
@@ -974,23 +1083,17 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
974
1083
|
config = {
|
|
975
1084
|
...config,
|
|
976
1085
|
...parsed,
|
|
977
|
-
colors: {
|
|
978
|
-
|
|
979
|
-
...parsed.colors
|
|
980
|
-
},
|
|
981
|
-
extensions: {
|
|
982
|
-
...config.extensions,
|
|
983
|
-
...parsed.extensions
|
|
984
|
-
}
|
|
1086
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
1087
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
985
1088
|
};
|
|
986
1089
|
}
|
|
987
1090
|
return config;
|
|
988
|
-
}
|
|
989
|
-
var getThemeColorConfigEnv =
|
|
1091
|
+
};
|
|
1092
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
990
1093
|
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
991
1094
|
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
992
|
-
}
|
|
993
|
-
var getSingleThemeColorConfigEnv =
|
|
1095
|
+
};
|
|
1096
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
994
1097
|
return {
|
|
995
1098
|
dark: process.env[`${prefix}DARK`],
|
|
996
1099
|
light: process.env[`${prefix}LIGHT`],
|
|
@@ -1007,14 +1110,16 @@ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
1007
1110
|
positive: process.env[`${prefix}POSITIVE`],
|
|
1008
1111
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
1009
1112
|
};
|
|
1010
|
-
}
|
|
1011
|
-
var getMultiThemeColorConfigEnv =
|
|
1113
|
+
};
|
|
1114
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
1012
1115
|
return {
|
|
1013
|
-
light: getBaseThemeColorConfigEnv(
|
|
1116
|
+
light: getBaseThemeColorConfigEnv(
|
|
1117
|
+
`${prefix}_LIGHT_`
|
|
1118
|
+
),
|
|
1014
1119
|
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
1015
1120
|
};
|
|
1016
|
-
}
|
|
1017
|
-
var getBaseThemeColorConfigEnv =
|
|
1121
|
+
};
|
|
1122
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
1018
1123
|
return {
|
|
1019
1124
|
foreground: process.env[`${prefix}FOREGROUND`],
|
|
1020
1125
|
background: process.env[`${prefix}BACKGROUND`],
|
|
@@ -1031,13 +1136,16 @@ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
1031
1136
|
positive: process.env[`${prefix}POSITIVE`],
|
|
1032
1137
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
1033
1138
|
};
|
|
1034
|
-
}
|
|
1139
|
+
};
|
|
1035
1140
|
|
|
1036
1141
|
// ../config-tools/src/env/set-env.ts
|
|
1037
|
-
var setExtensionEnv =
|
|
1142
|
+
var setExtensionEnv = (extensionName, extension) => {
|
|
1038
1143
|
for (const key of Object.keys(extension ?? {})) {
|
|
1039
1144
|
if (extension[key]) {
|
|
1040
|
-
const result = key?.replace(
|
|
1145
|
+
const result = key?.replace(
|
|
1146
|
+
/([A-Z])+/g,
|
|
1147
|
+
(input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
|
|
1148
|
+
).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
1041
1149
|
let extensionKey;
|
|
1042
1150
|
if (result.length === 0) {
|
|
1043
1151
|
return;
|
|
@@ -1052,8 +1160,8 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
|
|
|
1052
1160
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
1053
1161
|
}
|
|
1054
1162
|
}
|
|
1055
|
-
}
|
|
1056
|
-
var setConfigEnv =
|
|
1163
|
+
};
|
|
1164
|
+
var setConfigEnv = (config) => {
|
|
1057
1165
|
const prefix = "STORM_";
|
|
1058
1166
|
if (config.extends) {
|
|
1059
1167
|
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
@@ -1142,7 +1250,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1142
1250
|
}
|
|
1143
1251
|
if (config.directories) {
|
|
1144
1252
|
if (!config.skipCache && config.directories.cache) {
|
|
1145
|
-
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1253
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1254
|
+
config.directories.cache
|
|
1255
|
+
);
|
|
1146
1256
|
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
1147
1257
|
}
|
|
1148
1258
|
if (config.directories.data) {
|
|
@@ -1150,7 +1260,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1150
1260
|
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
1151
1261
|
}
|
|
1152
1262
|
if (config.directories.config) {
|
|
1153
|
-
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1263
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1264
|
+
config.directories.config
|
|
1265
|
+
);
|
|
1154
1266
|
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
1155
1267
|
}
|
|
1156
1268
|
if (config.directories.temp) {
|
|
@@ -1162,7 +1274,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1162
1274
|
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
1163
1275
|
}
|
|
1164
1276
|
if (config.directories.build) {
|
|
1165
|
-
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1277
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1278
|
+
config.directories.build
|
|
1279
|
+
);
|
|
1166
1280
|
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
1167
1281
|
}
|
|
1168
1282
|
}
|
|
@@ -1183,7 +1297,10 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1183
1297
|
setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
1184
1298
|
}
|
|
1185
1299
|
} else {
|
|
1186
|
-
setThemeColorConfigEnv(
|
|
1300
|
+
setThemeColorConfigEnv(
|
|
1301
|
+
`${prefix}COLOR_`,
|
|
1302
|
+
config.colors
|
|
1303
|
+
);
|
|
1187
1304
|
}
|
|
1188
1305
|
if (config.repository) {
|
|
1189
1306
|
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
@@ -1195,7 +1312,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1195
1312
|
process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
1196
1313
|
}
|
|
1197
1314
|
if (config.externalPackagePatterns) {
|
|
1198
|
-
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
1315
|
+
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
1316
|
+
config.externalPackagePatterns
|
|
1317
|
+
);
|
|
1199
1318
|
}
|
|
1200
1319
|
if (config.registry) {
|
|
1201
1320
|
if (config.registry.github) {
|
|
@@ -1208,20 +1327,28 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1208
1327
|
process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
1209
1328
|
}
|
|
1210
1329
|
if (config.registry.cyclone) {
|
|
1211
|
-
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1330
|
+
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1331
|
+
config.registry.cyclone
|
|
1332
|
+
);
|
|
1212
1333
|
}
|
|
1213
1334
|
if (config.registry.container) {
|
|
1214
|
-
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1335
|
+
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1336
|
+
config.registry.container
|
|
1337
|
+
);
|
|
1215
1338
|
}
|
|
1216
1339
|
}
|
|
1217
1340
|
if (config.logLevel) {
|
|
1218
1341
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
1219
1342
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
1220
|
-
process.env.NX_VERBOSE_LOGGING = String(
|
|
1343
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
1344
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
1345
|
+
);
|
|
1221
1346
|
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1222
1347
|
}
|
|
1223
1348
|
if (config.skipConfigLogging !== void 0) {
|
|
1224
|
-
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1349
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1350
|
+
config.skipConfigLogging
|
|
1351
|
+
);
|
|
1225
1352
|
}
|
|
1226
1353
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
1227
1354
|
for (const key of Object.keys(config.extensions ?? {})) {
|
|
@@ -1229,11 +1356,11 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1229
1356
|
setExtensionEnv(key, config.extensions[key]);
|
|
1230
1357
|
}
|
|
1231
1358
|
}
|
|
1232
|
-
}
|
|
1233
|
-
var setThemeColorConfigEnv =
|
|
1359
|
+
};
|
|
1360
|
+
var setThemeColorConfigEnv = (prefix, config) => {
|
|
1234
1361
|
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
|
|
1235
|
-
}
|
|
1236
|
-
var setSingleThemeColorConfigEnv =
|
|
1362
|
+
};
|
|
1363
|
+
var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
1237
1364
|
if (config.dark) {
|
|
1238
1365
|
process.env[`${prefix}DARK`] = config.dark;
|
|
1239
1366
|
}
|
|
@@ -1276,14 +1403,14 @@ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1276
1403
|
if (config.negative) {
|
|
1277
1404
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1278
1405
|
}
|
|
1279
|
-
}
|
|
1280
|
-
var setMultiThemeColorConfigEnv =
|
|
1406
|
+
};
|
|
1407
|
+
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
1281
1408
|
return {
|
|
1282
1409
|
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
1283
1410
|
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
1284
1411
|
};
|
|
1285
|
-
}
|
|
1286
|
-
var setBaseThemeColorConfigEnv =
|
|
1412
|
+
};
|
|
1413
|
+
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
1287
1414
|
if (config.foreground) {
|
|
1288
1415
|
process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
1289
1416
|
}
|
|
@@ -1326,12 +1453,12 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1326
1453
|
if (config.negative) {
|
|
1327
1454
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1328
1455
|
}
|
|
1329
|
-
}
|
|
1456
|
+
};
|
|
1330
1457
|
|
|
1331
1458
|
// ../config-tools/src/create-storm-config.ts
|
|
1332
1459
|
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
1333
1460
|
var _static_cache = void 0;
|
|
1334
|
-
var createStormWorkspaceConfig =
|
|
1461
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
1335
1462
|
let result;
|
|
1336
1463
|
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
1337
1464
|
let _workspaceRoot = workspaceRoot;
|
|
@@ -1342,16 +1469,19 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
|
|
|
1342
1469
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
1343
1470
|
if (!configFile) {
|
|
1344
1471
|
if (!skipLogs) {
|
|
1345
|
-
writeWarning(
|
|
1346
|
-
|
|
1347
|
-
|
|
1472
|
+
writeWarning(
|
|
1473
|
+
"No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
|
|
1474
|
+
{ logLevel: "all" }
|
|
1475
|
+
);
|
|
1348
1476
|
}
|
|
1349
1477
|
if (useDefault === false) {
|
|
1350
1478
|
return void 0;
|
|
1351
1479
|
}
|
|
1352
1480
|
}
|
|
1353
1481
|
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1354
|
-
result = await stormWorkspaceConfigSchema.parseAsync(
|
|
1482
|
+
result = await stormWorkspaceConfigSchema.parseAsync(
|
|
1483
|
+
(0, import_defu2.default)(configEnv, configFile, defaultConfig)
|
|
1484
|
+
);
|
|
1355
1485
|
result.workspaceRoot ??= _workspaceRoot;
|
|
1356
1486
|
} else {
|
|
1357
1487
|
result = _static_cache.data;
|
|
@@ -1367,11 +1497,9 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
|
|
|
1367
1497
|
data: result
|
|
1368
1498
|
};
|
|
1369
1499
|
return result;
|
|
1370
|
-
}
|
|
1371
|
-
var createConfigExtension =
|
|
1372
|
-
const extension_cache_key = {
|
|
1373
|
-
extensionName
|
|
1374
|
-
};
|
|
1500
|
+
};
|
|
1501
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
1502
|
+
const extension_cache_key = { extensionName };
|
|
1375
1503
|
if (_extension_cache.has(extension_cache_key)) {
|
|
1376
1504
|
return _extension_cache.get(extension_cache_key);
|
|
1377
1505
|
}
|
|
@@ -1381,21 +1509,30 @@ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
|
1381
1509
|
}
|
|
1382
1510
|
_extension_cache.set(extension_cache_key, extension);
|
|
1383
1511
|
return extension;
|
|
1384
|
-
}
|
|
1385
|
-
var loadStormWorkspaceConfig =
|
|
1386
|
-
const config = await createStormWorkspaceConfig(
|
|
1512
|
+
};
|
|
1513
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
1514
|
+
const config = await createStormWorkspaceConfig(
|
|
1515
|
+
void 0,
|
|
1516
|
+
void 0,
|
|
1517
|
+
workspaceRoot,
|
|
1518
|
+
skipLogs,
|
|
1519
|
+
true
|
|
1520
|
+
);
|
|
1387
1521
|
setConfigEnv(config);
|
|
1388
1522
|
if (!skipLogs && !config.skipConfigLogging) {
|
|
1389
|
-
writeTrace(
|
|
1390
|
-
|
|
1523
|
+
writeTrace(
|
|
1524
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
1525
|
+
${formatLogMessage(config)}`,
|
|
1526
|
+
config
|
|
1527
|
+
);
|
|
1391
1528
|
}
|
|
1392
1529
|
return config;
|
|
1393
|
-
}
|
|
1530
|
+
};
|
|
1394
1531
|
|
|
1395
1532
|
// ../config-tools/src/get-config.ts
|
|
1396
|
-
var getConfig =
|
|
1533
|
+
var getConfig = (workspaceRoot, skipLogs = false) => {
|
|
1397
1534
|
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
|
|
1398
|
-
}
|
|
1535
|
+
};
|
|
1399
1536
|
|
|
1400
1537
|
// bin/unbuild.ts
|
|
1401
1538
|
var import_commander = require("commander");
|
|
@@ -1422,7 +1559,7 @@ var import_path = require("path");
|
|
|
1422
1559
|
var import_copy_assets_handler = require("@nx/js/src/utils/assets/copy-assets-handler");
|
|
1423
1560
|
var import_glob = require("glob");
|
|
1424
1561
|
var import_promises2 = require("fs/promises");
|
|
1425
|
-
var copyAssets =
|
|
1562
|
+
var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1426
1563
|
const pendingAssets = Array.from(assets ?? []);
|
|
1427
1564
|
pendingAssets.push({
|
|
1428
1565
|
input: projectRoot,
|
|
@@ -1448,8 +1585,11 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1448
1585
|
output: "src/"
|
|
1449
1586
|
});
|
|
1450
1587
|
}
|
|
1451
|
-
writeTrace(
|
|
1452
|
-
|
|
1588
|
+
writeTrace(
|
|
1589
|
+
`\u{1F4DD} Copying the following assets to the output directory:
|
|
1590
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
|
|
1591
|
+
config
|
|
1592
|
+
);
|
|
1453
1593
|
const assetHandler = new import_copy_assets_handler.CopyAssetsHandler({
|
|
1454
1594
|
projectDir: projectRoot,
|
|
1455
1595
|
rootDir: config.workspaceRoot,
|
|
@@ -1458,20 +1598,33 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
|
|
|
1458
1598
|
});
|
|
1459
1599
|
await assetHandler.processAllAssetsOnce();
|
|
1460
1600
|
if (includeSrc === true) {
|
|
1461
|
-
writeDebug(
|
|
1601
|
+
writeDebug(
|
|
1602
|
+
`\u{1F4DD} Adding banner and writing source files: ${joinPaths(
|
|
1603
|
+
outputPath,
|
|
1604
|
+
"src"
|
|
1605
|
+
)}`,
|
|
1606
|
+
config
|
|
1607
|
+
);
|
|
1462
1608
|
const files = await (0, import_glob.glob)([
|
|
1463
1609
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
1464
1610
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
1465
1611
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
1466
1612
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
1467
1613
|
]);
|
|
1468
|
-
await Promise.allSettled(
|
|
1614
|
+
await Promise.allSettled(
|
|
1615
|
+
files.map(
|
|
1616
|
+
async (file) => (0, import_promises2.writeFile)(
|
|
1617
|
+
file,
|
|
1618
|
+
`${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
1469
1619
|
|
|
1470
1620
|
${await (0, import_promises2.readFile)(file, "utf8")}
|
|
1471
1621
|
|
|
1472
|
-
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
|
|
1622
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
|
|
1623
|
+
)
|
|
1624
|
+
)
|
|
1625
|
+
);
|
|
1473
1626
|
}
|
|
1474
|
-
}
|
|
1627
|
+
};
|
|
1475
1628
|
|
|
1476
1629
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1477
1630
|
var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
|
|
@@ -1479,7 +1632,7 @@ var import_glob2 = require("glob");
|
|
|
1479
1632
|
var import_node_fs4 = require("fs");
|
|
1480
1633
|
var import_promises3 = require("fs/promises");
|
|
1481
1634
|
var import_project_graph = require("nx/src/project-graph/project-graph");
|
|
1482
|
-
var addPackageDependencies =
|
|
1635
|
+
var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
1483
1636
|
let projectGraph;
|
|
1484
1637
|
try {
|
|
1485
1638
|
projectGraph = (0, import_project_graph.readCachedProjectGraph)();
|
|
@@ -1488,16 +1641,35 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1488
1641
|
projectGraph = (0, import_project_graph.readCachedProjectGraph)();
|
|
1489
1642
|
}
|
|
1490
1643
|
if (!projectGraph) {
|
|
1491
|
-
throw new Error(
|
|
1644
|
+
throw new Error(
|
|
1645
|
+
"The Build process failed because the project graph is not available. Please run the build command again."
|
|
1646
|
+
);
|
|
1492
1647
|
}
|
|
1493
|
-
const projectDependencies = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(
|
|
1648
|
+
const projectDependencies = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(
|
|
1649
|
+
void 0,
|
|
1650
|
+
projectGraph,
|
|
1651
|
+
workspaceRoot,
|
|
1652
|
+
projectName,
|
|
1653
|
+
process.env.NX_TASK_TARGET_TARGET || "build",
|
|
1654
|
+
process.env.NX_TASK_TARGET_CONFIGURATION || "production",
|
|
1655
|
+
true
|
|
1656
|
+
);
|
|
1494
1657
|
const localPackages = [];
|
|
1495
|
-
for (const project of projectDependencies.dependencies.filter(
|
|
1658
|
+
for (const project of projectDependencies.dependencies.filter(
|
|
1659
|
+
(dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot
|
|
1660
|
+
)) {
|
|
1496
1661
|
const projectNode = project.node;
|
|
1497
1662
|
if (projectNode.data.root) {
|
|
1498
|
-
const projectPackageJsonPath = joinPaths(
|
|
1663
|
+
const projectPackageJsonPath = joinPaths(
|
|
1664
|
+
workspaceRoot,
|
|
1665
|
+
projectNode.data.root,
|
|
1666
|
+
"package.json"
|
|
1667
|
+
);
|
|
1499
1668
|
if ((0, import_node_fs4.existsSync)(projectPackageJsonPath)) {
|
|
1500
|
-
const projectPackageJsonContent = await (0, import_promises3.readFile)(
|
|
1669
|
+
const projectPackageJsonContent = await (0, import_promises3.readFile)(
|
|
1670
|
+
projectPackageJsonPath,
|
|
1671
|
+
"utf8"
|
|
1672
|
+
);
|
|
1501
1673
|
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
1502
1674
|
if (projectPackageJson.private !== true) {
|
|
1503
1675
|
localPackages.push(projectPackageJson);
|
|
@@ -1506,19 +1678,33 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1506
1678
|
}
|
|
1507
1679
|
}
|
|
1508
1680
|
if (localPackages.length > 0) {
|
|
1509
|
-
writeTrace(
|
|
1510
|
-
|
|
1681
|
+
writeTrace(
|
|
1682
|
+
`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
|
|
1683
|
+
);
|
|
1684
|
+
const projectJsonFile = await (0, import_promises3.readFile)(
|
|
1685
|
+
joinPaths(projectRoot, "project.json"),
|
|
1686
|
+
"utf8"
|
|
1687
|
+
);
|
|
1511
1688
|
const projectJson = JSON.parse(projectJsonFile);
|
|
1512
1689
|
const projectName2 = projectJson.name;
|
|
1513
1690
|
const projectConfigurations = (0, import_project_graph.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
1514
1691
|
if (!projectConfigurations?.projects?.[projectName2]) {
|
|
1515
|
-
throw new Error(
|
|
1692
|
+
throw new Error(
|
|
1693
|
+
"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."
|
|
1694
|
+
);
|
|
1516
1695
|
}
|
|
1517
1696
|
const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
|
|
1518
1697
|
if (projectConfigurations.projects?.[dep]) {
|
|
1519
|
-
const depPackageJsonPath = joinPaths(
|
|
1698
|
+
const depPackageJsonPath = joinPaths(
|
|
1699
|
+
workspaceRoot,
|
|
1700
|
+
projectConfigurations.projects[dep].root,
|
|
1701
|
+
"package.json"
|
|
1702
|
+
);
|
|
1520
1703
|
if ((0, import_node_fs4.existsSync)(depPackageJsonPath)) {
|
|
1521
|
-
const depPackageJsonContent = (0, import_node_fs4.readFileSync)(
|
|
1704
|
+
const depPackageJsonContent = (0, import_node_fs4.readFileSync)(
|
|
1705
|
+
depPackageJsonPath,
|
|
1706
|
+
"utf8"
|
|
1707
|
+
);
|
|
1522
1708
|
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
1523
1709
|
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
1524
1710
|
ret.push(depPackageJson.name);
|
|
@@ -1543,10 +1729,13 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1543
1729
|
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
1544
1730
|
}
|
|
1545
1731
|
return packageJson;
|
|
1546
|
-
}
|
|
1547
|
-
var addWorkspacePackageJsonFields =
|
|
1732
|
+
};
|
|
1733
|
+
var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
1548
1734
|
const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
1549
|
-
const workspacePackageJsonContent = await (0, import_promises3.readFile)(
|
|
1735
|
+
const workspacePackageJsonContent = await (0, import_promises3.readFile)(
|
|
1736
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
1737
|
+
"utf8"
|
|
1738
|
+
);
|
|
1550
1739
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
1551
1740
|
packageJson.type ??= "module";
|
|
1552
1741
|
packageJson.sideEffects ??= false;
|
|
@@ -1557,9 +1746,7 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfi
|
|
|
1557
1746
|
}
|
|
1558
1747
|
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
1559
1748
|
}
|
|
1560
|
-
packageJson.files ??= [
|
|
1561
|
-
"dist/**/*"
|
|
1562
|
-
];
|
|
1749
|
+
packageJson.files ??= ["dist/**/*"];
|
|
1563
1750
|
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
1564
1751
|
packageJson.files.push("src/**/*");
|
|
1565
1752
|
}
|
|
@@ -1575,20 +1762,16 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfi
|
|
|
1575
1762
|
packageJson.author ??= workspacePackageJson.author;
|
|
1576
1763
|
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
1577
1764
|
if (!packageJson.maintainers && packageJson.author) {
|
|
1578
|
-
packageJson.maintainers = [
|
|
1579
|
-
packageJson.author
|
|
1580
|
-
];
|
|
1765
|
+
packageJson.maintainers = [packageJson.author];
|
|
1581
1766
|
}
|
|
1582
1767
|
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
1583
1768
|
if (!packageJson.contributors && packageJson.author) {
|
|
1584
|
-
packageJson.contributors = [
|
|
1585
|
-
packageJson.author
|
|
1586
|
-
];
|
|
1769
|
+
packageJson.contributors = [packageJson.author];
|
|
1587
1770
|
}
|
|
1588
1771
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
1589
1772
|
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
1590
1773
|
return packageJson;
|
|
1591
|
-
}
|
|
1774
|
+
};
|
|
1592
1775
|
|
|
1593
1776
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
1594
1777
|
var import_glob3 = require("glob");
|
|
@@ -1617,30 +1800,20 @@ async function clean(name = "Unbuild", directory, config) {
|
|
|
1617
1800
|
await cleanDirectories(name, directory, config);
|
|
1618
1801
|
stopwatch();
|
|
1619
1802
|
}
|
|
1620
|
-
__name(clean, "clean");
|
|
1621
1803
|
async function cleanDirectories(name = "Unbuild", directory, config) {
|
|
1622
|
-
await (0, import_promises5.rm)(directory, {
|
|
1623
|
-
recursive: true,
|
|
1624
|
-
force: true
|
|
1625
|
-
});
|
|
1804
|
+
await (0, import_promises5.rm)(directory, { recursive: true, force: true });
|
|
1626
1805
|
}
|
|
1627
|
-
__name(cleanDirectories, "cleanDirectories");
|
|
1628
1806
|
|
|
1629
1807
|
// src/plugins/analyze.ts
|
|
1630
|
-
var formatBytes =
|
|
1808
|
+
var formatBytes = (bytes) => {
|
|
1631
1809
|
if (bytes === 0) return "0 Byte";
|
|
1632
1810
|
const k = 1e3;
|
|
1633
1811
|
const dm = 3;
|
|
1634
|
-
const sizes = [
|
|
1635
|
-
"Bytes",
|
|
1636
|
-
"KB",
|
|
1637
|
-
"MB",
|
|
1638
|
-
"GB"
|
|
1639
|
-
];
|
|
1812
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
1640
1813
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1641
1814
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
1642
|
-
}
|
|
1643
|
-
var analyzePlugin =
|
|
1815
|
+
};
|
|
1816
|
+
var analyzePlugin = (options) => {
|
|
1644
1817
|
return {
|
|
1645
1818
|
name: "storm:analyzer",
|
|
1646
1819
|
renderChunk(source, chunk) {
|
|
@@ -1649,28 +1822,34 @@ var analyzePlugin = /* @__PURE__ */ __name((options) => {
|
|
|
1649
1822
|
writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
|
|
1650
1823
|
}
|
|
1651
1824
|
};
|
|
1652
|
-
}
|
|
1825
|
+
};
|
|
1653
1826
|
|
|
1654
1827
|
// src/plugins/on-error.ts
|
|
1655
|
-
var onErrorPlugin =
|
|
1828
|
+
var onErrorPlugin = (options) => ({
|
|
1656
1829
|
name: "storm:on-error",
|
|
1657
1830
|
buildEnd(error) {
|
|
1658
1831
|
if (error) {
|
|
1659
|
-
writeError(
|
|
1832
|
+
writeError(
|
|
1833
|
+
`The following errors occurred during the build:
|
|
1660
1834
|
${error ? error.message : "Unknown build error"}
|
|
1661
1835
|
|
|
1662
|
-
`,
|
|
1836
|
+
`,
|
|
1837
|
+
options.config
|
|
1838
|
+
);
|
|
1663
1839
|
throw new Error("Storm unbuild process failed with errors.");
|
|
1664
1840
|
}
|
|
1665
1841
|
},
|
|
1666
1842
|
renderError(error) {
|
|
1667
|
-
writeError(
|
|
1843
|
+
writeError(
|
|
1844
|
+
`The following errors occurred during the build:
|
|
1668
1845
|
${error ? error.message : "Unknown build error"}
|
|
1669
1846
|
|
|
1670
|
-
`,
|
|
1847
|
+
`,
|
|
1848
|
+
options.config
|
|
1849
|
+
);
|
|
1671
1850
|
throw new Error("Storm unbuild process failed with errors.");
|
|
1672
1851
|
}
|
|
1673
|
-
})
|
|
1852
|
+
});
|
|
1674
1853
|
|
|
1675
1854
|
// src/plugins/tsc.ts
|
|
1676
1855
|
var import_devkit3 = require("@nx/devkit");
|
|
@@ -1688,12 +1867,20 @@ async function loadConfig2(configPath) {
|
|
|
1688
1867
|
if (!/\.(js|mjs)$/.test((0, import_node_path4.extname)(configPath))) {
|
|
1689
1868
|
throw new Error("Unsupported config file format");
|
|
1690
1869
|
}
|
|
1691
|
-
return import((0, import_node_url.pathToFileURL)(configPath).toString()).then(
|
|
1870
|
+
return import((0, import_node_url.pathToFileURL)(configPath).toString()).then(
|
|
1871
|
+
(config) => config.default
|
|
1872
|
+
);
|
|
1692
1873
|
}
|
|
1693
|
-
__name(loadConfig2, "loadConfig");
|
|
1694
1874
|
async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
|
|
1695
|
-
const tsConfigFile = import_typescript.default.readConfigFile(
|
|
1696
|
-
|
|
1875
|
+
const tsConfigFile = import_typescript.default.readConfigFile(
|
|
1876
|
+
(0, import_devkit2.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath),
|
|
1877
|
+
import_typescript.default.sys.readFile
|
|
1878
|
+
);
|
|
1879
|
+
const tsConfig = import_typescript.default.parseJsonConfigFileContent(
|
|
1880
|
+
tsConfigFile.config,
|
|
1881
|
+
import_typescript.default.sys,
|
|
1882
|
+
(0, import_node_path4.dirname)((0, import_devkit2.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath))
|
|
1883
|
+
);
|
|
1697
1884
|
const compilerOptions = {
|
|
1698
1885
|
rootDir: projectRoot,
|
|
1699
1886
|
declaration: true,
|
|
@@ -1702,10 +1889,9 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
|
|
|
1702
1889
|
writeTrace(compilerOptions, config);
|
|
1703
1890
|
return compilerOptions;
|
|
1704
1891
|
}
|
|
1705
|
-
__name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
1706
1892
|
|
|
1707
1893
|
// src/plugins/tsc.ts
|
|
1708
|
-
var tscPlugin =
|
|
1894
|
+
var tscPlugin = async (options) => {
|
|
1709
1895
|
let projectGraph;
|
|
1710
1896
|
try {
|
|
1711
1897
|
projectGraph = (0, import_devkit3.readCachedProjectGraph)();
|
|
@@ -1714,22 +1900,45 @@ var tscPlugin = /* @__PURE__ */ __name(async (options) => {
|
|
|
1714
1900
|
projectGraph = (0, import_devkit3.readCachedProjectGraph)();
|
|
1715
1901
|
}
|
|
1716
1902
|
if (!projectGraph) {
|
|
1717
|
-
throw new Error(
|
|
1718
|
-
|
|
1719
|
-
|
|
1903
|
+
throw new Error(
|
|
1904
|
+
"The build process failed because the project graph is not available. Please run the build command again."
|
|
1905
|
+
);
|
|
1906
|
+
}
|
|
1907
|
+
const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(
|
|
1908
|
+
void 0,
|
|
1909
|
+
projectGraph,
|
|
1910
|
+
options.config.workspaceRoot,
|
|
1911
|
+
options.projectName,
|
|
1912
|
+
process.env.NX_TASK_TARGET_TARGET || "build",
|
|
1913
|
+
process.env.NX_TASK_TARGET_CONFIGURATION || "production",
|
|
1914
|
+
true
|
|
1915
|
+
);
|
|
1720
1916
|
let dependencies = result.dependencies;
|
|
1721
|
-
const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(
|
|
1917
|
+
const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(
|
|
1918
|
+
import_compiler_helper_dependency.HelperDependency.tsc,
|
|
1919
|
+
options.tsconfig,
|
|
1920
|
+
dependencies,
|
|
1921
|
+
projectGraph,
|
|
1922
|
+
true
|
|
1923
|
+
);
|
|
1722
1924
|
if (tsLibDependency) {
|
|
1723
|
-
dependencies = dependencies.filter(
|
|
1925
|
+
dependencies = dependencies.filter(
|
|
1926
|
+
(deps) => deps.name !== tsLibDependency.name
|
|
1927
|
+
);
|
|
1724
1928
|
dependencies.push(tsLibDependency);
|
|
1725
1929
|
}
|
|
1726
|
-
const compilerOptions = await createTsCompilerOptions(
|
|
1930
|
+
const compilerOptions = await createTsCompilerOptions(
|
|
1931
|
+
options.config,
|
|
1932
|
+
options.tsconfig,
|
|
1933
|
+
options.projectRoot,
|
|
1934
|
+
dependencies
|
|
1935
|
+
);
|
|
1727
1936
|
return (0, import_rollup_plugin_typescript2.default)({
|
|
1728
1937
|
check: options.declaration !== false,
|
|
1729
1938
|
tsconfig: options.tsconfig,
|
|
1730
1939
|
tsconfigOverride: compilerOptions
|
|
1731
1940
|
});
|
|
1732
|
-
}
|
|
1941
|
+
};
|
|
1733
1942
|
|
|
1734
1943
|
// src/build.ts
|
|
1735
1944
|
async function resolveOptions(options, config) {
|
|
@@ -1750,16 +1959,26 @@ async function resolveOptions(options, config) {
|
|
|
1750
1959
|
projectGraph = (0, import_devkit4.readCachedProjectGraph)();
|
|
1751
1960
|
}
|
|
1752
1961
|
if (!projectGraph) {
|
|
1753
|
-
throw new Error(
|
|
1754
|
-
|
|
1755
|
-
|
|
1962
|
+
throw new Error(
|
|
1963
|
+
"The build process failed because the project graph is not available. Please run the build command again."
|
|
1964
|
+
);
|
|
1965
|
+
}
|
|
1966
|
+
const projectJsonPath = joinPaths(
|
|
1967
|
+
config.workspaceRoot,
|
|
1968
|
+
options.projectRoot,
|
|
1969
|
+
"project.json"
|
|
1970
|
+
);
|
|
1756
1971
|
if (!(0, import_node_fs6.existsSync)(projectJsonPath)) {
|
|
1757
1972
|
throw new Error("Cannot find project.json configuration");
|
|
1758
1973
|
}
|
|
1759
1974
|
const projectJsonContent = await (0, import_promises6.readFile)(projectJsonPath, "utf8");
|
|
1760
1975
|
const projectJson = JSON.parse(projectJsonContent);
|
|
1761
1976
|
const projectName = projectJson.name;
|
|
1762
|
-
const packageJsonPath = joinPaths(
|
|
1977
|
+
const packageJsonPath = joinPaths(
|
|
1978
|
+
config.workspaceRoot,
|
|
1979
|
+
options.projectRoot,
|
|
1980
|
+
"package.json"
|
|
1981
|
+
);
|
|
1763
1982
|
if (!(0, import_node_fs6.existsSync)(packageJsonPath)) {
|
|
1764
1983
|
throw new Error("Cannot find package.json configuration");
|
|
1765
1984
|
}
|
|
@@ -1782,17 +2001,31 @@ async function resolveOptions(options, config) {
|
|
|
1782
2001
|
if (!(0, import_node_fs6.existsSync)(sourceRoot)) {
|
|
1783
2002
|
throw new Error("Cannot find sourceRoot directory");
|
|
1784
2003
|
}
|
|
1785
|
-
const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(
|
|
2004
|
+
const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(
|
|
2005
|
+
void 0,
|
|
2006
|
+
projectGraph,
|
|
2007
|
+
config.workspaceRoot,
|
|
2008
|
+
projectName,
|
|
2009
|
+
process.env.NX_TASK_TARGET_TARGET || "build",
|
|
2010
|
+
process.env.NX_TASK_TARGET_CONFIGURATION || "production",
|
|
2011
|
+
true
|
|
2012
|
+
);
|
|
1786
2013
|
let dependencies = result.dependencies;
|
|
1787
|
-
const tsLibDependency = (0, import_js.getHelperDependency)(
|
|
2014
|
+
const tsLibDependency = (0, import_js.getHelperDependency)(
|
|
2015
|
+
import_js.HelperDependency.tsc,
|
|
2016
|
+
tsconfig,
|
|
2017
|
+
dependencies,
|
|
2018
|
+
projectGraph,
|
|
2019
|
+
true
|
|
2020
|
+
);
|
|
1788
2021
|
if (tsLibDependency) {
|
|
1789
|
-
dependencies = dependencies.filter(
|
|
2022
|
+
dependencies = dependencies.filter(
|
|
2023
|
+
(deps) => deps.name !== tsLibDependency.name
|
|
2024
|
+
);
|
|
1790
2025
|
dependencies.push(tsLibDependency);
|
|
1791
2026
|
}
|
|
1792
2027
|
const name = options.name || projectName;
|
|
1793
|
-
const entries = options.entry ?? [
|
|
1794
|
-
sourceRoot
|
|
1795
|
-
];
|
|
2028
|
+
const entries = options.entry ?? [sourceRoot];
|
|
1796
2029
|
const resolvedOptions = {
|
|
1797
2030
|
...options,
|
|
1798
2031
|
name,
|
|
@@ -1812,7 +2045,14 @@ async function resolveOptions(options, config) {
|
|
|
1812
2045
|
while (entryPath.startsWith("/")) {
|
|
1813
2046
|
entryPath = entryPath.substring(1);
|
|
1814
2047
|
}
|
|
1815
|
-
const outDir = joinPaths(
|
|
2048
|
+
const outDir = joinPaths(
|
|
2049
|
+
(0, import_node_path5.relative)(
|
|
2050
|
+
joinPaths(config.workspaceRoot, options.projectRoot),
|
|
2051
|
+
config.workspaceRoot
|
|
2052
|
+
),
|
|
2053
|
+
outputPath,
|
|
2054
|
+
"dist"
|
|
2055
|
+
);
|
|
1816
2056
|
ret.push({
|
|
1817
2057
|
name: `${name}-esm`,
|
|
1818
2058
|
builder: "mkdist",
|
|
@@ -1890,7 +2130,9 @@ async function resolveOptions(options, config) {
|
|
|
1890
2130
|
}
|
|
1891
2131
|
}
|
|
1892
2132
|
};
|
|
1893
|
-
dependencies = dependencies.filter(
|
|
2133
|
+
dependencies = dependencies.filter(
|
|
2134
|
+
(dep) => dep.node.type === "npm" || dep.node.type === "lib" || dep.node.type === "app"
|
|
2135
|
+
);
|
|
1894
2136
|
if (dependencies.length > 0) {
|
|
1895
2137
|
resolvedOptions.dependencies = dependencies.map((dep) => dep.name);
|
|
1896
2138
|
}
|
|
@@ -1898,7 +2140,9 @@ async function resolveOptions(options, config) {
|
|
|
1898
2140
|
resolvedOptions.devDependencies = Object.keys(packageJson.devDependencies);
|
|
1899
2141
|
}
|
|
1900
2142
|
if (packageJson.peerDependencies) {
|
|
1901
|
-
resolvedOptions.peerDependencies = Object.keys(
|
|
2143
|
+
resolvedOptions.peerDependencies = Object.keys(
|
|
2144
|
+
packageJson.peerDependencies
|
|
2145
|
+
);
|
|
1902
2146
|
}
|
|
1903
2147
|
if (options.rollup) {
|
|
1904
2148
|
let rollup = {};
|
|
@@ -1913,38 +2157,45 @@ async function resolveOptions(options, config) {
|
|
|
1913
2157
|
resolvedOptions.rollup = (0, import_defu3.default)(resolvedOptions.rollup ?? {}, rollup);
|
|
1914
2158
|
}
|
|
1915
2159
|
resolvedOptions.hooks = {
|
|
1916
|
-
"rollup:options":
|
|
2160
|
+
"rollup:options": async (ctx, opts) => {
|
|
1917
2161
|
if (options.plugins && options.plugins.length > 0) {
|
|
1918
|
-
writeDebug(
|
|
2162
|
+
writeDebug(
|
|
2163
|
+
` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`,
|
|
2164
|
+
config
|
|
2165
|
+
);
|
|
1919
2166
|
opts.plugins = options.plugins;
|
|
1920
2167
|
} else {
|
|
1921
|
-
writeDebug(
|
|
2168
|
+
writeDebug(
|
|
2169
|
+
` \u{1F9E9} No plugins found in provided build options, using default plugins`,
|
|
2170
|
+
config
|
|
2171
|
+
);
|
|
1922
2172
|
opts.plugins = await Promise.all([
|
|
1923
2173
|
analyzePlugin(resolvedOptions),
|
|
1924
2174
|
tscPlugin(resolvedOptions),
|
|
1925
2175
|
onErrorPlugin(resolvedOptions)
|
|
1926
2176
|
]);
|
|
1927
2177
|
}
|
|
1928
|
-
},
|
|
1929
|
-
"mkdist:entry:options":
|
|
2178
|
+
},
|
|
2179
|
+
"mkdist:entry:options": async (ctx, entry, opts) => {
|
|
1930
2180
|
opts.esbuild ||= {};
|
|
1931
2181
|
opts.esbuild.platform ??= resolvedOptions.platform;
|
|
1932
2182
|
opts.esbuild.minify ??= resolvedOptions.minify ?? !resolvedOptions.debug;
|
|
1933
2183
|
opts.esbuild.sourcemap ??= resolvedOptions.sourcemap ?? !!options.debug;
|
|
1934
2184
|
if (options.loaders) {
|
|
1935
2185
|
if (typeof options.loaders === "function") {
|
|
1936
|
-
opts.loaders = await Promise.resolve(
|
|
2186
|
+
opts.loaders = await Promise.resolve(
|
|
2187
|
+
options.loaders(ctx, entry, opts)
|
|
2188
|
+
);
|
|
1937
2189
|
} else {
|
|
1938
2190
|
opts.loaders = options.loaders;
|
|
1939
2191
|
}
|
|
1940
2192
|
}
|
|
1941
|
-
}
|
|
2193
|
+
}
|
|
1942
2194
|
};
|
|
1943
2195
|
stopwatch();
|
|
1944
2196
|
return resolvedOptions;
|
|
1945
2197
|
}
|
|
1946
|
-
|
|
1947
|
-
var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot, projectRoot) => {
|
|
2198
|
+
var addPackageJsonExport = (file, type = "module", sourceRoot, projectRoot) => {
|
|
1948
2199
|
let root = sourceRoot.replace(projectRoot, "");
|
|
1949
2200
|
while (root.startsWith(".")) {
|
|
1950
2201
|
root = root.substring(1);
|
|
@@ -1973,7 +2224,7 @@ var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", source
|
|
|
1973
2224
|
default: type === "commonjs" ? `./dist/${entry}.cjs` : `./dist/${entry}.mjs`
|
|
1974
2225
|
}
|
|
1975
2226
|
};
|
|
1976
|
-
}
|
|
2227
|
+
};
|
|
1977
2228
|
async function generatePackageJson(options) {
|
|
1978
2229
|
if (options.generatePackageJson !== false && (0, import_node_fs6.existsSync)(joinPaths(options.projectRoot, "package.json"))) {
|
|
1979
2230
|
writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
|
|
@@ -1982,100 +2233,154 @@ async function generatePackageJson(options) {
|
|
|
1982
2233
|
if (!(0, import_node_fs6.existsSync)(packageJsonPath)) {
|
|
1983
2234
|
throw new Error("Cannot find package.json configuration");
|
|
1984
2235
|
}
|
|
1985
|
-
const packageJsonContent = await (0, import_promises6.readFile)(
|
|
2236
|
+
const packageJsonContent = await (0, import_promises6.readFile)(
|
|
2237
|
+
joinPaths(
|
|
2238
|
+
options.config.workspaceRoot,
|
|
2239
|
+
options.projectRoot,
|
|
2240
|
+
"package.json"
|
|
2241
|
+
),
|
|
2242
|
+
"utf8"
|
|
2243
|
+
);
|
|
1986
2244
|
if (!packageJsonContent) {
|
|
1987
2245
|
throw new Error("Cannot find package.json configuration file");
|
|
1988
2246
|
}
|
|
1989
2247
|
let packageJson = JSON.parse(packageJsonContent);
|
|
1990
|
-
packageJson = await addPackageDependencies(
|
|
1991
|
-
|
|
2248
|
+
packageJson = await addPackageDependencies(
|
|
2249
|
+
options.config.workspaceRoot,
|
|
2250
|
+
options.projectRoot,
|
|
2251
|
+
options.projectName,
|
|
2252
|
+
packageJson
|
|
2253
|
+
);
|
|
2254
|
+
packageJson = await addWorkspacePackageJsonFields(
|
|
2255
|
+
options.config,
|
|
2256
|
+
options.projectRoot,
|
|
2257
|
+
options.sourceRoot,
|
|
2258
|
+
options.projectName,
|
|
2259
|
+
false,
|
|
2260
|
+
packageJson
|
|
2261
|
+
);
|
|
1992
2262
|
packageJson.exports ??= {};
|
|
1993
|
-
await Promise.all(
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
ret.
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2263
|
+
await Promise.all(
|
|
2264
|
+
options.entries.reduce((ret, entry) => {
|
|
2265
|
+
let entryPath = typeof entry === "string" ? entry : entry.input;
|
|
2266
|
+
entryPath = entryPath.replaceAll("\\", "/");
|
|
2267
|
+
while (entryPath.startsWith(".")) {
|
|
2268
|
+
entryPath = entryPath.substring(1);
|
|
2269
|
+
}
|
|
2270
|
+
while (entryPath.startsWith("/")) {
|
|
2271
|
+
entryPath = entryPath.substring(1);
|
|
2272
|
+
}
|
|
2273
|
+
entryPath = `./${joinPaths(options.projectRoot, entryPath)}`;
|
|
2274
|
+
if (!ret.includes(entryPath)) {
|
|
2275
|
+
ret.push(entryPath);
|
|
2276
|
+
}
|
|
2277
|
+
return ret;
|
|
2278
|
+
}, []).map(async (entryPath) => {
|
|
2279
|
+
const files = await new import_glob4.Glob("**/*.{ts,tsx}", {
|
|
2280
|
+
absolute: false,
|
|
2281
|
+
cwd: entryPath,
|
|
2282
|
+
root: entryPath
|
|
2283
|
+
}).walk();
|
|
2284
|
+
files.forEach((file) => {
|
|
2285
|
+
addPackageJsonExport(
|
|
2286
|
+
file,
|
|
2287
|
+
packageJson.type,
|
|
2288
|
+
options.sourceRoot,
|
|
2289
|
+
options.projectRoot
|
|
2290
|
+
);
|
|
2291
|
+
const split = file.split(".");
|
|
2292
|
+
split.pop();
|
|
2293
|
+
const entry = split.join(".").replaceAll("\\", "/");
|
|
2294
|
+
packageJson.exports[`./${entry}`] ??= addPackageJsonExport(
|
|
2295
|
+
entry,
|
|
2296
|
+
packageJson.type,
|
|
2297
|
+
options.sourceRoot,
|
|
2298
|
+
options.projectRoot
|
|
2299
|
+
);
|
|
2300
|
+
});
|
|
2301
|
+
})
|
|
2302
|
+
);
|
|
2021
2303
|
packageJson.main ??= "./dist/index.cjs";
|
|
2022
2304
|
packageJson.module ??= "./dist/index.mjs";
|
|
2023
2305
|
packageJson.types ??= "./dist/index.d.ts";
|
|
2024
2306
|
packageJson.exports ??= {};
|
|
2025
|
-
packageJson.exports = Object.keys(packageJson.exports).reduce(
|
|
2026
|
-
|
|
2027
|
-
ret[key.replace("/index", "")]
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2307
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce(
|
|
2308
|
+
(ret, key) => {
|
|
2309
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
2310
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
2311
|
+
}
|
|
2312
|
+
return ret;
|
|
2313
|
+
},
|
|
2314
|
+
packageJson.exports
|
|
2315
|
+
);
|
|
2031
2316
|
packageJson.exports["./package.json"] ??= "./package.json";
|
|
2032
|
-
packageJson.exports["."] ??= addPackageJsonExport(
|
|
2317
|
+
packageJson.exports["."] ??= addPackageJsonExport(
|
|
2318
|
+
"index",
|
|
2319
|
+
packageJson.type,
|
|
2320
|
+
options.sourceRoot,
|
|
2321
|
+
options.projectRoot
|
|
2322
|
+
);
|
|
2033
2323
|
await (0, import_devkit4.writeJsonFile)(joinPaths(options.outDir, "package.json"), packageJson);
|
|
2034
2324
|
stopwatch();
|
|
2035
2325
|
}
|
|
2036
2326
|
return options;
|
|
2037
2327
|
}
|
|
2038
|
-
__name(generatePackageJson, "generatePackageJson");
|
|
2039
2328
|
async function executeUnbuild(options) {
|
|
2040
|
-
writeDebug(
|
|
2041
|
-
|
|
2329
|
+
writeDebug(
|
|
2330
|
+
` \u{1F680} Running ${options.name} (${options.projectRoot}) build`,
|
|
2331
|
+
options.config
|
|
2332
|
+
);
|
|
2333
|
+
const stopwatch = getStopwatch(
|
|
2334
|
+
`${options.name} (${options.projectRoot}) build`
|
|
2335
|
+
);
|
|
2042
2336
|
try {
|
|
2043
2337
|
const config = {
|
|
2044
2338
|
...options,
|
|
2045
2339
|
config: null,
|
|
2046
2340
|
rootDir: joinPaths(options.config.workspaceRoot, options.projectRoot)
|
|
2047
2341
|
};
|
|
2048
|
-
writeTrace(
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2342
|
+
writeTrace(
|
|
2343
|
+
`Running with unbuild configuration:
|
|
2344
|
+
${formatLogMessage({ ...config, env: "<Hidden>" })}
|
|
2345
|
+
`,
|
|
2346
|
+
options.config
|
|
2347
|
+
);
|
|
2054
2348
|
await (0, import_unbuild.build)(options.projectRoot, false, config);
|
|
2055
2349
|
} finally {
|
|
2056
2350
|
stopwatch();
|
|
2057
2351
|
}
|
|
2058
2352
|
return options;
|
|
2059
2353
|
}
|
|
2060
|
-
__name(executeUnbuild, "executeUnbuild");
|
|
2061
2354
|
async function copyBuildAssets(options) {
|
|
2062
|
-
writeDebug(
|
|
2355
|
+
writeDebug(
|
|
2356
|
+
` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`,
|
|
2357
|
+
options.config
|
|
2358
|
+
);
|
|
2063
2359
|
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
2064
|
-
await copyAssets(
|
|
2360
|
+
await copyAssets(
|
|
2361
|
+
options.config,
|
|
2362
|
+
options.assets ?? [],
|
|
2363
|
+
options.outDir,
|
|
2364
|
+
options.projectRoot,
|
|
2365
|
+
options.sourceRoot,
|
|
2366
|
+
options.generatePackageJson,
|
|
2367
|
+
options.includeSrc
|
|
2368
|
+
);
|
|
2065
2369
|
stopwatch();
|
|
2066
2370
|
return options;
|
|
2067
2371
|
}
|
|
2068
|
-
__name(copyBuildAssets, "copyBuildAssets");
|
|
2069
2372
|
async function cleanOutputPath(options) {
|
|
2070
2373
|
if (options.clean !== false && options.outDir) {
|
|
2071
|
-
writeDebug(
|
|
2374
|
+
writeDebug(
|
|
2375
|
+
` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`,
|
|
2376
|
+
options.config
|
|
2377
|
+
);
|
|
2072
2378
|
const stopwatch = getStopwatch(`${options.name} output clean`);
|
|
2073
2379
|
await cleanDirectories(options.name, options.outDir, options.config);
|
|
2074
2380
|
stopwatch();
|
|
2075
2381
|
}
|
|
2076
2382
|
return options;
|
|
2077
2383
|
}
|
|
2078
|
-
__name(cleanOutputPath, "cleanOutputPath");
|
|
2079
2384
|
async function build(options) {
|
|
2080
2385
|
const projectRoot = options.projectRoot;
|
|
2081
2386
|
if (!projectRoot) {
|
|
@@ -2099,15 +2404,20 @@ async function build(options) {
|
|
|
2099
2404
|
if (options.buildOnly !== true) {
|
|
2100
2405
|
await copyBuildAssets(resolvedOptions);
|
|
2101
2406
|
}
|
|
2102
|
-
writeSuccess(
|
|
2407
|
+
writeSuccess(
|
|
2408
|
+
` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`,
|
|
2409
|
+
config
|
|
2410
|
+
);
|
|
2103
2411
|
} catch (error) {
|
|
2104
|
-
writeFatal(
|
|
2412
|
+
writeFatal(
|
|
2413
|
+
"Fatal errors that the build process could not recover from have occured. The build process has been terminated.",
|
|
2414
|
+
config
|
|
2415
|
+
);
|
|
2105
2416
|
throw error;
|
|
2106
2417
|
} finally {
|
|
2107
2418
|
stopwatch();
|
|
2108
2419
|
}
|
|
2109
2420
|
}
|
|
2110
|
-
__name(build, "build");
|
|
2111
2421
|
|
|
2112
2422
|
// bin/unbuild.ts
|
|
2113
2423
|
async function createProgram(config) {
|
|
@@ -2122,34 +2432,57 @@ async function createProgram(config) {
|
|
|
2122
2432
|
const program = new import_commander.Command("storm-unbuild");
|
|
2123
2433
|
program.version("1.0.0", "-v --version", "display CLI version");
|
|
2124
2434
|
program.description("\u26A1 Run the Storm Unbuild pipeline").showHelpAfterError().showSuggestionAfterError();
|
|
2125
|
-
const projectRootOption = new import_commander.Option(
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
const
|
|
2130
|
-
"
|
|
2131
|
-
"
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
"
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2435
|
+
const projectRootOption = new import_commander.Option(
|
|
2436
|
+
"-p --project-root <path>",
|
|
2437
|
+
"The path to the root of the project to build. This path is defined relative to the workspace root."
|
|
2438
|
+
).makeOptionMandatory(true);
|
|
2439
|
+
const sourceRootOption = new import_commander.Option(
|
|
2440
|
+
"-s --source-root <path>",
|
|
2441
|
+
"The path of the project's source folder to build"
|
|
2442
|
+
);
|
|
2443
|
+
const nameOption = new import_commander.Option(
|
|
2444
|
+
"-n --name <value>",
|
|
2445
|
+
"The name of the project to build"
|
|
2446
|
+
);
|
|
2447
|
+
const outputPathOption = new import_commander.Option(
|
|
2448
|
+
"-o --output-path <path>",
|
|
2449
|
+
"The path of the project's source folder to build"
|
|
2450
|
+
).default("dist/{projectRoot}");
|
|
2451
|
+
const platformOption = new import_commander.Option(
|
|
2452
|
+
"-p --platform <value>",
|
|
2453
|
+
"The platform to build the distribution for"
|
|
2454
|
+
).choices(["node", "neutral", "browser"]).default("node");
|
|
2455
|
+
const formatOption = new import_commander.Option(
|
|
2456
|
+
"-f, --format <value...>",
|
|
2457
|
+
"The format to build the distribution in"
|
|
2458
|
+
).choices(["esm", "cjs", "iife"]).argParser((value, previous) => {
|
|
2139
2459
|
if (previous === void 0) {
|
|
2140
|
-
return [
|
|
2141
|
-
value
|
|
2142
|
-
];
|
|
2460
|
+
return [value];
|
|
2143
2461
|
} else if (!previous.includes(value)) {
|
|
2144
2462
|
previous.push(value);
|
|
2145
2463
|
}
|
|
2146
2464
|
return previous;
|
|
2147
2465
|
}).default("esm");
|
|
2148
|
-
const cleanOption = new import_commander.Option(
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
const
|
|
2466
|
+
const cleanOption = new import_commander.Option(
|
|
2467
|
+
"-c --clean",
|
|
2468
|
+
"Should the output directory be cleaned before building"
|
|
2469
|
+
).default(true);
|
|
2470
|
+
const noCleanOption = new import_commander.Option(
|
|
2471
|
+
"--no-clean",
|
|
2472
|
+
"Should the output directory be cleaned before building"
|
|
2473
|
+
).default(false);
|
|
2474
|
+
const bundleOption = new import_commander.Option(
|
|
2475
|
+
"-b --bundle",
|
|
2476
|
+
"Should the output be bundled"
|
|
2477
|
+
).default(true);
|
|
2478
|
+
const noBundleOption = new import_commander.Option(
|
|
2479
|
+
"--no-bundle",
|
|
2480
|
+
"Should the output be bundled"
|
|
2481
|
+
).default(false);
|
|
2482
|
+
const targetOption = new import_commander.Option(
|
|
2483
|
+
"-t --target <value>",
|
|
2484
|
+
"The target to build the distribution for"
|
|
2485
|
+
).choices([
|
|
2153
2486
|
"ESNext",
|
|
2154
2487
|
"ES2015",
|
|
2155
2488
|
"ES2016",
|
|
@@ -2161,31 +2494,72 @@ async function createProgram(config) {
|
|
|
2161
2494
|
"ES2022",
|
|
2162
2495
|
"ES2023"
|
|
2163
2496
|
]).default("ESNext");
|
|
2164
|
-
const watchOption = new import_commander.Option(
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
const
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2497
|
+
const watchOption = new import_commander.Option(
|
|
2498
|
+
"-w --watch",
|
|
2499
|
+
"Should the build process watch for changes"
|
|
2500
|
+
).default(false);
|
|
2501
|
+
const debugOption = new import_commander.Option(
|
|
2502
|
+
"-d --debug",
|
|
2503
|
+
"Should the build process run in debug mode"
|
|
2504
|
+
).default(false);
|
|
2505
|
+
const bannerOption = new import_commander.Option(
|
|
2506
|
+
"--banner <value>",
|
|
2507
|
+
"The banner to prepend to the output"
|
|
2508
|
+
);
|
|
2509
|
+
const footerOption = new import_commander.Option(
|
|
2510
|
+
"--footer <value>",
|
|
2511
|
+
"The footer to prepend to the output"
|
|
2512
|
+
);
|
|
2513
|
+
const splittingOption = new import_commander.Option(
|
|
2514
|
+
"--splitting",
|
|
2515
|
+
"Should the output be split into multiple files"
|
|
2516
|
+
).default(true);
|
|
2517
|
+
const treeShakingOption = new import_commander.Option(
|
|
2518
|
+
"--tree-shaking",
|
|
2519
|
+
"Should tree shaking be enabled"
|
|
2520
|
+
).default(true);
|
|
2521
|
+
const generatePackageJsonOption = new import_commander.Option(
|
|
2522
|
+
"--generate-package-json",
|
|
2523
|
+
"Should a package.json be generated for the output"
|
|
2524
|
+
).default(true);
|
|
2525
|
+
const emitOnAllOption = new import_commander.Option(
|
|
2526
|
+
"--emit-on-all",
|
|
2527
|
+
"Should the output be emitted on all platforms"
|
|
2528
|
+
).default(false);
|
|
2529
|
+
const metafileOption = new import_commander.Option(
|
|
2530
|
+
"--metafile",
|
|
2531
|
+
"Should a metafile be generated for the output"
|
|
2532
|
+
).default(true);
|
|
2533
|
+
const minifyOption = new import_commander.Option(
|
|
2534
|
+
"--minify",
|
|
2535
|
+
"Should the output be minified"
|
|
2536
|
+
).default(true);
|
|
2537
|
+
const includeSrcOption = new import_commander.Option(
|
|
2538
|
+
"--include-src",
|
|
2539
|
+
"Should the source files be included in the output"
|
|
2540
|
+
).default(false);
|
|
2541
|
+
const verboseOption = new import_commander.Option(
|
|
2542
|
+
"--verbose",
|
|
2543
|
+
"Should the build process be verbose"
|
|
2544
|
+
).default(false);
|
|
2545
|
+
const dtsOption = new import_commander.Option(
|
|
2546
|
+
"--emit-types",
|
|
2547
|
+
"Should types be emitted for the output"
|
|
2548
|
+
).default(true);
|
|
2549
|
+
program.command("build", { isDefault: true }).alias("bundle").description("Run a TypeScript build using Unbuild.").addOption(nameOption).addOption(projectRootOption).addOption(sourceRootOption).addOption(outputPathOption).addOption(platformOption).addOption(formatOption).addOption(targetOption).addOption(bundleOption).addOption(noBundleOption).addOption(cleanOption).addOption(noCleanOption).addOption(watchOption).addOption(debugOption).addOption(bannerOption).addOption(footerOption).addOption(splittingOption).addOption(treeShakingOption).addOption(generatePackageJsonOption).addOption(emitOnAllOption).addOption(metafileOption).addOption(minifyOption).addOption(includeSrcOption).addOption(verboseOption).addOption(dtsOption).action(buildAction(config));
|
|
2550
|
+
program.command("clean").alias("clear").description(
|
|
2551
|
+
"Clean the output directory of the project. This command will remove the 'dist' folder."
|
|
2552
|
+
).addOption(nameOption).action(cleanAction(config));
|
|
2181
2553
|
return program;
|
|
2182
2554
|
} catch (e) {
|
|
2183
|
-
writeFatal(
|
|
2555
|
+
writeFatal(
|
|
2556
|
+
`A fatal error occurred while running the program: ${e.message}`,
|
|
2557
|
+
config
|
|
2558
|
+
);
|
|
2184
2559
|
process.exit(1);
|
|
2185
2560
|
}
|
|
2186
2561
|
}
|
|
2187
|
-
|
|
2188
|
-
var buildAction = /* @__PURE__ */ __name((config) => async (options) => {
|
|
2562
|
+
var buildAction = (config) => async (options) => {
|
|
2189
2563
|
try {
|
|
2190
2564
|
await build({
|
|
2191
2565
|
...options,
|
|
@@ -2227,20 +2601,26 @@ var buildAction = /* @__PURE__ */ __name((config) => async (options) => {
|
|
|
2227
2601
|
}
|
|
2228
2602
|
});
|
|
2229
2603
|
} catch (e) {
|
|
2230
|
-
writeFatal(
|
|
2604
|
+
writeFatal(
|
|
2605
|
+
`A fatal error occurred while cleaning the Unbuild output directory: ${e.message}`,
|
|
2606
|
+
config
|
|
2607
|
+
);
|
|
2231
2608
|
exitWithError(config);
|
|
2232
2609
|
process.exit(1);
|
|
2233
2610
|
}
|
|
2234
|
-
}
|
|
2235
|
-
var cleanAction =
|
|
2611
|
+
};
|
|
2612
|
+
var cleanAction = (config) => async (options) => {
|
|
2236
2613
|
try {
|
|
2237
2614
|
await clean(options.name, options.output, config);
|
|
2238
2615
|
} catch (e) {
|
|
2239
|
-
writeFatal(
|
|
2616
|
+
writeFatal(
|
|
2617
|
+
`A fatal error occurred while cleaning the ESBuild output directory: ${e.message}`,
|
|
2618
|
+
config
|
|
2619
|
+
);
|
|
2240
2620
|
exitWithError(config);
|
|
2241
2621
|
process.exit(1);
|
|
2242
2622
|
}
|
|
2243
|
-
}
|
|
2623
|
+
};
|
|
2244
2624
|
void (async () => {
|
|
2245
2625
|
const config = await getConfig();
|
|
2246
2626
|
const stopwatch = getStopwatch("Storm ESBuild executable");
|
|
@@ -2248,12 +2628,18 @@ void (async () => {
|
|
|
2248
2628
|
handleProcess(config);
|
|
2249
2629
|
const program = await createProgram(config);
|
|
2250
2630
|
await program.parseAsync(process.argv);
|
|
2251
|
-
writeSuccess(
|
|
2631
|
+
writeSuccess(
|
|
2632
|
+
`\u{1F389} Storm ESBuild executable has completed successfully!`,
|
|
2633
|
+
config
|
|
2634
|
+
);
|
|
2252
2635
|
exitWithSuccess(config);
|
|
2253
2636
|
} catch (error) {
|
|
2254
|
-
writeFatal(
|
|
2637
|
+
writeFatal(
|
|
2638
|
+
`A fatal error occurred while running Storm ESBuild executable:
|
|
2255
2639
|
|
|
2256
|
-
${error.message}`,
|
|
2640
|
+
${error.message}`,
|
|
2641
|
+
config
|
|
2642
|
+
);
|
|
2257
2643
|
exitWithError(config);
|
|
2258
2644
|
process.exit(1);
|
|
2259
2645
|
} finally {
|