storybook-builder-rsbuild 0.1.6 → 0.1.8

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/index.js CHANGED
@@ -145,6 +145,7 @@ var import_node_fs = __toESM(require("fs"));
145
145
  var import_node_path = __toESM(require("path"));
146
146
  var import_node_path2 = require("path");
147
147
  var import_core_webpack = require("@storybook/core-webpack");
148
+ var import_find_cache_dir = __toESM(require("find-cache-dir"));
148
149
 
149
150
  // ../../node_modules/.pnpm/slash@5.1.0/node_modules/slash/index.js
150
151
  function slash(path2) {
@@ -161,11 +162,13 @@ var import_ts_dedent = require("ts-dedent");
161
162
  var getVirtualModules = async (options) => {
162
163
  const virtualModules = {};
163
164
  const cwd = process.cwd();
164
- const workingDir = options.cache ? import_node_path.default.resolve(
165
- process.cwd(),
165
+ const workingDir = options.cache ? (
166
166
  // TODO: This is a hard code cache dir, as Rspack doesn't support virtual modules now.
167
167
  // Remove this when Rspack supports virtual modules.
168
- "./node_modules/.cache/storybook/storybook-rsbuild-builder"
168
+ (0, import_find_cache_dir.default)({
169
+ name: "storybook-rsbuild-builder",
170
+ create: true
171
+ })
169
172
  ) : process.cwd();
170
173
  if (!import_node_fs.default.existsSync(workingDir)) {
171
174
  import_node_fs.default.mkdirSync(workingDir, { recursive: true });
@@ -735,6 +738,7 @@ var start = async ({
735
738
  router.use(rsbuildServer.middlewares);
736
739
  rsbuildServer.connectWebSocket({ server: storybookServer });
737
740
  const stats = await waitFirstCompileDone;
741
+ await server.afterListen();
738
742
  return {
739
743
  bail,
740
744
  stats,
package/dist/index.mjs CHANGED
@@ -16,6 +16,7 @@ import { globalsNameReferenceMap } from 'storybook/internal/preview/globals';
16
16
  import { dedent } from 'ts-dedent';
17
17
  import fs from 'fs';
18
18
  import { webpackIncludeRegexp } from '@storybook/core-webpack';
19
+ import findCacheDirectory from 'find-cache-dir';
19
20
  import { readFile } from 'fs/promises';
20
21
 
21
22
  // ../../node_modules/.pnpm/pretty-hrtime@1.0.3/node_modules/pretty-hrtime/index.js
@@ -103,11 +104,13 @@ function slash(path2) {
103
104
  var getVirtualModules = async (options) => {
104
105
  const virtualModules = {};
105
106
  const cwd = process.cwd();
106
- const workingDir = options.cache ? path.resolve(
107
- process.cwd(),
107
+ const workingDir = options.cache ? (
108
108
  // TODO: This is a hard code cache dir, as Rspack doesn't support virtual modules now.
109
109
  // Remove this when Rspack supports virtual modules.
110
- "./node_modules/.cache/storybook/storybook-rsbuild-builder"
110
+ findCacheDirectory({
111
+ name: "storybook-rsbuild-builder",
112
+ create: true
113
+ })
111
114
  ) : process.cwd();
112
115
  if (!fs.existsSync(workingDir)) {
113
116
  fs.mkdirSync(workingDir, { recursive: true });
@@ -677,6 +680,7 @@ var start = async ({
677
680
  router.use(rsbuildServer.middlewares);
678
681
  rsbuildServer.connectWebSocket({ server: storybookServer });
679
682
  const stats = await waitFirstCompileDone;
683
+ await server.afterListen();
680
684
  return {
681
685
  bail,
682
686
  stats,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-builder-rsbuild",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Rsbuild builder for Storybook",
5
5
  "keywords": [
6
6
  "storybook",
@@ -57,7 +57,7 @@
57
57
  "!src/**/*"
58
58
  ],
59
59
  "dependencies": {
60
- "@rsbuild/plugin-type-check": "^1.1.0",
60
+ "@rsbuild/plugin-type-check": "^1.2.0",
61
61
  "@storybook/addon-docs": "^8.2.1",
62
62
  "@storybook/core-webpack": "^8.2.1",
63
63
  "browser-assert": "^1.2.1",
@@ -65,8 +65,9 @@
65
65
  "cjs-module-lexer": "^1.4.1",
66
66
  "constants-browserify": "^1.0.0",
67
67
  "es-module-lexer": "^1.5.4",
68
+ "find-cache-dir": "^5.0.0",
68
69
  "fs-extra": "^11.2.0",
69
- "magic-string": "^0.30.14",
70
+ "magic-string": "^0.30.17",
70
71
  "path-browserify": "^1.0.1",
71
72
  "process": "^0.11.10",
72
73
  "rsbuild-plugin-html-minifier-terser": "^1.1.1",
@@ -77,14 +78,15 @@
77
78
  "util-deprecate": "^1.0.2"
78
79
  },
79
80
  "devDependencies": {
80
- "@rsbuild/core": "^1.1.7",
81
+ "@rsbuild/core": "^1.1.13",
82
+ "@types/find-cache-dir": "^5.0.2",
81
83
  "@types/fs-extra": "^11.0.4",
82
84
  "@types/node": "^18.0.0",
83
85
  "@types/pretty-hrtime": "^1.0.3",
84
86
  "pretty-hrtime": "^1.0.3",
85
87
  "slash": "^5.1.0",
86
- "storybook": "8.5.0-alpha.15",
87
- "typescript": "^5.7.2"
88
+ "storybook": "8.5.0-beta.8",
89
+ "typescript": "^5.7.3"
88
90
  },
89
91
  "peerDependencies": {
90
92
  "@rsbuild/core": "^1.0.1",