@elmeragroup/internal 0.2.0-canary.6 → 0.2.0-canary.8
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/api-extractor.mjs +1 -1
- package/dist/{dist-BGENubi7.mjs → dist-DcTc0uUY.mjs} +31 -53
- package/dist/{dist-DR31PLLJ.mjs → dist-hTVexsRM.mjs} +27 -32
- package/dist/{errors-CTGk3BUR.mjs → errors-D_qG2JhN.mjs} +2 -22
- package/dist/index.mjs +2 -2
- package/dist/release.mjs +40 -28
- package/package.json +2 -2
package/dist/api-extractor.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as ComponentSourceUnresolvedSchema, C as ComponentSourceDefaultSchema, D as ComponentSourceResultSchema, E as ComponentSourceResolvedSchema, O as ComponentSourceResultsSchema, S as FileNotInProgramError, T as ComponentSourceRequestSchema, _ as UnresolvedReExportWarningSchema, a as SemanticTypeSchema, b as ConfigError, c as ProvenanceEntrySchema, d as MissingDefaultExportSymbolWarningSchema, f as MissingEnumDeclarationWarningSchema, g as UnrepresentedConstructSignaturesWarningSchema, h as UncertainComponentRecognitionWarningSchema, i as ModuleNodeSchema, k as ComponentSourceUnresolvedReasonSchema, l as ProvenanceSchema, m as OmittedIndexSignatureWarningSchema, n as defaultExtractorOptions, o as DeclarationOwnerSchema, p as OmittedCallableMembersWarningSchema, r as ExtractionResultSchema, s as ProvenanceDeclarationSchema, t as ProjectExtractor, u as ExtractWarningSchema, v as UnsupportedTypeFallbackWarningSchema, w as ComponentSourceForwardedSchema, x as ExtractError, y as BackendError } from "./dist-
|
|
2
|
+
import { A as ComponentSourceUnresolvedSchema, C as ComponentSourceDefaultSchema, D as ComponentSourceResultSchema, E as ComponentSourceResolvedSchema, O as ComponentSourceResultsSchema, S as FileNotInProgramError, T as ComponentSourceRequestSchema, _ as UnresolvedReExportWarningSchema, a as SemanticTypeSchema, b as ConfigError, c as ProvenanceEntrySchema, d as MissingDefaultExportSymbolWarningSchema, f as MissingEnumDeclarationWarningSchema, g as UnrepresentedConstructSignaturesWarningSchema, h as UncertainComponentRecognitionWarningSchema, i as ModuleNodeSchema, k as ComponentSourceUnresolvedReasonSchema, l as ProvenanceSchema, m as OmittedIndexSignatureWarningSchema, n as defaultExtractorOptions, o as DeclarationOwnerSchema, p as OmittedCallableMembersWarningSchema, r as ExtractionResultSchema, s as ProvenanceDeclarationSchema, t as ProjectExtractor, u as ExtractWarningSchema, v as UnsupportedTypeFallbackWarningSchema, w as ComponentSourceForwardedSchema, x as ExtractError, y as BackendError } from "./dist-DcTc0uUY.mjs";
|
|
3
3
|
export { BackendError, ComponentSourceDefaultSchema, ComponentSourceForwardedSchema, ComponentSourceRequestSchema, ComponentSourceResolvedSchema, ComponentSourceResultSchema, ComponentSourceResultsSchema, ComponentSourceUnresolvedReasonSchema, ComponentSourceUnresolvedSchema, ConfigError, DeclarationOwnerSchema, ExtractError, ExtractWarningSchema, ExtractionResultSchema, FileNotInProgramError, MissingDefaultExportSymbolWarningSchema, MissingEnumDeclarationWarningSchema, ModuleNodeSchema, OmittedCallableMembersWarningSchema, OmittedIndexSignatureWarningSchema, ProjectExtractor, ProvenanceDeclarationSchema, ProvenanceEntrySchema, ProvenanceSchema, SemanticTypeSchema, UncertainComponentRecognitionWarningSchema, UnrepresentedConstructSignaturesWarningSchema, UnresolvedReExportWarningSchema, UnsupportedTypeFallbackWarningSchema, defaultExtractorOptions };
|
|
@@ -548,16 +548,12 @@ function valueOrFirstDeclarationHandle(symbol) {
|
|
|
548
548
|
* library-directory tests); they are normalized here so resolver code asks
|
|
549
549
|
* "who owns this declaration" and never matches paths itself.
|
|
550
550
|
*/
|
|
551
|
-
function declarationOwnership
|
|
552
|
-
return
|
|
553
|
-
}
|
|
554
|
-
/** Classifies a declaration handle's path without resolving its AST subtree. */
|
|
555
|
-
function declarationOwnershipOfPath(session, filePath) {
|
|
556
|
-
return session.ownershipOfPath(filePath);
|
|
551
|
+
function declarationOwnership(session, handle) {
|
|
552
|
+
return session.ownershipOfPath(session.nodePath(handle));
|
|
557
553
|
}
|
|
558
554
|
/** Whether a raw compiler declaration belongs outside the extracted project. */
|
|
559
555
|
function isExternalDeclaration(session, declaration) {
|
|
560
|
-
return isExternalOwnership(
|
|
556
|
+
return isExternalOwnership(session.ownershipOfPath(declaration.path));
|
|
561
557
|
}
|
|
562
558
|
/**
|
|
563
559
|
* Uses the compiler's default-library metadata for the strict library gate.
|
|
@@ -565,28 +561,20 @@ function isExternalDeclaration(session, declaration) {
|
|
|
565
561
|
* callers cannot accidentally reintroduce a source-path probe.
|
|
566
562
|
*/
|
|
567
563
|
function isTypeScriptLibraryDeclaration(session, declaration) {
|
|
568
|
-
const ownership =
|
|
564
|
+
const ownership = session.ownershipOfPath(declaration.path);
|
|
569
565
|
return ownership.kind === "typescript" && ownership.library === "standard-library";
|
|
570
566
|
}
|
|
571
567
|
/**
|
|
572
|
-
* Classifies a source file with the compiler's optional ownership metadata.
|
|
573
|
-
* An absent metadata record deliberately keeps the path fallback in
|
|
574
|
-
* `classifySourceFile`; an explicit record is authoritative, including two
|
|
575
|
-
* `false` flags for a project file whose path resembles TypeScript's library.
|
|
576
|
-
*/
|
|
577
|
-
function sourceFileOwnership(filePath, metadata) {
|
|
578
|
-
return classifySourceFile(filePath, metadata === void 0 ? void 0 : {
|
|
579
|
-
externalLibrary: metadata.isFromExternalLibrary,
|
|
580
|
-
defaultLibrary: metadata.isDefaultLibrary
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
568
|
* Classifies one source-file path into the ownership facts the contract
|
|
585
569
|
* defines. The three tests mirror the questions the resolver previously asked
|
|
586
570
|
* inline: packaged sources under any `node_modules` segment are external;
|
|
587
571
|
* TypeScript's own library files (`…/typescript/lib/…`, including
|
|
588
572
|
* `@typescript` toolchain installs) are the standard library; and the wider
|
|
589
573
|
* toolchain question accepts any TypeScript installation's lib directory.
|
|
574
|
+
*
|
|
575
|
+
* An absent metadata record deliberately keeps the path fallback; an explicit
|
|
576
|
+
* record from the compiler is authoritative, including two `false` flags for a
|
|
577
|
+
* project file whose path resembles TypeScript's library.
|
|
590
578
|
*/
|
|
591
579
|
function classifySourceFile(filePath, metadata) {
|
|
592
580
|
const pathSegments = filePath.replaceAll("\\", "/").split("/").filter((segment) => segment.length > 0);
|
|
@@ -594,8 +582,8 @@ function classifySourceFile(filePath, metadata) {
|
|
|
594
582
|
const fileName = pathSegments[pathSegments.length - 1] ?? "";
|
|
595
583
|
const pathExternal = pathSegments.includes("node_modules");
|
|
596
584
|
const pathStandardLibrary = pathTypescriptLibDirectory && /^lib\..+\.d\.ts$/u.test(fileName);
|
|
597
|
-
const external = metadata === void 0 ? pathExternal : metadata.
|
|
598
|
-
const standardLibrary = metadata?.
|
|
585
|
+
const external = metadata === void 0 ? pathExternal : metadata.isFromExternalLibrary || metadata.isDefaultLibrary;
|
|
586
|
+
const standardLibrary = metadata?.isDefaultLibrary ?? pathStandardLibrary;
|
|
599
587
|
const typescriptLibDirectory = pathTypescriptLibDirectory && (metadata === void 0 || external || standardLibrary);
|
|
600
588
|
if (standardLibrary) return {
|
|
601
589
|
kind: "typescript",
|
|
@@ -1238,7 +1226,8 @@ function moduleIsExternal(session, symbol) {
|
|
|
1238
1226
|
* see one origin. Project declarations intentionally have no origin.
|
|
1239
1227
|
*/
|
|
1240
1228
|
function declarationOrigin(session, declaration) {
|
|
1241
|
-
|
|
1229
|
+
const sourceFile = declaration.getSourceFile();
|
|
1230
|
+
return moduleOriginFromOwnership(session.ownershipOfPath(sourceFile.fileName));
|
|
1242
1231
|
}
|
|
1243
1232
|
function moduleOriginFromOwnership(ownership) {
|
|
1244
1233
|
if (ownership.kind === "project") return void 0;
|
|
@@ -1270,7 +1259,7 @@ function declarationOriginWithoutMaterialization(session, declaration) {
|
|
|
1270
1259
|
const pathIsStandardLibrary = pathOwnership.kind === "typescript" && pathOwnership.library === "standard-library";
|
|
1271
1260
|
const declarationHasNoAuthoredSource = declaration.kind === SyntaxKind.InterfaceDeclaration || declaration.kind === SyntaxKind.TypeAliasDeclaration;
|
|
1272
1261
|
if (!pathIsStandardLibrary && !declarationHasNoAuthoredSource) return;
|
|
1273
|
-
const ownership =
|
|
1262
|
+
const ownership = session.ownershipOfPath(declaration.path);
|
|
1274
1263
|
if (pathIsStandardLibrary) return ownership.kind === "typescript" && ownership.library === "standard-library" ? moduleOriginFromOwnership(ownership) : void 0;
|
|
1275
1264
|
return ownership.kind === "project" ? void 0 : moduleOriginFromOwnership(ownership);
|
|
1276
1265
|
}
|
|
@@ -1732,9 +1721,7 @@ function symbolOrigin(session, handle) {
|
|
|
1732
1721
|
* the parser's visibility gate.
|
|
1733
1722
|
*/
|
|
1734
1723
|
function declaringParentIsClass(session, handle) {
|
|
1735
|
-
|
|
1736
|
-
}
|
|
1737
|
-
function parentSymbolIsClass(session, symbol) {
|
|
1724
|
+
const symbol = session.symbol(handle, "symbolFacts.declaringParentIsClass");
|
|
1738
1725
|
session.ensureOpen("symbolFacts.declaringParentIsClass");
|
|
1739
1726
|
const parent = symbol.getParent();
|
|
1740
1727
|
return parent !== void 0 && (parent.flags & SymbolFlags.Class) !== 0;
|
|
@@ -1804,7 +1791,7 @@ function createSessionFacts(session, heritage) {
|
|
|
1804
1791
|
typeOfSymbol: cache.byHandlePair("typeOfSymbol", (symbol, declared) => typeOfSymbol(session, symbol, declared)),
|
|
1805
1792
|
typeAtNode: cache.byHandle("typeAtNode", (node) => typeAtNode(session, node)),
|
|
1806
1793
|
typeFacts: cache.byHandle("typeFacts", (type) => typeFacts(session, type)),
|
|
1807
|
-
declarationOwnership: cache.byHandle("declarationOwnership", (node) => declarationOwnership
|
|
1794
|
+
declarationOwnership: cache.byHandle("declarationOwnership", (node) => declarationOwnership(session, node)),
|
|
1808
1795
|
symbolFacts: cache.byHandle("symbolFacts", (symbol) => symbolFacts(session, symbol)),
|
|
1809
1796
|
symbolOrigin: symbolOriginRead,
|
|
1810
1797
|
declaringParentIsClass: cache.byHandle("symbolFacts.declaringParentIsClass", (symbol) => declaringParentIsClass(session, symbol)),
|
|
@@ -2779,7 +2766,7 @@ function isSynthesizedFunctionStatic(symbol) {
|
|
|
2779
2766
|
* twice) still expands both times.
|
|
2780
2767
|
*/
|
|
2781
2768
|
function appendNamespaceMembers(scope, out, visitedNamespaces, chain = scope.chain) {
|
|
2782
|
-
const ns =
|
|
2769
|
+
const ns = mergedNamespaceSymbols(scope.session, scope.symbol)[0] ?? scope.symbol;
|
|
2783
2770
|
if (visitedNamespaces.has(ns)) {
|
|
2784
2771
|
recordUnresolvedReExport({
|
|
2785
2772
|
...scope,
|
|
@@ -2887,10 +2874,6 @@ function mergedNamespaceSymbols(session, symbol) {
|
|
|
2887
2874
|
}
|
|
2888
2875
|
return namespaces;
|
|
2889
2876
|
}
|
|
2890
|
-
/** Resolves the namespace symbol a module declaration declares, when it has one. */
|
|
2891
|
-
function namespaceSymbolOf(session, symbol) {
|
|
2892
|
-
return mergedNamespaceSymbols(session, symbol)[0];
|
|
2893
|
-
}
|
|
2894
2877
|
function starExportSpecifiers(source, typeOnly) {
|
|
2895
2878
|
return source.statements.flatMap((statement) => isStarExport(statement, typeOnly) ? [statement.moduleSpecifier.text] : []);
|
|
2896
2879
|
}
|
|
@@ -3281,7 +3264,7 @@ var TsgoExtractionSession = class {
|
|
|
3281
3264
|
return intern(this.moduleExportsBySymbol, container, () => [...this.checker.getExportsOfModule(container)]);
|
|
3282
3265
|
}
|
|
3283
3266
|
ownershipOfPath(path) {
|
|
3284
|
-
return intern(this.ownershipByPath, path, () =>
|
|
3267
|
+
return intern(this.ownershipByPath, path, () => classifySourceFile(path, this.sourceFileMetadata(path)));
|
|
3285
3268
|
}
|
|
3286
3269
|
isExternalPath(path) {
|
|
3287
3270
|
return isExternalOwnership(this.ownershipOfPath(path));
|
|
@@ -3777,10 +3760,6 @@ const ExtractionResultSchema = Schema.Struct({
|
|
|
3777
3760
|
* dependency-owned declaration makes the whole symbol external), while the
|
|
3778
3761
|
* standard-library gates quantify over declarations at their own sites.
|
|
3779
3762
|
*/
|
|
3780
|
-
/** Normalized ownership of one declaration's source file. */
|
|
3781
|
-
function declarationOwnership(node, context) {
|
|
3782
|
-
return context.operations.declarationOwnership(node);
|
|
3783
|
-
}
|
|
3784
3763
|
/**
|
|
3785
3764
|
* The declaration a symbol is read from when one must stand for it: the value
|
|
3786
3765
|
* declaration when it has one, otherwise the first declaration.
|
|
@@ -3799,11 +3778,11 @@ function symbolDeclarations(info) {
|
|
|
3799
3778
|
* of its declarations ships in a packaged dependency or library.
|
|
3800
3779
|
*/
|
|
3801
3780
|
function isExternalSymbol(symbol, context) {
|
|
3802
|
-
return context.operations.symbolFacts(symbol).declarations.some((declaration) => isExternalOwnership(declarationOwnership(declaration
|
|
3781
|
+
return context.operations.symbolFacts(symbol).declarations.some((declaration) => isExternalOwnership(context.operations.declarationOwnership(declaration)));
|
|
3803
3782
|
}
|
|
3804
3783
|
/** Whether one declaration lives in TypeScript's own standard-library files. */
|
|
3805
3784
|
function isStandardLibraryDeclaration(node, context) {
|
|
3806
|
-
const ownership = declarationOwnership(node
|
|
3785
|
+
const ownership = context.operations.declarationOwnership(node);
|
|
3807
3786
|
return ownership.kind === "typescript" && ownership.library === "standard-library";
|
|
3808
3787
|
}
|
|
3809
3788
|
/**
|
|
@@ -3812,7 +3791,7 @@ function isStandardLibraryDeclaration(node, context) {
|
|
|
3812
3791
|
* where nested toolchain copies count but other packages do not.
|
|
3813
3792
|
*/
|
|
3814
3793
|
function isTypeScriptToolchainDeclaration(node, context) {
|
|
3815
|
-
return declarationOwnership(node
|
|
3794
|
+
return context.operations.declarationOwnership(node).kind === "typescript";
|
|
3816
3795
|
}
|
|
3817
3796
|
//#endregion
|
|
3818
3797
|
//#region ../api-extractor/dist/parse/react-policy.js
|
|
@@ -4135,7 +4114,7 @@ function referencedProjectAliasBody(node, facts, context) {
|
|
|
4135
4114
|
if (declaration === void 0) return void 0;
|
|
4136
4115
|
const declarationFacts = context.operations.nodeFacts(declaration);
|
|
4137
4116
|
if (declarationFacts.kind !== "typeAlias") return void 0;
|
|
4138
|
-
if (isExternalOwnership(declarationOwnership(declaration
|
|
4117
|
+
if (isExternalOwnership(context.operations.declarationOwnership(declaration))) return void 0;
|
|
4139
4118
|
return declarationFacts.type;
|
|
4140
4119
|
}
|
|
4141
4120
|
//#endregion
|
|
@@ -6807,7 +6786,7 @@ function mappedKeySignature({ node, substitutions }, context) {
|
|
|
6807
6786
|
const valueNode = facts.mappedValueType !== void 0 && authoredContainsPreservableKeyof(facts.mappedValueType, context) ? facts.mappedValueType : void 0;
|
|
6808
6787
|
return {
|
|
6809
6788
|
keyName: facts.keyName ?? "P",
|
|
6810
|
-
keyNameFromLibrary: isExternalOwnership(declarationOwnership(node
|
|
6789
|
+
keyNameFromLibrary: isExternalOwnership(context.operations.declarationOwnership(node)),
|
|
6811
6790
|
keyType,
|
|
6812
6791
|
valueType,
|
|
6813
6792
|
valueNode,
|
|
@@ -7736,14 +7715,13 @@ function substitutionFallback(facts, sourceNode, context) {
|
|
|
7736
7715
|
//#endregion
|
|
7737
7716
|
//#region ../api-extractor/dist/parser.js
|
|
7738
7717
|
/**
|
|
7739
|
-
*
|
|
7740
|
-
*
|
|
7741
|
-
*
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
/**
|
|
7718
|
+
* Backend-neutral module policy over a draft the adapter has already read.
|
|
7719
|
+
*
|
|
7720
|
+
* The adapter supplies a module descriptor and opaque compiler graph. This
|
|
7721
|
+
* module owns type resolution, alias/mapped substitution, warnings, and the
|
|
7722
|
+
* React component transform. A replacement compiler therefore only needs to
|
|
7723
|
+
* implement the package-owned operations in `BackendCompilerOperations`.
|
|
7724
|
+
*
|
|
7747
7725
|
* Apply module re-export policy and then invoke the compiler-free resolver.
|
|
7748
7726
|
*
|
|
7749
7727
|
* Type-only star re-exports keep only their pure types; structured module-walk
|
|
@@ -7827,7 +7805,7 @@ function openExtraction(project, externalTypes, componentSources = false) {
|
|
|
7827
7805
|
const inspectComponentSources = Effect.fn("ProjectExtractor.inspectComponentSources")(function* (project, filePath, requests) {
|
|
7828
7806
|
const session = guardedExtractionSession(yield* openExtraction(project, parseExtractorOptions().externalTypes, true), filePath);
|
|
7829
7807
|
const draft = yield* Effect.try({
|
|
7830
|
-
try: () =>
|
|
7808
|
+
try: () => session.readModule(filePath),
|
|
7831
7809
|
catch: (cause) => classifyThrown(cause, {
|
|
7832
7810
|
filePath,
|
|
7833
7811
|
operation: "readModule"
|
|
@@ -7847,7 +7825,7 @@ const extractModule = Effect.fn("ProjectExtractor.extractModule")(function* (pro
|
|
|
7847
7825
|
const parsedOptions = parseExtractorOptions(options);
|
|
7848
7826
|
const session = guardedExtractionSession(yield* openExtraction(project, parsedOptions.externalTypes), filePath);
|
|
7849
7827
|
const draft = yield* Effect.try({
|
|
7850
|
-
try: () =>
|
|
7828
|
+
try: () => session.readModule(filePath),
|
|
7851
7829
|
catch: (cause) => classifyThrown(cause, {
|
|
7852
7830
|
filePath,
|
|
7853
7831
|
operation: "readModule"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as ApiArtifactsError,
|
|
3
|
-
import { t as ProjectExtractor } from "./dist-
|
|
2
|
+
import { n as ApiArtifactsError, t as ApiArtifactsDriftError } from "./errors-D_qG2JhN.mjs";
|
|
3
|
+
import { t as ProjectExtractor } from "./dist-DcTc0uUY.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { API, NodeBuilderFlags, SignatureKind, SymbolFlags } from "typescript/unstable/sync";
|
|
@@ -34,7 +34,6 @@ function openLibraryProject(tsconfigPath, projectRoot) {
|
|
|
34
34
|
if (project === void 0) throw new Error(`Could not open the project at ${tsconfigPath}`);
|
|
35
35
|
return {
|
|
36
36
|
projectRoot,
|
|
37
|
-
project,
|
|
38
37
|
checker: project.checker,
|
|
39
38
|
program: project.program,
|
|
40
39
|
close: () => api.close()
|
|
@@ -90,13 +89,12 @@ function isRecipeAxisDeclaration(declarationPath) {
|
|
|
90
89
|
return file.endsWith("-variants.ts") || file.endsWith("-variants.tsx");
|
|
91
90
|
}
|
|
92
91
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* policy applied to ordinary declared props.
|
|
92
|
+
* Recipe axes are either checker-synthesized (no declaration) or declared in
|
|
93
|
+
* `*-variants` sources; neither case needs the consumer-facing JSDoc policy
|
|
94
|
+
* applied to ordinary declared props.
|
|
97
95
|
*/
|
|
98
|
-
function
|
|
99
|
-
return
|
|
96
|
+
function isRecipeAxisProp(symbol) {
|
|
97
|
+
return symbol.declarations.length === 0 || symbol.declarations.some((declaration) => isRecipeAxisDeclaration(declaration.path));
|
|
100
98
|
}
|
|
101
99
|
/**
|
|
102
100
|
* Turns one source-inspection result into artifact source metadata. Unresolved
|
|
@@ -106,12 +104,12 @@ function propOrigin(declarationPaths, synthesized) {
|
|
|
106
104
|
*/
|
|
107
105
|
function partSourceFromInspection(context, partName, result, problems) {
|
|
108
106
|
if (result.status === "unresolved") {
|
|
109
|
-
problems.
|
|
107
|
+
problems.push(`${partName}: could not recover the authored implementation (${result.reason})`);
|
|
110
108
|
return null;
|
|
111
109
|
}
|
|
112
110
|
const sourceFile = context.program.getSourceFile(result.filePath);
|
|
113
111
|
if (sourceFile === void 0) {
|
|
114
|
-
problems.
|
|
112
|
+
problems.push(`${partName}: could not load the authored implementation file (${result.filePath})`);
|
|
115
113
|
return null;
|
|
116
114
|
}
|
|
117
115
|
return {
|
|
@@ -167,7 +165,7 @@ function hasCallSignatures(checker, type) {
|
|
|
167
165
|
return checker.getSignaturesOfType(type, SignatureKind.Call).length > 0;
|
|
168
166
|
}
|
|
169
167
|
function isForwardedProp(context, symbol) {
|
|
170
|
-
return
|
|
168
|
+
return !isRecipeAxisProp(symbol) && !isOwnProp(context, symbol);
|
|
171
169
|
}
|
|
172
170
|
const emptyForwarded = {
|
|
173
171
|
count: 0,
|
|
@@ -211,12 +209,12 @@ function componentPartRequests(context, request, problems) {
|
|
|
211
209
|
const { checker, program } = context;
|
|
212
210
|
const sourceFile = program.getSourceFile(request.entryFile);
|
|
213
211
|
if (sourceFile === void 0) {
|
|
214
|
-
problems.
|
|
212
|
+
problems.push(`${request.entryFile}: entry module is not part of the library program`);
|
|
215
213
|
return [];
|
|
216
214
|
}
|
|
217
215
|
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
218
216
|
if (moduleSymbol === void 0) {
|
|
219
|
-
problems.
|
|
217
|
+
problems.push(`${request.entryFile}: entry module has no module symbol`);
|
|
220
218
|
return [];
|
|
221
219
|
}
|
|
222
220
|
const moduleExports = checker.getExportsOfModule(moduleSymbol);
|
|
@@ -224,12 +222,12 @@ function componentPartRequests(context, request, problems) {
|
|
|
224
222
|
for (const exportName of request.exportNames) {
|
|
225
223
|
const rootSymbol = moduleExports.find((exported) => exported.name === exportName);
|
|
226
224
|
if (rootSymbol === void 0) {
|
|
227
|
-
problems.
|
|
225
|
+
problems.push(`${request.entryFile}: does not export "${exportName}"`);
|
|
228
226
|
continue;
|
|
229
227
|
}
|
|
230
228
|
const rootType = checker.getTypeOfSymbol(rootSymbol);
|
|
231
229
|
if (rootType === void 0 || rootType.isErrorType()) {
|
|
232
|
-
problems.
|
|
230
|
+
problems.push(`${exportName}: exported value has an unresolvable type`);
|
|
233
231
|
continue;
|
|
234
232
|
}
|
|
235
233
|
if (hasCallSignatures(checker, rootType)) {
|
|
@@ -251,7 +249,7 @@ function componentPartRequests(context, request, problems) {
|
|
|
251
249
|
type: memberType
|
|
252
250
|
});
|
|
253
251
|
}
|
|
254
|
-
if (parts.length === start) problems.
|
|
252
|
+
if (parts.length === start) problems.push(`${exportName}: no renderable parts were found on the exported namespace`);
|
|
255
253
|
}
|
|
256
254
|
return parts;
|
|
257
255
|
}
|
|
@@ -310,16 +308,16 @@ function describeProps(context, request, source, props, problems) {
|
|
|
310
308
|
const { checker } = context;
|
|
311
309
|
const rows = [];
|
|
312
310
|
for (const property of props.values()) {
|
|
313
|
-
const isRecipeAxis =
|
|
314
|
-
if (
|
|
311
|
+
const isRecipeAxis = isRecipeAxisProp(property);
|
|
312
|
+
if (!isRecipeAxis && !isOwnProp(context, property)) continue;
|
|
315
313
|
const printed = printType(checker, checker.getTypeOfSymbol(property));
|
|
316
314
|
if (printed === null) {
|
|
317
|
-
problems.
|
|
315
|
+
problems.push(`${request.name}.${property.name}: type is unresolvable — the docs build cannot print it (${source.sourcePath})`);
|
|
318
316
|
continue;
|
|
319
317
|
}
|
|
320
318
|
const description = dedupeDocumentation(checker.getDocumentationCommentOfSymbol(property));
|
|
321
319
|
if (description === "" && !isRecipeAxis) {
|
|
322
|
-
problems.
|
|
320
|
+
problems.push(`${request.name}.${property.name}: public prop has no JSDoc description (${source.sourcePath})`);
|
|
323
321
|
continue;
|
|
324
322
|
}
|
|
325
323
|
rows.push({
|
|
@@ -337,7 +335,7 @@ function describeProps(context, request, source, props, problems) {
|
|
|
337
335
|
}
|
|
338
336
|
function describePart(context, request, contract, source, forwarded, problems) {
|
|
339
337
|
if (contract.kind !== "one") {
|
|
340
|
-
problems.
|
|
338
|
+
problems.push(contract.kind === "none" ? `${request.name}: no call signature — it does not look like a component` : `${request.name}: ${String(contract.count)} call signatures — API artifacts describe one public props contract; keep one public overload`);
|
|
341
339
|
return null;
|
|
342
340
|
}
|
|
343
341
|
if (source === null) return null;
|
|
@@ -351,7 +349,7 @@ function describePart(context, request, contract, source, forwarded, problems) {
|
|
|
351
349
|
forwardedCount: 0
|
|
352
350
|
};
|
|
353
351
|
case "unresolved":
|
|
354
|
-
problems.
|
|
352
|
+
problems.push(`${request.name}: props type is unresolvable`);
|
|
355
353
|
return null;
|
|
356
354
|
case "resolved": return {
|
|
357
355
|
name: request.name,
|
|
@@ -379,9 +377,6 @@ function extractPart(context, request, sourceResult, problems) {
|
|
|
379
377
|
}
|
|
380
378
|
//#endregion
|
|
381
379
|
//#region ../api-artifacts/dist/enrichment.js
|
|
382
|
-
function isEnrichable(facts) {
|
|
383
|
-
return facts.source?.origin !== "forwarded";
|
|
384
|
-
}
|
|
385
380
|
function propertiesOf(type) {
|
|
386
381
|
switch (type.kind) {
|
|
387
382
|
case "component": return type.props;
|
|
@@ -424,7 +419,7 @@ function enrichPart(context, component, current, result, roots, packages, proble
|
|
|
424
419
|
const root = roots.find((name) => current.name === name || current.name.startsWith(`${name}.`));
|
|
425
420
|
const facts = component.partApis.find((part) => part.name === current.name);
|
|
426
421
|
if (root === void 0 || facts === void 0) return current;
|
|
427
|
-
if (
|
|
422
|
+
if (facts.source?.origin === "forwarded") return current;
|
|
428
423
|
const selected = selectedProps(result, root, current.name);
|
|
429
424
|
if (selected === void 0) return current;
|
|
430
425
|
const handled = new Set(current.props.map((prop) => prop.name));
|
|
@@ -442,7 +437,7 @@ function enrichPart(context, component, current, result, roots, packages, proble
|
|
|
442
437
|
if (fact === void 0) continue;
|
|
443
438
|
if (fact.type === null) {
|
|
444
439
|
handled.add(property.name);
|
|
445
|
-
problems.
|
|
440
|
+
problems.push(`${current.name}.${property.name}: selected dependency prop has an unresolvable type`);
|
|
446
441
|
continue;
|
|
447
442
|
}
|
|
448
443
|
additions.push({
|
|
@@ -457,7 +452,7 @@ function enrichPart(context, component, current, result, roots, packages, proble
|
|
|
457
452
|
handled.add(property.name);
|
|
458
453
|
}
|
|
459
454
|
if (additions.length > current.forwardedCount) {
|
|
460
|
-
problems.
|
|
455
|
+
problems.push(`${current.name}: selected props exceed forwarded prop count`);
|
|
461
456
|
return current;
|
|
462
457
|
}
|
|
463
458
|
return {
|
|
@@ -558,7 +553,7 @@ async function generateApiArtifacts(options) {
|
|
|
558
553
|
diagnostics: []
|
|
559
554
|
};
|
|
560
555
|
const context = openLibraryProject(tsconfigPath, projectRoot);
|
|
561
|
-
const problems =
|
|
556
|
+
const problems = [];
|
|
562
557
|
let model;
|
|
563
558
|
let diagnostics = [];
|
|
564
559
|
try {
|
|
@@ -569,7 +564,7 @@ async function generateApiArtifacts(options) {
|
|
|
569
564
|
const inspected = yield* extractor.inspectComponentSources(request.entryFile, parts);
|
|
570
565
|
return describeComponent(context, request, parts, inspected, problems);
|
|
571
566
|
}));
|
|
572
|
-
if (problems.
|
|
567
|
+
if (problems.length > 0) return yield* Effect.fail(new ApiArtifactsError(problems));
|
|
573
568
|
const packages = options.includeExternalTypes ?? [];
|
|
574
569
|
if (packages.length === 0) return {
|
|
575
570
|
components: described,
|
|
@@ -577,7 +572,7 @@ async function generateApiArtifacts(options) {
|
|
|
577
572
|
};
|
|
578
573
|
const extracted = yield* Effect.forEach(requests, (entry) => extractor.extractModule(entry.entryFile, { includeExternalTypes: packages }));
|
|
579
574
|
const enriched = enrichComponents(context, extracted, described, packages, problems);
|
|
580
|
-
if (problems.
|
|
575
|
+
if (problems.length > 0) return yield* Effect.fail(new ApiArtifactsError(problems));
|
|
581
576
|
const rejected = enriched.diagnostics.filter((diagnostic) => !options.allowedWarningCodes?.includes(diagnostic.warning.code));
|
|
582
577
|
if (rejected.length > 0) return yield* Effect.fail(new ApiArtifactsError(rejected.map(({ component, warning }) => `${component}: ${warning.code}: ${warning.message}`)));
|
|
583
578
|
return enriched;
|
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
* the Effect runtime; the packed consumer's tree-shaking check pins that. `_tag`
|
|
7
7
|
* carries the same stable discriminant without a schema dependency.
|
|
8
8
|
*/
|
|
9
|
-
/** Renders the message for one batch of generation problems, keeping the structured list intact. */
|
|
10
|
-
function renderProblems(problems) {
|
|
11
|
-
return `API artifact generation failed:\n${problems.join("\n")}`;
|
|
12
|
-
}
|
|
13
9
|
/**
|
|
14
10
|
* Expected failure of `generateApiArtifacts`: the project could not be turned into
|
|
15
11
|
* artifacts. `problems` keeps every rendered problem as structured data so callers
|
|
@@ -20,7 +16,7 @@ var ApiArtifactsError = class extends Error {
|
|
|
20
16
|
/** Every problem found while describing the project, in discovery order. */
|
|
21
17
|
problems;
|
|
22
18
|
constructor(problems) {
|
|
23
|
-
super(
|
|
19
|
+
super(`API artifact generation failed:\n${problems.join("\n")}`);
|
|
24
20
|
this.name = "ApiArtifactsError";
|
|
25
21
|
this.problems = [...problems];
|
|
26
22
|
}
|
|
@@ -40,21 +36,5 @@ var ApiArtifactsDriftError = class extends Error {
|
|
|
40
36
|
this.files = [...files];
|
|
41
37
|
}
|
|
42
38
|
};
|
|
43
|
-
/**
|
|
44
|
-
* Collects actionable problems found while describing a project, so generation can
|
|
45
|
-
* fail once with the complete list instead of at the first problem. A non-empty log
|
|
46
|
-
* is reported through {@link ApiArtifactsError}.
|
|
47
|
-
*/
|
|
48
|
-
var ProblemLog = class {
|
|
49
|
-
entries = [];
|
|
50
|
-
/** Records one rendered problem message. */
|
|
51
|
-
add(problem) {
|
|
52
|
-
this.entries.push(problem);
|
|
53
|
-
}
|
|
54
|
-
/** Every problem recorded so far, in discovery order. */
|
|
55
|
-
get problems() {
|
|
56
|
-
return this.entries;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
39
|
//#endregion
|
|
60
|
-
export { ApiArtifactsError as n,
|
|
40
|
+
export { ApiArtifactsError as n, ApiArtifactsDriftError as t };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as ApiArtifactsError, t as ApiArtifactsDriftError } from "./errors-
|
|
2
|
+
import { n as ApiArtifactsError, t as ApiArtifactsDriftError } from "./errors-D_qG2JhN.mjs";
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
/** Generates API artifacts with the Elmera UI documentation defaults. */
|
|
5
5
|
async function generateApiArtifacts(options) {
|
|
6
|
-
const { generateApiArtifacts: generate } = await import("./dist-
|
|
6
|
+
const { generateApiArtifacts: generate } = await import("./dist-hTVexsRM.mjs");
|
|
7
7
|
return generate({
|
|
8
8
|
...options,
|
|
9
9
|
includeExternalTypes: options.includeExternalTypes ?? ["@base-ui/react"],
|
package/dist/release.mjs
CHANGED
|
@@ -460,11 +460,10 @@ function createCommitAncestry(cwd) {
|
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
462
462
|
* Reads git for the release pipeline. `cwd` is the checkout to read.
|
|
463
|
-
* `packageManifest` is the git path to package.json.
|
|
463
|
+
* `packageManifest` is the forward-slash git path to package.json (see `packageManifestGitPath`).
|
|
464
464
|
* `remoteTrackingRef` is the Changesets base branch (`origin/<branch>`). Required.
|
|
465
465
|
*/
|
|
466
466
|
function createGitPort(cwd, packageManifest, remoteTrackingRef) {
|
|
467
|
-
const manifest = packageManifest.replaceAll("\\", "/");
|
|
468
467
|
return {
|
|
469
468
|
head: () => lift(() => assertCommit(git(cwd, ["rev-parse", "HEAD"]))),
|
|
470
469
|
baseBranchTip: () => lift(() => assertCommit(git(cwd, ["rev-parse", remoteTrackingRef]))),
|
|
@@ -474,7 +473,7 @@ function createGitPort(cwd, packageManifest, remoteTrackingRef) {
|
|
|
474
473
|
"--untracked-files=no"
|
|
475
474
|
]) === ""),
|
|
476
475
|
stableVersionAt: (revision) => lift(() => {
|
|
477
|
-
return assertStableReleaseVersion(decodeJson(git(cwd, ["show", `${revision}:${
|
|
476
|
+
return assertStableReleaseVersion(decodeJson(git(cwd, ["show", `${revision}:${packageManifest}`]), PackageManifest, "recorded manifest").version);
|
|
478
477
|
})
|
|
479
478
|
};
|
|
480
479
|
}
|
|
@@ -586,10 +585,6 @@ function changesetBaseBranch(checkoutRoot) {
|
|
|
586
585
|
if (!base.startsWith("origin/")) throw new Error("Changesets baseBranch must be a remote-tracking ref (origin/<branch>)");
|
|
587
586
|
return base;
|
|
588
587
|
}
|
|
589
|
-
/** The branch Changesets tracks, without the `origin/` prefix. */
|
|
590
|
-
function trackedBranchOf(baseBranch) {
|
|
591
|
-
return baseBranch.slice(7);
|
|
592
|
-
}
|
|
593
588
|
/**
|
|
594
589
|
* Asks Changesets which releases the pending changesets in `checkoutRoot` would produce.
|
|
595
590
|
*
|
|
@@ -788,27 +783,49 @@ function planPublication(release, registry, isAncestor) {
|
|
|
788
783
|
promote: canaryTakesTag(release, registry)
|
|
789
784
|
};
|
|
790
785
|
}
|
|
791
|
-
/** Promotion is re-decided against the registry read that confirmed the upload. */
|
|
792
|
-
function shouldPromote(release, registry, isAncestor) {
|
|
793
|
-
const plan = planPublication(release, registry, isAncestor);
|
|
794
|
-
return plan.kind === "publish" && plan.promote;
|
|
795
|
-
}
|
|
796
786
|
//#endregion
|
|
797
787
|
//#region ../release/dist/publication.js
|
|
798
|
-
/**
|
|
788
|
+
/**
|
|
789
|
+
* Live confirmation timing. npm processes a new version asynchronously ("may take a few minutes
|
|
790
|
+
* to become available") and has taken longer than four minutes, so the window allows ten.
|
|
791
|
+
*/
|
|
792
|
+
const liveConfirmation = {
|
|
793
|
+
confirmationInterval: Duration.seconds(5),
|
|
794
|
+
confirmationWindow: Duration.minutes(10)
|
|
795
|
+
};
|
|
796
|
+
/** Caps the doubling delay so a long window polls npm every 30 seconds rather than hammering it. */
|
|
799
797
|
const maxConfirmationDelay = Duration.seconds(30);
|
|
800
798
|
const unverifiedPublication = "Publication could not be verified; retry the recorded release";
|
|
801
|
-
function
|
|
802
|
-
|
|
803
|
-
|
|
799
|
+
function confirmationDelay(interval, retry) {
|
|
800
|
+
return Duration.min(Duration.times(interval, 2 ** retry), maxConfirmationDelay);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* The number of re-reads whose delays first cover `window`. Counting scheduled delays rather than
|
|
804
|
+
* wall-clock time keeps the read count independent of registry latency, so the slept total is at
|
|
805
|
+
* least the window and tests on a test clock see a deterministic schedule.
|
|
806
|
+
*/
|
|
807
|
+
function confirmationRetries(interval, window) {
|
|
808
|
+
if (!Duration.isPositive(interval)) return 0;
|
|
809
|
+
let retries = 0;
|
|
810
|
+
let waited = Duration.zero;
|
|
811
|
+
while (Duration.isLessThan(waited, window)) {
|
|
812
|
+
waited = Duration.sum(waited, confirmationDelay(interval, retries));
|
|
813
|
+
retries += 1;
|
|
814
|
+
}
|
|
815
|
+
return retries;
|
|
804
816
|
}
|
|
805
|
-
|
|
817
|
+
function confirmationSchedule(deps) {
|
|
818
|
+
const interval = Duration.fromInputUnsafe(deps.confirmationInterval);
|
|
819
|
+
const window = Duration.fromInputUnsafe(deps.confirmationWindow);
|
|
820
|
+
return Schedule.recurs(confirmationRetries(interval, window)).pipe(Schedule.addDelay((metadata) => Effect.succeed(confirmationDelay(interval, metadata.output))));
|
|
821
|
+
}
|
|
822
|
+
/** Polls the registry until `isVisible` holds or the confirmation window is spent. */
|
|
806
823
|
function confirmRegistry(deps, isVisible) {
|
|
807
824
|
return Effect.gen(function* () {
|
|
808
825
|
const registry = yield* deps.readRegistry();
|
|
809
826
|
return (yield* lift(() => isVisible(registry))) ? registry : void 0;
|
|
810
827
|
}).pipe(Effect.repeat({
|
|
811
|
-
schedule: confirmationSchedule(deps
|
|
828
|
+
schedule: confirmationSchedule(deps),
|
|
812
829
|
until: (registry) => registry !== void 0
|
|
813
830
|
}));
|
|
814
831
|
}
|
|
@@ -843,7 +860,8 @@ function publishVerifiedRelease(release, deps) {
|
|
|
843
860
|
const intended = yield* lift(() => planPublication(release, registry, deps.ancestry));
|
|
844
861
|
if (intended.kind === "superseded") return "superseded";
|
|
845
862
|
const confirmed = intended.upload ? yield* uploadAndConfirm(release, deps) : registry;
|
|
846
|
-
|
|
863
|
+
const confirmedPlan = yield* lift(() => planPublication(release, confirmed, deps.ancestry));
|
|
864
|
+
if (confirmedPlan.kind === "publish" && confirmedPlan.promote) yield* promoteAndConfirm(release, deps);
|
|
847
865
|
return "published";
|
|
848
866
|
});
|
|
849
867
|
}
|
|
@@ -969,12 +987,6 @@ function classifyReleaseAsset(starterAllowed, asset) {
|
|
|
969
987
|
function assertSameIntent(saved, intended) {
|
|
970
988
|
if (saved.commit !== intended.commit || saved.version !== intended.version || saved.channel !== intended.channel) throw new Error("Release intent differs from the saved release");
|
|
971
989
|
}
|
|
972
|
-
function releaseBodyText(value) {
|
|
973
|
-
return value.body ?? "";
|
|
974
|
-
}
|
|
975
|
-
function assetNames(value) {
|
|
976
|
-
return value.assets.map((asset) => asset.name);
|
|
977
|
-
}
|
|
978
990
|
function savedReleaseFrom(value, intent) {
|
|
979
991
|
const assets = value.assets.filter((asset) => asset.name === releaseArchiveName);
|
|
980
992
|
if (assets.length > 1) throw new Error("Duplicate release archives");
|
|
@@ -990,7 +1002,7 @@ function savedReleaseFrom(value, intent) {
|
|
|
990
1002
|
*/
|
|
991
1003
|
function classifyCatalogEntry(value) {
|
|
992
1004
|
try {
|
|
993
|
-
const classification = classifyReleaseRecord(value.tag_name,
|
|
1005
|
+
const classification = classifyReleaseRecord(value.tag_name, value.body ?? "", value.assets.map((asset) => asset.name));
|
|
994
1006
|
switch (classification.kind) {
|
|
995
1007
|
case "ignored": return;
|
|
996
1008
|
case "foreign": return { kind: "foreign" };
|
|
@@ -1252,7 +1264,7 @@ function liveReleaseDeps(pkg, environment) {
|
|
|
1252
1264
|
store: createReleaseStore(createGitHubClient(environment), pkg.packageName),
|
|
1253
1265
|
readRegistry: () => readRegistry(pkg.packageName, environment.fetch),
|
|
1254
1266
|
npm: createNpmPublisher(pkg),
|
|
1255
|
-
|
|
1267
|
+
...liveConfirmation,
|
|
1256
1268
|
verifyArchive: (intent, bytes) => verifyReleaseArchive(intent, bytes, pkg.packageName),
|
|
1257
1269
|
log: (message) => {
|
|
1258
1270
|
console.log(message);
|
|
@@ -1266,7 +1278,7 @@ function liveCheckedCommitDeps(pkg, environment) {
|
|
|
1266
1278
|
return {
|
|
1267
1279
|
...liveReleaseDeps(pkg, environment),
|
|
1268
1280
|
git: liveGit(pkg, baseBranch),
|
|
1269
|
-
stableGate: createStableReleaseGate(client, pkg.checkoutRoot, pkg.packageDirectory,
|
|
1281
|
+
stableGate: createStableReleaseGate(client, pkg.checkoutRoot, pkg.packageDirectory, baseBranch.slice(7)),
|
|
1270
1282
|
plannedCanaryBase: (current) => plannedCanaryBase(current, pkg.packageName, pkg.checkoutRoot)
|
|
1271
1283
|
};
|
|
1272
1284
|
}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@elmeragroup/oxlint-plugin-anti-slop": "0.0.0",
|
|
19
19
|
"@elmeragroup/release": "0.0.0"
|
|
20
20
|
},
|
|
21
|
-
"version": "0.2.0-canary.
|
|
21
|
+
"version": "0.2.0-canary.8",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/index.d.mts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"sideEffects": false,
|
|
71
71
|
"elmeraRelease": {
|
|
72
|
-
"commit": "
|
|
72
|
+
"commit": "2d78080c4160f904e4f9b5be9ac02b5229d9f54d",
|
|
73
73
|
"channel": "canary"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|