/
deprecate-send-action.ts
46 lines (39 loc) · 1.49 KB
/
deprecate-send-action.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { deprecate } from '@ember/debug';
import { AST, ASTPlugin, ASTPluginEnvironment } from '@glimmer/syntax';
import calculateLocationDisplay from '../system/calculate-location-display';
export default function deprecateRender(env: ASTPluginEnvironment): ASTPlugin | undefined {
// let { moduleName } = env.meta;
// let deprecationMessage = (node: AST.MustacheStatement) => {
// let sourceInformation = calculateLocationDisplay(moduleName, node.loc);
// let componentName = (node.params[0] as AST.PathExpression).original;
// let original = `{{render "${componentName}"}}`;
// let preferred = `{{${componentName}}}`;
// return (
// `Please refactor \`${original}\` to a component and invoke via` +
// ` \`${preferred}\`. ${sourceInformation}`
// );
// };
// return {
// name: 'deprecate-render',
// visitor: {
// MustacheStatement(node: AST.MustacheStatement) {
// if (node.path.original !== 'render') {
// return;
// }
// if (node.params.length !== 1) {
// return;
// }
// node.params.forEach(param => {
// if (param.type !== 'StringLiteral') {
// return;
// }
// deprecate(deprecationMessage(node), false, {
// id: 'ember-template-compiler.deprecate-render',
// until: '3.0.0',
// url: 'https://emberjs.com/deprecations/v2.x#toc_code-render-code-helper',
// });
// });
// },
// },
// };
}