File tree Expand file tree Collapse file tree 5 files changed +12
-50
lines changed Expand file tree Collapse file tree 5 files changed +12
-50
lines changed Original file line number Diff line number Diff line change 5151 },
5252 "dependencies" : {
5353 "@babel/core" : " ^7.23.6" ,
54+ "content-tag" : " ^1.2.2" ,
5455 "prettier" : " ^3.1.1"
5556 },
5657 "devDependencies" : {
6566 "@typescript-eslint/parser" : " ^6.16.0" ,
6667 "@vitest/ui" : " ^1.1.0" ,
6768 "concurrently" : " ^8.2.2" ,
68- "content-tag" : " ^1.1.2" ,
6969 "eslint" : " ^8.56.0" ,
7070 "eslint-config-prettier" : " ^9.1.0" ,
7171 "eslint-plugin-eslint-comments" : " ^3.2.0" ,
Original file line number Diff line number Diff line change @@ -6,13 +6,14 @@ import type {
66 ObjectExpression ,
77 StaticBlock ,
88} from '@babel/types' ;
9+ import type { Parsed as RawGlimmerTemplate } from 'content-tag' ;
910import { Preprocessor } from 'content-tag' ;
1011import type { Parser } from 'prettier' ;
1112import { parsers as babelParsers } from 'prettier/plugins/babel.js' ;
1213
1314import { PRINTER_NAME } from '../config.js' ;
1415import type { Options } from '../options.js' ;
15- import type { GlimmerTemplate , RawGlimmerTemplate } from '../types/glimmer.js' ;
16+ import type { GlimmerTemplate } from '../types/glimmer.js' ;
1617import { isDefaultTemplate } from '../types/glimmer.js' ;
1718import { assert } from '../utils/index.js' ;
1819import { preprocessTemplateRange } from './preprocess.js' ;
@@ -88,7 +89,7 @@ function preprocess(code: string): {
8889 code : string ;
8990 rawTemplates : RawGlimmerTemplate [ ] ;
9091} {
91- const rawTemplates = p . parse ( code ) as RawGlimmerTemplate [ ] ;
92+ const rawTemplates = p . parse ( code ) ;
9293
9394 let output = code ;
9495 for ( const rawTemplate of rawTemplates ) {
Original file line number Diff line number Diff line change 1- import type { RawGlimmerTemplate } from '../types/glimmer.js ' ;
1+ import type { Parsed as RawGlimmerTemplate } from 'content-tag ' ;
22
33function replaceRange (
44 original : string ,
Original file line number Diff line number Diff line change 11import type { NodePath } from '@babel/core' ;
22import type { Node } from '@babel/types' ;
3-
4- /** The raw GlimmerTemplate node as parsed by the content-tag parser. */
5- export interface RawGlimmerTemplate {
6- type : 'expression' | 'class-member' ;
7-
8- tagName : 'template' ;
9-
10- /** Raw template contents */
11- contents : string ;
12-
13- /**
14- * Range of the contents, inclusive of inclusive of the
15- * `<template></template>` tags.
16- */
17- range : {
18- start : number ;
19- end : number ;
20- } ;
21-
22- /**
23- * Range of the template contents, not inclusive of the
24- * `<template></template>` tags.
25- */
26- contentRange : {
27- start : number ;
28- end : number ;
29- } ;
30-
31- /** Range of the opening `<template>` tag. */
32- startRange : {
33- end : number ;
34- start : number ;
35- } ;
36-
37- /** Range of the closing `</template>` tag. */
38- endRange : {
39- start : number ;
40- end : number ;
41- } ;
42- }
3+ import type { Parsed as RawGlimmerTemplate } from 'content-tag' ;
434
445export interface GlimmerTemplate {
456 type : 'FunctionDeclaration' ;
You can’t perform that action at this time.
0 commit comments