@glint/ember-tsc 1.5.0 → 1.6.0

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 (136) hide show
  1. package/package.json +14 -3
  2. package/src/environment-ember-template-imports/-private/environment/index.ts +48 -20
  3. package/types/-private/dsl/globals.d.ts +316 -1
  4. package/types/-private/intrinsics/array-hash.d.ts +17 -0
  5. package/types/-private/intrinsics/comparison.d.ts +36 -0
  6. package/types/-private/intrinsics/element.d.ts +14 -0
  7. package/types/-private/intrinsics/truth-convert.d.ts +86 -0
  8. package/types/-private/intrinsics/truth-helpers.d.ts +32 -0
  9. package/lib/cli/run-volar-tsc.d.ts +0 -2
  10. package/lib/cli/run-volar-tsc.d.ts.map +0 -1
  11. package/lib/cli/run-volar-tsc.js +0 -32
  12. package/lib/cli/run-volar-tsc.js.map +0 -1
  13. package/lib/config/config.d.ts +0 -15
  14. package/lib/config/config.d.ts.map +0 -1
  15. package/lib/config/config.js +0 -21
  16. package/lib/config/config.js.map +0 -1
  17. package/lib/config/environment.d.ts +0 -26
  18. package/lib/config/environment.d.ts.map +0 -1
  19. package/lib/config/environment.js +0 -96
  20. package/lib/config/environment.js.map +0 -1
  21. package/lib/config/index.d.ts +0 -24
  22. package/lib/config/index.d.ts.map +0 -1
  23. package/lib/config/index.js +0 -37
  24. package/lib/config/index.js.map +0 -1
  25. package/lib/config/loader.d.ts +0 -28
  26. package/lib/config/loader.d.ts.map +0 -1
  27. package/lib/config/loader.js +0 -121
  28. package/lib/config/loader.js.map +0 -1
  29. package/lib/config/types.cjs +0 -3
  30. package/lib/config/types.cjs.map +0 -1
  31. package/lib/config/types.d.cts +0 -60
  32. package/lib/config/types.d.cts.map +0 -1
  33. package/lib/environment-ember-template-imports/-private/environment/common.d.ts +0 -13
  34. package/lib/environment-ember-template-imports/-private/environment/common.d.ts.map +0 -1
  35. package/lib/environment-ember-template-imports/-private/environment/common.js +0 -2
  36. package/lib/environment-ember-template-imports/-private/environment/common.js.map +0 -1
  37. package/lib/environment-ember-template-imports/-private/environment/index.d.ts +0 -3
  38. package/lib/environment-ember-template-imports/-private/environment/index.d.ts.map +0 -1
  39. package/lib/environment-ember-template-imports/-private/environment/index.js +0 -76
  40. package/lib/environment-ember-template-imports/-private/environment/index.js.map +0 -1
  41. package/lib/environment-ember-template-imports/-private/environment/preprocess.d.ts +0 -4
  42. package/lib/environment-ember-template-imports/-private/environment/preprocess.d.ts.map +0 -1
  43. package/lib/environment-ember-template-imports/-private/environment/preprocess.js +0 -42
  44. package/lib/environment-ember-template-imports/-private/environment/preprocess.js.map +0 -1
  45. package/lib/environment-ember-template-imports/-private/environment/transform.d.ts +0 -4
  46. package/lib/environment-ember-template-imports/-private/environment/transform.d.ts.map +0 -1
  47. package/lib/environment-ember-template-imports/-private/environment/transform.js +0 -134
  48. package/lib/environment-ember-template-imports/-private/environment/transform.js.map +0 -1
  49. package/lib/index.d.ts +0 -7
  50. package/lib/index.d.ts.map +0 -1
  51. package/lib/index.js +0 -6
  52. package/lib/index.js.map +0 -1
  53. package/lib/plugins/g-compiler-errors.d.ts +0 -12
  54. package/lib/plugins/g-compiler-errors.d.ts.map +0 -1
  55. package/lib/plugins/g-compiler-errors.js +0 -58
  56. package/lib/plugins/g-compiler-errors.js.map +0 -1
  57. package/lib/plugins/g-component-hover.d.ts +0 -24
  58. package/lib/plugins/g-component-hover.d.ts.map +0 -1
  59. package/lib/plugins/g-component-hover.js +0 -135
  60. package/lib/plugins/g-component-hover.js.map +0 -1
  61. package/lib/plugins/g-template-tag-symbols.d.ts +0 -11
  62. package/lib/plugins/g-template-tag-symbols.d.ts.map +0 -1
  63. package/lib/plugins/g-template-tag-symbols.js +0 -48
  64. package/lib/plugins/g-template-tag-symbols.js.map +0 -1
  65. package/lib/plugins/utils.d.ts +0 -25
  66. package/lib/plugins/utils.d.ts.map +0 -1
  67. package/lib/plugins/utils.js +0 -63
  68. package/lib/plugins/utils.js.map +0 -1
  69. package/lib/transform/diagnostics/augmentation.d.ts +0 -4
  70. package/lib/transform/diagnostics/augmentation.d.ts.map +0 -1
  71. package/lib/transform/diagnostics/augmentation.js +0 -249
  72. package/lib/transform/diagnostics/augmentation.js.map +0 -1
  73. package/lib/transform/diagnostics/index.d.ts +0 -5
  74. package/lib/transform/diagnostics/index.d.ts.map +0 -1
  75. package/lib/transform/diagnostics/index.js +0 -2
  76. package/lib/transform/diagnostics/index.js.map +0 -1
  77. package/lib/transform/index.d.ts +0 -4
  78. package/lib/transform/index.d.ts.map +0 -1
  79. package/lib/transform/index.js +0 -2
  80. package/lib/transform/index.js.map +0 -1
  81. package/lib/transform/template/code-features.d.ts +0 -30
  82. package/lib/transform/template/code-features.d.ts.map +0 -1
  83. package/lib/transform/template/code-features.js +0 -26
  84. package/lib/transform/template/code-features.js.map +0 -1
  85. package/lib/transform/template/glimmer-ast-mapping-tree.d.ts +0 -80
  86. package/lib/transform/template/glimmer-ast-mapping-tree.d.ts.map +0 -1
  87. package/lib/transform/template/glimmer-ast-mapping-tree.js +0 -132
  88. package/lib/transform/template/glimmer-ast-mapping-tree.js.map +0 -1
  89. package/lib/transform/template/inlining/index.d.ts +0 -16
  90. package/lib/transform/template/inlining/index.d.ts.map +0 -1
  91. package/lib/transform/template/inlining/index.js +0 -21
  92. package/lib/transform/template/inlining/index.js.map +0 -1
  93. package/lib/transform/template/inlining/tagged-strings.d.ts +0 -8
  94. package/lib/transform/template/inlining/tagged-strings.d.ts.map +0 -1
  95. package/lib/transform/template/inlining/tagged-strings.js +0 -140
  96. package/lib/transform/template/inlining/tagged-strings.js.map +0 -1
  97. package/lib/transform/template/map-template-contents.d.ts +0 -121
  98. package/lib/transform/template/map-template-contents.d.ts.map +0 -1
  99. package/lib/transform/template/map-template-contents.js +0 -287
  100. package/lib/transform/template/map-template-contents.js.map +0 -1
  101. package/lib/transform/template/rewrite-module.d.ts +0 -22
  102. package/lib/transform/template/rewrite-module.d.ts.map +0 -1
  103. package/lib/transform/template/rewrite-module.js +0 -265
  104. package/lib/transform/template/rewrite-module.js.map +0 -1
  105. package/lib/transform/template/scope-stack.d.ts +0 -13
  106. package/lib/transform/template/scope-stack.d.ts.map +0 -1
  107. package/lib/transform/template/scope-stack.js +0 -28
  108. package/lib/transform/template/scope-stack.js.map +0 -1
  109. package/lib/transform/template/template-to-typescript.d.ts +0 -19
  110. package/lib/transform/template/template-to-typescript.d.ts.map +0 -1
  111. package/lib/transform/template/template-to-typescript.js +0 -1125
  112. package/lib/transform/template/template-to-typescript.js.map +0 -1
  113. package/lib/transform/template/transformed-module.d.ts +0 -111
  114. package/lib/transform/template/transformed-module.d.ts.map +0 -1
  115. package/lib/transform/template/transformed-module.js +0 -287
  116. package/lib/transform/template/transformed-module.js.map +0 -1
  117. package/lib/transform/util.d.ts +0 -7
  118. package/lib/transform/util.d.ts.map +0 -1
  119. package/lib/transform/util.js +0 -15
  120. package/lib/transform/util.js.map +0 -1
  121. package/lib/volar/ember-language-plugin.d.ts +0 -14
  122. package/lib/volar/ember-language-plugin.d.ts.map +0 -1
  123. package/lib/volar/ember-language-plugin.js +0 -91
  124. package/lib/volar/ember-language-plugin.js.map +0 -1
  125. package/lib/volar/gts-virtual-code.d.ts +0 -83
  126. package/lib/volar/gts-virtual-code.d.ts.map +0 -1
  127. package/lib/volar/gts-virtual-code.js +0 -210
  128. package/lib/volar/gts-virtual-code.js.map +0 -1
  129. package/lib/volar/language-server.d.ts +0 -2
  130. package/lib/volar/language-server.d.ts.map +0 -1
  131. package/lib/volar/language-server.js +0 -180
  132. package/lib/volar/language-server.js.map +0 -1
  133. package/lib/volar/script-snapshot.d.ts +0 -17
  134. package/lib/volar/script-snapshot.d.ts.map +0 -1
  135. package/lib/volar/script-snapshot.js +0 -24
  136. package/lib/volar/script-snapshot.js.map +0 -1
