@storm-software/esbuild 0.21.1 → 0.21.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 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.21.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.21.2-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 -->
package/dist/build.cjs CHANGED
@@ -1,19 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkOOH2ZVCIcjs = require('./chunk-OOH2ZVCI.cjs');
4
- require('./chunk-HPSHBBVG.cjs');
5
- require('./chunk-QT6BDK5A.cjs');
3
+ var _chunkE435TS4Gcjs = require('./chunk-E435TS4G.cjs');
4
+ require('./chunk-GZKDEX4I.cjs');
5
+ require('./chunk-DF6PHIIP.cjs');
6
6
  require('./chunk-S6M44SSZ.cjs');
7
7
  require('./chunk-WRBUO7H6.cjs');
8
- require('./chunk-I3JFFJC5.cjs');
8
+ require('./chunk-GQTYEGCT.cjs');
9
9
  require('./chunk-RMB62XEL.cjs');
10
- require('./chunk-UKOZKAQT.cjs');
11
- require('./chunk-R4BLLBKQ.cjs');
12
- require('./chunk-TNCZJEAM.cjs');
10
+ require('./chunk-42FF63OO.cjs');
11
+ require('./chunk-GD4U35FZ.cjs');
12
+ require('./chunk-ZKT6GJKV.cjs');
13
13
  require('./chunk-LVWQSCJM.cjs');
14
14
  require('./chunk-CGFDQ5AJ.cjs');
15
15
  require('./chunk-EZGTDCYM.cjs');
16
16
  require('./chunk-BGYQAVKQ.cjs');
17
17
 
18
18
 
19
- exports.build = _chunkOOH2ZVCIcjs.build;
19
+ exports.build = _chunkE435TS4Gcjs.build;
package/dist/build.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  build
3
- } from "./chunk-ZN6WVNOW.js";
4
- import "./chunk-ZHJADIB7.js";
5
- import "./chunk-W7HB7SFB.js";
3
+ } from "./chunk-C2VCPXPU.js";
4
+ import "./chunk-KE7NROKH.js";
5
+ import "./chunk-5KKE2KOP.js";
6
6
  import "./chunk-T5272PC2.js";
7
7
  import "./chunk-LYDEMC26.js";
8
- import "./chunk-LGGKK6QN.js";
8
+ import "./chunk-W5YHMJLR.js";
9
9
  import "./chunk-DAGDNKO5.js";
10
- import "./chunk-6FLK5OAO.js";
11
- import "./chunk-DT7YERJW.js";
12
- import "./chunk-A6ZMH3XN.js";
10
+ import "./chunk-7QV3QQUC.js";
11
+ import "./chunk-KJJEF47Z.js";
12
+ import "./chunk-JXPYSVZW.js";
13
13
  import "./chunk-7MDMXJ5V.js";
14
14
  import "./chunk-YNQ45EAM.js";
15
15
  import "./chunk-GWG4HOQ6.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkTNCZJEAMcjs = require('./chunk-TNCZJEAM.cjs');
3
+ var _chunkZKT6GJKVcjs = require('./chunk-ZKT6GJKV.cjs');
4
4
 
5
5
 
6
6
  var _chunkLVWQSCJMcjs = require('./chunk-LVWQSCJM.cjs');
@@ -84,7 +84,7 @@ function bundleTypeDefinitions(filename, outfile, externals, options) {
84
84
  localBuild: true
85
85
  });
