Skip to content

Commit

Permalink
Support arbitrary module namespace names with <script setup> (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Jan 20, 2022
1 parent 25c6847 commit 160f4ef
Show file tree
Hide file tree
Showing 8 changed files with 1,124 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/ast/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ export interface ESLintIdentifier extends HasLocation, HasParent {
interface ESLintLiteralBase extends HasLocation, HasParent {
type: "Literal"
value: string | boolean | null | number | RegExp | bigint
raw: string
regex?: {
pattern: string
flags: string
Expand Down
10 changes: 3 additions & 7 deletions src/script-setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,9 @@ function getScriptSetupCodeBlocks(
const exportedToken = tokens[localTokenIndex + 2]
checkToken(
exportedToken,
(spec.exported as ESLintIdentifier).name,
spec.exported.type === "Identifier"
? spec.exported.name
: spec.exported.raw,
)
restoreTokens.push(exportedToken)
processAppend(
Expand Down Expand Up @@ -693,12 +695,6 @@ function getScriptSetupCodeBlocks(
) {
const spec = body.specifiers[index]
const local = locals[index]
if (
(spec.local as ESLintIdentifier).name !==
local.name
) {
return null
}
map.set(spec, local)
}

Expand Down
Loading

0 comments on commit 160f4ef

Please sign in to comment.