@storm-software/workspace-tools 1.62.29 → 1.62.31
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 +24 -0
- package/index.js +112 -87
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/executors/tsup/executor.js +78 -53
- package/src/executors/tsup-browser/executor.js +80 -55
- package/src/executors/tsup-neutral/executor.js +80 -55
- package/src/executors/tsup-node/executor.js +81 -56
- package/src/utils/index.js +51 -26
|
@@ -325036,12 +325036,12 @@ var require_install_packages_task = __commonJS({
|
|
|
325036
325036
|
var child_process_1 = require("child_process");
|
|
325037
325037
|
var path_1 = require("path");
|
|
325038
325038
|
var nx_1 = require_nx();
|
|
325039
|
-
var { detectPackageManager, getPackageManagerCommand, joinPathFragments:
|
|
325039
|
+
var { detectPackageManager, getPackageManagerCommand, joinPathFragments: joinPathFragments4 } = (0, nx_1.requireNx)();
|
|
325040
325040
|
function installPackagesTask(tree, alwaysRun = false, cwd = "", packageManager = detectPackageManager(cwd)) {
|
|
325041
|
-
if (!tree.listChanges().find((f7) => f7.path ===
|
|
325041
|
+
if (!tree.listChanges().find((f7) => f7.path === joinPathFragments4(cwd, "package.json")) && !alwaysRun) {
|
|
325042
325042
|
return;
|
|
325043
325043
|
}
|
|
325044
|
-
const packageJsonValue = tree.read(
|
|
325044
|
+
const packageJsonValue = tree.read(joinPathFragments4(cwd, "package.json"), "utf-8");
|
|
325045
325045
|
let storedPackageJsonValue = global["__packageJsonInstallCache__"];
|
|
325046
325046
|
if (storedPackageJsonValue != packageJsonValue || alwaysRun) {
|
|
325047
325047
|
global["__packageJsonInstallCache__"] = packageJsonValue;
|
|
@@ -444495,7 +444495,7 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
444495
444495
|
var nx_1 = require_nx();
|
|
444496
444496
|
var get_workspace_layout_1 = require_get_workspace_layout();
|
|
444497
444497
|
var names_1 = require_names();
|
|
444498
|
-
var { joinPathFragments:
|
|
444498
|
+
var { joinPathFragments: joinPathFragments4, logger, normalizePath, output, readJson: readJson2, stripIndents, workspaceRoot } = (0, nx_1.requireNx)();
|
|
444499
444499
|
async function determineProjectNameAndRootOptions(tree, options8) {
|
|
444500
444500
|
if (!options8.projectNameAndRootFormat && (process.env.NX_INTERACTIVE !== "true" || !isTTY())) {
|
|
444501
444501
|
options8.projectNameAndRootFormat = "derived";
|
|
@@ -444622,14 +444622,14 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
444622
444622
|
if (options8.directory === relativeCwd || options8.directory.startsWith(`${relativeCwd}/`)) {
|
|
444623
444623
|
projectRoot = options8.directory;
|
|
444624
444624
|
} else {
|
|
444625
|
-
projectRoot =
|
|
444625
|
+
projectRoot = joinPathFragments4(relativeCwd, options8.directory);
|
|
444626
444626
|
}
|
|
444627
444627
|
} else if (options8.rootProject) {
|
|
444628
444628
|
projectRoot = ".";
|
|
444629
444629
|
} else {
|
|
444630
444630
|
projectRoot = relativeCwd;
|
|
444631
444631
|
if (!relativeCwd.endsWith(options8.name)) {
|
|
444632
|
-
projectRoot =
|
|
444632
|
+
projectRoot = joinPathFragments4(relativeCwd, options8.name);
|
|
444633
444633
|
}
|
|
444634
444634
|
}
|
|
444635
444635
|
let importPath = void 0;
|
|
@@ -444662,7 +444662,7 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
444662
444662
|
const projectSimpleName = name;
|
|
444663
444663
|
let projectRoot = projectDirectoryWithoutLayout;
|
|
444664
444664
|
if (projectDirectoryWithoutLayout !== ".") {
|
|
444665
|
-
projectRoot =
|
|
444665
|
+
projectRoot = joinPathFragments4(layoutDirectory, projectRoot);
|
|
444666
444666
|
}
|
|
444667
444667
|
let importPath;
|
|
444668
444668
|
if (options8.projectType === "library") {
|
|
@@ -446772,7 +446772,6 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
446772
446772
|
// packages/workspace-tools/src/utils/run-tsup-build.ts
|
|
446773
446773
|
var import_node_path2 = require("node:path");
|
|
446774
446774
|
var import_esbuild_decorators = __toESM(require_src());
|
|
446775
|
-
var import_devkit2 = __toESM(require_devkit());
|
|
446776
446775
|
var import_get_custom_transformers_factory = __toESM(require_get_custom_transformers_factory());
|
|
446777
446776
|
var import_normalize_options = __toESM(require_normalize_options());
|
|
446778
446777
|
|
|
@@ -446979,7 +446978,7 @@ var applyDefaultOptions = (options8) => {
|
|
|
446979
446978
|
return options8;
|
|
446980
446979
|
};
|
|
446981
446980
|
var runTsupBuild = async (context, config, options8) => {
|
|
446982
|
-
const { writeInfo, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
|
|
446981
|
+
const { writeInfo, writeTrace, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
|
|
446983
446982
|
const workspaceRoot = config?.workspaceRoot ?? findWorkspaceRoot();
|
|
446984
446983
|
const stormEnv = Object.keys(options8.env ?? {}).filter((key2) => key2.startsWith("STORM_")).reduce((ret, key2) => {
|
|
446985
446984
|
ret[key2] = options8.env?.[key2];
|
|
@@ -446992,6 +446991,32 @@ var runTsupBuild = async (context, config, options8) => {
|
|
|
446992
446991
|
})
|
|
446993
446992
|
);
|
|
446994
446993
|
options8.plugins?.push(environmentPlugin(stormEnv));
|
|
446994
|
+
const dtsTsConfig = getNormalizedTsConfig(
|
|
446995
|
+
workspaceRoot,
|
|
446996
|
+
options8.outputPath,
|
|
446997
|
+
createTypeScriptCompilationOptions(
|
|
446998
|
+
(0, import_normalize_options.normalizeOptions)(
|
|
446999
|
+
{
|
|
447000
|
+
...options8,
|
|
447001
|
+
watch: false,
|
|
447002
|
+
main: context.main,
|
|
447003
|
+
transformers: []
|
|
447004
|
+
},
|
|
447005
|
+
workspaceRoot,
|
|
447006
|
+
context.sourceRoot,
|
|
447007
|
+
workspaceRoot
|
|
447008
|
+
),
|
|
447009
|
+
context.projectName
|
|
447010
|
+
)
|
|
447011
|
+
);
|
|
447012
|
+
writeTrace(
|
|
447013
|
+
config,
|
|
447014
|
+
`\u2699\uFE0F TSC (Type Declarations) Build options:
|
|
447015
|
+
${Object.keys(dtsTsConfig.options).map(
|
|
447016
|
+
(key2) => `${key2}: ${!dtsTsConfig.options[key2] || _isPrimitive(dtsTsConfig.options[key2]) ? dtsTsConfig.options[key2] : JSON.stringify(dtsTsConfig.options[key2])}`
|
|
447017
|
+
).join("\n")}
|
|
447018
|
+
`
|
|
447019
|
+
);
|
|
446995
447020
|
const getConfigOptions = {
|
|
446996
447021
|
...options8,
|
|
446997
447022
|
entry: {
|
|
@@ -447009,24 +447034,7 @@ var runTsupBuild = async (context, config, options8) => {
|
|
|
447009
447034
|
return ret;
|
|
447010
447035
|
}, {})
|
|
447011
447036
|
},
|
|
447012
|
-
dtsTsConfig
|
|
447013
|
-
workspaceRoot,
|
|
447014
|
-
options8.outputPath,
|
|
447015
|
-
createTypeScriptCompilationOptions(
|
|
447016
|
-
(0, import_normalize_options.normalizeOptions)(
|
|
447017
|
-
{
|
|
447018
|
-
...options8,
|
|
447019
|
-
watch: false,
|
|
447020
|
-
main: context.main,
|
|
447021
|
-
transformers: []
|
|
447022
|
-
},
|
|
447023
|
-
workspaceRoot,
|
|
447024
|
-
context.sourceRoot,
|
|
447025
|
-
workspaceRoot
|
|
447026
|
-
),
|
|
447027
|
-
context.projectName
|
|
447028
|
-
)
|
|
447029
|
-
),
|
|
447037
|
+
dtsTsConfig,
|
|
447030
447038
|
banner: options8.banner ? {
|
|
447031
447039
|
js: `
|
|
447032
447040
|
|
|
@@ -447077,19 +447085,36 @@ Error: ${rawTsconfig.error.messageText}` : ""}`
|
|
|
447077
447085
|
...rawTsconfig.config,
|
|
447078
447086
|
compilerOptions: {
|
|
447079
447087
|
...rawTsconfig.config?.compilerOptions,
|
|
447080
|
-
|
|
447088
|
+
rootDir: workspaceRoot.replaceAll("\\", "/"),
|
|
447089
|
+
baseUrl: workspaceRoot.replaceAll("\\", "/"),
|
|
447081
447090
|
outDir: outputPath,
|
|
447082
447091
|
noEmit: false,
|
|
447083
447092
|
emitDeclarationOnly: true,
|
|
447084
447093
|
declaration: true,
|
|
447085
447094
|
declarationMap: true,
|
|
447086
|
-
declarationDir: (0, import_node_path2.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
447095
|
+
declarationDir: (0, import_node_path2.join)(workspaceRoot.replaceAll("\\", "/"), "tmp", ".tsup", "declaration")
|
|
447087
447096
|
}
|
|
447088
447097
|
},
|
|
447089
447098
|
import_typescript.sys,
|
|
447090
447099
|
(0, import_node_path2.dirname)(options8.tsConfig)
|
|
447091
447100
|
);
|
|
447092
|
-
parsedTsconfig.options.pathsBasePath = workspaceRoot;
|
|
447101
|
+
parsedTsconfig.options.pathsBasePath = workspaceRoot.replaceAll("\\", "/");
|
|
447102
|
+
if (parsedTsconfig.options.paths) {
|
|
447103
|
+
parsedTsconfig.options.paths = Object.keys(parsedTsconfig.options.paths).reduce(
|
|
447104
|
+
(ret, key2) => {
|
|
447105
|
+
if (parsedTsconfig.options.paths?.[key2]) {
|
|
447106
|
+
ret[key2] = parsedTsconfig.options.paths[key2]?.map(
|
|
447107
|
+
(path14) => (0, import_node_path2.join)(workspaceRoot.replaceAll("\\", "/"), path14)
|
|
447108
|
+
);
|
|
447109
|
+
}
|
|
447110
|
+
return ret;
|
|
447111
|
+
},
|
|
447112
|
+
{}
|
|
447113
|
+
);
|
|
447114
|
+
}
|
|
447115
|
+
if (parsedTsconfig.options.incremental) {
|
|
447116
|
+
parsedTsconfig.options.tsBuildInfoFile = (0, import_node_path2.join)(outputPath, "tsconfig.tsbuildinfo");
|
|
447117
|
+
}
|
|
447093
447118
|
return parsedTsconfig;
|
|
447094
447119
|
}
|
|
447095
447120
|
var build = async (options8, config) => {
|
|
@@ -447141,7 +447166,7 @@ var createTypeScriptCompilationOptions = (normalizedOptions, projectName) => {
|
|
|
447141
447166
|
|
|
447142
447167
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
447143
447168
|
var import_node_fs = require("node:fs");
|
|
447144
|
-
var
|
|
447169
|
+
var import_devkit2 = __toESM(require_devkit());
|
|
447145
447170
|
var import_js = __toESM(require_src6());
|
|
447146
447171
|
var import_fs_extra = __toESM(require_lib5());
|
|
447147
447172
|
|
|
@@ -453427,9 +453452,9 @@ ${Object.keys(options8).map(
|
|
|
453427
453452
|
if (!result.success) {
|
|
453428
453453
|
throw new Error("The Build process failed trying to copy assets");
|
|
453429
453454
|
}
|
|
453430
|
-
const pathToPackageJson = (0,
|
|
453431
|
-
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0,
|
|
453432
|
-
const workspacePackageJson = (0,
|
|
453455
|
+
const pathToPackageJson = (0, import_devkit2.joinPathFragments)(context.root, projectRoot, "package.json");
|
|
453456
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
453457
|
+
const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_devkit2.joinPathFragments)(workspaceRoot, "package.json"));
|
|
453433
453458
|
options8.external = options8.external || [];
|
|
453434
453459
|
if (workspacePackageJson?.dependencies) {
|
|
453435
453460
|
options8.external = Object.keys(workspacePackageJson?.dependencies).reduce(
|
|
@@ -453470,7 +453495,7 @@ ${Object.keys(options8).map(
|
|
|
453470
453495
|
writeDebug(config, `\u26A1 Adding implicit dependency: ${key2}`);
|
|
453471
453496
|
const projectConfig = projectConfigs[key2];
|
|
453472
453497
|
if (projectConfig?.targets?.build) {
|
|
453473
|
-
const projectPackageJson = (0,
|
|
453498
|
+
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
453474
453499
|
if (projectPackageJson?.name && !options8.external?.includes(projectPackageJson.name)) {
|
|
453475
453500
|
ret.push(projectPackageJson.name);
|
|
453476
453501
|
internalDependencies.push(projectPackageJson.name);
|
|
@@ -453507,34 +453532,34 @@ ${externalDependencies.map((dep) => {
|
|
|
453507
453532
|
entryPoints.push(...options8.additionalEntryPoints);
|
|
453508
453533
|
}
|
|
453509
453534
|
if (options8.emitOnAll === true) {
|
|
453510
|
-
entryPoints = globSync((0,
|
|
453535
|
+
entryPoints = globSync((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"), {
|
|
453511
453536
|
withFileTypes: true
|
|
453512
453537
|
}).reduce((ret, filePath) => {
|
|
453513
453538
|
let formattedPath = workspaceRoot.replaceAll("\\", "/");
|
|
453514
453539
|
if (formattedPath.toUpperCase().startsWith("C:")) {
|
|
453515
453540
|
formattedPath = formattedPath.substring(2);
|
|
453516
453541
|
}
|
|
453517
|
-
let propertyKey = (0,
|
|
453542
|
+
let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
453518
453543
|
if (propertyKey) {
|
|
453519
453544
|
while (propertyKey.startsWith("/")) {
|
|
453520
453545
|
propertyKey = propertyKey.substring(1);
|
|
453521
453546
|
}
|
|
453522
453547
|
writeDebug(
|
|
453523
453548
|
config,
|
|
453524
|
-
`Trying to add entry point ${propertyKey} at "${(0,
|
|
453549
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
453525
453550
|
filePath.path,
|
|
453526
453551
|
filePath.name
|
|
453527
453552
|
)}"`
|
|
453528
453553
|
);
|
|
453529
453554
|
if (!ret.includes(propertyKey)) {
|
|
453530
|
-
ret.push((0,
|
|
453555
|
+
ret.push((0, import_devkit2.joinPathFragments)(filePath.path, filePath.name));
|
|
453531
453556
|
}
|
|
453532
453557
|
}
|
|
453533
453558
|
return ret;
|
|
453534
453559
|
}, entryPoints);
|
|
453535
453560
|
}
|
|
453536
453561
|
if (options8.generatePackageJson !== false) {
|
|
453537
|
-
const projectGraph = (0,
|
|
453562
|
+
const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
|
|
453538
453563
|
if (options8.bundle === false) {
|
|
453539
453564
|
packageJson.dependencies = void 0;
|
|
453540
453565
|
for (const externalDependency of externalDependencies) {
|
|
@@ -453587,16 +453612,16 @@ ${externalDependencies.map((dep) => {
|
|
|
453587
453612
|
}
|
|
453588
453613
|
packageJson.exports[`./${formattedEntryPoint}`] = {
|
|
453589
453614
|
import: {
|
|
453590
|
-
types: `./${(0,
|
|
453591
|
-
default: `./${(0,
|
|
453615
|
+
types: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.d.ts`,
|
|
453616
|
+
default: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.js`
|
|
453592
453617
|
},
|
|
453593
453618
|
require: {
|
|
453594
|
-
types: `./${(0,
|
|
453595
|
-
default: `./${(0,
|
|
453619
|
+
types: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.d.cts`,
|
|
453620
|
+
default: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.cjs`
|
|
453596
453621
|
},
|
|
453597
453622
|
default: {
|
|
453598
|
-
types: `./${(0,
|
|
453599
|
-
default: `./${(0,
|
|
453623
|
+
types: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.d.ts`,
|
|
453624
|
+
default: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.js`
|
|
453600
453625
|
}
|
|
453601
453626
|
};
|
|
453602
453627
|
}
|
|
@@ -453620,7 +453645,7 @@ ${externalDependencies.map((dep) => {
|
|
|
453620
453645
|
if (distSrc.startsWith("/")) {
|
|
453621
453646
|
distSrc = distSrc.substring(1);
|
|
453622
453647
|
}
|
|
453623
|
-
packageJson.source ??= `${(0,
|
|
453648
|
+
packageJson.source ??= `${(0, import_devkit2.joinPathFragments)(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
453624
453649
|
}
|
|
453625
453650
|
packageJson.files ??= ["dist/**/*"];
|
|
453626
453651
|
if (options8.includeSrc === true && !packageJson.files.includes("src")) {
|
|
@@ -453637,8 +453662,8 @@ ${externalDependencies.map((dep) => {
|
|
|
453637
453662
|
packageJson.license ??= workspacePackageJson.license;
|
|
453638
453663
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
453639
453664
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
453640
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0,
|
|
453641
|
-
const packageJsonPath = (0,
|
|
453665
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_devkit2.joinPathFragments)("packages", context.projectName);
|
|
453666
|
+
const packageJsonPath = (0, import_devkit2.joinPathFragments)(context.root, options8.outputPath, "package.json");
|
|
453642
453667
|
writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
453643
453668
|
(0, import_node_fs.writeFileSync)(packageJsonPath, JSON.stringify(packageJson));
|
|
453644
453669
|
} else {
|
|
@@ -453646,10 +453671,10 @@ ${externalDependencies.map((dep) => {
|
|
|
453646
453671
|
}
|
|
453647
453672
|
if (options8.includeSrc === true) {
|
|
453648
453673
|
const files = globSync([
|
|
453649
|
-
(0,
|
|
453650
|
-
(0,
|
|
453651
|
-
(0,
|
|
453652
|
-
(0,
|
|
453674
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.ts"),
|
|
453675
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.tsx"),
|
|
453676
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.js"),
|
|
453677
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.jsx")
|
|
453653
453678
|
]);
|
|
453654
453679
|
options8.verbose = options8.verbose || getLogLevel(config?.logLevel) >= LogLevel.DEBUG;
|
|
453655
453680
|
await Promise.allSettled(
|
|
@@ -453706,7 +453731,7 @@ var _isFunction3 = (value) => {
|
|
|
453706
453731
|
};
|
|
453707
453732
|
|
|
453708
453733
|
// packages/workspace-tools/src/executors/tsup-neutral/get-config.ts
|
|
453709
|
-
var
|
|
453734
|
+
var import_devkit3 = __toESM(require_devkit());
|
|
453710
453735
|
var neutralConfig = ({
|
|
453711
453736
|
entry,
|
|
453712
453737
|
outDir,
|
|
@@ -453734,7 +453759,7 @@ var neutralConfig = ({
|
|
|
453734
453759
|
minify = false,
|
|
453735
453760
|
getTransform
|
|
453736
453761
|
}) => {
|
|
453737
|
-
const outputPath = (0,
|
|
453762
|
+
const outputPath = (0, import_devkit3.joinPathFragments)(outDir, "dist");
|
|
453738
453763
|
const options8 = {
|
|
453739
453764
|
name: "neutral",
|
|
453740
453765
|
entry,
|
|
@@ -325036,12 +325036,12 @@ var require_install_packages_task = __commonJS({
|
|
|
325036
325036
|
var child_process_1 = require("child_process");
|
|
325037
325037
|
var path_1 = require("path");
|
|
325038
325038
|
var nx_1 = require_nx();
|
|
325039
|
-
var { detectPackageManager, getPackageManagerCommand, joinPathFragments:
|
|
325039
|
+
var { detectPackageManager, getPackageManagerCommand, joinPathFragments: joinPathFragments4 } = (0, nx_1.requireNx)();
|
|
325040
325040
|
function installPackagesTask(tree, alwaysRun = false, cwd = "", packageManager = detectPackageManager(cwd)) {
|
|
325041
|
-
if (!tree.listChanges().find((f7) => f7.path ===
|
|
325041
|
+
if (!tree.listChanges().find((f7) => f7.path === joinPathFragments4(cwd, "package.json")) && !alwaysRun) {
|
|
325042
325042
|
return;
|
|
325043
325043
|
}
|
|
325044
|
-
const packageJsonValue = tree.read(
|
|
325044
|
+
const packageJsonValue = tree.read(joinPathFragments4(cwd, "package.json"), "utf-8");
|
|
325045
325045
|
let storedPackageJsonValue = global["__packageJsonInstallCache__"];
|
|
325046
325046
|
if (storedPackageJsonValue != packageJsonValue || alwaysRun) {
|
|
325047
325047
|
global["__packageJsonInstallCache__"] = packageJsonValue;
|
|
@@ -444495,7 +444495,7 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
444495
444495
|
var nx_1 = require_nx();
|
|
444496
444496
|
var get_workspace_layout_1 = require_get_workspace_layout();
|
|
444497
444497
|
var names_1 = require_names();
|
|
444498
|
-
var { joinPathFragments:
|
|
444498
|
+
var { joinPathFragments: joinPathFragments4, logger, normalizePath, output, readJson: readJson2, stripIndents, workspaceRoot } = (0, nx_1.requireNx)();
|
|
444499
444499
|
async function determineProjectNameAndRootOptions(tree, options8) {
|
|
444500
444500
|
if (!options8.projectNameAndRootFormat && (process.env.NX_INTERACTIVE !== "true" || !isTTY())) {
|
|
444501
444501
|
options8.projectNameAndRootFormat = "derived";
|
|
@@ -444622,14 +444622,14 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
444622
444622
|
if (options8.directory === relativeCwd || options8.directory.startsWith(`${relativeCwd}/`)) {
|
|
444623
444623
|
projectRoot = options8.directory;
|
|
444624
444624
|
} else {
|
|
444625
|
-
projectRoot =
|
|
444625
|
+
projectRoot = joinPathFragments4(relativeCwd, options8.directory);
|
|
444626
444626
|
}
|
|
444627
444627
|
} else if (options8.rootProject) {
|
|
444628
444628
|
projectRoot = ".";
|
|
444629
444629
|
} else {
|
|
444630
444630
|
projectRoot = relativeCwd;
|
|
444631
444631
|
if (!relativeCwd.endsWith(options8.name)) {
|
|
444632
|
-
projectRoot =
|
|
444632
|
+
projectRoot = joinPathFragments4(relativeCwd, options8.name);
|
|
444633
444633
|
}
|
|
444634
444634
|
}
|
|
444635
444635
|
let importPath = void 0;
|
|
@@ -444662,7 +444662,7 @@ var require_project_name_and_root_utils = __commonJS({
|
|
|
444662
444662
|
const projectSimpleName = name;
|
|
444663
444663
|
let projectRoot = projectDirectoryWithoutLayout;
|
|
444664
444664
|
if (projectDirectoryWithoutLayout !== ".") {
|
|
444665
|
-
projectRoot =
|
|
444665
|
+
projectRoot = joinPathFragments4(layoutDirectory, projectRoot);
|
|
444666
444666
|
}
|
|
444667
444667
|
let importPath;
|
|
444668
444668
|
if (options8.projectType === "library") {
|
|
@@ -446772,7 +446772,6 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
446772
446772
|
// packages/workspace-tools/src/utils/run-tsup-build.ts
|
|
446773
446773
|
var import_node_path2 = require("node:path");
|
|
446774
446774
|
var import_esbuild_decorators = __toESM(require_src());
|
|
446775
|
-
var import_devkit2 = __toESM(require_devkit());
|
|
446776
446775
|
var import_get_custom_transformers_factory = __toESM(require_get_custom_transformers_factory());
|
|
446777
446776
|
var import_normalize_options = __toESM(require_normalize_options());
|
|
446778
446777
|
|
|
@@ -446979,7 +446978,7 @@ var applyDefaultOptions = (options8) => {
|
|
|
446979
446978
|
return options8;
|
|
446980
446979
|
};
|
|
446981
446980
|
var runTsupBuild = async (context, config, options8) => {
|
|
446982
|
-
const { writeInfo, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
|
|
446981
|
+
const { writeInfo, writeTrace, writeWarning, findWorkspaceRoot } = await import("@storm-software/config-tools");
|
|
446983
446982
|
const workspaceRoot = config?.workspaceRoot ?? findWorkspaceRoot();
|
|
446984
446983
|
const stormEnv = Object.keys(options8.env ?? {}).filter((key2) => key2.startsWith("STORM_")).reduce((ret, key2) => {
|
|
446985
446984
|
ret[key2] = options8.env?.[key2];
|
|
@@ -446992,6 +446991,32 @@ var runTsupBuild = async (context, config, options8) => {
|
|
|
446992
446991
|
})
|
|
446993
446992
|
);
|
|
446994
446993
|
options8.plugins?.push(environmentPlugin(stormEnv));
|
|
446994
|
+
const dtsTsConfig = getNormalizedTsConfig(
|
|
446995
|
+
workspaceRoot,
|
|
446996
|
+
options8.outputPath,
|
|
446997
|
+
createTypeScriptCompilationOptions(
|
|
446998
|
+
(0, import_normalize_options.normalizeOptions)(
|
|
446999
|
+
{
|
|
447000
|
+
...options8,
|
|
447001
|
+
watch: false,
|
|
447002
|
+
main: context.main,
|
|
447003
|
+
transformers: []
|
|
447004
|
+
},
|
|
447005
|
+
workspaceRoot,
|
|
447006
|
+
context.sourceRoot,
|
|
447007
|
+
workspaceRoot
|
|
447008
|
+
),
|
|
447009
|
+
context.projectName
|
|
447010
|
+
)
|
|
447011
|
+
);
|
|
447012
|
+
writeTrace(
|
|
447013
|
+
config,
|
|
447014
|
+
`\u2699\uFE0F TSC (Type Declarations) Build options:
|
|
447015
|
+
${Object.keys(dtsTsConfig.options).map(
|
|
447016
|
+
(key2) => `${key2}: ${!dtsTsConfig.options[key2] || _isPrimitive(dtsTsConfig.options[key2]) ? dtsTsConfig.options[key2] : JSON.stringify(dtsTsConfig.options[key2])}`
|
|
447017
|
+
).join("\n")}
|
|
447018
|
+
`
|
|
447019
|
+
);
|
|
446995
447020
|
const getConfigOptions = {
|
|
446996
447021
|
...options8,
|
|
446997
447022
|
entry: {
|
|
@@ -447009,24 +447034,7 @@ var runTsupBuild = async (context, config, options8) => {
|
|
|
447009
447034
|
return ret;
|
|
447010
447035
|
}, {})
|
|
447011
447036
|
},
|
|
447012
|
-
dtsTsConfig
|
|
447013
|
-
workspaceRoot,
|
|
447014
|
-
options8.outputPath,
|
|
447015
|
-
createTypeScriptCompilationOptions(
|
|
447016
|
-
(0, import_normalize_options.normalizeOptions)(
|
|
447017
|
-
{
|
|
447018
|
-
...options8,
|
|
447019
|
-
watch: false,
|
|
447020
|
-
main: context.main,
|
|
447021
|
-
transformers: []
|
|
447022
|
-
},
|
|
447023
|
-
workspaceRoot,
|
|
447024
|
-
context.sourceRoot,
|
|
447025
|
-
workspaceRoot
|
|
447026
|
-
),
|
|
447027
|
-
context.projectName
|
|
447028
|
-
)
|
|
447029
|
-
),
|
|
447037
|
+
dtsTsConfig,
|
|
447030
447038
|
banner: options8.banner ? {
|
|
447031
447039
|
js: `
|
|
447032
447040
|
|
|
@@ -447077,19 +447085,36 @@ Error: ${rawTsconfig.error.messageText}` : ""}`
|
|
|
447077
447085
|
...rawTsconfig.config,
|
|
447078
447086
|
compilerOptions: {
|
|
447079
447087
|
...rawTsconfig.config?.compilerOptions,
|
|
447080
|
-
|
|
447088
|
+
rootDir: workspaceRoot.replaceAll("\\", "/"),
|
|
447089
|
+
baseUrl: workspaceRoot.replaceAll("\\", "/"),
|
|
447081
447090
|
outDir: outputPath,
|
|
447082
447091
|
noEmit: false,
|
|
447083
447092
|
emitDeclarationOnly: true,
|
|
447084
447093
|
declaration: true,
|
|
447085
447094
|
declarationMap: true,
|
|
447086
|
-
declarationDir: (0, import_node_path2.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
447095
|
+
declarationDir: (0, import_node_path2.join)(workspaceRoot.replaceAll("\\", "/"), "tmp", ".tsup", "declaration")
|
|
447087
447096
|
}
|
|
447088
447097
|
},
|
|
447089
447098
|
import_typescript.sys,
|
|
447090
447099
|
(0, import_node_path2.dirname)(options8.tsConfig)
|
|
447091
447100
|
);
|
|
447092
|
-
parsedTsconfig.options.pathsBasePath = workspaceRoot;
|
|
447101
|
+
parsedTsconfig.options.pathsBasePath = workspaceRoot.replaceAll("\\", "/");
|
|
447102
|
+
if (parsedTsconfig.options.paths) {
|
|
447103
|
+
parsedTsconfig.options.paths = Object.keys(parsedTsconfig.options.paths).reduce(
|
|
447104
|
+
(ret, key2) => {
|
|
447105
|
+
if (parsedTsconfig.options.paths?.[key2]) {
|
|
447106
|
+
ret[key2] = parsedTsconfig.options.paths[key2]?.map(
|
|
447107
|
+
(path14) => (0, import_node_path2.join)(workspaceRoot.replaceAll("\\", "/"), path14)
|
|
447108
|
+
);
|
|
447109
|
+
}
|
|
447110
|
+
return ret;
|
|
447111
|
+
},
|
|
447112
|
+
{}
|
|
447113
|
+
);
|
|
447114
|
+
}
|
|
447115
|
+
if (parsedTsconfig.options.incremental) {
|
|
447116
|
+
parsedTsconfig.options.tsBuildInfoFile = (0, import_node_path2.join)(outputPath, "tsconfig.tsbuildinfo");
|
|
447117
|
+
}
|
|
447093
447118
|
return parsedTsconfig;
|
|
447094
447119
|
}
|
|
447095
447120
|
var build = async (options8, config) => {
|
|
@@ -447141,7 +447166,7 @@ var createTypeScriptCompilationOptions = (normalizedOptions, projectName) => {
|
|
|
447141
447166
|
|
|
447142
447167
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
447143
447168
|
var import_node_fs = require("node:fs");
|
|
447144
|
-
var
|
|
447169
|
+
var import_devkit2 = __toESM(require_devkit());
|
|
447145
447170
|
var import_js = __toESM(require_src6());
|
|
447146
447171
|
var import_fs_extra = __toESM(require_lib5());
|
|
447147
447172
|
|
|
@@ -453427,9 +453452,9 @@ ${Object.keys(options8).map(
|
|
|
453427
453452
|
if (!result.success) {
|
|
453428
453453
|
throw new Error("The Build process failed trying to copy assets");
|
|
453429
453454
|
}
|
|
453430
|
-
const pathToPackageJson = (0,
|
|
453431
|
-
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0,
|
|
453432
|
-
const workspacePackageJson = (0,
|
|
453455
|
+
const pathToPackageJson = (0, import_devkit2.joinPathFragments)(context.root, projectRoot, "package.json");
|
|
453456
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
453457
|
+
const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_devkit2.joinPathFragments)(workspaceRoot, "package.json"));
|
|
453433
453458
|
options8.external = options8.external || [];
|
|
453434
453459
|
if (workspacePackageJson?.dependencies) {
|
|
453435
453460
|
options8.external = Object.keys(workspacePackageJson?.dependencies).reduce(
|
|
@@ -453470,7 +453495,7 @@ ${Object.keys(options8).map(
|
|
|
453470
453495
|
writeDebug(config, `\u26A1 Adding implicit dependency: ${key2}`);
|
|
453471
453496
|
const projectConfig = projectConfigs[key2];
|
|
453472
453497
|
if (projectConfig?.targets?.build) {
|
|
453473
|
-
const projectPackageJson = (0,
|
|
453498
|
+
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
453474
453499
|
if (projectPackageJson?.name && !options8.external?.includes(projectPackageJson.name)) {
|
|
453475
453500
|
ret.push(projectPackageJson.name);
|
|
453476
453501
|
internalDependencies.push(projectPackageJson.name);
|
|
@@ -453507,34 +453532,34 @@ ${externalDependencies.map((dep) => {
|
|
|
453507
453532
|
entryPoints.push(...options8.additionalEntryPoints);
|
|
453508
453533
|
}
|
|
453509
453534
|
if (options8.emitOnAll === true) {
|
|
453510
|
-
entryPoints = globSync((0,
|
|
453535
|
+
entryPoints = globSync((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"), {
|
|
453511
453536
|
withFileTypes: true
|
|
453512
453537
|
}).reduce((ret, filePath) => {
|
|
453513
453538
|
let formattedPath = workspaceRoot.replaceAll("\\", "/");
|
|
453514
453539
|
if (formattedPath.toUpperCase().startsWith("C:")) {
|
|
453515
453540
|
formattedPath = formattedPath.substring(2);
|
|
453516
453541
|
}
|
|
453517
|
-
let propertyKey = (0,
|
|
453542
|
+
let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
453518
453543
|
if (propertyKey) {
|
|
453519
453544
|
while (propertyKey.startsWith("/")) {
|
|
453520
453545
|
propertyKey = propertyKey.substring(1);
|
|
453521
453546
|
}
|
|
453522
453547
|
writeDebug(
|
|
453523
453548
|
config,
|
|
453524
|
-
`Trying to add entry point ${propertyKey} at "${(0,
|
|
453549
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
453525
453550
|
filePath.path,
|
|
453526
453551
|
filePath.name
|
|
453527
453552
|
)}"`
|
|
453528
453553
|
);
|
|
453529
453554
|
if (!ret.includes(propertyKey)) {
|
|
453530
|
-
ret.push((0,
|
|
453555
|
+
ret.push((0, import_devkit2.joinPathFragments)(filePath.path, filePath.name));
|
|
453531
453556
|
}
|
|
453532
453557
|
}
|
|
453533
453558
|
return ret;
|
|
453534
453559
|
}, entryPoints);
|
|
453535
453560
|
}
|
|
453536
453561
|
if (options8.generatePackageJson !== false) {
|
|
453537
|
-
const projectGraph = (0,
|
|
453562
|
+
const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
|
|
453538
453563
|
if (options8.bundle === false) {
|
|
453539
453564
|
packageJson.dependencies = void 0;
|
|
453540
453565
|
for (const externalDependency of externalDependencies) {
|
|
@@ -453587,16 +453612,16 @@ ${externalDependencies.map((dep) => {
|
|
|
453587
453612
|
}
|
|
453588
453613
|
packageJson.exports[`./${formattedEntryPoint}`] = {
|
|
453589
453614
|
import: {
|
|
453590
|
-
types: `./${(0,
|
|
453591
|
-
default: `./${(0,
|
|
453615
|
+
types: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.d.ts`,
|
|
453616
|
+
default: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.js`
|
|
453592
453617
|
},
|
|
453593
453618
|
require: {
|
|
453594
|
-
types: `./${(0,
|
|
453595
|
-
default: `./${(0,
|
|
453619
|
+
types: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.d.cts`,
|
|
453620
|
+
default: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.cjs`
|
|
453596
453621
|
},
|
|
453597
453622
|
default: {
|
|
453598
|
-
types: `./${(0,
|
|
453599
|
-
default: `./${(0,
|
|
453623
|
+
types: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.d.ts`,
|
|
453624
|
+
default: `./${(0, import_devkit2.joinPathFragments)(distPaths[0] ?? "./", formattedEntryPoint)}.js`
|
|
453600
453625
|
}
|
|
453601
453626
|
};
|
|
453602
453627
|
}
|
|
@@ -453620,7 +453645,7 @@ ${externalDependencies.map((dep) => {
|
|
|
453620
453645
|
if (distSrc.startsWith("/")) {
|
|
453621
453646
|
distSrc = distSrc.substring(1);
|
|
453622
453647
|
}
|
|
453623
|
-
packageJson.source ??= `${(0,
|
|
453648
|
+
packageJson.source ??= `${(0, import_devkit2.joinPathFragments)(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
453624
453649
|
}
|
|
453625
453650
|
packageJson.files ??= ["dist/**/*"];
|
|
453626
453651
|
if (options8.includeSrc === true && !packageJson.files.includes("src")) {
|
|
@@ -453637,8 +453662,8 @@ ${externalDependencies.map((dep) => {
|
|
|
453637
453662
|
packageJson.license ??= workspacePackageJson.license;
|
|
453638
453663
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
453639
453664
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
453640
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0,
|
|
453641
|
-
const packageJsonPath = (0,
|
|
453665
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_devkit2.joinPathFragments)("packages", context.projectName);
|
|
453666
|
+
const packageJsonPath = (0, import_devkit2.joinPathFragments)(context.root, options8.outputPath, "package.json");
|
|
453642
453667
|
writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
453643
453668
|
(0, import_node_fs.writeFileSync)(packageJsonPath, JSON.stringify(packageJson));
|
|
453644
453669
|
} else {
|
|
@@ -453646,10 +453671,10 @@ ${externalDependencies.map((dep) => {
|
|
|
453646
453671
|
}
|
|
453647
453672
|
if (options8.includeSrc === true) {
|
|
453648
453673
|
const files = globSync([
|
|
453649
|
-
(0,
|
|
453650
|
-
(0,
|
|
453651
|
-
(0,
|
|
453652
|
-
(0,
|
|
453674
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.ts"),
|
|
453675
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.tsx"),
|
|
453676
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.js"),
|
|
453677
|
+
(0, import_devkit2.joinPathFragments)(workspaceRoot, options8.outputPath, "src/**/*.jsx")
|
|
453653
453678
|
]);
|
|
453654
453679
|
options8.verbose = options8.verbose || getLogLevel(config?.logLevel) >= LogLevel.DEBUG;
|
|
453655
453680
|
await Promise.allSettled(
|
|
@@ -453706,7 +453731,7 @@ var _isFunction3 = (value) => {
|
|
|
453706
453731
|
};
|
|
453707
453732
|
|
|
453708
453733
|
// packages/workspace-tools/src/executors/tsup-node/get-config.ts
|
|
453709
|
-
var
|
|
453734
|
+
var import_devkit3 = __toESM(require_devkit());
|
|
453710
453735
|
function nodeConfig({
|
|
453711
453736
|
entry,
|
|
453712
453737
|
outDir,
|
|
@@ -453747,7 +453772,7 @@ function nodeConfig({
|
|
|
453747
453772
|
} : false,
|
|
453748
453773
|
projectRoot,
|
|
453749
453774
|
workspaceRoot,
|
|
453750
|
-
outDir: (0,
|
|
453775
|
+
outDir: (0, import_devkit3.joinPathFragments)(outDir, "dist"),
|
|
453751
453776
|
silent: !verbose,
|
|
453752
453777
|
metafile,
|
|
453753
453778
|
shims,
|
|
@@ -453764,7 +453789,7 @@ function nodeConfig({
|
|
|
453764
453789
|
...dtsTsConfig,
|
|
453765
453790
|
options: {
|
|
453766
453791
|
...dtsTsConfig.options,
|
|
453767
|
-
outDir: (0,
|
|
453792
|
+
outDir: (0, import_devkit3.joinPathFragments)(outDir, "dist")
|
|
453768
453793
|
}
|
|
453769
453794
|
}
|
|
453770
453795
|
},
|