86
86
  if (extractorResult.succeeded === false) {
87
- _chunkTNCZJEAMcjs.writeError.call(void 0, `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
87
+ _chunkZKT6GJKVcjs.writeError.call(void 0, `API Extractor completed with ${extractorResult.errorCount} ${extractorResult.errorCount === 1 ? "error" : "errors"}`);
88
88
  throw new Error("API Extractor completed with errors");
89
89
  }
90
90
  }
@@ -6,19 +6,20 @@ import {
6
6
  } from "./chunk-LYDEMC26.js";
7
7
  import {
8
8
  onErrorPlugin
9
- } from "./chunk-LGGKK6QN.js";
9
+ } from "./chunk-W5YHMJLR.js";
10
10
  import {
11
11
  resolvePathsPlugin
12
12
  } from "./chunk-DAGDNKO5.js";
13
13
  import {
14
14
  tscPlugin
15
- } from "./chunk-6FLK5OAO.js";
15
+ } from "./chunk-7QV3QQUC.js";
16
16
  import {
17
17
  COLOR_KEYS,
18
18
  LogLevel,
19
19
  STORM_DEFAULT_DOCS,
20
20
  STORM_DEFAULT_HOMEPAGE,
21
21
  STORM_DEFAULT_LICENSING,
22
+ StormConfigSchema,
22
23
  findWorkspaceRoot,
23
24
  formatLogMessage,
24
25
  getDefaultConfig,
@@ -26,10 +27,9 @@ import {
26
27
  getLogLevelLabel,
27
28
  isVerbose,
28
29
  writeDebug,
29
- writeSystem,
30
30
  writeTrace,
31
31
  writeWarning
32
- } from "./chunk-A6ZMH3XN.js";
32
+ } from "./chunk-JXPYSVZW.js";
33
33
  import {
34
34
  correctPaths,
35
35
  joinPaths
@@ -79,19 +79,19 @@ import { loadConfig } from "c12";
79
79
  import defu from "defu";
80
80
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
81
81
  const workspacePath = filePath || findWorkspaceRoot(filePath);
82
- let config = await loadConfig({
83
- cwd: workspacePath,
84
- packageJson: true,
85
- name: fileName,
86
- envName: fileName?.toUpperCase(),
87
- jitiOptions: {
88
- debug: false,
89
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
90
- },
91
- ...options
92
- });
93
- if (!config || Object.keys(config).length === 0) {
94
- config = await loadConfig({
82
+ const configs = await Promise.all([
83
+ loadConfig({
84
+ cwd: workspacePath,
85
+ packageJson: true,
86
+ name: fileName,
87
+ envName: fileName?.toUpperCase(),
88
+ jitiOptions: {
89
+ debug: false,
90
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
91
+ },
92
+ ...options
93
+ }),
94
+ loadConfig({
95
95
  cwd: workspacePath,
96
96
  packageJson: true,
97
97
  name: fileName,
@@ -102,9 +102,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
102
102
  },
103
103
  configFile: fileName,
104
104
  ...options
105
- });
106
- }
107
- return config;
105
+ })
106
+ ]);
107
+ return defu(configs[0] ?? {}, configs[1] ?? {});
108
108
  }, "getConfigFileByName");
109
109
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
110
110
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -112,7 +112,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
112
112
  let config = result.config;
113
113
  const configFile = result.configFile;
114
114
  if (config && configFile && Object.keys(config).length > 0) {
115
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
115
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
116
116
  logLevel: "all"
117
117
  });
118
118
  }
@@ -120,7 +120,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
120
120
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
121
121
  for (const result2 of results) {
122
122
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
123
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
123
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
124
124
  logLevel: "all"
125
125
  });
126
126
  config = defu(result2.config ?? {}, config ?? {});
@@ -138,6 +138,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
138
138
  import defu2 from "defu";
139
139
 
140
140
  // ../config-tools/src/env/get-env.ts
141
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
142
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
143
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
144
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
145
+ if (name) {
146
+ ret[name] = process.env[key];
147
+ }
148
+ return ret;
149
+ }, {});
150
+ }, "getExtensionEnv");
141
151
  var getConfigEnv = /* @__PURE__ */ __name(() => {
142
152
  const prefix = "STORM_";
143
153
  let config = {
@@ -297,7 +307,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
297
307
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
298
308
  const prefix = "STORM_";
299
309
  if (config.extends) {
300
- process.env[`${prefix}EXTENDS`] = config.extends;
310
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
301
311
  }
302
312
  if (config.name) {
303
313
  process.env[`${prefix}NAME`] = config.name;
@@ -527,37 +537,76 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
527
537
  }, "setBaseThemeColorConfigEnv");
528
538
 
529
539
  // ../config-tools/src/create-storm-config.ts
540
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
530
541
  var _static_cache = void 0;
531
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
532
- let config = {};
533
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
534
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
535
- return _static_cache.data;
536
- }
537
- let _workspaceRoot = workspaceRoot;
538
- if (!_workspaceRoot) {
539
- _workspaceRoot = findWorkspaceRoot();
540
- }
541
- const configFile = await getConfigFile(_workspaceRoot);
542
- if (!configFile) {
543
- 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", {
544
- logLevel: "all"
545
- });
542
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
543
+ let result;
544
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
545
+ let _workspaceRoot = workspaceRoot;
546
+ if (!_workspaceRoot) {
547
+ _workspaceRoot = findWorkspaceRoot();
548
+ }
549
+ const configEnv = getConfigEnv();
550
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
551
+ const configFile = await getConfigFile(_workspaceRoot);
552
+ if (!configFile && !skipLogs) {
553
+ 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", {
554
+ logLevel: "all"
555
+ });
556
+ }
557
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
558
+ result.workspaceRoot ??= _workspaceRoot;
559
+ } else {
560
+ result = _static_cache.data;
561
+ }
562
+ if (schema && extensionName) {
563
+ result.extensions = {
564
+ ...result.extensions,
565
+ [extensionName]: createConfigExtension(extensionName, schema)
566
+ };
546
567
  }
547
- config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
568
+ _static_cache = {
569
+ timestamp: Date.now(),
570
+ data: result
571
+ };
572
+ return result;
573
+ }, "createStormConfig");
574
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
575
+ const extension_cache_key = {
576
+ extensionName
577
+ };
578
+ if (_extension_cache.has(extension_cache_key)) {
579
+ return _extension_cache.get(extension_cache_key);
580
+ }
581
+ let extension = getExtensionEnv(extensionName);
582
+ if (schema) {
583
+ extension = schema.parse(extension);
584
+ }
585
+ _extension_cache.set(extension_cache_key, extension);
586
+ return extension;
587
+ }, "createConfigExtension");
588
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
589
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
548
590
  setConfigEnv(config);
549
- writeTrace(`\u2699\uFE0F Using Storm configuration:
591
+ if (!skipLogs) {
592
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
550
593
  ${formatLogMessage(config)}`, config);
594
+ }
551
595
  return config;
552
596
  }, "loadStormConfig");
553
597
 
598
+ // ../config-tools/src/get-config.ts
599
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
600
+ return loadStormConfig(workspaceRoot, skipLogs);
601
+ }, "getConfig");
602
+
554
603
  // ../build-tools/src/utilities/read-nx-config.ts
555
604
  import { existsSync } from "node:fs";
556
605
  import { readFile } from "node:fs/promises";
557
606
  var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
558
607
  let rootDir = workspaceRoot;
559
608
  if (!rootDir) {
560
- const config = await loadStormConfig();
609
+ const config = await getConfig();
561
610
  rootDir = config.workspaceRoot;
562
611
  }
563
612
  const nxJsonPath = joinPaths(rootDir, "nx.json");
@@ -572,7 +621,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
572
621
  var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson = true, includeSrc = false, banner, footer) => {
573
622
  const pendingAssets = Array.from(assets ?? []);
574
623
  pendingAssets.push({
575
- input: projectRoot,
624
+ input: joinPaths(config.workspaceRoot, projectRoot),
576
625
  glob: "*.md",
577
626
  output: "."
578
627
  });
@@ -605,8 +654,10 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
605
654
  if (!buildTarget) {
606
655
  throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
607
656
  }
657
+ writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
658
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
608
659
  const result = await copyAssetsBase({
609
- assets,
660
+ assets: pendingAssets,
610
661
  watch: false,
611
662
  outputPath
612
663
  }, {
@@ -889,7 +940,7 @@ var DEFAULT_BUILD_OPTIONS = {
889
940
  export {
890
941
  DEFAULT_COMPILED_BANNER,
891
942
  DEFAULT_TARGET,
892
- loadStormConfig,
943
+ getConfig,
893
944
  copyAssets,
894
945
  addPackageDependencies,
895
946
  addWorkspacePackageJsonFields,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeError
3
- } from "./chunk-A6ZMH3XN.js";
3
+ } from "./chunk-JXPYSVZW.js";
4
4
  import {
5
5
  joinPaths
6
6
  } from "./chunk-7MDMXJ5V.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clean
3
- } from "./chunk-ZHJADIB7.js";
3
+ } from "./chunk-KE7NROKH.js";
4
4
  import {
5
5
  DEFAULT_BUILD_OPTIONS,
6
6
  DEFAULT_COMPILED_BANNER,
@@ -9,15 +9,15 @@ import {
9
9
  addPackageJsonExport,
10
10
  addWorkspacePackageJsonFields,
11
11
  copyAssets,
12
+ getConfig,
12
13
  getDefaultBuildPlugins,
13
14
  getEntryPoints,
14
15
  getEnv,
15
- getOutputExtensionMap,
16
- loadStormConfig
17
- } from "./chunk-W7HB7SFB.js";
16
+ getOutputExtensionMap
17
+ } from "./chunk-5KKE2KOP.js";
18
18
  import {
19
19
  depsCheckPlugin
20
- } from "./chunk-DT7YERJW.js";
20
+ } from "./chunk-KJJEF47Z.js";
21
21
  import {
22
22
  getStopwatch,
23
23
  isVerbose,
@@ -27,7 +27,7 @@ import {
27
27
  writeSuccess,
28
28
  writeTrace,
29
29
  writeWarning
30
- } from "./chunk-A6ZMH3XN.js";
30
+ } from "./chunk-JXPYSVZW.js";
31
31
  import {
32
32
  joinPaths
33
33
  } from "./chunk-7MDMXJ5V.js";
@@ -277,7 +277,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
277
277
  if (!workspaceRoot) {
278
278
  throw new Error("Cannot find Nx workspace root");
279
279
  }
280
- const config = await loadStormConfig(workspaceRoot.dir);
280
+ const config = await getConfig(workspaceRoot.dir);
281
281
  writeDebug(" \u2699\uFE0F Resolving build options", config);
282
282
  const stopwatch = getStopwatch("Build options resolution");
283
283
  const projectGraph = await createProjectGraphAsync({