From d4ad3a272973cc88021d8f29052dd158158c8684 Mon Sep 17 00:00:00 2001 From: dpiercey Date: Tue, 17 Dec 2024 13:30:08 -0700 Subject: [PATCH] refactor: improve registry id normalization --- .changeset/afraid-laws-study.md | 7 +++++++ packages/compiler/src/babel-utils/tags.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/afraid-laws-study.md diff --git a/.changeset/afraid-laws-study.md b/.changeset/afraid-laws-study.md new file mode 100644 index 0000000000..2a8bda3628 --- /dev/null +++ b/.changeset/afraid-laws-study.md @@ -0,0 +1,7 @@ +--- +"@marko/compiler": patch +"marko": patch +"@marko/runtime-tags": patch +--- + +Improve registry id normalization. diff --git a/packages/compiler/src/babel-utils/tags.js b/packages/compiler/src/babel-utils/tags.js index 51d0085c82..2503f6b32a 100644 --- a/packages/compiler/src/babel-utils/tags.js +++ b/packages/compiler/src/babel-utils/tags.js @@ -319,7 +319,7 @@ function resolveMarkoFile(file, filename) { const idCache = new WeakMap(); const templateIdHashOpts = { outputLength: 5 }; export function getTemplateId(opts, request, child) { - const id = relative(ROOT, request); + const id = relative(ROOT, request).replace(/[^a-zA-Z0-9_$./-]/g, "/"); const optimize = typeof opts === "object" ? opts.optimize : opts; if (optimize) {