Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

new template-compilation apis #161

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions addon/cjs/index.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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: '<template>',
useTemplateTagProposalSemantics: 1,
},
},
},
}),

// HTMLBars,
// {
// 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: '<template>',
// useTemplateTagProposalSemantics: 1,
// },
// },
// },
],
[babel.availablePlugins['proposal-decorators'], { legacy: true }],
[babel.availablePlugins['proposal-class-properties']],
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
"postpack": "ember ts:clean"
},
"dependencies": {
"@babel/standalone": "^7.15.7",
"@embroider/macros": "^0.44.2",
"@babel/standalone": "^7.15.8",
"@embroider/macros": "^0.47.0",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"babel-plugin-htmlbars-inline-precompile": "^5.3.0",
"broccoli-file-creator": "^2.1.1",
"common-tags": "^1.8.0",
"ember-auto-import": "2.1.0",
"ember-auto-import": "2.2.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-htmlbars": "^5.7.1",
"ember-cli-htmlbars": "^6.0.0",
"ember-cli-typescript": "^4.2.1",
"ember-compatibility-helpers": "^1.2.5",
"path-browserify": "^1.0.1",
Expand All @@ -49,7 +49,7 @@
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.4.2",
"@ember/test-waiters": "^3.0.0",
"@embroider/test-setup": "^0.44.2",
"@embroider/test-setup": "^0.47.0",
"@glimmer/interfaces": "^0.80.0",
"@glimmer/reference": "^0.80.0",
"@glimmer/util": "^0.80.0",
Expand Down Expand Up @@ -85,7 +85,7 @@
"@typescript-eslint/parser": "^4.31.2",
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.28.0",
"ember-cli": "~3.28.3",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
Expand Down Expand Up @@ -116,8 +116,8 @@
"qunit": "^2.17.2",
"qunit-dom": "^2.0.0",
"semantic-release": "^17.0.0",
"typescript": "^4.4.3",
"webpack": "^5.54.0"
"typescript": "^4.4.4",
"webpack": "^5.59.0"
},
"release": {
"branches": [
Expand Down
3 changes: 0 additions & 3 deletions types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
// }


// provided by vendor/ember/ember-template-compiler.js (somehow)
declare module 'ember-template-compiler';

declare module '@ember/-internals/glimmer';
declare module '@ember/helper';
declare module '@ember/modifier';
Expand Down
Loading