storybook-builder-rsbuild 0.1.6 → 0.1.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/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 });
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 });
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.7",
4
4
  "description": "Rsbuild builder for Storybook",
5
5
  "keywords": [
6
6
  "storybook",
@@ -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,13 +78,14 @@
77
78
  "util-deprecate": "^1.0.2"
78
79
  },
79
80
  "devDependencies": {
80
- "@rsbuild/core": "^1.1.7",
81
+ "@rsbuild/core": "^1.1.12",
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",
88
+ "storybook": "8.5.0-alpha.22",
87
89
  "typescript": "^5.7.2"
88
90
  },
89
91
  "peerDependencies": {