@sitecore/sc-contenthub-blok 1.0.14 → 1.0.17
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/Components/BlokBadge/BlokBadge.d.ts +4 -1
- package/dist/Components/BlokBadge/BlokBadge.js +2 -2
- package/dist/Components/BlokBadge/BlokBadge.js.map +1 -1
- package/dist/Components/BlokBadge/BlokBadge.spec.js +48 -2
- package/dist/Components/BlokBadge/BlokBadge.spec.js.map +1 -1
- package/dist/Components/BlokIcon/BlokIcon.js +5 -0
- package/dist/Components/BlokIcon/BlokIcon.js.map +1 -1
- package/esm/Components/BlokBadge/BlokBadge.js +2 -2
- package/esm/Components/BlokBadge/BlokBadge.js.map +1 -1
- package/esm/Components/BlokIcon/BlokIcon.js +5 -0
- package/esm/Components/BlokIcon/BlokIcon.js.map +1 -1
- package/node_modules/@jridgewell/sourcemap-codec/LICENSE +3 -5
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +378 -379
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +6 -1
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +444 -419
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +6 -1
- package/node_modules/@jridgewell/sourcemap-codec/package.json +35 -47
- package/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +345 -0
- package/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +111 -0
- package/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +65 -0
- package/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +55 -0
- package/node_modules/@jridgewell/sourcemap-codec/{dist/types/scopes.d.ts → types/scopes.d.cts} +14 -13
- package/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +50 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +9 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +9 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/{dist/types/strings.d.ts → types/strings.d.cts} +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +16 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/{dist/types/vlq.d.ts → types/vlq.d.cts} +2 -1
- package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +1 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +7 -0
- package/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +1 -0
- package/package.json +12 -12
- package/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +0 -8
|
@@ -1,424 +1,423 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// src/vlq.ts
|
|
2
|
+
var comma = ",".charCodeAt(0);
|
|
3
|
+
var semicolon = ";".charCodeAt(0);
|
|
4
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
5
|
+
var intToChar = new Uint8Array(64);
|
|
6
|
+
var charToInt = new Uint8Array(128);
|
|
6
7
|
for (let i = 0; i < chars.length; i++) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const c = chars.charCodeAt(i);
|
|
9
|
+
intToChar[i] = c;
|
|
10
|
+
charToInt[c] = i;
|
|
10
11
|
}
|
|
11
12
|
function decodeInteger(reader, relative) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
let value = 0;
|
|
14
|
+
let shift = 0;
|
|
15
|
+
let integer = 0;
|
|
16
|
+
do {
|
|
17
|
+
const c = reader.next();
|
|
18
|
+
integer = charToInt[c];
|
|
19
|
+
value |= (integer & 31) << shift;
|
|
20
|
+
shift += 5;
|
|
21
|
+
} while (integer & 32);
|
|
22
|
+
const shouldNegate = value & 1;
|
|
23
|
+
value >>>= 1;
|
|
24
|
+
if (shouldNegate) {
|
|
25
|
+
value = -2147483648 | -value;
|
|
26
|
+
}
|
|
27
|
+
return relative + value;
|
|
27
28
|
}
|
|
28
29
|
function encodeInteger(builder, num, relative) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return num;
|
|
30
|
+
let delta = num - relative;
|
|
31
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
32
|
+
do {
|
|
33
|
+
let clamped = delta & 31;
|
|
34
|
+
delta >>>= 5;
|
|
35
|
+
if (delta > 0) clamped |= 32;
|
|
36
|
+
builder.write(intToChar[clamped]);
|
|
37
|
+
} while (delta > 0);
|
|
38
|
+
return num;
|
|
39
39
|
}
|
|
40
40
|
function hasMoreVlq(reader, max) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return reader.peek() !== comma;
|
|
41
|
+
if (reader.pos >= max) return false;
|
|
42
|
+
return reader.peek() !== comma;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
decode(buf) {
|
|
59
|
-
let out = '';
|
|
60
|
-
for (let i = 0; i < buf.length; i++) {
|
|
61
|
-
out += String.fromCharCode(buf[i]);
|
|
62
|
-
}
|
|
63
|
-
return out;
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
class StringWriter {
|
|
67
|
-
constructor() {
|
|
68
|
-
this.pos = 0;
|
|
69
|
-
this.out = '';
|
|
70
|
-
this.buffer = new Uint8Array(bufLength);
|
|
71
|
-
}
|
|
72
|
-
write(v) {
|
|
73
|
-
const { buffer } = this;
|
|
74
|
-
buffer[this.pos++] = v;
|
|
75
|
-
if (this.pos === bufLength) {
|
|
76
|
-
this.out += td.decode(buffer);
|
|
77
|
-
this.pos = 0;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
flush() {
|
|
81
|
-
const { buffer, out, pos } = this;
|
|
82
|
-
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
45
|
+
// src/strings.ts
|
|
46
|
+
var bufLength = 1024 * 16;
|
|
47
|
+
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
|
|
48
|
+
decode(buf) {
|
|
49
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
50
|
+
return out.toString();
|
|
51
|
+
}
|
|
52
|
+
} : {
|
|
53
|
+
decode(buf) {
|
|
54
|
+
let out = "";
|
|
55
|
+
for (let i = 0; i < buf.length; i++) {
|
|
56
|
+
out += String.fromCharCode(buf[i]);
|
|
83
57
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var StringWriter = class {
|
|
62
|
+
constructor() {
|
|
63
|
+
this.pos = 0;
|
|
64
|
+
this.out = "";
|
|
65
|
+
this.buffer = new Uint8Array(bufLength);
|
|
66
|
+
}
|
|
67
|
+
write(v) {
|
|
68
|
+
const { buffer } = this;
|
|
69
|
+
buffer[this.pos++] = v;
|
|
70
|
+
if (this.pos === bufLength) {
|
|
71
|
+
this.out += td.decode(buffer);
|
|
72
|
+
this.pos = 0;
|
|
89
73
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
74
|
+
}
|
|
75
|
+
flush() {
|
|
76
|
+
const { buffer, out, pos } = this;
|
|
77
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var StringReader = class {
|
|
81
|
+
constructor(buffer) {
|
|
82
|
+
this.pos = 0;
|
|
83
|
+
this.buffer = buffer;
|
|
84
|
+
}
|
|
85
|
+
next() {
|
|
86
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
87
|
+
}
|
|
88
|
+
peek() {
|
|
89
|
+
return this.buffer.charCodeAt(this.pos);
|
|
90
|
+
}
|
|
91
|
+
indexOf(char) {
|
|
92
|
+
const { buffer, pos } = this;
|
|
93
|
+
const idx = buffer.indexOf(char, pos);
|
|
94
|
+
return idx === -1 ? buffer.length : idx;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
102
97
|
|
|
103
|
-
|
|
98
|
+
// src/scopes.ts
|
|
99
|
+
var EMPTY = [];
|
|
104
100
|
function decodeOriginalScopes(input) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
scope.vars = vars;
|
|
132
|
-
scopes.push(scope);
|
|
133
|
-
stack.push(scope);
|
|
101
|
+
const { length } = input;
|
|
102
|
+
const reader = new StringReader(input);
|
|
103
|
+
const scopes = [];
|
|
104
|
+
const stack = [];
|
|
105
|
+
let line = 0;
|
|
106
|
+
for (; reader.pos < length; reader.pos++) {
|
|
107
|
+
line = decodeInteger(reader, line);
|
|
108
|
+
const column = decodeInteger(reader, 0);
|
|
109
|
+
if (!hasMoreVlq(reader, length)) {
|
|
110
|
+
const last = stack.pop();
|
|
111
|
+
last[2] = line;
|
|
112
|
+
last[3] = column;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const kind = decodeInteger(reader, 0);
|
|
116
|
+
const fields = decodeInteger(reader, 0);
|
|
117
|
+
const hasName = fields & 1;
|
|
118
|
+
const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
|
|
119
|
+
let vars = EMPTY;
|
|
120
|
+
if (hasMoreVlq(reader, length)) {
|
|
121
|
+
vars = [];
|
|
122
|
+
do {
|
|
123
|
+
const varsIndex = decodeInteger(reader, 0);
|
|
124
|
+
vars.push(varsIndex);
|
|
125
|
+
} while (hasMoreVlq(reader, length));
|
|
134
126
|
}
|
|
135
|
-
|
|
127
|
+
scope.vars = vars;
|
|
128
|
+
scopes.push(scope);
|
|
129
|
+
stack.push(scope);
|
|
130
|
+
}
|
|
131
|
+
return scopes;
|
|
136
132
|
}
|
|
137
133
|
function encodeOriginalScopes(scopes) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
const writer = new StringWriter();
|
|
135
|
+
for (let i = 0; i < scopes.length; ) {
|
|
136
|
+
i = _encodeOriginalScopes(scopes, i, writer, [0]);
|
|
137
|
+
}
|
|
138
|
+
return writer.flush();
|
|
143
139
|
}
|
|
144
140
|
function _encodeOriginalScopes(scopes, index, writer, state) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
141
|
+
const scope = scopes[index];
|
|
142
|
+
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
|
|
143
|
+
if (index > 0) writer.write(comma);
|
|
144
|
+
state[0] = encodeInteger(writer, startLine, state[0]);
|
|
145
|
+
encodeInteger(writer, startColumn, 0);
|
|
146
|
+
encodeInteger(writer, kind, 0);
|
|
147
|
+
const fields = scope.length === 6 ? 1 : 0;
|
|
148
|
+
encodeInteger(writer, fields, 0);
|
|
149
|
+
if (scope.length === 6) encodeInteger(writer, scope[5], 0);
|
|
150
|
+
for (const v of vars) {
|
|
151
|
+
encodeInteger(writer, v, 0);
|
|
152
|
+
}
|
|
153
|
+
for (index++; index < scopes.length; ) {
|
|
154
|
+
const next = scopes[index];
|
|
155
|
+
const { 0: l, 1: c } = next;
|
|
156
|
+
if (l > endLine || l === endLine && c >= endColumn) {
|
|
157
|
+
break;
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
index = _encodeOriginalScopes(scopes, index, writer, state);
|
|
166
|
-
}
|
|
167
|
-
writer.write(comma);
|
|
168
|
-
state[0] = encodeInteger(writer, endLine, state[0]);
|
|
169
|
-
encodeInteger(writer, endColumn, 0);
|
|
170
|
-
return index;
|
|
159
|
+
index = _encodeOriginalScopes(scopes, index, writer, state);
|
|
160
|
+
}
|
|
161
|
+
writer.write(comma);
|
|
162
|
+
state[0] = encodeInteger(writer, endLine, state[0]);
|
|
163
|
+
encodeInteger(writer, endColumn, 0);
|
|
164
|
+
return index;
|
|
171
165
|
}
|
|
172
166
|
function decodeGeneratedRanges(input) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
bindings.push(expressionRanges);
|
|
244
|
-
} while (hasMoreVlq(reader, semi));
|
|
167
|
+
const { length } = input;
|
|
168
|
+
const reader = new StringReader(input);
|
|
169
|
+
const ranges = [];
|
|
170
|
+
const stack = [];
|
|
171
|
+
let genLine = 0;
|
|
172
|
+
let definitionSourcesIndex = 0;
|
|
173
|
+
let definitionScopeIndex = 0;
|
|
174
|
+
let callsiteSourcesIndex = 0;
|
|
175
|
+
let callsiteLine = 0;
|
|
176
|
+
let callsiteColumn = 0;
|
|
177
|
+
let bindingLine = 0;
|
|
178
|
+
let bindingColumn = 0;
|
|
179
|
+
do {
|
|
180
|
+
const semi = reader.indexOf(";");
|
|
181
|
+
let genColumn = 0;
|
|
182
|
+
for (; reader.pos < semi; reader.pos++) {
|
|
183
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
184
|
+
if (!hasMoreVlq(reader, semi)) {
|
|
185
|
+
const last = stack.pop();
|
|
186
|
+
last[2] = genLine;
|
|
187
|
+
last[3] = genColumn;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const fields = decodeInteger(reader, 0);
|
|
191
|
+
const hasDefinition = fields & 1;
|
|
192
|
+
const hasCallsite = fields & 2;
|
|
193
|
+
const hasScope = fields & 4;
|
|
194
|
+
let callsite = null;
|
|
195
|
+
let bindings = EMPTY;
|
|
196
|
+
let range;
|
|
197
|
+
if (hasDefinition) {
|
|
198
|
+
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
|
|
199
|
+
definitionScopeIndex = decodeInteger(
|
|
200
|
+
reader,
|
|
201
|
+
definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0
|
|
202
|
+
);
|
|
203
|
+
definitionSourcesIndex = defSourcesIndex;
|
|
204
|
+
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
|
|
205
|
+
} else {
|
|
206
|
+
range = [genLine, genColumn, 0, 0];
|
|
207
|
+
}
|
|
208
|
+
range.isScope = !!hasScope;
|
|
209
|
+
if (hasCallsite) {
|
|
210
|
+
const prevCsi = callsiteSourcesIndex;
|
|
211
|
+
const prevLine = callsiteLine;
|
|
212
|
+
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
|
|
213
|
+
const sameSource = prevCsi === callsiteSourcesIndex;
|
|
214
|
+
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
|
|
215
|
+
callsiteColumn = decodeInteger(
|
|
216
|
+
reader,
|
|
217
|
+
sameSource && prevLine === callsiteLine ? callsiteColumn : 0
|
|
218
|
+
);
|
|
219
|
+
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
|
|
220
|
+
}
|
|
221
|
+
range.callsite = callsite;
|
|
222
|
+
if (hasMoreVlq(reader, semi)) {
|
|
223
|
+
bindings = [];
|
|
224
|
+
do {
|
|
225
|
+
bindingLine = genLine;
|
|
226
|
+
bindingColumn = genColumn;
|
|
227
|
+
const expressionsCount = decodeInteger(reader, 0);
|
|
228
|
+
let expressionRanges;
|
|
229
|
+
if (expressionsCount < -1) {
|
|
230
|
+
expressionRanges = [[decodeInteger(reader, 0)]];
|
|
231
|
+
for (let i = -1; i > expressionsCount; i--) {
|
|
232
|
+
const prevBl = bindingLine;
|
|
233
|
+
bindingLine = decodeInteger(reader, bindingLine);
|
|
234
|
+
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
|
|
235
|
+
const expression = decodeInteger(reader, 0);
|
|
236
|
+
expressionRanges.push([expression, bindingLine, bindingColumn]);
|
|
245
237
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
238
|
+
} else {
|
|
239
|
+
expressionRanges = [[expressionsCount]];
|
|
240
|
+
}
|
|
241
|
+
bindings.push(expressionRanges);
|
|
242
|
+
} while (hasMoreVlq(reader, semi));
|
|
243
|
+
}
|
|
244
|
+
range.bindings = bindings;
|
|
245
|
+
ranges.push(range);
|
|
246
|
+
stack.push(range);
|
|
247
|
+
}
|
|
248
|
+
genLine++;
|
|
249
|
+
reader.pos = semi + 1;
|
|
250
|
+
} while (reader.pos < length);
|
|
251
|
+
return ranges;
|
|
254
252
|
}
|
|
255
253
|
function encodeGeneratedRanges(ranges) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return writer.flush();
|
|
254
|
+
if (ranges.length === 0) return "";
|
|
255
|
+
const writer = new StringWriter();
|
|
256
|
+
for (let i = 0; i < ranges.length; ) {
|
|
257
|
+
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
|
|
258
|
+
}
|
|
259
|
+
return writer.flush();
|
|
263
260
|
}
|
|
264
261
|
function _encodeGeneratedRanges(ranges, index, writer, state) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
state[5] = 0;
|
|
290
|
-
state[6] = 0;
|
|
291
|
-
}
|
|
292
|
-
else if (callLine !== state[5]) {
|
|
293
|
-
state[6] = 0;
|
|
294
|
-
}
|
|
295
|
-
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
|
|
296
|
-
state[5] = encodeInteger(writer, callLine, state[5]);
|
|
297
|
-
state[6] = encodeInteger(writer, callColumn, state[6]);
|
|
298
|
-
}
|
|
299
|
-
if (bindings) {
|
|
300
|
-
for (const binding of bindings) {
|
|
301
|
-
if (binding.length > 1)
|
|
302
|
-
encodeInteger(writer, -binding.length, 0);
|
|
303
|
-
const expression = binding[0][0];
|
|
304
|
-
encodeInteger(writer, expression, 0);
|
|
305
|
-
let bindingStartLine = startLine;
|
|
306
|
-
let bindingStartColumn = startColumn;
|
|
307
|
-
for (let i = 1; i < binding.length; i++) {
|
|
308
|
-
const expRange = binding[i];
|
|
309
|
-
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
|
|
310
|
-
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
|
|
311
|
-
encodeInteger(writer, expRange[0], 0);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
262
|
+
const range = ranges[index];
|
|
263
|
+
const {
|
|
264
|
+
0: startLine,
|
|
265
|
+
1: startColumn,
|
|
266
|
+
2: endLine,
|
|
267
|
+
3: endColumn,
|
|
268
|
+
isScope,
|
|
269
|
+
callsite,
|
|
270
|
+
bindings
|
|
271
|
+
} = range;
|
|
272
|
+
if (state[0] < startLine) {
|
|
273
|
+
catchupLine(writer, state[0], startLine);
|
|
274
|
+
state[0] = startLine;
|
|
275
|
+
state[1] = 0;
|
|
276
|
+
} else if (index > 0) {
|
|
277
|
+
writer.write(comma);
|
|
278
|
+
}
|
|
279
|
+
state[1] = encodeInteger(writer, range[1], state[1]);
|
|
280
|
+
const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
|
|
281
|
+
encodeInteger(writer, fields, 0);
|
|
282
|
+
if (range.length === 6) {
|
|
283
|
+
const { 4: sourcesIndex, 5: scopesIndex } = range;
|
|
284
|
+
if (sourcesIndex !== state[2]) {
|
|
285
|
+
state[3] = 0;
|
|
314
286
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
287
|
+
state[2] = encodeInteger(writer, sourcesIndex, state[2]);
|
|
288
|
+
state[3] = encodeInteger(writer, scopesIndex, state[3]);
|
|
289
|
+
}
|
|
290
|
+
if (callsite) {
|
|
291
|
+
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
|
|
292
|
+
if (sourcesIndex !== state[4]) {
|
|
293
|
+
state[5] = 0;
|
|
294
|
+
state[6] = 0;
|
|
295
|
+
} else if (callLine !== state[5]) {
|
|
296
|
+
state[6] = 0;
|
|
322
297
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
298
|
+
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
|
|
299
|
+
state[5] = encodeInteger(writer, callLine, state[5]);
|
|
300
|
+
state[6] = encodeInteger(writer, callColumn, state[6]);
|
|
301
|
+
}
|
|
302
|
+
if (bindings) {
|
|
303
|
+
for (const binding of bindings) {
|
|
304
|
+
if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
|
|
305
|
+
const expression = binding[0][0];
|
|
306
|
+
encodeInteger(writer, expression, 0);
|
|
307
|
+
let bindingStartLine = startLine;
|
|
308
|
+
let bindingStartColumn = startColumn;
|
|
309
|
+
for (let i = 1; i < binding.length; i++) {
|
|
310
|
+
const expRange = binding[i];
|
|
311
|
+
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
|
|
312
|
+
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
|
|
313
|
+
encodeInteger(writer, expRange[0], 0);
|
|
314
|
+
}
|
|
327
315
|
}
|
|
328
|
-
|
|
329
|
-
|
|
316
|
+
}
|
|
317
|
+
for (index++; index < ranges.length; ) {
|
|
318
|
+
const next = ranges[index];
|
|
319
|
+
const { 0: l, 1: c } = next;
|
|
320
|
+
if (l > endLine || l === endLine && c >= endColumn) {
|
|
321
|
+
break;
|
|
330
322
|
}
|
|
331
|
-
|
|
332
|
-
|
|
323
|
+
index = _encodeGeneratedRanges(ranges, index, writer, state);
|
|
324
|
+
}
|
|
325
|
+
if (state[0] < endLine) {
|
|
326
|
+
catchupLine(writer, state[0], endLine);
|
|
327
|
+
state[0] = endLine;
|
|
328
|
+
state[1] = 0;
|
|
329
|
+
} else {
|
|
330
|
+
writer.write(comma);
|
|
331
|
+
}
|
|
332
|
+
state[1] = encodeInteger(writer, endColumn, state[1]);
|
|
333
|
+
return index;
|
|
333
334
|
}
|
|
334
335
|
function catchupLine(writer, lastLine, line) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
do {
|
|
337
|
+
writer.write(semicolon);
|
|
338
|
+
} while (++lastLine < line);
|
|
338
339
|
}
|
|
339
340
|
|
|
341
|
+
// src/sourcemap-codec.ts
|
|
340
342
|
function decode(mappings) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
else {
|
|
370
|
-
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
seg = [genColumn];
|
|
375
|
-
}
|
|
376
|
-
line.push(seg);
|
|
377
|
-
reader.pos++;
|
|
343
|
+
const { length } = mappings;
|
|
344
|
+
const reader = new StringReader(mappings);
|
|
345
|
+
const decoded = [];
|
|
346
|
+
let genColumn = 0;
|
|
347
|
+
let sourcesIndex = 0;
|
|
348
|
+
let sourceLine = 0;
|
|
349
|
+
let sourceColumn = 0;
|
|
350
|
+
let namesIndex = 0;
|
|
351
|
+
do {
|
|
352
|
+
const semi = reader.indexOf(";");
|
|
353
|
+
const line = [];
|
|
354
|
+
let sorted = true;
|
|
355
|
+
let lastCol = 0;
|
|
356
|
+
genColumn = 0;
|
|
357
|
+
while (reader.pos < semi) {
|
|
358
|
+
let seg;
|
|
359
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
360
|
+
if (genColumn < lastCol) sorted = false;
|
|
361
|
+
lastCol = genColumn;
|
|
362
|
+
if (hasMoreVlq(reader, semi)) {
|
|
363
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
364
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
365
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
366
|
+
if (hasMoreVlq(reader, semi)) {
|
|
367
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
368
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
369
|
+
} else {
|
|
370
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
378
371
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
372
|
+
} else {
|
|
373
|
+
seg = [genColumn];
|
|
374
|
+
}
|
|
375
|
+
line.push(seg);
|
|
376
|
+
reader.pos++;
|
|
377
|
+
}
|
|
378
|
+
if (!sorted) sort(line);
|
|
379
|
+
decoded.push(line);
|
|
380
|
+
reader.pos = semi + 1;
|
|
381
|
+
} while (reader.pos <= length);
|
|
382
|
+
return decoded;
|
|
385
383
|
}
|
|
386
384
|
function sort(line) {
|
|
387
|
-
|
|
385
|
+
line.sort(sortComparator);
|
|
388
386
|
}
|
|
389
387
|
function sortComparator(a, b) {
|
|
390
|
-
|
|
388
|
+
return a[0] - b[0];
|
|
391
389
|
}
|
|
392
390
|
function encode(decoded) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
414
|
-
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
415
|
-
if (segment.length === 4)
|
|
416
|
-
continue;
|
|
417
|
-
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
418
|
-
}
|
|
391
|
+
const writer = new StringWriter();
|
|
392
|
+
let sourcesIndex = 0;
|
|
393
|
+
let sourceLine = 0;
|
|
394
|
+
let sourceColumn = 0;
|
|
395
|
+
let namesIndex = 0;
|
|
396
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
397
|
+
const line = decoded[i];
|
|
398
|
+
if (i > 0) writer.write(semicolon);
|
|
399
|
+
if (line.length === 0) continue;
|
|
400
|
+
let genColumn = 0;
|
|
401
|
+
for (let j = 0; j < line.length; j++) {
|
|
402
|
+
const segment = line[j];
|
|
403
|
+
if (j > 0) writer.write(comma);
|
|
404
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
405
|
+
if (segment.length === 1) continue;
|
|
406
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
407
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
408
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
409
|
+
if (segment.length === 4) continue;
|
|
410
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
419
411
|
}
|
|
420
|
-
|
|
412
|
+
}
|
|
413
|
+
return writer.flush();
|
|
421
414
|
}
|
|
422
|
-
|
|
423
|
-
|
|
415
|
+
export {
|
|
416
|
+
decode,
|
|
417
|
+
decodeGeneratedRanges,
|
|
418
|
+
decodeOriginalScopes,
|
|
419
|
+
encode,
|
|
420
|
+
encodeGeneratedRanges,
|
|
421
|
+
encodeOriginalScopes
|
|
422
|
+
};
|
|
424
423
|
//# sourceMappingURL=sourcemap-codec.mjs.map
|