@storm-software/terraform-tools 0.52.1 → 0.53.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-TFP2FPZB.mjs → chunk-42WVFPO6.mjs} +31 -73
  4. package/dist/{chunk-GK3245WN.js → chunk-6D4LV6X2.js} +3 -3
  5. package/dist/{chunk-PNST6H5V.mjs → chunk-D6CRGFE3.mjs} +1 -1
  6. package/dist/{chunk-KJYJUNDY.mjs → chunk-EMIZUK4F.mjs} +1 -1
  7. package/dist/{chunk-DFJELNNO.js → chunk-FLEOXRFA.js} +2 -2
  8. package/dist/{chunk-CJ4NNPZP.js → chunk-GEMICIUF.js} +2 -2
  9. package/dist/{chunk-7URDMDS7.mjs → chunk-IMGISWCA.mjs} +1 -1
  10. package/dist/{chunk-SUZ23ERM.js → chunk-JEBWKJI3.js} +2 -2
  11. package/dist/{chunk-PCBBHDHD.mjs → chunk-KBT4UFBN.mjs} +1 -1
  12. package/dist/{chunk-JIPJCCPH.js → chunk-MJMNVCOX.js} +2 -2
  13. package/dist/{chunk-S3PQ6E47.js → chunk-TQAFH5OJ.js} +47 -89
  14. package/dist/{chunk-5J6DENCU.js → chunk-WGRRG2DY.js} +177 -177
  15. package/dist/{chunk-ZKOE2OCL.mjs → chunk-ZOKR7XCK.mjs} +14 -14
  16. package/dist/{chunk-XQXP5BJI.mjs → chunk-ZTLSR2U3.mjs} +1 -1
  17. package/dist/executors.js +6 -6
  18. package/dist/executors.mjs +6 -6
  19. package/dist/generators.js +3 -3
  20. package/dist/generators.mjs +2 -2
  21. package/dist/index.js +8 -8
  22. package/dist/index.mjs +7 -7
  23. package/dist/src/base/index.js +3 -3
  24. package/dist/src/base/index.mjs +2 -2
  25. package/dist/src/base/terraform-executor.js +3 -3
  26. package/dist/src/base/terraform-executor.mjs +2 -2
  27. package/dist/src/executors/apply/executor.js +4 -4
  28. package/dist/src/executors/apply/executor.mjs +3 -3
  29. package/dist/src/executors/destroy/executor.js +4 -4
  30. package/dist/src/executors/destroy/executor.mjs +3 -3
  31. package/dist/src/executors/output/executor.js +4 -4
  32. package/dist/src/executors/output/executor.mjs +3 -3
  33. package/dist/src/executors/plan/executor.js +4 -4
  34. package/dist/src/executors/plan/executor.mjs +3 -3
  35. package/dist/src/generators/init/init.js +3 -3
  36. package/dist/src/generators/init/init.mjs +2 -2
  37. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 0.53.1 (2025-01-22)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **config-tools:** Resolved issue applying entire token parameters object ([5ccf3881](https://github.com/storm-software/storm-ops/commit/5ccf3881))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated workspace-tools to 1.239.2
10
+ - Updated workspace-tools to 1.239.2
11
+
12
+ ## 0.53.0 (2025-01-22)
13
+
14
+ ### Features
15
+
16
+ - **workspace-tools:** Enhanced option tokenization logic for executors ([14ed93d7](https://github.com/storm-software/storm-ops/commit/14ed93d7))
17
+
18
+ ### 🧱 Updated Dependencies
19
+
20
+ - Updated workspace-tools to 1.239.0
21
+ - Updated workspace-tools to 1.239.0
22
+
1
23
  ## 0.52.1 (2025-01-21)
2
24
 
3
25
  ### Bug Fixes
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
- [![Version](https://img.shields.io/badge/version-0.52.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.53.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -607,48 +607,51 @@ var _isFunction = /* @__PURE__ */ __name((value) => {
607
607
  }, "_isFunction");
608
608
 
609
609
  // ../config-tools/src/utilities/apply-workspace-tokens.ts
610
- var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenizerOptions) => {
610
+ var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams) => {
611
611
  let result = option;
612
612
  if (!result) {
613
613
  return result;
614
614
  }
615
- if (tokenizerOptions) {
616
- const optionKeys = Object.keys(tokenizerOptions);
615
+ if (tokenParams) {
616
+ const optionKeys = Object.keys(tokenParams);
617
617
  if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
618
618
  for (const optionKey of optionKeys) {
619
619
  if (result.includes(`{${optionKey}}`)) {
620
- result = result.replaceAll(`{${optionKey}}`, tokenizerOptions.config?.[optionKey] ?? "");
620
+ result = result.replaceAll(`{${optionKey}}`, tokenParams?.[optionKey] || "");
621
621
  }
622
622
  }
623
623
  }
624
624
  }
625
- if (tokenizerOptions.config) {
626
- const configKeys = Object.keys(tokenizerOptions.config);
625
+ if (tokenParams.config) {
626
+ const configKeys = Object.keys(tokenParams.config);
627
627
  if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
628
628
  for (const configKey of configKeys) {
629
629
  if (result.includes(`{${configKey}}`)) {
630
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
630
+ result = result.replaceAll(`{${configKey}}`, tokenParams.config[configKey] || "");
631
631
  }
632
632
  }
633
633
  }
634
634
  }
635
635
  if (result.includes("{workspaceRoot}")) {
636
- result = result.replaceAll("{workspaceRoot}", tokenizerOptions.workspaceRoot ?? tokenizerOptions.config?.workspaceRoot ?? findWorkspaceRoot());
636
+ result = result.replaceAll("{workspaceRoot}", tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot());
637
637
  }
638
638
  return result;
639
639
  }, "applyWorkspaceBaseTokens");
640
- var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, config, tokenizerFn) => {
640
+ var applyWorkspaceProjectTokens = /* @__PURE__ */ __name((option, tokenParams) => {
641
+ return applyWorkspaceBaseTokens(option, tokenParams);
642
+ }, "applyWorkspaceProjectTokens");
643
+ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, tokenParams, tokenizerFn) => {
641
644
  if (!options) {
642
645
  return {};
643
646
  }
644
647
  const result = {};
645
648
  for (const option of Object.keys(options)) {
646
649
  if (typeof options[option] === "string") {
647
- result[option] = await Promise.resolve(tokenizerFn(options[option], config));
650
+ result[option] = await Promise.resolve(tokenizerFn(options[option], tokenParams));
648
651
  } else if (Array.isArray(options[option])) {
649
- result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, config)) : item));
652
+ result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item));
650
653
  } else if (typeof options[option] === "object") {
651
- result[option] = await applyWorkspaceTokens(options[option], config, tokenizerFn);
654
+ result[option] = await applyWorkspaceTokens(options[option], tokenParams, tokenizerFn);
652
655
  } else {
653
656
  result[option] = options[option];
654
657
  }
