storybook-builder-rsbuild 3.0.0-beta.2 → 3.0.0-beta.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.
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_1947c9521fb72e4e from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_1947c9521fb72e4e from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e from "node:module";
1
+ import CJS_COMPAT_NODE_URL_134f5ab7b24026fd from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_134f5ab7b24026fd from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_1947c9521fb72e4e.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_1947c9521fb72e4e.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_134f5ab7b24026fd.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_134f5ab7b24026fd.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/index.d.ts CHANGED
@@ -1,3 +1,73 @@
1
- // auto generated file from file:///Users/bytedance/Projects/storybook-rsbuild/scripts/build/utils/generate-type-mappers.ts, do not edit
2
- export * from '../src/index.ts';
3
- export type * from '../src/index.ts';
1
+ import * as rsbuildReal from '@rsbuild/core';
2
+ import { RsbuildConfig } from '@rsbuild/core';
3
+ import { Builder, TypescriptOptions as TypescriptOptions$1, Options, StorybookConfigRaw, BuilderResult as BuilderResult$1 } from 'storybook/internal/types';
4
+ import { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
5
+
6
+ type RsbuildStats = {
7
+ toJson: (...args: any[]) => any;
8
+ };
9
+ /**
10
+ * Options for TypeScript usage within Storybook.
11
+ */
12
+ interface TypescriptOptions extends TypescriptOptions$1 {
13
+ /**
14
+ * Configures `@rsbuild/plugin-type-check`, using `fork-ts-checker-webpack-plugin` under the hood.
15
+ */
16
+ checkOptions?: PluginTypeCheckerOptions;
17
+ }
18
+ type RsbuildBuilder = Builder<RsbuildConfig, RsbuildStats>;
19
+ type RsbuildFinal = (config: RsbuildConfig, options: Options) => RsbuildConfig | Promise<RsbuildConfig>;
20
+ type StorybookConfigRsbuild = {
21
+ rsbuildFinal?: RsbuildFinal;
22
+ webpackAddons?: StorybookConfigRaw['addons'];
23
+ };
24
+ type BuilderOptions = {
25
+ /**
26
+ * Path to rsbuild.config file, relative to CWD.
27
+ */
28
+ rsbuildConfigPath?: string;
29
+ /**
30
+ * Enable Rspack's lazy compilation (experimental).
31
+ */
32
+ lazyCompilation?: NonNullable<RsbuildConfig['performance']>['buildCache'];
33
+ /**
34
+ * Enable Rspack's [persistent cache(experimental)](https://rspack.dev/config/experiments#experimentscache).
35
+ * We continue to use the name `fsCache` here to maintain better compatibility with the webpack builder.
36
+ */
37
+ fsCache?: boolean;
38
+ /**
39
+ * Which environment to use from the Rsbuild config.
40
+ */
41
+ environment?: string;
42
+ /**
43
+ * @storybook/addon-docs options
44
+ */
45
+ addonDocs?: any;
46
+ };
47
+ interface BuilderResult extends BuilderResult$1 {
48
+ stats?: Stats;
49
+ }
50
+
51
+ declare const getVirtualModules: (options: Options) => Promise<{
52
+ virtualModules: Record<string, string>;
53
+ entries: string[];
54
+ }>;
55
+
56
+ type StatsOrMultiStats = Parameters<rsbuildReal.OnAfterBuildFn>[0]['stats'];
57
+ type Stats = NonNullable<Exclude<StatsOrMultiStats, {
58
+ stats: unknown[];
59
+ }>>;
60
+ declare const printDuration: (startTime: [number, number]) => string;
61
+ type BuilderStartOptions = Parameters<RsbuildBuilder['start']>['0'];
62
+ declare const executor: {
63
+ get: (options: Options) => Promise<typeof rsbuildReal>;
64
+ };
65
+ declare const getConfig: RsbuildBuilder['getConfig'];
66
+ declare function bail(): Promise<void>;
67
+ declare const start: RsbuildBuilder['start'];
68
+ declare const build: ({ options }: BuilderStartOptions) => Promise<Stats>;
69
+ declare const corePresets: string[];
70
+ declare const previewMainTemplate: () => string;
71
+
72
+ export { bail, build, corePresets, executor, getConfig, getVirtualModules, previewMainTemplate, printDuration, start };
73
+ export type { BuilderOptions, BuilderResult, RsbuildBuilder, RsbuildFinal, Stats, StorybookConfigRsbuild, TypescriptOptions };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_1947c9521fb72e4e from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_1947c9521fb72e4e from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e from "node:module";
1
+ import CJS_COMPAT_NODE_URL_134f5ab7b24026fd from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_134f5ab7b24026fd from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_1947c9521fb72e4e.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_1947c9521fb72e4e.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_134f5ab7b24026fd.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_134f5ab7b24026fd.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __require,
15
15
  __toESM
16
- } from "./_node-chunks/chunk-EVSXNGSH.js";
16
+ } from "./_node-chunks/chunk-YJZARK5B.js";
17
17
 
