@storm-software/workspace-tools 1.30.7 → 1.30.9

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.7",
3
+ "version": "1.30.9",
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,
@@ -117042,152 +117041,7 @@ function modernConfig({
117042
117041
  outExtension
117043
117042
  };
117044
117043
  }
117045
- function legacyConfig({
117046
- entry,
117047
- outDir,
117048
- projectRoot,
117049
- workspaceRoot,
117050
- tsconfig = "tsconfig.json",
117051
- splitting,
117052
- treeshake,
117053
- debug = false,
117054
- external,
117055
- banner = {},
117056
- platform = "neutral",
117057
- verbose = false,
117058
- shims = true,
117059
- define: define2,
117060
- env,
117061
- plugins,
117062
- generatePackageJson,
117063
- dtsTsConfig
117064
- }) {
117065
- let outputPath = (0, import_devkit.joinPathFragments)(outDir, "dist", "legacy");
117066
- return {
117067
- name: "legacy",
117068
- entry,
117069
- format: platform !== "node" ? ["cjs", "esm", "iife"] : ["cjs", "esm"],
117070
- target: ["es2022", "node18"],
117071
- tsconfig,
117072
- splitting,
117073
- generatePackageJson,
117074
- treeshake: treeshake ? {
117075
- preset: "recommended"
117076
- } : false,
117077
- projectRoot,
117078
- workspaceRoot,
117079
- outDir: outputPath,
117080
- silent: !verbose,
117081
- metafile: true,
117082
- shims,
117083
- external,
117084
- platform,
117085
- banner,
117086
- define: define2,
117087
- env,
117088
- dts: false,
117089
- experimentalDts: {
117090
- entry,
117091
- compilerOptions: {
117092
- ...dtsTsConfig,
117093
- options: {
117094
- ...dtsTsConfig.options,
117095
- outDir: outputPath
117096
- }
117097
- }
117098
- },
117099
- /*minify: debug ? false : "terser",
117100
- terserOptions: {
117101
- compress: true,
117102
- ecma: 2020,
117103
- keep_classnames: true,
117104
- keep_fnames: true
117105
- },*/
117106
- apiReport: false,
117107
- docModel: false,
117108
- tsdocMetadata: false,
117109
- sourcemap: debug,
117110
- clean: false,
117111
- tsconfigDecoratorMetadata: true,
117112
- plugins,
117113
- outExtension
117114
- };
117115
- }
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, {
117044
+ function getConfig(workspaceRoot, projectRoot, getConfigFn, {
117191
117045
  outputPath,
117192
117046
  tsConfig,
117193
117047
  additionalEntryPoints,
@@ -117195,53 +117049,14 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117195
117049
  emitOnAll = true,
117196
117050
  ...rest
117197
117051
  }) {
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 propertyKey = (0, import_devkit.joinPathFragments)(
117212
- filePath.path,
117213
- removeExtension(filePath.name)
117214
- ).replaceAll("\\", "/").replaceAll(workspaceRoot.substring(2).replaceAll("\\", "/"), "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117215
- if (propertyKey) {
117216
- while (propertyKey.startsWith("/")) {
117217
- propertyKey = propertyKey.substring(1);
117218
- }
117219
- console.debug(
117220
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit.joinPathFragments)(
117221
- filePath.path,
117222
- filePath.name
117223
- )}"`
117224
- );
117225
- if (!(propertyKey in ret)) {
117226
- ret[propertyKey] = (0, import_devkit.joinPathFragments)(filePath.path, filePath.name);
117227
- }
117228
- }
117229
- return ret;
117230
- }, {});
117231
- const params = {
117052
+ return getConfigFn({
117232
117053
  ...rest,
117233
- entry,
117234
117054
  outDir: outputPath,
117235
117055
  tsconfig: tsConfig,
117236
117056
  workspaceRoot,
117237
117057
  projectRoot,
117238
- sourceRoot,
117239
117058
  platform
117240
- };
117241
- if (platform === "worker") {
117242
- return (0, import_tsup.defineConfig)(workerConfig(params));
117243
- }
117244
- return (0, import_tsup.defineConfig)([modernConfig(params), legacyConfig(params)]);
117059
+ });
117245
117060
  }