@@ -1131,71 +1134,24 @@ ${formatLogMessage(config)}`, config);
1131
1134
  return config;
1132
1135
  }, "loadStormConfig");
1133
1136
 
1134
- // ../workspace-tools/src/utils/apply-workspace-tokens.ts
1135
- var applyWorkspaceExecutorTokens = /* @__PURE__ */ __name(async (option, tokenizerOptions) => {
1136
- let result = option;
1137
- if (!result) {
1138
- return result;
1139
- }
1140
- let projectName;
1141
- let projectRoot;
1142
- let sourceRoot;
1143
- if (tokenizerOptions?.projectName) {
1144
- const context = tokenizerOptions;
1145
- projectName = context.projectName;
1146
- projectRoot = context.root;
1147
- sourceRoot = context.sourceRoot;
1148
- } else {
1149
- const projectConfig = tokenizerOptions;
1150
- projectRoot = projectConfig.root;
1151
- if (projectConfig.name) {
1152
- projectName = projectConfig.name;
1153
- }
1154
- if (projectConfig.sourceRoot) {
1155
- sourceRoot = projectConfig.sourceRoot;
1156
- }
1157
- }
1158
- if (tokenizerOptions.config) {
1159
- const configKeys = Object.keys(tokenizerOptions.config);
1160
- if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
1161
- for (const configKey of configKeys) {
1162
- if (result.includes(`{${configKey}}`)) {
1163
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
1164
- }
1165
- }
1166
- }
1167
- }
1168
- if (result.includes("{projectName}")) {
1169
- result = result.replaceAll("{projectName}", projectName);
1170
- }
1171
- if (result.includes("{projectRoot}")) {
1172
- result = result.replaceAll("{projectRoot}", projectRoot);
1173
- }
1174
- if (result.includes("{sourceRoot}")) {
1175
- result = result.replaceAll("{sourceRoot}", sourceRoot);
1176
- }
1177
- if (result.includes("{workspaceRoot}")) {
1178
- result = result.replaceAll("{workspaceRoot}", tokenizerOptions.workspaceRoot ?? findWorkspaceRoot());
1179
- }
1180
- return result;
1181
- }, "applyWorkspaceExecutorTokens");
1182
-
1183
1137
  // ../workspace-tools/src/base/base-executor.ts
1138
+ import { defu as defu3 } from "defu";
1184
1139
  var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context) => {
1185
1140
  const stopwatch = getStopwatch(name);
1186
1141
  let options = _options;
1187
1142
  let config = {};
1188
1143
  try {
1189
- writeInfo(`\u26A1 Running the ${name} executor...
1190
- `, config);
1191
1144
  if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
1192
1145
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1193
1146
  }
1194
1147
  const workspaceRoot = findWorkspaceRoot();
1195
- const projectRoot = context.projectsConfigurations.projects[context.projectName]?.root ?? workspaceRoot;
1196
- const sourceRoot = context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? workspaceRoot;
1197
- const projectName = context.projectsConfigurations.projects[context.projectName]?.name ?? context.projectName;
1148
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot;
1149
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot;
1150
+ const projectName = context.projectName;
1198
1151
  config.workspaceRoot = workspaceRoot;
1152
+ writeInfo(`
1153
+ \u26A1 Running the ${name} executor for ${projectName}
1154
+ `, config);
1199
1155
  if (!executorOptions.skipReadingConfig) {
1200
1156
  writeTrace(`Loading the Storm Config from environment variables and storm.config.js file...
