Skip to content

Commit 45f9e16

Browse files
committed
chore: comment unsupport feature
1 parent 3811bc8 commit 45f9e16

14 files changed

+124
-117
lines changed

packages/vite/rollup.dts.config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ const identifierWithTrailingDollarRE = /\b(\w+)\$\d+\b/g
4646
* the module that imports the identifer as a named import alias
4747
*/
4848
const identifierReplacements: Record<string, Record<string, string>> = {
49-
rollup: {
50-
Plugin$1: 'rollup.Plugin',
51-
TransformResult$2: 'rollup.TransformResult',
49+
// rollup: {
50+
// Plugin$1: 'rollup.Plugin',
51+
// TransformResult$2: 'rollup.TransformResult',
52+
// },
53+
rolldown: {
54+
Plugin$1: 'rolldown.Plugin',
55+
TransformResult$2: 'rolldown.TransformResult',
5256
},
5357
esbuild: {
5458
TransformResult$1: 'esbuild_TransformResult',

packages/vite/src/node/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ export async function resolveConfig(
641641
aliasContainer ||
642642
(aliasContainer = await createPluginContainer({
643643
...resolved,
644+
// @ts-expect-error the aliasPlugin using rollup types
644645
plugins: [aliasPlugin({ entries: resolved.resolve.alias })],
645646
}))
646647
} else {
@@ -649,6 +650,7 @@ export async function resolveConfig(
649650
(resolverContainer = await createPluginContainer({
650651
...resolved,
651652
plugins: [
653+
// @ts-expect-error the aliasPlugin using rollup types
652654
aliasPlugin({ entries: resolved.resolve.alias }),
653655
resolvePlugin({
654656
...resolved.resolve,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
320320
const resolved = await this.resolve(url, importerFile)
321321

322322
// TODO @underfin `ResolveResult#meta`
323-
if (!resolved || resolved.meta?.['vite:alias']?.noResolved) {
323+
if (!resolved /* || resolved.meta?.['vite:alias']?.noResolved */) {
324324
// in ssr, we should let node handle the missing modules
325325
if (ssr) {
326326
return [url, url]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
SpreadElement,
1111
TemplateLiteral,
1212
} from 'estree'
13-
import type { CustomPluginOptions, RollupError } from 'rolldown'
13+
import type { /* CustomPluginOptions, */ RollupError } from 'rolldown'
1414
import MagicString from 'magic-string'
1515
import fg from 'fast-glob'
1616
import { stringifyQuery } from 'ufo'

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,21 @@ export function getSortedPluginsByHook<K extends keyof Plugin>(
143143
const sortedPlugins: Plugin[] = []
144144
// Use indexes to track and insert the ordered plugins directly in the
145145
// resulting array to avoid creating 3 extra temporary arrays per hook
146-
let pre = 0,
147-
normal = 0,
148-
post = 0
146+
const pre = 0;
147+
let normal = 0;
148+
// post = 0
149149
for (const plugin of plugins) {
150150
const hook = plugin[hookName]
151151
if (hook) {
152152
if (typeof hook === 'object') {
153-
if (hook.order === 'pre') {
154-
sortedPlugins.splice(pre++, 0, plugin)
155-
continue
156-
}
157-
if (hook.order === 'post') {
158-
sortedPlugins.splice(pre + normal + post++, 0, plugin)
159-
continue
160-
}
153+
// if (hook.order === 'pre') {
154+
// sortedPlugins.splice(pre++, 0, plugin)
155+
// continue
156+
// }
157+
// if (hook.order === 'post') {
158+
// sortedPlugins.splice(pre + normal + post++, 0, plugin)
159+
// continue
160+
// }
161161
}
162162
sortedPlugins.splice(pre + normal++, 0, plugin)
163163
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
117117

118118
renderChunk(code, chunk, options) {
119119
// TODO @underfin
120+
// @ts-expect-error
120121
if (!options.inlineDynamicImports) {
121122
for (const id of chunk.moduleIds) {
122123
const module = this.getModuleInfo(id)

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

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type {
22
GetManualChunk,
33
GetModuleInfo,
4-
ManualChunkMeta,
5-
OutputOptions,
4+
// ManualChunkMeta,
5+
// OutputOptions,
66
} from 'rollup'
7-
import { arraify, isInNodeModules } from '../utils'
8-
import type { UserConfig } from '../../node'
7+
import { /* arraify, */ isInNodeModules } from '../utils'
8+
// import type { UserConfig } from '../../node'
99
import type { Plugin } from '../plugin'
1010

1111
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
@@ -97,58 +97,58 @@ function staticImportedByEntry(
9797
* @deprecated use build.rollupOptions.output.manualChunks or framework specific configuration
9898
*/
9999
export function splitVendorChunkPlugin(): Plugin {
100-
const caches: SplitVendorChunkCache[] = []
101-
function createSplitVendorChunk(output: OutputOptions, config: UserConfig) {
102-
const cache = new SplitVendorChunkCache()
103-
caches.push(cache)
104-
const build = config.build ?? {}
105-
const format = output?.format
106-
if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
107-
return splitVendorChunk({ cache })
108-
}
109-
}
100+
// const caches: SplitVendorChunkCache[] = []
101+
// function createSplitVendorChunk(output: OutputOptions, config: UserConfig) {
102+
// const cache = new SplitVendorChunkCache()
103+
// caches.push(cache)
104+
// const build = config.build ?? {}
105+
// const format = output?.format
106+
// if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
107+
// return splitVendorChunk({ cache })
108+
// }
109+
// }
110110
return {
111111
name: 'vite:split-vendor-chunk',
112-
config(config) {
113-
let output = config?.build?.rollupOptions?.output
114-
if (output) {
115-
// outputs = arraify(outputs)
116-
// for (const output of outputs) {
117-
const viteManualChunks = createSplitVendorChunk(output, config)
118-
if (viteManualChunks) {
119-
if (output.manualChunks) {
120-
if (typeof output.manualChunks === 'function') {
121-
const userManualChunks = output.manualChunks
122-
output.manualChunks = (id: string, api: ManualChunkMeta) => {
123-
return userManualChunks(id, api) ?? viteManualChunks(id, api)
124-
}
125-
} else {
126-
// else, leave the object form of manualChunks untouched, as
127-
// we can't safely replicate rollup handling.
128-
// eslint-disable-next-line no-console
129-
console.warn(
130-
"(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead.",
131-
)
132-
}
133-
} else {
134-
output.manualChunks = viteManualChunks
135-
}
136-
}
137-
// }
138-
} else {
139-
return {
140-
build: {
141-
rollupOptions: {
142-
output: {
143-
manualChunks: createSplitVendorChunk({}, config),
144-
},
145-
},
146-
},
147-
}
148-
}
149-
},
150-
buildStart() {
151-
caches.forEach((cache) => cache.reset())
152-
},
112+
// config(config) {
113+
// let output = config?.build?.rollupOptions?.output
114+
// if (output) {
115+
// // outputs = arraify(outputs)
116+
// // for (const output of outputs) {
117+
// const viteManualChunks = createSplitVendorChunk(output, config)
118+
// if (viteManualChunks) {
119+
// if (output.manualChunks) {
120+
// if (typeof output.manualChunks === 'function') {
121+
// const userManualChunks = output.manualChunks
122+
// output.manualChunks = (id: string, api: ManualChunkMeta) => {
123+
// return userManualChunks(id, api) ?? viteManualChunks(id, api)
124+
// }
125+
// } else {
126+
// // else, leave the object form of manualChunks untouched, as
127+
// // we can't safely replicate rollup handling.
128+
// // eslint-disable-next-line no-console
129+
// console.warn(
130+
// "(!) the `splitVendorChunk` plugin doesn't have any effect when using the object form of `build.rollupOptions.output.manualChunks`. Consider using the function form instead.",
131+
// )
132+
// }
133+
// } else {
134+
// output.manualChunks = viteManualChunks
135+
// }
136+
// }
137+
// // }
138+
// } else {
139+
// return {
140+
// build: {
141+
// rollupOptions: {
142+
// output: {
143+
// manualChunks: createSplitVendorChunk({}, config),
144+
// },
145+
// },
146+
// },
147+
// }
148+
// }
149+
// },
150+
// buildStart() {
151+
// caches.forEach((cache) => cache.reset())
152+
// },
153153
}
154154
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ export function terserPlugin(config: ResolvedConfig): Plugin {
9494
}
9595
},
9696

97-
closeBundle() {
98-
worker?.stop()
99-
},
97+
// closeBundle() {
98+
// worker?.stop()
99+
// },
100100
}
101101
}

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

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,25 @@ export function webWorkerPostPlugin(): Plugin {
180180
return {
181181
name: 'vite:worker-post',
182182
// TODO @underfin it's not unsupported yet
183-
resolveImportMeta(property, { format }) {
184-
// document is undefined in the worker, so we need to avoid it in iife
185-
if (format === 'iife') {
186-
// compiling import.meta
187-
if (!property) {
188-
// rollup only supports `url` property. we only support `url` property as well.
189-
// https://github.com/rollup/rollup/blob/62b648e1cc6a1f00260bb85aa2050097bb4afd2b/src/ast/nodes/MetaProperty.ts#L164-L173
190-
return `{
191-
url: self.location.href
192-
}`
193-
}
194-
// compiling import.meta.url
195-
if (property === 'url') {
196-
return 'self.location.href'
197-
}
198-
}
199-
200-
return null
201-
},
183+
// resolveImportMeta(property, { format }) {
184+
// // document is undefined in the worker, so we need to avoid it in iife
185+
// if (format === 'iife') {
186+
// // compiling import.meta
187+
// if (!property) {
188+
// // rollup only supports `url` property. we only support `url` property as well.
189+
// // https://github.com/rollup/rollup/blob/62b648e1cc6a1f00260bb85aa2050097bb4afd2b/src/ast/nodes/MetaProperty.ts#L164-L173
190+
// return `{
191+
// url: self.location.href
192+
// }`
193+
// }
194+
// // compiling import.meta.url
195+
// if (property === 'url') {
196+
// return 'self.location.href'
197+
// }
198+
// }
199+
200+
// return null
201+
// },
202202
}
203203
}
204204

@@ -232,11 +232,11 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
232232
},
233233

234234
// TODO @underfin it's not unsupported yet
235-
shouldTransformCachedModule({ id }) {
236-
if (isBuild && config.build.watch && workerOrSharedWorkerRE.test(id)) {
237-
return true
238-
}
239-
},
235+
// shouldTransformCachedModule({ id }) {
236+
// if (isBuild && config.build.watch && workerOrSharedWorkerRE.test(id)) {
237+
// return true
238+
// }
239+
// },
240240

241241
async transform(raw, id) {
242242
const workerFileMatch = workerFileRE.exec(id)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ export function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
118118
name: 'vite:worker-import-meta-url',
119119

120120
// TODO @underfin it's not unsupported yet
121-
shouldTransformCachedModule({ code }) {
122-
if (isBuild && config.build.watch && isIncludeWorkerImportMetaUrl(code)) {
123-
return true
124-
}
125-
},
121+
// shouldTransformCachedModule({ code }) {
122+
// if (isBuild && config.build.watch && isIncludeWorkerImportMetaUrl(code)) {
123+
// return true
124+
// }
125+
// },
126126

127127
async transform(code, id, options) {
128128
if (!options?.ssr && isIncludeWorkerImportMetaUrl(code)) {

packages/vite/src/node/server/middlewares/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import colors from 'picocolors'
2-
import type { RollupError } from 'rollup'
2+
import type { RollupError } from 'rolldown'
33
import type { Connect } from 'dep-types/connect'
44
import strip from 'strip-ansi'
55
import type { ErrorPayload } from 'types/hmrPayload'

packages/vite/src/node/server/middlewares/indexHtml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fsp from 'node:fs/promises'
22
import path from 'node:path'
33
import MagicString from 'magic-string'
4-
import type { SourceMapInput } from 'rollup'
4+
import type { SourceMapInput } from 'rolldown'
55
import type { Connect } from 'dep-types/connect'
66
import type { DefaultTreeAdapterMap, Token } from 'parse5'
77
import type { IndexHtmlTransformHook } from '../../plugins/html'

packages/vite/src/node/server/middlewares/transform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'node:path'
22
import fsp from 'node:fs/promises'
33
import type { Connect } from 'dep-types/connect'
44
import colors from 'picocolors'
5-
import type { ExistingRawSourceMap } from 'rollup'
5+
import type { ExistingRawSourceMap } from 'rolldown'
66
import type { ViteDevServer } from '..'
77
import {
88
createDebugger,

packages/vite/src/node/server/pluginContainer.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -525,21 +525,21 @@ class PluginContext implements Omit<RollupPluginContext, 'cache'> {
525525
id: string,
526526
importer?: string,
527527
options?: {
528-
attributes?: Record<string, string>
529-
custom?: CustomPluginOptions
530-
isEntry?: boolean
531-
skipSelf?: boolean
528+
// attributes?: Record<string, string>
529+
// custom?: CustomPluginOptions
530+
// isEntry?: boolean
531+
// skipSelf?: boolean
532532
},
533533
): ReturnType<RollupPluginContext['resolve']> {
534534
let skip: Set<Plugin> | undefined
535-
if (options?.skipSelf !== false && this._plugin) {
536-
skip = new Set(this._resolveSkips)
537-
skip.add(this._plugin)
538-
}
535+
// if (options?.skipSelf !== false && this._plugin) {
536+
// skip = new Set(this._resolveSkips)
537+
// skip.add(this._plugin)
538+
// }
539539
let out = await this._container.resolveId(id, importer, {
540-
attributes: options?.attributes,
541-
custom: options?.custom,
542-
isEntry: !!options?.isEntry,
540+
// attributes: options?.attributes,
541+
// custom: options?.custom,
542+
// isEntry: !!options?.isEntry,
543543
skip,
544544
ssr: this.ssr,
545545
scan: this._scan,

0 commit comments

Comments
 (0)