Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8596dfd
wip: bump rollup
sapphi-red Sep 30, 2023
b907e6e
wip: remove `acorn`/`acornInjectPlugins` option, remove additional op…
sapphi-red Sep 30, 2023
e6474ba
wip: replace "assertions" with "attributes"
sapphi-red Sep 30, 2023
00e0ece
wip: replace RollupWarning with RollupLog
sapphi-red Sep 30, 2023
0c488c7
wip: remove omit `moduleIds`
sapphi-red Sep 30, 2023
d9085f7
wip: call `this.addWatchFile` in vite:load-fallback plugin
sapphi-red Sep 30, 2023
4d49292
wip: remove utf8 BOM for now
sapphi-red Sep 30, 2023
f161d22
wip: use parse function from rollup
sapphi-red Sep 30, 2023
ddde37f
wip: bump rollup for plugin-legacy
sapphi-red Sep 30, 2023
49dafa0
wip: default of skipSelf is now true
sapphi-red Sep 30, 2023
176f6d5
wip: ignore rollup version mismatch type error
sapphi-red Sep 30, 2023
9f36ca3
wip: bump rollup
sapphi-red Oct 3, 2023
6b00745
wip: revert "wip: remove utf8 BOM for now"
sapphi-red Oct 3, 2023
632d3b0
wip: new hash algorithm
sapphi-red Oct 3, 2023
a3c750f
wip: new hash algorithm
sapphi-red Oct 3, 2023
ae0b4c4
wip: new hash algorithm
sapphi-red Oct 3, 2023
fa7a370
chore: merge main
sapphi-red Oct 5, 2023
e5bf794
chore: update rollup plugins
sapphi-red Oct 5, 2023
a274f82
wip: update rollup
sapphi-red Oct 5, 2023
19c2d76
wip: use parseAst function from rollup
sapphi-red Oct 5, 2023
60bb4fd
wip: remove ensureWatchedFile
sapphi-red Oct 5, 2023
1edfeff
wip: bump rollup to 4.0.0
sapphi-red Oct 5, 2023
dafc6d7
wip: use ^4.0.0 instead of 4.0.0
sapphi-red Oct 5, 2023
e2c9e8a
wip: add `addWatchFile` to assetPlugin
sapphi-red Oct 5, 2023
90f1344
wip: remove ensureWatchPlugin
sapphi-red Oct 5, 2023
924c4b0
wip: add migration guide
sapphi-red Oct 5, 2023
e56494e
wip: remove RollupParseFunc type
sapphi-red Oct 6, 2023
9ab9f61
wip: remove the tweak to workaround rollup/acorn inconsistency
sapphi-red Oct 6, 2023
522f77c
wip: update docs
sapphi-red Oct 6, 2023
c9eb9f3
wip: restore ensureWatchedFile in indexHtml.ts
sapphi-red Oct 6, 2023
342716a
chore: merge main
sapphi-red Oct 6, 2023
aae78cf
wip: new hash algorithm
sapphi-red Oct 6, 2023
c1fad36
wip: new hash algorithm
sapphi-red Oct 6, 2023
31ed8b1
chore: merge main
sapphi-red Oct 9, 2023
0728839
chore: merge main
sapphi-red Oct 11, 2023
3d081e3
chore: merge main
sapphi-red Oct 12, 2023
8915ca5
chore: bump vitepress
sapphi-red Oct 12, 2023
22d7bd9
chore: merge main
sapphi-red Oct 16, 2023
d5bd340
chore: bump rollup-plugin-license
sapphi-red Oct 16, 2023
72a4624
chore: bump rollup and magic-string
sapphi-red Oct 16, 2023
6a5d4dd
chore: merge main
sapphi-red Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip: remove the tweak to workaround rollup/acorn inconsistency
  • Loading branch information
sapphi-red committed Oct 6, 2023
commit 9ab9f6157b6c069011ba5398f9f48b6aed9b94ca
21 changes: 8 additions & 13 deletions packages/vite/src/node/ssr/ssrTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function walk(
}

;(eswalk as any)(root, {
enter(node: Node, parent: Node | null, prop: string) {
enter(node: Node, parent: Node | null) {
if (node.type === 'ImportDeclaration') {
return this.skip()
}
Expand Down Expand Up @@ -400,7 +400,7 @@ function walk(
if (node.type === 'Identifier') {
if (
!isInScope(node.name, parentStack) &&
isRefIdentifier(node, parent!, parentStack, prop)
isRefIdentifier(node, parent!, parentStack)
) {
// record the identifier, for DFS -> BFS
identifiers.push([node, parentStack.slice(0)])
Expand All @@ -422,7 +422,7 @@ function walk(
return
}
;(eswalk as any)(p.type === 'AssignmentPattern' ? p.left : p, {
enter(child: Node, parent: Node, prop: string) {
enter(child: Node, parent: Node) {
// skip params default value of destructure
if (
parent?.type === 'AssignmentPattern' &&
Expand All @@ -432,7 +432,7 @@ function walk(
}
if (child.type !== 'Identifier') return
// do not record as scope variable if is a destructuring keyword
if (isStaticPropertyKey(child, parent, prop)) return
if (isStaticPropertyKey(child, parent)) return
// do not record if this is a default value
// assignment of a destructuring variable
if (
Expand Down Expand Up @@ -484,12 +484,7 @@ function walk(
})
}

function isRefIdentifier(
id: Identifier,
parent: _Node,
parentStack: _Node[],
prop: string,
) {
function isRefIdentifier(id: Identifier, parent: _Node, parentStack: _Node[]) {
// declaration id
if (
parent.type === 'CatchClause' ||
Expand Down Expand Up @@ -517,7 +512,7 @@ function isRefIdentifier(
}

// property key
if (isStaticPropertyKey(id, parent, prop)) {
if (isStaticPropertyKey(id, parent)) {
return false
}

Expand Down Expand Up @@ -558,8 +553,8 @@ function isRefIdentifier(
const isStaticProperty = (node: _Node): node is Property =>
node && node.type === 'Property' && !node.computed

const isStaticPropertyKey = (node: _Node, parent: _Node, prop: string) =>
isStaticProperty(parent) && prop === 'key' && parent.key === node
const isStaticPropertyKey = (node: _Node, parent: _Node) =>
isStaticProperty(parent) && parent.key === node

const functionNodeTypeRE = /Function(?:Expression|Declaration)$|Method$/
function isFunction(node: _Node): node is FunctionNode {
Expand Down