ember-repl 3.0.0-beta.6 → 3.0.0-beta.8

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 (53) hide show
  1. package/README.md +2 -2
  2. package/declarations/browser/compile/index.d.ts +5 -10
  3. package/declarations/browser/compile/index.d.ts.map +1 -1
  4. package/declarations/browser/gjs.d.ts +1 -1
  5. package/declarations/browser/gjs.d.ts.map +1 -1
  6. package/declarations/browser/known-modules.d.ts +26 -0
  7. package/declarations/browser/known-modules.d.ts.map +1 -1
  8. package/dist/browser/cjs/index.js +1 -1
  9. package/dist/browser/cjs/index.js.map +1 -1
  10. package/dist/browser/compile/index.js +7 -8
  11. package/dist/browser/compile/index.js.map +1 -1
  12. package/dist/browser/esm/index.js +1 -1
  13. package/dist/browser/esm/index.js.map +1 -1
  14. package/dist/browser/gjs.js +16 -13
  15. package/dist/browser/gjs.js.map +1 -1
  16. package/dist/browser/known-modules.js +6 -4
  17. package/dist/browser/known-modules.js.map +1 -1
  18. package/package.json +60 -56
  19. package/src/browser/cjs/index.ts +1 -1
  20. package/src/browser/compile/index.ts +11 -14
  21. package/src/browser/esm/index.ts +1 -1
  22. package/src/browser/gjs.ts +15 -15
  23. package/src/browser/known-modules.ts +6 -2
  24. package/declarations/browser/eti/babel-plugin.d.ts +0 -54
  25. package/declarations/browser/eti/babel-plugin.d.ts.map +0 -1
  26. package/declarations/browser/eti/debug.d.ts +0 -2
  27. package/declarations/browser/eti/debug.d.ts.map +0 -1
  28. package/declarations/browser/eti/parse-templates.d.ts +0 -56
  29. package/declarations/browser/eti/parse-templates.d.ts.map +0 -1
  30. package/declarations/browser/eti/preprocess.d.ts +0 -58
  31. package/declarations/browser/eti/preprocess.d.ts.map +0 -1
  32. package/declarations/browser/eti/template-tag-transform.d.ts +0 -15
  33. package/declarations/browser/eti/template-tag-transform.d.ts.map +0 -1
  34. package/declarations/browser/eti/util.d.ts +0 -14
  35. package/declarations/browser/eti/util.d.ts.map +0 -1
  36. package/dist/browser/eti/babel-plugin.js +0 -95
  37. package/dist/browser/eti/babel-plugin.js.map +0 -1
  38. package/dist/browser/eti/debug.js +0 -9
  39. package/dist/browser/eti/debug.js.map +0 -1
  40. package/dist/browser/eti/parse-templates.js +0 -181
  41. package/dist/browser/eti/parse-templates.js.map +0 -1
  42. package/dist/browser/eti/preprocess.js +0 -106
  43. package/dist/browser/eti/preprocess.js.map +0 -1
  44. package/dist/browser/eti/template-tag-transform.js +0 -46
  45. package/dist/browser/eti/template-tag-transform.js.map +0 -1
  46. package/dist/browser/eti/util.js +0 -39
  47. package/dist/browser/eti/util.js.map +0 -1
  48. package/src/browser/eti/babel-plugin.ts +0 -105
  49. package/src/browser/eti/debug.ts +0 -7
  50. package/src/browser/eti/parse-templates.ts +0 -284
  51. package/src/browser/eti/preprocess.ts +0 -187
  52. package/src/browser/eti/template-tag-transform.ts +0 -100
  53. package/src/browser/eti/util.ts +0 -72
