@storm-software/unbuild 0.24.1 → 0.24.2
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.js +71 -28
- package/bin/unbuild.mjs +69 -26
- package/dist/build.d.mts +1 -0
- package/dist/build.d.ts +1 -0
- package/dist/build.js +8 -8
- package/dist/build.mjs +7 -7
- package/dist/{chunk-RNM4JSUG.js → chunk-44VTNVZA.js} +6 -6
- package/dist/{chunk-UT4OJQUT.mjs → chunk-4BAUMYRN.mjs} +4 -7
- package/dist/{chunk-L76UPCDF.js → chunk-523YIUTF.js} +2 -2
- package/dist/{chunk-4QTKZ7Y7.mjs → chunk-6UMHN4KS.mjs} +9 -4
- package/dist/{chunk-QPMFJ7G7.js → chunk-BUCFGCTW.js} +2 -2
- package/dist/{chunk-TCARWZKA.mjs → chunk-ESGPHEWU.mjs} +3 -3
- package/dist/{chunk-26H2BQTK.mjs → chunk-G6BE6UP3.mjs} +62 -27
- package/dist/{chunk-X6Y2OZGW.js → chunk-MCNTIU52.js} +2 -8
- package/dist/{chunk-27VOTZLA.js → chunk-PVZYPNLZ.js} +11 -6
- package/dist/{chunk-JLKG5B52.mjs → chunk-Q4GMTWGF.mjs} +1 -1
- package/dist/{chunk-D4WJVAJM.js → chunk-SQOZCV36.js} +4 -7
- package/dist/{chunk-J3DIENOH.mjs → chunk-TEEYWCSY.mjs} +2 -8
- package/dist/{chunk-NXZFF473.mjs → chunk-WXJPXYHF.mjs} +1 -1
- package/dist/{chunk-YXF5LOZH.js → chunk-YIP6AERX.js} +107 -72
- package/dist/clean.d.mts +9 -1
- package/dist/clean.d.ts +9 -1
- package/dist/clean.js +5 -3
- package/dist/clean.mjs +6 -4
- package/dist/config.d.mts +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -6
- package/dist/config.mjs +5 -5
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -8
- package/dist/index.mjs +10 -8
- package/dist/types.d.mts +2 -0
- package/dist/types.d.ts +2 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
package/bin/unbuild.js
CHANGED
|
@@ -48739,8 +48739,7 @@ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
|
|
|
48739
48739
|
}, "isVerbose");
|
|
48740
48740
|
|
|
48741
48741
|
// ../config-tools/src/logger/console.ts
|
|
48742
|
-
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
|
|
48743
|
-
const _chalk = getChalk();
|
|
48742
|
+
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
48744
48743
|
const colors2 = !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;
|
|
48745
48744
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
48746
48745
|
if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
|
|
@@ -49372,12 +49371,47 @@ var import_devkit4 = require("@nx/devkit");
|
|
|
49372
49371
|
var import_js = require("@nx/js");
|
|
49373
49372
|
var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
49374
49373
|
var import_build_tools = require("@storm-software/build-tools");
|
|
49375
|
-
|
|
49374
|
+
|
|
49375
|
+
// ../config-tools/src/logger/create-logger.ts
|
|
49376
|
+
init_cjs_shims();
|
|
49376
49377
|
var import_jiti3 = require("jiti");
|
|
49378
|
+
async function createLogger(config) {
|
|
49379
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
49380
|
+
if (!workspaceRoot) {
|
|
49381
|
+
throw new Error("Cannot find workspace root");
|
|
49382
|
+
}
|
|
49383
|
+
const jiti = (0, import_jiti3.createJiti)(config?.workspaceRoot || workspaceRoot, {
|
|
49384
|
+
fsCache: "node_modules/.cache/storm/jiti",
|
|
49385
|
+
interopDefault: true
|
|
49386
|
+
});
|
|
49387
|
+
const chalk2 = await jiti.import("chalk");
|
|
49388
|
+
const writeFatal2 = getLogFn(LogLevel.FATAL, config, chalk2);
|
|
49389
|
+
const writeError2 = getLogFn(LogLevel.ERROR, config, chalk2);
|
|
49390
|
+
const writeWarning2 = getLogFn(LogLevel.WARN, config, chalk2);
|
|
49391
|
+
const writeInfo2 = getLogFn(LogLevel.INFO, config, chalk2);
|
|
49392
|
+
const writeSuccess2 = getLogFn(LogLevel.SUCCESS, config, chalk2);
|
|
49393
|
+
const writeDebug2 = getLogFn(LogLevel.DEBUG, config, chalk2);
|
|
49394
|
+
const writeTrace2 = getLogFn(LogLevel.DEBUG, config, chalk2);
|
|
49395
|
+
return {
|
|
49396
|
+
fatal: writeFatal2,
|
|
49397
|
+
error: writeError2,
|
|
49398
|
+
warning: writeWarning2,
|
|
49399
|
+
info: writeInfo2,
|
|
49400
|
+
success: writeSuccess2,
|
|
49401
|
+
debug: writeDebug2,
|
|
49402
|
+
trace: writeTrace2,
|
|
49403
|
+
getStopwatch
|
|
49404
|
+
};
|
|
49405
|
+
}
|
|
49406
|
+
__name(createLogger, "createLogger");
|
|
49407
|
+
|
|
49408
|
+
// src/build.ts
|
|
49409
|
+
var import_defu7 = __toESM(require("defu"));
|
|
49410
|
+
var import_jiti4 = require("jiti");
|
|
49377
49411
|
var import_node_fs12 = require("fs");
|
|
49378
49412
|
var import_promises7 = require("fs/promises");
|
|
49379
49413
|
var import_node_path9 = require("path");
|
|
49380
|
-
var
|
|
49414
|
+
var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
|
|
49381
49415
|
|
|
49382
49416
|
// src/clean.ts
|
|
49383
49417
|
init_cjs_shims();
|
|
@@ -49385,13 +49419,17 @@ var import_promises6 = require("fs/promises");
|
|
|
49385
49419
|
async function clean(name = "Unbuild", directory, config) {
|
|
49386
49420
|
writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
|
|
49387
49421
|
const stopwatch = getStopwatch(`${name} output clean`);
|
|
49422
|
+
await cleanDirectories(name, directory, config);
|
|
49423
|
+
stopwatch();
|
|
49424
|
+
}
|
|
49425
|
+
__name(clean, "clean");
|
|
49426
|
+
async function cleanDirectories(name = "Unbuild", directory, config) {
|
|
49388
49427
|
await (0, import_promises6.rm)(directory, {
|
|
49389
49428
|
recursive: true,
|
|
49390
49429
|
force: true
|
|
49391
49430
|
});
|
|
49392
|
-
stopwatch();
|
|
49393
49431
|
}
|
|
49394
|
-
__name(
|
|
49432
|
+
__name(cleanDirectories, "cleanDirectories");
|
|
49395
49433
|
|
|
49396
49434
|
// src/config.ts
|
|
49397
49435
|
init_cjs_shims();
|
|
@@ -49428,18 +49466,18 @@ var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
|
49428
49466
|
name: "storm:on-error",
|
|
49429
49467
|
buildEnd(error) {
|
|
49430
49468
|
if (error) {
|
|
49431
|
-
|
|
49469
|
+
resolvedOptions.logger.error(`The following errors occurred during the build:
|
|
49432
49470
|
${error ? error.message : "Unknown build error"}
|
|
49433
49471
|
|
|
49434
|
-
|
|
49472
|
+
`);
|
|
49435
49473
|
throw new Error("Storm unbuild process failed with errors.");
|
|
49436
49474
|
}
|
|
49437
49475
|
},
|
|
49438
49476
|
renderError(error) {
|
|
49439
|
-
|
|
49477
|
+
resolvedOptions.logger.error(`The following errors occurred during the build:
|
|
49440
49478
|
${error ? error.message : "Unknown build error"}
|
|
49441
49479
|
|
|
49442
|
-
|
|
49480
|
+
`);
|
|
49443
49481
|
throw new Error("Storm unbuild process failed with errors.");
|
|
49444
49482
|
}
|
|
49445
49483
|
}), "onErrorPlugin");
|
|
@@ -63027,13 +63065,14 @@ async function resolveOptions(options) {
|
|
|
63027
63065
|
throw new Error("Cannot find project root");
|
|
63028
63066
|
}
|
|
63029
63067
|
const outputPath = options.outputPath || joinPaths("dist", projectRoot);
|
|
63030
|
-
const workspaceRoot = (0,
|
|
63068
|
+
const workspaceRoot = (0, import_find_workspace_root5.findWorkspaceRoot)(projectRoot);
|
|
63031
63069
|
if (!workspaceRoot) {
|
|
63032
63070
|
throw new Error("Cannot find workspace root");
|
|
63033
63071
|
}
|
|
63034
63072
|
const config = await loadStormConfig(workspaceRoot.dir);
|
|
63035
|
-
|
|
63036
|
-
|
|
63073
|
+
const logger = await createLogger(config);
|
|
63074
|
+
logger.debug(" \u2699\uFE0F Resolving build options");
|
|
63075
|
+
const stopwatch = logger.getStopwatch("Build options resolution");
|
|
63037
63076
|
if (options.configPath) {
|
|
63038
63077
|
const configFile = await loadConfig2(options.configPath);
|
|
63039
63078
|
if (configFile) {
|
|
@@ -63075,7 +63114,7 @@ async function resolveOptions(options) {
|
|
|
63075
63114
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
63076
63115
|
dependencies.push(tsLibDependency);
|
|
63077
63116
|
}
|
|
63078
|
-
const jiti = (0,
|
|
63117
|
+
const jiti = (0, import_jiti4.createJiti)(config.workspaceRoot, {
|
|
63079
63118
|
fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
|
|
63080
63119
|
interopDefault: true
|
|
63081
63120
|
});
|
|
@@ -63087,6 +63126,7 @@ async function resolveOptions(options) {
|
|
|
63087
63126
|
projectName,
|
|
63088
63127
|
tsconfig,
|
|
63089
63128
|
jiti,
|
|
63129
|
+
logger,
|
|
63090
63130
|
clean: false,
|
|
63091
63131
|
entries: [
|
|
63092
63132
|
{
|
|
@@ -63194,8 +63234,8 @@ async function resolveOptions(options) {
|
|
|
63194
63234
|
__name(resolveOptions, "resolveOptions");
|
|
63195
63235
|
async function generatePackageJson(options) {
|
|
63196
63236
|
if (options.generatePackageJson !== false && (0, import_node_fs12.existsSync)(joinPaths(options.projectRoot, "package.json"))) {
|
|
63197
|
-
|
|
63198
|
-
const stopwatch = getStopwatch("Write package.json file");
|
|
63237
|
+
options.logger.debug(" \u270D\uFE0F Writing package.json file");
|
|
63238
|
+
const stopwatch = options.logger.getStopwatch("Write package.json file");
|
|
63199
63239
|
const packageJsonPath = joinPaths(options.projectRoot, "project.json");
|
|
63200
63240
|
if (!(0, import_node_fs12.existsSync)(packageJsonPath)) {
|
|
63201
63241
|
throw new Error("Cannot find package.json configuration");
|
|
@@ -63214,11 +63254,11 @@ async function generatePackageJson(options) {
|
|
|
63214
63254
|
}
|
|
63215
63255
|
__name(generatePackageJson, "generatePackageJson");
|
|
63216
63256
|
async function resolveUnbuild(options) {
|
|
63217
|
-
|
|
63257
|
+
options.logger.trace(`Resolving Unbuild package with Jiti`);
|
|
63218
63258
|
try {
|
|
63219
63259
|
return options.jiti.import("unbuild");
|
|
63220
63260
|
} catch (error) {
|
|
63221
|
-
|
|
63261
|
+
options.logger.error(" \u274C An error occurred while resolving the Unbuild package");
|
|
63222
63262
|
throw new Error("An error occurred while resolving the Unbuild package", {
|
|
63223
63263
|
cause: error
|
|
63224
63264
|
});
|
|
@@ -63226,8 +63266,8 @@ async function resolveUnbuild(options) {
|
|
|
63226
63266
|
}
|
|
63227
63267
|
__name(resolveUnbuild, "resolveUnbuild");
|
|
63228
63268
|
async function executeUnbuild(options) {
|
|
63229
|
-
|
|
63230
|
-
const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
|
|
63269
|
+
options.logger.debug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`);
|
|
63270
|
+
const stopwatch = options.logger.getStopwatch(`${options.name} (${options.projectRoot}) build`);
|
|
63231
63271
|
try {
|
|
63232
63272
|
const unbuild = await resolveUnbuild(options);
|
|
63233
63273
|
await unbuild.build(options.projectRoot, false, {
|
|
@@ -63241,8 +63281,8 @@ async function executeUnbuild(options) {
|
|
|
63241
63281
|
}
|
|
63242
63282
|
__name(executeUnbuild, "executeUnbuild");
|
|
63243
63283
|
async function copyBuildAssets(options) {
|
|
63244
|
-
|
|
63245
|
-
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
63284
|
+
options.logger.debug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`);
|
|
63285
|
+
const stopwatch = options.logger.getStopwatch(`${options.name} asset copy`);
|
|
63246
63286
|
await (0, import_build_tools.copyAssets)(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
63247
63287
|
stopwatch();
|
|
63248
63288
|
return options;
|
|
@@ -63250,23 +63290,26 @@ async function copyBuildAssets(options) {
|
|
|
63250
63290
|
__name(copyBuildAssets, "copyBuildAssets");
|
|
63251
63291
|
async function cleanOutputPath(options) {
|
|
63252
63292
|
if (options.clean !== false && options.outDir) {
|
|
63253
|
-
|
|
63293
|
+
options.logger.debug(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`);
|
|
63294
|
+
const stopwatch = options.logger.getStopwatch(`${options.name} output clean`);
|
|
63295
|
+
await cleanDirectories(options.name, options.outDir, options.config);
|
|
63296
|
+
stopwatch();
|
|
63254
63297
|
}
|
|
63255
63298
|
return options;
|
|
63256
63299
|
}
|
|
63257
63300
|
__name(cleanOutputPath, "cleanOutputPath");
|
|
63258
63301
|
async function build(options) {
|
|
63259
|
-
|
|
63260
|
-
|
|
63302
|
+
const resolvedOptions = await resolveOptions(options);
|
|
63303
|
+
resolvedOptions.logger.debug(` \u26A1 Executing Storm Unbuild pipeline`);
|
|
63304
|
+
const stopwatch = resolvedOptions.logger.getStopwatch("Unbuild pipeline");
|
|
63261
63305
|
try {
|
|
63262
|
-
const resolvedOptions = await resolveOptions(options);
|
|
63263
63306
|
await cleanOutputPath(resolvedOptions);
|
|
63264
63307
|
await generatePackageJson(resolvedOptions);
|
|
63265
63308
|
await executeUnbuild(resolvedOptions);
|
|
63266
63309
|
await copyBuildAssets(resolvedOptions);
|
|
63267
|
-
|
|
63310
|
+
resolvedOptions.logger.success(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`);
|
|
63268
63311
|
} catch (error) {
|
|
63269
|
-
|
|
63312
|
+
resolvedOptions.logger.fatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
|
|
63270
63313
|
throw error;
|
|
63271
63314
|
} finally {
|
|
63272
63315
|
stopwatch();
|
package/bin/unbuild.mjs
CHANGED
|
@@ -48741,8 +48741,7 @@ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
|
|
|
48741
48741
|
}, "isVerbose");
|
|
48742
48742
|
|
|
48743
48743
|
// ../config-tools/src/logger/console.ts
|
|
48744
|
-
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
|
|
48745
|
-
const _chalk = getChalk();
|
|
48744
|
+
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
48746
48745
|
const colors2 = !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;
|
|
48747
48746
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
48748
48747
|
if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
|
|
@@ -49374,8 +49373,43 @@ import { readCachedProjectGraph as readCachedProjectGraph2, writeJsonFile } from
|
|
|
49374
49373
|
import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
|
|
49375
49374
|
import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
|
|
49376
49375
|
import { addPackageDependencies, addPackageJsonExports, addWorkspacePackageJsonFields, copyAssets } from "@storm-software/build-tools";
|
|
49377
|
-
|
|
49376
|
+
|
|
49377
|
+
// ../config-tools/src/logger/create-logger.ts
|
|
49378
|
+
init_esm_shims();
|
|
49378
49379
|
import { createJiti as createJiti2 } from "jiti";
|
|
49380
|
+
async function createLogger(config) {
|
|
49381
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
49382
|
+
if (!workspaceRoot) {
|
|
49383
|
+
throw new Error("Cannot find workspace root");
|
|
49384
|
+
}
|
|
49385
|
+
const jiti = createJiti2(config?.workspaceRoot || workspaceRoot, {
|
|
49386
|
+
fsCache: "node_modules/.cache/storm/jiti",
|
|
49387
|
+
interopDefault: true
|
|
49388
|
+
});
|
|
49389
|
+
const chalk2 = await jiti.import("chalk");
|
|
49390
|
+
const writeFatal2 = getLogFn(LogLevel.FATAL, config, chalk2);
|
|
49391
|
+
const writeError2 = getLogFn(LogLevel.ERROR, config, chalk2);
|
|
49392
|
+
const writeWarning2 = getLogFn(LogLevel.WARN, config, chalk2);
|
|
49393
|
+
const writeInfo2 = getLogFn(LogLevel.INFO, config, chalk2);
|
|
49394
|
+
const writeSuccess2 = getLogFn(LogLevel.SUCCESS, config, chalk2);
|
|
49395
|
+
const writeDebug2 = getLogFn(LogLevel.DEBUG, config, chalk2);
|
|
49396
|
+
const writeTrace2 = getLogFn(LogLevel.DEBUG, config, chalk2);
|
|
49397
|
+
return {
|
|
49398
|
+
fatal: writeFatal2,
|
|
49399
|
+
error: writeError2,
|
|
49400
|
+
warning: writeWarning2,
|
|
49401
|
+
info: writeInfo2,
|
|
49402
|
+
success: writeSuccess2,
|
|
49403
|
+
debug: writeDebug2,
|
|
49404
|
+
trace: writeTrace2,
|
|
49405
|
+
getStopwatch
|
|
49406
|
+
};
|
|
49407
|
+
}
|
|
49408
|
+
__name(createLogger, "createLogger");
|
|
49409
|
+
|
|
49410
|
+
// src/build.ts
|
|
49411
|
+
import defu6 from "defu";
|
|
49412
|
+
import { createJiti as createJiti3 } from "jiti";
|
|
49379
49413
|
import { existsSync as existsSync8 } from "node:fs";
|
|
49380
49414
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
49381
49415
|
import { relative as relative5 } from "node:path";
|
|
@@ -49387,13 +49421,17 @@ import { rm as rm3 } from "node:fs/promises";
|
|
|
49387
49421
|
async function clean(name = "Unbuild", directory, config) {
|
|
49388
49422
|
writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
|
|
49389
49423
|
const stopwatch = getStopwatch(`${name} output clean`);
|
|
49424
|
+
await cleanDirectories(name, directory, config);
|
|
49425
|
+
stopwatch();
|
|
49426
|
+
}
|
|
49427
|
+
__name(clean, "clean");
|
|
49428
|
+
async function cleanDirectories(name = "Unbuild", directory, config) {
|
|
49390
49429
|
await rm3(directory, {
|
|
49391
49430
|
recursive: true,
|
|
49392
49431
|
force: true
|
|
49393
49432
|
});
|
|
49394
|
-
stopwatch();
|
|
49395
49433
|
}
|
|
49396
|
-
__name(
|
|
49434
|
+
__name(cleanDirectories, "cleanDirectories");
|
|
49397
49435
|
|
|
49398
49436
|
// src/config.ts
|
|
49399
49437
|
init_esm_shims();
|
|
@@ -49430,18 +49468,18 @@ var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
|
49430
49468
|
name: "storm:on-error",
|
|
49431
49469
|
buildEnd(error) {
|
|
49432
49470
|
if (error) {
|
|
49433
|
-
|
|
49471
|
+
resolvedOptions.logger.error(`The following errors occurred during the build:
|
|
49434
49472
|
${error ? error.message : "Unknown build error"}
|
|
49435
49473
|
|
|
49436
|
-
|
|
49474
|
+
`);
|
|
49437
49475
|
throw new Error("Storm unbuild process failed with errors.");
|
|
49438
49476
|
}
|
|
49439
49477
|
},
|
|
49440
49478
|
renderError(error) {
|
|
49441
|
-
|
|
49479
|
+
resolvedOptions.logger.error(`The following errors occurred during the build:
|
|
49442
49480
|
${error ? error.message : "Unknown build error"}
|
|
49443
49481
|
|
|
49444
|
-
|
|
49482
|
+
`);
|
|
49445
49483
|
throw new Error("Storm unbuild process failed with errors.");
|
|
49446
49484
|
}
|
|
49447
49485
|
}), "onErrorPlugin");
|
|
@@ -63034,8 +63072,9 @@ async function resolveOptions(options) {
|
|
|
63034
63072
|
throw new Error("Cannot find workspace root");
|
|
63035
63073
|
}
|
|
63036
63074
|
const config = await loadStormConfig(workspaceRoot.dir);
|
|
63037
|
-
|
|
63038
|
-
|
|
63075
|
+
const logger = await createLogger(config);
|
|
63076
|
+
logger.debug(" \u2699\uFE0F Resolving build options");
|
|
63077
|
+
const stopwatch = logger.getStopwatch("Build options resolution");
|
|
63039
63078
|
if (options.configPath) {
|
|
63040
63079
|
const configFile = await loadConfig2(options.configPath);
|
|
63041
63080
|
if (configFile) {
|
|
@@ -63077,7 +63116,7 @@ async function resolveOptions(options) {
|
|
|
63077
63116
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
63078
63117
|
dependencies.push(tsLibDependency);
|
|
63079
63118
|
}
|
|
63080
|
-
const jiti =
|
|
63119
|
+
const jiti = createJiti3(config.workspaceRoot, {
|
|
63081
63120
|
fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
|
|
63082
63121
|
interopDefault: true
|
|
63083
63122
|
});
|
|
@@ -63089,6 +63128,7 @@ async function resolveOptions(options) {
|
|
|
63089
63128
|
projectName,
|
|
63090
63129
|
tsconfig,
|
|
63091
63130
|
jiti,
|
|
63131
|
+
logger,
|
|
63092
63132
|
clean: false,
|
|
63093
63133
|
entries: [
|
|
63094
63134
|
{
|
|
@@ -63196,8 +63236,8 @@ async function resolveOptions(options) {
|
|
|
63196
63236
|
__name(resolveOptions, "resolveOptions");
|
|
63197
63237
|
async function generatePackageJson(options) {
|
|
63198
63238
|
if (options.generatePackageJson !== false && existsSync8(joinPaths(options.projectRoot, "package.json"))) {
|
|
63199
|
-
|
|
63200
|
-
const stopwatch = getStopwatch("Write package.json file");
|
|
63239
|
+
options.logger.debug(" \u270D\uFE0F Writing package.json file");
|
|
63240
|
+
const stopwatch = options.logger.getStopwatch("Write package.json file");
|
|
63201
63241
|
const packageJsonPath = joinPaths(options.projectRoot, "project.json");
|
|
63202
63242
|
if (!existsSync8(packageJsonPath)) {
|
|
63203
63243
|
throw new Error("Cannot find package.json configuration");
|
|
@@ -63216,11 +63256,11 @@ async function generatePackageJson(options) {
|
|
|
63216
63256
|
}
|
|
63217
63257
|
__name(generatePackageJson, "generatePackageJson");
|
|
63218
63258
|
async function resolveUnbuild(options) {
|
|
63219
|
-
|
|
63259
|
+
options.logger.trace(`Resolving Unbuild package with Jiti`);
|
|
63220
63260
|
try {
|
|
63221
63261
|
return options.jiti.import("unbuild");
|
|
63222
63262
|
} catch (error) {
|
|
63223
|
-
|
|
63263
|
+
options.logger.error(" \u274C An error occurred while resolving the Unbuild package");
|
|
63224
63264
|
throw new Error("An error occurred while resolving the Unbuild package", {
|
|
63225
63265
|
cause: error
|
|
63226
63266
|
});
|
|
@@ -63228,8 +63268,8 @@ async function resolveUnbuild(options) {
|
|
|
63228
63268
|
}
|
|
63229
63269
|
__name(resolveUnbuild, "resolveUnbuild");
|
|
63230
63270
|
async function executeUnbuild(options) {
|
|
63231
|
-
|
|
63232
|
-
const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
|
|
63271
|
+
options.logger.debug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`);
|
|
63272
|
+
const stopwatch = options.logger.getStopwatch(`${options.name} (${options.projectRoot}) build`);
|
|
63233
63273
|
try {
|
|
63234
63274
|
const unbuild = await resolveUnbuild(options);
|
|
63235
63275
|
await unbuild.build(options.projectRoot, false, {
|
|
@@ -63243,8 +63283,8 @@ async function executeUnbuild(options) {
|
|
|
63243
63283
|
}
|
|
63244
63284
|
__name(executeUnbuild, "executeUnbuild");
|
|
63245
63285
|
async function copyBuildAssets(options) {
|
|
63246
|
-
|
|
63247
|
-
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
63286
|
+
options.logger.debug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`);
|
|
63287
|
+
const stopwatch = options.logger.getStopwatch(`${options.name} asset copy`);
|
|
63248
63288
|
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.projectName, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
63249
63289
|
stopwatch();
|
|
63250
63290
|
return options;
|
|
@@ -63252,23 +63292,26 @@ async function copyBuildAssets(options) {
|
|
|
63252
63292
|
__name(copyBuildAssets, "copyBuildAssets");
|
|
63253
63293
|
async function cleanOutputPath(options) {
|
|
63254
63294
|
if (options.clean !== false && options.outDir) {
|
|
63255
|
-
|
|
63295
|
+
options.logger.debug(` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`);
|
|
63296
|
+
const stopwatch = options.logger.getStopwatch(`${options.name} output clean`);
|
|
63297
|
+
await cleanDirectories(options.name, options.outDir, options.config);
|
|
63298
|
+
stopwatch();
|
|
63256
63299
|
}
|
|
63257
63300
|
return options;
|
|
63258
63301
|
}
|
|
63259
63302
|
__name(cleanOutputPath, "cleanOutputPath");
|
|
63260
63303
|
async function build(options) {
|
|
63261
|
-
|
|
63262
|
-
|
|
63304
|
+
const resolvedOptions = await resolveOptions(options);
|
|
63305
|
+
resolvedOptions.logger.debug(` \u26A1 Executing Storm Unbuild pipeline`);
|
|
63306
|
+
const stopwatch = resolvedOptions.logger.getStopwatch("Unbuild pipeline");
|
|
63263
63307
|
try {
|
|
63264
|
-
const resolvedOptions = await resolveOptions(options);
|
|
63265
63308
|
await cleanOutputPath(resolvedOptions);
|
|
63266
63309
|
await generatePackageJson(resolvedOptions);
|
|
63267
63310
|
await executeUnbuild(resolvedOptions);
|
|
63268
63311
|
await copyBuildAssets(resolvedOptions);
|
|
63269
|
-
|
|
63312
|
+
resolvedOptions.logger.success(` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`);
|
|
63270
63313
|
} catch (error) {
|
|
63271
|
-
|
|
63314
|
+
resolvedOptions.logger.fatal(" \u274C Fatal errors occurred during the build that could not be recovered from. The build process has been terminated.");
|
|
63272
63315
|
throw error;
|
|
63273
63316
|
} finally {
|
|
63274
63317
|
stopwatch();
|
package/dist/build.d.mts
CHANGED
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkYIP6AERXjs = require('./chunk-YIP6AERX.js');
|
|
4
4
|
require('./chunk-45FJ3WQ6.js');
|
|
5
5
|
require('./chunk-W7YS7HE5.js');
|
|
6
6
|
require('./chunk-RM7SW35Z.js');
|
|
7
7
|
require('./chunk-S532A3LO.js');
|
|
8
8
|
require('./chunk-4HFICKAT.js');
|
|
9
9
|
require('./chunk-NMYL4VJJ.js');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
12
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-PVZYPNLZ.js');
|
|
11
|
+
require('./chunk-44VTNVZA.js');
|
|
12
|
+
require('./chunk-523YIUTF.js');
|
|
13
13
|
require('./chunk-P6LWSWAQ.js');
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-
|
|
16
|
-
require('./chunk-
|
|
14
|
+
require('./chunk-BUCFGCTW.js');
|
|
15
|
+
require('./chunk-MCNTIU52.js');
|
|
16
|
+
require('./chunk-SQOZCV36.js');
|
|
17
17
|
require('./chunk-RBSVNX4W.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.build =
|
|
20
|
+
exports.build = _chunkYIP6AERXjs.build;
|
package/dist/build.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
build
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G6BE6UP3.mjs";
|
|
4
4
|
import "./chunk-FAXWFK7Q.mjs";
|
|
5
5
|
import "./chunk-EKTZK3IJ.mjs";
|
|
6
6
|
import "./chunk-EGCWTBMT.mjs";
|
|
7
7
|
import "./chunk-VJI72AA6.mjs";
|
|
8
8
|
import "./chunk-K5SQO3GD.mjs";
|
|
9
9
|
import "./chunk-DIRFSBOA.mjs";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-6UMHN4KS.mjs";
|
|
11
|
+
import "./chunk-ESGPHEWU.mjs";
|
|
12
|
+
import "./chunk-Q4GMTWGF.mjs";
|
|
13
13
|
import "./chunk-4ENAOJ33.mjs";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-WXJPXYHF.mjs";
|
|
15
|
+
import "./chunk-TEEYWCSY.mjs";
|
|
16
|
+
import "./chunk-4BAUMYRN.mjs";
|
|
17
17
|
import "./chunk-3TNHGERR.mjs";
|
|
18
18
|
export {
|
|
19
19
|
build
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk523YIUTFjs = require('./chunk-523YIUTF.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkP6LWSWAQjs = require('./chunk-P6LWSWAQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkBUCFGCTWjs = require('./chunk-BUCFGCTW.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkSQOZCV36js = require('./chunk-SQOZCV36.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -18,10 +18,10 @@ var _chunkRBSVNX4Wjs = require('./chunk-RBSVNX4W.js');
|
|
|
18
18
|
// src/config.ts
|
|
19
19
|
_chunkRBSVNX4Wjs.init_cjs_shims.call(void 0, );
|
|
20
20
|
var getDefaultBuildPlugins = /* @__PURE__ */ _chunkRBSVNX4Wjs.__name.call(void 0, async (options, resolvedOptions) => Promise.all([
|
|
21
|
-
|
|
21
|
+
_chunkBUCFGCTWjs.analyzePlugin.call(void 0, options, resolvedOptions),
|
|
22
22
|
_chunkP6LWSWAQjs.typeDefinitions.call(void 0, resolvedOptions.projectRoot),
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
_chunk523YIUTFjs.tscPlugin.call(void 0, options, resolvedOptions),
|
|
24
|
+
_chunkSQOZCV36js.onErrorPlugin.call(void 0, options, resolvedOptions)
|
|
25
25
|
].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
|
|
26
26
|
|
|
27
27
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeError
|
|
3
|
-
} from "./chunk-J3DIENOH.mjs";
|
|
4
1
|
import {
|
|
5
2
|
__name,
|
|
6
3
|
init_esm_shims
|
|
@@ -12,18 +9,18 @@ var onErrorPlugin = /* @__PURE__ */ __name((options, resolvedOptions) => ({
|
|
|
12
9
|
name: "storm:on-error",
|
|
13
10
|
buildEnd(error) {
|
|
14
11
|
if (error) {
|
|
15
|
-
|
|
12
|
+
resolvedOptions.logger.error(`The following errors occurred during the build:
|
|
16
13
|
${error ? error.message : "Unknown build error"}
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
`);
|
|
19
16
|
throw new Error("Storm unbuild process failed with errors.");
|
|
20
17
|
}
|
|
21
18
|
},
|
|
22
19
|
renderError(error) {
|
|
23
|
-
|
|
20
|
+
resolvedOptions.logger.error(`The following errors occurred during the build:
|
|
24
21
|
${error ? error.message : "Unknown build error"}
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
`);
|
|
27
24
|
throw new Error("Storm unbuild process failed with errors.");
|
|
28
25
|
}
|
|
29
26
|
}), "onErrorPlugin");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMCNTIU52js = require('./chunk-MCNTIU52.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -19894,7 +19894,7 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
|
|
|
19894
19894
|
declaration: true,
|
|
19895
19895
|
paths: _buildablelibsutils.computeCompilerOptionsPaths.call(void 0, tsConfig, _nullishCoalesce(dependencies, () => ( [])))
|
|
19896
19896
|
};
|
|
19897
|
-
|
|
19897
|
+
_chunkMCNTIU52js.writeTrace.call(void 0, compilerOptions, config);
|
|
19898
19898
|
return compilerOptions;
|
|
19899
19899
|
}
|
|
19900
19900
|
_chunkRBSVNX4Wjs.__name.call(void 0, createTsCompilerOptions, "createTsCompilerOptions");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getStopwatch,
|
|
3
3
|
writeDebug
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TEEYWCSY.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__name,
|
|
7
7
|
init_esm_shims
|
|
@@ -13,14 +13,19 @@ import { rm } from "node:fs/promises";
|
|
|
13
13
|
async function clean(name = "Unbuild", directory, config) {
|
|
14
14
|
writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
|
|
15
15
|
const stopwatch = getStopwatch(`${name} output clean`);
|
|
16
|
+
await cleanDirectories(name, directory, config);
|
|
17
|
+
stopwatch();
|
|
18
|
+
}
|
|
19
|
+
__name(clean, "clean");
|
|
20
|
+
async function cleanDirectories(name = "Unbuild", directory, config) {
|
|
16
21
|
await rm(directory, {
|
|
17
22
|
recursive: true,
|
|
18
23
|
force: true
|
|
19
24
|
});
|
|
20
|
-
stopwatch();
|
|
21
25
|
}
|
|
22
|
-
__name(
|
|
26
|
+
__name(cleanDirectories, "cleanDirectories");
|
|
23
27
|
|
|
24
28
|
export {
|
|
25
|
-
clean
|
|
29
|
+
clean,
|
|
30
|
+
cleanDirectories
|
|
26
31
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMCNTIU52js = require('./chunk-MCNTIU52.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ var analyzePlugin = /* @__PURE__ */ _chunkRBSVNX4Wjs.__name.call(void 0, (option
|
|
|
27
27
|
renderChunk(source, chunk) {
|
|
28
28
|
const sourceBytes = formatBytes(source.length);
|
|
29
29
|
const fileName = chunk.fileName;
|
|
30
|
-
|
|
30
|
+
_chunkMCNTIU52js.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
}, "analyzePlugin");
|