From 1f0efe9296adb07ecd95d6770ad75df4ffdf9088 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 9 Sep 2024 14:26:33 -0400 Subject: [PATCH 1/2] Provide a default compilerPath This is a convenience feature due to the fact that embroider is about to offer a "normal" babel config where users will be looking directly at babel-plugin-ember-template-compilation. --- src/node-main.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/node-main.ts b/src/node-main.ts index 24495e6..7aa81d1 100644 --- a/src/node-main.ts +++ b/src/node-main.ts @@ -10,12 +10,15 @@ export * from './public-types'; export type Transform = ExtendedPluginBuilder | string | [string, unknown]; export type Options = Omit & { - // The on-disk path to the ember-template-comipler.js module for our current - // ember version. You need to either set `compilerPath` or set `compiler`. + // The on-disk path to the ember-template-compiler.js module for our current + // ember version. You can set either `compilerPath` or set `compiler`. If you + // set neither, we will attempt to resolve + // "ember-source/dist/ember-template-compiler.js" from the current working + // directory. compilerPath?: string; // The ember-template-compiler.js module that ships within your ember-source - // version. You need to set either `compilerPath` or `compiler`. + // version. You can set either `compilerPath` or `compiler`. compiler?: EmberTemplateCompiler; // List of custom transformations to apply to the handlebars AST before @@ -42,6 +45,10 @@ function handleNodeSpecificOptions(opts: Options): SharedOptions { } else if (opts.compiler) { assertTemplateCompiler(opts.compiler); compiler = opts.compiler; + } else { + let mod: any = cwdRequire('ember-source/dist/ember-template-compiler.js'); + assertTemplateCompiler(mod); + compiler = mod; } let transforms = []; From c9675bb7ab0f289a8335d891ee84deb02ded70b8 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Mon, 9 Sep 2024 14:27:55 -0400 Subject: [PATCH 2/2] update readme to match --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b3ebda6..8d8625b 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ interface Options { compiler?: EmberTemplateCompiler; // The on-disk path to the ember-template-compiler.js module for our current - // ember version. You need to either set `compilerPath` or set `compiler`. + // ember version. You may set `compilerPath` or set `compiler`. // This will get resolved from the current working directory, so a package name - // like "ember-source/dist/ember-template-compiler" is acceptable. + // like "ember-source/dist/ember-template-compiler" (the default value) is acceptable. compilerPath?: string; // Allows you to remap what imports will be emitted in our compiled output. By