Skip to content

Commit 071fa2b

Browse files
committed
add _SCRIPT_SUBNAME as an alias for _SCRIPT_NAME
1 parent 1d688c1 commit 071fa2b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/processScript/transform.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export function transform(
7373
referencePath.replaceWith(t.stringLiteral(scriptName == true ? `$${uniqueId}$SCRIPT_NAME$` : scriptName))
7474
}
7575

76+
if (program.scope.hasGlobal(`_SCRIPT_SUBNAME`)) {
77+
for (const referencePath of getReferencePathsToGlobal(`_SCRIPT_SUBNAME`, program))
78+
referencePath.replaceWith(t.stringLiteral(scriptName == true ? `$${uniqueId}$SCRIPT_NAME$` : scriptName))
79+
}
80+
7681
if (program.scope.hasGlobal(`_FULL_SCRIPT_NAME`)) {
7782
for (const referencePath of getReferencePathsToGlobal(`_FULL_SCRIPT_NAME`, program)) {
7883
if (scriptUser == true || scriptName == true)

0 commit comments

Comments
 (0)