@storm-software/workspace-tools 1.43.5 → 1.43.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/index.js +453 -450
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +40 -23
- package/src/executors/design-tokens/executor.js +39 -22
- package/src/executors/tsup/executor.js +433 -430
- package/src/executors/tsup-browser/executor.js +433 -430
- package/src/executors/tsup-neutral/executor.js +433 -430
- package/src/executors/tsup-node/executor.js +433 -430
- package/src/generators/browser-library/generator.js +39 -22
- package/src/generators/config-schema/generator.js +44 -27
- package/src/generators/neutral-library/generator.js +39 -22
- package/src/generators/node-library/generator.js +39 -22
- package/src/generators/preset/generator.js +39 -22
|
@@ -47246,8 +47246,8 @@ var require_dist2 = __commonJS({
|
|
|
47246
47246
|
loadTsConfig: () => loadTsConfig2
|
|
47247
47247
|
});
|
|
47248
47248
|
module2.exports = __toCommonJS2(src_exports);
|
|
47249
|
-
var
|
|
47250
|
-
var
|
|
47249
|
+
var import_path2 = __toESM2(require("path"), 1);
|
|
47250
|
+
var import_fs2 = __toESM2(require("fs"), 1);
|
|
47251
47251
|
var singleComment = Symbol("singleComment");
|
|
47252
47252
|
var multiComment = Symbol("multiComment");
|
|
47253
47253
|
var stripWithoutWhitespace = () => "";
|
|
@@ -47342,29 +47342,29 @@ var require_dist2 = __commonJS({
|
|
|
47342
47342
|
}
|
|
47343
47343
|
}
|
|
47344
47344
|
var req = false ? createRequire(import_meta.url) : require;
|
|
47345
|
-
var findUp = (name, startDir, stopDir =
|
|
47345
|
+
var findUp = (name, startDir, stopDir = import_path2.default.parse(startDir).root) => {
|
|
47346
47346
|
let dir = startDir;
|
|
47347
47347
|
while (dir !== stopDir) {
|
|
47348
|
-
const file =
|
|
47349
|
-
if (
|
|
47348
|
+
const file = import_path2.default.join(dir, name);
|
|
47349
|
+
if (import_fs2.default.existsSync(file))
|
|
47350
47350
|
return file;
|
|
47351
47351
|
if (!file.endsWith(".json")) {
|
|
47352
47352
|
const fileWithExt = file + ".json";
|
|
47353
|
-
if (
|
|
47353
|
+
if (import_fs2.default.existsSync(fileWithExt))
|
|
47354
47354
|
return fileWithExt;
|
|
47355
47355
|
}
|
|
47356
|
-
dir =
|
|
47356
|
+
dir = import_path2.default.dirname(dir);
|
|
47357
47357
|
}
|
|
47358
47358
|
return null;
|
|
47359
47359
|
};
|
|
47360
47360
|
var resolveTsConfigFromFile = (cwd, filename) => {
|
|
47361
|
-
if (
|
|
47362
|
-
return
|
|
47361
|
+
if (import_path2.default.isAbsolute(filename))
|
|
47362
|
+
return import_fs2.default.existsSync(filename) ? filename : null;
|
|
47363
47363
|
return findUp(filename, cwd);
|
|
47364
47364
|
};
|
|
47365
47365
|
var resolveTsConfigFromExtends = (cwd, name) => {
|
|
47366
|
-
if (
|
|
47367
|
-
return
|
|
47366
|
+
if (import_path2.default.isAbsolute(name))
|
|
47367
|
+
return import_fs2.default.existsSync(name) ? name : null;
|
|
47368
47368
|
if (name.startsWith("."))
|
|
47369
47369
|
return findUp(name, cwd);
|
|
47370
47370
|
const id = req.resolve(name, { paths: [cwd] });
|
|
@@ -47372,14 +47372,14 @@ var require_dist2 = __commonJS({
|
|
|
47372
47372
|
};
|
|
47373
47373
|
var loadTsConfigInternal = (dir = process.cwd(), name = "tsconfig.json", isExtends = false) => {
|
|
47374
47374
|
var _a, _b;
|
|
47375
|
-
dir =
|
|
47375
|
+
dir = import_path2.default.resolve(dir);
|
|
47376
47376
|
const id = isExtends ? resolveTsConfigFromExtends(dir, name) : resolveTsConfigFromFile(dir, name);
|
|
47377
47377
|
if (!id)
|
|
47378
47378
|
return null;
|
|
47379
|
-
const data = jsoncParse(
|
|
47380
|
-
const configDir =
|
|
47379
|
+
const data = jsoncParse(import_fs2.default.readFileSync(id, "utf-8"));
|
|
47380
|
+
const configDir = import_path2.default.dirname(id);
|
|
47381
47381
|
if ((_a = data.compilerOptions) == null ? void 0 : _a.baseUrl) {
|
|
47382
|
-
data.compilerOptions.baseUrl =
|
|
47382
|
+
data.compilerOptions.baseUrl = import_path2.default.join(
|
|
47383
47383
|
configDir,
|
|
47384
47384
|
data.compilerOptions.baseUrl
|
|
47385
47385
|
);
|
|
@@ -47456,17 +47456,17 @@ var require_dist3 = __commonJS({
|
|
|
47456
47456
|
tsconfigPathsToRegExp: () => tsconfigPathsToRegExp
|
|
47457
47457
|
});
|
|
47458
47458
|
module2.exports = __toCommonJS2(src_exports);
|
|
47459
|
-
var
|
|
47460
|
-
var
|
|
47459
|
+
var import_fs2 = __toESM2(require("fs"), 1);
|
|
47460
|
+
var import_path2 = __toESM2(require("path"), 1);
|
|
47461
47461
|
var import_url3 = require("url");
|
|
47462
47462
|
var import_esbuild = require("esbuild");
|
|
47463
47463
|
var import_load_tsconfig = require_dist2();
|
|
47464
|
-
var
|
|
47465
|
-
var
|
|
47464
|
+
var import_fs3 = __toESM2(require("fs"), 1);
|
|
47465
|
+
var import_path3 = __toESM2(require("path"), 1);
|
|
47466
47466
|
var getPkgType = () => {
|
|
47467
47467
|
try {
|
|
47468
47468
|
const pkg = JSON.parse(
|
|
47469
|
-
|
|
47469
|
+
import_fs3.default.readFileSync(import_path3.default.resolve("package.json"), "utf-8")
|
|
47470
47470
|
);
|
|
47471
47471
|
return pkg.type;
|
|
47472
47472
|
} catch (error) {
|
|
@@ -47475,7 +47475,7 @@ var require_dist3 = __commonJS({
|
|
|
47475
47475
|
function guessFormat(inputFile) {
|
|
47476
47476
|
if (!usingDynamicImport)
|
|
47477
47477
|
return "cjs";
|
|
47478
|
-
const ext2 =
|
|
47478
|
+
const ext2 = import_path3.default.extname(inputFile);
|
|
47479
47479
|
const type = getPkgType();
|
|
47480
47480
|
if (ext2 === ".js") {
|
|
47481
47481
|
return type === "module" ? "esm" : "cjs";
|
|
@@ -47532,7 +47532,7 @@ var require_dist3 = __commonJS({
|
|
|
47532
47532
|
name: "bundle-require:external",
|
|
47533
47533
|
setup(ctx) {
|
|
47534
47534
|
ctx.onResolve({ filter: /.*/ }, async (args) => {
|
|
47535
|
-
if (args.path[0] === "." ||
|
|
47535
|
+
if (args.path[0] === "." || import_path2.default.isAbsolute(args.path)) {
|
|
47536
47536
|
return;
|
|
47537
47537
|
}
|
|
47538
47538
|
if (match2(args.path, external)) {
|
|
@@ -47561,11 +47561,11 @@ var require_dist3 = __commonJS({
|
|
|
47561
47561
|
"import.meta.url": IMPORT_META_URL_VAR_NAME
|
|
47562
47562
|
};
|
|
47563
47563
|
ctx.onLoad({ filter: JS_EXT_RE }, async (args) => {
|
|
47564
|
-
const contents = await
|
|
47564
|
+
const contents = await import_fs2.default.promises.readFile(args.path, "utf-8");
|
|
47565
47565
|
const injectLines = [
|
|
47566
47566
|
`const ${FILENAME_VAR_NAME} = ${JSON.stringify(args.path)};`,
|
|
47567
47567
|
`const ${DIRNAME_VAR_NAME} = ${JSON.stringify(
|
|
47568
|
-
|
|
47568
|
+
import_path2.default.dirname(args.path)
|
|
47569
47569
|
)};`,
|
|
47570
47570
|
`const ${IMPORT_META_URL_VAR_NAME} = ${JSON.stringify(
|
|
47571
47571
|
(0, import_url3.pathToFileURL)(args.path).href
|
|
@@ -47573,7 +47573,7 @@ var require_dist3 = __commonJS({
|
|
|
47573
47573
|
];
|
|
47574
47574
|
return {
|
|
47575
47575
|
contents: injectLines.join("") + contents,
|
|
47576
|
-
loader: inferLoader(
|
|
47576
|
+
loader: inferLoader(import_path2.default.extname(args.path))
|
|
47577
47577
|
};
|
|
47578
47578
|
});
|
|
47579
47579
|
}
|
|
@@ -47599,7 +47599,7 @@ var require_dist3 = __commonJS({
|
|
|
47599
47599
|
const { text } = result.outputFiles[0];
|
|
47600
47600
|
const getOutputFile = options.getOutputFile || defaultGetOutputFile;
|
|
47601
47601
|
const outfile = getOutputFile(options.filepath, format2);
|
|
47602
|
-
await
|
|
47602
|
+
await import_fs2.default.promises.writeFile(outfile, text, "utf8");
|
|
47603
47603
|
let mod;
|
|
47604
47604
|
const req = options.require || dynamicImport;
|
|
47605
47605
|
try {
|
|
@@ -47609,7 +47609,7 @@ var require_dist3 = __commonJS({
|
|
|
47609
47609
|
);
|
|
47610
47610
|
} finally {
|
|
47611
47611
|
if (!preserveTemporaryFile) {
|
|
47612
|
-
await
|
|
47612
|
+
await import_fs2.default.promises.unlink(outfile);
|
|
47613
47613
|
}
|
|
47614
47614
|
}
|
|
47615
47615
|
return {
|
|
@@ -126332,7 +126332,7 @@ module.exports = __toCommonJS(executor_exports);
|
|
|
126332
126332
|
// packages/config-tools/src/config-file/get-config-file.ts
|
|
126333
126333
|
var import_cosmiconfig = __toESM(require_dist(), 1);
|
|
126334
126334
|
var _static_cache = void 0;
|
|
126335
|
-
var getConfigFileName = (fileName, filePath) => (0, import_cosmiconfig.cosmiconfig)(fileName, { cache: true }).search(filePath);
|
|
126335
|
+
var getConfigFileName = async (fileName, filePath) => (0, import_cosmiconfig.cosmiconfig)(fileName, { cache: true }).search(filePath);
|
|
126336
126336
|
var getConfigFile = async (filePath) => {
|
|
126337
126337
|
if (_static_cache) {
|
|
126338
126338
|
return _static_cache;
|
|
@@ -126392,17 +126392,17 @@ var LogLevelLabel = {
|
|
|
126392
126392
|
};
|
|
126393
126393
|
|
|
126394
126394
|
// packages/config-tools/src/utilities/find-up.ts
|
|
126395
|
-
var
|
|
126396
|
-
var
|
|
126395
|
+
var import_node_fs = require("node:fs");
|
|
126396
|
+
var import_node_path = require("node:path");
|
|
126397
126397
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
126398
126398
|
var depth = 0;
|
|
126399
126399
|
function findFolderUp(startPath, endFileNames) {
|
|
126400
126400
|
const _startPath = startPath ?? process.cwd();
|
|
126401
|
-
if (endFileNames.some((endFileName) => (0,
|
|
126401
|
+
if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
126402
126402
|
return _startPath;
|
|
126403
126403
|
}
|
|
126404
126404
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
126405
|
-
const parent = (0,
|
|
126405
|
+
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
126406
126406
|
return findFolderUp(parent, endFileNames);
|
|
126407
126407
|
}
|
|
126408
126408
|
return void 0;
|
|
@@ -126461,8 +126461,8 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
126461
126461
|
}
|
|
126462
126462
|
|
|
126463
126463
|
// packages/config-tools/src/utilities/get-default-config.ts
|
|
126464
|
-
var
|
|
126465
|
-
var
|
|
126464
|
+
var import_node_fs2 = require("node:fs");
|
|
126465
|
+
var import_node_path2 = require("node:path");
|
|
126466
126466
|
|
|
126467
126467
|
// node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
|
|
126468
126468
|
var util;
|
|
@@ -130131,8 +130131,8 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
130131
130131
|
let license = DefaultStormConfig.license;
|
|
130132
130132
|
let homepage = DefaultStormConfig.homepage;
|
|
130133
130133
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
130134
|
-
if ((0,
|
|
130135
|
-
const file = (0,
|
|
130134
|
+
if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
|
|
130135
|
+
const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
|
|
130136
130136
|
encoding: "utf-8"
|
|
130137
130137
|
});
|
|
130138
130138
|
if (file) {
|
|
@@ -130155,9 +130155,9 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
130155
130155
|
}
|
|
130156
130156
|
}
|
|
130157
130157
|
return StormConfigSchema.parse({
|
|
130158
|
-
...config,
|
|
130159
130158
|
...DefaultStormConfig,
|
|
130160
|
-
|
|
130159
|
+
...config,
|
|
130160
|
+
colors: { ...DefaultColorConfig, ...config.colors },
|
|
130161
130161
|
workspaceRoot,
|
|
130162
130162
|
name,
|
|
130163
130163
|
namespace,
|
|
@@ -130501,16 +130501,6 @@ var setConfigEnv = (config) => {
|
|
|
130501
130501
|
}
|
|
130502
130502
|
};
|
|
130503
130503
|
|
|
130504
|
-
// packages/config-tools/src/utilities/prepare-workspace.ts
|
|
130505
|
-
var prepareWorkspace = async () => {
|
|
130506
|
-
const _STORM_CONFIG = getDefaultConfig({
|
|
130507
|
-
...await getConfigFile(),
|
|
130508
|
-
...getConfigEnv()
|
|
130509
|
-
});
|
|
130510
|
-
setConfigEnv(_STORM_CONFIG);
|
|
130511
|
-
return _STORM_CONFIG;
|
|
130512
|
-
};
|
|
130513
|
-
|
|
130514
130504
|
// packages/config-tools/src/env/get-env.ts
|
|
130515
130505
|
var getExtensionEnv = (extensionName) => {
|
|
130516
130506
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
@@ -130578,6 +130568,32 @@ var getConfigEnv = () => {
|
|
|
130578
130568
|
}, config);
|
|
130579
130569
|
};
|
|
130580
130570
|
|
|
130571
|
+
// packages/config-tools/src/create-storm-config.ts
|
|
130572
|
+
var loadStormConfig = async (workspaceRoot) => {
|
|
130573
|
+
let config = {};
|
|
130574
|
+
let _workspaceRoot = workspaceRoot;
|
|
130575
|
+
if (!_workspaceRoot) {
|
|
130576
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
130577
|
+
}
|
|
130578
|
+
const configFile = await getDefaultConfig(
|
|
130579
|
+
{
|
|
130580
|
+
...await getConfigFile(_workspaceRoot),
|
|
130581
|
+
...getConfigEnv()
|
|
130582
|
+
},
|
|
130583
|
+
_workspaceRoot
|
|
130584
|
+
);
|
|
130585
|
+
if (configFile) {
|
|
130586
|
+
config = StormConfigSchema.parse(configFile);
|
|
130587
|
+
} else {
|
|
130588
|
+
writeWarning(
|
|
130589
|
+
config,
|
|
130590
|
+
"No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.config.js` file to the root of your workspace if it is not."
|
|
130591
|
+
);
|
|
130592
|
+
}
|
|
130593
|
+
setConfigEnv(config);
|
|
130594
|
+
return config;
|
|
130595
|
+
};
|
|
130596
|
+
|
|
130581
130597
|
// packages/workspace-tools/src/utils/get-workspace-root.ts
|
|
130582
130598
|
var import_find_workspace_root2 = require("nx/src/utils/find-workspace-root.js");
|
|
130583
130599
|
var getWorkspaceRoot = () => {
|
|
@@ -130690,7 +130706,7 @@ var withRunExecutor = (name, executorFn, executorOptions) => async (_options, co
|
|
|
130690
130706
|
- projectName: ${projectName}
|
|
130691
130707
|
`
|
|
130692
130708
|
);
|
|
130693
|
-
config = await
|
|
130709
|
+
config = await loadStormConfig(workspaceRoot);
|
|
130694
130710
|
writeTrace(
|
|
130695
130711
|
config,
|
|
130696
130712
|
`Loaded Storm config into env:
|
|
@@ -130791,9 +130807,9 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
130791
130807
|
};
|
|
130792
130808
|
|
|
130793
130809
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
130794
|
-
var
|
|
130810
|
+
var import_node_fs3 = require("node:fs");
|
|
130795
130811
|
var import_promises2 = require("node:fs/promises");
|
|
130796
|
-
var
|
|
130812
|
+
var import_node_path3 = require("node:path");
|
|
130797
130813
|
var import_esbuild_decorators = __toESM(require_src());
|
|
130798
130814
|
var import_devkit2 = __toESM(require_devkit());
|
|
130799
130815
|
var import_js = __toESM(require_src2());
|
|
@@ -133404,10 +133420,10 @@ var LRUCache = class _LRUCache {
|
|
|
133404
133420
|
};
|
|
133405
133421
|
|
|
133406
133422
|
// node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
|
|
133407
|
-
var
|
|
133423
|
+
var import_path = require("path");
|
|
133408
133424
|
var import_url = require("url");
|
|
133409
133425
|
var actualFS = __toESM(require("fs"), 1);
|
|
133410
|
-
var
|
|
133426
|
+
var import_fs = require("fs");
|
|
133411
133427
|
var import_promises = require("fs/promises");
|
|
133412
133428
|
|
|
133413
133429
|
// node_modules/.pnpm/minipass@7.0.4/node_modules/minipass/dist/esm/index.js
|
|
@@ -134289,12 +134305,12 @@ var Minipass = class extends import_events.EventEmitter {
|
|
|
134289
134305
|
};
|
|
134290
134306
|
|
|
134291
134307
|
// node_modules/.pnpm/path-scurry@1.10.1/node_modules/path-scurry/dist/mjs/index.js
|
|
134292
|
-
var realpathSync =
|
|
134308
|
+
var realpathSync = import_fs.realpathSync.native;
|
|
134293
134309
|
var defaultFS = {
|
|
134294
|
-
lstatSync:
|
|
134295
|
-
readdir:
|
|
134296
|
-
readdirSync:
|
|
134297
|
-
readlinkSync:
|
|
134310
|
+
lstatSync: import_fs.lstatSync,
|
|
134311
|
+
readdir: import_fs.readdir,
|
|
134312
|
+
readdirSync: import_fs.readdirSync,
|
|
134313
|
+
readlinkSync: import_fs.readlinkSync,
|
|
134298
134314
|
realpathSync,
|
|
134299
134315
|
promises: {
|
|
134300
134316
|
lstat: import_promises.lstat,
|
|
@@ -135290,7 +135306,7 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
135290
135306
|
* @internal
|
|
135291
135307
|
*/
|
|
135292
135308
|
getRootString(path2) {
|
|
135293
|
-
return
|
|
135309
|
+
return import_path.win32.parse(path2).root;
|
|
135294
135310
|
}
|
|
135295
135311
|
/**
|
|
135296
135312
|
* @internal
|
|
@@ -135930,7 +135946,7 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
135930
135946
|
sep = "\\";
|
|
135931
135947
|
constructor(cwd = process.cwd(), opts = {}) {
|
|
135932
135948
|
const { nocase = true } = opts;
|
|
135933
|
-
super(cwd,
|
|
135949
|
+
super(cwd, import_path.win32, "\\", { ...opts, nocase });
|
|
135934
135950
|
this.nocase = nocase;
|
|
135935
135951
|
for (let p = this.cwd; p; p = p.parent) {
|
|
135936
135952
|
p.nocase = this.nocase;
|
|
@@ -135940,7 +135956,7 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
135940
135956
|
* @internal
|
|
135941
135957
|
*/
|
|
135942
135958
|
parseRootPath(dir) {
|
|
135943
|
-
return
|
|
135959
|
+
return import_path.win32.parse(dir).root.toUpperCase();
|
|
135944
135960
|
}
|
|
135945
135961
|
/**
|
|
135946
135962
|
* @internal
|
|
@@ -135962,7 +135978,7 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
135962
135978
|
sep = "/";
|
|
135963
135979
|
constructor(cwd = process.cwd(), opts = {}) {
|
|
135964
135980
|
const { nocase = false } = opts;
|
|
135965
|
-
super(cwd,
|
|
135981
|
+
super(cwd, import_path.posix, "/", { ...opts, nocase });
|
|
135966
135982
|
this.nocase = nocase;
|
|
135967
135983
|
}
|
|
135968
135984
|
/**
|
|
@@ -137158,416 +137174,403 @@ var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(
|
|
|
137158
137174
|
|
|
137159
137175
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
137160
137176
|
async function tsupExecutorFn(options, context, config) {
|
|
137161
|
-
|
|
137162
|
-
|
|
137163
|
-
|
|
137164
|
-
|
|
137165
|
-
`\u2699\uFE0F Executor options:
|
|
137177
|
+
writeInfo(config, "\u{1F4E6} Running Storm build executor on the workspace");
|
|
137178
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && writeDebug(
|
|
137179
|
+
config,
|
|
137180
|
+
`\u2699\uFE0F Executor options:
|
|
137166
137181
|
${Object.keys(options).map(
|
|
137167
|
-
|
|
137168
|
-
|
|
137182
|
+
(key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
|
|
137183
|
+
).join("\n")}
|
|
137169
137184
|
`
|
|
137185
|
+
);
|
|
137186
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
137187
|
+
throw new Error(
|
|
137188
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
137170
137189
|
);
|
|
137171
|
-
|
|
137172
|
-
|
|
137173
|
-
|
|
137174
|
-
|
|
137175
|
-
|
|
137176
|
-
|
|
137177
|
-
|
|
137178
|
-
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
137179
|
-
if (options.clean !== false) {
|
|
137180
|
-
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
137181
|
-
writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
137182
|
-
}
|
|
137183
|
-
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
137190
|
+
}
|
|
137191
|
+
const workspaceRoot = getWorkspaceRoot();
|
|
137192
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
137193
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
137194
|
+
if (options.clean !== false) {
|
|
137195
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
137196
|
+
writeInfo(config, `\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
137184
137197
|
}
|
|
137185
|
-
|
|
137198
|
+
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
137199
|
+
}
|
|
137200
|
+
const assets = Array.from(options.assets);
|
|
137201
|
+
assets.push({
|
|
137202
|
+
input: projectRoot,
|
|
137203
|
+
glob: "*.md",
|
|
137204
|
+
output: "/"
|
|
137205
|
+
});
|
|
137206
|
+
assets.push({
|
|
137207
|
+
input: "",
|
|
137208
|
+
glob: "LICENSE",
|
|
137209
|
+
output: "."
|
|
137210
|
+
});
|
|
137211
|
+
if (options.generatePackageJson === false) {
|
|
137186
137212
|
assets.push({
|
|
137187
137213
|
input: projectRoot,
|
|
137188
|
-
glob: "
|
|
137189
|
-
output: "
|
|
137214
|
+
glob: "**/package.json",
|
|
137215
|
+
output: "."
|
|
137190
137216
|
});
|
|
137217
|
+
}
|
|
137218
|
+
if (options.includeSrc === true) {
|
|
137191
137219
|
assets.push({
|
|
137192
|
-
input:
|
|
137193
|
-
glob: "
|
|
137194
|
-
output: "
|
|
137220
|
+
input: sourceRoot,
|
|
137221
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
137222
|
+
output: "src/"
|
|
137195
137223
|
});
|
|
137196
|
-
|
|
137197
|
-
|
|
137198
|
-
|
|
137199
|
-
|
|
137200
|
-
|
|
137201
|
-
|
|
137202
|
-
|
|
137203
|
-
|
|
137204
|
-
|
|
137205
|
-
|
|
137206
|
-
|
|
137207
|
-
|
|
137208
|
-
|
|
137209
|
-
|
|
137210
|
-
|
|
137211
|
-
|
|
137212
|
-
|
|
137213
|
-
);
|
|
137214
|
-
if (!result.success) {
|
|
137215
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
137216
|
-
}
|
|
137217
|
-
const pathToPackageJson = (0, import_node_path.join)(context.root, projectRoot, "package.json");
|
|
137218
|
-
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
137219
|
-
const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_node_path.join)(workspaceRoot, "package.json"));
|
|
137220
|
-
options.external = options.external || [];
|
|
137221
|
-
if (workspacePackageJson?.dependencies) {
|
|
137222
|
-
options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
|
|
137223
|
-
(ret, key) => {
|
|
137224
|
-
if (!ret.includes(key)) {
|
|
137225
|
-
ret.push(key);
|
|
137226
|
-
}
|
|
137227
|
-
return ret;
|
|
137228
|
-
},
|
|
137229
|
-
options.external
|
|
137230
|
-
);
|
|
137231
|
-
}
|
|
137232
|
-
const externalDependencies = options.external.reduce(
|
|
137233
|
-
(ret, name) => {
|
|
137234
|
-
if (!packageJson?.devDependencies?.[name]) {
|
|
137235
|
-
const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
|
|
137236
|
-
if (externalNode) {
|
|
137237
|
-
ret.push({
|
|
137238
|
-
name,
|
|
137239
|
-
outputs: [],
|
|
137240
|
-
node: externalNode
|
|
137241
|
-
});
|
|
137242
|
-
}
|
|
137224
|
+
}
|
|
137225
|
+
const result = await (0, import_js.copyAssets)(
|
|
137226
|
+
{ assets, watch: options.watch, outputPath: options.outputPath },
|
|
137227
|
+
context
|
|
137228
|
+
);
|
|
137229
|
+
if (!result.success) {
|
|
137230
|
+
throw new Error("The Build process failed trying to copy assets");
|
|
137231
|
+
}
|
|
137232
|
+
const pathToPackageJson = (0, import_node_path3.join)(context.root, projectRoot, "package.json");
|
|
137233
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit2.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
137234
|
+
const workspacePackageJson = (0, import_devkit2.readJsonFile)((0, import_node_path3.join)(workspaceRoot, "package.json"));
|
|
137235
|
+
options.external = options.external || [];
|
|
137236
|
+
if (workspacePackageJson?.dependencies) {
|
|
137237
|
+
options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
|
|
137238
|
+
(ret, key) => {
|
|
137239
|
+
if (!ret.includes(key)) {
|
|
137240
|
+
ret.push(key);
|
|
137243
137241
|
}
|
|
137244
137242
|
return ret;
|
|
137245
137243
|
},
|
|
137246
|
-
|
|
137244
|
+
options.external
|
|
137247
137245
|
);
|
|
137248
|
-
|
|
137249
|
-
|
|
137250
|
-
|
|
137251
|
-
|
|
137252
|
-
|
|
137253
|
-
|
|
137254
|
-
|
|
137255
|
-
|
|
137256
|
-
|
|
137257
|
-
|
|
137258
|
-
|
|
137259
|
-
}
|
|
137260
|
-
const projectConfig = projectConfigs[key];
|
|
137261
|
-
if (projectConfig?.targets?.build) {
|
|
137262
|
-
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
137263
|
-
if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
|
|
137264
|
-
ret.push(projectPackageJson.name);
|
|
137265
|
-
internalDependencies.push(projectPackageJson.name);
|
|
137266
|
-
}
|
|
137267
|
-
}
|
|
137268
|
-
return ret;
|
|
137269
|
-
}, options.external);
|
|
137270
|
-
}
|
|
137271
|
-
if (options.bundle === false) {
|
|
137272
|
-
for (const thirdPartyDependency of getExternalDependencies(
|
|
137273
|
-
context.projectName,
|
|
137274
|
-
context.projectGraph
|
|
137275
|
-
)) {
|
|
137276
|
-
const packageConfig = thirdPartyDependency.node.data;
|
|
137277
|
-
if (packageConfig?.packageName) {
|
|
137278
|
-
options.external.push(packageConfig.packageName);
|
|
137279
|
-
if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
|
|
137280
|
-
externalDependencies.push(thirdPartyDependency);
|
|
137281
|
-
}
|
|
137246
|
+
}
|
|
137247
|
+
const externalDependencies = options.external.reduce(
|
|
137248
|
+
(ret, name) => {
|
|
137249
|
+
if (!packageJson?.devDependencies?.[name]) {
|
|
137250
|
+
const externalNode = context.projectGraph.externalNodes[`npm:${name}`];
|
|
137251
|
+
if (externalNode) {
|
|
137252
|
+
ret.push({
|
|
137253
|
+
name,
|
|
137254
|
+
outputs: [],
|
|
137255
|
+
node: externalNode
|
|
137256
|
+
});
|
|
137282
137257
|
}
|
|
137283
137258
|
}
|
|
137284
|
-
|
|
137285
|
-
|
|
137286
|
-
|
|
137287
|
-
|
|
137288
|
-
|
|
137289
|
-
|
|
137290
|
-
|
|
137291
|
-
|
|
137292
|
-
|
|
137293
|
-
|
|
137294
|
-
|
|
137295
|
-
|
|
137296
|
-
|
|
137297
|
-
|
|
137298
|
-
|
|
137299
|
-
|
|
137300
|
-
|
|
137301
|
-
|
|
137302
|
-
|
|
137303
|
-
|
|
137304
|
-
};
|
|
137305
|
-
const entryPoints = [];
|
|
137306
|
-
if (options.entry) {
|
|
137307
|
-
entryPoints.push(options.entry);
|
|
137308
|
-
}
|
|
137309
|
-
if (options.emitOnAll === true) {
|
|
137310
|
-
entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
|
|
137311
|
-
}
|
|
137312
|
-
if (options.additionalEntryPoints) {
|
|
137313
|
-
entryPoints.push(...options.additionalEntryPoints);
|
|
137314
|
-
}
|
|
137315
|
-
const entry = globSync(entryPoints, {
|
|
137316
|
-
withFileTypes: true
|
|
137317
|
-
}).reduce((ret, filePath) => {
|
|
137318
|
-
let formattedPath = workspaceRoot.replaceAll("\\", "/");
|
|
137319
|
-
if (formattedPath.toUpperCase().startsWith("C:")) {
|
|
137320
|
-
formattedPath = formattedPath.substring(2);
|
|
137321
|
-
}
|
|
137322
|
-
let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
137323
|
-
if (propertyKey) {
|
|
137324
|
-
while (propertyKey.startsWith("/")) {
|
|
137325
|
-
propertyKey = propertyKey.substring(1);
|
|
137326
|
-
}
|
|
137327
|
-
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
137328
|
-
console.debug(
|
|
137329
|
-
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
137330
|
-
filePath.path,
|
|
137331
|
-
filePath.name
|
|
137332
|
-
)}"`
|
|
137333
|
-
);
|
|
137334
|
-
}
|
|
137335
|
-
if (!(propertyKey in ret)) {
|
|
137336
|
-
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
137259
|
+
return ret;
|
|
137260
|
+
},
|
|
137261
|
+
[]
|
|
137262
|
+
);
|
|
137263
|
+
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
137264
|
+
const internalDependencies = [];
|
|
137265
|
+
const projectConfigs = await Promise.resolve(getProjectConfigurations());
|
|
137266
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
137267
|
+
writeDebug(config, "Project Configs:");
|
|
137268
|
+
console.log(projectConfigs);
|
|
137269
|
+
}
|
|
137270
|
+
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
137271
|
+
options.external = implicitDependencies.reduce((ret, key) => {
|
|
137272
|
+
writeDebug(config, `\u26A1 Adding implicit dependency: ${key}`);
|
|
137273
|
+
const projectConfig = projectConfigs[key];
|
|
137274
|
+
if (projectConfig?.targets?.build) {
|
|
137275
|
+
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
137276
|
+
if (projectPackageJson?.name && !options.external.includes(projectPackageJson.name)) {
|
|
137277
|
+
ret.push(projectPackageJson.name);
|
|
137278
|
+
internalDependencies.push(projectPackageJson.name);
|
|
137337
137279
|
}
|
|
137338
137280
|
}
|
|
137339
137281
|
return ret;
|
|
137340
|
-
},
|
|
137341
|
-
|
|
137342
|
-
|
|
137343
|
-
|
|
137344
|
-
|
|
137345
|
-
|
|
137346
|
-
|
|
137347
|
-
|
|
137348
|
-
|
|
137349
|
-
|
|
137350
|
-
|
|
137351
|
-
|
|
137352
|
-
packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
|
|
137282
|
+
}, options.external);
|
|
137283
|
+
}
|
|
137284
|
+
if (options.bundle === false) {
|
|
137285
|
+
for (const thirdPartyDependency of getExternalDependencies(
|
|
137286
|
+
context.projectName,
|
|
137287
|
+
context.projectGraph
|
|
137288
|
+
)) {
|
|
137289
|
+
const packageConfig = thirdPartyDependency.node.data;
|
|
137290
|
+
if (packageConfig?.packageName) {
|
|
137291
|
+
options.external.push(packageConfig.packageName);
|
|
137292
|
+
if (!packageJson?.devDependencies?.[packageConfig.packageName]) {
|
|
137293
|
+
externalDependencies.push(thirdPartyDependency);
|
|
137353
137294
|
}
|
|
137354
137295
|
}
|
|
137355
|
-
|
|
137356
|
-
|
|
137357
|
-
|
|
137358
|
-
|
|
137296
|
+
}
|
|
137297
|
+
}
|
|
137298
|
+
writeTrace(
|
|
137299
|
+
config,
|
|
137300
|
+
`Building with the following dependencies marked as external:
|
|
137301
|
+
${externalDependencies.map((dep) => {
|
|
137302
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
137303
|
+
}).join("\n")}`
|
|
137304
|
+
);
|
|
137305
|
+
const prettierOptions = {
|
|
137306
|
+
plugins: ["prettier-plugin-packagejson"],
|
|
137307
|
+
trailingComma: "none",
|
|
137308
|
+
tabWidth: 2,
|
|
137309
|
+
semi: true,
|
|
137310
|
+
singleQuote: false,
|
|
137311
|
+
quoteProps: "preserve",
|
|
137312
|
+
insertPragma: false,
|
|
137313
|
+
bracketSameLine: true,
|
|
137314
|
+
printWidth: 80,
|
|
137315
|
+
bracketSpacing: true,
|
|
137316
|
+
arrowParens: "avoid",
|
|
137317
|
+
endOfLine: "lf"
|
|
137318
|
+
};
|
|
137319
|
+
const entryPoints = [];
|
|
137320
|
+
if (options.entry) {
|
|
137321
|
+
entryPoints.push(options.entry);
|
|
137322
|
+
}
|
|
137323
|
+
if (options.emitOnAll === true) {
|
|
137324
|
+
entryPoints.push((0, import_devkit2.joinPathFragments)(sourceRoot, "**/*.{ts,tsx}"));
|
|
137325
|
+
}
|
|
137326
|
+
if (options.additionalEntryPoints) {
|
|
137327
|
+
entryPoints.push(...options.additionalEntryPoints);
|
|
137328
|
+
}
|
|
137329
|
+
const entry = globSync(entryPoints, {
|
|
137330
|
+
withFileTypes: true
|
|
137331
|
+
}).reduce((ret, filePath) => {
|
|
137332
|
+
let formattedPath = workspaceRoot.replaceAll("\\", "/");
|
|
137333
|
+
if (formattedPath.toUpperCase().startsWith("C:")) {
|
|
137334
|
+
formattedPath = formattedPath.substring(2);
|
|
137335
|
+
}
|
|
137336
|
+
let propertyKey = (0, import_devkit2.joinPathFragments)(filePath.path, removeExtension(filePath.name)).replaceAll("\\", "/").replaceAll(formattedPath, "").replaceAll(sourceRoot, "").replaceAll(projectRoot, "");
|
|
137337
|
+
if (propertyKey) {
|
|
137338
|
+
while (propertyKey.startsWith("/")) {
|
|
137339
|
+
propertyKey = propertyKey.substring(1);
|
|
137340
|
+
}
|
|
137341
|
+
writeDebug(
|
|
137342
|
+
config,
|
|
137343
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
137344
|
+
filePath.path,
|
|
137345
|
+
filePath.name
|
|
137346
|
+
)}"`
|
|
137347
|
+
);
|
|
137348
|
+
if (!(propertyKey in ret)) {
|
|
137349
|
+
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
137350
|
+
}
|
|
137351
|
+
}
|
|
137352
|
+
return ret;
|
|
137353
|
+
}, {});
|
|
137354
|
+
if (options.generatePackageJson !== false) {
|
|
137355
|
+
const projectGraph = (0, import_devkit2.readCachedProjectGraph)();
|
|
137356
|
+
packageJson.dependencies = void 0;
|
|
137357
|
+
for (const externalDependency of externalDependencies) {
|
|
137358
|
+
const packageConfig = externalDependency.node.data;
|
|
137359
|
+
if (packageConfig?.packageName && !!(projectGraph.externalNodes[externalDependency.node.name]?.type === "npm")) {
|
|
137360
|
+
const { packageName, version } = packageConfig;
|
|
137361
|
+
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName] || packageJson?.devDependencies?.[packageName]) {
|
|
137362
|
+
return null;
|
|
137359
137363
|
}
|
|
137364
|
+
packageJson.dependencies ??= {};
|
|
137365
|
+
packageJson.dependencies[packageName] = projectGraph.nodes[externalDependency.node.name] ? "latest" : version;
|
|
137360
137366
|
}
|
|
137361
|
-
|
|
137362
|
-
|
|
137363
|
-
if (
|
|
137364
|
-
packageJson.
|
|
137365
|
-
|
|
137367
|
+
}
|
|
137368
|
+
for (const packageName of internalDependencies) {
|
|
137369
|
+
if (!packageJson?.devDependencies?.[packageName]) {
|
|
137370
|
+
packageJson.dependencies ??= {};
|
|
137371
|
+
packageJson.dependencies[packageName] = "latest";
|
|
137372
|
+
}
|
|
137373
|
+
}
|
|
137374
|
+
const distPaths = !options?.getConfig || _isFunction(options.getConfig) ? ["dist/"] : Object.keys(options.getConfig).map((key) => `${key}/`);
|
|
137375
|
+
packageJson.type = "module";
|
|
137376
|
+
if (distPaths.length > 0) {
|
|
137377
|
+
packageJson.exports ??= {
|
|
137378
|
+
".": {
|
|
137379
|
+
import: {
|
|
137380
|
+
types: `./${distPaths[0]}index.d.ts`,
|
|
137381
|
+
default: `./${distPaths[0]}index.js`
|
|
137382
|
+
},
|
|
137383
|
+
require: {
|
|
137384
|
+
types: `./${distPaths[0]}index.d.cts`,
|
|
137385
|
+
default: `./${distPaths[0]}index.cjs`
|
|
137386
|
+
},
|
|
137387
|
+
default: {
|
|
137388
|
+
types: `./${distPaths[0]}index.d.ts`,
|
|
137389
|
+
default: `./${distPaths[0]}index.js`
|
|
137390
|
+
},
|
|
137391
|
+
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
137392
|
+
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
137393
|
+
types: (0, import_node_path3.join)(
|
|
137394
|
+
`./${distPaths[0]}`,
|
|
137395
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
137396
|
+
),
|
|
137397
|
+
default: (0, import_node_path3.join)(
|
|
137398
|
+
`./${distPaths[0]}`,
|
|
137399
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
137400
|
+
)
|
|
137401
|
+
}
|
|
137402
|
+
}))
|
|
137403
|
+
},
|
|
137404
|
+
"./package.json": "./package.json"
|
|
137405
|
+
};
|
|
137406
|
+
packageJson.exports = Object.keys(entry).reduce((ret, key) => {
|
|
137407
|
+
let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
|
|
137408
|
+
packageJsonKey = packageJsonKey.replaceAll("/index", "");
|
|
137409
|
+
if (!ret[packageJsonKey]) {
|
|
137410
|
+
ret[packageJsonKey] = {
|
|
137366
137411
|
import: {
|
|
137367
137412
|
types: `./${distPaths[0]}index.d.ts`,
|
|
137368
|
-
default: `./${distPaths[0]}
|
|
137413
|
+
default: `./${distPaths[0]}${key}.js`
|
|
137369
137414
|
},
|
|
137370
137415
|
require: {
|
|
137371
137416
|
types: `./${distPaths[0]}index.d.cts`,
|
|
137372
|
-
default: `./${distPaths[0]}
|
|
137417
|
+
default: `./${distPaths[0]}${key}.cjs`
|
|
137373
137418
|
},
|
|
137374
137419
|
default: {
|
|
137375
137420
|
types: `./${distPaths[0]}index.d.ts`,
|
|
137376
|
-
default: `./${distPaths[0]}
|
|
137377
|
-
}
|
|
137378
|
-
|
|
137379
|
-
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
137380
|
-
types: (0, import_node_path.join)(
|
|
137381
|
-
`./${distPaths[0]}`,
|
|
137382
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
137383
|
-
),
|
|
137384
|
-
default: (0, import_node_path.join)(
|
|
137385
|
-
`./${distPaths[0]}`,
|
|
137386
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
137387
|
-
)
|
|
137388
|
-
}
|
|
137389
|
-
}))
|
|
137390
|
-
},
|
|
137391
|
-
"./package.json": "./package.json"
|
|
137392
|
-
};
|
|
137393
|
-
packageJson.exports = Object.keys(entry).reduce((ret, key) => {
|
|
137394
|
-
let packageJsonKey = key.startsWith("./") ? key : `./${key}`;
|
|
137395
|
-
packageJsonKey = packageJsonKey.replaceAll("/index", "");
|
|
137396
|
-
if (!ret[packageJsonKey]) {
|
|
137397
|
-
ret[packageJsonKey] = {
|
|
137398
|
-
import: {
|
|
137399
|
-
types: `./${distPaths[0]}index.d.ts`,
|
|
137400
|
-
default: `./${distPaths[0]}${key}.js`
|
|
137401
|
-
},
|
|
137402
|
-
require: {
|
|
137403
|
-
types: `./${distPaths[0]}index.d.cts`,
|
|
137404
|
-
default: `./${distPaths[0]}${key}.cjs`
|
|
137405
|
-
},
|
|
137406
|
-
default: {
|
|
137407
|
-
types: `./${distPaths[0]}index.d.ts`,
|
|
137408
|
-
default: `./${distPaths[0]}${key}.js`
|
|
137409
|
-
}
|
|
137410
|
-
};
|
|
137411
|
-
}
|
|
137412
|
-
return ret;
|
|
137413
|
-
}, packageJson.exports);
|
|
137414
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
137415
|
-
packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
|
|
137416
|
-
packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
|
|
137417
|
-
packageJson.typescript ??= {
|
|
137418
|
-
definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
|
|
137419
|
-
};
|
|
137420
|
-
packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
|
|
137421
|
-
packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
|
|
137422
|
-
if (options.platform && options.platform !== "node") {
|
|
137423
|
-
packageJson.browser ??= `${distPaths[0]}index.global.js`;
|
|
137424
|
-
}
|
|
137425
|
-
if (options.includeSrc === true) {
|
|
137426
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
137427
|
-
if (distSrc.startsWith("/")) {
|
|
137428
|
-
distSrc = distSrc.substring(1);
|
|
137429
|
-
}
|
|
137430
|
-
packageJson.source ??= `${(0, import_node_path.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
137431
|
-
}
|
|
137432
|
-
packageJson.sideEffects ??= false;
|
|
137433
|
-
packageJson.files ??= ["dist/**/*"];
|
|
137434
|
-
if (options.includeSrc === true && !packageJson.files.includes("src")) {
|
|
137435
|
-
packageJson.files.push("src/**/*");
|
|
137421
|
+
default: `./${distPaths[0]}${key}.js`
|
|
137422
|
+
}
|
|
137423
|
+
};
|
|
137436
137424
|
}
|
|
137437
|
-
|
|
137438
|
-
packageJson.
|
|
137439
|
-
|
|
137440
|
-
}
|
|
137441
|
-
packageJson.
|
|
137442
|
-
packageJson.
|
|
137443
|
-
|
|
137444
|
-
|
|
137445
|
-
packageJson.
|
|
137446
|
-
packageJson.
|
|
137447
|
-
|
|
137448
|
-
|
|
137449
|
-
|
|
137450
|
-
if (
|
|
137451
|
-
|
|
137452
|
-
|
|
137453
|
-
|
|
137454
|
-
|
|
137455
|
-
|
|
137456
|
-
|
|
137457
|
-
|
|
137458
|
-
|
|
137459
|
-
)
|
|
137460
|
-
|
|
137461
|
-
|
|
137462
|
-
|
|
137463
|
-
|
|
137464
|
-
|
|
137465
|
-
|
|
137466
|
-
|
|
137467
|
-
|
|
137468
|
-
|
|
137469
|
-
|
|
137470
|
-
|
|
137471
|
-
|
|
137472
|
-
|
|
137473
|
-
|
|
137474
|
-
|
|
137475
|
-
|
|
137476
|
-
|
|
137477
|
-
|
|
137478
|
-
|
|
137479
|
-
|
|
137480
|
-
|
|
137481
|
-
"utf-8"
|
|
137482
|
-
)
|
|
137483
|
-
)
|
|
137484
|
-
);
|
|
137485
|
-
}
|
|
137486
|
-
const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
|
|
137487
|
-
ret[key] = options.env[key];
|
|
137488
|
-
return ret;
|
|
137489
|
-
}, {});
|
|
137490
|
-
options.plugins.push(
|
|
137491
|
-
(0, import_esbuild_decorators.esbuildDecorators)({
|
|
137492
|
-
tsconfig: options.tsConfig,
|
|
137493
|
-
cwd: workspaceRoot
|
|
137425
|
+
return ret;
|
|
137426
|
+
}, packageJson.exports);
|
|
137427
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
137428
|
+
packageJson.types ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
|
|
137429
|
+
packageJson.typings ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`;
|
|
137430
|
+
packageJson.typescript ??= {
|
|
137431
|
+
definition: `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.d.ts`
|
|
137432
|
+
};
|
|
137433
|
+
packageJson.main ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.cjs`;
|
|
137434
|
+
packageJson.module ??= `${distPaths.length > 1 ? distPaths[1] : distPaths[0]}index.js`;
|
|
137435
|
+
if (options.platform && options.platform !== "node") {
|
|
137436
|
+
packageJson.browser ??= `${distPaths[0]}index.global.js`;
|
|
137437
|
+
}
|
|
137438
|
+
if (options.includeSrc === true) {
|
|
137439
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
137440
|
+
if (distSrc.startsWith("/")) {
|
|
137441
|
+
distSrc = distSrc.substring(1);
|
|
137442
|
+
}
|
|
137443
|
+
packageJson.source ??= `${(0, import_node_path3.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
137444
|
+
}
|
|
137445
|
+
packageJson.sideEffects ??= false;
|
|
137446
|
+
packageJson.files ??= ["dist/**/*"];
|
|
137447
|
+
if (options.includeSrc === true && !packageJson.files.includes("src")) {
|
|
137448
|
+
packageJson.files.push("src/**/*");
|
|
137449
|
+
}
|
|
137450
|
+
}
|
|
137451
|
+
packageJson.publishConfig ??= {
|
|
137452
|
+
access: "public"
|
|
137453
|
+
};
|
|
137454
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
137455
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
137456
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
137457
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
137458
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
137459
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
137460
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
137461
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path3.join)("packages", context.projectName);
|
|
137462
|
+
const packageJsonPath = (0, import_node_path3.join)(context.root, options.outputPath, "package.json");
|
|
137463
|
+
writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
137464
|
+
(0, import_node_fs3.writeFileSync)(
|
|
137465
|
+
packageJsonPath,
|
|
137466
|
+
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
137467
|
+
...prettierOptions,
|
|
137468
|
+
parser: "json"
|
|
137494
137469
|
})
|
|
137495
137470
|
);
|
|
137496
|
-
|
|
137497
|
-
|
|
137498
|
-
|
|
137499
|
-
|
|
137500
|
-
|
|
137501
|
-
|
|
137502
|
-
|
|
137503
|
-
|
|
137504
|
-
|
|
137505
|
-
|
|
137506
|
-
|
|
137507
|
-
|
|
137508
|
-
|
|
137509
|
-
|
|
137510
|
-
(0,
|
|
137471
|
+
} else {
|
|
137472
|
+
writeWarning(config, "Skipping writing to package.json file");
|
|
137473
|
+
}
|
|
137474
|
+
if (options.includeSrc === true) {
|
|
137475
|
+
const files = globSync([
|
|
137476
|
+
(0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
137477
|
+
(0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
|
|
137478
|
+
(0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
|
|
137479
|
+
(0, import_devkit2.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
|
|
137480
|
+
]);
|
|
137481
|
+
await Promise.allSettled(
|
|
137482
|
+
files.map(
|
|
137483
|
+
async (file) => (0, import_promises2.writeFile)(
|
|
137484
|
+
file,
|
|
137485
|
+
await (0, import_prettier.format)(
|
|
137486
|
+
`${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
|
|
137487
|
+
|
|
137488
|
+
${(0, import_node_fs3.readFileSync)(file, "utf-8")}`,
|
|
137511
137489
|
{
|
|
137512
|
-
...
|
|
137513
|
-
|
|
137514
|
-
|
|
137515
|
-
transformers: options.skipTypia ? [] : ["typia/lib/transform"]
|
|
137516
|
-
},
|
|
137517
|
-
context.root,
|
|
137518
|
-
sourceRoot,
|
|
137519
|
-
workspaceRoot
|
|
137490
|
+
...prettierOptions,
|
|
137491
|
+
parser: "typescript"
|
|
137492
|
+
}
|
|
137520
137493
|
),
|
|
137521
|
-
|
|
137494
|
+
"utf-8"
|
|
137522
137495
|
)
|
|
137523
|
-
)
|
|
137524
|
-
|
|
137525
|
-
|
|
137496
|
+
)
|
|
137497
|
+
);
|
|
137498
|
+
}
|
|
137499
|
+
const stormEnv = Object.keys(options.env).filter((key) => key.startsWith("STORM_")).reduce((ret, key) => {
|
|
137500
|
+
ret[key] = options.env[key];
|
|
137501
|
+
return ret;
|
|
137502
|
+
}, {});
|
|
137503
|
+
options.plugins.push(
|
|
137504
|
+
(0, import_esbuild_decorators.esbuildDecorators)({
|
|
137505
|
+
tsconfig: options.tsConfig,
|
|
137506
|
+
cwd: workspaceRoot
|
|
137507
|
+
})
|
|
137508
|
+
);
|
|
137509
|
+
options.plugins.push(environmentPlugin(stormEnv));
|
|
137510
|
+
const getConfigOptions = {
|
|
137511
|
+
...options,
|
|
137512
|
+
define: {
|
|
137513
|
+
__STORM_CONFIG: JSON.stringify(stormEnv)
|
|
137514
|
+
},
|
|
137515
|
+
env: {
|
|
137516
|
+
__STORM_CONFIG: JSON.stringify(stormEnv),
|
|
137517
|
+
...stormEnv
|
|
137518
|
+
},
|
|
137519
|
+
dtsTsConfig: getNormalizedTsConfig(
|
|
137520
|
+
context.root,
|
|
137521
|
+
options.outputPath,
|
|
137522
|
+
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
137523
|
+
(0, import_normalize_options.normalizeOptions)(
|
|
137524
|
+
{
|
|
137525
|
+
...options,
|
|
137526
|
+
watch: false,
|
|
137527
|
+
main: options.entry,
|
|
137528
|
+
transformers: options.skipTypia ? [] : ["typia/lib/transform"]
|
|
137529
|
+
},
|
|
137530
|
+
context.root,
|
|
137531
|
+
sourceRoot,
|
|
137532
|
+
workspaceRoot
|
|
137533
|
+
),
|
|
137534
|
+
context
|
|
137535
|
+
)
|
|
137536
|
+
),
|
|
137537
|
+
banner: options.banner ? {
|
|
137538
|
+
js: `${options.banner}
|
|
137526
137539
|
|
|
137527
137540
|
`,
|
|
137528
|
-
|
|
137541
|
+
css: `/*
|
|
137529
137542
|
${options.banner}
|
|
137530
137543
|
*/
|
|
137531
137544
|
|
|
137532
137545
|
`
|
|
137533
|
-
|
|
137534
|
-
|
|
137535
|
-
|
|
137536
|
-
|
|
137537
|
-
|
|
137538
|
-
|
|
137539
|
-
|
|
137540
|
-
|
|
137541
|
-
|
|
137542
|
-
|
|
137543
|
-
|
|
137544
|
-
|
|
137545
|
-
|
|
137546
|
-
|
|
137547
|
-
);
|
|
137548
|
-
|
|
137549
|
-
|
|
137550
|
-
} else {
|
|
137551
|
-
await build(tsupConfig, config);
|
|
137552
|
-
}
|
|
137553
|
-
} else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
|
|
137554
|
-
writeWarning(
|
|
137555
|
-
config,
|
|
137556
|
-
"The Build process did not run because no `getConfig` parameter was provided"
|
|
137557
|
-
);
|
|
137558
|
-
}
|
|
137559
|
-
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
137560
|
-
writeSuccess(config, "\u26A1 The Build process has completed successfully");
|
|
137546
|
+
} : void 0,
|
|
137547
|
+
outputPath: options.outputPath,
|
|
137548
|
+
entry,
|
|
137549
|
+
getTransform: options.skipTypia ? void 0 : getTypiaTransform
|
|
137550
|
+
};
|
|
137551
|
+
if (options.getConfig) {
|
|
137552
|
+
writeInfo(config, "\u26A1 Running the Build process");
|
|
137553
|
+
const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
|
|
137554
|
+
const tsupConfig = (0, import_tsup.defineConfig)(
|
|
137555
|
+
getConfigFns.map(
|
|
137556
|
+
(getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
|
|
137557
|
+
)
|
|
137558
|
+
);
|
|
137559
|
+
if (_isFunction(tsupConfig)) {
|
|
137560
|
+
await build(await Promise.resolve(tsupConfig({})), config);
|
|
137561
|
+
} else {
|
|
137562
|
+
await build(tsupConfig, config);
|
|
137561
137563
|
}
|
|
137562
|
-
|
|
137563
|
-
|
|
137564
|
-
|
|
137565
|
-
|
|
137566
|
-
|
|
137567
|
-
return {
|
|
137568
|
-
success: false
|
|
137569
|
-
};
|
|
137564
|
+
} else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
|
|
137565
|
+
writeWarning(
|
|
137566
|
+
config,
|
|
137567
|
+
"The Build process did not run because no `getConfig` parameter was provided"
|
|
137568
|
+
);
|
|
137570
137569
|
}
|
|
137570
|
+
writeSuccess(config, "\u26A1 The Build process has completed successfully");
|
|
137571
|
+
return {
|
|
137572
|
+
success: true
|
|
137573
|
+
};
|
|
137571
137574
|
}
|
|
137572
137575
|
function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
137573
137576
|
const config = ts.readConfigFile(options.tsConfig, ts.sys.readFile).config;
|
|
@@ -137587,11 +137590,11 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
137587
137590
|
emitDeclarationOnly: true,
|
|
137588
137591
|
declaration: true,
|
|
137589
137592
|
declarationMap: true,
|
|
137590
|
-
declarationDir: (0,
|
|
137593
|
+
declarationDir: (0, import_node_path3.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
137591
137594
|
}
|
|
137592
137595
|
},
|
|
137593
137596
|
ts.sys,
|
|
137594
|
-
(0,
|
|
137597
|
+
(0, import_node_path3.dirname)(options.tsConfig)
|
|
137595
137598
|
);
|
|
137596
137599
|
tsConfig.options.pathsBasePath = workspaceRoot;
|
|
137597
137600
|
if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {
|