1201
1157
  - workspaceRoot: ${workspaceRoot}
@@ -1210,17 +1166,19 @@ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions
1210
1166
  options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
1211
1167
  writeDebug("Completed the applyDefaultOptions hook", config);
1212
1168
  }
1213
- writeTrace(`Executor schema options \u2699\uFE0F
1214
- ${Object.keys(options).map((key) => ` - ${key}=${_isFunction2(options[key]) ? "<function>" : JSON.stringify(options[key])}`).join("\n")}`, config);
1215
- const tokenized = await applyWorkspaceTokens(options, {
1216
- config,
1169
+ writeTrace(`Executor schema options \u2699\uFE0F
1170
+ ${formatLogMessage(options)}
1171
+ `, config);
1172
+ const tokenized = await applyWorkspaceTokens(options, defu3({
1217
1173
  workspaceRoot,
1218
1174
  projectRoot,
1219
1175
  sourceRoot,
1220
1176
  projectName,
1221
- ...context.projectsConfigurations.projects[context.projectName],
1222
- ...executorOptions
1223
- }, applyWorkspaceExecutorTokens);
1177
+ config
1178
+ }, config, context.projectsConfigurations.projects[context.projectName]), applyWorkspaceProjectTokens);
1179
+ writeTrace(`Executor schema tokenized options \u2699\uFE0F
1180
+ ${formatLogMessage(tokenized)}
1181
+ `, config);
1224
1182
  if (executorOptions?.hooks?.preProcess) {
1225
1183
  writeDebug("Running the preProcess hook...", config);
1226
1184
  await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkS3PQ6E47js = require('./chunk-S3PQ6E47.js');
4
+ var _chunkTQAFH5OJjs = require('./chunk-TQAFH5OJ.js');
5
5
 
6
6
 
7
7
  var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
@@ -9,7 +9,7 @@ var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
9
9
  // src/base/terraform-executor.ts
10
10
  var _shelljs = require('shelljs');
11
11
  var withTerraformExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (command, executorOptions = {}) => async (_options, context) => {
12
- return _chunkS3PQ6E47js.withRunExecutor.call(void 0, `Terraform \`${command}\` Command Executor`, async (options, context2, config) => {
12
+ return _chunkTQAFH5OJjs.withRunExecutor.call(void 0, `Terraform \`${command}\` Command Executor`, async (options, context2, config) => {
13
13
  if (!_shelljs.which.call(void 0, "tofu") || !_shelljs.which.call(void 0, "terraform")) {
14
14
  throw new Error("Both OpenTofu and Terraform are not installed. Please install one of the two before running this executor.");
15
15
  }
@@ -21,7 +21,7 @@ var withTerraformExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0,
21
21
  if (typeof jsonBackendConfig === "string") {
22
22
  jsonBackendConfig = JSON.parse(jsonBackendConfig);
23
23
  }
24
- _chunkS3PQ6E47js.run.call(void 0, config, [
24
+ _chunkTQAFH5OJjs.run.call(void 0, config, [
25
25
  "terragrunt",
26
26
  command,
27
27
  ...jsonBackendConfig.map((config2) => `-backend-config="${config2.key}=${config2.name}"`),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTerraformExecutor
3
- } from "./chunk-KJYJUNDY.mjs";
3
+ } from "./chunk-EMIZUK4F.mjs";
4
4
 
5
5
  // src/executors/output/executor.ts
6
6
  var executor_default = withTerraformExecutor("output");
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  run,
3
3
  withRunExecutor
4
- } from "./chunk-TFP2FPZB.mjs";
4
+ } from "./chunk-42WVFPO6.mjs";
5
5
  import {
6
6
  __name
7
7
  } from "./chunk-XUV4U54K.mjs";
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGK3245WNjs = require('./chunk-GK3245WN.js');
3
+ var _chunk6D4LV6X2js = require('./chunk-6D4LV6X2.js');
4
4
 
5
5
  // src/executors/apply/executor.ts
6
- var executor_default = _chunkGK3245WNjs.withTerraformExecutor.call(void 0, "apply");
6
+ var executor_default = _chunk6D4LV6X2js.withTerraformExecutor.call(void 0, "apply");
7
7
 
8
8
 
9
9
 
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGK3245WNjs = require('./chunk-GK3245WN.js');
3
+ var _chunk6D4LV6X2js = require('./chunk-6D4LV6X2.js');
4
4
 
5
5
  // src/executors/destroy/executor.ts
6
- var executor_default = _chunkGK3245WNjs.withTerraformExecutor.call(void 0, "destroy");
6
+ var executor_default = _chunk6D4LV6X2js.withTerraformExecutor.call(void 0, "destroy");
7
7
 
8
8
 
9
9
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTerraformExecutor
3
- } from "./chunk-KJYJUNDY.mjs";
3
+ } from "./chunk-EMIZUK4F.mjs";
4
4
 
5
5
  // src/executors/apply/executor.ts
6
6
  var executor_default = withTerraformExecutor("apply");
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGK3245WNjs = require('./chunk-GK3245WN.js');
3
+ var _chunk6D4LV6X2js = require('./chunk-6D4LV6X2.js');
4
4
 
5
5
  // src/executors/output/executor.ts
6
- var executor_default = _chunkGK3245WNjs.withTerraformExecutor.call(void 0, "output");
6
+ var executor_default = _chunk6D4LV6X2js.withTerraformExecutor.call(void 0, "output");
7
7
 
8
8
 
9
9
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTerraformExecutor
3
- } from "./chunk-KJYJUNDY.mjs";
3
+ } from "./chunk-EMIZUK4F.mjs";
4
4
 
5
5
  // src/executors/destroy/executor.ts
6
6
  var executor_default = withTerraformExecutor("destroy");
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGK3245WNjs = require('./chunk-GK3245WN.js');
3
+ var _chunk6D4LV6X2js = require('./chunk-6D4LV6X2.js');
4
4
 
5
5
  // src/executors/plan/executor.ts
6
- var executor_default = _chunkGK3245WNjs.withTerraformExecutor.call(void 0, "plan");
6
+ var executor_default = _chunk6D4LV6X2js.withTerraformExecutor.call(void 0, "plan");
7
7
 
8
8
 
9
9
 
@@ -607,48 +607,51 @@ var _isFunction = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (value) =
607
607
  }, "_isFunction");
