@shapeshift-labs/frontier-lang-compiler 0.2.101 → 0.2.103
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/declarations/import-adapter-core.d.ts +6 -0
- package/dist/declarations/native-project-admission-semantic-evidence.d.ts +34 -0
- package/dist/declarations/native-project-admission.d.ts +6 -10
- package/dist/declarations/semantic-edit-script.d.ts +3 -0
- package/dist/declarations/semantic-patch-bundle-overlaps.d.ts +1 -0
- package/dist/internal/index-impl/createLightweightNativeImport.js +9 -1
- package/dist/internal/index-impl/createProjectImportAdmissionRecord.js +14 -2
- package/dist/internal/index-impl/diffNativeSymbols.js +82 -1
- package/dist/internal/index-impl/importNativeSource.js +14 -14
- package/dist/internal/index-impl/nativeImportSemanticIndex.js +33 -0
- package/dist/internal/index-impl/projectImportAdmissionImportEvidence.js +1 -1
- package/dist/internal/index-impl/projectImportAdmissionSemanticWarnings.js +178 -0
- package/dist/internal/index-impl/projectImportAdmissionSummaries.js +22 -3
- package/dist/internal/index-impl/projectSemanticEditScriptToSource.js +12 -62
- package/dist/internal/index-impl/replaySemanticEditProjection.js +43 -63
- package/dist/internal/index-impl/semanticEditImportProjection.js +53 -0
- package/dist/internal/index-impl/semanticEditProjectionRecord.js +79 -0
- package/dist/internal/index-impl/semanticEditReplayAnchors.js +63 -0
- package/dist/internal/index-impl/semanticEditSourceRanges.js +5 -0
- package/dist/internal/index-impl/semanticPatchBundleAdmission.js +51 -2
- package/dist/internal/index-impl/semanticPatchBundleOverlaps.js +33 -16
- package/dist/semantic-import-regions.js +12 -1
- package/package.json +1 -1
|
@@ -65,7 +65,8 @@ export function compareSemanticPatchBundleRecords(left={},right={},options={}){
|
|
|
65
65
|
semanticSignals:shared.semanticEditKeys.length+shared.semanticIdentityHashes.length+shared.sourceIdentityHashes.length+shared.semanticTransformIdentityHashes.length+shared.projectionIdentityHashes.length,
|
|
66
66
|
sourceSignals:shared.regionKeys.length+shared.conflictKeys.length+shared.sourcePaths.length+shared.semanticEditReplayCurrentHashes.length,
|
|
67
67
|
baseHashMismatch:admission.reasonCodes.includes('base-hash-mismatch'),
|
|
68
|
-
targetHashMismatch:admission.reasonCodes.includes('target-hash-mismatch')
|
|
68
|
+
targetHashMismatch:admission.reasonCodes.includes('target-hash-mismatch'),
|
|
69
|
+
replayOutputHashMismatch:admission.reasonCodes.includes('replay-output-hash-mismatch')
|
|
69
70
|
},
|
|
70
71
|
metadata:compactRecord(options.metadata)
|
|
71
72
|
};
|
|
@@ -110,21 +111,32 @@ function sharedIndex(left,right,options){
|
|
|
110
111
|
baseHashes:intersect(left.baseHashes,right.baseHashes),
|
|
111
112
|
targetHashes:intersect(left.targetHashes,right.targetHashes)
|
|
112
113
|
};
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
return{
|
|
114
|
+
const semanticKeyIndependent=hasDisjointSemanticEditScope(left,right,shared);
|
|
115
|
+
const scopedShared={
|
|
116
116
|
...shared,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
sourcePaths:semanticKeyIndependent?[]:shared.sourcePaths
|
|
118
|
+
};
|
|
119
|
+
const scopedEdit=hasSharedEditScope(scopedShared);
|
|
120
|
+
const scopedSource=hasSharedSourceScope(scopedShared);
|
|
121
|
+
return{
|
|
122
|
+
...scopedShared,
|
|
123
|
+
operationContentHashes:scopedEdit?scopedShared.operationContentHashes:[],
|
|
124
|
+
editContentHashes:scopedEdit?scopedShared.editContentHashes:[],
|
|
125
|
+
semanticEditKeys:scopedSource?scopedShared.semanticEditKeys:[],
|
|
126
|
+
semanticIdentityHashes:scopedSource?scopedShared.semanticIdentityHashes:[],
|
|
127
|
+
semanticEditReplayCurrentHashes:scopedSource?scopedShared.semanticEditReplayCurrentHashes:[],
|
|
128
|
+
semanticEditReplayOutputHashes:scopedEdit?scopedShared.semanticEditReplayOutputHashes:[],
|
|
129
|
+
semanticTransformContentHashes:scopedShared.projectionIdentityHashes.length?scopedShared.semanticTransformContentHashes:[],
|
|
130
|
+
semanticTransformIdentityHashes:scopedShared.projectionIdentityHashes.length?scopedShared.semanticTransformIdentityHashes:[]
|
|
125
131
|
};
|
|
126
132
|
}
|
|
127
133
|
|
|
134
|
+
function hasDisjointSemanticEditScope(left,right,shared){
|
|
135
|
+
return Boolean(shared.sourcePaths.length&&left.semanticEditKeys.length&&right.semanticEditKeys.length
|
|
136
|
+
&&shared.semanticEditKeys.length===0&&shared.regionKeys.length===0&&shared.conflictKeys.length===0
|
|
137
|
+
&&shared.semanticIdentityHashes.length===0&&shared.sourceIdentityHashes.length===0);
|
|
138
|
+
}
|
|
139
|
+
|
|
128
140
|
function hasSharedEditScope(shared){
|
|
129
141
|
return Boolean(shared.regionKeys.length||shared.conflictKeys.length||shared.sourceIdentityHashes.length
|
|
130
142
|
||(shared.sourcePaths.length&&(shared.semanticEditKeys.length||shared.semanticIdentityHashes.length)));
|
|
@@ -135,7 +147,10 @@ function hasSharedSourceScope(shared){
|
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
function overlapAdmission(shared,{leftIndex,rightIndex,options}){
|
|
138
|
-
const
|
|
150
|
+
const baseHashMismatch=disjointNonEmpty(leftIndex.baseHashes,rightIndex.baseHashes);
|
|
151
|
+
const targetHashMismatch=disjointNonEmpty(leftIndex.targetHashes,rightIndex.targetHashes);
|
|
152
|
+
const replayOutputHashMismatch=disjointNonEmpty(leftIndex.semanticEditReplayOutputHashes,rightIndex.semanticEditReplayOutputHashes);
|
|
153
|
+
const hashMismatch=baseHashMismatch||targetHashMismatch||replayOutputHashMismatch;
|
|
139
154
|
const sourceRelated=shared.sourcePaths.length||shared.regionKeys.length||shared.conflictKeys.length||shared.sourceIdentityHashes.length;
|
|
140
155
|
const editContent=shared.operationContentHashes.length||shared.editContentHashes.length||shared.semanticEditReplayOutputHashes.length;
|
|
141
156
|
const transformContent=shared.semanticTransformContentHashes.length&&shared.projectionIdentityHashes.length;
|
|
@@ -158,8 +173,9 @@ function overlapAdmission(shared,{leftIndex,rightIndex,options}){
|
|
|
158
173
|
shared.regionKeys.length?'same-region-key':undefined,
|
|
159
174
|
shared.conflictKeys.length?'same-conflict-key':undefined,
|
|
160
175
|
shared.sourcePaths.length?'same-source-path':undefined,
|
|
161
|
-
status!=='independent'&&
|
|
162
|
-
status!=='independent'&&
|
|
176
|
+
status!=='independent'&&baseHashMismatch?'base-hash-mismatch':undefined,
|
|
177
|
+
status!=='independent'&&targetHashMismatch?'target-hash-mismatch':undefined,
|
|
178
|
+
status!=='independent'&&replayOutputHashMismatch?'replay-output-hash-mismatch':undefined
|
|
163
179
|
]);
|
|
164
180
|
return{
|
|
165
181
|
status,
|
|
@@ -223,7 +239,8 @@ function matchesOverlap(overlap,query){
|
|
|
223
239
|
function overlapScore(status,shared,reasonCodes){
|
|
224
240
|
const base=status==='duplicate'?100:status==='semantic-overlap'?75:status==='source-overlap'?35:0;
|
|
225
241
|
const sharedBonus=Math.min(20,countShared(shared));
|
|
226
|
-
const stalePenalty=reasonCodes.includes('base-hash-mismatch')||reasonCodes.includes('target-hash-mismatch')
|
|
242
|
+
const stalePenalty=reasonCodes.includes('base-hash-mismatch')||reasonCodes.includes('target-hash-mismatch')
|
|
243
|
+
||reasonCodes.includes('replay-output-hash-mismatch')?15:0;
|
|
227
244
|
return Math.max(0,base+sharedBonus-stalePenalty);
|
|
228
245
|
}
|
|
229
246
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { caseSensitiveIdFragment, idFragment, uniqueStrings } from './native-import-utils.js';
|
|
1
|
+
import { caseSensitiveIdFragment, idFragment, uniqueRecordsById, uniqueStrings } from './native-import-utils.js';
|
|
2
2
|
|
|
3
3
|
const NativeImportRegionTaxonomyKinds = Object.freeze([
|
|
4
4
|
'symbol',
|
|
@@ -172,9 +172,20 @@ function summarizeSemanticImportRegionTaxonomy(regions) {
|
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
function semanticOwnershipRegionsFromSemanticIndex(semanticIndex) {
|
|
176
|
+
const factRegions = (semanticIndex?.facts ?? [])
|
|
177
|
+
.filter((fact) => fact?.predicate === 'semanticOwnershipRegion' && fact.value && typeof fact.value === 'object')
|
|
178
|
+
.map((fact) => fact.value);
|
|
179
|
+
return uniqueRecordsById([
|
|
180
|
+
...(Array.isArray(semanticIndex?.ownershipRegions) ? semanticIndex.ownershipRegions : []),
|
|
181
|
+
...factRegions
|
|
182
|
+
]);
|
|
183
|
+
}
|
|
184
|
+
|
|
175
185
|
export {
|
|
176
186
|
NativeImportRegionTaxonomyKinds,
|
|
177
187
|
semanticOwnershipRegionForDeclaration,
|
|
188
|
+
semanticOwnershipRegionsFromSemanticIndex,
|
|
178
189
|
semanticOwnershipRegionForSymbol,
|
|
179
190
|
semanticPatchHintForRegion,
|
|
180
191
|
semanticRegionKindForSymbol,
|
package/package.json
CHANGED