@@ -1,284 +0,0 @@
1
- import { expect } from './debug.ts';
2
- import { TEMPLATE_TAG_NAME } from './util.ts';
3
-
4
- export type TemplateMatch = TemplateTagMatch;
5
-
6
- export interface TemplateTagMatch {
7
- type: 'template-tag';
8
- tagName: string;
9
- start: RegExpMatchArray;
10
- end: RegExpMatchArray;
11
- contents: string;
12
- }
13
-
14
- /**
15
- * Represents a static import of a template literal.
16
- */
17
- export interface StaticImportConfig {
18
- /**
19
- * The path to the package from which we want to import the template literal
20
- * (e.g.: 'ember-cli-htmlbars')
21
- */
22
- importPath: string;
23
- /**
24
- * The name of the template literal (e.g.: 'hbs') or 'default' if this package
25
- * exports a default function
26
- */
27
- importIdentifier: string;
28
- }
29
-
30
- /**
31
- * The input options to instruct parseTemplates on how to parse the input.
32
- *
33
- * @param templateTag
34
- */
35
- export interface ParseTemplatesOptions {
36
- /** Tag to use, if parsing template tags is enabled. */
37
- templateTag?: string;
38
- }
39
-
40
- const escapeChar = '\\';
41
- const stringDelimiter = /['"]/;
42
-
43
- const singleLineCommentStart = /\/\//;
44
- const newLine = /\n/;
45
- const multiLineCommentStart = /\/\*/;
46
- const multiLineCommentEnd = /\*\//;
47
-
48
- const templateLiteralStart = /([$a-zA-Z_][0-9a-zA-Z_$]*)?`/;
49
- const templateLiteralEnd = /`/;
50
-
51
- const dynamicSegmentStart = /\${/;
52
- const blockStart = /{/;
53
- const dynamicSegmentEnd = /}/;
54
-
55
- function isEscaped(template: string, _offset: number | undefined) {
56
- let offset = expect(_offset, 'Expected an index to check escaping');
57
-
58
- let count = 0;
59
-
60
- while (template[offset - 1] === escapeChar) {
61
- count++;
62
- offset--;
63
- }
64
-
65
- return count % 2 === 1;
66
- }
67
-
68
- export const DEFAULT_PARSE_TEMPLATES_OPTIONS = {
69
- templateTag: TEMPLATE_TAG_NAME,
70
- };
71
-
72
- /**
73
- * Parses a template to find all possible valid matches for an embedded template.
74
- * Supported syntaxes are template literals:
75
- *
76
- * hbs`Hello, world!`
77
- *
78
- * And template tags
79
- *
80
- * <template></template>
81
- *
82
- * The parser excludes any values found within strings recursively, and also
83
- * excludes any string literals with dynamic segments (e.g `${}`) since these
84
- * cannot be valid templates.
85
- *
86
- * @param template The template to parse
87
- * @param relativePath Relative file path for the template (for errors)
88
- * @param options optional configuration options for how to parse templates
89
- * @returns
90
- */
91
- export function parseTemplates(
92
- template: string,
93
- relativePath: string,
94
- options: ParseTemplatesOptions = DEFAULT_PARSE_TEMPLATES_OPTIONS
95
- ): TemplateMatch[] {
96
- const results: TemplateMatch[] = [];
97
- const templateTag = options?.templateTag;
98
-
99
- const templateTagStart = new RegExp(`<${templateTag}[^<]*>`);
100
- const templateTagEnd = new RegExp(`</${templateTag}>`);
101
- const argumentsMatchRegex = new RegExp(`<${templateTag}[^<]*\\S[^<]*>`);
102
-
103
- const allTokens = new RegExp(
104
- [
105
- singleLineCommentStart.source,
106
- newLine.source,
107
- multiLineCommentStart.source,
108
- multiLineCommentEnd.source,
109
- stringDelimiter.source,
110
- templateLiteralStart.source,
111
- templateLiteralEnd.source,
112
- dynamicSegmentStart.source,
113
- dynamicSegmentEnd.source,
114
- blockStart.source,
115
- templateTagStart.source,
116
- templateTagEnd.source,
117
- ].join('|'),
118
- 'g'
119
- );
120
-
121
- const tokens = Array.from(template.matchAll(allTokens));
122
-
123
- while (tokens.length > 0) {
124
- const currentToken = tokens.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion
125
-
126
- parseToken(results, template, currentToken, tokens, true);
127
- }
128
-
129
- /**
130
- * Parse the current token. If top level, then template tags can be parsed.
131
- * Else, we are nested within a dynamic segment, which is currently unsupported.
132
- */
133
- function parseToken(
134
- results: TemplateMatch[],
135
- template: string,
136
- token: RegExpMatchArray,
137
- tokens: RegExpMatchArray[],
138
- isTopLevel = false
139
- ) {
140
- if (token[0].match(multiLineCommentStart)) {
141
- parseMultiLineComment(results, template, token, tokens);
142
- } else if (token[0].match(singleLineCommentStart)) {
143
- parseSingleLineComment(results, template, token, tokens);
144
- } else if (token[0].match(templateLiteralStart)) {
145
- parseTemplateLiteral(template, tokens);
146
- } else if (
147
- isTopLevel &&
148
- templateTag !== undefined &&
149
- templateTagStart &&
150
- token[0].match(templateTagStart)
151
- ) {
152
- parseTemplateTag(results, template, token, tokens, templateTag);
153
- } else if (token[0].match(stringDelimiter)) {
154
- parseString(results, template, token, tokens);
155
- }
156
- }
157
-
158
- /**
159
- * Parse a template literal. If a dynamic segment is found, enters the dynamic
160
- * segment and parses it recursively. If no dynamic segments are found and the
161
- * literal is top level (e.g. not nested within a dynamic segment) and has a
162
- * tag, pushes it into the list of results.
163
- */
164
- function parseTemplateLiteral(template: string, tokens: RegExpMatchArray[]) {
165
- while (tokens.length > 0) {
166
- let currentToken = expect(tokens.shift(), 'expected token');
167
-
168
- if (isEscaped(template, currentToken.index)) continue;
169
-
170
- if (currentToken[0].match(templateLiteralEnd)) {
171
- return;
172
- }
173
- }
174
- }
175
-
176
- /**
177
- * Parse a string. All tokens within a string are ignored
178
- * since there are no dynamic segments within these.
179
- */
180
- function parseString(
181
- _results: TemplateMatch[],
182
- template: string,
183
- startToken: RegExpMatchArray,
184
- tokens: RegExpMatchArray[]
185
- ) {
186
- while (tokens.length > 0) {
187
- const currentToken = expect(tokens.shift(), 'expected token');
188
-
189
- if (currentToken[0] === startToken[0] && !isEscaped(template, currentToken.index)) {
190
- return;
191
- }
192
- }
193
- }
194
-
195
- /**
196
- * Parse a single-line comment. All tokens within a single-line comment are ignored
197
- * since there are no dynamic segments within them.
198
- */
199
- function parseSingleLineComment(
200
- _results: TemplateMatch[],
201
- _template: string,
202
- _startToken: RegExpMatchArray,
203
- tokens: RegExpMatchArray[]
204
- ) {
205
- while (tokens.length > 0) {
206
- const currentToken = expect(tokens.shift(), 'expected token');
207
-
208
- if (currentToken[0] === '\n') {
209
- return;
210
- }
211
- }
212
- }
213
-
214
- /**
215
- * Parse a multi-line comment. All tokens within a multi-line comment are ignored
216
- * since there are no dynamic segments within them.
217
- */
218
- function parseMultiLineComment(
219
- _results: TemplateMatch[],
220
- _template: string,
221
- _startToken: RegExpMatchArray,
222
- tokens: RegExpMatchArray[]
223
- ) {
224
- while (tokens.length > 0) {
225
- const currentToken = expect(tokens.shift(), 'expected token');
226
-
227
- if (currentToken[0] === '*/') {
228
- return;
229
- }
230
- }
231
- }
232
-
233
- /**
234
- * Parses a template tag. Continues parsing until the template tag has closed,
235
- * accounting for nested template tags.
236
- */
237
- function parseTemplateTag(
238
- results: TemplateMatch[],
239
- _template: string,
240
- startToken: RegExpMatchArray,
241
- tokens: RegExpMatchArray[],
242
- templateTag: string
243
- ) {
244
- let stack = 1;
245
-
246
- if (argumentsMatchRegex && startToken[0].match(argumentsMatchRegex)) {
247
- throw new Error(
248
- `embedded template preprocessing currently does not support passing arguments, found args in: ${relativePath}`
249
- );
250
- }
251
-
252
- while (tokens.length > 0) {
253
- const currentToken = expect(tokens.shift(), 'expected token');
254
-
255
- if (currentToken[0].match(templateTagStart)) {
256
- stack++;
257
- } else if (currentToken[0].match(templateTagEnd)) {
258
- stack--;
259
- }
260
-
261
- if (stack === 0) {
262
- let contents = '';
263
-
264
- if (startToken.index !== undefined) {
265
- const templateStart = startToken.index + startToken[0].length;
266
-
267
- contents = template.slice(templateStart, currentToken.index);
268
- }
269
-
270
- results.push({
271
- type: 'template-tag',
272
- tagName: templateTag,
273
- contents: contents,
274
- start: startToken,
275
- end: currentToken,
276
- });
277
-
278
- return;
279
- }
280
- }
281
- }
282
-
283
- return results;
284
- }
@@ -1,187 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore
3
- import { getTemplateLocals } from '@glimmer/syntax';
4
-
5
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
- // @ts-ignore
7
- import lineColumn from 'line-column';
8
- import MagicString from 'magic-string';
9
-
10
- import { expect } from './debug.ts';
11
- import { parseTemplates } from './parse-templates.ts';
12
-
13
- import type { ParseTemplatesOptions, TemplateMatch } from './parse-templates.ts';
14
-
15
- interface PreprocessOptionsEager {
16
- importIdentifier?: string;
17
- importPath?: string;
18
- templateTag?: string;
19
- templateTagReplacement?: string;
20
-
21
- relativePath: string;
22
- includeSourceMaps: boolean;
23
- includeTemplateTokens: boolean;
24
- }
25
-
26
- interface PreprocessOptionsLazy {
27
- importIdentifier?: string;
28
- importPath?: string;
29
- templateTag?: string;
30
- templateTagReplacement?: string;
31
-
32
- relativePath: string;
33
- includeSourceMaps: boolean;
34
- includeTemplateTokens: boolean;
35
- }
36
-
37
- type PreprocessOptions = PreprocessOptionsLazy | PreprocessOptionsEager;
38
-
39
- interface PreprocessedOutput {
40
- output: string;
41
- replacements: Replacement[];
42
- }
43
-
44
- interface Replacement {
45
- type: 'start' | 'end';
46
- index: number;
47
- oldLength: number;
48
- newLength: number;
49
- originalLine: number;
50
- originalCol: number;
51
- }
52
-
53
- function getMatchStartAndEnd(match: RegExpMatchArray) {
54
- return {
55
- start: expect(match.index, 'Expected regular expression match to have an index'),
56
- end:
57
- expect(match.index, 'Expected regular expression match to have an index') + match[0].length,
58
- };
59
- }
60
-
61
- function replacementFrom(
62
- template: string,
63
- index: number,
64
- oldLength: number,
65
- newLength: number,
66
- type: 'start' | 'end'
67
- ): Replacement {
68
- const loc = expect(
69
- lineColumn(template).fromIndex(index),
70
- 'BUG: expected to find a line/column based on index'
71
- );
72
-
73
- return {
74
- type,
75
- index,
76
- oldLength,
77
- newLength,
78
- originalCol: loc.col,
79
- originalLine: loc.line,
80
- };
81
- }
82
-
83
- function replaceMatch(
84
- s: MagicString,
85
- match: TemplateMatch,
86
- startReplacement: string,
87
- endReplacement: string,
88
- template: string,
89
- includeTemplateTokens: boolean
90
- ): Replacement[] {
91
- const { start: openStart, end: openEnd } = getMatchStartAndEnd(match.start);
92
- const { start: closeStart, end: closeEnd } = getMatchStartAndEnd(match.end);
93
-
94
- let options = '';
95
-
96
- if (includeTemplateTokens) {
97
- const tokensString = getTemplateLocals(template.slice(openEnd, closeStart))
98
- .filter((local: string) => local.match(/^[$A-Z_][0-9A-Z_$]*$/i))
99
- .join(',');
100
-
101
- if (tokensString.length > 0) {
102
- options = `, scope: () => ({${tokensString}})`;
103
- }
104
- }
105
-
106
- const newStart = `${startReplacement}\``;
107
- const newEnd = `\`, { strictMode: true${options} }${endReplacement}`;
108
-
109
- s.overwrite(openStart, openEnd, newStart);
110
- s.overwrite(closeStart, closeEnd, newEnd);
111
- ensureBackticksEscaped(s, openEnd + 1, closeStart - 1);
112
-
113
- return [
114
- replacementFrom(template, openStart, openEnd - openStart, newStart.length, 'start'),
115
- replacementFrom(template, closeStart, closeEnd - closeStart, newEnd.length, 'end'),
116
- ];
117
- }
118
-
119
- /**
120
- * Preprocesses all embedded templates within a JavaScript or TypeScript file.
121
- * This function replaces all embedded templates that match our template syntax
122
- * with valid, parseable JS. Optionally, it can also include a source map, and
123
- * it can also include all possible values used within the template.
124
- *
125
- * Input:
126
- *
127
- * <template><MyComponent/><template>
128
- *
129
- * Output:
130
- *
131
- * [GLIMMER_TEMPLATE(`<MyComponent/>`, { scope() { return {MyComponent}; } })];
132
- *
133
- * It can also be used with template literals to provide the in scope values:
134
- *
135
- * Input:
136
- *
137
- * hbs`<MyComponent/>`;
138
- *
139
- * Output
140
- *
141
- * hbs(`<MyComponent/>`, { scope() { return {MyComponent}; } });
142
- */
143
- export function preprocessEmbeddedTemplates(
144
- template: string,
145
- options: PreprocessOptions
146
- ): PreprocessedOutput {
147
- const { templateTag, templateTagReplacement, includeTemplateTokens, relativePath } = options;
148
-
149
- const parseTemplatesOptions: ParseTemplatesOptions = {
150
- templateTag,
151
- };
152
-
153
- const matches = parseTemplates(template, relativePath, parseTemplatesOptions);
154
- const replacements: Replacement[] = [];
155
- const s = new MagicString(template);
156
-
157
- for (const match of matches) {
158
- if (match.type === 'template-tag') {
159
- replacements.push(
160
- ...replaceMatch(
161
- s,
162
- match,
163
- `[${templateTagReplacement}(`,
164
- ')]',
165
- template,
166
- includeTemplateTokens
167
- )
168
- );
169
- }
170
- }
171
-
172
- let output = s.toString();
173
-
174
- return {
175
- output,
176
- replacements,
177
- };
178
- }
179
-
180
- function ensureBackticksEscaped(s: MagicString, start: number, end: number) {
181
- if (start >= end) return;
182
-
183
- let content = s.slice(start, end);
184
-
185
- content = content.replace(/(?<!\\)`/g, '\\`');
186
- s.overwrite(start, end, content, false);
187
- }
@@ -1,100 +0,0 @@
1
- import { buildPrecompileTemplateCall, registerRefs, TEMPLATE_TAG_NAME } from './util.ts';
2
-
3
- /**
4
- * Supports the following syntaxes:
5
- *
6
- * const Foo = [GLIMMER_TEMPLATE('hello')];
7
- *
8
- * export const Foo = [GLIMMER_TEMPLATE('hello')];
9
- *
10
- * export default [GLIMMER_TEMPLATE('hello')];
11
- *
12
- * class Foo {
13
- * [GLIMMER_TEMPLATE('hello')];
14
- * }
15
- */
16
- export const transformTemplateTag = function (t: any, templatePath: any, state: any) {
17
- let compiled = buildPrecompileTemplateCall(t, templatePath, state);
18
- let path = templatePath.parentPath;
19
-
20
- if (path.type === 'ArrayExpression') {
21
- let arrayParentPath = path.parentPath;
22
- let varId = arrayParentPath.node.id || path.scope.generateUidIdentifier(templatePath);
23
-
24
- const templateOnlyComponentExpression = t.callExpression(
25
- buildSetComponentTemplate(path, state),
26
- [
27
- compiled,
28
- t.callExpression(
29
- state.importUtil.import(
30
- templatePath,
31
- '@ember/component/template-only',
32
- 'default',
33
- 'templateOnly'
34
- ),
35
- [t.stringLiteral('dynamic-runtime-file.js'), t.stringLiteral(varId.name)]
36
- ),
37
- ]
38
- );
39
-
40
- if (
41
- arrayParentPath.type === 'ExpressionStatement' &&
42
- arrayParentPath.parentPath.type === 'Program'
43
- ) {
44
- registerRefs(
45
- arrayParentPath.replaceWith(t.exportDefaultDeclaration(templateOnlyComponentExpression)),
46
- (newPath: any) => [
47
- newPath.get('declaration.callee'),
48
- newPath.get('declaration.arguments.0.callee'),
49
- newPath.get('declaration.arguments.1.callee'),
50
- ]
51
- );
52
- } else {
53
- registerRefs(path.replaceWith(templateOnlyComponentExpression), (newPath: any) => [
54
- newPath.get('callee'),
55
- newPath.get('arguments.0.callee'),
56
- newPath.get('arguments.1.callee'),
57
- ]);
58
- }
59
- } else if (path.type === 'ClassProperty') {
60
- let classPath = path.parentPath.parentPath;
61
-
62
- if (classPath.node.type === 'ClassDeclaration') {
63
- registerRefs(
64
- classPath.insertAfter(
65
- t.expressionStatement(
66
- t.callExpression(buildSetComponentTemplate(path, state), [compiled, classPath.node.id])
67
- )
68
- ),
69
- (newPath: any) => [
70
- newPath.get('expression.callee'),
71
- newPath.get('expression.arguments.0.callee'),
72
- ]
73
- );
74
- } else {
75
- registerRefs(
76
- classPath.replaceWith(
77
- t.expressionStatement(
78
- t.callExpression(buildSetComponentTemplate(path, state), [compiled, classPath.node])
79
- )
80
- ),
81
- (newPath: any) => [
82
- newPath.parentPath.get('callee'),
83
- newPath.parentPath.get('arguments.0.callee'),
84
- ]
85
- );
86
- }
87
-
88
- path.remove();
89
-
90
- return;
91
- } else {
92
- throw path.buildCodeFrameError(
93
- `Attempted to use \`<${TEMPLATE_TAG_NAME}>\` to define a template in an unsupported way. Templates defined using this syntax must be:\n\n1. Assigned to a variable declaration OR\n2. The default export of a file OR\n2. In the top level of the file on their own (sugar for \`export default\`) OR\n4. Used directly within a named class body`
94
- );
95
- }
96
- };
97
-
98
- function buildSetComponentTemplate(path: any, state: any) {
99
- return state.importUtil.import(path, '@ember/component', 'setComponentTemplate');
100
- }
@@ -1,72 +0,0 @@
1
- import type { TemplateMatch } from './parse-templates.ts';
2
- import type { NodePath } from '@babel/traverse';
3
- import type { CallExpression } from '@babel/types';
4
- import type { ImportUtil } from 'babel-import-util';
5
-
6
- // const Greeting = <template>Hello</template>
7
- export const TEMPLATE_TAG_NAME = 'template';
8
- export const TEMPLATE_TAG_PLACEHOLDER = '__GLIMMER_TEMPLATE';
9
-
10
- export function isTemplateTag(callExpressionPath: NodePath<CallExpression>) {
11
- const callee = callExpressionPath.get('callee');
12
-
13
- return (
14
- !Array.isArray(callee) && callee.isIdentifier() && callee.node.name === TEMPLATE_TAG_PLACEHOLDER
15
- );
16
- }
17
-
18
- export function buildPrecompileTemplateCall(
19
- t: any,
20
- callExpressionPath: NodePath<CallExpression>,
21
- state: {
22
- importUtil: ImportUtil;
23
- }
24
- ): CallExpression {
25
- const callee = callExpressionPath.get('callee');
26
-
27
- return t.callExpression(
28
- state.importUtil.import(callee, '@ember/template-compilation', 'precompileTemplate'),
29
- callExpressionPath.node.arguments
30
- );
31
- }
32
-
33
- export function registerRefs(
34
- newPath: string | string[],
35
- getRefPaths: (path: string) => NodePath[]
36
- ) {
37
- if (Array.isArray(newPath)) {
38
- if (newPath.length > 1) {
39
- throw new Error(
40
- 'registerRefs is only meant to handle single node transformations. Received more than one path node.'
41
- );
42
- }
43
-
44
- newPath = newPath[0] as string;
45
- }
46
-
47
- const refPaths = getRefPaths(newPath);
48
-
49
- for (const ref of refPaths) {
50
- if (!ref.isIdentifier()) {
51
- throw new Error(
52
- 'ember-template-imports internal assumption that refPath should of type identifier. Please open an issue.'
53
- );
54
- }
55
-
56
- const binding = ref.scope.getBinding(ref.node.name);
57
-
58
- if (binding !== undefined) {
59
- binding.reference(ref);
60
- }
61
- }
62
- }
63
-
64
- const SUPPORTED_EXTENSIONS = ['.js', '.ts', '.gjs', '.gts'];
65
-
66
- export function isSupportedScriptFileExtension(filePath: string) {
67
- return SUPPORTED_EXTENSIONS.some((ext) => filePath.endsWith(ext));
68
- }
69
-
70
- export function isStrictMode(templateInfo: TemplateMatch): boolean {
71
- return templateInfo.type === 'template-tag';
72
- }