@vitejs/plugin-rsc 0.5.19 → 0.5.20

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.
Files changed (41) hide show
  1. package/dist/browser.d.ts +2 -2
  2. package/dist/{chunk-Dj_d7TT4.js → chunk-f2BShn47.js} +1 -1
  3. package/dist/{cjs-D2v1gYgq.js → cjs-v2jRTNln.js} +1 -61
  4. package/dist/core/browser.d.ts +5 -1
  5. package/dist/core/browser.js +1 -1
  6. package/dist/core/plugin.js +25 -1
  7. package/dist/core/rsc.d.ts +1 -1
  8. package/dist/core/rsc.js +84 -1
  9. package/dist/core/ssr.d.ts +1 -1
  10. package/dist/core/ssr.js +1 -1
  11. package/dist/import-environment-B994HXEc.d.ts +11 -0
  12. package/dist/index.d.ts +3 -2
  13. package/dist/index.js +4 -4
  14. package/dist/{picocolors-BRyoHAlU.js → picocolors-B0A1T24z.js} +1 -1
  15. package/dist/plugin.d.ts +179 -3
  16. package/dist/plugin.js +1461 -4
  17. package/dist/plugins/cjs.js +62 -1
  18. package/dist/react/browser.d.ts +2 -2
  19. package/dist/react/rsc.js +1 -1
  20. package/dist/rsc.d.ts +3 -2
  21. package/dist/rsc.js +2 -2
  22. package/dist/ssr.d.ts +3 -2
  23. package/dist/ssr.js +1 -1
  24. package/dist/transforms/index.d.ts +1 -1
  25. package/dist/transforms/index.js +1 -1
  26. package/dist/utils/encryption-runtime.js +1 -2
  27. package/dist/utils/rpc.js +89 -1
  28. package/dist/validate-import-DJumtHRw.js +498 -0
  29. package/package.json +7 -7
  30. package/dist/browser-s-WcB8A7.d.ts +0 -6
  31. package/dist/plugin-BGmSmdwL.js +0 -27
  32. package/dist/plugin-K7i9F4Fd.d.ts +0 -187
  33. package/dist/plugin-Xwi_Uxiv.js +0 -1947
  34. package/dist/rpc-EIuXyQpO.js +0 -91
  35. package/dist/rsc-Bhp6O2qz.js +0 -86
  36. /package/dist/{encryption-utils-DdqSKS_O.js → encryption-utils-Bk5eKdu6.js} +0 -0
  37. /package/dist/{index-now_lP2V.d.ts → index-BIbdRBfk.d.ts} +0 -0
  38. /package/dist/{index-CLmWsR1c.d.ts → server-action-B2zS9t-J.d.ts} +0 -0
  39. /package/dist/{transforms-B2EJTNXG.js → server-action-JkEy-6yW.js} +0 -0
  40. /package/dist/{shared-rtJPs0Yj.js → shared-Dhw3vs8e.js} +0 -0
  41. /package/dist/{shared-CGK4coF3.js → shared-d80_k_tn.js} +0 -0
