This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #334 from glimmerjs/sync-template-compilation-with…
…-ember Sync template compilation details with Ember, add @glimmer/babel-preset
- Loading branch information
Showing
63 changed files
with
508 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
module.exports = function (api) { | ||
module.exports = function () { | ||
return { | ||
plugins: [ | ||
['@glimmer/babel-plugin-glimmer-env', { DEBUG: !api.env('production') }], | ||
'@glimmer/babel-plugin-strict-template-precompile', | ||
['@babel/plugin-proposal-decorators', { legacy: true }], | ||
'@babel/plugin-proposal-class-properties', | ||
], | ||
presets: ['@babel/preset-env', '@babel/preset-typescript'], | ||
presets: ['@glimmer/babel-preset', '@babel/preset-env', '@babel/preset-typescript'], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
import { DEBUG } from '@glimmer/env'; | ||
import { setComponentTemplate as vmSetComponentTemplate } from '@glimmer/manager'; | ||
import { SerializedTemplateWithLazyBlock, Dict } from '@glimmer/interfaces'; | ||
import { templateFactory } from '@glimmer/opcode-compiler'; | ||
import { TemplateFactory } from '@glimmer/interfaces'; | ||
|
||
// This is provided by the `babel-plugin-strict-template-precompile` plugin | ||
export let createTemplate: ( | ||
scopeOrTemplate: Dict<unknown> | string, | ||
template?: string | ||
) => SerializedTemplateWithLazyBlock; | ||
// This is provided by `@glimmer/babel-preset` | ||
export let precompileTemplate: ( | ||
template: string, | ||
options?: { | ||
strictMode?: boolean; | ||
scope?: Record<string, unknown>; | ||
} | ||
) => TemplateFactory; | ||
|
||
if (DEBUG) { | ||
createTemplate = (): SerializedTemplateWithLazyBlock => { | ||
precompileTemplate = (): TemplateFactory => { | ||
throw new Error( | ||
'createTemplate() is meant to be preprocessed with a babel plugin, @glimmer/babel-plugin-strict-template-precompile. If you are seeing this error message, it means that you do not have this babel plugin installed, or it is not enabled correctly' | ||
'precompileTemplate() is meant to be preprocessed with babel, using @glimmer/babel-preset. If you are seeing this error message, it means that you do not have this babel preset installed, or it is not enabled correctly' | ||
); | ||
}; | ||
} | ||
|
||
export function setComponentTemplate( | ||
template: SerializedTemplateWithLazyBlock, | ||
ComponentClass: object | ||
): object { | ||
return vmSetComponentTemplate(templateFactory(template), ComponentClass); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.