Skip to content

Commit 66b1a7a

Browse files
committed
big cleanup
Lots of code here isn't needed anymore because we dropped support for the last ember versions that needed moduleApiPolyfill, which means we can always use babel-plugin-ember-template-compilation, which is smart enough to handle its own parallelizability.
1 parent 4721f12 commit 66b1a7a

13 files changed

+141
-1691
lines changed

README.md

Lines changed: 3 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,9 @@
44

55
## Compatibility
66

7-
* Ember.js v3.8 or above
8-
* Ember CLI v3.8 or above
9-
* Node.js v12 or above
10-
11-
## Tagged Template Usage / Migrating from `htmlbars-inline-precompile`
12-
13-
Starting with version 4.0, this addon now includes the testing helper from [ember-cli-htmlbars-inline-precompile](https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile)
14-
15-
This will require an update to the imports of the `hbs` helper in your tests:
16-
17-
Prior syntax:
18-
19-
```
20-
import hbs from 'htmlbars-inline-precompile';
21-
22-
...
23-
24-
await render(hbs`
25-
<MyComponent />
26-
`);
27-
```
28-
29-
New syntax:
30-
31-
```
32-
import { hbs } from 'ember-cli-htmlbars';
33-
34-
...
35-
36-
await render(hbs`
37-
<MyComponent />
38-
`);
39-
```
40-
41-
There is a [codemod](https://github.com/ember-codemods/ember-cli-htmlbars-inline-precompile-codemod) available to automate this change.
42-
43-
## Additional Trees
44-
45-
For addons which want additional customizations, they are able to interact with
46-
this addon directly.
47-
48-
```ts
49-
interface EmberCLIHTMLBars {
50-
/**
51-
Supports easier transpilation of non-standard input paths (e.g. to transpile
52-
a non-addon NPM dependency) while still leveraging the logic within
53-
ember-cli-htmlbars for transpiling (e.g. custom AST transforms, colocation, etc).
54-
*/
55-
transpileTree(inputTree: BroccoliTree): BroccoliTree;
56-
}
57-
```
58-
59-
### `transpileTree` usage
60-
61-
```js
62-
// find the ember-cli-htmlbars addon
63-
let htmlbarsAddon = this.addons.find(addon => addon.name === 'ember-cli-htmlbars');
64-
65-
// invoke .transpileTree passing in the custom input tree
66-
let transpiledCustomTree = htmlbarsAddon.transpileTree(someCustomTree);
67-
```
7+
* Ember.js v4.12 or above
8+
* Ember CLI v4.12 or above
9+
* Node.js v18 or above
6810

6911
## Adding Custom Plugins
7012

@@ -141,28 +83,6 @@ export interface ASTPluginWithDeps extends ASTPlugin {
14183
}
14284
```
14385

144-
## Precompile HTMLBars template strings within other addons
145-
146-
```javascript
147-
module.exports = {
148-
name: 'my-addon-name',
149-
150-
setupPreprocessorRegistry: function(type, registry) {
151-
var htmlbarsPlugin = registry.load('template').find(function(plugin) {
152-
return plugin.name === 'ember-cli-htmlbars';
153-
});
154-
155-
// precompile any htmlbars template string via the precompile method on the
156-
// ember-cli-htmlbars plugin wrapper; `precompiled` will be a string of the
157-
// form:
158-
//
159-
// Ember.HTMLBars.template(function() {...})
160-
//
161-
var precompiled = htmlbarsPlugin.precompile("{{my-component}}");
162-
}
163-
};
164-
```
165-
16686
### Custom Template Compiler
16787

16888
You can still provide a custom path to the template compiler (e.g. to test

lib/addDependencyTracker.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

lib/colocated-babel-plugin.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,9 @@ module.exports = function (babel) {
44
let t = babel.types;
55

66
function makeSetComponentTemplateExpression(state) {
7-
if (!state.opts.requiresModuleApiPolyfill) {
8-
return state._colocationEnsureImport(
9-
'setComponentTemplate',
10-
'@ember/component',
11-
);
12-
}
13-
14-
return t.memberExpression(
15-
t.identifier('Ember'),
16-
t.identifier('_setComponentTemplate'),
7+
return state._colocationEnsureImport(
8+
'setComponentTemplate',
9+
'@ember/component',
1710
);
1811
}
1912

0 commit comments

Comments
 (0)