Skip to content

Commit 9ff4513

Browse files
committed
feat: update rolldown
also use native reporter plugin for output generation hooks when native plugins are enabled
1 parent 284487e commit 9ff4513

File tree

5 files changed

+102
-96
lines changed

5 files changed

+102
-96
lines changed

packages/vite/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@
8585
},
8686
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
8787
"dependencies": {
88-
"@oxc-project/runtime": "0.68.1",
88+
"@oxc-project/runtime": "0.69.0",
8989
"fdir": "^6.4.4",
9090
"lightningcss": "^1.29.3",
9191
"picomatch": "^4.0.2",
9292
"postcss": "^8.5.3",
93-
"rolldown": "1.0.0-beta.8-commit.c76291c",
93+
"rolldown": "1.0.0-beta.8-commit.8951737",
9494
"tinyglobby": "^0.2.13"
9595
},
9696
"optionalDependencies": {
@@ -100,7 +100,7 @@
100100
"@ampproject/remapping": "^2.3.0",
101101
"@babel/parser": "^7.27.0",
102102
"@jridgewell/trace-mapping": "^0.3.25",
103-
"@oxc-project/types": "0.68.1",
103+
"@oxc-project/types": "0.69.0",
104104
"@polka/compression": "^1.0.0-next.25",
105105
"@rollup/plugin-alias": "^5.1.1",
106106
"@rollup/plugin-commonjs": "^28.0.3",

packages/vite/src/node/build.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type {
2626
import {
2727
loadFallbackPlugin as nativeLoadFallbackPlugin,
2828
manifestPlugin as nativeManifestPlugin,
29+
reportPlugin as nativeReportPlugin,
2930
} from 'rolldown/experimental'
3031
import type { RollupCommonJSOptions } from 'dep-types/commonjs'
3132
import type { RollupDynamicImportVarsOptions } from 'dep-types/dynamicImportVars'
@@ -65,7 +66,7 @@ import {
6566
} from './utils'
6667
import { perEnvironmentPlugin, resolveEnvironmentPlugins } from './plugin'
6768
import { manifestPlugin } from './plugins/manifest'
68-
import type { Logger } from './logger'
69+
import { LogLevels, type Logger } from './logger'
6970
import { buildImportAnalysisPlugin } from './plugins/importAnalysisBuild'
7071
import { ssrManifestPlugin } from './ssr/ssrManifestPlugin'
7172
import { buildLoadFallbackPlugin } from './plugins/loadFallback'
@@ -522,7 +523,21 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{
522523
})
523524
: manifestPlugin(),
524525
ssrManifestPlugin(),
525-
...buildReporterPlugin(config),
526+
enableNativePlugin === true
527+
? perEnvironmentPlugin('vite:modules-reporter', (env) => {
528+
const tty = process.stdout.isTTY && !process.env.CI
529+
const shouldLogInfo =
530+
LogLevels[config.logLevel || 'info'] >= LogLevels.info
531+
return nativeReportPlugin({
532+
isTty: !!tty,
533+
isLib: !!env.config.build.lib,
534+
assetsDir: env.config.build.assetsDir,
535+
chunkLimit: env.config.build.chunkSizeWarningLimit,
536+
shouldLogInfo,
537+
reportCompressedSize: env.config.build.reportCompressedSize,
538+
})
539+
})
540+
: buildReporterPlugin(config),
526541
]
527542
: []),
528543
enableNativePlugin === true

packages/vite/src/node/plugins/reporter.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { gzip } from 'node:zlib'
33
import { promisify } from 'node:util'
44
import colors from 'picocolors'
55
import type { OutputBundle } from 'rolldown'
6-
import { reportPlugin as nativeReportPlugin } from 'rolldown/experimental'
7-
import { type Plugin, perEnvironmentPlugin } from '../plugin'
6+
import { type Plugin } from '../plugin'
87
import type { ResolvedConfig } from '../config'
98
import type { Environment } from '../environment'
109
import { perEnvironmentState } from '../environment'
@@ -27,7 +26,7 @@ type LogEntry = {
2726

2827
const COMPRESSIBLE_ASSETS_RE = /\.(?:html|json|svg|txt|xml|xhtml|wasm)$/
2928

30-
export function buildReporterPlugin(config: ResolvedConfig): Plugin[] {
29+
export function buildReporterPlugin(config: ResolvedConfig): Plugin {
3130
const compress = promisify(gzip)
3231

3332
const numberFormatter = new Intl.NumberFormat('en', {
@@ -271,7 +270,7 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin[] {
271270
}
272271
})
273272

274-
const jsPlugin: Plugin = {
273+
return {
275274
name: 'vite:reporter',
276275
sharedDuringBuild: true,
277276
perEnvironmentStartEndDuringDev: true,
@@ -338,20 +337,6 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin[] {
338337
await chunksReporter(this).log(output, dir)
339338
},
340339
}
341-
const plugins = [jsPlugin]
342-
343-
if (config.experimental.enableNativePlugin === true) {
344-
delete jsPlugin.transform
345-
delete jsPlugin.buildStart
346-
delete jsPlugin.buildEnd
347-
plugins.push(
348-
perEnvironmentPlugin('vite:modules-reporter', () =>
349-
nativeReportPlugin({ isTty: !!tty }),
350-
),
351-
)
352-
}
353-
354-
return plugins
355340
}
356341

357342
function writeLine(output: string) {

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"convert-source-map": "^2.0.0",
1111
"css-color-names": "^1.0.1",
1212
"kill-port": "^1.6.1",
13-
"rolldown": "1.0.0-beta.8-commit.c76291c"
13+
"rolldown": "1.0.0-beta.8-commit.8951737"
1414
}
1515
}

0 commit comments

Comments
 (0)