babel-plugin-wallace 0.15.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-helpers.d.ts +35 -4
- package/dist/ast-helpers.js +83 -14
- package/dist/ast-helpers.js.map +1 -1
- package/dist/consolidation/ComponentDefinitionData.d.ts +1 -1
- package/dist/consolidation/processNodes.js +46 -48
- package/dist/consolidation/processNodes.js.map +1 -1
- package/dist/constants.d.ts +4 -2
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/contexts/parameters.js +1 -0
- package/dist/contexts/parameters.js.map +1 -1
- package/dist/directives.d.ts +3 -3
- package/dist/directives.js +87 -110
- package/dist/directives.js.map +1 -1
- package/dist/errors.d.ts +11 -11
- package/dist/errors.js +38 -27
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/models/component.d.ts +10 -3
- package/dist/models/component.js +6 -23
- package/dist/models/component.js.map +1 -1
- package/dist/models/directive.d.ts +20 -11
- package/dist/models/directive.js +94 -34
- package/dist/models/directive.js.map +1 -1
- package/dist/models/index.d.ts +4 -5
- package/dist/models/index.js +7 -5
- package/dist/models/index.js.map +1 -1
- package/dist/models/node.d.ts +14 -18
- package/dist/models/node.js +30 -58
- package/dist/models/node.js.map +1 -1
- package/dist/visitors/attribute.js +2 -45
- package/dist/visitors/attribute.js.map +1 -1
- package/dist/visitors/jsx.js +9 -27
- package/dist/visitors/jsx.js.map +1 -1
- package/dist/writers/defineComponent.js +47 -1
- package/dist/writers/defineComponent.js.map +1 -1
- package/package.json +2 -2
package/dist/directives.js
CHANGED
|
@@ -20,16 +20,26 @@ class ApplyDirective extends models_1.Directive {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
ApplyDirective.attributeName = "apply";
|
|
23
|
-
ApplyDirective.
|
|
24
|
-
ApplyDirective.
|
|
23
|
+
ApplyDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
24
|
+
ApplyDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
25
25
|
ApplyDirective.mayAccessElement = true;
|
|
26
|
+
class AssignDirective extends models_1.Directive {
|
|
27
|
+
apply(node, value, qualifier, _base) {
|
|
28
|
+
node.component.assignTo = value.expression || value.value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
AssignDirective.attributeName = "assign";
|
|
32
|
+
AssignDirective.valueMode = models_1.ValueMode.EitherRequired;
|
|
33
|
+
AssignDirective.qualifierMode = models_1.QualifierMode.SetsValue;
|
|
34
|
+
AssignDirective.mustBeOnRoot = true;
|
|
26
35
|
class BindDirective extends models_1.Directive {
|
|
27
36
|
apply(node, value, qualifier, _base) {
|
|
28
37
|
node.setBindInstruction(value.expression, qualifier);
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
BindDirective.attributeName = "bind";
|
|
32
|
-
BindDirective.
|
|
41
|
+
BindDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
42
|
+
BindDirective.qualifierMode = models_1.QualifierMode.Optional;
|
|
33
43
|
class ClassDirective extends models_1.Directive {
|
|
34
44
|
apply(node, value, qualifier, base) {
|
|
35
45
|
if (qualifier) {
|
|
@@ -47,20 +57,16 @@ class ClassDirective extends models_1.Directive {
|
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
ClassDirective.attributeName = "class";
|
|
50
|
-
ClassDirective.
|
|
51
|
-
ClassDirective.
|
|
52
|
-
ClassDirective.help = `
|
|
53
|
-
Without a qualifer this acts as a normal attribute, but with a qualifier it creates
|
|
54
|
-
a toggle target for use with the "toggle" directive:
|
|
55
|
-
|
|
56
|
-
/h <div class:danger="btn-danger" toggle:danger={expr}></div>
|
|
57
|
-
`;
|
|
60
|
+
ClassDirective.valueMode = models_1.ValueMode.EitherRequired;
|
|
61
|
+
ClassDirective.qualifierMode = models_1.QualifierMode.Optional;
|
|
58
62
|
class CssDirective extends models_1.Directive {
|
|
59
63
|
apply(node, value, _qualifier, _base) {
|
|
60
64
|
node.addStaticAttribute("class", value.expression);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
CssDirective.attributeName = "css";
|
|
68
|
+
CssDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
69
|
+
CssDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
64
70
|
CssDirective.mayAccessComponent = false;
|
|
65
71
|
class CtrlDirective extends models_1.Directive {
|
|
66
72
|
apply(node, value, _qualifier, _base) {
|
|
@@ -69,25 +75,11 @@ class CtrlDirective extends models_1.Directive {
|
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
CtrlDirective.attributeName = "ctrl";
|
|
78
|
+
CtrlDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
79
|
+
CtrlDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
72
80
|
CtrlDirective.allowOnNested = true;
|
|
73
81
|
CtrlDirective.allowOnRepeated = true;
|
|
74
82
|
CtrlDirective.allowOnNormalElement = false;
|
|
75
|
-
/**
|
|
76
|
-
* This is a hack to enable a Proxy of a Date to be passed to `valueAsDate`.
|
|
77
|
-
* It is not a documented directive.
|
|
78
|
-
*/
|
|
79
|
-
class ValueAsDateDirective extends models_1.Directive {
|
|
80
|
-
apply(node, value, _qualifier, _base) {
|
|
81
|
-
if (value.type === "expression") {
|
|
82
|
-
node.requiredImport(constants_1.IMPORTABLES.toDateString);
|
|
83
|
-
node.watchAttribute("value", t.callExpression(t.identifier(constants_1.IMPORTABLES.toDateString), [value.expression]));
|
|
84
|
-
}
|
|
85
|
-
else if (value.type === "string") {
|
|
86
|
-
node.addFixedAttribute("valueAsDate", value.value);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
ValueAsDateDirective.attributeName = "valueAsDate";
|
|
91
83
|
class EventDirective extends models_1.Directive {
|
|
92
84
|
apply(node, value, qualifier, _base) {
|
|
93
85
|
const eventName = qualifier || value.value;
|
|
@@ -98,67 +90,53 @@ class EventDirective extends models_1.Directive {
|
|
|
98
90
|
}
|
|
99
91
|
}
|
|
100
92
|
EventDirective.attributeName = "event";
|
|
101
|
-
EventDirective.
|
|
102
|
-
EventDirective.
|
|
103
|
-
EventDirective.requireQualifier = true;
|
|
93
|
+
EventDirective.valueMode = models_1.ValueMode.StringRequired;
|
|
94
|
+
EventDirective.qualifierMode = models_1.QualifierMode.SetsValue;
|
|
104
95
|
class FixedDirective extends models_1.Directive {
|
|
105
96
|
apply(node, value, qualifier, _base) {
|
|
106
97
|
node.addStaticAttribute(qualifier, value.expression);
|
|
107
98
|
}
|
|
108
99
|
}
|
|
109
100
|
FixedDirective.attributeName = "fixed";
|
|
110
|
-
FixedDirective.
|
|
101
|
+
FixedDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
102
|
+
FixedDirective.qualifierMode = models_1.QualifierMode.Required;
|
|
111
103
|
FixedDirective.mayAccessComponent = false;
|
|
112
104
|
class HideDirective extends models_1.Directive {
|
|
113
105
|
apply(node, value, _qualifier, _base) {
|
|
114
|
-
node.setVisibilityToggle(value.expression,
|
|
106
|
+
node.setVisibilityToggle(value.expression, true, false);
|
|
115
107
|
}
|
|
116
108
|
}
|
|
117
109
|
HideDirective.attributeName = "hide";
|
|
118
|
-
HideDirective.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/h <div hide={}></div>
|
|
122
|
-
`;
|
|
110
|
+
HideDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
111
|
+
HideDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
123
112
|
class HtmlDirective extends models_1.Directive {
|
|
124
113
|
apply(node, value, _qualifier, _base) {
|
|
125
114
|
node.watchAttribute("innerHTML", value.expression);
|
|
126
115
|
}
|
|
127
116
|
}
|
|
128
117
|
HtmlDirective.attributeName = "html";
|
|
129
|
-
HtmlDirective.
|
|
130
|
-
|
|
131
|
-
/h <div html={'<div>hello</div>'}></div>
|
|
132
|
-
`;
|
|
118
|
+
HtmlDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
119
|
+
HtmlDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
133
120
|
class IfDirective extends models_1.Directive {
|
|
134
121
|
apply(node, value, _qualifier, _base) {
|
|
135
|
-
node.setVisibilityToggle(value.expression,
|
|
122
|
+
node.setVisibilityToggle(value.expression, false, true);
|
|
136
123
|
}
|
|
137
124
|
}
|
|
138
125
|
IfDirective.attributeName = "if";
|
|
126
|
+
IfDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
127
|
+
IfDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
139
128
|
IfDirective.allowOnNested = true;
|
|
140
|
-
IfDirective.help = `
|
|
141
|
-
Conditionally includes/exludes an element from the DOM.
|
|
142
|
-
|
|
143
|
-
/h <div if={}></div>
|
|
144
|
-
`;
|
|
145
|
-
class ItemsDirective extends models_1.Directive {
|
|
146
|
-
apply(node, value, _qualifier, _base) {
|
|
147
|
-
node.setRepeatExpression(value.expression);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
ItemsDirective.attributeName = "items";
|
|
151
|
-
ItemsDirective.allowOnRepeated = true;
|
|
152
|
-
ItemsDirective.allowOnNormalElement = false;
|
|
153
129
|
class KeyDirective extends models_1.Directive {
|
|
154
130
|
apply(node, value, _qualifier, _base) {
|
|
155
131
|
node.setRepeatKey(value.expression || value.value);
|
|
156
132
|
}
|
|
157
133
|
}
|
|
158
134
|
KeyDirective.attributeName = "key";
|
|
159
|
-
KeyDirective.
|
|
135
|
+
KeyDirective.valueMode = models_1.ValueMode.EitherRequired;
|
|
136
|
+
KeyDirective.qualifierMode = models_1.QualifierMode.SetsValue;
|
|
160
137
|
KeyDirective.allowOnRepeated = true;
|
|
161
138
|
KeyDirective.allowOnNormalElement = false;
|
|
139
|
+
// TODO: change to be on:click
|
|
162
140
|
class OnEventDirective extends models_1.Directive {
|
|
163
141
|
apply(node, value, _qualifier, base) {
|
|
164
142
|
if (value.type === "string") {
|
|
@@ -170,64 +148,49 @@ class OnEventDirective extends models_1.Directive {
|
|
|
170
148
|
}
|
|
171
149
|
}
|
|
172
150
|
OnEventDirective.attributeName = "on*";
|
|
173
|
-
OnEventDirective.
|
|
151
|
+
OnEventDirective.valueMode = models_1.ValueMode.EitherRequired;
|
|
152
|
+
OnEventDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
174
153
|
OnEventDirective.mayAccessElement = true;
|
|
175
154
|
OnEventDirective.mayAccessEvent = true;
|
|
176
|
-
OnEventDirective.help = `
|
|
177
|
-
Creates an event handler:
|
|
178
|
-
|
|
179
|
-
/h <div onclick={alert('hello')}></div>
|
|
180
|
-
`;
|
|
181
155
|
class PartDirective extends models_1.Directive {
|
|
182
|
-
apply(node,
|
|
156
|
+
apply(node, value, qualifier, _base) {
|
|
183
157
|
config_1.wallaceConfig.ensureFlagIstrue(node.path, config_1.FlagValue.allowParts);
|
|
184
|
-
node.setPart(qualifier);
|
|
158
|
+
node.setPart(qualifier || value.value);
|
|
185
159
|
}
|
|
186
160
|
}
|
|
187
161
|
PartDirective.attributeName = "part";
|
|
162
|
+
PartDirective.valueMode = models_1.ValueMode.StringRequired;
|
|
163
|
+
PartDirective.qualifierMode = models_1.QualifierMode.SetsValue;
|
|
188
164
|
PartDirective.allowOnNested = true;
|
|
189
|
-
PartDirective.
|
|
190
|
-
PartDirective.allowExpression = false;
|
|
191
|
-
PartDirective.requireQualifier = true;
|
|
192
|
-
PartDirective.help = `
|
|
193
|
-
Saves a reference to a part of a component which can be updated.
|
|
194
|
-
|
|
195
|
-
/h <div part:title></div>
|
|
196
|
-
`;
|
|
165
|
+
PartDirective.allowOnRepeated = true;
|
|
197
166
|
class PropsDirective extends models_1.Directive {
|
|
198
167
|
apply(node, value, _qualifier, _base) {
|
|
199
168
|
node.setProps(value.expression);
|
|
200
169
|
}
|
|
201
170
|
}
|
|
202
171
|
PropsDirective.attributeName = "props";
|
|
172
|
+
PropsDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
173
|
+
PropsDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
203
174
|
PropsDirective.allowOnNested = true;
|
|
175
|
+
PropsDirective.allowOnRepeated = true;
|
|
204
176
|
PropsDirective.allowOnNormalElement = false;
|
|
205
177
|
class RefDirective extends models_1.Directive {
|
|
206
|
-
apply(node,
|
|
207
|
-
node.setRef(qualifier);
|
|
178
|
+
apply(node, value, qualifier, _base) {
|
|
179
|
+
node.setRef(qualifier || value.value);
|
|
208
180
|
}
|
|
209
181
|
}
|
|
210
182
|
RefDirective.attributeName = "ref";
|
|
183
|
+
RefDirective.valueMode = models_1.ValueMode.StringRequired;
|
|
184
|
+
RefDirective.qualifierMode = models_1.QualifierMode.SetsValue;
|
|
211
185
|
RefDirective.allowOnNested = true;
|
|
212
|
-
RefDirective.allowNull = true;
|
|
213
|
-
RefDirective.allowExpression = false;
|
|
214
|
-
RefDirective.requireQualifier = true;
|
|
215
|
-
RefDirective.help = `
|
|
216
|
-
Saves a reference to an element or nested component:
|
|
217
|
-
|
|
218
|
-
/h <div ref:title></div>
|
|
219
|
-
`;
|
|
220
186
|
class ShowDirective extends models_1.Directive {
|
|
221
187
|
apply(node, value, _qualifier, _base) {
|
|
222
|
-
node.setVisibilityToggle(value.expression,
|
|
188
|
+
node.setVisibilityToggle(value.expression, false, false);
|
|
223
189
|
}
|
|
224
190
|
}
|
|
225
191
|
ShowDirective.attributeName = "show";
|
|
226
|
-
ShowDirective.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
/h <div show={}></div>
|
|
230
|
-
`;
|
|
192
|
+
ShowDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
193
|
+
ShowDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
231
194
|
class StyleDirective extends models_1.Directive {
|
|
232
195
|
apply(node, value, qualifier, base) {
|
|
233
196
|
if (qualifier) {
|
|
@@ -249,12 +212,8 @@ class StyleDirective extends models_1.Directive {
|
|
|
249
212
|
}
|
|
250
213
|
}
|
|
251
214
|
StyleDirective.attributeName = "style";
|
|
252
|
-
StyleDirective.
|
|
253
|
-
StyleDirective.
|
|
254
|
-
StyleDirective.help = `
|
|
255
|
-
|
|
256
|
-
/h <div style:color="red"></div>
|
|
257
|
-
`;
|
|
215
|
+
StyleDirective.valueMode = models_1.ValueMode.EitherRequired;
|
|
216
|
+
StyleDirective.qualifierMode = models_1.QualifierMode.Optional;
|
|
258
217
|
class ToggleDirective extends models_1.Directive {
|
|
259
218
|
apply(node, value, qualifier, _base) {
|
|
260
219
|
if (!qualifier) {
|
|
@@ -264,38 +223,54 @@ class ToggleDirective extends models_1.Directive {
|
|
|
264
223
|
}
|
|
265
224
|
}
|
|
266
225
|
ToggleDirective.attributeName = "toggle";
|
|
267
|
-
ToggleDirective.
|
|
268
|
-
ToggleDirective.
|
|
269
|
-
If used on its own, the qualifer is the name of the css class to toggle:
|
|
270
|
-
|
|
271
|
-
/h <div toggle:danger={expr}></div>
|
|
272
|
-
|
|
273
|
-
If the element has class sets, then the qualifer corresponds to the name of the
|
|
274
|
-
class set:
|
|
275
|
-
|
|
276
|
-
/h <div class:danger="red danger" toggle:danger={expr}></div>
|
|
277
|
-
`;
|
|
226
|
+
ToggleDirective.valueMode = models_1.ValueMode.ExpressionRequired;
|
|
227
|
+
ToggleDirective.qualifierMode = models_1.QualifierMode.Required;
|
|
278
228
|
class UniqueDirective extends models_1.Directive {
|
|
279
229
|
apply(node, _value, _qualifier, _base) {
|
|
280
230
|
node.component.unique = true;
|
|
281
231
|
}
|
|
282
232
|
}
|
|
283
233
|
UniqueDirective.attributeName = "unique";
|
|
284
|
-
UniqueDirective.
|
|
285
|
-
UniqueDirective.
|
|
234
|
+
UniqueDirective.valueMode = models_1.ValueMode.NotAllowed;
|
|
235
|
+
UniqueDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
236
|
+
UniqueDirective.mustBeOnRoot = true;
|
|
237
|
+
/**
|
|
238
|
+
* This is a hack to enable a Proxy of a Date to be passed to `valueAsDate`.
|
|
239
|
+
* It is not a documented directive.
|
|
240
|
+
*/
|
|
241
|
+
class ValueAsDateDirective extends models_1.Directive {
|
|
242
|
+
apply(node, value, _qualifier, _base) {
|
|
243
|
+
if (value.type === "expression") {
|
|
244
|
+
node.requiredImport(constants_1.IMPORTABLES.toDateString);
|
|
245
|
+
node.watchAttribute("value", t.callExpression(t.identifier(constants_1.IMPORTABLES.toDateString), [value.expression]));
|
|
246
|
+
}
|
|
247
|
+
else if (value.type === "string") {
|
|
248
|
+
node.addFixedAttribute("valueAsDate", value.value);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
ValueAsDateDirective.attributeName = "valueAsDate";
|
|
253
|
+
class WatchDirective extends models_1.Directive {
|
|
254
|
+
apply(node, value, _qualifier, _base) {
|
|
255
|
+
node.component.watchProps = { callback: value.expression };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
WatchDirective.attributeName = "watch";
|
|
259
|
+
WatchDirective.valueMode = models_1.ValueMode.ExpressionOptional;
|
|
260
|
+
WatchDirective.qualifierMode = models_1.QualifierMode.NotAllowed;
|
|
261
|
+
WatchDirective.mustBeOnRoot = true;
|
|
286
262
|
exports.builtinDirectives = [
|
|
287
263
|
ApplyDirective,
|
|
264
|
+
AssignDirective,
|
|
288
265
|
BindDirective,
|
|
289
266
|
ClassDirective,
|
|
290
267
|
CssDirective,
|
|
291
268
|
CtrlDirective,
|
|
292
|
-
ValueAsDateDirective,
|
|
293
269
|
EventDirective,
|
|
294
270
|
FixedDirective,
|
|
295
271
|
HideDirective,
|
|
296
272
|
HtmlDirective,
|
|
297
273
|
IfDirective,
|
|
298
|
-
ItemsDirective,
|
|
299
274
|
KeyDirective,
|
|
300
275
|
OnEventDirective,
|
|
301
276
|
PartDirective,
|
|
@@ -304,6 +279,8 @@ exports.builtinDirectives = [
|
|
|
304
279
|
ShowDirective,
|
|
305
280
|
StyleDirective,
|
|
306
281
|
ToggleDirective,
|
|
307
|
-
UniqueDirective
|
|
282
|
+
UniqueDirective,
|
|
283
|
+
ValueAsDateDirective,
|
|
284
|
+
WatchDirective
|
|
308
285
|
];
|
|
309
286
|
//# sourceMappingURL=directives.js.map
|
package/dist/directives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,kCAAkC;AAClC,qCAAoD;AACpD,qCAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,kCAAkC;AAClC,qCAAoD;AACpD,qCAAiD;AACjD,qCAOkB;AAClB,2CAKqB;AAErB,MAAM,cAAe,SAAQ,kBAAS;IAKpC,KAAK,CAAC,IAAa,EAAE,KAAgB,EAAE,UAAqB,EAAE,KAAa;QACzE,IAAI,CAAC,QAAQ,CAAC,2BAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC;;AANM,4BAAa,GAAG,OAAO,CAAC;AACxB,wBAAS,GAAc,kBAAS,CAAC,kBAAkB,CAAC;AACpD,4BAAa,GAAkB,sBAAa,CAAC,UAAU,CAAC;AACxD,+BAAgB,GAAG,IAAI,CAAC;AAMjC,MAAM,eAAgB,SAAQ,kBAAS;IAKrC,KAAK,CAAC,IAAa,EAAE,KAAgB,EAAE,SAAoB,EAAE,KAAa;QACxE,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC;IAC5D,CAAC;;AANM,6BAAa,GAAG,QAAQ,CAAC;AACzB,yBAAS,GAAc,kBAAS,CAAC,cAAc,CAAC;AAChD,6BAAa,GAAkB,sBAAa,CAAC,SAAS,CAAC;AACvD,4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AAE,KAAK,CAAC,UAAU,EAAE,CAAC;IAC7D,CAAC;;AANM,4BAAa,GAAG,OAAO,CAAC;AACxB,wBAAS,GAAc,kBAAS,CAAC,kBAAkB,CAAC;AACpD,4BAAa,GAAkB,sBAAa,CAAC,UAAU,CAAC;AACxD,2BAAY,GAAG,IAAI,CAAC;AAMhB,QAAA,iBAAiB,GAAG;IAC/B,cAAc;IACd,eAAe;IACf,aAAa;IACb,cAAc;IACd,YAAY;IACZ,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;IACb,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,YAAY;IACZ,aAAa;IACb,cAAc;IACd,eAAe;IACf,eAAe;IACf,oBAAoB;IACpB,cAAc;CACf,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import type { NodePath } from "@babel/core";
|
|
2
2
|
export declare const ERROR_MESSAGES: {
|
|
3
3
|
BASE_COMPONENT_ALREADY_DEFINED: string;
|
|
4
|
-
BIND_ONLY_ALLOWED_ON_INPUT: string;
|
|
5
4
|
FOUND_JSX_IN_INVALID_LOCATION: string;
|
|
6
5
|
CLASS_METHOD_MUST_BE_PROPERTY_JSX: string;
|
|
7
6
|
CAPITALISED_COMPONENT_NAME: string;
|
|
8
7
|
CANNOT_USE_IF_ON_ROOT_ELEMENT: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
CANNOT_USE_DIRECTIVE_WITHOUT_QUALIFIER: (directive: string) => string;
|
|
12
|
-
CANNOT_USE_DIRECTIVE_WITH_QUALIFIER: (directive: string) => string;
|
|
8
|
+
DIRECTIVE_NOT_ALLOWED_ON_NESTED_ELEMENT: (directive: string) => string;
|
|
9
|
+
DIRECTIVE_NOT_ALLOWED_ON_REPEATED_ELEMENT: (directive: string) => string;
|
|
13
10
|
DIRECTIVE_ALREADY_DEFINED: (directive: string) => string;
|
|
11
|
+
DIRECTIVE_REQUIRES_QUALIFIER: (directive: string) => string;
|
|
12
|
+
DIRECTIVE_DISALLOWS_QUALIFIER: (directive: string) => string;
|
|
14
13
|
DIRECTIVE_MAY_NOT_ACCESS_SCOPE_VAR: (directive: string, name: string) => string;
|
|
14
|
+
DIRECTIVE_REQUIRES_QUALIFIER_OR_VALUE: (directive: string) => string;
|
|
15
|
+
DIRECTIVE_EITHER_VALUE_REQUIRED: (directive: string) => string;
|
|
16
|
+
DIRECTIVE_VALUE_REQUIRED: (type: string, directive: string) => string;
|
|
17
|
+
DIRECTIVE_NO_VALUE_ALLOWED: (directive: string) => string;
|
|
18
|
+
DIRECTIVE_MUST_BE_ON_ROOT_ELEMENT: (directive: string) => string;
|
|
15
19
|
EVENT_USED_WITHOUT_BIND: string;
|
|
16
20
|
FLAG_REQUIRED: (flag: string) => string;
|
|
21
|
+
INVALID_TAG_FORMAT: string;
|
|
17
22
|
INVALID_EVENT_NAME: (event: string) => string;
|
|
18
23
|
NESTED_COMPONENT_MUST_BE_CAPTIALIZED: string;
|
|
19
|
-
INCORRECTLY_NESTED_COMPONENT: string;
|
|
20
|
-
ARROW_FUNCTION_NOT_ASSIGNED: string;
|
|
21
|
-
DIRECTIVE_INVALID_TYPE: (directive: string, allowed: string[], actual: string) => string;
|
|
22
24
|
PLACEHOLDER_MAY_NOT_BE_LITERAL_OBJECT: string;
|
|
23
25
|
JSX_ELEMENTS_NOT_ALLOWED_IN_EXPRESSIONS: string;
|
|
24
26
|
UNSUPPORTED_ATTRIBUTE_VALUE: string;
|
|
@@ -28,12 +30,10 @@ export declare const ERROR_MESSAGES: {
|
|
|
28
30
|
NESTED_COMPONENT_WITH_CHILDREN: string;
|
|
29
31
|
NESTED_COMPONENT_WITH_ATTRIBUTES: string;
|
|
30
32
|
REFS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT: string;
|
|
31
|
-
SPECIFY_EITHER_VALUE_OR_QUALIFIER: (name: string) => string;
|
|
32
33
|
PARTS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT: string;
|
|
33
|
-
|
|
34
|
+
REPEAT_WITHOUT_PROPS: string;
|
|
34
35
|
REPEAT_ONLY_ON_NESTED_CLASS: string;
|
|
35
36
|
REPEAT_DIRECTIVE_WITH_SIBLINGS: string;
|
|
36
|
-
REPEAT_DIRECTIVE_WITH_CHILDREN: string;
|
|
37
37
|
TOGGLE_TARGETS_WITHOUT_TOGGLE_TRIGGERS: string;
|
|
38
38
|
UNSUPPORTED_NAMESPACE: string;
|
|
39
39
|
XARGS_MUST_BE_OBJECT: string;
|
package/dist/errors.js
CHANGED
|
@@ -7,44 +7,57 @@ const constants_1 = require("./constants");
|
|
|
7
7
|
const ALLOWED_XARGS = Object.values(constants_1.XARGS).map(n => `"${n}"`);
|
|
8
8
|
exports.ERROR_MESSAGES = {
|
|
9
9
|
BASE_COMPONENT_ALREADY_DEFINED: "Base component already defined.",
|
|
10
|
-
BIND_ONLY_ALLOWED_ON_INPUT: "The `bind` directive may only be used on `input` tags.",
|
|
11
10
|
FOUND_JSX_IN_INVALID_LOCATION: "Found JSX in invalid location.",
|
|
12
11
|
CLASS_METHOD_MUST_BE_PROPERTY_JSX: "Function returning JSX in a class must be assigned to property 'jsx'",
|
|
13
12
|
CAPITALISED_COMPONENT_NAME: "Component name must be capitalized.",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
// TODO: remove
|
|
14
|
+
CANNOT_USE_IF_ON_ROOT_ELEMENT: "Cannot use `if` directive on root element.",
|
|
15
|
+
DIRECTIVE_NOT_ALLOWED_ON_NESTED_ELEMENT: (directive) => {
|
|
16
|
+
return `The \`${directive}\` directive may not be used on nested elements.`;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return `The
|
|
18
|
+
DIRECTIVE_NOT_ALLOWED_ON_REPEATED_ELEMENT: (directive) => {
|
|
19
|
+
return `The \`${directive}\` directive may not be used on repeated elements.`;
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
return `The
|
|
21
|
+
DIRECTIVE_ALREADY_DEFINED: (directive) => {
|
|
22
|
+
return `The \`${directive}\` directive has already been defined on this node.`;
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
return `The
|
|
24
|
+
DIRECTIVE_REQUIRES_QUALIFIER: (directive) => {
|
|
25
|
+
return `The \`${directive}\` directive must have a qualifier.`;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return `The
|
|
27
|
+
DIRECTIVE_DISALLOWS_QUALIFIER: (directive) => {
|
|
28
|
+
return `The \`${directive}\` directive may not have a qualifier.`;
|
|
29
29
|
},
|
|
30
30
|
DIRECTIVE_MAY_NOT_ACCESS_SCOPE_VAR: (directive, name) => {
|
|
31
|
-
return `The
|
|
31
|
+
return `The \`${directive}\` directive may not access scoped variable \`${name}\`.`;
|
|
32
|
+
},
|
|
33
|
+
DIRECTIVE_REQUIRES_QUALIFIER_OR_VALUE: (directive) => {
|
|
34
|
+
return `The \`${directive}\` directive requires a qualifier or value, not both.`;
|
|
35
|
+
},
|
|
36
|
+
DIRECTIVE_EITHER_VALUE_REQUIRED: (directive) => {
|
|
37
|
+
return `The \`${directive}\` directive requires a value.`;
|
|
38
|
+
},
|
|
39
|
+
DIRECTIVE_VALUE_REQUIRED: (type, directive) => {
|
|
40
|
+
return `The \`${directive}\` directive requires a value of type \`${type}\`.`;
|
|
41
|
+
},
|
|
42
|
+
DIRECTIVE_NO_VALUE_ALLOWED: (directive) => {
|
|
43
|
+
return `The \`${directive}\` directive does not allow a value.`;
|
|
44
|
+
},
|
|
45
|
+
DIRECTIVE_MUST_BE_ON_ROOT_ELEMENT: (directive) => {
|
|
46
|
+
return `The \`${directive}\` directive may only be used on the root element.`;
|
|
32
47
|
},
|
|
33
48
|
EVENT_USED_WITHOUT_BIND: "The `event` directive must be used with the `bind` directive.",
|
|
34
49
|
FLAG_REQUIRED: (flag) => {
|
|
35
|
-
return `Flag
|
|
36
|
-
},
|
|
37
|
-
INVALID_EVENT_NAME: (event) => {
|
|
38
|
-
return `"${event}" is not a valid event. Must be lowercase without "on" prefix. E.g. event:keyup.`;
|
|
50
|
+
return `Flag \`${flag}\` must be set to true in the config for this feature.`;
|
|
39
51
|
},
|
|
52
|
+
INVALID_TAG_FORMAT: `Invalid tag format, must be one of:
|
|
53
|
+
<div ...> // A normal element
|
|
54
|
+
<Foo ...> // A nested component
|
|
55
|
+
<Foo.repeat ...> // A repeated component
|
|
56
|
+
<stub.foo ...> // A nested stub
|
|
57
|
+
<stub.foo.repeat ...> // A repeated stub
|
|
58
|
+
`,
|
|
59
|
+
INVALID_EVENT_NAME: (event) => `\`${event}\` is not a valid event. Must be lowercase without \`on\` prefix. E.g. \`event:keyup\`.`,
|
|
40
60
|
NESTED_COMPONENT_MUST_BE_CAPTIALIZED: "Nested component must be capitalized.",
|
|
41
|
-
INCORRECTLY_NESTED_COMPONENT: "Nest components using <Name.nest /> or <Name.repeat />.",
|
|
42
|
-
ARROW_FUNCTION_NOT_ASSIGNED: "Component function must be assigned to a variable.",
|
|
43
|
-
DIRECTIVE_INVALID_TYPE: (directive, allowed, actual) => {
|
|
44
|
-
return allowed.length
|
|
45
|
-
? `The "${directive}" directive value must be of type ${allowed.join(" or ")}. Found: ${actual}.`
|
|
46
|
-
: `The "${directive}" directive value must be of type ${allowed[0]}. Found: ${actual}.`;
|
|
47
|
-
},
|
|
48
61
|
PLACEHOLDER_MAY_NOT_BE_LITERAL_OBJECT: "Literal objects in placeholders not allowed as they will become constants.",
|
|
49
62
|
JSX_ELEMENTS_NOT_ALLOWED_IN_EXPRESSIONS: "JSX elements are not allowed in expressions.",
|
|
50
63
|
UNSUPPORTED_ATTRIBUTE_VALUE: "Attribute value must be a string or expression.",
|
|
@@ -54,12 +67,10 @@ exports.ERROR_MESSAGES = {
|
|
|
54
67
|
NESTED_COMPONENT_WITH_CHILDREN: "Nested components may not have child nodes.",
|
|
55
68
|
NESTED_COMPONENT_WITH_ATTRIBUTES: "Nested components do not allow regular attributes.",
|
|
56
69
|
REFS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT: "Refs must be unique within each component.",
|
|
57
|
-
SPECIFY_EITHER_VALUE_OR_QUALIFIER: (name) => `Specify either value: ${name}="xyz" or qualifier: ${name}:xyz`,
|
|
58
70
|
PARTS_MUST_BE_UNIQUE_WITHIN_EACH_COMPONENT: "Parts must be unique within each component.",
|
|
59
|
-
|
|
71
|
+
REPEAT_WITHOUT_PROPS: "Repeated component must specifiy props.",
|
|
60
72
|
REPEAT_ONLY_ON_NESTED_CLASS: "Repeat only allowed on nested component elements.",
|
|
61
73
|
REPEAT_DIRECTIVE_WITH_SIBLINGS: "Repeat may not have sibling elements if `allowRepeaterSiblings` flag is false.",
|
|
62
|
-
REPEAT_DIRECTIVE_WITH_CHILDREN: "Repeat may not have child nodes.",
|
|
63
74
|
TOGGLE_TARGETS_WITHOUT_TOGGLE_TRIGGERS: "Toggle targets must have toggle triggers.",
|
|
64
75
|
UNSUPPORTED_NAMESPACE: "Unsupported namespace, may only use 'stub'.",
|
|
65
76
|
XARGS_MUST_BE_OBJECT: "Extra args must be a destructured object.",
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAqFA,sBAEC;AAED,wBAIC;AA5FD,2CAAoC;AAEpC,MAAM,aAAa,GAAa,MAAM,CAAC,MAAM,CAAC,iBAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE3D,QAAA,cAAc,GAAG;IAC5B,8BAA8B,EAAE,iCAAiC;IACjE,6BAA6B,EAAE,gCAAgC;IAC/D,iCAAiC,EAC/B,sEAAsE;IACxE,0BAA0B,EAAE,qCAAqC;IACjE,eAAe;IACf,6BAA6B,EAAE,4CAA4C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kBAAkB,EAAE;;;;;;GAMnB;IACD,kBAAkB,EAAE,CAAC,KAAa,EAAE,EAAE,CACpC,KAAK,KAAK,yFAAyF;IACrG,oCAAoC,EAAE,uCAAuC;IAC7E,qCAAqC,EACnC,4EAA4E;IAC9E,uCAAuC,EAAE,8CAA8C;IACvF,2BAA2B,EAAE,iDAAiD;IAC9E,yCAAyC,EACvC,mDAAmD;IACrD,oBAAoB,EAAE,kCAAkC;IACxD,oCAAoC,EAAE,gDAAgD;IACtF,8BAA8B,EAAE,6CAA6C;IAC7E,gCAAgC,EAAE,oDAAoD;IACtF,yCAAyC,EAAE,4CAA4C;IACvF,0CAA0C,EACxC,6CAA6C;IAC/C,oBAAoB,EAAE,yCAAyC;IAC/D,2BAA2B,EAAE,mDAAmD;IAChF,8BAA8B,EAC5B,gFAAgF;IAClF,sCAAsC,EAAE,2CAA2C;IACnF,qBAAqB,EAAE,6CAA6C;IACpE,oBAAoB,EAAE,2CAA2C;IACjE,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE,CAC7B,qCAAqC,IAAI,2BAA2B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;CAClG,CAAC;AAEF,SAAgB,KAAK,CAAC,IAAmB,EAAE,YAAoB;IAC7D,MAAM,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,MAAM,CAAC,SAAkB,EAAE,IAAmB,EAAE,YAAoB;IAClF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import "source-map-support/register.js";
|
|
2
2
|
import * as constants from "./constants";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export { wallaceConfig } from "./config";
|
|
4
|
+
export { Directive, NodeValue, QualifierMode, ValueMode } from "./models";
|
|
5
5
|
import { wallacePlugin } from "./visitors/main";
|
|
6
6
|
export default wallacePlugin;
|
|
7
|
-
|
|
8
|
-
* These exports are for custom plugin development.
|
|
9
|
-
*/
|
|
10
|
-
export { wallaceConfig, Directive, NodeValue, constants };
|
|
7
|
+
export { constants };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.constants = exports.Directive = exports.wallaceConfig = void 0;
|
|
3
|
+
exports.constants = exports.ValueMode = exports.QualifierMode = exports.Directive = exports.wallaceConfig = void 0;
|
|
4
4
|
require("source-map-support/register.js"); // Ensures correct line numbers in stack traces.
|
|
5
5
|
const constants = require("./constants");
|
|
6
6
|
exports.constants = constants;
|
|
7
|
-
|
|
7
|
+
var config_1 = require("./config");
|
|
8
8
|
Object.defineProperty(exports, "wallaceConfig", { enumerable: true, get: function () { return config_1.wallaceConfig; } });
|
|
9
|
-
|
|
9
|
+
var models_1 = require("./models");
|
|
10
10
|
Object.defineProperty(exports, "Directive", { enumerable: true, get: function () { return models_1.Directive; } });
|
|
11
|
+
Object.defineProperty(exports, "QualifierMode", { enumerable: true, get: function () { return models_1.QualifierMode; } });
|
|
12
|
+
Object.defineProperty(exports, "ValueMode", { enumerable: true, get: function () { return models_1.ValueMode; } });
|
|
11
13
|
const main_1 = require("./visitors/main");
|
|
12
14
|
exports.default = main_1.wallacePlugin;
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAAwC,CAAC,gDAAgD;AAEzF,yCAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0CAAwC,CAAC,gDAAgD;AAEzF,yCAAyC;AAMhC,8BAAS;AALlB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AACtB,mCAA0E;AAAjE,mGAAA,SAAS,OAAA;AAAa,uGAAA,aAAa,OAAA;AAAE,mGAAA,SAAS,OAAA;AACvD,0CAAgD;AAEhD,kBAAe,oBAAa,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NodePath } from "@babel/core";
|
|
2
2
|
import type { Identifier, JSXElement, JSXExpressionContainer, JSXText, Expression } from "@babel/types";
|
|
3
|
+
import { LVal } from "@babel/types";
|
|
3
4
|
import type { Scope } from "@babel/traverse";
|
|
4
5
|
import { ExtractedNode, TagNode } from "./node";
|
|
5
6
|
import { Module } from "./module";
|
|
@@ -12,7 +13,7 @@ export declare class Component {
|
|
|
12
13
|
#private;
|
|
13
14
|
module: Module;
|
|
14
15
|
scope: Scope;
|
|
15
|
-
baseComponent
|
|
16
|
+
baseComponent?: Expression;
|
|
16
17
|
rootElement: HTMLElement;
|
|
17
18
|
extractedNodes: ExtractedNode[];
|
|
18
19
|
propsIdentifier: Identifier;
|
|
@@ -22,10 +23,16 @@ export declare class Component {
|
|
|
22
23
|
};
|
|
23
24
|
htmlExpressions: Expression[];
|
|
24
25
|
unique: boolean;
|
|
26
|
+
assignTo?: LVal | string;
|
|
27
|
+
watchProps?: {
|
|
28
|
+
callback?: Expression;
|
|
29
|
+
};
|
|
25
30
|
constructor(module: Module, scope: Scope, propsIdentifier: Identifier, componentIdentifier: Identifier);
|
|
31
|
+
needsCustomSetMethod(): string | LVal | {
|
|
32
|
+
callback?: Expression;
|
|
33
|
+
};
|
|
26
34
|
processJSXElement(path: NodePath<JSXElement>, tracker: WalkTracker, tagName: string, jsxVisitors: any): void;
|
|
27
|
-
|
|
28
|
-
processStub(path: NodePath<JSXElement>, name: string, tracker: WalkTracker): void;
|
|
35
|
+
processNestedComponentTagNode(path: NodePath<JSXElement>, tracker: WalkTracker, tagName: string, isRepeat: boolean, isStub: boolean): void;
|
|
29
36
|
processJSXText(path: NodePath<JSXText>, tracker: WalkTracker): void;
|
|
30
37
|
processJSXExpressionInText(path: NodePath<JSXExpressionContainer>, tracker: WalkTracker): void;
|
|
31
38
|
buildHTMLString(): Expression;
|