@rspack/core 1.2.0 → 1.2.1

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.
@@ -7,11 +7,11 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import * as binding from "@rspack/binding";
10
+ import type * as binding from "@rspack/binding";
11
11
  import * as liteTapable from "@rspack/lite-tapable";
12
12
  import Cache from "./lib/Cache";
13
13
  import CacheFacade from "./lib/CacheFacade";
14
- import { Chunk } from "./Chunk";
14
+ import type { Chunk } from "./Chunk";
15
15
  import { Compilation } from "./Compilation";
16
16
  import { ContextModuleFactory } from "./ContextModuleFactory";
17
17
  import { NormalModuleFactory } from "./NormalModuleFactory";
@@ -149,7 +149,35 @@ declare class Compiler {
149
149
  * @internal
150
150
  */
151
151
  __internal__rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
152
+ /**
153
+ * Note: This is not a webpack public API, maybe removed in future.
154
+ * @internal
155
+ */
156
+ __internal__create_compilation(native: binding.JsCompilation): Compilation;
157
+ /**
158
+ * Note: This is not a webpack public API, maybe removed in future.
159
+ * @internal
160
+ */
152
161
  __internal__registerBuiltinPlugin(plugin: binding.BuiltinPlugin): void;
162
+ /**
163
+ * Note: This is not a webpack public API, maybe removed in future.
164
+ * @internal
165
+ */
153
166
  __internal__getModuleExecutionResult(id: number): any;
167
+ /**
168
+ * Note: This is not a webpack public API, maybe removed in future.
169
+ * @internal
170
+ */
171
+ __internal__get_compilation(): Compilation | undefined;
172
+ /**
173
+ * Note: This is not a webpack public API, maybe removed in future.
174
+ * @internal
175
+ */
176
+ __internal__get_compilation_params(): CompilationParams | undefined;
177
+ /**
178
+ * Note: This is not a webpack public API, maybe removed in future.
179
+ * @internal
180
+ */
181
+ __internal__get_module_execution_results_map(): Map<number, any>;
154
182
  }
155
183
  export { Compiler };
@@ -0,0 +1,30 @@
1
+ import type { JsAfterEmitData, JsAfterTemplateExecutionData, JsAlterAssetTagGroupsData, JsAlterAssetTagsData, JsBeforeAssetTagGenerationData, JsBeforeEmitData } from "@rspack/binding";
2
+ import * as liteTapable from "@rspack/lite-tapable";
3
+ import { Compilation } from "../../Compilation";
4
+ import type { HtmlRspackPluginOptions } from "./options";
5
+ type ExtraPluginHookData = {
6
+ plugin: {
7
+ options: HtmlRspackPluginOptions;
8
+ };
9
+ };
10
+ export type HtmlRspackPluginHooks = {
11
+ beforeAssetTagGeneration: liteTapable.AsyncSeriesWaterfallHook<[
12
+ JsBeforeAssetTagGenerationData & ExtraPluginHookData
13
+ ]>;
14
+ alterAssetTags: liteTapable.AsyncSeriesWaterfallHook<[JsAlterAssetTagsData]>;
15
+ alterAssetTagGroups: liteTapable.AsyncSeriesWaterfallHook<[
16
+ JsAlterAssetTagGroupsData & ExtraPluginHookData
17
+ ]>;
18
+ afterTemplateExecution: liteTapable.AsyncSeriesWaterfallHook<[
19
+ JsAfterTemplateExecutionData & ExtraPluginHookData
20
+ ]>;
21
+ beforeEmit: liteTapable.AsyncSeriesWaterfallHook<[
22
+ JsBeforeEmitData & ExtraPluginHookData
23
+ ]>;
24
+ afterEmit: liteTapable.AsyncSeriesWaterfallHook<[
25
+ JsAfterEmitData & ExtraPluginHookData
26
+ ]>;
27
+ };
28
+ export declare const getPluginHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
29
+ export declare const cleanPluginHooks: (compilation: Compilation) => void;
30
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./plugin";
2
+ export * from "./options";
@@ -1,7 +1,4 @@
1
- import { BuiltinPluginName, type JsAfterEmitData, type JsAfterTemplateExecutionData, type JsAlterAssetTagGroupsData, type JsAlterAssetTagsData, type JsBeforeAssetTagGenerationData, type JsBeforeEmitData, type JsHtmlPluginTag } from "@rspack/binding";
2
- import * as liteTapable from "@rspack/lite-tapable";
3
- import { Compilation } from "../Compilation";
4
- import type { Compiler } from "../Compiler";
1
+ import { Compilation } from "../../Compilation";
5
2
  export type TemplateRenderFunction = (params: Record<string, any>) => string | Promise<string>;
6
3
  export type TemplateParamFunction = (params: Record<string, any>) => Record<string, any> | Promise<Record<string, any>>;
