-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: rework
import.meta.glob
(#7537)
- Loading branch information
Showing
38 changed files
with
1,308 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
154 changes: 154 additions & 0 deletions
154
packages/vite/src/node/__tests__/plugins/importGlob/__snapshots__/fixture.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`fixture > transform 1`] = ` | ||
"import * as __vite_glob_1_0 from \\"./modules/a.ts\\" | ||
import * as __vite_glob_1_1 from \\"./modules/b.ts\\" | ||
import * as __vite_glob_1_2 from \\"./modules/index.ts\\" | ||
import { name as __vite_glob_3_0 } from \\"./modules/a.ts\\" | ||
import { name as __vite_glob_3_1 } from \\"./modules/b.ts\\" | ||
import { name as __vite_glob_3_2 } from \\"./modules/index.ts\\" | ||
import { default as __vite_glob_5_0 } from \\"./modules/a.ts?raw\\" | ||
import { default as __vite_glob_5_1 } from \\"./modules/b.ts?raw\\" | ||
import \\"../../../../../../types/importMeta\\"; | ||
export const basic = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), | ||
\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\") | ||
}; | ||
export const basicEager = { | ||
\\"./modules/a.ts\\": __vite_glob_1_0, | ||
\\"./modules/b.ts\\": __vite_glob_1_1, | ||
\\"./modules/index.ts\\": __vite_glob_1_2 | ||
}; | ||
export const ignore = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\") | ||
}; | ||
export const namedEager = { | ||
\\"./modules/a.ts\\": __vite_glob_3_0, | ||
\\"./modules/b.ts\\": __vite_glob_3_1, | ||
\\"./modules/index.ts\\": __vite_glob_3_2 | ||
}; | ||
export const namedDefault = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\").then(m => m[\\"default\\"]), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\").then(m => m[\\"default\\"]), | ||
\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\").then(m => m[\\"default\\"]) | ||
}; | ||
export const eagerAs = { | ||
\\"./modules/a.ts\\": __vite_glob_5_0, | ||
\\"./modules/b.ts\\": __vite_glob_5_1 | ||
}; | ||
export const excludeSelf = { | ||
\\"./sibling.ts\\": () => import(\\"./sibling.ts\\") | ||
}; | ||
export const customQueryString = { | ||
\\"./sibling.ts\\": () => import(\\"./sibling.ts?custom\\") | ||
}; | ||
export const customQueryObject = { | ||
\\"./sibling.ts\\": () => import(\\"./sibling.ts?foo=bar&raw=true\\") | ||
}; | ||
export const parent = { | ||
}; | ||
export const rootMixedRelative = { | ||
\\"/css.spec.ts\\": () => import(\\"../../css.spec.ts?url\\").then(m => m[\\"default\\"]), | ||
\\"/define.spec.ts\\": () => import(\\"../../define.spec.ts?url\\").then(m => m[\\"default\\"]), | ||
\\"/import.spec.ts\\": () => import(\\"../../import.spec.ts?url\\").then(m => m[\\"default\\"]), | ||
\\"/importGlob/fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts?url\\").then(m => m[\\"default\\"]), | ||
\\"/importGlob/fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts?url\\").then(m => m[\\"default\\"]), | ||
\\"/importGlob/fixture-b/index.ts\\": () => import(\\"../fixture-b/index.ts?url\\").then(m => m[\\"default\\"]) | ||
}; | ||
export const cleverCwd1 = { | ||
\\"./node_modules/framework/pages/hello.page.js\\": () => import(\\"./node_modules/framework/pages/hello.page.js\\") | ||
}; | ||
export const cleverCwd2 = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), | ||
\\"../fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts\\"), | ||
\\"../fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts\\") | ||
}; | ||
" | ||
`; | ||
|
||
exports[`fixture > transform with restoreQueryExtension 1`] = ` | ||
"import * as __vite_glob_1_0 from \\"./modules/a.ts\\" | ||
import * as __vite_glob_1_1 from \\"./modules/b.ts\\" | ||
import * as __vite_glob_1_2 from \\"./modules/index.ts\\" | ||
import { name as __vite_glob_3_0 } from \\"./modules/a.ts\\" | ||
import { name as __vite_glob_3_1 } from \\"./modules/b.ts\\" | ||
import { name as __vite_glob_3_2 } from \\"./modules/index.ts\\" | ||
import { default as __vite_glob_5_0 } from \\"./modules/a.ts?raw\\" | ||
import { default as __vite_glob_5_1 } from \\"./modules/b.ts?raw\\" | ||
import \\"../../../../../../types/importMeta\\"; | ||
export const basic = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), | ||
\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\") | ||
}; | ||
export const basicEager = { | ||
\\"./modules/a.ts\\": __vite_glob_1_0, | ||
\\"./modules/b.ts\\": __vite_glob_1_1, | ||
\\"./modules/index.ts\\": __vite_glob_1_2 | ||
}; | ||
export const ignore = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\") | ||
}; | ||
export const namedEager = { | ||
\\"./modules/a.ts\\": __vite_glob_3_0, | ||
\\"./modules/b.ts\\": __vite_glob_3_1, | ||
\\"./modules/index.ts\\": __vite_glob_3_2 | ||
}; | ||
export const namedDefault = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\").then(m => m[\\"default\\"]), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\").then(m => m[\\"default\\"]), | ||
\\"./modules/index.ts\\": () => import(\\"./modules/index.ts\\").then(m => m[\\"default\\"]) | ||
}; | ||
export const eagerAs = { | ||
\\"./modules/a.ts\\": __vite_glob_5_0, | ||
\\"./modules/b.ts\\": __vite_glob_5_1 | ||
}; | ||
export const excludeSelf = { | ||
\\"./sibling.ts\\": () => import(\\"./sibling.ts\\") | ||
}; | ||
export const customQueryString = { | ||
\\"./sibling.ts\\": () => import(\\"./sibling.ts?custom&lang.ts\\") | ||
}; | ||
export const customQueryObject = { | ||
\\"./sibling.ts\\": () => import(\\"./sibling.ts?foo=bar&raw=true&lang.ts\\") | ||
}; | ||
export const parent = { | ||
}; | ||
export const rootMixedRelative = { | ||
\\"/css.spec.ts\\": () => import(\\"../../css.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), | ||
\\"/define.spec.ts\\": () => import(\\"../../define.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), | ||
\\"/import.spec.ts\\": () => import(\\"../../import.spec.ts?url&lang.ts\\").then(m => m[\\"default\\"]), | ||
\\"/importGlob/fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts?url&lang.ts\\").then(m => m[\\"default\\"]), | ||
\\"/importGlob/fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts?url&lang.ts\\").then(m => m[\\"default\\"]), | ||
\\"/importGlob/fixture-b/index.ts\\": () => import(\\"../fixture-b/index.ts?url&lang.ts\\").then(m => m[\\"default\\"]) | ||
}; | ||
export const cleverCwd1 = { | ||
\\"./node_modules/framework/pages/hello.page.js\\": () => import(\\"./node_modules/framework/pages/hello.page.js\\") | ||
}; | ||
export const cleverCwd2 = { | ||
\\"./modules/a.ts\\": () => import(\\"./modules/a.ts\\"), | ||
\\"./modules/b.ts\\": () => import(\\"./modules/b.ts\\"), | ||
\\"../fixture-b/a.ts\\": () => import(\\"../fixture-b/a.ts\\"), | ||
\\"../fixture-b/b.ts\\": () => import(\\"../fixture-b/b.ts\\") | ||
}; | ||
" | ||
`; | ||
|
||
exports[`fixture > virtual modules 1`] = ` | ||
"{ | ||
\\"/modules/a.ts\\": () => import(\\"/modules/a.ts\\"), | ||
\\"/modules/b.ts\\": () => import(\\"/modules/b.ts\\"), | ||
\\"/modules/index.ts\\": () => import(\\"/modules/index.ts\\") | ||
} | ||
{ | ||
\\"/../fixture-b/a.ts\\": () => import(\\"/../fixture-b/a.ts\\"), | ||
\\"/../fixture-b/b.ts\\": () => import(\\"/../fixture-b/b.ts\\"), | ||
\\"/../fixture-b/index.ts\\": () => import(\\"/../fixture-b/index.ts\\") | ||
}" | ||
`; |
1 change: 1 addition & 0 deletions
1
packages/vite/src/node/__tests__/plugins/importGlob/fixture-a/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!/node_modules/ |
Oops, something went wrong.