608
608
 
609
609
  // ../config-tools/src/utilities/apply-workspace-tokens.ts
610
- var applyWorkspaceBaseTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (option, tokenizerOptions) => {
610
+ var applyWorkspaceBaseTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (option, tokenParams) => {
611
611
  let result = option;
612
612
  if (!result) {
613
613
  return result;
614
614
  }
615
- if (tokenizerOptions) {
616
- const optionKeys = Object.keys(tokenizerOptions);
615
+ if (tokenParams) {
616
+ const optionKeys = Object.keys(tokenParams);
617
617
  if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
618
618
  for (const optionKey of optionKeys) {
619
619
  if (result.includes(`{${optionKey}}`)) {
620
- result = result.replaceAll(`{${optionKey}}`, _nullishCoalesce(_optionalChain([tokenizerOptions, 'access', _30 => _30.config, 'optionalAccess', _31 => _31[optionKey]]), () => ( "")));
620
+ result = result.replaceAll(`{${optionKey}}`, _optionalChain([tokenParams, 'optionalAccess', _30 => _30[optionKey]]) || "");
621
621
  }
622
622
  }
623
623
  }
624
624
  }
625
- if (tokenizerOptions.config) {
626
- const configKeys = Object.keys(tokenizerOptions.config);
625
+ if (tokenParams.config) {
626
+ const configKeys = Object.keys(tokenParams.config);
627
627
  if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
628
628
  for (const configKey of configKeys) {
629
629
  if (result.includes(`{${configKey}}`)) {
630
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
630
+ result = result.replaceAll(`{${configKey}}`, tokenParams.config[configKey] || "");
631
631
  }
632
632
  }
633
633
  }
634
634
  }
635
635
  if (result.includes("{workspaceRoot}")) {
636
- result = result.replaceAll("{workspaceRoot}", _nullishCoalesce(_nullishCoalesce(tokenizerOptions.workspaceRoot, () => ( _optionalChain([tokenizerOptions, 'access', _32 => _32.config, 'optionalAccess', _33 => _33.workspaceRoot]))), () => ( findWorkspaceRoot())));
636
+ result = result.replaceAll("{workspaceRoot}", _nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _31 => _31.config, 'optionalAccess', _32 => _32.workspaceRoot]))), () => ( findWorkspaceRoot())));
637
637
  }
