@rspack/core 2.0.0-beta.5 → 2.0.0-beta.7
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/README.md +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +544 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/open/index.d.ts +161 -0
- package/compiled/open/package.json +1 -0
- package/dist/builtin-loader/swc/types.d.ts +17 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
- package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +25 -0
- package/dist/checkNodeVersion.d.ts +1 -0
- package/dist/config/devServer.d.ts +102 -237
- package/dist/config/types.d.ts +2 -5
- package/dist/container/ContainerPlugin.d.ts +3 -2
- package/dist/container/ContainerReferencePlugin.d.ts +4 -3
- package/dist/container/ModuleFederationPlugin.d.ts +2 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +109 -74
- package/dist/rslib-runtime.js +3 -3
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +2 -2
- package/dist/sharing/ConsumeSharedPlugin.d.ts +5 -5
- package/dist/sharing/ProvideSharedPlugin.d.ts +6 -5
- package/dist/sharing/SharePlugin.d.ts +9 -7
- package/hot/dev-server.js +1 -1
- package/hot/emitter.js +0 -2
- package/hot/log.js +0 -2
- package/hot/only-dev-server.js +1 -1
- package/package.json +12 -11
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
type Options = {
|
|
4
|
+
/**
|
|
5
|
+
Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
|
|
6
|
+
|
|
7
|
+
Note that it waits for the app to exit, not just for the window to close.
|
|
8
|
+
|
|
9
|
+
On Windows, you have to explicitly specify an app for it to be able to wait.
|
|
10
|
+
|
|
11
|
+
**Warning:** When opening URLs in browsers while the browser is already running, the `wait` option will not work as expected. Browsers use a single-instance architecture where new URLs are passed to the existing process, causing the command to exit immediately. Use the `newInstance` option on macOS to force a new browser instance, or avoid using `wait` with browsers.
|
|
12
|
+
|
|
13
|
+
@default false
|
|
14
|
+
*/
|
|
15
|
+
readonly wait?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
__macOS only__
|
|
19
|
+
|
|
20
|
+
Do not bring the app to the foreground.
|
|
21
|
+
|
|
22
|
+
@default false
|
|
23
|
+
*/
|
|
24
|
+
readonly background?: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
__macOS only__
|
|
28
|
+
|
|
29
|
+
Open a new instance of the app even it's already running.
|
|
30
|
+
|
|
31
|
+
A new instance is always opened on other platforms.
|
|
32
|
+
|
|
33
|
+
@default false
|
|
34
|
+
*/
|
|
35
|
+
readonly newInstance?: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
Specify the `name` of the app to open the `target` with, and optionally, app `arguments`. `app` can be an array of apps to try to open and `name` can be an array of app names to try. If each app fails, the last error will be thrown.
|
|
39
|
+
|
|
40
|
+
The app name is platform dependent. Don't hard code it in reusable modules. For example, Chrome is `google chrome` on macOS, `google-chrome` on Linux and `chrome` on Windows. If possible, use `apps` which auto-detects the correct binary to use.
|
|
41
|
+
|
|
42
|
+
You may also pass in the app's full path. For example on WSL, this can be `/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe` for the Windows installation of Chrome.
|
|
43
|
+
|
|
44
|
+
The app `arguments` are app dependent. Check the app's documentation for what arguments it accepts.
|
|
45
|
+
*/
|
|
46
|
+
readonly app?: App | readonly App[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
Allow the opened app to exit with nonzero exit code when the `wait` option is `true`.
|
|
50
|
+
|
|
51
|
+
We do not recommend setting this option. The convention for success is exit code zero.
|
|
52
|
+
|
|
53
|
+
@default false
|
|
54
|
+
*/
|
|
55
|
+
readonly allowNonzeroExitCode?: boolean;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type OpenAppOptions = {
|
|
59
|
+
/**
|
|
60
|
+
Arguments passed to the app.
|
|
61
|
+
|
|
62
|
+
These arguments are app dependent. Check the app's documentation for what arguments it accepts.
|
|
63
|
+
*/
|
|
64
|
+
readonly arguments?: readonly string[];
|
|
65
|
+
} & Omit<Options, 'app'>;
|
|
66
|
+
|
|
67
|
+
type AppName =
|
|
68
|
+
| 'chrome'
|
|
69
|
+
| 'brave'
|
|
70
|
+
| 'firefox'
|
|
71
|
+
| 'edge'
|
|
72
|
+
| 'browser'
|
|
73
|
+
| 'browserPrivate';
|
|
74
|
+
|
|
75
|
+
type App = {
|
|
76
|
+
name: string | readonly string[];
|
|
77
|
+
arguments?: readonly string[];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
An object containing auto-detected binary names for common apps. Useful to work around cross-platform differences.
|
|
82
|
+
|
|
83
|
+
@example
|
|
84
|
+
```
|
|
85
|
+
import open, {apps} from 'open';
|
|
86
|
+
|
|
87
|
+
await open('https://google.com', {
|
|
88
|
+
app: {
|
|
89
|
+
name: apps.chrome
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
*/
|
|
94
|
+
declare const apps: Record<AppName, string | readonly string[]>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
Open stuff like URLs, files, executables. Cross-platform.
|
|
98
|
+
|
|
99
|
+
Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
|
|
100
|
+
|
|
101
|
+
@param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. For example, URLs open in your default browser.
|
|
102
|
+
@returns The [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
|
|
103
|
+
|
|
104
|
+
@example
|
|
105
|
+
```
|
|
106
|
+
import open, {apps} from 'open';
|
|
107
|
+
|
|
108
|
+
// Opens the image in the default image viewer.
|
|
109
|
+
await open('unicorn.png', {wait: true});
|
|
110
|
+
console.log('The image viewer app quit');
|
|
111
|
+
|
|
112
|
+
// Opens the URL in the default browser.
|
|
113
|
+
await open('https://sindresorhus.com');
|
|
114
|
+
|
|
115
|
+
// Opens the URL in a specified browser.
|
|
116
|
+
await open('https://sindresorhus.com', {app: {name: 'firefox'}});
|
|
117
|
+
|
|
118
|
+
// Specify app arguments.
|
|
119
|
+
await open('https://sindresorhus.com', {app: {name: 'google chrome', arguments: ['--incognito']}});
|
|
120
|
+
|
|
121
|
+
// Opens the URL in the default browser in incognito mode.
|
|
122
|
+
await open('https://sindresorhus.com', {app: {name: apps.browserPrivate}});
|
|
123
|
+
```
|
|
124
|
+
*/
|
|
125
|
+
declare function open(
|
|
126
|
+
target: string,
|
|
127
|
+
options?: Options
|
|
128
|
+
): Promise<ChildProcess>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
Open an app. Cross-platform.
|
|
132
|
+
|
|
133
|
+
Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
|
|
134
|
+
|
|
135
|
+
@param name - The app you want to open. Can be either builtin supported `apps` names or other name supported in platform.
|
|
136
|
+
@returns The [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
|
|
137
|
+
|
|
138
|
+
@example
|
|
139
|
+
```
|
|
140
|
+
import open, {openApp, apps} from 'open';
|
|
141
|
+
|
|
142
|
+
// Open Firefox.
|
|
143
|
+
await openApp(apps.firefox);
|
|
144
|
+
|
|
145
|
+
// Open Chrome in incognito mode.
|
|
146
|
+
await openApp(apps.chrome, {arguments: ['--incognito']});
|
|
147
|
+
|
|
148
|
+
// Open default browser.
|
|
149
|
+
await openApp(apps.browser);
|
|
150
|
+
|
|
151
|
+
// Open default browser in incognito mode.
|
|
152
|
+
await openApp(apps.browserPrivate);
|
|
153
|
+
|
|
154
|
+
// Open Xcode.
|
|
155
|
+
await openApp('xcode');
|
|
156
|
+
```
|
|
157
|
+
*/
|
|
158
|
+
declare function openApp(name: App['name'], options?: OpenAppOptions): Promise<ChildProcess>;
|
|
159
|
+
|
|
160
|
+
export { apps, open as default, openApp };
|
|
161
|
+
export type { App, AppName, OpenAppOptions, Options };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"open","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"version":"11.0.0","funding":"https://github.com/sponsors/sindresorhus","license":"MIT","types":"index.d.ts","type":"module"}
|
|
@@ -15,18 +15,34 @@ export type SwcLoaderOptions = Config & {
|
|
|
15
15
|
* providing better TypeScript development experience and smaller output bundle size.
|
|
16
16
|
*/
|
|
17
17
|
collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Ported from [babel-plugin-import](https://github.com/umijs/babel-plugin-import),
|
|
20
|
+
* used to transform imports for modular component libraries.
|
|
21
|
+
*/
|
|
22
|
+
transformImport?: PluginImportOptions;
|
|
18
23
|
/**
|
|
19
24
|
* Experimental features provided by Rspack.
|
|
20
25
|
* @experimental
|
|
21
26
|
*/
|
|
22
27
|
rspackExperiments?: {
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use top-level `transformImport` instead.
|
|
30
|
+
*/
|
|
23
31
|
import?: PluginImportOptions;
|
|
24
32
|
/**
|
|
25
33
|
* Enable React Server Components support.
|
|
26
34
|
*/
|
|
27
|
-
reactServerComponents?: boolean;
|
|
35
|
+
reactServerComponents?: boolean | ReactServerComponentsOptions;
|
|
28
36
|
};
|
|
29
37
|
};
|
|
38
|
+
export interface ReactServerComponentsOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Whether to disable the compile-time check that reports errors when React
|
|
41
|
+
* client-only APIs (e.g. `useState`, `useEffect`) are imported in server
|
|
42
|
+
* components. Defaults to `false`.
|
|
43
|
+
*/
|
|
44
|
+
disableClientApiChecks?: boolean;
|
|
45
|
+
}
|
|
30
46
|
export interface TerserCompressOptions {
|
|
31
47
|
arguments?: boolean;
|
|
32
48
|
arrows?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
|
|
1
|
+
import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorConnectionsOnlyImport, type JsRsdoctorConnectionsOnlyImportConnection, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
|
|
2
2
|
import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist';
|
|
3
3
|
import { type Compilation } from '../Compilation.js';
|
|
4
4
|
import type { Compiler } from '../Compiler.js';
|
|
5
5
|
import type { CreatePartialRegisters } from '../taps/types.js';
|
|
6
6
|
export declare namespace RsdoctorPluginData {
|
|
7
|
-
export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch, };
|
|
7
|
+
export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorConnectionsOnlyImport as RsdoctorConnectionsOnlyImport, JsRsdoctorConnectionsOnlyImportConnection as RsdoctorConnectionsOnlyImportConnection, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch, };
|
|
8
8
|
}
|
|
9
9
|
export type RsdoctorPluginOptions = {
|
|
10
10
|
moduleGraphFeatures?: boolean | ('graph' | 'ids' | 'sources')[];
|
|
@@ -8,6 +8,7 @@ export declare class WorkerPlugin extends RspackBuiltinPlugin {
|
|
|
8
8
|
private module;
|
|
9
9
|
private workerPublicPath;
|
|
10
10
|
name: BuiltinPluginName;
|
|
11
|
+
affectedHooks: "compilation";
|
|
11
12
|
constructor(chunkLoading: ChunkLoading, wasmLoading: WasmLoading, module: OutputModule, workerPublicPath: WorkerPublicPath);
|
|
12
13
|
raw(compiler: Compiler): BuiltinPlugin;
|
|
13
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Compiler, MultiCompiler } from '../../index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DevServerMiddlewareHandler } from '../../config/devServer.js';
|
|
3
3
|
export declare const LAZY_COMPILATION_PREFIX = "/_rspack/lazy/trigger";
|
|
4
4
|
/**
|
|
5
5
|
* Create a middleware that handles lazy compilation requests from the client.
|
|
@@ -9,4 +9,4 @@ export declare const LAZY_COMPILATION_PREFIX = "/_rspack/lazy/trigger";
|
|
|
9
9
|
* Use this middleware when integrating lazy compilation into a
|
|
10
10
|
* custom development server instead of relying on the built-in server.
|
|
11
11
|
*/
|
|
12
|
-
export declare const lazyCompilationMiddleware: (compiler: Compiler | MultiCompiler) =>
|
|
12
|
+
export declare const lazyCompilationMiddleware: (compiler: Compiler | MultiCompiler) => DevServerMiddlewareHandler;
|
|
@@ -2,9 +2,34 @@ import type binding from '@rspack/binding';
|
|
|
2
2
|
import type { Compiler } from '../../index.js';
|
|
3
3
|
import { RspackBuiltinPlugin } from '../base.js';
|
|
4
4
|
import { type Coordinator } from './Coordinator.js';
|
|
5
|
+
/** Manifest export entry (server/client actions, module refs). */
|
|
6
|
+
export interface RscManifestExport {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
chunks: string[];
|
|
10
|
+
async?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Map of export name to manifest export. */
|
|
13
|
+
export type RscManifestNode = Record<string, RscManifestExport>;
|
|
14
|
+
/** Module loading config (prefix, crossOrigin). */
|
|
15
|
+
export interface RscModuleLoading {
|
|
16
|
+
prefix: string;
|
|
17
|
+
crossOrigin?: 'use-credentials' | '';
|
|
18
|
+
}
|
|
19
|
+
export interface RscManifestPerEntry {
|
|
20
|
+
serverManifest: Record<string, RscManifestExport>;
|
|
21
|
+
clientManifest: Record<string, RscManifestExport>;
|
|
22
|
+
serverConsumerModuleMap: Record<string, RscManifestNode>;
|
|
23
|
+
moduleLoading: RscModuleLoading;
|
|
24
|
+
entryCssFiles: Record<string, string[]>;
|
|
25
|
+
entryJsFiles: string[];
|
|
26
|
+
}
|
|
27
|
+
/** Full RSC manifest (all entries) passed to onManifest. Map from entry name to per-entry manifest. */
|
|
28
|
+
export type RscManifest = Record<string, RscManifestPerEntry>;
|
|
5
29
|
export type RscServerPluginOptions = {
|
|
6
30
|
coordinator: Coordinator;
|
|
7
31
|
onServerComponentChanges?: () => Promise<void>;
|
|
32
|
+
onManifest?: (manifest: RscManifest) => void | Promise<void>;
|
|
8
33
|
};
|
|
9
34
|
export declare class RscServerPlugin extends RspackBuiltinPlugin {
|
|
10
35
|
#private;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare function checkNodeVersion(): void;
|