@dialecte/nsd 0.0.5 → 0.1.0

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.
Files changed (45) hide show
  1. package/dist/config-OIL3vhlF.js +3555 -0
  2. package/dist/{config → v2017A/config}/dialecte.config.d.ts.map +1 -1
  3. package/dist/v2017A/config/hydrated.types.d.ts.map +1 -0
  4. package/dist/v2017A/config/index.d.ts.map +1 -0
  5. package/dist/v2017A/definition/constants.generated.d.ts.map +1 -0
  6. package/dist/{definition → v2017A/definition}/definition.generated.d.ts.map +1 -1
  7. package/dist/v2017A/definition/index.d.ts.map +1 -0
  8. package/dist/v2017A/definition/types.generated.d.ts.map +1 -0
  9. package/dist/v2017A/dialecte.d.ts.map +1 -0
  10. package/dist/v2017A/extensions/index.d.ts.map +1 -0
  11. package/dist/v2017A/index.d.ts.map +1 -0
  12. package/dist/v2017A/index.js +20 -0
  13. package/dist/{test → v2017A/test}/hydrated-test.d.ts.map +1 -1
  14. package/dist/v2017A/test/hydrated-test.types.d.ts.map +1 -0
  15. package/dist/v2017A/test/index.d.ts.map +1 -0
  16. package/dist/v2017A/test.js +20 -0
  17. package/package.json +15 -8
  18. package/dist/config/hydrated.types.d.ts.map +0 -1
  19. package/dist/config/index.d.ts.map +0 -1
  20. package/dist/config-zLg71lgV.js +0 -11497
  21. package/dist/definition/constants.generated.d.ts.map +0 -1
  22. package/dist/definition/index.d.ts.map +0 -1
  23. package/dist/definition/types.generated.d.ts.map +0 -1
  24. package/dist/dialecte.d.ts.map +0 -1
  25. package/dist/extensions/index.d.ts.map +0 -1
  26. package/dist/index.d.ts.map +0 -1
  27. package/dist/index.js +0 -19
  28. package/dist/magic-string.es-BzExMDjp.js +0 -659
  29. package/dist/test/hydrated-test.types.d.ts.map +0 -1
  30. package/dist/test/index.d.ts.map +0 -1
  31. package/dist/test.js +0 -11725
  32. /package/dist/{config → v2017A/config}/dialecte.config.d.ts +0 -0
  33. /package/dist/{config → v2017A/config}/hydrated.types.d.ts +0 -0
  34. /package/dist/{config → v2017A/config}/index.d.ts +0 -0
  35. /package/dist/{definition → v2017A/definition}/constants.generated.d.ts +0 -0
  36. /package/dist/{definition → v2017A/definition}/definition.generated.d.ts +0 -0
  37. /package/dist/{definition → v2017A/definition}/index.d.ts +0 -0
  38. /package/dist/{definition → v2017A/definition}/types.generated.d.ts +0 -0
  39. /package/dist/{dialecte.d.ts → v2017A/dialecte.d.ts} +0 -0
  40. /package/dist/{extensions → v2017A/extensions}/index.d.ts +0 -0
  41. /package/dist/{index.d.ts → v2017A/index.d.ts} +0 -0
  42. /package/dist/{test → v2017A/test}/hydrated-test.d.ts +0 -0
  43. /package/dist/{test → v2017A/test}/hydrated-test.types.d.ts +0 -0
  44. /package/dist/{test → v2017A/test}/index.d.ts +0 -0
  45. /package/dist/{test.d.ts → v2017A/test.d.ts} +0 -0
