@storm-software/tsdown 0.22.3 → 0.22.5
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/README.md +1 -1
- package/dist/build.cjs +2 -2
- package/dist/build.js +1 -1
- package/dist/{chunk-ZNJE4VS3.cjs → chunk-GYAZ6EIB.cjs} +172 -209
- package/dist/{chunk-XKKDJDDD.js → chunk-Y4MOS2JM.js} +174 -211
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/tsdown.cjs +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
package/dist/build.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGYAZ6EIBcjs = require('./chunk-GYAZ6EIB.cjs');
|
|
4
4
|
require('./chunk-2Z7WS4H3.cjs');
|
|
5
5
|
require('./chunk-5KRF6IVW.cjs');
|
|
6
6
|
require('./chunk-USNT2KNT.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.build =
|
|
9
|
+
exports.build = _chunkGYAZ6EIBcjs.build;
|
package/dist/build.js
CHANGED
|
@@ -51,10 +51,174 @@ var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_reso
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
54
|
-
|
|
55
|
-
var _js = require('@nx/js');
|
|
54
|
+
var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
|
|
56
55
|
var _glob = require('glob');
|
|
57
56
|
var _promises = require('fs/promises');
|
|
57
|
+
var copyAssets = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
58
|
+
const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
|
|
59
|
+
pendingAssets.push({
|
|
60
|
+
input: projectRoot,
|
|
61
|
+
glob: "*.md",
|
|
62
|
+
output: "."
|
|
63
|
+
});
|
|
64
|
+
pendingAssets.push({
|
|
65
|
+
input: ".",
|
|
66
|
+
glob: "LICENSE",
|
|
67
|
+
output: "."
|
|
68
|
+
});
|
|
69
|
+
if (generatePackageJson2 === false) {
|
|
70
|
+
pendingAssets.push({
|
|
71
|
+
input: projectRoot,
|
|
72
|
+
glob: "package.json",
|
|
73
|
+
output: "."
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (includeSrc === true) {
|
|
77
|
+
pendingAssets.push({
|
|
78
|
+
input: sourceRoot,
|
|
79
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
80
|
+
output: "src/"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
_chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
|
|
84
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
85
|
+
const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
|
|
86
|
+
projectDir: projectRoot,
|
|
87
|
+
rootDir: config.workspaceRoot,
|
|
88
|
+
outputDir: outputPath,
|
|
89
|
+
assets: pendingAssets
|
|
90
|
+
});
|
|
91
|
+
await assetHandler.processAllAssetsOnce();
|
|
92
|
+
if (includeSrc === true) {
|
|
93
|
+
_chunk2Z7WS4H3cjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, outputPath, "src")}`, config);
|
|
94
|
+
const files = await _glob.glob.call(void 0, [
|
|
95
|
+
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
96
|
+
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
97
|
+
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
98
|
+
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
99
|
+
]);
|
|
100
|
+
await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
101
|
+
|
|
102
|
+
${await _promises.readFile.call(void 0, file, "utf8")}
|
|
103
|
+
|
|
104
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
105
|
+
}
|
|
106
|
+
}, "copyAssets");
|
|
107
|
+
|
|
108
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
109
|
+
var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var _projectgraph = require('nx/src/project-graph/project-graph');
|
|
114
|
+
var addPackageDependencies = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
115
|
+
const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
116
|
+
const localPackages = [];
|
|
117
|
+
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
118
|
+
const projectNode = project.node;
|
|
119
|
+
if (projectNode.data.root) {
|
|
120
|
+
const projectPackageJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
|
|
121
|
+
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
122
|
+
const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
123
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
124
|
+
if (projectPackageJson.private !== false) {
|
|
125
|
+
localPackages.push(projectPackageJson);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (localPackages.length > 0) {
|
|
131
|
+
_chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
132
|
+
packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
|
|
133
|
+
if (!ret[localPackage.name]) {
|
|
134
|
+
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
135
|
+
}
|
|
136
|
+
return ret;
|
|
137
|
+
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
138
|
+
packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
|
|
139
|
+
if (!ret[localPackage.name]) {
|
|
140
|
+
ret[localPackage.name] = {
|
|
141
|
+
optional: false
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return ret;
|
|
145
|
+
}, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
|
|
146
|
+
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
147
|
+
if (!ret[localPackage.name]) {
|
|
148
|
+
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
149
|
+
}
|
|
150
|
+
return ret;
|
|
151
|
+
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
152
|
+
} else {
|
|
153
|
+
_chunk2Z7WS4H3cjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
154
|
+
}
|
|
155
|
+
return packageJson;
|
|
156
|
+
}, "addPackageDependencies");
|
|
157
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
158
|
+
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, );
|
|
159
|
+
const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
|
|
160
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
161
|
+
packageJson.type ??= "module";
|
|
162
|
+
packageJson.sideEffects ??= false;
|
|
163
|
+
if (includeSrc === true) {
|
|
164
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
165
|
+
if (distSrc.startsWith("/")) {
|
|
166
|
+
distSrc = distSrc.substring(1);
|
|
167
|
+
}
|
|
168
|
+
packageJson.source ??= `${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
169
|
+
}
|
|
170
|
+
packageJson.files ??= [
|
|
171
|
+
"dist/**/*"
|
|
172
|
+
];
|
|
173
|
+
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
174
|
+
packageJson.files.push("src/**/*");
|
|
175
|
+
}
|
|
176
|
+
packageJson.publishConfig ??= {
|
|
177
|
+
access: "public"
|
|
178
|
+
};
|
|
179
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
180
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
181
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
182
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
183
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
184
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
185
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
186
|
+
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
187
|
+
if (!packageJson.maintainers && packageJson.author) {
|
|
188
|
+
packageJson.maintainers = [
|
|
189
|
+
packageJson.author
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
193
|
+
if (!packageJson.contributors && packageJson.author) {
|
|
194
|
+
packageJson.contributors = [
|
|
195
|
+
packageJson.author
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
199
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : _chunk2Z7WS4H3cjs.joinPaths.call(void 0, "packages", projectName);
|
|
200
|
+
return packageJson;
|
|
201
|
+
}, "addWorkspacePackageJsonFields");
|
|
202
|
+
var addPackageJsonExport = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (file, type = "module", sourceRoot) => {
|
|
203
|
+
let entry = file.replaceAll("\\", "/");
|
|
204
|
+
if (sourceRoot) {
|
|
205
|
+
entry = entry.replace(sourceRoot, "");
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
"import": {
|
|
209
|
+
"types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
|
|
210
|
+
"default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
|
|
211
|
+
},
|
|
212
|
+
"require": {
|
|
213
|
+
"types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
|
|
214
|
+
"default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
|
|
215
|
+
},
|
|
216
|
+
"default": {
|
|
217
|
+
"types": `./dist/${entry}.d.ts`,
|
|
218
|
+
"default": `./dist/${entry}.js`
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}, "addPackageJsonExport");
|
|
58
222
|
|
|
59
223
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
60
224
|
var _c12 = require('c12');
|
|
@@ -582,211 +746,6 @@ var getConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (workspace
|
|
|
582
746
|
return loadStormConfig(workspaceRoot, skipLogs);
|
|
583
747
|
}, "getConfig");
|
|
584
748
|
|
|
585
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
var readNxConfig = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot) => {
|
|
589
|
-
let rootDir = workspaceRoot;
|
|
590
|
-
if (!rootDir) {
|
|
591
|
-
const config = await getConfig();
|
|
592
|
-
rootDir = config.workspaceRoot;
|
|
593
|
-
}
|
|
594
|
-
const nxJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, rootDir, "nx.json");
|
|
595
|
-
if (!_fs.existsSync.call(void 0, nxJsonPath)) {
|
|
596
|
-
throw new Error("Cannot find project.json configuration");
|
|
597
|
-
}
|
|
598
|
-
const configContent = await _promises.readFile.call(void 0, nxJsonPath, "utf8");
|
|
599
|
-
return JSON.parse(configContent);
|
|
600
|
-
}, "readNxConfig");
|
|
601
|
-
|
|
602
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
603
|
-
var copyAssets = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
604
|
-
const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
|
|
605
|
-
pendingAssets.push({
|
|
606
|
-
input: _chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, projectRoot),
|
|
607
|
-
glob: "*.md",
|
|
608
|
-
output: "."
|
|
609
|
-
});
|
|
610
|
-
pendingAssets.push({
|
|
611
|
-
input: config.workspaceRoot,
|
|
612
|
-
glob: "LICENSE",
|
|
613
|
-
output: "."
|
|
614
|
-
});
|
|
615
|
-
if (generatePackageJson2 === false) {
|
|
616
|
-
pendingAssets.push({
|
|
617
|
-
input: projectRoot,
|
|
618
|
-
glob: "package.json",
|
|
619
|
-
output: "."
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
if (includeSrc === true) {
|
|
623
|
-
pendingAssets.push({
|
|
624
|
-
input: sourceRoot,
|
|
625
|
-
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
626
|
-
output: "src/"
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
630
|
-
const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
631
|
-
const projectsConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
632
|
-
if (!_optionalChain([projectsConfigurations, 'optionalAccess', _31 => _31.projects, 'optionalAccess', _32 => _32[projectName]])) {
|
|
633
|
-
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
634
|
-
}
|
|
635
|
-
const buildTarget = _optionalChain([projectsConfigurations, 'access', _33 => _33.projects, 'access', _34 => _34[projectName], 'access', _35 => _35.targets, 'optionalAccess', _36 => _36.build]);
|
|
636
|
-
if (!buildTarget) {
|
|
637
|
-
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, projectRoot, "project.json")}`);
|
|
638
|
-
}
|
|
639
|
-
_chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u{1F4DD} Copying the following assets to the output directory:
|
|
640
|
-
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
641
|
-
const result = await _js.copyAssets.call(void 0, {
|
|
642
|
-
assets: pendingAssets,
|
|
643
|
-
watch: false,
|
|
644
|
-
outputPath
|
|
645
|
-
}, {
|
|
646
|
-
root: config.workspaceRoot,
|
|
647
|
-
targetName: "build",
|
|
648
|
-
target: buildTarget,
|
|
649
|
-
projectName,
|
|
650
|
-
projectGraph,
|
|
651
|
-
projectsConfigurations,
|
|
652
|
-
nxJsonConfiguration: nxJson,
|
|
653
|
-
cwd: config.workspaceRoot,
|
|
654
|
-
isVerbose: _chunk2Z7WS4H3cjs.isVerbose.call(void 0, config.logLevel)
|
|
655
|
-
});
|
|
656
|
-
if (!result.success) {
|
|
657
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
658
|
-
}
|
|
659
|
-
if (includeSrc === true) {
|
|
660
|
-
_chunk2Z7WS4H3cjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, outputPath, "src")}`, config);
|
|
661
|
-
const files = await _glob.glob.call(void 0, [
|
|
662
|
-
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
663
|
-
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
664
|
-
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
665
|
-
_chunk2Z7WS4H3cjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
666
|
-
]);
|
|
667
|
-
await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
668
|
-
|
|
669
|
-
${await _promises.readFile.call(void 0, file, "utf8")}
|
|
670
|
-
|
|
671
|
-
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
672
|
-
}
|
|
673
|
-
}, "copyAssets");
|
|
674
|
-
|
|
675
|
-
// ../build-tools/src/utilities/generate-package-json.ts
|
|
676
|
-
var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
var _projectgraph = require('nx/src/project-graph/project-graph');
|
|
681
|
-
var addPackageDependencies = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
682
|
-
const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0, void 0, _projectgraph.readCachedProjectGraph.call(void 0, ), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
683
|
-
const localPackages = [];
|
|
684
|
-
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
685
|
-
const projectNode = project.node;
|
|
686
|
-
if (projectNode.data.root) {
|
|
687
|
-
const projectPackageJsonPath = _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, projectNode.data.root, "package.json");
|
|
688
|
-
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
689
|
-
const projectPackageJsonContent = await _promises.readFile.call(void 0, projectPackageJsonPath, "utf8");
|
|
690
|
-
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
691
|
-
if (projectPackageJson.private !== false) {
|
|
692
|
-
localPackages.push(projectPackageJson);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
if (localPackages.length > 0) {
|
|
698
|
-
_chunk2Z7WS4H3cjs.writeTrace.call(void 0, `\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
699
|
-
packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
|
|
700
|
-
if (!ret[localPackage.name]) {
|
|
701
|
-
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
702
|
-
}
|
|
703
|
-
return ret;
|
|
704
|
-
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
705
|
-
packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
|
|
706
|
-
if (!ret[localPackage.name]) {
|
|
707
|
-
ret[localPackage.name] = {
|
|
708
|
-
optional: false
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
return ret;
|
|
712
|
-
}, _nullishCoalesce(packageJson.peerDependenciesMeta, () => ( {})));
|
|
713
|
-
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
714
|
-
if (!ret[localPackage.name]) {
|
|
715
|
-
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
716
|
-
}
|
|
717
|
-
return ret;
|
|
718
|
-
}, _nullishCoalesce(packageJson.peerDependencies, () => ( {})));
|
|
719
|
-
} else {
|
|
720
|
-
_chunk2Z7WS4H3cjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
721
|
-
}
|
|
722
|
-
return packageJson;
|
|
723
|
-
}, "addPackageDependencies");
|
|
724
|
-
var addWorkspacePackageJsonFields = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
725
|
-
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunk2Z7WS4H3cjs.findWorkspaceRoot.call(void 0, );
|
|
726
|
-
const workspacePackageJsonContent = await _promises.readFile.call(void 0, _chunk2Z7WS4H3cjs.joinPaths.call(void 0, workspaceRoot, "package.json"), "utf8");
|
|
727
|
-
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
728
|
-
packageJson.type ??= "module";
|
|
729
|
-
packageJson.sideEffects ??= false;
|
|
730
|
-
if (includeSrc === true) {
|
|
731
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
732
|
-
if (distSrc.startsWith("/")) {
|
|
733
|
-
distSrc = distSrc.substring(1);
|
|
734
|
-
}
|
|
735
|
-
packageJson.source ??= `${_chunk2Z7WS4H3cjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
736
|
-
}
|
|
737
|
-
packageJson.files ??= [
|
|
738
|
-
"dist/**/*"
|
|
739
|
-
];
|
|
740
|
-
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
741
|
-
packageJson.files.push("src/**/*");
|
|
742
|
-
}
|
|
743
|
-
packageJson.publishConfig ??= {
|
|
744
|
-
access: "public"
|
|
745
|
-
};
|
|
746
|
-
packageJson.description ??= workspacePackageJson.description;
|
|
747
|
-
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
748
|
-
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
749
|
-
packageJson.license ??= workspacePackageJson.license;
|
|
750
|
-
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
751
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
752
|
-
packageJson.author ??= workspacePackageJson.author;
|
|
753
|
-
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
754
|
-
if (!packageJson.maintainers && packageJson.author) {
|
|
755
|
-
packageJson.maintainers = [
|
|
756
|
-
packageJson.author
|
|
757
|
-
];
|
|
758
|
-
}
|
|
759
|
-
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
760
|
-
if (!packageJson.contributors && packageJson.author) {
|
|
761
|
-
packageJson.contributors = [
|
|
762
|
-
packageJson.author
|
|
763
|
-
];
|
|
764
|
-
}
|
|
765
|
-
packageJson.repository ??= workspacePackageJson.repository;
|
|
766
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : _chunk2Z7WS4H3cjs.joinPaths.call(void 0, "packages", projectName);
|
|
767
|
-
return packageJson;
|
|
768
|
-
}, "addWorkspacePackageJsonFields");
|
|
769
|
-
var addPackageJsonExport = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (file, type = "module", sourceRoot) => {
|
|
770
|
-
let entry = file.replaceAll("\\", "/");
|
|
771
|
-
if (sourceRoot) {
|
|
772
|
-
entry = entry.replace(sourceRoot, "");
|
|
773
|
-
}
|
|
774
|
-
return {
|
|
775
|
-
"import": {
|
|
776
|
-
"types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
|
|
777
|
-
"default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
|
|
778
|
-
},
|
|
779
|
-
"require": {
|
|
780
|
-
"types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
|
|
781
|
-
"default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
|
|
782
|
-
},
|
|
783
|
-
"default": {
|
|
784
|
-
"types": `./dist/${entry}.d.ts`,
|
|
785
|
-
"default": `./dist/${entry}.js`
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
}, "addPackageJsonExport");
|
|
789
|
-
|
|
790
749
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
791
750
|
|
|
792
751
|
var getEntryPoints = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
|
|
@@ -841,6 +800,10 @@ var getEnv = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (builder, opt
|
|
|
841
800
|
};
|
|
842
801
|
}, "getEnv");
|
|
843
802
|
|
|
803
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
844
807
|
// ../build-tools/src/utilities/task-graph.ts
|
|
845
808
|
var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph');
|
|
846
809
|
|
|
@@ -867,7 +830,7 @@ var resolveOptions = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, async
|
|
|
867
830
|
const projectJson = await _node.hfs.json(projectJsonPath);
|
|
868
831
|
const projectName = projectJson.name;
|
|
869
832
|
const projectConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
870
|
-
if (!_optionalChain([projectConfigurations, 'optionalAccess',
|
|
833
|
+
if (!_optionalChain([projectConfigurations, 'optionalAccess', _31 => _31.projects, 'optionalAccess', _32 => _32[projectName]])) {
|
|
871
834
|
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
872
835
|
}
|
|
873
836
|
const options = _defu2.default.call(void 0, userOptions, _chunk5KRF6IVWcjs.DEFAULT_BUILD_OPTIONS);
|
|
@@ -996,7 +959,7 @@ _chunkUSNT2KNTcjs.__name.call(void 0, executeTSDown, "executeTSDown");
|
|
|
996
959
|
async function copyBuildAssets(options) {
|
|
997
960
|
_chunk2Z7WS4H3cjs.writeDebug.call(void 0, ` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
|
|
998
961
|
const stopwatch = _chunk2Z7WS4H3cjs.getStopwatch.call(void 0, `${options.name} asset copy`);
|
|
999
|
-
await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outdir, options.projectRoot, options.
|
|
962
|
+
await copyAssets(options.config, _nullishCoalesce(options.assets, () => ( [])), options.outdir, options.projectRoot, options.sourceRoot, true, false);
|
|
1000
963
|
stopwatch();
|
|
1001
964
|
return options;
|
|
1002
965
|
}
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
|
|
31
31
|
// src/build.ts
|
|
32
32
|
import { hfs } from "@humanfs/node";
|
|
33
|
-
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph
|
|
33
|
+
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph, writeJsonFile } from "@nx/devkit";
|
|
34
34
|
|
|
35
35
|
// ../build-tools/src/config.ts
|
|
36
36
|
var DEFAULT_ENVIRONMENT = "production";
|
|
@@ -51,10 +51,174 @@ import { stripIndents } from "@nx/devkit";
|
|
|
51
51
|
import { relative } from "path";
|
|
52
52
|
|
|
53
53
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
54
|
-
import {
|
|
55
|
-
import { copyAssets as copyAssetsBase } from "@nx/js";
|
|
54
|
+
import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
|
|
56
55
|
import { glob } from "glob";
|
|
57
|
-
import { readFile
|
|
56
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
57
|
+
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
58
|
+
const pendingAssets = Array.from(assets ?? []);
|
|
59
|
+
pendingAssets.push({
|
|
60
|
+
input: projectRoot,
|
|
61
|
+
glob: "*.md",
|
|
62
|
+
output: "."
|
|
63
|
+
});
|
|
64
|
+
pendingAssets.push({
|
|
65
|
+
input: ".",
|
|
66
|
+
glob: "LICENSE",
|
|
67
|
+
output: "."
|
|
68
|
+
});
|
|
69
|
+
if (generatePackageJson2 === false) {
|
|
70
|
+
pendingAssets.push({
|
|
71
|
+
input: projectRoot,
|
|
72
|
+
glob: "package.json",
|
|
73
|
+
output: "."
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (includeSrc === true) {
|
|
77
|
+
pendingAssets.push({
|
|
78
|
+
input: sourceRoot,
|
|
79
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
80
|
+
output: "src/"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
84
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
85
|
+
const assetHandler = new CopyAssetsHandler({
|
|
86
|
+
projectDir: projectRoot,
|
|
87
|
+
rootDir: config.workspaceRoot,
|
|
88
|
+
outputDir: outputPath,
|
|
89
|
+
assets: pendingAssets
|
|
90
|
+
});
|
|
91
|
+
await assetHandler.processAllAssetsOnce();
|
|
92
|
+
if (includeSrc === true) {
|
|
93
|
+
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
94
|
+
const files = await glob([
|
|
95
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
96
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
97
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
98
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
99
|
+
]);
|
|
100
|
+
await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
101
|
+
|
|
102
|
+
${await readFile(file, "utf8")}
|
|
103
|
+
|
|
104
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
105
|
+
}
|
|
106
|
+
}, "copyAssets");
|
|
107
|
+
|
|
108
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
109
|
+
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
110
|
+
import { Glob } from "glob";
|
|
111
|
+
import { existsSync } from "node:fs";
|
|
112
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
113
|
+
import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
|
|
114
|
+
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
115
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
116
|
+
const localPackages = [];
|
|
117
|
+
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
118
|
+
const projectNode = project.node;
|
|
119
|
+
if (projectNode.data.root) {
|
|
120
|
+
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
121
|
+
if (existsSync(projectPackageJsonPath)) {
|
|
122
|
+
const projectPackageJsonContent = await readFile2(projectPackageJsonPath, "utf8");
|
|
123
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
124
|
+
if (projectPackageJson.private !== false) {
|
|
125
|
+
localPackages.push(projectPackageJson);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (localPackages.length > 0) {
|
|
131
|
+
writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
132
|
+
packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
|
|
133
|
+
if (!ret[localPackage.name]) {
|
|
134
|
+
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
135
|
+
}
|
|
136
|
+
return ret;
|
|
137
|
+
}, packageJson.peerDependencies ?? {});
|
|
138
|
+
packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
|
|
139
|
+
if (!ret[localPackage.name]) {
|
|
140
|
+
ret[localPackage.name] = {
|
|
141
|
+
optional: false
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return ret;
|
|
145
|
+
}, packageJson.peerDependenciesMeta ?? {});
|
|
146
|
+
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
147
|
+
if (!ret[localPackage.name]) {
|
|
148
|
+
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
149
|
+
}
|
|
150
|
+
return ret;
|
|
151
|
+
}, packageJson.peerDependencies ?? {});
|
|
152
|
+
} else {
|
|
153
|
+
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
154
|
+
}
|
|
155
|
+
return packageJson;
|
|
156
|
+
}, "addPackageDependencies");
|
|
157
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
158
|
+
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
|
|
159
|
+
const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
160
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
161
|
+
packageJson.type ??= "module";
|
|
162
|
+
packageJson.sideEffects ??= false;
|
|
163
|
+
if (includeSrc === true) {
|
|
164
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
165
|
+
if (distSrc.startsWith("/")) {
|
|
166
|
+
distSrc = distSrc.substring(1);
|
|
167
|
+
}
|
|
168
|
+
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
169
|
+
}
|
|
170
|
+
packageJson.files ??= [
|
|
171
|
+
"dist/**/*"
|
|
172
|
+
];
|
|
173
|
+
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
174
|
+
packageJson.files.push("src/**/*");
|
|
175
|
+
}
|
|
176
|
+
packageJson.publishConfig ??= {
|
|
177
|
+
access: "public"
|
|
178
|
+
};
|
|
179
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
180
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
181
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
182
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
183
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
184
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
185
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
186
|
+
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
187
|
+
if (!packageJson.maintainers && packageJson.author) {
|
|
188
|
+
packageJson.maintainers = [
|
|
189
|
+
packageJson.author
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
193
|
+
if (!packageJson.contributors && packageJson.author) {
|
|
194
|
+
packageJson.contributors = [
|
|
195
|
+
packageJson.author
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
199
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
200
|
+
return packageJson;
|
|
201
|
+
}, "addWorkspacePackageJsonFields");
|
|
202
|
+
var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot) => {
|
|
203
|
+
let entry = file.replaceAll("\\", "/");
|
|
204
|
+
if (sourceRoot) {
|
|
205
|
+
entry = entry.replace(sourceRoot, "");
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
"import": {
|
|
209
|
+
"types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
|
|
210
|
+
"default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
|
|
211
|
+
},
|
|
212
|
+
"require": {
|
|
213
|
+
"types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
|
|
214
|
+
"default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
|
|
215
|
+
},
|
|
216
|
+
"default": {
|
|
217
|
+
"types": `./dist/${entry}.d.ts`,
|
|
218
|
+
"default": `./dist/${entry}.js`
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}, "addPackageJsonExport");
|
|
58
222
|
|
|
59
223
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
60
224
|
import { loadConfig } from "c12";
|
|
@@ -582,211 +746,6 @@ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
|
|
|
582
746
|
return loadStormConfig(workspaceRoot, skipLogs);
|
|
583
747
|
}, "getConfig");
|
|
584
748
|
|
|
585
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
586
|
-
import { existsSync } from "node:fs";
|
|
587
|
-
import { readFile } from "node:fs/promises";
|
|
588
|
-
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
589
|
-
let rootDir = workspaceRoot;
|
|
590
|
-
if (!rootDir) {
|
|
591
|
-
const config = await getConfig();
|
|
592
|
-
rootDir = config.workspaceRoot;
|
|
593
|
-
}
|
|
594
|
-
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
595
|
-
if (!existsSync(nxJsonPath)) {
|
|
596
|
-
throw new Error("Cannot find project.json configuration");
|
|
597
|
-
}
|
|
598
|
-
const configContent = await readFile(nxJsonPath, "utf8");
|
|
599
|
-
return JSON.parse(configContent);
|
|
600
|
-
}, "readNxConfig");
|
|
601
|
-
|
|
602
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
603
|
-
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
604
|
-
const pendingAssets = Array.from(assets ?? []);
|
|
605
|
-
pendingAssets.push({
|
|
606
|
-
input: joinPaths(config.workspaceRoot, projectRoot),
|
|
607
|
-
glob: "*.md",
|
|
608
|
-
output: "."
|
|
609
|
-
});
|
|
610
|
-
pendingAssets.push({
|
|
611
|
-
input: config.workspaceRoot,
|
|
612
|
-
glob: "LICENSE",
|
|
613
|
-
output: "."
|
|
614
|
-
});
|
|
615
|
-
if (generatePackageJson2 === false) {
|
|
616
|
-
pendingAssets.push({
|
|
617
|
-
input: projectRoot,
|
|
618
|
-
glob: "package.json",
|
|
619
|
-
output: "."
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
if (includeSrc === true) {
|
|
623
|
-
pendingAssets.push({
|
|
624
|
-
input: sourceRoot,
|
|
625
|
-
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
626
|
-
output: "src/"
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
630
|
-
const projectGraph = readCachedProjectGraph();
|
|
631
|
-
const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
632
|
-
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
633
|
-
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
634
|
-
}
|
|
635
|
-
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
636
|
-
if (!buildTarget) {
|
|
637
|
-
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
|
|
638
|
-
}
|
|
639
|
-
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
640
|
-
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
641
|
-
const result = await copyAssetsBase({
|
|
642
|
-
assets: pendingAssets,
|
|
643
|
-
watch: false,
|
|
644
|
-
outputPath
|
|
645
|
-
}, {
|
|
646
|
-
root: config.workspaceRoot,
|
|
647
|
-
targetName: "build",
|
|
648
|
-
target: buildTarget,
|
|
649
|
-
projectName,
|
|
650
|
-
projectGraph,
|
|
651
|
-
projectsConfigurations,
|
|
652
|
-
nxJsonConfiguration: nxJson,
|
|
653
|
-
cwd: config.workspaceRoot,
|
|
654
|
-
isVerbose: isVerbose(config.logLevel)
|
|
655
|
-
});
|
|
656
|
-
if (!result.success) {
|
|
657
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
658
|
-
}
|
|
659
|
-
if (includeSrc === true) {
|
|
660
|
-
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
661
|
-
const files = await glob([
|
|
662
|
-
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
663
|
-
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
664
|
-
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
665
|
-
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
666
|
-
]);
|
|
667
|
-
await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
668
|
-
|
|
669
|
-
${await readFile2(file, "utf8")}
|
|
670
|
-
|
|
671
|
-
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
672
|
-
}
|
|
673
|
-
}, "copyAssets");
|
|
674
|
-
|
|
675
|
-
// ../build-tools/src/utilities/generate-package-json.ts
|
|
676
|
-
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
677
|
-
import { Glob } from "glob";
|
|
678
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
679
|
-
import { readFile as readFile3 } from "node:fs/promises";
|
|
680
|
-
import { readCachedProjectGraph as readCachedProjectGraph2 } from "nx/src/project-graph/project-graph";
|
|
681
|
-
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
682
|
-
const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph2(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
683
|
-
const localPackages = [];
|
|
684
|
-
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
685
|
-
const projectNode = project.node;
|
|
686
|
-
if (projectNode.data.root) {
|
|
687
|
-
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
688
|
-
if (existsSync2(projectPackageJsonPath)) {
|
|
689
|
-
const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
|
|
690
|
-
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
691
|
-
if (projectPackageJson.private !== false) {
|
|
692
|
-
localPackages.push(projectPackageJson);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
if (localPackages.length > 0) {
|
|
698
|
-
writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
699
|
-
packageJson.peerDependencies = localPackages.reduce((ret, localPackage) => {
|
|
700
|
-
if (!ret[localPackage.name]) {
|
|
701
|
-
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
702
|
-
}
|
|
703
|
-
return ret;
|
|
704
|
-
}, packageJson.peerDependencies ?? {});
|
|
705
|
-
packageJson.peerDependenciesMeta = localPackages.reduce((ret, localPackage) => {
|
|
706
|
-
if (!ret[localPackage.name]) {
|
|
707
|
-
ret[localPackage.name] = {
|
|
708
|
-
optional: false
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
return ret;
|
|
712
|
-
}, packageJson.peerDependenciesMeta ?? {});
|
|
713
|
-
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
714
|
-
if (!ret[localPackage.name]) {
|
|
715
|
-
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
716
|
-
}
|
|
717
|
-
return ret;
|
|
718
|
-
}, packageJson.peerDependencies ?? {});
|
|
719
|
-
} else {
|
|
720
|
-
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
721
|
-
}
|
|
722
|
-
return packageJson;
|
|
723
|
-
}, "addPackageDependencies");
|
|
724
|
-
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
725
|
-
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
|
|
726
|
-
const workspacePackageJsonContent = await readFile3(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
727
|
-
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
728
|
-
packageJson.type ??= "module";
|
|
729
|
-
packageJson.sideEffects ??= false;
|
|
730
|
-
if (includeSrc === true) {
|
|
731
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
732
|
-
if (distSrc.startsWith("/")) {
|
|
733
|
-
distSrc = distSrc.substring(1);
|
|
734
|
-
}
|
|
735
|
-
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
736
|
-
}
|
|
737
|
-
packageJson.files ??= [
|
|
738
|
-
"dist/**/*"
|
|
739
|
-
];
|
|
740
|
-
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
741
|
-
packageJson.files.push("src/**/*");
|
|
742
|
-
}
|
|
743
|
-
packageJson.publishConfig ??= {
|
|
744
|
-
access: "public"
|
|
745
|
-
};
|
|
746
|
-
packageJson.description ??= workspacePackageJson.description;
|
|
747
|
-
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
748
|
-
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
749
|
-
packageJson.license ??= workspacePackageJson.license;
|
|
750
|
-
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
751
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
752
|
-
packageJson.author ??= workspacePackageJson.author;
|
|
753
|
-
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
754
|
-
if (!packageJson.maintainers && packageJson.author) {
|
|
755
|
-
packageJson.maintainers = [
|
|
756
|
-
packageJson.author
|
|
757
|
-
];
|
|
758
|
-
}
|
|
759
|
-
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
760
|
-
if (!packageJson.contributors && packageJson.author) {
|
|
761
|
-
packageJson.contributors = [
|
|
762
|
-
packageJson.author
|
|
763
|
-
];
|
|
764
|
-
}
|
|
765
|
-
packageJson.repository ??= workspacePackageJson.repository;
|
|
766
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
767
|
-
return packageJson;
|
|
768
|
-
}, "addWorkspacePackageJsonFields");
|
|
769
|
-
var addPackageJsonExport = /* @__PURE__ */ __name((file, type = "module", sourceRoot) => {
|
|
770
|
-
let entry = file.replaceAll("\\", "/");
|
|
771
|
-
if (sourceRoot) {
|
|
772
|
-
entry = entry.replace(sourceRoot, "");
|
|
773
|
-
}
|
|
774
|
-
return {
|
|
775
|
-
"import": {
|
|
776
|
-
"types": `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
|
|
777
|
-
"default": `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
|
|
778
|
-
},
|
|
779
|
-
"require": {
|
|
780
|
-
"types": `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
|
|
781
|
-
"default": `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
|
|
782
|
-
},
|
|
783
|
-
"default": {
|
|
784
|
-
"types": `./dist/${entry}.d.ts`,
|
|
785
|
-
"default": `./dist/${entry}.js`
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
}, "addPackageJsonExport");
|
|
789
|
-
|
|
790
749
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
791
750
|
import { glob as glob2 } from "glob";
|
|
792
751
|
var getEntryPoints = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
|
|
@@ -841,6 +800,10 @@ var getEnv = /* @__PURE__ */ __name((builder, options) => {
|
|
|
841
800
|
};
|
|
842
801
|
}, "getEnv");
|
|
843
802
|
|
|
803
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
804
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
805
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
806
|
+
|
|
844
807
|
// ../build-tools/src/utilities/task-graph.ts
|
|
845
808
|
import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
|
|
846
809
|
|
|
@@ -866,7 +829,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
|
|
|
866
829
|
}
|
|
867
830
|
const projectJson = await hfs.json(projectJsonPath);
|
|
868
831
|
const projectName = projectJson.name;
|
|
869
|
-
const projectConfigurations =
|
|
832
|
+
const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
870
833
|
if (!projectConfigurations?.projects?.[projectName]) {
|
|
871
834
|
throw new Error("The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project.");
|
|
872
835
|
}
|
|
@@ -996,7 +959,7 @@ __name(executeTSDown, "executeTSDown");
|
|
|
996
959
|
async function copyBuildAssets(options) {
|
|
997
960
|
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
|
|
998
961
|
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
999
|
-
await copyAssets(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.
|
|
962
|
+
await copyAssets(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.sourceRoot, true, false);
|
|
1000
963
|
stopwatch();
|
|
1001
964
|
return options;
|
|
1002
965
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGYAZ6EIBcjs = require('./chunk-GYAZ6EIB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunk2Z7WS4H3cjs = require('./chunk-2Z7WS4H3.cjs');
|
|
@@ -13,4 +13,4 @@ require('./chunk-SFZRYJZ2.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.DEFAULT_BUILD_OPTIONS = _chunk5KRF6IVWcjs.DEFAULT_BUILD_OPTIONS; exports.build =
|
|
16
|
+
exports.DEFAULT_BUILD_OPTIONS = _chunk5KRF6IVWcjs.DEFAULT_BUILD_OPTIONS; exports.build = _chunkGYAZ6EIBcjs.build; exports.clean = _chunk2Z7WS4H3cjs.clean;
|
package/dist/index.js
CHANGED
package/dist/tsdown.cjs
CHANGED
|
@@ -275,7 +275,7 @@ __name(executeTSDown, "executeTSDown");
|
|
|
275
275
|
async function copyBuildAssets(options) {
|
|
276
276
|
(0, import_console2.writeDebug)(` \u{1F4CB} Copying asset files to output directory: ${options.outdir}`, options.config);
|
|
277
277
|
const stopwatch = (0, import_console2.getStopwatch)(`${options.name} asset copy`);
|
|
278
|
-
await (0, import_build_tools.copyAssets)(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.
|
|
278
|
+
await (0, import_build_tools.copyAssets)(options.config, options.assets ?? [], options.outdir, options.projectRoot, options.sourceRoot, true, false);
|
|
279
279
|
stopwatch();
|
|
280
280
|
return options;
|
|
281
281
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/tsdown",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing `tsdown` utilities for building Storm Software libraries and applications",
|
|
6
6
|
"repository": {
|
|
@@ -173,9 +173,9 @@
|
|
|
173
173
|
"@microsoft/api-extractor": "^7.48.1",
|
|
174
174
|
"@nx/devkit": "^20.3.1",
|
|
175
175
|
"@nx/js": "^20.3.1",
|
|
176
|
-
"@storm-software/build-tools": "0.
|
|
177
|
-
"@storm-software/config": "1.
|
|
178
|
-
"@storm-software/config-tools": "1.
|
|
176
|
+
"@storm-software/build-tools": "0.136.1",
|
|
177
|
+
"@storm-software/config": "1.99.1",
|
|
178
|
+
"@storm-software/config-tools": "1.142.1",
|
|
179
179
|
"@types/node": "^22.10.2",
|
|
180
180
|
"defu": "6.1.4",
|
|
181
181
|
"rollup": "4.29.1",
|