Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
76df629
feat: optimizeDeps.devStrategy, new 'dynamic-scan' strat
patak-dev Jun 30, 2022
48ae304
chore: merge main
patak-dev Jun 30, 2022
f3bb834
chore: update
patak-dev Jun 30, 2022
b6f2d04
fix: use urlWithoutBase
patak-dev Jun 30, 2022
fd46ccf
test: add example of full-reload with 'lazy' in preload playground
patak-dev Jun 30, 2022
562d479
chore: merge main
patak-dev Jul 1, 2022
cda64d2
refactor: dynamic-scan -> scan
patak-dev Jul 1, 2022
a7cf18f
feat: scan strategy, fix alias issue by making it the default
patak-dev Jul 2, 2022
d7da60e
chore: remove unneeded changes to scan.ts
patak-dev Jul 2, 2022
6d288fa
fix: use scanner during build time, remove devStrategy option
patak-dev Jul 2, 2022
39f9858
chore: update
patak-dev Jul 2, 2022
7ad4962
fix: preAliasPlugin during build
patak-dev Jul 2, 2022
89fef62
fix: restrict preAlias to aliased bareImports
patak-dev Jul 2, 2022
6eb114d
fix: post scan optimization
patak-dev Jul 2, 2022
387b18e
chore: try serialize esbuild
patak-dev Jul 2, 2022
80e7a4d
chore: serialize esbuild scan calls
patak-dev Jul 2, 2022
04f34b2
fix: await scanner before optimizing SSR deps
patak-dev Jul 2, 2022
aa58dd8
chore: revert 04f34b2939131edaae16b4f0c5a80978b6ff1210
patak-dev Jul 2, 2022
1ec2f5b
chore: update
patak-dev Jul 2, 2022
e491071
chore: test CI, await scanner and ssr deps optimization before server…
patak-dev Jul 2, 2022
9b33538
chore: sync set of depsOptimizer.scanning
patak-dev Jul 2, 2022
967dfd4
test: move SSR module error test to ssr-vue
patak-dev Jul 2, 2022
6c72736
test: avoid starting two servers concurrently in a test
patak-dev Jul 3, 2022
e814d41
fix: improve init logic
patak-dev Jul 3, 2022
0cb384b
chore: use hints for snapshots
patak-dev Jul 3, 2022
23df866
chore: remove optimizeDeps guard
patak-dev Jul 3, 2022
d81a855
fix: SSR deps external/noExternal optimization
patak-dev Jul 3, 2022
1a58e7d
fix: don't collide external/noExternal with optimizeDeps
patak-dev Jul 3, 2022
48b215e
fix: correct init server await
patak-dev Jul 4, 2022
96b9170
chore: reduce changeset
patak-dev Jul 4, 2022
81b3992
chore: reduce changeset
patak-dev Jul 4, 2022
8861550
chore: remove changes to SSR/optimizeDeps, TBD in another PR
patak-dev Jul 4, 2022
File filter

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
chore: remove unneeded changes to scan.ts
  • Loading branch information
patak-dev committed Jul 2, 2022
commit d7da60e45e5e5abda7a70a664d736f037a05536c
28 changes: 8 additions & 20 deletions packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export async function scanImports(config: ResolvedConfig): Promise<{
deps: Record<string, string>
missing: Record<string, string>
}> {
const start = performance.now()

let entries: string[] = []

const explicitEntryPatterns = config.optimizeDeps.entries
Expand All @@ -68,7 +70,9 @@ export async function scanImports(config: ResolvedConfig): Promise<{

// Non-supported entry file types and virtual files should not be scanned for
// dependencies.
entries = filterScannableEntries(entries)
entries = entries.filter(
(entry) => isScannable(entry) && fs.existsSync(entry)
)

if (!entries.length) {
if (!explicitEntryPatterns && !config.optimizeDeps.include) {
Expand All @@ -81,26 +85,10 @@ export async function scanImports(config: ResolvedConfig): Promise<{
)
}
return { deps: {}, missing: {} }
} else {
debug(`Crawling dependencies using entries:\n ${entries.join('\n ')}`)
}

return scanImportsInEntries(entries, config)
}

export function filterScannableEntries(entries: string[]): string[] {
return entries.filter((entry) => isScannable(entry) && fs.existsSync(entry))
}

export async function scanImportsInEntries(
entries: string[],
config: ResolvedConfig
): Promise<{
deps: Record<string, string>
missing: Record<string, string>
}> {
const start = performance.now()

debug(`Crawling dependencies using entries:\n ${entries.join('\n ')}`)

const deps: Record<string, string> = {}
const missing: Record<string, string> = {}
const container = await createPluginContainer(config)
Expand Down Expand Up @@ -140,7 +128,7 @@ function orderedDependencies(deps: Record<string, string>) {
return Object.fromEntries(depsList)
}

export async function globEntries(
export function globEntries(
pattern: string | string[],
config: ResolvedConfig
): Promise<string[]> {
Expand Down