@workleap/rsbuild-configs 3.2.6 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @workleap/rsbuild-configs
2
2
 
3
+ ## 3.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#420](https://github.com/workleap/wl-web-configs/pull/420) [`a0f5806`](https://github.com/workleap/wl-web-configs/commit/a0f58067a91bea18d1e8c5d3dc024a94d5d9a071) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Updated the dev config interface to accept options for the basic SSL plugin through the `https` option.
8
+
3
9
  ## 3.2.6
4
10
 
5
11
  ### Patch Changes
@@ -1 +1,2 @@
1
1
  export declare function isBoolean(value: unknown): value is boolean;
2
+ export declare function isFunction(value: unknown): value is (...args: any[]) => unknown;
@@ -1,7 +1,11 @@
1
1
  function isBoolean(value) {
2
2
  return typeof value === "boolean";
3
3
  }
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ function isFunction(value) {
6
+ return typeof value === "function";
7
+ }
4
8
 
5
- export { isBoolean };
9
+ export { isBoolean, isFunction };
6
10
 
7
11
  //# sourceMappingURL=assertions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertions.js","sources":["../src/assertions.ts"],"sourcesContent":["export function isBoolean(value: unknown): value is boolean {\n return typeof value === \"boolean\";\n}\n"],"names":["isBoolean","value"],"mappings":"AAAO,SAASA,SAASA,CAACC,KAAc;IACpC,OAAO,OAAOA,UAAU;AAC5B"}
1
+ {"version":3,"file":"assertions.js","sources":["../src/assertions.ts"],"sourcesContent":["export function isBoolean(value: unknown): value is boolean {\n return typeof value === \"boolean\";\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isFunction(value: unknown): value is (...args: any[]) => unknown {\n return typeof value === \"function\";\n}\n"],"names":["isBoolean","value","isFunction"],"mappings":"AAAO,SAASA,SAASA,CAACC,KAAc;IACpC,OAAO,OAAOA,UAAU;AAC5B;AAEA,8DAA8D;AACvD,SAASC,UAAUA,CAACD,KAAc;IACrC,OAAO,OAAOA,UAAU;AAC5B"}
package/dist/dev.d.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  import { type HtmlConfig, type RsbuildConfig, type RsbuildEntry, type RsbuildPlugins, type ServerConfig, type SourceMap } from "@rsbuild/core";
2
+ import { type PluginBasicSslOptions } from "@rsbuild/plugin-basic-ssl";
2
3
  import { type PluginReactOptions } from "@rsbuild/plugin-react";
3
4
  import { type PluginSvgrOptions } from "@rsbuild/plugin-svgr";
4
5
  import { type RsbuildConfigTransformer } from "./applyTransformers.ts";
5
6
  export type DefineDevHtmlPluginConfigFunction = (defaultOptions: HtmlConfig) => HtmlConfig;
6
7
  export type DefineDevDefineReactPluginConfigFunction = (defaultOptions: PluginReactOptions) => PluginReactOptions;
7
8
  export type DefineDevSvgrPluginConfigFunction = (defaultOptions: PluginSvgrOptions) => PluginSvgrOptions;
