@shapeshift-labs/frontier-lang-compiler 0.2.127 → 0.2.128
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.
|
@@ -214,7 +214,7 @@ function moduleSpecifierForDeclaration(declaration) {
|
|
|
214
214
|
declaration.metadata?.importPath,
|
|
215
215
|
declaration.metadata?.exportPath,
|
|
216
216
|
declaration.metadata?.source,
|
|
217
|
-
declaration.symbolKind === 'module' ? declaration.name : undefined
|
|
217
|
+
declaration.role === 'import' && declaration.symbolKind === 'module' ? declaration.name : undefined
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JsTsSafeMergeConflictCodes, JsTsSafeMergeGateIds } from './js-ts-safe-merge-constants.js';
|
|
2
2
|
import { addConflict, arraysEqual, sameStatementText } from './js-ts-safe-merge-context.js';
|
|
3
|
+
import { validateCrossSideExportStarAdditions } from './js-ts-safe-merge-export-star-validation.js';
|
|
3
4
|
|
|
4
5
|
export function analyzeVariantLedger(base, variant, baseIndex, side, context) {
|
|
5
6
|
const projectedBaseKeys = [];
|
|
@@ -159,6 +160,7 @@ export function validateIndependentAdditions(base, workerPlan, headPlan, context
|
|
|
159
160
|
validateAddedEntryNames(workerPlan, declarationNames, context);
|
|
160
161
|
validateAddedEntryNames(headPlan, declarationNames, context);
|
|
161
162
|
validateCrossSideAddedNames(workerPlan, headPlan, context);
|
|
163
|
+
validateCrossSideExportStarAdditions(workerPlan, headPlan, context);
|
|
162
164
|
validateCrossSideImportAdditions(workerPlan, headPlan, context);
|
|
163
165
|
validateMergedImportAndDeclarationNames(base, workerPlan, headPlan, context);
|
|
164
166
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { JsTsSafeMergeConflictCodes, JsTsSafeMergeGateIds } from './js-ts-safe-merge-constants.js';
|
|
2
|
+
import { addConflict } from './js-ts-safe-merge-context.js';
|
|
3
|
+
|
|
4
|
+
export function validateCrossSideExportStarAdditions(workerPlan, headPlan, context) {
|
|
5
|
+
if (context.deferReExportIdentityConflictsToProjectGraph === true) return;
|
|
6
|
+
for (const workerEntry of workerPlan.addedEntries) {
|
|
7
|
+
for (const headEntry of headPlan.addedEntries) {
|
|
8
|
+
if (!isSourceOnlyExportStarRisk(workerEntry, headEntry)) continue;
|
|
9
|
+
addConflict(context, {
|
|
10
|
+
code: JsTsSafeMergeConflictCodes.duplicateName,
|
|
11
|
+
gateId: JsTsSafeMergeGateIds.uniqueNames,
|
|
12
|
+
side: 'worker',
|
|
13
|
+
message: 'Source-only merge cannot prove export-star additions have disjoint public names.',
|
|
14
|
+
details: {
|
|
15
|
+
reasonCode: 'source-only-export-star-requires-project-graph',
|
|
16
|
+
workerKey: workerEntry.key,
|
|
17
|
+
headKey: headEntry.key,
|
|
18
|
+
workerStatement: workerEntry.text.trim(),
|
|
19
|
+
headStatement: headEntry.text.trim()
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isSourceOnlyExportStarRisk(left, right) {
|
|
28
|
+
const leftStar = isExportStarReExportEntry(left);
|
|
29
|
+
const rightStar = isExportStarReExportEntry(right);
|
|
30
|
+
if (!leftStar && !rightStar) return false;
|
|
31
|
+
if (leftStar && rightStar && sameExportStarIdentity(left, right)) return false;
|
|
32
|
+
return isPublicSurfaceAddition(left) && isPublicSurfaceAddition(right);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isExportStarReExportEntry(entry) {
|
|
36
|
+
return entry?.kind === 'export' && entry.declarationInfo?.reExport === true && entry.declarationInfo?.exportStar === true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function sameExportStarIdentity(left, right) {
|
|
40
|
+
return left?.declarationInfo?.moduleSpecifier === right?.declarationInfo?.moduleSpecifier
|
|
41
|
+
&& Boolean(left?.declarationInfo?.typeOnly) === Boolean(right?.declarationInfo?.typeOnly);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isPublicSurfaceAddition(entry) {
|
|
45
|
+
return entry?.kind === 'export' || entry?.declarationInfo?.exported === true;
|
|
46
|
+
}
|
|
@@ -46,7 +46,7 @@ function addProjectGraphDeltaConflictSummary(projectGraphDelta, conflicts) {
|
|
|
46
46
|
publicContractConflicts: conflicts.filter((conflict) => conflict.code === 'project-public-contract-delta-conflict').length,
|
|
47
47
|
reExportIdentityConflicts: conflicts.filter((conflict) => conflict.code === 'project-re-export-identity-delta-conflict').length,
|
|
48
48
|
importTargetConflicts: conflicts.filter((conflict) => conflict.code === 'project-import-target-delta-conflict').length,
|
|
49
|
-
limitConflicts: conflicts.filter((conflict) => conflict.
|
|
49
|
+
limitConflicts: conflicts.filter((conflict) => conflict.gateId === 'project-graph-limit').length
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
}
|
package/package.json
CHANGED