File size: 3,040 Bytes
fea495a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import type { CssImports, ClientComponentImports } from '../loaders/next-flight-client-entry-loader';
import { webpack } from 'next/dist/compiled/webpack/webpack';
interface Options {
    dev: boolean;
    appDir: string;
    isEdgeServer: boolean;
    encryptionKey: string;
}
type Actions = {
    [actionId: string]: {
        exportedName?: string;
        filename?: string;
        workers: {
            [name: string]: {
                moduleId: string | number;
                async: boolean;
            };
        };
        layer: {
            [name: string]: string;
        };
    };
};
type ActionIdNamePair = {
    id: string;
    exportedName?: string;
    filename?: string;
};
export type ActionManifest = {
    encryptionKey: string;
    node: Actions;
    edge: Actions;
};
export interface ModuleInfo {
    moduleId: string | number;
    async: boolean;
}
export declare class FlightClientEntryPlugin {
    dev: boolean;
    appDir: string;
    projectDir: string;
    encryptionKey: string;
    isEdgeServer: boolean;
    assetPrefix: string;
    webpackRuntime: string;
    constructor(options: Options);
    apply(compiler: webpack.Compiler): void;
    createClientEntries(compiler: webpack.Compiler, compilation: webpack.Compilation): Promise<void>;
    collectClientActionsFromDependencies({ compilation, dependencies, }: {
        compilation: webpack.Compilation;
        dependencies: ReturnType<typeof webpack.EntryPlugin.createDependency>[];
    }): Map<string, ActionIdNamePair[]>;
    collectComponentInfoFromServerEntryDependency({ entryRequest, compilation, resolvedModule, }: {
        entryRequest: string;
        compilation: webpack.Compilation;
        resolvedModule: any;
    }): {
        cssImports: CssImports;
        clientComponentImports: ClientComponentImports;
        actionImports: [string, ActionIdNamePair[]][];
    };
    injectClientEntryAndSSRModules({ compiler, compilation, entryName, clientImports, bundlePath, absolutePagePath, }: {
        compiler: webpack.Compiler;
        compilation: webpack.Compilation;
        entryName: string;
        clientImports: ClientComponentImports;
        bundlePath: string;
        absolutePagePath?: string;
    }): [
        shouldInvalidate: boolean,
        addSSREntryPromise: Promise<void>,
        addRSCEntryPromise: Promise<void>,
        ssrDep: ReturnType<typeof webpack.EntryPlugin.createDependency>
    ];
    injectActionEntry({ compiler, compilation, actions, entryName, bundlePath, fromClient, createdActionIds, }: {
        compiler: webpack.Compiler;
        compilation: webpack.Compilation;
        actions: Map<string, ActionIdNamePair[]>;
        entryName: string;
        bundlePath: string;
        createdActionIds: Set<string>;
        fromClient?: boolean;
    }): Promise<any>;
    addEntry(compilation: webpack.Compilation, context: string, dependency: webpack.Dependency, options: webpack.EntryOptions): Promise<any>;
    createActionAssets(compilation: webpack.Compilation): Promise<void>;
}
export {};