Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1befb90
feat: plugin hook filters
florian-lefebvre Dec 10, 2025
c383f54
wip
florian-lefebvre Dec 10, 2025
3feb29f
wip
florian-lefebvre Dec 10, 2025
5a5acbb
wip
florian-lefebvre Dec 10, 2025
c37813a
wip
florian-lefebvre Dec 10, 2025
3901a73
wip
florian-lefebvre Dec 10, 2025
fb6e01d
wip
florian-lefebvre Dec 10, 2025
e87df8d
wip
florian-lefebvre Dec 10, 2025
93c8cb2
wip
florian-lefebvre Dec 10, 2025
a3da79c
wip
florian-lefebvre Dec 10, 2025
e95e37e
wip
florian-lefebvre Dec 10, 2025
8f72ee4
wip
florian-lefebvre Dec 10, 2025
db456d0
wip
florian-lefebvre Dec 10, 2025
c76daa3
todos
florian-lefebvre Dec 10, 2025
e5a0b19
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 10, 2025
bf3a9ed
fix
florian-lefebvre Dec 10, 2025
8750f02
fix: vite plugin config alias
florian-lefebvre Dec 10, 2025
8b23c66
feat: load
florian-lefebvre Dec 10, 2025
ecbb025
fix: misc
florian-lefebvre Dec 10, 2025
46e78fc
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 10, 2025
e95d8e0
fix: regex
florian-lefebvre Dec 10, 2025
a358b76
fix: regex
florian-lefebvre Dec 10, 2025
da1cacd
fix: regex
florian-lefebvre Dec 10, 2025
6e5f017
fix: regex
florian-lefebvre Dec 11, 2025
4fa4903
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 11, 2025
477d1ab
fix: regex
florian-lefebvre Dec 11, 2025
863606e
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 11, 2025
5870997
fix: regex
florian-lefebvre Dec 11, 2025
3dc7098
improve regex
florian-lefebvre Dec 11, 2025
71a0b26
fix: unsufficient regex
florian-lefebvre Dec 11, 2025
fa7a8db
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 11, 2025
e362a45
chore: format
florian-lefebvre Dec 12, 2025
d0cae56
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 12, 2025
69bcb45
chore: format
florian-lefebvre Dec 12, 2025
dacba07
wip
florian-lefebvre Dec 12, 2025
547f756
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 15, 2025
4c44b63
feat: plugin hook filters (part 2) (#15000)
florian-lefebvre Dec 15, 2025
4c5f2f3
Merge branch 'next' into feat/plugin-hook-filters
florian-lefebvre Dec 15, 2025
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
Merge branch 'next' into feat/plugin-hook-filters
  • Loading branch information
florian-lefebvre committed Dec 10, 2025
commit 46e78fcdfb727cf7433229c32c2bd158af2bcf3d
49 changes: 0 additions & 49 deletions packages/astro/src/vite-plugin-config-alias/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ export default function configAliasVitePlugin({
},
};
},
configResolved(config) {
patchCreateResolver(config, plugin);
},
resolveId: {
filter: {
id: {
Expand Down Expand Up @@ -169,49 +166,3 @@ export default function configAliasVitePlugin({

return plugin;
}

/**
* Vite's `createResolver` is used to resolve various things, including CSS `@import`.
* We use vite.resolve.alias with custom resolvers to handle tsconfig paths in most cases,
* but for CSS imports, we still need to patch createResolver as vite.resolve.alias
* doesn't apply there. This function patches createResolver to inject our custom resolver.
*
* TODO: Remove this function once all tests pass with only the vite.resolve.alias approach,
* which means CSS @import resolution will work without patching createResolver.
*/
function patchCreateResolver(config: ResolvedConfig, postPlugin: VitePlugin) {
const _createResolver = config.createResolver;
// @ts-expect-error override readonly property intentionally
config.createResolver = function (...args1: any) {
const resolver = _createResolver.apply(config, args1);
return async function (...args2: any) {
const id: string = args2[0];
const importer: string | undefined = args2[1];
const ssr: boolean | undefined = args2[3];

// fast path so we don't run this extensive logic in prebundling
if (importer?.includes('node_modules')) {
return resolver.apply(_createResolver, args2);
}

const fakePluginContext = {
resolve: (_id: string, _importer?: string) => resolver(_id, _importer, false, ssr),
};
const fakeResolveIdOpts = {
assertions: {},
isEntry: false,
ssr,
};

const result = await resolver.apply(_createResolver, args2);
if (result) return result;

// @ts-expect-error resolveId exists
const resolved = await (typeof postPlugin.resolveId === 'function'
? postPlugin.resolveId
: postPlugin.resolveId?.handler
).apply(fakePluginContext, [id, importer, fakeResolveIdOpts]);
if (resolved) return resolved;
};
};
}
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.