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.
Sync template compilation details with Ember, add @glimmer/babel-preset
Syncs the details of template compilation with Ember so that both frameworks are using the same setup to compile templates. Also removes the two babel plugins in favor of a single babel preset. \## Breaking Changes - `createTemplate` has been renamed and updated to match `precompileTemplate` in Ember - `setComponentTemplate` and `createTemplateFactory` have been split apart into separate functions, matching the usage in Ember - `@glimmer/babel-plugin-glimmer-env` has been removed - `@glimmer/babel-plugin-strict-template-precompile` has been removed - `@glimmer/babel-preset` has been added - `@glimmer/debug` has been added with `deprecate` and `assert` functions
- Loading branch information
Chris Garrett
committed
Mar 19, 2021
1 parent
364140c
commit dce0cb6
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.