@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.
@@ -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,
@@ -117144,139 +117143,21 @@ function legacyConfig({
117144
117143
  outExtension
117145
117144
  };
117146
117145
  }
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, {
117146
+ function getConfig(workspaceRoot, projectRoot, getConfigFn, {
117222
117147
  outputPath,
117223
117148
  tsConfig,
117224
117149
  additionalEntryPoints,
117225
117150
  platform,
117226
- emitOnAll = true,
117227
117151
  ...rest
117228
117152
  }) {
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 formattedPath = workspaceRoot.replaceAll("\\", "/");
117243
- if (formattedPath.toUpperCase().startsWith("C:")) {
117244
- formattedPath = formattedPath.substring(2);
117245
- }
117246
- let propertyKey = (0, import_devkit.joinPathFragments)(
117247
- filePath.path,
117248
- removeExtension(filePath.name)
117249
- ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117250
- if (propertyKey) {
117251
- while (propertyKey.startsWith("/")) {
117252
- propertyKey = propertyKey.substring(1);
117253
- }
117254
- console.debug(
117255
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit.joinPathFragments)(
117256
- filePath.path,
117257
- filePath.name
117258
- )}"`
117259
- );
117260
- if (!(propertyKey in ret)) {
117261
- ret[propertyKey] = (0, import_devkit.joinPathFragments)(filePath.path, filePath.name);
117262
- }
117263
- }
117264
- return ret;
117265
- }, {});
117266
- const params = {
117153
+ return getConfigFn({
117267
117154
  ...rest,
117268
- entry,
117269
117155
  outDir: outputPath,
117270
117156
  tsconfig: tsConfig,
117271
117157
  workspaceRoot,
117272
117158
  projectRoot,
117273
- sourceRoot,
117274
117159
  platform
117275
- };
117276
- if (platform === "worker") {
117277
- return (0, import_tsup.defineConfig)(workerConfig(params));
117278
- }
117279
- return (0, import_tsup.defineConfig)([modernConfig(params), legacyConfig(params)]);
117160
+ });
117280
117161
  }
