@ariestools/toolchain 8.7.1 → 8.7.3

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.
Files changed (59) hide show
  1. package/README.md +44 -0
  2. package/dist/actions/api-exposure/analyzer/analyzePackage.d.ts.map +1 -1
  3. package/dist/actions/api-exposure/reporters.d.ts.map +1 -1
  4. package/dist/actions/api-exposure/scoring.d.ts +1 -0
  5. package/dist/actions/api-exposure/scoring.d.ts.map +1 -1
  6. package/dist/actions/api-exposure/types.d.ts +3 -0
  7. package/dist/actions/api-exposure/types.d.ts.map +1 -1
  8. package/dist/actions/deplint/deplint.d.ts +3 -1
  9. package/dist/actions/deplint/deplint.d.ts.map +1 -1
  10. package/dist/actions/deplint/engine.d.ts +2 -2
  11. package/dist/actions/deplint/engine.d.ts.map +1 -1
  12. package/dist/actions/deplint/findFiles.d.ts.map +1 -1
  13. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.d.ts.map +1 -1
  14. package/dist/actions/deplint/getImportsFromFile.d.ts.map +1 -1
  15. package/dist/actions/deplint/getStorybookConfigImports.d.ts.map +1 -1
  16. package/dist/actions/deplint/index.d.ts +2 -0
  17. package/dist/actions/deplint/index.d.ts.map +1 -1
  18. package/dist/actions/deplint/reporters.d.ts +6 -1
  19. package/dist/actions/deplint/reporters.d.ts.map +1 -1
  20. package/dist/actions/deplint/runDeplint.d.ts +4 -0
  21. package/dist/actions/deplint/runDeplint.d.ts.map +1 -0
  22. package/dist/actions/deplint/snapshot.d.ts +7 -0
  23. package/dist/actions/deplint/snapshot.d.ts.map +1 -1
  24. package/dist/actions/deplint/sourceFileCache.d.ts +11 -0
  25. package/dist/actions/deplint/sourceFileCache.d.ts.map +1 -0
  26. package/dist/actions/deplint/types.d.ts +31 -0
  27. package/dist/actions/deplint/types.d.ts.map +1 -1
  28. package/dist/actions/license.d.ts +2 -1
  29. package/dist/actions/license.d.ts.map +1 -1
  30. package/dist/actions/lintNextWorker.d.ts.map +1 -1
  31. package/dist/actions/package/compile/MonolithConfig.d.ts +10 -0
  32. package/dist/actions/package/compile/MonolithConfig.d.ts.map +1 -1
  33. package/dist/actions/package/compile/XyConfig.d.ts +2 -0
  34. package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
  35. package/dist/actions/package/compile/index.d.ts +1 -0
  36. package/dist/actions/package/compile/index.d.ts.map +1 -1
  37. package/dist/actions/package/compile/monolithCopyEntries.d.ts +14 -0
  38. package/dist/actions/package/compile/monolithCopyEntries.d.ts.map +1 -0
  39. package/dist/actions/package/compile/packageCompileMonolith.d.ts.map +1 -1
  40. package/dist/actions/package/expectedCompileOutputs.d.ts +1 -0
  41. package/dist/actions/package/expectedCompileOutputs.d.ts.map +1 -1
  42. package/dist/actions/package/exportMapPublint.d.ts.map +1 -1
  43. package/dist/bin/package/build.mjs +118 -14
  44. package/dist/bin/package/build.mjs.map +1 -1
  45. package/dist/bin/package/compile.mjs +84 -6
  46. package/dist/bin/package/compile.mjs.map +1 -1
  47. package/dist/bin/package/publint.mjs +95 -14
  48. package/dist/bin/package/publint.mjs.map +1 -1
  49. package/dist/bin/package/recompile.mjs +84 -6
  50. package/dist/bin/package/recompile.mjs.map +1 -1
  51. package/dist/bin/package/sync-layout.mjs +23 -6
  52. package/dist/bin/package/sync-layout.mjs.map +1 -1
  53. package/dist/bin/xy.mjs +1929 -1704
  54. package/dist/bin/xy.mjs.map +1 -1
  55. package/dist/lib/licenseCheck/checkLicenses.d.ts +17 -1
  56. package/dist/lib/licenseCheck/checkLicenses.d.ts.map +1 -1
  57. package/dist/lib/loadConfig.d.ts.map +1 -1
  58. package/dist/xy/lint/deplintCommand.d.ts.map +1 -1
  59. package/package.json +5 -5