9
+ export type DefineBasicSslConfigFunction = (defaultOptions: PluginBasicSslOptions) => PluginBasicSslOptions;
8
10
  export interface DefineDevConfigOptions {
9
11
  entry?: RsbuildEntry;
10
- https?: boolean | ServerConfig["https"];
12
+ https?: boolean | DefineBasicSslConfigFunction | ServerConfig["https"];
11
13
  host?: string;
12
14
  port?: number;
13
15
  assetPrefix?: string;
package/dist/dev.js CHANGED
@@ -4,7 +4,7 @@ import { pluginReact } from "@rsbuild/plugin-react";
4
4
  import { pluginSvgr } from "@rsbuild/plugin-svgr";
5
5
  import node_path from "node:path";
6
6
  import { applyTransformers } from "./applyTransformers.js";
7
- import { isBoolean } from "./assertions.js";
7
+ import { isBoolean, isFunction } from "./assertions.js";
8
8
 
9
9
 
10
10
 
@@ -50,7 +50,7 @@ function defineDevConfig(options = {}) {
50
50
  writeToDisk
51
51
  },
52
52
  server: {
53
- https: isBoolean(https) ? undefined : https,
53
+ https: isBoolean(https) || isFunction(https) ? undefined : https,
54
54
  host,
55
55
  port,
56
56
  historyApiFallback: true
@@ -76,7 +76,7 @@ function defineDevConfig(options = {}) {
76
76
  template: node_path.resolve("./public/index.html")
77
77
  }) : undefined,
78
78
  plugins: [
79
- isBoolean(https) && https && pluginBasicSsl(),
79
+ https && (isBoolean(https) || isFunction(https)) && pluginBasicSsl(isFunction(https) ? https({}) : undefined),
80
80
  react && pluginReact(react({
81
81
  fastRefresh,
82
82
  reactRefreshOptions: {
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sources":["../src/dev.ts"],"sourcesContent":["import { defineConfig, type HtmlConfig, type RsbuildConfig, type RsbuildEntry, type RsbuildPlugins, type ServerConfig, type SourceMap } from \"@rsbuild/core\";\nimport { pluginBasicSsl } from \"@rsbuild/plugin-basic-ssl\";\nimport { pluginReact, type PluginReactOptions } from \"@rsbuild/plugin-react\";\nimport { pluginSvgr, type PluginSvgrOptions } from \"@rsbuild/plugin-svgr\";\nimport path from \"node:path\";\nimport { applyTransformers, type RsbuildConfigTransformer } from \"./applyTransformers.ts\";\nimport { isBoolean } from \"./assertions.ts\";\n\nexport type DefineDevHtmlPluginConfigFunction = (defaultOptions: HtmlConfig) => HtmlConfig;\nexport type DefineDevDefineReactPluginConfigFunction = (defaultOptions: PluginReactOptions) => PluginReactOptions;\nexport type DefineDevSvgrPluginConfigFunction = (defaultOptions: PluginSvgrOptions) => PluginSvgrOptions;\n\nexport interface DefineDevConfigOptions {\n entry?: RsbuildEntry;\n https?: boolean | ServerConfig[\"https\"];\n host?: string;\n port?: number;\n // Similar to webpack.publicPath.\n assetPrefix?: string;\n plugins?: RsbuildPlugins;\n html?: false | DefineDevHtmlPluginConfigFunction;\n lazyCompilation?: boolean;\n hmr?: boolean;\n fastRefresh?: boolean;\n sourceMap?: false | SourceMap;\n overlay?: false;\n writeToDisk?: true;\n react?: false | DefineDevDefineReactPluginConfigFunction;\n svgr?: false | DefineDevSvgrPluginConfigFunction;\n environmentVariables?: Record<string, unknown>;\n transformers?: RsbuildConfigTransformer[];\n verbose?: boolean;\n}\n\nfunction defaultDefineHtmlPluginConfig(options: HtmlConfig) {\n return options;\n}\n\nfunction defaultDefineReactPluginConfig(options: PluginReactOptions) {\n return options;\n}\n\nfunction defineSvgrPluginConfig(options: PluginSvgrOptions) {\n return options;\n}\n\nexport function defineDevConfig(options: DefineDevConfigOptions = {}) {\n const {\n entry = {\n index: path.resolve(\"./src/index.tsx\")\n },\n https = false,\n host = \"localhost\",\n port = 8080,\n assetPrefix = \"/\",\n plugins = [],\n html = defaultDefineHtmlPluginConfig,\n lazyCompilation = false,\n hmr = true,\n fastRefresh = true,\n sourceMap = {\n js: \"cheap-module-source-map\",\n css: true\n },\n overlay,\n writeToDisk,\n react = defaultDefineReactPluginConfig,\n svgr = defineSvgrPluginConfig,\n // Using an empty object literal as the default value to ensure\n // \"process.env\" is always available.\n environmentVariables = {},\n transformers = [],\n verbose = false\n } = options;\n\n const config: RsbuildConfig = {\n mode: \"development\",\n dev: {\n assetPrefix,\n lazyCompilation,\n hmr: hmr || fastRefresh,\n client: (overlay === false || fastRefresh) ? {\n overlay: false\n } : undefined,\n writeToDisk\n },\n server: {\n https: isBoolean(https) ? undefined : https,\n host,\n port,\n historyApiFallback: true\n },\n source: {\n entry,\n // Stringify the environment variables because the plugin does a direct text replacement. Otherwise, \"production\" would become production\n // after replacement and cause an undefined var error because the production var doesn't exist.\n // For more information, view: https://rsbuild.dev/guide/advanced/env-vars#using-define.\n define: {\n \"process.env\": Object.keys(environmentVariables).reduce((acc, key) => {\n acc[key] = JSON.stringify(environmentVariables[key]);\n\n return acc;\n }, {} as Record<string, string>)\n }\n },\n output: {\n target: \"web\",\n minify: false,\n sourceMap\n },\n html: html\n ? html({ template: path.resolve(\"./public/index.html\") })\n : undefined,\n plugins: [\n isBoolean(https) && https && pluginBasicSsl(),\n react && pluginReact(react({\n fastRefresh,\n reactRefreshOptions: {\n overlay: overlay !== false\n }\n })),\n svgr && pluginSvgr(svgr({\n svgrOptions: {\n exportType: \"named\"\n }\n })),\n ...plugins\n ].filter(Boolean),\n tools: {\n rspack: {\n infrastructureLogging: verbose ? {\n appendOnly: true,\n level: \"verbose\",\n debug: /PackFileCache/\n } : undefined\n }\n }\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"dev\",\n verbose\n });\n\n return defineConfig(transformedConfig);\n}\n\n"],"names":["defineConfig","pluginBasicSsl","pluginReact","pluginSvgr","path","applyTransformers","isBoolean","defaultDefineHtmlPluginConfig","options","defaultDefineReactPluginConfig","defineSvgrPluginConfig","defineDevConfig","entry","https","host","port","assetPrefix","plugins","html","lazyCompilation","hmr","fastRefresh","sourceMap","overlay","writeToDisk","react","svgr","environmentVariables","transformers","verbose","config","undefined","Object","acc","key","JSON","Boolean","transformedConfig"],"mappings":";;;;;;;;;;;;;;;AAA6J;AAClG;AACkB;AACH;AAC7C;AAC6D;AAC9C;AA4B5C,SAASO,6BAA6BA,CAACC,OAAmB;IACtD,OAAOA;AACX;AAEA,SAASC,8BAA8BA,CAACD,OAA2B;IAC/D,OAAOA;AACX;AAEA,SAASE,sBAAsBA,CAACF,OAA0B;IACtD,OAAOA;AACX;AAEO,SAASG,eAAeA,CAACH,UAAkC,CAAC,CAAC;IAChE,MAAM,EACFI,QAAQ;QACJ,OAAOR,iBAAY,CAAC;IACxB,CAAC,EACDS,QAAQ,KAAK,EACbC,OAAO,WAAW,EAClBC,OAAO,IAAI,EACXC,cAAc,GAAG,EACjBC,UAAU,EAAE,EACZC,OAAOX,6BAA6B,EACpCY,kBAAkB,KAAK,EACvBC,MAAM,IAAI,EACVC,cAAc,IAAI,EAClBC,YAAY;QACR,IAAI;QACJ,KAAK;IACT,CAAC,EACDC,OAAO,EACPC,WAAW,EACXC,QAAQhB,8BAA8B,EACtCiB,OAAOhB,sBAAsB,EAC7B,+DAA+D;IAC/D,qCAAqC;IACrCiB,uBAAuB,CAAC,CAAC,EACzBC,eAAe,EAAE,EACjBC,UAAU,KAAK,EAClB,GAAGrB;IAEJ,MAAMsB,SAAwB;QAC1B,MAAM;QACN,KAAK;YACDd;YACAG;YACA,KAAKC,OAAOC;YACZ,QAASE,YAAY,SAASF,cAAe;gBACzC,SAAS;YACb,IAAIU;YACJP;QACJ;QACA,QAAQ;YACJ,OAAOlB,SAASA,CAACO,SAASkB,YAAYlB;YACtCC;YACAC;YACA,oBAAoB;QACxB;QACA,QAAQ;YACJH;YACA,yIAAyI;YACzI,+FAA+F;YAC/F,wFAAwF;YACxF,QAAQ;gBACJ,eAAeoB,OAAO,IAAI,CAACL,sBAAsB,MAAM,CAAC,CAACM,KAAKC;oBAC1DD,GAAG,CAACC,IAAI,GAAGC,KAAK,SAAS,CAACR,oBAAoB,CAACO,IAAI;oBAEnD,OAAOD;gBACX,GAAG,CAAC;YACR;QACJ;QACA,QAAQ;YACJ,QAAQ;YACR,QAAQ;YACRX;QACJ;QACA,MAAMJ,OACAA,KAAK;YAAE,UAAUd,iBAAY,CAAC;QAAuB,KACrD2B;QACN,SAAS;YACLzB,SAASA,CAACO,UAAUA,SAASZ,cAAcA;YAC3CwB,SAASvB,WAAWA,CAACuB,MAAM;gBACvBJ;gBACA,qBAAqB;oBACjB,SAASE,YAAY;gBACzB;YACJ;YACAG,QAAQvB,UAAUA,CAACuB,KAAK;gBACpB,aAAa;oBACT,YAAY;gBAChB;YACJ;eACGT;SACN,CAAC,MAAM,CAACmB;QACT,OAAO;YACH,QAAQ;gBACJ,uBAAuBP,UAAU;oBAC7B,YAAY;oBACZ,OAAO;oBACP,OAAO;gBACX,IAAIE;YACR;QACJ;IACJ;IAEA,MAAMM,oBAAoBhC,iBAAiBA,CAACyB,QAAQF,cAAc;QAC9D,aAAa;QACbC;IACJ;IAEA,OAAO7B,YAAYA,CAACqC;AACxB"}
1
+ {"version":3,"file":"dev.js","sources":["../src/dev.ts"],"sourcesContent":["import { defineConfig, type HtmlConfig, type RsbuildConfig, type RsbuildEntry, type RsbuildPlugins, type ServerConfig, type SourceMap } from \"@rsbuild/core\";\nimport { pluginBasicSsl, type PluginBasicSslOptions } from \"@rsbuild/plugin-basic-ssl\";\nimport { pluginReact, type PluginReactOptions } from \"@rsbuild/plugin-react\";\nimport { pluginSvgr, type PluginSvgrOptions } from \"@rsbuild/plugin-svgr\";\nimport path from \"node:path\";\nimport { applyTransformers, type RsbuildConfigTransformer } from \"./applyTransformers.ts\";\nimport { isBoolean, isFunction } from \"./assertions.ts\";\n\nexport type DefineDevHtmlPluginConfigFunction = (defaultOptions: HtmlConfig) => HtmlConfig;\nexport type DefineDevDefineReactPluginConfigFunction = (defaultOptions: PluginReactOptions) => PluginReactOptions;\nexport type DefineDevSvgrPluginConfigFunction = (defaultOptions: PluginSvgrOptions) => PluginSvgrOptions;\nexport type DefineBasicSslConfigFunction = (defaultOptions: PluginBasicSslOptions) => PluginBasicSslOptions;\n\nexport interface DefineDevConfigOptions {\n entry?: RsbuildEntry;\n https?: boolean | DefineBasicSslConfigFunction | ServerConfig[\"https\"];\n host?: string;\n port?: number;\n // Similar to webpack.publicPath.\n assetPrefix?: string;\n plugins?: RsbuildPlugins;\n html?: false | DefineDevHtmlPluginConfigFunction;\n lazyCompilation?: boolean;\n hmr?: boolean;\n fastRefresh?: boolean;\n sourceMap?: false | SourceMap;\n overlay?: false;\n writeToDisk?: true;\n react?: false | DefineDevDefineReactPluginConfigFunction;\n svgr?: false | DefineDevSvgrPluginConfigFunction;\n environmentVariables?: Record<string, unknown>;\n transformers?: RsbuildConfigTransformer[];\n verbose?: boolean;\n}\n\nfunction defaultDefineHtmlPluginConfig(options: HtmlConfig) {\n return options;\n}\n\nfunction defaultDefineReactPluginConfig(options: PluginReactOptions) {\n return options;\n}\n\nfunction defineSvgrPluginConfig(options: PluginSvgrOptions) {\n return options;\n}\n\nexport function defineDevConfig(options: DefineDevConfigOptions = {}) {\n const {\n entry = {\n index: path.resolve(\"./src/index.tsx\")\n },\n https = false,\n host = \"localhost\",\n port = 8080,\n assetPrefix = \"/\",\n plugins = [],\n html = defaultDefineHtmlPluginConfig,\n lazyCompilation = false,\n hmr = true,\n fastRefresh = true,\n sourceMap = {\n js: \"cheap-module-source-map\",\n css: true\n },\n overlay,\n writeToDisk,\n react = defaultDefineReactPluginConfig,\n svgr = defineSvgrPluginConfig,\n // Using an empty object literal as the default value to ensure\n // \"process.env\" is always available.\n environmentVariables = {},\n transformers = [],\n verbose = false\n } = options;\n\n const config: RsbuildConfig = {\n mode: \"development\",\n dev: {\n assetPrefix,\n lazyCompilation,\n hmr: hmr || fastRefresh,\n client: (overlay === false || fastRefresh) ? {\n overlay: false\n } : undefined,\n writeToDisk\n },\n server: {\n https: isBoolean(https) || isFunction(https) ? undefined : https,\n host,\n port,\n historyApiFallback: true\n },\n source: {\n entry,\n // Stringify the environment variables because the plugin does a direct text replacement. Otherwise, \"production\" would become production\n // after replacement and cause an undefined var error because the production var doesn't exist.\n // For more information, view: https://rsbuild.dev/guide/advanced/env-vars#using-define.\n define: {\n \"process.env\": Object.keys(environmentVariables).reduce((acc, key) => {\n acc[key] = JSON.stringify(environmentVariables[key]);\n\n return acc;\n }, {} as Record<string, string>)\n }\n },\n output: {\n target: \"web\",\n minify: false,\n sourceMap\n },\n html: html\n ? html({ template: path.resolve(\"./public/index.html\") })\n : undefined,\n plugins: [\n https && (isBoolean(https) || isFunction(https)) && pluginBasicSsl(isFunction(https) ? https({}) : undefined),\n react && pluginReact(react({\n fastRefresh,\n reactRefreshOptions: {\n overlay: overlay !== false\n }\n })),\n svgr && pluginSvgr(svgr({\n svgrOptions: {\n exportType: \"named\"\n }\n })),\n ...plugins\n ].filter(Boolean),\n tools: {\n rspack: {\n infrastructureLogging: verbose ? {\n appendOnly: true,\n level: \"verbose\",\n debug: /PackFileCache/\n } : undefined\n }\n }\n };\n\n const transformedConfig = applyTransformers(config, transformers, {\n environment: \"dev\",\n verbose\n });\n\n return defineConfig(transformedConfig);\n}\n\n"],"names":["defineConfig","pluginBasicSsl","pluginReact","pluginSvgr","path","applyTransformers","isBoolean","isFunction","defaultDefineHtmlPluginConfig","options","defaultDefineReactPluginConfig","defineSvgrPluginConfig","defineDevConfig","entry","https","host","port","assetPrefix","plugins","html","lazyCompilation","hmr","fastRefresh","sourceMap","overlay","writeToDisk","react","svgr","environmentVariables","transformers","verbose","config","undefined","Object","acc","key","JSON","Boolean","transformedConfig"],"mappings":";;;;;;;;;;;;;;;AAA6J;AACtE;AACV;AACH;AAC7C;AAC6D;AAClC;AA6BxD,SAASQ,6BAA6BA,CAACC,OAAmB;IACtD,OAAOA;AACX;AAEA,SAASC,8BAA8BA,CAACD,OAA2B;IAC/D,OAAOA;AACX;AAEA,SAASE,sBAAsBA,CAACF,OAA0B;IACtD,OAAOA;AACX;AAEO,SAASG,eAAeA,CAACH,UAAkC,CAAC,CAAC;IAChE,MAAM,EACFI,QAAQ;QACJ,OAAOT,iBAAY,CAAC;IACxB,CAAC,EACDU,QAAQ,KAAK,EACbC,OAAO,WAAW,EAClBC,OAAO,IAAI,EACXC,cAAc,GAAG,EACjBC,UAAU,EAAE,EACZC,OAAOX,6BAA6B,EACpCY,kBAAkB,KAAK,EACvBC,MAAM,IAAI,EACVC,cAAc,IAAI,EAClBC,YAAY;QACR,IAAI;QACJ,KAAK;IACT,CAAC,EACDC,OAAO,EACPC,WAAW,EACXC,QAAQhB,8BAA8B,EACtCiB,OAAOhB,sBAAsB,EAC7B,+DAA+D;IAC/D,qCAAqC;IACrCiB,uBAAuB,CAAC,CAAC,EACzBC,eAAe,EAAE,EACjBC,UAAU,KAAK,EAClB,GAAGrB;IAEJ,MAAMsB,SAAwB;QAC1B,MAAM;QACN,KAAK;YACDd;YACAG;YACA,KAAKC,OAAOC;YACZ,QAASE,YAAY,SAASF,cAAe;gBACzC,SAAS;YACb,IAAIU;YACJP;QACJ;QACA,QAAQ;YACJ,OAAOnB,SAASA,CAACQ,UAAUP,UAAUA,CAACO,SAASkB,YAAYlB;YAC3DC;YACAC;YACA,oBAAoB;QACxB;QACA,QAAQ;YACJH;YACA,yIAAyI;YACzI,+FAA+F;YAC/F,wFAAwF;YACxF,QAAQ;gBACJ,eAAeoB,OAAO,IAAI,CAACL,sBAAsB,MAAM,CAAC,CAACM,KAAKC;oBAC1DD,GAAG,CAACC,IAAI,GAAGC,KAAK,SAAS,CAACR,oBAAoB,CAACO,IAAI;oBAEnD,OAAOD;gBACX,GAAG,CAAC;YACR;QACJ;QACA,QAAQ;YACJ,QAAQ;YACR,QAAQ;YACRX;QACJ;QACA,MAAMJ,OACAA,KAAK;YAAE,UAAUf,iBAAY,CAAC;QAAuB,KACrD4B;QACN,SAAS;YACLlB,SAAUR,CAAAA,SAASA,CAACQ,UAAUP,UAAUA,CAACO,MAAK,KAAMb,cAAcA,CAACM,UAAUA,CAACO,SAASA,MAAM,CAAC,KAAKkB;YACnGN,SAASxB,WAAWA,CAACwB,MAAM;gBACvBJ;gBACA,qBAAqB;oBACjB,SAASE,YAAY;gBACzB;YACJ;YACAG,QAAQxB,UAAUA,CAACwB,KAAK;gBACpB,aAAa;oBACT,YAAY;gBAChB;YACJ;eACGT;SACN,CAAC,MAAM,CAACmB;QACT,OAAO;YACH,QAAQ;gBACJ,uBAAuBP,UAAU;oBAC7B,YAAY;oBACZ,OAAO;oBACP,OAAO;gBACX,IAAIE;YACR;QACJ;IACJ;IAEA,MAAMM,oBAAoBjC,iBAAiBA,CAAC0B,QAAQF,cAAc;QAC9D,aAAa;QACbC;IACJ;IAEA,OAAO9B,YAAYA,CAACsC;AACxB"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@workleap/rsbuild-configs",
3
3
  "author": "Workleap",
4
4
  "description": "Workleap recommended Rsbuild configurations.",
5
- "version": "3.2.6",
5
+ "version": "3.2.7",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -40,17 +40,17 @@
40
40
  "devDependencies": {
41
41
  "@eslint/js": "9.39.2",
42
42
  "@rsbuild/core": "1.7.5",
43
- "@rslib/core": "0.20.2",
43
+ "@rslib/core": "0.20.3",
44
44
  "@rspack/core": "1.7.11",
45
- "@types/node": "25.5.0",
45
+ "@types/node": "25.5.2",
46
46
  "@typescript-eslint/parser": "8.58.0",
47
- "@typescript/native-preview": "7.0.0-dev.20260331.1",
47
+ "@typescript/native-preview": "7.0.0-dev.20260407.1",
48
48
  "eslint": "9.39.2",
49
49
  "typescript": "6.0.2",
50
50
  "typescript-eslint": "8.58.0",
51
- "vitest": "4.1.2",
52
- "@workleap/eslint-configs": "2.0.1",
53
- "@workleap/rslib-configs": "1.1.11",
51
+ "vitest": "4.1.3",
52
+ "@workleap/eslint-configs": "2.0.2",
53
+ "@workleap/rslib-configs": "1.1.12",
54
54
  "@workleap/typescript-configs": "4.0.0"
55
55
  },
56
56
  "scripts": {
package/src/assertions.ts CHANGED
@@ -1,3 +1,8 @@
1
1
  export function isBoolean(value: unknown): value is boolean {
2
2
  return typeof value === "boolean";
3
3
  }
4
+
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ export function isFunction(value: unknown): value is (...args: any[]) => unknown {
7
+ return typeof value === "function";
8
+ }
package/src/dev.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  import { defineConfig, type HtmlConfig, type RsbuildConfig, type RsbuildEntry, type RsbuildPlugins, type ServerConfig, type SourceMap } from "@rsbuild/core";
2
- import { pluginBasicSsl } from "@rsbuild/plugin-basic-ssl";
2
+ import { pluginBasicSsl, type PluginBasicSslOptions } from "@rsbuild/plugin-basic-ssl";
3
3
  import { pluginReact, type PluginReactOptions } from "@rsbuild/plugin-react";
4
4
  import { pluginSvgr, type PluginSvgrOptions } from "@rsbuild/plugin-svgr";
5
5
  import path from "node:path";
6
6
  import { applyTransformers, type RsbuildConfigTransformer } from "./applyTransformers.ts";
7
- import { isBoolean } from "./assertions.ts";
7
+ import { isBoolean, isFunction } from "./assertions.ts";
8
8
 
9
9
  export type DefineDevHtmlPluginConfigFunction = (defaultOptions: HtmlConfig) => HtmlConfig;
10
10
  export type DefineDevDefineReactPluginConfigFunction = (defaultOptions: PluginReactOptions) => PluginReactOptions;
11
11
  export type DefineDevSvgrPluginConfigFunction = (defaultOptions: PluginSvgrOptions) => PluginSvgrOptions;
12
+ export type DefineBasicSslConfigFunction = (defaultOptions: PluginBasicSslOptions) => PluginBasicSslOptions;
12
13
 
13
14
  export interface DefineDevConfigOptions {
14
15
  entry?: RsbuildEntry;
15
- https?: boolean | ServerConfig["https"];
16
+ https?: boolean | DefineBasicSslConfigFunction | ServerConfig["https"];
16
17
  host?: string;
17
18
  port?: number;
18
19
  // Similar to webpack.publicPath.
@@ -85,7 +86,7 @@ export function defineDevConfig(options: DefineDevConfigOptions = {}) {
85
86
  writeToDisk
86
87
  },
87
88
  server: {
88
- https: isBoolean(https) ? undefined : https,
89
+ https: isBoolean(https) || isFunction(https) ? undefined : https,
89
90
  host,
90
91
  port,
91
92
  historyApiFallback: true
@@ -112,7 +113,7 @@ export function defineDevConfig(options: DefineDevConfigOptions = {}) {
112
113
  ? html({ template: path.resolve("./public/index.html") })
113
114
  : undefined,
114
115
  plugins: [
115
- isBoolean(https) && https && pluginBasicSsl(),
116
+ https && (isBoolean(https) || isFunction(https)) && pluginBasicSsl(isFunction(https) ? https({}) : undefined),
116
117
  react && pluginReact(react({
117
118
  fastRefresh,
118
119
  reactRefreshOptions: {