@storm-software/workspace-tools 1.290.11 → 1.291.0
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 +15 -0
- package/dist/{chunk-MR2J2XDA.js → chunk-3WCQK76E.js} +22 -292
- package/dist/{chunk-KKCNNJUO.mjs → chunk-DVZPBLGA.mjs} +20 -290
- package/dist/chunk-F3NQOV2M.mjs +314 -0
- package/dist/chunk-FSYURQ5X.js +314 -0
- package/dist/chunk-H5NKQQJU.mjs +363 -0
- package/dist/chunk-OTI7QVPG.js +363 -0
- package/dist/executor-4s6Siy2o.d.ts +144 -0
- package/dist/executor-BmxxnfjA.d.mts +144 -0
- package/dist/executors.d.mts +1 -0
- package/dist/executors.d.ts +1 -0
- package/dist/executors.js +11 -6
- package/dist/executors.mjs +13 -8
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +3 -3
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -9
- package/dist/index.mjs +16 -11
- package/dist/src/executors/esbuild/executor.js +3 -2
- package/dist/src/executors/esbuild/executor.mjs +2 -1
- package/dist/src/executors/tsdown/executor.d.mts +5 -0
- package/dist/src/executors/tsdown/executor.d.ts +5 -0
- package/dist/src/executors/tsdown/executor.js +15 -0
- package/dist/src/executors/tsdown/executor.mjs +16 -0
- package/dist/src/executors/tsdown/schema.d.ts +135 -0
- package/dist/src/executors/tsdown/schema.json +174 -0
- package/dist/src/executors/tsdown/untyped.d.mts +5 -0
- package/dist/src/executors/tsdown/untyped.d.ts +5 -0
- package/dist/src/executors/tsdown/untyped.js +18 -0
- package/dist/src/executors/tsdown/untyped.mjs +19 -0
- package/dist/src/plugins/typescript/tsdown.d.mts +9 -0
- package/dist/src/plugins/typescript/tsdown.d.ts +9 -0
- package/dist/src/plugins/typescript/tsdown.js +169 -0
- package/dist/src/plugins/typescript/tsdown.mjs +170 -0
- package/docs/api/executors/tsdown/schema.md +126 -0
- package/package.json +8 -6
- /package/dist/{chunk-7VDOGZYO.js → chunk-3J53KHVV.js} +0 -0
- /package/dist/{chunk-BLX5SLPC.mjs → chunk-V7YZ3666.mjs} +0 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeDebug,
|
|
3
|
+
writeTrace
|
|
4
|
+
} from "./chunk-V44DYGWX.mjs";
|
|
5
|
+
import {
|
|
6
|
+
findWorkspaceRoot
|
|
7
|
+
} from "./chunk-VGJEUOUN.mjs";
|
|
8
|
+
import {
|
|
9
|
+
joinPaths
|
|
10
|
+
} from "./chunk-C26A6BXG.mjs";
|
|
11
|
+
|
|
12
|
+
// ../build-tools/src/config.ts
|
|
13
|
+
var DEFAULT_COMPILED_BANNER = `/*****************************************
|
|
14
|
+
*
|
|
15
|
+
* \u26A1 Built by Storm Software
|
|
16
|
+
*
|
|
17
|
+
*****************************************/
|
|
18
|
+
`;
|
|
19
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
20
|
+
var DEFAULT_TARGET = "esnext";
|
|
21
|
+
var DEFAULT_ORGANIZATION = "storm-software";
|
|
22
|
+
|
|
23
|
+
// ../build-tools/src/utilities/copy-assets.ts
|
|
24
|
+
import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
|
|
25
|
+
import { glob } from "glob";
|
|
26
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
27
|
+
var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson = true, includeSrc = false, banner, footer) => {
|
|
28
|
+
const pendingAssets = Array.from(assets ?? []);
|
|
29
|
+
pendingAssets.push({
|
|
30
|
+
input: projectRoot,
|
|
31
|
+
glob: "*.md",
|
|
32
|
+
output: "."
|
|
33
|
+
});
|
|
34
|
+
pendingAssets.push({
|
|
35
|
+
input: ".",
|
|
36
|
+
glob: "LICENSE",
|
|
37
|
+
output: "."
|
|
38
|
+
});
|
|
39
|
+
if (generatePackageJson === false) {
|
|
40
|
+
pendingAssets.push({
|
|
41
|
+
input: projectRoot,
|
|
42
|
+
glob: "package.json",
|
|
43
|
+
output: "."
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (includeSrc === true) {
|
|
47
|
+
pendingAssets.push({
|
|
48
|
+
input: sourceRoot,
|
|
49
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
50
|
+
output: "src/"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
writeTrace(
|
|
54
|
+
`\u{1F4DD} Copying the following assets to the output directory:
|
|
55
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
|
|
56
|
+
config
|
|
57
|
+
);
|
|
58
|
+
const assetHandler = new CopyAssetsHandler({
|
|
59
|
+
projectDir: projectRoot,
|
|
60
|
+
rootDir: config.workspaceRoot,
|
|
61
|
+
outputDir: outputPath,
|
|
62
|
+
assets: pendingAssets
|
|
63
|
+
});
|
|
64
|
+
await assetHandler.processAllAssetsOnce();
|
|
65
|
+
writeTrace("Completed copying assets to the output directory", config);
|
|
66
|
+
if (includeSrc === true) {
|
|
67
|
+
writeDebug(
|
|
68
|
+
`\u{1F4DD} Adding banner and writing source files: ${joinPaths(
|
|
69
|
+
outputPath,
|
|
70
|
+
"src"
|
|
71
|
+
)}`,
|
|
72
|
+
config
|
|
73
|
+
);
|
|
74
|
+
const files = await glob([
|
|
75
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
76
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
77
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
78
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
79
|
+
]);
|
|
80
|
+
await Promise.allSettled(
|
|
81
|
+
files.map(
|
|
82
|
+
async (file) => writeFile(
|
|
83
|
+
file,
|
|
84
|
+
`${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
85
|
+
|
|
86
|
+
${await readFile(file, "utf8")}
|
|
87
|
+
|
|
88
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
96
|
+
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
97
|
+
import { Glob } from "glob";
|
|
98
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
99
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
100
|
+
import {
|
|
101
|
+
createProjectGraphAsync,
|
|
102
|
+
readCachedProjectGraph,
|
|
103
|
+
readProjectsConfigurationFromProjectGraph
|
|
104
|
+
} from "nx/src/project-graph/project-graph";
|
|
105
|
+
var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
106
|
+
let projectGraph;
|
|
107
|
+
try {
|
|
108
|
+
projectGraph = readCachedProjectGraph();
|
|
109
|
+
} catch {
|
|
110
|
+
await createProjectGraphAsync();
|
|
111
|
+
projectGraph = readCachedProjectGraph();
|
|
112
|
+
}
|
|
113
|
+
if (!projectGraph) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"The Build process failed because the project graph is not available. Please run the build command again."
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
const projectDependencies = calculateProjectBuildableDependencies(
|
|
119
|
+
void 0,
|
|
120
|
+
projectGraph,
|
|
121
|
+
workspaceRoot,
|
|
122
|
+
projectName,
|
|
123
|
+
process.env.NX_TASK_TARGET_TARGET || "build",
|
|
124
|
+
process.env.NX_TASK_TARGET_CONFIGURATION || "production",
|
|
125
|
+
true
|
|
126
|
+
);
|
|
127
|
+
const localPackages = [];
|
|
128
|
+
for (const project of projectDependencies.dependencies.filter(
|
|
129
|
+
(dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot
|
|
130
|
+
)) {
|
|
131
|
+
const projectNode = project.node;
|
|
132
|
+
if (projectNode.data.root) {
|
|
133
|
+
const projectPackageJsonPath = joinPaths(
|
|
134
|
+
workspaceRoot,
|
|
135
|
+
projectNode.data.root,
|
|
136
|
+
"package.json"
|
|
137
|
+
);
|
|
138
|
+
if (existsSync(projectPackageJsonPath)) {
|
|
139
|
+
const projectPackageJsonContent = await readFile2(
|
|
140
|
+
projectPackageJsonPath,
|
|
141
|
+
"utf8"
|
|
142
|
+
);
|
|
143
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
144
|
+
if (projectPackageJson.private !== true) {
|
|
145
|
+
localPackages.push(projectPackageJson);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (localPackages.length > 0) {
|
|
151
|
+
writeTrace(
|
|
152
|
+
`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
|
|
153
|
+
);
|
|
154
|
+
const projectJsonFile = await readFile2(
|
|
155
|
+
joinPaths(projectRoot, "project.json"),
|
|
156
|
+
"utf8"
|
|
157
|
+
);
|
|
158
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
159
|
+
const projectName2 = projectJson.name;
|
|
160
|
+
const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
161
|
+
if (!projectConfigurations?.projects?.[projectName2]) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
"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."
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
|
|
167
|
+
if (projectConfigurations.projects?.[dep]) {
|
|
168
|
+
const depPackageJsonPath = joinPaths(
|
|
169
|
+
workspaceRoot,
|
|
170
|
+
projectConfigurations.projects[dep].root,
|
|
171
|
+
"package.json"
|
|
172
|
+
);
|
|
173
|
+
if (existsSync(depPackageJsonPath)) {
|
|
174
|
+
const depPackageJsonContent = readFileSync(
|
|
175
|
+
depPackageJsonPath,
|
|
176
|
+
"utf8"
|
|
177
|
+
);
|
|
178
|
+
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
179
|
+
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
180
|
+
ret.push(depPackageJson.name);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return ret;
|
|
185
|
+
}, []);
|
|
186
|
+
packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
|
|
187
|
+
if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
|
|
188
|
+
ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
|
|
189
|
+
}
|
|
190
|
+
return ret;
|
|
191
|
+
}, packageJson.dependencies ?? {});
|
|
192
|
+
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
193
|
+
if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
|
|
194
|
+
ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
|
|
195
|
+
}
|
|
196
|
+
return ret;
|
|
197
|
+
}, packageJson.devDependencies ?? {});
|
|
198
|
+
} else {
|
|
199
|
+
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
200
|
+
}
|
|
201
|
+
return packageJson;
|
|
202
|
+
};
|
|
203
|
+
var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
204
|
+
const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
205
|
+
const workspacePackageJsonContent = await readFile2(
|
|
206
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
207
|
+
"utf8"
|
|
208
|
+
);
|
|
209
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
210
|
+
packageJson.type ??= "module";
|
|
211
|
+
packageJson.sideEffects ??= false;
|
|
212
|
+
if (includeSrc === true) {
|
|
213
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
214
|
+
if (distSrc.startsWith("/")) {
|
|
215
|
+
distSrc = distSrc.substring(1);
|
|
216
|
+
}
|
|
217
|
+
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
218
|
+
}
|
|
219
|
+
packageJson.files ??= ["dist/**/*"];
|
|
220
|
+
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
221
|
+
packageJson.files.push("src/**/*");
|
|
222
|
+
}
|
|
223
|
+
packageJson.publishConfig ??= {
|
|
224
|
+
access: "public"
|
|
225
|
+
};
|
|
226
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
227
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
228
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
229
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
230
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
231
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
232
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
233
|
+
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
234
|
+
if (!packageJson.maintainers && packageJson.author) {
|
|
235
|
+
packageJson.maintainers = [packageJson.author];
|
|
236
|
+
}
|
|
237
|
+
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
238
|
+
if (!packageJson.contributors && packageJson.author) {
|
|
239
|
+
packageJson.contributors = [packageJson.author];
|
|
240
|
+
}
|
|
241
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
242
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
243
|
+
return packageJson;
|
|
244
|
+
};
|
|
245
|
+
var addPackageJsonExport = (file, type = "module", sourceRoot) => {
|
|
246
|
+
let entry = file.replaceAll("\\", "/");
|
|
247
|
+
if (sourceRoot) {
|
|
248
|
+
entry = entry.replace(sourceRoot, "");
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
import: {
|
|
252
|
+
types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
|
|
253
|
+
default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
|
|
254
|
+
},
|
|
255
|
+
require: {
|
|
256
|
+
types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
|
|
257
|
+
default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
|
|
258
|
+
},
|
|
259
|
+
default: {
|
|
260
|
+
types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
|
|
261
|
+
default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// ../build-tools/src/utilities/get-env.ts
|
|
267
|
+
var getEnv = (builder, options) => {
|
|
268
|
+
return {
|
|
269
|
+
STORM_BUILD: builder,
|
|
270
|
+
STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
|
|
271
|
+
STORM_NAME: options.name,
|
|
272
|
+
STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
|
|
273
|
+
STORM_PLATFORM: options.platform,
|
|
274
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
275
|
+
STORM_TARGET: JSON.stringify(options.target),
|
|
276
|
+
...options.env
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// ../build-tools/src/plugins/swc.ts
|
|
281
|
+
import { transform } from "@swc/core";
|
|
282
|
+
|
|
283
|
+
// ../build-tools/src/plugins/ts-resolve.ts
|
|
284
|
+
import fs from "node:fs";
|
|
285
|
+
import { builtinModules } from "node:module";
|
|
286
|
+
import path from "node:path";
|
|
287
|
+
import _resolve from "resolve";
|
|
288
|
+
|
|
289
|
+
// ../build-tools/src/plugins/type-definitions.ts
|
|
290
|
+
import { stripIndents } from "@nx/devkit";
|
|
291
|
+
import { relative } from "path";
|
|
292
|
+
|
|
293
|
+
// ../build-tools/src/utilities/get-entry-points.ts
|
|
294
|
+
import { glob as glob2 } from "glob";
|
|
295
|
+
|
|
296
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
297
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
298
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
299
|
+
|
|
300
|
+
// ../build-tools/src/utilities/task-graph.ts
|
|
301
|
+
import {
|
|
302
|
+
createTaskGraph,
|
|
303
|
+
mapTargetDefaultsToDependencies
|
|
304
|
+
} from "nx/src/tasks-runner/create-task-graph";
|
|
305
|
+
|
|
306
|
+
export {
|
|
307
|
+
DEFAULT_COMPILED_BANNER,
|
|
308
|
+
DEFAULT_TARGET,
|
|
309
|
+
copyAssets,
|
|
310
|
+
addPackageDependencies,
|
|
311
|
+
addWorkspacePackageJsonFields,
|
|
312
|
+
addPackageJsonExport,
|
|
313
|
+
getEnv
|
|
314
|
+
};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk2CDSXWFAjs = require('./chunk-2CDSXWFA.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkIVAHNQZPjs = require('./chunk-IVAHNQZP.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkG2L3EEEOjs = require('./chunk-G2L3EEEO.js');
|
|
11
|
+
|
|
12
|
+
// ../build-tools/src/config.ts
|
|
13
|
+
var DEFAULT_COMPILED_BANNER = `/*****************************************
|
|
14
|
+
*
|
|
15
|
+
* \u26A1 Built by Storm Software
|
|
16
|
+
*
|
|
17
|
+
*****************************************/
|
|
18
|
+
`;
|
|
19
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
20
|
+
var DEFAULT_TARGET = "esnext";
|
|
21
|
+
var DEFAULT_ORGANIZATION = "storm-software";
|
|
22
|
+
|
|
23
|
+
// ../build-tools/src/utilities/copy-assets.ts
|
|
24
|
+
var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
|
|
25
|
+
var _glob = require('glob');
|
|
26
|
+
var _promises = require('fs/promises');
|
|
27
|
+
var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson = true, includeSrc = false, banner, footer) => {
|
|
28
|
+
const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
|
|
29
|
+
pendingAssets.push({
|
|
30
|
+
input: projectRoot,
|
|
31
|
+
glob: "*.md",
|
|
32
|
+
output: "."
|
|
33
|
+
});
|
|
34
|
+
pendingAssets.push({
|
|
35
|
+
input: ".",
|
|
36
|
+
glob: "LICENSE",
|
|
37
|
+
output: "."
|
|
38
|
+
});
|
|
39
|
+
if (generatePackageJson === false) {
|
|
40
|
+
pendingAssets.push({
|
|
41
|
+
input: projectRoot,
|
|
42
|
+
glob: "package.json",
|
|
43
|
+
output: "."
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (includeSrc === true) {
|
|
47
|
+
pendingAssets.push({
|
|
48
|
+
input: sourceRoot,
|
|
49
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
50
|
+
output: "src/"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
_chunk2CDSXWFAjs.writeTrace.call(void 0,
|
|
54
|
+
`\u{1F4DD} Copying the following assets to the output directory:
|
|
55
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${_chunkG2L3EEEOjs.joinPaths.call(void 0, outputPath, pendingAsset.output)}`).join("\n")}`,
|
|
56
|
+
config
|
|
57
|
+
);
|
|
58
|
+
const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
|
|
59
|
+
projectDir: projectRoot,
|
|
60
|
+
rootDir: config.workspaceRoot,
|
|
61
|
+
outputDir: outputPath,
|
|
62
|
+
assets: pendingAssets
|
|
63
|
+
});
|
|
64
|
+
await assetHandler.processAllAssetsOnce();
|
|
65
|
+
_chunk2CDSXWFAjs.writeTrace.call(void 0, "Completed copying assets to the output directory", config);
|
|
66
|
+
if (includeSrc === true) {
|
|
67
|
+
_chunk2CDSXWFAjs.writeDebug.call(void 0,
|
|
68
|
+
`\u{1F4DD} Adding banner and writing source files: ${_chunkG2L3EEEOjs.joinPaths.call(void 0,
|
|
69
|
+
outputPath,
|
|
70
|
+
"src"
|
|
71
|
+
)}`,
|
|
72
|
+
config
|
|
73
|
+
);
|
|
74
|
+
const files = await _glob.glob.call(void 0, [
|
|
75
|
+
_chunkG2L3EEEOjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
76
|
+
_chunkG2L3EEEOjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
77
|
+
_chunkG2L3EEEOjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
78
|
+
_chunkG2L3EEEOjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
79
|
+
]);
|
|
80
|
+
await Promise.allSettled(
|
|
81
|
+
files.map(
|
|
82
|
+
async (file) => _promises.writeFile.call(void 0,
|
|
83
|
+
file,
|
|
84
|
+
`${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
85
|
+
|
|
86
|
+
${await _promises.readFile.call(void 0, file, "utf8")}
|
|
87
|
+
|
|
88
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
96
|
+
var _buildablelibsutils = require('@nx/js/src/utils/buildable-libs-utils');
|
|
97
|
+
|
|
98
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var _projectgraph = require('nx/src/project-graph/project-graph');
|
|
105
|
+
var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
106
|
+
let projectGraph;
|
|
107
|
+
try {
|
|
108
|
+
projectGraph = _projectgraph.readCachedProjectGraph.call(void 0, );
|
|
109
|
+
} catch (e) {
|
|
110
|
+
await _projectgraph.createProjectGraphAsync.call(void 0, );
|
|
111
|
+
projectGraph = _projectgraph.readCachedProjectGraph.call(void 0, );
|
|
112
|
+
}
|
|
113
|
+
if (!projectGraph) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"The Build process failed because the project graph is not available. Please run the build command again."
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
const projectDependencies = _buildablelibsutils.calculateProjectBuildableDependencies.call(void 0,
|
|
119
|
+
void 0,
|
|
120
|
+
projectGraph,
|
|
121
|
+
workspaceRoot,
|
|
122
|
+
projectName,
|
|
123
|
+
process.env.NX_TASK_TARGET_TARGET || "build",
|
|
124
|
+
process.env.NX_TASK_TARGET_CONFIGURATION || "production",
|
|
125
|
+
true
|
|
126
|
+
);
|
|
127
|
+
const localPackages = [];
|
|
128
|
+
for (const project of projectDependencies.dependencies.filter(
|
|
129
|
+
(dep) => dep.node.type === "lib" && _optionalChain([dep, 'access', _ => _.node, 'access', _2 => _2.data, 'optionalAccess', _3 => _3.root]) !== projectRoot && _optionalChain([dep, 'access', _4 => _4.node, 'access', _5 => _5.data, 'optionalAccess', _6 => _6.root]) !== workspaceRoot
|
|
130
|
+
)) {
|
|
131
|
+
const projectNode = project.node;
|
|
132
|
+
if (projectNode.data.root) {
|
|
133
|
+
const projectPackageJsonPath = _chunkG2L3EEEOjs.joinPaths.call(void 0,
|
|
134
|
+
workspaceRoot,
|
|
135
|
+
projectNode.data.root,
|
|
136
|
+
"package.json"
|
|
137
|
+
);
|
|
138
|
+
if (_fs.existsSync.call(void 0, projectPackageJsonPath)) {
|
|
139
|
+
const projectPackageJsonContent = await _promises.readFile.call(void 0,
|
|
140
|
+
projectPackageJsonPath,
|
|
141
|
+
"utf8"
|
|
142
|
+
);
|
|
143
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
144
|
+
if (projectPackageJson.private !== true) {
|
|
145
|
+
localPackages.push(projectPackageJson);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (localPackages.length > 0) {
|
|
151
|
+
_chunk2CDSXWFAjs.writeTrace.call(void 0,
|
|
152
|
+
`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
|
|
153
|
+
);
|
|
154
|
+
const projectJsonFile = await _promises.readFile.call(void 0,
|
|
155
|
+
_chunkG2L3EEEOjs.joinPaths.call(void 0, projectRoot, "project.json"),
|
|
156
|
+
"utf8"
|
|
157
|
+
);
|
|
158
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
159
|
+
const projectName2 = projectJson.name;
|
|
160
|
+
const projectConfigurations = _projectgraph.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
161
|
+
if (!_optionalChain([projectConfigurations, 'optionalAccess', _7 => _7.projects, 'optionalAccess', _8 => _8[projectName2]])) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
"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."
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const implicitDependencies = _optionalChain([projectConfigurations, 'access', _9 => _9.projects, 'optionalAccess', _10 => _10[projectName2], 'access', _11 => _11.implicitDependencies, 'optionalAccess', _12 => _12.reduce, 'call', _13 => _13((ret, dep) => {
|
|
167
|
+
if (_optionalChain([projectConfigurations, 'access', _14 => _14.projects, 'optionalAccess', _15 => _15[dep]])) {
|
|
168
|
+
const depPackageJsonPath = _chunkG2L3EEEOjs.joinPaths.call(void 0,
|
|
169
|
+
workspaceRoot,
|
|
170
|
+
projectConfigurations.projects[dep].root,
|
|
171
|
+
"package.json"
|
|
172
|
+
);
|
|
173
|
+
if (_fs.existsSync.call(void 0, depPackageJsonPath)) {
|
|
174
|
+
const depPackageJsonContent = _fs.readFileSync.call(void 0,
|
|
175
|
+
depPackageJsonPath,
|
|
176
|
+
"utf8"
|
|
177
|
+
);
|
|
178
|
+
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
179
|
+
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
180
|
+
ret.push(depPackageJson.name);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return ret;
|
|
185
|
+
}, [])]);
|
|
186
|
+
packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
|
|
187
|
+
if (!ret[localPackage.name] && !_optionalChain([implicitDependencies, 'optionalAccess', _16 => _16.includes, 'call', _17 => _17(localPackage.name)]) && _optionalChain([packageJson, 'access', _18 => _18.devDependencies, 'optionalAccess', _19 => _19[localPackage.name]]) === void 0) {
|
|
188
|
+
ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
|
|
189
|
+
}
|
|
190
|
+
return ret;
|
|
191
|
+
}, _nullishCoalesce(packageJson.dependencies, () => ( {})));
|
|
192
|
+
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
193
|
+
if (!ret[localPackage.name] && _optionalChain([implicitDependencies, 'optionalAccess', _20 => _20.includes, 'call', _21 => _21(localPackage.name)]) && _optionalChain([packageJson, 'access', _22 => _22.dependencies, 'optionalAccess', _23 => _23[localPackage.name]]) === void 0) {
|
|
194
|
+
ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
|
|
195
|
+
}
|
|
196
|
+
return ret;
|
|
197
|
+
}, _nullishCoalesce(packageJson.devDependencies, () => ( {})));
|
|
198
|
+
} else {
|
|
199
|
+
_chunk2CDSXWFAjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
200
|
+
}
|
|
201
|
+
return packageJson;
|
|
202
|
+
};
|
|
203
|
+
var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
204
|
+
const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : _chunkIVAHNQZPjs.findWorkspaceRoot.call(void 0, );
|
|
205
|
+
const workspacePackageJsonContent = await _promises.readFile.call(void 0,
|
|
206
|
+
_chunkG2L3EEEOjs.joinPaths.call(void 0, workspaceRoot, "package.json"),
|
|
207
|
+
"utf8"
|
|
208
|
+
);
|
|
209
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
210
|
+
packageJson.type ??= "module";
|
|
211
|
+
packageJson.sideEffects ??= false;
|
|
212
|
+
if (includeSrc === true) {
|
|
213
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
214
|
+
if (distSrc.startsWith("/")) {
|
|
215
|
+
distSrc = distSrc.substring(1);
|
|
216
|
+
}
|
|
217
|
+
packageJson.source ??= `${_chunkG2L3EEEOjs.joinPaths.call(void 0, distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
218
|
+
}
|
|
219
|
+
packageJson.files ??= ["dist/**/*"];
|
|
220
|
+
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
221
|
+
packageJson.files.push("src/**/*");
|
|
222
|
+
}
|
|
223
|
+
packageJson.publishConfig ??= {
|
|
224
|
+
access: "public"
|
|
225
|
+
};
|
|
226
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
227
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
228
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
229
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
230
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
231
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
232
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
233
|
+
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
234
|
+
if (!packageJson.maintainers && packageJson.author) {
|
|
235
|
+
packageJson.maintainers = [packageJson.author];
|
|
236
|
+
}
|
|
237
|
+
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
238
|
+
if (!packageJson.contributors && packageJson.author) {
|
|
239
|
+
packageJson.contributors = [packageJson.author];
|
|
240
|
+
}
|
|
241
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
242
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : _chunkG2L3EEEOjs.joinPaths.call(void 0, "packages", projectName);
|
|
243
|
+
return packageJson;
|
|
244
|
+
};
|
|
245
|
+
var addPackageJsonExport = (file, type = "module", sourceRoot) => {
|
|
246
|
+
let entry = file.replaceAll("\\", "/");
|
|
247
|
+
if (sourceRoot) {
|
|
248
|
+
entry = entry.replace(sourceRoot, "");
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
import: {
|
|
252
|
+
types: `./dist/${entry}.d.${type === "module" ? "ts" : "mts"}`,
|
|
253
|
+
default: `./dist/${entry}.${type === "module" ? "js" : "mjs"}`
|
|
254
|
+
},
|
|
255
|
+
require: {
|
|
256
|
+
types: `./dist/${entry}.d.${type === "commonjs" ? "ts" : "cts"}`,
|
|
257
|
+
default: `./dist/${entry}.${type === "commonjs" ? "js" : "cjs"}`
|
|
258
|
+
},
|
|
259
|
+
default: {
|
|
260
|
+
types: `./dist/${entry}.d.${type !== "fixed" ? "ts" : "mts"}`,
|
|
261
|
+
default: `./dist/${entry}.${type !== "fixed" ? "js" : "mjs"}`
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// ../build-tools/src/utilities/get-env.ts
|
|
267
|
+
var getEnv = (builder, options) => {
|
|
268
|
+
return {
|
|
269
|
+
STORM_BUILD: builder,
|
|
270
|
+
STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
|
|
271
|
+
STORM_NAME: options.name,
|
|
272
|
+
STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
|
|
273
|
+
STORM_PLATFORM: options.platform,
|
|
274
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
275
|
+
STORM_TARGET: JSON.stringify(options.target),
|
|
276
|
+
...options.env
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// ../build-tools/src/plugins/swc.ts
|
|
281
|
+
var _core = require('@swc/core');
|
|
282
|
+
|
|
283
|
+
// ../build-tools/src/plugins/ts-resolve.ts
|
|
284
|
+
|
|
285
|
+
var _module = require('module');
|
|
286
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
287
|
+
var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_resolve2);
|
|
288
|
+
|
|
289
|
+
// ../build-tools/src/plugins/type-definitions.ts
|
|
290
|
+
var _devkit = require('@nx/devkit');
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
// ../build-tools/src/utilities/get-entry-points.ts
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
// ../build-tools/src/utilities/task-graph.ts
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
var _createtaskgraph = require('nx/src/tasks-runner/create-task-graph');
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
exports.DEFAULT_COMPILED_BANNER = DEFAULT_COMPILED_BANNER; exports.DEFAULT_TARGET = DEFAULT_TARGET; exports.copyAssets = copyAssets; exports.addPackageDependencies = addPackageDependencies; exports.addWorkspacePackageJsonFields = addWorkspacePackageJsonFields; exports.addPackageJsonExport = addPackageJsonExport; exports.getEnv = getEnv;
|