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

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.
@@ -123,6 +123,16 @@ export interface SemanticEditScript {
123
123
  export interface SemanticEditProjectionEdit {
124
124
  readonly operationId?: string;
125
125
  readonly status: 'applied' | 'already-applied';
126
+ readonly kind?: string;
127
+ readonly changeKind?: string;
128
+ readonly anchorKey?: string;
129
+ readonly conflictKey?: string;
130
+ readonly regionId?: string;
131
+ readonly regionKind?: string;
132
+ readonly sourcePath?: string;
133
+ readonly symbolId?: string;
134
+ readonly symbolName?: string;
135
+ readonly symbolKind?: string;
126
136
  readonly headStart: number;
127
137
  readonly headEnd: number;
128
138
  readonly workerStart?: number;
@@ -54,7 +54,7 @@ export function projectSemanticEditScriptToSource(input = {}) {
54
54
 
55
55
  function sourceEditForOperation(operation, workerSourceText, headSourceText) {
56
56
  if (operation.status === 'already-applied') {
57
- return { ok: true, value: { operationId: operation.id, start: 0, end: 0, replacement: '', current: '', alreadyApplied: true } };
57
+ return { ok: true, value: { ...semanticEditIdentity(operation), operationId: operation.id, start: 0, end: 0, replacement: '', current: '', alreadyApplied: true } };
58
58
  }
59
59
  if (operation.status !== 'portable') return { ok: false, reasonCodes: [`operation-not-portable:${operation.id}`] };
60
60
  const workerOffsets = spanOffsets(workerSourceText, operation.spans?.worker);
@@ -77,6 +77,7 @@ function sourceEditForOperation(operation, workerSourceText, headSourceText) {
77
77
  ok: true,
78
78
  value: {
79
79
  operationId: operation.id,
80
+ ...semanticEditIdentity(operation),
80
81
  start: headOffsets.start,
81
82
  end: headOffsets.end,
82
83
  workerStart: workerOffsets.start,
@@ -91,6 +92,16 @@ function projectionEditRecord(edit) {
91
92
  return compactRecord({
92
93
  operationId: edit.operationId,
93
94
  status: edit.alreadyApplied ? 'already-applied' : 'applied',
95
+ kind: edit.kind,
96
+ changeKind: edit.changeKind,
97
+ anchorKey: edit.anchorKey,
98
+ conflictKey: edit.conflictKey,
99
+ regionId: edit.regionId,
100
+ regionKind: edit.regionKind,
101
+ sourcePath: edit.sourcePath,
102
+ symbolId: edit.symbolId,
103
+ symbolName: edit.symbolName,
104
+ symbolKind: edit.symbolKind,
94
105
  headStart: edit.start,
95
106
  headEnd: edit.end,
96
107
  workerStart: edit.workerStart,
@@ -103,6 +114,22 @@ function projectionEditRecord(edit) {
103
114
  });
104
115
  }
105
116
 
117
+ function semanticEditIdentity(operation) {
118
+ const anchor = operation.anchor ?? {};
119
+ return compactRecord({
120
+ kind: operation.kind,
121
+ changeKind: operation.changeKind,
122
+ anchorKey: anchor.key,
123
+ conflictKey: anchor.conflictKey,
124
+ regionId: anchor.regionId,
125
+ regionKind: anchor.regionKind,
126
+ sourcePath: anchor.sourcePath,
127
+ symbolId: anchor.symbolId,
128
+ symbolName: anchor.symbolName,
129
+ symbolKind: anchor.symbolKind
130
+ });
131
+ }
132
+
106
133
  function applySourceEdits(sourceText, edits) {
107
134
  return edits.filter((edit) => !edit.alreadyApplied)
108
135
  .sort((left, right) => right.start - left.start)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshift-labs/frontier-lang-compiler",
3
- "version": "0.2.82",
3
+ "version": "0.2.83",
4
4
  "description": "Compiler facade for Frontier Lang source documents and language projection adapters.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",