638
638
  return result;
639
639
  }, "applyWorkspaceBaseTokens");
640
- var applyWorkspaceTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (options, config, tokenizerFn) => {
640
+ var applyWorkspaceProjectTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (option, tokenParams) => {
641
+ return applyWorkspaceBaseTokens(option, tokenParams);
642
+ }, "applyWorkspaceProjectTokens");
643
+ var applyWorkspaceTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (options, tokenParams, tokenizerFn) => {
641
644
  if (!options) {
642
645
  return {};
643
646
  }
644
647
  const result = {};
645
648
  for (const option of Object.keys(options)) {
646
649
  if (typeof options[option] === "string") {
647
- result[option] = await Promise.resolve(tokenizerFn(options[option], config));
650
+ result[option] = await Promise.resolve(tokenizerFn(options[option], tokenParams));
648
651
  } else if (Array.isArray(options[option])) {
649
- result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, config)) : item));
652
+ result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item));
650
653
  } else if (typeof options[option] === "object") {
651
- result[option] = await applyWorkspaceTokens(options[option], config, tokenizerFn);
654
+ result[option] = await applyWorkspaceTokens(options[option], tokenParams, tokenizerFn);
652
655
  } else {
653
656
  result[option] = options[option];
654
657
  }
@@ -663,7 +666,7 @@ var getConfigFileByName = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, a
663
666
  cwd: workspacePath,
664
667
  packageJson: true,
665
668
  name: fileName,
