@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.
- package/README.md +44 -0
- package/dist/actions/api-exposure/analyzer/analyzePackage.d.ts.map +1 -1
- package/dist/actions/api-exposure/reporters.d.ts.map +1 -1
- package/dist/actions/api-exposure/scoring.d.ts +1 -0
- package/dist/actions/api-exposure/scoring.d.ts.map +1 -1
- package/dist/actions/api-exposure/types.d.ts +3 -0
- package/dist/actions/api-exposure/types.d.ts.map +1 -1
- package/dist/actions/deplint/deplint.d.ts +3 -1
- package/dist/actions/deplint/deplint.d.ts.map +1 -1
- package/dist/actions/deplint/engine.d.ts +2 -2
- package/dist/actions/deplint/engine.d.ts.map +1 -1
- package/dist/actions/deplint/findFiles.d.ts.map +1 -1
- package/dist/actions/deplint/getCliReferencedPackagesFromFiles.d.ts.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.d.ts.map +1 -1
- package/dist/actions/deplint/getStorybookConfigImports.d.ts.map +1 -1
- package/dist/actions/deplint/index.d.ts +2 -0
- package/dist/actions/deplint/index.d.ts.map +1 -1
- package/dist/actions/deplint/reporters.d.ts +6 -1
- package/dist/actions/deplint/reporters.d.ts.map +1 -1
- package/dist/actions/deplint/runDeplint.d.ts +4 -0
- package/dist/actions/deplint/runDeplint.d.ts.map +1 -0
- package/dist/actions/deplint/snapshot.d.ts +7 -0
- package/dist/actions/deplint/snapshot.d.ts.map +1 -1
- package/dist/actions/deplint/sourceFileCache.d.ts +11 -0
- package/dist/actions/deplint/sourceFileCache.d.ts.map +1 -0
- package/dist/actions/deplint/types.d.ts +31 -0
- package/dist/actions/deplint/types.d.ts.map +1 -1
- package/dist/actions/license.d.ts +2 -1
- package/dist/actions/license.d.ts.map +1 -1
- package/dist/actions/lintNextWorker.d.ts.map +1 -1
- package/dist/actions/package/compile/MonolithConfig.d.ts +10 -0
- package/dist/actions/package/compile/MonolithConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +2 -0
- package/dist/actions/package/compile/XyConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/index.d.ts +1 -0
- package/dist/actions/package/compile/index.d.ts.map +1 -1
- package/dist/actions/package/compile/monolithCopyEntries.d.ts +14 -0
- package/dist/actions/package/compile/monolithCopyEntries.d.ts.map +1 -0
- package/dist/actions/package/compile/packageCompileMonolith.d.ts.map +1 -1
- package/dist/actions/package/expectedCompileOutputs.d.ts +1 -0
- package/dist/actions/package/expectedCompileOutputs.d.ts.map +1 -1
- package/dist/actions/package/exportMapPublint.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +118 -14
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +84 -6
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +95 -14
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +84 -6
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +23 -6
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/xy.mjs +1929 -1704
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/lib/licenseCheck/checkLicenses.d.ts +17 -1
- package/dist/lib/licenseCheck/checkLicenses.d.ts.map +1 -1
- package/dist/lib/loadConfig.d.ts.map +1 -1
- package/dist/xy/lint/deplintCommand.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -10075,22 +10075,33 @@ function deprecatedRuleConfigAliases(configKey) {
|
|
|
10075
10075
|
var import_dist = require_dist();
|
|
10076
10076
|
const configState = {
|
|
10077
10077
|
config: void 0,
|
|
10078
|
+
/** In-flight root load so concurrent callers share one cosmiconfig search. */
|
|
10079
|
+
loadPromise: void 0,
|
|
10078
10080
|
rootConfigPath: void 0
|
|
10079
10081
|
};
|
|
10080
10082
|
const workspaceConfigCache = /* @__PURE__ */ new Map();
|
|
10083
|
+
/** In-flight workspace loads — concurrent jobs for the same dir share one search. */
|
|
10084
|
+
const workspaceConfigLoadPromises = /* @__PURE__ */ new Map();
|
|
10081
10085
|
const deprecationWarned = /* @__PURE__ */ new Set();
|
|
10082
10086
|
function isRecord$1(value) {
|
|
10083
10087
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10084
10088
|
}
|
|
10085
|
-
|
|
10086
|
-
|
|
10089
|
+
const explorerState = {};
|
|
10090
|
+
function getExplorer() {
|
|
10091
|
+
explorerState.current ??= (0, import_dist.cosmiconfig)("xy", {
|
|
10087
10092
|
cache: true,
|
|
10088
10093
|
loaders: { ".ts": TypeScriptLoader() }
|
|
10089
10094
|
});
|
|
10095
|
+
return explorerState.current;
|
|
10090
10096
|
}
|
|
10091
|
-
|
|
10092
|
-
if (configState.config
|
|
10093
|
-
|
|
10097
|
+
async function ensureRootConfigLoaded() {
|
|
10098
|
+
if (configState.config !== void 0) return;
|
|
10099
|
+
if (configState.loadPromise !== void 0) {
|
|
10100
|
+
await configState.loadPromise;
|
|
10101
|
+
return;
|
|
10102
|
+
}
|
|
10103
|
+
configState.loadPromise = (async () => {
|
|
10104
|
+
const cosmicConfigResult = await getExplorer().search();
|
|
10094
10105
|
configState.config = cosmicConfigResult?.config ?? {};
|
|
10095
10106
|
configState.rootConfigPath = cosmicConfigResult?.filepath;
|
|
10096
10107
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
@@ -10098,8 +10109,16 @@ const loadConfig = async (params) => {
|
|
|
10098
10109
|
console.log(chalk.green(`Loaded config from ${configFilePath}`));
|
|
10099
10110
|
if (Boolean(configState.config.verbose)) console.log(chalk.gray(JSON.stringify(configState.config, null, 2)));
|
|
10100
10111
|
}
|
|
10112
|
+
})();
|
|
10113
|
+
try {
|
|
10114
|
+
await configState.loadPromise;
|
|
10115
|
+
} finally {
|
|
10116
|
+
configState.loadPromise = void 0;
|
|
10101
10117
|
}
|
|
10102
|
-
|
|
10118
|
+
}
|
|
10119
|
+
const loadConfig = async (params) => {
|
|
10120
|
+
await ensureRootConfigLoaded();
|
|
10121
|
+
return deepMerge$1(configState.config ?? {}, params ?? {});
|
|
10103
10122
|
};
|
|
10104
10123
|
/**
|
|
10105
10124
|
* Loads the xy.config from a specific workspace directory.
|
|
@@ -10109,14 +10128,25 @@ const loadConfig = async (params) => {
|
|
|
10109
10128
|
async function loadWorkspaceConfig(workspaceDir) {
|
|
10110
10129
|
const cached = workspaceConfigCache.get(workspaceDir);
|
|
10111
10130
|
if (cached !== void 0) return cached;
|
|
10112
|
-
const
|
|
10113
|
-
if (
|
|
10114
|
-
|
|
10115
|
-
|
|
10131
|
+
const inFlight = workspaceConfigLoadPromises.get(workspaceDir);
|
|
10132
|
+
if (inFlight !== void 0) return inFlight;
|
|
10133
|
+
const loadPromise = (async () => {
|
|
10134
|
+
await ensureRootConfigLoaded();
|
|
10135
|
+
const result = await getExplorer().search(workspaceDir);
|
|
10136
|
+
if (!result || result.filepath === configState.rootConfigPath) {
|
|
10137
|
+
workspaceConfigCache.set(workspaceDir, {});
|
|
10138
|
+
return {};
|
|
10139
|
+
}
|
|
10140
|
+
const wsConfig = result.config ?? {};
|
|
10141
|
+
workspaceConfigCache.set(workspaceDir, wsConfig);
|
|
10142
|
+
return wsConfig;
|
|
10143
|
+
})();
|
|
10144
|
+
workspaceConfigLoadPromises.set(workspaceDir, loadPromise);
|
|
10145
|
+
try {
|
|
10146
|
+
return await loadPromise;
|
|
10147
|
+
} finally {
|
|
10148
|
+
workspaceConfigLoadPromises.delete(workspaceDir);
|
|
10116
10149
|
}
|
|
10117
|
-
const wsConfig = result.config ?? {};
|
|
10118
|
-
workspaceConfigCache.set(workspaceDir, wsConfig);
|
|
10119
|
-
return wsConfig;
|
|
10120
10150
|
}
|
|
10121
10151
|
/** Deprecated top-level fields that should be under `commands`. */
|
|
10122
10152
|
const DEPRECATED_COMMAND_FIELDS = /* @__PURE__ */ new Set(["deplint", "publint"]);
|
|
@@ -14735,6 +14765,65 @@ function buildMonolithEntries(config) {
|
|
|
14735
14765
|
return entries;
|
|
14736
14766
|
}
|
|
14737
14767
|
//#endregion
|
|
14768
|
+
//#region src/actions/package/compile/monolithCopyEntries.ts
|
|
14769
|
+
const copyPlatforms = /* @__PURE__ */ new Set([
|
|
14770
|
+
"browser",
|
|
14771
|
+
"neutral",
|
|
14772
|
+
"node"
|
|
14773
|
+
]);
|
|
14774
|
+
function isPathInside(parent, candidate) {
|
|
14775
|
+
const relative = PATH.relative(parent, candidate);
|
|
14776
|
+
return relative.length > 0 && relative !== ".." && !relative.startsWith(`..${PATH.sep}`) && !PATH.isAbsolute(relative);
|
|
14777
|
+
}
|
|
14778
|
+
/** Resolves configured copy destinations without requiring their sources to exist. */
|
|
14779
|
+
function listMonolithCopyEntries(packageDir, config) {
|
|
14780
|
+
const distDir = PATH.resolve(packageDir, "dist");
|
|
14781
|
+
const entries = [];
|
|
14782
|
+
const configuredCopyEntries = Object.entries(config.copyEntries ?? {});
|
|
14783
|
+
for (const [platformName, configuredEntries] of configuredCopyEntries) {
|
|
14784
|
+
if (!copyPlatforms.has(platformName)) throw new Error(`Unsupported monolith copy entry platform "${platformName}"`);
|
|
14785
|
+
const platform = platformName;
|
|
14786
|
+
const platformDir = PATH.join(distDir, platform);
|
|
14787
|
+
for (const [output, source] of Object.entries(configuredEntries)) {
|
|
14788
|
+
if (output.length === 0) throw new Error(`Monolith copy entry for ${platform} has an empty output path`);
|
|
14789
|
+
if (source.length === 0) throw new Error(`Monolith copy entry "${output}" has an empty source`);
|
|
14790
|
+
if (PATH.isAbsolute(output)) throw new Error(`Monolith copy entry output must be relative: "${output}"`);
|
|
14791
|
+
const destination = PATH.resolve(platformDir, output);
|
|
14792
|
+
if (!isPathInside(platformDir, destination)) throw new Error(`Monolith copy entry output escapes dist/${platform}: "${output}"`);
|
|
14793
|
+
const normalizedOutput = PATH.relative(platformDir, destination).split(PATH.sep).join("/");
|
|
14794
|
+
entries.push({
|
|
14795
|
+
destination,
|
|
14796
|
+
output: normalizedOutput,
|
|
14797
|
+
platform,
|
|
14798
|
+
source,
|
|
14799
|
+
subpath: `./${normalizedOutput}`
|
|
14800
|
+
});
|
|
14801
|
+
}
|
|
14802
|
+
}
|
|
14803
|
+
return entries;
|
|
14804
|
+
}
|
|
14805
|
+
function resolveCopySource(packageDir, source) {
|
|
14806
|
+
let resolved;
|
|
14807
|
+
try {
|
|
14808
|
+
resolved = PATH.isAbsolute(source) || source.startsWith(".") ? PATH.resolve(packageDir, source) : createRequire(PATH.join(packageDir, "package.json")).resolve(source);
|
|
14809
|
+
} catch (reason) {
|
|
14810
|
+
const detail = reason instanceof Error ? reason.message : String(reason);
|
|
14811
|
+
throw new Error(`Unable to resolve monolith copy entry source "${source}": ${detail}`, { cause: reason });
|
|
14812
|
+
}
|
|
14813
|
+
if (!fs.existsSync(resolved) || !fs.statSync(resolved).isFile()) throw new Error(`Monolith copy entry source is not a file: "${source}" (${resolved})`);
|
|
14814
|
+
return resolved;
|
|
14815
|
+
}
|
|
14816
|
+
/** Copies configured opaque entries into their exact dist destinations. */
|
|
14817
|
+
function copyMonolithEntries(packageDir, config) {
|
|
14818
|
+
const entries = listMonolithCopyEntries(packageDir, config);
|
|
14819
|
+
for (const entry of entries) {
|
|
14820
|
+
const source = resolveCopySource(packageDir, entry.source);
|
|
14821
|
+
fs.mkdirSync(PATH.dirname(entry.destination), { recursive: true });
|
|
14822
|
+
fs.copyFileSync(source, entry.destination);
|
|
14823
|
+
}
|
|
14824
|
+
return entries.length;
|
|
14825
|
+
}
|
|
14826
|
+
//#endregion
|
|
14738
14827
|
//#region src/actions/package/compile/packageCompileMonolith.ts
|
|
14739
14828
|
function assertNoManualEntries(compile) {
|
|
14740
14829
|
if (compile.entryMode !== void 0) throw new Error("monolith mode computes entries; remove compile.entryMode");
|
|
@@ -14827,6 +14916,8 @@ const packageCompileMonolith = async (config, mode = {}) => {
|
|
|
14827
14916
|
if (isVerbose && flattened > 0) console.log(chalk.gray(`monolith pure reexport flatten: ${flattened} files`));
|
|
14828
14917
|
const rewritten = fixMonolithDeclarations(distDir, monolith);
|
|
14829
14918
|
if (isVerbose) console.log(chalk.gray(`monolith declaration fixups: ${rewritten} files`));
|
|
14919
|
+
const copied = copyMonolithEntries(packageDir, monolith);
|
|
14920
|
+
if (isVerbose && copied > 0) console.log(chalk.gray(`monolith copied entries: ${copied} files`));
|
|
14830
14921
|
const specifierProblems = verifyMonolithRuntimeSpecifiers(distDir, monolith);
|
|
14831
14922
|
if (specifierProblems.length > 0) {
|
|
14832
14923
|
for (const problem of specifierProblems) console.error(chalk.red(problem));
|
|
@@ -15722,10 +15813,22 @@ async function collectExpectedCompileOutputs(pkgDir) {
|
|
|
15722
15813
|
const compile = (await loadMergedWorkspaceConfig(pkgDir)).compile;
|
|
15723
15814
|
if (compile === void 0) return [];
|
|
15724
15815
|
const platforms = resolveCompilePlatforms(compile);
|
|
15816
|
+
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) => {
|
|
15817
|
+
const declarationFile = pairedDeclarationFile(entry.destination);
|
|
15818
|
+
return {
|
|
15819
|
+
entry: entry.output,
|
|
15820
|
+
isPrimaryIndex: false,
|
|
15821
|
+
platform: entry.platform,
|
|
15822
|
+
runtime: relativeExportsTarget(pkgDir, entry.destination),
|
|
15823
|
+
suggestedSubpath: entry.subpath,
|
|
15824
|
+
types: declarationFile === void 0 ? void 0 : relativeExportsTarget(pkgDir, declarationFile)
|
|
15825
|
+
};
|
|
15826
|
+
}) : [];
|
|
15725
15827
|
return [
|
|
15726
15828
|
...collectOutputsForPlatform(pkgDir, "node", platforms.node, compile),
|
|
15727
15829
|
...collectOutputsForPlatform(pkgDir, "browser", platforms.browser, compile),
|
|
15728
|
-
...collectOutputsForPlatform(pkgDir, "neutral", platforms.neutral, compile)
|
|
15830
|
+
...collectOutputsForPlatform(pkgDir, "neutral", platforms.neutral, compile),
|
|
15831
|
+
...copiedOutputs
|
|
15729
15832
|
];
|
|
15730
15833
|
}
|
|
15731
15834
|
//#endregion
|
|
@@ -15928,6 +16031,7 @@ function setConditionExport(subpathExport, platform, kind, target) {
|
|
|
15928
16031
|
if (conditionExport[kind] === void 0) conditionExport[kind] = target;
|
|
15929
16032
|
}
|
|
15930
16033
|
function preferredSubpath(expected) {
|
|
16034
|
+
if (expected.suggestedSubpath !== void 0) return expected.suggestedSubpath;
|
|
15931
16035
|
if (expected.isPrimaryIndex) return ".";
|
|
15932
16036
|
return `./${PATH.posix.parse(expected.runtime).name}`;
|
|
15933
16037
|
}
|