@storm-software/unbuild 0.22.0 → 0.23.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/bin/unbuild.js CHANGED
@@ -23,10 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  mod
24
24
  ));
25
25
 
26
- // ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.49.1_@types+node@22.10.7__@swc+core@1.7.26_@swc+helpers_ekim6y52mwpq6ssxiprcp44dam/node_modules/tsup/assets/cjs_shims.js
27
- var getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
28
- var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
-
30
26
  // ../config/src/schema.ts
31
27
  var import_zod = __toESM(require("zod"));
32
28
 
@@ -514,7 +510,7 @@ var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
514
510
  // ../config-tools/src/logger/console.ts
515
511
  var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
516
512
  const _chalk = getChalk();
517
- const colors3 = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
513
+ const colors2 = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
518
514
  const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
519
515
  if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
520
516
  return (_2) => {
@@ -523,48 +519,48 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) =>
523
519
  if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
524
520
  return (message) => {
525
521
  console.error(`
526
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
522
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
527
523
  `);
528
524
  };
529
525
  }
530
526
  if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
531
527
  return (message) => {
532
528
  console.error(`
533
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
529
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
534
530
  `);
535
531
  };
536
532
  }
537
533
  if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
538
534
  return (message) => {
539
535
  console.warn(`
540
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
536
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
541
537
  `);
542
538
  };
543
539
  }
544
540
  if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
545
541
  return (message) => {
546
542
  console.info(`
547
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
543
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
548
544
  `);
549
545
  };
550
546
  }
551
547
  if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
552
548
  return (message) => {
553
549
  console.info(`
554
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
550
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
555
551
  `);
556
552
  };
557
553
  }
558
554
  if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
559
555
  return (message) => {
560
556
  console.debug(`
561
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
557
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
562
558
  `);
563
559
  };
564
560
  }
565
561
  return (message) => {
566
562
  console.log(`
567
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors3.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
563
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors2.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.bold.whiteBright(formatLogMessage(message))}
568
564
  `);
569
565
  };
570
566
  }, "getLogFn");
@@ -655,7 +651,7 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
655
651
  envName: fileName?.toUpperCase(),
656
652
  jitiOptions: {
657
653
  debug: false,
658
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
654
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
659
655
  },
660
656
  ...options
661
657
  });
@@ -667,7 +663,7 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
667
663
  envName: fileName?.toUpperCase(),
668
664
  jitiOptions: {
669
665
  debug: false,
670
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
666
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
671
667
  },
672
668
  configFile: fileName,
673
669
  ...options
@@ -1386,1449 +1382,19 @@ var import_glob3 = require("glob");
1386
1382
  var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
1387
1383
 
1388
1384
  // src/build.ts
1389
- var import_defu5 = __toESM(require("defu"));
1390
- var import_node_fs8 = require("fs");
1391
- var import_promises7 = require("fs/promises");
1392
- var import_node_path6 = require("path");
1393
- var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
1394
-
1395
- // ../../node_modules/.pnpm/unbuild@3.3.1_sass@1.83.4_typescript@5.7.3/node_modules/unbuild/dist/shared/unbuild.B2_7OVir.mjs
1396
- var import_node_module2 = __toESM(require("module"), 1);
1397
- var import_node_fs6 = require("fs");
1398
- var import_pathe = require("pathe");
1399
- var import_utils = require("consola/utils");
1400
- var import_consola = __toESM(require("consola"), 1);
1401
- var import_defu3 = require("defu");
1402
- var import_hookable = require("hookable");
1403
- var import_pretty_bytes = __toESM(require("pretty-bytes"), 1);
1404
- var import_tinyglobby = require("tinyglobby");
1405
- var import_promises4 = __toESM(require("fs/promises"), 1);
1385
+ var import_defu3 = __toESM(require("defu"));
1406
1386
  var import_jiti = require("jiti");
