@storm-software/tsdown 0.22.2 → 0.22.3
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/dist/build.cjs +3 -3
- package/dist/build.js +2 -2
- package/dist/{chunk-EHVHDVI3.cjs → chunk-2Z7WS4H3.cjs} +20 -16
- package/dist/{chunk-MLTU5LTF.js → chunk-QVK624ZI.js} +18 -14
- package/dist/{chunk-22FHFD4Q.js → chunk-XKKDJDDD.js} +90 -41
- package/dist/{chunk-7QXMK5E7.cjs → chunk-ZNJE4VS3.cjs} +167 -118
- package/dist/clean.cjs +2 -2
- package/dist/clean.d.cts +13 -13
- package/dist/clean.d.ts +13 -13
- package/dist/clean.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/dist/tsdown.cjs +4 -4
- 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/dist/build.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkZNJE4VS3cjs = require('./chunk-ZNJE4VS3.cjs');
|
|
4
|
+
require('./chunk-2Z7WS4H3.cjs');
|
|
5
5
|
require('./chunk-5KRF6IVW.cjs');
|
|
6
6
|
require('./chunk-USNT2KNT.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.build =
|
|
9
|
+
exports.build = _chunkZNJE4VS3cjs.build;
|
package/dist/build.js
CHANGED
|
@@ -118,6 +118,8 @@ var ColorConfigMapSchema = _zod2.default.union([
|
|
|
118
118
|
}),
|
|
119
119
|
_zod2.default.record(_zod2.default.string(), ColorConfigSchema)
|
|
120
120
|
]);
|
|
121
|
+
var ExtendsItemSchema = _zod2.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(_zod2.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 = _zod2.default.object({
|
|
122
124
|
name: _zod2.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: _zod2.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
@@ -132,11 +134,11 @@ var WorkspaceDirectoryConfigSchema = _zod2.default.object({
|
|
|
132
134
|
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
133
135
|
var StormConfigSchema = _zod2.default.object({
|
|
134
136
|
$schema: _zod2.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: _zod2.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
137
139
|
namespace: _zod2.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
138
140
|
organization: _zod2.default.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
139
|
-
repository: _zod2.default.string().trim().
|
|
141
|
+
repository: _zod2.default.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
140
142
|
license: _zod2.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
141
143
|
homepage: _zod2.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
|
|
142
144
|
docs: _zod2.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
|
|
@@ -200,6 +202,7 @@ var COLOR_KEYS = [
|
|
|
200
202
|
|
|
201
203
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
202
204
|
var _fs = require('fs');
|
|
205
|
+
var _promises = require('fs/promises');
|
|
203
206
|
var _path = require('path');
|
|
204
207
|
|
|
205
208
|
// ../config-tools/src/utilities/correct-paths.ts
|
|
@@ -321,17 +324,15 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
321
324
|
"negative": "#dc2626"
|
|
322
325
|
}
|
|
323
326
|
};
|
|
324
|
-
var getDefaultConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (root) => {
|
|
327
|
+
var getDefaultConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (root) => {
|
|
325
328
|
let license = STORM_DEFAULT_LICENSE;
|
|
326
329
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
327
|
-
let name;
|
|
328
|
-
let namespace;
|
|
329
|
-
let repository;
|
|
330
|
+
let name = void 0;
|
|
331
|
+
let namespace = void 0;
|
|
332
|
+
let repository = void 0;
|
|
330
333
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
331
334
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
|
|
332
|
-
const file =
|
|
333
|
-
encoding: "utf8"
|
|
334
|
-
});
|
|
335
|
+
const file = await _promises.readFile.call(void 0, joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
335
336
|
if (file) {
|
|
336
337
|
const packageJson = JSON.parse(file);
|
|
337
338
|
if (packageJson.name) {
|
|
@@ -340,8 +341,12 @@ var getDefaultConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (ro
|
|
|
340
341
|
if (packageJson.namespace) {
|
|
341
342
|
namespace = packageJson.namespace;
|
|
342
343
|
}
|
|
343
|
-
if (
|
|
344
|
-
|
|
344
|
+
if (packageJson.repository) {
|
|
345
|
+
if (typeof packageJson.repository === "string") {
|
|
346
|
+
repository = packageJson.repository;
|
|
347
|
+
} else if (packageJson.repository.url) {
|
|
348
|
+
repository = packageJson.repository.url;
|
|
349
|
+
}
|
|
345
350
|
}
|
|
346
351
|
if (packageJson.license) {
|
|
347
352
|
license = packageJson.license;
|
|
@@ -386,7 +391,7 @@ var chalkDefault = {
|
|
|
386
391
|
};
|
|
387
392
|
var getChalk = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, () => {
|
|
388
393
|
let _chalk = _chalk3.default;
|
|
389
|
-
if (!_optionalChain([_chalk, 'optionalAccess',
|
|
394
|
+
if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright])) {
|
|
390
395
|
_chalk = chalkDefault;
|
|
391
396
|
}
|
|
392
397
|
return _chalk;
|
|
@@ -482,7 +487,7 @@ var isVerbose = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (label = L
|
|
|
482
487
|
|
|
483
488
|
// ../config-tools/src/logger/console.ts
|
|
484
489
|
var getLogFn = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
485
|
-
const colors = !_optionalChain([config, 'access',
|
|
490
|
+
const colors = !_optionalChain([config, 'access', _7 => _7.colors, 'optionalAccess', _8 => _8.dark]) && !_optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10["base"]]) && !_optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"], 'optionalAccess', _18 => _18.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _19 => _19.colors, 'optionalAccess', _20 => _20["base"]]) ? _optionalChain([config, 'access', _21 => _21.colors, 'optionalAccess', _22 => _22["base"]]) : DEFAULT_COLOR_CONFIG;
|
|
486
491
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
487
492
|
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
488
493
|
return (_) => {
|
|
@@ -548,7 +553,6 @@ var writeWarning = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (messag
|
|
|
548
553
|
var writeSuccess = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
|
|
549
554
|
var writeDebug = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
|
|
550
555
|
var writeTrace = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
|
|
551
|
-
var writeSystem = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
|
|
552
556
|
var getStopwatch = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (name) => {
|
|
553
557
|
const start = process.hrtime();
|
|
554
558
|
return () => {
|
|
@@ -578,7 +582,7 @@ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${pre
|
|
|
578
582
|
}, "formatLogMessage");
|
|
579
583
|
var _isFunction = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (value) => {
|
|
580
584
|
try {
|
|
581
|
-
return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess',
|
|
585
|
+
return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _23 => _23.constructor]) && _optionalChain([value, 'optionalAccess', _24 => _24.call]) && _optionalChain([value, 'optionalAccess', _25 => _25.apply]));
|
|
582
586
|
} catch (e) {
|
|
583
587
|
return false;
|
|
584
588
|
}
|
|
@@ -615,4 +619,4 @@ _chunkUSNT2KNTcjs.__name.call(void 0, clean, "clean");
|
|
|
615
619
|
|
|
616
620
|
|
|
617
621
|
|
|
618
|
-
exports.LogLevel = LogLevel; exports.STORM_DEFAULT_DOCS = STORM_DEFAULT_DOCS; exports.STORM_DEFAULT_HOMEPAGE = STORM_DEFAULT_HOMEPAGE; exports.STORM_DEFAULT_LICENSING = STORM_DEFAULT_LICENSING; exports.COLOR_KEYS = COLOR_KEYS; exports.correctPaths = correctPaths; exports.joinPaths = joinPaths; exports.findWorkspaceRoot = findWorkspaceRoot; exports.getDefaultConfig = getDefaultConfig; exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose; exports.writeFatal = writeFatal; exports.writeWarning = writeWarning; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.
|
|
622
|
+
exports.LogLevel = LogLevel; exports.STORM_DEFAULT_DOCS = STORM_DEFAULT_DOCS; exports.STORM_DEFAULT_HOMEPAGE = STORM_DEFAULT_HOMEPAGE; exports.STORM_DEFAULT_LICENSING = STORM_DEFAULT_LICENSING; exports.StormConfigSchema = StormConfigSchema; exports.COLOR_KEYS = COLOR_KEYS; exports.correctPaths = correctPaths; exports.joinPaths = joinPaths; exports.findWorkspaceRoot = findWorkspaceRoot; exports.getDefaultConfig = getDefaultConfig; exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose; exports.writeFatal = writeFatal; exports.writeWarning = writeWarning; exports.writeSuccess = writeSuccess; exports.writeDebug = writeDebug; exports.writeTrace = writeTrace; exports.getStopwatch = getStopwatch; exports.formatLogMessage = formatLogMessage; exports.clean = clean;
|
|
@@ -118,6 +118,8 @@ var ColorConfigMapSchema = z.union([
|
|
|
118
118
|
}),
|
|
119
119
|
z.record(z.string(), ColorConfigSchema)
|
|
120
120
|
]);
|
|
121
|
+
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.");
|
|
122
|
+
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.");
|
|
121
123
|
var WorkspaceBotConfigSchema = z.object({
|
|
122
124
|
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)"),
|
|
123
125
|
email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
@@ -132,11 +134,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
|
|
|
132
134
|
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
133
135
|
var StormConfigSchema = z.object({
|
|
134
136
|
$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"),
|
|
135
|
-
extends:
|
|
137
|
+
extends: ExtendsSchema.optional(),
|
|
136
138
|
name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
137
139
|
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
138
140
|
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
139
|
-
repository: z.string().trim().
|
|
141
|
+
repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
140
142
|
license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
141
143
|
homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
|
|
142
144
|
docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
|
|
@@ -199,7 +201,8 @@ var COLOR_KEYS = [
|
|
|
199
201
|
];
|
|
200
202
|
|
|
201
203
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
202
|
-
import { existsSync as existsSync2
|
|
204
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
205
|
+
import { readFile } from "node:fs/promises";
|
|
203
206
|
import { join as join2 } from "node:path";
|
|
204
207
|
|
|
205
208
|
// ../config-tools/src/utilities/correct-paths.ts
|
|
@@ -321,17 +324,15 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
321
324
|
"negative": "#dc2626"
|
|
322
325
|
}
|
|
323
326
|
};
|
|
324
|
-
var getDefaultConfig = /* @__PURE__ */ __name((root) => {
|
|
327
|
+
var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
325
328
|
let license = STORM_DEFAULT_LICENSE;
|
|
326
329
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
327
|
-
let name;
|
|
328
|
-
let namespace;
|
|
329
|
-
let repository;
|
|
330
|
+
let name = void 0;
|
|
331
|
+
let namespace = void 0;
|
|
332
|
+
let repository = void 0;
|
|
330
333
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
331
334
|
if (existsSync2(join2(workspaceRoot, "package.json"))) {
|
|
332
|
-
const file =
|
|
333
|
-
encoding: "utf8"
|
|
334
|
-
});
|
|
335
|
+
const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
335
336
|
if (file) {
|
|
336
337
|
const packageJson = JSON.parse(file);
|
|
337
338
|
if (packageJson.name) {
|
|
@@ -340,8 +341,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
|
|
|
340
341
|
if (packageJson.namespace) {
|
|
341
342
|
namespace = packageJson.namespace;
|
|
342
343
|
}
|
|
343
|
-
if (packageJson.repository
|
|
344
|
-
|
|
344
|
+
if (packageJson.repository) {
|
|
345
|
+
if (typeof packageJson.repository === "string") {
|
|
346
|
+
repository = packageJson.repository;
|
|
347
|
+
} else if (packageJson.repository.url) {
|
|
348
|
+
repository = packageJson.repository.url;
|
|
349
|
+
}
|
|
345
350
|
}
|
|
346
351
|
if (packageJson.license) {
|
|
347
352
|
license = packageJson.license;
|
|
@@ -548,7 +553,6 @@ var writeWarning = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel
|
|
|
548
553
|
var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
|
|
549
554
|
var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
|
|
550
555
|
var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
|
|
551
|
-
var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
|
|
552
556
|
var getStopwatch = /* @__PURE__ */ __name((name) => {
|
|
553
557
|
const start = process.hrtime();
|
|
554
558
|
return () => {
|
|
@@ -598,6 +602,7 @@ export {
|
|
|
598
602
|
STORM_DEFAULT_DOCS,
|
|
599
603
|
STORM_DEFAULT_HOMEPAGE,
|
|
600
604
|
STORM_DEFAULT_LICENSING,
|
|
605
|
+
StormConfigSchema,
|
|
601
606
|
COLOR_KEYS,
|
|
602
607
|
correctPaths,
|
|
603
608
|
joinPaths,
|
|
@@ -611,7 +616,6 @@ export {
|
|
|
611
616
|
writeSuccess,
|
|
612
617
|
writeDebug,
|
|
613
618
|
writeTrace,
|
|
614
|
-
writeSystem,
|
|
615
619
|
getStopwatch,
|
|
616
620
|
formatLogMessage,
|
|
617
621
|
clean
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
STORM_DEFAULT_DOCS,
|
|
5
5
|
STORM_DEFAULT_HOMEPAGE,
|
|
6
6
|
STORM_DEFAULT_LICENSING,
|
|
7
|
+
StormConfigSchema,
|
|
7
8
|
clean,
|
|
8
9
|
correctPaths,
|
|
9
10
|
findWorkspaceRoot,
|
|
@@ -17,10 +18,9 @@ import {
|
|
|
17
18
|
writeDebug,
|
|
18
19
|
writeFatal,
|
|
19
20
|
writeSuccess,
|
|
20
|
-
writeSystem,
|
|
21
21
|
writeTrace,
|
|
22
22
|
writeWarning
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QVK624ZI.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_BUILD_OPTIONS
|
|
26
26
|
} from "./chunk-UQLCBJOS.js";
|
|
@@ -61,19 +61,19 @@ import { loadConfig } from "c12";
|
|
|
61
61
|
import defu from "defu";
|
|
62
62
|
var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
|
|
63
63
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
const configs = await Promise.all([
|
|
65
|
+
loadConfig({
|
|
66
|
+
cwd: workspacePath,
|
|
67
|
+
packageJson: true,
|
|
68
|
+
name: fileName,
|
|
69
|
+
envName: fileName?.toUpperCase(),
|
|
70
|
+
jitiOptions: {
|
|
71
|
+
debug: false,
|
|
72
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
73
|
+
},
|
|
74
|
+
...options
|
|
75
|
+
}),
|
|
76
|
+
loadConfig({
|
|
77
77
|
cwd: workspacePath,
|
|
78
78
|
packageJson: true,
|
|
79
79
|
name: fileName,
|
|
@@ -84,9 +84,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
84
84
|
},
|
|
85
85
|
configFile: fileName,
|
|
86
86
|
...options
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
return
|
|
87
|
+
})
|
|
88
|
+
]);
|
|
89
|
+
return defu(configs[0] ?? {}, configs[1] ?? {});
|
|
90
90
|
}, "getConfigFileByName");
|
|
91
91
|
var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
|
|
92
92
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
@@ -94,7 +94,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
94
94
|
let config = result.config;
|
|
95
95
|
const configFile = result.configFile;
|
|
96
96
|
if (config && configFile && Object.keys(config).length > 0) {
|
|
97
|
-
|
|
97
|
+
writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
98
98
|
logLevel: "all"
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -102,7 +102,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
102
102
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
103
103
|
for (const result2 of results) {
|
|
104
104
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
105
|
-
|
|
105
|
+
writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
106
106
|
logLevel: "all"
|
|
107
107
|
});
|
|
108
108
|
config = defu(result2.config ?? {}, config ?? {});
|
|
@@ -120,6 +120,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
120
120
|
import defu2 from "defu";
|
|
121
121
|
|
|
122
122
|
// ../config-tools/src/env/get-env.ts
|
|
123
|
+
var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
|
|
124
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
125
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
126
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
127
|
+
if (name) {
|
|
128
|
+
ret[name] = process.env[key];
|
|
129
|
+
}
|
|
130
|
+
return ret;
|
|
131
|
+
}, {});
|
|
132
|
+
}, "getExtensionEnv");
|
|
123
133
|
var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
124
134
|
const prefix = "STORM_";
|
|
125
135
|
let config = {
|
|
@@ -279,7 +289,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
|
|
|
279
289
|
var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
280
290
|
const prefix = "STORM_";
|
|
281
291
|
if (config.extends) {
|
|
282
|
-
process.env[`${prefix}EXTENDS`] = config.extends;
|
|
292
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
283
293
|
}
|
|
284
294
|
if (config.name) {
|
|
285
295
|
process.env[`${prefix}NAME`] = config.name;
|
|
@@ -509,37 +519,76 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
509
519
|
}, "setBaseThemeColorConfigEnv");
|
|
510
520
|
|
|
511
521
|
// ../config-tools/src/create-storm-config.ts
|
|
522
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
512
523
|
var _static_cache = void 0;
|
|
513
|
-
var
|
|
514
|
-
let
|
|
515
|
-
if (_static_cache?.data
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}
|
|
524
|
+
var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
|
|
525
|
+
let result;
|
|
526
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
527
|
+
let _workspaceRoot = workspaceRoot;
|
|
528
|
+
if (!_workspaceRoot) {
|
|
529
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
530
|
+
}
|
|
531
|
+
const configEnv = getConfigEnv();
|
|
532
|
+
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
533
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
534
|
+
if (!configFile && !skipLogs) {
|
|
535
|
+
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", {
|
|
536
|
+
logLevel: "all"
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
|
|
540
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
541
|
+
} else {
|
|
542
|
+
result = _static_cache.data;
|
|
528
543
|
}
|
|
529
|
-
|
|
544
|
+
if (schema && extensionName) {
|
|
545
|
+
result.extensions = {
|
|
546
|
+
...result.extensions,
|
|
547
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
_static_cache = {
|
|
551
|
+
timestamp: Date.now(),
|
|
552
|
+
data: result
|
|
553
|
+
};
|
|
554
|
+
return result;
|
|
555
|
+
}, "createStormConfig");
|
|
556
|
+
var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
557
|
+
const extension_cache_key = {
|
|
558
|
+
extensionName
|
|
559
|
+
};
|
|
560
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
561
|
+
return _extension_cache.get(extension_cache_key);
|
|
562
|
+
}
|
|
563
|
+
let extension = getExtensionEnv(extensionName);
|
|
564
|
+
if (schema) {
|
|
565
|
+
extension = schema.parse(extension);
|
|
566
|
+
}
|
|
567
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
568
|
+
return extension;
|
|
569
|
+
}, "createConfigExtension");
|
|
570
|
+
var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
|
|
571
|
+
const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
|
|
530
572
|
setConfigEnv(config);
|
|
531
|
-
|
|
573
|
+
if (!skipLogs) {
|
|
574
|
+
writeTrace(`\u2699\uFE0F Using Storm configuration:
|
|
532
575
|
${formatLogMessage(config)}`, config);
|
|
576
|
+
}
|
|
533
577
|
return config;
|
|
534
578
|
}, "loadStormConfig");
|
|
535
579
|
|
|
580
|
+
// ../config-tools/src/get-config.ts
|
|
581
|
+
var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
|
|
582
|
+
return loadStormConfig(workspaceRoot, skipLogs);
|
|
583
|
+
}, "getConfig");
|
|
584
|
+
|
|
536
585
|
// ../build-tools/src/utilities/read-nx-config.ts
|
|
537
586
|
import { existsSync } from "node:fs";
|
|
538
587
|
import { readFile } from "node:fs/promises";
|
|
539
588
|
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
540
589
|
let rootDir = workspaceRoot;
|
|
541
590
|
if (!rootDir) {
|
|
542
|
-
const config = await
|
|
591
|
+
const config = await getConfig();
|
|
543
592
|
rootDir = config.workspaceRoot;
|
|
544
593
|
}
|
|
545
594
|
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
@@ -554,7 +603,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
|
554
603
|
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
555
604
|
const pendingAssets = Array.from(assets ?? []);
|
|
556
605
|
pendingAssets.push({
|
|
557
|
-
input: projectRoot,
|
|
606
|
+
input: joinPaths(config.workspaceRoot, projectRoot),
|
|
558
607
|
glob: "*.md",
|
|
559
608
|
output: "."
|
|
560
609
|
});
|
|
@@ -805,7 +854,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
|
|
|
805
854
|
if (!workspaceRoot) {
|
|
806
855
|
throw new Error("Cannot find Nx workspace root");
|
|
807
856
|
}
|
|
808
|
-
const config = await
|
|
857
|
+
const config = await getConfig(workspaceRoot.dir);
|
|
809
858
|
writeDebug(" \u2699\uFE0F Resolving build options", config);
|
|
810
859
|
const stopwatch = getStopwatch("Build options resolution");
|
|
811
860
|
const projectGraph = await createProjectGraphAsync({
|