storybook-builder-rsbuild 0.0.3 → 0.0.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.
- package/dist/index.d.ts +12 -2
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
import * as rsbuildReal from '@rsbuild/core';
|
2
2
|
import { RsbuildConfig } from '@rsbuild/core';
|
3
|
-
import { Builder, Options, NormalizedStoriesSpecifier } from '@storybook/types';
|
3
|
+
import { TypescriptOptions as TypescriptOptions$1, Builder, Options, NormalizedStoriesSpecifier } from '@storybook/types';
|
4
|
+
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
4
5
|
|
5
6
|
type RsbuildStats = {
|
6
7
|
toJson: () => any;
|
7
8
|
};
|
9
|
+
/**
|
10
|
+
* Options for TypeScript usage within Storybook.
|
11
|
+
*/
|
12
|
+
interface TypescriptOptions extends TypescriptOptions$1 {
|
13
|
+
/**
|
14
|
+
* Configures `fork-ts-checker-webpack-plugin`
|
15
|
+
*/
|
16
|
+
checkOptions?: ConstructorParameters<typeof ForkTsCheckerWebpackPlugin>[0];
|
17
|
+
}
|
8
18
|
type RsbuildBuilder = Builder<RsbuildConfig, RsbuildStats>;
|
9
19
|
type RsbuildFinal = (config: RsbuildConfig, options: Options) => RsbuildConfig | Promise<RsbuildConfig>;
|
10
20
|
type StorybookConfigRsbuild = {
|
@@ -41,4 +51,4 @@ declare const build: ({ options }: BuilderStartOptions) => Promise<void>;
|
|
41
51
|
declare const corePresets: string[];
|
42
52
|
declare const previewMainTemplate: () => string;
|
43
53
|
|
44
|
-
export { BuilderOptions, RsbuildBuilder, RsbuildFinal, StorybookConfigRsbuild, bail, build, corePresets, executor, getConfig, getVirtualModules, importPipeline, previewMainTemplate, printDuration, rsbuild, start, toImportFn, toImportFnPart };
|
54
|
+
export { BuilderOptions, RsbuildBuilder, RsbuildFinal, StorybookConfigRsbuild, TypescriptOptions, bail, build, corePresets, executor, getConfig, getVirtualModules, importPipeline, previewMainTemplate, printDuration, rsbuild, start, toImportFn, toImportFnPart };
|
package/dist/index.js
CHANGED
@@ -272,6 +272,7 @@ function importPipeline() {
|
|
272
272
|
// src/preview/iframe-rsbuild.config.ts
|
273
273
|
var import_core = require("@rsbuild/core");
|
274
274
|
var import_preset = require("@storybook/addon-docs/dist/preset");
|
275
|
+
var import_fork_ts_checker_webpack_plugin = __toESM(require("fork-ts-checker-webpack-plugin"));
|
275
276
|
var getAbsolutePath = (input) => (0, import_path3.dirname)(require.resolve((0, import_path3.join)(input, "package.json")));
|
276
277
|
var maybeGetAbsolutePath = (input) => {
|
277
278
|
try {
|
@@ -303,7 +304,7 @@ var iframe_rsbuild_config_default = async (options) => {
|
|
303
304
|
configType,
|
304
305
|
presets,
|
305
306
|
previewUrl,
|
306
|
-
|
307
|
+
typescriptOptions,
|
307
308
|
features
|
308
309
|
} = options;
|
309
310
|
const isProd = configType === "PRODUCTION";
|
@@ -343,6 +344,8 @@ var iframe_rsbuild_config_default = async (options) => {
|
|
343
344
|
configDir: options.configDir,
|
344
345
|
workingDir
|
345
346
|
});
|
347
|
+
const shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipCompiler;
|
348
|
+
const tsCheckOptions = typescriptOptions.checkOptions || {};
|
346
349
|
if (!template) {
|
347
350
|
throw new Error(import_ts_dedent2.dedent`
|
348
351
|
Storybook's Webpack5 builder requires a template to be specified.
|
@@ -454,7 +457,8 @@ var iframe_rsbuild_config_default = async (options) => {
|
|
454
457
|
new rspack.ProvidePlugin({
|
455
458
|
process: require.resolve("process/browser.js")
|
456
459
|
}),
|
457
|
-
new import_case_sensitive_paths_webpack_plugin.default()
|
460
|
+
new import_case_sensitive_paths_webpack_plugin.default(),
|
461
|
+
shouldCheckTs ? new import_fork_ts_checker_webpack_plugin.default(tsCheckOptions) : null
|
458
462
|
].filter(Boolean)
|
459
463
|
);
|
460
464
|
return mergeConfig(config, appliedDocsWebpack);
|
package/dist/index.mjs
CHANGED
@@ -12,6 +12,7 @@ import { dedent } from 'ts-dedent';
|
|
12
12
|
import fs from 'fs';
|
13
13
|
import { webpackIncludeRegexp } from '@storybook/core-webpack';
|
14
14
|
import { webpack } from '@storybook/addon-docs/dist/preset';
|
15
|
+
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
15
16
|
|
16
17
|
// ../../node_modules/.pnpm/pretty-hrtime@1.0.3/node_modules/pretty-hrtime/index.js
|
17
18
|
var require_pretty_hrtime = __commonJS({
|
@@ -242,7 +243,7 @@ var iframe_rsbuild_config_default = async (options) => {
|
|
242
243
|
configType,
|
243
244
|
presets,
|
244
245
|
previewUrl,
|
245
|
-
|
246
|
+
typescriptOptions,
|
246
247
|
features
|
247
248
|
} = options;
|
248
249
|
const isProd = configType === "PRODUCTION";
|
@@ -282,6 +283,8 @@ var iframe_rsbuild_config_default = async (options) => {
|
|
282
283
|
configDir: options.configDir,
|
283
284
|
workingDir
|
284
285
|
});
|
286
|
+
const shouldCheckTs = typescriptOptions.check && !typescriptOptions.skipCompiler;
|
287
|
+
const tsCheckOptions = typescriptOptions.checkOptions || {};
|
285
288
|
if (!template) {
|
286
289
|
throw new Error(dedent`
|
287
290
|
Storybook's Webpack5 builder requires a template to be specified.
|
@@ -395,7 +398,8 @@ var iframe_rsbuild_config_default = async (options) => {
|
|
395
398
|
new rspack.ProvidePlugin({
|
396
399
|
process: __require.resolve("process/browser.js")
|
397
400
|
}),
|
398
|
-
new CaseSensitivePathsPlugin()
|
401
|
+
new CaseSensitivePathsPlugin(),
|
402
|
+
shouldCheckTs ? new ForkTsCheckerWebpackPlugin(tsCheckOptions) : null
|
399
403
|
].filter(Boolean)
|
400
404
|
);
|
401
405
|
return mergeConfig(config, appliedDocsWebpack);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "storybook-builder-rsbuild",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.4",
|
4
4
|
"description": "Rsbuild builder for Storybook",
|
5
5
|
"keywords": [
|
6
6
|
"storybook",
|
@@ -74,6 +74,7 @@
|
|
74
74
|
"css-loader": "^6.7.1",
|
75
75
|
"es-module-lexer": "^1.5.0",
|
76
76
|
"express": "^4.17.3",
|
77
|
+
"fork-ts-checker-webpack-plugin": "^8.0.0",
|
77
78
|
"fs-extra": "^11.1.0",
|
78
79
|
"magic-string": "^0.30.5",
|
79
80
|
"path-browserify": "^1.0.1",
|