rolldown 0.12.2 → 0.13.0-snapshot-514fd69-20240905003110
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/cjs/cli.cjs +1552 -584
- package/dist/cjs/experimental-index.cjs +40 -0
- package/dist/cjs/index.cjs +5 -22
- package/dist/cjs/parallel-plugin-worker.cjs +7 -7
- package/dist/cjs/parallel-plugin.cjs +1 -1
- package/dist/esm/cli.mjs +1549 -583
- package/dist/esm/experimental-index.mjs +23 -0
- package/dist/esm/index.mjs +5 -17
- package/dist/esm/parallel-plugin-worker.mjs +6 -6
- package/dist/esm/parallel-plugin.mjs +1 -1
- package/dist/shared/{chunk-1xb6WR3y.cjs → chunk-gQ4GMlVi.cjs} +3 -2
- package/dist/shared/{consola.36c0034f-N8xiTrv3.cjs → consola.36c0034f-eps_ogJv.cjs} +188 -188
- package/dist/shared/{consola.36c0034f-jtHhMkSX.mjs → consola.36c0034f-m5cABVv4.mjs} +187 -187
- package/dist/shared/package-3VR4tEG7.mjs +9 -0
- package/dist/shared/package-OJCNSbf0.cjs +11 -0
- package/dist/shared/plugin-context-data-AMG1kfMv.mjs +1443 -0
- package/dist/shared/plugin-context-data-S1bXhfAf.cjs +1436 -0
- package/dist/shared/{prompt-pjyLzLci.mjs → prompt-9VjtYvi_.mjs} +182 -182
- package/dist/shared/{prompt-1K6oCkIU.cjs → prompt-Ah5G71p-.cjs} +183 -183
- package/dist/shared/rolldown-NGdGAW73.mjs +1069 -0
- package/dist/shared/rolldown-binding.wasi.cjs +70 -51
- package/dist/shared/rolldown-z62CIhEW.cjs +1085 -0
- package/dist/types/binding.d.ts +329 -14
- package/dist/types/cli/arguments/alias.d.ts +8 -0
- package/dist/types/cli/arguments/index.d.ts +13 -0
- package/dist/types/cli/arguments/normalize.d.ts +15 -0
- package/dist/types/cli/arguments/schema.d.ts +161 -0
- package/dist/types/cli/arguments/utils.d.ts +6 -0
- package/dist/types/cli/commands/bundle.d.ts +3 -1
- package/dist/types/cli/commands/help.d.ts +1 -0
- package/dist/types/cli/utils.d.ts +1 -1
- package/dist/types/constants/plugin-context.d.ts +7 -0
- package/dist/types/constants/plugin.d.ts +36 -0
- package/dist/types/experimental-index.d.ts +5 -0
- package/dist/types/index.d.ts +8 -8
- package/dist/types/options/input-options.d.ts +139 -27
- package/dist/types/options/normalized-alias-plugin-config.d.ts +10 -0
- package/dist/types/options/normalized-ecma-transform-plugin-config.d.ts +8 -0
- package/dist/types/options/normalized-output-options.d.ts +8 -3
- package/dist/types/options/output-options.d.ts +102 -11
- package/dist/types/options/utils.d.ts +2 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -8
- package/dist/types/plugin/bindingify-hook-filter.d.ts +5 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +11 -7
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +8 -0
- package/dist/types/plugin/bindingify-plugin.d.ts +2 -1
- package/dist/types/plugin/builtin-plugin.d.ts +75 -7
- package/dist/types/plugin/index.d.ts +68 -28
- package/dist/types/plugin/plugin-context-data.d.ts +6 -0
- package/dist/types/plugin/plugin-context.d.ts +18 -8
- package/dist/types/plugin/plugin-driver.d.ts +2 -2
- package/dist/types/rollup.d.ts +1 -0
- package/dist/types/types/rolldown-output.d.ts +1 -0
- package/dist/types/utils/compose-js-plugins.d.ts +2 -0
- package/dist/types/utils/misc.d.ts +1 -0
- package/dist/types/utils/normalize-hook.d.ts +7 -5
- package/dist/types/utils/plugin/index.d.ts +2 -0
- package/dist/types/utils/type-assert.d.ts +1 -0
- package/package.json +30 -22
- package/dist/shared/rolldown-SCF5NBN_.cjs +0 -49
- package/dist/shared/rolldown-kYz4BvAA.mjs +0 -48
- package/dist/shared/utils_index-_DFpKlu1.mjs +0 -1582
- package/dist/shared/utils_index-xb2NoRNm.cjs +0 -1557
- package/dist/types/cli/constants.d.ts +0 -1
- package/dist/types/utils/ensure-array.d.ts +0 -1
- package/dist/types/utils/index.d.ts +0 -9
- /package/dist/types/plugin/{transfrom-plugin-context.d.ts → transform-plugin-context.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RenderedChunk } from '../binding';
|
|
1
|
+
import type { PreRenderedChunk, RenderedChunk } from '../binding';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
declare const ModuleFormatSchema: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>, z.ZodLiteral<"iife">]>>;
|
|
4
4
|
declare const outputOptionsSchema: z.ZodObject<{
|
|
@@ -10,39 +10,130 @@ declare const outputOptionsSchema: z.ZodObject<{
|
|
|
10
10
|
sourcemapPathTransform: z.ZodOptional<z.ZodType<SourcemapPathTransformOption, z.ZodTypeDef, SourcemapPathTransformOption>>;
|
|
11
11
|
banner: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
12
12
|
footer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
intro: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
14
|
+
outro: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
15
|
+
extend: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
esModule: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"if-default-prop">, z.ZodBoolean]>>;
|
|
17
|
+
entryFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
18
|
+
chunkFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
15
19
|
assetFileNames: z.ZodOptional<z.ZodString>;
|
|
16
20
|
minify: z.ZodOptional<z.ZodBoolean>;
|
|
17
21
|
name: z.ZodOptional<z.ZodString>;
|
|
22
|
+
globals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
+
externalLiveBindings: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
24
|
+
inlineDynamicImports: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
18
25
|
}, "strict", z.ZodTypeAny, {
|
|
26
|
+
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
27
|
+
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
28
|
+
intro?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
29
|
+
outro?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
19
30
|
name?: string | undefined;
|
|
20
31
|
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
21
|
-
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
22
|
-
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
23
32
|
dir?: string | undefined;
|
|
24
33
|
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | undefined;
|
|
25
34
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
26
35
|
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
27
36
|
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
extend?: boolean | undefined;
|
|
38
|
+
esModule?: boolean | "if-default-prop" | undefined;
|
|
39
|
+
entryFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
40
|
+
chunkFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
30
41
|
assetFileNames?: string | undefined;
|
|
31
42
|
minify?: boolean | undefined;
|
|
43
|
+
globals?: Record<string, string> | undefined;
|
|
44
|
+
externalLiveBindings?: boolean | undefined;
|
|
45
|
+
inlineDynamicImports?: boolean | undefined;
|
|
32
46
|
}, {
|
|
47
|
+
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
48
|
+
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
49
|
+
intro?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
50
|
+
outro?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
33
51
|
name?: string | undefined;
|
|
34
52
|
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
35
|
-
banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
36
|
-
footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
|
|
37
53
|
dir?: string | undefined;
|
|
38
54
|
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | undefined;
|
|
39
55
|
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
40
56
|
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
|
|
41
57
|
sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
extend?: boolean | undefined;
|
|
59
|
+
esModule?: boolean | "if-default-prop" | undefined;
|
|
60
|
+
entryFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
61
|
+
chunkFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
62
|
+
assetFileNames?: string | undefined;
|
|
63
|
+
minify?: boolean | undefined;
|
|
64
|
+
globals?: Record<string, string> | undefined;
|
|
65
|
+
externalLiveBindings?: boolean | undefined;
|
|
66
|
+
inlineDynamicImports?: boolean | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
export declare const outputCliOptionsSchema: z.ZodObject<Omit<z.objectUtil.extendShape<{
|
|
69
|
+
dir: z.ZodOptional<z.ZodString>;
|
|
70
|
+
exports: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"named">]>, z.ZodLiteral<"default">]>, z.ZodLiteral<"none">]>>;
|
|
71
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"es">, z.ZodLiteral<"cjs">]>, z.ZodLiteral<"esm">]>, z.ZodLiteral<"module">]>, z.ZodLiteral<"commonjs">]>, z.ZodLiteral<"iife">]>>;
|
|
72
|
+
sourcemap: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>, z.ZodLiteral<"hidden">]>>;
|
|
73
|
+
sourcemapIgnoreList: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodType<SourcemapIgnoreListOption, z.ZodTypeDef, SourcemapIgnoreListOption>]>>;
|
|
74
|
+
sourcemapPathTransform: z.ZodOptional<z.ZodType<SourcemapPathTransformOption, z.ZodTypeDef, SourcemapPathTransformOption>>;
|
|
75
|
+
banner: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
76
|
+
footer: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
77
|
+
intro: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
78
|
+
outro: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<RenderedChunk, z.ZodTypeDef, RenderedChunk>], z.ZodUnknown>, z.ZodUnion<[z.ZodString, z.ZodPromise<z.ZodString>]>>]>>;
|
|
79
|
+
extend: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
esModule: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"if-default-prop">, z.ZodBoolean]>>;
|
|
81
|
+
entryFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
82
|
+
chunkFileNames: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodType<PreRenderedChunk, z.ZodTypeDef, PreRenderedChunk>], z.ZodUnknown>, z.ZodString>]>>;
|
|
83
|
+
assetFileNames: z.ZodOptional<z.ZodString>;
|
|
84
|
+
minify: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
name: z.ZodOptional<z.ZodString>;
|
|
86
|
+
globals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
87
|
+
externalLiveBindings: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
88
|
+
inlineDynamicImports: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
89
|
+
}, {
|
|
90
|
+
banner: z.ZodOptional<z.ZodString>;
|
|
91
|
+
footer: z.ZodOptional<z.ZodString>;
|
|
92
|
+
intro: z.ZodOptional<z.ZodString>;
|
|
93
|
+
outro: z.ZodOptional<z.ZodString>;
|
|
94
|
+
esModule: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
sourcemapIgnoreList: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
sourcemapPathTransform: z.ZodOptional<z.ZodUndefined>;
|
|
97
|
+
}>, "sourcemapPathTransform">, "strict", z.ZodTypeAny, {
|
|
98
|
+
footer?: string | undefined;
|
|
99
|
+
banner?: string | undefined;
|
|
100
|
+
intro?: string | undefined;
|
|
101
|
+
outro?: string | undefined;
|
|
102
|
+
name?: string | undefined;
|
|
103
|
+
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
104
|
+
dir?: string | undefined;
|
|
105
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | undefined;
|
|
106
|
+
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
107
|
+
sourcemapIgnoreList?: boolean | undefined;
|
|
108
|
+
extend?: boolean | undefined;
|
|
109
|
+
esModule?: boolean | undefined;
|
|
110
|
+
entryFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
111
|
+
chunkFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
112
|
+
assetFileNames?: string | undefined;
|
|
113
|
+
minify?: boolean | undefined;
|
|
114
|
+
globals?: Record<string, string> | undefined;
|
|
115
|
+
externalLiveBindings?: boolean | undefined;
|
|
116
|
+
inlineDynamicImports?: boolean | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
footer?: string | undefined;
|
|
119
|
+
banner?: string | undefined;
|
|
120
|
+
intro?: string | undefined;
|
|
121
|
+
outro?: string | undefined;
|
|
122
|
+
name?: string | undefined;
|
|
123
|
+
exports?: "auto" | "named" | "default" | "none" | undefined;
|
|
124
|
+
dir?: string | undefined;
|
|
125
|
+
format?: "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | undefined;
|
|
126
|
+
sourcemap?: boolean | "inline" | "hidden" | undefined;
|
|
127
|
+
sourcemapIgnoreList?: boolean | undefined;
|
|
128
|
+
extend?: boolean | undefined;
|
|
129
|
+
esModule?: boolean | undefined;
|
|
130
|
+
entryFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
131
|
+
chunkFileNames?: string | ((args_0: PreRenderedChunk, ...args_1: unknown[]) => string) | undefined;
|
|
44
132
|
assetFileNames?: string | undefined;
|
|
45
133
|
minify?: boolean | undefined;
|
|
134
|
+
globals?: Record<string, string> | undefined;
|
|
135
|
+
externalLiveBindings?: boolean | undefined;
|
|
136
|
+
inlineDynamicImports?: boolean | undefined;
|
|
46
137
|
}>;
|
|
47
138
|
export type OutputOptions = z.infer<typeof outputOptionsSchema>;
|
|
48
139
|
export type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { BindingPluginOptions } from '../binding';
|
|
2
|
-
import type { Plugin } from './index';
|
|
2
|
+
import type { hookFilterExtension, Plugin } from './index';
|
|
3
3
|
import { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
4
|
import { PluginContextData } from './plugin-context-data';
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
5
|
+
import { PluginHookWithBindingExt } from './bindingify-plugin-hook-meta';
|
|
6
|
+
export declare function bindingifyBuildStart(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['buildStart']>;
|
|
7
|
+
export declare function bindingifyBuildEnd(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['buildEnd']>;
|
|
8
|
+
export declare function bindingifyResolveId(plugin: Plugin, normalizedOptions: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['resolveId'], hookFilterExtension<'transform'>>;
|
|
9
|
+
export declare function bindingifyResolveDynamicImport(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['resolveDynamicImport']>;
|
|
10
|
+
export declare function bindingifyTransform(plugin: Plugin, normalizedOptions: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['transform']>;
|
|
11
|
+
export declare function bindingifyLoad(plugin: Plugin, normalized_options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['load']>;
|
|
12
|
+
export declare function bindingifyModuleParsed(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['moduleParsed']>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BindingGeneralHookFilter, BindingTransformHookFilter } from '../binding.d';
|
|
2
|
+
import { hookFilterExtension } from '.';
|
|
3
|
+
export declare function bindingifyResolveIdFilter(filterOption?: hookFilterExtension<'resolveId'>['filter']): BindingGeneralHookFilter | undefined;
|
|
4
|
+
export declare function bindingifyLoadFilter(filterOption?: hookFilterExtension<'load'>['filter']): BindingGeneralHookFilter | undefined;
|
|
5
|
+
export declare function bindingifyTransformFilter(filterOption?: hookFilterExtension<'transform'>['filter']): BindingTransformHookFilter | undefined;
|
|
@@ -3,10 +3,14 @@ import type { NormalizedInputOptions } from '../options/normalized-input-options
|
|
|
3
3
|
import type { Plugin } from './index';
|
|
4
4
|
import { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
5
5
|
import { PluginContextData } from './plugin-context-data';
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
6
|
+
import { PluginHookWithBindingExt } from './bindingify-plugin-hook-meta';
|
|
7
|
+
export declare function bindingifyRenderStart(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['renderStart']>;
|
|
8
|
+
export declare function bindingifyRenderChunk(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['renderChunk']>;
|
|
9
|
+
export declare function bindingifyAugmentChunkHash(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['augmentChunkHash']>;
|
|
10
|
+
export declare function bindingifyRenderError(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['renderError']>;
|
|
11
|
+
export declare function bindingifyGenerateBundle(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['generateBundle']>;
|
|
12
|
+
export declare function bindingifyWriteBundle(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['writeBundle']>;
|
|
13
|
+
export declare function bindingifyBanner(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['banner']>;
|
|
14
|
+
export declare function bindingifyFooter(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['footer']>;
|
|
15
|
+
export declare function bindingifyIntro(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['intro']>;
|
|
16
|
+
export declare function bindingifyOutro(plugin: Plugin, options: NormalizedInputOptions, pluginContextData: PluginContextData): PluginHookWithBindingExt<BindingPluginOptions['outro']>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ObjectHookMeta } from '.';
|
|
2
|
+
import { BindingPluginHookMeta } from '../binding';
|
|
3
|
+
export declare function bindingifyPluginHookMeta(options: ObjectHookMeta): BindingPluginHookMeta;
|
|
4
|
+
export type PluginHookWithBindingExt<T, F = undefined> = {
|
|
5
|
+
plugin?: T;
|
|
6
|
+
meta?: BindingPluginHookMeta;
|
|
7
|
+
filter?: F;
|
|
8
|
+
};
|
|
@@ -2,4 +2,5 @@ import type { BindingPluginOptions } from '../binding';
|
|
|
2
2
|
import type { Plugin } from './index';
|
|
3
3
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
4
|
import type { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
5
|
-
|
|
5
|
+
import { PluginContextData } from './plugin-context-data';
|
|
6
|
+
export declare function bindingifyPlugin(plugin: Plugin, options: NormalizedInputOptions, outputOptions: NormalizedOutputOptions, pluginContextData: PluginContextData): BindingPluginOptions;
|
|
@@ -1,13 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransformPluginConfig } from '../options/normalized-ecma-transform-plugin-config';
|
|
2
|
+
import { AliasPluginConfig } from '../options/normalized-alias-plugin-config';
|
|
3
|
+
import { BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingBuiltinPlugin, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingReplacePluginConfig } from '../binding';
|
|
2
4
|
export declare class BuiltinPlugin {
|
|
3
5
|
name: BindingBuiltinPluginName;
|
|
4
|
-
options?: unknown
|
|
5
|
-
constructor(name: BindingBuiltinPluginName, options?: unknown
|
|
6
|
+
options?: unknown;
|
|
7
|
+
constructor(name: BindingBuiltinPluginName, options?: unknown);
|
|
6
8
|
}
|
|
7
|
-
export declare class
|
|
8
|
-
constructor(
|
|
9
|
+
export declare class ModulePreloadPolyfillPlugin extends BuiltinPlugin {
|
|
10
|
+
constructor(config?: BindingModulePreloadPolyfillPluginConfig);
|
|
9
11
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
constructor(
|
|
12
|
+
export declare class DynamicImportVarsPlugin extends BuiltinPlugin {
|
|
13
|
+
constructor();
|
|
12
14
|
}
|
|
15
|
+
export declare class ImportGlobPlugin extends BuiltinPlugin {
|
|
16
|
+
constructor(config?: BindingGlobImportPluginConfig);
|
|
17
|
+
}
|
|
18
|
+
export declare class ManifestPlugin extends BuiltinPlugin {
|
|
19
|
+
constructor(config?: BindingManifestPluginConfig);
|
|
20
|
+
}
|
|
21
|
+
export declare class WasmHelperPlugin extends BuiltinPlugin {
|
|
22
|
+
constructor();
|
|
23
|
+
}
|
|
24
|
+
export declare class WasmFallbackPlugin extends BuiltinPlugin {
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare class LoadFallbackPlugin extends BuiltinPlugin {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export declare class AliasPlugin extends BuiltinPlugin {
|
|
31
|
+
constructor(config?: AliasPluginConfig);
|
|
32
|
+
}
|
|
33
|
+
export declare class TransformPlugin extends BuiltinPlugin {
|
|
34
|
+
constructor(config?: TransformPluginConfig);
|
|
35
|
+
}
|
|
36
|
+
export declare class JsonPlugin extends BuiltinPlugin {
|
|
37
|
+
constructor(config?: BindingJsonPluginConfig);
|
|
38
|
+
}
|
|
39
|
+
export declare class BuildImportAnalysisPlugin extends BuiltinPlugin {
|
|
40
|
+
constructor(config?: BindingBuildImportAnalysisPluginConfig);
|
|
41
|
+
}
|
|
42
|
+
export declare class ReplacePlugin extends BuiltinPlugin {
|
|
43
|
+
constructor(config?: BindingReplacePluginConfig);
|
|
44
|
+
}
|
|
45
|
+
export declare function modulePreloadPolyfillPlugin(config?: BindingModulePreloadPolyfillPluginConfig): ModulePreloadPolyfillPlugin;
|
|
46
|
+
export declare function dynamicImportVarsPlugin(): DynamicImportVarsPlugin;
|
|
47
|
+
export declare function importGlobPlugin(config?: BindingGlobImportPluginConfig): ImportGlobPlugin;
|
|
48
|
+
export declare function manifestPlugin(config?: BindingManifestPluginConfig): ManifestPlugin;
|
|
49
|
+
export declare function wasmHelperPlugin(): WasmHelperPlugin;
|
|
50
|
+
export declare function wasmFallbackPlugin(): WasmFallbackPlugin;
|
|
51
|
+
export declare function transformPlugin(config?: TransformPluginConfig): TransformPlugin;
|
|
52
|
+
export declare function loadFallbackPlugin(): LoadFallbackPlugin;
|
|
53
|
+
export declare function aliasPlugin(config: AliasPluginConfig): AliasPlugin;
|
|
54
|
+
export declare function jsonPlugin(config?: BindingJsonPluginConfig): JsonPlugin;
|
|
55
|
+
export declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuildImportAnalysisPlugin;
|
|
56
|
+
/**
|
|
57
|
+
* ## Usage
|
|
58
|
+
*
|
|
59
|
+
* ```js
|
|
60
|
+
* replacePlugin({
|
|
61
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
62
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
63
|
+
* __buildVersion: 15
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* ### With options
|
|
68
|
+
*
|
|
69
|
+
* ```js
|
|
70
|
+
* replacePlugin({
|
|
71
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
72
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
73
|
+
* __buildVersion: 15
|
|
74
|
+
* }, {
|
|
75
|
+
* preventAssignment: false,
|
|
76
|
+
* })
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
export declare function replacePlugin(values?: BindingReplacePluginConfig['values'], options?: Omit<BindingReplacePluginConfig, 'values'>): ReplacePlugin;
|
|
13
81
|
export declare function bindingifyBuiltInPlugin(plugin: BuiltinPlugin): BindingBuiltinPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BindingHookResolveIdExtraArgs, BindingTransformHookExtraArgs, RenderedChunk } from '../binding';
|
|
2
2
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
3
|
import type { NullValue, MaybePromise, PartialNull, MakeAsync } from '../types/utils';
|
|
4
4
|
import type { SourceMapInput } from '../types/sourcemap';
|
|
5
5
|
import type { ModuleInfo } from '../types/module-info';
|
|
6
6
|
import type { OutputBundle } from '../types/output-bundle';
|
|
7
7
|
import { PluginContext } from './plugin-context';
|
|
8
|
-
import type { TransformPluginContext } from './
|
|
8
|
+
import type { TransformPluginContext } from './transform-plugin-context';
|
|
9
9
|
import type { NormalizedOutputOptions } from '../options/normalized-output-options';
|
|
10
10
|
import type { LogLevel } from '../log/logging';
|
|
11
11
|
import type { RollupLog } from '../rollup';
|
|
@@ -13,8 +13,12 @@ import type { MinimalPluginContext } from '../log/logger';
|
|
|
13
13
|
import { InputOptions, OutputOptions } from '..';
|
|
14
14
|
import { BuiltinPlugin } from './builtin-plugin';
|
|
15
15
|
import { ParallelPlugin } from './parallel-plugin';
|
|
16
|
+
import type { DefinedHookNames } from '../constants/plugin';
|
|
17
|
+
import { DEFINED_HOOK_NAMES } from '../constants/plugin';
|
|
18
|
+
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
16
19
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
17
|
-
export type
|
|
20
|
+
export type ModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
21
|
+
export type ImportKind = BindingHookResolveIdExtraArgs['kind'];
|
|
18
22
|
export interface CustomPluginOptions {
|
|
19
23
|
[plugin: string]: any;
|
|
20
24
|
}
|
|
@@ -33,50 +37,83 @@ export interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
|
|
|
33
37
|
export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
|
|
34
38
|
code: string;
|
|
35
39
|
map?: SourceMapInput;
|
|
40
|
+
moduleType?: ModuleType;
|
|
41
|
+
}
|
|
42
|
+
interface ResolveIdExtraOptions {
|
|
43
|
+
custom?: CustomPluginOptions;
|
|
44
|
+
isEntry: boolean;
|
|
45
|
+
kind: 'import' | 'dynamic-import' | 'require-call';
|
|
46
|
+
}
|
|
47
|
+
export interface PrivateResolveIdExtraOptions extends ResolveIdExtraOptions {
|
|
48
|
+
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
36
49
|
}
|
|
37
50
|
export type ResolveIdResult = string | NullValue | false | PartialResolvedId;
|
|
38
51
|
export type LoadResult = NullValue | string | SourceDescription;
|
|
39
52
|
export type TransformResult = NullValue | string | Partial<SourceDescription>;
|
|
40
53
|
export interface FunctionPluginHooks {
|
|
41
|
-
onLog: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
42
|
-
options: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
43
|
-
outputOptions: (this: null, options: OutputOptions) => NullValue | OutputOptions;
|
|
44
|
-
buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
45
|
-
resolveId: (this: PluginContext, source: string, importer: string | undefined, extraOptions:
|
|
54
|
+
[DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
55
|
+
[DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
56
|
+
[DEFINED_HOOK_NAMES.outputOptions]: (this: null, options: OutputOptions) => NullValue | OutputOptions;
|
|
57
|
+
[DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
58
|
+
[DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
|
|
46
59
|
/**
|
|
47
60
|
* @deprecated
|
|
48
61
|
* This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
|
|
49
62
|
*/
|
|
50
|
-
resolveDynamicImport: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
|
|
51
|
-
load: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
52
|
-
transform: (this: TransformPluginContext, code: string, id: string
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
[DEFINED_HOOK_NAMES.resolveDynamicImport]: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
|
|
64
|
+
[DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
65
|
+
[DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
|
|
66
|
+
moduleType: ModuleType;
|
|
67
|
+
}) => TransformResult;
|
|
68
|
+
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
69
|
+
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
70
|
+
[DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
71
|
+
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => NullValue | string | {
|
|
57
72
|
code: string;
|
|
58
73
|
map?: SourceMapInput;
|
|
59
74
|
};
|
|
60
|
-
augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
61
|
-
renderError: (this: PluginContext, error: Error) => void;
|
|
62
|
-
generateBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
63
|
-
writeBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
75
|
+
[DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
76
|
+
[DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
|
|
77
|
+
[DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
78
|
+
[DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
64
79
|
}
|
|
80
|
+
export type PluginOrder = 'pre' | 'post' | null;
|
|
81
|
+
export type ObjectHookMeta<O = {}> = {
|
|
82
|
+
order?: PluginOrder;
|
|
83
|
+
} & O;
|
|
65
84
|
export type ObjectHook<T, O = {}> = T | ({
|
|
66
85
|
handler: T;
|
|
67
|
-
} & O);
|
|
68
|
-
export type SyncPluginHooks = 'augmentChunkHash' | 'onLog' | 'outputOptions';
|
|
86
|
+
} & ObjectHookMeta<O>);
|
|
87
|
+
export type SyncPluginHooks = DefinedHookNames['augmentChunkHash' | 'onLog' | 'outputOptions'];
|
|
69
88
|
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
70
|
-
export type FirstPluginHooks = 'load' | '
|
|
71
|
-
export type SequentialPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'onLog' | 'options' | 'outputOptions' | 'renderChunk' | 'transform';
|
|
72
|
-
export type AddonHooks = 'banner';
|
|
73
|
-
export type OutputPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle';
|
|
89
|
+
export type FirstPluginHooks = DefinedHookNames['load' | 'resolveDynamicImport' | 'resolveId'];
|
|
90
|
+
export type SequentialPluginHooks = DefinedHookNames['augmentChunkHash' | 'generateBundle' | 'onLog' | 'options' | 'outputOptions' | 'renderChunk' | 'transform'];
|
|
91
|
+
export type AddonHooks = DefinedHookNames['banner' | 'footer' | 'intro' | 'outro'];
|
|
92
|
+
export type OutputPluginHooks = DefinedHookNames['augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle'];
|
|
74
93
|
export type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
94
|
+
export type hookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'transform' ? {
|
|
95
|
+
filter?: BaseHookFilter;
|
|
96
|
+
} : K extends 'load' | 'resolveId' ? {
|
|
97
|
+
filter?: Omit<BaseHookFilter, 'code' | 'moduleType'>;
|
|
98
|
+
} : {};
|
|
99
|
+
export type BaseHookFilter = {
|
|
100
|
+
id?: {
|
|
101
|
+
include?: (string | RegExp)[];
|
|
102
|
+
exclude?: (string | RegExp)[];
|
|
103
|
+
};
|
|
104
|
+
moduleType?: ModuleType[] | {
|
|
105
|
+
include?: ModuleType[];
|
|
106
|
+
};
|
|
107
|
+
code?: {
|
|
108
|
+
include?: (string | RegExp)[];
|
|
109
|
+
exclude?: (string | RegExp)[];
|
|
110
|
+
};
|
|
111
|
+
};
|
|
75
112
|
export type PluginHooks = {
|
|
76
|
-
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K]
|
|
113
|
+
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], hookFilterExtension<K>>;
|
|
77
114
|
};
|
|
78
115
|
export type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
|
|
79
|
-
export type AddonHook = AddonHookFunction;
|
|
116
|
+
export type AddonHook = string | AddonHookFunction;
|
|
80
117
|
export interface OutputPlugin extends Partial<{
|
|
81
118
|
[K in OutputPluginHooks]: PluginHooks[K];
|
|
82
119
|
}>, Partial<{
|
|
@@ -85,5 +122,8 @@ export interface OutputPlugin extends Partial<{
|
|
|
85
122
|
name?: string;
|
|
86
123
|
}
|
|
87
124
|
export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
125
|
+
api?: A;
|
|
88
126
|
}
|
|
89
|
-
export type RolldownPlugin<A = any> = Plugin<A> |
|
|
127
|
+
export type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
|
|
128
|
+
export type RolldownPluginRec<A = any> = RolldownPlugin<A> | RolldownPlugin<A>[];
|
|
129
|
+
export {};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { BindingPluginContext } from '../binding';
|
|
2
2
|
import { ModuleInfo, ModuleOptions } from '..';
|
|
3
|
+
import { PluginContextResolveOptions } from './plugin-context';
|
|
3
4
|
export declare class PluginContextData {
|
|
4
5
|
modules: Map<string, ModuleInfo>;
|
|
5
6
|
moduleIds: Array<string> | null;
|
|
6
7
|
moduleOptionMap: Map<string, ModuleOptions>;
|
|
8
|
+
resolveOptionsMap: Map<number, PluginContextResolveOptions>;
|
|
7
9
|
updateModuleOption(id: string, option: ModuleOptions): void;
|
|
10
|
+
getModuleOption(id: string): ModuleOptions | undefined;
|
|
8
11
|
getModuleInfo(id: string, context: BindingPluginContext): ModuleInfo | null;
|
|
9
12
|
getModuleIds(context: BindingPluginContext): IterableIterator<string>;
|
|
13
|
+
saveResolveOptions(options: PluginContextResolveOptions): number;
|
|
14
|
+
getSavedResolveOptions(receipt: number): PluginContextResolveOptions | undefined;
|
|
15
|
+
removeSavedResolveOptions(receipt: number): void;
|
|
10
16
|
}
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
import type { RollupError, LoggingFunction } from '../rollup';
|
|
2
2
|
import type { BindingPluginContext } from '../binding';
|
|
3
3
|
import type { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
4
|
-
import type { Plugin } from './index';
|
|
4
|
+
import type { CustomPluginOptions, Plugin, ResolvedId } from './index';
|
|
5
5
|
import { AssetSource } from '../utils/asset-source';
|
|
6
6
|
import { ModuleInfo } from '../types/module-info';
|
|
7
7
|
import { PluginContextData } from './plugin-context-data';
|
|
8
|
+
import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
|
|
8
9
|
export interface EmittedAsset {
|
|
9
10
|
type: 'asset';
|
|
10
11
|
name?: string;
|
|
11
12
|
fileName?: string;
|
|
13
|
+
originalFileName?: string | null;
|
|
12
14
|
source: AssetSource;
|
|
13
15
|
}
|
|
14
16
|
export type EmittedFile = EmittedAsset;
|
|
17
|
+
export interface PluginContextResolveOptions {
|
|
18
|
+
skipSelf?: boolean;
|
|
19
|
+
custom?: CustomPluginOptions;
|
|
20
|
+
}
|
|
21
|
+
export interface PrivatePluginContextResolveOptions extends PluginContextResolveOptions {
|
|
22
|
+
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
|
|
23
|
+
}
|
|
15
24
|
export declare class PluginContext {
|
|
16
25
|
debug: LoggingFunction;
|
|
17
26
|
info: LoggingFunction;
|
|
18
27
|
warn: LoggingFunction;
|
|
19
|
-
error: (error: RollupError | string) => never;
|
|
20
|
-
resolve:
|
|
21
|
-
emitFile: (file: EmittedAsset) => string;
|
|
22
|
-
getFileName: (referenceId: string) => string;
|
|
23
|
-
getModuleInfo: (id: string) => ModuleInfo | null;
|
|
24
|
-
getModuleIds: () => IterableIterator<string>;
|
|
28
|
+
readonly error: (error: RollupError | string) => never;
|
|
29
|
+
readonly resolve: (source: string, importer?: string, options?: PluginContextResolveOptions) => Promise<ResolvedId | null>;
|
|
30
|
+
readonly emitFile: (file: EmittedAsset) => string;
|
|
31
|
+
readonly getFileName: (referenceId: string) => string;
|
|
32
|
+
readonly getModuleInfo: (id: string) => ModuleInfo | null;
|
|
33
|
+
readonly getModuleIds: () => IterableIterator<string>;
|
|
34
|
+
readonly addWatchFile: (id: string) => void;
|
|
25
35
|
/**
|
|
26
36
|
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
|
|
27
37
|
*/
|
|
28
|
-
parse: (input: string, options?: any) => any;
|
|
38
|
+
readonly parse: (input: string, options?: any) => any;
|
|
29
39
|
constructor(options: NormalizedInputOptions, context: BindingPluginContext, plugin: Plugin, data: PluginContextData);
|
|
30
40
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Plugin,
|
|
1
|
+
import { Plugin, RolldownPluginRec } from './';
|
|
2
2
|
import { NormalizedInputOptions } from '../options/normalized-input-options';
|
|
3
3
|
import { InputOptions, OutputOptions } from '..';
|
|
4
4
|
export declare class PluginDriver {
|
|
5
5
|
callOptionsHook(inputOptions: InputOptions): Promise<InputOptions>;
|
|
6
6
|
callOutputOptionsHook(inputOptions: NormalizedInputOptions, outputOptions: OutputOptions): OutputOptions;
|
|
7
7
|
}
|
|
8
|
-
export declare function getObjectPlugins(plugins:
|
|
8
|
+
export declare function getObjectPlugins(plugins: RolldownPluginRec[]): Plugin[];
|
package/dist/types/rollup.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function arraify<T>(value: T | T[]): T[];
|
|
2
|
+
export declare function isNullish(value: any): value is null | undefined | void;
|
|
2
3
|
export declare function unimplemented(info?: string): never;
|
|
3
4
|
export declare function unreachable(info?: string): never;
|
|
4
5
|
export declare function unsupported(info: string): () => never;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { AnyFn } from '../types/utils';
|
|
2
|
+
import type { ObjectHook, ObjectHookMeta } from '../plugin';
|
|
3
|
+
export declare function normalizeHook<Hook extends ObjectHook<AnyFn | string>>(hook: Hook): Hook extends ObjectHook<infer RawHook, infer CustomOptions> ? {
|
|
4
|
+
handler: RawHook;
|
|
5
|
+
options: CustomOptions;
|
|
6
|
+
meta: ObjectHookMeta;
|
|
7
|
+
} : never;
|
|
@@ -9,4 +9,5 @@ export type ShowPropertiesEqualStatus<A, B> = {
|
|
|
9
9
|
[K in keyof A]: K extends keyof B ? IsEqual<A[K], B[K]> : true;
|
|
10
10
|
};
|
|
11
11
|
export type IsPropertiesEqual<A, B> = IsValuesOfObjectAllTrue<ShowPropertiesEqualStatus<A, B>>;
|
|
12
|
+
export type AssertNever<T extends never> = T;
|
|
12
13
|
export {};
|