From bd880e8437ea2df16f322f604865c1148a9fd4cf Mon Sep 17 00:00:00 2001 From: liruifengv Date: Fri, 26 Jan 2024 17:44:54 +0800 Subject: [PATCH] fix: fix `transition:name` can be unicode (#9822) * fix: fix `transition:name` can be unicode * delete prefix - * use for func * add changeset * Update .changeset/cold-bobcats-shave.md Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * fix review issue * fix review issue * add comment * add \ to regex * fix some issue * delete unused import * remove a rule * remove valid rule -- * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * Update transition.ts Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> * format * use cssesc to escape name * test: add e2e test * add charset for layout * use the raw value for e2e test * use cssesc instead of toValidIdent * uncomment --------- Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> Co-authored-by: Nate Moore --- .changeset/cold-bobcats-shave.md | 5 ++ .../src/components/Layout.astro | 1 + .../src/pages/transition-name.astro | 16 +++++++ packages/astro/e2e/view-transitions.test.js | 48 +++++++++++++++++++ packages/astro/package.json | 2 + .../astro/src/runtime/server/transition.ts | 8 +--- pnpm-lock.yaml | 10 ++++ 7 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 .changeset/cold-bobcats-shave.md create mode 100644 packages/astro/e2e/fixtures/view-transitions/src/pages/transition-name.astro diff --git a/.changeset/cold-bobcats-shave.md b/.changeset/cold-bobcats-shave.md new file mode 100644 index 000000000000..ac05fde494f4 --- /dev/null +++ b/.changeset/cold-bobcats-shave.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Applies the correct escaping to identifiers used with `transition:name`. diff --git a/packages/astro/e2e/fixtures/view-transitions/src/components/Layout.astro b/packages/astro/e2e/fixtures/view-transitions/src/components/Layout.astro index ef82078e78f5..8643f273fd51 100644 --- a/packages/astro/e2e/fixtures/view-transitions/src/components/Layout.astro +++ b/packages/astro/e2e/fixtures/view-transitions/src/components/Layout.astro @@ -22,6 +22,7 @@ const { link } = Astro.props as Props; +