@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.
@@ -67372,7 +67372,7 @@ var require_Options_gen_types = __commonJS({
67372
67372
  compiledFilename: "string"
67373
67373
  });
67374
67374
  exports.SourceMapOptions = SourceMapOptions;
67375
- var Options3 = t.iface([], {
67375
+ var Options2 = t.iface([], {
67376
67376
  transforms: t.array("Transform"),
67377
67377
  disableESTransforms: t.opt("boolean"),
67378
67378
  jsxRuntime: t.opt(t.union(t.lit("classic"), t.lit("automatic"), t.lit("preserve"))),
@@ -67388,7 +67388,7 @@ var require_Options_gen_types = __commonJS({
67388
67388
  sourceMapOptions: t.opt("SourceMapOptions"),
67389
67389
  filePath: t.opt("string")
67390
67390
  });
67391
- exports.Options = Options3;
67391
+ exports.Options = Options2;
67392
67392
  var exportedTypeSuite = {
67393
67393
  Transform: exports.Transform,
67394
67394
  SourceMapOptions: exports.SourceMapOptions,
@@ -116961,7 +116961,7 @@ glob.glob = glob;
116961
116961
  var import_fileutils = require("nx/src/utils/fileutils");
116962
116962
  var import_path3 = require("path");
116963
116963
  var import_prettier = require("prettier");
116964
- var import_tsup2 = __toESM(require_dist6());
116964
+ var import_tsup = __toESM(require_dist6());
116965
116965
  var ts = __toESM(require("typescript"));
116966
116966
 
116967
116967
  // packages/workspace-tools/src/utils/file-path-utils.ts
@@ -116990,7 +116990,6 @@ function getExternalDependencies(projectName, graph) {
116990
116990
 
116991
116991
  // packages/workspace-tools/src/executors/tsup/get-config.ts
116992
116992
  var import_devkit = __toESM(require_devkit());
116993
- var import_tsup = __toESM(require_dist6());
116994
116993
  function modernConfig({
116995
116994
  entry,
116996
116995
  outDir,
@@ -117027,7 +117026,7 @@ function modernConfig({
117027
117026
  "ios15",
117028
117027
  "opera77",
117029
117028
  "esnext"
117030
- ] : ["esnext", "node18"],
117029
+ ] : ["esnext", "node"],
117031
117030
  tsconfig,
117032
117031
  splitting,
117033
117032
  generatePackageJson,
@@ -117073,152 +117072,7 @@ function modernConfig({
117073
117072
  outExtension
117074
117073
  };
117075
117074
  }
117076
- function legacyConfig({
117077
- entry,
117078
- outDir,
117079
- projectRoot,
117080
- workspaceRoot,
117081
- tsconfig = "tsconfig.json",
117082
- splitting,
117083
- treeshake,
117084
- debug = false,
117085
- external,
117086
- banner = {},
117087
- platform = "neutral",
117088
- verbose = false,
117089
- shims = true,
117090
- define: define2,
117091
- env,
117092
- plugins,
117093
- generatePackageJson,
117094
- dtsTsConfig
117095
- }) {
117096
- let outputPath = (0, import_devkit.joinPathFragments)(outDir, "dist", "legacy");
117097
- return {
117098
- name: "legacy",
117099
- entry,
117100
- format: platform !== "node" ? ["cjs", "esm", "iife"] : ["cjs", "esm"],
117101
- target: ["es2022", "node18"],
117102
- tsconfig,
117103
- splitting,
117104
- generatePackageJson,
117105
- treeshake: treeshake ? {
117106
- preset: "recommended"
117107
- } : false,
117108
- projectRoot,
117109
- workspaceRoot,
117110
- outDir: outputPath,
117111
- silent: !verbose,
117112
- metafile: true,
117113
- shims,
117114
- external,
117115
- platform,
117116
- banner,
117117
- define: define2,
117118
- env,
117119
- dts: false,
117120
- experimentalDts: {
117121
- entry,
117122
- compilerOptions: {
117123
- ...dtsTsConfig,
117124
- options: {
117125
- ...dtsTsConfig.options,
117126
- outDir: outputPath
117127
- }
117128
- }
117129
- },
117130
- /*minify: debug ? false : "terser",
117131
- terserOptions: {
117132
- compress: true,
117133
- ecma: 2020,
117134
- keep_classnames: true,
117135
- keep_fnames: true
117136
- },*/
117137
- apiReport: false,
117138
- docModel: false,
117139
- tsdocMetadata: false,
117140
- sourcemap: debug,
117141
- clean: false,
117142
- tsconfigDecoratorMetadata: true,
117143
- plugins,
117144
- outExtension
117145
- };
117146
- }
117147
- function workerConfig({
117148
- entry,
117149
- outDir,
117150
- projectRoot,
117151
- workspaceRoot,
117152
- tsconfig = "tsconfig.json",
117153
- splitting,
117154
- treeshake,
117155
- debug = false,
117156
- external,
117157
- banner = {},
117158
- verbose = false,
117159
- apiReport = true,
117160
- docModel = true,
117161
- tsdocMetadata = true,
117162
- shims = true,
117163
- define: define2,
117164
- env,
117165
- plugins,
117166
- generatePackageJson,
117167
- dtsTsConfig
117168
- }) {
117169
- let outputPath = (0, import_devkit.joinPathFragments)(outDir, "dist");
117170
- return {
117171
- name: "worker",
117172
- entry,
117173
- format: ["esm"],
117174
- target: ["chrome95"],
117175
- bundle: true,
117176
- tsconfig,
117177
- splitting,
117178
- generatePackageJson,
117179
- treeshake: treeshake ? {
117180
- preset: "recommended"
117181
- } : false,
117182
- projectRoot,
117183
- workspaceRoot,
117184
- outDir: outputPath,
117185
- silent: !verbose,
117186
- metafile: true,
117187
- shims,
117188
- external,
117189
- platform: "browser",
117190
- banner,
117191
- define: define2,
117192
- env,
117193
- dts: false,
117194
- experimentalDts: {
117195
- entry,
117196
- compilerOptions: {
117197
- ...dtsTsConfig,
117198
- options: {
117199
- ...dtsTsConfig.options,
117200
- outDir: outputPath
117201
- }
117202
- }
117203
- },
117204
- minify: debug ? false : "terser",
117205
- terserOptions: {
117206
- compress: true,
117207
- ecma: 2020,
117208
- keep_classnames: true,
117209
- keep_fnames: true
117210
- },
117211
- apiReport,
117212
- docModel,
117213
- tsdocMetadata,
117214
- sourcemap: debug,
117215
- clean: false,
117216
- tsconfigDecoratorMetadata: true,
117217
- plugins,
117218
- outExtension
117219
- };
117220
- }
117221
- function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117075
+ function getConfig(workspaceRoot, projectRoot, getConfigFn, {
117222
117076
  outputPath,
117223
117077
  tsConfig,
117224
117078
  additionalEntryPoints,
@@ -117226,53 +117080,14 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117226
117080
  emitOnAll = true,
117227
117081
  ...rest
117228
117082
  }) {
117229
- const entryPoints = [];
117230
- if (rest.entry) {
117231
- entryPoints.push(rest.entry);
117232
- }
117233
- if (emitOnAll !== false) {
117234
- entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117235
- }
117236
- if (additionalEntryPoints) {
117237
- entryPoints.push(...additionalEntryPoints);
117238
- }
117239
- const entry = globSync(entryPoints, {
117240
- withFileTypes: true
117241
- }).reduce((ret, filePath) => {
117242
- let propertyKey = (0, import_devkit.joinPathFragments)(
117243
- filePath.path,
117244
- removeExtension(filePath.name)
117245
- ).replaceAll("\\", "/").replaceAll(workspaceRoot.substring(2).replaceAll("\\", "/"), "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117246
- if (propertyKey) {
117247
- while (propertyKey.startsWith("/")) {
117248
- propertyKey = propertyKey.substring(1);
117249
- }
117250
- console.debug(
117251
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit.joinPathFragments)(
117252
- filePath.path,
117253
- filePath.name
117254
- )}"`
117255
- );
117256
- if (!(propertyKey in ret)) {
117257
- ret[propertyKey] = (0, import_devkit.joinPathFragments)(filePath.path, filePath.name);
117258
- }
117259
- }
117260
- return ret;
117261
- }, {});
117262
- const params = {
117083
+ return getConfigFn({
117263
117084
  ...rest,
117264
- entry,
117265
117085
  outDir: outputPath,
117266
117086
  tsconfig: tsConfig,
117267
117087
  workspaceRoot,
117268
117088
  projectRoot,
117269
- sourceRoot,
117270
117089
  platform
117271
- };
117272
- if (platform === "worker") {
117273
- return (0, import_tsup.defineConfig)(workerConfig(params));
117274
- }
117275
- return (0, import_tsup.defineConfig)([modernConfig(params), legacyConfig(params)]);
117090
+ });
117276
117091
  }
117277
117092
  var outExtension = ({ format: format2 }) => {
117278
117093
  let jsExtension = ".js";
@@ -117429,20 +117244,57 @@ ${externalDependencies.map((dep) => {
117429
117244
  arrowParens: "avoid",
117430
117245
  endOfLine: "lf"
117431
117246
  };
117247
+ const entryPoints = [];
117248
+ if (options.entry) {
117249
+ entryPoints.push(options.entry);
117250
+ }
117251
+ if (options.emitOnAll !== false) {
117252
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117253
+ }
117254
+ if (options.additionalEntryPoints) {
117255
+ entryPoints.push(...options.additionalEntryPoints);
117256
+ }
117257
+ const entry = globSync(entryPoints, {
117258
+ withFileTypes: true
117259
+ }).reduce((ret, filePath) => {
117260
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
117261
+ if (formattedPath.toUpperCase().startsWith("C:")) {
117262
+ formattedPath = formattedPath.substring(2);
117263
+ }
117264
+ let propertyKey = (0, import_devkit2.joinPathFragments)(
117265
+ filePath.path,
117266
+ removeExtension(filePath.name)
117267
+ ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117268
+ if (propertyKey) {
117269
+ while (propertyKey.startsWith("/")) {
117270
+ propertyKey = propertyKey.substring(1);
117271
+ }
117272
+ console.debug(
117273
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
117274
+ filePath.path,
117275
+ filePath.name
117276
+ )}"`
117277
+ );
117278
+ if (!(propertyKey in ret)) {
117279
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
117280
+ }
117281
+ }
117282
+ return ret;
117283
+ }, {});
117432
117284
  if (options.generatePackageJson !== false) {
117433
117285
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117434
117286
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117435
117287
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117436
117288
  delete packageJson.dependencies;
117437
- externalDependencies.forEach((entry) => {
117438
- const packageConfig = entry.node.data;
117439
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry.node.name]?.type === "npm")) {
117289
+ externalDependencies.forEach((entry2) => {
117290
+ const packageConfig = entry2.node.data;
117291
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry2.node.name]?.type === "npm")) {
117440
117292
  const { packageName, version } = packageConfig;
117441
117293
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117442
117294
  return;
117443
117295
  }
117444
117296
  packageJson.dependencies ??= {};
117445
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117297
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[entry2.node.name] ? "latest" : version;
117446
117298
  }
117447
117299
  });
117448
117300
  internalDependencies.forEach((packageName) => {
@@ -117464,20 +117316,6 @@ ${externalDependencies.map((dep) => {
117464
117316
  types: "./dist/modern/index.d.ts",
117465
117317
  default: "./dist/modern/index.js"
117466
117318
  },
117467
- "./*": {
117468
- "import": {
117469
- types: "./dist/modern/index.d.ts",
117470
- default: "./dist/modern/**/*.js"
117471
- },
117472
- require: {
117473
- types: "./dist/modern/index.d.cts",
117474
- default: "./dist/modern/**/*.cjs"
117475
- },
117476
- "default": {
117477
- types: "./dist/modern/index.d.ts",
117478
- default: "./dist/modern/**/*.js"
117479
- }
117480
- },
117481
117319
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117482
117320
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117483
117321
  types: (0, import_path3.join)(
@@ -117493,6 +117331,29 @@ ${externalDependencies.map((dep) => {
117493
117331
  },
117494
117332
  "./package.json": "./package.json"
117495
117333
  };
117334
+ packageJson.exports = Object.keys(entry).reduce(
117335
+ (ret, key) => {
117336
+ const packageJsonKey = key.startsWith("./") ? key : `./${key}`;
117337
+ if (!ret[packageJsonKey]) {
117338
+ ret[packageJsonKey] = {
117339
+ import: {
117340
+ types: `./dist/modern/${key}.d.ts`,
117341
+ default: `./dist/modern/${key}.js`
117342
+ },
117343
+ require: {
117344
+ types: `./dist/modern/${key}.d.cts`,
117345
+ default: `./dist/modern/${key}.cjs`
117346
+ },
117347
+ default: {
117348
+ types: `./dist/modern/${key}.d.ts`,
117349
+ default: `./dist/modern/${key}.js`
117350
+ }
117351
+ };
117352
+ }
117353
+ return ret;
117354
+ },
117355
+ packageJson.exports
117356
+ );
117496
117357
  packageJson.funding ??= workspacePackageJson.funding;
117497
117358
  packageJson.types ??= "dist/legacy/index.d.ts";
117498
117359
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117579,45 +117440,53 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117579
117440
  })
117580
117441
  );
117581
117442
  options.plugins.push(environmentPlugin(stormEnv));
117582
- const config = getConfig(context.root, projectRoot, sourceRoot, {
117583
- ...options,
117584
- define: {
117585
- __STORM_CONFIG: JSON.stringify(stormEnv)
117586
- },
117587
- env: {
117588
- __STORM_CONFIG: JSON.stringify(stormEnv),
117589
- ...stormEnv
117590
- },
117591
- dtsTsConfig: getNormalizedTsConfig(
117592
- context.root,
117593
- options.outputPath,
117594
- (0, import_tsc.createTypeScriptCompilationOptions)(
117595
- (0, import_normalize_options.normalizeOptions)(
117596
- {
117597
- ...options,
117598
- watch: false,
117599
- main: options.entry,
117600
- transformers: []
117443
+ const config = (0, import_tsup.defineConfig)([
117444
+ ...Object.keys(entry).reduce((ret, key) => {
117445
+ ret.push(
117446
+ getConfig(context.root, projectRoot, modernConfig, {
117447
+ ...options,
117448
+ define: {
117449
+ __STORM_CONFIG: JSON.stringify(stormEnv)
117601
117450
  },
117602
- context.root,
117603
- sourceRoot,
117604
- workspaceRoot
117605
- ),
117606
- context
117607
- )
117608
- ),
117609
- banner: options.banner ? {
117610
- js: `${options.banner}
117451
+ env: {
117452
+ __STORM_CONFIG: JSON.stringify(stormEnv),
117453
+ ...stormEnv
117454
+ },
117455
+ dtsTsConfig: getNormalizedTsConfig(
117456
+ context.root,
117457
+ options.outputPath,
117458
+ (0, import_tsc.createTypeScriptCompilationOptions)(
117459
+ (0, import_normalize_options.normalizeOptions)(
117460
+ {
117461
+ ...options,
117462
+ watch: false,
117463
+ main: key,
117464
+ transformers: []
117465
+ },
117466
+ context.root,
117467
+ sourceRoot,
117468
+ workspaceRoot
117469
+ ),
117470
+ context
117471
+ )
117472
+ ),
117473
+ banner: options.banner ? {
117474
+ js: `${options.banner}
117611
117475
 
117612
117476
  `,
117613
- css: `/*
117477
+ css: `/*
117614
117478
  ${options.banner}
117615
117479
  */
117616
117480
 
117617
117481
  `
117618
- } : void 0,
117619
- outputPath: options.outputPath
117620
- });
117482
+ } : void 0,
117483
+ outputPath: options.outputPath,
117484
+ entry: key
117485
+ })
117486
+ );
117487
+ return ret;
117488
+ }, [])
117489
+ ]);
117621
117490
  if (typeof config === "function") {
117622
117491
  await build(await Promise.resolve(config({})));
117623
117492
  } else {
@@ -117667,9 +117536,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117667
117536
  var build = async (options) => {
117668
117537
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117669
117538
  if (Array.isArray(options)) {
117670
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117539
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117671
117540
  } else {
117672
- await (0, import_tsup2.build)(options);
117541
+ await (0, import_tsup.build)(options);
117673
117542
  }
117674
117543
  };
117675
117544
  var isPrimitive = (value) => {