Skip to content

Commit 67c965b

Browse files
authored
fix(deps): update @rollup/plugin-alias to v6.0.1 (#23862)
1 parent 6de44f3 commit 67c965b

7 files changed

Lines changed: 71 additions & 6 deletions

File tree

‎packages/vite/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"@jridgewell/remapping": "^2.3.5",
8181
"@jridgewell/trace-mapping": "^0.3.31",
8282
"@polka/compression": "^1.0.0-next.25",
83-
"@rollup/plugin-alias": "^6.0.0",
83+
"@rollup/plugin-alias": "^6.0.1",
8484
"@rollup/plugin-dynamic-import-vars": "2.1.4",
8585
"@rollup/pluginutils": "^5.4.0",
8686
"@types/escape-html": "^1.0.4",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'dollar-double'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'dollar-ampersand'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default 'regex-capture'

‎packages/vite/src/node/__tests__/resolve.spec.ts‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { EnvironmentOptions, InlineConfig } from '../config'
55
import { resolveSubpathImports } from '../plugins/resolve'
66
import { createServer } from '../server'
77
import { createServerModuleRunner } from '../ssr/runtime/serverModuleRunner'
8+
import { normalizePath } from '../utils'
89

910
for (const id of ['#hash#blocked', '#hash?blocked']) {
1011
test(`does not fall back from explicitly blocked imports key ${id}`, () => {
@@ -330,3 +331,63 @@ describe('file url', () => {
330331
expect(mod2.default.default).toBe('ok')
331332
})
332333
})
334+
335+
describe('alias replacement with $ patterns', () => {
336+
const fixtureDir = join(import.meta.dirname, 'fixtures/alias-special-pattern')
337+
338+
async function resolveWithAlias(
339+
alias: NonNullable<InlineConfig['resolve']>['alias'],
340+
id: string,
341+
) {
342+
const server = await createServer({
343+
configFile: false,
344+
root: import.meta.dirname,
345+
logLevel: 'error',
346+
resolve: { alias },
347+
// the scanner would otherwise crawl every HTML fixture under `__tests__`
348+
optimizeDeps: {
349+
noDiscovery: true,
350+
include: [],
351+
},
352+
server: {
353+
middlewareMode: true,
354+
ws: false,
355+
},
356+
})
357+
onTestFinished(() => server.close())
358+
// The SSR dev plugin container exercises @rollup/plugin-alias, which we want to test here.
359+
// Builds use Rolldown's native alias plugin for aliases.
360+
return server.environments.ssr.pluginContainer.resolveId(id)
361+
}
362+
363+
test('$$ in string replacement is inserted literally', async () => {
364+
const resolved = await resolveWithAlias(
365+
{ '@dollar-double': join(fixtureDir, '$$') },
366+
'@dollar-double',
367+
)
368+
expect(resolved?.id).toBe(normalizePath(join(fixtureDir, '$$/index.js')))
369+
})
370+
371+
test('$& in string replacement is inserted literally', async () => {
372+
const resolved = await resolveWithAlias(
373+
{ '@dollar-ampersand': join(fixtureDir, '$&') },
374+
'@dollar-ampersand',
375+
)
376+
expect(resolved?.id).toBe(normalizePath(join(fixtureDir, '$&/index.js')))
377+
})
378+
379+
test('capture groups in regex replacement still work', async () => {
380+
const resolved = await resolveWithAlias(
381+
[
382+
{
383+
find: /^@regex-capture\/(.*)$/,
384+
replacement: join(fixtureDir, 'regex-target') + '/$1',
385+
},
386+
],
387+
'@regex-capture/file',
388+
)
389+
expect(resolved?.id).toBe(
390+
normalizePath(join(fixtureDir, 'regex-target/file.js')),
391+
)
392+
})
393+
})

‎pnpm-lock.yaml‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ minimumReleaseAgeExclude:
7272
7373
7474
75+
- '@rollup/[email protected]'
7576
trustPolicy: no-downgrade
7677
trustPolicyExcludePrune: true
7778
trustPolicyExclude:

0 commit comments

Comments
 (0)