117246
117061
  var outExtension = ({ format: format2 }) => {
117247
117062
  let jsExtension = ".js";
@@ -117398,20 +117213,57 @@ ${externalDependencies.map((dep) => {
117398
117213
  arrowParens: "avoid",
117399
117214
  endOfLine: "lf"
117400
117215
  };
117216
+ const entryPoints = [];
117217
+ if (options.entry) {
117218
+ entryPoints.push(options.entry);
117219
+ }
117220
+ if (options.emitOnAll !== false) {
117221
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117222
+ }
117223
+ if (options.additionalEntryPoints) {
117224
+ entryPoints.push(...options.additionalEntryPoints);
117225
+ }
117226
+ const entry = globSync(entryPoints, {
117227
+ withFileTypes: true
117228
+ }).reduce((ret, filePath) => {
117229
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
117230
+ if (formattedPath.toUpperCase().startsWith("C:")) {
117231
+ formattedPath = formattedPath.substring(2);
117232
+ }
117233
+ let propertyKey = (0, import_devkit2.joinPathFragments)(
117234
+ filePath.path,
117235
+ removeExtension(filePath.name)
117236
+ ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117237
+ if (propertyKey) {
117238
+ while (propertyKey.startsWith("/")) {
117239
+ propertyKey = propertyKey.substring(1);
117240
+ }
117241
+ console.debug(
117242
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
117243
+ filePath.path,
117244
+ filePath.name
117245
+ )}"`
117246
+ );
117247
+ if (!(propertyKey in ret)) {
117248
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
117249
+ }
117250
+ }
117251
+ return ret;
117252
+ }, {});
117401
117253
  if (options.generatePackageJson !== false) {
117402
117254
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117403
117255
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117404
117256
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117405
117257
  delete packageJson.dependencies;
117406
- externalDependencies.forEach((entry) => {
117407
- const packageConfig = entry.node.data;
117408
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry.node.name]?.type === "npm")) {
117258
+ externalDependencies.forEach((entry2) => {
117259
+ const packageConfig = entry2.node.data;
117260
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry2.node.name]?.type === "npm")) {
117409
117261
  const { packageName, version } = packageConfig;
117410
117262
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117411
117263
  return;
117412
117264
  }
117413
117265
  packageJson.dependencies ??= {};
117414
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117266
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[entry2.node.name] ? "latest" : version;
117415
117267
  }
117416
117268
  });
