@storm-software/config-tools 1.40.1 → 1.41.1
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/CHANGELOG.md +24 -0
- package/declarations.d.ts +3 -0
- package/index.cjs +121 -59
- package/index.js +120 -59
- package/meta.cjs.json +1 -1
- package/meta.esm.json +1 -1
- package/package.json +1 -1
- package/utilities/logger.cjs +36 -7
- package/utilities/logger.js +35 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## 1.41.1 (2024-04-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🩹 Fixes
|
|
5
|
+
|
|
6
|
+
- **config-tools:** Resovled issue with parsing env values ([bb0e395a](https://github.com/storm-software/storm-ops/commit/bb0e395a))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ❤️ Thank You
|
|
10
|
+
|
|
11
|
+
- Patrick Sullivan
|
|
12
|
+
|
|
13
|
+
## 1.41.0 (2024-04-24)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 🚀 Features
|
|
17
|
+
|
|
18
|
+
- **config-tools:** Enhanced the config loading and logging processes ([0e3b7cef](https://github.com/storm-software/storm-ops/commit/0e3b7cef))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ❤️ Thank You
|
|
22
|
+
|
|
23
|
+
- Patrick Sullivan
|
|
24
|
+
|
|
1
25
|
## 1.40.1 (2024-04-22)
|
|
2
26
|
|
|
3
27
|
|
package/declarations.d.ts
CHANGED
|
@@ -106,6 +106,9 @@ export { exitWithSuccess };
|
|
|
106
106
|
declare function handleProcess(config?: StormConfig): void;
|
|
107
107
|
export { handleProcess };
|
|
108
108
|
|
|
109
|
+
declare function formatLogMessage(message?: any, prefix?: string): string;
|
|
110
|
+
export { formatLogMessage };
|
|
111
|
+
|
|
109
112
|
/**
|
|
110
113
|
* Write a message to the console at the `fatal` log level
|
|
111
114
|
*
|
package/index.cjs
CHANGED
|
@@ -38777,8 +38777,8 @@ var require_pax = __commonJS({
|
|
|
38777
38777
|
return len + s2;
|
|
38778
38778
|
}
|
|
38779
38779
|
};
|
|
38780
|
-
Pax.parse = (string, ex, g4) => new Pax(
|
|
38781
|
-
var
|
|
38780
|
+
Pax.parse = (string, ex, g4) => new Pax(merge3(parseKV(string), ex), g4);
|
|
38781
|
+
var merge3 = (a2, b6) => b6 ? Object.keys(a2).reduce((s2, k4) => (s2[k4] = a2[k4], s2), b6) : a2;
|
|
38782
38782
|
var parseKV = (string) => string.replace(/\n$/, "").split("\n").reduce(parseKVLine, /* @__PURE__ */ Object.create(null));
|
|
38783
38783
|
var parseKVLine = (set, line) => {
|
|
38784
38784
|
const n = parseInt(line, 10);
|
|
@@ -60208,6 +60208,7 @@ __export(src_exports, {
|
|
|
60208
60208
|
findFileName: () => findFileName,
|
|
60209
60209
|
findWorkspaceRoot: () => findWorkspaceRoot,
|
|
60210
60210
|
findWorkspaceRootSafe: () => findWorkspaceRootSafe,
|
|
60211
|
+
formatLogMessage: () => formatLogMessage,
|
|
60211
60212
|
getChalk: () => getChalk,
|
|
60212
60213
|
getConfigEnv: () => getConfigEnv,
|
|
60213
60214
|
getConfigFile: () => getConfigFile,
|
|
@@ -68358,47 +68359,10 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
68358
68359
|
|
|
68359
68360
|
// packages/config-tools/src/config-file/get-config-file.ts
|
|
68360
68361
|
var import_deepmerge = __toESM(require_cjs());
|
|
68361
|
-
|
|
68362
|
-
|
|
68363
|
-
|
|
68364
|
-
|
|
68365
|
-
packageJson: true,
|
|
68366
|
-
name: fileName,
|
|
68367
|
-
envName: fileName?.toUpperCase(),
|
|
68368
|
-
jitiOptions: {
|
|
68369
|
-
debug: true,
|
|
68370
|
-
cache: process.env.STORM_CACHE ? process.env.STORM_CACHE_DIRECTORY : false
|
|
68371
|
-
}
|
|
68372
|
-
});
|
|
68373
|
-
};
|
|
68374
|
-
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
68375
|
-
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
68376
|
-
let { config, configFile } = await loadConfig({
|
|
68377
|
-
cwd: workspacePath,
|
|
68378
|
-
name: "storm"
|
|
68379
|
-
});
|
|
68380
|
-
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
68381
|
-
const results = await Promise.all(
|
|
68382
|
-
additionalFileNames.map(
|
|
68383
|
-
(fileName) => loadConfig({
|
|
68384
|
-
cwd: workspacePath,
|
|
68385
|
-
name: fileName
|
|
68386
|
-
})
|
|
68387
|
-
)
|
|
68388
|
-
);
|
|
68389
|
-
for (const result of results) {
|
|
68390
|
-
if (result) {
|
|
68391
|
-
config = (0, import_deepmerge.default)(config ?? {}, result.config ?? {});
|
|
68392
|
-
}
|
|
68393
|
-
}
|
|
68394
|
-
}
|
|
68395
|
-
if (!config) {
|
|
68396
|
-
return void 0;
|
|
68397
|
-
}
|
|
68398
|
-
config.configFile = configFile;
|
|
68399
|
-
config.runtimeVersion = "0.0.1";
|
|
68400
|
-
return config;
|
|
68401
|
-
};
|
|
68362
|
+
|
|
68363
|
+
// packages/config-tools/src/utilities/get-default-config.ts
|
|
68364
|
+
var import_node_fs10 = require("node:fs");
|
|
68365
|
+
var import_node_path6 = require("node:path");
|
|
68402
68366
|
|
|
68403
68367
|
// node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
|
|
68404
68368
|
var util;
|
|
@@ -72269,8 +72233,6 @@ var COLOR_KEYS = [
|
|
|
72269
72233
|
];
|
|
72270
72234
|
|
|
72271
72235
|
// packages/config-tools/src/utilities/get-default-config.ts
|
|
72272
|
-
var import_node_fs10 = require("node:fs");
|
|
72273
|
-
var import_node_path6 = require("node:path");
|
|
72274
72236
|
var DEFAULT_COLOR_CONFIG = {
|
|
72275
72237
|
dark: "#1d232a",
|
|
72276
72238
|
light: "#f4f4f5",
|
|
@@ -72463,7 +72425,9 @@ var getLogFn = (logLevel = LogLevel.INFO, config = {}) => {
|
|
|
72463
72425
|
return (message) => {
|
|
72464
72426
|
console.error(
|
|
72465
72427
|
`
|
|
72466
|
-
${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal
|
|
72428
|
+
${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#b62324").whiteBright(
|
|
72429
|
+
" \u{1F480} Fatal "
|
|
72430
|
+
)} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
|
|
72467
72431
|
|
|
72468
72432
|
`
|
|
72469
72433
|
);
|
|
@@ -72473,7 +72437,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal).whiteBri
|
|
|
72473
72437
|
return (message) => {
|
|
72474
72438
|
console.error(
|
|
72475
72439
|
`
|
|
72476
|
-
${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error
|
|
72440
|
+
${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.error ?? "#f85149").whiteBright(
|
|
72441
|
+
" \u2718 Error "
|
|
72442
|
+
)} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
|
|
72477
72443
|
`
|
|
72478
72444
|
);
|
|
72479
72445
|
};
|
|
@@ -72482,7 +72448,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error).whiteBri
|
|
|
72482
72448
|
return (message) => {
|
|
72483
72449
|
console.warn(
|
|
72484
72450
|
`
|
|
72485
|
-
${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning
|
|
72451
|
+
${_chalk.bold.hex(colors.warning ?? "#e3b341")("> ")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(
|
|
72452
|
+
" \u26A0 Warn "
|
|
72453
|
+
)} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
|
|
72486
72454
|
`
|
|
72487
72455
|
);
|
|
72488
72456
|
};
|
|
@@ -72491,7 +72459,9 @@ ${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning).whi
|
|
|
72491
72459
|
return (message) => {
|
|
72492
72460
|
console.info(
|
|
72493
72461
|
`
|
|
72494
|
-
${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success
|
|
72462
|
+
${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(
|
|
72463
|
+
" \u2713 Success "
|
|
72464
|
+
)} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
|
|
72495
72465
|
`
|
|
72496
72466
|
);
|
|
72497
72467
|
};
|
|
@@ -72500,7 +72470,9 @@ ${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success).whit
|
|
|
72500
72470
|
return (message) => {
|
|
72501
72471
|
console.info(
|
|
72502
72472
|
`
|
|
72503
|
-
${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info
|
|
72473
|
+
${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(
|
|
72474
|
+
" \u2139 Info "
|
|
72475
|
+
)} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
|
|
72504
72476
|
`
|
|
72505
72477
|
);
|
|
72506
72478
|
};
|
|
@@ -72509,7 +72481,9 @@ ${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info).whiteBrigh
|
|
|
72509
72481
|
return (message) => {
|
|
72510
72482
|
console.debug(
|
|
72511
72483
|
`
|
|
72512
|
-
${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary
|
|
72484
|
+
${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
|
|
72485
|
+
" \u{1F6E0} Debug "
|
|
72486
|
+
)} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
|
|
72513
72487
|
`
|
|
72514
72488
|
);
|
|
72515
72489
|
};
|
|
@@ -72517,7 +72491,9 @@ ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whit
|
|
|
72517
72491
|
return (message) => {
|
|
72518
72492
|
console.log(
|
|
72519
72493
|
`
|
|
72520
|
-
${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary
|
|
72494
|
+
${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
|
|
72495
|
+
" \u2709 System "
|
|
72496
|
+
)} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
|
|
72521
72497
|
`
|
|
72522
72498
|
);
|
|
72523
72499
|
};
|
|
@@ -72544,6 +72520,19 @@ var getStopwatch = (name) => {
|
|
|
72544
72520
|
);
|
|
72545
72521
|
};
|
|
72546
72522
|
};
|
|
72523
|
+
var formatLogMessage = (message, prefix = "-") => {
|
|
72524
|
+
return typeof message === "string" ? message : typeof message === "object" ? Object.keys(message).map(
|
|
72525
|
+
(key) => ` ${prefix} ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? `
|
|
72526
|
+
${formatLogMessage(message[key], `${prefix}-`)}` : message[key]}`
|
|
72527
|
+
).join("\n") : message;
|
|
72528
|
+
};
|
|
72529
|
+
var _isFunction = (value2) => {
|
|
72530
|
+
try {
|
|
72531
|
+
return value2 instanceof Function || typeof value2 === "function" || !!(value2?.constructor && value2?.call && value2?.apply);
|
|
72532
|
+
} catch (e2) {
|
|
72533
|
+
return false;
|
|
72534
|
+
}
|
|
72535
|
+
};
|
|
72547
72536
|
|
|
72548
72537
|
// packages/config-tools/src/utilities/process-handler.ts
|
|
72549
72538
|
var exitWithError = (config) => {
|
|
@@ -72680,6 +72669,78 @@ var applyWorkspaceTokens = async (options, config, tokenizerFn) => {
|
|
|
72680
72669
|
return result;
|
|
72681
72670
|
};
|
|
72682
72671
|
|
|
72672
|
+
// packages/config-tools/src/config-file/get-config-file.ts
|
|
72673
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
72674
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
72675
|
+
let config = loadConfig({
|
|
72676
|
+
cwd: workspacePath,
|
|
72677
|
+
packageJson: true,
|
|
72678
|
+
name: fileName,
|
|
72679
|
+
envName: fileName?.toUpperCase(),
|
|
72680
|
+
jitiOptions: {
|
|
72681
|
+
debug: true,
|
|
72682
|
+
cache: process.env.STORM_CACHE ? process.env.STORM_CACHE_DIRECTORY : false
|
|
72683
|
+
},
|
|
72684
|
+
...options
|
|
72685
|
+
});
|
|
72686
|
+
if (!config || Object.keys(config).length === 0) {
|
|
72687
|
+
config = loadConfig({
|
|
72688
|
+
cwd: workspacePath,
|
|
72689
|
+
packageJson: true,
|
|
72690
|
+
name: fileName,
|
|
72691
|
+
envName: fileName?.toUpperCase(),
|
|
72692
|
+
jitiOptions: {
|
|
72693
|
+
debug: true,
|
|
72694
|
+
cache: process.env.STORM_CACHE ? process.env.STORM_CACHE_DIRECTORY : false
|
|
72695
|
+
},
|
|
72696
|
+
configFile: fileName,
|
|
72697
|
+
...options
|
|
72698
|
+
});
|
|
72699
|
+
}
|
|
72700
|
+
return config;
|
|
72701
|
+
};
|
|
72702
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
72703
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
72704
|
+
let { config, configFile } = await getConfigFileByName(
|
|
72705
|
+
"storm",
|
|
72706
|
+
workspacePath
|
|
72707
|
+
);
|
|
72708
|
+
if (config && Object.keys(config).length > 0) {
|
|
72709
|
+
writeTrace(
|
|
72710
|
+
`Found Storm configuration file "${configFile}" at "${workspacePath}"`,
|
|
72711
|
+
{
|
|
72712
|
+
logLevel: "all"
|
|
72713
|
+
}
|
|
72714
|
+
);
|
|
72715
|
+
writeTrace(config, { logLevel: "all" });
|
|
72716
|
+
}
|
|
72717
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
72718
|
+
const results = await Promise.all(
|
|
72719
|
+
additionalFileNames.map(
|
|
72720
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
72721
|
+
)
|
|
72722
|
+
);
|
|
72723
|
+
for (const result of results) {
|
|
72724
|
+
if (result?.config && Object.keys(result.config).length > 0) {
|
|
72725
|
+
writeTrace(
|
|
72726
|
+
`Found additional configuration file "${result.configFile}" at "${workspacePath}"`,
|
|
72727
|
+
{
|
|
72728
|
+
logLevel: "all"
|
|
72729
|
+
}
|
|
72730
|
+
);
|
|
72731
|
+
writeTrace(result.config, { logLevel: "all" });
|
|
72732
|
+
config = (0, import_deepmerge.default)(config ?? {}, result.config ?? {});
|
|
72733
|
+
}
|
|
72734
|
+
}
|
|
72735
|
+
}
|
|
72736
|
+
if (!config) {
|
|
72737
|
+
return void 0;
|
|
72738
|
+
}
|
|
72739
|
+
config.configFile = configFile;
|
|
72740
|
+
config.runtimeVersion = "0.0.1";
|
|
72741
|
+
return config;
|
|
72742
|
+
};
|
|
72743
|
+
|
|
72683
72744
|
// packages/config-tools/src/env/get-env.ts
|
|
72684
72745
|
var getExtensionEnv = (extensionName) => {
|
|
72685
72746
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
@@ -72984,8 +73045,8 @@ var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
|
72984
73045
|
};
|
|
72985
73046
|
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
72986
73047
|
return {
|
|
72987
|
-
light: setBaseThemeColorConfigEnv(`${prefix}
|
|
72988
|
-
dark: setBaseThemeColorConfigEnv(`${prefix}
|
|
73048
|
+
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
73049
|
+
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
72989
73050
|
};
|
|
72990
73051
|
};
|
|
72991
73052
|
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
@@ -73025,6 +73086,7 @@ var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
|
73025
73086
|
};
|
|
73026
73087
|
|
|
73027
73088
|
// packages/config-tools/src/create-storm-config.ts
|
|
73089
|
+
var import_deepmerge2 = __toESM(require_cjs());
|
|
73028
73090
|
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
73029
73091
|
var _static_cache = void 0;
|
|
73030
73092
|
var createConfig = (workspaceRoot) => {
|
|
@@ -73073,7 +73135,9 @@ var loadStormConfig = async (workspaceRoot) => {
|
|
|
73073
73135
|
if (!_workspaceRoot) {
|
|
73074
73136
|
_workspaceRoot = findWorkspaceRoot();
|
|
73075
73137
|
}
|
|
73076
|
-
|
|
73138
|
+
let configFile = await getConfigFile(
|
|
73139
|
+
_workspaceRoot
|
|
73140
|
+
);
|
|
73077
73141
|
if (!configFile) {
|
|
73078
73142
|
writeWarning(
|
|
73079
73143
|
"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",
|
|
@@ -73082,10 +73146,7 @@ var loadStormConfig = async (workspaceRoot) => {
|
|
|
73082
73146
|
}
|
|
73083
73147
|
config = StormConfigSchema.parse(
|
|
73084
73148
|
await getDefaultConfig(
|
|
73085
|
-
{
|
|
73086
|
-
...getConfigEnv(),
|
|
73087
|
-
...configFile
|
|
73088
|
-
},
|
|
73149
|
+
(0, import_deepmerge2.default)(configFile, getConfigEnv(), {}),
|
|
73089
73150
|
_workspaceRoot
|
|
73090
73151
|
)
|
|
73091
73152
|
);
|
|
@@ -73111,6 +73172,7 @@ var loadStormConfig = async (workspaceRoot) => {
|
|
|
73111
73172
|
findFileName,
|
|
73112
73173
|
findWorkspaceRoot,
|
|
73113
73174
|
findWorkspaceRootSafe,
|
|
73175
|
+
formatLogMessage,
|
|
73114
73176
|
getChalk,
|
|
73115
73177
|
getConfigEnv,
|
|
73116
73178
|
getConfigFile,
|
package/index.js
CHANGED
|
@@ -38783,8 +38783,8 @@ var require_pax = __commonJS({
|
|
|
38783
38783
|
return len + s2;
|
|
38784
38784
|
}
|
|
38785
38785
|
};
|
|
38786
|
-
Pax.parse = (string, ex, g4) => new Pax(
|
|
38787
|
-
var
|
|
38786
|
+
Pax.parse = (string, ex, g4) => new Pax(merge3(parseKV(string), ex), g4);
|
|
38787
|
+
var merge3 = (a2, b6) => b6 ? Object.keys(a2).reduce((s2, k4) => (s2[k4] = a2[k4], s2), b6) : a2;
|
|
38788
38788
|
var parseKV = (string) => string.replace(/\n$/, "").split("\n").reduce(parseKVLine, /* @__PURE__ */ Object.create(null));
|
|
38789
38789
|
var parseKVLine = (set, line) => {
|
|
38790
38790
|
const n = parseInt(line, 10);
|
|
@@ -68317,47 +68317,10 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
68317
68317
|
|
|
68318
68318
|
// packages/config-tools/src/config-file/get-config-file.ts
|
|
68319
68319
|
var import_deepmerge = __toESM(require_cjs());
|
|
68320
|
-
|
|
68321
|
-
|
|
68322
|
-
|
|
68323
|
-
|
|
68324
|
-
packageJson: true,
|
|
68325
|
-
name: fileName,
|
|
68326
|
-
envName: fileName?.toUpperCase(),
|
|
68327
|
-
jitiOptions: {
|
|
68328
|
-
debug: true,
|
|
68329
|
-
cache: process.env.STORM_CACHE ? process.env.STORM_CACHE_DIRECTORY : false
|
|
68330
|
-
}
|
|
68331
|
-
});
|
|
68332
|
-
};
|
|
68333
|
-
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
68334
|
-
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
68335
|
-
let { config, configFile } = await loadConfig({
|
|
68336
|
-
cwd: workspacePath,
|
|
68337
|
-
name: "storm"
|
|
68338
|
-
});
|
|
68339
|
-
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
68340
|
-
const results = await Promise.all(
|
|
68341
|
-
additionalFileNames.map(
|
|
68342
|
-
(fileName) => loadConfig({
|
|
68343
|
-
cwd: workspacePath,
|
|
68344
|
-
name: fileName
|
|
68345
|
-
})
|
|
68346
|
-
)
|
|
68347
|
-
);
|
|
68348
|
-
for (const result of results) {
|
|
68349
|
-
if (result) {
|
|
68350
|
-
config = (0, import_deepmerge.default)(config ?? {}, result.config ?? {});
|
|
68351
|
-
}
|
|
68352
|
-
}
|
|
68353
|
-
}
|
|
68354
|
-
if (!config) {
|
|
68355
|
-
return void 0;
|
|
68356
|
-
}
|
|
68357
|
-
config.configFile = configFile;
|
|
68358
|
-
config.runtimeVersion = "0.0.1";
|
|
68359
|
-
return config;
|
|
68360
|
-
};
|
|
68320
|
+
|
|
68321
|
+
// packages/config-tools/src/utilities/get-default-config.ts
|
|
68322
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
68323
|
+
import { join as join3 } from "node:path";
|
|
68361
68324
|
|
|
68362
68325
|
// node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
|
|
68363
68326
|
var util;
|
|
@@ -72228,8 +72191,6 @@ var COLOR_KEYS = [
|
|
|
72228
72191
|
];
|
|
72229
72192
|
|
|
72230
72193
|
// packages/config-tools/src/utilities/get-default-config.ts
|
|
72231
|
-
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
72232
|
-
import { join as join3 } from "node:path";
|
|
72233
72194
|
var DEFAULT_COLOR_CONFIG = {
|
|
72234
72195
|
dark: "#1d232a",
|
|
72235
72196
|
light: "#f4f4f5",
|
|
@@ -72422,7 +72383,9 @@ var getLogFn = (logLevel = LogLevel.INFO, config = {}) => {
|
|
|
72422
72383
|
return (message) => {
|
|
72423
72384
|
console.error(
|
|
72424
72385
|
`
|
|
72425
|
-
${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal
|
|
72386
|
+
${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#b62324").whiteBright(
|
|
72387
|
+
" \u{1F480} Fatal "
|
|
72388
|
+
)} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
|
|
72426
72389
|
|
|
72427
72390
|
`
|
|
72428
72391
|
);
|
|
@@ -72432,7 +72395,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal).whiteBri
|
|
|
72432
72395
|
return (message) => {
|
|
72433
72396
|
console.error(
|
|
72434
72397
|
`
|
|
72435
|
-
${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error
|
|
72398
|
+
${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.error ?? "#f85149").whiteBright(
|
|
72399
|
+
" \u2718 Error "
|
|
72400
|
+
)} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
|
|
72436
72401
|
`
|
|
72437
72402
|
);
|
|
72438
72403
|
};
|
|
@@ -72441,7 +72406,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error).whiteBri
|
|
|
72441
72406
|
return (message) => {
|
|
72442
72407
|
console.warn(
|
|
72443
72408
|
`
|
|
72444
|
-
${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning
|
|
72409
|
+
${_chalk.bold.hex(colors.warning ?? "#e3b341")("> ")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(
|
|
72410
|
+
" \u26A0 Warn "
|
|
72411
|
+
)} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
|
|
72445
72412
|
`
|
|
72446
72413
|
);
|
|
72447
72414
|
};
|
|
@@ -72450,7 +72417,9 @@ ${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning).whi
|
|
|
72450
72417
|
return (message) => {
|
|
72451
72418
|
console.info(
|
|
72452
72419
|
`
|
|
72453
|
-
${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success
|
|
72420
|
+
${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(
|
|
72421
|
+
" \u2713 Success "
|
|
72422
|
+
)} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
|
|
72454
72423
|
`
|
|
72455
72424
|
);
|
|
72456
72425
|
};
|
|
@@ -72459,7 +72428,9 @@ ${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success).whit
|
|
|
72459
72428
|
return (message) => {
|
|
72460
72429
|
console.info(
|
|
72461
72430
|
`
|
|
72462
|
-
${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info
|
|
72431
|
+
${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(
|
|
72432
|
+
" \u2139 Info "
|
|
72433
|
+
)} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
|
|
72463
72434
|
`
|
|
72464
72435
|
);
|
|
72465
72436
|
};
|
|
@@ -72468,7 +72439,9 @@ ${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info).whiteBrigh
|
|
|
72468
72439
|
return (message) => {
|
|
72469
72440
|
console.debug(
|
|
72470
72441
|
`
|
|
72471
|
-
${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary
|
|
72442
|
+
${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
|
|
72443
|
+
" \u{1F6E0} Debug "
|
|
72444
|
+
)} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
|
|
72472
72445
|
`
|
|
72473
72446
|
);
|
|
72474
72447
|
};
|
|
@@ -72476,7 +72449,9 @@ ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whit
|
|
|
72476
72449
|
return (message) => {
|
|
72477
72450
|
console.log(
|
|
72478
72451
|
`
|
|
72479
|
-
${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary
|
|
72452
|
+
${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
|
|
72453
|
+
" \u2709 System "
|
|
72454
|
+
)} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
|
|
72480
72455
|
`
|
|
72481
72456
|
);
|
|
72482
72457
|
};
|
|
@@ -72503,6 +72478,19 @@ var getStopwatch = (name) => {
|
|
|
72503
72478
|
);
|
|
72504
72479
|
};
|
|
72505
72480
|
};
|
|
72481
|
+
var formatLogMessage = (message, prefix = "-") => {
|
|
72482
|
+
return typeof message === "string" ? message : typeof message === "object" ? Object.keys(message).map(
|
|
72483
|
+
(key) => ` ${prefix} ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? `
|
|
72484
|
+
${formatLogMessage(message[key], `${prefix}-`)}` : message[key]}`
|
|
72485
|
+
).join("\n") : message;
|
|
72486
|
+
};
|
|
72487
|
+
var _isFunction = (value2) => {
|
|
72488
|
+
try {
|
|
72489
|
+
return value2 instanceof Function || typeof value2 === "function" || !!(value2?.constructor && value2?.call && value2?.apply);
|
|
72490
|
+
} catch (e2) {
|
|
72491
|
+
return false;
|
|
72492
|
+
}
|
|
72493
|
+
};
|
|
72506
72494
|
|
|
72507
72495
|
// packages/config-tools/src/utilities/process-handler.ts
|
|
72508
72496
|
var exitWithError = (config) => {
|
|
@@ -72639,6 +72627,78 @@ var applyWorkspaceTokens = async (options, config, tokenizerFn) => {
|
|
|
72639
72627
|
return result;
|
|
72640
72628
|
};
|
|
72641
72629
|
|
|
72630
|
+
// packages/config-tools/src/config-file/get-config-file.ts
|
|
72631
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
72632
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
72633
|
+
let config = loadConfig({
|
|
72634
|
+
cwd: workspacePath,
|
|
72635
|
+
packageJson: true,
|
|
72636
|
+
name: fileName,
|
|
72637
|
+
envName: fileName?.toUpperCase(),
|
|
72638
|
+
jitiOptions: {
|
|
72639
|
+
debug: true,
|
|
72640
|
+
cache: process.env.STORM_CACHE ? process.env.STORM_CACHE_DIRECTORY : false
|
|
72641
|
+
},
|
|
72642
|
+
...options
|
|
72643
|
+
});
|
|
72644
|
+
if (!config || Object.keys(config).length === 0) {
|
|
72645
|
+
config = loadConfig({
|
|
72646
|
+
cwd: workspacePath,
|
|
72647
|
+
packageJson: true,
|
|
72648
|
+
name: fileName,
|
|
72649
|
+
envName: fileName?.toUpperCase(),
|
|
72650
|
+
jitiOptions: {
|
|
72651
|
+
debug: true,
|
|
72652
|
+
cache: process.env.STORM_CACHE ? process.env.STORM_CACHE_DIRECTORY : false
|
|
72653
|
+
},
|
|
72654
|
+
configFile: fileName,
|
|
72655
|
+
...options
|
|
72656
|
+
});
|
|
72657
|
+
}
|
|
72658
|
+
return config;
|
|
72659
|
+
};
|
|
72660
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
72661
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
72662
|
+
let { config, configFile } = await getConfigFileByName(
|
|
72663
|
+
"storm",
|
|
72664
|
+
workspacePath
|
|
72665
|
+
);
|
|
72666
|
+
if (config && Object.keys(config).length > 0) {
|
|
72667
|
+
writeTrace(
|
|
72668
|
+
`Found Storm configuration file "${configFile}" at "${workspacePath}"`,
|
|
72669
|
+
{
|
|
72670
|
+
logLevel: "all"
|
|
72671
|
+
}
|
|
72672
|
+
);
|
|
72673
|
+
writeTrace(config, { logLevel: "all" });
|
|
72674
|
+
}
|
|
72675
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
72676
|
+
const results = await Promise.all(
|
|
72677
|
+
additionalFileNames.map(
|
|
72678
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
72679
|
+
)
|
|
72680
|
+
);
|
|
72681
|
+
for (const result of results) {
|
|
72682
|
+
if (result?.config && Object.keys(result.config).length > 0) {
|
|
72683
|
+
writeTrace(
|
|
72684
|
+
`Found additional configuration file "${result.configFile}" at "${workspacePath}"`,
|
|
72685
|
+
{
|
|
72686
|
+
logLevel: "all"
|
|
72687
|
+
}
|
|
72688
|
+
);
|
|
72689
|
+
writeTrace(result.config, { logLevel: "all" });
|
|
72690
|
+
config = (0, import_deepmerge.default)(config ?? {}, result.config ?? {});
|
|
72691
|
+
}
|
|
72692
|
+
}
|
|
72693
|
+
}
|
|
72694
|
+
if (!config) {
|
|
72695
|
+
return void 0;
|
|
72696
|
+
}
|
|
72697
|
+
config.configFile = configFile;
|
|
72698
|
+
config.runtimeVersion = "0.0.1";
|
|
72699
|
+
return config;
|
|
72700
|
+
};
|
|
72701
|
+
|
|
72642
72702
|
// packages/config-tools/src/env/get-env.ts
|
|
72643
72703
|
var getExtensionEnv = (extensionName) => {
|
|
72644
72704
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
@@ -72943,8 +73003,8 @@ var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
|
72943
73003
|
};
|
|
72944
73004
|
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
72945
73005
|
return {
|
|
72946
|
-
light: setBaseThemeColorConfigEnv(`${prefix}
|
|
72947
|
-
dark: setBaseThemeColorConfigEnv(`${prefix}
|
|
73006
|
+
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
73007
|
+
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
72948
73008
|
};
|
|
72949
73009
|
};
|
|
72950
73010
|
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
@@ -72984,6 +73044,7 @@ var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
|
72984
73044
|
};
|
|
72985
73045
|
|
|
72986
73046
|
// packages/config-tools/src/create-storm-config.ts
|
|
73047
|
+
var import_deepmerge2 = __toESM(require_cjs());
|
|
72987
73048
|
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
72988
73049
|
var _static_cache = void 0;
|
|
72989
73050
|
var createConfig = (workspaceRoot) => {
|
|
@@ -73032,7 +73093,9 @@ var loadStormConfig = async (workspaceRoot) => {
|
|
|
73032
73093
|
if (!_workspaceRoot) {
|
|
73033
73094
|
_workspaceRoot = findWorkspaceRoot();
|
|
73034
73095
|
}
|
|
73035
|
-
|
|
73096
|
+
let configFile = await getConfigFile(
|
|
73097
|
+
_workspaceRoot
|
|
73098
|
+
);
|
|
73036
73099
|
if (!configFile) {
|
|
73037
73100
|
writeWarning(
|
|
73038
73101
|
"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",
|
|
@@ -73041,10 +73104,7 @@ var loadStormConfig = async (workspaceRoot) => {
|
|
|
73041
73104
|
}
|
|
73042
73105
|
config = StormConfigSchema.parse(
|
|
73043
73106
|
await getDefaultConfig(
|
|
73044
|
-
{
|
|
73045
|
-
...getConfigEnv(),
|
|
73046
|
-
...configFile
|
|
73047
|
-
},
|
|
73107
|
+
(0, import_deepmerge2.default)(configFile, getConfigEnv(), {}),
|
|
73048
73108
|
_workspaceRoot
|
|
73049
73109
|
)
|
|
73050
73110
|
);
|
|
@@ -73069,6 +73129,7 @@ export {
|
|
|
73069
73129
|
findFileName,
|
|
73070
73130
|
findWorkspaceRoot,
|
|
73071
73131
|
findWorkspaceRootSafe,
|
|
73132
|
+
formatLogMessage,
|
|
73072
73133
|
getChalk,
|
|
73073
73134
|
getConfigEnv,
|
|
73074
73135
|
getConfigFile,
|