File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,17 @@ class TemplateCompiler extends Filter {
5252 let srcDir = this . inputPaths [ 0 ] ;
5353 let srcName = path . join ( srcDir , relativePath ) ;
5454 try {
55+ // we have to reverse these for reasons that are a bit bonkers. the initial
56+ // version of this system used `registeredPlugin` from
57+ // `ember-template-compiler.js` to set up these plugins (because Ember ~ 1.13
58+ // only had `registerPlugin`, and there was no way to pass plugins directly
59+ // to the call to `compile`/`precompile`). calling `registerPlugin`
60+ // unfortunately **inverted** the order of plugins (it essentially did
61+ // `PLUGINS = [plugin, ...PLUGINS]`).
62+ //
63+ // sooooooo...... we are forced to maintain that **absolutely bonkers** ordering
64+ let astPlugins = this . options . plugins ? [ ...this . options . plugins . ast ] . reverse ( ) : [ ] ;
65+
5566 let result =
5667 'export default ' +
5768 utils . template ( this . options . templateCompiler , stripBom ( string ) , {
@@ -67,7 +78,7 @@ class TemplateCompiler extends Filter {
6778 // all of the built in AST transforms into plugins.ast, which breaks
6879 // persistent caching)
6980 plugins : {
70- ast : this . options . plugins ? this . options . plugins . ast : [ ] ,
81+ ast : astPlugins ,
7182 } ,
7283 } ) +
7384 ';' ;
Original file line number Diff line number Diff line change @@ -208,9 +208,20 @@ function setup(pluginInfo, options) {
208208 let templatePrecompile = templateCompiler . precompile ;
209209
210210 let precompile = ( template , _options ) => {
211+ // we have to reverse these for reasons that are a bit bonkers. the initial
212+ // version of this system used `registeredPlugin` from
213+ // `ember-template-compiler.js` to set up these plugins (because Ember ~ 1.13
214+ // only had `registerPlugin`, and there was no way to pass plugins directly
215+ // to the call to `compile`/`precompile`). calling `registerPlugin`
216+ // unfortunately **inverted** the order of plugins (it essentially did
217+ // `PLUGINS = [plugin, ...PLUGINS]`).
218+ //
219+ // sooooooo...... we are forced to maintain that **absolutely bonkers** ordering
220+ let astPlugins = [ ...pluginInfo . plugins ] . reverse ( ) ;
221+
211222 let options = {
212223 plugins : {
213- ast : pluginInfo . plugins ,
224+ ast : astPlugins ,
214225 } ,
215226 } ;
216227
You can’t perform that action at this time.
0 commit comments