666
- envName: _optionalChain([fileName, 'optionalAccess', _34 => _34.toUpperCase, 'call', _35 => _35()]),
669
+ envName: _optionalChain([fileName, 'optionalAccess', _33 => _33.toUpperCase, 'call', _34 => _34()]),
667
670
  jitiOptions: {
668
671
  debug: false,
669
672
  fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
@@ -675,7 +678,7 @@ var getConfigFileByName = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, a
675
678
  cwd: workspacePath,
676
679
  packageJson: true,
677
680
  name: fileName,
678
- envName: _optionalChain([fileName, 'optionalAccess', _36 => _36.toUpperCase, 'call', _37 => _37()]),
681
+ envName: _optionalChain([fileName, 'optionalAccess', _35 => _35.toUpperCase, 'call', _36 => _36()]),
679
682
  jitiOptions: {
680
683
  debug: false,
681
684
  fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
@@ -699,7 +702,7 @@ var getConfigFile = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (
699
702
  if (additionalFileNames && additionalFileNames.length > 0) {
700
703
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
701
704
  for (const result2 of results) {
702
- if (_optionalChain([result2, 'optionalAccess', _38 => _38.config]) && _optionalChain([result2, 'optionalAccess', _39 => _39.configFile]) && Object.keys(result2.config).length > 0) {
705
+ if (_optionalChain([result2, 'optionalAccess', _37 => _37.config]) && _optionalChain([result2, 'optionalAccess', _38 => _38.configFile]) && Object.keys(result2.config).length > 0) {
703
706
  writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
704
707
  logLevel: "all"
705
708
  });
@@ -858,13 +861,13 @@ var getBaseThemeColorConfigEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(vo
858
861
  var setExtensionEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (extensionName, extension) => {
859
862
  for (const key of Object.keys(_nullishCoalesce(extension, () => ( {})))) {
860
863
  if (extension[key]) {
861
- const result = _nullishCoalesce(_optionalChain([key, 'optionalAccess', _40 => _40.replace, 'call', _41 => _41(/([A-Z])+/g, (input) => input ? _optionalChain([input, 'access', _42 => _42[0], 'optionalAccess', _43 => _43.toUpperCase, 'call', _44 => _44()]) + input.slice(1) : ""), 'access', _45 => _45.split, 'call', _46 => _46(/(?=[A-Z])|[.\-\s_]/), 'access', _47 => _47.map, 'call', _48 => _48((x) => x.toLowerCase())]), () => ( []));
864
+ const result = _nullishCoalesce(_optionalChain([key, 'optionalAccess', _39 => _39.replace, 'call', _40 => _40(/([A-Z])+/g, (input) => input ? _optionalChain([input, 'access', _41 => _41[0], 'optionalAccess', _42 => _42.toUpperCase, 'call', _43 => _43()]) + input.slice(1) : ""), 'access', _44 => _44.split, 'call', _45 => _45(/(?=[A-Z])|[.\-\s_]/), 'access', _46 => _46.map, 'call', _47 => _47((x) => x.toLowerCase())]), () => ( []));
862
865
  let extensionKey;
863
866
  if (result.length === 0) {
864
867
  return;
865
868
  }
866
869
  if (result.length === 1) {
867
- extensionKey = _nullishCoalesce(_optionalChain([result, 'access', _49 => _49[0], 'optionalAccess', _50 => _50.toUpperCase, 'call', _51 => _51()]), () => ( ""));
870
+ extensionKey = _nullishCoalesce(_optionalChain([result, 'access', _48 => _48[0], 'optionalAccess', _49 => _49.toUpperCase, 'call', _50 => _50()]), () => ( ""));
868
871
  } else {
869
872
  extensionKey = result.reduce((ret, part) => {
870
873
  return `${ret}_${part.toLowerCase()}`;
@@ -961,7 +964,7 @@ var setConfigEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (config)
961
964
  process.env.NODE_ENV = config.env;
962
965
  process.env.ENVIRONMENT = config.env;
963
966
  }
964
- if (_optionalChain([config, 'access', _52 => _52.colors, 'optionalAccess', _53 => _53.base, 'optionalAccess', _54 => _54.light]) || _optionalChain([config, 'access', _55 => _55.colors, 'optionalAccess', _56 => _56.base, 'optionalAccess', _57 => _57.dark])) {
967
+ if (_optionalChain([config, 'access', _51 => _51.colors, 'optionalAccess', _52 => _52.base, 'optionalAccess', _53 => _53.light]) || _optionalChain([config, 'access', _54 => _54.colors, 'optionalAccess', _55 => _55.base, 'optionalAccess', _56 => _56.dark])) {
965
968
  for (const key of Object.keys(config.colors)) {
966
969
  setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
967
970
  }
@@ -1009,7 +1012,7 @@ var setConfigEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (config)
1009
1012
  }
1010
1013
  }, "setConfigEnv");
1011
1014
  var setThemeColorConfigEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (prefix, config) => {
1012
- return _optionalChain([config, 'optionalAccess', _58 => _58.light, 'optionalAccess', _59 => _59.brand]) || _optionalChain([config, 'optionalAccess', _60 => _60.dark, 'optionalAccess', _61 => _61.brand]) ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
1015
+ return _optionalChain([config, 'optionalAccess', _57 => _57.light, 'optionalAccess', _58 => _58.brand]) || _optionalChain([config, 'optionalAccess', _59 => _59.dark, 'optionalAccess', _60 => _60.brand]) ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
1013
1016
  }, "setThemeColorConfigEnv");
1014
1017
  var setSingleThemeColorConfigEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (prefix, config) => {
1015
1018
  if (config.dark) {
@@ -1110,7 +1113,7 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(vo
1110
1113
  var _static_cache = void 0;
1111
1114
  var loadStormConfig = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (workspaceRoot) => {
1112
1115
  let config = {};
1113
- if (_optionalChain([_static_cache, 'optionalAccess', _62 => _62.data]) && _optionalChain([_static_cache, 'optionalAccess', _63 => _63.timestamp]) && _static_cache.timestamp >= Date.now() + 3e4) {
1116
+ if (_optionalChain([_static_cache, 'optionalAccess', _61 => _61.data]) && _optionalChain([_static_cache, 'optionalAccess', _62 => _62.timestamp]) && _static_cache.timestamp >= Date.now() + 3e4) {
1114
1117
  writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
1115
1118
  return _static_cache.data;
1116
1119
  }
@@ -1131,71 +1134,24 @@ ${formatLogMessage(config)}`, config);
1131
1134
  return config;
1132
1135
  }, "loadStormConfig");
1133
1136
 
1134
- // ../workspace-tools/src/utils/apply-workspace-tokens.ts
1135
- var applyWorkspaceExecutorTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (option, tokenizerOptions) => {
1136
- let result = option;
1137
- if (!result) {
1138
- return result;
1139
- }
1140
- let projectName;
1141
- let projectRoot;
1142
- let sourceRoot;
1143
- if (_optionalChain([tokenizerOptions, 'optionalAccess', _64 => _64.projectName])) {
1144
- const context = tokenizerOptions;
1145
- projectName = context.projectName;
1146
- projectRoot = context.root;
1147
- sourceRoot = context.sourceRoot;
1148
- } else {
1149
- const projectConfig = tokenizerOptions;
1150
- projectRoot = projectConfig.root;
1151
- if (projectConfig.name) {
1152
- projectName = projectConfig.name;
1153
- }
1154
- if (projectConfig.sourceRoot) {
1155
- sourceRoot = projectConfig.sourceRoot;
1156
- }
1157
- }
1158
- if (tokenizerOptions.config) {
1159
- const configKeys = Object.keys(tokenizerOptions.config);
1160
- if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
1161
- for (const configKey of configKeys) {
1162
- if (result.includes(`{${configKey}}`)) {
1163
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
1164
- }
1165
- }
1166
- }
1167
- }
1168
- if (result.includes("{projectName}")) {
1169
- result = result.replaceAll("{projectName}", projectName);
1170
- }
1171
- if (result.includes("{projectRoot}")) {
1172
- result = result.replaceAll("{projectRoot}", projectRoot);
1173
- }
1174
- if (result.includes("{sourceRoot}")) {
1175
- result = result.replaceAll("{sourceRoot}", sourceRoot);
1176
- }
1177
- if (result.includes("{workspaceRoot}")) {
1178
- result = result.replaceAll("{workspaceRoot}", _nullishCoalesce(tokenizerOptions.workspaceRoot, () => ( findWorkspaceRoot())));
1179
- }
1180
- return result;
1181
- }, "applyWorkspaceExecutorTokens");
1182
-
1183
1137
  // ../workspace-tools/src/base/base-executor.ts
1138
+
1184
1139
  var withRunExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (name, executorFn, executorOptions = {}) => async (_options, context) => {
1185
1140
  const stopwatch = getStopwatch(name);
1186
1141
  let options = _options;
1187
1142
  let config = {};
1188
1143
  try {
1189
- writeInfo(`\u26A1 Running the ${name} executor...
1190
- `, config);
1191
- if (!_optionalChain([context, 'access', _65 => _65.projectsConfigurations, 'optionalAccess', _66 => _66.projects]) || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
1144
+ if (!_optionalChain([context, 'access', _63 => _63.projectsConfigurations, 'optionalAccess', _64 => _64.projects]) || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
1192
1145
  throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
1193
1146
  }
1194
1147
  const workspaceRoot = findWorkspaceRoot();
1195
- const projectRoot = _nullishCoalesce(_optionalChain([context, 'access', _67 => _67.projectsConfigurations, 'access', _68 => _68.projects, 'access', _69 => _69[context.projectName], 'optionalAccess', _70 => _70.root]), () => ( workspaceRoot));
1196
- const sourceRoot = _nullishCoalesce(_optionalChain([context, 'access', _71 => _71.projectsConfigurations, 'access', _72 => _72.projects, 'access', _73 => _73[context.projectName], 'optionalAccess', _74 => _74.sourceRoot]), () => ( workspaceRoot));
1197
- const projectName = _nullishCoalesce(_optionalChain([context, 'access', _75 => _75.projectsConfigurations, 'access', _76 => _76.projects, 'access', _77 => _77[context.projectName], 'optionalAccess', _78 => _78.name]), () => ( context.projectName));
1148
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot;
1149
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot;
1150
+ const projectName = context.projectName;
1198
1151
  config.workspaceRoot = workspaceRoot;
1152
+ writeInfo(`
1153
+ \u26A1 Running the ${name} executor for ${projectName}
1154
+ `, config);
1199
1155
  if (!executorOptions.skipReadingConfig) {
1200
1156
  writeTrace(`Loading the Storm Config from environment variables and storm.config.js file...
1201
1157
  - workspaceRoot: ${workspaceRoot}
@@ -1205,43 +1161,45 @@ var withRunExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (name
1205
1161
  `, config);
1206
1162
  config = await loadStormConfig(workspaceRoot);
1207
1163
  }
1208
- if (_optionalChain([executorOptions, 'optionalAccess', _79 => _79.hooks, 'optionalAccess', _80 => _80.applyDefaultOptions])) {
1164
+ if (_optionalChain([executorOptions, 'optionalAccess', _65 => _65.hooks, 'optionalAccess', _66 => _66.applyDefaultOptions])) {
1209
1165
  writeDebug("Running the applyDefaultOptions hook...", config);
1210
1166
  options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
1211
1167
  writeDebug("Completed the applyDefaultOptions hook", config);
1212
1168
  }
1213
- writeTrace(`Executor schema options \u2699\uFE0F
1214
- ${Object.keys(options).map((key) => ` - ${key}=${_isFunction2(options[key]) ? "<function>" : JSON.stringify(options[key])}`).join("\n")}`, config);
1215
- const tokenized = await applyWorkspaceTokens(options, {
1216
- config,
1169
+ writeTrace(`Executor schema options \u2699\uFE0F
1170
+ ${formatLogMessage(options)}
1171
+ `, config);
1172
+ const tokenized = await applyWorkspaceTokens(options, _defu.defu.call(void 0, {
1217
1173
  workspaceRoot,
1218
1174
  projectRoot,
1219
1175
  sourceRoot,
1220
1176
  projectName,
1221
- ...context.projectsConfigurations.projects[context.projectName],
1222
- ...executorOptions
1223
- }, applyWorkspaceExecutorTokens);
1224
- if (_optionalChain([executorOptions, 'optionalAccess', _81 => _81.hooks, 'optionalAccess', _82 => _82.preProcess])) {
1177
+ config
1178
+ }, config, context.projectsConfigurations.projects[context.projectName]), applyWorkspaceProjectTokens);
1179
+ writeTrace(`Executor schema tokenized options \u2699\uFE0F
1180
+ ${formatLogMessage(tokenized)}
1181
+ `, config);
1182
+ if (_optionalChain([executorOptions, 'optionalAccess', _67 => _67.hooks, 'optionalAccess', _68 => _68.preProcess])) {
1225
1183
  writeDebug("Running the preProcess hook...", config);
1226
1184
  await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
1227
1185
  writeDebug("Completed the preProcess hook", config);
1228
1186
  }
1229
1187
  const ret = executorFn(tokenized, context, config);
1230
- if (_isFunction2(_optionalChain([ret, 'optionalAccess', _83 => _83.next]))) {
1188
+ if (_isFunction2(_optionalChain([ret, 'optionalAccess', _69 => _69.next]))) {
1231
1189
  const asyncGen = ret;
1232
1190
  for await (const iter of asyncGen) {
1233
1191
  }
1234
1192
  }
1235
1193
  const result = await Promise.resolve(ret);
1236
- if (result && (!result.success || result.error && _optionalChain([result, 'optionalAccess', _84 => _84.error, 'optionalAccess', _85 => _85.message]) && typeof _optionalChain([result, 'optionalAccess', _86 => _86.error, 'optionalAccess', _87 => _87.message]) === "string" && _optionalChain([result, 'optionalAccess', _88 => _88.error, 'optionalAccess', _89 => _89.name]) && typeof _optionalChain([result, 'optionalAccess', _90 => _90.error, 'optionalAccess', _91 => _91.name]) === "string")) {
1194
+ if (result && (!result.success || result.error && _optionalChain([result, 'optionalAccess', _70 => _70.error, 'optionalAccess', _71 => _71.message]) && typeof _optionalChain([result, 'optionalAccess', _72 => _72.error, 'optionalAccess', _73 => _73.message]) === "string" && _optionalChain([result, 'optionalAccess', _74 => _74.error, 'optionalAccess', _75 => _75.name]) && typeof _optionalChain([result, 'optionalAccess', _76 => _76.error, 'optionalAccess', _77 => _77.name]) === "string")) {
1237
1195
  writeTrace(`Failure determined by the ${name} executor
1238
1196
  ${formatLogMessage(result)}`, config);
1239
1197
  console.error(result);
1240
1198
  throw new Error(`The ${name} executor failed to run`, {
1241
- cause: _optionalChain([result, 'optionalAccess', _92 => _92.error])
1199
+ cause: _optionalChain([result, 'optionalAccess', _78 => _78.error])
1242
1200
  });
1243
1201
  }
1244
- if (_optionalChain([executorOptions, 'optionalAccess', _93 => _93.hooks, 'optionalAccess', _94 => _94.postProcess])) {
1202
+ if (_optionalChain([executorOptions, 'optionalAccess', _79 => _79.hooks, 'optionalAccess', _80 => _80.postProcess])) {
1245
1203
  writeDebug("Running the postProcess hook...", config);
1246
1204
  await Promise.resolve(executorOptions.hooks.postProcess(config));
1247
1205
  writeDebug("Completed the postProcess hook", config);
@@ -1265,7 +1223,7 @@ ${formatLogMessage(result)}`, config);
1265
1223
  }, "withRunExecutor");
1266
1224
  var _isFunction2 = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (value) => {
1267
1225
  try {
1268
- return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _95 => _95.constructor]) && _optionalChain([value, 'optionalAccess', _96 => _96.call]) && _optionalChain([value, 'optionalAccess', _97 => _97.apply]));
1226
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _81 => _81.constructor]) && _optionalChain([value, 'optionalAccess', _82 => _82.call]) && _optionalChain([value, 'optionalAccess', _83 => _83.apply]));
1269
1227
  } catch (e) {
1270
1228
  return false;
1271
1229
  }