18
18
  // ../../node_modules/.pnpm/pretty-hrtime@1.0.3/node_modules/pretty-hrtime/index.js
19
19
  var require_pretty_hrtime = __commonJS({
@@ -1,15 +1,15 @@
1
- import CJS_COMPAT_NODE_URL_1947c9521fb72e4e from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_1947c9521fb72e4e from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e from "node:module";
1
+ import CJS_COMPAT_NODE_URL_134f5ab7b24026fd from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_134f5ab7b24026fd from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_1947c9521fb72e4e.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_1947c9521fb72e4e.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_134f5ab7b24026fd.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_134f5ab7b24026fd.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
- import "../_node-chunks/chunk-EVSXNGSH.js";
12
+ import "../_node-chunks/chunk-YJZARK5B.js";
13
13
 
14
14
  // src/loaders/export-order-loader.ts
15
15
  import assert from "node:assert";
@@ -20,7 +20,7 @@ async function loader(source, map, meta) {
20
20
  let callback = this.async();
21
21
  try {
22
22
  let magicString = new MagicString(source);
23
- if (!source.includes("__namedExportsOrder")) {
23
+ if (!source.includes("__namedExportsOrder"))
24
24
  try {
25
25
  let namedExportsOrder = ((await parseEs(source))[1] || []).map((e) => source.substring(e.s, e.e)).filter((e) => e !== "default");
26
26
  assert(
@@ -41,17 +41,7 @@ async function loader(source, map, meta) {
41
41
  `;module.exports.__namedExportsOrder = ${JSON.stringify(namedExportsOrder)};`
42
42
  );
43
43
  }
44
- return callback(
45
- null,
46
- magicString.toString(),
47
- map ?? magicString.generateMap({
48
- hires: !0,
49
- includeContent: !0,
50
- source: this.resourcePath
51
- }),
52
- meta
53
- );
54
- }
44
+ return callback(null, magicString.toString(), map, meta);
55
45
  } catch {
56
46
  return callback(null, source, map, meta);
57
47
  }
@@ -1,17 +1,17 @@
1
- import CJS_COMPAT_NODE_URL_1947c9521fb72e4e from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_1947c9521fb72e4e from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e from "node:module";
1
+ import CJS_COMPAT_NODE_URL_134f5ab7b24026fd from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_134f5ab7b24026fd from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_1947c9521fb72e4e.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_1947c9521fb72e4e.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_1947c9521fb72e4e.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_134f5ab7b24026fd.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_134f5ab7b24026fd.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_134f5ab7b24026fd.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
12
  import {
13
13
  __require
14
- } from "./_node-chunks/chunk-EVSXNGSH.js";
14
+ } from "./_node-chunks/chunk-YJZARK5B.js";
15
15
 
16
16
  // src/preview-preset.ts
17
17
  var previewMainTemplate = () => __require.resolve("storybook-builder-rsbuild/templates/preview.ejs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-builder-rsbuild",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.4",
4
4
  "description": "Rsbuild builder for Storybook",
5
5
  "keywords": [
6
6
  "storybook",
@@ -69,7 +69,6 @@
69
69
  "@types/node": "^22.0.0",
70
70
  "@types/pretty-hrtime": "^1.0.3",
71
71
  "find-cache-dir": "^5.0.0",
72
- "jiti": "^2.4.2",
73
72
  "prebundle": "^1.6.0",
74
73
  "pretty-hrtime": "^1.0.3",
75
74
  "slash": "^5.1.0",
@@ -105,7 +104,7 @@
105
104
  "platform": "node"
106
105
  },
107
106
  "scripts": {
108
- "build": "pnpm run prep",
107
+ "build": "pnpm run prep --production",
109
108
  "check": "jiti ../../scripts/check/check-package.ts",
110
109
  "prep": "prebundle && jiti ../../scripts/build/build-package.ts"
111
110
  }