|
3 | 3 | module.exports = { |
4 | 4 | name: require('./package').name, |
5 | 5 |
|
6 | | - init() { |
7 | | - this._super.init && this._super.init.apply(this, arguments); |
8 | | - |
9 | | - this._templateDeprecations = []; |
10 | | - }, |
11 | | - |
12 | 6 | _shouldInclude() { |
13 | 7 | // the presence of `this.app.tests` shows that we are in one of: |
14 | 8 | // |
@@ -52,91 +46,4 @@ module.exports = { |
52 | 46 |
|
53 | 47 | return mergeTrees([tree, configTree], { overwrite: true }); |
54 | 48 | }, |
55 | | - |
56 | | - _findHtmlbarsPreprocessor(registry) { |
57 | | - var plugins = registry.load('template'); |
58 | | - |
59 | | - return plugins.filter(function (plugin) { |
60 | | - return plugin.name === 'ember-cli-htmlbars'; |
61 | | - })[0]; |
62 | | - }, |
63 | | - |
64 | | - _monkeyPatch_EmberDeprecate(htmlbarsCompilerPreprocessor) { |
65 | | - if (!htmlbarsCompilerPreprocessor._addon) { |
66 | | - // not a new enough ember-cli-htmlbars to monkey patch |
67 | | - // we need 1.0.3 |
68 | | - return; |
69 | | - } |
70 | | - var addonContext = this; |
71 | | - var originalHtmlbarsOptions = |
72 | | - htmlbarsCompilerPreprocessor._addon.htmlbarsOptions; |
73 | | - var logToNodeConsole = this.project.config( |
74 | | - process.env.EMBER_ENV |
75 | | - ).logTemplateLintToConsole; |
76 | | - |
77 | | - htmlbarsCompilerPreprocessor._addon.htmlbarsOptions = function () { |
78 | | - var options = originalHtmlbarsOptions.apply(this, arguments); |
79 | | - var Ember = options.templateCompiler._Ember; |
80 | | - |
81 | | - if (Ember.Debug && Ember.Debug.registerDeprecationHandler) { |
82 | | - Ember.Debug.registerDeprecationHandler(function ( |
83 | | - message, |
84 | | - options, |
85 | | - next |
86 | | - ) { |
87 | | - addonContext._templateDeprecations.push({ |
88 | | - message: JSON.stringify(message), |
89 | | - test: false, |
90 | | - options: JSON.stringify(options), |
91 | | - }); |
92 | | - |
93 | | - if (logToNodeConsole) { |
94 | | - next(); |
95 | | - } |
96 | | - }); |
97 | | - } |
98 | | - |
99 | | - var originalDeprecate = options.templateCompiler._Ember.deprecate; |
100 | | - Ember.deprecate = function (message, test, options) { |
101 | | - var noDeprecation; |
102 | | - |
103 | | - if (typeof test === 'function') { |
104 | | - noDeprecation = test(); |
105 | | - } else { |
106 | | - noDeprecation = test; |
107 | | - } |
108 | | - |
109 | | - if (!noDeprecation) { |
110 | | - addonContext._templateDeprecations.push({ |
111 | | - message: JSON.stringify(message), |
112 | | - test: !!test, |
113 | | - options: JSON.stringify(options), |
114 | | - }); |
115 | | - } |
116 | | - |
117 | | - if (logToNodeConsole) { |
118 | | - return originalDeprecate.apply(this, arguments); |
119 | | - } |
120 | | - }; |
121 | | - |
122 | | - return options; |
123 | | - }; |
124 | | - }, |
125 | | - |
126 | | - setupPreprocessorRegistry(type, registry) { |
127 | | - if (type === 'parent') { |
128 | | - var htmlbarsCompilerPreprocessor = |
129 | | - this._findHtmlbarsPreprocessor(registry); |
130 | | - |
131 | | - this._monkeyPatch_EmberDeprecate(htmlbarsCompilerPreprocessor); |
132 | | - } |
133 | | - }, |
134 | | - |
135 | | - lintTree(type, tree) { |
136 | | - if (type === 'template') { |
137 | | - var TemplateLinter = require('./generate-deprecations-tree'); |
138 | | - |
139 | | - return new TemplateLinter(this, tree); |
140 | | - } |
141 | | - }, |
142 | 49 | }; |
0 commit comments