@noma.to/qwik-mock 0.0.0-semantically-released
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/README.md +8 -0
- package/lib/index.qwik.cjs +6 -0
- package/lib/index.qwik.mjs +6 -0
- package/lib/lib/qwik-mock.qwik.cjs +14 -0
- package/lib/lib/qwik-mock.qwik.mjs +14 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
- package/lib/node_modules/.pnpm/@vitest_expect@3.0.9/node_modules/@vitest/expect/dist/index.qwik.cjs +2190 -0
- package/lib/node_modules/.pnpm/@vitest_expect@3.0.9/node_modules/@vitest/expect/dist/index.qwik.mjs +2190 -0
- package/lib/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1499 -0
- package/lib/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1499 -0
- package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
- package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
- package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.qwik.cjs +767 -0
- package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.qwik.mjs +767 -0
- package/lib/node_modules/.pnpm/@vitest_snapshot@3.0.9/node_modules/@vitest/snapshot/dist/index.qwik.cjs +2149 -0
- package/lib/node_modules/.pnpm/@vitest_snapshot@3.0.9/node_modules/@vitest/snapshot/dist/index.qwik.mjs +2149 -0
- package/lib/node_modules/.pnpm/@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.cjs +147 -0
- package/lib/node_modules/.pnpm/@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.mjs +147 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +165 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +165 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.cjs +1755 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.mjs +1755 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.qwik.cjs +474 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.qwik.mjs +474 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.qwik.cjs +218 -0
- package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.qwik.mjs +218 -0
- package/lib/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.qwik.cjs +4237 -0
- package/lib/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.qwik.mjs +4237 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/array.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/array.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/class.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/class.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/date.qwik.cjs +12 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/date.qwik.mjs +13 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/error.qwik.cjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/error.qwik.mjs +37 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/function.qwik.cjs +11 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/function.qwik.mjs +12 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.qwik.cjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.qwik.mjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.qwik.cjs +130 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.qwik.mjs +130 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/map.qwik.cjs +23 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/map.qwik.mjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/number.qwik.cjs +19 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/number.qwik.mjs +20 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/object.qwik.cjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/object.qwik.mjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/promise.qwik.cjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/promise.qwik.mjs +18 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/set.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/set.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/string.qwik.cjs +23 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/string.qwik.mjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
- package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
- package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.cjs +979 -0
- package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.mjs +979 -0
- package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.qwik.cjs +101 -0
- package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.qwik.mjs +101 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
- package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.cjs +2983 -0
- package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.mjs +2983 -0
- package/lib-types/index.d.ts +1 -0
- package/lib-types/lib/qwik-mock.d.ts +34 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Qwik Mock
|
|
2
|
+
|
|
3
|
+
Qwik Mock is a small utility to mock Qwik QRLs. It is currently experimental and should be used with caution.
|
|
4
|
+
|
|
5
|
+
Head over to [qtl-docs-repo] to learn how to use it.
|
|
6
|
+
|
|
7
|
+
[qtl-docs-repo]: https://github.com/ianlet/qwik-testing-library/blob/main/README.md
|
|
8
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const qwik = require("@builder.io/qwik");
|
|
4
|
+
const vi_nSCvwQ7l = require("../node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.cjs");
|
|
5
|
+
const mockQrl = () => {
|
|
6
|
+
return qwik.$(vi_nSCvwQ7l.v.fn());
|
|
7
|
+
};
|
|
8
|
+
const mock$ = qwik.implicit$FirstArg(mockQrl);
|
|
9
|
+
function clearAllMocks() {
|
|
10
|
+
vi_nSCvwQ7l.v.clearAllMocks();
|
|
11
|
+
}
|
|
12
|
+
exports.clearAllMocks = clearAllMocks;
|
|
13
|
+
exports.mock$ = mock$;
|
|
14
|
+
exports.mockQrl = mockQrl;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { implicit$FirstArg, $ } from "@builder.io/qwik";
|
|
2
|
+
import { v as vi } from "../node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.mjs";
|
|
3
|
+
const mockQrl = () => {
|
|
4
|
+
return $(vi.fn());
|
|
5
|
+
};
|
|
6
|
+
const mock$ = implicit$FirstArg(mockQrl);
|
|
7
|
+
function clearAllMocks() {
|
|
8
|
+
vi.clearAllMocks();
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
clearAllMocks,
|
|
12
|
+
mock$,
|
|
13
|
+
mockQrl
|
|
14
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const comma = ",".charCodeAt(0);
|
|
4
|
+
const semicolon = ";".charCodeAt(0);
|
|
5
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
|
+
const intToChar = new Uint8Array(64);
|
|
7
|
+
const charToInt = new Uint8Array(128);
|
|
8
|
+
for (let i = 0; i < chars.length; i++) {
|
|
9
|
+
const c = chars.charCodeAt(i);
|
|
10
|
+
intToChar[i] = c;
|
|
11
|
+
charToInt[c] = i;
|
|
12
|
+
}
|
|
13
|
+
function encodeInteger(builder, num, relative) {
|
|
14
|
+
let delta = num - relative;
|
|
15
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
16
|
+
do {
|
|
17
|
+
let clamped = delta & 31;
|
|
18
|
+
delta >>>= 5;
|
|
19
|
+
if (delta > 0)
|
|
20
|
+
clamped |= 32;
|
|
21
|
+
builder.write(intToChar[clamped]);
|
|
22
|
+
} while (delta > 0);
|
|
23
|
+
return num;
|
|
24
|
+
}
|
|
25
|
+
const bufLength = 1024 * 16;
|
|
26
|
+
const td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
|
|
27
|
+
decode(buf) {
|
|
28
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
29
|
+
return out.toString();
|
|
30
|
+
}
|
|
31
|
+
} : {
|
|
32
|
+
decode(buf) {
|
|
33
|
+
let out = "";
|
|
34
|
+
for (let i = 0; i < buf.length; i++) {
|
|
35
|
+
out += String.fromCharCode(buf[i]);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
class StringWriter {
|
|
41
|
+
constructor() {
|
|
42
|
+
this.pos = 0;
|
|
43
|
+
this.out = "";
|
|
44
|
+
this.buffer = new Uint8Array(bufLength);
|
|
45
|
+
}
|
|
46
|
+
write(v) {
|
|
47
|
+
const { buffer } = this;
|
|
48
|
+
buffer[this.pos++] = v;
|
|
49
|
+
if (this.pos === bufLength) {
|
|
50
|
+
this.out += td.decode(buffer);
|
|
51
|
+
this.pos = 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
flush() {
|
|
55
|
+
const { buffer, out, pos } = this;
|
|
56
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function encode(decoded) {
|
|
60
|
+
const writer = new StringWriter();
|
|
61
|
+
let sourcesIndex = 0;
|
|
62
|
+
let sourceLine = 0;
|
|
63
|
+
let sourceColumn = 0;
|
|
64
|
+
let namesIndex = 0;
|
|
65
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
66
|
+
const line = decoded[i];
|
|
67
|
+
if (i > 0)
|
|
68
|
+
writer.write(semicolon);
|
|
69
|
+
if (line.length === 0)
|
|
70
|
+
continue;
|
|
71
|
+
let genColumn = 0;
|
|
72
|
+
for (let j = 0; j < line.length; j++) {
|
|
73
|
+
const segment = line[j];
|
|
74
|
+
if (j > 0)
|
|
75
|
+
writer.write(comma);
|
|
76
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
77
|
+
if (segment.length === 1)
|
|
78
|
+
continue;
|
|
79
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
80
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
81
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
82
|
+
if (segment.length === 4)
|
|
83
|
+
continue;
|
|
84
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return writer.flush();
|
|
88
|
+
}
|
|
89
|
+
exports.encode = encode;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const comma = ",".charCodeAt(0);
|
|
2
|
+
const semicolon = ";".charCodeAt(0);
|
|
3
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
4
|
+
const intToChar = new Uint8Array(64);
|
|
5
|
+
const charToInt = new Uint8Array(128);
|
|
6
|
+
for (let i = 0; i < chars.length; i++) {
|
|
7
|
+
const c = chars.charCodeAt(i);
|
|
8
|
+
intToChar[i] = c;
|
|
9
|
+
charToInt[c] = i;
|
|
10
|
+
}
|
|
11
|
+
function encodeInteger(builder, num, relative) {
|
|
12
|
+
let delta = num - relative;
|
|
13
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
14
|
+
do {
|
|
15
|
+
let clamped = delta & 31;
|
|
16
|
+
delta >>>= 5;
|
|
17
|
+
if (delta > 0)
|
|
18
|
+
clamped |= 32;
|
|
19
|
+
builder.write(intToChar[clamped]);
|
|
20
|
+
} while (delta > 0);
|
|
21
|
+
return num;
|
|
22
|
+
}
|
|
23
|
+
const bufLength = 1024 * 16;
|
|
24
|
+
const td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
|
|
25
|
+
decode(buf) {
|
|
26
|
+
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
27
|
+
return out.toString();
|
|
28
|
+
}
|
|
29
|
+
} : {
|
|
30
|
+
decode(buf) {
|
|
31
|
+
let out = "";
|
|
32
|
+
for (let i = 0; i < buf.length; i++) {
|
|
33
|
+
out += String.fromCharCode(buf[i]);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
class StringWriter {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.pos = 0;
|
|
41
|
+
this.out = "";
|
|
42
|
+
this.buffer = new Uint8Array(bufLength);
|
|
43
|
+
}
|
|
44
|
+
write(v) {
|
|
45
|
+
const { buffer } = this;
|
|
46
|
+
buffer[this.pos++] = v;
|
|
47
|
+
if (this.pos === bufLength) {
|
|
48
|
+
this.out += td.decode(buffer);
|
|
49
|
+
this.pos = 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
flush() {
|
|
53
|
+
const { buffer, out, pos } = this;
|
|
54
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function encode(decoded) {
|
|
58
|
+
const writer = new StringWriter();
|
|
59
|
+
let sourcesIndex = 0;
|
|
60
|
+
let sourceLine = 0;
|
|
61
|
+
let sourceColumn = 0;
|
|
62
|
+
let namesIndex = 0;
|
|
63
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
64
|
+
const line = decoded[i];
|
|
65
|
+
if (i > 0)
|
|
66
|
+
writer.write(semicolon);
|
|
67
|
+
if (line.length === 0)
|
|
68
|
+
continue;
|
|
69
|
+
let genColumn = 0;
|
|
70
|
+
for (let j = 0; j < line.length; j++) {
|
|
71
|
+
const segment = line[j];
|
|
72
|
+
if (j > 0)
|
|
73
|
+
writer.write(comma);
|
|
74
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
75
|
+
if (segment.length === 1)
|
|
76
|
+
continue;
|
|
77
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
78
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
79
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
80
|
+
if (segment.length === 4)
|
|
81
|
+
continue;
|
|
82
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return writer.flush();
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
encode
|
|
89
|
+
};
|