Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency es-module-lexer to v1 #9576

Merged
merged 2 commits into from Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/package.json
Expand Up @@ -90,7 +90,7 @@
"debug": "^4.3.4",
"dotenv": "^14.3.2",
"dotenv-expand": "^5.1.0",
"es-module-lexer": "^0.10.5",
"es-module-lexer": "^1.0.3",
"estree-walker": "^3.0.1",
"etag": "^1.8.1",
"fast-glob": "^3.2.11",
Expand Down
5 changes: 3 additions & 2 deletions packages/vite/src/node/optimizer/index.ts
Expand Up @@ -42,6 +42,7 @@ const jsMapExtensionRE = /\.js\.map$/i

export type ExportsData = {
hasImports: boolean
// exported names (for `export { a as b }`, `b` is exported name)
exports: readonly string[]
facade: boolean
// es-module-lexer has a facade detection but isn't always accurate for our
Expand Down Expand Up @@ -941,7 +942,7 @@ export async function extractExportsData(
const [imports, exports, facade] = parse(result.outputFiles[0].text)
return {
hasImports: imports.length > 0,
exports,
exports: exports.map((e) => e.n),
facade
}
}
Expand Down Expand Up @@ -973,7 +974,7 @@ export async function extractExportsData(
const [imports, exports, facade] = parseResult
const exportsData: ExportsData = {
hasImports: imports.length > 0,
exports,
exports: exports.map((e) => e.n),
facade,
hasReExports: imports.some(({ ss, se }) => {
const exp = entryContent.slice(ss, se)
Expand Down
6 changes: 3 additions & 3 deletions packages/vite/src/node/plugins/importAnalysis.ts
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path'
import { performance } from 'node:perf_hooks'
import colors from 'picocolors'
import MagicString from 'magic-string'
import type { ImportSpecifier } from 'es-module-lexer'
import type { ExportSpecifier, ImportSpecifier } from 'es-module-lexer'
import { init, parse as parseImports } from 'es-module-lexer'
import { parse as parseJS } from 'acorn'
import type { Node } from 'estree'
Expand Down Expand Up @@ -189,7 +189,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
const start = performance.now()
await init
let imports: readonly ImportSpecifier[] = []
let exports: readonly string[] = []
let exports: readonly ExportSpecifier[] = []
source = stripBomTag(source)
try {
;[imports, exports] = parseImports(source)
Expand Down Expand Up @@ -676,7 +676,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
!isSelfAccepting &&
isPartiallySelfAccepting &&
acceptedExports.size >= exports.length &&
exports.every((name) => acceptedExports.has(name))
exports.every((e) => acceptedExports.has(e.n))
) {
isSelfAccepting = true
}
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.