@@ -1,187 +0,0 @@
1
- import { s as TransformWrapExportFilter } from "./index-CLmWsR1c.js";
2
- import MagicString from "magic-string";
3
- import { Plugin, ResolvedConfig, Rollup, ViteDevServer, parseAstAsync } from "vite";
4
-
5
- //#region src/plugins/import-environment.d.ts
6
- type EnvironmentImportMeta = {
7
- resolvedId: string;
8
- targetEnv: string;
9
- sourceEnv: string;
10
- specifier: string;
11
- };
12
- //#endregion
13
- //#region src/plugin.d.ts
14
- type ClientReferenceMeta = {
15
- importId: string;
16
- referenceKey: string;
17
- packageSource?: string;
18
- exportNames: string[];
19
- renderedExports: string[];
20
- serverChunk?: string;
21
- groupChunkId?: string;
22
- };
23
- type ServerRerferenceMeta = {
24
- importId: string;
25
- referenceKey: string;
26
- exportNames: string[];
27
- };
28
- /**
29
- * @experimental
30
- */
31
- declare class RscPluginManager {
32
- server: ViteDevServer;
33
- config: ResolvedConfig;
34
- bundles: Record<string, Rollup.OutputBundle>;
35
- buildAssetsManifest: AssetsManifest | undefined;
36
- isScanBuild: boolean;
37
- clientReferenceMetaMap: Record<string, ClientReferenceMeta>;
38
- clientReferenceGroups: Record<string, ClientReferenceMeta[]>;
39
- serverReferenceMetaMap: Record<string, ServerRerferenceMeta>;
40
- serverResourcesMetaMap: Record<string, {
41
- key: string;
42
- }>;
43
- environmentImportMetaMap: Record<string, Record<string, Record<string, EnvironmentImportMeta>>>;
44
- stabilize(): void;
45
- toRelativeId(id: string): string;
46
- writeAssetsManifest(environmentNames: string[]): void;
47
- writeEnvironmentImportsManifest(): void;
48
- }
49
- type RscPluginOptions = {
50
- /**
51
- * shorthand for configuring `environments.(name).build.rollupOptions.input.index`
52
- */
53
- entries?: Partial<Record<"client" | "ssr" | "rsc", string>>; /** @default { enviornmentName: "rsc", entryName: "index" } */
54
- serverHandler?: {
55
- environmentName: string;
56
- entryName: string;
57
- } | false; /** @default false */
58
- loadModuleDevProxy?: boolean;
59
- rscCssTransform?: false | {
60
- filter?: (id: string) => boolean;
61
- };
62
- /**
63
- * This option allows customizing how client build copies assets from server build.
64
- * By default, all assets are copied, but frameworks can establish server asset convention
65
- * to tighten security using this option.
66
- */
67
- copyServerAssetsToClient?: (fileName: string) => boolean;
68
- /**
69
- * This option allows disabling action closure encryption for debugging purpose.
70
- * @default true
71
- */
72
- enableActionEncryption?: boolean;
73
- /**
74
- * By default, the plugin uses a build-time generated encryption key for
75
- * "use server" closure argument binding.
76
- * This can be overwritten by configuring `defineEncryptionKey` option,
77
- * for example, to obtain a key through environment variable during runtime.
78
- * cf. https://nextjs.org/docs/app/guides/data-security#overwriting-encryption-keys-advanced
79
- */
80
- defineEncryptionKey?: string; /** Escape hatch for Waku's `allowServer` */
81
- keepUseCientProxy?: boolean;
82
- /**
83
- * Enable build-time validation of 'client-only' and 'server-only' imports
84
- * @default true
85
- */
86
- validateImports?: boolean;
87
- /**
88
- * use `Plugin.buildApp` hook (introduced on Vite 7) instead of `builder.buildApp` configuration
89
- * for better composability with other plugins.
90
- * @default true since Vite 7
91
- */
92
- useBuildAppHook?: boolean;
93
- /**
94
- * Skip the default buildApp orchestration for downstream frameworks
95
- * to implement custom build pipelines using `getPluginApi()`.
96
- * @experimental
97
- * @default false
98
- */
99
- customBuildApp?: boolean;
100
- /**
101
- * Custom environment configuration
102
- * @experimental
103
- * @default { browser: 'client', ssr: 'ssr', rsc: 'rsc' }
104
- */
105
- environment?: {
106
- browser?: string;
107
- ssr?: string;
108
- rsc?: string;
109
- };
110
- /**
111
- * Custom chunking strategy for client reference modules.
112
- *
113
- * This function allows you to group multiple client components into
114
- * custom chunks instead of having each module in its own chunk.
115
- * By default, client chunks are grouped by `meta.serverChunk`.
116
- */
117
- clientChunks?: (meta: {
118
- /** client reference module id */id: string; /** normalized client reference module id */
119
- normalizedId: string; /** server chunk which includes a corresponding client reference proxy module */
120
- serverChunk: string;
121
- }) => string | undefined;
122
- /**
123
- * Controls whether CSS links use React's `precedence` attribute.
124
- * @experimental
125
- * @default true
126
- */
127
- cssLinkPrecedence?: boolean;
128
- /**
129
- * Opt out of the default "index" client entry convention.
130
- * When enabled, the plugin will not:
131
- * - Require an entry chunk named "index"
132
- * - Automatically include client entry deps in each client reference's dependencies
133
- *
134
- * Note: `import.meta.viteRsc.loadBootstrapScriptContent` cannot be used with this option.
135
- *
136
- * Use this when you manually handle client entry setup and preloading.
137
- *
138
- * @experimental
139
- * @default false
140
- */
141
- customClientEntry?: boolean;
142
- };
143
- type PluginApi = {
144
- manager: RscPluginManager;
145
- };
146
- /** @experimental */
147
- declare function getPluginApi(config: Pick<ResolvedConfig, "plugins">): PluginApi | undefined;
148
- /** @experimental */
149
- declare function vitePluginRscMinimal(rscPluginOptions?: RscPluginOptions, manager?: RscPluginManager): Plugin[];
150
- declare global {
151
- function __VITE_ENVIRONMENT_RUNNER_IMPORT__(environmentName: string, id: string): Promise<any>;
152
- }
153
- declare function vitePluginRsc(rscPluginOptions?: RscPluginOptions): Plugin[];
154
- declare class RuntimeAsset {
155
- runtime: string;
156
- constructor(value: string);
157
- }
158
- type AssetsManifest = {
159
- bootstrapScriptContent: string | RuntimeAsset;
160
- clientReferenceDeps: Record<string, AssetDeps>;
161
- serverResources?: Record<string, Pick<AssetDeps, "css">>;
162
- cssLinkPrecedence?: boolean;
163
- };
164
- type AssetDeps = {
165
- js: (string | RuntimeAsset)[];
166
- css: (string | RuntimeAsset)[];
167
- };
168
- type ResolvedAssetsManifest = {
169
- bootstrapScriptContent: string;
170
- clientReferenceDeps: Record<string, ResolvedAssetDeps>;
171
- serverResources?: Record<string, Pick<ResolvedAssetDeps, "css">>;
172
- cssLinkPrecedence?: boolean;
173
- };
174
- type ResolvedAssetDeps = {
175
- js: string[];
176
- css: string[];
177
- };
178
- declare function transformRscCssExport(options: {
179
- ast: Awaited<ReturnType<typeof parseAstAsync>>;
180
- code: string;
181
- id?: string;
182
- filter: TransformWrapExportFilter;
183
- }): Promise<{
184
- output: MagicString;
185
- } | undefined>;
186
- //#endregion
187
- export { ResolvedAssetsManifest as a, getPluginApi as c, vitePluginRscMinimal as d, ResolvedAssetDeps as i, transformRscCssExport as l, AssetsManifest as n, RscPluginManager as o, PluginApi as r, RscPluginOptions as s, AssetDeps as t, vitePluginRsc as u };