Skip to content

Commit 92124de

Browse files
Turbo87tylerturdenpants
authored andcommitted
Add more known common helpers (#145)
* Add `ember-font-awesome` helpers to list of known common helpers * Add `ember-svg-jar` helper to list of known common helpers * Add `ember-concurrency` helper to list of known common helpers * Add `ember-maybe-in-element` helper to list of known common helpers * Extract `IGNORE_MUSTACHE_STATEMENTS` into a dedicated file
1 parent 120943b commit 92124de

2 files changed

Lines changed: 130 additions & 117 deletions

File tree

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
const KNOWN_HELPERS = [
2+
// Ember.js
3+
'action',
4+
'array',
5+
'component',
6+
'concat',
7+
'debugger',
8+
'each',
9+
'each-in',
10+
'else',
11+
'get',
12+
'hash',
13+
'if',
14+
'if-unless',
15+
'in-element',
16+
'-in-element',
17+
'let',
18+
'loc',
19+
'log',
20+
'mut',
21+
'outlet',
22+
'partial',
23+
'query-params',
24+
'readonly',
25+
'unbound',
26+
'unless',
27+
'with',
28+
'yield',
29+
30+
// Glimmer VM
31+
'identity', // glimmer blocks
32+
'render-inverse', // glimmer blocks
33+
'-get-dynamic-var', // glimmer internal helper
34+
35+
// ember-route-helpers
36+
'transition-to',
37+
'replace-with',
38+
'transition-to-external',
39+
'replace-with-external',
40+
41+
// ember-intl
42+
'format-date',
43+
'format-message',
44+
'format-relative',
45+
'format-time',
46+
'format-money',
47+
'format-number',
48+
't',
49+
50+
// ember-moment
51+
'is-after',
52+
'is-before',
53+
'is-between',
54+
'is-same',
55+
'is-same-or-after',
56+
'is-same-or-before',
57+
'moment',
58+
'moment-calendar',
59+
'moment-diff',
60+
'moment-duration',
61+
'moment-format',
62+
'moment-from',
63+
'moment-from-now',
64+
'moment-to',
65+
'moment-to-now',
66+
'now',
67+
'unix',
68+
69+
// ember-cp-validations
70+
'v-get',
71+
72+
// ember-route-action-helper
73+
'route-action',
74+
75+
// ember-composable-helpers
76+
'map-by',
77+
'sort-by',
78+
'filter-by',
79+
'reject-by',
80+
'find-by',
81+
'object-at',
82+
'has-block',
83+
'has-next',
84+
'has-previous',
85+
'group-by',
86+
'not-eq',
87+
'is-array',
88+
'is-empty',
89+
'is-equal',
90+
91+
// liquid-fire
92+
'liquid-unless',
93+
'liquid-container',
94+
'liquid-outlet',
95+
'liquid-versions',
96+
'liquid-bind',
97+
'liquid-spacer',
98+
'liquid-sync',
99+
'liquid-measured',
100+
'liquid-child',
101+
'liquid-if',
102+
103+
// ember-animated
104+
'animated-beacon',
105+
'animated-each',
106+
'animated-if',
107+
'animated-orphans',
108+
'animated-value',
109+
110+
// ember-app-version
111+
'app-version',
112+
113+
// ember-font-awesome
114+
'fa-icon',
115+
'fa-list',
116+
'fa-stack',
117+
118+
// ember-svg-jar
119+
'svg-jar',
120+
121+
// ember-concurrency
122+
'perform',
123+
124+
// ember-maybe-in-element
125+
'maybe-in-element',
126+
];
127+
128+
module.exports = KNOWN_HELPERS;

transforms/angle-brackets/transform.js

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const recast = require('ember-template-recast');
22

3+
const IGNORE_MUSTACHE_STATEMENTS = require('./known-helpers');
4+
35
const _EMPTY_STRING_ = `ANGLE_BRACKET_EMPTY_${Date.now()}`;
46

57
/**
@@ -9,123 +11,6 @@ const HTML_ATTRIBUTES = ['class', 'placeholder', 'required'];
911

1012
const BUILT_IN_COMPONENTS = ['link-to', 'input', 'textarea'];
1113

12-
/**
13-
* Ignore the following list of MustacheStatements from transform
14-
* Politely lifted from https://github.com/lifeart/ember-ast-hot-load/blob/master/lib/ast-transform.js#L26
15-
*/
16-
const IGNORE_MUSTACHE_STATEMENTS = [
17-
// Ember.js
18-
'action',
19-
'array',
20-
'component',
21-
'concat',
22-
'debugger',
23-
'each',
24-
'each-in',
25-
'else',
26-
'get',
27-
'hash',
28-
'if',
29-
'if-unless',
30-
'in-element',
31-
'-in-element',
32-
'let',
33-
'loc',
34-
'log',
35-
'mut',
36-
'outlet',
37-
'partial',
38-
'query-params',
39-
'readonly',
40-
'unbound',
41-
'unless',
42-
'with',
43-
'yield',
44-
45-
// Glimmer VM
46-
'identity', // glimmer blocks
47-
'render-inverse', // glimmer blocks
48-
'-get-dynamic-var', // glimmer internal helper
49-
50-
// ember-route-helpers
51-
'transition-to',
52-
'replace-with',
53-
'transition-to-external',
54-
'replace-with-external',
55-
56-
// ember-intl
57-
'format-date',
58-
'format-message',
59-
'format-relative',
60-
'format-time',
61-
'format-money',
62-
'format-number',
63-
't',
64-
65-
// ember-moment
66-
'is-after',
67-
'is-before',
68-
'is-between',
69-
'is-same',
70-
'is-same-or-after',
71-
'is-same-or-before',
72-
'moment',
73-
'moment-calendar',
74-
'moment-diff',
75-
'moment-duration',
76-
'moment-format',
77-
'moment-from',
78-
'moment-from-now',
79-
'moment-to',
80-
'moment-to-now',
81-
'now',
82-
'unix',
83-
84-
// ember-cp-validations
85-
'v-get',
86-
87-
// ember-route-action-helper
88-
'route-action',
89-
90-
// ember-composable-helpers
91-
'map-by',
92-
'sort-by',
93-
'filter-by',
94-
'reject-by',
95-
'find-by',
96-
'object-at',
97-
'has-block',
98-
'has-next',
99-
'has-previous',
100-
'group-by',
101-
'not-eq',
102-
'is-array',
103-
'is-empty',
104-
'is-equal',
105-
106-
// liquid-fire
107-
'liquid-unless',
108-
'liquid-container',
109-
'liquid-outlet',
110-
'liquid-versions',
111-
'liquid-bind',
112-
'liquid-spacer',
113-
'liquid-sync',
114-
'liquid-measured',
115-
'liquid-child',
116-
'liquid-if',
117-
118-
// ember-animated
119-
'animated-beacon',
120-
'animated-each',
121-
'animated-if',
122-
'animated-orphans',
123-
'animated-value',
124-
125-
// ember-app-version
126-
'app-version',
127-
];
128-
12914
function isAttribute(key) {
13015
return HTML_ATTRIBUTES.includes(key) || key.startsWith('data-');
13116
}

0 commit comments

Comments
 (0)