@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/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.cjs
CHANGED
|
@@ -118,6 +118,8 @@ var ColorConfigMapSchema = import_zod.default.union([
|
|
|
118
118
|
}),
|
|
119
119
|
import_zod.default.record(import_zod.default.string(), ColorConfigSchema)
|
|
120
120
|
]);
|
|
121
|
+
var ExtendsItemSchema = import_zod.default.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.");
|
|
122
|
+
var ExtendsSchema = ExtendsItemSchema.or(import_zod.default.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.");
|
|
121
123
|
var WorkspaceBotConfigSchema = import_zod.default.object({
|
|
122
124
|
name: import_zod.default.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
|
|
123
125
|
email: import_zod.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
@@ -132,11 +134,11 @@ var WorkspaceDirectoryConfigSchema = import_zod.default.object({
|
|
|
132
134
|
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
133
135
|
var StormConfigSchema = import_zod.default.object({
|
|
134
136
|
$schema: import_zod.default.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"),
|
|
135
|
-
extends:
|
|
137
|
+
extends: ExtendsSchema.optional(),
|
|
136
138
|
name: import_zod.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
137
139
|
namespace: import_zod.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
138
140
|
organization: import_zod.default.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
139
|
-
repository: import_zod.default.string().trim().
|
|
141
|
+
repository: import_zod.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
140
142
|
license: import_zod.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
141
143
|
homepage: import_zod.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
|
|
142
144
|
docs: import_zod.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
|
|
@@ -231,6 +233,7 @@ var COLOR_KEYS = [
|
|
|
231
233
|
|
|
232
234
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
233
235
|
var import_node_fs2 = require("fs");
|
|
236
|
+
var import_promises = require("fs/promises");
|
|
234
237
|
var import_node_path2 = require("path");
|
|
235
238
|
|
|
236
239
|
// ../config-tools/src/utilities/correct-paths.ts
|
|
@@ -352,17 +355,15 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
352
355
|
"negative": "#dc2626"
|
|
353
356
|
}
|
|
354
357
|
};
|
|
355
|
-
var getDefaultConfig = /* @__PURE__ */ __name((root) => {
|
|
358
|
+
var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
356
359
|
let license = STORM_DEFAULT_LICENSE;
|
|
357
360
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
358
|
-
let name;
|
|
359
|
-
let namespace;
|
|
360
|
-
let repository;
|
|
361
|
+
let name = void 0;
|
|
362
|
+
let namespace = void 0;
|
|
363
|
+
let repository = void 0;
|
|
361
364
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
362
365
|
if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
|
|
363
|
-
const file = (0,
|
|
364
|
-
encoding: "utf8"
|
|
365
|
-
});
|
|
366
|
+
const file = await (0, import_promises.readFile)(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
366
367
|
if (file) {
|
|
367
368
|
const packageJson = JSON.parse(file);
|
|
368
369
|
if (packageJson.name) {
|
|
@@ -371,8 +372,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
|
|
|
371
372
|
if (packageJson.namespace) {
|
|
372
373
|
namespace = packageJson.namespace;
|
|
373
374
|
}
|
|
374
|
-
if (packageJson.repository
|
|
375
|
-
|
|
375
|
+
if (packageJson.repository) {
|
|
376
|
+
if (typeof packageJson.repository === "string") {
|
|
377
|
+
repository = packageJson.repository;
|
|
378
|
+
} else if (packageJson.repository.url) {
|
|
379
|
+
repository = packageJson.repository.url;
|
|
380
|
+
}
|
|
376
381
|
}
|
|
377
382
|
if (packageJson.license) {
|
|
378
383
|
license = packageJson.license;
|
|
@@ -581,7 +586,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
|
|
|
581
586
|
var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
|
|
582
587
|
var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
|
|
583
588
|
var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
|
|
584
|
-
var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
|
|
585
589
|
var getStopwatch = /* @__PURE__ */ __name((name) => {
|
|
586
590
|
const start = process.hrtime();
|
|
587
591
|
return () => {
|
|
@@ -654,19 +658,19 @@ Stacktrace: ${error.stack}`, config);
|
|
|
654
658
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
655
659
|
var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
|
|
656
660
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
661
|
+
const configs = await Promise.all([
|
|
662
|
+
(0, import_c12.loadConfig)({
|
|
663
|
+
cwd: workspacePath,
|
|
664
|
+
packageJson: true,
|
|
665
|
+
name: fileName,
|
|
666
|
+
envName: fileName?.toUpperCase(),
|
|
667
|
+
jitiOptions: {
|
|
668
|
+
debug: false,
|
|
669
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
670
|
+
},
|
|
671
|
+
...options
|
|
672
|
+
}),
|
|
673
|
+
(0, import_c12.loadConfig)({
|
|
670
674
|
cwd: workspacePath,
|
|
671
675
|
packageJson: true,
|
|
672
676
|
name: fileName,
|
|
@@ -677,9 +681,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
677
681
|
},
|
|
678
682
|
configFile: fileName,
|
|
679
683
|
...options
|
|
680
|
-
})
|
|
681
|
-
|
|
682
|
-
return
|
|
684
|
+
})
|
|
685
|
+
]);
|
|
686
|
+
return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
|
|
683
687
|
}, "getConfigFileByName");
|
|
684
688
|
var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
|
|
685
689
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
@@ -687,7 +691,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
687
691
|
let config = result.config;
|
|
688
692
|
const configFile = result.configFile;
|
|
689
693
|
if (config && configFile && Object.keys(config).length > 0) {
|
|
690
|
-
|
|
694
|
+
writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
691
695
|
logLevel: "all"
|
|
692
696
|
});
|
|
693
697
|
}
|
|
@@ -695,7 +699,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
695
699
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
696
700
|
for (const result2 of results) {
|
|
697
701
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
698
|
-
|
|
702
|
+
writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
699
703
|
logLevel: "all"
|
|
700
704
|
});
|
|
701
705
|
config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
|
|
@@ -710,6 +714,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
710
714
|
}, "getConfigFile");
|
|
711
715
|
|
|
712
716
|
// ../config-tools/src/env/get-env.ts
|
|
717
|
+
var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
|
|
718
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
719
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
720
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
721
|
+
if (name) {
|
|
722
|
+
ret[name] = process.env[key];
|
|
723
|
+
}
|
|
724
|
+
return ret;
|
|
725
|
+
}, {});
|
|
726
|
+
}, "getExtensionEnv");
|
|
713
727
|
var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
714
728
|
const prefix = "STORM_";
|
|
715
729
|
let config = {
|
|
@@ -869,7 +883,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
|
|
|
869
883
|
var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
870
884
|
const prefix = "STORM_";
|
|
871
885
|
if (config.extends) {
|
|
872
|
-
process.env[`${prefix}EXTENDS`] = config.extends;
|
|
886
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
873
887
|
}
|
|
874
888
|
if (config.name) {
|
|
875
889
|
process.env[`${prefix}NAME`] = config.name;
|
|
@@ -1099,36 +1113,75 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1099
1113
|
}, "setBaseThemeColorConfigEnv");
|
|
1100
1114
|
|
|
1101
1115
|
// ../config-tools/src/create-storm-config.ts
|
|
1116
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
1102
1117
|
var _static_cache = void 0;
|
|
1103
|
-
var
|
|
1104
|
-
let
|
|
1105
|
-
if (_static_cache?.data
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1118
|
+
var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
|
|
1119
|
+
let result;
|
|
1120
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
1121
|
+
let _workspaceRoot = workspaceRoot;
|
|
1122
|
+
if (!_workspaceRoot) {
|
|
1123
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
1124
|
+
}
|
|
1125
|
+
const configEnv = getConfigEnv();
|
|
1126
|
+
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1127
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
1128
|
+
if (!configFile && !skipLogs) {
|
|
1129
|
+
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", {
|
|
1130
|
+
logLevel: "all"
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
result = await StormConfigSchema.parseAsync((0, import_defu2.default)(configEnv, configFile, defaultConfig));
|
|
1134
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
1135
|
+
} else {
|
|
1136
|
+
result = _static_cache.data;
|
|
1118
1137
|
}
|
|
1119
|
-
|
|
1138
|
+
if (schema && extensionName) {
|
|
1139
|
+
result.extensions = {
|
|
1140
|
+
...result.extensions,
|
|
1141
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
_static_cache = {
|
|
1145
|
+
timestamp: Date.now(),
|
|
1146
|
+
data: result
|
|
1147
|
+
};
|
|
1148
|
+
return result;
|
|
1149
|
+
}, "createStormConfig");
|
|
1150
|
+
var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
1151
|
+
const extension_cache_key = {
|
|
1152
|
+
extensionName
|
|
1153
|
+
};
|
|
1154
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
1155
|
+
return _extension_cache.get(extension_cache_key);
|
|
1156
|
+
}
|
|
1157
|
+
let extension = getExtensionEnv(extensionName);
|
|
1158
|
+
if (schema) {
|
|
1159
|
+
extension = schema.parse(extension);
|
|
1160
|
+
}
|
|
1161
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
1162
|
+
return extension;
|
|
1163
|
+
}, "createConfigExtension");
|
|
1164
|
+
var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
|
|
1165
|
+
const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
|
|
1120
1166
|
setConfigEnv(config);
|
|
1121
|
-
|
|
1167
|
+
if (!skipLogs) {
|
|
1168
|
+
writeTrace(`\u2699\uFE0F Using Storm configuration:
|
|
1122
1169
|
${formatLogMessage(config)}`, config);
|
|
1170
|
+
}
|
|
1123
1171
|
return config;
|
|
1124
1172
|
}, "loadStormConfig");
|
|
1125
1173
|
|
|
1174
|
+
// ../config-tools/src/get-config.ts
|
|
1175
|
+
var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
|
|
1176
|
+
return loadStormConfig(workspaceRoot, skipLogs);
|
|
1177
|
+
}, "getConfig");
|
|
1178
|
+
|
|
1126
1179
|
// bin/unbuild.ts
|
|
1127
1180
|
var import_commander = require("commander");
|
|
1128
1181
|
|
|
1129
1182
|
// src/build.ts
|
|
1130
|
-
var
|
|
1131
|
-
var
|
|
1183
|
+
var import_devkit5 = require("@nx/devkit");
|
|
1184
|
+
var import_js = require("@nx/js");
|
|
1132
1185
|
var import_buildable_libs_utils4 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
1133
1186
|
|
|
1134
1187
|
// ../build-tools/src/plugins/swc.ts
|
|
@@ -1145,30 +1198,10 @@ var import_devkit2 = require("@nx/devkit");
|
|
|
1145
1198
|
var import_path = require("path");
|
|
1146
1199
|
|
|
1147
1200
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
1148
|
-
var
|
|
1149
|
-
var import_js = require("@nx/js");
|
|
1201
|
+
var import_copy_assets_handler = require("@nx/js/src/utils/assets/copy-assets-handler");
|
|
1150
1202
|
var import_glob = require("glob");
|
|
1151
1203
|
var import_promises2 = require("fs/promises");
|
|
1152
|
-
|
|
1153
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1154
|
-
var import_node_fs4 = require("fs");
|
|
1155
|
-
var import_promises = require("fs/promises");
|
|
1156
|
-
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
1157
|
-
let rootDir = workspaceRoot;
|
|
1158
|
-
if (!rootDir) {
|
|
1159
|
-
const config = await loadStormConfig();
|
|
1160
|
-
rootDir = config.workspaceRoot;
|
|
1161
|
-
}
|
|
1162
|
-
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
1163
|
-
if (!(0, import_node_fs4.existsSync)(nxJsonPath)) {
|
|
1164
|
-
throw new Error("Cannot find project.json configuration");
|
|
1165
|
-
}
|
|
1166
|
-
const configContent = await (0, import_promises.readFile)(nxJsonPath, "utf8");
|
|
1167
|
-
return JSON.parse(configContent);
|
|
1168
|
-
}, "readNxConfig");
|
|
1169
|
-
|
|
1170
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
1171
|
-
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1204
|
+
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1172
1205
|
const pendingAssets = Array.from(assets ?? []);
|
|
1173
1206
|
pendingAssets.push({
|
|
1174
1207
|
input: projectRoot,
|
|
@@ -1176,7 +1209,7 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1176
1209
|
output: "."
|
|
1177
1210
|
});
|
|
1178
1211
|
pendingAssets.push({
|
|
1179
|
-
input:
|
|
1212
|
+
input: ".",
|
|
1180
1213
|
glob: "LICENSE",
|
|
1181
1214
|
output: "."
|
|
1182
1215
|
});
|
|
@@ -1194,36 +1227,15 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1194
1227
|
output: "src/"
|
|
1195
1228
|
});
|
|
1196
1229
|
}
|
|
1197
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
1198
|
-
const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
|
|
1199
|
-
const projectsConfigurations = (0, import_devkit3.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
1200
|
-
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
1201
|
-
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.");
|
|
1202
|
-
}
|
|
1203
|
-
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
1204
|
-
if (!buildTarget) {
|
|
1205
|
-
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")}`);
|
|
1206
|
-
}
|
|
1207
1230
|
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
1208
1231
|
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
outputPath
|
|
1213
|
-
|
|
1214
|
-
root: config.workspaceRoot,
|
|
1215
|
-
targetName: "build",
|
|
1216
|
-
target: buildTarget,
|
|
1217
|
-
projectName,
|
|
1218
|
-
projectGraph,
|
|
1219
|
-
projectsConfigurations,
|
|
1220
|
-
nxJsonConfiguration: nxJson,
|
|
1221
|
-
cwd: config.workspaceRoot,
|
|
1222
|
-
isVerbose: isVerbose(config.logLevel)
|
|
1232
|
+
const assetHandler = new import_copy_assets_handler.CopyAssetsHandler({
|
|
1233
|
+
projectDir: projectRoot,
|
|
1234
|
+
rootDir: config.workspaceRoot,
|
|
1235
|
+
outputDir: outputPath,
|
|
1236
|
+
assets: pendingAssets
|
|
1223
1237
|
});
|
|
1224
|
-
|
|
1225
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
1226
|
-
}
|
|
1238
|
+
await assetHandler.processAllAssetsOnce();
|
|
1227
1239
|
if (includeSrc === true) {
|
|
1228
1240
|
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
1229
1241
|
const files = await (0, import_glob.glob)([
|
|
@@ -1243,7 +1255,7 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
|
|
|
1243
1255
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1244
1256
|
var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
|
|
1245
1257
|
var import_glob2 = require("glob");
|
|
1246
|
-
var
|
|
1258
|
+
var import_node_fs4 = require("fs");
|
|
1247
1259
|
var import_promises3 = require("fs/promises");
|
|
1248
1260
|
var import_project_graph = require("nx/src/project-graph/project-graph");
|
|
1249
1261
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
@@ -1253,7 +1265,7 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1253
1265
|
const projectNode = project.node;
|
|
1254
1266
|
if (projectNode.data.root) {
|
|
1255
1267
|
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
1256
|
-
if ((0,
|
|
1268
|
+
if ((0, import_node_fs4.existsSync)(projectPackageJsonPath)) {
|
|
1257
1269
|
const projectPackageJsonContent = await (0, import_promises3.readFile)(projectPackageJsonPath, "utf8");
|
|
1258
1270
|
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
1259
1271
|
if (projectPackageJson.private !== false) {
|
|
@@ -1338,6 +1350,10 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projec
|
|
|
1338
1350
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
1339
1351
|
var import_glob3 = require("glob");
|
|
1340
1352
|
|
|
1353
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1354
|
+
var import_node_fs5 = require("fs");
|
|
1355
|
+
var import_promises4 = require("fs/promises");
|
|
1356
|
+
|
|
1341
1357
|
// ../build-tools/src/utilities/task-graph.ts
|
|
1342
1358
|
var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
|
|
1343
1359
|
|
|
@@ -1345,7 +1361,7 @@ var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
|
|
|
1345
1361
|
var import_defu5 = __toESM(require("defu"), 1);
|
|
1346
1362
|
var import_glob4 = require("glob");
|
|
1347
1363
|
var import_node_fs8 = require("fs");
|
|
1348
|
-
var
|
|
1364
|
+
var import_promises8 = require("fs/promises");
|
|
1349
1365
|
var import_node_path6 = require("path");
|
|
1350
1366
|
var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
|
|
1351
1367
|
|
|
@@ -1359,7 +1375,7 @@ var import_defu3 = require("defu");
|
|
|
1359
1375
|
var import_hookable = require("hookable");
|
|
1360
1376
|
var import_pretty_bytes = __toESM(require("pretty-bytes"), 1);
|
|
1361
1377
|
var import_tinyglobby = require("tinyglobby");
|
|
1362
|
-
var
|
|
1378
|
+
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
1363
1379
|
var import_jiti = require("jiti");
|
|
1364
1380
|
var import_rollup = require("rollup");
|
|
1365
1381
|
var import_rollup_plugin_dts = __toESM(require("rollup-plugin-dts"), 1);
|
|
@@ -1493,7 +1509,7 @@ var getEntrypointPaths = /* @__PURE__ */ __name((path2) => {
|
|
|
1493
1509
|
return segments.map((_, index) => segments.slice(index).join("/")).filter(Boolean);
|
|
1494
1510
|
}, "getEntrypointPaths");
|
|
1495
1511
|
async function ensuredir(path2) {
|
|
1496
|
-
await
|
|
1512
|
+
await import_promises5.default.mkdir((0, import_pathe.dirname)(path2), { recursive: true });
|
|
1497
1513
|
}
|
|
1498
1514
|
__name(ensuredir, "ensuredir");
|
|
1499
1515
|
function warn(ctx, message) {
|
|
@@ -1507,10 +1523,10 @@ __name(warn, "warn");
|
|
|
1507
1523
|
async function symlink(from, to, force = true) {
|
|
1508
1524
|
await ensuredir(to);
|
|
1509
1525
|
if (force) {
|
|
1510
|
-
await
|
|
1526
|
+
await import_promises5.default.unlink(to).catch(() => {
|
|
1511
1527
|
});
|
|
1512
1528
|
}
|
|
1513
|
-
await
|
|
1529
|
+
await import_promises5.default.symlink(from, to, "junction");
|
|
1514
1530
|
}
|
|
1515
1531
|
__name(symlink, "symlink");
|
|
1516
1532
|
function dumpObject(obj) {
|
|
@@ -1523,9 +1539,9 @@ function getpkg(id = "") {
|
|
|
1523
1539
|
}
|
|
1524
1540
|
__name(getpkg, "getpkg");
|
|
1525
1541
|
async function rmdir(dir) {
|
|
1526
|
-
await
|
|
1542
|
+
await import_promises5.default.unlink(dir).catch(() => {
|
|
1527
1543
|
});
|
|
1528
|
-
await
|
|
1544
|
+
await import_promises5.default.rm(dir, { recursive: true, force: true }).catch(() => {
|
|
1529
1545
|
});
|
|
1530
1546
|
}
|
|
1531
1547
|
__name(rmdir, "rmdir");
|
|
@@ -2129,7 +2145,7 @@ async function rollupStub(ctx) {
|
|
|
2129
2145
|
const resolvedEntryForTypeImport = isESM ? `${resolvedEntry.replace(/(\.m?)(ts)$/, "$1js")}` : resolvedEntryWithoutExt;
|
|
2130
2146
|
const code = await import_node_fs6.promises.readFile(resolvedEntry, "utf8");
|
|
2131
2147
|
const shebang = getShebang(code);
|
|
2132
|
-
await (0,
|
|
2148
|
+
await (0, import_promises5.mkdir)((0, import_pathe.dirname)(output), { recursive: true });
|
|
2133
2149
|
if (ctx.options.rollup.emitCJS) {
|
|
2134
2150
|
const jitiCJSPath = (0, import_pathe.relative)(
|
|
2135
2151
|
(0, import_pathe.dirname)(output),
|
|
@@ -2138,7 +2154,7 @@ async function rollupStub(ctx) {
|
|
|
2138
2154
|
conditions: ["node", "require"]
|
|
2139
2155
|
})
|
|
2140
2156
|
);
|
|
2141
|
-
await (0,
|
|
2157
|
+
await (0, import_promises5.writeFile)(
|
|
2142
2158
|
output + ".cjs",
|
|
2143
2159
|
shebang + [
|
|
2144
2160
|
`const { createJiti } = require(${JSON.stringify(jitiCJSPath)})`,
|
|
@@ -2172,7 +2188,7 @@ async function rollupStub(ctx) {
|
|
|
2172
2188
|
conditions: ["node", "import"]
|
|
2173
2189
|
})
|
|
2174
2190
|
);
|
|
2175
|
-
await (0,
|
|
2191
|
+
await (0, import_promises5.writeFile)(
|
|
2176
2192
|
output + ".mjs",
|
|
2177
2193
|
shebang + [
|
|
2178
2194
|
`import { createJiti } from ${JSON.stringify(jitiESMPath)};`,
|
|
@@ -2195,10 +2211,10 @@ async function rollupStub(ctx) {
|
|
|
2195
2211
|
`export * from ${JSON.stringify(resolvedEntryForTypeImport)};`,
|
|
2196
2212
|
hasDefaultExport ? `export { default } from ${JSON.stringify(resolvedEntryForTypeImport)};` : ""
|
|
2197
2213
|
].join("\n");
|
|
2198
|
-
await (0,
|
|
2199
|
-
await (0,
|
|
2214
|
+
await (0, import_promises5.writeFile)(output + ".d.cts", dtsContent);
|
|
2215
|
+
await (0, import_promises5.writeFile)(output + ".d.mts", dtsContent);
|
|
2200
2216
|
if (ctx.options.declaration === "compatible" || ctx.options.declaration === true) {
|
|
2201
|
-
await (0,
|
|
2217
|
+
await (0, import_promises5.writeFile)(output + ".d.ts", dtsContent);
|
|
2202
2218
|
}
|
|
2203
2219
|
}
|
|
2204
2220
|
if (shebang) {
|
|
@@ -2374,7 +2390,7 @@ async function typesBuild(ctx) {
|
|
|
2374
2390
|
await ctx.hooks.callHook("untyped:entry:outputs", ctx, entry, outputs);
|
|
2375
2391
|
for (const output of Object.values(outputs)) {
|
|
2376
2392
|
if (!output) continue;
|
|
2377
|
-
await (0,
|
|
2393
|
+
await (0, import_promises5.writeFile)(
|
|
2378
2394
|
(0, import_pathe.resolve)(distDir, output.fileName),
|
|
2379
2395
|
output.contents,
|
|
2380
2396
|
"utf8"
|
|
@@ -2761,7 +2777,7 @@ var import_defu4 = require("defu");
|
|
|
2761
2777
|
var import_hookable2 = require("hookable");
|
|
2762
2778
|
var import_pretty_bytes2 = require("pretty-bytes");
|
|
2763
2779
|
var import_tinyglobby2 = require("tinyglobby");
|
|
2764
|
-
var
|
|
2780
|
+
var import_promises6 = require("fs/promises");
|
|
2765
2781
|
var import_jiti2 = require("jiti");
|
|
2766
2782
|
var import_rollup2 = require("rollup");
|
|
2767
2783
|
var import_rollup_plugin_dts2 = require("rollup-plugin-dts");
|
|
@@ -2781,7 +2797,7 @@ var import_scule2 = require("scule");
|
|
|
2781
2797
|
var import_mkdist2 = require("mkdist");
|
|
2782
2798
|
|
|
2783
2799
|
// src/clean.ts
|
|
2784
|
-
var
|
|
2800
|
+
var import_promises7 = require("fs/promises");
|
|
2785
2801
|
async function clean(name = "Unbuild", directory, config) {
|
|
2786
2802
|
writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
|
|
2787
2803
|
const stopwatch = getStopwatch(`${name} output clean`);
|
|
@@ -2790,7 +2806,7 @@ async function clean(name = "Unbuild", directory, config) {
|
|
|
2790
2806
|
}
|
|
2791
2807
|
__name(clean, "clean");
|
|
2792
2808
|
async function cleanDirectories(name = "Unbuild", directory, config) {
|
|
2793
|
-
await (0,
|
|
2809
|
+
await (0, import_promises7.rm)(directory, {
|
|
2794
2810
|
recursive: true,
|
|
2795
2811
|
force: true
|
|
2796
2812
|
});
|
|
@@ -2844,13 +2860,13 @@ ${error ? error.message : "Unknown build error"}
|
|
|
2844
2860
|
}), "onErrorPlugin");
|
|
2845
2861
|
|
|
2846
2862
|
// src/plugins/tsc.ts
|
|
2847
|
-
var
|
|
2863
|
+
var import_devkit4 = require("@nx/devkit");
|
|
2848
2864
|
var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
2849
2865
|
var import_compiler_helper_dependency = require("@nx/js/src/utils/compiler-helper-dependency");
|
|
2850
2866
|
var import_rollup_plugin_typescript2 = __toESM(require("rollup-plugin-typescript2"), 1);
|
|
2851
2867
|
|
|
2852
2868
|
// src/utilities/helpers.ts
|
|
2853
|
-
var
|
|
2869
|
+
var import_devkit3 = require("@nx/devkit");
|
|
2854
2870
|
var import_buildable_libs_utils2 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
2855
2871
|
var import_node_path4 = require("path");
|
|
2856
2872
|
var import_node_url = require("url");
|
|
@@ -2863,8 +2879,8 @@ async function loadConfig2(configPath) {
|
|
|
2863
2879
|
}
|
|
2864
2880
|
__name(loadConfig2, "loadConfig");
|
|
2865
2881
|
async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
|
|
2866
|
-
const tsConfigFile = import_typescript.default.readConfigFile((0,
|
|
2867
|
-
const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path4.dirname)((0,
|
|
2882
|
+
const tsConfigFile = import_typescript.default.readConfigFile((0, import_devkit3.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath), import_typescript.default.sys.readFile);
|
|
2883
|
+
const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path4.dirname)((0, import_devkit3.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath)));
|
|
2868
2884
|
const compilerOptions = {
|
|
2869
2885
|
rootDir: projectRoot,
|
|
2870
2886
|
declaration: true,
|
|
@@ -2877,7 +2893,7 @@ __name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
|
2877
2893
|
|
|
2878
2894
|
// src/plugins/tsc.ts
|
|
2879
2895
|
var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
|
|
2880
|
-
const projectGraph = (0,
|
|
2896
|
+
const projectGraph = (0, import_devkit4.readCachedProjectGraph)();
|
|
2881
2897
|
const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
2882
2898
|
let dependencies = result.dependencies;
|
|
2883
2899
|
const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(import_compiler_helper_dependency.HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
|
|
@@ -2944,19 +2960,19 @@ async function resolveOptions(options, config) {
|
|
|
2944
2960
|
}
|
|
2945
2961
|
}
|
|
2946
2962
|
const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
|
|
2947
|
-
const projectGraph = (0,
|
|
2963
|
+
const projectGraph = (0, import_devkit5.readCachedProjectGraph)();
|
|
2948
2964
|
const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
|
|
2949
2965
|
if (!(0, import_node_fs8.existsSync)(projectJsonPath)) {
|
|
2950
2966
|
throw new Error("Cannot find project.json configuration");
|
|
2951
2967
|
}
|
|
2952
|
-
const projectJsonContent = await (0,
|
|
2968
|
+
const projectJsonContent = await (0, import_promises8.readFile)(projectJsonPath, "utf8");
|
|
2953
2969
|
const projectJson = JSON.parse(projectJsonContent);
|
|
2954
2970
|
const projectName = projectJson.name;
|
|
2955
2971
|
const packageJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "package.json");
|
|
2956
2972
|
if (!(0, import_node_fs8.existsSync)(packageJsonPath)) {
|
|
2957
2973
|
throw new Error("Cannot find package.json configuration");
|
|
2958
2974
|
}
|
|
2959
|
-
const packageJsonContent = await (0,
|
|
2975
|
+
const packageJsonContent = await (0, import_promises8.readFile)(packageJsonPath, "utf8");
|
|
2960
2976
|
const packageJson = JSON.parse(packageJsonContent);
|
|
2961
2977
|
let tsconfig = options.tsconfig;
|
|
2962
2978
|
if (!tsconfig) {
|
|
@@ -2974,7 +2990,7 @@ async function resolveOptions(options, config) {
|
|
|
2974
2990
|
}
|
|
2975
2991
|
const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
2976
2992
|
let dependencies = result.dependencies;
|
|
2977
|
-
const tsLibDependency = (0,
|
|
2993
|
+
const tsLibDependency = (0, import_js.getHelperDependency)(import_js.HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
|
|
2978
2994
|
if (tsLibDependency) {
|
|
2979
2995
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
2980
2996
|
dependencies.push(tsLibDependency);
|
|
@@ -3145,7 +3161,7 @@ async function generatePackageJson(options) {
|
|
|
3145
3161
|
if (!(0, import_node_fs8.existsSync)(packageJsonPath)) {
|
|
3146
3162
|
throw new Error("Cannot find package.json configuration");
|
|
3147
3163
|
}
|
|
3148
|
-
let packageJsonContent = await (0,
|
|
3164
|
+
let packageJsonContent = await (0, import_promises8.readFile)(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
|
|
3149
3165
|
if (!packageJsonContent) {
|
|
3150
3166
|
throw new Error("Cannot find package.json configuration file");
|
|
3151
3167
|
}
|
|
@@ -3193,7 +3209,7 @@ async function generatePackageJson(options) {
|
|
|
3193
3209
|
}, packageJson.exports);
|
|
3194
3210
|
packageJson.exports["./package.json"] ??= "./package.json";
|
|
3195
3211
|
packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot, options.projectRoot);
|
|
3196
|
-
await (0,
|
|
3212
|
+
await (0, import_devkit5.writeJsonFile)(joinPaths(options.outDir, "package.json"), packageJson);
|
|
3197
3213
|
stopwatch();
|
|
3198
3214
|
}
|
|
3199
3215
|
return options;
|
|
@@ -3221,7 +3237,7 @@ __name(executeUnbuild, "executeUnbuild");
|
|
|
3221
3237
|
async function copyBuildAssets(options) {
|
|
3222
3238
|
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
|
|
3223
3239
|
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
3224
|
-
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.
|
|
3240
|
+
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
3225
3241
|
stopwatch();
|
|
3226
3242
|
return options;
|
|
3227
3243
|
}
|
|
@@ -3245,7 +3261,7 @@ async function build2(options) {
|
|
|
3245
3261
|
if (!workspaceRoot) {
|
|
3246
3262
|
throw new Error("Cannot find workspace root");
|
|
3247
3263
|
}
|
|
3248
|
-
const config = await
|
|
3264
|
+
const config = await getConfig(workspaceRoot.dir);
|
|
3249
3265
|
writeDebug(` \u26A1 Executing Storm Unbuild pipeline`, config);
|
|
3250
3266
|
const stopwatch = getStopwatch("Unbuild pipeline");
|
|
3251
3267
|
try {
|
|
@@ -3396,7 +3412,7 @@ var cleanAction = /* @__PURE__ */ __name((config) => async (options) => {
|
|
|
3396
3412
|
}
|
|
3397
3413
|
}, "cleanAction");
|
|
3398
3414
|
void (async () => {
|
|
3399
|
-
const config = await
|
|
3415
|
+
const config = await getConfig();
|
|
3400
3416
|
const stopwatch = getStopwatch("Storm ESBuild executable");
|
|
3401
3417
|
try {
|
|
3402
3418
|
handleProcess(config);
|