@lynx-js/rspeedy-canary 0.9.11-canary-20250627-a64333ef → 0.9.11-canary-20250630-77513752

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/CHANGELOG.md CHANGED
@@ -1,9 +1,37 @@
1
1
  # @lynx-js/rspeedy
2
2
 
3
- ## 0.9.11-canary-20250627041429-a64333ef28228d6b90c32e027f67bef8acbd8432
3
+ ## 0.9.11-canary-20250630115829-775137521782ca5445f22029c39163c0a63bbfa5
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Enable fine-grained control for `output.inlineScripts` ([#883](https://github.com/lynx-family/lynx-stack/pull/883))
8
+
9
+ ```ts
10
+ type InlineChunkTestFunction = (params: {
11
+ size: number;
12
+ name: string;
13
+ }) => boolean;
14
+
15
+ type InlineChunkTest = RegExp | InlineChunkTestFunction;
16
+
17
+ type InlineChunkConfig =
18
+ | boolean
19
+ | InlineChunkTest
20
+ | { enable?: boolean | "auto"; test: InlineChunkTest };
21
+ ```
22
+
23
+ ```ts
24
+ import { defineConfig } from "@lynx-js/rspeedy";
25
+
26
+ export default defineConfig({
27
+ output: {
28
+ inlineScripts: ({ name, size }) => {
29
+ return name.includes("foo") && size < 1000;
30
+ },
31
+ },
32
+ });
33
+ ```
34
+
7
35
  - docs: remove chunks: 'all' in comments ([#1168](https://github.com/lynx-family/lynx-stack/pull/1168))
8
36
 
9
37
  ## 0.9.10
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@
17
17
 
18
18
  import type { CreateRsbuildOptions } from '@rsbuild/core';
19
19
  import type { DistPathConfig } from '@rsbuild/core';
20
+ import type { InlineChunkConfig } from '@rsbuild/core';
20
21
  import { logger } from '@rsbuild/core';
21
22
  import type { PerformanceConfig } from '@rsbuild/core';
22
23
  import type { RsbuildConfig } from '@rsbuild/core';
@@ -1961,11 +1962,15 @@ export declare interface Output {
1961
1962
  *
1962
1963
  * @remarks
1963
1964
  *
1964
- * If no value is provided, the default value would be `true`.
1965
+ * If no value is provided, the default value would be `true`, which means all background thread scripts will be inlined.
1965
1966
  *
1966
1967
  * This is different with {@link https://rsbuild.dev/config/output/inline-scripts | output.inlineScripts } since we normally want to inline scripts in Lynx bundle (`.lynx.bundle`).
1967
1968
  *
1968
- * Only background thread scripts can remain non-inlined, whereas the main thread script is always inlined.
1969
+ * There are two points that need to be especially noted:
1970
+ *
1971
+ * 1. Only background thread scripts can remain non-inlined, whereas the main thread script is always inlined.
1972
+ *
1973
+ * 2. Currently, when `experimental_isLazyBundle` is enabled, `inlineScripts` will always be `true`.
1969
1974
  *
1970
1975
  * @example
1971
1976
  *
@@ -1980,7 +1985,7 @@ export declare interface Output {
1980
1985
  * })
1981
1986
  * ```
1982
1987
  */
1983
- inlineScripts?: boolean | undefined;
1988
+ inlineScripts?: InlineChunkConfig | undefined;
1984
1989
  /**
1985
1990
  * The {@link Output.legalComments} controls how to handle the legal comment.
1986
1991
  *
@@ -1574,9 +1574,9 @@ export const __webpack_modules__ = {
1574
1574
  if (void 0 === value) return true;
1575
1575
  return "string" == typeof value || "boolean" == typeof value;
1576
1576
  });
1577
- const _io50 = (input, _exceptionable = true)=>"string" == typeof input["__@toStringTag@6680"] && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{
1577
+ const _io50 = (input, _exceptionable = true)=>"string" == typeof input["__@toStringTag@6682"] && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{
1578
1578
  if ([
1579
- "__@toStringTag@6680"
1579
+ "__@toStringTag@6682"
1580
1580
  ].some((prop)=>key === prop)) return true;
1581
1581
  const value = input[key];
1582
1582
  if (void 0 === value) return true;
@@ -3155,14 +3155,14 @@ export const __webpack_modules__ = {
3155
3155
  if (void 0 === value) return true;
3156
3156
  return false;
3157
3157
  })));
3158
- const _io156 = (input, _exceptionable = true)=>"number" == typeof input.BYTES_PER_ELEMENT && (input.buffer instanceof ArrayBuffer || input.buffer instanceof SharedArrayBuffer) && "number" == typeof input.byteLength && "number" == typeof input.byteOffset && "number" == typeof input.length && "Uint8Array" === input["__@toStringTag@6680"] && Object.keys(input).every((key)=>{
3158
+ const _io156 = (input, _exceptionable = true)=>"number" == typeof input.BYTES_PER_ELEMENT && (input.buffer instanceof ArrayBuffer || input.buffer instanceof SharedArrayBuffer) && "number" == typeof input.byteLength && "number" == typeof input.byteOffset && "number" == typeof input.length && "Uint8Array" === input["__@toStringTag@6682"] && Object.keys(input).every((key)=>{
3159
3159
  if ([
3160
3160
  "BYTES_PER_ELEMENT",
3161
3161
  "buffer",
3162
3162
  "byteLength",
3163
3163
  "byteOffset",
3164
3164
  "length",
3165
- "__@toStringTag@6680"
3165
+ "__@toStringTag@6682"
3166
3166
  ].some((prop)=>key === prop)) return true;
3167
3167
  const value = input[key];
3168
3168
  if (void 0 === value) return true;
@@ -6371,15 +6371,15 @@ export const __webpack_modules__ = {
6371
6371
  if (void 0 === value) return true;
6372
6372
  return false;
6373
6373
  }));
6374
- const _io410 = (input, _exceptionable = true)=>"string" == typeof input["__@toStringTag@6680"] && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{
6374
+ const _io410 = (input, _exceptionable = true)=>"string" == typeof input["__@toStringTag@6682"] && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{
6375
6375
  if ([
6376
- "__@toStringTag@6680"
6376
+ "__@toStringTag@6682"
6377
6377
  ].some((prop)=>key === prop)) return true;
6378
6378
  const value = input[key];
6379
6379
  if (void 0 === value) return true;
6380
6380
  return false;
6381
6381
  }));
6382
- const _io411 = (input, _exceptionable = true)=>(void 0 === input.assetPrefix || "string" == typeof input.assetPrefix) && (void 0 === input.cleanDistPath || "boolean" == typeof input.cleanDistPath) && null !== input.copy && (void 0 === input.copy || Array.isArray(input.copy) && input.copy.every((elem, _index333)=>null != elem && ("string" == typeof elem || "object" == typeof elem && null !== elem && _io383(elem, _exceptionable))) || "object" == typeof input.copy && null !== input.copy && _io382(input.copy, _exceptionable)) && (void 0 === input.cssModules || "object" == typeof input.cssModules && null !== input.cssModules && false === Array.isArray(input.cssModules) && _io412(input.cssModules, _exceptionable)) && (void 0 === input.dataUriLimit || "number" == typeof input.dataUriLimit) && (void 0 === input.distPath || "object" == typeof input.distPath && null !== input.distPath && false === Array.isArray(input.distPath) && _io413(input.distPath, _exceptionable)) && null !== input.filename && (void 0 === input.filename || "string" == typeof input.filename || "object" == typeof input.filename && null !== input.filename && false === Array.isArray(input.filename) && _io414(input.filename, _exceptionable)) && (void 0 === input.filenameHash || "string" == typeof input.filenameHash || "boolean" == typeof input.filenameHash) && (void 0 === input.inlineScripts || "boolean" == typeof input.inlineScripts) && (void 0 === input.legalComments || "none" === input.legalComments || "inline" === input.legalComments || "linked" === input.legalComments) && null !== input.minify && (void 0 === input.minify || "boolean" == typeof input.minify || "object" == typeof input.minify && null !== input.minify && false === Array.isArray(input.minify) && _io415(input.minify, _exceptionable)) && null !== input.sourceMap && (void 0 === input.sourceMap || "boolean" == typeof input.sourceMap || "object" == typeof input.sourceMap && null !== input.sourceMap && false === Array.isArray(input.sourceMap) && _io416(input.sourceMap, _exceptionable)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
6382
+ const _io411 = (input, _exceptionable = true)=>(void 0 === input.assetPrefix || "string" == typeof input.assetPrefix) && (void 0 === input.cleanDistPath || "boolean" == typeof input.cleanDistPath) && null !== input.copy && (void 0 === input.copy || Array.isArray(input.copy) && input.copy.every((elem, _index333)=>null != elem && ("string" == typeof elem || "object" == typeof elem && null !== elem && _io383(elem, _exceptionable))) || "object" == typeof input.copy && null !== input.copy && _io382(input.copy, _exceptionable)) && (void 0 === input.cssModules || "object" == typeof input.cssModules && null !== input.cssModules && false === Array.isArray(input.cssModules) && _io412(input.cssModules, _exceptionable)) && (void 0 === input.dataUriLimit || "number" == typeof input.dataUriLimit) && (void 0 === input.distPath || "object" == typeof input.distPath && null !== input.distPath && false === Array.isArray(input.distPath) && _io413(input.distPath, _exceptionable)) && null !== input.filename && (void 0 === input.filename || "string" == typeof input.filename || "object" == typeof input.filename && null !== input.filename && false === Array.isArray(input.filename) && _io414(input.filename, _exceptionable)) && (void 0 === input.filenameHash || "string" == typeof input.filenameHash || "boolean" == typeof input.filenameHash) && null !== input.inlineScripts && (void 0 === input.inlineScripts || "function" == typeof input.inlineScripts || "boolean" == typeof input.inlineScripts || input.inlineScripts instanceof RegExp || "object" == typeof input.inlineScripts && null !== input.inlineScripts && _io381(input.inlineScripts, _exceptionable)) && (void 0 === input.legalComments || "none" === input.legalComments || "inline" === input.legalComments || "linked" === input.legalComments) && null !== input.minify && (void 0 === input.minify || "boolean" == typeof input.minify || "object" == typeof input.minify && null !== input.minify && false === Array.isArray(input.minify) && _io415(input.minify, _exceptionable)) && null !== input.sourceMap && (void 0 === input.sourceMap || "boolean" == typeof input.sourceMap || "object" == typeof input.sourceMap && null !== input.sourceMap && false === Array.isArray(input.sourceMap) && _io416(input.sourceMap, _exceptionable)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
6383
6383
  if ([
6384
6384
  "assetPrefix",
6385
6385
  "cleanDistPath",
@@ -6981,18 +6981,18 @@ export const __webpack_modules__ = {
6981
6981
  return false;
6982
6982
  })();
6983
6983
  const _iu3 = (input, _exceptionable = true)=>(()=>{
6984
- if (void 0 !== input["__@toStringTag@6680"]) return _io156(input, _exceptionable);
6984
+ if (void 0 !== input["__@toStringTag@6682"]) return _io156(input, _exceptionable);
6985
6985
  if (void 0 !== input.pem) return _io157(input, _exceptionable);
6986
6986
  return false;
6987
6987
  })();
6988
6988
  const _iu4 = (input, _exceptionable = true)=>(()=>{
6989
- if (void 0 !== input["__@toStringTag@6680"]) return _io156(input, _exceptionable);
6989
+ if (void 0 !== input["__@toStringTag@6682"]) return _io156(input, _exceptionable);
6990
6990
  if (void 0 !== input.buf) return _io158(input, _exceptionable);
6991
6991
  return false;
6992
6992
  })();
6993
6993
  const _iu5 = (input, _exceptionable = true)=>(()=>{
6994
6994
  if (void 0 !== input.name) return _io409(input, _exceptionable);
6995
- if (void 0 !== input["__@toStringTag@6680"]) return _io410(input, _exceptionable);
6995
+ if (void 0 !== input["__@toStringTag@6682"]) return _io410(input, _exceptionable);
6996
6996
  return false;
6997
6997
  })();
6998
6998
  const _iu6 = (input, _exceptionable = true)=>(()=>{
@@ -9736,14 +9736,14 @@ export const __webpack_modules__ = {
9736
9736
  }).every((flag)=>flag)
9737
9737
  ].every((flag)=>flag);
9738
9738
  const _vo50 = (input, _path, _exceptionable = true)=>[
9739
- "string" == typeof input["__@toStringTag@6680"] || _report(_exceptionable, {
9740
- path: _path + "[\"__@toStringTag@6680\"]",
9739
+ "string" == typeof input["__@toStringTag@6682"] || _report(_exceptionable, {
9740
+ path: _path + "[\"__@toStringTag@6682\"]",
9741
9741
  expected: "string",
9742
- value: input["__@toStringTag@6680"]
9742
+ value: input["__@toStringTag@6682"]
9743
9743
  }),
9744
9744
  1 === Object.keys(input).length || false === _exceptionable || Object.keys(input).map((key)=>{
9745
9745
  if ([
9746
- "__@toStringTag@6680"
9746
+ "__@toStringTag@6682"
9747
9747
  ].some((prop)=>key === prop)) return true;
9748
9748
  const value = input[key];
9749
9749
  if (void 0 === value) return true;
@@ -18197,10 +18197,10 @@ export const __webpack_modules__ = {
18197
18197
  expected: "number",
18198
18198
  value: input.length
18199
18199
  }),
18200
- "Uint8Array" === input["__@toStringTag@6680"] || _report(_exceptionable, {
18201
- path: _path + "[\"__@toStringTag@6680\"]",
18200
+ "Uint8Array" === input["__@toStringTag@6682"] || _report(_exceptionable, {
18201
+ path: _path + "[\"__@toStringTag@6682\"]",
18202
18202
  expected: "\"Uint8Array\"",
18203
- value: input["__@toStringTag@6680"]
18203
+ value: input["__@toStringTag@6682"]
18204
18204
  }),
18205
18205
  false === _exceptionable || Object.keys(input).map((key)=>{
18206
18206
  if ([
@@ -18209,7 +18209,7 @@ export const __webpack_modules__ = {
18209
18209
  "byteLength",
18210
18210
  "byteOffset",
18211
18211
  "length",
18212
- "__@toStringTag@6680"
18212
+ "__@toStringTag@6682"
18213
18213
  ].some((prop)=>key === prop)) return true;
18214
18214
  const value = input[key];
18215
18215
  if (void 0 === value) return true;
@@ -35058,14 +35058,14 @@ export const __webpack_modules__ = {
35058
35058
  }).every((flag)=>flag)
35059
35059
  ].every((flag)=>flag);
35060
35060
  const _vo410 = (input, _path, _exceptionable = true)=>[
35061
- "string" == typeof input["__@toStringTag@6680"] || _report(_exceptionable, {
35062
- path: _path + "[\"__@toStringTag@6680\"]",
35061
+ "string" == typeof input["__@toStringTag@6682"] || _report(_exceptionable, {
35062
+ path: _path + "[\"__@toStringTag@6682\"]",
35063
35063
  expected: "string",
35064
- value: input["__@toStringTag@6680"]
35064
+ value: input["__@toStringTag@6682"]
35065
35065
  }),
35066
35066
  1 === Object.keys(input).length || false === _exceptionable || Object.keys(input).map((key)=>{
35067
35067
  if ([
35068
- "__@toStringTag@6680"
35068
+ "__@toStringTag@6682"
35069
35069
  ].some((prop)=>key === prop)) return true;
35070
35070
  const value = input[key];
35071
35071
  if (void 0 === value) return true;
@@ -35157,11 +35157,19 @@ export const __webpack_modules__ = {
35157
35157
  expected: "(boolean | string | undefined)",
35158
35158
  value: input.filenameHash
35159
35159
  }),
35160
- void 0 === input.inlineScripts || "boolean" == typeof input.inlineScripts || _report(_exceptionable, {
35160
+ (null !== input.inlineScripts || _report(_exceptionable, {
35161
35161
  path: _path + ".inlineScripts",
35162
- expected: "(boolean | undefined)",
35162
+ expected: "(RegExp | __type.o111 | boolean | undefined)",
35163
35163
  value: input.inlineScripts
35164
- }),
35164
+ })) && (void 0 === input.inlineScripts || "function" == typeof input.inlineScripts || "boolean" == typeof input.inlineScripts || input.inlineScripts instanceof RegExp || ("object" == typeof input.inlineScripts && null !== input.inlineScripts || _report(_exceptionable, {
35165
+ path: _path + ".inlineScripts",
35166
+ expected: "(RegExp | __type.o111 | boolean | undefined)",
35167
+ value: input.inlineScripts
35168
+ })) && _vo381(input.inlineScripts, _path + ".inlineScripts", _exceptionable) || _report(_exceptionable, {
35169
+ path: _path + ".inlineScripts",
35170
+ expected: "(RegExp | __type.o111 | boolean | undefined)",
35171
+ value: input.inlineScripts
35172
+ })),
35165
35173
  void 0 === input.legalComments || "none" === input.legalComments || "inline" === input.legalComments || "linked" === input.legalComments || _report(_exceptionable, {
35166
35174
  path: _path + ".legalComments",
35167
35175
  expected: "(\"inline\" | \"linked\" | \"none\" | undefined)",
@@ -37821,7 +37829,7 @@ export const __webpack_modules__ = {
37821
37829
  });
37822
37830
  })();
37823
37831
  const _vu3 = (input, _path, _exceptionable = true)=>(()=>{
37824
- if (void 0 !== input["__@toStringTag@6680"]) return _vo156(input, _path, _exceptionable);
37832
+ if (void 0 !== input["__@toStringTag@6682"]) return _vo156(input, _path, _exceptionable);
37825
37833
  if (void 0 !== input.pem) return _vo157(input, _path, _exceptionable);
37826
37834
  return _report(_exceptionable, {
37827
37835
  path: _path,
@@ -37830,7 +37838,7 @@ export const __webpack_modules__ = {
37830
37838
  });
37831
37839
  })();
37832
37840
  const _vu4 = (input, _path, _exceptionable = true)=>(()=>{
37833
- if (void 0 !== input["__@toStringTag@6680"]) return _vo156(input, _path, _exceptionable);
37841
+ if (void 0 !== input["__@toStringTag@6682"]) return _vo156(input, _path, _exceptionable);
37834
37842
  if (void 0 !== input.buf) return _vo158(input, _path, _exceptionable);
37835
37843
  return _report(_exceptionable, {
37836
37844
  path: _path,
@@ -37840,7 +37848,7 @@ export const __webpack_modules__ = {
37840
37848
  })();
37841
37849
  const _vu5 = (input, _path, _exceptionable = true)=>(()=>{
37842
37850
  if (void 0 !== input.name) return _vo409(input, _path, _exceptionable);
37843
- if (void 0 !== input["__@toStringTag@6680"]) return _vo410(input, _path, _exceptionable);
37851
+ if (void 0 !== input["__@toStringTag@6682"]) return _vo410(input, _path, _exceptionable);
37844
37852
  return _report(_exceptionable, {
37845
37853
  path: _path,
37846
37854
  expected: "(LooseRsbuildPlugin | RsbuildPlugins | LooseRsbuildPlugin | Falsy)",
@@ -19,11 +19,11 @@ export const __webpack_modules__ = {
19
19
  config,
20
20
  debug: _debug_js__WEBPACK_IMPORTED_MODULE_1__.fF,
21
21
  async exit (code) {
22
- const { exit } = await __webpack_require__.e("src_cli_exit_ts").then(__webpack_require__.bind(__webpack_require__, "./src/cli/exit.ts"));
22
+ const { exit } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/cli/exit.ts"));
23
23
  return exit(code);
24
24
  },
25
25
  logger: _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger,
26
- version: _version_js__WEBPACK_IMPORTED_MODULE_2__.i8
26
+ version: _version_js__WEBPACK_IMPORTED_MODULE_2__.version
27
27
  });
28
28
  }
29
29
  };
@@ -7,10 +7,8 @@ export const __webpack_modules__ = {
7
7
  __webpack_require__.d(__webpack_exports__, {
8
8
  pluginRsdoctor: ()=>pluginRsdoctor
9
9
  });
10
- var core_ = __webpack_require__("@rsbuild/core");
11
- function isCI() {
12
- return !!process.env['CI'] && 'false' !== process.env['CI'];
13
- }
10
+ var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core");
11
+ var _utils_is_ci_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/is-ci.ts");
14
12
  function pluginRsdoctor(options) {
15
13
  return {
16
14
  name: 'lynx:rsbuild:rsdoctor',
@@ -27,7 +25,7 @@ export const __webpack_modules__ = {
27
25
  if (registered) continue;
28
26
  config.plugins ??= [];
29
27
  const defaultOptions = {
30
- disableClientServer: isCI(),
28
+ disableClientServer: (0, _utils_is_ci_js__WEBPACK_IMPORTED_MODULE_1__.y)(),
31
29
  supports: {
32
30
  banner: true
33
31
  },
@@ -42,12 +40,20 @@ export const __webpack_modules__ = {
42
40
  }
43
41
  }
44
42
  };
45
- config.plugins.push(new RsdoctorRspackPlugin((0, core_.mergeRsbuildConfig)(defaultOptions, options)));
43
+ config.plugins.push(new RsdoctorRspackPlugin((0, _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.mergeRsbuildConfig)(defaultOptions, options)));
46
44
  }
47
- core_.logger.info("Rsdoctor is enabled.");
45
+ _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.info("Rsdoctor is enabled.");
48
46
  });
49
47
  }
50
48
  };
51
49
  }
50
+ },
51
+ "./src/utils/is-ci.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
52
+ __webpack_require__.d(__webpack_exports__, {
53
+ y: ()=>isCI
54
+ });
55
+ function isCI() {
56
+ return !!process.env['CI'] && 'false' !== process.env['CI'];
57
+ }
52
58
  }
53
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/rspeedy-canary",
3
- "version": "0.9.11-canary-20250627-a64333ef",
3
+ "version": "0.9.11-canary-20250630-77513752",
4
4
  "description": "A webpack/rspack-based frontend toolchain for Lynx",
5
5
  "keywords": [
6
6
  "webpack",