@ariestools/toolchain 8.7.8 → 8.7.10
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/analyzer/analyzePackage.d.ts.map +1 -1
- package/dist/actions/api-exposure/analyzer/entryPoints.d.ts.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.d.ts +0 -7
- package/dist/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.d.ts.map +1 -1
- package/dist/actions/deplint/snapshot.d.ts.map +1 -1
- package/dist/actions/package/compile/ApiExposureConfig.d.ts +6 -6
- package/dist/bin/xy.mjs +45 -95
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/lib/shouldRunInstall.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzePackage.d.ts","sourceRoot":"","sources":["../../../../src/actions/api-exposure/analyzer/analyzePackage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAOV,0BAA0B,EAC3B,MAAM,aAAa,CAAA;AAOpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGtD,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,MAAM,EAAE,2BAA2B,CAAA;IACnC,qEAAqE;IACrE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACtC,SAAS,EAAE,SAAS,CAAA;IACpB,oEAAoE;IACpE,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC7B;
|
|
1
|
+
{"version":3,"file":"analyzePackage.d.ts","sourceRoot":"","sources":["../../../../src/actions/api-exposure/analyzer/analyzePackage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,KAAK,EAOV,0BAA0B,EAC3B,MAAM,aAAa,CAAA;AAOpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGtD,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,MAAM,EAAE,2BAA2B,CAAA;IACnC,qEAAqE;IACrE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACtC,SAAS,EAAE,SAAS,CAAA;IACpB,oEAAoE;IACpE,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC7B;AAuYD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,GAC/D,EAAE,oBAAoB,GAAG,0BAA0B,CAuDnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entryPoints.d.ts","sourceRoot":"","sources":["../../../../src/actions/api-exposure/analyzer/entryPoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entryPoints.d.ts","sourceRoot":"","sources":["../../../../src/actions/api-exposure/analyzer/entryPoints.ts"],"names":[],"mappings":"AAmFA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBjE"}
|
|
@@ -20,13 +20,6 @@ export interface PeerSource {
|
|
|
20
20
|
export interface PeerForwardingPolicy {
|
|
21
21
|
importedModules: ReadonlySet<string>;
|
|
22
22
|
mode: 'always' | 'when-exposed' | 'when-used';
|
|
23
|
-
/**
|
|
24
|
-
* Peers vouched for by workspace-internal surfaces this package ships
|
|
25
|
-
* (see `getInternalSurfaceVouchedPeers`): a re-export barrel never names
|
|
26
|
-
* these in its own files, yet they flow through its public surface, so
|
|
27
|
-
* they forward even though `importedModules` cannot see them.
|
|
28
|
-
*/
|
|
29
|
-
vouchedPeers?: ReadonlySet<string>;
|
|
30
23
|
}
|
|
31
24
|
/** True when the policy (if any) obliges this package to forward `peer`. */
|
|
32
25
|
export declare function isPeerForwarded(policy: PeerForwardingPolicy | undefined, peer: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUnsatisfiedPeerDependencies.d.ts","sourceRoot":"","sources":["../../../../src/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAEhE,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACpC,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"getUnsatisfiedPeerDependencies.d.ts","sourceRoot":"","sources":["../../../../src/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MA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nC,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,4BAAiC,GACzC,uBAAuB,CAiGzB"}
|
|
@@ -50,12 +50,12 @@ export interface ApiExposureDependencyOverride {
|
|
|
50
50
|
* - `'always'`: every unmet chain peer is conclusively a `peerDependency`
|
|
51
51
|
* here (`aei.signal.required-peer`, ∞).
|
|
52
52
|
* - `'when-used'`: the conclusive rule fires only for chain peers this
|
|
53
|
-
* package itself imports or exposes through its public API;
|
|
54
|
-
*
|
|
55
|
-
* instead —
|
|
56
|
-
*
|
|
53
|
+
* package itself imports or directly exposes through its own public API;
|
|
54
|
+
* peers it inherits only through a re-exported package surface as the
|
|
55
|
+
* informational `aei.signal.inherited-peer` instead — that package owns
|
|
56
|
+
* the peer range and installers resolve its contract.
|
|
57
57
|
* - `'when-exposed'`: the conclusive rule fires only for chain peers whose
|
|
58
|
-
* types
|
|
58
|
+
* types this package directly exposes in its own public API or that it value-imports;
|
|
59
59
|
* untouched peers surface as the informational
|
|
60
60
|
* `aei.signal.absorbable-peer` — declaring them in this package's own
|
|
61
61
|
* `dependencies` (the provider pattern) discharges the contract without
|
|
@@ -79,7 +79,7 @@ export interface ApiExposureConfig {
|
|
|
79
79
|
packages?: Record<string, ApiExposureDependencyOverride>;
|
|
80
80
|
/**
|
|
81
81
|
* Peer-chain forwarding policy, honored by `xy api-exposure` and by
|
|
82
|
-
* `xy deplint` in `classifier: 'aei'` mode. @default '
|
|
82
|
+
* `xy deplint` in `classifier: 'aei'` mode. @default 'when-exposed'
|
|
83
83
|
*/
|
|
84
84
|
peerForwarding?: ApiExposurePeerForwarding;
|
|
85
85
|
/** Rule weight / enable-state overrides keyed by rule id. */
|
package/dist/bin/xy.mjs
CHANGED
|
@@ -20982,7 +20982,11 @@ function shouldRunInstall(cwd) {
|
|
|
20982
20982
|
},
|
|
20983
20983
|
cwd,
|
|
20984
20984
|
encoding: "utf8",
|
|
20985
|
-
stdio:
|
|
20985
|
+
stdio: isJsonMode() ? [
|
|
20986
|
+
"inherit",
|
|
20987
|
+
2,
|
|
20988
|
+
2
|
|
20989
|
+
] : "inherit"
|
|
20986
20990
|
}).status !== 0) {
|
|
20987
20991
|
console.warn(chalk.yellow(`${pm} install failed`));
|
|
20988
20992
|
return false;
|
|
@@ -23099,7 +23103,7 @@ function isTerminalPackage$1(location) {
|
|
|
23099
23103
|
//#region src/actions/deplint/checkPackage/getUnsatisfiedPeerDependencies.ts
|
|
23100
23104
|
/** True when the policy (if any) obliges this package to forward `peer`. */
|
|
23101
23105
|
function isPeerForwarded(policy, peer) {
|
|
23102
|
-
return policy === void 0 || policy.mode === "always" || policy.importedModules.has(peer)
|
|
23106
|
+
return policy === void 0 || policy.mode === "always" || policy.importedModules.has(peer);
|
|
23103
23107
|
}
|
|
23104
23108
|
function readDepPackageJson(location, dep) {
|
|
23105
23109
|
const depPkgPath = findDepPackageJson(location, dep);
|
|
@@ -23722,7 +23726,7 @@ function matchingOverrides(packages, dependency) {
|
|
|
23722
23726
|
});
|
|
23723
23727
|
return exact === void 0 ? globs : [...globs, exact];
|
|
23724
23728
|
}
|
|
23725
|
-
function resolvePeerForwarding(peerForwarding = "
|
|
23729
|
+
function resolvePeerForwarding(peerForwarding = "when-exposed") {
|
|
23726
23730
|
if (peerForwarding !== "always" && peerForwarding !== "when-used" && peerForwarding !== "when-exposed") throw new TypeError("commands.apiExposure.peerForwarding must be \"always\", \"when-used\", or \"when-exposed\"");
|
|
23727
23731
|
return peerForwarding;
|
|
23728
23732
|
}
|
|
@@ -24386,8 +24390,9 @@ function stripExtension(entry) {
|
|
|
24386
24390
|
/**
|
|
24387
24391
|
* Maps a manifest entry (usually pointing into `dist/`) back to the source
|
|
24388
24392
|
* file it was compiled from, following the XY layout convention:
|
|
24389
|
-
* `dist/<platform>/index.mjs` → `src
|
|
24390
|
-
* `src/
|
|
24393
|
+
* `dist/<platform>/index.mjs` → `src/<platform>/index.ts` when present,
|
|
24394
|
+
* otherwise `src/index.ts`; `dist/bin/xy.mjs` → `src/bin/xy.ts`;
|
|
24395
|
+
* `dist/index.d.ts` → `src/index.ts`.
|
|
24391
24396
|
*/
|
|
24392
24397
|
function mapEntryToSource(workspaceDir, entry) {
|
|
24393
24398
|
const normalized = entry.replace(/^\.\//, "");
|
|
@@ -24396,7 +24401,12 @@ function mapEntryToSource(workspaceDir, entry) {
|
|
|
24396
24401
|
if (segments[0] === "src") return resolveSourceFile(PATH.join(workspaceDir, ...segments));
|
|
24397
24402
|
if (segments[0] === "dist" || segments[0] === "build") {
|
|
24398
24403
|
let rest = segments.slice(1);
|
|
24399
|
-
if (rest.length > 0 && PLATFORM_DIRS.has(rest[0]))
|
|
24404
|
+
if (rest.length > 0 && PLATFORM_DIRS.has(rest[0])) {
|
|
24405
|
+
const platform = rest[0];
|
|
24406
|
+
rest = rest.slice(1);
|
|
24407
|
+
const platformSource = resolveSourceFile(PATH.join(workspaceDir, "src", platform, ...rest));
|
|
24408
|
+
if (platformSource !== void 0) return platformSource;
|
|
24409
|
+
}
|
|
24400
24410
|
return resolveSourceFile(PATH.join(workspaceDir, "src", ...rest));
|
|
24401
24411
|
}
|
|
24402
24412
|
return resolveSourceFile(PATH.join(workspaceDir, ...segments));
|
|
@@ -24956,13 +24966,29 @@ function requiredPeerEvidence(sources) {
|
|
|
24956
24966
|
const chains = [...new Set(sources.map((source) => source.chain?.join(" > ") ?? source.requiredBy))];
|
|
24957
24967
|
return `required as a peer by ${chains.slice(0, 3).join(", ")}${chains.length > 3 ? ` (+${chains.length - 3} more)` : ""}`;
|
|
24958
24968
|
}
|
|
24969
|
+
/** True when the finding was emitted from a file owned by this package. */
|
|
24970
|
+
function isWorkspaceOwnedFinding(workspaceDir, file) {
|
|
24971
|
+
if (file.startsWith("(")) return false;
|
|
24972
|
+
const workspaceRoot = PATH.resolve(workspaceDir);
|
|
24973
|
+
let current = PATH.dirname(PATH.resolve(workspaceRoot, file));
|
|
24974
|
+
while (true) {
|
|
24975
|
+
if (fs.existsSync(PATH.join(current, "package.json"))) return current === workspaceRoot;
|
|
24976
|
+
const parent = PATH.dirname(current);
|
|
24977
|
+
if (parent === current) return false;
|
|
24978
|
+
current = parent;
|
|
24979
|
+
}
|
|
24980
|
+
}
|
|
24959
24981
|
/**
|
|
24960
|
-
*
|
|
24961
|
-
*
|
|
24962
|
-
*
|
|
24982
|
+
* Direct exposure evidence for the evidence-based forwarding policies.
|
|
24983
|
+
*
|
|
24984
|
+
* The type walker deliberately follows re-exported dependency declarations.
|
|
24985
|
+
* Those findings are useful for describing the public API, but they do not
|
|
24986
|
+
* transfer ownership of a nested peer contract: the re-exported package owns
|
|
24987
|
+
* its peer range. Only exposure emitted from this package's own files means
|
|
24988
|
+
* this package directly names/constructs the peer's public identity.
|
|
24963
24989
|
*/
|
|
24964
|
-
function
|
|
24965
|
-
return raw.some((finding) => finding.ruleId.startsWith("aei.exposure.") && config.ruleFor(finding.ruleId, dependency)?.enabled === true);
|
|
24990
|
+
function hasEnabledOwnedExposure(raw, dependency, config, workspaceDir) {
|
|
24991
|
+
return raw.some((finding) => finding.ruleId.startsWith("aei.exposure.") && config.ruleFor(finding.ruleId, dependency)?.enabled === true && isWorkspaceOwnedFinding(workspaceDir, finding.file));
|
|
24966
24992
|
}
|
|
24967
24993
|
/**
|
|
24968
24994
|
* The distinct chain roots when every chain imposing the peer contract is
|
|
@@ -24980,12 +25006,11 @@ function typeOnlyChainRoots(peerSources, importedPackages) {
|
|
|
24980
25006
|
* forwarding policy (spec sections 6/8). Conclusive forwarding
|
|
24981
25007
|
* (`aei.signal.required-peer`, ∞) applies under `'always'`, whenever usage
|
|
24982
25008
|
* is unknown (no program), or when the policy's own-usage/exposure test
|
|
24983
|
-
* passes.
|
|
24984
|
-
*
|
|
24985
|
-
*
|
|
24986
|
-
*
|
|
24987
|
-
*
|
|
24988
|
-
* required here.
|
|
25009
|
+
* passes. Direct exposure is conclusive in both evidence-based modes. Types
|
|
25010
|
+
* merely inherited through a re-exported package remain that package's peer
|
|
25011
|
+
* contract; forwarding them again here would duplicate version ownership.
|
|
25012
|
+
* Otherwise the contract downgrades to the informational rule that best
|
|
25013
|
+
* explains why no forwarding is required here.
|
|
24989
25014
|
*/
|
|
24990
25015
|
function peerChainFinding({ config, dependency, hasExposure, importedPackages, peerSources }) {
|
|
24991
25016
|
const evidence = requiredPeerEvidence(peerSources);
|
|
@@ -25026,7 +25051,7 @@ function assessDependency({ config, dependency, importedPackages, isSelfOrIntern
|
|
|
25026
25051
|
if (peerSources !== void 0 && !isSelfOrInternal(dependency) && !sections.dependencies.has(dependency)) dependencyRaw.push(peerChainFinding({
|
|
25027
25052
|
config,
|
|
25028
25053
|
dependency,
|
|
25029
|
-
hasExposure:
|
|
25054
|
+
hasExposure: hasEnabledOwnedExposure(dependencyRaw, dependency, config, workspaceDir),
|
|
25030
25055
|
importedPackages,
|
|
25031
25056
|
peerSources
|
|
25032
25057
|
}));
|
|
@@ -30344,80 +30369,6 @@ async function loadDeplintRules(config) {
|
|
|
30344
30369
|
return normalizeDeplintRules(plugins.flatMap((plugin) => plugin.rules), config, new Set(builtInDeplintPlugin.rules.map((rule) => rule.id)));
|
|
30345
30370
|
}
|
|
30346
30371
|
//#endregion
|
|
30347
|
-
//#region src/actions/deplint/getInternalSurfaceVouchedPeers.ts
|
|
30348
|
-
/** Bound on recursion through nested workspace-internal surfaces. */
|
|
30349
|
-
const MAX_INTERNAL_SURFACE_DEPTH = 3;
|
|
30350
|
-
const surfaceImportsCache = /* @__PURE__ */ new Map();
|
|
30351
|
-
function resolveInternalSurface(baseDir, name) {
|
|
30352
|
-
const manifestPath = findDepPackageJson(baseDir, name);
|
|
30353
|
-
if (manifestPath === void 0) return void 0;
|
|
30354
|
-
try {
|
|
30355
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
30356
|
-
let dir = PATH.dirname(manifestPath);
|
|
30357
|
-
try {
|
|
30358
|
-
dir = fs.realpathSync(dir);
|
|
30359
|
-
} catch {}
|
|
30360
|
-
return {
|
|
30361
|
-
dir,
|
|
30362
|
-
peerDependencies: Object.keys(manifest.peerDependencies ?? {})
|
|
30363
|
-
};
|
|
30364
|
-
} catch {
|
|
30365
|
-
return;
|
|
30366
|
-
}
|
|
30367
|
-
}
|
|
30368
|
-
/**
|
|
30369
|
-
* External package names referenced by a package's shipped surface: import
|
|
30370
|
-
* specifiers in its dist runtime and emitted d.ts. Falls back to src when
|
|
30371
|
-
* no dist exists (unbuilt workspace), mirroring deplint's own fallback.
|
|
30372
|
-
*/
|
|
30373
|
-
function getSurfaceImports(dir) {
|
|
30374
|
-
const cached = surfaceImportsCache.get(dir);
|
|
30375
|
-
if (cached !== void 0) return cached;
|
|
30376
|
-
let files = findFilesByGlob(dir, "dist/**/*.{js,mjs,cjs,ts,mts,cts}", ["**/node_modules/**"]);
|
|
30377
|
-
if (files.length === 0) files = findFilesByGlob(dir, "src/**/*.{ts,tsx,mts,cts}", ["**/node_modules/**"]);
|
|
30378
|
-
const imports = /* @__PURE__ */ new Set();
|
|
30379
|
-
for (const file of files) {
|
|
30380
|
-
const [valueImports, typeImports] = getImportsFromFile(file, {}, {});
|
|
30381
|
-
for (const name of valueImports) imports.add(name);
|
|
30382
|
-
for (const name of typeImports) imports.add(name);
|
|
30383
|
-
}
|
|
30384
|
-
surfaceImportsCache.set(dir, imports);
|
|
30385
|
-
return imports;
|
|
30386
|
-
}
|
|
30387
|
-
/**
|
|
30388
|
-
* Peers vouched for by workspace-internal packages whose surface this
|
|
30389
|
-
* package ships. A pure re-export barrel never names the peers it
|
|
30390
|
-
* re-exposes in its own imports or emitted d.ts, so scan-based forwarding
|
|
30391
|
-
* evidence (`PeerForwardingPolicy.importedModules`) cannot see them. The
|
|
30392
|
-
* re-exported internal package's own shipped surface is the next-best
|
|
30393
|
-
* authority: any peer it declares AND references from its dist runtime or
|
|
30394
|
-
* emitted d.ts flows through every package that ships its surface.
|
|
30395
|
-
* Recurses through nested internal surfaces (a barrel re-exporting a
|
|
30396
|
-
* facade re-exporting core), depth-limited.
|
|
30397
|
-
*/
|
|
30398
|
-
function getInternalSurfaceVouchedPeers(location, shippedImports, workspaceNames) {
|
|
30399
|
-
const vouched = /* @__PURE__ */ new Set();
|
|
30400
|
-
const visited = /* @__PURE__ */ new Set();
|
|
30401
|
-
const visitSurface = ({ baseDir, name }) => {
|
|
30402
|
-
if (visited.has(name)) return [];
|
|
30403
|
-
visited.add(name);
|
|
30404
|
-
const surface = resolveInternalSurface(baseDir, name);
|
|
30405
|
-
if (surface === void 0) return [];
|
|
30406
|
-
const surfaceImports = getSurfaceImports(surface.dir);
|
|
30407
|
-
for (const peer of surface.peerDependencies) if (surfaceImports.has(peer)) vouched.add(peer);
|
|
30408
|
-
return [...surfaceImports].filter((imported) => workspaceNames.has(imported)).map((imported) => ({
|
|
30409
|
-
baseDir: surface.dir,
|
|
30410
|
-
name: imported
|
|
30411
|
-
}));
|
|
30412
|
-
};
|
|
30413
|
-
let frontier = [...new Set(shippedImports)].filter((name) => workspaceNames.has(name)).map((name) => ({
|
|
30414
|
-
baseDir: location,
|
|
30415
|
-
name
|
|
30416
|
-
}));
|
|
30417
|
-
for (let depth = 0; depth < MAX_INTERNAL_SURFACE_DEPTH && frontier.length > 0; depth++) frontier = frontier.flatMap((ref) => visitSurface(ref));
|
|
30418
|
-
return vouched;
|
|
30419
|
-
}
|
|
30420
|
-
//#endregion
|
|
30421
30372
|
//#region src/actions/deplint/snapshot.ts
|
|
30422
30373
|
function buildUnusedDependencyExclude(options, requiredTransitivePeers) {
|
|
30423
30374
|
return /* @__PURE__ */ new Set([
|
|
@@ -30494,15 +30445,14 @@ function buildWorkspaceContext(workspace, options = {}) {
|
|
|
30494
30445
|
const packageMetaStarted = performance.now();
|
|
30495
30446
|
const packageJsonPath = `${workspace.location}/package.json`;
|
|
30496
30447
|
const packageParams = getDependenciesFromPackageJson(packageJsonPath);
|
|
30497
|
-
const forwardingMode = options.classifier === "aei" ? options.apiExposureConfig?.peerForwarding ?? "
|
|
30448
|
+
const forwardingMode = options.classifier === "aei" ? options.apiExposureConfig?.peerForwarding ?? "when-exposed" : "always";
|
|
30498
30449
|
const peerForwarding = forwardingMode === "always" ? void 0 : {
|
|
30499
30450
|
importedModules: forwardingMode === "when-exposed" ? /* @__PURE__ */ new Set([...sourceParams.externalDistImports, ...sourceParams.externalDistTypeImports]) : /* @__PURE__ */ new Set([
|
|
30500
30451
|
...sourceParams.externalAllImports,
|
|
30501
30452
|
...sourceParams.externalDistImports,
|
|
30502
30453
|
...sourceParams.externalDistTypeImports
|
|
30503
30454
|
]),
|
|
30504
|
-
mode: forwardingMode
|
|
30505
|
-
vouchedPeers: options.workspaceNames === void 0 ? void 0 : getInternalSurfaceVouchedPeers(workspace.location, [...sourceParams.externalDistImports, ...sourceParams.externalDistTypeImports], options.workspaceNames)
|
|
30455
|
+
mode: forwardingMode
|
|
30506
30456
|
};
|
|
30507
30457
|
const requiredTransitivePeers = getRequiredNonOptionalTransitivePeers(workspace.location, packageParams);
|
|
30508
30458
|
const runtimeRootedRequired = new Set([...getRuntimeRootedNonOptionalTransitivePeers(workspace.location, packageParams)].filter((peer) => isPeerForwarded(peerForwarding, peer)));
|