-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
/
pluginContainer.ts
806 lines (738 loc) · 23.1 KB
/
pluginContainer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
/**
* This file is refactored into TypeScript based on
* https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
*/
/**
https://github.com/preactjs/wmr/blob/master/LICENSE
MIT License
Copyright (c) 2020 The Preact Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import fs from 'node:fs'
import { join } from 'node:path'
import { performance } from 'node:perf_hooks'
import { VERSION as rollupVersion } from 'rollup'
import type {
AsyncPluginHooks,
CustomPluginOptions,
EmittedFile,
FunctionPluginHooks,
InputOptions,
LoadResult,
MinimalPluginContext,
ModuleInfo,
ModuleOptions,
NormalizedInputOptions,
OutputOptions,
ParallelPluginHooks,
PartialNull,
PartialResolvedId,
ResolvedId,
RollupError,
RollupLog,
PluginContext as RollupPluginContext,
SourceDescription,
SourceMap,
TransformResult,
} from 'rollup'
import * as acorn from 'acorn'
import type { RawSourceMap } from '@ampproject/remapping'
import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping'
import MagicString from 'magic-string'
import type { FSWatcher } from 'chokidar'
import colors from 'picocolors'
import type * as postcss from 'postcss'
import type { Plugin } from '../plugin'
import {
arraify,
cleanUrl,
combineSourcemaps,
createDebugger,
ensureWatchedFile,
generateCodeFrame,
isExternalUrl,
isObject,
normalizePath,
numberToPos,
prettifyUrl,
timeFrom,
unwrapId,
} from '../utils'
import { FS_PREFIX } from '../constants'
import type { ResolvedConfig } from '../config'
import { createPluginHookUtils } from '../plugins'
import { buildErrorMessage } from './middlewares/error'
import type { ModuleGraph } from './moduleGraph'
const noop = () => {}
export const ERR_CLOSED_SERVER = 'ERR_CLOSED_SERVER'
export function throwClosedServerError(): never {
const err: any = new Error(
'The server is being restarted or closed. Request is outdated',
)
err.code = ERR_CLOSED_SERVER
// This error will be caught by the transform middleware that will
// send a 504 status code request timeout
throw err
}
export interface PluginContainerOptions {
cwd?: string
output?: OutputOptions
modules?: Map<string, { info: ModuleInfo }>
writeFile?: (name: string, source: string | Uint8Array) => void
}
export interface PluginContainer {
options: InputOptions
getModuleInfo(id: string): ModuleInfo | null
buildStart(options: InputOptions): Promise<void>
resolveId(
id: string,
importer?: string,
options?: {
assertions?: Record<string, string>
custom?: CustomPluginOptions
skip?: Set<Plugin>
ssr?: boolean
/**
* @internal
*/
scan?: boolean
isEntry?: boolean
},
): Promise<PartialResolvedId | null>
transform(
code: string,
id: string,
options?: {
inMap?: SourceDescription['map']
ssr?: boolean
},
): Promise<{ code: string; map: SourceMap | null }>
load(
id: string,
options?: {
ssr?: boolean
},
): Promise<LoadResult | null>
close(): Promise<void>
}
type PluginContext = Omit<
RollupPluginContext,
// not documented
| 'cache'
// deprecated
| 'moduleIds'
>
export let parser = acorn.Parser
export async function createPluginContainer(
config: ResolvedConfig,
moduleGraph?: ModuleGraph,
watcher?: FSWatcher,
): Promise<PluginContainer> {
const {
plugins,
logger,
root,
build: { rollupOptions },
} = config
const { getSortedPluginHooks, getSortedPlugins } =
createPluginHookUtils(plugins)
const seenResolves: Record<string, true | undefined> = {}
const debugResolve = createDebugger('vite:resolve')
const debugPluginResolve = createDebugger('vite:plugin-resolve', {
onlyWhenFocused: 'vite:plugin',
})
const debugPluginTransform = createDebugger('vite:plugin-transform', {
onlyWhenFocused: 'vite:plugin',
})
const debugSourcemapCombineFilter =
process.env.DEBUG_VITE_SOURCEMAP_COMBINE_FILTER
const debugSourcemapCombine = createDebugger('vite:sourcemap-combine', {
onlyWhenFocused: true,
})
// ---------------------------------------------------------------------------
const watchFiles = new Set<string>()
const minimalContext: MinimalPluginContext = {
meta: {
rollupVersion,
watchMode: true,
},
debug: noop,
info: noop,
warn: noop,
// @ts-expect-error noop
error: noop,
}
function warnIncompatibleMethod(method: string, plugin: string) {
logger.warn(
colors.cyan(`[plugin:${plugin}] `) +
colors.yellow(
`context method ${colors.bold(
`${method}()`,
)} is not supported in serve mode. This plugin is likely not vite-compatible.`,
),
)
}
// parallel, ignores returns
async function hookParallel<H extends AsyncPluginHooks & ParallelPluginHooks>(
hookName: H,
context: (plugin: Plugin) => ThisType<FunctionPluginHooks[H]>,
args: (plugin: Plugin) => Parameters<FunctionPluginHooks[H]>,
): Promise<void> {
const parallelPromises: Promise<unknown>[] = []
for (const plugin of getSortedPlugins(hookName)) {
// Don't throw here if closed, so buildEnd and closeBundle hooks can finish running
const hook = plugin[hookName]
if (!hook) continue
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore hook is not a primitive
const handler: Function = 'handler' in hook ? hook.handler : hook
if ((hook as { sequential?: boolean }).sequential) {
await Promise.all(parallelPromises)
parallelPromises.length = 0
await handler.apply(context(plugin), args(plugin))
} else {
parallelPromises.push(handler.apply(context(plugin), args(plugin)))
}
}
await Promise.all(parallelPromises)
}
// throw when an unsupported ModuleInfo property is accessed,
// so that incompatible plugins fail in a non-cryptic way.
const ModuleInfoProxy: ProxyHandler<ModuleInfo> = {
get(info: any, key: string) {
if (key in info) {
return info[key]
}
// Don't throw an error when returning from an async function
if (key === 'then') {
return undefined
}
throw Error(
`[vite] The "${key}" property of ModuleInfo is not supported.`,
)
},
}
// same default value of "moduleInfo.meta" as in Rollup
const EMPTY_OBJECT = Object.freeze({})
function getModuleInfo(id: string) {
const module = moduleGraph?.getModuleById(id)
if (!module) {
return null
}
if (!module.info) {
module.info = new Proxy(
{ id, meta: module.meta || EMPTY_OBJECT } as ModuleInfo,
ModuleInfoProxy,
)
}
return module.info
}
function updateModuleInfo(id: string, { meta }: { meta?: object | null }) {
if (meta) {
const moduleInfo = getModuleInfo(id)
if (moduleInfo) {
moduleInfo.meta = { ...moduleInfo.meta, ...meta }
}
}
}
// we should create a new context for each async hook pipeline so that the
// active plugin in that pipeline can be tracked in a concurrency-safe manner.
// using a class to make creating new contexts more efficient
class Context implements PluginContext {
meta = minimalContext.meta
ssr = false
_scan = false
_activePlugin: Plugin | null
_activeId: string | null = null
_activeCode: string | null = null
_resolveSkips?: Set<Plugin>
_addedImports: Set<string> | null = null
constructor(initialPlugin?: Plugin) {
this._activePlugin = initialPlugin || null
}
parse(code: string, opts: any = {}) {
return parser.parse(code, {
sourceType: 'module',
ecmaVersion: 'latest',
locations: true,
...opts,
})
}
async resolve(
id: string,
importer?: string,
options?: {
assertions?: Record<string, string>
custom?: CustomPluginOptions
isEntry?: boolean
skipSelf?: boolean
},
) {
let skip: Set<Plugin> | undefined
if (options?.skipSelf && this._activePlugin) {
skip = new Set(this._resolveSkips)
skip.add(this._activePlugin)
}
let out = await container.resolveId(id, importer, {
assertions: options?.assertions,
custom: options?.custom,
isEntry: !!options?.isEntry,
skip,
ssr: this.ssr,
scan: this._scan,
})
if (typeof out === 'string') out = { id: out }
return out as ResolvedId | null
}
async load(
options: {
id: string
resolveDependencies?: boolean
} & Partial<PartialNull<ModuleOptions>>,
): Promise<ModuleInfo> {
// We may not have added this to our module graph yet, so ensure it exists
await moduleGraph?.ensureEntryFromUrl(unwrapId(options.id), this.ssr)
// Not all options passed to this function make sense in the context of loading individual files,
// but we can at least update the module info properties we support
updateModuleInfo(options.id, options)
await container.load(options.id, { ssr: this.ssr })
const moduleInfo = this.getModuleInfo(options.id)
// This shouldn't happen due to calling ensureEntryFromUrl, but 1) our types can't ensure that
// and 2) moduleGraph may not have been provided (though in the situations where that happens,
// we should never have plugins calling this.load)
if (!moduleInfo)
throw Error(`Failed to load module with id ${options.id}`)
return moduleInfo
}
getModuleInfo(id: string) {
return getModuleInfo(id)
}
getModuleIds() {
return moduleGraph
? moduleGraph.idToModuleMap.keys()
: Array.prototype[Symbol.iterator]()
}
addWatchFile(id: string) {
watchFiles.add(id)
;(this._addedImports || (this._addedImports = new Set())).add(id)
if (watcher) ensureWatchedFile(watcher, id, root)
}
getWatchFiles() {
return [...watchFiles]
}
emitFile(assetOrFile: EmittedFile) {
warnIncompatibleMethod(`emitFile`, this._activePlugin!.name)
return ''
}
setAssetSource() {
warnIncompatibleMethod(`setAssetSource`, this._activePlugin!.name)
}
getFileName() {
warnIncompatibleMethod(`getFileName`, this._activePlugin!.name)
return ''
}
warn(
e: string | RollupLog | (() => string | RollupLog),
position?: number | { column: number; line: number },
) {
const err = formatError(typeof e === 'function' ? e() : e, position, this)
const msg = buildErrorMessage(
err,
[colors.yellow(`warning: ${err.message}`)],
false,
)
logger.warn(msg, {
clear: true,
timestamp: true,
})
}
error(
e: string | RollupError,
position?: number | { column: number; line: number },
): never {
// error thrown here is caught by the transform middleware and passed on
// the the error middleware.
throw formatError(e, position, this)
}
debug = noop
info = noop
}
function formatError(
e: string | RollupError,
position: number | { column: number; line: number } | undefined,
ctx: Context,
) {
const err = (
typeof e === 'string' ? new Error(e) : e
) as postcss.CssSyntaxError & RollupError
if (err.pluginCode) {
return err // The plugin likely called `this.error`
}
if (err.file && err.name === 'CssSyntaxError') {
err.id = normalizePath(err.file)
}
if (ctx._activePlugin) err.plugin = ctx._activePlugin.name
if (ctx._activeId && !err.id) err.id = ctx._activeId
if (ctx._activeCode) {
err.pluginCode = ctx._activeCode
// some rollup plugins, e.g. json, sets err.position instead of err.pos
const pos = position ?? err.pos ?? (err as any).position
if (pos != null) {
let errLocation
try {
errLocation = numberToPos(ctx._activeCode, pos)
} catch (err2) {
logger.error(
colors.red(
`Error in error handler:\n${err2.stack || err2.message}\n`,
),
// print extra newline to separate the two errors
{ error: err2 },
)
throw err
}
err.loc = err.loc || {
file: err.id,
...errLocation,
}
err.frame = err.frame || generateCodeFrame(ctx._activeCode, pos)
} else if (err.loc) {
// css preprocessors may report errors in an included file
if (!err.frame) {
let code = ctx._activeCode
if (err.loc.file) {
err.id = normalizePath(err.loc.file)
try {
code = fs.readFileSync(err.loc.file, 'utf-8')
} catch {}
}
err.frame = generateCodeFrame(code, err.loc)
}
} else if ((err as any).line && (err as any).column) {
err.loc = {
file: err.id,
line: (err as any).line,
column: (err as any).column,
}
err.frame = err.frame || generateCodeFrame(err.id!, err.loc)
}
if (
ctx instanceof TransformContext &&
typeof err.loc?.line === 'number' &&
typeof err.loc?.column === 'number'
) {
const rawSourceMap = ctx._getCombinedSourcemap()
if (rawSourceMap) {
const traced = new TraceMap(rawSourceMap as any)
const { source, line, column } = originalPositionFor(traced, {
line: Number(err.loc.line),
column: Number(err.loc.column),
})
if (source && line != null && column != null) {
err.loc = { file: source, line, column }
}
}
}
} else if (err.loc) {
if (!err.frame) {
let code = err.pluginCode
if (err.loc.file) {
err.id = normalizePath(err.loc.file)
if (!code) {
try {
code = fs.readFileSync(err.loc.file, 'utf-8')
} catch {}
}
}
if (code) {
err.frame = generateCodeFrame(`${code}`, err.loc)
}
}
}
if (
typeof err.loc?.column !== 'number' &&
typeof err.loc?.line !== 'number' &&
!err.loc?.file
) {
delete err.loc
}
return err
}
class TransformContext extends Context {
filename: string
originalCode: string
originalSourcemap: SourceMap | null = null
sourcemapChain: NonNullable<SourceDescription['map']>[] = []
combinedMap: SourceMap | null = null
constructor(filename: string, code: string, inMap?: SourceMap | string) {
super()
this.filename = filename
this.originalCode = code
if (inMap) {
if (debugSourcemapCombine) {
// @ts-expect-error inject name for debug purpose
inMap.name = '$inMap'
}
this.sourcemapChain.push(inMap)
}
}
_getCombinedSourcemap(createIfNull = false) {
if (
debugSourcemapCombine &&
debugSourcemapCombineFilter &&
this.filename.includes(debugSourcemapCombineFilter)
) {
debugSourcemapCombine('----------', this.filename)
debugSourcemapCombine(this.combinedMap)
debugSourcemapCombine(this.sourcemapChain)
debugSourcemapCombine('----------')
}
let combinedMap = this.combinedMap
for (let m of this.sourcemapChain) {
if (typeof m === 'string') m = JSON.parse(m)
if (!('version' in (m as SourceMap))) {
// empty, nullified source map
combinedMap = this.combinedMap = null
this.sourcemapChain.length = 0
break
}
if (!combinedMap) {
combinedMap = m as SourceMap
} else {
combinedMap = combineSourcemaps(cleanUrl(this.filename), [
m as RawSourceMap,
combinedMap as RawSourceMap,
]) as SourceMap
}
}
if (!combinedMap) {
return createIfNull
? new MagicString(this.originalCode).generateMap({
includeContent: true,
hires: 'boundary',
source: cleanUrl(this.filename),
})
: null
}
if (combinedMap !== this.combinedMap) {
this.combinedMap = combinedMap
this.sourcemapChain.length = 0
}
return this.combinedMap
}
getCombinedSourcemap() {
return this._getCombinedSourcemap(true) as SourceMap
}
}
let closed = false
const processesing = new Set<Promise<any>>()
// keeps track of hook promises so that we can wait for them all to finish upon closing the server
function handleHookPromise<T>(maybePromise: undefined | T | Promise<T>) {
if (!(maybePromise as any)?.then) {
return maybePromise
}
const promise = maybePromise as Promise<T>
processesing.add(promise)
return promise.finally(() => processesing.delete(promise))
}
const container: PluginContainer = {
options: await (async () => {
let options = rollupOptions
for (const optionsHook of getSortedPluginHooks('options')) {
if (closed) throwClosedServerError()
options =
(await handleHookPromise(
optionsHook.call(minimalContext, options),
)) || options
}
if (options.acornInjectPlugins) {
parser = acorn.Parser.extend(
...(arraify(options.acornInjectPlugins) as any),
)
}
return {
acorn,
acornInjectPlugins: [],
...options,
}
})(),
getModuleInfo,
async buildStart() {
await handleHookPromise(
hookParallel(
'buildStart',
(plugin) => new Context(plugin),
() => [container.options as NormalizedInputOptions],
),
)
},
async resolveId(rawId, importer = join(root, 'index.html'), options) {
const skip = options?.skip
const ssr = options?.ssr
const scan = !!options?.scan
const ctx = new Context()
ctx.ssr = !!ssr
ctx._scan = scan
ctx._resolveSkips = skip
const resolveStart = debugResolve ? performance.now() : 0
let id: string | null = null
const partial: Partial<PartialResolvedId> = {}
for (const plugin of getSortedPlugins('resolveId')) {
if (closed && !ssr) throwClosedServerError()
if (!plugin.resolveId) continue
if (skip?.has(plugin)) continue
ctx._activePlugin = plugin
const pluginResolveStart = debugPluginResolve ? performance.now() : 0
const handler =
'handler' in plugin.resolveId
? plugin.resolveId.handler
: plugin.resolveId
const result = await handleHookPromise(
handler.call(ctx as any, rawId, importer, {
assertions: options?.assertions ?? {},
custom: options?.custom,
isEntry: !!options?.isEntry,
ssr,
scan,
}),
)
if (!result) continue
if (typeof result === 'string') {
id = result
} else {
id = result.id
Object.assign(partial, result)
}
debugPluginResolve?.(
timeFrom(pluginResolveStart),
plugin.name,
prettifyUrl(id, root),
)
// resolveId() is hookFirst - first non-null result is returned.
break
}
if (debugResolve && rawId !== id && !rawId.startsWith(FS_PREFIX)) {
const key = rawId + id
// avoid spamming
if (!seenResolves[key]) {
seenResolves[key] = true
debugResolve(
`${timeFrom(resolveStart)} ${colors.cyan(rawId)} -> ${colors.dim(
id,
)}`,
)
}
}
if (id) {
partial.id = isExternalUrl(id) ? id : normalizePath(id)
return partial as PartialResolvedId
} else {
return null
}
},
async load(id, options) {
const ssr = options?.ssr
const ctx = new Context()
ctx.ssr = !!ssr
for (const plugin of getSortedPlugins('load')) {
if (closed && !ssr) throwClosedServerError()
if (!plugin.load) continue
ctx._activePlugin = plugin
const handler =
'handler' in plugin.load ? plugin.load.handler : plugin.load
const result = await handleHookPromise(
handler.call(ctx as any, id, { ssr }),
)
if (result != null) {
if (isObject(result)) {
updateModuleInfo(id, result)
}
return result
}
}
return null
},
async transform(code, id, options) {
const inMap = options?.inMap
const ssr = options?.ssr
const ctx = new TransformContext(id, code, inMap as SourceMap)
ctx.ssr = !!ssr
for (const plugin of getSortedPlugins('transform')) {
if (closed && !ssr) throwClosedServerError()
if (!plugin.transform) continue
ctx._activePlugin = plugin
ctx._activeId = id
ctx._activeCode = code
const start = debugPluginTransform ? performance.now() : 0
let result: TransformResult | string | undefined
const handler =
'handler' in plugin.transform
? plugin.transform.handler
: plugin.transform
try {
result = await handleHookPromise(
handler.call(ctx as any, code, id, { ssr }),
)
} catch (e) {
ctx.error(e)
}
if (!result) continue
debugPluginTransform?.(
timeFrom(start),
plugin.name,
prettifyUrl(id, root),
)
if (isObject(result)) {
if (result.code !== undefined) {
code = result.code
if (result.map) {
if (debugSourcemapCombine) {
// @ts-expect-error inject plugin name for debug purpose
result.map.name = plugin.name
}
ctx.sourcemapChain.push(result.map)
}
}
updateModuleInfo(id, result)
} else {
code = result
}
}
return {
code,
map: ctx._getCombinedSourcemap(),
}
},
async close() {
if (closed) return
closed = true
await Promise.allSettled(Array.from(processesing))
const ctx = new Context()
await hookParallel(
'buildEnd',
() => ctx,
() => [],
)
await hookParallel(
'closeBundle',
() => ctx,
() => [],
)
},
}
return container
}