@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.
- package/CHANGELOG.md +14 -0
- package/index.js +117 -177
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/executors/tsup/executor.js +117 -177
- package/src/executors/tsup/get-config.js +647 -70995
- package/src/executors/tsup-browser/executor.js +117 -177
- package/src/executors/tsup-neutral/executor.js +117 -177
- package/src/executors/tsup-node/executor.js +117 -177
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.30.9](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.8...workspace-tools-v1.30.9) (2023-12-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **workspace-tools:** Update package.json export to include new options ([480d5d0](https://github.com/storm-software/storm-ops/commit/480d5d06eee301206ac0ed7c03ae6d7a22835b84))
|
|
7
|
+
|
|
8
|
+
## [1.30.8](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.30.7...workspace-tools-v1.30.8) (2023-12-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **workspace-tools:** Resolve issue with dist paths in non-windows systems ([ea9e3a6](https://github.com/storm-software/storm-ops/commit/ea9e3a625847d0eb3472ec34a450b5c220103fd6))
|
|
14
|
+
|
|
1
15
|
## [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
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
|
|
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 =
|
|
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
|
|
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,7 +117234,7 @@ function modernConfig({
|
|
|
117235
117234
|
"ios15",
|
|
117236
117235
|
"opera77",
|
|
117237
117236
|
"esnext"
|
|
117238
|
-
] : ["esnext", "
|
|
117237
|
+
] : ["esnext", "node"],
|
|
117239
117238
|
tsconfig,
|
|
117240
117239
|
splitting,
|
|
117241
117240
|
generatePackageJson,
|
|
@@ -117352,139 +117351,21 @@ function legacyConfig({
|
|
|
117352
117351
|
outExtension
|
|
117353
117352
|
};
|
|
117354
117353
|
}
|
|
117355
|
-
function
|
|
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
|
-
apiReport,
|
|
117420
|
-
docModel,
|
|
117421
|
-
tsdocMetadata,
|
|
117422
|
-
sourcemap: debug,
|
|
117423
|
-
clean: false,
|
|
117424
|
-
tsconfigDecoratorMetadata: true,
|
|
117425
|
-
plugins,
|
|
117426
|
-
outExtension
|
|
117427
|
-
};
|
|
117428
|
-
}
|
|
117429
|
-
function getConfig(workspaceRoot, projectRoot, sourceRoot, {
|
|
117354
|
+
function getConfig(workspaceRoot, projectRoot, getConfigFn, {
|
|
117430
117355
|
outputPath,
|
|
117431
117356
|
tsConfig,
|
|
117432
117357
|
additionalEntryPoints,
|
|
117433
117358
|
platform,
|
|
117434
|
-
emitOnAll = true,
|
|
117435
117359
|
...rest
|
|
117436
117360
|
}) {
|
|
117437
|
-
|
|
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 = {
|
|
117361
|
+
return getConfigFn({
|
|
117475
117362
|
...rest,
|
|
117476
|
-
entry,
|
|
117477
117363
|
outDir: outputPath,
|
|
117478
117364
|
tsconfig: tsConfig,
|
|
117479
117365
|
workspaceRoot,
|
|
117480
117366
|
projectRoot,
|
|
117481
|
-
sourceRoot,
|
|
117482
117367
|
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)]);
|
|
117368
|
+
});
|
|
117488
117369
|
}
|
|
117489
117370
|
var outExtension = ({ format: format2 }) => {
|
|
117490
117371
|
let jsExtension = ".js";
|
|
@@ -117641,20 +117522,57 @@ ${externalDependencies.map((dep) => {
|
|
|
117641
117522
|
arrowParens: "avoid",
|
|
117642
117523
|
endOfLine: "lf"
|
|
117643
117524
|
};
|
|
117525
|
+
const entryPoints = [];
|
|
117526
|
+
if (options.entry) {
|
|
117527
|
+
entryPoints.push(options.entry);
|
|
117528
|
+
}
|
|
117529
|
+
if (options.emitOnAll !== false) {
|
|
117530
|
+
entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
|
|
117531
|
+
}
|
|
117532
|
+
if (options.additionalEntryPoints) {
|
|
117533
|
+
entryPoints.push(...options.additionalEntryPoints);
|
|
117534
|
+
}
|
|
117535
|
+
const entry = globSync(entryPoints, {
|
|
117536
|
+
withFileTypes: true
|
|
117537
|
+
}).reduce((ret, filePath) => {
|
|
117538
|
+
let formattedPath = workspaceRoot.replaceAll("\\", "/");
|
|
117539
|
+
if (formattedPath.toUpperCase().startsWith("C:")) {
|
|
117540
|
+
formattedPath = formattedPath.substring(2);
|
|
117541
|
+
}
|
|
117542
|
+
let propertyKey = (0, import_devkit2.joinPathFragments)(
|
|
117543
|
+
filePath.path,
|
|
117544
|
+
removeExtension(filePath.name)
|
|
117545
|
+
).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
117546
|
+
if (propertyKey) {
|
|
117547
|
+
while (propertyKey.startsWith("/")) {
|
|
117548
|
+
propertyKey = propertyKey.substring(1);
|
|
117549
|
+
}
|
|
117550
|
+
console.debug(
|
|
117551
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
117552
|
+
filePath.path,
|
|
117553
|
+
filePath.name
|
|
117554
|
+
)}"`
|
|
117555
|
+
);
|
|
117556
|
+
if (!(propertyKey in ret)) {
|
|
117557
|
+
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
117558
|
+
}
|
|
117559
|
+
}
|
|
117560
|
+
return ret;
|
|
117561
|
+
}, {});
|
|
117644
117562
|
if (options.generatePackageJson !== false) {
|
|
117645
117563
|
const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
|
|
117646
117564
|
const pathToPackageJson = (0, import_path3.join)(context.root, projectRoot, "package.json");
|
|
117647
117565
|
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117648
117566
|
delete packageJson.dependencies;
|
|
117649
|
-
externalDependencies.forEach((
|
|
117650
|
-
const packageConfig =
|
|
117651
|
-
if (packageConfig?.packageName && !!(projectGraph.externalNodes[
|
|
117567
|
+
externalDependencies.forEach((externalDependency) => {
|
|
117568
|
+
const packageConfig = externalDependency.node.data;
|
|
117569
|
+
if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
|
|
117652
117570
|
const { packageName, version } = packageConfig;
|
|
117653
117571
|
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117654
117572
|
return;
|
|
117655
117573
|
}
|
|
117656
117574
|
packageJson.dependencies ??= {};
|
|
117657
|
-
packageJson.dependencies[packageName] = !!projectGraph.nodes[
|
|
117575
|
+
packageJson.dependencies[packageName] = !!projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
|
|
117658
117576
|
}
|
|
117659
117577
|
});
|
|
117660
117578
|
internalDependencies.forEach((packageName) => {
|
|
@@ -117676,20 +117594,6 @@ ${externalDependencies.map((dep) => {
|
|
|
117676
117594
|
types: "./dist/modern/index.d.ts",
|
|
117677
117595
|
default: "./dist/modern/index.js"
|
|
117678
117596
|
},
|
|
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
117597
|
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117694
117598
|
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117695
117599
|
types: (0, import_path3.join)(
|
|
@@ -117705,6 +117609,30 @@ ${externalDependencies.map((dep) => {
|
|
|
117705
117609
|
},
|
|
117706
117610
|
"./package.json": "./package.json"
|
|
117707
117611
|
};
|
|
117612
|
+
packageJson.exports = Object.keys(entry).reduce(
|
|
117613
|
+
(ret, key) => {
|
|
117614
|
+
let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
|
|
117615
|
+
packageJsonKey = packageJsonKey.replaceAll("/index", "");
|
|
117616
|
+
if (!ret[packageJsonKey]) {
|
|
117617
|
+
ret[packageJsonKey] = {
|
|
117618
|
+
import: {
|
|
117619
|
+
types: `./dist/modern/${key}.d.ts`,
|
|
117620
|
+
default: `./dist/modern/${key}.js`
|
|
117621
|
+
},
|
|
117622
|
+
require: {
|
|
117623
|
+
types: `./dist/modern/${key}.d.cts`,
|
|
117624
|
+
default: `./dist/modern/${key}.cjs`
|
|
117625
|
+
},
|
|
117626
|
+
default: {
|
|
117627
|
+
types: `./dist/modern/${key}.d.ts`,
|
|
117628
|
+
default: `./dist/modern/${key}.js`
|
|
117629
|
+
}
|
|
117630
|
+
};
|
|
117631
|
+
}
|
|
117632
|
+
return ret;
|
|
117633
|
+
},
|
|
117634
|
+
packageJson.exports
|
|
117635
|
+
);
|
|
117708
117636
|
packageJson.funding ??= workspacePackageJson.funding;
|
|
117709
117637
|
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117710
117638
|
packageJson.typings ??= "dist/legacy/index.d.ts";
|
|
@@ -117791,45 +117719,57 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
|
|
|
117791
117719
|
})
|
|
117792
117720
|
);
|
|
117793
117721
|
options.plugins.push(environmentPlugin(stormEnv));
|
|
117794
|
-
const config =
|
|
117795
|
-
...
|
|
117796
|
-
|
|
117797
|
-
|
|
117798
|
-
|
|
117799
|
-
|
|
117800
|
-
|
|
117801
|
-
|
|
117802
|
-
|
|
117803
|
-
|
|
117804
|
-
|
|
117805
|
-
|
|
117806
|
-
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
117807
|
-
(0, import_normalize_options.normalizeOptions)(
|
|
117808
|
-
{
|
|
117809
|
-
...options,
|
|
117810
|
-
watch: false,
|
|
117811
|
-
main: options.entry,
|
|
117812
|
-
transformers: []
|
|
117813
|
-
},
|
|
117722
|
+
const config = (0, import_tsup.defineConfig)([
|
|
117723
|
+
...Object.keys(entry).reduce((ret, key) => {
|
|
117724
|
+
const getConfigOptions = {
|
|
117725
|
+
...options,
|
|
117726
|
+
define: {
|
|
117727
|
+
__STORM_CONFIG: JSON.stringify(stormEnv)
|
|
117728
|
+
},
|
|
117729
|
+
env: {
|
|
117730
|
+
__STORM_CONFIG: JSON.stringify(stormEnv),
|
|
117731
|
+
...stormEnv
|
|
117732
|
+
},
|
|
117733
|
+
dtsTsConfig: getNormalizedTsConfig(
|
|
117814
117734
|
context.root,
|
|
117815
|
-
|
|
117816
|
-
|
|
117735
|
+
options.outputPath,
|
|
117736
|
+
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
117737
|
+
(0, import_normalize_options.normalizeOptions)(
|
|
117738
|
+
{
|
|
117739
|
+
...options,
|
|
117740
|
+
watch: false,
|
|
117741
|
+
main: entry[key],
|
|
117742
|
+
transformers: []
|
|
117743
|
+
},
|
|
117744
|
+
context.root,
|
|
117745
|
+
sourceRoot,
|
|
117746
|
+
workspaceRoot
|
|
117747
|
+
),
|
|
117748
|
+
context
|
|
117749
|
+
)
|
|
117817
117750
|
),
|
|
117818
|
-
|
|
117819
|
-
|
|
117820
|
-
),
|
|
117821
|
-
banner: options.banner ? {
|
|
117822
|
-
js: `${options.banner}
|
|
117751
|
+
banner: options.banner ? {
|
|
117752
|
+
js: `${options.banner}
|
|
117823
117753
|
|
|
117824
117754
|
`,
|
|
117825
|
-
|
|
117755
|
+
css: `/*
|
|
117826
117756
|
${options.banner}
|
|
117827
117757
|
*/
|
|
117828
117758
|
|
|
117829
117759
|
`
|
|
117830
|
-
|
|
117831
|
-
|
|
117832
|
-
|
|
117760
|
+
} : void 0,
|
|
117761
|
+
outputPath: options.outputPath,
|
|
117762
|
+
entry: entry[key]
|
|
117763
|
+
};
|
|
117764
|
+
ret.push(
|
|
117765
|
+
getConfig(context.root, projectRoot, legacyConfig, getConfigOptions)
|
|
117766
|
+
);
|
|
117767
|
+
ret.push(
|
|
117768
|
+
getConfig(context.root, projectRoot, modernConfig, getConfigOptions)
|
|
117769
|
+
);
|
|
117770
|
+
return ret;
|
|
117771
|
+
}, [])
|
|
117772
|
+
]);
|
|
117833
117773
|
if (typeof config === "function") {
|
|
117834
117774
|
await build(await Promise.resolve(config({})));
|
|
117835
117775
|
} else {
|
|
@@ -117879,9 +117819,9 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
117879
117819
|
var build = async (options) => {
|
|
117880
117820
|
Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
117881
117821
|
if (Array.isArray(options)) {
|
|
117882
|
-
await Promise.all(options.map((buildOptions) => (0,
|
|
117822
|
+
await Promise.all(options.map((buildOptions) => (0, import_tsup.build)(buildOptions)));
|
|
117883
117823
|
} else {
|
|
117884
|
-
await (0,
|
|
117824
|
+
await (0, import_tsup.build)(options);
|
|
117885
117825
|
}
|
|
117886
117826
|
};
|
|
117887
117827
|
var isPrimitive = (value) => {
|