@rolldown/browser 1.0.0-beta.46 → 1.0.0-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-setup.mjs +3 -4
- package/dist/cli.mjs +22 -10
- package/dist/config.d.mts +3 -2
- package/dist/config.mjs +6 -5
- package/dist/constructors-EhfoQfqh.js +68 -0
- package/dist/experimental-index.browser.mjs +38 -117
- package/dist/experimental-index.d.mts +18 -58
- package/dist/experimental-index.mjs +41 -120
- package/dist/filter-index.d.mts +3 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +5 -5
- package/dist/{shared/parse-ast-index-DMI5m8Lk.mjs → normalize-string-or-regex-d47jXr3r.js} +38 -110
- package/dist/parallel-plugin-worker.mjs +7 -6
- package/dist/parallel-plugin.d.mts +3 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +2 -2
- package/dist/plugins-index.browser.mjs +39 -0
- package/dist/plugins-index.d.mts +31 -0
- package/dist/plugins-index.mjs +40 -0
- package/dist/rolldown-binding.wasi-browser.js +1 -1
- package/dist/rolldown-binding.wasi.cjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CCMrV5an.d.mts → binding-B4uTNiw2.d.mts} +49 -58
- package/dist/shared/constructors-CaN9lKj2.d.mts +32 -0
- package/dist/shared/constructors-DcEzB0nc.mjs +68 -0
- package/dist/shared/{define-config-Bj-neIhz.d.mts → define-config-Dv3i4cxM.d.mts} +4 -62
- package/dist/shared/{load-config-DnUAKl9P.mjs → load-config-B-QIvCpC.mjs} +2 -2
- package/dist/shared/logs-CPsamAuj.mjs +181 -0
- package/dist/shared/normalize-string-or-regex-CbDij6KB.mjs +46 -0
- package/dist/shared/parse-ast-index-D9jH_38U.mjs +81 -0
- package/dist/shared/{prompt-YGfbLmz5.mjs → prompt-Ckjl2FdJ.mjs} +1 -1
- package/dist/shared/{src-B8saaB3b.mjs → src-CvsuRKGv.mjs} +247 -224
- package/dist/shared/utils-CduIqa7h.d.mts +18 -0
- package/dist/{src-B-7Hrt6w.js → src-DLQqj5Wo.js} +234 -994
- package/package.json +1 -1
- package/dist/shared/binding-BeWSOIj5.mjs +0 -578
- /package/dist/shared/{composable-filters-CgRsnfr3.mjs → composable-filters-CBpK2Fbc.mjs} +0 -0
|
@@ -130,7 +130,6 @@ module.exports.transformAsync = __napiModule.exports.transformAsync
|
|
|
130
130
|
module.exports.BindingBundleEndEventData = __napiModule.exports.BindingBundleEndEventData
|
|
131
131
|
module.exports.BindingBundleErrorEventData = __napiModule.exports.BindingBundleErrorEventData
|
|
132
132
|
module.exports.BindingBundler = __napiModule.exports.BindingBundler
|
|
133
|
-
module.exports.BindingBundlerImpl = __napiModule.exports.BindingBundlerImpl
|
|
134
133
|
module.exports.BindingCallableBuiltinPlugin = __napiModule.exports.BindingCallableBuiltinPlugin
|
|
135
134
|
module.exports.BindingChunkingContext = __napiModule.exports.BindingChunkingContext
|
|
136
135
|
module.exports.BindingDevEngine = __napiModule.exports.BindingDevEngine
|
|
@@ -146,6 +145,7 @@ module.exports.BindingRenderedModule = __napiModule.exports.BindingRenderedModul
|
|
|
146
145
|
module.exports.BindingTransformPluginContext = __napiModule.exports.BindingTransformPluginContext
|
|
147
146
|
module.exports.BindingUrlResolver = __napiModule.exports.BindingUrlResolver
|
|
148
147
|
module.exports.BindingWatcher = __napiModule.exports.BindingWatcher
|
|
148
|
+
module.exports.BindingWatcherBundler = __napiModule.exports.BindingWatcherBundler
|
|
149
149
|
module.exports.BindingWatcherChangeData = __napiModule.exports.BindingWatcherChangeData
|
|
150
150
|
module.exports.BindingWatcherEvent = __napiModule.exports.BindingWatcherEvent
|
|
151
151
|
module.exports.ParallelJsPluginRegistry = __napiModule.exports.ParallelJsPluginRegistry
|
|
Binary file
|
|
@@ -4,10 +4,6 @@ import * as _oxc_project_types0 from "@oxc-project/types";
|
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
5
5
|
type VoidNullable<T = void> = T | null | undefined | void;
|
|
6
6
|
type BindingStringOrRegex = string | RegExp;
|
|
7
|
-
type BindingResult<T> = {
|
|
8
|
-
errors: BindingError[];
|
|
9
|
-
isBindingErrors: boolean;
|
|
10
|
-
} | T;
|
|
11
7
|
interface CodegenOptions {
|
|
12
8
|
/**
|
|
13
9
|
* Remove whitespace.
|
|
@@ -126,6 +122,8 @@ interface MangleOptionsKeepNames {
|
|
|
126
122
|
*/
|
|
127
123
|
class: boolean;
|
|
128
124
|
}
|
|
125
|
+
/** Minify synchronously. */
|
|
126
|
+
declare function minify(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): MinifyResult;
|
|
129
127
|
interface MinifyOptions {
|
|
130
128
|
/** Use when minifying an ES6 module. */
|
|
131
129
|
module?: boolean;
|
|
@@ -134,6 +132,11 @@ interface MinifyOptions {
|
|
|
134
132
|
codegen?: boolean | CodegenOptions;
|
|
135
133
|
sourcemap?: boolean;
|
|
136
134
|
}
|
|
135
|
+
interface MinifyResult {
|
|
136
|
+
code: string;
|
|
137
|
+
map?: SourceMap;
|
|
138
|
+
errors: Array<OxcError>;
|
|
139
|
+
}
|
|
137
140
|
interface Comment {
|
|
138
141
|
type: 'Line' | 'Block';
|
|
139
142
|
value: string;
|
|
@@ -227,6 +230,12 @@ type ImportNameKind = /** `import { x } from "mod"` */
|
|
|
227
230
|
'Name' | /** `import * as ns from "mod"` */
|
|
228
231
|
'NamespaceObject' | /** `import defaultExport from "mod"` */
|
|
229
232
|
'Default';
|
|
233
|
+
/**
|
|
234
|
+
* Parse asynchronously.
|
|
235
|
+
*
|
|
236
|
+
* Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
|
|
237
|
+
*/
|
|
238
|
+
declare function parseAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>;
|
|
230
239
|
interface ParserOptions {
|
|
231
240
|
/** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
|
|
232
241
|
lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
|
|
@@ -267,6 +276,8 @@ interface ParserOptions {
|
|
|
267
276
|
*/
|
|
268
277
|
showSemanticErrors?: boolean;
|
|
269
278
|
}
|
|
279
|
+
/** Parse synchronously. */
|
|
280
|
+
declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult;
|
|
270
281
|
interface Span {
|
|
271
282
|
start: number;
|
|
272
283
|
end: number;
|
|
@@ -1175,20 +1186,12 @@ interface TypeScriptOptions {
|
|
|
1175
1186
|
declare class BindingBundleEndEventData {
|
|
1176
1187
|
output: string;
|
|
1177
1188
|
duration: number;
|
|
1178
|
-
get result():
|
|
1189
|
+
get result(): BindingWatcherBundler;
|
|
1179
1190
|
}
|
|
1180
1191
|
declare class BindingBundleErrorEventData {
|
|
1181
|
-
get result():
|
|
1192
|
+
get result(): BindingWatcherBundler;
|
|
1182
1193
|
get error(): Array<BindingError>;
|
|
1183
1194
|
}
|
|
1184
|
-
declare class BindingBundlerImpl {
|
|
1185
|
-
write(): Promise<BindingResult<BindingOutputs>>;
|
|
1186
|
-
generate(): Promise<BindingResult<BindingOutputs>>;
|
|
1187
|
-
scan(): Promise<BindingResult<BindingOutputs>>;
|
|
1188
|
-
close(): Promise<void>;
|
|
1189
|
-
get closed(): boolean;
|
|
1190
|
-
getWatchFiles(): Promise<Array<string>>;
|
|
1191
|
-
}
|
|
1192
1195
|
declare class BindingMagicString {
|
|
1193
1196
|
constructor(source: string);
|
|
1194
1197
|
replace(from: string, to: string): void;
|
|
@@ -1204,32 +1207,10 @@ declare class BindingMagicString {
|
|
|
1204
1207
|
hasChanged(): boolean;
|
|
1205
1208
|
length(): number;
|
|
1206
1209
|
isEmpty(): boolean;
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
getOriginalFileName(): string | null;
|
|
1212
|
-
getOriginalFileNames(): Array<string>;
|
|
1213
|
-
getSource(): BindingAssetSource;
|
|
1214
|
-
getName(): string | null;
|
|
1215
|
-
getNames(): Array<string>;
|
|
1216
|
-
}
|
|
1217
|
-
declare class BindingOutputChunk {
|
|
1218
|
-
dropInner(): ExternalMemoryStatus;
|
|
1219
|
-
getIsEntry(): boolean;
|
|
1220
|
-
getIsDynamicEntry(): boolean;
|
|
1221
|
-
getFacadeModuleId(): string | null;
|
|
1222
|
-
getModuleIds(): Array<string>;
|
|
1223
|
-
getExports(): Array<string>;
|
|
1224
|
-
getFileName(): string;
|
|
1225
|
-
getModules(): BindingModules;
|
|
1226
|
-
getImports(): Array<string>;
|
|
1227
|
-
getDynamicImports(): Array<string>;
|
|
1228
|
-
getCode(): string;
|
|
1229
|
-
getMap(): string | null;
|
|
1230
|
-
getSourcemapFileName(): string | null;
|
|
1231
|
-
getPreliminaryFileName(): string;
|
|
1232
|
-
getName(): string;
|
|
1210
|
+
remove(start: number, end: number): void;
|
|
1211
|
+
update(start: number, end: number, content: string): void;
|
|
1212
|
+
relocate(start: number, end: number, to: number): void;
|
|
1213
|
+
indent(indentor?: string | undefined | null): void;
|
|
1233
1214
|
}
|
|
1234
1215
|
declare class BindingRenderedChunk {
|
|
1235
1216
|
get name(): string;
|
|
@@ -1250,6 +1231,13 @@ declare class BindingRenderedModule {
|
|
|
1250
1231
|
declare class BindingUrlResolver {
|
|
1251
1232
|
call(url: string, importer?: string): Promise<[string, string | undefined]>;
|
|
1252
1233
|
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Minimal wrapper around the core `Bundler` for watcher events.
|
|
1236
|
+
* This is returned from watcher event data to allow access to the bundler instance.
|
|
1237
|
+
*/
|
|
1238
|
+
declare class BindingWatcherBundler {
|
|
1239
|
+
close(): Promise<void>;
|
|
1240
|
+
}
|
|
1253
1241
|
declare class BindingWatcherChangeData {
|
|
1254
1242
|
path: string;
|
|
1255
1243
|
kind: string;
|
|
@@ -1271,10 +1259,7 @@ interface BindingAssetPluginConfig {
|
|
|
1271
1259
|
isSkipAssets: boolean;
|
|
1272
1260
|
assetsInclude: Array<BindingStringOrRegex>;
|
|
1273
1261
|
assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
|
|
1274
|
-
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) =>
|
|
1275
|
-
}
|
|
1276
|
-
interface BindingAssetSource {
|
|
1277
|
-
inner: string | Uint8Array;
|
|
1262
|
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet;
|
|
1278
1263
|
}
|
|
1279
1264
|
interface BindingBuildImportAnalysisPluginConfig {
|
|
1280
1265
|
preloadCode: string;
|
|
@@ -1282,9 +1267,16 @@ interface BindingBuildImportAnalysisPluginConfig {
|
|
|
1282
1267
|
optimizeModulePreloadRelativePaths: boolean;
|
|
1283
1268
|
renderBuiltUrl: boolean;
|
|
1284
1269
|
isRelativeBase: boolean;
|
|
1285
|
-
|
|
1270
|
+
v2?: BindingBuildImportAnalysisPluginV2Config;
|
|
1271
|
+
}
|
|
1272
|
+
interface BindingBuildImportAnalysisPluginV2Config {
|
|
1273
|
+
isSsr: boolean;
|
|
1274
|
+
urlBase: string;
|
|
1275
|
+
decodedBase: string;
|
|
1276
|
+
modulePreload: false | BindingModulePreloadOptions;
|
|
1277
|
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet;
|
|
1286
1278
|
}
|
|
1287
|
-
type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:esm-external-require' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:transform' | 'builtin:vite-css' | 'builtin:vite-css-post' | 'builtin:vite-html' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
|
|
1279
|
+
type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:esm-external-require' | 'builtin:html-inline-proxy' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:react-refresh-wrapper' | 'builtin:reporter' | 'builtin:replace' | 'builtin:transform' | 'builtin:vite-css' | 'builtin:vite-css-post' | 'builtin:vite-html' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
|
|
1288
1280
|
interface BindingClientHmrUpdate {
|
|
1289
1281
|
clientId: string;
|
|
1290
1282
|
update: BindingHmrUpdate;
|
|
@@ -1365,6 +1357,13 @@ interface BindingManifestPluginConfig {
|
|
|
1365
1357
|
isLegacy?: () => boolean;
|
|
1366
1358
|
cssEntries: () => Record<string, string>;
|
|
1367
1359
|
}
|
|
1360
|
+
interface BindingModulePreloadOptions {
|
|
1361
|
+
polyfill: boolean;
|
|
1362
|
+
resolveDependencies?: (filename: string, deps: string[], context: {
|
|
1363
|
+
hostId: string;
|
|
1364
|
+
hostType: 'html' | 'js';
|
|
1365
|
+
}) => string[];
|
|
1366
|
+
}
|
|
1368
1367
|
interface BindingModulePreloadPolyfillPluginConfig {
|
|
1369
1368
|
isServer?: boolean;
|
|
1370
1369
|
}
|
|
@@ -1372,10 +1371,6 @@ interface BindingModules {
|
|
|
1372
1371
|
values: Array<BindingRenderedModule>;
|
|
1373
1372
|
keys: Array<string>;
|
|
1374
1373
|
}
|
|
1375
|
-
interface BindingOutputs {
|
|
1376
|
-
chunks: Array<BindingOutputChunk>;
|
|
1377
|
-
assets: Array<BindingOutputAsset>;
|
|
1378
|
-
}
|
|
1379
1374
|
interface BindingReactRefreshWrapperPluginConfig {
|
|
1380
1375
|
cwd: string;
|
|
1381
1376
|
include?: Array<BindingStringOrRegex>;
|
|
@@ -1454,7 +1449,7 @@ interface BindingViteCssPostPluginConfig {
|
|
|
1454
1449
|
libCssFilename?: string;
|
|
1455
1450
|
isLegacy?: () => boolean;
|
|
1456
1451
|
cssMinify?: (css: string) => Promise<string>;
|
|
1457
|
-
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) =>
|
|
1452
|
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet;
|
|
1458
1453
|
}
|
|
1459
1454
|
interface BindingViteHtmlPluginConfig {
|
|
1460
1455
|
isLib: boolean;
|
|
@@ -1463,13 +1458,9 @@ interface BindingViteHtmlPluginConfig {
|
|
|
1463
1458
|
publicDir: string;
|
|
1464
1459
|
decodedBase: string;
|
|
1465
1460
|
cssCodeSplit: boolean;
|
|
1466
|
-
|
|
1461
|
+
modulePreload: false | BindingModulePreloadOptions;
|
|
1467
1462
|
assetInlineLimit: number | ((file: string, content: Buffer) => boolean | undefined);
|
|
1468
|
-
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) =>
|
|
1469
|
-
resolveDependencies?: boolean | ((filename: string, dependencies: string[], context: {
|
|
1470
|
-
hostId: string;
|
|
1471
|
-
hostType: 'html' | 'js';
|
|
1472
|
-
}) => Promise<string[]>);
|
|
1463
|
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet;
|
|
1473
1464
|
}
|
|
1474
1465
|
interface BindingViteResolvePluginConfig {
|
|
1475
1466
|
resolveOptions: BindingViteResolvePluginResolveOptions;
|
|
@@ -1524,4 +1515,4 @@ interface PreRenderedChunk {
|
|
|
1524
1515
|
exports: Array<string>;
|
|
1525
1516
|
}
|
|
1526
1517
|
//#endregion
|
|
1527
|
-
export { IsolatedDeclarationsOptions as A,
|
|
1518
|
+
export { IsolatedDeclarationsOptions as A, ResolverFactory as B, BindingViteCssPostPluginConfig as C, BindingWatcherBundler as D, BindingWasmHelperPluginConfig as E, NapiResolveOptions as F, moduleRunnerTransform as G, TransformResult as H, ParseResult as I, transform as J, parseAsync as K, ParserOptions as L, JsxOptions as M, MinifyOptions as N, BindingWatcherEvent as O, MinifyResult as P, PreRenderedChunk as R, BindingViteCssPluginConfig as S, BindingViteResolvePluginConfig as T, isolatedDeclaration as U, TransformOptions as V, minify as W, BindingReplacePluginConfig as _, BindingDynamicImportVarsPluginConfig as a, BindingTransformPluginConfig as b, BindingImportGlobPluginConfig as c, BindingMagicString as d, BindingManifestPluginConfig as f, BindingRenderedChunk as g, BindingRebuildStrategy as h, BindingClientHmrUpdate as i, IsolatedDeclarationsResult as j, ExternalMemoryStatus as k, BindingIsolatedDeclarationPluginConfig as l, BindingReactRefreshWrapperPluginConfig as m, BindingBuildImportAnalysisPluginConfig as n, BindingEsmExternalRequirePluginConfig as o, BindingModulePreloadPolyfillPluginConfig as p, parseSync as q, BindingBuiltinPluginName as r, BindingHookResolveIdExtraArgs as s, BindingAssetPluginConfig as t, BindingJsonPluginConfig as u, BindingReporterPluginConfig as v, BindingViteHtmlPluginConfig as w, BindingUrlResolver as x, BindingTransformHookExtraArgs as y, ResolveResult as z };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { C as BindingViteCssPostPluginConfig, E as BindingWasmHelperPluginConfig, T as BindingViteResolvePluginConfig, a as BindingDynamicImportVarsPluginConfig, c as BindingImportGlobPluginConfig, f as BindingManifestPluginConfig, l as BindingIsolatedDeclarationPluginConfig, m as BindingReactRefreshWrapperPluginConfig, n as BindingBuildImportAnalysisPluginConfig, o as BindingEsmExternalRequirePluginConfig, p as BindingModulePreloadPolyfillPluginConfig, u as BindingJsonPluginConfig, v as BindingReporterPluginConfig, w as BindingViteHtmlPluginConfig } from "./binding-B4uTNiw2.mjs";
|
|
2
|
+
import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-CduIqa7h.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/builtin-plugin/constructors.d.ts
|
|
5
|
+
declare function modulePreloadPolyfillPlugin(config?: BindingModulePreloadPolyfillPluginConfig): BuiltinPlugin;
|
|
6
|
+
type DynamicImportVarsPluginConfig = Omit<BindingDynamicImportVarsPluginConfig, "include" | "exclude"> & {
|
|
7
|
+
include?: StringOrRegExp | StringOrRegExp[];
|
|
8
|
+
exclude?: StringOrRegExp | StringOrRegExp[];
|
|
9
|
+
};
|
|
10
|
+
declare function dynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
|
|
11
|
+
declare function importGlobPlugin(config?: BindingImportGlobPluginConfig): BuiltinPlugin;
|
|
12
|
+
declare function reporterPlugin(config?: BindingReporterPluginConfig): BuiltinPlugin;
|
|
13
|
+
declare function manifestPlugin(config?: BindingManifestPluginConfig): BuiltinPlugin;
|
|
14
|
+
declare function wasmHelperPlugin(config?: BindingWasmHelperPluginConfig): BuiltinPlugin;
|
|
15
|
+
declare function wasmFallbackPlugin(): BuiltinPlugin;
|
|
16
|
+
declare function loadFallbackPlugin(): BuiltinPlugin;
|
|
17
|
+
declare function jsonPlugin(config?: BindingJsonPluginConfig): BuiltinPlugin;
|
|
18
|
+
declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuiltinPlugin;
|
|
19
|
+
declare function viteResolvePlugin(config: BindingViteResolvePluginConfig): BuiltinPlugin;
|
|
20
|
+
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
|
|
21
|
+
declare function webWorkerPostPlugin(): BuiltinPlugin;
|
|
22
|
+
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
|
|
23
|
+
type ReactRefreshWrapperPluginConfig = Omit<BindingReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
|
|
24
|
+
include?: StringOrRegExp | StringOrRegExp[];
|
|
25
|
+
exclude?: StringOrRegExp | StringOrRegExp[];
|
|
26
|
+
};
|
|
27
|
+
declare function reactRefreshWrapperPlugin(config: ReactRefreshWrapperPluginConfig): BuiltinPlugin;
|
|
28
|
+
declare function viteCSSPostPlugin(config?: BindingViteCssPostPluginConfig): BuiltinPlugin;
|
|
29
|
+
declare function viteHtmlPlugin(config?: BindingViteHtmlPluginConfig): BuiltinPlugin;
|
|
30
|
+
declare function htmlInlineProxyPlugin(): BuiltinPlugin;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { wasmHelperPlugin as _, importGlobPlugin as a, loadFallbackPlugin as c, reactRefreshWrapperPlugin as d, reporterPlugin as f, wasmFallbackPlugin as g, viteResolvePlugin as h, htmlInlineProxyPlugin as i, manifestPlugin as l, viteHtmlPlugin as m, dynamicImportVarsPlugin as n, isolatedDeclarationPlugin as o, viteCSSPostPlugin as p, esmExternalRequirePlugin as r, jsonPlugin as s, buildImportAnalysisPlugin as t, modulePreloadPolyfillPlugin as u, webWorkerPostPlugin as v };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { i as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CbDij6KB.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/builtin-plugin/constructors.ts
|
|
4
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
5
|
+
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
6
|
+
}
|
|
7
|
+
function dynamicImportVarsPlugin(config) {
|
|
8
|
+
if (config) {
|
|
9
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
10
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
11
|
+
}
|
|
12
|
+
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
13
|
+
}
|
|
14
|
+
function importGlobPlugin(config) {
|
|
15
|
+
return new BuiltinPlugin("builtin:import-glob", config);
|
|
16
|
+
}
|
|
17
|
+
function reporterPlugin(config) {
|
|
18
|
+
return new BuiltinPlugin("builtin:reporter", config);
|
|
19
|
+
}
|
|
20
|
+
function manifestPlugin(config) {
|
|
21
|
+
return new BuiltinPlugin("builtin:manifest", config);
|
|
22
|
+
}
|
|
23
|
+
function wasmHelperPlugin(config) {
|
|
24
|
+
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
25
|
+
}
|
|
26
|
+
function wasmFallbackPlugin() {
|
|
27
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:wasm-fallback"));
|
|
28
|
+
}
|
|
29
|
+
function loadFallbackPlugin() {
|
|
30
|
+
return new BuiltinPlugin("builtin:load-fallback");
|
|
31
|
+
}
|
|
32
|
+
function jsonPlugin(config) {
|
|
33
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:json", config));
|
|
34
|
+
}
|
|
35
|
+
function buildImportAnalysisPlugin(config) {
|
|
36
|
+
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
37
|
+
}
|
|
38
|
+
function viteResolvePlugin(config) {
|
|
39
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", config));
|
|
40
|
+
}
|
|
41
|
+
function isolatedDeclarationPlugin(config) {
|
|
42
|
+
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
43
|
+
}
|
|
44
|
+
function webWorkerPostPlugin() {
|
|
45
|
+
return new BuiltinPlugin("builtin:web-worker-post");
|
|
46
|
+
}
|
|
47
|
+
function esmExternalRequirePlugin(config) {
|
|
48
|
+
return new BuiltinPlugin("builtin:esm-external-require", config);
|
|
49
|
+
}
|
|
50
|
+
function reactRefreshWrapperPlugin(config) {
|
|
51
|
+
if (config) {
|
|
52
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
53
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
54
|
+
}
|
|
55
|
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:react-refresh-wrapper", config));
|
|
56
|
+
}
|
|
57
|
+
function viteCSSPostPlugin(config) {
|
|
58
|
+
return new BuiltinPlugin("builtin:vite-css-post", config);
|
|
59
|
+
}
|
|
60
|
+
function viteHtmlPlugin(config) {
|
|
61
|
+
return new BuiltinPlugin("builtin:vite-html", config);
|
|
62
|
+
}
|
|
63
|
+
function htmlInlineProxyPlugin() {
|
|
64
|
+
return new BuiltinPlugin("builtin:html-inline-proxy");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { wasmHelperPlugin as _, importGlobPlugin as a, loadFallbackPlugin as c, reactRefreshWrapperPlugin as d, reporterPlugin as f, wasmFallbackPlugin as g, viteResolvePlugin as h, htmlInlineProxyPlugin as i, manifestPlugin as l, viteHtmlPlugin as m, dynamicImportVarsPlugin as n, isolatedDeclarationPlugin as o, viteCSSPostPlugin as p, esmExternalRequirePlugin as r, jsonPlugin as s, buildImportAnalysisPlugin as t, modulePreloadPolyfillPlugin as u, webWorkerPostPlugin as v };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as BindingWatcherBundler, L as ParserOptions, M as JsxOptions, N as MinifyOptions$1, O as BindingWatcherEvent, R as PreRenderedChunk, V as TransformOptions$1, d as BindingMagicString, g as BindingRenderedChunk, k as ExternalMemoryStatus, s as BindingHookResolveIdExtraArgs, y as BindingTransformHookExtraArgs } from "./binding-B4uTNiw2.mjs";
|
|
2
|
+
import { a as NullValue, i as MaybePromise, n as MakeAsync, o as PartialNull, r as MaybeArray, s as StringOrRegExp, t as BuiltinPlugin } from "./utils-CduIqa7h.mjs";
|
|
2
3
|
import { Program } from "@oxc-project/types";
|
|
3
4
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
4
5
|
|
|
@@ -179,14 +180,6 @@ interface RolldownOutput extends ExternalMemoryHandle {
|
|
|
179
180
|
output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
|
|
180
181
|
}
|
|
181
182
|
//#endregion
|
|
182
|
-
//#region src/types/utils.d.ts
|
|
183
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
184
|
-
type NullValue<T = void> = T | undefined | null | void;
|
|
185
|
-
type PartialNull<T> = { [P in keyof T]: T[P] | null };
|
|
186
|
-
type MakeAsync<Function_> = Function_ extends ((this: infer This, ...parameters: infer Arguments) => infer Return) ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
|
|
187
|
-
type MaybeArray<T> = T | T[];
|
|
188
|
-
type StringOrRegExp = string | RegExp;
|
|
189
|
-
//#endregion
|
|
190
183
|
//#region src/options/output-options.d.ts
|
|
191
184
|
type GeneratedCodePreset = "es5" | "es2015";
|
|
192
185
|
interface GeneratedCodeOptions {
|
|
@@ -650,7 +643,6 @@ declare class RolldownBuild {
|
|
|
650
643
|
static asyncRuntimeShutdown: boolean;
|
|
651
644
|
constructor(inputOptions: InputOptions);
|
|
652
645
|
get closed(): boolean;
|
|
653
|
-
scan(): Promise<void>;
|
|
654
646
|
generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
655
647
|
write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
656
648
|
/**
|
|
@@ -672,7 +664,7 @@ interface WatchOptions extends InputOptions {
|
|
|
672
664
|
//#region src/api/watch/watch-emitter.d.ts
|
|
673
665
|
type WatcherEvent = "close" | "event" | "restart" | "change";
|
|
674
666
|
type ChangeEvent$1 = "create" | "update" | "delete";
|
|
675
|
-
type RolldownWatchBuild =
|
|
667
|
+
type RolldownWatchBuild = BindingWatcherBundler;
|
|
676
668
|
type RolldownWatcherEvent = {
|
|
677
669
|
code: "START";
|
|
678
670
|
} | {
|
|
@@ -992,13 +984,6 @@ type SourceMapInput = ExistingRawSourceMap | string | null;
|
|
|
992
984
|
//#region src/index.d.ts
|
|
993
985
|
declare const VERSION: string;
|
|
994
986
|
//#endregion
|
|
995
|
-
//#region src/builtin-plugin/utils.d.ts
|
|
996
|
-
declare class BuiltinPlugin {
|
|
997
|
-
name: BindingBuiltinPluginName;
|
|
998
|
-
_options?: unknown;
|
|
999
|
-
constructor(name: BindingBuiltinPluginName, _options?: unknown);
|
|
1000
|
-
}
|
|
1001
|
-
//#endregion
|
|
1002
987
|
//#region src/constants/plugin.d.ts
|
|
1003
988
|
declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"];
|
|
1004
989
|
declare const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES: readonly ["augmentChunkHash", "outputOptions", "renderChunk", "renderStart", "renderError", "writeBundle", "generateBundle"];
|
|
@@ -1602,33 +1587,6 @@ interface InputOptions {
|
|
|
1602
1587
|
nativeMagicString?: boolean;
|
|
1603
1588
|
};
|
|
1604
1589
|
/**
|
|
1605
|
-
* Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
|
|
1606
|
-
*
|
|
1607
|
-
* @deprecated Use `transform.define` instead. This top-level option will be removed in a future release.
|
|
1608
|
-
*
|
|
1609
|
-
* See `transform.define` for detailed documentation and examples.
|
|
1610
|
-
*/
|
|
1611
|
-
define?: Record<string, string>;
|
|
1612
|
-
/**
|
|
1613
|
-
* Inject import statements on demand.
|
|
1614
|
-
*
|
|
1615
|
-
* @deprecated Use `transform.inject` instead. This top-level option will be removed in a future release.
|
|
1616
|
-
*
|
|
1617
|
-
* See `transform.inject` for detailed documentation and examples.
|
|
1618
|
-
*/
|
|
1619
|
-
inject?: Record<string, string | [string, string]>;
|
|
1620
|
-
/**
|
|
1621
|
-
* Whether to add readable names to internal variables for profiling purposes.
|
|
1622
|
-
*
|
|
1623
|
-
* When enabled, generated code will use descriptive variable names that correspond
|
|
1624
|
-
* to the original module names, making it easier to profile and debug the bundled code.
|
|
1625
|
-
*
|
|
1626
|
-
* @default true when minification is disabled, false when minification is enabled
|
|
1627
|
-
*
|
|
1628
|
-
* @deprecated Use `output.generatedCode.profilerNames` instead. This top-level option will be removed in a future release.
|
|
1629
|
-
*/
|
|
1630
|
-
profilerNames?: boolean;
|
|
1631
|
-
/**
|
|
1632
1590
|
* Configure how the code is transformed. This process happens after the `transform` hook.
|
|
1633
1591
|
*
|
|
1634
1592
|
* To transpile [legacy decorators](https://github.com/tc39/proposal-decorators/tree/4ac0f4cd31bd0f2e8170cb4c5136e51671e46c8d), you could use
|
|
@@ -1647,22 +1605,6 @@ interface InputOptions {
|
|
|
1647
1605
|
*/
|
|
1648
1606
|
transform?: TransformOptions;
|
|
1649
1607
|
watch?: WatcherOptions | false;
|
|
1650
|
-
/**
|
|
1651
|
-
* Remove labeled statements with these label names.
|
|
1652
|
-
*
|
|
1653
|
-
* @deprecated Use `transform.dropLabels` instead. This top-level option will be removed in a future release.
|
|
1654
|
-
*
|
|
1655
|
-
* See `transform.dropLabels` for detailed documentation and examples.
|
|
1656
|
-
*/
|
|
1657
|
-
dropLabels?: string[];
|
|
1658
|
-
/**
|
|
1659
|
-
* Keep function and class names after bundling.
|
|
1660
|
-
*
|
|
1661
|
-
* @deprecated Use `output.keepNames` instead. This top-level option will be removed in a future release.
|
|
1662
|
-
*
|
|
1663
|
-
* See `output.keepNames` for detailed documentation.
|
|
1664
|
-
*/
|
|
1665
|
-
keepNames?: boolean;
|
|
1666
1608
|
checks?: ChecksOptions;
|
|
1667
1609
|
makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
|
|
1668
1610
|
debug?: {
|
|
@@ -1701,4 +1643,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
|
|
|
1701
1643
|
declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
|
|
1702
1644
|
declare function defineConfig(config: ConfigExport): ConfigExport;
|
|
1703
1645
|
//#endregion
|
|
1704
|
-
export {
|
|
1646
|
+
export { NormalizedOutputOptions as $, VERSION as A, LogLevel as At, PluginContext as B, ResolveIdResult as C, RenderedChunk as Ct, SourceDescription as D, freeExternalMemory as Dt, RolldownPluginOption as E, SourceMap as Et, TreeshakingOptions as F, RollupLogWithString as Ft, GeneralHookFilter as G, defineParallelPlugin as H, TransformPluginContext as I, BufferEncoding as J, HookFilter as K, EmittedAsset as L, SourceMapInput as M, LogOrStringHandler as Mt, RolldownOptionsFunction as N, RollupError as Nt, TransformResult as O, ModuleInfo as Ot, OutputBundle as P, RollupLog as Pt, InternalModuleFormat as Q, EmittedFile as R, ResolveIdExtraOptions as S, OutputChunk as St, RolldownPlugin as T, RolldownOutput as Tt, MinimalPluginContext as U, DefineParallelPluginResult as V, PluginContextMeta as W, RolldownFileStats as X, RolldownDirectoryEntry as Y, RolldownFsModule as Z, ModuleType as _, MinifyOptions as _t, InputOption as a, RolldownWatcherEvent as at, PartialResolvedId as b, PreRenderedAsset as bt, OptimizationOptions as c, RolldownBuild as ct, CustomPluginOptions as d, AddonFunction as dt, NormalizedInputOptions as et, FunctionPluginHooks as f, ChunkFileNamesFunction as ft, ModuleOptions as g, GlobalsFunction as gt, LoadResult as h, GeneratedCodePreset as ht, ExternalOption as i, RolldownWatcher as it, ExistingRawSourceMap as j, LogLevelOption as jt, withFilter as k, SourcemapIgnoreListOption as kt, WatcherOptions as l, BuildOptions as lt, ImportKind as m, GeneratedCodeOptions as mt, ConfigExport as n, WarningHandlerWithDefault as nt, InputOptions as o, WatchOptions as ot, HookFilterExtension as p, ChunkingContext as pt, ModuleTypeFilter as q, RolldownOptions as r, watch as rt, ModuleTypes as s, rolldown as st, defineConfig as t, LoggingFunction as tt, AsyncPluginHooks as u, build as ut, ObjectHook as v, ModuleFormat as vt, ResolvedId as w, RenderedModule as wt, Plugin as x, OutputAsset as xt, ParallelPluginHooks as y, OutputOptions as yt, GetModuleInfo as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as rolldown } from "./src-
|
|
2
|
-
import fs from "node:fs";
|
|
1
|
+
import { o as rolldown } from "./src-CvsuRKGv.mjs";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { readdir } from "node:fs/promises";
|
|
5
4
|
import { pathToFileURL } from "node:url";
|
|
6
5
|
import { cwd } from "node:process";
|
|
6
|
+
import fs from "node:fs";
|
|
7
7
|
|
|
8
8
|
//#region src/utils/load-config.ts
|
|
9
9
|
async function bundleTsConfig(configFile, isEsm) {
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
//#region src/utils/code-frame.ts
|
|
2
|
+
function spaces(index) {
|
|
3
|
+
let result = "";
|
|
4
|
+
while (index--) result += " ";
|
|
5
|
+
return result;
|
|
6
|
+
}
|
|
7
|
+
function tabsToSpaces(value) {
|
|
8
|
+
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
|
|
9
|
+
}
|
|
10
|
+
const LINE_TRUNCATE_LENGTH = 120;
|
|
11
|
+
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
12
|
+
const ELLIPSIS = "...";
|
|
13
|
+
function getCodeFrame(source, line, column) {
|
|
14
|
+
let lines = source.split("\n");
|
|
15
|
+
if (line > lines.length) return "";
|
|
16
|
+
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + 3, LINE_TRUNCATE_LENGTH);
|
|
17
|
+
const frameStart = Math.max(0, line - 3);
|
|
18
|
+
let frameEnd = Math.min(line + 2, lines.length);
|
|
19
|
+
lines = lines.slice(frameStart, frameEnd);
|
|
20
|
+
while (!/\S/.test(lines[lines.length - 1])) {
|
|
21
|
+
lines.pop();
|
|
22
|
+
frameEnd -= 1;
|
|
23
|
+
}
|
|
24
|
+
const digits = String(frameEnd).length;
|
|
25
|
+
return lines.map((sourceLine, index) => {
|
|
26
|
+
const isErrorLine = frameStart + index + 1 === line;
|
|
27
|
+
let lineNumber = String(index + frameStart + 1);
|
|
28
|
+
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
|
|
29
|
+
let displayedLine = tabsToSpaces(sourceLine);
|
|
30
|
+
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - 3)}${ELLIPSIS}`;
|
|
31
|
+
if (isErrorLine) {
|
|
32
|
+
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
|
|
33
|
+
return `${lineNumber}: ${displayedLine}\n${indicator}`;
|
|
34
|
+
}
|
|
35
|
+
return `${lineNumber}: ${displayedLine}`;
|
|
36
|
+
}).join("\n");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/log/locate-character/index.js
|
|
41
|
+
/** @typedef {import('./types').Location} Location */
|
|
42
|
+
/**
|
|
43
|
+
* @param {import('./types').Range} range
|
|
44
|
+
* @param {number} index
|
|
45
|
+
*/
|
|
46
|
+
function rangeContains(range, index) {
|
|
47
|
+
return range.start <= index && index < range.end;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} source
|
|
51
|
+
* @param {import('./types').Options} [options]
|
|
52
|
+
*/
|
|
53
|
+
function getLocator(source, options = {}) {
|
|
54
|
+
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
55
|
+
let start = 0;
|
|
56
|
+
const ranges = source.split("\n").map((line, i$1) => {
|
|
57
|
+
const end = start + line.length + 1;
|
|
58
|
+
/** @type {import('./types').Range} */
|
|
59
|
+
const range = {
|
|
60
|
+
start,
|
|
61
|
+
end,
|
|
62
|
+
line: i$1
|
|
63
|
+
};
|
|
64
|
+
start = end;
|
|
65
|
+
return range;
|
|
66
|
+
});
|
|
67
|
+
let i = 0;
|
|
68
|
+
/**
|
|
69
|
+
* @param {string | number} search
|
|
70
|
+
* @param {number} [index]
|
|
71
|
+
* @returns {Location | undefined}
|
|
72
|
+
*/
|
|
73
|
+
function locator(search, index) {
|
|
74
|
+
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
|
|
75
|
+
if (search === -1) return void 0;
|
|
76
|
+
let range = ranges[i];
|
|
77
|
+
const d = search >= range.end ? 1 : -1;
|
|
78
|
+
while (range) {
|
|
79
|
+
if (rangeContains(range, search)) return {
|
|
80
|
+
line: offsetLine + range.line,
|
|
81
|
+
column: offsetColumn + search - range.start,
|
|
82
|
+
character: search
|
|
83
|
+
};
|
|
84
|
+
i += d;
|
|
85
|
+
range = ranges[i];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return locator;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} source
|
|
92
|
+
* @param {string | number} search
|
|
93
|
+
* @param {import('./types').Options} [options]
|
|
94
|
+
* @returns {Location | undefined}
|
|
95
|
+
*/
|
|
96
|
+
function locate(source, search, options) {
|
|
97
|
+
return getLocator(source, options)(search, options && options.startIndex);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/log/logs.ts
|
|
102
|
+
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
|
|
103
|
+
function logParseError(message) {
|
|
104
|
+
return {
|
|
105
|
+
code: PARSE_ERROR,
|
|
106
|
+
message
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function logInvalidLogPosition(pluginName) {
|
|
110
|
+
return {
|
|
111
|
+
code: INVALID_LOG_POSITION,
|
|
112
|
+
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function logInputHookInOutputPlugin(pluginName, hookName) {
|
|
116
|
+
return {
|
|
117
|
+
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
|
|
118
|
+
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function logCycleLoading(pluginName, moduleId) {
|
|
122
|
+
return {
|
|
123
|
+
code: CYCLE_LOADING,
|
|
124
|
+
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function logMultiplyNotifyOption() {
|
|
128
|
+
return {
|
|
129
|
+
code: MULTIPLY_NOTIFY_OPTION,
|
|
130
|
+
message: `Found multiply notify option at watch options, using first one to start notify watcher.`
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function logPluginError(error$1, plugin, { hook, id } = {}) {
|
|
134
|
+
try {
|
|
135
|
+
const code = error$1.code;
|
|
136
|
+
if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
|
|
137
|
+
error$1.code = PLUGIN_ERROR;
|
|
138
|
+
error$1.plugin = plugin;
|
|
139
|
+
if (hook) error$1.hook = hook;
|
|
140
|
+
if (id) error$1.id = id;
|
|
141
|
+
} catch (_) {} finally {
|
|
142
|
+
return error$1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function error(base) {
|
|
146
|
+
if (!(base instanceof Error)) {
|
|
147
|
+
base = Object.assign(new Error(base.message), base);
|
|
148
|
+
Object.defineProperty(base, "name", {
|
|
149
|
+
value: "RollupError",
|
|
150
|
+
writable: true
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
throw base;
|
|
154
|
+
}
|
|
155
|
+
function augmentCodeLocation(properties, pos, source, id) {
|
|
156
|
+
if (typeof pos === "object") {
|
|
157
|
+
const { line, column } = pos;
|
|
158
|
+
properties.loc = {
|
|
159
|
+
column,
|
|
160
|
+
file: id,
|
|
161
|
+
line
|
|
162
|
+
};
|
|
163
|
+
} else {
|
|
164
|
+
properties.pos = pos;
|
|
165
|
+
const location = locate(source, pos, { offsetLine: 1 });
|
|
166
|
+
if (!location) return;
|
|
167
|
+
const { line, column } = location;
|
|
168
|
+
properties.loc = {
|
|
169
|
+
column,
|
|
170
|
+
file: id,
|
|
171
|
+
line
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (properties.frame === void 0) {
|
|
175
|
+
const { line, column } = properties.loc;
|
|
176
|
+
properties.frame = getCodeFrame(source, line, column);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
export { logInvalidLogPosition as a, logPluginError as c, logInputHookInOutputPlugin as i, locate as l, error as n, logMultiplyNotifyOption as o, logCycleLoading as r, logParseError as s, augmentCodeLocation as t, getCodeFrame as u };
|