@storm-software/unbuild 0.41.21 → 0.41.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/unbuild.cjs +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
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-3GQAWCBQ.js";
|
|
4
|
-
|
|
5
1
|
// ../config-tools/src/types.ts
|
|
6
2
|
var LogLevel = {
|
|
7
3
|
SILENT: 0,
|
|
@@ -34,11 +30,10 @@ function normalizeWindowsPath(input = "") {
|
|
|
34
30
|
}
|
|
35
31
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
36
32
|
}
|
|
37
|
-
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
38
33
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
39
34
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
40
35
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
41
|
-
var correctPaths =
|
|
36
|
+
var correctPaths = function(path) {
|
|
42
37
|
if (!path || path.length === 0) {
|
|
43
38
|
return ".";
|
|
44
39
|
}
|
|
@@ -66,8 +61,8 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
66
61
|
return `//${path}`;
|
|
67
62
|
}
|
|
68
63
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
69
|
-
}
|
|
70
|
-
var joinPaths =
|
|
64
|
+
};
|
|
65
|
+
var joinPaths = function(...segments) {
|
|
71
66
|
let path = "";
|
|
72
67
|
for (const seg of segments) {
|
|
73
68
|
if (!seg) {
|
|
@@ -87,7 +82,7 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
84
|
return correctPaths(path);
|
|
90
|
-
}
|
|
85
|
+
};
|
|
91
86
|
function normalizeString(path, allowAboveRoot) {
|
|
92
87
|
let res = "";
|
|
93
88
|
let lastSegmentLength = 0;
|
|
@@ -148,13 +143,12 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
148
143
|
}
|
|
149
144
|
return res;
|
|
150
145
|
}
|
|
151
|
-
|
|
152
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
146
|
+
var isAbsolute = function(p) {
|
|
153
147
|
return _IS_ABSOLUTE_RE.test(p);
|
|
154
|
-
}
|
|
148
|
+
};
|
|
155
149
|
|
|
156
150
|
// ../config-tools/src/logger/get-log-level.ts
|
|
157
|
-
var getLogLevel =
|
|
151
|
+
var getLogLevel = (label) => {
|
|
158
152
|
switch (label) {
|
|
159
153
|
case "all":
|
|
160
154
|
return LogLevel.ALL;
|
|
@@ -175,8 +169,8 @@ var getLogLevel = /* @__PURE__ */ __name((label) => {
|
|
|
175
169
|
default:
|
|
176
170
|
return LogLevel.INFO;
|
|
177
171
|
}
|
|
178
|
-
}
|
|
179
|
-
var getLogLevelLabel =
|
|
172
|
+
};
|
|
173
|
+
var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
|
|
180
174
|
if (logLevel >= LogLevel.ALL) {
|
|
181
175
|
return LogLevelLabel.ALL;
|
|
182
176
|
}
|
|
@@ -202,11 +196,11 @@ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
|
|
|
202
196
|
return LogLevelLabel.SILENT;
|
|
203
197
|
}
|
|
204
198
|
return LogLevelLabel.INFO;
|
|
205
|
-
}
|
|
206
|
-
var isVerbose =
|
|
199
|
+
};
|
|
200
|
+
var isVerbose = (label = LogLevelLabel.SILENT) => {
|
|
207
201
|
const logLevel = typeof label === "string" ? getLogLevel(label) : label;
|
|
208
202
|
return logLevel >= LogLevel.DEBUG;
|
|
209
|
-
}
|
|
203
|
+
};
|
|
210
204
|
|
|
211
205
|
// ../config/src/constants.ts
|
|
212
206
|
var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
|
|
@@ -306,23 +300,39 @@ var RegistryConfigSchema = z.object({
|
|
|
306
300
|
cyclone: RegistryUrlConfigSchema,
|
|
307
301
|
container: RegistryUrlConfigSchema
|
|
308
302
|
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
309
|
-
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
303
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
304
|
+
MultiThemeColorConfigSchema
|
|
305
|
+
).describe("Colors used for various workspace elements");
|
|
310
306
|
var ColorConfigMapSchema = z.union([
|
|
311
|
-
z.object({
|
|
312
|
-
base: ColorConfigSchema
|
|
313
|
-
}),
|
|
307
|
+
z.object({ base: ColorConfigSchema }),
|
|
314
308
|
z.record(z.string(), ColorConfigSchema)
|
|
315
309
|
]);
|
|
316
|
-
var ExtendsItemSchema = z.string().trim().describe(
|
|
317
|
-
|
|
310
|
+
var ExtendsItemSchema = z.string().trim().describe(
|
|
311
|
+
"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."
|
|
312
|
+
);
|
|
313
|
+
var ExtendsSchema = ExtendsItemSchema.or(
|
|
314
|
+
z.array(ExtendsItemSchema)
|
|
315
|
+
).describe(
|
|
316
|
+
"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."
|
|
317
|
+
);
|
|
318
318
|
var WorkspaceBotConfigSchema = z.object({
|
|
319
|
-
name: z.string().trim().default("stormie-bot").describe(
|
|
319
|
+
name: z.string().trim().default("stormie-bot").describe(
|
|
320
|
+
"The workspace bot user's name (this is the bot that will be used to perform various tasks)"
|
|
321
|
+
),
|
|
320
322
|
email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
321
|
-
}).describe(
|
|
323
|
+
}).describe(
|
|
324
|
+
"The workspace's bot user's config used to automated various operations tasks"
|
|
325
|
+
);
|
|
322
326
|
var WorkspaceReleaseConfigSchema = z.object({
|
|
323
|
-
banner: z.string().trim().default(STORM_DEFAULT_RELEASE_BANNER).describe(
|
|
324
|
-
|
|
325
|
-
|
|
327
|
+
banner: z.string().trim().default(STORM_DEFAULT_RELEASE_BANNER).describe(
|
|
328
|
+
"A URL to a banner image used to display the workspace's release"
|
|
329
|
+
),
|
|
330
|
+
header: z.string().trim().optional().describe(
|
|
331
|
+
"A header message appended to the start of the workspace's release notes"
|
|
332
|
+
),
|
|
333
|
+
footer: z.string().trim().default(STORM_DEFAULT_RELEASE_FOOTER).describe(
|
|
334
|
+
"A footer message appended to the end of the workspace's release notes"
|
|
335
|
+
)
|
|
326
336
|
}).describe("The workspace's release config used during the release process");
|
|
327
337
|
var WorkspaceAccountConfigSchema = z.object({
|
|
328
338
|
twitter: z.string().trim().default(STORM_DEFAULT_ACCOUNT_TWITTER).describe("A Twitter/X account associated with the organization/project"),
|
|
@@ -331,23 +341,41 @@ var WorkspaceAccountConfigSchema = z.object({
|
|
|
331
341
|
slack: z.string().trim().default(STORM_DEFAULT_ACCOUNT_SLACK).describe("A Slack account associated with the organization/project"),
|
|
332
342
|
medium: z.string().trim().default(STORM_DEFAULT_ACCOUNT_MEDIUM).describe("A Medium account associated with the organization/project"),
|
|
333
343
|
github: z.string().trim().default(STORM_DEFAULT_ACCOUNT_GITHUB).describe("A GitHub account associated with the organization/project")
|
|
334
|
-
}).describe(
|
|
344
|
+
}).describe(
|
|
345
|
+
"The workspace's account config used to store various social media links"
|
|
346
|
+
);
|
|
335
347
|
var WorkspaceDirectoryConfigSchema = z.object({
|
|
336
|
-
cache: z.string().trim().optional().describe(
|
|
348
|
+
cache: z.string().trim().optional().describe(
|
|
349
|
+
"The directory used to store the environment's cached file data"
|
|
350
|
+
),
|
|
337
351
|
data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
338
|
-
config: z.string().trim().optional().describe(
|
|
352
|
+
config: z.string().trim().optional().describe(
|
|
353
|
+
"The directory used to store the environment's configuration files"
|
|
354
|
+
),
|
|
339
355
|
temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
340
356
|
log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
341
|
-
build: z.string().trim().default("dist").describe(
|
|
342
|
-
|
|
357
|
+
build: z.string().trim().default("dist").describe(
|
|
358
|
+
"The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
|
|
359
|
+
)
|
|
360
|
+
}).describe(
|
|
361
|
+
"Various directories used by the workspace to store data, cache, and configuration files"
|
|
362
|
+
);
|
|
343
363
|
var errorConfigSchema = z.object({
|
|
344
364
|
codesFile: z.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
|
|
345
|
-
url: z.string().trim().url().optional().describe(
|
|
365
|
+
url: z.string().trim().url().optional().describe(
|
|
366
|
+
"A URL to a page that looks up the workspace's error messages given a specific error code"
|
|
367
|
+
)
|
|
346
368
|
}).describe("The workspace's error config used during the error process");
|
|
347
369
|
var stormWorkspaceConfigSchema = z.object({
|
|
348
|
-
$schema: z.string().trim().default(
|
|
370
|
+
$schema: z.string().trim().default(
|
|
371
|
+
"https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm-workspace.schema.json"
|
|
372
|
+
).optional().nullish().describe(
|
|
373
|
+
"The URL to the JSON schema file that describes the Storm configuration file"
|
|
374
|
+
),
|
|
349
375
|
extends: ExtendsSchema.optional(),
|
|
350
|
-
name: z.string().trim().toLowerCase().optional().describe(
|
|
376
|
+
name: z.string().trim().toLowerCase().optional().describe(
|
|
377
|
+
"The name of the service/package/scope using this configuration"
|
|
378
|
+
),
|
|
351
379
|
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
352
380
|
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
353
381
|
repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
@@ -363,21 +391,16 @@ var stormWorkspaceConfigSchema = z.object({
|
|
|
363
391
|
release: WorkspaceReleaseConfigSchema,
|
|
364
392
|
account: WorkspaceAccountConfigSchema,
|
|
365
393
|
error: errorConfigSchema,
|
|
366
|
-
mode: z.enum([
|
|
367
|
-
"development",
|
|
368
|
-
"staging",
|
|
369
|
-
"production"
|
|
370
|
-
]).default("production").describe("The current runtime environment mode for the package"),
|
|
394
|
+
mode: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment mode for the package"),
|
|
371
395
|
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
372
|
-
externalPackagePatterns: z.array(z.string()).default([]).describe(
|
|
396
|
+
externalPackagePatterns: z.array(z.string()).default([]).describe(
|
|
397
|
+
"The build will use these package patterns to determine if they should be external to the bundle"
|
|
398
|
+
),
|
|
373
399
|
skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
374
400
|
directories: WorkspaceDirectoryConfigSchema,
|
|
375
|
-
packageManager: z.enum([
|
|
376
|
-
"
|
|
377
|
-
|
|
378
|
-
"pnpm",
|
|
379
|
-
"bun"
|
|
380
|
-
]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
|
|
401
|
+
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
|
|
402
|
+
"The JavaScript/TypeScript package manager used by the repository"
|
|
403
|
+
),
|
|
381
404
|
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
382
405
|
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
383
406
|
logLevel: z.enum([
|
|
@@ -390,13 +413,23 @@ var stormWorkspaceConfigSchema = z.object({
|
|
|
390
413
|
"debug",
|
|
391
414
|
"trace",
|
|
392
415
|
"all"
|
|
393
|
-
]).default("info").describe(
|
|
394
|
-
|
|
416
|
+
]).default("info").describe(
|
|
417
|
+
"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`)."
|
|
418
|
+
),
|
|
419
|
+
skipConfigLogging: z.boolean().optional().describe(
|
|
420
|
+
"Should the logging of the current Storm Workspace configuration be skipped?"
|
|
421
|
+
),
|
|
395
422
|
registry: RegistryConfigSchema,
|
|
396
|
-
configFile: z.string().trim().nullable().default(null).describe(
|
|
397
|
-
|
|
423
|
+
configFile: z.string().trim().nullable().default(null).describe(
|
|
424
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
425
|
+
),
|
|
426
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
|
|
427
|
+
"Storm theme config values used for styling various package elements"
|
|
428
|
+
),
|
|
398
429
|
extensions: z.record(z.any()).optional().default({}).describe("Configuration of each used extension")
|
|
399
|
-
}).describe(
|
|
430
|
+
}).describe(
|
|
431
|
+
"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."
|
|
432
|
+
);
|
|
400
433
|
|
|
401
434
|
// ../config/src/types.ts
|
|
402
435
|
var COLOR_KEYS = [
|
|
@@ -429,10 +462,14 @@ var MAX_PATH_SEARCH_DEPTH = 30;
|
|
|
429
462
|
var depth = 0;
|
|
430
463
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
431
464
|
const _startPath = startPath ?? process.cwd();
|
|
432
|
-
if (endDirectoryNames.some(
|
|
465
|
+
if (endDirectoryNames.some(
|
|
466
|
+
(endDirName) => existsSync(join(_startPath, endDirName))
|
|
467
|
+
)) {
|
|
433
468
|
return _startPath;
|
|
434
469
|
}
|
|
435
|
-
if (endFileNames.some(
|
|
470
|
+
if (endFileNames.some(
|
|
471
|
+
(endFileName) => existsSync(join(_startPath, endFileName))
|
|
472
|
+
)) {
|
|
436
473
|
return _startPath;
|
|
437
474
|
}
|
|
438
475
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
@@ -441,7 +478,6 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
|
441
478
|
}
|
|
442
479
|
return void 0;
|
|
443
480
|
}
|
|
444
|
-
__name(findFolderUp, "findFolderUp");
|
|
445
481
|
|
|
446
482
|
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
447
483
|
var rootFiles = [
|
|
@@ -488,21 +524,31 @@ var rootDirectories = [
|
|
|
488
524
|
];
|
|
489
525
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
490
526
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
491
|
-
return correctPaths(
|
|
492
|
-
|
|
493
|
-
|
|
527
|
+
return correctPaths(
|
|
528
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
return correctPaths(
|
|
532
|
+
findFolderUp(
|
|
533
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
534
|
+
rootFiles,
|
|
535
|
+
rootDirectories
|
|
536
|
+
)
|
|
537
|
+
);
|
|
494
538
|
}
|
|
495
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
496
539
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
497
540
|
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
498
541
|
if (!result) {
|
|
499
|
-
throw new Error(
|
|
500
|
-
|
|
501
|
-
|
|
542
|
+
throw new Error(
|
|
543
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
544
|
+
${rootFiles.join(
|
|
545
|
+
"\n"
|
|
546
|
+
)}
|
|
547
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
548
|
+
);
|
|
502
549
|
}
|
|
503
550
|
return result;
|
|
504
551
|
}
|
|
505
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
506
552
|
|
|
507
553
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
508
554
|
var DEFAULT_COLOR_CONFIG = {
|
|
@@ -533,7 +579,7 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
533
579
|
negative: "#dc2626"
|
|
534
580
|
}
|
|
535
581
|
};
|
|
536
|
-
var getDefaultConfig =
|
|
582
|
+
var getDefaultConfig = async (root) => {
|
|
537
583
|
let license = STORM_DEFAULT_LICENSE;
|
|
538
584
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
539
585
|
let name = void 0;
|
|
@@ -541,7 +587,10 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
541
587
|
let repository = void 0;
|
|
542
588
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
543
589
|
if (existsSync2(join2(workspaceRoot, "package.json"))) {
|
|
544
|
-
const file = await readFile(
|
|
590
|
+
const file = await readFile(
|
|
591
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
592
|
+
"utf8"
|
|
593
|
+
);
|
|
545
594
|
if (file) {
|
|
546
595
|
const packageJson = JSON.parse(file);
|
|
547
596
|
if (packageJson.name) {
|
|
@@ -578,36 +627,36 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
578
627
|
url: `${homepage || STORM_DEFAULT_HOMEPAGE}/errors`
|
|
579
628
|
}
|
|
580
629
|
};
|
|
581
|
-
}
|
|
630
|
+
};
|
|
582
631
|
|
|
583
632
|
// ../config-tools/src/logger/chalk.ts
|
|
584
633
|
import chalk from "chalk";
|
|
585
634
|
var chalkDefault = {
|
|
586
|
-
hex:
|
|
587
|
-
bgHex:
|
|
588
|
-
whiteBright:
|
|
589
|
-
}),
|
|
590
|
-
whiteBright:
|
|
591
|
-
gray:
|
|
635
|
+
hex: (_) => (message) => message,
|
|
636
|
+
bgHex: (_) => ({
|
|
637
|
+
whiteBright: (message) => message
|
|
638
|
+
}),
|
|
639
|
+
whiteBright: (message) => message,
|
|
640
|
+
gray: (message) => message,
|
|
592
641
|
bold: {
|
|
593
|
-
hex:
|
|
594
|
-
bgHex:
|
|
595
|
-
whiteBright:
|
|
596
|
-
}),
|
|
597
|
-
whiteBright:
|
|
642
|
+
hex: (_) => (message) => message,
|
|
643
|
+
bgHex: (_) => ({
|
|
644
|
+
whiteBright: (message) => message
|
|
645
|
+
}),
|
|
646
|
+
whiteBright: (message) => message
|
|
598
647
|
},
|
|
599
648
|
dim: {
|
|
600
|
-
hex:
|
|
601
|
-
gray:
|
|
649
|
+
hex: (_) => (message) => message,
|
|
650
|
+
gray: (message) => message
|
|
602
651
|
}
|
|
603
652
|
};
|
|
604
|
-
var getChalk =
|
|
653
|
+
var getChalk = () => {
|
|
605
654
|
let _chalk = chalk;
|
|
606
655
|
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
607
656
|
_chalk = chalkDefault;
|
|
608
657
|
}
|
|
609
658
|
return _chalk;
|
|
610
|
-
}
|
|
659
|
+
};
|
|
611
660
|
|
|
612
661
|
// ../config-tools/src/logger/is-unicode-supported.ts
|
|
613
662
|
function isUnicodeSupported() {
|
|
@@ -619,10 +668,9 @@ function isUnicodeSupported() {
|
|
|
619
668
|
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
620
669
|
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";
|
|
621
670
|
}
|
|
622
|
-
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
623
671
|
|
|
624
672
|
// ../config-tools/src/logger/console-icons.ts
|
|
625
|
-
var useIcon =
|
|
673
|
+
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
626
674
|
var CONSOLE_ICONS = {
|
|
627
675
|
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
628
676
|
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
@@ -635,12 +683,12 @@ var CONSOLE_ICONS = {
|
|
|
635
683
|
};
|
|
636
684
|
|
|
637
685
|
// ../config-tools/src/logger/format-timestamp.ts
|
|
638
|
-
var formatTimestamp =
|
|
686
|
+
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
639
687
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
640
|
-
}
|
|
688
|
+
};
|
|
641
689
|
|
|
642
690
|
// ../config-tools/src/logger/console.ts
|
|
643
|
-
var getLogFn =
|
|
691
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
644
692
|
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;
|
|
645
693
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
646
694
|
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
@@ -649,99 +697,119 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _c
|
|
|
649
697
|
}
|
|
650
698
|
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
651
699
|
return (message) => {
|
|
652
|
-
console.error(
|
|
700
|
+
console.error(
|
|
701
|
+
`
|
|
653
702
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
654
|
-
`
|
|
703
|
+
`
|
|
704
|
+
);
|
|
655
705
|
};
|
|
656
706
|
}
|
|
657
707
|
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
658
708
|
return (message) => {
|
|
659
|
-
console.error(
|
|
709
|
+
console.error(
|
|
710
|
+
`
|
|
660
711
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
661
|
-
`
|
|
712
|
+
`
|
|
713
|
+
);
|
|
662
714
|
};
|
|
663
715
|
}
|
|
664
716
|
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
665
717
|
return (message) => {
|
|
666
|
-
console.warn(
|
|
718
|
+
console.warn(
|
|
719
|
+
`
|
|
667
720
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
668
|
-
`
|
|
721
|
+
`
|
|
722
|
+
);
|
|
669
723
|
};
|
|
670
724
|
}
|
|
671
725
|
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
672
726
|
return (message) => {
|
|
673
|
-
console.info(
|
|
727
|
+
console.info(
|
|
728
|
+
`
|
|
674
729
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
675
|
-
`
|
|
730
|
+
`
|
|
731
|
+
);
|
|
676
732
|
};
|
|
677
733
|
}
|
|
678
734
|
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
679
735
|
return (message) => {
|
|
680
|
-
console.info(
|
|
736
|
+
console.info(
|
|
737
|
+
`
|
|
681
738
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
682
|
-
`
|
|
739
|
+
`
|
|
740
|
+
);
|
|
683
741
|
};
|
|
684
742
|
}
|
|
685
743
|
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
686
744
|
return (message) => {
|
|
687
|
-
console.debug(
|
|
745
|
+
console.debug(
|
|
746
|
+
`
|
|
688
747
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
689
|
-
`
|
|
748
|
+
`
|
|
749
|
+
);
|
|
690
750
|
};
|
|
691
751
|
}
|
|
692
752
|
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
693
753
|
return (message) => {
|
|
694
|
-
console.debug(
|
|
754
|
+
console.debug(
|
|
755
|
+
`
|
|
695
756
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
696
|
-
`
|
|
757
|
+
`
|
|
758
|
+
);
|
|
697
759
|
};
|
|
698
760
|
}
|
|
699
761
|
return (message) => {
|
|
700
|
-
console.log(
|
|
762
|
+
console.log(
|
|
763
|
+
`
|
|
701
764
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
702
|
-
`
|
|
765
|
+
`
|
|
766
|
+
);
|
|
703
767
|
};
|
|
704
|
-
}
|
|
705
|
-
var writeFatal =
|
|
706
|
-
var writeError =
|
|
707
|
-
var writeWarning =
|
|
708
|
-
var writeInfo =
|
|
709
|
-
var writeSuccess =
|
|
710
|
-
var writeDebug =
|
|
711
|
-
var writeTrace =
|
|
712
|
-
var getStopwatch =
|
|
768
|
+
};
|
|
769
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
770
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
771
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
772
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
773
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
774
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
775
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
776
|
+
var getStopwatch = (name) => {
|
|
713
777
|
const start = process.hrtime();
|
|
714
778
|
return () => {
|
|
715
779
|
const end = process.hrtime(start);
|
|
716
|
-
console.info(
|
|
717
|
-
|
|
718
|
-
`
|
|
780
|
+
console.info(
|
|
781
|
+
`
|
|
782
|
+
> \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
783
|
+
end[0] * 1e3 + end[1] / 1e6
|
|
784
|
+
)}ms to complete
|
|
785
|
+
`
|
|
786
|
+
);
|
|
719
787
|
};
|
|
720
|
-
}
|
|
788
|
+
};
|
|
721
789
|
var MAX_DEPTH = 4;
|
|
722
|
-
var formatLogMessage =
|
|
790
|
+
var formatLogMessage = (message, options = {}, depth2 = 0) => {
|
|
723
791
|
if (depth2 > MAX_DEPTH) {
|
|
724
792
|
return "<max depth>";
|
|
725
793
|
}
|
|
726
794
|
const prefix = options.prefix ?? "-";
|
|
727
795
|
const skip = options.skip ?? [];
|
|
728
796
|
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
729
|
-
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}
|
|
738
|
-
var _isFunction =
|
|
797
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
798
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
799
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
800
|
+
message[key],
|
|
801
|
+
{ prefix: `${prefix}-`, skip },
|
|
802
|
+
depth2 + 1
|
|
803
|
+
) : message[key]}`
|
|
804
|
+
).join("\n")}` : message;
|
|
805
|
+
};
|
|
806
|
+
var _isFunction = (value) => {
|
|
739
807
|
try {
|
|
740
808
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
741
809
|
} catch (e) {
|
|
742
810
|
return false;
|
|
743
811
|
}
|
|
744
|
-
}
|
|
812
|
+
};
|
|
745
813
|
|
|
746
814
|
export {
|
|
747
815
|
LogLevel,
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writeInfo
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-3GQAWCBQ.js";
|
|
3
|
+
} from "./chunk-XQLLOGJZ.js";
|
|
7
4
|
|
|
8
5
|
// src/plugins/analyze.ts
|
|
9
|
-
var formatBytes =
|
|
6
|
+
var formatBytes = (bytes) => {
|
|
10
7
|
if (bytes === 0) return "0 Byte";
|
|
11
8
|
const k = 1e3;
|
|
12
9
|
const dm = 3;
|
|
13
|
-
const sizes = [
|
|
14
|
-
"Bytes",
|
|
15
|
-
"KB",
|
|
16
|
-
"MB",
|
|
17
|
-
"GB"
|
|
18
|
-
];
|
|
10
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
19
11
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
20
12
|
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
|
|
21
|
-
}
|
|
22
|
-
var analyzePlugin =
|
|
13
|
+
};
|
|
14
|
+
var analyzePlugin = (options) => {
|
|
23
15
|
return {
|
|
24
16
|
name: "storm:analyzer",
|
|
25
17
|
renderChunk(source, chunk) {
|
|
@@ -28,7 +20,7 @@ var analyzePlugin = /* @__PURE__ */ __name((options) => {
|
|
|
28
20
|
writeInfo(` - ${fileName} ${sourceBytes}`, options.config);
|
|
29
21
|
}
|
|
30
22
|
};
|
|
31
|
-
}
|
|
23
|
+
};
|
|
32
24
|
|
|
33
25
|
export {
|
|
34
26
|
analyzePlugin
|
package/dist/clean.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
4
|
+
var _chunkQ3NBYYR4cjs = require('./chunk-Q3NBYYR4.cjs');
|
|
5
|
+
require('./chunk-Q2G4VMOW.cjs');
|
|
6
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.clean =
|
|
10
|
+
exports.clean = _chunkQ3NBYYR4cjs.clean; exports.cleanDirectories = _chunkQ3NBYYR4cjs.cleanDirectories;
|
package/dist/clean.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clean,
|
|
3
3
|
cleanDirectories
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-PCGRQKDH.js";
|
|
5
|
+
import "./chunk-XQLLOGJZ.js";
|
|
6
|
+
import "./chunk-3RG5ZIWI.js";
|
|
7
7
|
export {
|
|
8
8
|
clean,
|
|
9
9
|
cleanDirectories
|