@xylabs/ts-scripts-yarn3 7.0.0-rc.13 → 7.0.0-rc.15
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/dist/actions/index.mjs +61 -41
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +61 -41
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +61 -41
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +33 -24
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +12 -4
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +55 -38
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/index.mjs +61 -41
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +61 -41
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +61 -41
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +61 -41
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +61 -41
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +55 -38
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +61 -41
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +61 -41
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +61 -41
- package/dist/index.mjs.map +1 -1
- package/dist/lib/index.mjs +6 -3
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +6 -3
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/package.json +2 -2
package/dist/actions/index.mjs
CHANGED
|
@@ -299,14 +299,17 @@ import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
|
299
299
|
import deepmerge from "deepmerge";
|
|
300
300
|
var config;
|
|
301
301
|
var loadConfig = async (params) => {
|
|
302
|
-
if (config) {
|
|
302
|
+
if (config !== void 0) {
|
|
303
303
|
return deepmerge(config, params ?? {});
|
|
304
304
|
}
|
|
305
305
|
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
306
306
|
config = cosmicConfigResult?.config;
|
|
307
307
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
308
|
-
if (configFilePath) {
|
|
309
|
-
console.log(chalk5.
|
|
308
|
+
if (configFilePath !== void 0) {
|
|
309
|
+
console.log(chalk5.green(`Loaded config from ${configFilePath}`));
|
|
310
|
+
if (config.verbose) {
|
|
311
|
+
console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
|
|
312
|
+
}
|
|
310
313
|
}
|
|
311
314
|
return deepmerge(config, params ?? {});
|
|
312
315
|
};
|
|
@@ -1448,9 +1451,12 @@ var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
|
1448
1451
|
};
|
|
1449
1452
|
|
|
1450
1453
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1451
|
-
var packageCompileTsc = (entries, folder = "src", config2 = {}, compilerOptionsParam) => {
|
|
1454
|
+
var packageCompileTsc = (entries, folder = "src", outDir = "build", config2 = {}, compilerOptionsParam, verbose = false) => {
|
|
1452
1455
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1453
|
-
const
|
|
1456
|
+
const resolvedVerbose = verbose ?? config2?.verbose ?? false;
|
|
1457
|
+
if (resolvedVerbose) {
|
|
1458
|
+
console.log(`Verifying code START: ${entries.length} files to ${outDir} from ${folder}`);
|
|
1459
|
+
}
|
|
1454
1460
|
const compilerOptions = {
|
|
1455
1461
|
...getCompilerOptions({
|
|
1456
1462
|
removeComments: false,
|
|
@@ -1459,38 +1465,44 @@ var packageCompileTsc = (entries, folder = "src", config2 = {}, compilerOptionsP
|
|
|
1459
1465
|
sourceMap: false
|
|
1460
1466
|
}),
|
|
1461
1467
|
...compilerOptionsParam,
|
|
1462
|
-
outDir
|
|
1468
|
+
outDir,
|
|
1463
1469
|
emitDeclarationOnly: true,
|
|
1464
1470
|
noEmit: false
|
|
1465
1471
|
};
|
|
1466
1472
|
console.log(chalk26.green(`Validating Files: ${entries.length}`));
|
|
1467
|
-
if (
|
|
1473
|
+
if (resolvedVerbose) {
|
|
1468
1474
|
for (const entry of entries) {
|
|
1469
1475
|
console.log(chalk26.grey(`Validating: ${entry}`));
|
|
1470
1476
|
}
|
|
1471
1477
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1478
|
+
try {
|
|
1479
|
+
if (entries.length > 0) {
|
|
1480
|
+
const program = createProgramFromConfig({
|
|
1481
|
+
basePath: pkg ?? cwd2(),
|
|
1482
|
+
compilerOptions,
|
|
1483
|
+
files: entries.map((entry) => `${folder}/${entry}`)
|
|
1484
|
+
});
|
|
1485
|
+
const diagnostics = getPreEmitDiagnostics(program);
|
|
1486
|
+
if (diagnostics.length > 0) {
|
|
1487
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1488
|
+
diagnostics,
|
|
1489
|
+
{
|
|
1490
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1491
|
+
getCurrentDirectory: () => folder,
|
|
1492
|
+
getNewLine: () => sys.newLine
|
|
1493
|
+
}
|
|
1494
|
+
);
|
|
1495
|
+
console.error(formattedDiagnostics);
|
|
1496
|
+
}
|
|
1497
|
+
program.emit();
|
|
1498
|
+
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1499
|
+
}
|
|
1500
|
+
return 0;
|
|
1501
|
+
} finally {
|
|
1502
|
+
if (resolvedVerbose) {
|
|
1503
|
+
console.log(`Verifying code FINISH: ${entries.length} files to ${outDir} from ${folder}`);
|
|
1489
1504
|
}
|
|
1490
|
-
program.emit();
|
|
1491
|
-
return diagnostics.reduce((acc, diag) => acc + (diag.category === DiagnosticCategory.Error ? 1 : 0), 0);
|
|
1492
1505
|
}
|
|
1493
|
-
return 0;
|
|
1494
1506
|
};
|
|
1495
1507
|
|
|
1496
1508
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
@@ -1498,7 +1510,7 @@ import { cwd as cwd3 } from "process";
|
|
|
1498
1510
|
import { rollup } from "rollup";
|
|
1499
1511
|
import dts from "rollup-plugin-dts";
|
|
1500
1512
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
1501
|
-
async function bundleDts(inputPath, outputPath, platform, options) {
|
|
1513
|
+
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
1502
1514
|
const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
|
|
1503
1515
|
const bundle = await rollup({
|
|
1504
1516
|
input: inputPath,
|
|
@@ -1512,9 +1524,14 @@ async function bundleDts(inputPath, outputPath, platform, options) {
|
|
|
1512
1524
|
file: outputPath,
|
|
1513
1525
|
format: "es"
|
|
1514
1526
|
});
|
|
1515
|
-
|
|
1527
|
+
if (verbose) {
|
|
1528
|
+
console.log(`Bundled declarations written to ${outputPath}`);
|
|
1529
|
+
}
|
|
1516
1530
|
}
|
|
1517
|
-
var packageCompileTscTypes = async (entries, outDir, platform, folder = "build") => {
|
|
1531
|
+
var packageCompileTscTypes = async (entries, outDir, platform, folder = "build", verbose = false) => {
|
|
1532
|
+
if (verbose) {
|
|
1533
|
+
console.log(`Compiling Types START: ${entries.length} files to ${outDir} from ${folder}`);
|
|
1534
|
+
}
|
|
1518
1535
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1519
1536
|
const srcRoot = `${pkg}/${folder}`;
|
|
1520
1537
|
const entryNameToTypeName = (entry) => {
|
|
@@ -1534,8 +1551,11 @@ var packageCompileTscTypes = async (entries, outDir, platform, folder = "build")
|
|
|
1534
1551
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
1535
1552
|
const entryTypeName = entryNameToTypeName(entryName);
|
|
1536
1553
|
console.log(`Compiling Types: ${srcRoot}/${entryTypeName} to ${outDir}/${entryTypeName}`);
|
|
1537
|
-
await bundleDts(`${srcRoot}/${entryTypeName}`, outDir + "/" + entryTypeName, platform, { compilerOptions, tsconfig: "tsconfig.json" });
|
|
1554
|
+
await bundleDts(`${srcRoot}/${entryTypeName}`, outDir + "/" + entryTypeName, platform, { compilerOptions, tsconfig: "tsconfig.json" }, verbose);
|
|
1538
1555
|
}));
|
|
1556
|
+
if (verbose) {
|
|
1557
|
+
console.log(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${folder}`);
|
|
1558
|
+
}
|
|
1539
1559
|
return 0;
|
|
1540
1560
|
};
|
|
1541
1561
|
|
|
@@ -1559,7 +1579,7 @@ var compileFolder = async (folder, entries, options, verbose) => {
|
|
|
1559
1579
|
tsconfig: "tsconfig.json",
|
|
1560
1580
|
...options
|
|
1561
1581
|
});
|
|
1562
|
-
const validationResult = packageCompileTsc(entries);
|
|
1582
|
+
const validationResult = packageCompileTsc(entries, folder, void 0, void 0, void 0, verbose);
|
|
1563
1583
|
if (validationResult !== 0) {
|
|
1564
1584
|
console.error(`Compile:Validation had ${validationResult} errors`);
|
|
1565
1585
|
return validationResult;
|
|
@@ -1577,7 +1597,7 @@ var compileFolder = async (folder, entries, options, verbose) => {
|
|
|
1577
1597
|
if (verbose) {
|
|
1578
1598
|
console.log(`TSUP:build:stop [${folder}]`);
|
|
1579
1599
|
}
|
|
1580
|
-
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", "build");
|
|
1600
|
+
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", "build", verbose);
|
|
1581
1601
|
return 0;
|
|
1582
1602
|
};
|
|
1583
1603
|
var tsupOptions = (options = []) => {
|
|
@@ -1603,8 +1623,8 @@ var tsupOptions = (options = []) => {
|
|
|
1603
1623
|
};
|
|
1604
1624
|
var packageCompileTsup = async (config2) => {
|
|
1605
1625
|
const compile2 = config2?.compile;
|
|
1606
|
-
const
|
|
1607
|
-
if (
|
|
1626
|
+
const resolvedVerbose = config2?.verbose ?? false;
|
|
1627
|
+
if (resolvedVerbose) {
|
|
1608
1628
|
console.log(`Compiling with TSUP [Depth: ${compile2?.depth}]`);
|
|
1609
1629
|
}
|
|
1610
1630
|
const compileForNode = compile2?.node ?? { src: {} };
|
|
@@ -1616,14 +1636,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
1616
1636
|
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1617
1637
|
return typeof folder === "string" ? await compileFolder(
|
|
1618
1638
|
folder,
|
|
1619
|
-
buildEntries(folder, compile2?.entryMode, options, true,
|
|
1639
|
+
buildEntries(folder, compile2?.entryMode, options, true, resolvedVerbose),
|
|
1620
1640
|
tsupOptions([
|
|
1621
1641
|
inEsBuildOptions,
|
|
1622
1642
|
compile2?.tsup?.options ?? {},
|
|
1623
1643
|
typeof options === "object" ? options : {},
|
|
1624
1644
|
{ platform: "node", outDir: optionsObject.outDir ?? "dist/node" }
|
|
1625
1645
|
]),
|
|
1626
|
-
|
|
1646
|
+
resolvedVerbose
|
|
1627
1647
|
) : 0;
|
|
1628
1648
|
})
|
|
1629
1649
|
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
@@ -1632,14 +1652,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
1632
1652
|
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1633
1653
|
return typeof folder === "string" ? await compileFolder(
|
|
1634
1654
|
folder,
|
|
1635
|
-
buildEntries(folder, compile2?.entryMode, options, true,
|
|
1655
|
+
buildEntries(folder, compile2?.entryMode, options, true, resolvedVerbose),
|
|
1636
1656
|
tsupOptions([
|
|
1637
1657
|
inEsBuildOptions,
|
|
1638
1658
|
compile2?.tsup?.options ?? {},
|
|
1639
1659
|
typeof options === "object" ? options : {},
|
|
1640
1660
|
{ platform: "browser", outDir: optionsObject.outDir ?? "dist/browser" }
|
|
1641
1661
|
]),
|
|
1642
|
-
|
|
1662
|
+
resolvedVerbose
|
|
1643
1663
|
) : 0;
|
|
1644
1664
|
})
|
|
1645
1665
|
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
@@ -1648,14 +1668,14 @@ var packageCompileTsup = async (config2) => {
|
|
|
1648
1668
|
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1649
1669
|
return typeof folder === "string" ? await compileFolder(
|
|
1650
1670
|
folder,
|
|
1651
|
-
buildEntries(folder, compile2?.entryMode, options, true,
|
|
1671
|
+
buildEntries(folder, compile2?.entryMode, options, true, resolvedVerbose),
|
|
1652
1672
|
tsupOptions([
|
|
1653
1673
|
inEsBuildOptions,
|
|
1654
1674
|
compile2?.tsup?.options ?? {},
|
|
1655
1675
|
typeof options === "object" ? options : {},
|
|
1656
1676
|
{ platform: "neutral", outDir: optionsObject.outDir ?? "dist/neutral" }
|
|
1657
1677
|
]),
|
|
1658
|
-
|
|
1678
|
+
resolvedVerbose
|
|
1659
1679
|
) : 0;
|
|
1660
1680
|
})
|
|
1661
1681
|
)).reduce((prev, value) => prev + value, 0) + 0;
|