@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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.30.8](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.7...workspace-tools-v1.30.8) (2023-12-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **workspace-tools:** Resolve issue with dist paths in non-windows systems ([ea9e3a6](https://github.com/storm-software/storm-ops/commit/ea9e3a625847d0eb3472ec34a450b5c220103fd6))
7
+
1
8
  ## [1.30.7](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.6...workspace-tools-v1.30.7) (2023-12-14)
2
9
 
3
10
 
package/index.js CHANGED
@@ -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,
@@ -117121,7 +117121,7 @@ glob.glob = glob;
117121
117121
  var import_fileutils = require("nx/src/utils/fileutils");
117122
117122
  var import_path3 = require("path");
117123
117123
  var import_prettier = require("prettier");
117124
- var import_tsup2 = __toESM(require_dist6());
117124
+ var import_tsup = __toESM(require_dist6());
117125
117125
  var ts = __toESM(require("typescript"));
117126
117126
 
117127
117127
  // packages/workspace-tools/src/utils/file-path-utils.ts
@@ -117198,7 +117198,6 @@ function getExternalDependencies(projectName, graph) {
117198
117198
 
117199
117199
  // packages/workspace-tools/src/executors/tsup/get-config.ts
117200
117200
  var import_devkit = __toESM(require_devkit());
117201
- var import_tsup = __toESM(require_dist6());
117202
117201
  function modernConfig({
117203
117202
  entry,
117204
117203
  outDir,
@@ -117235,78 +117234,7 @@ function modernConfig({
117235
117234
  "ios15",
117236
117235
  "opera77",
117237
117236
  "esnext"
117238
- ] : ["esnext", "node18"],
117239
- tsconfig,
117240
- splitting,
117241
- generatePackageJson,
117242
- treeshake: treeshake ? {
117243
- preset: "recommended"
117244
- } : false,
117245
- projectRoot,
117246
- workspaceRoot,
117247
- outDir: outputPath,
117248
- silent: !verbose,
117249
- metafile: true,
117250
- shims,
117251
- external,
117252
- platform,
117253
- banner,
117254
- define: define2,
117255
- env: env2,
117256
- dts: false,
117257
- experimentalDts: {
117258
- entry,
117259
- compilerOptions: {
117260
- ...dtsTsConfig,
117261
- options: {
117262
- ...dtsTsConfig.options,
117263
- outDir: outputPath
117264
- }
117265
- }
117266
- },
117267
- /*minify: debug ? false : "terser",
117268
- terserOptions: {
117269
- compress: true,
117270
- ecma: 2020,
117271
- keep_classnames: true,
117272
- keep_fnames: true
117273
- },*/
117274
- apiReport,
117275
- docModel,
117276
- tsdocMetadata,
117277
- sourcemap: debug,
117278
- clean: false,
117279
- tsconfigDecoratorMetadata: true,
117280
- plugins,
117281
- outExtension
117282
- };
117283
- }
117284
- function legacyConfig({
117285
- entry,
117286
- outDir,
117287
- projectRoot,
117288
- workspaceRoot,
117289
- tsconfig = "tsconfig.json",
117290
- splitting,
117291
- treeshake,
117292
- debug = false,
117293
- external,
117294
- banner = {},
117295
- platform = "neutral",
117296
- verbose = false,
117297
- shims = true,
117298
- define: define2,
117299
- env: env2,
117300
- plugins,
117301
- generatePackageJson,
117302
- dtsTsConfig
117303
- }) {
117304
- let outputPath = (0, import_devkit.joinPathFragments)(outDir, "dist", "legacy");
117305
- return {
117306
- name: "legacy",
117307
- entry,
117308
- format: platform !== "node" ? ["cjs", "esm", "iife"] : ["cjs", "esm"],
117309
- target: ["es2022", "node18"],
117237
+ ] : ["esnext", "node"],
117310
117238
  tsconfig,
117311
117239
  splitting,
117312
117240
  generatePackageJson,
@@ -117342,80 +117270,6 @@ function legacyConfig({
117342
117270
  keep_classnames: true,
117343
117271
  keep_fnames: true
117344
117272
  },*/
117345
- apiReport: false,
117346
- docModel: false,
117347
- tsdocMetadata: false,
117348
- sourcemap: debug,
117349
- clean: false,
117350
- tsconfigDecoratorMetadata: true,
117351
- plugins,
117352
- outExtension
117353
- };
117354
- }
117355
- function workerConfig({
117356
- entry,
117357
- outDir,
117358
- projectRoot,
117359
- workspaceRoot,
117360
- tsconfig = "tsconfig.json",
117361
- splitting,
117362
- treeshake,
117363
- debug = false,
117364
- external,
117365
- banner = {},
117366
- verbose = false,
117367
- apiReport = true,
117368
- docModel = true,
117369
- tsdocMetadata = true,
117370
- shims = true,
117371
- define: define2,
117372
- env: env2,
117373
- plugins,
117374
- generatePackageJson,
117375
- dtsTsConfig
117376
- }) {
117377
- let outputPath = (0, import_devkit.joinPathFragments)(outDir, "dist");
117378
- return {
117379
- name: "worker",
117380
- entry,
117381
- format: ["esm"],
117382
- target: ["chrome95"],
117383
- bundle: true,
117384
- tsconfig,
117385
- splitting,
117386
- generatePackageJson,
117387
- treeshake: treeshake ? {
117388
- preset: "recommended"
117389
- } : false,
117390
- projectRoot,
117391
- workspaceRoot,
117392
- outDir: outputPath,
117393
- silent: !verbose,
117394
- metafile: true,
117395
- shims,
117396
- external,
117397
- platform: "browser",
117398
- banner,
117399
- define: define2,
117400
- env: env2,
117401
- dts: false,
117402
- experimentalDts: {
117403
- entry,
117404
- compilerOptions: {
117405
- ...dtsTsConfig,
117406
- options: {
117407
- ...dtsTsConfig.options,
117408
- outDir: outputPath
117409
- }
117410
- }
117411
- },
117412
- minify: debug ? false : "terser",
117413
- terserOptions: {
117414
- compress: true,
117415
- ecma: 2020,
117416
- keep_classnames: true,
117417
- keep_fnames: true
117418
- },
117419
117273
  apiReport,
117420
117274
  docModel,
117421
117275
  tsdocMetadata,
@@ -117426,7 +117280,7 @@ function workerConfig({
117426
117280
  outExtension
117427
117281
  };
117428
117282
  }
117429
- function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117283
+ function getConfig(workspaceRoot, projectRoot, getConfigFn, {
117430
117284
  outputPath,
117431
117285
  tsConfig,
117432
117286
  additionalEntryPoints,
@@ -117434,57 +117288,14 @@ function getConfig(workspaceRoot, projectRoot, sourceRoot, {
117434
117288
  emitOnAll = true,
117435
117289
  ...rest
117436
117290
  }) {
117437
- const entryPoints = [];
117438
- if (rest.entry) {
117439
- entryPoints.push(rest.entry);
117440
- }
117441
- if (emitOnAll !== false) {
117442
- entryPoints.push((0, import_devkit.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117443
- }
117444
- if (additionalEntryPoints) {
117445
- entryPoints.push(...additionalEntryPoints);
117446
- }
117447
- const entry = globSync(entryPoints, {
117448
- withFileTypes: true
117449
- }).reduce((ret, filePath) => {
117450
- let formattedPath = workspaceRoot.replaceAll("\\", "/");
117451
- if (formattedPath.toUpperCase().startsWith("C:")) {
117452
- formattedPath = formattedPath.substring(2);
117453
- }
117454
- let propertyKey = (0, import_devkit.joinPathFragments)(
117455
- filePath.path,
117456
- removeExtension(filePath.name)
117457
- ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117458
- if (propertyKey) {
117459
- while (propertyKey.startsWith("/")) {
117460
- propertyKey = propertyKey.substring(1);
117461
- }
117462
- console.debug(
117463
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit.joinPathFragments)(
117464
- filePath.path,
117465
- filePath.name
117466
- )}"`
117467
- );
117468
- if (!(propertyKey in ret)) {
117469
- ret[propertyKey] = (0, import_devkit.joinPathFragments)(filePath.path, filePath.name);
117470
- }
117471
- }
117472
- return ret;
117473
- }, {});
117474
- const params = {
117291
+ return getConfigFn({
117475
117292
  ...rest,
117476
- entry,
117477
117293
  outDir: outputPath,
117478
117294
  tsconfig: tsConfig,
117479
117295
  workspaceRoot,
117480
117296
  projectRoot,
117481
- sourceRoot,
117482
117297
  platform
117483
- };
117484
- if (platform === "worker") {
117485
- return (0, import_tsup.defineConfig)(workerConfig(params));
117486
- }
117487
- return (0, import_tsup.defineConfig)([modernConfig(params), legacyConfig(params)]);
117298
+ });
117488
117299
  }
117489
117300
  var outExtension = ({ format: format2 }) => {
117490
117301
  let jsExtension = ".js";
@@ -117641,20 +117452,57 @@ ${externalDependencies.map((dep) => {
117641
117452
  arrowParens: "avoid",
117642
117453
  endOfLine: "lf"
117643
117454
  };
117455
+ const entryPoints = [];
117456
+ if (options.entry) {
117457
+ entryPoints.push(options.entry);
117458
+ }
117459
+ if (options.emitOnAll !== false) {
117460
+ entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
117461
+ }
117462
+ if (options.additionalEntryPoints) {
117463
+ entryPoints.push(...options.additionalEntryPoints);
117464
+ }
117465
+ const entry = globSync(entryPoints, {
117466
+ withFileTypes: true
117467
+ }).reduce((ret, filePath) => {
117468
+ let formattedPath = workspaceRoot.replaceAll("\\", "/");
117469
+ if (formattedPath.toUpperCase().startsWith("C:")) {
117470
+ formattedPath = formattedPath.substring(2);
117471
+ }
117472
+ let propertyKey = (0, import_devkit2.joinPathFragments)(
117473
+ filePath.path,
117474
+ removeExtension(filePath.name)
117475
+ ).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117476
+ if (propertyKey) {
117477
+ while (propertyKey.startsWith("/")) {
117478
+ propertyKey = propertyKey.substring(1);
117479
+ }
117480
+ console.debug(
117481
+ `Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
117482
+ filePath.path,
117483
+ filePath.name
117484
+ )}"`
117485
+ );
117486
+ if (!(propertyKey in ret)) {
117487
+ ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
117488
+ }
117489
+ }
117490
+ return ret;
117491
+ }, {});
117644
117492
  if (options.generatePackageJson !== false) {
117645
117493
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117646
117494
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117647
117495
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117648
117496
  delete packageJson.dependencies;
117649
- externalDependencies.forEach((entry) => {
117650
- const packageConfig = entry.node.data;
117651
- if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry.node.name]?.type === "npm")) {
117497
+ externalDependencies.forEach((entry2) => {
117498
+ const packageConfig = entry2.node.data;
117499
+ if (packageConfig?.packageName && !!(projectGraph.externalNodes[entry2.node.name]?.type === "npm")) {
117652
117500
  const { packageName, version } = packageConfig;
117653
117501
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117654
117502
  return;
117655
117503
  }
117656
117504
  packageJson.dependencies ??= {};
117657
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117505
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[entry2.node.name] ? "latest" : version;
117658
117506
  }
117659
117507
  });
117660
117508
  internalDependencies.forEach((packageName) => {
@@ -117676,20 +117524,6 @@ ${externalDependencies.map((dep) => {
117676
117524
  types: "./dist/modern/index.d.ts",
117677
117525
  default: "./dist/modern/index.js"
117678
117526
  },
117679
- "./*": {
117680
- "import": {
117681
- types: "./dist/modern/index.d.ts",
117682
- default: "./dist/modern/**/*.js"
117683
- },
117684
- require: {
117685
- types: "./dist/modern/index.d.cts",
117686
- default: "./dist/modern/**/*.cjs"
117687
- },
117688
- "default": {
117689
- types: "./dist/modern/index.d.ts",
117690
- default: "./dist/modern/**/*.js"
117691
- }
117692
- },
117693
117527
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117694
117528
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117695
117529
  types: (0, import_path3.join)(
@@ -117705,6 +117539,29 @@ ${externalDependencies.map((dep) => {
117705
117539
  },
117706
117540
  "./package.json": "./package.json"
117707
117541
  };
117542
+ packageJson.exports = Object.keys(entry).reduce(
117543
+ (ret, key) => {
117544
+ const packageJsonKey = key.startsWith("./") ? key : `./${key}`;
117545
+ if (!ret[packageJsonKey]) {
117546
+ ret[packageJsonKey] = {
117547
+ import: {
117548
+ types: `./dist/modern/${key}.d.ts`,
117549
+ default: `./dist/modern/${key}.js`
117550
+ },
117551
+ require: {
117552
+ types: `./dist/modern/${key}.d.cts`,
117553
+ default: `./dist/modern/${key}.cjs`
117554
+ },
117555
+ default: {
117556
+ types: `./dist/modern/${key}.d.ts`,
117557
+ default: `./dist/modern/${key}.js`
117558
+ }
117559
+ };
117560
+ }
117561
+ return ret;
117562
+ },
117563
+ packageJson.exports
117564
+ );
117708
117565
  packageJson.funding ??= workspacePackageJson.funding;
117709
117566
  packageJson.types ??= "dist/legacy/index.d.ts";
117710
117567
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117791,45 +117648,53 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117791
117648
  })
117792
117649
  );
117793
117650
  options.plugins.push(environmentPlugin(stormEnv));
117794
- const config = getConfig(context.root, projectRoot, sourceRoot, {
117795
- ...options,
117796
- define: {
117797
- __STORM_CONFIG: JSON.stringify(stormEnv)
117798
- },
117799
- env: {
117800
- __STORM_CONFIG: JSON.stringify(stormEnv),
117801
- ...stormEnv
117802
- },
117803
- dtsTsConfig: getNormalizedTsConfig(
117804
- context.root,
117805
- options.outputPath,
117806
- (0, import_tsc.createTypeScriptCompilationOptions)(
117807
- (0, import_normalize_options.normalizeOptions)(
117808
- {
117809
- ...options,
117810
- watch: false,
117811
- main: options.entry,
117812
- transformers: []
117651
+ const config = (0, import_tsup.defineConfig)([
117652
+ ...Object.keys(entry).reduce((ret, key) => {
117653
+ ret.push(
117654
+ getConfig(context.root, projectRoot, modernConfig, {
117655
+ ...options,
117656
+ define: {
117657
+ __STORM_CONFIG: JSON.stringify(stormEnv)
117813
117658
  },
117814
- context.root,
117815
- sourceRoot,
117816
- workspaceRoot
117817
- ),
117818
- context
117819
- )
117820
- ),
117821
- banner: options.banner ? {
117822
- js: `${options.banner}
117659
+ env: {
117660
+ __STORM_CONFIG: JSON.stringify(stormEnv),
117661
+ ...stormEnv
117662
+ },
117663
+ dtsTsConfig: getNormalizedTsConfig(
117664
+ context.root,
117665
+ options.outputPath,
117666
+ (0, import_tsc.createTypeScriptCompilationOptions)(
117667
+ (0, import_normalize_options.normalizeOptions)(
117668
+ {
117669
+ ...options,
117670
+ watch: false,
117671
+ main: key,
117672
+ transformers: []
117673
+ },
117674
+ context.root,
117675
+ sourceRoot,
117676
+ workspaceRoot
117677
+ ),
117678
+ context
117679
+ )
117680
+ ),
117681
+ banner: options.banner ? {
117682
+ js: `${options.banner}
117823
117683
 
117824
117684
  `,
117825
- css: `/*
117685
+ css: `/*
117826
117686
  ${options.banner}
117827
117687
  */
117828
117688
 
117829
117689
  `
117830
- } : void 0,
117831
- outputPath: options.outputPath
117832
- });
117690
+ } : void 0,
117691
+ outputPath: options.outputPath,
117692
+ entry: key
117693
+ })
117694
+ );
117695
+ return ret;
117696
+ }, [])
117697
+ ]);
117833
117698
  if (typeof config === "function") {
117834
117699
  await build(await Promise.resolve(config({})));
117835
117700
  } else {
@@ -117879,9 +117744,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117879
117744
  var build = async (options) => {
117880
117745
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117881
117746
  if (Array.isArray(options)) {
117882
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117747
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117883
117748
  } else {
117884
- await (0, import_tsup2.build)(options);
117749
+ await (0, import_tsup.build)(options);
117885
117750
  }
117886
117751
  };
117887
117752
  var isPrimitive = (value) => {