@@ -9588,22 +9588,33 @@ function deprecatedRuleConfigAliases(configKey) {
9588
9588
  var import_dist = require_dist();
9589
9589
  const configState = {
9590
9590
  config: void 0,
9591
+ /** In-flight root load so concurrent callers share one cosmiconfig search. */
9592
+ loadPromise: void 0,
9591
9593
  rootConfigPath: void 0
9592
9594
  };
9593
9595
  const workspaceConfigCache = /* @__PURE__ */ new Map();
9596
+ /** In-flight workspace loads — concurrent jobs for the same dir share one search. */
9597
+ const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
9594
9598
  const deprecationWarned = /* @__PURE__ */ new Set();
9595
9599
  function isRecord$1(value) {
9596
9600
  return typeof value === "object" && value !== null && !Array.isArray(value);
9597
9601
  }
9598
- function createExplorer() {
9599
- return (0, import_dist.cosmiconfig)("xy", {
9602
+ const explorerState = {};
9603
+ function getExplorer() {
9604
+ explorerState.current ??= (0, import_dist.cosmiconfig)("xy", {
9600
9605
  cache: true,
9601
9606
  loaders: { ".ts": TypeScriptLoader() }
9602
9607
  });
9608
+ return explorerState.current;
9603
9609
  }
9604
- const loadConfig = async (params) => {
9605
- if (configState.config === void 0) {
9606
- const cosmicConfigResult = await createExplorer().search();
9610
+ async function ensureRootConfigLoaded() {
9611
+ if (configState.config !== void 0) return;
9612
+ if (configState.loadPromise !== void 0) {
9613
+ await configState.loadPromise;
9614
+ return;
9615
+ }
9616
+ configState.loadPromise = (async () => {
9617
+ const cosmicConfigResult = await getExplorer().search();
9607
9618
  configState.config = cosmicConfigResult?.config ?? {};
9608
9619
  configState.rootConfigPath = cosmicConfigResult?.filepath;
9609
9620
  const configFilePath = cosmicConfigResult?.filepath;
@@ -9611,8 +9622,16 @@ const loadConfig = async (params) => {
9611
9622
  console.log(chalk.green(`Loaded config from ${configFilePath}`));
9612
9623
  if (Boolean(configState.config.verbose)) console.log(chalk.gray(JSON.stringify(configState.config, null, 2)));
9613
9624
  }
9625
+ })();
9626
+ try {
9627
+ await configState.loadPromise;
9628
+ } finally {
9629
+ configState.loadPromise = void 0;
9614
9630
  }
9615
- return deepMerge(configState.config, params ?? {});
9631
+ }
9632
+ const loadConfig = async (params) => {
9633
+ await ensureRootConfigLoaded();
9634
+ return deepMerge(configState.config ?? {}, params ?? {});
9616
9635
  };
9617
9636
  /**
9618
9637
  * Loads the xy.config from a specific workspace directory.
@@ -9622,14 +9641,25 @@ const loadConfig = async (params) => {
9622
9641
  async function loadWorkspaceConfig(workspaceDir) {
9623
9642
  const cached = workspaceConfigCache.get(workspaceDir);
9624
9643
  if (cached !== void 0) return cached;
9625
- const result = await createExplorer().search(workspaceDir);
9626
- if (!result || result.filepath === configState.rootConfigPath) {
9627
- workspaceConfigCache.set(workspaceDir, {});
9628
- return {};
9644
+ const inFlight = workspaceConfigLoadPromises.get(workspaceDir);
9645
+ if (inFlight !== void 0) return inFlight;
9646
+ const loadPromise = (async () => {
9647
+ await ensureRootConfigLoaded();
9648
+ const result = await getExplorer().search(workspaceDir);
9649
+ if (!result || result.filepath === configState.rootConfigPath) {
9650
+ workspaceConfigCache.set(workspaceDir, {});
9651
+ return {};
9652
+ }
9653
+ const wsConfig = result.config ?? {};
9654
+ workspaceConfigCache.set(workspaceDir, wsConfig);
9655
+ return wsConfig;
9656
+ })();
9657
+ workspaceConfigLoadPromises.set(workspaceDir, loadPromise);
9658
+ try {
9659
+ return await loadPromise;
9660
+ } finally {
9661
+ workspaceConfigLoadPromises.delete(workspaceDir);
9629
9662
  }
9630
- const wsConfig = result.config ?? {};
9631
- workspaceConfigCache.set(workspaceDir, wsConfig);
9632
- return wsConfig;
9633
9663
  }
9634
9664
  /** Deprecated top-level fields that should be under `commands`. */
9635
9665
  const DEPRECATED_COMMAND_FIELDS = /* @__PURE__ */ new Set(["deplint", "publint"]);
@@ -10580,6 +10610,44 @@ const resolveCompilePlatforms = (compile) => {
10580
10610
  };
10581
10611
  };
10582
10612
  //#endregion
10613
+ //#region src/actions/package/compile/monolithCopyEntries.ts
10614
+ const copyPlatforms = /* @__PURE__ */ new Set([
10615
+ "browser",
10616
+ "neutral",
10617
+ "node"
10618
+ ]);
10619
+ function isPathInside(parent, candidate) {
10620
+ const relative = PATH.relative(parent, candidate);
10621
+ return relative.length > 0 && relative !== ".." && !relative.startsWith(`..${PATH.sep}`) && !PATH.isAbsolute(relative);
10622
+ }
10623
+ /** Resolves configured copy destinations without requiring their sources to exist. */
10624
+ function listMonolithCopyEntries(packageDir, config) {
10625
+ const distDir = PATH.resolve(packageDir, "dist");
10626
+ const entries = [];
10627
+ const configuredCopyEntries = Object.entries(config.copyEntries ?? {});
10628
+ for (const [platformName, configuredEntries] of configuredCopyEntries) {
10629
+ if (!copyPlatforms.has(platformName)) throw new Error(`Unsupported monolith copy entry platform "${platformName}"`);
10630
+ const platform = platformName;
10631
+ const platformDir = PATH.join(distDir, platform);
10632
+ for (const [output, source] of Object.entries(configuredEntries)) {
10633
+ if (output.length === 0) throw new Error(`Monolith copy entry for ${platform} has an empty output path`);
10634
+ if (source.length === 0) throw new Error(`Monolith copy entry "${output}" has an empty source`);
10635
+ if (PATH.isAbsolute(output)) throw new Error(`Monolith copy entry output must be relative: "${output}"`);
10636
+ const destination = PATH.resolve(platformDir, output);
10637
+ if (!isPathInside(platformDir, destination)) throw new Error(`Monolith copy entry output escapes dist/${platform}: "${output}"`);
10638
+ const normalizedOutput = PATH.relative(platformDir, destination).split(PATH.sep).join("/");
10639
+ entries.push({
10640
+ destination,
10641
+ output: normalizedOutput,
10642
+ platform,
10643
+ source,
10644
+ subpath: `./${normalizedOutput}`
10645
+ });
10646
+ }
10647
+ }
10648
+ return entries;
10649
+ }
10650
+ //#endregion
10583
10651
  //#region src/actions/package/compile/PublintConfig.ts
10584
10652
  const ALL_PUBLINT_CHECKS = [
10585
10653
  "compileTargets",
@@ -10912,10 +10980,22 @@ async function collectExpectedCompileOutputs(pkgDir) {
10912
10980
  const compile = (await loadMergedWorkspaceConfig(pkgDir)).compile;
10913
10981
  if (compile === void 0) return [];
10914
10982
  const platforms = resolveCompilePlatforms(compile);
10983
+ const copiedOutputs = compile.mode === "monolith" && compile.monolith !== void 0 ? listMonolithCopyEntries(pkgDir, compile.monolith).filter((entry) => fs.existsSync(entry.destination) && fs.statSync(entry.destination).isFile()).map((entry) => {
10984
+ const declarationFile = pairedDeclarationFile(entry.destination);
10985
+ return {
10986
+ entry: entry.output,
10987
+ isPrimaryIndex: false,
10988
+ platform: entry.platform,
10989
+ runtime: relativeExportsTarget(pkgDir, entry.destination),
10990
+ suggestedSubpath: entry.subpath,
10991
+ types: declarationFile === void 0 ? void 0 : relativeExportsTarget(pkgDir, declarationFile)
10992
+ };
10993
+ }) : [];
10915
10994
  return [
10916
10995
  ...collectOutputsForPlatform(pkgDir, "node", platforms.node, compile),
10917
10996
  ...collectOutputsForPlatform(pkgDir, "browser", platforms.browser, compile),
10918
- ...collectOutputsForPlatform(pkgDir, "neutral", platforms.neutral, compile)
10997
+ ...collectOutputsForPlatform(pkgDir, "neutral", platforms.neutral, compile),
10998
+ ...copiedOutputs
10919
10999
  ];
10920
11000
  }
10921
11001
  //#endregion
@@ -11118,6 +11198,7 @@ function setConditionExport(subpathExport, platform, kind, target) {
11118
11198
  if (conditionExport[kind] === void 0) conditionExport[kind] = target;
11119
11199
  }
11120
11200
  function preferredSubpath(expected) {
11201
+ if (expected.suggestedSubpath !== void 0) return expected.suggestedSubpath;
11121
11202
  if (expected.isPrimaryIndex) return ".";
11122
11203
  return `./${PATH.posix.parse(expected.runtime).name}`;
11123
11204
  }