@winner-fed/bundler-rsbuild2 0.19.4-alpha.0 → 0.19.4

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.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 把 rsbuild 的 onAfterDevCompile 适配成 webpack 风格的 compiler.hooks.done,
3
+ * 供 dev server 中间件工厂(如 createRouteMiddleware)消费真实 stats。
4
+ */
5
+ export interface ICompilerLike {
6
+ hooks: {
7
+ done: {
8
+ tap: (name: string, cb: (stats: any) => void) => void;
9
+ };
10
+ };
11
+ }
12
+ export declare function createCompilerLike(rsbuild: {
13
+ onAfterDevCompile: (fn: (params: {
14
+ stats: any;
15
+ }) => void) => void;
16
+ }): ICompilerLike;
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/server/compilerAdapter.ts
20
+ var compilerAdapter_exports = {};
21
+ __export(compilerAdapter_exports, {
22
+ createCompilerLike: () => createCompilerLike
23
+ });
24
+ module.exports = __toCommonJS(compilerAdapter_exports);
25
+ function createCompilerLike(rsbuild) {
26
+ return {
27
+ hooks: {
28
+ done: {
29
+ tap: (_name, cb) => {
30
+ rsbuild.onAfterDevCompile(({ stats }) => cb(stats));
31
+ }
32
+ }
33
+ }
34
+ };
35
+ }
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ createCompilerLike
39
+ });
@@ -37,6 +37,7 @@ var import_bundler_utils = require("@winner-fed/bundler-utils");
37
37
  var import_express = __toESM(require("@winner-fed/bundler-utils/compiled/express"));
38
38
  var import_utils = require("@winner-fed/utils");
39
39
  var import_types = require("../types");
40
+ var import_compilerAdapter = require("./compilerAdapter");
40
41
  async function createServer(opts) {
41
42
  var _a;
42
43
  const { userConfig, rsbuildConfig } = opts;
@@ -58,15 +59,7 @@ async function createServer(opts) {
58
59
  if (userConfig.proxy) {
59
60
  (0, import_bundler_utils.createProxy)(userConfig.proxy, app);
60
61
  }
61
- const compilerLike = {
62
- hooks: {
63
- done: {
64
- tap: (_name, cb) => {
65
- rsbuild.onAfterDevCompile(({ stats }) => cb(stats));
66
- }
67
- }
68
- }
69
- };
62
+ const compilerLike = (0, import_compilerAdapter.createCompilerLike)(rsbuild);
70
63
  (opts.afterMiddlewares || []).forEach((m) => {
71
64
  app.use((0, import_bundler_utils.resolveMiddleware)(m, { compiler: compilerLike }));
72
65
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winner-fed/bundler-rsbuild2",
3
- "version": "0.19.4-alpha.0",
3
+ "version": "0.19.4",
4
4
  "description": "@winner-fed/bundler-rsbuild2, based on Rsbuild 2.x (Rspack 2.x). External bundler for winjs, not a dependency of preset-win.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,8 +20,8 @@
20
20
  "@rsbuild/plugin-sass": "2.0.1",
21
21
  "@rsbuild/plugin-stylus": "2.0.1",
22
22
  "@rsbuild/plugin-type-check": "1.6.0",
23
- "@winner-fed/bundler-utils": "0.19.4-alpha.0",
24
- "@winner-fed/utils": "0.19.4-alpha.0"
23
+ "@winner-fed/bundler-utils": "0.19.4",
24
+ "@winner-fed/utils": "0.19.4"
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=20.19"
@@ -32,6 +32,7 @@
32
32
  "scripts": {
33
33
  "build": "win-scripts father build",
34
34
  "build:deps": "win-scripts bundleDeps",
35
- "dev": "win-scripts father dev"
35
+ "dev": "win-scripts father dev",
36
+ "test": "win-scripts jest-turbo"
36
37
  }
37
38
  }