@ariestools/toolchain 8.6.12 → 8.7.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/dist/actions/api-exposure/config.d.ts.map +1 -1
- package/dist/actions/deplint/packageJsonEditor.d.ts +1 -1
- package/dist/actions/deplint/ruleConfig.d.ts.map +1 -1
- package/dist/actions/deplint/types.d.ts +1 -1
- package/dist/actions/gitlint.d.ts +2 -0
- package/dist/actions/gitlint.d.ts.map +1 -1
- package/dist/actions/lintlint.d.ts +31 -0
- package/dist/actions/lintlint.d.ts.map +1 -1
- package/dist/actions/node-lint.d.ts +7 -0
- package/dist/actions/node-lint.d.ts.map +1 -1
- package/dist/actions/package/compile/MonolithConfig.d.ts +23 -4
- package/dist/actions/package/compile/MonolithConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/PublintConfig.d.ts +4 -2
- package/dist/actions/package/compile/PublintConfig.d.ts.map +1 -1
- package/dist/actions/package/compile/XyConfig.d.ts +18 -6
- 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/monolithCompileEntries.d.ts +8 -6
- package/dist/actions/package/compile/monolithCompileEntries.d.ts.map +1 -1
- package/dist/actions/package/compile/monolithCompileLayout.d.ts +2 -0
- package/dist/actions/package/compile/monolithCompileLayout.d.ts.map +1 -1
- package/dist/actions/package/compile/monolithReexport.d.ts +45 -0
- package/dist/actions/package/compile/monolithReexport.d.ts.map +1 -0
- package/dist/actions/package/compile/packageCompileMonolith.d.ts.map +1 -1
- package/dist/actions/package/publintRules.d.ts +4 -1
- package/dist/actions/package/publintRules.d.ts.map +1 -1
- package/dist/actions/package-lint.d.ts.map +1 -1
- package/dist/actions/packman/lint.d.ts +14 -0
- package/dist/actions/packman/lint.d.ts.map +1 -1
- package/dist/actions/ruleCatalog.d.ts +4 -2
- package/dist/actions/ruleCatalog.d.ts.map +1 -1
- package/dist/actions/ruleRunner.d.ts +4 -1
- package/dist/actions/ruleRunner.d.ts.map +1 -1
- package/dist/actions/skills/lint.d.ts +13 -0
- package/dist/actions/skills/lint.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +412 -55
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +249 -21
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +163 -34
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +249 -21
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +47 -7
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/xy.mjs +6942 -621
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/loadConfig.d.ts +1 -0
- package/dist/lib/loadConfig.d.ts.map +1 -1
- package/dist/lib/ruleCommandRegistry.d.ts +100 -0
- package/dist/lib/ruleCommandRegistry.d.ts.map +1 -0
- package/dist/xy/common/gitCommand.d.ts +3 -0
- package/dist/xy/common/gitCommand.d.ts.map +1 -0
- package/dist/xy/common/gitlintCommand.d.ts +2 -0
- package/dist/xy/common/gitlintCommand.d.ts.map +1 -1
- package/dist/xy/common/index.d.ts.map +1 -1
- package/dist/xy/deprecatedCommand.d.ts +2 -0
- package/dist/xy/deprecatedCommand.d.ts.map +1 -0
- package/dist/xy/lint/index.d.ts.map +1 -1
- package/dist/xy/lint/lint/index.d.ts.map +1 -1
- package/dist/xy/lint/lint/runCommand.d.ts.map +1 -1
- package/dist/xy/lint/lintlintCommand.d.ts +2 -0
- package/dist/xy/lint/lintlintCommand.d.ts.map +1 -1
- package/dist/xy/lint/nodeCommand.d.ts +3 -0
- package/dist/xy/lint/nodeCommand.d.ts.map +1 -0
- package/dist/xy/lint/nodeLintCommand.d.ts +2 -0
- package/dist/xy/lint/nodeLintCommand.d.ts.map +1 -1
- package/dist/xy/lint/publintCommand.d.ts.map +1 -1
- package/dist/xy/lint/relintCommand.d.ts.map +1 -1
- package/dist/xy/lint/republintCommand.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -12071,6 +12071,230 @@ const packageCompileEsbuild = async (config, mode = {}) => {
|
|
|
12071
12071
|
return nodeErrors + browserErrors + neutralErrors;
|
|
12072
12072
|
};
|
|
12073
12073
|
//#endregion
|
|
12074
|
+
//#region src/actions/package/compile/monolithReexport.ts
|
|
12075
|
+
function normalizeReexportTargets(value) {
|
|
12076
|
+
if (value === void 0) return [];
|
|
12077
|
+
return Array.isArray(value) ? value : [value];
|
|
12078
|
+
}
|
|
12079
|
+
/** Package-like specifier: not a hash alias and not a relative/absolute path. */
|
|
12080
|
+
function isPackageLikeSpecifier(spec) {
|
|
12081
|
+
return !spec.startsWith("#") && !spec.startsWith(".") && !spec.startsWith("/");
|
|
12082
|
+
}
|
|
12083
|
+
/** Configured `reexport` targets for a module, if any. */
|
|
12084
|
+
function moduleReexportTargets(mod) {
|
|
12085
|
+
return normalizeReexportTargets(mod.reexport);
|
|
12086
|
+
}
|
|
12087
|
+
function moduleHasReexport(mod) {
|
|
12088
|
+
return moduleReexportTargets(mod).length > 0;
|
|
12089
|
+
}
|
|
12090
|
+
/**
|
|
12091
|
+
* Master-barrel re-export targets for a module: explicit `barrelFrom`, else
|
|
12092
|
+
* `reexport`, else `#<name>`.
|
|
12093
|
+
*/
|
|
12094
|
+
function moduleBarrelTargets(mod) {
|
|
12095
|
+
const fromBarrel = normalizeReexportTargets(mod.barrelFrom);
|
|
12096
|
+
if (fromBarrel.length > 0) return fromBarrel;
|
|
12097
|
+
const fromReexport = moduleReexportTargets(mod);
|
|
12098
|
+
if (fromReexport.length > 0) return fromReexport;
|
|
12099
|
+
return [`#${mod.name}`];
|
|
12100
|
+
}
|
|
12101
|
+
/**
|
|
12102
|
+
* Subpath shim re-export targets: explicit `shimFrom`, else `reexport`, else
|
|
12103
|
+
* `#<name>`.
|
|
12104
|
+
*/
|
|
12105
|
+
function moduleShimTargets(mod) {
|
|
12106
|
+
const fromShim = normalizeReexportTargets(mod.shimFrom);
|
|
12107
|
+
if (fromShim.length > 0) return fromShim;
|
|
12108
|
+
const fromReexport = moduleReexportTargets(mod);
|
|
12109
|
+
if (fromReexport.length > 0) return fromReexport;
|
|
12110
|
+
return [`#${mod.name}`];
|
|
12111
|
+
}
|
|
12112
|
+
/** Builds a pure star-reexport TypeScript (or mjs) source body (no header). */
|
|
12113
|
+
function buildStarReexportLines(targets, options = {}) {
|
|
12114
|
+
const semi = options.semi === false ? "" : ";";
|
|
12115
|
+
return `${targets.map((target) => `export * from '${target}'${semi}`).join("\n")}\n`;
|
|
12116
|
+
}
|
|
12117
|
+
const starExportLineRe = /^export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?\s*$/;
|
|
12118
|
+
function isSkippableSourceLine(line) {
|
|
12119
|
+
if (line.length === 0) return true;
|
|
12120
|
+
if (line.startsWith("//")) return true;
|
|
12121
|
+
if (line.startsWith("/*") || line.startsWith("*") || line.startsWith("*/")) return true;
|
|
12122
|
+
return false;
|
|
12123
|
+
}
|
|
12124
|
+
/**
|
|
12125
|
+
* If `source` is only star re-exports (plus blank lines / `//` comments /
|
|
12126
|
+
* generated header), returns the targets in order. Otherwise `null`.
|
|
12127
|
+
*/
|
|
12128
|
+
function parsePureStarReexports(source) {
|
|
12129
|
+
const targets = [];
|
|
12130
|
+
for (const rawLine of source.split("\n")) {
|
|
12131
|
+
const line = rawLine.trim();
|
|
12132
|
+
if (isSkippableSourceLine(line)) continue;
|
|
12133
|
+
const match = starExportLineRe.exec(line);
|
|
12134
|
+
if (match === null) return null;
|
|
12135
|
+
targets.push(match[1]);
|
|
12136
|
+
}
|
|
12137
|
+
return targets.length > 0 ? targets : null;
|
|
12138
|
+
}
|
|
12139
|
+
function moduleIndexSourcePath(packageDir, moduleName) {
|
|
12140
|
+
return PATH.join(packageDir, "src", "modules", moduleName, "index.ts");
|
|
12141
|
+
}
|
|
12142
|
+
function hashModuleParts(spec) {
|
|
12143
|
+
const [modName, sub] = spec.slice(1).split("/", 2);
|
|
12144
|
+
return {
|
|
12145
|
+
modName,
|
|
12146
|
+
sub
|
|
12147
|
+
};
|
|
12148
|
+
}
|
|
12149
|
+
function resolveHashToModuleFile(packageDir, spec, config) {
|
|
12150
|
+
const { modName, sub } = hashModuleParts(spec);
|
|
12151
|
+
if (config.aliasImports?.[spec] !== void 0) {
|
|
12152
|
+
const alias = config.aliasImports[spec].replace(/^\.\//, "");
|
|
12153
|
+
return PATH.join(packageDir, alias);
|
|
12154
|
+
}
|
|
12155
|
+
if (sub === void 0) return moduleIndexSourcePath(packageDir, modName);
|
|
12156
|
+
if (sub === "model") return PATH.join(packageDir, "src", "modules", modName, "model.ts");
|
|
12157
|
+
return PATH.join(packageDir, "src", "modules", modName, `${sub}.ts`);
|
|
12158
|
+
}
|
|
12159
|
+
function expandNestedSource(file, packageDir, config, seen) {
|
|
12160
|
+
if (!fs.existsSync(file)) return null;
|
|
12161
|
+
const nested = parsePureStarReexports(fs.readFileSync(file, "utf8"));
|
|
12162
|
+
if (nested === null) return null;
|
|
12163
|
+
return expandToPackageReexportTargets(nested, packageDir, config, seen);
|
|
12164
|
+
}
|
|
12165
|
+
function expandHashTarget(target, packageDir, config, seen) {
|
|
12166
|
+
const { modName, sub } = hashModuleParts(target);
|
|
12167
|
+
const mod = config.modules.find((candidate) => candidate.name === modName);
|
|
12168
|
+
if (mod !== void 0 && moduleHasReexport(mod) && sub === void 0) return expandToPackageReexportTargets(moduleReexportTargets(mod), packageDir, config, seen);
|
|
12169
|
+
const file = resolveHashToModuleFile(packageDir, target, config);
|
|
12170
|
+
if (file === null) return null;
|
|
12171
|
+
return expandNestedSource(file, packageDir, config, seen);
|
|
12172
|
+
}
|
|
12173
|
+
function expandRelativeTarget(target, packageDir, config, seen) {
|
|
12174
|
+
const base = PATH.resolve(packageDir, "src", target.replace(/^\.\//, ""));
|
|
12175
|
+
const existing = [
|
|
12176
|
+
base,
|
|
12177
|
+
`${base}.ts`,
|
|
12178
|
+
`${base}.tsx`,
|
|
12179
|
+
PATH.join(base, "index.ts")
|
|
12180
|
+
].find((candidate) => fs.existsSync(candidate));
|
|
12181
|
+
if (existing === void 0) return null;
|
|
12182
|
+
return expandNestedSource(existing, packageDir, config, seen);
|
|
12183
|
+
}
|
|
12184
|
+
/**
|
|
12185
|
+
* Expands pure star-reexport targets until only package-like specifiers remain.
|
|
12186
|
+
* Returns `null` if any hop has local implementation or unreadable sources.
|
|
12187
|
+
*/
|
|
12188
|
+
function expandToPackageReexportTargets(targets, packageDir, config, seen = /* @__PURE__ */ new Set()) {
|
|
12189
|
+
const out = [];
|
|
12190
|
+
for (const target of targets) {
|
|
12191
|
+
if (seen.has(target)) continue;
|
|
12192
|
+
seen.add(target);
|
|
12193
|
+
if (isPackageLikeSpecifier(target)) {
|
|
12194
|
+
out.push(target);
|
|
12195
|
+
continue;
|
|
12196
|
+
}
|
|
12197
|
+
const expanded = target.startsWith("#") ? expandHashTarget(target, packageDir, config, seen) : target.startsWith(".") ? expandRelativeTarget(target, packageDir, config, seen) : null;
|
|
12198
|
+
if (expanded === null) return null;
|
|
12199
|
+
out.push(...expanded);
|
|
12200
|
+
}
|
|
12201
|
+
return out;
|
|
12202
|
+
}
|
|
12203
|
+
/**
|
|
12204
|
+
* Resolves pure package reexport targets for a module from config and/or source.
|
|
12205
|
+
*/
|
|
12206
|
+
function resolveModulePackageReexports(mod, packageDir, config) {
|
|
12207
|
+
if (moduleHasReexport(mod)) return expandToPackageReexportTargets(moduleReexportTargets(mod), packageDir, config);
|
|
12208
|
+
const file = moduleIndexSourcePath(packageDir, mod.name);
|
|
12209
|
+
if (!fs.existsSync(file)) return null;
|
|
12210
|
+
const targets = parsePureStarReexports(fs.readFileSync(file, "utf8"));
|
|
12211
|
+
if (targets === null) return null;
|
|
12212
|
+
return expandToPackageReexportTargets(targets, packageDir, config);
|
|
12213
|
+
}
|
|
12214
|
+
function walkMjs$1(dir, out = []) {
|
|
12215
|
+
if (!fs.existsSync(dir)) return out;
|
|
12216
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
12217
|
+
for (const entry of entries) {
|
|
12218
|
+
const fp = PATH.join(dir, entry.name);
|
|
12219
|
+
if (entry.isDirectory()) walkMjs$1(fp, out);
|
|
12220
|
+
else if (entry.name.endsWith(".mjs")) out.push(fp);
|
|
12221
|
+
}
|
|
12222
|
+
return out;
|
|
12223
|
+
}
|
|
12224
|
+
function writePureReexportMjs(filePath, targets) {
|
|
12225
|
+
fs.mkdirSync(PATH.dirname(filePath), { recursive: true });
|
|
12226
|
+
fs.writeFileSync(filePath, buildStarReexportLines(targets, { semi: true }));
|
|
12227
|
+
}
|
|
12228
|
+
function collectPackageTargetsByModule(packageDir, config) {
|
|
12229
|
+
const packageTargetsByModule = /* @__PURE__ */ new Map();
|
|
12230
|
+
for (const mod of config.modules) {
|
|
12231
|
+
if (!(mod.export ?? false) && !(mod.barrel ?? false)) continue;
|
|
12232
|
+
const targets = resolveModulePackageReexports(mod, packageDir, config);
|
|
12233
|
+
if (targets !== null && targets.length > 0) packageTargetsByModule.set(mod.name, targets);
|
|
12234
|
+
}
|
|
12235
|
+
return packageTargetsByModule;
|
|
12236
|
+
}
|
|
12237
|
+
function resolveBarrelModuleTargets(mod, packageDir, config, packageTargetsByModule) {
|
|
12238
|
+
const fromBarrel = normalizeReexportTargets(mod.barrelFrom);
|
|
12239
|
+
if (fromBarrel.length > 0) return expandToPackageReexportTargets(fromBarrel, packageDir, config);
|
|
12240
|
+
return packageTargetsByModule.get(mod.name) ?? null;
|
|
12241
|
+
}
|
|
12242
|
+
function resolveIndexPackageTargets(packageDir, config, packageTargetsByModule) {
|
|
12243
|
+
const barrelModules = config.modules.filter((mod) => mod.barrel ?? false).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
12244
|
+
const indexTargets = [...config.barrelImports ?? []];
|
|
12245
|
+
for (const mod of barrelModules) {
|
|
12246
|
+
const moduleTargets = resolveBarrelModuleTargets(mod, packageDir, config, packageTargetsByModule);
|
|
12247
|
+
if (moduleTargets === null) return null;
|
|
12248
|
+
indexTargets.push(...moduleTargets);
|
|
12249
|
+
}
|
|
12250
|
+
return indexTargets;
|
|
12251
|
+
}
|
|
12252
|
+
function rewriteModuleReexportMjs(distDir, modulesPlatform, packageTargetsByModule) {
|
|
12253
|
+
let rewritten = 0;
|
|
12254
|
+
for (const [name, targets] of packageTargetsByModule) {
|
|
12255
|
+
const file = PATH.join(distDir, modulesPlatform, `${name}.mjs`);
|
|
12256
|
+
if (!fs.existsSync(file)) continue;
|
|
12257
|
+
writePureReexportMjs(file, targets);
|
|
12258
|
+
rewritten++;
|
|
12259
|
+
}
|
|
12260
|
+
return rewritten;
|
|
12261
|
+
}
|
|
12262
|
+
function rewriteIndexReexportMjs(distDir, platforms, indexTargets) {
|
|
12263
|
+
let rewritten = 0;
|
|
12264
|
+
for (const platform of platforms) {
|
|
12265
|
+
const file = PATH.join(distDir, platform, "index.mjs");
|
|
12266
|
+
if (!fs.existsSync(file)) continue;
|
|
12267
|
+
writePureReexportMjs(file, indexTargets);
|
|
12268
|
+
rewritten++;
|
|
12269
|
+
}
|
|
12270
|
+
for (const file of walkMjs$1(distDir)) {
|
|
12271
|
+
const base = PATH.basename(file);
|
|
12272
|
+
if (!base.startsWith("index") || !base.endsWith(".mjs") || base === "index.mjs") continue;
|
|
12273
|
+
writePureReexportMjs(file, indexTargets);
|
|
12274
|
+
rewritten++;
|
|
12275
|
+
}
|
|
12276
|
+
return rewritten;
|
|
12277
|
+
}
|
|
12278
|
+
/**
|
|
12279
|
+
* After esbuild, rewrite known pure package-facade entries to `export * from`
|
|
12280
|
+
* form. esbuild preserves star re-exports only on the entry file; multi-hop
|
|
12281
|
+
* `#module` chains become `__reExport` helpers that break Storybook/Vite
|
|
12282
|
+
* analysis. Returns the number of files rewritten.
|
|
12283
|
+
*/
|
|
12284
|
+
function flattenPurePackageReexportMjs(distDir, packageDir, config) {
|
|
12285
|
+
const modulesPlatform = config.modulesPlatform ?? "neutral";
|
|
12286
|
+
const platforms = config.platforms ?? [
|
|
12287
|
+
"neutral",
|
|
12288
|
+
"node",
|
|
12289
|
+
"browser"
|
|
12290
|
+
];
|
|
12291
|
+
const packageTargetsByModule = collectPackageTargetsByModule(packageDir, config);
|
|
12292
|
+
let rewritten = rewriteModuleReexportMjs(distDir, modulesPlatform, packageTargetsByModule);
|
|
12293
|
+
const indexTargets = resolveIndexPackageTargets(packageDir, config, packageTargetsByModule);
|
|
12294
|
+
if (indexTargets !== null && indexTargets.length > 0) rewritten += rewriteIndexReexportMjs(distDir, platforms, indexTargets);
|
|
12295
|
+
return rewritten;
|
|
12296
|
+
}
|
|
12297
|
+
//#endregion
|
|
12074
12298
|
//#region src/actions/package/compile/monolithCompileLayout.ts
|
|
12075
12299
|
/**
|
|
12076
12300
|
* Layout generation for `compile.mode: 'monolith'` — a 1:1 port of the
|
|
@@ -12177,10 +12401,7 @@ function buildIndexTs(modules, config) {
|
|
|
12177
12401
|
const hasConditional = Object.keys(config.conditionalImports ?? {}).length > 0;
|
|
12178
12402
|
const barrelModules = modules.filter((mod) => mod.barrel ?? false).toSorted((a, b) => a.name.localeCompare(b.name));
|
|
12179
12403
|
const lines = (config.barrelImports ?? []).map((spec) => `export * from '${spec}'`);
|
|
12180
|
-
for (const mod of barrelModules) {
|
|
12181
|
-
const target = mod.barrelFrom ?? `#${mod.name}`;
|
|
12182
|
-
lines.push(`export * from '${target}'`);
|
|
12183
|
-
}
|
|
12404
|
+
for (const mod of barrelModules) for (const target of moduleBarrelTargets(mod)) lines.push(`export * from '${target}'`);
|
|
12184
12405
|
return `${GENERATED_HEADER}${hasConditional ? "/* eslint-disable @typescript-eslint/ban-ts-comment -- conditional package imports */\n// @ts-nocheck\n" : ""}${lines.join("\n")}
|
|
12185
12406
|
`;
|
|
12186
12407
|
}
|
|
@@ -12190,9 +12411,11 @@ function buildModelTs(modules) {
|
|
|
12190
12411
|
`;
|
|
12191
12412
|
}
|
|
12192
12413
|
function buildModuleShim(mod) {
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12414
|
+
return `${GENERATED_HEADER}${buildStarReexportLines(moduleShimTargets(mod), { semi: false })}`;
|
|
12415
|
+
}
|
|
12416
|
+
/** Generated module body for facade modules with `reexport` targets. */
|
|
12417
|
+
function buildModuleReexportIndex(mod) {
|
|
12418
|
+
return `${GENERATED_HEADER}${buildStarReexportLines(moduleReexportTargets(mod), { semi: false })}`;
|
|
12196
12419
|
}
|
|
12197
12420
|
function buildModelShim(mod) {
|
|
12198
12421
|
return `${GENERATED_HEADER}export type * from '#${mod.name}/model'
|
|
@@ -12257,6 +12480,7 @@ function syncMonolithLayout(packageDir, config, options = {}) {
|
|
|
12257
12480
|
if (!(config.index?.custom ?? false)) writeOrCheck(PATH.join(packageDir, "src/index.ts"), buildIndexTs(modules, config));
|
|
12258
12481
|
if (monolithHasModelBarrel(config)) writeOrCheck(PATH.join(packageDir, "src/model.ts"), buildModelTs(modules));
|
|
12259
12482
|
for (const mod of modules) {
|
|
12483
|
+
if (moduleHasReexport(mod)) writeOrCheck(PATH.join(packageDir, "src", "modules", mod.name, "index.ts"), buildModuleReexportIndex(mod));
|
|
12260
12484
|
if (!(mod.export ?? false)) continue;
|
|
12261
12485
|
writeOrCheck(PATH.join(packageDir, `src/${mod.name}.ts`), buildModuleShim(mod));
|
|
12262
12486
|
if (mod.model ?? false) writeOrCheck(PATH.join(packageDir, `src/${mod.name}.model.ts`), buildModelShim(mod));
|
|
@@ -12419,15 +12643,14 @@ function moduleShimEntries(mod, isDirectIndex, isExternal) {
|
|
|
12419
12643
|
return shims;
|
|
12420
12644
|
}
|
|
12421
12645
|
/**
|
|
12422
|
-
*
|
|
12423
|
-
*
|
|
12424
|
-
*
|
|
12425
|
-
*
|
|
12426
|
-
* re-export its own output — compile the default source directly instead.
|
|
12646
|
+
* Prefer compiling `modules/<name>/index.ts` directly when star re-exports
|
|
12647
|
+
* must stay as `export * from` on the entry (esbuild lowers multi-hop stars
|
|
12648
|
+
* into `__reExport` helpers). Used for external linkage, facade `reexport`
|
|
12649
|
+
* modules, and pure package facades that would otherwise hop through shims.
|
|
12427
12650
|
*/
|
|
12428
12651
|
function modulesPlatformEntries(mod, config, isExternal, modulesPlatform) {
|
|
12429
12652
|
const conditional = config.conditionalImports?.[mod.name];
|
|
12430
|
-
let isDirectIndex = isExternal && conditional === void 0;
|
|
12653
|
+
let isDirectIndex = (isExternal || moduleHasReexport(mod)) && conditional === void 0;
|
|
12431
12654
|
let directIn = `./modules/${mod.name}/index.ts`;
|
|
12432
12655
|
if (isExternal && conditional?.distImports?.default === `./dist/${modulesPlatform}/${mod.name}.mjs`) {
|
|
12433
12656
|
isDirectIndex = true;
|
|
@@ -12465,12 +12688,14 @@ function platformShimEntry(platform, name, target, isExternal) {
|
|
|
12465
12688
|
* a conditional `#import` skip the modules-platform entry — the subpath
|
|
12466
12689
|
* shim already resolves the default condition.
|
|
12467
12690
|
*
|
|
12468
|
-
* With `moduleLinkage: 'external'`
|
|
12469
|
-
* the generated one-line shims and target the module files
|
|
12470
|
-
* `{in, out}` pairs: esbuild only preserves
|
|
12471
|
-
* when it appears in the entry file itself — routed
|
|
12472
|
-
* re-export
|
|
12473
|
-
* remain the tsc declaration sources for the same dist names.
|
|
12691
|
+
* With `moduleLinkage: 'external'` or module `reexport` facades, subpath
|
|
12692
|
+
* entries bypass the generated one-line shims and target the module files
|
|
12693
|
+
* directly via `{in, out}` pairs: esbuild only preserves
|
|
12694
|
+
* `export * from '…'` when it appears in the entry file itself — routed
|
|
12695
|
+
* through an intermediate re-export the star is lowered to `__reExport`
|
|
12696
|
+
* helpers. Shims remain the tsc declaration sources for the same dist names.
|
|
12697
|
+
* After esbuild, pure package-facade graphs are also flattened in
|
|
12698
|
+
* {@link flattenPurePackageReexportMjs} so multi-hop barrels stay clean.
|
|
12474
12699
|
*/
|
|
12475
12700
|
function buildMonolithEntries(config) {
|
|
12476
12701
|
const { conditionalImports = {}, modules, platformEntries = {} } = config;
|
|
@@ -12578,9 +12803,12 @@ const packageCompileMonolith = async (config, mode = {}) => {
|
|
|
12578
12803
|
if (!shouldEmit) return 0;
|
|
12579
12804
|
const compileResult = await packageCompileEsbuild(deriveEsbuildConfig(config, compile, monolith), { emitOnly: true });
|
|
12580
12805
|
if (compileResult !== 0) return compileResult;
|
|
12581
|
-
const
|
|
12806
|
+
const distDir = PATH.join(packageDir, "dist");
|
|
12807
|
+
const flattened = flattenPurePackageReexportMjs(distDir, packageDir, monolith);
|
|
12808
|
+
if (isVerbose && flattened > 0) console.log(chalk.gray(`monolith pure reexport flatten: ${flattened} files`));
|
|
12809
|
+
const rewritten = fixMonolithDeclarations(distDir, monolith);
|
|
12582
12810
|
if (isVerbose) console.log(chalk.gray(`monolith declaration fixups: ${rewritten} files`));
|
|
12583
|
-
const specifierProblems = verifyMonolithRuntimeSpecifiers(
|
|
12811
|
+
const specifierProblems = verifyMonolithRuntimeSpecifiers(distDir, monolith);
|
|
12584
12812
|
if (specifierProblems.length > 0) {
|
|
12585
12813
|
for (const problem of specifierProblems) console.error(chalk.red(problem));
|
|
12586
12814
|
return 1;
|