svelte 5.45.6 → 5.45.8
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/compiler/index.js +1 -1
- package/elements.d.ts +1 -1
- package/package.json +1 -1
- package/src/compiler/phases/1-parse/index.js +2 -15
- package/src/compiler/phases/2-analyze/visitors/VariableDeclarator.js +11 -1
- package/src/compiler/print/index.js +24 -0
- package/src/internal/server/hydratable.js +12 -16
- package/src/version.js +1 -1
package/elements.d.ts
CHANGED
|
@@ -1422,7 +1422,7 @@ export interface HTMLTextareaAttributes extends HTMLAttributes<HTMLTextAreaEleme
|
|
|
1422
1422
|
// needs both casing variants because language tools does lowercase names of non-shorthand attributes
|
|
1423
1423
|
defaultValue?: string | string[] | number | undefined | null;
|
|
1424
1424
|
defaultvalue?: string | string[] | number | undefined | null;
|
|
1425
|
-
wrap?: 'hard' | 'soft' | undefined | null;
|
|
1425
|
+
wrap?: 'hard' | 'soft' | 'off' | undefined | null;
|
|
1426
1426
|
|
|
1427
1427
|
'on:change'?: ChangeEventHandler<HTMLTextAreaElement> | undefined | null;
|
|
1428
1428
|
onchange?: ChangeEventHandler<HTMLTextAreaElement> | undefined | null;
|
package/package.json
CHANGED
|
@@ -117,21 +117,8 @@ export class Parser {
|
|
|
117
117
|
e.unexpected_eof(this.index);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
while (regex_whitespace.test(template[start])) start += 1;
|
|
123
|
-
|
|
124
|
-
let end = /** @type {number} */ (
|
|
125
|
-
this.root.fragment.nodes[this.root.fragment.nodes.length - 1].end
|
|
126
|
-
);
|
|
127
|
-
while (regex_whitespace.test(template[end - 1])) end -= 1;
|
|
128
|
-
|
|
129
|
-
this.root.start = start;
|
|
130
|
-
this.root.end = end;
|
|
131
|
-
} else {
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
this.root.start = this.root.end = null;
|
|
134
|
-
}
|
|
120
|
+
this.root.start = 0;
|
|
121
|
+
this.root.end = template.length;
|
|
135
122
|
|
|
136
123
|
const options_index = this.root.fragment.nodes.findIndex(
|
|
137
124
|
/** @param {any} thing */
|
|
@@ -146,5 +146,15 @@ export function VariableDeclarator(node, context) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
context.
|
|
149
|
+
if (node.init && get_rune(node.init, context.state.scope) === '$props') {
|
|
150
|
+
// prevent erroneous `state_referenced_locally` warnings on prop fallbacks
|
|
151
|
+
context.visit(node.id, {
|
|
152
|
+
...context.state,
|
|
153
|
+
function_depth: context.state.function_depth + 1
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
context.visit(node.init);
|
|
157
|
+
} else {
|
|
158
|
+
context.next();
|
|
159
|
+
}
|
|
150
160
|
}
|
|
@@ -181,6 +181,18 @@ const css_visitors = {
|
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
183
|
|
|
184
|
+
AttributeSelector(node, context) {
|
|
185
|
+
context.write(`[${node.name}`);
|
|
186
|
+
if (node.matcher) {
|
|
187
|
+
context.write(node.matcher);
|
|
188
|
+
context.write(`"${node.value}"`);
|
|
189
|
+
if (node.flags) {
|
|
190
|
+
context.write(` ${node.flags}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
context.write(']');
|
|
194
|
+
},
|
|
195
|
+
|
|
184
196
|
Block(node, context) {
|
|
185
197
|
context.write('{');
|
|
186
198
|
|
|
@@ -221,10 +233,22 @@ const css_visitors = {
|
|
|
221
233
|
context.write(`${node.property}: ${node.value};`);
|
|
222
234
|
},
|
|
223
235
|
|
|
236
|
+
IdSelector(node, context) {
|
|
237
|
+
context.write(`#${node.name}`);
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
NestingSelector(node, context) {
|
|
241
|
+
context.write('&');
|
|
242
|
+
},
|
|
243
|
+
|
|
224
244
|
Nth(node, context) {
|
|
225
245
|
context.write(node.value);
|
|
226
246
|
},
|
|
227
247
|
|
|
248
|
+
Percentage(node, context) {
|
|
249
|
+
context.write(`${node.value}%`);
|
|
250
|
+
},
|
|
251
|
+
|
|
228
252
|
PseudoClassSelector(node, context) {
|
|
229
253
|
context.write(`:${node.name}`);
|
|
230
254
|
|
|
@@ -57,8 +57,16 @@ function encode(key, value, unresolved) {
|
|
|
57
57
|
|
|
58
58
|
entry.serialized = devalue.uneval(entry.value, (value, uneval) => {
|
|
59
59
|
if (is_promise(value)) {
|
|
60
|
+
// we serialize promises as `"${i}"`, because it's impossible for that string
|
|
61
|
+
// to occur 'naturally' (since the quote marks would have to be escaped)
|
|
62
|
+
// this placeholder is returned synchronously from `uneval`, which includes it in the
|
|
63
|
+
// serialized string. Later (at least one microtask from now), when `p.then` runs, it'll
|
|
64
|
+
// be replaced.
|
|
65
|
+
const placeholder = `"${uid++}"`;
|
|
60
66
|
const p = value
|
|
61
|
-
.then((v) =>
|
|
67
|
+
.then((v) => {
|
|
68
|
+
entry.serialized = entry.serialized.replace(placeholder, `r(${uneval(v)})`);
|
|
69
|
+
})
|
|
62
70
|
.catch((devalue_error) =>
|
|
63
71
|
e.hydratable_serialization_failed(
|
|
64
72
|
key,
|
|
@@ -66,23 +74,11 @@ function encode(key, value, unresolved) {
|
|
|
66
74
|
)
|
|
67
75
|
);
|
|
68
76
|
|
|
69
|
-
// prevent unhandled rejections from crashing the server
|
|
70
|
-
p.catch(() => {});
|
|
71
|
-
|
|
72
|
-
// track which promises are still resolving when render is complete
|
|
73
77
|
unresolved?.set(p, key);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// we serialize promises as `"${i}"`, because it's impossible for that string
|
|
77
|
-
// to occur 'naturally' (since the quote marks would have to be escaped)
|
|
78
|
-
const placeholder = `"${uid++}"`;
|
|
79
|
-
|
|
80
|
-
(entry.promises ??= []).push(
|
|
81
|
-
p.then((s) => {
|
|
82
|
-
entry.serialized = entry.serialized.replace(placeholder, s);
|
|
83
|
-
})
|
|
84
|
-
);
|
|
78
|
+
// prevent unhandled rejections from crashing the server, track which promises are still resolving when render is complete
|
|
79
|
+
p.catch(() => {}).finally(() => unresolved?.delete(p));
|
|
85
80
|
|
|
81
|
+
(entry.promises ??= []).push(p);
|
|
86
82
|
return placeholder;
|
|
87
83
|
}
|
|
88
84
|
});
|
package/src/version.js
CHANGED