storybook-builder-rsbuild 3.6.0 → 3.6.2
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/compiled/@storybook/core-webpack/package.json +1 -1
- package/dist/index.js +19 -13
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@storybook/core-webpack","version":"10.6.
|
|
1
|
+
{"name":"@storybook/core-webpack","version":"10.6.5","funding":{"type":"opencollective","url":"https://opencollective.com/storybook"},"license":"MIT","types":"index.d.ts","type":"module"}
|
package/dist/index.js
CHANGED
|
@@ -344,6 +344,7 @@ const withStatsJsonCompat = (stats)=>{
|
|
|
344
344
|
return stats;
|
|
345
345
|
};
|
|
346
346
|
const PLUGIN_NAME = 'RspackInjectMockerRuntimePlugin';
|
|
347
|
+
const RUNTIME_ASSET_NAME = 'mocker-runtime-injected.js';
|
|
347
348
|
class RspackInjectMockerRuntimePlugin {
|
|
348
349
|
cachedRuntime = null;
|
|
349
350
|
getHtmlPlugin(compiler) {
|
|
@@ -362,19 +363,20 @@ class RspackInjectMockerRuntimePlugin {
|
|
|
362
363
|
const HtmlPlugin = this.getHtmlPlugin(compiler);
|
|
363
364
|
const getHtmlHooks = HtmlPlugin?.getCompilationHooks ?? HtmlPlugin?.getHooks;
|
|
364
365
|
if ('function' != typeof getHtmlHooks) return void compiler.getInfrastructureLogger(PLUGIN_NAME).warn('HTML plugin is not available. Cannot inject mocker runtime.');
|
|
366
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
367
|
+
compilation.hooks.processAssets.tap({
|
|
368
|
+
name: PLUGIN_NAME,
|
|
369
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
370
|
+
}, ()=>{
|
|
371
|
+
if (compilation.getAsset(RUNTIME_ASSET_NAME)) return;
|
|
372
|
+
const runtimeScriptContent = this.cachedRuntime ?? (this.cachedRuntime = getMockerRuntime());
|
|
373
|
+
compilation.emitAsset(RUNTIME_ASSET_NAME, new compiler.webpack.sources.RawSource(runtimeScriptContent));
|
|
374
|
+
});
|
|
375
|
+
});
|
|
365
376
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
366
377
|
getHtmlHooks(compilation).beforeAssetTagGeneration.tapAsync(PLUGIN_NAME, (data, cb)=>{
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const runtimeAssetName = 'mocker-runtime-injected.js';
|
|
370
|
-
const Sources = compiler.webpack?.sources;
|
|
371
|
-
if (!Sources?.RawSource) throw new Error('rspack sources is not available on compiler.webpack');
|
|
372
|
-
if (!compilation.getAsset(runtimeAssetName)) compilation.emitAsset(runtimeAssetName, new Sources.RawSource(runtimeScriptContent));
|
|
373
|
-
data.assets.js.unshift(runtimeAssetName);
|
|
374
|
-
cb(null, data);
|
|
375
|
-
} catch (error) {
|
|
376
|
-
cb(error);
|
|
377
|
-
}
|
|
378
|
+
data.assets.js.unshift(RUNTIME_ASSET_NAME);
|
|
379
|
+
cb(null, data);
|
|
378
380
|
});
|
|
379
381
|
});
|
|
380
382
|
}
|
|
@@ -941,7 +943,7 @@ const iframe_rsbuild_config = async (options, extraWebpackConfig)=>{
|
|
|
941
943
|
const { outputDir = join('.', 'public'), quiet, packageJson, configType, presets, previewUrl, typescriptOptions, features } = options;
|
|
942
944
|
const isProd = 'PRODUCTION' === configType;
|
|
943
945
|
const workingDir = process.cwd();
|
|
944
|
-
const [coreOptions, frameworkOptions, envs, logLevel, headHtmlSnippet, bodyHtmlSnippet, template, docsOptions, entries, nonNormalizedStories, build, tagsOptions, htmlLang] = await Promise.all([
|
|
946
|
+
const [coreOptions, frameworkOptions, envs, logLevel, headHtmlSnippet, bodyHtmlSnippet, template, docsOptions, entries, nonNormalizedStories, build, tagsOptions, security, htmlLang] = await Promise.all([
|
|
945
947
|
presets.apply('core'),
|
|
946
948
|
presets.apply('frameworkOptions'),
|
|
947
949
|
presets.apply('env'),
|
|
@@ -954,6 +956,7 @@ const iframe_rsbuild_config = async (options, extraWebpackConfig)=>{
|
|
|
954
956
|
presets.apply('stories', []),
|
|
955
957
|
options.presets.apply('build'),
|
|
956
958
|
presets.apply('tags', {}),
|
|
959
|
+
presets.apply('security'),
|
|
957
960
|
presets.apply('htmlLang', 'en')
|
|
958
961
|
]);
|
|
959
962
|
const stories = normalizeStories(nonNormalizedStories, {
|
|
@@ -1203,6 +1206,9 @@ const iframe_rsbuild_config = async (options, extraWebpackConfig)=>{
|
|
|
1203
1206
|
TAGS_OPTIONS: tagsOptions,
|
|
1204
1207
|
...build?.test?.disableBlocks ? {
|
|
1205
1208
|
__STORYBOOK_BLOCKS_EMPTY_MODULE__: {}
|
|
1209
|
+
} : {},
|
|
1210
|
+
...security?.insecureIframeMessaging ? {
|
|
1211
|
+
INSECURE_IFRAME_MESSAGING: true
|
|
1206
1212
|
} : {}
|
|
1207
1213
|
},
|
|
1208
1214
|
htmlLang,
|
|
@@ -1376,7 +1382,7 @@ const start = async ({ startTime, options, router, server: storybookServer, chan
|
|
|
1376
1382
|
if (storybookServer.listening) runAfterListen();
|
|
1377
1383
|
else storybookServer.once('listening', runAfterListen);
|
|
1378
1384
|
return {
|
|
1379
|
-
bail
|
|
1385
|
+
bail,
|
|
1380
1386
|
totalTime: process.hrtime(startTime)
|
|
1381
1387
|
};
|
|
1382
1388
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-builder-rsbuild",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "Rsbuild builder for Storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"!src/**/*"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@rsbuild/plugin-type-check": "^1.6.
|
|
47
|
+
"@rsbuild/plugin-type-check": "^1.6.1",
|
|
48
48
|
"browser-assert": "^1.2.1",
|
|
49
49
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
50
|
-
"cjs-module-lexer": "^2.
|
|
50
|
+
"cjs-module-lexer": "^2.3.0",
|
|
51
51
|
"constants-browserify": "^1.0.0",
|
|
52
52
|
"es-module-lexer": "^1.7.0",
|
|
53
|
-
"fs-extra": "^11.4.
|
|
54
|
-
"magic-string": "^1.4.
|
|
53
|
+
"fs-extra": "^11.4.1",
|
|
54
|
+
"magic-string": "^1.4.5",
|
|
55
55
|
"path-browserify": "^1.0.1",
|
|
56
56
|
"pathe": "^2.0.3",
|
|
57
57
|
"picocolors": "^1.1.1",
|
|
@@ -64,23 +64,23 @@
|
|
|
64
64
|
"util-deprecate": "^1.0.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@microsoft/api-extractor": "^7.
|
|
68
|
-
"@rsbuild/core": "^2.2.
|
|
69
|
-
"@storybook/core-webpack": "10.6.
|
|
67
|
+
"@microsoft/api-extractor": "^7.60.1",
|
|
68
|
+
"@rsbuild/core": "^2.2.14",
|
|
69
|
+
"@storybook/core-webpack": "10.6.5",
|
|
70
70
|
"@types/fs-extra": "^11.0.4",
|
|
71
71
|
"@types/node": "^22.0.0",
|
|
72
72
|
"@types/pretty-hrtime": "^1.0.3",
|
|
73
73
|
"prebundle": "^1.6.5",
|
|
74
74
|
"pretty-hrtime": "^1.0.3",
|
|
75
75
|
"slash": "^5.1.0",
|
|
76
|
-
"storybook": "10.6.
|
|
76
|
+
"storybook": "10.6.5",
|
|
77
77
|
"typescript": "^5.9.3"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@rsbuild/core": "^1.5.0 || ^2.0.0-0",
|
|
81
81
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
82
82
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
83
|
-
"storybook": "^10.6.
|
|
83
|
+
"storybook": "^10.6.5"
|
|
84
84
|
},
|
|
85
85
|
"peerDependenciesMeta": {
|
|
86
86
|
"react": {
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"platform": "node"
|
|
108
108
|
},
|
|
109
109
|
"scripts": {
|
|
110
|
-
"build": "prebundle &&
|
|
111
|
-
"dev": "prebundle &&
|
|
110
|
+
"build": "prebundle && rs lib",
|
|
111
|
+
"dev": "prebundle && rs lib --watch"
|
|
112
112
|
}
|
|
113
113
|
}
|