@shapeshift-labs/frontier-lang-compiler 0.2.38 → 0.2.39
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 +12 -0
- package/bench/smoke.mjs +14 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +261 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ import {
|
|
|
118
118
|
createNativeImportCoverageMatrix,
|
|
119
119
|
createNativeParserAstFormatMatrix,
|
|
120
120
|
createProjectionTargetLossMatrix,
|
|
121
|
+
createUniversalCapabilityMatrix,
|
|
121
122
|
importNativeSource
|
|
122
123
|
} from '@shapeshift-labs/frontier-lang-compiler';
|
|
123
124
|
|
|
@@ -142,6 +143,15 @@ const pythonProjection = projectionMatrix.languages.find((entry) => entry.langua
|
|
|
142
143
|
console.log(pythonProjection.sourceProjection.exactSource.lossClass); // "exactSourceProjection"
|
|
143
144
|
console.log(pythonProjection.sourceProjection.stubs.lossClass); // "nativeSourceStubs"
|
|
144
145
|
console.log(pythonProjection.targets.find((entry) => entry.target === 'rust').lossClass); // "missingAdapter"
|
|
146
|
+
|
|
147
|
+
const universalMatrix = createUniversalCapabilityMatrix({
|
|
148
|
+
imports: [imported],
|
|
149
|
+
requiredFeatures: ['syntax', 'semantic', 'sourcePreservation']
|
|
150
|
+
});
|
|
151
|
+
const pythonUniversal = universalMatrix.languages.find((entry) => entry.language === 'python');
|
|
152
|
+
|
|
153
|
+
console.log(pythonUniversal.readiness); // combined import/parser/projection readiness
|
|
154
|
+
console.log(pythonUniversal.blockers); // missing evidence/adapters that prevent merge admission
|
|
145
155
|
```
|
|
146
156
|
|
|
147
157
|
The projection target matrix separates five runtime/API classes:
|
|
@@ -152,6 +162,8 @@ The projection target matrix separates five runtime/API classes:
|
|
|
152
162
|
- `targetAdapterProjection`: a host-owned native-to-target adapter is present and produced target output with its own evidence/readiness.
|
|
153
163
|
- `missingAdapter`: no native-to-target projection adapter is declared; preserve or stub the original source language instead, or inject host-owned parser/semantic adapter evidence.
|
|
154
164
|
|
|
165
|
+
`createUniversalCapabilityMatrix` composes the import coverage, parser AST format, parser feature, and projection target matrices into a single language row per source language. It is the coordinator-facing view for universal-language work: it shows imports, symbols, source-map mappings, parser feature readiness, projection targets, missing adapters, unsupported target features, blockers, and review reasons without claiming lossless conversion where evidence is absent.
|
|
166
|
+
|
|
155
167
|
Preserve exact native source text, token/trivia hashes, comments, whitespace, and source directives as evidence. This does not claim full semantic understanding; it keeps round-trip material available while exact parser adapters catch up:
|
|
156
168
|
|
|
157
169
|
```js
|
package/bench/smoke.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createNativeParserAstFormatMatrix,
|
|
13
13
|
createNativeParserFeatureMatrix,
|
|
14
14
|
createProjectionTargetLossMatrix,
|
|
15
|
+
createUniversalCapabilityMatrix,
|
|
15
16
|
createNativeSourcePreservation,
|
|
16
17
|
createPythonAstNativeImporterAdapter,
|
|
17
18
|
createRustSynNativeImporterAdapter,
|
|
@@ -140,6 +141,14 @@ const projectionMatrixStart = performance.now();
|
|
|
140
141
|
const projectionLossMatrix = createProjectionTargetLossMatrix({ imports: nativeImportResults });
|
|
141
142
|
const projectionMatrixDurationMs = performance.now() - projectionMatrixStart;
|
|
142
143
|
|
|
144
|
+
const universalMatrixStart = performance.now();
|
|
145
|
+
const universalCapabilityMatrix = createUniversalCapabilityMatrix({
|
|
146
|
+
imports: nativeImportResults,
|
|
147
|
+
adapters: [estreeAdapter, createPythonAstNativeImporterAdapter(), createRustSynNativeImporterAdapter(), createClangAstNativeImporterAdapter(), createGoAstNativeImporterAdapter(), createJavaAstNativeImporterAdapter(), kotlinPsiAdapter, createCSharpRoslynNativeImporterAdapter(), createSwiftSyntaxNativeImporterAdapter()],
|
|
148
|
+
requiredFeatures: ['syntax', 'semantic', 'sourcePreservation']
|
|
149
|
+
});
|
|
150
|
+
const universalMatrixDurationMs = performance.now() - universalMatrixStart;
|
|
151
|
+
|
|
143
152
|
const preservationStart = performance.now();
|
|
144
153
|
const preservationRecords = nativeImportResults.map((imported) => imported.metadata.sourcePreservation ?? createNativeSourcePreservation({
|
|
145
154
|
language: imported.language,
|
|
@@ -304,6 +313,11 @@ console.log(JSON.stringify({
|
|
|
304
313
|
projectionMatrixMissingAdapters: projectionLossMatrix.summary.missingAdapters,
|
|
305
314
|
projectionMatrixUnsupportedTargetFeatures: projectionLossMatrix.summary.unsupportedTargetFeatures,
|
|
306
315
|
projectionMatrixDurationMs: Number(projectionMatrixDurationMs.toFixed(2)),
|
|
316
|
+
universalMatrixLanguages: universalCapabilityMatrix.summary.languages,
|
|
317
|
+
universalMatrixImports: universalCapabilityMatrix.summary.imports,
|
|
318
|
+
universalMatrixBlockedLanguages: universalCapabilityMatrix.summary.blockedLanguages,
|
|
319
|
+
universalMatrixMissingAdapters: universalCapabilityMatrix.summary.missingAdapters,
|
|
320
|
+
universalMatrixDurationMs: Number(universalMatrixDurationMs.toFixed(2)),
|
|
307
321
|
sourcePreservationRecords: preservationRecords.length,
|
|
308
322
|
sourcePreservationTokens: preservationTokens,
|
|
309
323
|
sourcePreservationDurationMs: Number(preservationDurationMs.toFixed(2)),
|
package/dist/index.d.ts
CHANGED
|
@@ -652,6 +652,101 @@ export interface ProjectionTargetLossMatrixOptions {
|
|
|
652
652
|
readonly generatedAt?: number;
|
|
653
653
|
}
|
|
654
654
|
|
|
655
|
+
export interface UniversalCapabilityLanguageRow {
|
|
656
|
+
readonly language: FrontierSourceLanguage | string;
|
|
657
|
+
readonly aliases: readonly string[];
|
|
658
|
+
readonly extensions: readonly string[];
|
|
659
|
+
readonly readiness: SemanticMergeReadiness;
|
|
660
|
+
readonly imports: {
|
|
661
|
+
readonly total: number;
|
|
662
|
+
readonly readiness: SemanticMergeReadiness;
|
|
663
|
+
readonly symbols: number;
|
|
664
|
+
readonly sourceMaps: number;
|
|
665
|
+
readonly sourceMapMappings: number;
|
|
666
|
+
readonly losses: number;
|
|
667
|
+
readonly lossKinds: Readonly<Record<string, number>>;
|
|
668
|
+
readonly readinessReasons: readonly string[];
|
|
669
|
+
};
|
|
670
|
+
readonly parser: {
|
|
671
|
+
readonly readiness: SemanticMergeReadiness;
|
|
672
|
+
readonly rows: number;
|
|
673
|
+
readonly parsers: readonly string[];
|
|
674
|
+
readonly mergeReadyParsers: readonly string[];
|
|
675
|
+
readonly blockingFeatures: readonly NativeParserFeatureCategory[];
|
|
676
|
+
readonly reviewFeatures: readonly NativeParserFeatureCategory[];
|
|
677
|
+
readonly languageSummary?: NativeParserFeatureLanguageSummary;
|
|
678
|
+
};
|
|
679
|
+
readonly projection: {
|
|
680
|
+
readonly readiness: SemanticMergeReadiness;
|
|
681
|
+
readonly sourceProjection?: ProjectionTargetLanguageCoverage['sourceProjection'];
|
|
682
|
+
readonly targets: readonly ProjectionTargetCoverageEntry[];
|
|
683
|
+
readonly summary: ProjectionTargetLanguageCoverage['summary'];
|
|
684
|
+
readonly missingTargets: readonly (FrontierCompileTarget | string)[];
|
|
685
|
+
readonly unsupportedTargets: readonly (FrontierCompileTarget | string)[];
|
|
686
|
+
};
|
|
687
|
+
readonly evidence: {
|
|
688
|
+
readonly parserAdapters: number;
|
|
689
|
+
readonly adapterCoverageSummaries: number;
|
|
690
|
+
readonly adapterCoverageGaps: Readonly<Record<string, number>>;
|
|
691
|
+
readonly knownLossKinds: readonly NativeImportKnownLossKind[];
|
|
692
|
+
readonly sourceMapMappings: number;
|
|
693
|
+
};
|
|
694
|
+
readonly blockers: readonly string[];
|
|
695
|
+
readonly review: readonly string[];
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
export interface UniversalCapabilityMatrix {
|
|
699
|
+
readonly kind: 'frontier.lang.universalCapabilityMatrix';
|
|
700
|
+
readonly version: 1;
|
|
701
|
+
readonly generatedAt: number;
|
|
702
|
+
readonly languages: readonly UniversalCapabilityLanguageRow[];
|
|
703
|
+
readonly summary: {
|
|
704
|
+
readonly languages: number;
|
|
705
|
+
readonly imports: number;
|
|
706
|
+
readonly symbols: number;
|
|
707
|
+
readonly sourceMapMappings: number;
|
|
708
|
+
readonly losses: number;
|
|
709
|
+
readonly parserRows: number;
|
|
710
|
+
readonly parserMergeReady: number;
|
|
711
|
+
readonly targetEntries: number;
|
|
712
|
+
readonly missingAdapters: number;
|
|
713
|
+
readonly unsupportedTargetFeatures: number;
|
|
714
|
+
readonly exactSourceProjection: number;
|
|
715
|
+
readonly nativeSourceStubs: number;
|
|
716
|
+
readonly blockers: number;
|
|
717
|
+
readonly reviewReasons: number;
|
|
718
|
+
readonly readyLanguages: number;
|
|
719
|
+
readonly readyWithLossesLanguages: number;
|
|
720
|
+
readonly reviewLanguages: number;
|
|
721
|
+
readonly blockedLanguages: number;
|
|
722
|
+
readonly byReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
|
|
723
|
+
readonly byImportReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
|
|
724
|
+
readonly byParserReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
|
|
725
|
+
readonly byProjectionReadiness: Readonly<Record<SemanticMergeReadiness, number>>;
|
|
726
|
+
};
|
|
727
|
+
readonly matrices: {
|
|
728
|
+
readonly importCoverage: NativeImportCoverageMatrix;
|
|
729
|
+
readonly parserFormats: NativeParserAstFormatMatrix;
|
|
730
|
+
readonly parserFeatures: NativeParserFeatureMatrix;
|
|
731
|
+
readonly projectionTargets: ProjectionTargetLossMatrix;
|
|
732
|
+
};
|
|
733
|
+
readonly metadata: {
|
|
734
|
+
readonly requiredFeatures: readonly NativeParserFeatureCategory[];
|
|
735
|
+
readonly minimumReadiness: SemanticMergeReadiness;
|
|
736
|
+
readonly compileTargets: readonly (FrontierCompileTarget | string)[];
|
|
737
|
+
readonly note: string;
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
export interface UniversalCapabilityMatrixOptions extends
|
|
742
|
+
NativeImportCoverageMatrixOptions,
|
|
743
|
+
NativeParserAstFormatMatrixOptions,
|
|
744
|
+
NativeParserFeatureMatrixOptions,
|
|
745
|
+
ProjectionTargetLossMatrixOptions {
|
|
746
|
+
readonly targetAdapters?: readonly NativeTargetProjectionAdapter[];
|
|
747
|
+
readonly targets?: readonly (FrontierCompileTarget | string)[];
|
|
748
|
+
}
|
|
749
|
+
|
|
655
750
|
export interface NativeImportContractSource {
|
|
656
751
|
readonly id: string;
|
|
657
752
|
readonly language?: FrontierSourceLanguage | string;
|
|
@@ -2253,6 +2348,7 @@ export declare function createNativeParserAstFormatMatrix(options?: NativeParser
|
|
|
2253
2348
|
export declare function createNativeParserFeatureMatrix(options?: NativeParserFeatureMatrixOptions): NativeParserFeatureMatrix;
|
|
2254
2349
|
export declare function queryNativeParserFeatureMatrix(matrixOrOptions?: NativeParserFeatureMatrix | NativeParserFeatureMatrixOptions, query?: NativeParserFeatureMatrixQuery): NativeParserFeatureMatrixQueryResult;
|
|
2255
2350
|
export declare function createProjectionTargetLossMatrix(options?: ProjectionTargetLossMatrixOptions): ProjectionTargetLossMatrix;
|
|
2351
|
+
export declare function createUniversalCapabilityMatrix(options?: UniversalCapabilityMatrixOptions): UniversalCapabilityMatrix;
|
|
2256
2352
|
export declare function createNativeSourcePreservation(options: CreateNativeSourcePreservationOptions): NativeSourcePreservation;
|
|
2257
2353
|
export declare function createSemanticImportSidecar(importResult: NativeSourceImportResult | NativeProjectImportResult, options?: SemanticImportSidecarOptions): SemanticImportSidecar;
|
|
2258
2354
|
export declare function createNativeImportResultContract(importResult: NativeSourceImportResult | NativeProjectImportResult, options?: NativeImportResultContractOptions): NativeImportResultContract;
|
package/dist/index.js
CHANGED
|
@@ -2488,6 +2488,62 @@ export function createProjectionTargetLossMatrix(input = {}) {
|
|
|
2488
2488
|
};
|
|
2489
2489
|
}
|
|
2490
2490
|
|
|
2491
|
+
export function createUniversalCapabilityMatrix(input = {}) {
|
|
2492
|
+
const generatedAt = input.generatedAt ?? Date.now();
|
|
2493
|
+
const imports = input.imports ?? [];
|
|
2494
|
+
const adapters = input.adapters ?? [];
|
|
2495
|
+
const targetAdapters = input.targetAdapters ?? [];
|
|
2496
|
+
const languages = input.languages ?? NativeImportLanguageProfiles;
|
|
2497
|
+
const targets = input.targets ?? FrontierCompileTargets;
|
|
2498
|
+
const importCoverage = createNativeImportCoverageMatrix({ languages, imports, adapters, generatedAt });
|
|
2499
|
+
const parserFormats = createNativeParserAstFormatMatrix({
|
|
2500
|
+
formats: input.formats,
|
|
2501
|
+
imports,
|
|
2502
|
+
adapters,
|
|
2503
|
+
generatedAt
|
|
2504
|
+
});
|
|
2505
|
+
const parserFeatures = createNativeParserFeatureMatrix({
|
|
2506
|
+
languages,
|
|
2507
|
+
imports,
|
|
2508
|
+
adapters,
|
|
2509
|
+
requiredFeatures: input.requiredFeatures,
|
|
2510
|
+
minimumReadiness: input.minimumReadiness,
|
|
2511
|
+
includeEmptyParsers: input.includeEmptyParsers,
|
|
2512
|
+
generatedAt
|
|
2513
|
+
});
|
|
2514
|
+
const projectionTargets = createProjectionTargetLossMatrix({
|
|
2515
|
+
languages,
|
|
2516
|
+
imports,
|
|
2517
|
+
adapters,
|
|
2518
|
+
targetAdapters,
|
|
2519
|
+
targets,
|
|
2520
|
+
generatedAt
|
|
2521
|
+
});
|
|
2522
|
+
const rows = importCoverage.languages.map((entry) => universalCapabilityLanguageRow(entry, {
|
|
2523
|
+
parserFeatures,
|
|
2524
|
+
projectionTargets
|
|
2525
|
+
}));
|
|
2526
|
+
return {
|
|
2527
|
+
kind: 'frontier.lang.universalCapabilityMatrix',
|
|
2528
|
+
version: 1,
|
|
2529
|
+
generatedAt,
|
|
2530
|
+
languages: rows,
|
|
2531
|
+
summary: universalCapabilityMatrixSummary(rows),
|
|
2532
|
+
matrices: {
|
|
2533
|
+
importCoverage,
|
|
2534
|
+
parserFormats,
|
|
2535
|
+
parserFeatures,
|
|
2536
|
+
projectionTargets
|
|
2537
|
+
},
|
|
2538
|
+
metadata: {
|
|
2539
|
+
requiredFeatures: parserFeatures.metadata.requiredFeatures,
|
|
2540
|
+
minimumReadiness: parserFeatures.metadata.minimumReadiness,
|
|
2541
|
+
compileTargets: projectionTargets.metadata.compileTargets,
|
|
2542
|
+
note: 'Universal capability coverage composes import, parser, source-preservation, and projection evidence. It identifies gaps; it is not a proof that every language feature is losslessly portable.'
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2491
2547
|
export function createNativeSourcePreservation(options) {
|
|
2492
2548
|
if (!options || typeof options.sourceText !== 'string') {
|
|
2493
2549
|
throw new Error('createNativeSourcePreservation requires sourceText');
|
|
@@ -7191,6 +7247,211 @@ function projectionTargetLossMatrixSummary(languages) {
|
|
|
7191
7247
|
};
|
|
7192
7248
|
}
|
|
7193
7249
|
|
|
7250
|
+
function universalCapabilityLanguageRow(importCoverage, context) {
|
|
7251
|
+
const languageIds = universalLanguageIds(importCoverage);
|
|
7252
|
+
const parserRows = (context.parserFeatures.parsers ?? []).filter((row) => universalLanguageIds(row).some((id) => languageIds.includes(id)));
|
|
7253
|
+
const parserLanguage = (context.parserFeatures.languages ?? []).find((row) => universalLanguageIds(row).some((id) => languageIds.includes(id)));
|
|
7254
|
+
const projection = (context.projectionTargets.languages ?? []).find((row) => universalLanguageIds(row).some((id) => languageIds.includes(id)));
|
|
7255
|
+
const parserReadiness = parserRows.length
|
|
7256
|
+
? parserRows.reduce((current, row) => maxSemanticMergeReadiness(current, row.merge?.readiness ?? row.imports?.readiness ?? 'blocked'), 'ready')
|
|
7257
|
+
: 'blocked';
|
|
7258
|
+
const sourceProjectionReadiness = [projection?.sourceProjection?.exactSource, projection?.sourceProjection?.stubs]
|
|
7259
|
+
.filter(Boolean)
|
|
7260
|
+
.reduce((current, entry) => maxSemanticMergeReadiness(current, entry.readiness ?? 'blocked'), 'ready');
|
|
7261
|
+
const targetReadiness = (projection?.targets ?? []).length
|
|
7262
|
+
? projection.targets.reduce((current, entry) => maxSemanticMergeReadiness(current, entry.readiness ?? 'blocked'), 'ready')
|
|
7263
|
+
: 'blocked';
|
|
7264
|
+
const projectionReadiness = maxSemanticMergeReadiness(sourceProjectionReadiness, targetReadiness);
|
|
7265
|
+
const readiness = maxSemanticMergeReadiness(importCoverage.imports.readiness, maxSemanticMergeReadiness(parserReadiness, projectionReadiness));
|
|
7266
|
+
const parserBlockingFeatures = uniqueStrings(parserRows.flatMap((row) => row.merge?.blockingFeatures ?? []));
|
|
7267
|
+
const parserReviewFeatures = uniqueStrings(parserRows.flatMap((row) => row.merge?.reviewFeatures ?? []));
|
|
7268
|
+
const missingTargets = (projection?.targets ?? []).filter((entry) => entry.lossClass === 'missingAdapter').map((entry) => entry.target);
|
|
7269
|
+
const unsupportedTargets = (projection?.targets ?? []).filter((entry) => entry.lossClass === 'unsupportedTargetFeatures').map((entry) => entry.target);
|
|
7270
|
+
const blockers = universalCapabilityBlockers({
|
|
7271
|
+
importCoverage,
|
|
7272
|
+
parserRows,
|
|
7273
|
+
parserReadiness,
|
|
7274
|
+
parserBlockingFeatures,
|
|
7275
|
+
projection,
|
|
7276
|
+
missingTargets,
|
|
7277
|
+
readiness
|
|
7278
|
+
});
|
|
7279
|
+
const review = universalCapabilityReviewReasons({
|
|
7280
|
+
importCoverage,
|
|
7281
|
+
parserRows,
|
|
7282
|
+
parserReviewFeatures,
|
|
7283
|
+
unsupportedTargets,
|
|
7284
|
+
readiness
|
|
7285
|
+
});
|
|
7286
|
+
return {
|
|
7287
|
+
language: importCoverage.language,
|
|
7288
|
+
aliases: importCoverage.aliases,
|
|
7289
|
+
extensions: importCoverage.extensions,
|
|
7290
|
+
readiness,
|
|
7291
|
+
imports: {
|
|
7292
|
+
total: importCoverage.imports.total,
|
|
7293
|
+
readiness: importCoverage.imports.readiness,
|
|
7294
|
+
symbols: importCoverage.imports.symbols,
|
|
7295
|
+
sourceMaps: importCoverage.imports.sourceMaps,
|
|
7296
|
+
sourceMapMappings: importCoverage.imports.sourceMapMappings,
|
|
7297
|
+
losses: importCoverage.imports.losses,
|
|
7298
|
+
lossKinds: importCoverage.imports.lossKinds,
|
|
7299
|
+
readinessReasons: importCoverage.imports.readinessReasons
|
|
7300
|
+
},
|
|
7301
|
+
parser: {
|
|
7302
|
+
readiness: parserReadiness,
|
|
7303
|
+
rows: parserRows.length,
|
|
7304
|
+
parsers: parserRows.map((row) => row.parser),
|
|
7305
|
+
mergeReadyParsers: parserRows.filter((row) => row.merge?.mergeReady).map((row) => row.parser),
|
|
7306
|
+
blockingFeatures: parserBlockingFeatures,
|
|
7307
|
+
reviewFeatures: parserReviewFeatures,
|
|
7308
|
+
languageSummary: parserLanguage
|
|
7309
|
+
},
|
|
7310
|
+
projection: {
|
|
7311
|
+
readiness: projectionReadiness,
|
|
7312
|
+
sourceProjection: projection?.sourceProjection,
|
|
7313
|
+
targets: projection?.targets ?? [],
|
|
7314
|
+
summary: projection?.summary ?? {
|
|
7315
|
+
imports: 0,
|
|
7316
|
+
parserAdapters: 0,
|
|
7317
|
+
targetEntries: 0,
|
|
7318
|
+
byLossClass: {},
|
|
7319
|
+
exactSourceImports: 0,
|
|
7320
|
+
stubDeclarationImports: 0
|
|
7321
|
+
},
|
|
7322
|
+
missingTargets,
|
|
7323
|
+
unsupportedTargets
|
|
7324
|
+
},
|
|
7325
|
+
evidence: {
|
|
7326
|
+
parserAdapters: importCoverage.parserAdapters.length,
|
|
7327
|
+
adapterCoverageSummaries: importCoverage.adapterCoverage.total,
|
|
7328
|
+
adapterCoverageGaps: importCoverage.adapterCoverage.gaps,
|
|
7329
|
+
knownLossKinds: importCoverage.knownLossKinds,
|
|
7330
|
+
sourceMapMappings: importCoverage.imports.sourceMapMappings
|
|
7331
|
+
},
|
|
7332
|
+
blockers,
|
|
7333
|
+
review
|
|
7334
|
+
};
|
|
7335
|
+
}
|
|
7336
|
+
|
|
7337
|
+
function universalCapabilityBlockers(input) {
|
|
7338
|
+
const blockers = [];
|
|
7339
|
+
if ((input.importCoverage.imports.total ?? 0) === 0) {
|
|
7340
|
+
blockers.push('No native import evidence observed for this language.');
|
|
7341
|
+
}
|
|
7342
|
+
if (!input.parserRows.length) {
|
|
7343
|
+
blockers.push('No parser feature row matched this language.');
|
|
7344
|
+
}
|
|
7345
|
+
if (input.parserReadiness === 'blocked') {
|
|
7346
|
+
blockers.push('Parser feature readiness is blocked.');
|
|
7347
|
+
}
|
|
7348
|
+
for (const feature of input.parserBlockingFeatures) {
|
|
7349
|
+
blockers.push(`Required parser feature is not merge-ready: ${feature}.`);
|
|
7350
|
+
}
|
|
7351
|
+
if (!input.projection) {
|
|
7352
|
+
blockers.push('No projection coverage row matched this language.');
|
|
7353
|
+
}
|
|
7354
|
+
for (const target of input.missingTargets) {
|
|
7355
|
+
blockers.push(`Missing native-to-target projection adapter for ${target}.`);
|
|
7356
|
+
}
|
|
7357
|
+
if (input.readiness === 'blocked' && blockers.length === 0) {
|
|
7358
|
+
blockers.push('Combined universal capability readiness is blocked.');
|
|
7359
|
+
}
|
|
7360
|
+
return uniqueStrings(blockers);
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7363
|
+
function universalCapabilityReviewReasons(input) {
|
|
7364
|
+
const review = [];
|
|
7365
|
+
if ((input.importCoverage.imports.losses ?? 0) > 0) {
|
|
7366
|
+
review.push(`Native import evidence carries ${input.importCoverage.imports.losses} loss record(s).`);
|
|
7367
|
+
}
|
|
7368
|
+
for (const reason of input.importCoverage.imports.readinessReasons ?? []) {
|
|
7369
|
+
review.push(reason);
|
|
7370
|
+
}
|
|
7371
|
+
for (const feature of input.parserReviewFeatures) {
|
|
7372
|
+
review.push(`Parser feature needs review: ${feature}.`);
|
|
7373
|
+
}
|
|
7374
|
+
for (const target of input.unsupportedTargets) {
|
|
7375
|
+
review.push(`Target projection has unsupported feature losses for ${target}.`);
|
|
7376
|
+
}
|
|
7377
|
+
if (input.readiness === 'needs-review') {
|
|
7378
|
+
review.push('Combined universal capability readiness requires review.');
|
|
7379
|
+
} else if (input.readiness === 'ready-with-losses') {
|
|
7380
|
+
review.push('Combined universal capability readiness is ready with disclosed losses.');
|
|
7381
|
+
}
|
|
7382
|
+
return uniqueStrings(review);
|
|
7383
|
+
}
|
|
7384
|
+
|
|
7385
|
+
function universalCapabilityMatrixSummary(rows) {
|
|
7386
|
+
const byReadiness = {};
|
|
7387
|
+
const byImportReadiness = {};
|
|
7388
|
+
const byParserReadiness = {};
|
|
7389
|
+
const byProjectionReadiness = {};
|
|
7390
|
+
let imports = 0;
|
|
7391
|
+
let symbols = 0;
|
|
7392
|
+
let sourceMapMappings = 0;
|
|
7393
|
+
let losses = 0;
|
|
7394
|
+
let parserRows = 0;
|
|
7395
|
+
let parserMergeReady = 0;
|
|
7396
|
+
let targetEntries = 0;
|
|
7397
|
+
let missingAdapters = 0;
|
|
7398
|
+
let unsupportedTargetFeatures = 0;
|
|
7399
|
+
let exactSourceProjection = 0;
|
|
7400
|
+
let nativeSourceStubs = 0;
|
|
7401
|
+
let blockers = 0;
|
|
7402
|
+
let reviewReasons = 0;
|
|
7403
|
+
for (const row of rows) {
|
|
7404
|
+
byReadiness[row.readiness] = (byReadiness[row.readiness] ?? 0) + 1;
|
|
7405
|
+
byImportReadiness[row.imports.readiness] = (byImportReadiness[row.imports.readiness] ?? 0) + 1;
|
|
7406
|
+
byParserReadiness[row.parser.readiness] = (byParserReadiness[row.parser.readiness] ?? 0) + 1;
|
|
7407
|
+
byProjectionReadiness[row.projection.readiness] = (byProjectionReadiness[row.projection.readiness] ?? 0) + 1;
|
|
7408
|
+
imports += row.imports.total;
|
|
7409
|
+
symbols += row.imports.symbols;
|
|
7410
|
+
sourceMapMappings += row.imports.sourceMapMappings;
|
|
7411
|
+
losses += row.imports.losses;
|
|
7412
|
+
parserRows += row.parser.rows;
|
|
7413
|
+
parserMergeReady += row.parser.mergeReadyParsers.length;
|
|
7414
|
+
targetEntries += row.projection.targets.length;
|
|
7415
|
+
missingAdapters += row.projection.missingTargets.length;
|
|
7416
|
+
unsupportedTargetFeatures += row.projection.unsupportedTargets.length;
|
|
7417
|
+
exactSourceProjection += row.projection.summary.byLossClass?.exactSourceProjection ?? 0;
|
|
7418
|
+
nativeSourceStubs += row.projection.summary.byLossClass?.nativeSourceStubs ?? 0;
|
|
7419
|
+
blockers += row.blockers.length;
|
|
7420
|
+
reviewReasons += row.review.length;
|
|
7421
|
+
}
|
|
7422
|
+
return {
|
|
7423
|
+
languages: rows.length,
|
|
7424
|
+
imports,
|
|
7425
|
+
symbols,
|
|
7426
|
+
sourceMapMappings,
|
|
7427
|
+
losses,
|
|
7428
|
+
parserRows,
|
|
7429
|
+
parserMergeReady,
|
|
7430
|
+
targetEntries,
|
|
7431
|
+
missingAdapters,
|
|
7432
|
+
unsupportedTargetFeatures,
|
|
7433
|
+
exactSourceProjection,
|
|
7434
|
+
nativeSourceStubs,
|
|
7435
|
+
blockers,
|
|
7436
|
+
reviewReasons,
|
|
7437
|
+
readyLanguages: rows.filter((row) => row.readiness === 'ready').length,
|
|
7438
|
+
readyWithLossesLanguages: rows.filter((row) => row.readiness === 'ready-with-losses').length,
|
|
7439
|
+
reviewLanguages: rows.filter((row) => row.readiness === 'needs-review').length,
|
|
7440
|
+
blockedLanguages: rows.filter((row) => row.readiness === 'blocked').length,
|
|
7441
|
+
byReadiness,
|
|
7442
|
+
byImportReadiness,
|
|
7443
|
+
byParserReadiness,
|
|
7444
|
+
byProjectionReadiness
|
|
7445
|
+
};
|
|
7446
|
+
}
|
|
7447
|
+
|
|
7448
|
+
function universalLanguageIds(entry) {
|
|
7449
|
+
return uniqueStrings([
|
|
7450
|
+
entry?.language,
|
|
7451
|
+
...(entry?.aliases ?? [])
|
|
7452
|
+
].map(normalizeNativeLanguageId).filter(Boolean));
|
|
7453
|
+
}
|
|
7454
|
+
|
|
7194
7455
|
function countProjectionLossClasses(entries) {
|
|
7195
7456
|
const counts = {};
|
|
7196
7457
|
for (const entry of entries ?? []) {
|
package/package.json
CHANGED