Skip to content

Commit 5762eb8

Browse files
committed
do not proxy template literal
1 parent caf5fd5 commit 5762eb8

File tree

88 files changed

+165
-93
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+165
-93
lines changed

packages/svelte/src/compiler/phases/3-transform/client/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ export function should_proxy_or_freeze(node) {
615615
if (
616616
!node ||
617617
node.type === 'Literal' ||
618+
node.type === 'TemplateLiteral' ||
618619
node.type === 'ArrowFunctionExpression' ||
619620
node.type === 'FunctionExpression' ||
620621
node.type === 'UnaryExpression' ||

packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,10 +1663,7 @@ function serialize_template_literal(values, visit, state) {
16631663
if (node.type === 'Text') {
16641664
const last = /** @type {import('estree').TemplateElement} */ (quasis.at(-1));
16651665
last.value.raw += sanitize_template_string(node.data);
1666-
} else if (
1667-
node.type === 'ExpressionTag' &&
1668-
node.expression.type === 'Literal'
1669-
) {
1666+
} else if (node.type === 'ExpressionTag' && node.expression.type === 'Literal') {
16701667
const last = /** @type {import('estree').TemplateElement} */ (quasis.at(-1));
16711668
if (node.expression.value != null) {
16721669
last.value.raw += sanitize_template_string(node.expression.value + '');

packages/svelte/tests/parser-legacy/samples/action-duplicate/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
}
3232
]
3333
}
34-
}
34+
}

packages/svelte/tests/parser-legacy/samples/action-with-call/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
}
7474
]
7575
}
76-
}
76+
}

packages/svelte/tests/parser-legacy/samples/action-with-identifier/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
}
3939
]
4040
}
41-
}
41+
}

packages/svelte/tests/parser-legacy/samples/action-with-literal/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939
}
4040
]
4141
}
42-
}
42+
}

packages/svelte/tests/parser-legacy/samples/action/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
}
2424
]
2525
}
26-
}
26+
}

packages/svelte/tests/parser-legacy/samples/animation/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@
7676
}
7777
]
7878
}
79-
}
79+
}

packages/svelte/tests/parser-legacy/samples/attribute-class-directive/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
}
3939
]
4040
}
41-
}
41+
}

packages/svelte/tests/parser-legacy/samples/attribute-containing-solidus/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
}
3939
]
4040
}
41-
}
41+
}

0 commit comments

Comments
 (0)