1407
- var import_rollup = require("rollup");
1408
- var import_rollup_plugin_dts = __toESM(require("rollup-plugin-dts"), 1);
1409
- var import_plugin_commonjs = __toESM(require("@rollup/plugin-commonjs"), 1);
1410
- var import_plugin_node_resolve = require("@rollup/plugin-node-resolve");
1411
- var import_plugin_alias = __toESM(require("@rollup/plugin-alias"), 1);
1412
- var import_plugin_replace = __toESM(require("@rollup/plugin-replace"), 1);
1413
- var import_utils2 = require("pathe/utils");
1414
- var import_mlly = require("mlly");
1415
- var import_esbuild = require("esbuild");
1416
- var import_pluginutils = require("@rollup/pluginutils");
1417
- var import_plugin_json = __toESM(require("@rollup/plugin-json"), 1);
1418
- var import_magic_string = __toESM(require("magic-string"), 1);
1419
- var import_untyped = require("untyped");
1420
- var import_babel_plugin = __toESM(require("untyped/babel-plugin"), 1);
1421
- var import_scule = require("scule");
1422
- var import_mkdist = require("mkdist");
1423
- function definePreset(preset) {
1424
- return preset;
1425
- }
1426
- __name(definePreset, "definePreset");
1427
- var autoPreset = definePreset(() => {
1428
- return {
1429
- hooks: {
1430
- "build:prepare"(ctx) {
1431
- if (!ctx.pkg || ctx.options.entries.length > 0) {
1432
- return;
1433
- }
1434
- const sourceFiles = listRecursively((0, import_pathe.join)(ctx.options.rootDir, "src"));
1435
- const res = inferEntries(ctx.pkg, sourceFiles, ctx.options.rootDir);
1436
- for (const message of res.warnings) {
1437
- warn(ctx, message);
1438
- }
1439
- ctx.options.entries.push(...res.entries);
1440
- if (res.cjs) {
1441
- ctx.options.rollup.emitCJS = true;
1442
- }
1443
- if (ctx.options.declaration === void 0) {
1444
- ctx.options.declaration = res.dts ? "compatible" : false;
1445
- }
1446
- import_consola.consola.info(
1447
- "Automatically detected entries:",
1448
- import_utils.colors.cyan(
1449
- ctx.options.entries.map(
1450
- (e) => import_utils.colors.bold(
1451
- e.input.replace(ctx.options.rootDir + "/", "").replace(/\/$/, "/*")
1452
- )
1453
- ).join(", ")
1454
- ),
1455
- import_utils.colors.gray(
1456
- ["esm", res.cjs && "cjs", res.dts && "dts"].filter(Boolean).map((tag) => `[${tag}]`).join(" ")
1457
- )
1458
- );
1459
- }
1460
- }
1461
- };
1462
- });
1463
- function inferEntries(pkg, sourceFiles, rootDir) {
1464
- const warnings = [];
1465
- sourceFiles.sort((a, b) => a.split("/").length - b.split("/").length);
1466
- const outputs = extractExportFilenames(pkg.exports);
1467
- if (pkg.bin) {
1468
- const binaries = typeof pkg.bin === "string" ? [pkg.bin] : Object.values(pkg.bin);
1469
- for (const file of binaries) {
1470
- outputs.push({ file });
1471
- }
1472
- }
1473
- if (pkg.main) {
1474
- outputs.push({ file: pkg.main });
1475
- }
1476
- if (pkg.module) {
1477
- outputs.push({ type: "esm", file: pkg.module });
1478
- }
1479
- if (pkg.types || pkg.typings) {
1480
- outputs.push({ file: pkg.types || pkg.typings });
1481
- }
1482
- const isESMPkg = pkg.type === "module";
1483
- for (const output of outputs.filter((o) => !o.type)) {
1484
- const isJS = output.file.endsWith(".js");
1485
- if (isESMPkg && isJS || output.file.endsWith(".mjs")) {
1486
- output.type = "esm";
1487
- } else if (!isESMPkg && isJS || output.file.endsWith(".cjs")) {
1488
- output.type = "cjs";
1489
- }
1490
- }
1491
- let cjs = false;
1492
- let dts2 = false;
1493
- const entries = [];
1494
- for (const output of outputs) {
1495
- const outputSlug = output.file.replace(
1496
- /(\*[^/\\]*|\.d\.(m|c)?ts|\.\w+)$/,
1497
- ""
1498
- );
1499
- const isDir = outputSlug.endsWith("/");
1500
- if (isDir && ["./", "/"].includes(outputSlug)) {
1501
- continue;
1502
- }
1503
- const possiblePaths = getEntrypointPaths(outputSlug);
1504
- const input = possiblePaths.reduce((source, d) => {
1505
- if (source) {
1506
- return source;
1507
- }
1508
- const SOURCE_RE = new RegExp(
1509
- `(?<=/|$)${d}${isDir ? "" : String.raw`\.\w+`}$`
1510
- );
1511
- return sourceFiles.find((i) => SOURCE_RE.test(i))?.replace(/(\.d\.(m|c)?ts|\.\w+)$/, "");
1512
- }, void 0);
1513
- if (!input) {
1514
- if (!(0, import_node_fs6.existsSync)((0, import_pathe.resolve)(rootDir || ".", output.file))) {
1515
- warnings.push(`Could not find entrypoint for \`${output.file}\``);
1516
- }
1517
- continue;
1518
- }
1519
- if (output.type === "cjs") {
1520
- cjs = true;
1521
- }
1522
- const entry = entries.find((i) => i.input === input) || entries[entries.push({ input }) - 1];
1523
- if (/\.d\.(m|c)?ts$/.test(output.file)) {
1524
- dts2 = true;
1525
- }
1526
- if (isDir) {
1527
- entry.outDir = outputSlug;
1528
- entry.format = output.type;
1529
- }
1530
- }
1531
- return { entries, cjs, dts: dts2, warnings };
1532
- }
1533
- __name(inferEntries, "inferEntries");
1534
- var getEntrypointPaths = /* @__PURE__ */ __name((path3) => {
1535
- const segments = (0, import_pathe.normalize)(path3).split("/");
1536
- return segments.map((_2, index) => segments.slice(index).join("/")).filter(Boolean);
1537
- }, "getEntrypointPaths");
1538
- async function ensuredir(path3) {
1539
- await import_promises4.default.mkdir((0, import_pathe.dirname)(path3), { recursive: true });
1540
- }
1541
- __name(ensuredir, "ensuredir");
1542
- function warn(ctx, message) {
1543
- if (ctx.warnings.has(message)) {
1544
- return;
1545
- }
1546
- import_consola.consola.debug("[unbuild] [warn]", message);
1547
- ctx.warnings.add(message);
1548
- }
1549
- __name(warn, "warn");
1550
- async function symlink(from, to, force = true) {
1551
- await ensuredir(to);
1552
- if (force) {
1553
- await import_promises4.default.unlink(to).catch(() => {
1554
- });
1555
- }
1556
- await import_promises4.default.symlink(from, to, "junction");
1557
- }
1558
- __name(symlink, "symlink");
1559
- function dumpObject(obj) {
1560
- return "{ " + Object.keys(obj).map((key) => `${key}: ${JSON.stringify(obj[key])}`).join(", ") + " }";
1561
- }
1562
- __name(dumpObject, "dumpObject");
1563
- function getpkg(id = "") {
1564
- const s = id.split("/");
1565
- return s[0][0] === "@" ? `${s[0]}/${s[1]}` : s[0];
1566
- }
1567
- __name(getpkg, "getpkg");
1568
- async function rmdir(dir) {
1569
- await import_promises4.default.unlink(dir).catch(() => {
1570
- });
1571
- await import_promises4.default.rm(dir, { recursive: true, force: true }).catch(() => {
1572
- });
1573
- }
1574
- __name(rmdir, "rmdir");
1575
- function listRecursively(path3) {
1576
- const filenames = /* @__PURE__ */ new Set();
1577
- const walk = /* @__PURE__ */ __name((path22) => {
1578
- const files = (0, import_node_fs6.readdirSync)(path22);
1579
- for (const file of files) {
1580
- const fullPath = (0, import_pathe.resolve)(path22, file);
1581
- if ((0, import_node_fs6.statSync)(fullPath).isDirectory()) {
1582
- filenames.add(fullPath + "/");
1583
- walk(fullPath);
1584
- } else {
1585
- filenames.add(fullPath);
1586
- }
1587
- }
1588
- }, "walk");
1589
- walk(path3);
1590
- return [...filenames];
1591
- }
1592
- __name(listRecursively, "listRecursively");
1593
- async function resolvePreset(preset, rootDir) {
1594
- if (preset === "auto") {
1595
- preset = autoPreset;
1596
- } else if (typeof preset === "string") {
1597
- preset = await (0, import_jiti.createJiti)(rootDir, { interopDefault: true }).import(preset, {
1598
- default: true
1599
- }) || {};
1600
- }
1601
- if (typeof preset === "function") {
1602
- preset = preset();
1603
- }
1604
- return preset;
1605
- }
1606
- __name(resolvePreset, "resolvePreset");
1607
- function inferExportType(condition, previousConditions = [], filename = "") {
1608
- if (filename) {
1609
- if (filename.endsWith(".d.ts")) {
1610
- return "esm";
1611
- }
1612
- if (filename.endsWith(".mjs")) {
1613
- return "esm";
1614
- }
1615
- if (filename.endsWith(".cjs")) {
1616
- return "cjs";
1617
- }
1618
- }
1619
- switch (condition) {
1620
- case "import": {
1621
- return "esm";
1622
- }
1623
- case "require": {
1624
- return "cjs";
1625
- }
1626
- default: {
1627
- if (previousConditions.length === 0) {
1628
- return "esm";
1629
- }
1630
- const [newCondition, ...rest] = previousConditions;
1631
- return inferExportType(newCondition, rest, filename);
1632
- }
1633
- }
1634
- }
1635
- __name(inferExportType, "inferExportType");
1636
- function extractExportFilenames(exports2, conditions = []) {
1637
- if (!exports2) {
1638
- return [];
1639
- }
1640
- if (typeof exports2 === "string") {
1641
- return [{ file: exports2, type: "esm" }];
1642
- }
1643
- return Object.entries(exports2).filter(([subpath]) => !subpath.endsWith(".json")).flatMap(
1644
- ([condition, exports22]) => typeof exports22 === "string" ? {
1645
- file: exports22,
1646
- type: inferExportType(condition, conditions, exports22)
1647
- } : extractExportFilenames(exports22, [...conditions, condition])
1648
- );
1649
- }
1650
- __name(extractExportFilenames, "extractExportFilenames");
1651
- function arrayIncludes(arr, searchElement) {
1652
- return arr.some(
1653
- (entry) => entry instanceof RegExp ? entry.test(searchElement) : entry === searchElement
1654
- );
1655
- }
1656
- __name(arrayIncludes, "arrayIncludes");
1657
- function removeExtension(filename) {
1658
- return filename.replace(/\.(js|mjs|cjs|ts|mts|cts|json|jsx|tsx)$/, "");
1659
- }
1660
- __name(removeExtension, "removeExtension");
1661
- function inferPkgExternals(pkg) {
1662
- const externals = [
1663
- ...Object.keys(pkg.dependencies || {}),
1664
- ...Object.keys(pkg.peerDependencies || {}),
1665
- ...Object.keys(pkg.devDependencies || {}).filter(
1666
- (dep) => dep.startsWith("@types/")
1667
- ),
1668
- ...Object.keys(pkg.optionalDependencies || {})
1669
- ];
1670
- if (pkg.name) {
1671
- externals.push(pkg.name);
1672
- if (pkg.exports) {
1673
- for (const subpath of Object.keys(pkg.exports)) {
1674
- if (subpath.startsWith("./")) {
1675
- externals.push(pathToRegex(`${pkg.name}/${subpath.slice(2)}`));
1676
- }
1677
- }
1678
- }
1679
- }
1680
- if (pkg.imports) {
1681
- for (const importName of Object.keys(pkg.imports)) {
1682
- if (importName.startsWith("#")) {
1683
- externals.push(pathToRegex(importName));
1684
- }
1685
- }
1686
- }
1687
- return [...new Set(externals)];
1688
- }
1689
- __name(inferPkgExternals, "inferPkgExternals");
1690
- function pathToRegex(path3) {
1691
- return path3.includes("*") ? new RegExp(
1692
- `^${path3.replace(/\./g, String.raw`\.`).replace(/\*/g, ".*")}$`
1693
- ) : path3;
1694
- }
1695
- __name(pathToRegex, "pathToRegex");
1696
- function withTrailingSlash(path3) {
1697
- return path3.endsWith("/") ? path3 : `${path3}/`;
1698
- }
1699
- __name(withTrailingSlash, "withTrailingSlash");
1700
- function validateDependencies(ctx) {
1701
- const usedDependencies = /* @__PURE__ */ new Set();
1702
- const unusedDependencies = new Set(
1703
- Object.keys(ctx.pkg.dependencies || {})
1704
- );
1705
- const implicitDependencies = /* @__PURE__ */ new Set();
1706
- for (const id of ctx.usedImports) {
1707
- unusedDependencies.delete(id);
1708
- usedDependencies.add(id);
1709
- }
1710
- if (Array.isArray(ctx.options.dependencies)) {
1711
- for (const id of ctx.options.dependencies) {
1712
- unusedDependencies.delete(id);
1713
- }
1714
- }
1715
- for (const id of usedDependencies) {
1716
- if (!arrayIncludes(ctx.options.externals, id) && !id.startsWith("chunks/") && !ctx.options.dependencies.includes(getpkg(id)) && !ctx.options.peerDependencies.includes(getpkg(id))) {
1717
- implicitDependencies.add(id);
1718
- }
1719
- }
1720
- if (unusedDependencies.size > 0) {
1721
- warn(
1722
- ctx,
1723
- "Potential unused dependencies found: " + [...unusedDependencies].map((id) => import_utils.colors.cyan(id)).join(", ")
1724
- );
1725
- }
1726
- if (implicitDependencies.size > 0 && !ctx.options.rollup.inlineDependencies) {
1727
- warn(
1728
- ctx,
1729
- "Potential implicit dependencies found: " + [...implicitDependencies].map((id) => import_utils.colors.cyan(id)).join(", ")
1730
- );
1731
- }
1732
- }
1733
- __name(validateDependencies, "validateDependencies");
1734
- function validatePackage(pkg, rootDir, ctx) {
1735
- if (!pkg) {
1736
- return;
1737
- }
1738
- const filenames = new Set(
1739
- [
1740
- ...typeof pkg.bin === "string" ? [pkg.bin] : Object.values(pkg.bin || {}),
1741
- pkg.main,
1742
- pkg.module,
1743
- pkg.types,
1744
- pkg.typings,
1745
- ...extractExportFilenames(pkg.exports).map((i) => i.file)
1746
- ].map((i) => i && (0, import_pathe.resolve)(rootDir, i.replace(/\/[^/]*\*.*$/, "")))
1747
- );
1748
- const missingOutputs = [];
1749
- for (const filename of filenames) {
1750
- if (filename && !filename.includes("*") && !(0, import_node_fs6.existsSync)(filename)) {
1751
- missingOutputs.push(filename.replace(rootDir + "/", ""));
1752
- }
1753
- }
1754
- if (missingOutputs.length > 0) {
1755
- warn(
1756
- ctx,
1757
- `Potential missing package.json files: ${missingOutputs.map((o) => import_utils.colors.cyan(o)).join(", ")}`
1758
- );
1759
- }
1760
- }
1761
- __name(validatePackage, "validatePackage");
1762
- var SHEBANG_RE = /^#![^\n]*/;
1763
- function shebangPlugin() {
1764
- return {
1765
- name: "unbuild-shebang",
1766
- async writeBundle(options, bundle) {
1767
- for (const [fileName, output] of Object.entries(bundle)) {
1768
- if (output.type !== "chunk") {
1769
- continue;
1770
- }
1771
- if (output.code?.match(SHEBANG_RE)) {
1772
- const outFile = (0, import_pathe.resolve)(options.dir, fileName);
1773
- await makeExecutable(outFile);
1774
- }
1775
- }
1776
- }
1777
- };
1778
- }
1779
- __name(shebangPlugin, "shebangPlugin");
1780
- function removeShebangPlugin() {
1781
- return {
1782
- name: "unbuild-remove-shebang",
1783
- renderChunk(code) {
1784
- return code.replace(SHEBANG_RE, "");
1785
- }
1786
- };
1787
- }
1788
- __name(removeShebangPlugin, "removeShebangPlugin");
1789
- async function makeExecutable(filePath) {
1790
- await import_node_fs6.promises.chmod(
1791
- filePath,
1792
- 493
1793
- /* rwx r-x r-x */
1794
- ).catch(() => {
1795
- });
1796
- }
1797
- __name(makeExecutable, "makeExecutable");
1798
- function getShebang(code, append = "\n") {
1799
- const m = code.match(SHEBANG_RE);
1800
- return m ? m + append : "";
1801
- }
1802
- __name(getShebang, "getShebang");
1803
- var DefaultLoaders = {
1804
- ".js": "js",
1805
- ".mjs": "js",
1806
- ".cjs": "js",
1807
- ".ts": "ts",
1808
- ".mts": "ts",
1809
- ".cts": "ts",
1810
- ".tsx": "tsx",
1811
- ".jsx": "jsx"
1812
- };
1813
- function esbuild(options) {
1814
- const {
1815
- include = new RegExp(Object.keys(DefaultLoaders).join("|")),
1816
- exclude = /node_modules/,
1817
- loaders: loaderOptions,
1818
- ...esbuildOptions
1819
- } = options;
1820
- const loaders = { ...DefaultLoaders };
1821
- if (loaderOptions) {
1822
- for (const [key, value] of Object.entries(loaderOptions)) {
1823
- if (typeof value === "string") {
1824
- loaders[key] = value;
1825
- } else if (value === false) {
1826
- delete loaders[key];
1827
- }
1828
- }
1829
- }
1830
- const getLoader = /* @__PURE__ */ __name((id = "") => {
1831
- return loaders[(0, import_pathe.extname)(id)];
1832
- }, "getLoader");
1833
- const filter = (0, import_pluginutils.createFilter)(include, exclude);
1834
- return {
1835
- name: "esbuild",
1836
- async transform(code, id) {
1837
- if (!filter(id)) {
1838
- return null;
1839
- }
1840
- const loader = getLoader(id);
1841
- if (!loader) {
1842
- return null;
1843
- }
1844
- const result = await (0, import_esbuild.transform)(code, {
1845
- ...esbuildOptions,
1846
- loader,
1847
- sourcefile: id
1848
- });
1849
- printWarnings(id, result, this);
1850
- return {
1851
- code: result.code || "",
1852
- map: result.map || null
1853
- };
1854
- },
1855
- async renderChunk(code, { fileName }) {
1856
- if (!options.minify) {
1857
- return null;
1858
- }
1859
- if (/\.d\.(c|m)?tsx?$/.test(fileName)) {
1860
- return null;
1861
- }
1862
- const loader = getLoader(fileName);
1863
- if (!loader) {
1864
- return null;
1865
- }
1866
- const result = await (0, import_esbuild.transform)(code, {
1867
- ...esbuildOptions,
1868
- loader,
1869
- sourcefile: fileName,
1870
- minify: true
1871
- });
1872
- return {
1873
- code: result.code || "",
1874
- map: result.map || null
1875
- };
1876
- }
1877
- };
1878
- }
1879
- __name(esbuild, "esbuild");
1880
- function printWarnings(id, result, plugin) {
1881
- if (result.warnings) {
1882
- for (const warning of result.warnings) {
1883
- let message = "[esbuild]";
1884
- if (warning.location) {
1885
- message += ` (${(0, import_pathe.relative)(process.cwd(), id)}:${warning.location.line}:${warning.location.column})`;
1886
- }
1887
- message += ` ${warning.text}`;
1888
- plugin.warn(message);
1889
- }
1890
- }
1891
- }
1892
- __name(printWarnings, "printWarnings");
1893
- var EXPORT_DEFAULT = "export default ";
1894
- function JSONPlugin(options) {
1895
- const plugin = (0, import_plugin_json.default)(options);
1896
- return {
1897
- ...plugin,
1898
- name: "unbuild-json",
1899
- transform(code, id) {
1900
- const res = plugin.transform.call(this, code, id);
1901
- if (res && typeof res !== "string" && "code" in res && res.code && res.code.startsWith(EXPORT_DEFAULT)) {
1902
- res.code = res.code.replace(EXPORT_DEFAULT, "module.exports = ");
1903
- }
1904
- return res;
1905
- }
1906
- };
1907
- }
1908
- __name(JSONPlugin, "JSONPlugin");
1909
- var defaults = {
1910
- include: [/\.(md|txt|css|htm|html)$/],
1911
- exclude: []
1912
- };
1913
- function rawPlugin(opts = {}) {
1914
- opts = { ...opts, ...defaults };
1915
- const filter = (0, import_pluginutils.createFilter)(opts.include, opts.exclude);
1916
- return {
1917
- name: "unbuild-raw",
1918
- transform(code, id) {
1919
- if (filter(id)) {
1920
- return {
1921
- code: `export default ${JSON.stringify(code)}`,
1922
- map: null
1923
- };
1924
- }
1925
- }
1926
- };
1927
- }
1928
- __name(rawPlugin, "rawPlugin");
1929
- function cjsPlugin(_opts) {
1930
- return {
1931
- name: "unbuild-cjs",
1932
- renderChunk(code, _chunk, opts) {
1933
- if (opts.format === "es") {
1934
- return CJSToESM(code);
1935
- }
1936
- return null;
1937
- }
1938
- };
1939
- }
1940
- __name(cjsPlugin, "cjsPlugin");
1941
- function fixCJSExportTypePlugin() {
1942
- return {
1943
- name: "unbuild-fix-cjs-export-type",
1944
- renderChunk(code, info, opts) {
1945
- if (info.type !== "chunk" || !info.fileName.endsWith(".d.cts") || !info.isEntry || info.exports?.length !== 1 || info.exports[0] !== "default") {
1946
- return;
1947
- }
1948
- return code.replace(
1949
- /(?<=(?<=[;}]|^)\s*export\s*){\s*([\w$]+)\s*as\s+default\s*}/,
1950
- `= $1`
1951
- );
1952
- }
1953
- };
1954
- }
1955
- __name(fixCJSExportTypePlugin, "fixCJSExportTypePlugin");
1956
- var CJSyntaxRe = /__filename|__dirname|require\(|require\.resolve\(/;
1957
- var CJSShim = `
1958
-
1959
- // -- Unbuild CommonJS Shims --
1960
- import __cjs_url__ from 'url';
1961
- import __cjs_path__ from 'path';
1962
- import __cjs_mod__ from 'module';
1963
- const __filename = __cjs_url__.fileURLToPath(import.meta.url);
1964
- const __dirname = __cjs_path__.dirname(__filename);
1965
- const require = __cjs_mod__.createRequire(import.meta.url);
1966
- `;
1967
- function CJSToESM(code) {
1968
- if (code.includes(CJSShim) || !CJSyntaxRe.test(code)) {
1969
- return null;
1970
- }
1971
- const lastESMImport = (0, import_mlly.findStaticImports)(code).pop();
1972
- const indexToAppend = lastESMImport ? lastESMImport.end : 0;
1973
- const s = new import_magic_string.default(code);
1974
- s.appendRight(indexToAppend, CJSShim);
1975
- return {
1976
- code: s.toString(),
1977
- map: s.generateMap()
1978
- };
1979
- }
1980
- __name(CJSToESM, "CJSToESM");
1981
- var DEFAULT_EXTENSIONS = [
1982
- ".ts",
1983
- ".tsx",
1984
- ".mts",
1985
- ".cts",
1986
- ".mjs",
1987
- ".cjs",
1988
- ".js",
1989
- ".jsx",
1990
- ".json"
1991
- ];
1992
- function resolveAliases(ctx) {
1993
- const aliases = {
1994
- [ctx.pkg.name]: ctx.options.rootDir,
1995
- ...ctx.options.alias
1996
- };
1997
- if (ctx.options.rollup.alias) {
1998
- if (Array.isArray(ctx.options.rollup.alias.entries)) {
1999
- Object.assign(
2000
- aliases,
2001
- Object.fromEntries(
2002
- ctx.options.rollup.alias.entries.map((entry) => {
2003
- return [entry.find, entry.replacement];
2004
- })
2005
- )
2006
- );
2007
- } else {
2008
- Object.assign(
2009
- aliases,
2010
- ctx.options.rollup.alias.entries || ctx.options.rollup.alias
2011
- );
2012
- }
2013
- }
2014
- return aliases;
2015
- }
2016
- __name(resolveAliases, "resolveAliases");
2017
- function getChunkFilename(ctx, chunk, ext) {
2018
- if (chunk.isDynamicEntry) {
2019
- return `chunks/[name].${ext}`;
2020
- }
2021
- return `shared/${ctx.options.name}.[hash].${ext}`;
2022
- }
2023
- __name(getChunkFilename, "getChunkFilename");
2024
- function getRollupOptions(ctx) {
2025
- const _aliases = resolveAliases(ctx);
2026
- return {
2027
- input: Object.fromEntries(
2028
- ctx.options.entries.filter((entry) => entry.builder === "rollup").map((entry) => [
2029
- entry.name,
2030
- (0, import_pathe.resolve)(ctx.options.rootDir, entry.input)
2031
- ])
2032
- ),
2033
- output: [
2034
- ctx.options.rollup.emitCJS && {
2035
- dir: (0, import_pathe.resolve)(ctx.options.rootDir, ctx.options.outDir),
2036
- entryFileNames: "[name].cjs",
2037
- chunkFileNames: /* @__PURE__ */ __name((chunk) => getChunkFilename(ctx, chunk, "cjs"), "chunkFileNames"),
2038
- format: "cjs",
2039
- exports: "auto",
2040
- interop: "compat",
2041
- generatedCode: { constBindings: true },
2042
- externalLiveBindings: false,
2043
- freeze: false,
2044
- sourcemap: ctx.options.sourcemap,
2045
- ...ctx.options.rollup.output
2046
- },
2047
- {
2048
- dir: (0, import_pathe.resolve)(ctx.options.rootDir, ctx.options.outDir),
2049
- entryFileNames: "[name].mjs",
2050
- chunkFileNames: /* @__PURE__ */ __name((chunk) => getChunkFilename(ctx, chunk, "mjs"), "chunkFileNames"),
2051
- format: "esm",
2052
- exports: "auto",
2053
- generatedCode: { constBindings: true },
2054
- externalLiveBindings: false,
2055
- freeze: false,
2056
- sourcemap: ctx.options.sourcemap,
2057
- ...ctx.options.rollup.output
2058
- }
2059
- ].filter(Boolean),
2060
- external(originalId) {
2061
- const resolvedId = (0, import_utils2.resolveAlias)(originalId, _aliases);
2062
- const pkgName = (0, import_mlly.parseNodeModulePath)(resolvedId)?.name || (0, import_mlly.parseNodeModulePath)(originalId)?.name || getpkg(originalId);
2063
- if (arrayIncludes(ctx.options.externals, pkgName) || arrayIncludes(ctx.options.externals, originalId) || arrayIncludes(ctx.options.externals, resolvedId)) {
2064
- return true;
2065
- }
2066
- for (const id of [originalId, resolvedId]) {
2067
- if (id[0] === "." || (0, import_pathe.isAbsolute)(id) || /src[/\\]/.test(id) || id.startsWith(ctx.pkg.name)) {
2068
- return false;
2069
- }
2070
- }
2071
- if (ctx.options.rollup.inlineDependencies === true || Array.isArray(ctx.options.rollup.inlineDependencies) && (arrayIncludes(ctx.options.rollup.inlineDependencies, pkgName) || arrayIncludes(ctx.options.rollup.inlineDependencies, originalId) || arrayIncludes(ctx.options.rollup.inlineDependencies, resolvedId))) {
2072
- return false;
2073
- }
2074
- warn(ctx, `Implicitly bundling "${originalId}"`);
2075
- return false;
2076
- },
2077
- onwarn(warning, rollupWarn) {
2078
- if (!warning.code || !["CIRCULAR_DEPENDENCY"].includes(warning.code)) {
2079
- rollupWarn(warning);
2080
- }
2081
- },
2082
- plugins: [
2083
- ctx.options.rollup.replace && (0, import_plugin_replace.default)({
2084
- ...ctx.options.rollup.replace,
2085
- values: {
2086
- ...ctx.options.replace,
2087
- ...ctx.options.rollup.replace.values
2088
- }
2089
- }),
2090
- ctx.options.rollup.alias && (0, import_plugin_alias.default)({
2091
- ...ctx.options.rollup.alias,
2092
- entries: _aliases
2093
- }),
2094
- ctx.options.rollup.resolve && (0, import_plugin_node_resolve.nodeResolve)({
2095
- extensions: DEFAULT_EXTENSIONS,
2096
- exportConditions: ["production"],
2097
- ...ctx.options.rollup.resolve
2098
- }),
2099
- ctx.options.rollup.json && JSONPlugin({
2100
- ...ctx.options.rollup.json
2101
- }),
2102
- shebangPlugin(),
2103
- ctx.options.rollup.esbuild && esbuild({
2104
- sourcemap: ctx.options.sourcemap,
2105
- ...ctx.options.rollup.esbuild
2106
- }),
2107
- ctx.options.rollup.commonjs && (0, import_plugin_commonjs.default)({
2108
- extensions: DEFAULT_EXTENSIONS,
2109
- ...ctx.options.rollup.commonjs
2110
- }),
2111
- ctx.options.rollup.preserveDynamicImports && {
2112
- renderDynamicImport() {
2113
- return { left: "import(", right: ")" };
2114
- }
2115
- },
2116
- ctx.options.rollup.cjsBridge && cjsPlugin(),
2117
- rawPlugin()
2118
- ].filter(Boolean)
2119
- };
2120
- }
2121
- __name(getRollupOptions, "getRollupOptions");
2122
- async function rollupStub(ctx) {
2123
- const babelPlugins = ctx.options.stubOptions.jiti.transformOptions?.babel?.plugins;
2124
- const importedBabelPlugins = [];
2125
- const serializedJitiOptions = JSON.stringify(
2126
- {
2127
- ...ctx.options.stubOptions.jiti,
2128
- alias: {
2129
- ...resolveAliases(ctx),
2130
- ...ctx.options.stubOptions.jiti.alias
2131
- },
2132
- transformOptions: {
2133
- ...ctx.options.stubOptions.jiti.transformOptions,
2134
- babel: {
2135
- ...ctx.options.stubOptions.jiti.transformOptions?.babel,
2136
- plugins: "__$BABEL_PLUGINS"
2137
- }
2138
- }
2139
- },
2140
- null,
2141
- 2
2142
- ).replace(
2143
- '"__$BABEL_PLUGINS"',
2144
- Array.isArray(babelPlugins) ? "[" + babelPlugins.map((plugin, i) => {
2145
- if (Array.isArray(plugin)) {
2146
- const [name, ...args] = plugin;
2147
- importedBabelPlugins.push(name);
2148
- return `[` + [
2149
- `plugin${i}`,
2150
- ...args.map((val) => JSON.stringify(val))
2151
- ].join(", ") + "]";
2152
- } else {
2153
- importedBabelPlugins.push(plugin);
2154
- return `plugin${i}`;
2155
- }
2156
- }).join(",") + "]" : "[]"
2157
- );
2158
- for (const entry of ctx.options.entries.filter(
2159
- (entry2) => entry2.builder === "rollup"
2160
- )) {
2161
- const output = (0, import_pathe.resolve)(
2162
- ctx.options.rootDir,
2163
- ctx.options.outDir,
2164
- entry.name
2165
- );
2166
- const isESM = ctx.pkg.type === "module";
2167
- const resolvedEntry = (0, import_mlly.fileURLToPath)(ctx.jiti.esmResolve(entry.input));
2168
- const resolvedEntryWithoutExt = resolvedEntry.slice(
2169
- 0,
2170
- Math.max(0, resolvedEntry.length - (0, import_pathe.extname)(resolvedEntry).length)
2171
- );
2172
- const resolvedEntryForTypeImport = isESM ? `${resolvedEntry.replace(/(\.m?)(ts)$/, "$1js")}` : resolvedEntryWithoutExt;
2173
- const code = await import_node_fs6.promises.readFile(resolvedEntry, "utf8");
2174
- const shebang = getShebang(code);
2175
- await (0, import_promises4.mkdir)((0, import_pathe.dirname)(output), { recursive: true });
2176
- if (ctx.options.rollup.emitCJS) {
2177
- const jitiCJSPath = (0, import_pathe.relative)(
2178
- (0, import_pathe.dirname)(output),
2179
- await (0, import_mlly.resolvePath)("jiti", {
2180
- url: importMetaUrl,
2181
- conditions: ["node", "require"]
2182
- })
2183
- );
2184
- await (0, import_promises4.writeFile)(
2185
- output + ".cjs",
2186
- shebang + [
2187
- `const { createJiti } = require(${JSON.stringify(jitiCJSPath)})`,
2188
- ...importedBabelPlugins.map(
2189
- (plugin, i) => `const plugin${i} = require(${JSON.stringify(plugin)})`
2190
- ),
2191
- "",
2192
- `const jiti = createJiti(__filename, ${serializedJitiOptions})`,
2193
- "",
2194
- `/** @type {import(${JSON.stringify(
2195
- resolvedEntryForTypeImport
2196
- )})} */`,
2197
- `module.exports = jiti(${JSON.stringify(resolvedEntry)})`
2198
- ].join("\n")
2199
- );
2200
- }
2201
- const namedExports = await (0, import_mlly.resolveModuleExportNames)(
2202
- resolvedEntry,
2203
- {
2204
- extensions: DEFAULT_EXTENSIONS
2205
- }
2206
- ).catch((error) => {
2207
- warn(ctx, `Cannot analyze ${resolvedEntry} for exports:` + error);
2208
- return [];
2209
- });
2210
- const hasDefaultExport = namedExports.includes("default") || namedExports.length === 0;
2211
- const jitiESMPath = (0, import_pathe.relative)(
2212
- (0, import_pathe.dirname)(output),
2213
- await (0, import_mlly.resolvePath)("jiti", {
2214
- url: importMetaUrl,
2215
- conditions: ["node", "import"]
2216
- })
2217
- );
2218
- await (0, import_promises4.writeFile)(
2219
- output + ".mjs",
2220
- shebang + [
2221
- `import { createJiti } from ${JSON.stringify(jitiESMPath)};`,
2222
- ...importedBabelPlugins.map(
2223
- (plugin, i) => `import plugin${i} from ${JSON.stringify(plugin)}`
2224
- ),
2225
- "",
2226
- `const jiti = createJiti(import.meta.url, ${serializedJitiOptions})`,
2227
- "",
2228
- `/** @type {import(${JSON.stringify(resolvedEntryForTypeImport)})} */`,
2229
- `const _module = await jiti.import(${JSON.stringify(
2230
- resolvedEntry
2231
- )});`,
2232
- hasDefaultExport ? "\nexport default _module?.default ?? _module;" : "",
2233
- ...namedExports.filter((name) => name !== "default").map((name) => `export const ${name} = _module.${name};`)
2234
- ].join("\n")
2235
- );
2236
- if (ctx.options.declaration) {
2237
- const dtsContent = [
2238
- `export * from ${JSON.stringify(resolvedEntryForTypeImport)};`,
2239
- hasDefaultExport ? `export { default } from ${JSON.stringify(resolvedEntryForTypeImport)};` : ""
2240
- ].join("\n");
2241
- await (0, import_promises4.writeFile)(output + ".d.cts", dtsContent);
2242
- await (0, import_promises4.writeFile)(output + ".d.mts", dtsContent);
2243
- if (ctx.options.declaration === "compatible" || ctx.options.declaration === true) {
2244
- await (0, import_promises4.writeFile)(output + ".d.ts", dtsContent);
2245
- }
2246
- }
2247
- if (shebang) {
2248
- await makeExecutable(output + ".cjs");
2249
- await makeExecutable(output + ".mjs");
2250
- }
2251
- }
2252
- }
2253
- __name(rollupStub, "rollupStub");
2254
- function rollupWatch(rollupOptions) {
2255
- const watcher = (0, import_rollup.watch)(rollupOptions);
2256
- let inputs;
2257
- if (Array.isArray(rollupOptions.input)) {
2258
- inputs = rollupOptions.input;
2259
- } else if (typeof rollupOptions.input === "string") {
2260
- inputs = [rollupOptions.input];
2261
- } else {
2262
- inputs = Object.keys(rollupOptions.input || {});
2263
- }
2264
- import_consola.default.info(
2265
- `[unbuild] [rollup] Starting watchers for entries: ${inputs.map((input) => "./" + (0, import_pathe.relative)(process.cwd(), input)).join(", ")}`
2266
- );
2267
- import_consola.default.warn(
2268
- "[unbuild] [rollup] Watch mode is experimental and may be unstable"
2269
- );
2270
- watcher.on("change", (id, { event }) => {
2271
- import_consola.default.info(`${import_utils.colors.cyan((0, import_pathe.relative)(".", id))} was ${event}d`);
2272
- });
2273
- watcher.on("restart", () => {
2274
- import_consola.default.info(import_utils.colors.gray("[unbuild] [rollup] Rebuilding bundle"));
2275
- });
2276
- watcher.on("event", (event) => {
2277
- if (event.code === "END") {
2278
- import_consola.default.success(import_utils.colors.green("[unbuild] [rollup] Rebuild finished\n"));
2279
- }
2280
- });
2281
- }
2282
- __name(rollupWatch, "rollupWatch");
2283
- async function rollupBuild(ctx) {
2284
- if (ctx.options.stub) {
2285
- await rollupStub(ctx);
2286
- await ctx.hooks.callHook("rollup:done", ctx);
2287
- return;
2288
- }
2289
- const rollupOptions = getRollupOptions(ctx);
2290
- await ctx.hooks.callHook("rollup:options", ctx, rollupOptions);
2291
- if (Object.keys(rollupOptions.input).length === 0) {
2292
- await ctx.hooks.callHook("rollup:done", ctx);
2293
- return;
2294
- }
2295
- const buildResult = await (0, import_rollup.rollup)(rollupOptions);
2296
- await ctx.hooks.callHook("rollup:build", ctx, buildResult);
2297
- const allOutputOptions = rollupOptions.output;
2298
- for (const outputOptions of allOutputOptions) {
2299
- const { output } = await buildResult.write(outputOptions);
2300
- const chunkFileNames = /* @__PURE__ */ new Set();
2301
- const outputChunks = output.filter(
2302
- (e) => e.type === "chunk"
2303
- );
2304
- for (const entry of outputChunks) {
2305
- chunkFileNames.add(entry.fileName);
2306
- for (const id of entry.imports) {
2307
- ctx.usedImports.add(id);
2308
- }
2309
- if (entry.isEntry) {
2310
- ctx.buildEntries.push({
2311
- chunks: entry.imports.filter(
2312
- (i) => outputChunks.find((c) => c.fileName === i)
2313
- ),
2314
- modules: Object.entries(entry.modules).map(([id, mod]) => ({
2315
- id,
2316
- bytes: mod.renderedLength
2317
- })),
2318
- path: entry.fileName,
2319
- bytes: Buffer.byteLength(entry.code, "utf8"),
2320
- exports: entry.exports
2321
- });
2322
- }
2323
- }
2324
- for (const chunkFileName of chunkFileNames) {
2325
- ctx.usedImports.delete(chunkFileName);
2326
- }
2327
- }
2328
- if (ctx.options.watch) {
2329
- rollupWatch(rollupOptions);
2330
- if (ctx.options.declaration && ctx.options.watch) {
2331
- import_consola.default.warn("`rollup` DTS builder does not support watch mode yet.");
2332
- }
2333
- return;
2334
- }
2335
- if (ctx.options.declaration) {
2336
- rollupOptions.plugins = [
2337
- ...rollupOptions.plugins,
2338
- (0, import_rollup_plugin_dts.default)(ctx.options.rollup.dts),
2339
- removeShebangPlugin(),
2340
- ctx.options.rollup.emitCJS && fixCJSExportTypePlugin()
2341
- ].filter(Boolean);
2342
- await ctx.hooks.callHook("rollup:dts:options", ctx, rollupOptions);
2343
- const typesBuild2 = await (0, import_rollup.rollup)(rollupOptions);
2344
- await ctx.hooks.callHook("rollup:dts:build", ctx, typesBuild2);
2345
- if (ctx.options.rollup.emitCJS) {
2346
- await typesBuild2.write({
2347
- dir: (0, import_pathe.resolve)(ctx.options.rootDir, ctx.options.outDir),
2348
- entryFileNames: "[name].d.cts",
2349
- chunkFileNames: /* @__PURE__ */ __name((chunk) => getChunkFilename(ctx, chunk, "d.cts"), "chunkFileNames")
2350
- });
2351
- }
2352
- await typesBuild2.write({
2353
- dir: (0, import_pathe.resolve)(ctx.options.rootDir, ctx.options.outDir),
2354
- entryFileNames: "[name].d.mts",
2355
- chunkFileNames: /* @__PURE__ */ __name((chunk) => getChunkFilename(ctx, chunk, "d.mts"), "chunkFileNames")
2356
- });
2357
- if (ctx.options.declaration === true || ctx.options.declaration === "compatible") {
2358
- await typesBuild2.write({
2359
- dir: (0, import_pathe.resolve)(ctx.options.rootDir, ctx.options.outDir),
2360
- entryFileNames: "[name].d.ts",
2361
- chunkFileNames: /* @__PURE__ */ __name((chunk) => getChunkFilename(ctx, chunk, "d.ts"), "chunkFileNames")
2362
- });
2363
- }
2364
- }
2365
- await ctx.hooks.callHook("rollup:done", ctx);
2366
- }
2367
- __name(rollupBuild, "rollupBuild");
2368
- async function typesBuild(ctx) {
2369
- const entries = ctx.options.entries.filter(
2370
- (entry) => entry.builder === "untyped"
2371
- );
2372
- await ctx.hooks.callHook("untyped:entries", ctx, entries);
2373
- for (const entry of entries) {
2374
- const options = {
2375
- jiti: {
2376
- interopDefault: true,
2377
- transformOptions: {
2378
- babel: {
2379
- plugins: [import_babel_plugin.default]
2380
- }
2381
- }
2382
- }
2383
- };
2384
- await ctx.hooks.callHook("untyped:entry:options", ctx, entry, options);
2385
- const untypedJiti = (0, import_jiti.createJiti)(ctx.options.rootDir, options.jiti);
2386
- const distDir = entry.outDir;
2387
- let rawSchema = await untypedJiti.import((0, import_pathe.resolve)(ctx.options.rootDir, entry.input), {
2388
- try: true
2389
- }) || {};
2390
- const rawSchemaKeys = Object.keys(rawSchema);
2391
- if (rawSchemaKeys.length === 1 && rawSchemaKeys[0] === "default") {
2392
- rawSchema = rawSchema.default;
2393
- }
2394
- const defaults2 = entry.defaults || {};
2395
- const schema = await (0, import_untyped.resolveSchema)(rawSchema, defaults2);
2396
- await ctx.hooks.callHook("untyped:entry:schema", ctx, entry, schema);
2397
- const outputs = {
2398
- markdown: {
2399
- fileName: (0, import_pathe.resolve)(distDir, `${entry.name}.md`),
2400
- contents: (0, import_untyped.generateMarkdown)(schema)
2401
- },
2402
- schema: {
2403
- fileName: `${entry.name}.schema.json`,
2404
- contents: JSON.stringify(schema, null, 2)
2405
- },
2406
- defaults: {
2407
- fileName: `${entry.name}.defaults.json`,
2408
- contents: JSON.stringify(defaults2, null, 2)
2409
- },
2410
- declaration: entry.declaration ? {
2411
- fileName: `${entry.name}.d.ts`,
2412
- contents: (0, import_untyped.generateTypes)(schema, {
2413
- interfaceName: (0, import_scule.pascalCase)(entry.name + "-schema")
2414
- })
2415
- } : void 0
2416
- };
2417
- await ctx.hooks.callHook("untyped:entry:outputs", ctx, entry, outputs);
2418
- for (const output of Object.values(outputs)) {
2419
- if (!output) continue;
2420
- await (0, import_promises4.writeFile)(
2421
- (0, import_pathe.resolve)(distDir, output.fileName),
2422
- output.contents,
2423
- "utf8"
2424
- );
2425
- }
2426
- }
2427
- await ctx.hooks.callHook("untyped:done", ctx);
2428
- if (entries.length > 0 && ctx.options.watch) {
2429
- import_consola.default.warn("`untyped` builder does not support watch mode yet.");
2430
- }
2431
- }
2432
- __name(typesBuild, "typesBuild");
2433
- async function mkdistBuild(ctx) {
2434
- const entries = ctx.options.entries.filter(
2435
- (e) => e.builder === "mkdist"
2436
- );
2437
- await ctx.hooks.callHook("mkdist:entries", ctx, entries);
2438
- for (const entry of entries) {
2439
- const distDir = entry.outDir;
2440
- if (ctx.options.stub) {
2441
- await rmdir(distDir);
2442
- await symlink(entry.input, distDir);
2443
- } else {
2444
- const mkdistOptions = {
2445
- rootDir: ctx.options.rootDir,
2446
- srcDir: entry.input,
2447
- distDir,
2448
- cleanDist: false,
2449
- ...entry
2450
- };
2451
- await ctx.hooks.callHook(
2452
- "mkdist:entry:options",
2453
- ctx,
2454
- entry,
2455
- mkdistOptions
2456
- );
2457
- const output = await (0, import_mkdist.mkdist)(mkdistOptions);
2458
- ctx.buildEntries.push({
2459
- path: distDir,
2460
- chunks: output.writtenFiles.map((p) => (0, import_pathe.relative)(ctx.options.outDir, p))
2461
- });
2462
- await ctx.hooks.callHook("mkdist:entry:build", ctx, entry, output);
2463
- if (output.errors) {
2464
- for (const error of output.errors) {
2465
- warn(
2466
- ctx,
2467
- `mkdist build failed for \`${(0, import_pathe.relative)(ctx.options.rootDir, error.filename)}\`:
2468
- ${error.errors.map((e) => ` - ${e}`).join("\n")}`
2469
- );
2470
- }
2471
- }
2472
- }
2473
- }
2474
- await ctx.hooks.callHook("mkdist:done", ctx);
2475
- if (entries.length > 0 && ctx.options.watch) {
2476
- import_consola.default.warn("`mkdist` builder does not support watch mode yet.");
2477
- }
2478
- }
2479
- __name(mkdistBuild, "mkdistBuild");
2480
- var copy = import_node_fs6.promises.cp || import_node_fs6.promises.copyFile;
2481
- async function copyBuild(ctx) {
2482
- const entries = ctx.options.entries.filter(
2483
- (e) => e.builder === "copy"
2484
- );
2485
- await ctx.hooks.callHook("copy:entries", ctx, entries);
2486
- for (const entry of entries) {
2487
- const distDir = entry.outDir;
2488
- if (ctx.options.stub) {
2489
- await rmdir(distDir);
2490
- await symlink(entry.input, distDir);
2491
- } else {
2492
- const patterns = Array.isArray(entry.pattern) ? entry.pattern : [entry.pattern || "**"];
2493
- const paths = await (0, import_tinyglobby.glob)(patterns, {
2494
- cwd: (0, import_pathe.resolve)(ctx.options.rootDir, entry.input),
2495
- absolute: false
2496
- });
2497
- const outputList = await Promise.allSettled(
2498
- paths.map(async (path3) => {
2499
- const src = (0, import_pathe.resolve)(ctx.options.rootDir, entry.input, path3);
2500
- const dist = (0, import_pathe.resolve)(ctx.options.rootDir, distDir, path3);
2501
- await copy(src, dist);
2502
- return dist;
2503
- })
2504
- );
2505
- for (const output of outputList) {
2506
- if (output.status === "rejected") {
2507
- warn(ctx, output.reason);
2508
- }
2509
- }
2510
- ctx.buildEntries.push({
2511
- path: distDir,
2512
- chunks: outputList.filter(({ status }) => status === "fulfilled").map(
2513
- (p) => (0, import_pathe.relative)(
2514
- ctx.options.outDir,
2515
- p.value
2516
- )
2517
- )
2518
- });
2519
- }
2520
- }
2521
- await ctx.hooks.callHook("copy:done", ctx);
2522
- if (entries.length > 0 && ctx.options.watch) {
2523
- import_consola.default.warn("`untyped` builder does not support watch mode yet.");
2524
- }
2525
- }
2526
- __name(copyBuild, "copyBuild");
2527
- async function build(rootDir, stub, inputConfig = {}) {
2528
- rootDir = (0, import_pathe.resolve)(process.cwd(), rootDir || ".");
2529
- const jiti = (0, import_jiti.createJiti)(rootDir);
2530
- const _buildConfig = await jiti.import(inputConfig?.config || "./build.config", {
2531
- try: !inputConfig.config,
2532
- default: true
2533
- }) || {};
2534
- const buildConfigs = (Array.isArray(_buildConfig) ? _buildConfig : [_buildConfig]).filter(Boolean);
2535
- const pkg = await jiti.import("./package.json", {
2536
- try: true,
2537
- default: true
2538
- }) || {};
2539
- const cleanedDirs = [];
2540
- const _watchMode = inputConfig.watch === true;
2541
- const _stubMode = !_watchMode && (stub || inputConfig.stub === true);
2542
- for (const buildConfig of buildConfigs) {
2543
- await _build(
2544
- rootDir,
2545
- inputConfig,
2546
- buildConfig,
2547
- pkg,
2548
- cleanedDirs,
2549
- _stubMode,
2550
- _watchMode
2551
- );
2552
- }
2553
- }
2554
- __name(build, "build");
2555
- async function _build(rootDir, inputConfig = {}, buildConfig, pkg, cleanedDirs, _stubMode, _watchMode) {
2556
- const preset = await resolvePreset(
2557
- buildConfig.preset || pkg.unbuild?.preset || pkg.build?.preset || inputConfig.preset || "auto",
2558
- rootDir
2559
- );
2560
- const options = (0, import_defu3.defu)(
2561
- buildConfig,
2562
- pkg.unbuild || pkg.build,
2563
- inputConfig,
2564
- preset,
2565
- {
2566
- name: (pkg?.name || "").split("/").pop() || "default",
2567
- rootDir,
2568
- entries: [],
2569
- clean: true,
2570
- declaration: void 0,
2571
- outDir: "dist",
2572
- stub: _stubMode,
2573
- stubOptions: {
2574
- /**
2575
- * See https://github.com/unjs/jiti#%EF%B8%8F-options
2576
- */
2577
- jiti: {
2578
- interopDefault: true,
2579
- alias: {}
2580
- }
2581
- },
2582
- watch: _watchMode,
2583
- watchOptions: _watchMode ? {
2584
- exclude: "node_modules/**",
2585
- include: "src/**"
2586
- } : void 0,
2587
- externals: [
2588
- ...import_node_module2.default.builtinModules,
2589
- ...import_node_module2.default.builtinModules.map((m) => "node:" + m)
2590
- ],
2591
- dependencies: [],
2592
- devDependencies: [],
2593
- peerDependencies: [],
2594
- alias: {},
2595
- replace: {},
2596
- failOnWarn: true,
2597
- sourcemap: false,
2598
- rollup: {
2599
- emitCJS: false,
2600
- watch: false,
2601
- cjsBridge: false,
2602
- inlineDependencies: false,
2603
- preserveDynamicImports: true,
2604
- output: {
2605
- // https://v8.dev/features/import-attributes
2606
- importAttributesKey: "with"
2607
- },
2608
- // Plugins
2609
- replace: {
2610
- preventAssignment: true
2611
- },
2612
- alias: {},
2613
- resolve: {
2614
- preferBuiltins: true
2615
- },
2616
- json: {
2617
- preferConst: true
2618
- },
2619
- commonjs: {
2620
- ignoreTryCatch: true
2621
- },
2622
- esbuild: { target: "esnext" },
2623
- dts: {
2624
- // https://github.com/Swatinem/rollup-plugin-dts/issues/143
2625
- compilerOptions: { preserveSymlinks: false },
2626
- respectExternal: true
2627
- }
2628
- },
2629
- parallel: false
2630
- }
2631
- );
2632
- options.outDir = (0, import_pathe.resolve)(options.rootDir, options.outDir);
2633
- const jiti = (0, import_jiti.createJiti)(options.rootDir, { interopDefault: true });
2634
- const ctx = {
2635
- options,
2636
- jiti,
2637
- warnings: /* @__PURE__ */ new Set(),
2638
- pkg,
2639
- buildEntries: [],
2640
- usedImports: /* @__PURE__ */ new Set(),
2641
- hooks: (0, import_hookable.createHooks)()
2642
- };
2643
- if (preset.hooks) {
2644
- ctx.hooks.addHooks(preset.hooks);
2645
- }
2646
- if (inputConfig.hooks) {
2647
- ctx.hooks.addHooks(inputConfig.hooks);
2648
- }
2649
- if (buildConfig.hooks) {
2650
- ctx.hooks.addHooks(buildConfig.hooks);
2651
- }
2652
- await ctx.hooks.callHook("build:prepare", ctx);
2653
- options.entries = options.entries.map(
2654
- (entry) => typeof entry === "string" ? { input: entry } : entry
2655
- );
2656
- for (const entry of options.entries) {
2657
- if (typeof entry.name !== "string") {
2658
- let relativeInput = (0, import_pathe.isAbsolute)(entry.input) ? (0, import_pathe.relative)(rootDir, entry.input) : (0, import_pathe.normalize)(entry.input);
2659
- if (relativeInput.startsWith("./")) {
2660
- relativeInput = relativeInput.slice(2);
2661
- }
2662
- entry.name = removeExtension(relativeInput.replace(/^src\//, ""));
2663
- }
2664
- if (!entry.input) {
2665
- throw new Error("Missing entry input: " + dumpObject(entry));
2666
- }
2667
- if (!entry.builder) {
2668
- entry.builder = entry.input.endsWith("/") ? "mkdist" : "rollup";
2669
- }
2670
- if (options.declaration !== void 0 && entry.declaration === void 0) {
2671
- entry.declaration = options.declaration;
2672
- }
2673
- entry.input = (0, import_pathe.resolve)(options.rootDir, entry.input);
2674
- entry.outDir = (0, import_pathe.resolve)(options.rootDir, entry.outDir || options.outDir);
2675
- }
2676
- options.dependencies = Object.keys(pkg.dependencies || {});
2677
- options.peerDependencies = Object.keys(pkg.peerDependencies || {});
2678
- options.devDependencies = Object.keys(pkg.devDependencies || {});
2679
- options.externals.push(...inferPkgExternals(pkg));
2680
- options.externals = [...new Set(options.externals)];
2681
- await ctx.hooks.callHook("build:before", ctx);
2682
- import_consola.consola.info(
2683
- import_utils.colors.cyan(`${options.stub ? "Stubbing" : "Building"} ${options.name}`)
2684
- );
2685
- if (process.env.DEBUG) {
2686
- import_consola.consola.info(`${import_utils.colors.bold("Root dir:")} ${options.rootDir}
2687
- ${import_utils.colors.bold("Entries:")}
2688
- ${options.entries.map((entry) => " " + dumpObject(entry)).join("\n ")}
2689
- `);
2690
- }
2691
- if (options.clean) {
2692
- for (const dir of new Set(
2693
- options.entries.map((e) => e.outDir).filter(Boolean).sort()
2694
- )) {
2695
- if (dir === options.rootDir || options.rootDir.startsWith(withTrailingSlash(dir)) || cleanedDirs.some((c) => dir.startsWith(c))) {
2696
- continue;
2697
- }
2698
- cleanedDirs.push(dir);
2699
- import_consola.consola.info(
2700
- `Cleaning dist directory: \`./${(0, import_pathe.relative)(process.cwd(), dir)}\``
2701
- );
2702
- await rmdir(dir);
2703
- await import_node_fs6.promises.mkdir(dir, { recursive: true });
2704
- }
2705
- }
2706
- const buildTasks = [
2707
- typesBuild,
2708
- // untyped
2709
- mkdistBuild,
2710
- // mkdist
2711
- rollupBuild,
2712
- // rollup
2713
- copyBuild
2714
- // copy
2715
- ];
2716
- if (options.parallel) {
2717
- await Promise.all(buildTasks.map((task) => task(ctx)));
2718
- } else {
2719
- for (const task of buildTasks) {
2720
- await task(ctx);
2721
- }
2722
- }
2723
- if (options.stub || options.watch) {
2724
- await ctx.hooks.callHook("build:done", ctx);
2725
- return;
2726
- }
2727
- import_consola.consola.success(import_utils.colors.green("Build succeeded for " + options.name));
2728
- const outFiles = await (0, import_tinyglobby.glob)(["**"], { cwd: options.outDir });
2729
- for (const file of outFiles) {
2730
- let entry = ctx.buildEntries.find((e) => e.path === file);
2731
- if (!entry) {
2732
- entry = {
2733
- path: file,
2734
- chunk: true
2735
- };
2736
- ctx.buildEntries.push(entry);
2737
- }
2738
- if (!entry.bytes) {
2739
- const stat = await import_node_fs6.promises.stat((0, import_pathe.resolve)(options.outDir, file));
2740
- entry.bytes = stat.size;
2741
- }
2742
- }
2743
- const rPath = /* @__PURE__ */ __name((p) => (0, import_pathe.relative)(process.cwd(), (0, import_pathe.resolve)(options.outDir, p)), "rPath");
2744
- for (const entry of ctx.buildEntries.filter((e) => !e.chunk)) {
2745
- let totalBytes = entry.bytes || 0;
2746
- for (const chunk of entry.chunks || []) {
2747
- totalBytes += ctx.buildEntries.find((e) => e.path === chunk)?.bytes || 0;
2748
- }
2749
- let line = ` ${import_utils.colors.bold(rPath(entry.path))} (` + [
2750
- totalBytes && `total size: ${import_utils.colors.cyan((0, import_pretty_bytes.default)(totalBytes))}`,
2751
- entry.bytes && `chunk size: ${import_utils.colors.cyan((0, import_pretty_bytes.default)(entry.bytes))}`,
2752
- entry.exports?.length && `exports: ${import_utils.colors.gray(entry.exports.join(", "))}`
2753
- ].filter(Boolean).join(", ") + ")";
2754
- if (entry.chunks?.length) {
2755
- line += "\n" + entry.chunks.map((p) => {
2756
- const chunk = ctx.buildEntries.find((e) => e.path === p) || {};
2757
- return import_utils.colors.gray(
2758
- " \u2514\u2500 " + rPath(p) + import_utils.colors.bold(
2759
- chunk.bytes ? ` (${(0, import_pretty_bytes.default)(chunk?.bytes)})` : ""
2760
- )
2761
- );
2762
- }).join("\n");
2763
- }
2764
- if (entry.modules?.length) {
2765
- line += "\n" + entry.modules.filter((m) => m.id.includes("node_modules")).sort((a, b) => (b.bytes || 0) - (a.bytes || 0)).map((m) => {
2766
- return import_utils.colors.gray(
2767
- " \u{1F4E6} " + rPath(m.id) + import_utils.colors.bold(m.bytes ? ` (${(0, import_pretty_bytes.default)(m.bytes)})` : "")
2768
- );
2769
- }).join("\n");
2770
- }
2771
- import_consola.consola.log(entry.chunk ? import_utils.colors.gray(line) : line);
2772
- }
2773
- console.log(
2774
- "\u03A3 Total dist size (byte size):",
2775
- import_utils.colors.cyan(
2776
- (0, import_pretty_bytes.default)(ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0))
2777
- )
2778
- );
2779
- validateDependencies(ctx);
2780
- validatePackage(pkg, rootDir, ctx);
2781
- await ctx.hooks.callHook("build:done", ctx);
2782
- import_consola.consola.log("");
2783
- if (ctx.warnings.size > 0) {
2784
- import_consola.consola.warn(
2785
- "Build is done with some warnings:\n\n" + [...ctx.warnings].map((msg) => "- " + msg).join("\n")
2786
- );
2787
- if (ctx.options.failOnWarn) {
2788
- import_consola.consola.error(
2789
- "Exiting with code (1). You can change this behavior by setting `failOnWarn: false` ."
2790
- );
2791
- process.exit(1);
2792
- }
2793
- }
2794
- }
2795
- __name(_build, "_build");
2796
-
2797
- // ../../node_modules/.pnpm/unbuild@3.3.1_sass@1.83.4_typescript@5.7.3/node_modules/unbuild/dist/index.mjs
2798
- var import_node_module3 = require("module");
2799
- var import_node_fs7 = require("fs");
2800
- var import_pathe2 = require("pathe");
2801
- var import_utils3 = require("consola/utils");
2802
- var import_consola2 = require("consola");
2803
- var import_defu4 = require("defu");
2804
- var import_hookable2 = require("hookable");
2805
- var import_pretty_bytes2 = require("pretty-bytes");
2806
- var import_tinyglobby2 = require("tinyglobby");
1387
+ var import_node_fs6 = require("fs");
2807
1388
  var import_promises5 = require("fs/promises");
2808
- var import_jiti2 = require("jiti");
2809
- var import_rollup2 = require("rollup");
2810
- var import_rollup_plugin_dts2 = require("rollup-plugin-dts");
2811
- var import_plugin_commonjs2 = require("@rollup/plugin-commonjs");
2812
- var import_plugin_node_resolve2 = require("@rollup/plugin-node-resolve");
2813
- var import_plugin_alias2 = require("@rollup/plugin-alias");
2814
- var import_plugin_replace2 = require("@rollup/plugin-replace");
2815
- var import_utils4 = require("pathe/utils");
2816
- var import_mlly2 = require("mlly");
2817
- var import_esbuild2 = require("esbuild");
2818
- var import_pluginutils2 = require("@rollup/pluginutils");
2819
- var import_plugin_json2 = require("@rollup/plugin-json");
2820
- var import_magic_string2 = require("magic-string");
2821
- var import_untyped2 = require("untyped");
2822
- var import_babel_plugin2 = require("untyped/babel-plugin");
2823
- var import_scule2 = require("scule");
2824
- var import_mkdist2 = require("mkdist");
1389
+ var import_node_path6 = require("path");
1390
+ var import_find_workspace_root5 = require("nx/src/utils/find-workspace-root");
2825
1391
 
2826
1392
  // src/clean.ts
2827
- var import_promises6 = require("fs/promises");
1393
+ var import_promises4 = require("fs/promises");
2828
1394
  async function clean(name = "Unbuild", directory, config) {
2829
1395
  writeDebug(` \u{1F9F9} Cleaning ${name} output path: ${directory}`, config);
2830
1396
  const stopwatch = getStopwatch(`${name} output clean`);
2831
- await (0, import_promises6.rm)(directory, {
1397
+ await (0, import_promises4.rm)(directory, {
2832
1398
  recursive: true,
2833
1399
  force: true
2834
1400
  });
@@ -2890,7 +1456,7 @@ var import_compiler_helper_dependency = require("@nx/js/src/utils/compiler-helpe
2890
1456
  // ../../node_modules/.pnpm/rollup-plugin-typescript2@0.36.0_rollup@4.29.1_typescript@5.7.3/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.es.js
2891
1457
  var require$$0 = __toESM(require("path"));
2892
1458
  var import_path2 = __toESM(require("path"));
2893
- var import_pluginutils3 = require("@rollup/pluginutils");
1459
+ var import_pluginutils = require("@rollup/pluginutils");
2894
1460
  var import_util = __toESM(require("util"));
2895
1461
  var import_os = __toESM(require("os"));
2896
1462
  var import_semver = __toESM(require("semver"));
@@ -2900,12 +1466,12 @@ var import_fs_extra = require("fs-extra");
2900
1466
  var import_crypto = __toESM(require("crypto"));
2901
1467
  function __awaiter(thisArg, _arguments, P, generator) {
2902
1468
  function adopt(value) {
2903
- return value instanceof P ? value : new P(function(resolve3) {
2904
- resolve3(value);
1469
+ return value instanceof P ? value : new P(function(resolve2) {
1470
+ resolve2(value);
2905
1471
  });
2906
1472
  }
2907
1473
  __name(adopt, "adopt");
2908
- return new (P || (P = Promise))(function(resolve3, reject) {
1474
+ return new (P || (P = Promise))(function(resolve2, reject) {
2909
1475
  function fulfilled(value) {
2910
1476
  try {
2911
1477
  step(generator.next(value));
@@ -2923,7 +1489,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
2923
1489
  }
2924
1490
  __name(rejected, "rejected");
2925
1491
  function step(result) {
2926
- result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
1492
+ result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
2927
1493
  }
2928
1494
  __name(step, "step");
2929
1495
  step((generator = generator.apply(thisArg, _arguments || [])).next());
@@ -2934,7 +1500,7 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
2934
1500
  var safe = {
2935
1501
  exports: {}
2936
1502
  };
2937
- var colors2 = {
1503
+ var colors = {
2938
1504
  exports: {}
2939
1505
  };
2940
1506
  var styles = {
@@ -3651,16 +2217,16 @@ function requireAmerica() {
3651
2217
  if (hasRequiredAmerica) return america.exports;
3652
2218
  hasRequiredAmerica = 1;
3653
2219
  (function(module2) {
3654
- module2["exports"] = function(colors3) {
2220
+ module2["exports"] = function(colors2) {
3655
2221
  return function(letter, i, exploded) {
3656
2222
  if (letter === " ") return letter;
3657
2223
  switch (i % 3) {
3658
2224
  case 0:
3659
- return colors3.red(letter);
2225
+ return colors2.red(letter);
3660
2226
  case 1:
3661
- return colors3.white(letter);
2227
+ return colors2.white(letter);
3662
2228
  case 2:
3663
- return colors3.blue(letter);
2229
+ return colors2.blue(letter);
3664
2230
  }
3665
2231
  };
3666
2232
  };
@@ -3676,9 +2242,9 @@ function requireZebra() {
3676
2242
  if (hasRequiredZebra) return zebra.exports;
3677
2243
  hasRequiredZebra = 1;
3678
2244
  (function(module2) {
3679
- module2["exports"] = function(colors3) {
2245
+ module2["exports"] = function(colors2) {
3680
2246
  return function(letter, i, exploded) {
3681
- return i % 2 === 0 ? letter : colors3.inverse(letter);
2247
+ return i % 2 === 0 ? letter : colors2.inverse(letter);
3682
2248
  };
3683
2249
  };
3684
2250
  })(zebra);
@@ -3693,7 +2259,7 @@ function requireRainbow() {
3693
2259
  if (hasRequiredRainbow) return rainbow.exports;
3694
2260
  hasRequiredRainbow = 1;
3695
2261
  (function(module2) {
3696
- module2["exports"] = function(colors3) {
2262
+ module2["exports"] = function(colors2) {
3697
2263
  var rainbowColors = [
3698
2264
  "red",
3699
2265
  "yellow",
@@ -3705,7 +2271,7 @@ function requireRainbow() {
3705
2271
  if (letter === " ") {
3706
2272
  return letter;
3707
2273
  } else {
3708
- return colors3[rainbowColors[i++ % rainbowColors.length]](letter);
2274
+ return colors2[rainbowColors[i++ % rainbowColors.length]](letter);
3709
2275
  }
3710
2276
  };
3711
2277
  };
@@ -3721,7 +2287,7 @@ function requireRandom() {
3721
2287
  if (hasRequiredRandom) return random.exports;
3722
2288
  hasRequiredRandom = 1;
3723
2289
  (function(module2) {
3724
- module2["exports"] = function(colors3) {
2290
+ module2["exports"] = function(colors2) {
3725
2291
  var available = [
3726
2292
  "underline",
3727
2293
  "inverse",
@@ -3742,7 +2308,7 @@ function requireRandom() {
3742
2308
  "brightMagenta"
3743
2309
  ];
3744
2310
  return function(letter, i, exploded) {
3745
- return letter === " " ? letter : colors3[available[Math.round(Math.random() * (available.length - 2))]](letter);
2311
+ return letter === " " ? letter : colors2[available[Math.round(Math.random() * (available.length - 2))]](letter);
3746
2312
  };
3747
2313
  };
3748
2314
  })(random);
@@ -3750,33 +2316,33 @@ function requireRandom() {
3750
2316
  }
3751
2317
  __name(requireRandom, "requireRandom");
3752
2318
  (function(module2) {
3753
- var colors3 = {};
3754
- module2["exports"] = colors3;
3755
- colors3.themes = {};
2319
+ var colors2 = {};
2320
+ module2["exports"] = colors2;
2321
+ colors2.themes = {};
3756
2322
  var util = import_util.default;
3757
- var ansiStyles = colors3.styles = styles.exports;
2323
+ var ansiStyles = colors2.styles = styles.exports;
3758
2324
  var defineProps = Object.defineProperties;
3759
2325
  var newLineRegex = new RegExp(/[\r\n]+/g);
3760
- colors3.supportsColor = supportsColors.supportsColor;
3761
- if (typeof colors3.enabled === "undefined") {
3762
- colors3.enabled = colors3.supportsColor() !== false;
2326
+ colors2.supportsColor = supportsColors.supportsColor;
2327
+ if (typeof colors2.enabled === "undefined") {
2328
+ colors2.enabled = colors2.supportsColor() !== false;
3763
2329
  }
3764
- colors3.enable = function() {
3765
- colors3.enabled = true;
2330
+ colors2.enable = function() {
2331
+ colors2.enabled = true;
3766
2332
  };
3767
- colors3.disable = function() {
3768
- colors3.enabled = false;
2333
+ colors2.disable = function() {
2334
+ colors2.enabled = false;
3769
2335
  };
3770
- colors3.stripColors = colors3.strip = function(str) {
2336
+ colors2.stripColors = colors2.strip = function(str) {
3771
2337
  return ("" + str).replace(/\x1B\[\d+m/g, "");
3772
2338
  };
3773
- colors3.stylize = /* @__PURE__ */ __name(function stylize(str, style) {
3774
- if (!colors3.enabled) {
2339
+ colors2.stylize = /* @__PURE__ */ __name(function stylize(str, style) {
2340
+ if (!colors2.enabled) {
3775
2341
  return str + "";
3776
2342
  }
3777
2343
  var styleMap = ansiStyles[style];
3778
- if (!styleMap && style in colors3) {
3779
- return colors3[style](str);
2344
+ if (!styleMap && style in colors2) {
2345
+ return colors2[style](str);
3780
2346
  }
3781
2347
  return styleMap.open + str + styleMap.close;
3782
2348
  }, "stylize");
@@ -3787,7 +2353,7 @@ __name(requireRandom, "requireRandom");
3787
2353
  }
3788
2354
  return str.replace(matchOperatorsRe, "\\$&");
3789
2355
  }, "escapeStringRegexp");
3790
- function build3(_styles) {
2356
+ function build2(_styles) {
3791
2357
  var builder = /* @__PURE__ */ __name(function builder2() {
3792
2358
  return applyStyle.apply(builder2, arguments);
3793
2359
  }, "builder");
@@ -3795,7 +2361,7 @@ __name(requireRandom, "requireRandom");
3795
2361
  builder.__proto__ = proto;
3796
2362
  return builder;
3797
2363
  }
3798
- __name(build3, "build");
2364
+ __name(build2, "build");
3799
2365
  var styles$1 = function() {
3800
2366
  var ret = {};
3801
2367
  ansiStyles.grey = ansiStyles.gray;
@@ -3803,13 +2369,13 @@ __name(requireRandom, "requireRandom");
3803
2369
  ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), "g");
3804
2370
  ret[key] = {
3805
2371
  get: /* @__PURE__ */ __name(function() {
3806
- return build3(this._styles.concat(key));
2372
+ return build2(this._styles.concat(key));
3807
2373
  }, "get")
3808
2374
  };
3809
2375
  });
3810
2376
  return ret;
3811
2377
  }();
3812
- var proto = defineProps(/* @__PURE__ */ __name(function colors4() {
2378
+ var proto = defineProps(/* @__PURE__ */ __name(function colors3() {
3813
2379
  }, "colors"), styles$1);
3814
2380
  function applyStyle() {
3815
2381
  var args = Array.prototype.slice.call(arguments);
@@ -3820,7 +2386,7 @@ __name(requireRandom, "requireRandom");
3820
2386
  return util.inspect(arg);
3821
2387
  }
3822
2388
  }).join(" ");
3823
- if (!colors3.enabled || !str) {
2389
+ if (!colors2.enabled || !str) {
3824
2390
  return str;
3825
2391
  }
3826
2392
  var newLinesPresent = str.indexOf("\n") != -1;
@@ -3838,22 +2404,22 @@ __name(requireRandom, "requireRandom");
3838
2404
  return str;
3839
2405
  }
3840
2406
  __name(applyStyle, "applyStyle");
3841
- colors3.setTheme = function(theme) {
2407
+ colors2.setTheme = function(theme) {
3842
2408
  if (typeof theme === "string") {
3843
2409
  console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
3844
2410
  return;
3845
2411
  }
3846
2412
  for (var style in theme) {
3847
2413
  (function(style2) {
3848
- colors3[style2] = function(str) {
2414
+ colors2[style2] = function(str) {
3849
2415
  if (typeof theme[style2] === "object") {
3850
2416
  var out = str;
3851
2417
  for (var i in theme[style2]) {
3852
- out = colors3[theme[style2][i]](out);
2418
+ out = colors2[theme[style2][i]](out);
3853
2419
  }
3854
2420
  return out;
3855
2421
  }
3856
- return colors3[theme[style2]](str);
2422
+ return colors2[theme[style2]](str);
3857
2423
  };
3858
2424
  })(style);
3859
2425
  }
@@ -3863,7 +2429,7 @@ __name(requireRandom, "requireRandom");
3863
2429
  Object.keys(styles$1).forEach(function(name) {
3864
2430
  ret[name] = {
3865
2431
  get: /* @__PURE__ */ __name(function() {
3866
- return build3([
2432
+ return build2([
3867
2433
  name
3868
2434
  ]);
3869
2435
  }, "get")
@@ -3877,24 +2443,24 @@ __name(requireRandom, "requireRandom");
3877
2443
  exploded = exploded.map(map2);
3878
2444
  return exploded.join("");
3879
2445
  }, "sequencer");
3880
- colors3.trap = requireTrap();
3881
- colors3.zalgo = requireZalgo();
3882
- colors3.maps = {};
3883
- colors3.maps.america = requireAmerica()(colors3);
3884
- colors3.maps.zebra = requireZebra()(colors3);
3885
- colors3.maps.rainbow = requireRainbow()(colors3);
3886
- colors3.maps.random = requireRandom()(colors3);
3887
- for (var map in colors3.maps) {
2446
+ colors2.trap = requireTrap();
2447
+ colors2.zalgo = requireZalgo();
2448
+ colors2.maps = {};
2449
+ colors2.maps.america = requireAmerica()(colors2);
2450
+ colors2.maps.zebra = requireZebra()(colors2);
2451
+ colors2.maps.rainbow = requireRainbow()(colors2);
2452
+ colors2.maps.random = requireRandom()(colors2);
2453
+ for (var map in colors2.maps) {
3888
2454
  (function(map2) {
3889
- colors3[map2] = function(str) {
3890
- return sequencer(colors3.maps[map2], str);
2455
+ colors2[map2] = function(str) {
2456
+ return sequencer(colors2.maps[map2], str);
3891
2457
  };
3892
2458
  })(map);
3893
2459
  }
3894
- defineProps(colors3, init());
3895
- })(colors2);
2460
+ defineProps(colors2, init());
2461
+ })(colors);
3896
2462
  (function(module2) {
3897
- var colors$1 = colors2.exports;
2463
+ var colors$1 = colors.exports;
3898
2464
  module2["exports"] = colors$1;
3899
2465
  })(safe);
3900
2466
  var path$4 = import_path2.default;
@@ -3934,8 +2500,8 @@ var pLimit$2 = {
3934
2500
  var pTry$2 = {
3935
2501
  exports: {}
3936
2502
  };
3937
- var pTry$1 = /* @__PURE__ */ __name((fn, ...arguments_) => new Promise((resolve3) => {
3938
- resolve3(fn(...arguments_));
2503
+ var pTry$1 = /* @__PURE__ */ __name((fn, ...arguments_) => new Promise((resolve2) => {
2504
+ resolve2(fn(...arguments_));
3939
2505
  }), "pTry$1");
3940
2506
  pTry$2.exports = pTry$1;
3941
2507
  pTry$2.exports.default = pTry$1;
@@ -3952,20 +2518,20 @@ var pLimit$1 = /* @__PURE__ */ __name((concurrency) => {
3952
2518
  queue.shift()();
3953
2519
  }
3954
2520
  }, "next");
3955
- const run = /* @__PURE__ */ __name((fn, resolve3, ...args) => {
2521
+ const run = /* @__PURE__ */ __name((fn, resolve2, ...args) => {
3956
2522
  activeCount++;
3957
2523
  const result = pTry(fn, ...args);
3958
- resolve3(result);
2524
+ resolve2(result);
3959
2525
  result.then(next, next);
3960
2526
  }, "run");
3961
- const enqueue = /* @__PURE__ */ __name((fn, resolve3, ...args) => {
2527
+ const enqueue = /* @__PURE__ */ __name((fn, resolve2, ...args) => {
3962
2528
  if (activeCount < concurrency) {
3963
- run(fn, resolve3, ...args);
2529
+ run(fn, resolve2, ...args);
3964
2530
  } else {
3965
- queue.push(run.bind(null, fn, resolve3, ...args));
2531
+ queue.push(run.bind(null, fn, resolve2, ...args));
3966
2532
  }
3967
2533
  }, "enqueue");
3968
- const generator = /* @__PURE__ */ __name((fn, ...args) => new Promise((resolve3) => enqueue(fn, resolve3, ...args)), "generator");
2534
+ const generator = /* @__PURE__ */ __name((fn, ...args) => new Promise((resolve2) => enqueue(fn, resolve2, ...args)), "generator");
3969
2535
  Object.defineProperties(generator, {
3970
2536
  activeCount: {
3971
2537
  get: /* @__PURE__ */ __name(() => activeCount, "get")
@@ -4208,12 +2774,12 @@ var checkPath = /* @__PURE__ */ __name((pth) => {
4208
2774
  }
4209
2775
  }, "checkPath");
4210
2776
  var processOptions = /* @__PURE__ */ __name((options) => {
4211
- const defaults2 = {
2777
+ const defaults = {
4212
2778
  mode: 511 & ~process.umask(),
4213
2779
  fs: fs$1
4214
2780
  };
4215
2781
  return {
4216
- ...defaults2,
2782
+ ...defaults,
4217
2783
  ...options
4218
2784
  };
4219
2785
  }, "processOptions");
@@ -4228,11 +2794,11 @@ var permissionError = /* @__PURE__ */ __name((pth) => {
4228
2794
  var makeDir$1 = /* @__PURE__ */ __name(async (input, options) => {
4229
2795
  checkPath(input);
4230
2796
  options = processOptions(options);
4231
- const mkdir2 = promisify(options.fs.mkdir);
2797
+ const mkdir = promisify(options.fs.mkdir);
4232
2798
  const stat = promisify(options.fs.stat);
4233
2799
  if (useNativeRecursiveOption && options.fs.mkdir === fs$1.mkdir) {
4234
2800
  const pth = path$1.resolve(input);
4235
- await mkdir2(pth, {
2801
+ await mkdir(pth, {
4236
2802
  mode: options.mode,
4237
2803
  recursive: true
4238
2804
  });
@@ -4240,7 +2806,7 @@ var makeDir$1 = /* @__PURE__ */ __name(async (input, options) => {
4240
2806
  }
4241
2807
  const make = /* @__PURE__ */ __name(async (pth) => {
4242
2808
  try {
4243
- await mkdir2(pth, options.mode);
2809
+ await mkdir(pth, options.mode);
4244
2810
  return pth;
4245
2811
  } catch (error) {
4246
2812
  if (error.code === "EPERM") {
@@ -4442,7 +3008,7 @@ var LanguageServiceHost = class LanguageServiceHost2 {
4442
3008
  this.service = service;
4443
3009
  }
4444
3010
  setSnapshot(fileName, source) {
4445
- fileName = (0, import_pluginutils3.normalizePath)(fileName);
3011
+ fileName = (0, import_pluginutils.normalizePath)(fileName);
4446
3012
  const snapshot = tsModule.ScriptSnapshot.fromString(source);
4447
3013
  this.snapshots[fileName] = snapshot;
4448
3014
  this.versions[fileName] = (this.versions[fileName] || 0) + 1;
@@ -4450,14 +3016,14 @@ var LanguageServiceHost = class LanguageServiceHost2 {
4450
3016
  return snapshot;
4451
3017
  }
4452
3018
  getScriptSnapshot(fileName) {
4453
- fileName = (0, import_pluginutils3.normalizePath)(fileName);
3019
+ fileName = (0, import_pluginutils.normalizePath)(fileName);
4454
3020
  if (fileName in this.snapshots) return this.snapshots[fileName];
4455
3021
  const source = tsModule.sys.readFile(fileName);
4456
3022
  if (source) return this.setSnapshot(fileName, source);
4457
3023
  return void 0;
4458
3024
  }
4459
3025
  getScriptVersion(fileName) {
4460
- fileName = (0, import_pluginutils3.normalizePath)(fileName);
3026
+ fileName = (0, import_pluginutils.normalizePath)(fileName);
4461
3027
  return (this.versions[fileName] || 0).toString();
4462
3028
  }
4463
3029
  getCustomTransformers() {
@@ -4935,11 +3501,11 @@ var lodash$1 = {
4935
3501
  return result;
4936
3502
  }
4937
3503
  __name(arrayFilter, "arrayFilter");
4938
- function arrayIncludes2(array, value) {
3504
+ function arrayIncludes(array, value) {
4939
3505
  var length = array == null ? 0 : array.length;
4940
3506
  return !!length && baseIndexOf(array, value, 0) > -1;
4941
3507
  }
4942
- __name(arrayIncludes2, "arrayIncludes");
3508
+ __name(arrayIncludes, "arrayIncludes");
4943
3509
  function arrayIncludesWith(array, value, comparator) {
4944
3510
  var index = -1, length = array == null ? 0 : array.length;
4945
3511
  while (++index < length) {
@@ -5188,9 +3754,9 @@ var lodash$1 = {
5188
3754
  return result;
5189
3755
  }
5190
3756
  __name(mapToArray, "mapToArray");
5191
- function overArg(func, transform3) {
3757
+ function overArg(func, transform2) {
5192
3758
  return function(arg) {
5193
- return func(transform3(arg));
3759
+ return func(transform2(arg));
5194
3760
  };
5195
3761
  }
5196
3762
  __name(overArg, "overArg");
@@ -5864,7 +4430,7 @@ var lodash$1 = {
5864
4430
  }
5865
4431
  __name(baseDelay, "baseDelay");
5866
4432
  function baseDifference(array, values2, iteratee2, comparator) {
5867
- var index = -1, includes2 = arrayIncludes2, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
4433
+ var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
5868
4434
  if (!length) {
5869
4435
  return result2;
5870
4436
  }
@@ -6019,7 +4585,7 @@ var lodash$1 = {
6019
4585
  }
6020
4586
  __name(baseInRange, "baseInRange");
6021
4587
  function baseIntersection(arrays, iteratee2, comparator) {
6022
- var includes2 = comparator ? arrayIncludesWith : arrayIncludes2, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array1(othLength), maxLength = Infinity, result2 = [];
4588
+ var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array1(othLength), maxLength = Infinity, result2 = [];
6023
4589
  while (othIndex--) {
6024
4590
  var array = arrays[othIndex];
6025
4591
  if (othIndex && iteratee2) {
@@ -6600,7 +5166,7 @@ var lodash$1 = {
6600
5166
  }
6601
5167
  __name(baseToString, "baseToString");
6602
5168
  function baseUniq(array, iteratee2, comparator) {
6603
- var index = -1, includes2 = arrayIncludes2, length = array.length, isCommon = true, result2 = [], seen = result2;
5169
+ var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
6604
5170
  if (comparator) {
6605
5171
  isCommon = false;
6606
5172
  includes2 = arrayIncludesWith;
@@ -7798,7 +6364,7 @@ var lodash$1 = {
7798
6364
  return nativeObjectToString.call(value);
7799
6365
  }
7800
6366
  __name(objectToString, "objectToString");
7801
- function overRest(func, start, transform4) {
6367
+ function overRest(func, start, transform3) {
7802
6368
  start = nativeMax(start === undefined$1 ? func.length - 1 : start, 0);
7803
6369
  return function() {
7804
6370
  var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array1(length);
@@ -7810,7 +6376,7 @@ var lodash$1 = {
7810
6376
  while (++index < start) {
7811
6377
  otherArgs[index] = args[index];
7812
6378
  }
7813
- otherArgs[start] = transform4(array);
6379
+ otherArgs[start] = transform3(array);
7814
6380
  return apply(func, this, otherArgs);
7815
6381
  };
7816
6382
  }
@@ -7911,7 +6477,7 @@ var lodash$1 = {
7911
6477
  function updateWrapDetails(details, bitmask) {
7912
6478
  arrayEach(wrapFlags, function(pair) {
7913
6479
  var value = "_." + pair[0];
7914
- if (bitmask & pair[1] && !arrayIncludes2(details, value)) {
6480
+ if (bitmask & pair[1] && !arrayIncludes(details, value)) {
7915
6481
  details.push(value);
7916
6482
  }
7917
6483
  });
@@ -8122,10 +6688,10 @@ var lodash$1 = {
8122
6688
  }
8123
6689
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined$1, comparator) : [];
8124
6690
  });
8125
- function join5(array, separator) {
6691
+ function join4(array, separator) {
8126
6692
  return array == null ? "" : nativeJoin.call(array, separator);
8127
6693
  }
8128
- __name(join5, "join");
6694
+ __name(join4, "join");
8129
6695
  function last(array) {
8130
6696
  var length = array == null ? 0 : array.length;
8131
6697
  return length ? array[length - 1] : undefined$1;
@@ -9230,7 +7796,7 @@ var lodash$1 = {
9230
7796
  return properties == null ? result2 : baseAssign(result2, properties);
9231
7797
  }
9232
7798
  __name(create, "create");
9233
- var defaults2 = baseRest(function(object, sources) {
7799
+ var defaults = baseRest(function(object, sources) {
9234
7800
  object = Object1(object);
9235
7801
  var index = -1;
9236
7802
  var length = sources.length;
@@ -9425,7 +7991,7 @@ var lodash$1 = {
9425
7991
  __name(setWith, "setWith");
9426
7992
  var toPairs = createToPairs(keys);
9427
7993
  var toPairsIn = createToPairs(keysIn);
9428
- function transform3(object, iteratee2, accumulator) {
7994
+ function transform2(object, iteratee2, accumulator) {
9429
7995
  var isArr = isArray(object), isArrLike = isArr || isBuffer2(object) || isTypedArray(object);
9430
7996
  iteratee2 = getIteratee(iteratee2, 4);
9431
7997
  if (accumulator == null) {
@@ -9443,7 +8009,7 @@ var lodash$1 = {
9443
8009
  });
9444
8010
  return accumulator;
9445
8011
  }
9446
- __name(transform3, "transform");
8012
+ __name(transform2, "transform");
9447
8013
  function unset(object, path3) {
9448
8014
  return object == null ? true : baseUnset(object, path3);
9449
8015
  }
@@ -9613,11 +8179,11 @@ var lodash$1 = {
9613
8179
  return baseRepeat(toString(string), n);
9614
8180
  }
9615
8181
  __name(repeat, "repeat");
9616
- function replace2() {
8182
+ function replace() {
9617
8183
  var args = arguments, string = toString(args[0]);
9618
8184
  return args.length < 3 ? string : string.replace(args[1], args[2]);
9619
8185
  }
9620
- __name(replace2, "replace");
8186
+ __name(replace, "replace");
9621
8187
  var snakeCase = createCompounder(function(result2, word, index) {
9622
8188
  return result2 + (index ? "_" : "") + word.toLowerCase();
9623
8189
  });
@@ -10070,7 +8636,7 @@ var lodash$1 = {
10070
8636
  lodash2.curry = curry;
10071
8637
  lodash2.curryRight = curryRight;
10072
8638
  lodash2.debounce = debounce;
10073
- lodash2.defaults = defaults2;
8639
+ lodash2.defaults = defaults;
10074
8640
  lodash2.defaultsDeep = defaultsDeep;
10075
8641
  lodash2.defer = defer;
10076
8642
  lodash2.delay = delay;
@@ -10170,7 +8736,7 @@ var lodash$1 = {
10170
8736
  lodash2.toPairsIn = toPairsIn;
10171
8737
  lodash2.toPath = toPath;
10172
8738
  lodash2.toPlainObject = toPlainObject;
10173
- lodash2.transform = transform3;
8739
+ lodash2.transform = transform2;
10174
8740
  lodash2.unary = unary;
10175
8741
  lodash2.union = union;
10176
8742
  lodash2.unionBy = unionBy;
@@ -10280,7 +8846,7 @@ var lodash$1 = {
10280
8846
  lodash2.isUndefined = isUndefined;
10281
8847
  lodash2.isWeakMap = isWeakMap;
10282
8848
  lodash2.isWeakSet = isWeakSet;
10283
- lodash2.join = join5;
8849
+ lodash2.join = join4;
10284
8850
  lodash2.kebabCase = kebabCase;
10285
8851
  lodash2.last = last;
10286
8852
  lodash2.lastIndexOf = lastIndexOf;
@@ -10312,7 +8878,7 @@ var lodash$1 = {
10312
8878
  lodash2.reduce = reduce;
10313
8879
  lodash2.reduceRight = reduceRight;
10314
8880
  lodash2.repeat = repeat;
10315
- lodash2.replace = replace2;
8881
+ lodash2.replace = replace;
10316
8882
  lodash2.result = result;
10317
8883
  lodash2.round = round;
10318
8884
  lodash2.runInContext = runInContext2;
@@ -11704,9 +10270,9 @@ var hasRequired_overArg;
11704
10270
  function require_overArg() {
11705
10271
  if (hasRequired_overArg) return _overArg;
11706
10272
  hasRequired_overArg = 1;
11707
- function overArg(func, transform3) {
10273
+ function overArg(func, transform2) {
11708
10274
  return function(arg) {
11709
- return func(transform3(arg));
10275
+ return func(transform2(arg));
11710
10276
  };
11711
10277
  }
11712
10278
  __name(overArg, "overArg");
@@ -13827,7 +12393,7 @@ function requireTransform() {
13827
12393
  if (hasRequiredTransform) return transform_1;
13828
12394
  hasRequiredTransform = 1;
13829
12395
  var arrayEach = require_arrayEach(), baseCreate = require_baseCreate(), baseForOwn = require_baseForOwn(), baseIteratee = require_baseIteratee(), getPrototype = require_getPrototype(), isArray = requireIsArray(), isBuffer2 = requireIsBuffer(), isFunction = requireIsFunction(), isObject = requireIsObject(), isTypedArray = requireIsTypedArray();
13830
- function transform3(object, iteratee, accumulator) {
12396
+ function transform2(object, iteratee, accumulator) {
13831
12397
  var isArr = isArray(object), isArrLike = isArr || isBuffer2(object) || isTypedArray(object);
13832
12398
  iteratee = baseIteratee(iteratee, 4);
13833
12399
  if (accumulator == null) {
@@ -13845,8 +12411,8 @@ function requireTransform() {
13845
12411
  });
13846
12412
  return accumulator;
13847
12413
  }
13848
- __name(transform3, "transform");
13849
- transform_1 = transform3;
12414
+ __name(transform2, "transform");
12415
+ transform_1 = transform2;
13850
12416
  return transform_1;
13851
12417
  }
13852
12418
  __name(requireTransform, "requireTransform");
@@ -13924,7 +12490,7 @@ function require_overRest() {
13924
12490
  hasRequired_overRest = 1;
13925
12491
  var apply = require_apply();
13926
12492
  var nativeMax = Math.max;
13927
- function overRest(func, start, transform3) {
12493
+ function overRest(func, start, transform2) {
13928
12494
  start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
13929
12495
  return function() {
13930
12496
  var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
@@ -13936,7 +12502,7 @@ function require_overRest() {
13936
12502
  while (++index < start) {
13937
12503
  otherArgs[index] = args[index];
13938
12504
  }
13939
- otherArgs[start] = transform3(array);
12505
+ otherArgs[start] = transform2(array);
13940
12506
  return apply(func, this, otherArgs);
13941
12507
  };
13942
12508
  }
@@ -14086,12 +12652,12 @@ function require_arrayIncludes() {
14086
12652
  if (hasRequired_arrayIncludes) return _arrayIncludes;
14087
12653
  hasRequired_arrayIncludes = 1;
14088
12654
  var baseIndexOf = require_baseIndexOf();
14089
- function arrayIncludes2(array, value) {
12655
+ function arrayIncludes(array, value) {
14090
12656
  var length = array == null ? 0 : array.length;
14091
12657
  return !!length && baseIndexOf(array, value, 0) > -1;
14092
12658
  }
14093
- __name(arrayIncludes2, "arrayIncludes");
14094
- _arrayIncludes = arrayIncludes2;
12659
+ __name(arrayIncludes, "arrayIncludes");
12660
+ _arrayIncludes = arrayIncludes;
14095
12661
  return _arrayIncludes;
14096
12662
  }
14097
12663
  __name(require_arrayIncludes, "require_arrayIncludes");
@@ -14148,10 +12714,10 @@ var hasRequired_baseUniq;
14148
12714
  function require_baseUniq() {
14149
12715
  if (hasRequired_baseUniq) return _baseUniq;
14150
12716
  hasRequired_baseUniq = 1;
14151
- var SetCache = require_SetCache(), arrayIncludes2 = require_arrayIncludes(), arrayIncludesWith = require_arrayIncludesWith(), cacheHas = require_cacheHas(), createSet = require_createSet(), setToArray = require_setToArray();
12717
+ var SetCache = require_SetCache(), arrayIncludes = require_arrayIncludes(), arrayIncludesWith = require_arrayIncludesWith(), cacheHas = require_cacheHas(), createSet = require_createSet(), setToArray = require_setToArray();
14152
12718
  var LARGE_ARRAY_SIZE = 200;
14153
12719
  function baseUniq(array, iteratee, comparator) {
14154
- var index = -1, includes = arrayIncludes2, length = array.length, isCommon = true, result = [], seen = result;
12720
+ var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
14155
12721
  if (comparator) {
14156
12722
  isCommon = false;
14157
12723
  includes = arrayIncludesWith;
@@ -14486,27 +13052,27 @@ Graph$2.prototype.isLeaf = function(v) {
14486
13052
  return neighbors.length === 0;
14487
13053
  };
14488
13054
  Graph$2.prototype.filterNodes = function(filter) {
14489
- var copy2 = new this.constructor({
13055
+ var copy = new this.constructor({
14490
13056
  directed: this._isDirected,
14491
13057
  multigraph: this._isMultigraph,
14492
13058
  compound: this._isCompound
14493
13059
  });
14494
- copy2.setGraph(this.graph());
13060
+ copy.setGraph(this.graph());
14495
13061
  var self1 = this;
14496
13062
  _$b.each(this._nodes, function(value, v) {
14497
13063
  if (filter(v)) {
14498
- copy2.setNode(v, value);
13064
+ copy.setNode(v, value);
14499
13065
  }
14500
13066
  });
14501
13067
  _$b.each(this._edgeObjs, function(e) {
14502
- if (copy2.hasNode(e.v) && copy2.hasNode(e.w)) {
14503
- copy2.setEdge(e, self1.edge(e));
13068
+ if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
13069
+ copy.setEdge(e, self1.edge(e));
14504
13070
  }
14505
13071
  });
14506
13072
  var parents = {};
14507
13073
  function findParent(v) {
14508
13074
  var parent = self1.parent(v);
14509
- if (parent === void 0 || copy2.hasNode(parent)) {
13075
+ if (parent === void 0 || copy.hasNode(parent)) {
14510
13076
  parents[v] = parent;
14511
13077
  return parent;
14512
13078
  } else if (parent in parents) {
@@ -14517,11 +13083,11 @@ Graph$2.prototype.filterNodes = function(filter) {
14517
13083
  }
14518
13084
  __name(findParent, "findParent");
14519
13085
  if (this._isCompound) {
14520
- _$b.each(copy2.nodes(), function(v) {
14521
- copy2.setParent(v, findParent(v));
13086
+ _$b.each(copy.nodes(), function(v) {
13087
+ copy.setParent(v, findParent(v));
14522
13088
  });
14523
13089
  }
14524
- return copy2;
13090
+ return copy;
14525
13091
  };
14526
13092
  Graph$2.prototype.setDefaultEdgeLabel = function(newDefault) {
14527
13093
  if (!_$b.isFunction(newDefault)) {
@@ -15846,9 +14412,9 @@ var TsCache = class TsCache2 {
15846
14412
  this.syntacticDiagnosticsCache.roll();
15847
14413
  this.typesCache.roll();
15848
14414
  }
15849
- getCompiled(id, snapshot, transform3) {
14415
+ getCompiled(id, snapshot, transform2) {
15850
14416
  this.context.info(`${safe.exports.blue("transpiling")} '${id}'`);
15851
- return this.getCached(this.codeCache, id, snapshot, Boolean(!this.options.isolatedModules || this.options.declaration), transform3);
14417
+ return this.getCached(this.codeCache, id, snapshot, Boolean(!this.options.isolatedModules || this.options.declaration), transform2);
15852
14418
  }
15853
14419
  getSyntacticDiagnostics(id, snapshot, check) {
15854
14420
  return this.getDiagnostics("syntax", this.syntacticDiagnosticsCache, id, snapshot, check);
@@ -15931,7 +14497,7 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
15931
14497
  noEmit: false,
15932
14498
  noEmitOnError: false,
15933
14499
  inlineSourceMap: false,
15934
- outDir: (0, import_pluginutils3.normalizePath)(`${cacheRoot}/placeholder`),
14500
+ outDir: (0, import_pluginutils.normalizePath)(`${cacheRoot}/placeholder`),
15935
14501
  allowNonTsExtensions: true
15936
14502
  };
15937
14503
  if (!preParsedTsconfig) return overrides;
@@ -15946,13 +14512,13 @@ __name(getOptionsOverrides, "getOptionsOverrides");
15946
14512
  function expandIncludeWithDirs(include, dirs) {
15947
14513
  const newDirs = [];
15948
14514
  dirs.forEach((root) => {
15949
- if (include instanceof Array) include.forEach((x) => newDirs.push((0, import_pluginutils3.normalizePath)(require$$0.join(root, x))));
15950
- else newDirs.push((0, import_pluginutils3.normalizePath)(require$$0.join(root, include)));
14515
+ if (include instanceof Array) include.forEach((x) => newDirs.push((0, import_pluginutils.normalizePath)(require$$0.join(root, x))));
14516
+ else newDirs.push((0, import_pluginutils.normalizePath)(require$$0.join(root, include)));
15951
14517
  });
15952
14518
  return newDirs;
15953
14519
  }
15954
14520
  __name(expandIncludeWithDirs, "expandIncludeWithDirs");
15955
- function createFilter2(context, pluginOptions, parsedConfig) {
14521
+ function createFilter(context, pluginOptions, parsedConfig) {
15956
14522
  let included = pluginOptions.include;
15957
14523
  let excluded = pluginOptions.exclude;
15958
14524
  if (parsedConfig.options.rootDirs) {
@@ -15967,11 +14533,11 @@ function createFilter2(context, pluginOptions, parsedConfig) {
15967
14533
  ${JSON.stringify(included, void 0, 4)}`);
15968
14534
  context.debug(() => `excluded:
15969
14535
  ${JSON.stringify(excluded, void 0, 4)}`);
15970
- return (0, import_pluginutils3.createFilter)(included, excluded, {
14536
+ return (0, import_pluginutils.createFilter)(included, excluded, {
15971
14537
  resolve: parsedConfig.options.rootDir
15972
14538
  });
15973
14539
  }
15974
- __name(createFilter2, "createFilter");
14540
+ __name(createFilter, "createFilter");
15975
14541
  function parseTsConfig(context, pluginOptions) {
15976
14542
  var _a, _b;
15977
14543
  const fileName = tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, pluginOptions.tsconfig);
@@ -16052,7 +14618,7 @@ var typescript = /* @__PURE__ */ __name((options) => {
16052
14618
  }, "getDiagnostics");
16053
14619
  const typecheckFile = /* @__PURE__ */ __name((id, snapshot, tcContext) => {
16054
14620
  if (!snapshot) return;
16055
- id = (0, import_pluginutils3.normalizePath)(id);
14621
+ id = (0, import_pluginutils.normalizePath)(id);
16056
14622
  checkedFiles.add(id);
16057
14623
  const diagnostics = getDiagnostics(id, snapshot);
16058
14624
  printDiagnostics(tcContext, diagnostics, parsedConfig.options.pretty !== false);
@@ -16060,7 +14626,7 @@ var typescript = /* @__PURE__ */ __name((options) => {
16060
14626
  }, "typecheckFile");
16061
14627
  const addDeclaration = /* @__PURE__ */ __name((id, result) => {
16062
14628
  if (!result.dts) return;
16063
- const key = (0, import_pluginutils3.normalizePath)(id);
14629
+ const key = (0, import_pluginutils.normalizePath)(id);
16064
14630
  declarations[key] = {
16065
14631
  type: result.dts,
16066
14632
  map: result.dtsmap
@@ -16142,7 +14708,7 @@ ${JSON.stringify(rollupOptions, void 0, 4)}`);
16142
14708
  if (pluginOptions.objectHashIgnoreUnknownHack) context.warn(() => `${safe.exports.yellow("You are using 'objectHashIgnoreUnknownHack' option")}. If you enabled it because of async functions, try disabling it now.`);
16143
14709
  if (pluginOptions.rollupCommonJSResolveHack) context.warn(() => `${safe.exports.yellow("You are using 'rollupCommonJSResolveHack' option")}. This is no longer needed, try disabling it now.`);
16144
14710
  if (watchMode) context.info(`running in watch mode`);
16145
- filter = createFilter2(context, pluginOptions, parsedConfig);
14711
+ filter = createFilter(context, pluginOptions, parsedConfig);
16146
14712
  servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers, pluginOptions.cwd);
16147
14713
  service = tsModule.createLanguageService(servicesHost, documentRegistry);
16148
14714
  servicesHost.setLanguageService(service);
@@ -16157,7 +14723,7 @@ ${JSON.stringify(rollupOptions, void 0, 4)}`);
16157
14723
  }
16158
14724
  },
16159
14725
  watchChange(id) {
16160
- const key = (0, import_pluginutils3.normalizePath)(id);
14726
+ const key = (0, import_pluginutils.normalizePath)(id);
16161
14727
  delete declarations[key];
16162
14728
  checkedFiles.delete(key);
16163
14729
  },
@@ -16165,7 +14731,7 @@ ${JSON.stringify(rollupOptions, void 0, 4)}`);
16165
14731
  var _a;
16166
14732
  if (importee === TSLIB) return TSLIB_VIRTUAL;
16167
14733
  if (!importer) return;
16168
- importer = (0, import_pluginutils3.normalizePath)(importer);
14734
+ importer = (0, import_pluginutils.normalizePath)(importer);
16169
14735
  const result = tsModule.nodeModuleNameResolver(importee, importer, parsedConfig.options, tsModule.sys);
16170
14736
  const resolved = (_a = result.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName;
16171
14737
  if (!resolved) return;
@@ -16251,7 +14817,7 @@ ${JSON.stringify(rollupOptions, void 0, 4)}`);
16251
14817
  });
16252
14818
  }
16253
14819
  parsedConfig.fileNames.forEach((name) => {
16254
- const key = (0, import_pluginutils3.normalizePath)(name);
14820
+ const key = (0, import_pluginutils.normalizePath)(name);
16255
14821
  if (checkedFiles.has(key) || !filter(key)) return;
16256
14822
  context.debug(() => `type-checking missed '${key}'`);
16257
14823
  const snapshot = servicesHost.getScriptSnapshot(key);
@@ -16264,7 +14830,7 @@ ${JSON.stringify(rollupOptions, void 0, 4)}`);
16264
14830
  generateRound++;
16265
14831
  if (!parsedConfig.options.declaration) return;
16266
14832
  parsedConfig.fileNames.forEach((name) => {
16267
- const key = (0, import_pluginutils3.normalizePath)(name);
14833
+ const key = (0, import_pluginutils.normalizePath)(name);
16268
14834
  if (key in declarations || !filter(key)) return;
16269
14835
  context.debug(() => `generating missed declarations for '${key}'`);
16270
14836
  const out = convertEmitOutput(service.getEmitOutput(key, true));
@@ -16286,11 +14852,11 @@ ${JSON.stringify(rollupOptions, void 0, 4)}`);
16286
14852
  const parsedText = JSON.parse(entryText);
16287
14853
  parsedText.sources = parsedText.sources.map((source) => {
16288
14854
  const absolutePath = (0, import_path2.resolve)(cachePlaceholder, source);
16289
- return (0, import_pluginutils3.normalizePath)((0, import_path2.relative)(declarationDir, absolutePath));
14855
+ return (0, import_pluginutils.normalizePath)((0, import_path2.relative)(declarationDir, absolutePath));
16290
14856
  });
16291
14857
  entryText = JSON.stringify(parsedText);
16292
14858
  }
16293
- const relativePath = (0, import_pluginutils3.normalizePath)((0, import_path2.relative)(cachePlaceholder, fileName));
14859
+ const relativePath = (0, import_pluginutils.normalizePath)((0, import_path2.relative)(cachePlaceholder, fileName));
16294
14860
  context.debug(() => `${safe.exports.blue("emitting declarations")} for '${key}' to '${relativePath}'`);
16295
14861
  this.emitFile({
16296
14862
  type: "asset",
@@ -16409,35 +14975,35 @@ async function resolveOptions(options) {
16409
14975
  if (options.configPath) {
16410
14976
  const configFile = await loadConfig2(options.configPath);
16411
14977
  if (configFile) {
16412
- options = (0, import_defu5.default)(options, configFile);
14978
+ options = (0, import_defu3.default)(options, configFile);
16413
14979
  }
16414
14980
  }
16415
14981
  const projectGraph = (0, import_devkit6.readCachedProjectGraph)();
16416
14982
  const projectJsonPath = joinPaths(config.workspaceRoot, projectRoot, "project.json");
16417
- if (!(0, import_node_fs8.existsSync)(projectJsonPath)) {
14983
+ if (!(0, import_node_fs6.existsSync)(projectJsonPath)) {
16418
14984
  throw new Error("Cannot find project.json configuration");
16419
14985
  }
16420
- const projectJsonContent = await (0, import_promises7.readFile)(projectJsonPath, "utf8");
14986
+ const projectJsonContent = await (0, import_promises5.readFile)(projectJsonPath, "utf8");
16421
14987
  const projectJson = JSON.parse(projectJsonContent);
16422
14988
  const projectName = projectJson.name;
16423
14989
  const packageJsonPath = joinPaths(workspaceRoot.dir, projectRoot, "package.json");
16424
- if (!(0, import_node_fs8.existsSync)(packageJsonPath)) {
14990
+ if (!(0, import_node_fs6.existsSync)(packageJsonPath)) {
16425
14991
  throw new Error("Cannot find package.json configuration");
16426
14992
  }
16427
- const packageJsonContent = await (0, import_promises7.readFile)(packageJsonPath, "utf8");
14993
+ const packageJsonContent = await (0, import_promises5.readFile)(packageJsonPath, "utf8");
16428
14994
  const packageJson = JSON.parse(packageJsonContent);
16429
14995
  let tsconfig = options.tsconfig;
16430
14996
  if (!tsconfig) {
16431
14997
  tsconfig = joinPaths(workspaceRoot.dir, projectRoot, "tsconfig.json");
16432
14998
  }
16433
- if (!(0, import_node_fs8.existsSync)(tsconfig)) {
14999
+ if (!(0, import_node_fs6.existsSync)(tsconfig)) {
16434
15000
  throw new Error("Cannot find tsconfig.json configuration");
16435
15001
  }
16436
15002
  let sourceRoot = projectJson.sourceRoot;
16437
15003
  if (!sourceRoot) {
16438
15004
  sourceRoot = joinPaths(projectRoot, "src");
16439
15005
  }
16440
- if (!(0, import_node_fs8.existsSync)(sourceRoot)) {
15006
+ if (!(0, import_node_fs6.existsSync)(sourceRoot)) {
16441
15007
  throw new Error("Cannot find sourceRoot directory");
16442
15008
  }
16443
15009
  const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(void 0, projectGraph, workspaceRoot.dir, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
@@ -16447,6 +15013,11 @@ async function resolveOptions(options) {
16447
15013
  dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
16448
15014
  dependencies.push(tsLibDependency);
16449
15015
  }
15016
+ const jiti = (0, import_jiti.createJiti)(config.workspaceRoot, {
15017
+ cache: true,
15018
+ fsCache: config.skipCache ? false : joinPaths(config.directories.cache || "node_modules/.cache/storm", "jiti"),
15019
+ interopDefault: true
15020
+ });
16450
15021
  const resolvedOptions = {
16451
15022
  name: projectName,
16452
15023
  config,
@@ -16454,6 +15025,7 @@ async function resolveOptions(options) {
16454
15025
  sourceRoot,
16455
15026
  projectName,
16456
15027
  tsconfig,
15028
+ jiti,
16457
15029
  clean: false,
16458
15030
  entries: [
16459
15031
  {
@@ -16520,7 +15092,7 @@ async function resolveOptions(options) {
16520
15092
  ]
16521
15093
  },
16522
15094
  esbuild: {
16523
- minify: !!options.minify,
15095
+ minify: options.minify !== false,
16524
15096
  splitting: options.splitting !== false,
16525
15097
  treeShaking: options.treeShaking !== false,
16526
15098
  color: true,
@@ -16539,16 +15111,16 @@ async function resolveOptions(options) {
16539
15111
  resolvedOptions.peerDependencies = Object.keys(packageJson.peerDependencies);
16540
15112
  }
16541
15113
  if (options.rollup) {
16542
- let rollup2 = {};
15114
+ let rollup = {};
16543
15115
  if (typeof options.rollup === "string") {
16544
15116
  const rollupFile = await loadConfig2(options.rollup);
16545
15117
  if (rollupFile) {
16546
- rollup2 = rollupFile;
15118
+ rollup = rollupFile;
16547
15119
  }
16548
15120
  } else {
16549
- rollup2 = options.rollup;
15121
+ rollup = options.rollup;
16550
15122
  }
16551
- resolvedOptions.rollup = (0, import_defu5.default)(resolvedOptions.rollup ?? {}, rollup2);
15123
+ resolvedOptions.rollup = (0, import_defu3.default)(resolvedOptions.rollup ?? {}, rollup);
16552
15124
  }
16553
15125
  resolvedOptions.hooks = {
16554
15126
  "rollup:options": /* @__PURE__ */ __name(async (ctx, opts) => {
@@ -16560,14 +15132,14 @@ async function resolveOptions(options) {
16560
15132
  }
16561
15133
  __name(resolveOptions, "resolveOptions");
16562
15134
  async function generatePackageJson(options) {
16563
- if (options.generatePackageJson !== false && (0, import_node_fs8.existsSync)(joinPaths(options.projectRoot, "package.json"))) {
15135
+ if (options.generatePackageJson !== false && (0, import_node_fs6.existsSync)(joinPaths(options.projectRoot, "package.json"))) {
16564
15136
  writeDebug(" \u270D\uFE0F Writing package.json file", options.config);
16565
15137
  const stopwatch = getStopwatch("Write package.json file");
16566
15138
  const packageJsonPath = joinPaths(options.projectRoot, "project.json");
16567
- if (!(0, import_node_fs8.existsSync)(packageJsonPath)) {
15139
+ if (!(0, import_node_fs6.existsSync)(packageJsonPath)) {
16568
15140
  throw new Error("Cannot find package.json configuration");
16569
15141
  }
16570
- let packageJsonContent = await (0, import_promises7.readFile)(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
15142
+ let packageJsonContent = await (0, import_promises5.readFile)(joinPaths(options.config.workspaceRoot, options.projectRoot, "package.json"), "utf8");
16571
15143
  if (!packageJsonContent) {
16572
15144
  throw new Error("Cannot find package.json configuration file");
16573
15145
  }
@@ -16580,11 +15152,24 @@ async function generatePackageJson(options) {
16580
15152
  return options;
16581
15153
  }
16582
15154
  __name(generatePackageJson, "generatePackageJson");
15155
+ async function resolveUnbuild(options) {
15156
+ writeTrace(`Resolving Unbuild package with Jiti`, options.config);
15157
+ try {
15158
+ return options.jiti.import("unbuild");
15159
+ } catch (error) {
15160
+ writeError(" \u274C An error occurred while resolving the Unbuild package", options.config);
15161
+ throw new Error("An error occurred while resolving the Unbuild package", {
15162
+ cause: error
15163
+ });
15164
+ }
15165
+ }
15166
+ __name(resolveUnbuild, "resolveUnbuild");
16583
15167
  async function executeUnbuild(options) {
16584
15168
  writeDebug(` \u{1F680} Running ${options.name} (${options.projectRoot}) build`, options.config);
16585
15169
  const stopwatch = getStopwatch(`${options.name} (${options.projectRoot}) build`);
16586
15170
  try {
16587
- await build(options.projectRoot, false, {
15171
+ const unbuild = await resolveUnbuild(options);
15172
+ await unbuild.build(options.projectRoot, false, {
16588
15173
  ...options,
16589
15174
  rootDir: options.projectRoot
16590
15175
  });
@@ -16609,7 +15194,7 @@ async function cleanOutputPath(options) {
16609
15194
  return options;
16610
15195
  }
16611
15196
  __name(cleanOutputPath, "cleanOutputPath");
16612
- async function build2(options) {
15197
+ async function build(options) {
16613
15198
  writeDebug(` \u26A1 Executing Storm Unbuild pipeline`);
16614
15199
  const stopwatch = getStopwatch("Unbuild pipeline");
16615
15200
  try {
@@ -16626,7 +15211,7 @@ async function build2(options) {
16626
15211
  stopwatch();
16627
15212
  }
16628
15213
  }
16629
- __name(build2, "build");
15214
+ __name(build, "build");
16630
15215
 
16631
15216
  // bin/unbuild.ts
16632
15217
  async function createProgram(config) {
@@ -16704,7 +15289,7 @@ async function createProgram(config) {
16704
15289
  __name(createProgram, "createProgram");
16705
15290
  var buildAction = /* @__PURE__ */ __name((config) => async (options) => {
16706
15291
  try {
16707
- await build2({
15292
+ await build({
16708
15293
  ...options,
16709
15294
  sourcemap: !!options.debug,
16710
15295
  replace: {},