@shapeshift-labs/frontier-lang-compiler 0.2.83 → 0.2.84

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.
@@ -133,6 +133,10 @@ export interface SemanticEditProjectionEdit {
133
133
  readonly symbolId?: string;
134
134
  readonly symbolName?: string;
135
135
  readonly symbolKind?: string;
136
+ readonly semanticKey?: string;
137
+ readonly semanticIdentityHash?: string;
138
+ readonly sourceIdentityHash?: string;
139
+ readonly editContentHash?: string;
136
140
  readonly headStart: number;
137
141
  readonly headEnd: number;
138
142
  readonly workerStart?: number;
@@ -89,6 +89,11 @@ function sourceEditForOperation(operation, workerSourceText, headSourceText) {
89
89
  }
90
90
 
91
91
  function projectionEditRecord(edit) {
92
+ const deletedTextHash = hashSemanticValue(edit.current);
93
+ const replacementTextHash = hashSemanticValue(edit.replacement);
94
+ const semanticKey = semanticEditKey(edit);
95
+ const semanticIdentityHash = hashSemanticValue(semanticIdentityRecord(edit, semanticKey));
96
+ const sourceIdentityHash = hashSemanticValue(sourceIdentityRecord(edit));
92
97
  return compactRecord({
93
98
  operationId: edit.operationId,
94
99
  status: edit.alreadyApplied ? 'already-applied' : 'applied',
@@ -102,18 +107,56 @@ function projectionEditRecord(edit) {
102
107
  symbolId: edit.symbolId,
103
108
  symbolName: edit.symbolName,
104
109
  symbolKind: edit.symbolKind,
110
+ semanticKey,
111
+ semanticIdentityHash,
112
+ sourceIdentityHash,
113
+ editContentHash: hashSemanticValue(compactRecord({
114
+ semanticIdentityHash,
115
+ deletedTextHash,
116
+ replacementTextHash,
117
+ status: edit.alreadyApplied ? 'already-applied' : 'applied'
118
+ })),
105
119
  headStart: edit.start,
106
120
  headEnd: edit.end,
107
121
  workerStart: edit.workerStart,
108
122
  workerEnd: edit.workerEnd,
109
123
  deletedBytes: edit.current.length,
110
124
  replacementBytes: edit.replacement.length,
111
- deletedTextHash: hashSemanticValue(edit.current),
112
- replacementTextHash: hashSemanticValue(edit.replacement),
125
+ deletedTextHash,
126
+ replacementTextHash,
113
127
  replacementText: edit.replacement
114
128
  });
115
129
  }
116
130
 
131
+ function semanticEditKey(edit) {
132
+ const scope = edit.symbolName
133
+ ? `${edit.symbolKind ?? 'symbol'}:${edit.symbolName}`
134
+ : edit.anchorKey ?? edit.regionId ?? edit.operationId;
135
+ return ['semantic-edit', edit.kind ?? 'region', edit.changeKind ?? 'change', scope].filter(Boolean).join(':');
136
+ }
137
+
138
+ function semanticIdentityRecord(edit, semanticKey) {
139
+ return compactRecord({
140
+ semanticKey,
141
+ kind: edit.kind,
142
+ changeKind: edit.changeKind,
143
+ regionKind: edit.regionKind,
144
+ symbolName: edit.symbolName,
145
+ symbolKind: edit.symbolKind
146
+ });
147
+ }
148
+
149
+ function sourceIdentityRecord(edit) {
150
+ return compactRecord({
151
+ anchorKey: edit.anchorKey,
152
+ conflictKey: edit.conflictKey,
153
+ regionId: edit.regionId,
154
+ sourcePath: edit.sourcePath,
155
+ symbolId: edit.symbolId,
156
+ semanticKey: semanticEditKey(edit)
157
+ });
158
+ }
159
+
117
160
  function semanticEditIdentity(operation) {
118
161
  const anchor = operation.anchor ?? {};
119
162
  return compactRecord({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-compiler",
3
- "version": "0.2.83",
3
+ "version": "0.2.84",
4
4
  "description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",