mirror of
https://github.com/morluto/rea
synced 2026-10-28 15:07:26 -04:00
fix(javascript): preserve asterisks in block source-map URLs (#2728)
Squash merge of https://github.com/morluto/rea/pull/2728. Co-authored-by: LouisChen <3361008+chqcjq@users.noreply.github.com>
This commit is contained in:
@@ -429,7 +429,12 @@ export const addSourceMapDirectives = (
|
||||
end === null
|
||||
)
|
||||
continue;
|
||||
const commentSource = source.slice(start, end);
|
||||
// The parser owns comment boundaries. Exclude only the closing block
|
||||
// delimiter; an asterisk elsewhere remains part of the declared URL.
|
||||
const commentSource = source.slice(
|
||||
start,
|
||||
comment.type === "CommentBlock" ? end - 2 : end,
|
||||
);
|
||||
if (
|
||||
!(commentSource.startsWith("//") || commentSource.startsWith("/*")) ||
|
||||
!(commentSource[2] === "#" || commentSource[2] === "@")
|
||||
@@ -449,9 +454,7 @@ export const addSourceMapDirectives = (
|
||||
const urlOffset = commentSource.slice(equalsStart + 1).search(/\S/u);
|
||||
if (urlOffset === -1) continue;
|
||||
const declaredStart = equalsStart + 1 + urlOffset;
|
||||
const terminator = commentSource
|
||||
.slice(declaredStart)
|
||||
.search(commentSource.startsWith("//") ? /\s/u : /[\s*]/u);
|
||||
const terminator = commentSource.slice(declaredStart).search(/\s/u);
|
||||
const declaredEnd =
|
||||
terminator === -1 ? commentSource.length : declaredStart + terminator;
|
||||
if (declaredEnd === declaredStart) continue;
|
||||
|
||||
Reference in New Issue
Block a user