@storm-software/workspace-tools 1.30.8 → 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.8",
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,57 +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 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 = {
117052
+ return getConfigFn({
117236
117053
  ...rest,
117237
- entry,
117238
117054
  outDir: outputPath,
117239
117055
  tsconfig: tsConfig,
117240
117056
  workspaceRoot,
117241
117057
  projectRoot,
117242
- sourceRoot,
117243
117058
  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)]);
117059
+ });
117249
117060
  }
117250
117061
  var outExtension = ({ format: format2 }) => {
117251
117062
  let jsExtension = ".js";
@@ -117402,20 +117213,57 @@ ${externalDependencies.map((dep) => {
117402
117213
  arrowParens: "avoid",
117403
117214
  endOfLine: "lf"
117404
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
+ }, {});
117405
117253
  if (options.generatePackageJson !== false) {
117406
117254
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117407
117255
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117408
117256
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117409
117257
  delete packageJson.dependencies;
117410
- externalDependencies.forEach((entry) => {
117411
- const packageConfig = entry.node.data;
117412
- 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")) {
117413
117261
  const { packageName, version } = packageConfig;
117414
117262
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117415
117263
  return;
117416
117264
  }
117417
117265
  packageJson.dependencies ??= {};
117418
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117266
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[entry2.node.name] ? "latest" : version;
117419
117267
  }
117420
117268
  });
117421
117269
  internalDependencies.forEach((packageName) => {
@@ -117437,20 +117285,6 @@ ${externalDependencies.map((dep) => {
117437
117285
  types: "./dist/modern/index.d.ts",
117438
117286
  default: "./dist/modern/index.js"
117439
117287
  },
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
117288
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117455
117289
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117456
117290
  types: (0, import_path3.join)(
@@ -117466,6 +117300,29 @@ ${externalDependencies.map((dep) => {
117466
117300
  },
117467
117301
  "./package.json": "./package.json"
117468
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
+ );
117469
117326
  packageJson.funding ??= workspacePackageJson.funding;
117470
117327
  packageJson.types ??= "dist/legacy/index.d.ts";
117471
117328
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117552,45 +117409,53 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117552
117409
  })
117553
117410
  );
117554
117411
  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: []
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)
117574
117419
  },
117575
- context.root,
117576
- sourceRoot,
117577
- workspaceRoot
117578
- ),
117579
- context
117580
- )
117581
- ),
117582
- banner: options.banner ? {
117583
- 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}
117584
117444
 
117585
117445
  `,
117586
- css: `/*
117446
+ css: `/*
117587
117447
  ${options.banner}
117588
117448
  */
117589
117449
 
117590
117450
  `
117591
- } : void 0,
117592
- outputPath: options.outputPath
117593
- });
117451
+ } : void 0,
117452
+ outputPath: options.outputPath,
117453
+ entry: key
117454
+ })
117455
+ );
117456
+ return ret;
117457
+ }, [])
117458
+ ]);
117594
117459
  if (typeof config === "function") {
117595
117460
  await build(await Promise.resolve(config({})));
117596
117461
  } else {
@@ -117640,9 +117505,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117640
117505
  var build = async (options) => {
117641
117506
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117642
117507
  if (Array.isArray(options)) {
117643
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117508
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117644
117509
  } else {
117645
- await (0, import_tsup2.build)(options);
117510
+ await (0, import_tsup.build)(options);
117646
117511
  }
117647
117512
  };
117648
117513
  var isPrimitive = (value) => {