Skip to content

Commit

Permalink
feat: export InitFragment class for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Mar 22, 2024
2 parents e55ea25 + 21df328 commit 4fda155
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ module.exports = mergeExports(fn, {
get HotModuleReplacementPlugin() {
return require("./HotModuleReplacementPlugin");
},
get InitFragment() {
return require("./InitFragment");
},
get IgnorePlugin() {
return require("./IgnorePlugin");
},
Expand Down
22 changes: 21 additions & 1 deletion types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5385,7 +5385,14 @@ declare interface InfrastructureLogging {
*/
stream?: NodeJS.WritableStream;
}
declare abstract class InitFragment<GenerateContext> {
declare class InitFragment<GenerateContext> {
constructor(
content: undefined | string | Source,
stage: number,
position: number,
key?: string,
endContent?: string | Source
);
content?: string | Source;
stage: number;
position: number;
Expand All @@ -5396,6 +5403,18 @@ declare abstract class InitFragment<GenerateContext> {
serialize(context: ObjectSerializerContext): void;
deserialize(context: ObjectDeserializerContext): void;
merge: any;
static addToSource<Context, T>(
source: Source,
initFragments: InitFragment<T>[],
context: Context
): Source;
static STAGE_CONSTANTS: number;
static STAGE_ASYNC_BOUNDARY: number;
static STAGE_HARMONY_EXPORTS: number;
static STAGE_HARMONY_IMPORTS: number;
static STAGE_PROVIDES: number;
static STAGE_ASYNC_DEPENDENCIES: number;
static STAGE_ASYNC_HARMONY_IMPORTS: number;
}
declare interface InputFileSystem {
readFile: ReadFileFs;
Expand Down Expand Up @@ -15363,6 +15382,7 @@ declare namespace exports {
Generator,
HotUpdateChunk,
HotModuleReplacementPlugin,
InitFragment,
IgnorePlugin,
JavascriptModulesPlugin,
LibManifestPlugin,
Expand Down

0 comments on commit 4fda155

Please sign in to comment.