@glint/ember-tsc 1.7.5 → 1.8.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/environment-ember-template-imports/-private/environment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA0B,MAAM,+BAA+B,CAAC;AAI/F,MAAM,CAAC,OAAO,UAAU,+BAA+B,CACrD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,sBAAsB,CAwGxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/environment-ember-template-imports/-private/environment/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAA0B,MAAM,+BAA+B,CAAC;AAqC/F,MAAM,CAAC,OAAO,UAAU,+BAA+B,CACrD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,sBAAsB,CAwGxB"}
@@ -1,5 +1,41 @@
1
+ import { createRequire } from 'node:module';
1
2
  import { preprocess } from './preprocess.js';
2
3
  import { transform } from './transform.js';
4
+ /**
5
+ * Probe for the ember-source >= 7.1 built-in keyword set at config-load time.
6
+ *
7
+ * The 7.1 keywords (and, or, eq, fn, hash, not, gt/gte/lt/lte/neq, on, element,
8
+ * array) ship with ember-source 7.1 (RFCs 389, 470, 560, 561, 562, 997, 998,
9
+ * 999, 1000). On older versions consumers must import them from
10
+ * `ember-truth-helpers` / `@ember/helper`. Including these names in the strict
11
+ * mode `globals` set unconditionally suppresses TypeScript's
12
+ * "Cannot find name 'X'" diagnostic on <7.1 (because the transform emits
13
+ * `__glintDSL__.Globals.X` instead of a bare `X`), which in turn disables the
14
+ * `Add import from '...'` quick-fix and IDE autocomplete from user imports.
15
+ *
16
+ * Resolving from this module's URL means the probe walks the consumer's
17
+ * `node_modules` tree, so it reflects the host project's installed
18
+ * `ember-source`. Any failure (missing package, unreadable JSON, malformed
19
+ * version) collapses to `false` so the safe default is to assume the
20
+ * consumer is on a pre-7.1 build and let users import explicitly.
21
+ */
22
+ function hasEmber71BuiltIns() {
23
+ try {
24
+ const require_ = createRequire(import.meta.url);
25
+ const pkg = require_('ember-source/package.json');
26
+ if (typeof pkg.version !== 'string')
27
+ return false;
28
+ const [majorStr, minorStr] = pkg.version.split('.', 2);
29
+ const major = Number(majorStr);
30
+ const minor = Number(minorStr);
31
+ if (!Number.isFinite(major) || !Number.isFinite(minor))
32
+ return false;
33
+ return major > 7 || (major === 7 && minor >= 1);
34
+ }
35
+ catch {
36
+ return false;
37
+ }
38
+ }
3
39
  export default function emberTemplateImportsEnvironment(options) {
4
40
  let additionalSpecialForms = typeof options['additionalSpecialForms'] === 'object'
5
41
  ? options['additionalSpecialForms']
@@ -78,7 +114,7 @@ export default function emberTemplateImportsEnvironment(options) {
78
114
  },
79
115
  globals: [
80
116
  ...globalsForEmber,
81
- ...globalsForEmber71,
117
+ ...(hasEmber71BuiltIns() ? globalsForEmber71 : []),
82
118
  ...Object.keys(additionalGlobalSpecialForms),
83
119
  ...additionalGlobals,
84
120
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/environment-ember-template-imports/-private/environment/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,+BAA+B,CACrD,OAAgC;IAEhC,IAAI,sBAAsB,GACxB,OAAO,OAAO,CAAC,wBAAwB,CAAC,KAAK,QAAQ;QACnD,CAAC,CAAE,OAAO,CAAC,wBAAwB,CAA4B;QAC/D,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,4BAA4B,GAAG,sBAAsB,CAAC,OAAO,IAAI,EAAE,CAAC;IAE1E,MAAM,iBAAiB,GAAG,KAAK,CA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BAC5C,GAAG,iBAAiB;qBACrB;iBACF;aACF;SACF;QACD,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,cAAc;gBACpB,UAAU;gBACV,SAAS;aACV;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,UAAU;gBACV,SAAS;aACV;SACF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/environment-ember-template-imports/-private/environment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,2BAA2B,CAA0B,CAAC;QAC3E,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAClD,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACrE,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,MAA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,EAAE,gBAAgB;4BACxB,GAAG,4BAA4B;yBAChC;wBACD,OAAO,EAAE;4BACP,eAAe,EAAE;gCACf,KAAK,EAAE,eAAe;gCACtB,IAAI,EAAE,gBAAgB;gCACtB,GAAG,sBAAsB,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC;6BACrD;4BACD,GAAG,sBAAsB,CAAC,OAAO;yBAClC;qBACF;oBACD,OAAO,EAAE;wBACP,GAAG,eAAe;wBAClB,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;wBAClD,GAAG,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC;wBAC5C,GAAG,iBAAiB;qBACrB;iBACF;aACF;SACF;QACD,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,cAAc;gBACpB,UAAU;gBACV,SAAS;aACV;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,UAAU;gBACV,SAAS;aACV;SACF;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glint/ember-tsc",
3
- "version": "1.7.5",
3
+ "version": "1.8.0",
4
4
  "repository": "typed-ember/glint",
5
5
  "description": "A CLI for performing typechecking on Glimmer templates",
6
6
  "license": "MIT",
@@ -1,7 +1,41 @@
1
+ import { createRequire } from 'node:module';
1
2
  import { GlintEnvironmentConfig, GlintSpecialFormConfig } from '@glint/ember-tsc/config-types';
2
3
  import { preprocess } from './preprocess.js';
3
4
  import { transform } from './transform.js';
4
5
 
6
+ /**
7
+ * Probe for the ember-source >= 7.1 built-in keyword set at config-load time.
8
+ *
9
+ * The 7.1 keywords (and, or, eq, fn, hash, not, gt/gte/lt/lte/neq, on, element,
10
+ * array) ship with ember-source 7.1 (RFCs 389, 470, 560, 561, 562, 997, 998,
11
+ * 999, 1000). On older versions consumers must import them from
12
+ * `ember-truth-helpers` / `@ember/helper`. Including these names in the strict
13
+ * mode `globals` set unconditionally suppresses TypeScript's
14
+ * "Cannot find name 'X'" diagnostic on <7.1 (because the transform emits
15
+ * `__glintDSL__.Globals.X` instead of a bare `X`), which in turn disables the
16
+ * `Add import from '...'` quick-fix and IDE autocomplete from user imports.
17
+ *
18
+ * Resolving from this module's URL means the probe walks the consumer's
19
+ * `node_modules` tree, so it reflects the host project's installed
20
+ * `ember-source`. Any failure (missing package, unreadable JSON, malformed
21
+ * version) collapses to `false` so the safe default is to assume the
22
+ * consumer is on a pre-7.1 build and let users import explicitly.
23
+ */
24
+ function hasEmber71BuiltIns(): boolean {
25
+ try {
26
+ const require_ = createRequire(import.meta.url);
27
+ const pkg = require_('ember-source/package.json') as { version?: unknown };
28
+ if (typeof pkg.version !== 'string') return false;
29
+ const [majorStr, minorStr] = pkg.version.split('.', 2);
30
+ const major = Number(majorStr);
31
+ const minor = Number(minorStr);
32
+ if (!Number.isFinite(major) || !Number.isFinite(minor)) return false;
33
+ return major > 7 || (major === 7 && minor >= 1);
34
+ } catch {
35
+ return false;
36
+ }
37
+ }
38
+
5
39
  export default function emberTemplateImportsEnvironment(
6
40
  options: Record<string, unknown>,
7
41
  ): GlintEnvironmentConfig {
@@ -88,7 +122,7 @@ export default function emberTemplateImportsEnvironment(
88
122
  },
89
123
  globals: [
90
124
  ...globalsForEmber,
91
- ...globalsForEmber71,
125
+ ...(hasEmber71BuiltIns() ? globalsForEmber71 : []),
92
126
  ...Object.keys(additionalGlobalSpecialForms),
93
127
  ...additionalGlobals,
94
128
  ],
@@ -31,9 +31,12 @@ import { UniqueIdHelper } from '../intrinsics/unique-id';
31
31
  // 389 are only available at runtime when consumers are on ember-source >= 7.1.
32
32
  // We probe for the `eq` value re-export added by RFC 561 to decide whether to
33
33
  // expose the new keyword types. On older versions the probe collapses to the
34
- // empty type, so referencing e.g. `{{eq}}` falls back to whatever the user
35
- // has imported (or surfaces as an "unknown identifier" diagnostic), keeping
36
- // behaviour identical to today.
34
+ // empty type, so the 7.1 keyword members are entirely absent from `Globals` —
35
+ // referencing e.g. `{{eq}}` then surfaces TypeScript's standard
36
+ // "Property 'eq' does not exist on type 'Globals'" diagnostic, which triggers
37
+ // auto-import quick-fixes (`import { eq } from 'ember-truth-helpers'`) and
38
+ // lets user-scoped imports flow through completion and hover without being
39
+ // shadowed by a `never`-typed builtin.
37
40
  //
38
41
  // We probe a value export (`eq`) rather than the matching `EqHelper`
39
42
  // interface because `typeof import(...)` only surfaces the module's value
@@ -49,9 +52,6 @@ type EmberHelperExports = typeof import('@ember/helper');
49
52
 
50
53
  type HasEmber71BuiltIns = [EmberHelperExports] extends [{ eq: unknown }] ? true : false;
51
54
 
52
- /** Resolves to `T` only when ember-source >= 7.1 ships the new keyword set. */
53
- type Ember71Only<T> = HasEmber71BuiltIns extends true ? T : never;
54
-
55
55
  // The keyword vs global breakdown here is loosely matched with
56
56
  // the listing in http://emberjs.github.io/rfcs/0496-handlebars-strict-mode.html
57
57
 
@@ -243,12 +243,16 @@ interface KeywordsForEmber {
243
243
 
244
244
  /**
245
245
  * Built-in template keywords introduced by ember-source 7.1
246
- * (RFCs 389, 470, 560, 561, 562, 997, 998, 999, 1000). Each entry is gated by
247
- * `Ember71Only<T>` so the keyword resolves to `never` (and is therefore
248
- * effectively absent) when the consumer is on ember-source < 7.1. See the
249
- * `HasEmber71BuiltIns` probe at the top of this file.
246
+ * (RFCs 389, 470, 560, 561, 562, 997, 998, 999, 1000). The whole member set is
247
+ * gated by `HasEmber71BuiltIns` at the `Globals` intersection below, so when
248
+ * the consumer is on ember-source < 7.1 these property keys are absent from
249
+ * `Globals` entirely (rather than present as `never`). That lets TypeScript
250
+ * report `{{eq}}` / `{{and}}` / etc. as unknown properties and offer the
251
+ * "Add import from 'ember-truth-helpers'" / `@ember/helper` quick-fix, and
252
+ * keeps user-imported helpers from being shadowed by a `never`-typed builtin
253
+ * in completion and hover.
250
254
  */
251
- interface KeywordsForEmber71 {
255
+ interface KeywordsForEmber71Members {
252
256
  /**
253
257
  * The `{{and}}` helper evaluates arguments left to right, returning the first
254
258
  * falsy value (using Handlebars truthiness) or the right-most value if all
@@ -265,7 +269,7 @@ interface KeywordsForEmber71 {
265
269
  *
266
270
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/and
267
271
  */
268
- and: Ember71Only<AndHelper>;
272
+ and: AndHelper;
269
273
 
270
274
  /**
271
275
  * Using the `{{array}}` helper, you can pass arrays directly from the
@@ -286,7 +290,7 @@ interface KeywordsForEmber71 {
286
290
  *
287
291
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/array
288
292
  */
289
- array: Ember71Only<ArrayHelper>;
293
+ array: ArrayHelper;
290
294
 
291
295
  /**
292
296
  * The `{{element}}` helper lets you dynamically set the tag name of an
@@ -310,7 +314,7 @@ interface KeywordsForEmber71 {
310
314
  *
311
315
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/element
312
316
  */
313
- element: Ember71Only<ElementHelper>;
317
+ element: ElementHelper;
314
318
 
315
319
  /**
316
320
  * The `{{eq}}` helper returns `true` if its two arguments are strictly equal
@@ -327,7 +331,7 @@ interface KeywordsForEmber71 {
327
331
  *
328
332
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/eq
329
333
  */
330
- eq: Ember71Only<EqHelper>;
334
+ eq: EqHelper;
331
335
 
332
336
  /**
333
337
  * `{{fn}}` is a helper that receives a function and some arguments, and
@@ -351,7 +355,7 @@ interface KeywordsForEmber71 {
351
355
  *
352
356
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/fn
353
357
  */
354
- fn: Ember71Only<FnHelper>;
358
+ fn: FnHelper;
355
359
 
356
360
  /**
357
361
  * The `{{gt}}` helper returns `true` if the first argument is greater than
@@ -368,7 +372,7 @@ interface KeywordsForEmber71 {
368
372
  *
369
373
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/gt
370
374
  */
371
- gt: Ember71Only<GtHelper>;
375
+ gt: GtHelper;
372
376
 
373
377
  /**
374
378
  * The `{{gte}}` helper returns `true` if the first argument is greater than
@@ -385,7 +389,7 @@ interface KeywordsForEmber71 {
385
389
  *
386
390
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/gte
387
391
  */
388
- gte: Ember71Only<GteHelper>;
392
+ gte: GteHelper;
389
393
 
390
394
  /**
391
395
  * Using the `{{hash}}` helper, you can pass objects directly from the
@@ -404,7 +408,7 @@ interface KeywordsForEmber71 {
404
408
  *
405
409
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/hash
406
410
  */
407
- hash: Ember71Only<HashHelper>;
411
+ hash: HashHelper;
408
412
 
409
413
  /**
410
414
  * The `{{lt}}` helper returns `true` if the first argument is less than the
@@ -421,7 +425,7 @@ interface KeywordsForEmber71 {
421
425
  *
422
426
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/lt
423
427
  */
424
- lt: Ember71Only<LtHelper>;
428
+ lt: LtHelper;
425
429
 
426
430
  /**
427
431
  * The `{{lte}}` helper returns `true` if the first argument is less than or
@@ -438,7 +442,7 @@ interface KeywordsForEmber71 {
438
442
  *
439
443
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/lte
440
444
  */
441
- lte: Ember71Only<LteHelper>;
445
+ lte: LteHelper;
442
446
 
443
447
  /**
444
448
  * The `{{neq}}` helper returns `true` if its two arguments are strictly not
@@ -455,7 +459,7 @@ interface KeywordsForEmber71 {
455
459
  *
456
460
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/neq
457
461
  */
458
- neq: Ember71Only<NeqHelper>;
462
+ neq: NeqHelper;
459
463
 
460
464
  /**
461
465
  * The `{{not}}` helper returns the logical negation of its argument using
@@ -472,7 +476,7 @@ interface KeywordsForEmber71 {
472
476
  *
473
477
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/not
474
478
  */
475
- not: Ember71Only<NotHelper>;
479
+ not: NotHelper;
476
480
 
477
481
  /**
478
482
  * The `{{on}}` element modifier attaches an event listener to an element.
@@ -493,7 +497,7 @@ interface KeywordsForEmber71 {
493
497
  *
494
498
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fmodifier/on
495
499
  */
496
- on: Ember71Only<OnModifier>;
500
+ on: OnModifier;
497
501
 
498
502
  /**
499
503
  * The `{{or}}` helper evaluates arguments left to right, returning the first
@@ -511,7 +515,7 @@ interface KeywordsForEmber71 {
511
515
  *
512
516
  * @see https://api.emberjs.com/ember/release/functions/@ember%2Fhelper/or
513
517
  */
514
- or: Ember71Only<OrHelper>;
518
+ or: OrHelper;
515
519
  }
516
520
 
517
521
  /**
@@ -576,6 +580,12 @@ interface KeywordAliasesForEmber {
576
580
  unique_id: UniqueIdHelper;
577
581
  }
578
582
 
579
- interface Keywords extends KeywordsForEmber, KeywordsForEmber71, KeywordAliasesForEmber {}
583
+ interface Keywords extends KeywordsForEmber, KeywordAliasesForEmber {}
584
+
585
+ // When `HasEmber71BuiltIns` is `true`, the 7.1 keyword members are included on
586
+ // `Globals`; otherwise the conditional collapses to `{}` and the keys are
587
+ // absent so TypeScript surfaces "unknown identifier" diagnostics / auto-import
588
+ // quick-fixes for `{{and}}`, `{{eq}}`, etc.
589
+ type KeywordsForEmber71 = HasEmber71BuiltIns extends true ? KeywordsForEmber71Members : {};
580
590
 
581
- export const Globals: Keywords & Globals;
591
+ export const Globals: Keywords & KeywordsForEmber71 & Globals;
@@ -10,12 +10,18 @@ export type EventForName<Name extends string> = Name extends keyof HTMLElementEv
10
10
  ? HTMLElementEventMap[Name]
11
11
  : Event;
12
12
 
13
- export type OnModifier = abstract new <Name extends string>() => InstanceType<
13
+ export type OnModifier = abstract new <
14
+ Name extends string,
15
+ El extends Element = Element,
16
+ >() => InstanceType<
14
17
  ModifierLike<{
15
- Element: Element;
18
+ Element: El;
16
19
  Args: {
17
20
  Named: OnModifierArgs;
18
- Positional: [name: Name, callback: (event: EventForName<Name>) => void];
21
+ Positional: [
22
+ name: Name,
23
+ callback: (event: EventForName<Name> & { currentTarget: El }) => void,
24
+ ];
19
25
  };
20
26
  }>
21
27
  >;