@@ -62,7 +62,8 @@ import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping'
62
62
import MagicString from 'magic-string'
63
63
import type { FSWatcher } from 'dep-types/chokidar'
64
64
import colors from 'picocolors'
65
- import { parseAst as rolldownParseAst } from '../parseAst'
65
+ import { parseAst as rolldownParseAst } from 'rolldown/parseAst'
66
+ import type { Program } from '@oxc-project/types'
66
67
import type { Plugin } from '../plugin'
67
68
import {
68
69
combineSourcemaps ,
@@ -121,10 +122,6 @@ export function throwClosedServerError(): never {
121
122
throw err
122
123
}
123
124
124
- // NOTE: add a env var to use parseAst from rollup for now
125
- const useLegacyParseAst = ! ! process . env . VITE_USE_LEGACY_PARSE_AST
126
- let legacyParseAst : typeof import ( 'rollup/parseAst' ) . parseAst
127
-
128
125
export interface PluginContainerOptions {
129
126
cwd ?: string
130
127
output ?: OutputOptions
@@ -149,9 +146,6 @@ export async function createEnvironmentPluginContainer(
149
146
watcher ,
150
147
autoStart ,
151
148
)
152
- if ( useLegacyParseAst ) {
153
- legacyParseAst = await import ( 'rollup/parseAst' ) . then ( ( mod ) => mod . parseAst )
154
- }
155
149
await container . resolveRollupOptions ( )
156
150
return container
157
151
}
@@ -625,10 +619,7 @@ class PluginContext
625
619
super ( _container . minimalContext . meta , _container . environment )
626
620
}
627
621
628
- parse ( code : string , opts : any ) {
629
- if ( useLegacyParseAst ) {
630
- return legacyParseAst ( code , opts )
631
- }
622
+ parse ( code : string , opts : any ) : Program {
632
623
return rolldownParseAst ( code , opts )
633
624
}
634
625
0 commit comments