@storm-software/workspace-tools 1.30.8 → 1.30.10

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.30.8",
3
+ "version": "1.30.10",
4
4
  "private": false,
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "keywords": [
@@ -60929,7 +60929,7 @@ var require_Options_gen_types = __commonJS({
60929
60929
  compiledFilename: "string"
60930
60930
  });
60931
60931
  exports.SourceMapOptions = SourceMapOptions;
60932
- var Options3 = t.iface([], {
60932
+ var Options2 = t.iface([], {
60933
60933
  transforms: t.array("Transform"),
60934
60934
  disableESTransforms: t.opt("boolean"),
60935
60935
  jsxRuntime: t.opt(t.union(t.lit("classic"), t.lit("automatic"), t.lit("preserve"))),
@@ -60945,7 +60945,7 @@ var require_Options_gen_types = __commonJS({
60945
60945
  sourceMapOptions: t.opt("SourceMapOptions"),
60946
60946
  filePath: t.opt("string")
60947
60947
  });
60948
- exports.Options = Options3;
60948
+ exports.Options = Options2;
60949
60949
  var exportedTypeSuite = {
60950
60950
  Transform: exports.Transform,
60951
60951
  SourceMapOptions: exports.SourceMapOptions,
@@ -112784,7 +112784,7 @@ glob.glob = glob;
112784
112784
  var import_fileutils = require("nx/src/utils/fileutils");
112785
112785
  var import_path3 = require("path");
112786
112786
  var import_prettier = require("prettier");
112787
- var import_tsup2 = __toESM(require_dist5());
112787
+ var import_tsup = __toESM(require_dist5());
112788
112788
  var ts = __toESM(require("typescript"));
112789
112789
 
112790
112790
  // packages/config-tools/src/config-file/get-config-file.ts
@@ -116959,7 +116959,6 @@ function getExternalDependencies(projectName, graph) {
116959
116959
 
116960
116960
  // packages/workspace-tools/src/executors/tsup/get-config.ts
116961
116961
  var import_devkit = __toESM(require_devkit());
116962
- var import_tsup = __toESM(require_dist5());
116963
116962
  function modernConfig({
116964
116963
  entry,
116965
116964
  outDir,
@@ -116996,7 +116995,7 @@ function modernConfig({
116996
116995
  "ios15",
116997
116996
  "opera77",
116998
116997
  "esnext"
116999
- ] : ["esnext", "node18"],
116998
+ ] : ["esnext", "node"],
117000
116999
  tsconfig,
117001
117000
  splitting,
117002
117001
  generatePackageJson,
@@ -117113,139 +117112,21 @@ function legacyConfig({
117113
117112
  outExtension
117114
117113
  };
117115
117114
  }
117116
- function workerConfig({
117117
- entry,
117118
- outDir,
117119
- projectRoot,
117120
- workspaceRoot,
117121
- tsconfig = "tsconfig.json",
117122
- splitting,
117123
- treeshake,
117124
- debug = false,
117125
- external,
117126
- banner = {},
117127
- verbose = false,
117128
- apiReport = true,
117129
- docModel = true,
117130
- tsdocMetadata = true,
117131
- shims = true,
117132
- define: define2,
117133
- env,
117134
- plugins,
117135
- generatePackageJson,
117136
- dtsTsConfig
117137
- }) {
117138
- let outputPath = (0, import_devkit.joinPathFragments)(outDir, "dist");
117139
- return {
117140
- name: "worker",
117141
- entry,
117142
- format: ["esm"],
117143
- target: ["chrome95"],
117144
- bundle: true,
117145
- tsconfig,
117146
- splitting,
117147
- generatePackageJson,
117148
- treeshake: treeshake ? {
117149
- preset: "recommended"
117150
- } : false,
117151
- projectRoot,
117152
- workspaceRoot,
117153
- outDir: outputPath,
117154
- silent: !verbose,
117155
- metafile: true,
117156
- shims,
117157
- external,
117158
- platform: "browser",
117159
- banner,
117160
- define: define2,
117161
- env,
117162
- dts: false,
117163
- experimentalDts: {
117164
- entry,
117165
- compilerOptions: {
117166
- ...dtsTsConfig,
117167
- options: {
117168
- ...dtsTsConfig.options,
117169
- outDir: outputPath
117170
- }
117171
- }
117172
- },
117173
- minify: debug ? false : "terser",
117174
- terserOptions: {
117175
- compress: true,
117176
- ecma: 2020,
117177
- keep_classnames: true,
117178
- keep_fnames: true
117179
- },
117180
- apiReport,
117181
- docModel,
117182
- tsdocMetadata,
117183
- sourcemap: debug,
117184
- clean: false,
117185
- tsconfigDecoratorMetadata: true,
117186
- plugins,
117187
- outExtension
117188
- };
117189
- }
117190
- function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117115
+ function getConfig(workspaceRoot, projectRoot, getConfigFn, {
117191
117116
  outputPath,
117192
117117
  tsConfig,
117193
117118
  additionalEntryPoints,
117194
117119
  platform,
117195
- emitOnAll = true,
117196
117120
  ...rest
117197
117121
  }) {
117198
- const entryPoints = [];
117199
- if (rest.entry) {
117200
- entryPoints.push(rest.entry);
117201
- }
117202
- if (emitOnAll !== false) {
117203
- entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117204
- }
117205
- if (additionalEntryPoints) {
117206
- entryPoints.push(...additionalEntryPoints);
117207
- }
117208
- const entry = globSync(entryPoints, {
117209
- withFileTypes: true
117210
- }).reduce((ret, filePath) => {
117211
- let formattedPath = workspaceRoot.replaceAll("\\", "/");
117212
- if (formattedPath.toUpperCase().startsWith("C:")) {
117213
- formattedPath = formattedPath.substring(2);
117214
- }
117215
- let propertyKey = (0, import_devkit.joinPathFragments)(
117216
- filePath.path,
117217
- removeExtension(filePath.name)
117218
- ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117219
- if (propertyKey) {
117220
- while (propertyKey.startsWith("/")) {
117221
- propertyKey = propertyKey.substring(1);
117222
- }
117223
- console.debug(
117224
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit.joinPathFragments)(
117225
- filePath.path,
117226
- filePath.name
117227
- )}"`
117228
- );
117229
- if (!(propertyKey in ret)) {
117230
- ret[propertyKey] = (0, import_devkit.joinPathFragments)(filePath.path, filePath.name);
117231
- }
117232
- }
117233
- return ret;
117234
- }, {});
117235
- const params = {
117122
+ return getConfigFn({
117236
117123
  ...rest,
117237
- entry,
117238
117124
  outDir: outputPath,
117239
117125
  tsconfig: tsConfig,
117240
117126
  workspaceRoot,
117241
117127
  projectRoot,
117242
- sourceRoot,
117243
117128
  platform
117244
- };
117245
- if (platform === "worker") {
117246
- return (0, import_tsup.defineConfig)(workerConfig(params));
117247
- }
117248
- return (0, import_tsup.defineConfig)([modernConfig(params), legacyConfig(params)]);
117129
+ });
117249
117130
  }
117250
117131
  var outExtension = ({ format: format2 }) => {
117251
117132
  let jsExtension = ".js";
@@ -117402,20 +117283,57 @@ ${externalDependencies.map((dep) => {
117402
117283
  arrowParens: "avoid",
117403
117284
  endOfLine: "lf"
117404
117285
  };
117286
+ const entryPoints = [];
117287
+ if (options.entry) {
117288
+ entryPoints.push(options.entry);
117289
+ }
117290
+ if (options.emitOnAll !== false) {
117291
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117292
+ }
117293
+ if (options.additionalEntryPoints) {
117294
+ entryPoints.push(...options.additionalEntryPoints);
117295
+ }
117296
+ const entry = globSync(entryPoints, {
117297
+ withFileTypes: true
117298
+ }).reduce((ret, filePath) => {
117299
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
117300
+ if (formattedPath.toUpperCase().startsWith("C:")) {
117301
+ formattedPath = formattedPath.substring(2);
117302
+ }
117303
+ let propertyKey = (0, import_devkit2.joinPathFragments)(
117304
+ filePath.path,
117305
+ removeExtension(filePath.name)
117306
+ ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117307
+ if (propertyKey) {
117308
+ while (propertyKey.startsWith("/")) {
117309
+ propertyKey = propertyKey.substring(1);
117310
+ }
117311
+ console.debug(
117312
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
117313
+ filePath.path,
117314
+ filePath.name
117315
+ )}"`
117316
+ );
117317
+ if (!(propertyKey in ret)) {
117318
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
117319
+ }
117320
+ }
117321
+ return ret;
117322
+ }, {});
117405
117323
  if (options.generatePackageJson !== false) {
117406
117324
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117407
117325
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117408
117326
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117409
117327
  delete packageJson.dependencies;
117410
- externalDependencies.forEach((entry) => {
117411
- const packageConfig = entry.node.data;
117412
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry.node.name]?.type === "npm")) {
117328
+ externalDependencies.forEach((externalDependency) => {
117329
+ const packageConfig = externalDependency.node.data;
117330
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
117413
117331
  const { packageName, version } = packageConfig;
117414
117332
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117415
117333
  return;
117416
117334
  }
117417
117335
  packageJson.dependencies ??= {};
117418
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117336
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
117419
117337
  }
117420
117338
  });
117421
117339
  internalDependencies.forEach((packageName) => {
@@ -117437,20 +117355,6 @@ ${externalDependencies.map((dep) => {
117437
117355
  types: "./dist/modern/index.d.ts",
117438
117356
  default: "./dist/modern/index.js"
117439
117357
  },
117440
- "./*": {
117441
- "import": {
117442
- types: "./dist/modern/index.d.ts",
117443
- default: "./dist/modern/**/*.js"
117444
- },
117445
- require: {
117446
- types: "./dist/modern/index.d.cts",
117447
- default: "./dist/modern/**/*.cjs"
117448
- },
117449
- "default": {
117450
- types: "./dist/modern/index.d.ts",
117451
- default: "./dist/modern/**/*.js"
117452
- }
117453
- },
117454
117358
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117455
117359
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117456
117360
  types: (0, import_path3.join)(
@@ -117466,6 +117370,30 @@ ${externalDependencies.map((dep) => {
117466
117370
  },
117467
117371
  "./package.json": "./package.json"
117468
117372
  };
117373
+ packageJson.exports = Object.keys(entry).reduce(
117374
+ (ret, key) => {
117375
+ let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
117376
+ packageJsonKey = packageJsonKey.replaceAll("/index", "");
117377
+ if (!ret[packageJsonKey]) {
117378
+ ret[packageJsonKey] = {
117379
+ import: {
117380
+ types: `./dist/modern/${key}.d.ts`,
117381
+ default: `./dist/modern/${key}.js`
117382
+ },
117383
+ require: {
117384
+ types: `./dist/modern/${key}.d.cts`,
117385
+ default: `./dist/modern/${key}.cjs`
117386
+ },
117387
+ default: {
117388
+ types: `./dist/modern/${key}.d.ts`,
117389
+ default: `./dist/modern/${key}.js`
117390
+ }
117391
+ };
117392
+ }
117393
+ return ret;
117394
+ },
117395
+ packageJson.exports
117396
+ );
117469
117397
  packageJson.funding ??= workspacePackageJson.funding;
117470
117398
  packageJson.types ??= "dist/legacy/index.d.ts";
117471
117399
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117552,45 +117480,57 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117552
117480
  })
117553
117481
  );
117554
117482
  options.plugins.push(environmentPlugin(stormEnv));
117555
- const config = getConfig(context.root, projectRoot, sourceRoot, {
117556
- ...options,
117557
- define: {
117558
- __STORM_CONFIG: JSON.stringify(stormEnv)
117559
- },
117560
- env: {
117561
- __STORM_CONFIG: JSON.stringify(stormEnv),
117562
- ...stormEnv
117563
- },
117564
- dtsTsConfig: getNormalizedTsConfig(
117565
- context.root,
117566
- options.outputPath,
117567
- (0, import_tsc.createTypeScriptCompilationOptions)(
117568
- (0, import_normalize_options.normalizeOptions)(
117569
- {
117570
- ...options,
117571
- watch: false,
117572
- main: options.entry,
117573
- transformers: []
117574
- },
117483
+ const config = (0, import_tsup.defineConfig)([
117484
+ ...Object.keys(entry).reduce((ret, key) => {
117485
+ const getConfigOptions = {
117486
+ ...options,
117487
+ define: {
117488
+ __STORM_CONFIG: JSON.stringify(stormEnv)
117489
+ },
117490
+ env: {
117491
+ __STORM_CONFIG: JSON.stringify(stormEnv),
117492
+ ...stormEnv
117493
+ },
117494
+ dtsTsConfig: getNormalizedTsConfig(
117575
117495
  context.root,
117576
- sourceRoot,
117577
- workspaceRoot
117496
+ options.outputPath,
117497
+ (0, import_tsc.createTypeScriptCompilationOptions)(
117498
+ (0, import_normalize_options.normalizeOptions)(
117499
+ {
117500
+ ...options,
117501
+ watch: false,
117502
+ main: entry[key],
117503
+ transformers: []
117504
+ },
117505
+ context.root,
117506
+ sourceRoot,
117507
+ workspaceRoot
117508
+ ),
117509
+ context
117510
+ )
117578
117511
  ),
117579
- context
117580
- )
117581
- ),
117582
- banner: options.banner ? {
117583
- js: `${options.banner}
117512
+ banner: options.banner ? {
117513
+ js: `${options.banner}
117584
117514
 
117585
117515
  `,
117586
- css: `/*
117516
+ css: `/*
117587
117517
  ${options.banner}
117588
117518
  */
117589
117519
 
117590
117520
  `
117591
- } : void 0,
117592
- outputPath: options.outputPath
117593
- });
117521
+ } : void 0,
117522
+ outputPath: options.outputPath,
117523
+ entry: entry[key]
117524
+ };
117525
+ ret.push(
117526
+ getConfig(context.root, projectRoot, legacyConfig, getConfigOptions)
117527
+ );
117528
+ ret.push(
117529
+ getConfig(context.root, projectRoot, modernConfig, getConfigOptions)
117530
+ );
117531
+ return ret;
117532
+ }, [])
117533
+ ]);
117594
117534
  if (typeof config === "function") {
117595
117535
  await build(await Promise.resolve(config({})));
117596
117536
  } else {
@@ -117640,9 +117580,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117640
117580
  var build = async (options) => {
117641
117581
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117642
117582
  if (Array.isArray(options)) {
117643
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117583
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117644
117584
  } else {
117645
- await (0, import_tsup2.build)(options);
117585
+ await (0, import_tsup.build)(options);
117646
117586
  }
117647
117587
  };
117648
117588
  var isPrimitive = (value) => {