@@ -7,7 +7,7 @@ import { JSUtils, ExtendedPluginBuilder } from './js-utils';
7
7
import type { EmberTemplateCompiler , PreprocessOptions } from './ember-template-compiler' ;
8
8
import { LegacyModuleName } from './public-types' ;
9
9
import { ScopeLocals } from './scope-locals' ;
10
- import { getTemplateLocals , preprocess , print } from '@glimmer/syntax' ;
10
+ import { ASTPluginBuilder , getTemplateLocals , preprocess , print } from '@glimmer/syntax' ;
11
11
12
12
export * from './public-types' ;
13
13
@@ -395,7 +395,10 @@ function buildPrecompileOptions<EnvSpecificOptions>(
395
395
396
396
let output : PreprocessOptions & Record < string , unknown > = {
397
397
contents : template ,
398
- meta,
398
+
399
+ // we've extended meta to add jsutils, but the types in @glimmer/syntax
400
+ // don't account for extension
401
+ meta : meta as PreprocessOptions [ 'meta' ] ,
399
402
400
403
// TODO: embroider's template-compiler allows this to be overriden to get
401
404
// backward-compatible module names that don't match the real name of the
@@ -408,7 +411,9 @@ function buildPrecompileOptions<EnvSpecificOptions>(
408
411
filename : state . filename ,
409
412
410
413
plugins : {
411
- ast : state . normalizedOpts . transforms ,
414
+ // the cast is needed here only because our meta is extended. That is,
415
+ // these plugins can access meta.jsutils.
416
+ ast : state . normalizedOpts . transforms as ASTPluginBuilder [ ] ,
412
417
} ,
413
418
} ;
414
419
@@ -544,7 +549,7 @@ function insertTransformedTemplate<EnvSpecificOptions>(
544
549
formatOptions ,
545
550
scopeLocals
546
551
) ;
547
- let ast = preprocess ( template , { ...options , mode : 'codemod' } as any ) ;
552
+ let ast = preprocess ( template , { ...options , mode : 'codemod' } ) ;
548
553
let transformed = print ( ast , { entityEncoding : 'raw' } ) ;
549
554
if ( target . isCallExpression ( ) ) {
550
555
( target . get ( 'arguments.0' ) as NodePath < t . Node > ) . replaceWith ( t . stringLiteral ( transformed ) ) ;
0 commit comments