rolldown 0.12.2-snapshot-3ea6797-20240810002921 → 0.12.2-snapshot-e65c643-20240811191124
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 +2 -2
- package/dist/cjs/experimental-index.cjs +2 -2
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/parallel-plugin-worker.cjs +1 -1
- package/dist/esm/cli.mjs +2 -2
- package/dist/esm/experimental-index.mjs +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/parallel-plugin-worker.mjs +1 -1
- package/dist/shared/{plugin-context-data-I1aPS5hK.cjs → plugin-context-data-DXDLCu7_.cjs} +179 -115
- package/dist/shared/{plugin-context-data-l2hAUTQq.mjs → plugin-context-data-ymCbOD0T.mjs} +179 -115
- package/dist/shared/{rolldown-tWN4pzYf.cjs → rolldown-HPuKu0TA.cjs} +54 -13
- package/dist/shared/{rolldown-gbhp04Mo.mjs → rolldown-Lp-BFTO_.mjs} +54 -13
- package/dist/shared/rolldown-binding.wasi.cjs +54 -49
- package/dist/types/binding.d.ts +40 -0
- package/dist/types/constants/plugin.d.ts +28 -1
- package/dist/types/experimental-index.d.ts +4 -6
- package/dist/types/options/input-options.d.ts +38 -22
- package/dist/types/options/normalized-ecma-transform-plugin-config.d.ts +1 -1
- package/dist/types/options/output-options.d.ts +8 -8
- package/dist/types/plugin/bindingify-build-hooks.d.ts +8 -7
- package/dist/types/plugin/bindingify-output-hooks.d.ts +11 -10
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +7 -0
- package/dist/types/plugin/index.d.ts +30 -23
- package/dist/types/plugin/plugin-driver.d.ts +2 -2
- package/dist/types/utils/normalize-hook.d.ts +7 -2
- package/dist/types/utils/plugin/index.d.ts +2 -0
- package/package.json +14 -14
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ObjectHookMeta } from '.';
|
|
2
|
+
import { BindingPluginHookMeta } from '../binding';
|
|
3
|
+
export declare function bindingifyPluginHookMeta(options: ObjectHookMeta): BindingPluginHookMeta;
|
|
4
|
+
export type PluginHookWithBindingMeta<T> = [
|
|
5
|
+
T | undefined,
|
|
6
|
+
BindingPluginHookMeta | undefined
|
|
7
|
+
];
|
|
@@ -13,6 +13,8 @@ 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';
|
|
16
18
|
export type ModuleSideEffects = boolean | 'no-treeshake' | null;
|
|
17
19
|
export type ModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
|
18
20
|
export type ImportKind = BindingHookResolveIdExtraArgs['kind'];
|
|
@@ -46,41 +48,45 @@ export type TransformResult = NullValue | string | (Partial<SourceDescription> &
|
|
|
46
48
|
moduleType?: ModuleType;
|
|
47
49
|
});
|
|
48
50
|
export interface FunctionPluginHooks {
|
|
49
|
-
onLog: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
50
|
-
options: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
51
|
-
outputOptions: (this: null, options: OutputOptions) => NullValue | OutputOptions;
|
|
52
|
-
buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
53
|
-
resolveId: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
|
|
51
|
+
[DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
|
|
52
|
+
[DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
|
|
53
|
+
[DEFINED_HOOK_NAMES.outputOptions]: (this: null, options: OutputOptions) => NullValue | OutputOptions;
|
|
54
|
+
[DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
55
|
+
[DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
|
|
54
56
|
/**
|
|
55
57
|
* @deprecated
|
|
56
58
|
* This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
|
|
57
59
|
*/
|
|
58
|
-
resolveDynamicImport: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
|
|
59
|
-
load: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
60
|
-
transform: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
|
|
60
|
+
[DEFINED_HOOK_NAMES.resolveDynamicImport]: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
|
|
61
|
+
[DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
|
|
62
|
+
[DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
|
|
61
63
|
moduleType: ModuleType;
|
|
62
64
|
}) => TransformResult;
|
|
63
|
-
moduleParsed: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
64
|
-
buildEnd: (this: PluginContext, err?: Error) => void;
|
|
65
|
-
renderStart: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
66
|
-
renderChunk: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => NullValue | string | {
|
|
65
|
+
[DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
|
|
66
|
+
[DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
|
|
67
|
+
[DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
|
|
68
|
+
[DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) => NullValue | string | {
|
|
67
69
|
code: string;
|
|
68
70
|
map?: SourceMapInput;
|
|
69
71
|
};
|
|
70
|
-
augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
71
|
-
renderError: (this: PluginContext, error: Error) => void;
|
|
72
|
-
generateBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
73
|
-
writeBundle: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
72
|
+
[DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
73
|
+
[DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
|
|
74
|
+
[DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
|
|
75
|
+
[DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
|
|
74
76
|
}
|
|
77
|
+
export type PluginOrder = 'pre' | 'post' | null;
|
|
78
|
+
export type ObjectHookMeta<O = {}> = {
|
|
79
|
+
order?: PluginOrder;
|
|
80
|
+
} & O;
|
|
75
81
|
export type ObjectHook<T, O = {}> = T | ({
|
|
76
82
|
handler: T;
|
|
77
|
-
} & O);
|
|
78
|
-
export type SyncPluginHooks = 'augmentChunkHash' | 'onLog' | 'outputOptions';
|
|
83
|
+
} & ObjectHookMeta<O>);
|
|
84
|
+
export type SyncPluginHooks = DefinedHookNames['augmentChunkHash' | 'onLog' | 'outputOptions'];
|
|
79
85
|
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
80
|
-
export type FirstPluginHooks = 'load' | '
|
|
81
|
-
export type SequentialPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'onLog' | 'options' | 'outputOptions' | 'renderChunk' | 'transform';
|
|
82
|
-
export type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro';
|
|
83
|
-
export type OutputPluginHooks = 'augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle';
|
|
86
|
+
export type FirstPluginHooks = DefinedHookNames['load' | 'resolveDynamicImport' | 'resolveId'];
|
|
87
|
+
export type SequentialPluginHooks = DefinedHookNames['augmentChunkHash' | 'generateBundle' | 'onLog' | 'options' | 'outputOptions' | 'renderChunk' | 'transform'];
|
|
88
|
+
export type AddonHooks = DefinedHookNames['banner' | 'footer' | 'intro' | 'outro'];
|
|
89
|
+
export type OutputPluginHooks = DefinedHookNames['augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle'];
|
|
84
90
|
export type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
85
91
|
export type PluginHooks = {
|
|
86
92
|
[K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K]>;
|
|
@@ -97,5 +103,6 @@ export interface OutputPlugin extends Partial<{
|
|
|
97
103
|
export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
|
|
98
104
|
api?: A;
|
|
99
105
|
}
|
|
100
|
-
export type RolldownPlugin<A = any> = Plugin<A> |
|
|
106
|
+
export type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
|
|
107
|
+
export type RolldownPluginRec<A = any> = RolldownPlugin<A> | RolldownPlugin<A>[];
|
|
101
108
|
export {};
|
|
@@ -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[];
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown",
|
|
3
|
-
"version": "0.12.2-snapshot-
|
|
3
|
+
"version": "0.12.2-snapshot-e65c643-20240811191124",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"repository": {
|
|
@@ -102,21 +102,21 @@
|
|
|
102
102
|
"vitest": "^1.6.0",
|
|
103
103
|
"why-is-node-running": "^2.2.2",
|
|
104
104
|
"@rolldown/testing": "0.0.1",
|
|
105
|
-
"rolldown": "0.12.2-snapshot-
|
|
105
|
+
"rolldown": "0.12.2-snapshot-e65c643-20240811191124"
|
|
106
106
|
},
|
|
107
107
|
"optionalDependencies": {
|
|
108
|
-
"@rolldown/binding-darwin-arm64": "0.12.2-snapshot-
|
|
109
|
-
"@rolldown/binding-darwin-x64": "0.12.2-snapshot-
|
|
110
|
-
"@rolldown/binding-linux-arm-gnueabihf": "0.12.2-snapshot-
|
|
111
|
-
"@rolldown/binding-freebsd-x64": "0.12.2-snapshot-
|
|
112
|
-
"@rolldown/binding-linux-arm64-gnu": "0.12.2-snapshot-
|
|
113
|
-
"@rolldown/binding-linux-arm64-musl": "0.12.2-snapshot-
|
|
114
|
-
"@rolldown/binding-linux-x64-gnu": "0.12.2-snapshot-
|
|
115
|
-
"@rolldown/binding-
|
|
116
|
-
"@rolldown/binding-
|
|
117
|
-
"@rolldown/binding-
|
|
118
|
-
"@rolldown/binding-win32-
|
|
119
|
-
"@rolldown/binding-win32-
|
|
108
|
+
"@rolldown/binding-darwin-arm64": "0.12.2-snapshot-e65c643-20240811191124",
|
|
109
|
+
"@rolldown/binding-darwin-x64": "0.12.2-snapshot-e65c643-20240811191124",
|
|
110
|
+
"@rolldown/binding-linux-arm-gnueabihf": "0.12.2-snapshot-e65c643-20240811191124",
|
|
111
|
+
"@rolldown/binding-freebsd-x64": "0.12.2-snapshot-e65c643-20240811191124",
|
|
112
|
+
"@rolldown/binding-linux-arm64-gnu": "0.12.2-snapshot-e65c643-20240811191124",
|
|
113
|
+
"@rolldown/binding-linux-arm64-musl": "0.12.2-snapshot-e65c643-20240811191124",
|
|
114
|
+
"@rolldown/binding-linux-x64-gnu": "0.12.2-snapshot-e65c643-20240811191124",
|
|
115
|
+
"@rolldown/binding-linux-x64-musl": "0.12.2-snapshot-e65c643-20240811191124",
|
|
116
|
+
"@rolldown/binding-wasm32-wasi": "0.12.2-snapshot-e65c643-20240811191124",
|
|
117
|
+
"@rolldown/binding-win32-ia32-msvc": "0.12.2-snapshot-e65c643-20240811191124",
|
|
118
|
+
"@rolldown/binding-win32-x64-msvc": "0.12.2-snapshot-e65c643-20240811191124",
|
|
119
|
+
"@rolldown/binding-win32-arm64-msvc": "0.12.2-snapshot-e65c643-20240811191124"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"# Scrips for binding #": "_",
|