Skip to content

Commit ed2566d

Browse files
committed
refactor: Removed unnecessary exports
1 parent ddee426 commit ed2566d

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/parse/preprocess.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface Template {
1515

1616
const BufferMap: Map<string, Buffer> = new Map();
1717

18-
export const PLACEHOLDER = '~';
18+
const PLACEHOLDER = '~';
1919

2020
function getBuffer(s: string): Buffer {
2121
let buf = BufferMap.get(s);
@@ -27,19 +27,19 @@ function getBuffer(s: string): Buffer {
2727
}
2828

2929
/** Slice string using byte range */
30-
export function sliceByteRange(s: string, a: number, b?: number): string {
30+
function sliceByteRange(s: string, a: number, b?: number): string {
3131
const buf = getBuffer(s);
3232
return buf.subarray(a, b).toString();
3333
}
3434

3535
/** Converts byte index to js char index (utf16) */
36-
export function byteToCharIndex(s: string, byteOffset: number): number {
36+
function byteToCharIndex(s: string, byteOffset: number): number {
3737
const buf = getBuffer(s);
3838
return buf.subarray(0, byteOffset).toString().length;
3939
}
4040

4141
/** Calculate byte length */
42-
export function byteLength(s: string): number {
42+
function byteLength(s: string): number {
4343
return getBuffer(s).length;
4444
}
4545

tests/unit-tests/preprocess.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { describe, expect, test } from 'vitest';
22

33
import {
44
codeToGlimmerAst,
5-
PLACEHOLDER,
65
preprocessTemplateRange,
76
} from '../../src/parse/preprocess.js';
87

@@ -13,21 +12,19 @@ const TEST_CASES = [
1312
},
1413
{
1514
code: '<template>/* hi */</template>',
16-
expected: [`{/*${PLACEHOLDER}* hi *${PLACEHOLDER} */}`],
15+
expected: [`{/*~* hi *~ */}`],
1716
},
1817
{
1918
code: '<template><div>hi</div></template>',
20-
expected: [`{/*<div>hi<${PLACEHOLDER}div> */}`],
19+
expected: [`{/*<div>hi<~div> */}`],
2120
},
2221
{
2322
code: '<template>{{#if true}}hi{{/if}}</template>',
24-
expected: [`{/*{{#if true}}hi{{${PLACEHOLDER}if}} */}`],
23+
expected: [`{/*{{#if true}}hi{{~if}} */}`],
2524
},
2625
{
2726
code: '<template>////////////////</template>',
28-
expected: [
29-
`{/*${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER}${PLACEHOLDER} */}`,
30-
],
27+
expected: [`{/*~~~~~~~~~~~~~~~~ */}`],
3128
},
3229
{
3330
code: '<template>💩</template>',

0 commit comments

Comments
 (0)