@@ -1,659 +0,0 @@
1
- //#region node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2
- var e = 44, t = 59, n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = new Uint8Array(64), i = new Uint8Array(128);
3
- for (let e = 0; e < n.length; e++) {
4
- let t = n.charCodeAt(e);
5
- r[e] = t, i[t] = e;
6
- }
7
- function a(e, t, n) {
8
- let i = t - n;
9
- i = i < 0 ? -i << 1 | 1 : i << 1;
10
- do {
11
- let t = i & 31;
12
- i >>>= 5, i > 0 && (t |= 32), e.write(r[t]);
13
- } while (i > 0);
14
- return t;
15
- }
16
- var o = 1024 * 16, s = typeof TextDecoder < "u" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer < "u" ? { decode(e) {
17
- return Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString();
18
- } } : { decode(e) {
19
- let t = "";
20
- for (let n = 0; n < e.length; n++) t += String.fromCharCode(e[n]);
21
- return t;
22
- } }, c = class {
23
- constructor() {
24
- this.pos = 0, this.out = "", this.buffer = new Uint8Array(o);
25
- }
26
- write(e) {
27
- let { buffer: t } = this;
28
- t[this.pos++] = e, this.pos === o && (this.out += s.decode(t), this.pos = 0);
29
- }
30
- flush() {
31
- let { buffer: e, out: t, pos: n } = this;
32
- return n > 0 ? t + s.decode(e.subarray(0, n)) : t;
33
- }
34
- };
35
- function l(n) {
36
- let r = new c(), i = 0, o = 0, s = 0, l = 0;
37
- for (let c = 0; c < n.length; c++) {
38
- let u = n[c];
39
- if (c > 0 && r.write(t), u.length === 0) continue;
40
- let d = 0;
41
- for (let t = 0; t < u.length; t++) {
42
- let n = u[t];
43
- t > 0 && r.write(e), d = a(r, n[0], d), n.length !== 1 && (i = a(r, n[1], i), o = a(r, n[2], o), s = a(r, n[3], s), n.length !== 4 && (l = a(r, n[4], l)));
44
- }
45
- }
46
- return r.flush();
47
- }
48
- //#endregion
49
- //#region node_modules/magic-string/dist/magic-string.es.mjs
50
- var u = class e {
51
- constructor(t) {
52
- this.bits = t instanceof e ? t.bits.slice() : [];
53
- }
54
- add(e) {
55
- this.bits[e >> 5] |= 1 << (e & 31);
56
- }
57
- has(e) {
58
- return !!(this.bits[e >> 5] & 1 << (e & 31));
59
- }
60
- }, d = class e {
61
- constructor(e, t, n) {
62
- this.start = e, this.end = t, this.original = n, this.intro = "", this.outro = "", this.content = n, this.storeName = !1, this.edited = !1, this.previous = null, this.next = null;
63
- }
64
- appendLeft(e) {
65
- this.outro += e;
66
- }
67
- appendRight(e) {
68
- this.intro += e;
69
- }
70
- clone() {
71
- let t = new e(this.start, this.end, this.original);
72
- return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t;
73
- }
74
- contains(e) {
75
- return this.start < e && e < this.end;
76
- }
77
- eachNext(e) {
78
- let t = this;
79
- for (; t;) e(t), t = t.next;
80
- }
81
- eachPrevious(e) {
82
- let t = this;
83
- for (; t;) e(t), t = t.previous;
84
- }
85
- edit(e, t, n) {
86
- return this.content = e, n || (this.intro = "", this.outro = ""), this.storeName = t, this.edited = !0, this;
87
- }
88
- prependLeft(e) {
89
- this.outro = e + this.outro;
90
- }
91
- prependRight(e) {
92
- this.intro = e + this.intro;
93
- }
94
- reset() {
95
- this.intro = "", this.outro = "", this.edited &&= (this.content = this.original, this.storeName = !1, !1);
96
- }
97
- split(t) {
98
- let n = t - this.start, r = this.original.slice(0, n), i = this.original.slice(n);
99
- this.original = r;
100
- let a = new e(t, this.end, i);
101
- return a.outro = this.outro, this.outro = "", this.end = t, this.edited ? (a.edit("", !1), this.content = "") : this.content = r, a.next = this.next, a.next && (a.next.previous = a), a.previous = this, this.next = a, a;
102
- }
103
- toString() {
104
- return this.intro + this.content + this.outro;
105
- }
106
- trimEnd(e) {
107
- if (this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
108
- let t = this.content.replace(e, "");
109
- if (t.length) return t !== this.content && (this.split(this.start + t.length).edit("", void 0, !0), this.edited && this.edit(t, this.storeName, !0)), !0;
110
- if (this.edit("", void 0, !0), this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
111
- }
112
- trimStart(e) {
113
- if (this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
114
- let t = this.content.replace(e, "");
115
- if (t.length) {
116
- if (t !== this.content) {
117
- let e = this.split(this.end - t.length);
118
- this.edited && e.edit(t, this.storeName, !0), this.edit("", void 0, !0);
119
- }
120
- return !0;
121
- } else if (this.edit("", void 0, !0), this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
122
- }
123
- };
124
- function f() {
125
- return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (e) => globalThis.btoa(unescape(encodeURIComponent(e))) : typeof Buffer == "function" ? (e) => Buffer.from(e, "utf-8").toString("base64") : () => {
126
- throw Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
127
- };
128
- }
129
- var p = /*#__PURE__*/ f(), m = class {
130
- constructor(e) {
131
- this.version = 3, this.file = e.file, this.sources = e.sources, this.sourcesContent = e.sourcesContent, this.names = e.names, this.mappings = l(e.mappings), e.x_google_ignoreList !== void 0 && (this.x_google_ignoreList = e.x_google_ignoreList), e.debugId !== void 0 && (this.debugId = e.debugId);
132
- }
133
- toString() {
134
- return JSON.stringify(this);
135
- }
136
- toUrl() {
137
- return "data:application/json;charset=utf-8;base64," + p(this.toString());
138
- }
139
- };
140
- function h(e) {
141
- let t = e.split("\n"), n = t.filter((e) => /^\t+/.test(e)), r = t.filter((e) => /^ {2,}/.test(e));
142
- if (n.length === 0 && r.length === 0) return null;
143
- if (n.length >= r.length) return " ";
144
- let i = r.reduce((e, t) => {
145
- let n = /^ +/.exec(t)[0].length;
146
- return Math.min(n, e);
147
- }, Infinity);
148
- return Array(i + 1).join(" ");
149
- }
150
- function g(e, t) {
151
- let n = e.split(/[/\\]/), r = t.split(/[/\\]/);
152
- for (n.pop(); n[0] === r[0];) n.shift(), r.shift();
153
- if (n.length) {
154
- let e = n.length;
155
- for (; e--;) n[e] = "..";
156
- }
157
- return n.concat(r).join("/");
158
- }
159
- var _ = Object.prototype.toString;
160
- function v(e) {
161
- return _.call(e) === "[object Object]";
162
- }
163
- function y(e) {
164
- let t = e.split("\n"), n = [];
165
- for (let e = 0, r = 0; e < t.length; e++) n.push(r), r += t[e].length + 1;
166
- return function(e) {
167
- let t = 0, r = n.length;
168
- for (; t < r;) {
169
- let i = t + r >> 1;
170
- e < n[i] ? r = i : t = i + 1;
171
- }
172
- let i = t - 1;
173
- return {
174
- line: i,
175
- column: e - n[i]
176
- };
177
- };
178
- }
179
- var b = /\w/, x = class {
180
- constructor(e) {
181
- this.hires = e, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] = [], this.pending = null;
182
- }
183
- addEdit(e, t, n, r) {
184
- if (t.length) {
185
- let i = t.length - 1, a = t.indexOf("\n", 0), o = -1;
186
- for (; a >= 0 && i > a;) {
187
- let i = [
188
- this.generatedCodeColumn,
189
- e,
190
- n.line,
191
- n.column
192
- ];
193
- r >= 0 && i.push(r), this.rawSegments.push(i), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, o = a, a = t.indexOf("\n", a + 1);
194
- }
195
- let s = [
196
- this.generatedCodeColumn,
197
- e,
198
- n.line,
199
- n.column
200
- ];
201
- r >= 0 && s.push(r), this.rawSegments.push(s), this.advance(t.slice(o + 1));
202
- } else this.pending && (this.rawSegments.push(this.pending), this.advance(t));
203
- this.pending = null;
204
- }
205
- addUneditedChunk(e, t, n, r, i) {
206
- let a = t.start, o = !0, s = !1;
207
- for (; a < t.end;) {
208
- if (n[a] === "\n") r.line += 1, r.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn = 0, o = !0, s = !1;
209
- else {
210
- if (this.hires || o || i.has(a)) {
211
- let t = [
212
- this.generatedCodeColumn,
213
- e,
214
- r.line,
215
- r.column
216
- ];
217
- this.hires === "boundary" ? b.test(n[a]) ? s ||= (this.rawSegments.push(t), !0) : (this.rawSegments.push(t), s = !1) : this.rawSegments.push(t);
218
- }
219
- r.column += 1, this.generatedCodeColumn += 1, o = !1;
220
- }
221
- a += 1;
222
- }
223
- this.pending = null;
224
- }
225
- advance(e) {
226
- if (!e) return;
227
- let t = e.split("\n");
228
- if (t.length > 1) {
229
- for (let e = 0; e < t.length - 1; e++) this.generatedCodeLine++, this.raw[this.generatedCodeLine] = this.rawSegments = [];
230
- this.generatedCodeColumn = 0;
231
- }
232
- this.generatedCodeColumn += t[t.length - 1].length;
233
- }
234
- }, S = "\n", C = {
235
- insertLeft: !1,
236
- insertRight: !1,
237
- storeName: !1
238
- }, w = class e {
239
- constructor(e, t = {}) {
240
- let n = new d(0, e.length, e);
241
- Object.defineProperties(this, {
242
- original: {
243
- writable: !0,
244
- value: e
245
- },
246
- outro: {
247
- writable: !0,
248
- value: ""
249
- },
250
- intro: {
251
- writable: !0,
252
- value: ""
253
- },
254
- firstChunk: {
255
- writable: !0,
256
- value: n
257
- },
258
- lastChunk: {
259
- writable: !0,
260
- value: n
261
- },
262
- lastSearchedChunk: {
263
- writable: !0,
264
- value: n
265
- },
266
- byStart: {
267
- writable: !0,
268
- value: {}
269
- },
270
- byEnd: {
271
- writable: !0,
272
- value: {}
273
- },
274
- filename: {
275
- writable: !0,
276
- value: t.filename
277
- },
278
- indentExclusionRanges: {
279
- writable: !0,
280
- value: t.indentExclusionRanges
281
- },
282
- sourcemapLocations: {
283
- writable: !0,
284
- value: new u()
285
- },
286
- storedNames: {
287
- writable: !0,
288
- value: {}
289
- },
290
- indentStr: {
291
- writable: !0,
292
- value: void 0
293
- },
294
- ignoreList: {
295
- writable: !0,
296
- value: t.ignoreList
297
- },
298
- offset: {
299
- writable: !0,
300
- value: t.offset || 0
301
- }
302
- }), this.byStart[0] = n, this.byEnd[e.length] = n;
303
- }
304
- addSourcemapLocation(e) {
305
- this.sourcemapLocations.add(e);
306
- }
307
- append(e) {
308
- if (typeof e != "string") throw TypeError("outro content must be a string");
309
- return this.outro += e, this;
310
- }
311
- appendLeft(e, t) {
312
- if (e += this.offset, typeof t != "string") throw TypeError("inserted content must be a string");
313
- this._split(e);
314
- let n = this.byEnd[e];
315
- return n ? n.appendLeft(t) : this.intro += t, this;
316
- }
317
- appendRight(e, t) {
318
- if (e += this.offset, typeof t != "string") throw TypeError("inserted content must be a string");
319
- this._split(e);
320
- let n = this.byStart[e];
321
- return n ? n.appendRight(t) : this.outro += t, this;
322
- }
323
- clone() {
324
- let t = new e(this.original, {
325
- filename: this.filename,
326
- offset: this.offset
327
- }), n = this.firstChunk, r = t.firstChunk = t.lastSearchedChunk = n.clone();
328
- for (; n;) {
329
- t.byStart[r.start] = r, t.byEnd[r.end] = r;
330
- let e = n.next, i = e && e.clone();
331
- i && (r.next = i, i.previous = r, r = i), n = e;
332
- }
333
- return t.lastChunk = r, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations = new u(this.sourcemapLocations), t.intro = this.intro, t.outro = this.outro, t;
334
- }
335
- generateDecodedMap(e) {
336
- e ||= {};
337
- let t = Object.keys(this.storedNames), n = new x(e.hires), r = y(this.original);
338
- return this.intro && n.advance(this.intro), this.firstChunk.eachNext((e) => {
339
- let i = r(e.start);
340
- e.intro.length && n.advance(e.intro), e.edited ? n.addEdit(0, e.content, i, e.storeName ? t.indexOf(e.original) : -1) : n.addUneditedChunk(0, e, this.original, i, this.sourcemapLocations), e.outro.length && n.advance(e.outro);
341
- }), this.outro && n.advance(this.outro), {
342
- file: e.file ? e.file.split(/[/\\]/).pop() : void 0,
343
- sources: [e.source ? g(e.file || "", e.source) : e.file || ""],
344
- sourcesContent: e.includeContent ? [this.original] : void 0,
345
- names: t,
346
- mappings: n.raw,
347
- x_google_ignoreList: this.ignoreList ? [0] : void 0
348
- };
349
- }
350
- generateMap(e) {
351
- return new m(this.generateDecodedMap(e));
352
- }
353
- _ensureindentStr() {
354
- this.indentStr === void 0 && (this.indentStr = h(this.original));
355
- }
356
- _getRawIndentString() {
357
- return this._ensureindentStr(), this.indentStr;
358
- }
359
- getIndentString() {
360
- return this._ensureindentStr(), this.indentStr === null ? " " : this.indentStr;
361
- }
362
- indent(e, t) {
363
- let n = /^[^\r\n]/gm;
364
- if (v(e) && (t = e, e = void 0), e === void 0 && (this._ensureindentStr(), e = this.indentStr || " "), e === "") return this;
365
- t ||= {};
366
- let r = {};
367
- t.exclude && (typeof t.exclude[0] == "number" ? [t.exclude] : t.exclude).forEach((e) => {
368
- for (let t = e[0]; t < e[1]; t += 1) r[t] = !0;
369
- });
370
- let i = t.indentStart !== !1, a = (t) => i ? `${e}${t}` : (i = !0, t);
371
- this.intro = this.intro.replace(n, a);
372
- let o = 0, s = this.firstChunk;
373
- for (; s;) {
374
- let t = s.end;
375
- if (s.edited) r[o] || (s.content = s.content.replace(n, a), s.content.length && (i = s.content[s.content.length - 1] === "\n"));
376
- else for (o = s.start; o < t;) {
377
- if (!r[o]) {
378
- let t = this.original[o];
379
- t === "\n" ? i = !0 : t !== "\r" && i && (i = !1, o === s.start ? s.prependRight(e) : (this._splitChunk(s, o), s = s.next, s.prependRight(e)));
380
- }
381
- o += 1;
382
- }
383
- o = s.end, s = s.next;
384
- }
385
- return this.outro = this.outro.replace(n, a), this;
386
- }
387
- insert() {
388
- throw Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)");
389
- }
390
- insertLeft(e, t) {
391
- return C.insertLeft ||= (console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"), !0), this.appendLeft(e, t);
392
- }
393
- insertRight(e, t) {
394
- return C.insertRight ||= (console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"), !0), this.prependRight(e, t);
395
- }
396
- move(e, t, n) {
397
- if (e += this.offset, t += this.offset, n += this.offset, n >= e && n <= t) throw Error("Cannot move a selection inside itself");
398
- this._split(e), this._split(t), this._split(n);
399
- let r = this.byStart[e], i = this.byEnd[t], a = r.previous, o = i.next, s = this.byStart[n];
400
- if (!s && i === this.lastChunk) return this;
401
- let c = s ? s.previous : this.lastChunk;
402
- return a && (a.next = o), o && (o.previous = a), c && (c.next = r), s && (s.previous = i), r.previous || (this.firstChunk = i.next), i.next || (this.lastChunk = r.previous, this.lastChunk.next = null), r.previous = c, i.next = s || null, c || (this.firstChunk = r), s || (this.lastChunk = i), this;
403
- }
404
- overwrite(e, t, n, r) {
405
- return r ||= {}, this.update(e, t, n, {
406
- ...r,
407
- overwrite: !r.contentOnly
408
- });
409
- }
410
- update(e, t, n, r) {
411
- if (e += this.offset, t += this.offset, typeof n != "string") throw TypeError("replacement content must be a string");
412
- if (this.original.length !== 0) {
413
- for (; e < 0;) e += this.original.length;
414
- for (; t < 0;) t += this.original.length;
415
- }
416
- if (t > this.original.length) throw Error("end is out of bounds");
417
- if (e === t) throw Error("Cannot overwrite a zero-length range – use appendLeft or prependRight instead");
418
- this._split(e), this._split(t), r === !0 && (C.storeName ||= (console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"), !0), r = { storeName: !0 });
419
- let i = r === void 0 ? !1 : r.storeName, a = r === void 0 ? !1 : r.overwrite;
420
- if (i) {
421
- let n = this.original.slice(e, t);
422
- Object.defineProperty(this.storedNames, n, {
423
- writable: !0,
424
- value: !0,
425
- enumerable: !0
426
- });
427
- }
428
- let o = this.byStart[e], s = this.byEnd[t];
429
- if (o) {
430
- let e = o;
431
- for (; e !== s;) {
432
- if (e.next !== this.byStart[e.end]) throw Error("Cannot overwrite across a split point");
433
- e = e.next, e.edit("", !1);
434
- }
435
- o.edit(n, i, !a);
436
- } else {
437
- let r = new d(e, t, "").edit(n, i);
438
- s.next = r, r.previous = s;
439
- }
440
- return this;
441
- }
442
- prepend(e) {
443
- if (typeof e != "string") throw TypeError("outro content must be a string");
444
- return this.intro = e + this.intro, this;
445
- }
446
- prependLeft(e, t) {
447
- if (e += this.offset, typeof t != "string") throw TypeError("inserted content must be a string");
448
- this._split(e);
449
- let n = this.byEnd[e];
450
- return n ? n.prependLeft(t) : this.intro = t + this.intro, this;
451
- }
452
- prependRight(e, t) {
453
- if (e += this.offset, typeof t != "string") throw TypeError("inserted content must be a string");
454
- this._split(e);
455
- let n = this.byStart[e];
456
- return n ? n.prependRight(t) : this.outro = t + this.outro, this;
457
- }
458
- remove(e, t) {
459
- if (e += this.offset, t += this.offset, this.original.length !== 0) {
460
- for (; e < 0;) e += this.original.length;
461
- for (; t < 0;) t += this.original.length;
462
- }
463
- if (e === t) return this;
464
- if (e < 0 || t > this.original.length) throw Error("Character is out of bounds");
465
- if (e > t) throw Error("end must be greater than start");
466
- this._split(e), this._split(t);
467
- let n = this.byStart[e];
468
- for (; n;) n.intro = "", n.outro = "", n.edit(""), n = t > n.end ? this.byStart[n.end] : null;
469
- return this;
470
- }
471
- reset(e, t) {
472
- if (e += this.offset, t += this.offset, this.original.length !== 0) {
473
- for (; e < 0;) e += this.original.length;
474
- for (; t < 0;) t += this.original.length;
475
- }
476
- if (e === t) return this;
477
- if (e < 0 || t > this.original.length) throw Error("Character is out of bounds");
478
- if (e > t) throw Error("end must be greater than start");
479
- this._split(e), this._split(t);
480
- let n = this.byStart[e];
481
- for (; n;) n.reset(), n = t > n.end ? this.byStart[n.end] : null;
482
- return this;
483
- }
484
- lastChar() {
485
- if (this.outro.length) return this.outro[this.outro.length - 1];
486
- let e = this.lastChunk;
487
- do {
488
- if (e.outro.length) return e.outro[e.outro.length - 1];
489
- if (e.content.length) return e.content[e.content.length - 1];
490
- if (e.intro.length) return e.intro[e.intro.length - 1];
491
- } while (e = e.previous);
492
- return this.intro.length ? this.intro[this.intro.length - 1] : "";
493
- }
494
- lastLine() {
495
- let e = this.outro.lastIndexOf(S);
496
- if (e !== -1) return this.outro.substr(e + 1);
497
- let t = this.outro, n = this.lastChunk;
498
- do {
499
- if (n.outro.length > 0) {
500
- if (e = n.outro.lastIndexOf(S), e !== -1) return n.outro.substr(e + 1) + t;
501
- t = n.outro + t;
502
- }
503
- if (n.content.length > 0) {
504
- if (e = n.content.lastIndexOf(S), e !== -1) return n.content.substr(e + 1) + t;
505
- t = n.content + t;
506
- }
507
- if (n.intro.length > 0) {
508
- if (e = n.intro.lastIndexOf(S), e !== -1) return n.intro.substr(e + 1) + t;
509
- t = n.intro + t;
510
- }
511
- } while (n = n.previous);
512
- return e = this.intro.lastIndexOf(S), e === -1 ? this.intro + t : this.intro.substr(e + 1) + t;
513
- }
514
- slice(e = 0, t = this.original.length - this.offset) {
515
- if (e += this.offset, t += this.offset, this.original.length !== 0) {
516
- for (; e < 0;) e += this.original.length;
517
- for (; t < 0;) t += this.original.length;
518
- }
519
- let n = "", r = this.firstChunk;
520
- for (; r && (r.start > e || r.end <= e);) {
521
- if (r.start < t && r.end >= t) return n;
522
- r = r.next;
523
- }
524
- if (r && r.edited && r.start !== e) throw Error(`Cannot use replaced character ${e} as slice start anchor.`);
525
- let i = r;
526
- for (; r;) {
527
- r.intro && (i !== r || r.start === e) && (n += r.intro);
528
- let a = r.start < t && r.end >= t;
529
- if (a && r.edited && r.end !== t) throw Error(`Cannot use replaced character ${t} as slice end anchor.`);
530
- let o = i === r ? e - r.start : 0, s = a ? r.content.length + t - r.end : r.content.length;
531
- if (n += r.content.slice(o, s), r.outro && (!a || r.end === t) && (n += r.outro), a) break;
532
- r = r.next;
533
- }
534
- return n;
535
- }
536
- snip(e, t) {
537
- let n = this.clone();
538
- return n.remove(0, e), n.remove(t, n.original.length), n;
539
- }
540
- _split(e) {
541
- if (this.byStart[e] || this.byEnd[e]) return;
542
- let t = this.lastSearchedChunk, n = t, r = e > t.end;
543
- for (; t;) {
544
- if (t.contains(e)) return this._splitChunk(t, e);
545
- if (t = r ? this.byStart[t.end] : this.byEnd[t.start], t === n) return;
546
- n = t;
547
- }
548
- }
549
- _splitChunk(e, t) {
550
- if (e.edited && e.content.length) {
551
- let n = y(this.original)(t);
552
- throw Error(`Cannot split a chunk that has already been edited (${n.line}:${n.column} – "${e.original}")`);
553
- }
554
- let n = e.split(t);
555
- return this.byEnd[t] = e, this.byStart[t] = n, this.byEnd[n.end] = n, e === this.lastChunk && (this.lastChunk = n), this.lastSearchedChunk = e, !0;
556
- }
557
- toString() {
558
- let e = this.intro, t = this.firstChunk;
559
- for (; t;) e += t.toString(), t = t.next;
560
- return e + this.outro;
561
- }
562
- isEmpty() {
563
- let e = this.firstChunk;
564
- do
565
- if (e.intro.length && e.intro.trim() || e.content.length && e.content.trim() || e.outro.length && e.outro.trim()) return !1;
566
- while (e = e.next);
567
- return !0;
568
- }
569
- length() {
570
- let e = this.firstChunk, t = 0;
571
- do
572
- t += e.intro.length + e.content.length + e.outro.length;
573
- while (e = e.next);
574
- return t;
575
- }
576
- trimLines() {
577
- return this.trim("[\\r\\n]");
578
- }
579
- trim(e) {
580
- return this.trimStart(e).trimEnd(e);
581
- }
582
- trimEndAborted(e) {
583
- let t = RegExp((e || "\\s") + "+$");
584
- if (this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
585
- let n = this.lastChunk;
586
- do {
587
- let e = n.end, r = n.trimEnd(t);
588
- if (n.end !== e && (this.lastChunk === n && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), r) return !0;
589
- n = n.previous;
590
- } while (n);
591
- return !1;
592
- }
593
- trimEnd(e) {
594
- return this.trimEndAborted(e), this;
595
- }
596
- trimStartAborted(e) {
597
- let t = RegExp("^" + (e || "\\s") + "+");
598
- if (this.intro = this.intro.replace(t, ""), this.intro.length) return !0;
599
- let n = this.firstChunk;
600
- do {
601
- let e = n.end, r = n.trimStart(t);
602
- if (n.end !== e && (n === this.lastChunk && (this.lastChunk = n.next), this.byEnd[n.end] = n, this.byStart[n.next.start] = n.next, this.byEnd[n.next.end] = n.next), r) return !0;
603
- n = n.next;
604
- } while (n);
605
- return !1;
606
- }
607
- trimStart(e) {
608
- return this.trimStartAborted(e), this;
609
- }
610
- hasChanged() {
611
- return this.original !== this.toString();
612
- }
613
- _replaceRegexp(e, t) {
614
- function n(e, n) {
615
- return typeof t == "string" ? t.replace(/\$(\$|&|\d+)/g, (t, n) => n === "$" ? "$" : n === "&" ? e[0] : +n < e.length ? e[+n] : `$${n}`) : t(...e, e.index, n, e.groups);
616
- }
617
- function r(e, t) {
618
- let n, r = [];
619
- for (; n = e.exec(t);) r.push(n);
620
- return r;
621
- }
622
- if (e.global) r(e, this.original).forEach((e) => {
623
- if (e.index != null) {
624
- let t = n(e, this.original);
625
- t !== e[0] && this.overwrite(e.index, e.index + e[0].length, t);
626
- }
627
- });
628
- else {
629
- let t = this.original.match(e);
630
- if (t && t.index != null) {
631
- let e = n(t, this.original);
632
- e !== t[0] && this.overwrite(t.index, t.index + t[0].length, e);
633
- }
634
- }
635
- return this;
636
- }
637
- _replaceString(e, t) {
638
- let { original: n } = this, r = n.indexOf(e);
639
- return r !== -1 && (typeof t == "function" && (t = t(e, r, n)), e !== t && this.overwrite(r, r + e.length, t)), this;
640
- }
641
- replace(e, t) {
642
- return typeof e == "string" ? this._replaceString(e, t) : this._replaceRegexp(e, t);
643
- }
644
- _replaceAllString(e, t) {
645
- let { original: n } = this, r = e.length;
646
- for (let i = n.indexOf(e); i !== -1; i = n.indexOf(e, i + r)) {
647
- let e = n.slice(i, i + r), a = t;
648
- typeof t == "function" && (a = t(e, i, n)), e !== a && this.overwrite(i, i + r, a);
649
- }
650
- return this;
651
- }
652
- replaceAll(e, t) {
653
- if (typeof e == "string") return this._replaceAllString(e, t);
654
- if (!e.global) throw TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
655
- return this._replaceRegexp(e, t);
656
- }
657
- };
658
- //#endregion
659
- export { w as default };
@@ -1 +0,0 @@
1
- {"version":3,"file":"hydrated-test.types.d.ts","sourceRoot":"","sources":["../../src/test/hydrated-test.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAEpD,yBAAiB,OAAO,CAAC;IACxB,KAAY,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAA;IAChD,KAAY,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;IACtD,KAAY,SAAS,CAAC,CAAC,SAAS,YAAY,GAAG,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACnF,KAAY,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;IACxD,KAAY,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,qBAAqB,CAAC,CAAA;IAChG,KAAY,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACpD,KAAY,SAAS,CAAC,CAAC,SAAS,QAAQ,CAAC,eAAe,IAAI,QAAQ,CAAC,SAAS,CAC7E,MAAM,EACN,CAAC,EACD,OAAO,qBAAqB,CAC5B,CAAA;IACD,KAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;IAC1C,KAAY,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,qBAAqB,CAAC,CAAA;CAClF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,uBAAuB,CAAA"}