Skip to content

Commit

Permalink
Update Glimmer.js to the latest
Browse files Browse the repository at this point in the history
Updates Glimmer.js to the latest, and also updates a number of APIs:

\## Breaking Changes

- Removes `@glimmerx/babel-plugin-component-templates`, replaces it with
  `@glimmerx/babel-preset` which wraps `@glimmer/babel-preset`. This
  uses `babel-plugin-htmlbars-inline-precompile`, which is the same
  inline precompiler used by Ember.js now, so we are synced between the
  two frameworks.
- Removes support for Ember < 3.25, `@glimmerx/component` will only work
  with versions of Ember that support strict mode.
- Adds `@glimmerx/webpack-loader`, which is now required to run before
  the Babel loader.
- Removes `TemplateArgs` export as a type.

\## Other Changes

- Adds support for `.gts` and `.gjs`
- Re-exports `fn` and `on` from Ember for usage in the Ember version of
  the addons
- Implements `helper()` for use in defining helpers in Ember
  • Loading branch information
Chris Garrett committed Mar 25, 2021
1 parent 116fa29 commit c32ca4b
Show file tree
Hide file tree
Showing 150 changed files with 1,713 additions and 1,971 deletions.
8 changes: 4 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
**/bower_components/**

# Fixtures
**/packages/@glimmerx/babel-plugin-component-templates/test/**/code.js
**/packages/@glimmerx/babel-plugin-component-templates/test/**/output.js
**/packages/@glimmerx/babel-plugin-component-templates/test/**/code.ts
**/packages/@glimmerx/babel-plugin-component-templates/test/**/output.ts
**/packages/@glimmerx/babel-preset/test/**/code.js
**/packages/@glimmerx/babel-preset/test/**/output.js
**/packages/@glimmerx/babel-preset/test/**/code.ts
**/packages/@glimmerx/babel-preset/test/**/output.ts
39 changes: 15 additions & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module.exports = {
ecmaVersion: 2019,
sourceType: 'module',
},
env: {
es6: true,
},
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
Expand All @@ -30,7 +33,6 @@ module.exports = {
'**/scripts/**/*.js',
'**/blueprints/**/*.js',
'webpack.config.js',
'packages/babel-plugins/**/*.js',
'packages/@glimmerx/blueprint/index.js',
],
env: {
Expand All @@ -40,19 +42,9 @@ module.exports = {
},
{
files: [
'packages/@glimmerx/babel-plugin-component-templates/**/*.js',
'packages/@glimmerx/babel-preset/**/*.js',
'packages/@glimmerx/eslint-plugin/**/*.js',
],
env: {
es6: true,
node: true,
mocha: true,
},
},
{
files: [
'packages/@glimmerx/babel-plugin-component-templates/test/**/code.js',
'packages/@glimmerx/babel-plugin-component-templates/test/**/output.js',
'packages/@glimmerx/webpack-loader/**/*.js',
],
env: {
es6: true,
Expand All @@ -67,17 +59,6 @@ module.exports = {
'no-process-exit': 'off',
},
},
// source Js
{
files: ['**/src/**/*.js', '**/test/**/*.js'],
env: {
es2020: true,
browser: true,
},
parserOptions: {
sourceType: 'module',
},
},
// TypeScript source
{
files: ['**/*.ts'],
Expand All @@ -91,9 +72,19 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

'@typescript-eslint/ban-types': ['error', {
types: {
// we currently use `object` as "valid WeakMap key" in a lot of APIs
object: false,
}
}],

// We should try to remove this eventually
'@typescript-eslint/explicit-function-return-type': 'off',

// We should also try to remove this eventually
'@typescript-eslint/ban-ts-ignore': 'off',

// disabling this one because of DEBUG APIs, if we ever find a better
// way to suport those we should re-enable it
'@typescript-eslint/no-non-null-assertion': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

strategy:
matrix:
ember-version: [default, release, beta, canary, lts-3.16]
ember-version: [default, release, beta, canary, "3.25"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages/@glimmerx/babel-plugin-component-templates/test/
packages/@glimmerx/babel-preset/test/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ npm:
yarn add @glimmerx/core @glimmerx/component
```

You will also need to install a Babel plugin that compiles templates with the
Glimmer compiler:
You will also need to install a Babel preset that handles Glimmer templates and
other language features, such as decorators and class fields:

```
yarn add -D @glimmerx/babel-plugin-component-templates
yarn add -D @glimmerx/babel-preset
```

If using ESLint, you will also want to install / use the plugin provided, as the `no-unused-vars` core rule will fail without it
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"start": "webpack-dev-server",
"storybook": "yarn build && yarn workspace basic-example-app storybook",
"test": "yarn lint && testem ci && yarn test:babel-plugins",
"test:babel-plugins": "mocha -r esm --timeout 5000 packages/@glimmerx/babel-plugin-component-templates/test packages/@glimmerx/eslint-plugin/test/lib/rules",
"test:babel-plugins": "mocha -r esm --timeout 5000 packages/@glimmerx/babel-preset/test packages/@glimmerx/eslint-plugin/test/lib/rules",
"test:ember": "yarn workspace basic-addon ember try:one",
"test:playground": "yarn workspace glimmerx-playground test",
"test:watch": "testem"
Expand All @@ -44,10 +44,9 @@
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@babel/preset-typescript": "^7.9.0",
"@glimmer/babel-plugin-glimmer-env": "2.0.0-beta.12",
"@types/qunit": "^2.9.1",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"babel-loader": "^8.0.6",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
Expand All @@ -62,7 +61,7 @@
"testem": "^3.0.3",
"ts-loader": "^6.2.2",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "~3.8.3",
"typescript": "~4.2.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
Expand Down
Loading

0 comments on commit c32ca4b

Please sign in to comment.