@rspack/browser 1.5.0-rc.0 → 1.5.0
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 +15 -0
- package/dist/Compiler.d.ts +5 -0
- package/dist/browser/{BrowserImportEsmPlugin.d.ts → BrowserHttpImportEsmPlugin.d.ts} +3 -4
- package/dist/browser/BrowserRequire.d.ts +32 -0
- package/dist/browser/index.d.ts +2 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -1
- package/dist/index.mjs +92 -72
- package/dist/napi-binding.d.ts +1 -0
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/package.json +1 -1
- package/dist/util/require.d.ts +0 -3
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<picture>
|
|
2
|
+
<img alt="Rspack Banner" src="https://assets.rspack.rs/rspack/rspack-banner.png">
|
|
3
|
+
</picture>
|
|
4
|
+
|
|
5
|
+
# @rspack/browser
|
|
6
|
+
|
|
7
|
+
Rspack for running in the browser. This is still in early stage and may not follow the semver.
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
See <https://rspack.rs/api/javascript-api/browser> for details.
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -94,6 +94,11 @@ declare class Compiler {
|
|
|
94
94
|
cache: Cache;
|
|
95
95
|
compilerPath: string;
|
|
96
96
|
options: RspackOptionsNormalized;
|
|
97
|
+
/**
|
|
98
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
__internal_browser_require: (id: string) => unknown;
|
|
97
102
|
constructor(context: string, options: RspackOptionsNormalized);
|
|
98
103
|
get recordsInputPath(): never;
|
|
99
104
|
get recordsOutputPath(): never;
|
|
@@ -2,9 +2,8 @@ import type { Compiler } from ".";
|
|
|
2
2
|
interface BrowserHttpImportPluginOptions {
|
|
3
3
|
/**
|
|
4
4
|
* ESM CDN domain
|
|
5
|
-
* @default "https://esm.sh"
|
|
6
5
|
*/
|
|
7
|
-
domain
|
|
6
|
+
domain: string | ((request: string, packageName: string) => string);
|
|
8
7
|
/**
|
|
9
8
|
* Specify ESM CDN URL for dependencies.
|
|
10
9
|
*/
|
|
@@ -18,9 +17,9 @@ interface BrowserHttpImportPluginOptions {
|
|
|
18
17
|
/**
|
|
19
18
|
* Convert imports of dependencies in node modules to http imports from esm cdn.
|
|
20
19
|
*/
|
|
21
|
-
export declare class
|
|
20
|
+
export declare class BrowserHttpImportEsmPlugin {
|
|
22
21
|
private options;
|
|
23
|
-
constructor(options
|
|
22
|
+
constructor(options: BrowserHttpImportPluginOptions);
|
|
24
23
|
apply(compiler: Compiler): void;
|
|
25
24
|
resolveWithUrlIssuer(request: string, issuer: URL): string;
|
|
26
25
|
resolveNodeModule(request: string, packageName: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Compiler } from "../Compiler";
|
|
2
|
+
type BrowserRequire = typeof Compiler.prototype.__internal_browser_require;
|
|
3
|
+
/**
|
|
4
|
+
* Represents the runtime context for CommonJS modules in a browser environment.
|
|
5
|
+
*/
|
|
6
|
+
interface CommonJsRuntime {
|
|
7
|
+
module: any;
|
|
8
|
+
exports: any;
|
|
9
|
+
require: BrowserRequire;
|
|
10
|
+
}
|
|
11
|
+
interface BrowserRequirePluginOptions {
|
|
12
|
+
/**
|
|
13
|
+
* This function defines how to execute CommonJS code.
|
|
14
|
+
*/
|
|
15
|
+
execute: (code: string, runtime: CommonJsRuntime) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This plugin inject browser-compatible `require` function to the `Compiler`.
|
|
19
|
+
* 1. It resolves the JavaScript in the memfs with Node.js resolution algorithm rather than in the host filesystem.
|
|
20
|
+
* 2. It transform ESM to CommonJS which will be executed with a user-defined `execute` function.
|
|
21
|
+
*/
|
|
22
|
+
export declare class BrowserRequirePlugin {
|
|
23
|
+
private options;
|
|
24
|
+
/**
|
|
25
|
+
* This is an unsafe way to execute code in the browser using `new Function`.
|
|
26
|
+
* It is your responsibility to ensure that your application is not vulnerable to attacks due to this function.
|
|
27
|
+
*/
|
|
28
|
+
static unsafeExecute: (code: string, runtime: CommonJsRuntime) => void;
|
|
29
|
+
constructor(options: BrowserRequirePluginOptions);
|
|
30
|
+
apply(compiler: Compiler): void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "../index";
|
|
2
|
-
export {
|
|
2
|
+
export { BrowserHttpImportEsmPlugin } from "./BrowserHttpImportEsmPlugin";
|
|
3
|
+
export { BrowserRequirePlugin } from "./BrowserRequire";
|
|
3
4
|
export declare const builtinMemFs: {
|
|
4
5
|
fs: import("memfs").IFs;
|
|
5
6
|
volume: import("memfs").Volume;
|
|
@@ -5,7 +5,8 @@ export declare class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
|
5
5
|
#private;
|
|
6
6
|
private type;
|
|
7
7
|
private externals;
|
|
8
|
+
private placeInInitial?;
|
|
8
9
|
name: BuiltinPluginName;
|
|
9
|
-
constructor(type: string, externals: Externals);
|
|
10
|
+
constructor(type: string, externals: Externals, placeInInitial?: boolean | undefined);
|
|
10
11
|
raw(): BuiltinPlugin | undefined;
|
|
11
12
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -35090,40 +35090,6 @@ var __webpack_modules__ = {
|
|
|
35090
35090
|
const { readFileSync, readdirSync, lstat, existsSync, readdir, watch } = fs;
|
|
35091
35091
|
const __WEBPACK_DEFAULT_EXPORT__ = fs;
|
|
35092
35092
|
},
|
|
35093
|
-
"./src/util/require.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
35094
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
35095
|
-
y: ()=>nonWebpackRequire
|
|
35096
|
-
});
|
|
35097
|
-
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/browser/fs.ts");
|
|
35098
|
-
var _rspack_binding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@rspack/binding");
|
|
35099
|
-
function nonWebpackRequire() {
|
|
35100
|
-
return async function(id) {
|
|
35101
|
-
return new Promise((resolve, reject)=>{
|
|
35102
|
-
(0, _rspack_binding__WEBPACK_IMPORTED_MODULE_1__.async)("", id).then(({ path: loaderPath })=>{
|
|
35103
|
-
if (!loaderPath) return void reject(`Cannot find loader of ${id}`);
|
|
35104
|
-
node_fs__WEBPACK_IMPORTED_MODULE_0__["default"].readFile(loaderPath, {}, (err, data)=>{
|
|
35105
|
-
if (err) return void reject(err);
|
|
35106
|
-
const loaderCode = (null == data ? void 0 : data.toString()) || "";
|
|
35107
|
-
const codeUrl = URL.createObjectURL(new Blob([
|
|
35108
|
-
loaderCode
|
|
35109
|
-
], {
|
|
35110
|
-
type: "text/javascript"
|
|
35111
|
-
}));
|
|
35112
|
-
try {
|
|
35113
|
-
const modulePromise = eval(`import("${codeUrl}")`);
|
|
35114
|
-
modulePromise.then((module)=>{
|
|
35115
|
-
URL.revokeObjectURL(codeUrl);
|
|
35116
|
-
resolve(module);
|
|
35117
|
-
});
|
|
35118
|
-
} catch (e) {
|
|
35119
|
-
reject(e);
|
|
35120
|
-
}
|
|
35121
|
-
});
|
|
35122
|
-
}).catch((err)=>reject(err));
|
|
35123
|
-
});
|
|
35124
|
-
};
|
|
35125
|
-
}
|
|
35126
|
-
},
|
|
35127
35093
|
"@rspack/binding": function(module) {
|
|
35128
35094
|
module.exports = __WEBPACK_EXTERNAL_MODULE__rspack_wasi_browser_js_bd433424__;
|
|
35129
35095
|
},
|
|
@@ -39188,7 +39154,6 @@ class ModuleWarning extends lib_WebpackError {
|
|
|
39188
39154
|
async function service_run() {
|
|
39189
39155
|
throw new Error("Not support browser");
|
|
39190
39156
|
}
|
|
39191
|
-
var util_require = __webpack_require__("./src/util/require.ts");
|
|
39192
39157
|
class LoadingLoaderError extends Error {
|
|
39193
39158
|
constructor(message){
|
|
39194
39159
|
super(message);
|
|
@@ -39198,9 +39163,15 @@ class LoadingLoaderError extends Error {
|
|
|
39198
39163
|
}
|
|
39199
39164
|
const LoaderLoadingError = LoadingLoaderError;
|
|
39200
39165
|
function loadLoader(loader, compiler, callback) {
|
|
39201
|
-
|
|
39202
|
-
|
|
39203
|
-
|
|
39166
|
+
{
|
|
39167
|
+
let module;
|
|
39168
|
+
try {
|
|
39169
|
+
module = compiler.__internal_browser_require(loader.path);
|
|
39170
|
+
} catch (e) {
|
|
39171
|
+
return callback(e);
|
|
39172
|
+
}
|
|
39173
|
+
return handleResult(loader, module, callback);
|
|
39174
|
+
}
|
|
39204
39175
|
}
|
|
39205
39176
|
function handleResult(loader, module, callback) {
|
|
39206
39177
|
if ("function" != typeof module && "object" != typeof module) return callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (export function or es6 module)`));
|
|
@@ -40613,12 +40584,13 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
|
40613
40584
|
type,
|
|
40614
40585
|
externals: (Array.isArray(externals) ? externals : [
|
|
40615
40586
|
externals
|
|
40616
|
-
]).filter(Boolean).map((item)=>ExternalsPlugin_class_private_field_get(this, _getRawExternalItem).call(this, item))
|
|
40587
|
+
]).filter(Boolean).map((item)=>ExternalsPlugin_class_private_field_get(this, _getRawExternalItem).call(this, item)),
|
|
40588
|
+
placeInInitial: this.placeInInitial ?? false
|
|
40617
40589
|
};
|
|
40618
40590
|
return createBuiltinPlugin(this.name, raw);
|
|
40619
40591
|
}
|
|
40620
|
-
constructor(type, externals){
|
|
40621
|
-
super(), ExternalsPlugin_class_private_method_init(this, _processRequest), ExternalsPlugin_define_property(this, "type", void 0), ExternalsPlugin_define_property(this, "externals", void 0), ExternalsPlugin_define_property(this, "name", void 0), ExternalsPlugin_class_private_field_init(this, _resolveRequestCache, {
|
|
40592
|
+
constructor(type, externals, placeInInitial){
|
|
40593
|
+
super(), ExternalsPlugin_class_private_method_init(this, _processRequest), ExternalsPlugin_define_property(this, "type", void 0), ExternalsPlugin_define_property(this, "externals", void 0), ExternalsPlugin_define_property(this, "placeInInitial", void 0), ExternalsPlugin_define_property(this, "name", void 0), ExternalsPlugin_class_private_field_init(this, _resolveRequestCache, {
|
|
40622
40594
|
writable: true,
|
|
40623
40595
|
value: void 0
|
|
40624
40596
|
}), ExternalsPlugin_class_private_field_init(this, _processResolveResult, {
|
|
@@ -40627,7 +40599,7 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
|
|
|
40627
40599
|
}), ExternalsPlugin_class_private_field_init(this, _getRawExternalItem, {
|
|
40628
40600
|
writable: true,
|
|
40629
40601
|
value: void 0
|
|
40630
|
-
}), this.type = type, this.externals = externals, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ExternalsPlugin, ExternalsPlugin_class_private_field_set(this, _resolveRequestCache, new Map()), ExternalsPlugin_class_private_field_set(this, _processResolveResult, (text)=>{
|
|
40602
|
+
}), this.type = type, this.externals = externals, this.placeInInitial = placeInInitial, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ExternalsPlugin, ExternalsPlugin_class_private_field_set(this, _resolveRequestCache, new Map()), ExternalsPlugin_class_private_field_set(this, _processResolveResult, (text)=>{
|
|
40631
40603
|
if (!text) return;
|
|
40632
40604
|
let resolveRequest = ExternalsPlugin_class_private_field_get(this, _resolveRequestCache).get(text);
|
|
40633
40605
|
if (!resolveRequest) {
|
|
@@ -45047,7 +45019,7 @@ const HtmlRspackPluginImpl = base_create(external_rspack_wasi_browser_js_.Builti
|
|
|
45047
45019
|
const templateFilePath = path_browserify_default().resolve(context, filename);
|
|
45048
45020
|
if (!browser_fs["default"].existsSync(templateFilePath)) throw new Error(`HtmlRspackPlugin: could not load file \`${filename}\` from \`${context}\``);
|
|
45049
45021
|
try {
|
|
45050
|
-
const renderer =
|
|
45022
|
+
const renderer = this.__internal_browser_require(templateFilePath);
|
|
45051
45023
|
if (false === c.templateParameters) return await renderer({});
|
|
45052
45024
|
return await renderer(generateRenderData(data));
|
|
45053
45025
|
} catch (e) {
|
|
@@ -45772,9 +45744,12 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
|
|
|
45772
45744
|
});
|
|
45773
45745
|
});
|
|
45774
45746
|
}
|
|
45775
|
-
|
|
45747
|
+
try {
|
|
45748
|
+
const htmlPlugin = compiler.__internal_browser_require(this.options.htmlPlugin);
|
|
45749
|
+
bindingHtmlHooks(htmlPlugin);
|
|
45750
|
+
} catch (e) {
|
|
45776
45751
|
if (!isErrorWithCode(e) || "MODULE_NOT_FOUND" !== e.code) throw e;
|
|
45777
|
-
}
|
|
45752
|
+
}
|
|
45778
45753
|
}
|
|
45779
45754
|
}
|
|
45780
45755
|
constructor(options = {}){
|
|
@@ -47076,7 +47051,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
47076
47051
|
if ("object" == typeof rspackFuture) {
|
|
47077
47052
|
D(rspackFuture, "bundlerInfo", {});
|
|
47078
47053
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
47079
|
-
D(rspackFuture.bundlerInfo, "version", "1.5.0
|
|
47054
|
+
D(rspackFuture.bundlerInfo, "version", "1.5.0");
|
|
47080
47055
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
47081
47056
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
47082
47057
|
}
|
|
@@ -50861,6 +50836,7 @@ class Compiler {
|
|
|
50861
50836
|
Compiler_define_property(this, "cache", void 0);
|
|
50862
50837
|
Compiler_define_property(this, "compilerPath", void 0);
|
|
50863
50838
|
Compiler_define_property(this, "options", void 0);
|
|
50839
|
+
Compiler_define_property(this, "__internal_browser_require", void 0);
|
|
50864
50840
|
Compiler_class_private_field_set(this, Compiler_initial, true);
|
|
50865
50841
|
Compiler_class_private_field_set(this, _builtinPlugins, []);
|
|
50866
50842
|
Compiler_class_private_field_set(this, _nonSkippableRegisters, []);
|
|
@@ -50969,6 +50945,9 @@ class Compiler {
|
|
|
50969
50945
|
this.running = false;
|
|
50970
50946
|
this.idle = false;
|
|
50971
50947
|
this.watchMode = false;
|
|
50948
|
+
this.__internal_browser_require = ()=>{
|
|
50949
|
+
throw new Error("Cannot execute user defined code in browser without `BrowserRequirePlugin`");
|
|
50950
|
+
};
|
|
50972
50951
|
this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader);
|
|
50973
50952
|
new JsLoaderRspackPlugin(this).apply(this);
|
|
50974
50953
|
new ExecuteModulePlugin().apply(this);
|
|
@@ -51167,7 +51146,7 @@ class MultiStats {
|
|
|
51167
51146
|
return obj;
|
|
51168
51147
|
});
|
|
51169
51148
|
if (childOptions.version) {
|
|
51170
|
-
obj.rspackVersion = "1.5.0
|
|
51149
|
+
obj.rspackVersion = "1.5.0";
|
|
51171
51150
|
obj.version = "5.75.0";
|
|
51172
51151
|
}
|
|
51173
51152
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -51287,7 +51266,7 @@ function MultiWatching_define_property(obj, key, value) {
|
|
|
51287
51266
|
else obj[key] = value;
|
|
51288
51267
|
return obj;
|
|
51289
51268
|
}
|
|
51290
|
-
class
|
|
51269
|
+
class MultiWatching {
|
|
51291
51270
|
invalidate(callback) {
|
|
51292
51271
|
if (callback) asyncLib.each(this.watchings, (watching, callback)=>watching.invalidate(callback), callback);
|
|
51293
51272
|
else for (const watching of this.watchings)watching.invalidate();
|
|
@@ -51320,7 +51299,7 @@ class MultiWatching_MultiWatching {
|
|
|
51320
51299
|
this.compiler = compiler;
|
|
51321
51300
|
}
|
|
51322
51301
|
}
|
|
51323
|
-
const
|
|
51302
|
+
const src_MultiWatching = MultiWatching;
|
|
51324
51303
|
function ArrayQueue_define_property(obj, key, value) {
|
|
51325
51304
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
51326
51305
|
value: value,
|
|
@@ -51497,10 +51476,10 @@ class MultiCompiler {
|
|
|
51497
51476
|
if (compiler.watching !== watching) return;
|
|
51498
51477
|
if (!watching.running) watching.invalidate();
|
|
51499
51478
|
}, handler);
|
|
51500
|
-
this.watching = new
|
|
51479
|
+
this.watching = new src_MultiWatching(watchings, this);
|
|
51501
51480
|
return this.watching;
|
|
51502
51481
|
}
|
|
51503
|
-
this.watching = new
|
|
51482
|
+
this.watching = new src_MultiWatching([], this);
|
|
51504
51483
|
return this.watching;
|
|
51505
51484
|
}
|
|
51506
51485
|
run(callback, options) {
|
|
@@ -52477,7 +52456,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
52477
52456
|
},
|
|
52478
52457
|
version: (object)=>{
|
|
52479
52458
|
object.version = "5.75.0";
|
|
52480
|
-
object.rspackVersion = "1.5.0
|
|
52459
|
+
object.rspackVersion = "1.5.0";
|
|
52481
52460
|
},
|
|
52482
52461
|
env: (object, _compilation, _context, { _env })=>{
|
|
52483
52462
|
object.env = _env;
|
|
@@ -54088,14 +54067,14 @@ class RspackOptionsApply {
|
|
|
54088
54067
|
compiler.outputFileSystem = browser_fs["default"];
|
|
54089
54068
|
if (options.externals) {
|
|
54090
54069
|
assert_default()(options.externalsType, "options.externalsType should have value after `applyRspackOptionsDefaults`");
|
|
54091
|
-
new ExternalsPlugin(options.externalsType, options.externals).apply(compiler);
|
|
54070
|
+
new ExternalsPlugin(options.externalsType, options.externals, false).apply(compiler);
|
|
54092
54071
|
}
|
|
54093
54072
|
if (options.externalsPresets.node) new NodeTargetPlugin().apply(compiler);
|
|
54094
54073
|
if (options.externalsPresets.electronMain) new ElectronTargetPlugin("main").apply(compiler);
|
|
54095
54074
|
if (options.externalsPresets.electronPreload) new ElectronTargetPlugin("preload").apply(compiler);
|
|
54096
54075
|
if (options.externalsPresets.electronRenderer) new ElectronTargetPlugin("renderer").apply(compiler);
|
|
54097
54076
|
if (options.externalsPresets.electron && !options.externalsPresets.electronMain && !options.externalsPresets.electronPreload && !options.externalsPresets.electronRenderer) new ElectronTargetPlugin().apply(compiler);
|
|
54098
|
-
if (options.externalsPresets.nwjs) new ExternalsPlugin("node-commonjs", "nw.gui").apply(compiler);
|
|
54077
|
+
if (options.externalsPresets.nwjs) new ExternalsPlugin("node-commonjs", "nw.gui", false).apply(compiler);
|
|
54099
54078
|
if (options.externalsPresets.web || options.externalsPresets.webAsync || options.externalsPresets.node && options.experiments.css) new HttpExternalsRspackPlugin(!!options.experiments.css, !!options.externalsPresets.webAsync).apply(compiler);
|
|
54100
54079
|
new ChunkPrefetchPreloadPlugin().apply(compiler);
|
|
54101
54080
|
if (options.output.pathinfo) new ModuleInfoHeaderPlugin("verbose" === options.output.pathinfo).apply(compiler);
|
|
@@ -56550,11 +56529,7 @@ function getDefaultEntryRuntime(paths, options, compiler) {
|
|
|
56550
56529
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
56551
56530
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
56552
56531
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
|
|
56553
|
-
compiler.webpack.Template.getFunctionContent(
|
|
56554
|
-
var e = new Error("Cannot find module './moduleFederationDefaultRuntime.js'");
|
|
56555
|
-
e.code = 'MODULE_NOT_FOUND';
|
|
56556
|
-
throw e;
|
|
56557
|
-
}())))
|
|
56532
|
+
compiler.webpack.Template.getFunctionContent(compiler.__internal_browser_require("@rspack/browser/moduleFederationDefaultRuntime.js"))
|
|
56558
56533
|
].join(";");
|
|
56559
56534
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
56560
56535
|
}
|
|
@@ -56843,7 +56818,7 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
|
56843
56818
|
i++;
|
|
56844
56819
|
}
|
|
56845
56820
|
}
|
|
56846
|
-
new ExternalsPlugin(remoteType, remoteExternals).apply(compiler);
|
|
56821
|
+
new ExternalsPlugin(remoteType, remoteExternals, true).apply(compiler);
|
|
56847
56822
|
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
56848
56823
|
const rawOptions = {
|
|
56849
56824
|
remoteType: this._options.remoteType,
|
|
@@ -56939,7 +56914,7 @@ function transformSync(source, options) {
|
|
|
56939
56914
|
const _options = JSON.stringify(options || {});
|
|
56940
56915
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
56941
56916
|
}
|
|
56942
|
-
const exports_rspackVersion = "1.5.0
|
|
56917
|
+
const exports_rspackVersion = "1.5.0";
|
|
56943
56918
|
const exports_version = "5.75.0";
|
|
56944
56919
|
const exports_WebpackError = Error;
|
|
56945
56920
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -57110,7 +57085,7 @@ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
|
|
|
57110
57085
|
src_fn.rspack = src_fn;
|
|
57111
57086
|
src_fn.webpack = src_fn;
|
|
57112
57087
|
const src_rspack = src_fn;
|
|
57113
|
-
function
|
|
57088
|
+
function BrowserHttpImportEsmPlugin_define_property(obj, key, value) {
|
|
57114
57089
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
57115
57090
|
value: value,
|
|
57116
57091
|
enumerable: true,
|
|
@@ -57120,13 +57095,13 @@ function BrowserImportEsmPlugin_define_property(obj, key, value) {
|
|
|
57120
57095
|
else obj[key] = value;
|
|
57121
57096
|
return obj;
|
|
57122
57097
|
}
|
|
57123
|
-
|
|
57124
|
-
class BrowserImportEsmPlugin {
|
|
57098
|
+
class BrowserHttpImportEsmPlugin {
|
|
57125
57099
|
apply(compiler) {
|
|
57126
57100
|
compiler.hooks.normalModuleFactory.tap("BrowserHttpImportPlugin", (nmf)=>{
|
|
57127
57101
|
nmf.hooks.resolve.tap("BrowserHttpImportPlugin", (resolveData)=>{
|
|
57128
57102
|
const request = resolveData.request;
|
|
57129
57103
|
const packageName = getPackageName(request);
|
|
57104
|
+
if (request.includes("!")) return;
|
|
57130
57105
|
if (this.options.dependencyUrl) {
|
|
57131
57106
|
if ("function" == typeof this.options.dependencyUrl) {
|
|
57132
57107
|
const url = this.options.dependencyUrl(packageName);
|
|
@@ -57142,7 +57117,7 @@ class BrowserImportEsmPlugin {
|
|
|
57142
57117
|
}
|
|
57143
57118
|
}
|
|
57144
57119
|
}
|
|
57145
|
-
const issuerUrl =
|
|
57120
|
+
const issuerUrl = toHttpUrl(resolveData.contextInfo.issuer);
|
|
57146
57121
|
if (issuerUrl) {
|
|
57147
57122
|
resolveData.request = this.resolveWithUrlIssuer(request, issuerUrl);
|
|
57148
57123
|
return;
|
|
@@ -57159,7 +57134,7 @@ class BrowserImportEsmPlugin {
|
|
|
57159
57134
|
}
|
|
57160
57135
|
resolveNodeModule(request, packageName) {
|
|
57161
57136
|
var _this_options_dependencyVersions;
|
|
57162
|
-
let domain =
|
|
57137
|
+
let domain = "";
|
|
57163
57138
|
if ("function" == typeof this.options.domain) domain = this.options.domain(request, packageName);
|
|
57164
57139
|
else if ("string" == typeof this.options.domain) domain = this.options.domain;
|
|
57165
57140
|
const version = (null == (_this_options_dependencyVersions = this.options.dependencyVersions) ? void 0 : _this_options_dependencyVersions[packageName]) || "latest";
|
|
@@ -57167,11 +57142,11 @@ class BrowserImportEsmPlugin {
|
|
|
57167
57142
|
return `${domain}/${versionedRequest}`;
|
|
57168
57143
|
}
|
|
57169
57144
|
isNodeModule(request) {
|
|
57170
|
-
if (
|
|
57145
|
+
if (toHttpUrl(request)) return false;
|
|
57171
57146
|
return !request.startsWith(".") && !request.startsWith("/") && !request.startsWith("!");
|
|
57172
57147
|
}
|
|
57173
|
-
constructor(options
|
|
57174
|
-
|
|
57148
|
+
constructor(options){
|
|
57149
|
+
BrowserHttpImportEsmPlugin_define_property(this, "options", void 0);
|
|
57175
57150
|
this.options = options;
|
|
57176
57151
|
}
|
|
57177
57152
|
}
|
|
@@ -57202,14 +57177,59 @@ function getRequestWithVersion(request, version) {
|
|
|
57202
57177
|
}
|
|
57203
57178
|
}
|
|
57204
57179
|
}
|
|
57205
|
-
function
|
|
57180
|
+
function toHttpUrl(request) {
|
|
57206
57181
|
try {
|
|
57207
57182
|
const url = new URL(request);
|
|
57208
|
-
return url;
|
|
57183
|
+
if ("http:" === url.protocol || "https:" === url.protocol) return url;
|
|
57209
57184
|
} catch {
|
|
57210
57185
|
return;
|
|
57211
57186
|
}
|
|
57212
57187
|
}
|
|
57188
|
+
function BrowserRequire_define_property(obj, key, value) {
|
|
57189
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
57190
|
+
value: value,
|
|
57191
|
+
enumerable: true,
|
|
57192
|
+
configurable: true,
|
|
57193
|
+
writable: true
|
|
57194
|
+
});
|
|
57195
|
+
else obj[key] = value;
|
|
57196
|
+
return obj;
|
|
57197
|
+
}
|
|
57198
|
+
const unsafeExecute = (code, runtime)=>{
|
|
57199
|
+
const wrapper = new Function("module", "exports", "require", code);
|
|
57200
|
+
wrapper(runtime.module, runtime.exports, runtime.require);
|
|
57201
|
+
};
|
|
57202
|
+
class BrowserRequirePlugin {
|
|
57203
|
+
apply(compiler) {
|
|
57204
|
+
const execute = this.options.execute;
|
|
57205
|
+
compiler.__internal_browser_require = function browserRequire(id) {
|
|
57206
|
+
const { path: loaderPath } = (0, external_rspack_wasi_browser_js_.sync)("", id);
|
|
57207
|
+
if (!loaderPath) throw new Error(`Cannot find loader of ${id}`);
|
|
57208
|
+
const data = browser_fs["default"].readFileSync(loaderPath);
|
|
57209
|
+
const code = (null == data ? void 0 : data.toString()) || "";
|
|
57210
|
+
const module = {
|
|
57211
|
+
exports: {}
|
|
57212
|
+
};
|
|
57213
|
+
const exports = module.exports;
|
|
57214
|
+
const cjs = (0, external_rspack_wasi_browser_js_.transformSync)(code, JSON.stringify({
|
|
57215
|
+
module: {
|
|
57216
|
+
type: "commonjs"
|
|
57217
|
+
}
|
|
57218
|
+
}));
|
|
57219
|
+
execute(cjs.code, {
|
|
57220
|
+
exports,
|
|
57221
|
+
module,
|
|
57222
|
+
require: browserRequire
|
|
57223
|
+
});
|
|
57224
|
+
return exports.default ?? module.exports;
|
|
57225
|
+
};
|
|
57226
|
+
}
|
|
57227
|
+
constructor(options){
|
|
57228
|
+
BrowserRequire_define_property(this, "options", void 0);
|
|
57229
|
+
this.options = options;
|
|
57230
|
+
}
|
|
57231
|
+
}
|
|
57232
|
+
BrowserRequire_define_property(BrowserRequirePlugin, "unsafeExecute", unsafeExecute);
|
|
57213
57233
|
const builtinMemFs = {
|
|
57214
57234
|
fs: browser_fs.fs,
|
|
57215
57235
|
volume: browser_fs.volume
|
|
@@ -57222,4 +57242,4 @@ var __webpack_exports__EntryDependency = external_rspack_wasi_browser_js_.EntryD
|
|
|
57222
57242
|
var __webpack_exports__ExternalModule = external_rspack_wasi_browser_js_.ExternalModule;
|
|
57223
57243
|
var __webpack_exports__Module = external_rspack_wasi_browser_js_.Module;
|
|
57224
57244
|
var __webpack_exports__NormalModule = external_rspack_wasi_browser_js_.NormalModule;
|
|
57225
|
-
export { BannerPlugin,
|
|
57245
|
+
export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SwcJsMinimizerRspackPlugin, Template, validate_ValidationError as ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, exports_library as library, exports_node as node, optimize, src_rspack as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -2144,6 +2144,7 @@ export interface RawExternalItemFnResult {
|
|
|
2144
2144
|
export interface RawExternalsPluginOptions {
|
|
2145
2145
|
type: string
|
|
2146
2146
|
externals: (string | RegExp | Record<string, string | boolean | string[] | Record<string, string[]>> | ((...args: any[]) => any))[]
|
|
2147
|
+
placeInInitial: boolean
|
|
2147
2148
|
}
|
|
2148
2149
|
|
|
2149
2150
|
export interface RawExternalsPresets {
|
|
Binary file
|
package/package.json
CHANGED
package/dist/util/require.d.ts
DELETED