117417
117269
  internalDependencies.forEach((packageName) => {
@@ -117433,20 +117285,6 @@ ${externalDependencies.map((dep) => {
117433
117285
  types: "./dist/modern/index.d.ts",
117434
117286
  default: "./dist/modern/index.js"
117435
117287
  },
117436
- "./*": {
117437
- "import": {
117438
- types: "./dist/modern/index.d.ts",
117439
- default: "./dist/modern/**/*.js"
117440
- },
117441
- require: {
117442
- types: "./dist/modern/index.d.cts",
117443
- default: "./dist/modern/**/*.cjs"
117444
- },
117445
- "default": {
117446
- types: "./dist/modern/index.d.ts",
117447
- default: "./dist/modern/**/*.js"
117448
- }
117449
- },
117450
117288
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117451
117289
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117452
117290
  types: (0, import_path3.join)(
@@ -117462,6 +117300,29 @@ ${externalDependencies.map((dep) => {
117462
117300
  },
117463
117301
  "./package.json": "./package.json"
117464
117302
  };
117303
+ packageJson.exports = Object.keys(entry).reduce(
117304
+ (ret, key) => {
117305
+ const packageJsonKey = key.startsWith("./") ? key : `./${key}`;
117306
+ if (!ret[packageJsonKey]) {
117307
+ ret[packageJsonKey] = {
117308
+ import: {
117309
+ types: `./dist/modern/${key}.d.ts`,
117310
+ default: `./dist/modern/${key}.js`
117311
+ },
117312
+ require: {
117313
+ types: `./dist/modern/${key}.d.cts`,
117314
+ default: `./dist/modern/${key}.cjs`
117315
+ },
117316
+ default: {
117317
+ types: `./dist/modern/${key}.d.ts`,
117318
+ default: `./dist/modern/${key}.js`
117319
+ }
117320
+ };
117321
+ }
117322
+ return ret;
117323
+ },
117324
+ packageJson.exports
117325
+ );
117465
117326
  packageJson.funding ??= workspacePackageJson.funding;
117466
117327
  packageJson.types ??= "dist/legacy/index.d.ts";
117467
117328
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117548,45 +117409,53 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117548
117409
  })
117549
117410
  );
117550
117411
  options.plugins.push(environmentPlugin(stormEnv));
117551
- const config = getConfig(context.root, projectRoot, sourceRoot, {
117552
- ...options,
117553
- define: {
117554
- __STORM_CONFIG: JSON.stringify(stormEnv)
117555
- },
117556
- env: {
117557
- __STORM_CONFIG: JSON.stringify(stormEnv),
117558
- ...stormEnv
117559
- },
117560
- dtsTsConfig: getNormalizedTsConfig(
117561
- context.root,
117562
- options.outputPath,
117563
- (0, import_tsc.createTypeScriptCompilationOptions)(
117564
- (0, import_normalize_options.normalizeOptions)(
117565
- {
117566
- ...options,
117567
- watch: false,
117568
- main: options.entry,
117569
- transformers: []
117412
+ const config = (0, import_tsup.defineConfig)([
117413
+ ...Object.keys(entry).reduce((ret, key) => {
117414
+ ret.push(
117415
+ getConfig(context.root, projectRoot, modernConfig, {
117416
+ ...options,
117417
+ define: {
117418
+ __STORM_CONFIG: JSON.stringify(stormEnv)
117570
117419
  },
117571
- context.root,
117572
- sourceRoot,
117573
- workspaceRoot
117574
- ),
117575
- context
117576
- )
117577
- ),
117578
- banner: options.banner ? {
117579
- js: `${options.banner}
117420
+ env: {
117421
+ __STORM_CONFIG: JSON.stringify(stormEnv),
117422
+ ...stormEnv
117423
+ },
117424
+ dtsTsConfig: getNormalizedTsConfig(
117425
+ context.root,
117426
+ options.outputPath,
117427
+ (0, import_tsc.createTypeScriptCompilationOptions)(
117428
+ (0, import_normalize_options.normalizeOptions)(
117429
+ {
117430
+ ...options,
117431
+ watch: false,
117432
+ main: key,
117433
+ transformers: []
117434
+ },
117435
+ context.root,
117436
+ sourceRoot,
117437
+ workspaceRoot
117438
+ ),
117439
+ context
117440
+ )
117441
+ ),
117442
+ banner: options.banner ? {
117443
+ js: `${options.banner}
117580
117444
 
117581
117445
  `,
117582
- css: `/*
117446
+ css: `/*
117583
117447
  ${options.banner}
117584
117448
  */
117585
117449
 
117586
117450
  `
117587
- } : void 0,
117588
- outputPath: options.outputPath
117589
- });
117451
+ } : void 0,
117452
+ outputPath: options.outputPath,
117453
+ entry: key
117454
+ })
117455
+ );
117456
+ return ret;
117457
+ }, [])
117458
+ ]);
117590
117459
  if (typeof config === "function") {
117591
117460
  await build(await Promise.resolve(config({})));
117592
117461
  } else {
@@ -117636,9 +117505,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117636
117505
  var build = async (options) => {
117637
117506
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117638
117507
  if (Array.isArray(options)) {
117639
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117508
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117640
117509
  } else {
117641
- await (0, import_tsup2.build)(options);
117510
+ await (0, import_tsup.build)(options);
117642
117511
  }
117643
117512
  };
117644
117513
  var isPrimitive = (value) => {