117281
117162
  var outExtension = ({ format: format2 }) => {
117282
117163
  let jsExtension = ".js";
@@ -117433,20 +117314,57 @@ ${externalDependencies.map((dep) => {
117433
117314
  arrowParens: "avoid",
117434
117315
  endOfLine: "lf"
117435
117316
  };
117317
+ const entryPoints = [];
117318
+ if (options.entry) {
117319
+ entryPoints.push(options.entry);
117320
+ }
117321
+ if (options.emitOnAll !== false) {
117322
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117323
+ }
117324
+ if (options.additionalEntryPoints) {
117325
+ entryPoints.push(...options.additionalEntryPoints);
117326
+ }
117327
+ const entry = globSync(entryPoints, {
117328
+ withFileTypes: true
117329
+ }).reduce((ret, filePath) => {
117330
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
117331
+ if (formattedPath.toUpperCase().startsWith("C:")) {
117332
+ formattedPath = formattedPath.substring(2);
117333
+ }
117334
+ let propertyKey = (0, import_devkit2.joinPathFragments)(
117335
+ filePath.path,
117336
+ removeExtension(filePath.name)
117337
+ ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117338
+ if (propertyKey) {
117339
+ while (propertyKey.startsWith("/")) {
117340
+ propertyKey = propertyKey.substring(1);
117341
+ }
117342
+ console.debug(
117343
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
117344
+ filePath.path,
117345
+ filePath.name
117346
+ )}"`
117347
+ );
117348
+ if (!(propertyKey in ret)) {
117349
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
117350
+ }
117351
+ }
117352
+ return ret;
117353
+ }, {});
117436
117354
  if (options.generatePackageJson !== false) {
117437
117355
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117438
117356
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117439
117357
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117440
117358
  delete packageJson.dependencies;
117441
- externalDependencies.forEach((entry) => {
117442
- const packageConfig = entry.node.data;
117443
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry.node.name]?.type === "npm")) {
117359
+ externalDependencies.forEach((externalDependency) => {
117360
+ const packageConfig = externalDependency.node.data;
117361
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
117444
117362
  const { packageName, version } = packageConfig;
117445
117363
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117446
117364
  return;
117447
117365
  }
117448
117366
  packageJson.dependencies ??= {};
117449
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117367
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
117450
117368
  }
117451
117369
  });
117452
117370
  internalDependencies.forEach((packageName) => {
@@ -117468,20 +117386,6 @@ ${externalDependencies.map((dep) => {
117468
117386
  types: "./dist/modern/index.d.ts",
117469
117387
  default: "./dist/modern/index.js"
117470
117388
  },
117471
- "./*": {
117472
- "import": {
117473
- types: "./dist/modern/index.d.ts",
117474
- default: "./dist/modern/**/*.js"
117475
- },
117476
- require: {
117477
- types: "./dist/modern/index.d.cts",
117478
- default: "./dist/modern/**/*.cjs"
117479
- },
117480
- "default": {
117481
- types: "./dist/modern/index.d.ts",
117482
- default: "./dist/modern/**/*.js"
117483
- }
117484
- },
117485
117389
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117486
117390
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117487
117391
  types: (0, import_path3.join)(
@@ -117497,6 +117401,30 @@ ${externalDependencies.map((dep) => {
117497
117401
  },
117498
117402
  "./package.json": "./package.json"
117499
117403
  };
117404
+ packageJson.exports = Object.keys(entry).reduce(
117405
+ (ret, key) => {
117406
+ let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
117407
+ packageJsonKey = packageJsonKey.replaceAll("/index", "");
117408
+ if (!ret[packageJsonKey]) {
117409
+ ret[packageJsonKey] = {
117410
+ import: {
117411
+ types: `./dist/modern/${key}.d.ts`,
117412
+ default: `./dist/modern/${key}.js`
117413
+ },
117414
+ require: {
117415
+ types: `./dist/modern/${key}.d.cts`,
117416
+ default: `./dist/modern/${key}.cjs`
117417
+ },
117418
+ default: {
117419
+ types: `./dist/modern/${key}.d.ts`,
117420
+ default: `./dist/modern/${key}.js`
117421
+ }
117422
+ };
117423
+ }
117424
+ return ret;
117425
+ },
117426
+ packageJson.exports
117427
+ );
117500
117428
  packageJson.funding ??= workspacePackageJson.funding;
117501
117429
  packageJson.types ??= "dist/legacy/index.d.ts";
117502
117430
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117583,45 +117511,57 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117583
117511
  })
117584
117512
  );
117585
117513
  options.plugins.push(environmentPlugin(stormEnv));
117586
- const config = getConfig(context.root, projectRoot, sourceRoot, {
117587
- ...options,
117588
- define: {
117589
- __STORM_CONFIG: JSON.stringify(stormEnv)
117590
- },
117591
- env: {
117592
- __STORM_CONFIG: JSON.stringify(stormEnv),
117593
- ...stormEnv
117594
- },
117595
- dtsTsConfig: getNormalizedTsConfig(
117596
- context.root,
117597
- options.outputPath,
117598
- (0, import_tsc.createTypeScriptCompilationOptions)(
117599
- (0, import_normalize_options.normalizeOptions)(
117600
- {
117601
- ...options,
117602
- watch: false,
117603
- main: options.entry,
117604
- transformers: []
117605
- },
117514
+ const config = (0, import_tsup.defineConfig)([
117515
+ ...Object.keys(entry).reduce((ret, key) => {
117516
+ const getConfigOptions = {
117517
+ ...options,
117518
+ define: {
117519
+ __STORM_CONFIG: JSON.stringify(stormEnv)
117520
+ },
117521
+ env: {
117522
+ __STORM_CONFIG: JSON.stringify(stormEnv),
117523
+ ...stormEnv
117524
+ },
117525
+ dtsTsConfig: getNormalizedTsConfig(
117606
117526
  context.root,
117607
- sourceRoot,
117608
- workspaceRoot
117527
+ options.outputPath,
117528
+ (0, import_tsc.createTypeScriptCompilationOptions)(
117529
+ (0, import_normalize_options.normalizeOptions)(
117530
+ {
117531
+ ...options,
117532
+ watch: false,
117533
+ main: entry[key],
117534
+ transformers: []
117535
+ },
117536
+ context.root,
117537
+ sourceRoot,
117538
+ workspaceRoot
117539
+ ),
117540
+ context
117541
+ )
117609
117542
  ),
117610
- context
117611
- )
117612
- ),
117613
- banner: options.banner ? {
117614
- js: `${options.banner}
117543
+ banner: options.banner ? {
117544
+ js: `${options.banner}
117615
117545
 
117616
117546
  `,
117617
- css: `/*
117547
+ css: `/*
117618
117548
  ${options.banner}
117619
117549
  */
117620
117550
 
117621
117551
  `
117622
- } : void 0,
117623
- outputPath: options.outputPath
117624
- });
117552
+ } : void 0,
117553
+ outputPath: options.outputPath,
117554
+ entry: entry[key]
117555
+ };
117556
+ ret.push(
117557
+ getConfig(context.root, projectRoot, legacyConfig, getConfigOptions)
117558
+ );
117559
+ ret.push(
117560
+ getConfig(context.root, projectRoot, modernConfig, getConfigOptions)
117561
+ );
117562
+ return ret;
117563
+ }, [])
117564
+ ]);
117625
117565
  if (typeof config === "function") {
117626
117566
  await build(await Promise.resolve(config({})));
117627
117567
  } else {
@@ -117671,9 +117611,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117671
117611
  var build = async (options) => {
117672
117612
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117673
117613
  if (Array.isArray(options)) {
117674
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117614
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117675
117615
  } else {
117676
- await (0, import_tsup2.build)(options);
117616
+ await (0, import_tsup.build)(options);
117677
117617
  }
117678
117618
  };
117679
117619
  var isPrimitive = (value) => {