7
4
  export type HtmlRspackPluginOptions = {
@@ -67,46 +64,7 @@ export type HtmlRspackPluginOptions = {
67
64
  /** Inject a base tag */
68
65
  hash?: boolean;
69
66
  };
70
- declare const HtmlRspackPluginImpl: {
71
- new (c?: HtmlRspackPluginOptions | undefined): {
72
- name: BuiltinPluginName;
73
- _args: [c?: HtmlRspackPluginOptions | undefined];
74
- affectedHooks: "done" | "environment" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
75
- raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
76
- apply(compiler: Compiler): void;
77
- };
78
- };
79
- type ExtraPluginHookData = {
80
- plugin: {
81
- options: HtmlRspackPluginOptions;
82
- };
83
- };
84
- export type HtmlRspackPluginHooks = {
85
- beforeAssetTagGeneration: liteTapable.AsyncSeriesWaterfallHook<[
86
- JsBeforeAssetTagGenerationData & ExtraPluginHookData
87
- ]>;
88
- alterAssetTags: liteTapable.AsyncSeriesWaterfallHook<[JsAlterAssetTagsData]>;
89
- alterAssetTagGroups: liteTapable.AsyncSeriesWaterfallHook<[
90
- JsAlterAssetTagGroupsData & ExtraPluginHookData
91
- ]>;
92
- afterTemplateExecution: liteTapable.AsyncSeriesWaterfallHook<[
93
- JsAfterTemplateExecutionData & ExtraPluginHookData
94
- ]>;
95
- beforeEmit: liteTapable.AsyncSeriesWaterfallHook<[
96
- JsBeforeEmitData & ExtraPluginHookData
97
- ]>;
98
- afterEmit: liteTapable.AsyncSeriesWaterfallHook<[
99
- JsAfterEmitData & ExtraPluginHookData
100
- ]>;
101
- };
102
- declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
103
- /**
104
- * @deprecated Use `getCompilationHooks` instead.
105
- */
106
- getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
107
- getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
108
- getCompilationOptions: (compilation: Compilation) => HtmlRspackPluginOptions | void;
109
- createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string | undefined) => JsHtmlPluginTag;
110
- version: number;
111
- };
112
- export { HtmlRspackPlugin };
67
+ export declare function validateHtmlPluginOptions(options: HtmlRspackPluginOptions): void;
68
+ export declare const getPluginOptions: (compilation: Compilation) => HtmlRspackPluginOptions | undefined;
69
+ export declare const setPluginOptions: (compilation: Compilation, options: HtmlRspackPluginOptions) => void;
70
+ export declare const cleanPluginOptions: (compilation: Compilation) => void;
@@ -0,0 +1,25 @@
1
+ import { BuiltinPluginName, type JsHtmlPluginTag } from "@rspack/binding";
2
+ import type { Compilation } from "../../Compilation";
3
+ import type { Compiler } from "../../Compiler";
4
+ import { type HtmlRspackPluginHooks } from "./hooks";
5
+ import { type HtmlRspackPluginOptions } from "./options";
6
+ declare const HtmlRspackPluginImpl: {
7
+ new (c?: HtmlRspackPluginOptions | undefined): {
8
+ name: BuiltinPluginName;
9
+ _args: [c?: HtmlRspackPluginOptions | undefined];
10
+ affectedHooks: "done" | "environment" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
11
+ raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
12
+ apply(compiler: Compiler): void;
13
+ };
14
+ };
15
+ declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
16
+ /**
17
+ * @deprecated Use `getCompilationHooks` instead.
18
+ */
19
+ getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
20
+ getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
21
+ getCompilationOptions: (compilation: Compilation) => HtmlRspackPluginOptions | void;
22
+ createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string | undefined) => JsHtmlPluginTag;
23
+ version: number;
24
+ };
25
+ export { HtmlRspackPlugin };
@@ -0,0 +1,2 @@
1
+ import type { CreatePartialRegisters } from "../../taps/types";
2
+ export declare const createHtmlPluginHooksRegisters: CreatePartialRegisters<`HtmlPlugin`>;
@@ -28,7 +28,7 @@ export * from "./FileUriPlugin";
28
28
  export * from "./FlagDependencyExportsPlugin";
29
29
  export * from "./FlagDependencyUsagePlugin";
30
30
  export * from "./HotModuleReplacementPlugin";
31
- export * from "./HtmlRspackPlugin";
31
+ export * from "./html-plugin/index";
32
32
  export * from "./HttpExternalsRspackPlugin";
33
33
  export * from "./IgnorePlugin";
34
34
  export * from "./InferAsyncModulesPlugin";
@@ -575,7 +575,7 @@ export type ResolveOptions = {
575
575
  roots?: string[];
576
576
  /** Customize the Resolve configuration based on the module type. */
577
577
  byDependency?: Record<string, ResolveOptions>;
578
- /** enable yarn pnp */
578
+ /** enable Yarn PnP */
579
579
  pnp?: boolean;
580
580
  };
581
581
  /** Used to configure the Rspack module resolution */