@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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
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
+
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)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **workspace-tools:** Resolved issue with promise on configuration object ([1f2046f](https://github.com/storm-software/storm-ops/commit/1f2046f4ad6bedbc314535b424cf1b5511f31269))
14
+
1
15
  ## [1.30.6](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.5...workspace-tools-v1.30.6) (2023-12-14)
2
16
 
3
17
 
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,53 +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 propertyKey = (0, import_devkit.joinPathFragments)(
117451
- filePath.path,
117452
- removeExtension(filePath.name)
117453
- ).replaceAll("\\", "/").replaceAll(workspaceRoot.substring(2).replaceAll("\\", "/"), "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
117454
- if (propertyKey) {
117455
- while (propertyKey.startsWith("/")) {
117456
- propertyKey = propertyKey.substring(1);
117457
- }
117458
- console.debug(
117459
- `Trying to add entry point ${propertyKey} at "${(0, import_devkit.joinPathFragments)(
117460
- filePath.path,
117461
- filePath.name
117462
- )}"`
117463
- );
117464
- if (!(propertyKey in ret)) {
117465
- ret[propertyKey] = (0, import_devkit.joinPathFragments)(filePath.path, filePath.name);
117466
- }
117467
- }
117468
- return ret;
117469
- }, {});
117470
- const params = {
117291
+ return getConfigFn({
117471
117292
  ...rest,
117472
- entry,
117473
117293
  outDir: outputPath,
117474
117294
  tsconfig: tsConfig,
117475
117295
  workspaceRoot,
117476
117296
  projectRoot,
117477
- sourceRoot,
117478
117297
  platform
117479
- };
117480
- if (platform === "worker") {
117481
- return (0, import_tsup.defineConfig)(workerConfig(params));
117482
- }
117483
- return (0, import_tsup.defineConfig)([modernConfig(params), legacyConfig(params)]);
117298
+ });
117484
117299
  }
117485
117300
  var outExtension = ({ format: format2 }) => {
117486
117301
  let jsExtension = ".js";
@@ -117637,20 +117452,57 @@ ${externalDependencies.map((dep) => {
117637
117452
  arrowParens: "avoid",
117638
117453
  endOfLine: "lf"
117639
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
+ }, {});
117640
117492
  if (options.generatePackageJson !== false) {
117641
117493
  const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
117642
117494
  const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
117643
117495
  const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117644
117496
  delete packageJson.dependencies;
117645
- externalDependencies.forEach((entry) => {
117646
- const packageConfig = entry.node.data;
117647
- 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")) {
117648
117500
  const { packageName, version } = packageConfig;
117649
117501
  if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117650
117502
  return;
117651
117503
  }
117652
117504
  packageJson.dependencies ??= {};
117653
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117505
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[entry2.node.name] ? "latest" : version;
117654
117506
  }
117655
117507
  });
117656
117508
  internalDependencies.forEach((packageName) => {
@@ -117672,20 +117524,6 @@ ${externalDependencies.map((dep) => {
117672
117524
  types: "./dist/modern/index.d.ts",
117673
117525
  default: "./dist/modern/index.js"
117674
117526
  },
117675
- "./*": {
117676
- "import": {
117677
- types: "./dist/modern/index.d.ts",
117678
- default: "./dist/modern/**/*.js"
117679
- },
117680
- require: {
117681
- types: "./dist/modern/index.d.cts",
117682
- default: "./dist/modern/**/*.cjs"
117683
- },
117684
- "default": {
117685
- types: "./dist/modern/index.d.ts",
117686
- default: "./dist/modern/**/*.js"
117687
- }
117688
- },
117689
117527
  ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117690
117528
  [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117691
117529
  types: (0, import_path3.join)(
@@ -117701,6 +117539,29 @@ ${externalDependencies.map((dep) => {
117701
117539
  },
117702
117540
  "./package.json": "./package.json"
117703
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
+ );
117704
117565
  packageJson.funding ??= workspacePackageJson.funding;
117705
117566
  packageJson.types ??= "dist/legacy/index.d.ts";
117706
117567
  packageJson.typings ??= "dist/legacy/index.d.ts";
@@ -117787,45 +117648,53 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
117787
117648
  })
117788
117649
  );
117789
117650
  options.plugins.push(environmentPlugin(stormEnv));
117790
- const config = getConfig(context.root, projectRoot, sourceRoot, {
117791
- ...options,
117792
- define: {
117793
- __STORM_CONFIG: JSON.stringify(stormEnv)
117794
- },
117795
- env: {
117796
- __STORM_CONFIG: JSON.stringify(stormEnv),
117797
- ...stormEnv
117798
- },
117799
- dtsTsConfig: getNormalizedTsConfig(
117800
- context.root,
117801
- options.outputPath,
117802
- (0, import_tsc.createTypeScriptCompilationOptions)(
117803
- (0, import_normalize_options.normalizeOptions)(
117804
- {
117805
- ...options,
117806
- watch: false,
117807
- main: options.entry,
117808
- 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)
117809
117658
  },
117810
- context.root,
117811
- sourceRoot,
117812
- workspaceRoot
117813
- ),
117814
- context
117815
- )
117816
- ),
117817
- banner: options.banner ? {
117818
- 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}
117819
117683
 
117820
117684
  `,
117821
- css: `/*
117685
+ css: `/*
117822
117686
  ${options.banner}
117823
117687
  */
117824
117688
 
117825
117689
  `
117826
- } : void 0,
117827
- outputPath: options.outputPath
117828
- });
117690
+ } : void 0,
117691
+ outputPath: options.outputPath,
117692
+ entry: key
117693
+ })
117694
+ );
117695
+ return ret;
117696
+ }, [])
117697
+ ]);
117829
117698
  if (typeof config === "function") {
117830
117699
  await build(await Promise.resolve(config({})));
117831
117700
  } else {
@@ -117875,9 +117744,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
117875
117744
  var build = async (options) => {
117876
117745
  Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
117877
117746
  if (Array.isArray(options)) {
117878
- await Promise.all(options.map((buildOptions) => (0, import_tsup2.build)(buildOptions)));
117747
+ await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
117879
117748
  } else {
117880
- await (0, import_tsup2.build)(options);
117749
+ await (0, import_tsup.build)(options);
117881
117750
  }
117882
117751
  };
117883
117752
  var isPrimitive = (value) => {