From 1adb0efbe740ed80b412bb7cb3c5c6b2b6935621 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Wed, 20 Oct 2021 15:04:25 -0400 Subject: [PATCH 1/3] wip: try to use new template-compilation apis --- addon/cjs/index.ts | 43 ++++++----- index.js | 2 +- package.json | 15 ++-- types/global.d.ts | 3 - yarn.lock | 180 +++++++++++++++++++++++++++++++++++++-------- 5 files changed, 183 insertions(+), 60 deletions(-) diff --git a/addon/cjs/index.ts b/addon/cjs/index.ts index 8c62448d..e4f69d8c 100644 --- a/addon/cjs/index.ts +++ b/addon/cjs/index.ts @@ -1,8 +1,9 @@ import { getTemplateLocals } from '@glimmer/syntax'; +import { precompileTemplate } from '@ember/template-compilation'; -import HTMLBars, { preprocessEmbeddedTemplates } from 'babel-plugin-htmlbars-inline-precompile'; -import { precompile as precompileTemplate } from 'ember-template-compiler'; +import makePlugin from 'babel-plugin-ember-template-compilation'; +// import HTMLBars, { preprocessEmbeddedTemplates } from 'babel-plugin-htmlbars-inline-precompile'; import { nameFor } from '../utils'; import { evalSnippet } from './eval'; @@ -72,24 +73,28 @@ async function compileGJS({ code: input, name }: Info) { filename: `${name}.js`, plugins: [ [ - HTMLBars, - { + makePlugin({ precompile: precompileTemplate, - // this needs to be true until Ember 3.27+ - ensureModuleApiPolyfill: false, - modules: { - 'ember-template-imports': { - export: 'hbs', - useTemplateLiteralProposalSemantics: 1, - }, - - 'TEMPLATE-TAG-MODULE': { - export: 'GLIMMER_TEMPLATE', - debugName: '