@@ -1,63 +0,0 @@
1
- // based on https://github.com/vuejs/language-tools/blob/master/packages/language-service/lib/utils.ts
2
- import { URI } from 'vscode-uri';
3
- import { VirtualGtsCode } from '../volar/gts-virtual-code.js';
4
- /**
5
- * Helper function that accepts a document URI and, if it matches the format
6
- * of Volar's special URI format for representing embedded codes within a virtual code,
7
- * will look up and return the embedded code and its root VirtualGtsCode.
8
- *
9
- * A example Volar embedded document URI would be something like:
10
- *
11
- * volar-embedded-content://gts/file%253A%252F%252F%252FUsers%252Fmachty%252Fcode%252Fglint%252Ftest-packages%252Fts-template-imports-app%252Fsrc%252Fempty-fixture.gts
12
- *
13
- * Note that the hostname/authority part of the URI is the embedded code ID, e.g. `gts`. These correspond
14
- * to the IDs we assign to parsed embedded virtual codes contained within the root virtual code,
15
- * e.g. `ts` corresponds to the TypeScript representation of .gts files where all `<template>` tags
16
- * have been converted to type-checkable TS.
17
- */
18
- export function getEmbeddedInfo(context, document, desiredEmbeddedCodeId, desiredDocumentLanguageId) {
19
- const uri = URI.parse(document.uri);
20
- const decoded = context.decodeEmbeddedDocumentUri(uri);
21
- if (!decoded) {
22
- return;
23
- }
24
- const [documentUri, embeddedCodeId] = decoded;
25
- if (desiredEmbeddedCodeId) {
26
- if (typeof desiredEmbeddedCodeId === 'string') {
27
- if (embeddedCodeId !== desiredEmbeddedCodeId) {
28
- return;
29
- }
30
- }
31
- else if (!desiredEmbeddedCodeId(embeddedCodeId)) {
32
- return;
33
- }
34
- }
35
- if (desiredDocumentLanguageId) {
36
- if (typeof desiredDocumentLanguageId === 'string') {
37
- if (document.languageId !== desiredDocumentLanguageId) {
38
- return;
39
- }
40
- }
41
- else if (!desiredDocumentLanguageId(document.languageId)) {
42
- return;
43
- }
44
- }
45
- const sourceScript = context.language.scripts.get(documentUri);
46
- if (!sourceScript?.generated) {
47
- return;
48
- }
49
- const virtualCode = sourceScript.generated.embeddedCodes.get(embeddedCodeId);
50
- if (!virtualCode) {
51
- return;
52
- }
53
- const root = sourceScript.generated.root;
54
- if (!(root instanceof VirtualGtsCode)) {
55
- return;
56
- }
57
- return {
58
- sourceScript: sourceScript,
59
- virtualCode,
60
- root,
61
- };
62
- }
63
- //# sourceMappingURL=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C,YAAY,EAAE,SAAS,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7E,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC;IACzC,IAAI,CAAC,CAAC,IAAI,YAAY,cAAc,CAAC,EAAE,CAAC;QACtC,OAAO;IACT,CAAC;IAED,OAAO;QACL,YAAY,EAAE,YAA2C;QACzD,WAAW;QACX,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- import TransformedModule from '../template/transformed-module.js';
2
- import { Diagnostic } from './index.js';
3
- export declare function augmentDiagnostics<T extends Diagnostic>(transformedModule: TransformedModule, diagnostics: T[]): T[];
4
- //# sourceMappingURL=augmentation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"augmentation.d.ts","sourceRoot":"","sources":["../../../src/transform/diagnostics/augmentation.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EACrD,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,CAAC,EAAE,GACf,CAAC,EAAE,CA8BL"}
@@ -1,249 +0,0 @@
1
- export function augmentDiagnostics(transformedModule, diagnostics) {
2
- const mappingForDiagnostic = (diagnostic) => {
3
- if (!transformedModule) {
4
- return [];
5
- }
6
- if (!diagnostic.start || !diagnostic.length) {
7
- return [];
8
- }
9
- const start = diagnostic.start;
10
- const end = start + diagnostic.length;
11
- return transformedModule.getExactTransformedRanges(transformedModule.originalFileName, start, end);
12
- };
13
- const augmentedDiagnostics = [];
14
- for (const diagnostic of diagnostics) {
15
- const augmentedDiagnostic = rewriteMessageText(diagnostic, mappingForDiagnostic);
16
- augmentedDiagnostics.push(augmentedDiagnostic);
17
- }
18
- // @ts-expect-error not sure how to fix
19
- return augmentedDiagnostics;
20
- }
21
- function rewriteMessageText(diagnostic, mappingGetter) {
22
- const handler = diagnosticHandlers[diagnostic.code?.toString() ?? ''];
23
- if (!handler) {
24
- return diagnostic;
25
- }
26
- for (let mapping of mappingGetter(diagnostic)) {
27
- const augmentedDiagnostic = handler(diagnostic, mapping);
28
- if (augmentedDiagnostic) {
29
- return augmentedDiagnostic;
30
- }
31
- }
32
- return diagnostic;
33
- }
34
- const diagnosticHandlers = {
35
- '2307': checkGlintLibImports, // TS2307: An import cannot be found.
36
- '2322': checkAssignabilityError, // TS2322: Type 'X' is not assignable to type 'Y'.
37
- '2345': checkAssignabilityError, // TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'.
38
- '2554': noteNamedArgsAffectArity, // TS2554: Expected N arguments, but got M.
39
- '2555': noteNamedArgsAffectArity, // TS2555: Expected at least N arguments, but got M.
40
- '2769': checkResolveError, // TS2769: No overload matches this call.
41
- '4111': checkIndexAccessError, // TS4111: Property 'x' comes from an index signature, so it must be accessed with ['x'].
42
- '7053': checkImplicitAnyError, // TS7053: Element implicitly has an 'any' type because expression of type '"X"' can't be used to index type 'Y'.
43
- };
44
- const bindHelpers = ['component', 'helper', 'modifier'];
45
- function checkGlintLibImports(diagnostic, _mapping) {
46
- let messageText = typeof diagnostic.messageText === 'string'
47
- ? diagnostic.messageText
48
- : diagnostic.messageText.messageText;
49
- const typesModules = '@glint/ember-tsc/-private/dsl';
50
- if (messageText.includes(typesModules)) {
51
- return addGlintDetails(diagnostic, 'You appear to be using version 2 of the Glint VS Code extension ' +
52
- '(or a v2 Glint plugin for another IDE), but your package.json still ' +
53
- 'references version 1 Glint dependencies (or they are missing). You need to either upgrade your `@glint/core` ' +
54
- 'and `@glint/template` project dependencies, or downgrade your VS Code Glint extension to version 1.x. ' +
55
- 'Please see the Glint v2 release notes and upgrade guide for more information.');
56
- }
57
- else {
58
- return diagnostic;
59
- }
60
- }
61
- function checkAssignabilityError(diagnostic, mapping) {
62
- let node = mapping.sourceNode;
63
- // When a modifier requires a specific Element type (TS2322/TS2345) but the component's
64
- // signature doesn't specify one, the element type defaults to `unknown`, producing a
65
- // confusing "Argument of type 'unknown' is not assignable to parameter of type
66
- // 'SomeElement'" error.
67
- if (node.type === 'ElementModifierStatement') {
68
- let messageText = typeof diagnostic.messageText === 'string'
69
- ? diagnostic.messageText
70
- : diagnostic.messageText.messageText;
71
- if (messageText.includes("type 'unknown'")) {
72
- return addGlintDetails(diagnostic, 'An Element must be specified in the component signature in order to use modifiers that require a specific element type, ' +
73
- 'e.g. `interface Signature { Element: HTMLElement; ... }`.');
74
- }
75
- }
76
- let parentNode = mapping.parent?.sourceNode;
77
- if (!parentNode)
78
- return;
79
- if (parentNode.type === node.type) {
80
- // For Volar, we added a few more artificial nestings / wrappings around Handlebars
81
- // AST nodes to provide more hookpoints for TS diagnostics to correctly source-map
82
- // back to .gts/.hbs source code. The result of this is that sometimes you have
83
- // things like MustacheNodes being "parents" of MustacheNodes, which we try and
84
- // detect here.
85
- //
86
- // This can go away if/when we refactor the `transformModule` code.
87
- parentNode = mapping.parent?.parent?.sourceNode;
88
- if (!parentNode)
89
- return;
90
- }
91
- if (node.type === 'Identifier' &&
92
- parentNode.type === 'AttrNode' &&
93
- !/^(@|\.)/.test(parentNode.name)) {
94
- // If the assignability issue is on an attribute name and it's not an `@arg`
95
- // or `...attributes`, then it's an HTML attribute type issue.
96
- return addGlintDetails(diagnostic, 'Only primitive values (see `AttrValue` in `@glint/template`) are assignable as HTML attributes. ' +
97
- 'If you want to set an event listener, consider using the `{{on}}` modifier instead.');
98
- }
99
- else if (node.type === 'AttrNode' &&
100
- parentNode.type === 'ElementNode' &&
101
- !/^(@|\.)/.test(node.name)) {
102
- // If the assignability issue is on an attribute name and it's not an `@arg`
103
- // or `...attributes`, then it's an HTML attribute type issue.
104
- return addGlintDetails(diagnostic, 'An Element must be specified in the component signature in order to pass in HTML attributes.');
105
- }
106
- else if (node.type === 'AttrNode' &&
107
- parentNode.type === 'ElementNode' &&
108
- node.name === '...attributes') {
109
- // When ...attributes is used inside a component whose signature doesn't specify
110
- // Element, the element type defaults to `unknown`, producing a confusing error.
111
- let messageText = typeof diagnostic.messageText === 'string'
112
- ? diagnostic.messageText
113
- : diagnostic.messageText.messageText;
114
- if (messageText.includes("type 'unknown'")) {
115
- return addGlintDetails(diagnostic, 'An Element must be specified in the component signature in order to use ...attributes, ' +
116
- 'e.g. `interface Signature { Element: HTMLDivElement; ... }`.');
117
- }
118
- }
119
- else if (node.type === 'MustacheStatement' &&
120
- (parentNode.type === 'Template' ||
121
- parentNode.type === 'BlockStatement' ||
122
- parentNode.type === 'ElementNode') &&
123
- !(node.path.type === 'PathExpression' && node.path.original === 'yield')) {
124
- // If we're looking at a top-level {{mustache}}, we first double check whether
125
- // it's an attempted inline {{component 'foo'}} invocation...
126
- if (node.path.type === 'PathExpression' && node.path.original === 'component') {
127
- return addGlintDetails(diagnostic, `The {{component}} helper can't be used to directly invoke a component under Glint. ` +
128
- `Consider first binding the result to a variable, e.g. ` +
129
- `'{{#let (component 'component-name') as |ComponentName|}}' and then invoking it as ` +
130
- `'<ComponentName @arg={{value}} />'.`);
131
- }
132
- // Otherwise, it's a DOM content type issue.
133
- return addGlintDetails(diagnostic, 'Only primitive values and certain DOM objects (see `ContentValue` in `@glint/template`) are ' +
134
- 'usable as top-level template content.');
135
- }
136
- else if ((mapping?.sourceNode.type === 'SubExpression' ||
137
- mapping?.sourceNode.type === 'MustacheStatement') &&
138
- mapping.sourceNode.path.type === 'PathExpression' &&
139
- bindHelpers.includes(mapping.sourceNode.path.original)) {
140
- // If we're looking at a binding helper subexpression like `(component ...)`, error messages
141
- // may be very straightforward or may be horrendously complex when users start playing games
142
- // with parametrized types, so we add a hint here.
143
- let kind = mapping.sourceNode.path.original;
144
- return {
145
- ...diagnostic,
146
- messageText: `Unable to pre-bind the given args to the given ${kind}. This likely indicates a type mismatch between its signature and the values you're passing.`,
147
- };
148
- }
149
- }
150
- function noteNamedArgsAffectArity(diagnostic, mapping) {
151
- // In normal template entity invocations, named args (if specified) are effectively
152
- // passed as the final positional argument. Because of this, the reported "expected
153
- // N arguments, but got M" message may appear to be off-by-one to the developer.
154
- // Since this treatment of named args as a final "options hash" argument is user
155
- // visible in cases like type errors, we can't just paper over this by subtracting
156
- // 1 from the numbers in the message. Instead, if the invocation has named args, we
157
- // explicitly note that they're effectively the final positional parameter.
158
- let callNode = findAncestor(mapping, 'MustacheStatement', 'SubExpression');
159
- if (callNode?.path.type === 'PathExpression' && callNode.path.original === 'yield') {
160
- // Yield is directly transformed rather than being treated as a normal mustache
161
- return;
162
- }
163
- let hasNamedArgs = !!callNode?.hash.pairs.length;
164
- if (hasNamedArgs) {
165
- let note = 'Note that named args are passed together as a final argument, so they ' +
166
- 'collectively increase the given arg count by 1.';
167
- return {
168
- ...diagnostic,
169
- messageText: `${diagnostic.messageText} ${note}`,
170
- };
171
- }
172
- }
173
- function checkResolveError(diagnostic, mapping) {
174
- // The diagnostic might fall on a lone identifier or a full path; if the former,
175
- // we need to traverse up through the path to find the true parent.
176
- let sourceMapping = mapping.sourceNode.type === 'Identifier' ? mapping.parent : mapping;
177
- let parentNode = sourceMapping?.parent?.sourceNode;
178
- // If this error is on the first param to a {{component}} or other bind invocation, this means
179
- // we either have a non-component value or a string that's missing from the registry.
180
- if ((parentNode?.type === 'SubExpression' || parentNode?.type === 'MustacheStatement') &&
181
- parentNode.path.type === 'PathExpression' &&
182
- bindHelpers.includes(parentNode.path.original) &&
183
- parentNode.params[0] === sourceMapping?.sourceNode) {
184
- let kind = parentNode.path.original;
185
- if (sourceMapping.sourceNode.type === 'StringLiteral') {
186
- return addGlintDetails(diagnostic, `Unknown ${kind} name '${sourceMapping.sourceNode.value}'. If this isn't a typo, you may be ` +
187
- `missing a registry entry for this name; see the Template Registry page in the Glint ` +
188
- `documentation for more details.`);
189
- }
190
- else {
191
- return addGlintDetails(diagnostic, `The type of this expression doesn't appear to be a valid value to pass the {{${kind}}} ` +
192
- `helper. If possible, you may need to give the expression a narrower type, ` +
193
- `for example \`'thing-a' | 'thing-b'\` rather than \`string\`.`);
194
- }
195
- }
196
- // Otherwise if this is on a top level invocation, we're trying to use a template-unaware
197
- // value in a template-specific way.
198
- let nodeType = sourceMapping?.sourceNode.type;
199
- if (nodeType === 'ElementNode' || nodeType === 'PathExpression' || nodeType === 'Identifier') {
200
- return addGlintDetails(diagnostic, 'The given value does not appear to be usable as a component, modifier or helper.');
201
- }
202
- }
203
- function checkImplicitAnyError(diagnostic, mapping) {
204
- let message = diagnostic.messageText;
205
- // We don't want to bake in assumptions about the exact format of TS error messages,
206
- // but we can assume that the name of the type we're indexing (`Globals`) will appear
207
- // in the text in the case we're interested in.
208
- if (typeof message === 'string' && message.includes('Globals')) {
209
- let { sourceNode } = mapping;
210
- // This error may appear either on `<Foo />` or `{{foo}}`/`(foo)`
211
- let globalName = sourceNode.type === 'ElementNode'
212
- ? sourceNode.path.head.original
213
- : sourceNode.type === 'PathExpression' && sourceNode.head.type === 'VarHead'
214
- ? sourceNode.head.name
215
- : null;
216
- if (globalName) {
217
- return addGlintDetails(diagnostic, `Unknown name '${globalName}'. If this isn't a typo, you may be missing a registry entry ` +
218
- `for this value; see the Template Registry page in the Glint documentation for more details.`);
219
- }
220
- }
221
- }
222
- function checkIndexAccessError(diagnostic, mapping) {
223
- if (mapping.sourceNode.type === 'Identifier' && typeof diagnostic.messageText === 'string') {
224
- let message = diagnostic.messageText;
225
- // "accessed with ['x']" => "accessed with {{get ... 'x'}}"
226
- return {
227
- ...diagnostic,
228
- messageText: message.replace(/\[(['"])(.*)\1\]/, `{{get ... $1$2$1}}`),
229
- };
230
- }
231
- }
232
- function addGlintDetails(diagnostic, details) {
233
- return {
234
- ...diagnostic,
235
- messageText: `${details}\n${diagnostic.messageText}`,
236
- };
237
- }
238
- // Find the nearest mapping node at or above the given one whose `source` AST node
239
- // matches one of the given types.
240
- function findAncestor(mapping, ...types) {
241
- let current = mapping;
242
- do {
243
- if (types.includes(current.sourceNode.type)) {
244
- return current.sourceNode;
245
- }
246
- } while ((current = current.parent));
247
- return null;
248
- }
249
- //# sourceMappingURL=augmentation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"augmentation.js","sourceRoot":"","sources":["../../../src/transform/diagnostics/augmentation.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,kBAAkB,CAChC,iBAAoC,EACpC,WAAgB;IAEhB,MAAM,oBAAoB,GAAG,CAAC,UAAyB,EAA2B,EAAE;QAClF,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC/B,MAAM,GAAG,GAAG,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC;QAEtC,OAAO,iBAAiB,CAAC,yBAAyB,CAChD,iBAAiB,CAAC,gBAAgB,EAClC,KAAK,EACL,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAiB,EAAE,CAAC;IAE9C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;QAEjF,oBAAoB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACjD,CAAC;IAED,uCAAuC;IACvC,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAOD,SAAS,kBAAkB,CACzB,UAAsB,EACtB,aAAkE;IAElE,MAAM,OAAO,GAAG,kBAAkB,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,E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D,OAAO;QACL,GAAG,UAAU;QACb,WAAW,EAAE,GAAG,OAAO,KAAK,UAAU,CAAC,WAAW,EAAE;KACrD,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,kCAAkC;AAClC,SAAS,YAAY,CACnB,OAA8B,EAC9B,GAAG,KAAe;IAElB,IAAI,OAAO,GAAiC,OAAO,CAAC;IACpD,GAAG,CAAC;QACF,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,IAAS,CAAC,EAAE,CAAC;YACjD,OAAO,OAAO,CAAC,UAAiD,CAAC;QACnE,CAAC;IACH,CAAC,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;IACrC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,5 +0,0 @@
1
- import type * as ts from 'typescript';
2
- export type Diagnostic = ts.Diagnostic & {
3
- isContentTagError?: boolean;
4
- };
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transform/diagnostics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,GAAG;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transform/diagnostics/index.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export type { Directive, default as TransformedModule } from './template/transformed-module.js';
2
- export type { Diagnostic } from './diagnostics/index.js';
3
- export { rewriteModule } from './template/rewrite-module.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transform/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAChG,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,2 +0,0 @@
1
- export { rewriteModule } from './template/rewrite-module.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transform/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,30 +0,0 @@
1
- import { CodeInformation } from '@volar/language-server/node.js';
2
- /**
3
- * Based on https://github.com/machty/vue-language-tools/blob/deff856aa8c15f691544e646519215a15aacbef1/packages/language-core/lib/codegen/codeFeatures.ts
4
- *
5
- * This file exports a "code features" object which provides a useful shorthand/shortcut
6
- * for specifying a nubmer of Volar CodeInformation configuration options in the code
7
- * we use for mapping between source code (e.g. .gts files) and transformed (i.e. type-checkable TS) code.
8
- *
9
- * Volar uses the CodeInformation we pass along with each mapping to determine what sort of language
10
- * features should be activated/processed for a given span of code.
11
- */
12
- declare const raw: {
13
- all: {
14
- verification: true;
15
- completion: true;
16
- semantic: true;
17
- navigation: true;
18
- };
19
- withoutHighlight: {
20
- semantic: {
21
- shouldHighlight: () => false;
22
- };
23
- verification: true;
24
- navigation: true;
25
- completion: true;
26
- };
27
- };
28
- export declare const codeFeatures: { [K in keyof typeof raw]: CodeInformation; };
29
- export {};
30
- //# sourceMappingURL=code-features.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-features.d.ts","sourceRoot":"","sources":["../../../src/transform/template/code-features.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;;;;;;GASG;AACH,QAAA,MAAM,GAAG;;;;;;;;;;;;;;;CAakC,CAAC;AAE5C,eAAO,MAAM,YAAY,EAAU,GAChC,CAAC,IAAI,MAAM,OAAO,GAAG,GAAG,eAAe,GACzC,CAAC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Based on https://github.com/machty/vue-language-tools/blob/deff856aa8c15f691544e646519215a15aacbef1/packages/language-core/lib/codegen/codeFeatures.ts
3
- *
4
- * This file exports a "code features" object which provides a useful shorthand/shortcut
5
- * for specifying a nubmer of Volar CodeInformation configuration options in the code
6
- * we use for mapping between source code (e.g. .gts files) and transformed (i.e. type-checkable TS) code.
7
- *
8
- * Volar uses the CodeInformation we pass along with each mapping to determine what sort of language
9
- * features should be activated/processed for a given span of code.
10
- */
11
- const raw = {
12
- all: {
13
- verification: true,
14
- completion: true,
15
- semantic: true,
16
- navigation: true,
17
- },
18
- withoutHighlight: {
19
- semantic: { shouldHighlight: () => false },
20
- verification: true,
21
- navigation: true,
22
- completion: true,
23
- },
24
- };
25
- export const codeFeatures = raw;
26
- //# sourceMappingURL=code-features.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-features.js","sourceRoot":"","sources":["../../../src/transform/template/code-features.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,GAAG,GAAG;IACV,GAAG,EAAE;QACH,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;KACjB;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE;QAC1C,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;KACjB;CACwC,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,GAE3B,CAAC"}
@@ -1,80 +0,0 @@
1
- import { AST } from '@glimmer/syntax';
2
- import { Range } from './transformed-module.js';
3
- import { Identifier } from './map-template-contents.js';
4
- import { CodeInformation } from '@volar/language-server/node.js';
5
- export type MappingSource = AST.Node | TemplateEmbedding | TextContent | Identifier | ParseError;
6
- /**
7
- * In cases where we're unable to parse a template, we still want to
8
- * be able to hold a placeholder mapping so that we can respond sensibly
9
- * to offset transformation queries. This class acts as a standin for
10
- * the proper AST node we were unable to obtain in such cases.
11
- */
12
- export declare class ParseError {
13
- readonly type = "ParseError";
14
- }
15
- /**
16
- * The Glimmer AST uses `TextNode` for both string arg values on elements
17
- * and for top-level text content floating in the DOM itself. Since we
18
- * want to treat the two differently (namely, string args may have useful
19
- * completion suggestions but plain text doesn't), we use a stand-in
20
- * node for the latter.
21
- */
22
- export declare class TextContent {
23
- readonly type = "TextContent";
24
- }
25
- /**
26
- * This node represents the root of an embedded template, including
27
- * the surrounding `<template>...</template>` boilerplate that designates
28
- * the surrounded contents as a template.
29
- */
30
- export declare class TemplateEmbedding {
31
- readonly type = "TemplateEmbedding";
32
- }
33
- /**
34
- * A `MappingTree` maintains a hierarchy of mappings between ranges of
35
- * locations in original and transformed source strings. These mappings
36
- * are naturally hierarchical due to the tree structure of the underlying
37
- * code.
38
- *
39
- * For instance, given an expression like `{{foo.bar}}` in a template, a
40
- * corresponding expression in TypeScript might be `foo?.bar`. The individual
41
- * identifiers `foo` and `bar` map directly to one another, but the full
42
- * expressions do as well. By maintaining a full hierarchy of these mappings,
43
- * we can always report diagnostics in the template at roughly the same
44
- * level of granularity as TS itself uses when reporting on the transformed
45
- * output.
46
- */
47
- export default class GlimmerASTMappingTree {
48
- transformedRange: Range;
49
- originalRange: Range;
50
- children: Array<GlimmerASTMappingTree>;
51
- sourceNode: MappingSource;
52
- codeInformation?: CodeInformation | undefined;
53
- parent: GlimmerASTMappingTree | null;
54
- constructor(transformedRange: Range, originalRange: Range, children: Array<GlimmerASTMappingTree> | undefined, sourceNode: MappingSource, codeInformation?: CodeInformation | undefined);
55
- /**
56
- * Returns the mapping corresponding to the smallest span in the transformed source
57
- * that contains the given range, or `null` if that range doesn't fall within
58
- * this mapping tree.
59
- */
60
- narrowestMappingForTransformedRange(range: Range): GlimmerASTMappingTree | null;
61
- /**
62
- * Returns the mapping corresponding to the smallest span in the original source
63
- * that contains the given range, or `null` if that range doesn't fall within
64
- * this mapping tree.
65
- */
66
- narrowestMappingForOriginalRange(range: Range): GlimmerASTMappingTree | null;
67
- /**
68
- * Returns all mappings that exactly match the provided range.
69
- */
70
- exactMappingsForOriginalRange(range: Range): GlimmerASTMappingTree[];
71
- toDebugString(options: {
72
- originalStart: number;
73
- originalSource: string;
74
- transformedStart: number;
75
- transformedSource: string;
76
- indent?: string;
77
- }): string;
78
- private getSourceRange;
79
- }
80
- //# sourceMappingURL=glimmer-ast-mapping-tree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glimmer-ast-mapping-tree.d.ts","sourceRoot":"","sources":["../../../src/transform/template/glimmer-ast-mapping-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,GAAG,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjG;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,SAAgB,IAAI,gBAAgB;CACrC;AAED;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,SAAgB,IAAI,iBAAiB;CACtC;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,SAAgB,IAAI,uBAAuB;CAC5C;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAqB;IAI/B,gBAAgB,EAAE,KAAK;IACvB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,KAAK,CAAC,qBAAqB,CAAC;IACtC,UAAU,EAAE,aAAa;IACzB,eA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