@rspack/browser 1.5.2 → 1.5.3
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/dist/NativeWatchFileSystem.d.ts +1 -1
- package/dist/browser/BrowserHttpImportEsmPlugin.d.ts +25 -5
- package/dist/config/adapterRuleUse.d.ts +36 -5
- package/dist/config/index.d.ts +1 -0
- package/dist/index.mjs +70 -46
- package/dist/napi-binding.d.ts +2 -1
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/package.json +2 -2
|
@@ -13,7 +13,7 @@ export default class NativeWatchFileSystem implements WatchFileSystem {
|
|
|
13
13
|
}, missing: Iterable<string> & {
|
|
14
14
|
added?: Iterable<string>;
|
|
15
15
|
removed?: Iterable<string>;
|
|
16
|
-
},
|
|
16
|
+
}, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
|
|
17
17
|
getNativeWatcher(options: Watchpack.WatchOptions): binding.NativeWatcher;
|
|
18
18
|
triggerEvent(kind: "change" | "remove" | "create", path: string): void;
|
|
19
19
|
formatWatchDependencies(dependencies: Iterable<string> & {
|
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
import type { Compiler } from ".";
|
|
2
|
+
interface ResolvedRequest {
|
|
3
|
+
request: string;
|
|
4
|
+
issuer: string;
|
|
5
|
+
packageName: string;
|
|
6
|
+
}
|
|
7
|
+
interface ProcessedRequest extends ResolvedRequest {
|
|
8
|
+
url: URL;
|
|
9
|
+
}
|
|
2
10
|
interface BrowserHttpImportPluginOptions {
|
|
3
11
|
/**
|
|
4
12
|
* ESM CDN domain
|
|
5
13
|
*/
|
|
6
|
-
domain: string | ((
|
|
14
|
+
domain: string | ((resolvedRequest: ResolvedRequest) => string);
|
|
7
15
|
/**
|
|
8
16
|
* Specify ESM CDN URL for dependencies.
|
|
17
|
+
* If a record is provided, it will be used to map package names to their CDN URLs.
|
|
18
|
+
*
|
|
19
|
+
* Once this function resolves a dependency, other options are ignored.
|
|
9
20
|
*/
|
|
10
|
-
dependencyUrl?: Record<string, string | undefined> | ((
|
|
21
|
+
dependencyUrl?: Record<string, string | undefined> | ((resolvedRequest: ResolvedRequest) => string | undefined);
|
|
11
22
|
/**
|
|
12
23
|
* Specify versions for dependencies.
|
|
13
24
|
* Default to "latest" if not specified.
|
|
14
25
|
*/
|
|
15
26
|
dependencyVersions?: Record<string, string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* You can attach additional queries supported by the CDN to the `request.url`.
|
|
29
|
+
*
|
|
30
|
+
* For example, to specify the external dependencies under esm.sh, you can do:
|
|
31
|
+
*
|
|
32
|
+
* `request.url.searchParams.set("external", "react,react-dom")`
|
|
33
|
+
*/
|
|
34
|
+
postprocess?: (request: ProcessedRequest) => void;
|
|
16
35
|
}
|
|
17
36
|
/**
|
|
18
37
|
* Convert imports of dependencies in node modules to http imports from esm cdn.
|
|
@@ -21,8 +40,9 @@ export declare class BrowserHttpImportEsmPlugin {
|
|
|
21
40
|
private options;
|
|
22
41
|
constructor(options: BrowserHttpImportPluginOptions);
|
|
23
42
|
apply(compiler: Compiler): void;
|
|
24
|
-
resolveWithUrlIssuer
|
|
25
|
-
resolveNodeModule
|
|
26
|
-
|
|
43
|
+
private resolveWithUrlIssuer;
|
|
44
|
+
private resolveNodeModule;
|
|
45
|
+
private parameterize;
|
|
46
|
+
private isNodeModule;
|
|
27
47
|
}
|
|
28
48
|
export {};
|
|
@@ -15,19 +15,50 @@ export interface ComposeJsUseOptions {
|
|
|
15
15
|
experiments: RawOptions["experiments"];
|
|
16
16
|
compiler: Compiler;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface RawSourceMap {
|
|
19
|
+
/**
|
|
20
|
+
* The version of the source map format, always 3
|
|
21
|
+
*/
|
|
19
22
|
version: number;
|
|
23
|
+
/**
|
|
24
|
+
* A list of original sources used by the mappings field
|
|
25
|
+
*/
|
|
20
26
|
sources: string[];
|
|
27
|
+
/**
|
|
28
|
+
* A string with the encoded mapping data
|
|
29
|
+
*/
|
|
21
30
|
mappings: string;
|
|
22
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The filename of the generated code that this source map is associated with
|
|
33
|
+
*/
|
|
34
|
+
file: string;
|
|
35
|
+
/**
|
|
36
|
+
* An optional source root string, used for relocating source files on a server
|
|
37
|
+
* or removing repeated values in the sources entry.
|
|
38
|
+
*/
|
|
23
39
|
sourceRoot?: string;
|
|
40
|
+
/**
|
|
41
|
+
* An array containing the actual content of the original source files
|
|
42
|
+
*/
|
|
24
43
|
sourcesContent?: string[];
|
|
25
|
-
|
|
44
|
+
/**
|
|
45
|
+
* A list of symbol names which may be used by the mappings field.
|
|
46
|
+
*/
|
|
47
|
+
names: string[];
|
|
48
|
+
/**
|
|
49
|
+
* A unique identifier for debugging purposes
|
|
50
|
+
*/
|
|
51
|
+
debugId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* An array of indices into the sources array, indicating which sources
|
|
54
|
+
* should be ignored by debuggers
|
|
55
|
+
*/
|
|
56
|
+
ignoreList?: number[];
|
|
26
57
|
}
|
|
27
58
|
export interface AdditionalData {
|
|
28
59
|
[index: string]: any;
|
|
29
60
|
}
|
|
30
|
-
export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string |
|
|
61
|
+
export type LoaderContextCallback = (err?: Error | null, content?: string | Buffer, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => void;
|
|
31
62
|
export type ErrorWithDetails = Error & {
|
|
32
63
|
details?: string;
|
|
33
64
|
};
|
|
@@ -322,7 +353,7 @@ export interface LoaderContext<OptionsType = {}> {
|
|
|
322
353
|
*/
|
|
323
354
|
__internal__setParseMeta: (key: string, value: string) => void;
|
|
324
355
|
}
|
|
325
|
-
export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string |
|
|
356
|
+
export type LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | RawSourceMap, additionalData?: AdditionalData) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
326
357
|
export type PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> = (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object) => string | void | Buffer | Promise<string | Buffer | void>;
|
|
327
358
|
/**
|
|
328
359
|
* Defines a loader for Rspack.
|
package/dist/config/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -46704,6 +46704,7 @@ const browserslistTargetHandler_resolve = (browsers)=>{
|
|
|
46704
46704
|
require: nodeProperty
|
|
46705
46705
|
};
|
|
46706
46706
|
};
|
|
46707
|
+
var target_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
46707
46708
|
const getBrowserslistTargetHandler = memoize(()=>browserslistTargetHandler_namespaceObject);
|
|
46708
46709
|
const hasBrowserslistConfig = (context)=>{
|
|
46709
46710
|
const { findConfig } = __webpack_require__("../../node_modules/.pnpm/browserslist-load-config@1.0.0/node_modules/browserslist-load-config/dist/index.cjs");
|
|
@@ -46724,7 +46725,7 @@ const TARGETS = [
|
|
|
46724
46725
|
(rest, context)=>{
|
|
46725
46726
|
const inlineQuery = rest ? rest.trim() : null;
|
|
46726
46727
|
const browsers = external_rspack_wasi_browser_js_["default"].loadBrowserslist(inlineQuery, context);
|
|
46727
|
-
if (!browsers || !inlineQuery && !hasBrowserslistConfig(context)) throw new Error(`No browserslist config found to handle the 'browserslist' target.
|
|
46728
|
+
if (!browsers || !inlineQuery && !hasBrowserslistConfig(context) && !target_process.env.BROWSERSLIST) throw new Error(`No browserslist config found to handle the 'browserslist' target.
|
|
46728
46729
|
See https://github.com/browserslist/browserslist#queries for possible ways to provide a config.
|
|
46729
46730
|
The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions).
|
|
46730
46731
|
You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`);
|
|
@@ -46959,11 +46960,16 @@ const applyRspackOptionsDefaults = (options)=>{
|
|
|
46959
46960
|
D(options, "lazyCompilation", false);
|
|
46960
46961
|
D(options, "bail", false);
|
|
46961
46962
|
defaults_F(options, "cache", ()=>development);
|
|
46963
|
+
if (false === options.cache) options.experiments.cache = false;
|
|
46962
46964
|
applyExperimentsDefaults(options.experiments, {
|
|
46963
46965
|
production,
|
|
46964
46966
|
development
|
|
46965
46967
|
});
|
|
46966
|
-
|
|
46968
|
+
applyOptimizationDefaults(options.optimization, {
|
|
46969
|
+
production,
|
|
46970
|
+
development,
|
|
46971
|
+
css: options.experiments.css
|
|
46972
|
+
});
|
|
46967
46973
|
applySnapshotDefaults(options.snapshot, {
|
|
46968
46974
|
production
|
|
46969
46975
|
});
|
|
@@ -46973,6 +46979,7 @@ const applyRspackOptionsDefaults = (options)=>{
|
|
|
46973
46979
|
targetProperties,
|
|
46974
46980
|
mode: options.mode,
|
|
46975
46981
|
uniqueName: options.output.uniqueName,
|
|
46982
|
+
usedExports: !!options.optimization.usedExports,
|
|
46976
46983
|
inlineConst: options.experiments.inlineConst
|
|
46977
46984
|
});
|
|
46978
46985
|
applyOutputDefaults(options.output, {
|
|
@@ -47002,11 +47009,6 @@ const applyRspackOptionsDefaults = (options)=>{
|
|
|
47002
47009
|
applyPerformanceDefaults(options.performance, {
|
|
47003
47010
|
production
|
|
47004
47011
|
});
|
|
47005
|
-
applyOptimizationDefaults(options.optimization, {
|
|
47006
|
-
production,
|
|
47007
|
-
development,
|
|
47008
|
-
css: options.experiments.css
|
|
47009
|
-
});
|
|
47010
47012
|
options.resolve = cleverMerge(getResolveDefaults({
|
|
47011
47013
|
context: options.context,
|
|
47012
47014
|
targetProperties,
|
|
@@ -47071,14 +47073,14 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
47071
47073
|
if ("object" == typeof rspackFuture) {
|
|
47072
47074
|
D(rspackFuture, "bundlerInfo", {});
|
|
47073
47075
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
47074
|
-
D(rspackFuture.bundlerInfo, "version", "1.5.
|
|
47076
|
+
D(rspackFuture.bundlerInfo, "version", "1.5.3");
|
|
47075
47077
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
47076
47078
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
47077
47079
|
}
|
|
47078
47080
|
}
|
|
47079
47081
|
};
|
|
47080
47082
|
const applySnapshotDefaults = (_snapshot, _env)=>{};
|
|
47081
|
-
const applyJavascriptParserOptionsDefaults = (parserOptions, { inlineConst })=>{
|
|
47083
|
+
const applyJavascriptParserOptionsDefaults = (parserOptions, { usedExports, inlineConst })=>{
|
|
47082
47084
|
D(parserOptions, "dynamicImportMode", "lazy");
|
|
47083
47085
|
D(parserOptions, "dynamicImportPrefetch", false);
|
|
47084
47086
|
D(parserOptions, "dynamicImportPreload", false);
|
|
@@ -47096,13 +47098,13 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { inlineConst })=>{
|
|
|
47096
47098
|
"..."
|
|
47097
47099
|
]);
|
|
47098
47100
|
D(parserOptions, "importMeta", true);
|
|
47099
|
-
D(parserOptions, "inlineConst", inlineConst);
|
|
47101
|
+
D(parserOptions, "inlineConst", usedExports && inlineConst);
|
|
47100
47102
|
D(parserOptions, "typeReexportsPresence", "no-tolerant");
|
|
47101
47103
|
};
|
|
47102
47104
|
const applyJsonGeneratorOptionsDefaults = (generatorOptions)=>{
|
|
47103
47105
|
D(generatorOptions, "JSONParse", true);
|
|
47104
47106
|
};
|
|
47105
|
-
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties, mode, uniqueName, inlineConst })=>{
|
|
47107
|
+
const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst })=>{
|
|
47106
47108
|
assertNotNill(module.parser);
|
|
47107
47109
|
assertNotNill(module.generator);
|
|
47108
47110
|
defaults_F(module.parser, ASSET_MODULE_TYPE, ()=>({}));
|
|
@@ -47112,6 +47114,7 @@ const applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties,
|
|
|
47112
47114
|
defaults_F(module.parser, "javascript", ()=>({}));
|
|
47113
47115
|
assertNotNill(module.parser.javascript);
|
|
47114
47116
|
applyJavascriptParserOptionsDefaults(module.parser.javascript, {
|
|
47117
|
+
usedExports,
|
|
47115
47118
|
inlineConst
|
|
47116
47119
|
});
|
|
47117
47120
|
defaults_F(module.parser, JSON_MODULE_TYPE, ()=>({}));
|
|
@@ -49942,14 +49945,14 @@ const toJsWatcherIgnored = (ignored)=>{
|
|
|
49942
49945
|
};
|
|
49943
49946
|
var NativeWatchFileSystem_inner = /*#__PURE__*/ new WeakMap(), _isFirstWatch = /*#__PURE__*/ new WeakMap(), _inputFileSystem = /*#__PURE__*/ new WeakMap();
|
|
49944
49947
|
class NativeWatchFileSystem {
|
|
49945
|
-
watch(files, directories, missing,
|
|
49948
|
+
watch(files, directories, missing, startTime, options, callback, callbackUndelayed) {
|
|
49946
49949
|
if ((!files.added || "function" != typeof files.added[Symbol.iterator]) && (!files.removed || "function" != typeof files.removed[Symbol.iterator])) throw new Error("Invalid arguments: 'files'");
|
|
49947
49950
|
if ((!directories.added || "function" != typeof directories.added[Symbol.iterator]) && (!directories.removed || "function" != typeof directories.removed[Symbol.iterator])) throw new Error("Invalid arguments: 'directories'");
|
|
49948
49951
|
if ("function" != typeof callback) throw new Error("Invalid arguments: 'callback'");
|
|
49949
49952
|
if ("object" != typeof options) throw new Error("Invalid arguments: 'options'");
|
|
49950
49953
|
if ("function" != typeof callbackUndelayed && callbackUndelayed) throw new Error("Invalid arguments: 'callbackUndelayed'");
|
|
49951
49954
|
const nativeWatcher = this.getNativeWatcher(options);
|
|
49952
|
-
nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), (err, result)=>{
|
|
49955
|
+
nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), BigInt(startTime), (err, result)=>{
|
|
49953
49956
|
var _class_private_field_get1;
|
|
49954
49957
|
if (err) return void callback(err, new Map(), new Map(), new Set(), new Set());
|
|
49955
49958
|
nativeWatcher.pause();
|
|
@@ -51166,7 +51169,7 @@ class MultiStats {
|
|
|
51166
51169
|
return obj;
|
|
51167
51170
|
});
|
|
51168
51171
|
if (childOptions.version) {
|
|
51169
|
-
obj.rspackVersion = "1.5.
|
|
51172
|
+
obj.rspackVersion = "1.5.3";
|
|
51170
51173
|
obj.version = "5.75.0";
|
|
51171
51174
|
}
|
|
51172
51175
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -52476,7 +52479,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
52476
52479
|
},
|
|
52477
52480
|
version: (object)=>{
|
|
52478
52481
|
object.version = "5.75.0";
|
|
52479
|
-
object.rspackVersion = "1.5.
|
|
52482
|
+
object.rspackVersion = "1.5.3";
|
|
52480
52483
|
},
|
|
52481
52484
|
env: (object, _compilation, _context, { _env })=>{
|
|
52482
52485
|
object.env = _env;
|
|
@@ -56517,21 +56520,10 @@ function getRuntimePlugins(options) {
|
|
|
56517
56520
|
return options.runtimePlugins ?? [];
|
|
56518
56521
|
}
|
|
56519
56522
|
function getPaths(options) {
|
|
56520
|
-
const runtimeToolsPath = options.implementation ?? require.resolve("@module-federation/runtime-tools");
|
|
56521
|
-
const bundlerRuntimePath = require.resolve("@module-federation/webpack-bundler-runtime", {
|
|
56522
|
-
paths: [
|
|
56523
|
-
runtimeToolsPath
|
|
56524
|
-
]
|
|
56525
|
-
});
|
|
56526
|
-
const runtimePath = require.resolve("@module-federation/runtime", {
|
|
56527
|
-
paths: [
|
|
56528
|
-
runtimeToolsPath
|
|
56529
|
-
]
|
|
56530
|
-
});
|
|
56531
56523
|
return {
|
|
56532
|
-
runtimeTools:
|
|
56533
|
-
bundlerRuntime:
|
|
56534
|
-
runtime:
|
|
56524
|
+
runtimeTools: "@module-federation/runtime-tools",
|
|
56525
|
+
bundlerRuntime: "@module-federation/webpack-bundler-runtime",
|
|
56526
|
+
runtime: "@module-federation/runtime"
|
|
56535
56527
|
};
|
|
56536
56528
|
}
|
|
56537
56529
|
function getDefaultEntryRuntime(paths, options, compiler) {
|
|
@@ -56551,7 +56543,7 @@ function getDefaultEntryRuntime(paths, options, compiler) {
|
|
|
56551
56543
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
56552
56544
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
56553
56545
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
|
|
56554
|
-
|
|
56546
|
+
'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
|
|
56555
56547
|
].join(";");
|
|
56556
56548
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
56557
56549
|
}
|
|
@@ -56936,7 +56928,7 @@ function transformSync(source, options) {
|
|
|
56936
56928
|
const _options = JSON.stringify(options || {});
|
|
56937
56929
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
56938
56930
|
}
|
|
56939
|
-
const exports_rspackVersion = "1.5.
|
|
56931
|
+
const exports_rspackVersion = "1.5.3";
|
|
56940
56932
|
const exports_version = "5.75.0";
|
|
56941
56933
|
const exports_WebpackError = Error;
|
|
56942
56934
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -57122,30 +57114,31 @@ class BrowserHttpImportEsmPlugin {
|
|
|
57122
57114
|
compiler.hooks.normalModuleFactory.tap("BrowserHttpImportPlugin", (nmf)=>{
|
|
57123
57115
|
nmf.hooks.resolve.tap("BrowserHttpImportPlugin", (resolveData)=>{
|
|
57124
57116
|
const request = resolveData.request;
|
|
57125
|
-
const
|
|
57117
|
+
const issuer = resolveData.contextInfo.issuer;
|
|
57126
57118
|
if (request.includes("!")) return;
|
|
57119
|
+
const issuerUrl = toHttpUrl(issuer);
|
|
57120
|
+
const resolvedRequest = BrowserHttpImportEsmPlugin_resolveRequest(request, issuer, !!issuerUrl);
|
|
57127
57121
|
if (this.options.dependencyUrl) {
|
|
57128
57122
|
if ("function" == typeof this.options.dependencyUrl) {
|
|
57129
|
-
const url = this.options.dependencyUrl(
|
|
57123
|
+
const url = this.options.dependencyUrl(resolvedRequest);
|
|
57130
57124
|
if (url) {
|
|
57131
57125
|
resolveData.request = url;
|
|
57132
57126
|
return;
|
|
57133
57127
|
}
|
|
57134
57128
|
} else if ("object" == typeof this.options.dependencyUrl) {
|
|
57135
|
-
const url = this.options.dependencyUrl[packageName];
|
|
57129
|
+
const url = this.options.dependencyUrl[resolvedRequest.packageName];
|
|
57136
57130
|
if (url) {
|
|
57137
57131
|
resolveData.request = url;
|
|
57138
57132
|
return;
|
|
57139
57133
|
}
|
|
57140
57134
|
}
|
|
57141
57135
|
}
|
|
57142
|
-
const issuerUrl = toHttpUrl(resolveData.contextInfo.issuer);
|
|
57143
57136
|
if (issuerUrl) {
|
|
57144
|
-
resolveData.request = this.resolveWithUrlIssuer(request, issuerUrl);
|
|
57137
|
+
resolveData.request = this.parameterize(this.resolveWithUrlIssuer(request, issuerUrl), resolvedRequest);
|
|
57145
57138
|
return;
|
|
57146
57139
|
}
|
|
57147
57140
|
if (this.isNodeModule(request)) {
|
|
57148
|
-
resolveData.request = this.resolveNodeModule(
|
|
57141
|
+
resolveData.request = this.parameterize(this.resolveNodeModule(resolvedRequest), resolvedRequest);
|
|
57149
57142
|
return;
|
|
57150
57143
|
}
|
|
57151
57144
|
});
|
|
@@ -57154,15 +57147,24 @@ class BrowserHttpImportEsmPlugin {
|
|
|
57154
57147
|
resolveWithUrlIssuer(request, issuer) {
|
|
57155
57148
|
return new URL(request, issuer).href;
|
|
57156
57149
|
}
|
|
57157
|
-
resolveNodeModule(
|
|
57150
|
+
resolveNodeModule(resolvedRequest) {
|
|
57158
57151
|
var _this_options_dependencyVersions;
|
|
57159
57152
|
let domain = "";
|
|
57160
|
-
if ("function" == typeof this.options.domain) domain = this.options.domain(
|
|
57153
|
+
if ("function" == typeof this.options.domain) domain = this.options.domain(resolvedRequest);
|
|
57161
57154
|
else if ("string" == typeof this.options.domain) domain = this.options.domain;
|
|
57162
|
-
const version = (null == (_this_options_dependencyVersions = this.options.dependencyVersions) ? void 0 : _this_options_dependencyVersions[packageName]) || "latest";
|
|
57163
|
-
const versionedRequest = getRequestWithVersion(request, version);
|
|
57155
|
+
const version = (null == (_this_options_dependencyVersions = this.options.dependencyVersions) ? void 0 : _this_options_dependencyVersions[resolvedRequest.packageName]) || "latest";
|
|
57156
|
+
const versionedRequest = getRequestWithVersion(resolvedRequest.request, version);
|
|
57164
57157
|
return `${domain}/${versionedRequest}`;
|
|
57165
57158
|
}
|
|
57159
|
+
parameterize(requestUrl, resolvedRequest) {
|
|
57160
|
+
if (!this.options.postprocess) return requestUrl;
|
|
57161
|
+
const url = new URL(requestUrl);
|
|
57162
|
+
this.options.postprocess({
|
|
57163
|
+
url,
|
|
57164
|
+
...resolvedRequest
|
|
57165
|
+
});
|
|
57166
|
+
return url.toString();
|
|
57167
|
+
}
|
|
57166
57168
|
isNodeModule(request) {
|
|
57167
57169
|
if (toHttpUrl(request)) return false;
|
|
57168
57170
|
return !request.startsWith(".") && !request.startsWith("/") && !request.startsWith("!");
|
|
@@ -57172,12 +57174,34 @@ class BrowserHttpImportEsmPlugin {
|
|
|
57172
57174
|
this.options = options;
|
|
57173
57175
|
}
|
|
57174
57176
|
}
|
|
57175
|
-
function
|
|
57176
|
-
|
|
57177
|
-
|
|
57178
|
-
|
|
57177
|
+
function BrowserHttpImportEsmPlugin_resolveRequest(request, issuer, isHttpIssuer) {
|
|
57178
|
+
function resolvePackageName() {
|
|
57179
|
+
if (isHttpIssuer) {
|
|
57180
|
+
let requestToResolve = request;
|
|
57181
|
+
if (!request.startsWith("/")) requestToResolve = issuer;
|
|
57182
|
+
const segments = requestToResolve.split("/");
|
|
57183
|
+
const nameSegIndex = segments.findIndex((segment)=>segment.includes("@") && !segment.startsWith("@"));
|
|
57184
|
+
if (nameSegIndex > 0) {
|
|
57185
|
+
const nameSeg = segments[nameSegIndex];
|
|
57186
|
+
const atIndex = nameSeg.indexOf("@");
|
|
57187
|
+
const name = nameSeg.slice(0, atIndex);
|
|
57188
|
+
const groupSeg = segments[nameSegIndex - 1] ?? "";
|
|
57189
|
+
if (groupSeg.startsWith("@")) return `${groupSeg}/${name}`;
|
|
57190
|
+
return name;
|
|
57191
|
+
}
|
|
57192
|
+
}
|
|
57193
|
+
if (request.startsWith("@")) {
|
|
57194
|
+
const parts = request.split("/");
|
|
57195
|
+
return `${parts[0]}/${parts[1]}`;
|
|
57196
|
+
}
|
|
57197
|
+
return request.split("/")[0];
|
|
57179
57198
|
}
|
|
57180
|
-
|
|
57199
|
+
const packageName = resolvePackageName();
|
|
57200
|
+
return {
|
|
57201
|
+
packageName,
|
|
57202
|
+
request,
|
|
57203
|
+
issuer
|
|
57204
|
+
};
|
|
57181
57205
|
}
|
|
57182
57206
|
function getRequestWithVersion(request, version) {
|
|
57183
57207
|
if (request.startsWith("@")) {
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -443,7 +443,7 @@ export declare class ModuleGraphConnection {
|
|
|
443
443
|
|
|
444
444
|
export declare class NativeWatcher {
|
|
445
445
|
constructor(options: NativeWatcherOptions)
|
|
446
|
-
watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
|
|
446
|
+
watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
|
|
447
447
|
triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
|
|
448
448
|
/**
|
|
449
449
|
* # Safety
|
|
@@ -2111,6 +2111,7 @@ parallelCodeSplitting: boolean
|
|
|
2111
2111
|
rspackFuture?: RawRspackFuture
|
|
2112
2112
|
cache: boolean | { type: "persistent" } & RawExperimentCacheOptionsPersistent | { type: "memory" }
|
|
2113
2113
|
useInputFileSystem?: false | Array<RegExp>
|
|
2114
|
+
css?: boolean
|
|
2114
2115
|
inlineConst: boolean
|
|
2115
2116
|
inlineEnum: boolean
|
|
2116
2117
|
typeReexportsPresence: boolean
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/browser",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@rspack/lite-tapable": "1.0.1",
|
|
34
34
|
"@swc/types": "0.1.24",
|
|
35
35
|
"@types/watchpack": "^2.4.4",
|
|
36
|
-
"memfs": "4.
|
|
36
|
+
"memfs": "4.38.2",
|
|
37
37
|
"webpack-sources": "3.3.3"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|