@storm-software/workspace-tools 1.180.10 → 1.181.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.180.10",
3
+ "version": "1.181.1",
4
4
  "type": "commonjs",
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "repository": {
@@ -94143,9 +94143,9 @@ var init_get_default_config = __esm({
94143
94143
  let repository = "https://github.com/storm-software/storm-ops";
94144
94144
  let license = DEFAULT_STORM_CONFIG.license;
94145
94145
  let homepage = DEFAULT_STORM_CONFIG.homepage;
94146
- const workspaceRoot3 = findWorkspaceRoot(root);
94147
- if ((0, import_node_fs10.existsSync)((0, import_node_path11.join)(workspaceRoot3, "package.json"))) {
94148
- const file = (0, import_node_fs10.readFileSync)((0, import_node_path11.join)(workspaceRoot3, "package.json"), {
94146
+ const workspaceRoot2 = findWorkspaceRoot(root);
94147
+ if ((0, import_node_fs10.existsSync)((0, import_node_path11.join)(workspaceRoot2, "package.json"))) {
94148
+ const file = (0, import_node_fs10.readFileSync)((0, import_node_path11.join)(workspaceRoot2, "package.json"), {
94149
94149
  encoding: "utf-8"
94150
94150
  });
94151
94151
  if (file) {
@@ -94178,7 +94178,7 @@ var init_get_default_config = __esm({
94178
94178
  return ret;
94179
94179
  }, {}),
94180
94180
  colors: { ...DEFAULT_COLOR_CONFIG, ...config.colors },
94181
- workspaceRoot: workspaceRoot3,
94181
+ workspaceRoot: workspaceRoot2,
94182
94182
  name,
94183
94183
  namespace,
94184
94184
  repository,
@@ -95024,14 +95024,14 @@ var init_create_storm_config = __esm({
95024
95024
  init_get_default_config();
95025
95025
  _extension_cache = /* @__PURE__ */ new WeakMap();
95026
95026
  _static_cache = void 0;
95027
- createConfig = (workspaceRoot3) => {
95028
- return createStormConfig(void 0, void 0, workspaceRoot3);
95027
+ createConfig = (workspaceRoot2) => {
95028
+ return createStormConfig(void 0, void 0, workspaceRoot2);
95029
95029
  };
95030
- createStormConfig = (extensionName, schema, workspaceRoot3) => {
95030
+ createStormConfig = (extensionName, schema, workspaceRoot2) => {
95031
95031
  let result;
95032
95032
  if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 3e4) {
95033
95033
  const config = getConfigEnv();
95034
- const defaultConfig = getDefaultConfig(config, workspaceRoot3);
95034
+ const defaultConfig = getDefaultConfig(config, workspaceRoot2);
95035
95035
  result = StormConfigSchema.parse({
95036
95036
  ...defaultConfig,
95037
95037
  ...config,
@@ -95040,7 +95040,7 @@ var init_create_storm_config = __esm({
95040
95040
  ...config.colors
95041
95041
  }
95042
95042
  });
95043
- result.workspaceRoot ??= defaultConfig.workspaceRoot ? defaultConfig.workspaceRoot : findWorkspaceRoot(workspaceRoot3);
95043
+ result.workspaceRoot ??= defaultConfig.workspaceRoot ? defaultConfig.workspaceRoot : findWorkspaceRoot(workspaceRoot2);
95044
95044
  } else {
95045
95045
  result = _static_cache.data;
95046
95046
  }
@@ -95068,7 +95068,7 @@ var init_create_storm_config = __esm({
95068
95068
  _extension_cache.set(extension_cache_key, extension);
95069
95069
  return extension;
95070
95070
  };
95071
- loadStormConfig = async (workspaceRoot3) => {
95071
+ loadStormConfig = async (workspaceRoot2) => {
95072
95072
  let config = {};
95073
95073
  if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
95074
95074
  writeInfo(
@@ -95077,7 +95077,7 @@ var init_create_storm_config = __esm({
95077
95077
  );
95078
95078
  return _static_cache.data;
95079
95079
  }
95080
- let _workspaceRoot = workspaceRoot3;
95080
+ let _workspaceRoot = workspaceRoot2;
95081
95081
  if (!_workspaceRoot) {
95082
95082
  _workspaceRoot = findWorkspaceRoot();
95083
95083
  }
@@ -200339,22 +200339,22 @@ var withRunExecutor = (name, executorFn, executorOptions = {}) => async (_option
200339
200339
  "The Build process failed because the context is not valid. Please run this command from a workspace."
200340
200340
  );
200341
200341
  }
200342
- const workspaceRoot3 = findWorkspaceRoot2();
200343
- const projectRoot = context.projectsConfigurations.projects[context.projectName]?.root ?? workspaceRoot3;
200344
- const sourceRoot = context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? workspaceRoot3;
200342
+ const workspaceRoot2 = findWorkspaceRoot2();
200343
+ const projectRoot = context.projectsConfigurations.projects[context.projectName]?.root ?? workspaceRoot2;
200344
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? workspaceRoot2;
200345
200345
  const projectName = context.projectsConfigurations.projects[context.projectName]?.name ?? context.projectName;
200346
- config.workspaceRoot = workspaceRoot3;
200346
+ config.workspaceRoot = workspaceRoot2;
200347
200347
  if (!executorOptions.skipReadingConfig) {
200348
200348
  writeDebug2(
200349
200349
  `Loading the Storm Config from environment variables and storm.config.js file...
200350
- - workspaceRoot: ${workspaceRoot3}
200350
+ - workspaceRoot: ${workspaceRoot2}
200351
200351
  - projectRoot: ${projectRoot}
200352
200352
  - sourceRoot: ${sourceRoot}
200353
200353
  - projectName: ${projectName}
200354
200354
  `,
200355
200355
  config
200356
200356
  );
200357
- config = await loadStormConfig2(workspaceRoot3);
200357
+ config = await loadStormConfig2(workspaceRoot2);
200358
200358
  }
200359
200359
  if (executorOptions?.hooks?.applyDefaultOptions) {
200360
200360
  writeDebug2("Running the applyDefaultOptions hook...", config);
@@ -200374,7 +200374,7 @@ ${Object.keys(options).map(
200374
200374
  options,
200375
200375
  {
200376
200376
  config,
200377
- workspaceRoot: workspaceRoot3,
200377
+ workspaceRoot: workspaceRoot2,
200378
200378
  projectRoot,
200379
200379
  sourceRoot,
200380
200380
  projectName,
@@ -201916,7 +201916,7 @@ var import_devkit = require("@nx/devkit");
201916
201916
  var import_js = require("@nx/js");
201917
201917
  var import_node_fs11 = require("node:fs");
201918
201918
  var import_node_path12 = require("node:path");
201919
- function normalizeOptions(projectRoot, sourceRoot, options) {
201919
+ function normalizeOptions(projectRoot, sourceRoot, options, config) {
201920
201920
  if (global.NX_GRAPH_CREATION)
201921
201921
  return options;
201922
201922
  normalizeRelativePaths(projectRoot, options);
@@ -201936,7 +201936,10 @@ function normalizeOptions(projectRoot, sourceRoot, options) {
201936
201936
  generateExportsField: options.generateExportsField ?? false,
201937
201937
  javascriptEnabled: options.javascriptEnabled ?? false,
201938
201938
  skipTypeCheck: options.skipTypeCheck ?? false,
201939
- skipTypeField: options.skipTypeField ?? false
201939
+ skipTypeField: options.skipTypeField ?? false,
201940
+ projectRoot,
201941
+ sourceRoot,
201942
+ config
201940
201943
  };
201941
201944
  }
201942
201945
  function normalizeAssets(assets, root, sourceRoot) {
@@ -202027,12 +202030,14 @@ function analyze() {
202027
202030
  }
202028
202031
  };
202029
202032
  }
202030
- async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, config) {
202033
+ async function withRollupConfig(rawOptions, rollupConfig = {}, config, dependencies) {
202031
202034
  const { writeWarning: writeWarning2, correctPaths: correctPaths2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
202032
202035
  const ts = (0, import_ensure_typescript.ensureTypescript)();
202033
202036
  const finalConfig = { ...rollupConfig };
202034
202037
  const projectNode = getProjectNode();
202035
- const projectRoot = correctPaths2((0, import_node_path13.join)(import_devkit2.workspaceRoot, projectNode.data.root));
202038
+ const projectRoot = correctPaths2(
202039
+ (0, import_node_path13.join)(config.workspaceRoot, projectNode.data.root)
202040
+ );
202036
202041
  const projectGraph = global.NX_GRAPH_CREATION ? null : (0, import_devkit2.readCachedProjectGraph)();
202037
202042
  if (!projectGraph) {
202038
202043
  throw new Error(`Cannot find project graph.`);
@@ -202051,7 +202056,7 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202051
202056
  const result = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(
202052
202057
  void 0,
202053
202058
  projectGraph,
202054
- import_devkit2.workspaceRoot,
202059
+ config.workspaceRoot,
202055
202060
  projectNode.name,
202056
202061
  process.env.NX_TASK_TARGET_TARGET,
202057
202062
  process.env.NX_TASK_TARGET_CONFIGURATION,
@@ -202065,13 +202070,16 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202065
202070
  const options = normalizeOptions(
202066
202071
  projectNode.data.root,
202067
202072
  projectNode.data.sourceRoot,
202068
- rawOptions
202073
+ rawOptions,
202074
+ config
202075
+ );
202076
+ const tsConfigPath = correctPaths2(
202077
+ (0, import_node_path13.join)(config.workspaceRoot, options.tsConfig)
202069
202078
  );
202070
- const tsConfigPath = correctPaths2((0, import_node_path13.join)(import_devkit2.workspaceRoot, options.tsConfig));
202071
202079
  const tsConfigFile = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
202072
202080
  const tsConfigInclude = [
202073
202081
  ...tsConfigFile.config?.include && Array.isArray(tsConfigFile.config.include) ? tsConfigFile.config.include : [],
202074
- (0, import_node_path13.join)(import_devkit2.workspaceRoot, "node_modules/typescript/lib/*.d.ts")
202082
+ (0, import_node_path13.join)(config.workspaceRoot, "node_modules/typescript/lib/*.d.ts")
202075
202083
  ];
202076
202084
  const tsConfig = ts.parseJsonConfigFileContent(
202077
202085
  {
@@ -202090,7 +202098,7 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202090
202098
  config
202091
202099
  );
202092
202100
  }
202093
- finalConfig.input = rollupConfig.input || createInput(options);
202101
+ finalConfig.input = rollupConfig.input || await createInput(options);
202094
202102
  if (options.format) {
202095
202103
  if (Array.isArray(rollupConfig.output)) {
202096
202104
  throw new Error(
@@ -202114,13 +202122,13 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202114
202122
  // Options are not normalized with project root during graph creation due to the lack of project and project root.
202115
202123
  // Cannot be joined with workspace root now, but will be handled by @nx/rollup/plugin.
202116
202124
  options.outputPath
202117
- ) : correctPaths2((0, import_node_path13.join)(import_devkit2.workspaceRoot, options.outputPath)),
202125
+ ) : correctPaths2((0, import_node_path13.join)(config.workspaceRoot, options.outputPath)),
202118
202126
  sourcemap: options.sourceMap
202119
202127
  }));
202120
202128
  }
202121
202129
  let packageJson = {};
202122
202130
  if (!global.NX_GRAPH_CREATION) {
202123
- const packageJsonPath = options.project ? (0, import_node_path13.join)(import_devkit2.workspaceRoot, options.project) : (0, import_node_path13.join)(projectRoot, "package.json");
202131
+ const packageJsonPath = options.project ? (0, import_node_path13.join)(config.workspaceRoot, options.project) : (0, import_node_path13.join)(projectRoot, "package.json");
202124
202132
  if (!(0, import_node_fs12.existsSync)(packageJsonPath)) {
202125
202133
  throw new Error(`Cannot find ${packageJsonPath}.`);
202126
202134
  }
@@ -202166,7 +202174,8 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202166
202174
  copy({
202167
202175
  targets: convertCopyAssetsToRollupOptions(
202168
202176
  options.outputPath,
202169
- options.assets
202177
+ options.assets,
202178
+ config.workspaceRoot
202170
202179
  )
202171
202180
  }),
202172
202181
  image(),
@@ -202176,7 +202185,7 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202176
202185
  extensions: fileExtensions
202177
202186
  }),
202178
202187
  require_rollup_plugin_typescript2_cjs()({
202179
- cwd: correctPaths2(import_devkit2.workspaceRoot),
202188
+ cwd: correctPaths2(config.workspaceRoot),
202180
202189
  check: !options.skipTypeCheck,
202181
202190
  typescript: ts,
202182
202191
  tsconfig: options.tsConfig,
@@ -202214,7 +202223,7 @@ async function withRollupConfig(rawOptions, rollupConfig = {}, dependencies, con
202214
202223
  },
202215
202224
  cwd: correctPaths2(
202216
202225
  (0, import_node_path13.join)(
202217
- import_devkit2.workspaceRoot,
202226
+ config.workspaceRoot,
202218
202227
  projectNode.data.sourceRoot ?? projectNode.data.root
202219
202228
  )
202220
202229
  ),
@@ -202250,15 +202259,34 @@ function convertRpts2LogLevel(logLevel) {
202250
202259
  return 0;
202251
202260
  }
202252
202261
  }
202253
- function createInput(options) {
202262
+ async function createInput(options) {
202263
+ const { correctPaths: correctPaths2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
202254
202264
  if (global.NX_GRAPH_CREATION) return {};
202255
202265
  const mainEntryFileName = options.outputFileName || options.main;
202256
202266
  const input = {};
202257
- input[(0, import_node_path13.parse)(mainEntryFileName).name] = (0, import_node_path13.join)(import_devkit2.workspaceRoot, options.main);
202267
+ input[(0, import_node_path13.parse)(mainEntryFileName).name] = (0, import_node_path13.join)(
202268
+ options.config.workspaceRoot,
202269
+ options.main
202270
+ );
202258
202271
  options.additionalEntryPoints?.forEach((entry) => {
202259
- input[(0, import_node_path13.parse)(entry).name] = (0, import_node_path13.join)(import_devkit2.workspaceRoot, entry);
202272
+ const entryPoint = correctPaths2((0, import_node_path13.join)(options.config.workspaceRoot, entry));
202273
+ let entryName = entryPoint.includes(
202274
+ options.sourceRoot.replaceAll("\\", "/")
202275
+ ) ? entryPoint.replace(options.sourceRoot.replaceAll("\\", "/"), "") : entryPoint.replace(
202276
+ options.config.workspaceRoot.replaceAll("\\", "/"),
202277
+ ""
202278
+ );
202279
+ if (entryName.startsWith("/")) {
202280
+ entryName = entryName.slice(1);
202281
+ }
202282
+ input[entryName] = entryPoint;
202260
202283
  });
202261
- return input;
202284
+ return Object.keys(input).reduce((ret, key) => {
202285
+ if (key.endsWith("/index.ts") && input[key]) {
202286
+ ret[key.replace("/index.ts", "")] = input[key];
202287
+ }
202288
+ return ret;
202289
+ }, input);
202262
202290
  }
202263
202291
  async function createTsCompilerOptions(parsedCommandLine, options, dependencies, config) {
202264
202292
  const { correctPaths: correctPaths2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
@@ -202286,10 +202314,10 @@ async function createTsCompilerOptions(parsedCommandLine, options, dependencies,
202286
202314
  }
202287
202315
  return compilerOptions;
202288
202316
  }
202289
- function convertCopyAssetsToRollupOptions(outputPath, assets) {
202317
+ function convertCopyAssetsToRollupOptions(outputPath, assets, workspaceRoot2) {
202290
202318
  return assets ? assets.map((a2) => ({
202291
202319
  src: (0, import_node_path13.join)(a2.input, a2.glob).replace(/\\/g, "/"),
202292
- dest: (0, import_node_path13.join)(import_devkit2.workspaceRoot, outputPath, a2.output).replace(/\\/g, "/")
202320
+ dest: (0, import_node_path13.join)(workspaceRoot2, outputPath, a2.output).replace(/\\/g, "/")
202293
202321
  })) : [];
202294
202322
  }
202295
202323
  function readCompatibleFormats(config) {
@@ -202318,7 +202346,7 @@ async function* rollupExecutorFn(options, context, config) {
202318
202346
  if (!context?.projectName || !context?.projectsConfigurations?.projects?.[context.projectName]?.root) {
202319
202347
  throw new Error("Nx executor context was invalid");
202320
202348
  }
202321
- const workspaceRoot3 = findWorkspaceRoot2();
202349
+ const workspaceRoot2 = findWorkspaceRoot2();
202322
202350
  const projectRoot = context?.projectsConfigurations?.projects[context.projectName]?.root;
202323
202351
  const sourceRoot = context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? projectRoot;
202324
202352
  if (options.clean !== false) {
@@ -202348,7 +202376,7 @@ async function* rollupExecutorFn(options, context, config) {
202348
202376
  const files = await new Glob("**/*.{ts,mts,cts,tsx}", {
202349
202377
  absolute: true,
202350
202378
  cwd: sourceRoot,
202351
- root: workspaceRoot3
202379
+ root: workspaceRoot2
202352
202380
  }).walk();
202353
202381
  options.additionalEntryPoints = files.reduce(
202354
202382
  (ret, file) => {
@@ -202359,10 +202387,10 @@ async function* rollupExecutorFn(options, context, config) {
202359
202387
  return ret;
202360
202388
  },
202361
202389
  options.additionalEntryPoints?.map(
202362
- (entry) => correctPaths2((0, import_path5.join)(workspaceRoot3, entry))
202390
+ (entry) => correctPaths2((0, import_path5.join)(workspaceRoot2, entry))
202363
202391
  ) ?? []
202364
202392
  ).map((entry) => {
202365
- const formatted = entry.replace(workspaceRoot3, "");
202393
+ const formatted = entry.replace(workspaceRoot2, "");
202366
202394
  return formatted.startsWith("/") ? formatted.slice(1) : formatted;
202367
202395
  });
202368
202396
  }
@@ -202474,8 +202502,8 @@ async function createRollupOptions(options, context, config) {
202474
202502
  const rollupConfig = await withRollupConfig(
202475
202503
  options,
202476
202504
  {},
202477
- dependencies,
202478
- config
202505
+ config,
202506
+ dependencies
202479
202507
  );
202480
202508
  const generatePackageJsonPlugin = Array.isArray(rollupConfig.plugins) ? rollupConfig.plugins.find(
202481
202509
  (p2) => p2?.["name"] === import_generate_package_json2.pluginName
@@ -2,4 +2,4 @@ import { DependentBuildableProjectNode } from "@nx/js/src/utils/buildable-libs-u
2
2
  import { StormConfig } from "@storm-software/config";
3
3
  import * as rollup from "rollup";
4
4
  import { RollupWithNxPluginOptions } from "./normalize-options";
5
- export declare function withRollupConfig(rawOptions: RollupWithNxPluginOptions, rollupConfig?: rollup.RollupOptions, dependencies?: DependentBuildableProjectNode[], config?: StormConfig): Promise<rollup.RollupOptions>;
5
+ export declare function withRollupConfig(rawOptions: RollupWithNxPluginOptions, rollupConfig: rollup.RollupOptions | undefined, config: StormConfig, dependencies: DependentBuildableProjectNode[]): Promise<rollup.RollupOptions>;
@@ -1,3 +1,4 @@
1
+ import { StormConfig } from "@storm-software/config";
1
2
  export interface RollupWithNxPluginOptions {
2
3
  /**
3
4
  * Additional entry-points to add to exports field in the package.json file.
@@ -87,5 +88,8 @@ export interface NormalizedRollupWithNxPluginOptions extends RollupWithNxPluginO
87
88
  assets: AssetGlobPattern[];
88
89
  compiler: "babel" | "tsc" | "swc";
89
90
  format: ("cjs" | "esm")[];
91
+ projectRoot: string;
92
+ sourceRoot: string;
93
+ config: StormConfig;
90
94
  }
91
- export declare function normalizeOptions(projectRoot: string, sourceRoot: string, options: RollupWithNxPluginOptions): NormalizedRollupWithNxPluginOptions;
95
+ export declare function normalizeOptions(projectRoot: string, sourceRoot: string, options: RollupWithNxPluginOptions, config: StormConfig): NormalizedRollupWithNxPluginOptions;