@rspack-canary/browser 1.5.0-canary-1b8c8525-20250820061915 → 1.5.0-canary-efb61069-20250820113456

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.
@@ -1,5 +1,4 @@
1
1
  export * from "../index";
2
- export { BrowserHttpImportPlugin } from "./BrowserHttpImportPlugin";
3
2
  export declare const builtinMemFs: {
4
3
  fs: import("memfs").IFs;
5
4
  volume: import("memfs").Volume;
package/dist/index.mjs CHANGED
@@ -40765,19 +40765,45 @@ function HttpUriPlugin_define_property(obj, key, value) {
40765
40765
  else obj[key] = value;
40766
40766
  return obj;
40767
40767
  }
40768
- memoize(()=>__webpack_require__("../../node_modules/.pnpm/stream-http@3.2.0/node_modules/stream-http/index.js"));
40769
- memoize(()=>__webpack_require__("../../node_modules/.pnpm/https-browserify@1.0.0/node_modules/https-browserify/index.js"));
40770
- const defaultHttpClientForBrowser = async (url, headers)=>{
40771
- const res = await fetch(url, {
40768
+ const getHttp = memoize(()=>__webpack_require__("../../node_modules/.pnpm/stream-http@3.2.0/node_modules/stream-http/index.js"));
40769
+ const getHttps = memoize(()=>__webpack_require__("../../node_modules/.pnpm/https-browserify@1.0.0/node_modules/https-browserify/index.js"));
40770
+ function fetch(url, options) {
40771
+ const parsedURL = new URL(url);
40772
+ const send = "https:" === parsedURL.protocol ? getHttps() : getHttp();
40773
+ const { createBrotliDecompress, createGunzip, createInflate } = __webpack_require__("../../node_modules/.pnpm/browserify-zlib@0.2.0/node_modules/browserify-zlib/lib/index.js");
40774
+ return new Promise((resolve, reject)=>{
40775
+ send.get(url, options, (res)=>{
40776
+ const contentEncoding = res.headers["content-encoding"];
40777
+ let stream = res;
40778
+ if ("gzip" === contentEncoding) stream = stream.pipe(createGunzip());
40779
+ else if ("br" === contentEncoding) stream = stream.pipe(createBrotliDecompress());
40780
+ else if ("deflate" === contentEncoding) stream = stream.pipe(createInflate());
40781
+ const chunks = [];
40782
+ stream.on("data", (chunk)=>{
40783
+ chunks.push(chunk);
40784
+ });
40785
+ stream.on("end", ()=>{
40786
+ const bodyBuffer = Buffer.concat(chunks);
40787
+ if (!res.complete) return void reject(new Error(`${url} request was terminated early`));
40788
+ resolve({
40789
+ res,
40790
+ body: bodyBuffer
40791
+ });
40792
+ });
40793
+ }).on("error", reject);
40794
+ });
40795
+ }
40796
+ const defaultHttpClient = async (url, headers)=>{
40797
+ const { res, body } = await fetch(url, {
40772
40798
  headers
40773
40799
  });
40774
40800
  const responseHeaders = {};
40775
40801
  for (const [key, value] of Object.entries(res.headers))if (Array.isArray(value)) responseHeaders[key] = value.join(", ");
40776
40802
  else responseHeaders[key] = value;
40777
40803
  return {
40778
- status: res.status,
40804
+ status: res.statusCode,
40779
40805
  headers: responseHeaders,
40780
- body: Buffer.from(await res.arrayBuffer())
40806
+ body: Buffer.from(body)
40781
40807
  };
40782
40808
  };
40783
40809
  class HttpUriPlugin extends RspackBuiltinPlugin {
@@ -40785,7 +40811,6 @@ class HttpUriPlugin extends RspackBuiltinPlugin {
40785
40811
  const options = this.options;
40786
40812
  const lockfileLocation = options.lockfileLocation ?? path_browserify_default().join(compiler.context, compiler.name ? `${compiler.name}.rspack.lock` : "rspack.lock");
40787
40813
  const cacheLocation = false === options.cacheLocation ? void 0 : options.cacheLocation ?? `${lockfileLocation}.data`;
40788
- const defaultHttpClient = defaultHttpClientForBrowser;
40789
40814
  const raw = {
40790
40815
  allowedUris: options.allowedUris,
40791
40816
  lockfileLocation,
@@ -47076,7 +47101,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
47076
47101
  if ("object" == typeof rspackFuture) {
47077
47102
  D(rspackFuture, "bundlerInfo", {});
47078
47103
  if ("object" == typeof rspackFuture.bundlerInfo) {
47079
- D(rspackFuture.bundlerInfo, "version", "1.5.0-canary-1b8c8525-20250820061915");
47104
+ D(rspackFuture.bundlerInfo, "version", "1.5.0-canary-efb61069-20250820113456");
47080
47105
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
47081
47106
  D(rspackFuture.bundlerInfo, "force", !library);
47082
47107
  }
@@ -51161,7 +51186,7 @@ class MultiStats {
51161
51186
  return obj;
51162
51187
  });
51163
51188
  if (childOptions.version) {
51164
- obj.rspackVersion = "1.5.0-canary-1b8c8525-20250820061915";
51189
+ obj.rspackVersion = "1.5.0-canary-efb61069-20250820113456";
51165
51190
  obj.version = "5.75.0";
51166
51191
  }
51167
51192
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -52471,7 +52496,7 @@ const SIMPLE_EXTRACTORS = {
52471
52496
  },
52472
52497
  version: (object)=>{
52473
52498
  object.version = "5.75.0";
52474
- object.rspackVersion = "1.5.0-canary-1b8c8525-20250820061915";
52499
+ object.rspackVersion = "1.5.0-canary-efb61069-20250820113456";
52475
52500
  },
52476
52501
  env: (object, _compilation, _context, { _env })=>{
52477
52502
  object.env = _env;
@@ -56933,7 +56958,7 @@ function transformSync(source, options) {
56933
56958
  const _options = JSON.stringify(options || {});
56934
56959
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
56935
56960
  }
56936
- const exports_rspackVersion = "1.5.0-canary-1b8c8525-20250820061915";
56961
+ const exports_rspackVersion = "1.5.0-canary-efb61069-20250820113456";
56937
56962
  const exports_version = "5.75.0";
56938
56963
  const exports_WebpackError = Error;
56939
56964
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -57104,106 +57129,6 @@ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
57104
57129
  src_fn.rspack = src_fn;
57105
57130
  src_fn.webpack = src_fn;
57106
57131
  const src_rspack = src_fn;
57107
- function BrowserHttpImportPlugin_define_property(obj, key, value) {
57108
- if (key in obj) Object.defineProperty(obj, key, {
57109
- value: value,
57110
- enumerable: true,
57111
- configurable: true,
57112
- writable: true
57113
- });
57114
- else obj[key] = value;
57115
- return obj;
57116
- }
57117
- const DOMAIN_ESM_SH = "https://esm.sh";
57118
- class BrowserHttpImportPlugin {
57119
- apply(compiler) {
57120
- compiler.hooks.normalModuleFactory.tap("BrowserHttpImportPlugin", (nmf)=>{
57121
- nmf.hooks.resolve.tap("BrowserHttpImportPlugin", (resolveData)=>{
57122
- const request = resolveData.request;
57123
- const packageName = getPackageName(request);
57124
- if (this.options.dependencyUrl) {
57125
- if ("function" == typeof this.options.dependencyUrl) {
57126
- const url = this.options.dependencyUrl(packageName);
57127
- if (url) {
57128
- resolveData.request = url;
57129
- return;
57130
- }
57131
- } else if ("object" == typeof this.options.dependencyUrl) {
57132
- const url = this.options.dependencyUrl[packageName];
57133
- if (url) {
57134
- resolveData.request = url;
57135
- return;
57136
- }
57137
- }
57138
- }
57139
- const issuerUrl = toUrl(resolveData.contextInfo.issuer);
57140
- if (issuerUrl) {
57141
- resolveData.request = this.resolveWithUrlIssuer(request, issuerUrl);
57142
- return;
57143
- }
57144
- if (this.isNodeModule(request)) {
57145
- resolveData.request = this.resolveNodeModule(request, packageName);
57146
- return;
57147
- }
57148
- });
57149
- });
57150
- }
57151
- resolveWithUrlIssuer(request, issuer) {
57152
- return new URL(request, issuer).href;
57153
- }
57154
- resolveNodeModule(request, packageName) {
57155
- var _this_options_dependencyVersions;
57156
- let domain = DOMAIN_ESM_SH;
57157
- if ("function" == typeof this.options.domain) domain = this.options.domain(request, packageName);
57158
- else if ("string" == typeof this.options.domain) domain = this.options.domain;
57159
- const version = (null == (_this_options_dependencyVersions = this.options.dependencyVersions) ? void 0 : _this_options_dependencyVersions[packageName]) || "latest";
57160
- const versionedRequest = getRequestWithVersion(request, version);
57161
- return `${domain}/${versionedRequest}`;
57162
- }
57163
- isNodeModule(request) {
57164
- if (toUrl(request)) return false;
57165
- return !request.startsWith(".") && !request.startsWith("/") && !request.startsWith("!");
57166
- }
57167
- constructor(options = {}){
57168
- BrowserHttpImportPlugin_define_property(this, "options", void 0);
57169
- this.options = options;
57170
- }
57171
- }
57172
- function getPackageName(request) {
57173
- if (request.startsWith("@")) {
57174
- const parts = request.split("/");
57175
- return `${parts[0]}/${parts[1]}`;
57176
- }
57177
- return request.split("/")[0];
57178
- }
57179
- function getRequestWithVersion(request, version) {
57180
- if (request.startsWith("@")) {
57181
- const secondSlashIndex = request.indexOf("/", request.indexOf("/") + 1);
57182
- if (-1 === secondSlashIndex) return `${request}@${version}`;
57183
- {
57184
- const scopedPackage = request.substring(0, secondSlashIndex);
57185
- const restPath = request.substring(secondSlashIndex);
57186
- return `${scopedPackage}@${version}${restPath}`;
57187
- }
57188
- }
57189
- {
57190
- const firstSlashIndex = request.indexOf("/");
57191
- if (-1 === firstSlashIndex) return `${request}@${version}`;
57192
- {
57193
- const packageName = request.substring(0, firstSlashIndex);
57194
- const restPath = request.substring(firstSlashIndex);
57195
- return `${packageName}@${version}${restPath}`;
57196
- }
57197
- }
57198
- }
57199
- function toUrl(request) {
57200
- try {
57201
- const url = new URL(request);
57202
- return url;
57203
- } catch {
57204
- return;
57205
- }
57206
- }
57207
57132
  const builtinMemFs = {
57208
57133
  fs: browser_fs.fs,
57209
57134
  volume: browser_fs.volume
@@ -57216,4 +57141,4 @@ var __webpack_exports__EntryDependency = external_rspack_wasi_browser_js_.EntryD
57216
57141
  var __webpack_exports__ExternalModule = external_rspack_wasi_browser_js_.ExternalModule;
57217
57142
  var __webpack_exports__Module = external_rspack_wasi_browser_js_.Module;
57218
57143
  var __webpack_exports__NormalModule = external_rspack_wasi_browser_js_.NormalModule;
57219
- export { BannerPlugin, BrowserHttpImportPlugin, 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 };
57144
+ export { BannerPlugin, 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 };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.5.0-canary-1b8c8525-20250820061915",
3
+ "version": "1.5.0-canary-efb61069-20250820113456",
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.",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@napi-rs/wasm-runtime": "^1.0.1",
33
33
  "@rspack/lite-tapable": "1.0.1",
34
- "@swc/types": "0.1.23",
34
+ "@swc/types": "0.1.24",
35
35
  "@types/watchpack": "^2.4.4",
36
36
  "memfs": "4.36.0",
37
37
  "webpack-sources": "3.3.3"
@@ -1,26 +0,0 @@
1
- import type { Compiler } from ".";
2
- interface BrowserHttpImportPluginOptions {
3
- /**
4
- * ESM CDN domain
5
- * @default "https://esm.sh"
6
- */
7
- domain?: string | ((request: string, packageName: string) => string);
8
- /**
9
- * Specify ESM CDN URL for dependencies.
10
- */
11
- dependencyUrl?: Record<string, string | undefined> | ((packageName: string) => string | undefined);
12
- /**
13
- * Specify versions for dependencies.
14
- * Default to "latest" if not specified.
15
- */
16
- dependencyVersions?: Record<string, string | undefined>;
17
- }
18
- export declare class BrowserHttpImportPlugin {
19
- private options;
20
- constructor(options?: BrowserHttpImportPluginOptions);
21
- apply(compiler: Compiler): void;
22
- resolveWithUrlIssuer(request: string, issuer: URL): string;
23
- resolveNodeModule(request: string, packageName: string): string;
24
- isNodeModule(request: string): boolean;
25
- }
26
- export {};