@wuchale/svelte 0.20.1 → 0.20.3
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/transformer.d.ts +1 -1
- package/dist/transformer.js +15 -13
- package/package.json +2 -2
package/dist/transformer.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class SvelteTransformer extends Transformer {
|
|
|
17
17
|
visitExpressionTag(node: AST.ExpressionTag): Message[];
|
|
18
18
|
visitVariableDeclarator(node: VariableDeclarator): Message[];
|
|
19
19
|
initMixedVisitor(): MixedVisitorSvelte;
|
|
20
|
-
visitFragment(node: AST.Fragment): Message[];
|
|
20
|
+
visitFragment(node: AST.Fragment, nestable?: boolean): Message[];
|
|
21
21
|
visitRegularElement(node: AST.ElementLike): Message[];
|
|
22
22
|
visitComponent(node: AST.Component): Message[];
|
|
23
23
|
visitSpreadAttribute(node: AST.SpreadAttribute): Message[];
|
package/dist/transformer.js
CHANGED
|
@@ -110,9 +110,10 @@ export class SvelteTransformer extends Transformer {
|
|
|
110
110
|
},
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
visitFragment(node) {
|
|
113
|
+
visitFragment(node, nestable = false) {
|
|
114
114
|
return this.mixedVisitor.visit({
|
|
115
115
|
children: node.nodes,
|
|
116
|
+
nestable,
|
|
116
117
|
commentDirectives: this.commentDirectives,
|
|
117
118
|
scope: 'markup',
|
|
118
119
|
element: this.currentElement,
|
|
@@ -126,7 +127,7 @@ export class SvelteTransformer extends Transformer {
|
|
|
126
127
|
for (const attrib of node.attributes) {
|
|
127
128
|
msgs.push(...this.visitSv(attrib));
|
|
128
129
|
}
|
|
129
|
-
msgs.push(...this.visitFragment(node.fragment));
|
|
130
|
+
msgs.push(...this.visitFragment(node.fragment, true));
|
|
130
131
|
this.currentElement = currentElement;
|
|
131
132
|
return msgs;
|
|
132
133
|
}
|
|
@@ -150,6 +151,7 @@ export class SvelteTransformer extends Transformer {
|
|
|
150
151
|
if (values.length > 1) {
|
|
151
152
|
const msgs = this.mixedVisitor.visit({
|
|
152
153
|
children: values,
|
|
154
|
+
nestable: false,
|
|
153
155
|
commentDirectives: this.commentDirectives,
|
|
154
156
|
scope: 'attribute',
|
|
155
157
|
element: this.currentElement,
|
|
@@ -226,41 +228,41 @@ export class SvelteTransformer extends Transformer {
|
|
|
226
228
|
if (this.hasIdentifier(this.moduleExportExprs, node.expression.name)) {
|
|
227
229
|
this.currentRtVar = rtModuleVar;
|
|
228
230
|
}
|
|
229
|
-
const msgs = this.visitFragment(node.body);
|
|
231
|
+
const msgs = this.visitFragment(node.body, false);
|
|
230
232
|
this.currentRtVar = prevRtVar;
|
|
231
233
|
return msgs;
|
|
232
234
|
}
|
|
233
235
|
visitIfBlock(node) {
|
|
234
236
|
const msgs = this.visit(node.test);
|
|
235
|
-
msgs.push(...this.
|
|
237
|
+
msgs.push(...this.visitFragment(node.consequent, false));
|
|
236
238
|
if (node.alternate) {
|
|
237
|
-
msgs.push(...this.
|
|
239
|
+
msgs.push(...this.visitFragment(node.alternate, false));
|
|
238
240
|
}
|
|
239
241
|
return msgs;
|
|
240
242
|
}
|
|
241
243
|
visitEachBlock(node) {
|
|
242
|
-
const msgs = [...this.visit(node.expression), ...this.
|
|
244
|
+
const msgs = [...this.visit(node.expression), ...this.visitFragment(node.body, false)];
|
|
243
245
|
if (node.key) {
|
|
244
246
|
msgs.push(...this.visit(node.key));
|
|
245
247
|
}
|
|
246
248
|
if (node.fallback) {
|
|
247
|
-
msgs.push(...this.
|
|
249
|
+
msgs.push(...this.visitFragment(node.fallback, false));
|
|
248
250
|
}
|
|
249
251
|
return msgs;
|
|
250
252
|
}
|
|
251
253
|
visitKeyBlock(node) {
|
|
252
|
-
return [...this.visit(node.expression), ...this.
|
|
254
|
+
return [...this.visit(node.expression), ...this.visitFragment(node.fragment, false)];
|
|
253
255
|
}
|
|
254
256
|
visitAwaitBlock(node) {
|
|
255
257
|
const msgs = this.visit(node.expression);
|
|
256
258
|
if (node.then) {
|
|
257
|
-
msgs.push(...this.visitFragment(node.then));
|
|
259
|
+
msgs.push(...this.visitFragment(node.then, false));
|
|
258
260
|
}
|
|
259
261
|
if (node.pending) {
|
|
260
|
-
msgs.push(...this.visitFragment(node.pending));
|
|
262
|
+
msgs.push(...this.visitFragment(node.pending, false));
|
|
261
263
|
}
|
|
262
264
|
if (node.catch) {
|
|
263
|
-
msgs.push(...this.visitFragment(node.catch));
|
|
265
|
+
msgs.push(...this.visitFragment(node.catch, false));
|
|
264
266
|
}
|
|
265
267
|
return msgs;
|
|
266
268
|
}
|
|
@@ -278,7 +280,7 @@ export class SvelteTransformer extends Transformer {
|
|
|
278
280
|
else {
|
|
279
281
|
this.currentElement = 'svelte:element';
|
|
280
282
|
}
|
|
281
|
-
const msgs = [...node.attributes.flatMap(n => this.visitSv(n)), ...this.visitFragment(node.fragment)];
|
|
283
|
+
const msgs = [...node.attributes.flatMap(n => this.visitSv(n)), ...this.visitFragment(node.fragment, true)];
|
|
282
284
|
this.currentElement = currentElement;
|
|
283
285
|
return msgs;
|
|
284
286
|
}
|
|
@@ -316,7 +318,7 @@ export class SvelteTransformer extends Transformer {
|
|
|
316
318
|
this.commentDirectives = {}; // reset
|
|
317
319
|
msgs.push(...this.visitProgram(node.instance.content));
|
|
318
320
|
}
|
|
319
|
-
msgs.push(...this.visitFragment(node.fragment
|
|
321
|
+
msgs.push(...this.visitFragment(node.fragment, false));
|
|
320
322
|
return msgs;
|
|
321
323
|
}
|
|
322
324
|
visitSv(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wuchale/svelte",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "Protobuf-like i18n from plain code: Svelte adapter",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc --watch",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"svelte": "^5"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"wuchale": "^0.25.
|
|
57
|
+
"wuchale": "^0.25.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "~24.13.2",
|