@storm-software/unbuild 0.30.5 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/unbuild.cjs +149 -133
- package/bin/unbuild.js +130 -114
- package/dist/build.cjs +8 -8
- package/dist/build.js +7 -7
- package/dist/{chunk-V627S7QU.cjs → chunk-26OHEX55.cjs} +2 -2
- package/dist/{chunk-KPFCICEG.js → chunk-3Q2ZB7CN.js} +1 -1
- package/dist/{chunk-VD6EE7HD.js → chunk-BZJA6TK2.js} +243 -231
- package/dist/{chunk-5E3NJ26L.cjs → chunk-CUQLNBV5.cjs} +3 -3
- package/dist/{chunk-5S4A4OEA.js → chunk-G2BQ6VSR.js} +1 -1
- package/dist/{chunk-CF2C3GEV.cjs → chunk-GVX7LSWK.cjs} +3 -3
- package/dist/{chunk-PSYW5YJB.cjs → chunk-KDTFDJN3.cjs} +2 -2
- package/dist/{chunk-FG6XQ26M.cjs → chunk-LXCK6Y4C.cjs} +20 -16
- package/dist/{chunk-F77T2VZV.cjs → chunk-N2XPKSKO.cjs} +318 -306
- package/dist/{chunk-C5IHRWT3.js → chunk-NYVG7QMW.js} +1 -1
- package/dist/{chunk-Y2DOCJBE.cjs → chunk-O45RUFL3.cjs} +6 -6
- package/dist/{chunk-K2D7TQ7G.js → chunk-OAOLAATA.js} +3 -3
- package/dist/{chunk-TPFSDZCR.js → chunk-VWXW3RW5.js} +18 -14
- package/dist/{chunk-VC7N2YVM.js → chunk-XGZOR6PZ.js} +1 -1
- package/dist/clean.cjs +3 -3
- package/dist/clean.js +2 -2
- package/dist/config.cjs +6 -6
- package/dist/config.js +5 -5
- package/dist/index.cjs +8 -8
- package/dist/index.js +7 -7
- package/package.json +4 -4
package/bin/unbuild.js
CHANGED
|
@@ -93,6 +93,8 @@ var ColorConfigMapSchema = z.union([
|
|
|
93
93
|
}),
|
|
94
94
|
z.record(z.string(), ColorConfigSchema)
|
|
95
95
|
]);
|
|
96
|
+
var ExtendsItemSchema = z.string().trim().describe("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.");
|
|
97
|
+
var ExtendsSchema = ExtendsItemSchema.or(z.array(ExtendsItemSchema)).describe("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.");
|
|
96
98
|
var WorkspaceBotConfigSchema = z.object({
|
|
97
99
|
name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
|
|
98
100
|
email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
@@ -107,11 +109,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
|
|
|
107
109
|
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
108
110
|
var StormConfigSchema = z.object({
|
|
109
111
|
$schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
110
|
-
extends:
|
|
112
|
+
extends: ExtendsSchema.optional(),
|
|
111
113
|
name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
112
114
|
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
113
115
|
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
114
|
-
repository: z.string().trim().
|
|
116
|
+
repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
115
117
|
license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
116
118
|
homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
|
|
117
119
|
docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
|
|
@@ -205,7 +207,8 @@ var COLOR_KEYS = [
|
|
|
205
207
|
];
|
|
206
208
|
|
|
207
209
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
208
|
-
import { existsSync as existsSync2
|
|
210
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
211
|
+
import { readFile } from "node:fs/promises";
|
|
209
212
|
import { join as join2 } from "node:path";
|
|
210
213
|
|
|
211
214
|
// ../config-tools/src/utilities/correct-paths.ts
|
|
@@ -327,17 +330,15 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
327
330
|
"negative": "#dc2626"
|
|
328
331
|
}
|
|
329
332
|
};
|
|
330
|
-
var getDefaultConfig = /* @__PURE__ */ __name((root) => {
|
|
333
|
+
var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
331
334
|
let license = STORM_DEFAULT_LICENSE;
|
|
332
335
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
333
|
-
let name;
|
|
334
|
-
let namespace;
|
|
335
|
-
let repository;
|
|
336
|
+
let name = void 0;
|
|
337
|
+
let namespace = void 0;
|
|
338
|
+
let repository = void 0;
|
|
336
339
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
337
340
|
if (existsSync2(join2(workspaceRoot, "package.json"))) {
|
|
338
|
-
const file =
|
|
339
|
-
encoding: "utf8"
|
|
340
|
-
});
|
|
341
|
+
const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
341
342
|
if (file) {
|
|
342
343
|
const packageJson = JSON.parse(file);
|
|
343
344
|
if (packageJson.name) {
|
|
@@ -346,8 +347,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
|
|
|
346
347
|
if (packageJson.namespace) {
|
|
347
348
|
namespace = packageJson.namespace;
|
|
348
349
|
}
|
|
349
|
-
if (packageJson.repository
|
|
350
|
-
|
|
350
|
+
if (packageJson.repository) {
|
|
351
|
+
if (typeof packageJson.repository === "string") {
|
|
352
|
+
repository = packageJson.repository;
|
|
353
|
+
} else if (packageJson.repository.url) {
|
|
354
|
+
repository = packageJson.repository.url;
|
|
355
|
+
}
|
|
351
356
|
}
|
|
352
357
|
if (packageJson.license) {
|
|
353
358
|
license = packageJson.license;
|
|
@@ -556,7 +561,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
|
|
|
556
561
|
var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
|
|
557
562
|
var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
|
|
558
563
|
var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
|
|
559
|
-
var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
|
|
560
564
|
var getStopwatch = /* @__PURE__ */ __name((name) => {
|
|
561
565
|
const start = process.hrtime();
|
|
562
566
|
return () => {
|
|
@@ -629,19 +633,19 @@ Stacktrace: ${error.stack}`, config);
|
|
|
629
633
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
630
634
|
var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
|
|
631
635
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
636
|
+
const configs = await Promise.all([
|
|
637
|
+
loadConfig({
|
|
638
|
+
cwd: workspacePath,
|
|
639
|
+
packageJson: true,
|
|
640
|
+
name: fileName,
|
|
641
|
+
envName: fileName?.toUpperCase(),
|
|
642
|
+
jitiOptions: {
|
|
643
|
+
debug: false,
|
|
644
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
645
|
+
},
|
|
646
|
+
...options
|
|
647
|
+
}),
|
|
648
|
+
loadConfig({
|
|
645
649
|
cwd: workspacePath,
|
|
646
650
|
packageJson: true,
|
|
647
651
|
name: fileName,
|
|
@@ -652,9 +656,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
652
656
|
},
|
|
653
657
|
configFile: fileName,
|
|
654
658
|
...options
|
|
655
|
-
})
|
|
656
|
-
|
|
657
|
-
return
|
|
659
|
+
})
|
|
660
|
+
]);
|
|
661
|
+
return defu(configs[0] ?? {}, configs[1] ?? {});
|
|
658
662
|
}, "getConfigFileByName");
|
|
659
663
|
var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
|
|
660
664
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
@@ -662,7 +666,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
662
666
|
let config = result.config;
|
|
663
667
|
const configFile = result.configFile;
|
|
664
668
|
if (config && configFile && Object.keys(config).length > 0) {
|
|
665
|
-
|
|
669
|
+
writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
666
670
|
logLevel: "all"
|
|
667
671
|
});
|
|
668
672
|
}
|
|
@@ -670,7 +674,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
670
674
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
671
675
|
for (const result2 of results) {
|
|
672
676
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
673
|
-
|
|
677
|
+
writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
674
678
|
logLevel: "all"
|
|
675
679
|
});
|
|
676
680
|
config = defu(result2.config ?? {}, config ?? {});
|
|
@@ -685,6 +689,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
685
689
|
}, "getConfigFile");
|
|
686
690
|
|
|
687
691
|
// ../config-tools/src/env/get-env.ts
|
|
692
|
+
var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
|
|
693
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
694
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
695
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
696
|
+
if (name) {
|
|
697
|
+
ret[name] = process.env[key];
|
|
698
|
+
}
|
|
699
|
+
return ret;
|
|
700
|
+
}, {});
|
|
701
|
+
}, "getExtensionEnv");
|
|
688
702
|
var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
689
703
|
const prefix = "STORM_";
|
|
690
704
|
let config = {
|
|
@@ -844,7 +858,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
|
|
|
844
858
|
var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
845
859
|
const prefix = "STORM_";
|
|
846
860
|
if (config.extends) {
|
|
847
|
-
process.env[`${prefix}EXTENDS`] = config.extends;
|
|
861
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
848
862
|
}
|
|
849
863
|
if (config.name) {
|
|
850
864
|
process.env[`${prefix}NAME`] = config.name;
|
|
@@ -1074,35 +1088,74 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1074
1088
|
}, "setBaseThemeColorConfigEnv");
|
|
1075
1089
|
|
|
1076
1090
|
// ../config-tools/src/create-storm-config.ts
|
|
1091
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
1077
1092
|
var _static_cache = void 0;
|
|
1078
|
-
var
|
|
1079
|
-
let
|
|
1080
|
-
if (_static_cache?.data
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
}
|
|
1093
|
+
var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
|
|
1094
|
+
let result;
|
|
1095
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
1096
|
+
let _workspaceRoot = workspaceRoot;
|
|
1097
|
+
if (!_workspaceRoot) {
|
|
1098
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
1099
|
+
}
|
|
1100
|
+
const configEnv = getConfigEnv();
|
|
1101
|
+
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1102
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
1103
|
+
if (!configFile && !skipLogs) {
|
|
1104
|
+
writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
|
|
1105
|
+
logLevel: "all"
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
|
|
1109
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
1110
|
+
} else {
|
|
1111
|
+
result = _static_cache.data;
|
|
1112
|
+
}
|
|
1113
|
+
if (schema && extensionName) {
|
|
1114
|
+
result.extensions = {
|
|
1115
|
+
...result.extensions,
|
|
1116
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
1117
|
+
};
|
|
1093
1118
|
}
|
|
1094
|
-
|
|
1119
|
+
_static_cache = {
|
|
1120
|
+
timestamp: Date.now(),
|
|
1121
|
+
data: result
|
|
1122
|
+
};
|
|
1123
|
+
return result;
|
|
1124
|
+
}, "createStormConfig");
|
|
1125
|
+
var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
1126
|
+
const extension_cache_key = {
|
|
1127
|
+
extensionName
|
|
1128
|
+
};
|
|
1129
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
1130
|
+
return _extension_cache.get(extension_cache_key);
|
|
1131
|
+
}
|
|
1132
|
+
let extension = getExtensionEnv(extensionName);
|
|
1133
|
+
if (schema) {
|
|
1134
|
+
extension = schema.parse(extension);
|
|
1135
|
+
}
|
|
1136
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
1137
|
+
return extension;
|
|
1138
|
+
}, "createConfigExtension");
|
|
1139
|
+
var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
|
|
1140
|
+
const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
|
|
1095
1141
|
setConfigEnv(config);
|
|
1096
|
-
|
|
1142
|
+
if (!skipLogs) {
|
|
1143
|
+
writeTrace(`\u2699\uFE0F Using Storm configuration:
|
|
1097
1144
|
${formatLogMessage(config)}`, config);
|
|
1145
|
+
}
|
|
1098
1146
|
return config;
|
|
1099
1147
|
}, "loadStormConfig");
|
|
1100
1148
|
|
|
1149
|
+
// ../config-tools/src/get-config.ts
|
|
1150
|
+
var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
|
|
1151
|
+
return loadStormConfig(workspaceRoot, skipLogs);
|
|
1152
|
+
}, "getConfig");
|
|
1153
|
+
|
|
1101
1154
|
// bin/unbuild.ts
|
|
1102
1155
|
import { Command, Option } from "commander";
|
|
1103
1156
|
|
|
1104
1157
|
// src/build.ts
|
|
1105
|
-
import { readCachedProjectGraph as
|
|
1158
|
+
import { readCachedProjectGraph as readCachedProjectGraph3, writeJsonFile } from "@nx/devkit";
|
|
1106
1159
|
import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
|
|
1107
1160
|
import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies3 } from "@nx/js/src/utils/buildable-libs-utils";
|
|
1108
1161
|
|
|
@@ -1120,30 +1173,10 @@ import { stripIndents } from "@nx/devkit";
|
|
|
1120
1173
|
import { relative } from "path";
|
|
1121
1174
|
|
|
1122
1175
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
1123
|
-
import {
|
|
1124
|
-
import { copyAssets as copyAssetsBase } from "@nx/js";
|
|
1176
|
+
import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
|
|
1125
1177
|
import { glob } from "glob";
|
|
1126
1178
|
import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
1127
|
-
|
|
1128
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1129
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
1130
|
-
import { readFile } from "node:fs/promises";
|
|
1131
|
-
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
1132
|
-
let rootDir = workspaceRoot;
|
|
1133
|
-
if (!rootDir) {
|
|
1134
|
-
const config = await loadStormConfig();
|
|
1135
|
-
rootDir = config.workspaceRoot;
|
|
1136
|
-
}
|
|
1137
|
-
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
1138
|
-
if (!existsSync3(nxJsonPath)) {
|
|
1139
|
-
throw new Error("Cannot find project.json configuration");
|
|
1140
|
-
}
|
|
1141
|
-
const configContent = await readFile(nxJsonPath, "utf8");
|
|
1142
|
-
return JSON.parse(configContent);
|
|
1143
|
-
}, "readNxConfig");
|
|
1144
|
-
|
|
1145
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
1146
|
-
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1179
|
+
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1147
1180
|
const pendingAssets = Array.from(assets ?? []);
|
|
1148
1181
|
pendingAssets.push({
|
|
1149
1182
|
input: projectRoot,
|
|
@@ -1151,7 +1184,7 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1151
1184
|
output: "."
|
|
1152
1185
|
});
|
|
1153
1186
|
pendingAssets.push({
|
|
1154
|
-
input:
|
|
1187
|
+
input: ".",
|
|
1155
1188
|
glob: "LICENSE",
|
|
1156
1189
|
output: "."
|
|
1157
1190
|
});
|
|
@@ -1169,36 +1202,15 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1169
1202
|
output: "src/"
|
|
1170
1203
|
});
|
|
1171
1204
|
}
|
|
1172
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
1173
|
-
const projectGraph = readCachedProjectGraph();
|
|
1174
|
-
const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
1175
|
-
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
1176
|
-
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
1177
|
-
}
|
|
1178
|
-
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
1179
|
-
if (!buildTarget) {
|
|
1180
|
-
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
|
|
1181
|
-
}
|
|
1182
1205
|
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
1183
1206
|
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
1184
|
-
const
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
outputPath
|
|
1188
|
-
|
|
1189
|
-
root: config.workspaceRoot,
|
|
1190
|
-
targetName: "build",
|
|
1191
|
-
target: buildTarget,
|
|
1192
|
-
projectName,
|
|
1193
|
-
projectGraph,
|
|
1194
|
-
projectsConfigurations,
|
|
1195
|
-
nxJsonConfiguration: nxJson,
|
|
1196
|
-
cwd: config.workspaceRoot,
|
|
1197
|
-
isVerbose: isVerbose(config.logLevel)
|
|
1207
|
+
const assetHandler = new CopyAssetsHandler({
|
|
1208
|
+
projectDir: projectRoot,
|
|
1209
|
+
rootDir: config.workspaceRoot,
|
|
1210
|
+
outputDir: outputPath,
|
|
1211
|
+
assets: pendingAssets
|
|
1198
1212
|
});
|
|
1199
|
-
|
|
1200
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
1201
|
-
}
|
|
1213
|
+
await assetHandler.processAllAssetsOnce();
|
|
1202
1214
|
if (includeSrc === true) {
|
|
1203
1215
|
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
1204
1216
|
const files = await glob([
|
|
@@ -1218,17 +1230,17 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
|
|
|
1218
1230
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1219
1231
|
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
1220
1232
|
import { Glob } from "glob";
|
|
1221
|
-
import { existsSync as
|
|
1233
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
1222
1234
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
1223
|
-
import { readCachedProjectGraph
|
|
1235
|
+
import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
|
|
1224
1236
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
1225
|
-
const projectDependencies = calculateProjectBuildableDependencies(void 0,
|
|
1237
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1226
1238
|
const localPackages = [];
|
|
1227
1239
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
1228
1240
|
const projectNode = project.node;
|
|
1229
1241
|
if (projectNode.data.root) {
|
|
1230
1242
|
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
1231
|
-
if (
|
|
1243
|
+
if (existsSync3(projectPackageJsonPath)) {
|
|
1232
1244
|
const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
|
|
1233
1245
|
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
1234
1246
|
if (projectPackageJson.private !== false) {
|
|
@@ -1313,6 +1325,10 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projec
|
|
|
1313
1325
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
1314
1326
|
import { glob as glob2 } from "glob";
|
|
1315
1327
|
|
|
1328
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1329
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
1330
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
1331
|
+
|
|
1316
1332
|
// ../build-tools/src/utilities/task-graph.ts
|
|
1317
1333
|
import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
|
|
1318
1334
|
|
|
@@ -1320,7 +1336,7 @@ import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-r
|
|
|
1320
1336
|
import defu4 from "defu";
|
|
1321
1337
|
import { Glob as Glob2 } from "glob";
|
|
1322
1338
|
import { existsSync as existsSync6 } from "node:fs";
|
|
1323
|
-
import { readFile as
|
|
1339
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
1324
1340
|
import { relative as relative4 } from "node:path";
|
|
1325
1341
|
import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
|
|
1326
1342
|
|
|
@@ -2819,7 +2835,7 @@ ${error ? error.message : "Unknown build error"}
|
|
|
2819
2835
|
}), "onErrorPlugin");
|
|
2820
2836
|
|
|
2821
2837
|
// src/plugins/tsc.ts
|
|
2822
|
-
import { readCachedProjectGraph as
|
|
2838
|
+
import { readCachedProjectGraph as readCachedProjectGraph2 } from "@nx/devkit";
|
|
2823
2839
|
import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
|
|
2824
2840
|
import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
|
|
2825
2841
|
import ts2Plugin from "rollup-plugin-typescript2";
|
|
@@ -2852,7 +2868,7 @@ __name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
|
2852
2868
|
|
|
2853
2869
|
// src/plugins/tsc.ts
|
|
2854
2870
|
var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
|
|
2855
|
-
const projectGraph =
|
|
2871
|
+
const projectGraph = readCachedProjectGraph2();
|
|
2856
2872
|
const result = calculateProjectBuildableDependencies2(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
2857
2873
|
let dependencies = result.dependencies;
|
|
2858
2874
|
const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
|
|
@@ -2919,19 +2935,19 @@ async function resolveOptions(options, config) {
|
|
|
2919
2935
|
}
|
|
2920
2936
|
}
|
|
2921
2937
|
const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
|
|
2922
|
-
const projectGraph =
|
|
2938
|
+
const projectGraph = readCachedProjectGraph3();
|
|
2923
2939
|
const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
|
|
2924
2940
|
if (!existsSync6(projectJsonPath)) {
|
|
2925
2941
|
throw new Error("Cannot find project.json configuration");
|
|
2926
2942
|
}
|
|
2927
|
-
const projectJsonContent = await
|
|
2943
|
+
const projectJsonContent = await readFile5(projectJsonPath, "utf8");
|
|
2928
2944
|
const projectJson = JSON.parse(projectJsonContent);
|
|
2929
2945
|
const projectName = projectJson.name;
|
|
2930
2946
|
const packageJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "package.json");
|
|
2931
2947
|
if (!existsSync6(packageJsonPath)) {
|
|
2932
2948
|
throw new Error("Cannot find package.json configuration");
|
|
2933
2949
|
}
|
|
2934
|
-
const packageJsonContent = await
|
|
2950
|
+
const packageJsonContent = await readFile5(packageJsonPath, "utf8");
|
|
2935
2951
|
const packageJson = JSON.parse(packageJsonContent);
|
|
2936
2952
|
let tsconfig = options.tsconfig;
|
|
2937
2953
|
if (!tsconfig) {
|
|
@@ -3120,7 +3136,7 @@ async function generatePackageJson(options) {
|
|
|
3120
3136
|
if (!existsSync6(packageJsonPath)) {
|
|
3121
3137
|
throw new Error("Cannot find package.json configuration");
|
|
3122
3138
|
}
|
|
3123
|
-
let packageJsonContent = await
|
|
3139
|
+
let packageJsonContent = await readFile5(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
|
|
3124
3140
|
if (!packageJsonContent) {
|
|
3125
3141
|
throw new Error("Cannot find package.json configuration file");
|
|
3126
3142
|
}
|
|
@@ -3196,7 +3212,7 @@ __name(executeUnbuild, "executeUnbuild");
|
|
|
3196
3212
|
async function copyBuildAssets(options) {
|
|
3197
3213
|
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
|
|
3198
3214
|
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
3199
|
-
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.
|
|
3215
|
+
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
3200
3216
|
stopwatch();
|
|
3201
3217
|
return options;
|
|
3202
3218
|
}
|
|
@@ -3220,7 +3236,7 @@ async function build2(options) {
|
|
|
3220
3236
|
if (!workspaceRoot) {
|
|
3221
3237
|
throw new Error("Cannot find workspace root");
|
|
3222
3238
|
}
|
|
3223
|
-
const config = await
|
|
3239
|
+
const config = await getConfig(workspaceRoot.dir);
|
|
3224
3240
|
writeDebug(` \u26A1 Executing Storm Unbuild pipeline`, config);
|
|
3225
3241
|
const stopwatch = getStopwatch("Unbuild pipeline");
|
|
3226
3242
|
try {
|
|
@@ -3371,7 +3387,7 @@ var cleanAction = /* @__PURE__ */ __name((config) => async (options) => {
|
|
|
3371
3387
|
}
|
|
3372
3388
|
}, "cleanAction");
|
|
3373
3389
|
void (async () => {
|
|
3374
|
-
const config = await
|
|
3390
|
+
const config = await getConfig();
|
|
3375
3391
|
const stopwatch = getStopwatch("Storm ESBuild executable");
|
|
3376
3392
|
try {
|
|
3377
3393
|
handleProcess(config);
|
package/dist/build.cjs
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
8
|
+
var _chunkN2XPKSKOcjs = require('./chunk-N2XPKSKO.cjs');
|
|
9
|
+
require('./chunk-CUQLNBV5.cjs');
|
|
10
|
+
require('./chunk-O45RUFL3.cjs');
|
|
11
|
+
require('./chunk-26OHEX55.cjs');
|
|
12
12
|
require('./chunk-SHHAZOHN.cjs');
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-KDTFDJN3.cjs');
|
|
14
|
+
require('./chunk-GVX7LSWK.cjs');
|
|
15
|
+
require('./chunk-LXCK6Y4C.cjs');
|
|
16
16
|
require('./chunk-YDYGZTJK.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
@@ -21,4 +21,4 @@ require('./chunk-YDYGZTJK.cjs');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.build =
|
|
24
|
+
exports.build = _chunkN2XPKSKOcjs.build; exports.cleanOutputPath = _chunkN2XPKSKOcjs.cleanOutputPath; exports.copyBuildAssets = _chunkN2XPKSKOcjs.copyBuildAssets; exports.executeUnbuild = _chunkN2XPKSKOcjs.executeUnbuild; exports.generatePackageJson = _chunkN2XPKSKOcjs.generatePackageJson; exports.resolveOptions = _chunkN2XPKSKOcjs.resolveOptions;
|
package/dist/build.js
CHANGED
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
executeUnbuild,
|
|
6
6
|
generatePackageJson,
|
|
7
7
|
resolveOptions
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-BZJA6TK2.js";
|
|
9
|
+
import "./chunk-XGZOR6PZ.js";
|
|
10
|
+
import "./chunk-OAOLAATA.js";
|
|
11
|
+
import "./chunk-NYVG7QMW.js";
|
|
12
12
|
import "./chunk-ESRR2FD2.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-3Q2ZB7CN.js";
|
|
14
|
+
import "./chunk-G2BQ6VSR.js";
|
|
15
|
+
import "./chunk-VWXW3RW5.js";
|
|
16
16
|
import "./chunk-3GQAWCBQ.js";
|
|
17
17
|
export {
|
|
18
18
|
build,
|
|
@@ -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 _chunkLXCK6Y4Ccjs = require('./chunk-LXCK6Y4C.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkYDYGZTJKcjs = require('./chunk-YDYGZTJK.cjs');
|
|
@@ -32,7 +32,7 @@ async function createTsCompilerOptions(config, tsConfigPath, projectRoot, depend
|
|
|
32
32
|
declaration: true,
|
|
33
33
|
paths: _buildablelibsutils.computeCompilerOptionsPaths.call(void 0, tsConfig, _nullishCoalesce(dependencies, () => ( [])))
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
_chunkLXCK6Y4Ccjs.writeTrace.call(void 0, compilerOptions, config);
|
|
36
36
|
return compilerOptions;
|
|
37
37
|
}
|
|
38
38
|
_chunkYDYGZTJKcjs.__name.call(void 0, createTsCompilerOptions, "createTsCompilerOptions");
|