@mdsvex/source-map 0.0.0 → 0.1.0-next.1
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/CHANGELOG.md +37 -0
- package/LICENSE +21 -0
- package/package.json +38 -7
- package/src/compose_mappings.ts +156 -0
- package/src/edit.ts +95 -0
- package/src/index.ts +4 -0
- package/src/keys.ts +101 -0
- package/src/pfm_to_svelte.ts +883 -0
- package/src/v3_to_volar.ts +115 -0
- package/test/compose_mappings.spec.ts +161 -0
- package/test/end_to_end.spec.ts +419 -0
- package/test/pfm_to_svelte.spec.ts +307 -0
- package/test/pfm_to_svelte_config.spec.ts +339 -0
- package/test/pfm_to_svelte_extended.spec.ts +205 -0
- package/test/pfm_to_svelte_live.spec.ts +84 -0
- package/test/v3_to_volar.spec.ts +135 -0
- package/tsconfig.json +11 -0
- package/README.md +0 -3
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extended test fixtures for pfmToSvelte — covers edge cases,
|
|
3
|
+
* control flow, nested expressions, style blocks, and complex documents.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect } from "vitest";
|
|
6
|
+
import { pfmToSvelte } from "../src/pfm_to_svelte";
|
|
7
|
+
import type { PfmToSvelteResult } from "../src/pfm_to_svelte";
|
|
8
|
+
import type { Mapping, MappingData } from "@mdsvex/render/mappings";
|
|
9
|
+
|
|
10
|
+
function assertValid(source: string, result: PfmToSvelteResult) {
|
|
11
|
+
for (const m of result.mappings) {
|
|
12
|
+
for (let i = 0; i < m.sourceOffsets.length; i++) {
|
|
13
|
+
expect(m.sourceOffsets[i]).toBeGreaterThanOrEqual(0);
|
|
14
|
+
expect(m.sourceOffsets[i] + m.lengths[i]).toBeLessThanOrEqual(source.length);
|
|
15
|
+
expect(m.generatedOffsets[i]).toBeGreaterThanOrEqual(0);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe("pfmToSvelte — control flow blocks", () => {
|
|
21
|
+
it("if/else block", () => {
|
|
22
|
+
const source = "---\nshow: true\n---\n\n{#if show}\nVisible\n{:else}\nHidden\n{/if}\n";
|
|
23
|
+
const result = pfmToSvelte(source);
|
|
24
|
+
assertValid(source, result);
|
|
25
|
+
expect(result.code).toContain("{#if");
|
|
26
|
+
expect(result.code).toContain("{:else}");
|
|
27
|
+
expect(result.code).toContain("{/if}");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("each block", () => {
|
|
31
|
+
const source = "---\nitems: [1, 2, 3]\n---\n\n{#each items as item}\n- {item}\n{/each}\n";
|
|
32
|
+
const result = pfmToSvelte(source);
|
|
33
|
+
assertValid(source, result);
|
|
34
|
+
expect(result.code).toContain("{#each");
|
|
35
|
+
expect(result.code).toContain("{/each}");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("nested if inside each", () => {
|
|
39
|
+
const source = "{#each items as item}\n{#if item > 0}\n{item}\n{/if}\n{/each}\n";
|
|
40
|
+
const result = pfmToSvelte(source);
|
|
41
|
+
assertValid(source, result);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("pfmToSvelte — style blocks", () => {
|
|
46
|
+
it("extracts style block positions", () => {
|
|
47
|
+
const source = "<style>\nh1 { color: red; }\n</style>\n\n# Hello\n";
|
|
48
|
+
const result = pfmToSvelte(source);
|
|
49
|
+
assertValid(source, result);
|
|
50
|
+
|
|
51
|
+
expect(result.styleBlocks.length).toBe(1);
|
|
52
|
+
const sb = result.styleBlocks[0];
|
|
53
|
+
const cssContent = source.slice(sb.sourceStart, sb.sourceEnd);
|
|
54
|
+
expect(cssContent).toContain("h1 { color: red; }");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("multiple style blocks", () => {
|
|
58
|
+
const source = "<style>\nh1 { color: red; }\n</style>\n\n# Hello\n\n<style>\np { margin: 0; }\n</style>\n";
|
|
59
|
+
const result = pfmToSvelte(source);
|
|
60
|
+
assertValid(source, result);
|
|
61
|
+
expect(result.styleBlocks.length).toBe(2);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("no style blocks when none present", () => {
|
|
65
|
+
const source = "# Hello\n\nWorld\n";
|
|
66
|
+
const result = pfmToSvelte(source);
|
|
67
|
+
expect(result.styleBlocks.length).toBe(0);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe("pfmToSvelte — excluded regions", () => {
|
|
72
|
+
it("excludes frontmatter", () => {
|
|
73
|
+
const source = "---\ntitle: hello\n---\n\n# Hello\n";
|
|
74
|
+
const result = pfmToSvelte(source);
|
|
75
|
+
expect(result.excludedRegions.length).toBeGreaterThanOrEqual(1);
|
|
76
|
+
const fmRegion = result.excludedRegions[0];
|
|
77
|
+
expect(source.slice(fmRegion.start, fmRegion.end)).toContain("---");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("excludes script blocks", () => {
|
|
81
|
+
const source = "<script>\nlet x = 1;\n</script>\n\n# Hello\n";
|
|
82
|
+
const result = pfmToSvelte(source);
|
|
83
|
+
const scriptRegion = result.excludedRegions.find(r =>
|
|
84
|
+
source.slice(r.start, r.end).includes("script"),
|
|
85
|
+
);
|
|
86
|
+
expect(scriptRegion).toBeDefined();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("excludes style blocks", () => {
|
|
90
|
+
const source = "<style>\nh1 { color: red; }\n</style>\n\n# Hello\n";
|
|
91
|
+
const result = pfmToSvelte(source);
|
|
92
|
+
const styleRegion = result.excludedRegions.find(r =>
|
|
93
|
+
source.slice(r.start, r.end).includes("style"),
|
|
94
|
+
);
|
|
95
|
+
expect(styleRegion).toBeDefined();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("excludes import statements", () => {
|
|
99
|
+
const source = 'import A from "./A.svelte"\n\n# Hello\n';
|
|
100
|
+
const result = pfmToSvelte(source);
|
|
101
|
+
const importRegion = result.excludedRegions.find(r =>
|
|
102
|
+
source.slice(r.start, r.end).includes("import"),
|
|
103
|
+
);
|
|
104
|
+
expect(importRegion).toBeDefined();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe("pfmToSvelte — complex documents", () => {
|
|
109
|
+
it("full-featured document", () => {
|
|
110
|
+
const source = `---
|
|
111
|
+
title: My Page
|
|
112
|
+
count: 42
|
|
113
|
+
draft: true
|
|
114
|
+
---
|
|
115
|
+
import Counter from "./Counter.svelte"
|
|
116
|
+
|
|
117
|
+
<script lang="ts">
|
|
118
|
+
const { count, draft } = metadata;
|
|
119
|
+
const doubled = count * 2;
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<style>
|
|
123
|
+
h1 { color: blue; }
|
|
124
|
+
p { margin: 1rem; }
|
|
125
|
+
</style>
|
|
126
|
+
|
|
127
|
+
# {metadata.title}
|
|
128
|
+
|
|
129
|
+
{#if !draft}
|
|
130
|
+
<Counter value={count} />
|
|
131
|
+
{:else}
|
|
132
|
+
**Draft mode** — count is {count}
|
|
133
|
+
{/if}
|
|
134
|
+
|
|
135
|
+
The doubled value is {doubled}.
|
|
136
|
+
|
|
137
|
+
> A blockquote with {metadata.title}
|
|
138
|
+
|
|
139
|
+
- Item {count}
|
|
140
|
+
- Item {count + 1}
|
|
141
|
+
|
|
142
|
+
\`\`\`ts
|
|
143
|
+
const x: number = 42;
|
|
144
|
+
\`\`\`
|
|
145
|
+
`;
|
|
146
|
+
const result = pfmToSvelte(source);
|
|
147
|
+
assertValid(source, result);
|
|
148
|
+
|
|
149
|
+
// script block merged
|
|
150
|
+
expect(result.code).toContain("const doubled = count * 2");
|
|
151
|
+
expect(result.code).toContain('import Counter from "./Counter.svelte"');
|
|
152
|
+
expect(result.code).toContain(
|
|
153
|
+
'export const metadata = {title: "My Page", count: 42, draft: true};',
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// style block detected
|
|
157
|
+
expect(result.styleBlocks.length).toBe(1);
|
|
158
|
+
|
|
159
|
+
// excluded regions cover frontmatter, imports, script, style
|
|
160
|
+
expect(result.excludedRegions.length).toBeGreaterThanOrEqual(3);
|
|
161
|
+
|
|
162
|
+
// body preserved
|
|
163
|
+
expect(result.code).toContain("{#if");
|
|
164
|
+
expect(result.code).toContain("<Counter");
|
|
165
|
+
expect(result.code).toContain("{:else}");
|
|
166
|
+
|
|
167
|
+
// two script blocks: <script module> for frontmatter + <script> for user code
|
|
168
|
+
const scriptCount = (result.code.match(/<script[^>]*>/g) || []).length;
|
|
169
|
+
expect(scriptCount).toBe(2);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("empty document", () => {
|
|
173
|
+
const result = pfmToSvelte("\n");
|
|
174
|
+
expect(result.code).toBeDefined();
|
|
175
|
+
expect(result.mappings).toBeDefined();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("frontmatter only, no body", () => {
|
|
179
|
+
const source = "---\ntitle: hello\n---\n";
|
|
180
|
+
const result = pfmToSvelte(source);
|
|
181
|
+
assertValid(source, result);
|
|
182
|
+
expect(result.code).toContain('export const metadata = {title: "hello"};');
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("frontmatter with all YAML scalar types", () => {
|
|
186
|
+
const source = "---\nstr: hello world\nnum: 3.14\nbool: false\nnull_val: null\ntilde_null: ~\nempty:\nint: -42\nsci: 1e10\n---\n\n# Test\n";
|
|
187
|
+
const result = pfmToSvelte(source);
|
|
188
|
+
assertValid(source, result);
|
|
189
|
+
|
|
190
|
+
// values are what the core yaml parser gives, the build exports the same
|
|
191
|
+
expect(result.metadata).toEqual({
|
|
192
|
+
str: "hello world",
|
|
193
|
+
num: 3.14,
|
|
194
|
+
bool: false,
|
|
195
|
+
null_val: null,
|
|
196
|
+
tilde_null: null,
|
|
197
|
+
empty: null,
|
|
198
|
+
int: -42,
|
|
199
|
+
sci: 1e10,
|
|
200
|
+
});
|
|
201
|
+
expect(result.code).toContain(
|
|
202
|
+
'{str: "hello world", num: 3.14, bool: false, null_val: null, tilde_null: null, empty: null, int: -42, sci: 10000000000}',
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { svelte2tsx } from 'svelte2tsx';
|
|
3
|
+
import { create_highlight } from 'mdsvex/highlight';
|
|
4
|
+
import { default_languages } from 'mdsvex/highlight/languages';
|
|
5
|
+
import type { Mapping, MappingData } from '@mdsvex/render/mappings';
|
|
6
|
+
|
|
7
|
+
import { pfmToSvelte } from '../src/pfm_to_svelte';
|
|
8
|
+
|
|
9
|
+
const highlight = create_highlight({ languages: default_languages });
|
|
10
|
+
|
|
11
|
+
function src_of(source: string, m: Mapping<MappingData>) {
|
|
12
|
+
return source.slice(m.sourceOffsets[0], m.sourceOffsets[0] + m.lengths[0]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function gen_of(code: string, m: Mapping<MappingData>) {
|
|
16
|
+
const len = m.generatedLengths ? m.generatedLengths[0] : m.lengths[0];
|
|
17
|
+
return code.slice(m.generatedOffsets[0], m.generatedOffsets[0] + len);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DOC = [
|
|
21
|
+
'<script>',
|
|
22
|
+
' let some_val = 1;',
|
|
23
|
+
'</script>',
|
|
24
|
+
'',
|
|
25
|
+
'```js',
|
|
26
|
+
'function my_func() {',
|
|
27
|
+
' console.log({ a: {some_val} }) // [!eval ="{some_val}"]',
|
|
28
|
+
'}',
|
|
29
|
+
'```',
|
|
30
|
+
'',
|
|
31
|
+
].join('\n');
|
|
32
|
+
|
|
33
|
+
describe('live expressions in code', () => {
|
|
34
|
+
it('each maps one to one with every capability', () => {
|
|
35
|
+
const r = pfmToSvelte(DOC, { compile: { highlight } });
|
|
36
|
+
expect(r.diagnostics).toEqual([]);
|
|
37
|
+
const live = r.mappings.filter(
|
|
38
|
+
(m) =>
|
|
39
|
+
src_of(DOC, m) === '{some_val}' && gen_of(r.code, m) === '{some_val}'
|
|
40
|
+
);
|
|
41
|
+
expect(live).toHaveLength(1);
|
|
42
|
+
expect(live[0].data).toMatchObject({
|
|
43
|
+
verification: true,
|
|
44
|
+
completion: true,
|
|
45
|
+
semantic: true,
|
|
46
|
+
navigation: true,
|
|
47
|
+
role: 'content',
|
|
48
|
+
});
|
|
49
|
+
const g = live[0].generatedOffsets[0];
|
|
50
|
+
const over = r.mappings.filter((m) => {
|
|
51
|
+
if (m.data.role !== 'content') return false;
|
|
52
|
+
const start = m.generatedOffsets[0];
|
|
53
|
+
const end = start + (m.generatedLengths?.[0] ?? m.lengths[0]);
|
|
54
|
+
return start < g + 10 && end > g;
|
|
55
|
+
});
|
|
56
|
+
expect(over).toEqual(live);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('svelte2tsx reads it as a reference', () => {
|
|
60
|
+
const r = pfmToSvelte(DOC, { compile: { highlight } });
|
|
61
|
+
const tsx = svelte2tsx(r.code, { filename: 'doc.svelte', mode: 'ts' }).code;
|
|
62
|
+
expect(tsx).toMatch(/\bsome_val\b[^]*\bsome_val\b/);
|
|
63
|
+
expect(tsx).not.toContain('my_func');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('a half typed live expression is a diagnostic, the document still converts', () => {
|
|
67
|
+
const doc = DOC.replace(
|
|
68
|
+
'console.log',
|
|
69
|
+
'f({some_val) // [!eval]\n console.log'
|
|
70
|
+
);
|
|
71
|
+
const r = pfmToSvelte(doc, { compile: { highlight } });
|
|
72
|
+
expect(r.diagnostics).toHaveLength(1);
|
|
73
|
+
const [d] = r.diagnostics;
|
|
74
|
+
expect(d.severity).toBe('error');
|
|
75
|
+
expect(d.message).toMatch(/must close on its line/);
|
|
76
|
+
expect(doc.slice(d.start, d.start + 4)).toBe('{som');
|
|
77
|
+
expect(r.code).toContain('<pre><code');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('without highlight nothing is live', () => {
|
|
81
|
+
const r = pfmToSvelte(DOC);
|
|
82
|
+
expect(r.code).not.toContain('{some_val}');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { v3ToVolarMappings } from "../src/v3_to_volar";
|
|
3
|
+
import type { SourceMapV3 } from "../src/v3_to_volar";
|
|
4
|
+
import { CI_SVELTE, CI_TEXT } from "@mdsvex/render/mappings";
|
|
5
|
+
|
|
6
|
+
// ── helpers ──
|
|
7
|
+
|
|
8
|
+
/** Create a minimal v3 map with raw VLQ mappings string. */
|
|
9
|
+
function makeV3(
|
|
10
|
+
mappings: string,
|
|
11
|
+
sources = ["input.svelte"],
|
|
12
|
+
): SourceMapV3 {
|
|
13
|
+
return {
|
|
14
|
+
version: 3,
|
|
15
|
+
sources,
|
|
16
|
+
mappings,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ── tests ──
|
|
21
|
+
|
|
22
|
+
describe("v3ToVolarMappings", () => {
|
|
23
|
+
it("single point mapping", () => {
|
|
24
|
+
// VLQ "AAAA" = gen col 0, src idx 0, src line 0, src col 0
|
|
25
|
+
const source = "hello";
|
|
26
|
+
const generated = "hello";
|
|
27
|
+
const v3 = makeV3("AAAA");
|
|
28
|
+
|
|
29
|
+
const mappings = v3ToVolarMappings(v3, generated, source);
|
|
30
|
+
|
|
31
|
+
expect(mappings.length).toBeGreaterThanOrEqual(1);
|
|
32
|
+
expect(mappings[0].sourceOffsets[0]).toBe(0);
|
|
33
|
+
expect(mappings[0].generatedOffsets[0]).toBe(0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("identity mapping produces correct offsets", () => {
|
|
37
|
+
// Map "hello" at 0,0 → 0,0 — 5 consecutive characters
|
|
38
|
+
// AAAA,CAAC,CAAC,CAAC,CAAC = 5 points at offsets 0,1,2,3,4
|
|
39
|
+
const source = "hello";
|
|
40
|
+
const generated = "hello";
|
|
41
|
+
const v3 = makeV3("AAAA,CAAC,CAAC,CAAC,CAAC");
|
|
42
|
+
|
|
43
|
+
const mappings = v3ToVolarMappings(v3, generated, source);
|
|
44
|
+
|
|
45
|
+
// should coalesce into one range
|
|
46
|
+
expect(mappings.length).toBe(1);
|
|
47
|
+
expect(mappings[0].sourceOffsets[0]).toBe(0);
|
|
48
|
+
expect(mappings[0].generatedOffsets[0]).toBe(0);
|
|
49
|
+
expect(mappings[0].lengths[0]).toBe(5);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("coalesces consecutive identity-mapped points", () => {
|
|
53
|
+
// Generate per-character mappings for a 10-char string
|
|
54
|
+
// AAAA, then 9x CAAC
|
|
55
|
+
const segments = ["AAAA"];
|
|
56
|
+
for (let i = 1; i < 10; i++) segments.push("CAAC");
|
|
57
|
+
const v3 = makeV3(segments.join(","));
|
|
58
|
+
|
|
59
|
+
const source = "0123456789";
|
|
60
|
+
const generated = "0123456789";
|
|
61
|
+
|
|
62
|
+
const mappings = v3ToVolarMappings(v3, generated, source);
|
|
63
|
+
|
|
64
|
+
// all 10 points should coalesce into 1 range
|
|
65
|
+
expect(mappings.length).toBe(1);
|
|
66
|
+
expect(mappings[0].lengths[0]).toBe(10);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("handles multi-line mappings", () => {
|
|
70
|
+
const source = "ab\ncd\n";
|
|
71
|
+
const generated = "ab\ncd\n";
|
|
72
|
+
// line 0: col 0→0,0 col 1→0,1; line 1: col 0→1,0 col 1→1,1
|
|
73
|
+
const v3 = makeV3("AAAA,CAAC;AAAA,CAAC");
|
|
74
|
+
|
|
75
|
+
const mappings = v3ToVolarMappings(v3, generated, source);
|
|
76
|
+
|
|
77
|
+
// should produce 2 ranges (one per line, since newline breaks the identity run)
|
|
78
|
+
expect(mappings.length).toBeGreaterThanOrEqual(1);
|
|
79
|
+
|
|
80
|
+
// first range starts at offset 0
|
|
81
|
+
expect(mappings[0].sourceOffsets[0]).toBe(0);
|
|
82
|
+
expect(mappings[0].generatedOffsets[0]).toBe(0);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("respects defaultData parameter", () => {
|
|
86
|
+
const v3 = makeV3("AAAA");
|
|
87
|
+
const mappings = v3ToVolarMappings(v3, "x", "x", CI_TEXT);
|
|
88
|
+
|
|
89
|
+
expect(mappings[0].data).toEqual(CI_TEXT);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("defaults to CI_SVELTE when no defaultData", () => {
|
|
93
|
+
const v3 = makeV3("AAAA");
|
|
94
|
+
const mappings = v3ToVolarMappings(v3, "x", "x");
|
|
95
|
+
|
|
96
|
+
expect(mappings[0].data).toEqual(CI_SVELTE);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("handles offset mapping (source offset != generated offset)", () => {
|
|
100
|
+
// gen col 2, src idx 0, src line 0, src col 0 = generated starts at col 2
|
|
101
|
+
// VLQ: E=2, A=0, A=0, A=0 → "EAAA"
|
|
102
|
+
const source = "hello";
|
|
103
|
+
const generated = " hello";
|
|
104
|
+
const v3 = makeV3("EAAA");
|
|
105
|
+
|
|
106
|
+
const mappings = v3ToVolarMappings(v3, generated, source);
|
|
107
|
+
|
|
108
|
+
expect(mappings.length).toBe(1);
|
|
109
|
+
expect(mappings[0].generatedOffsets[0]).toBe(2);
|
|
110
|
+
expect(mappings[0].sourceOffsets[0]).toBe(0);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("non-identity gap produces separate ranges", () => {
|
|
114
|
+
// Two identity points with a gap: offset 0→0 and offset 5→5
|
|
115
|
+
// AAAA, then jump to col 5 with src col 5
|
|
116
|
+
// Delta from 0 to 5: gen col delta=5(K), src col delta=5(K)
|
|
117
|
+
const v3 = makeV3("AAAA,KAAK");
|
|
118
|
+
|
|
119
|
+
const source = "0123456789";
|
|
120
|
+
const generated = "0123456789";
|
|
121
|
+
|
|
122
|
+
const mappings = v3ToVolarMappings(v3, generated, source);
|
|
123
|
+
|
|
124
|
+
// should be 2 separate ranges (the gap breaks the run)
|
|
125
|
+
expect(mappings.length).toBe(2);
|
|
126
|
+
expect(mappings[0].generatedOffsets[0]).toBe(0);
|
|
127
|
+
expect(mappings[1].generatedOffsets[0]).toBe(5);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("handles empty mappings string", () => {
|
|
131
|
+
const v3 = makeV3("");
|
|
132
|
+
const mappings = v3ToVolarMappings(v3, "hello", "hello");
|
|
133
|
+
expect(mappings.length).toBe(0);
|
|
134
|
+
});
|
|
135
|
+
});
|
package/tsconfig.json
ADDED
package/README.md
DELETED