storybook-addon-modernjs 2.1.6 → 3.0.0-beta.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/dist/index.d.ts +3 -9
- package/dist/index.js +10 -17
- package/dist/preset.js +49 -82
- package/package.json +11 -12
- package/preset.js +1 -1
- package/dist/index.mjs +0 -1
- package/dist/preset.d.ts +0 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @default "modern.config.ts"
|
|
5
|
-
*/
|
|
6
|
-
configPath?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { AddonOptions };
|
|
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';
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
import CJS_COMPAT_NODE_URL_6843cb1ad00e6c48 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_6843cb1ad00e6c48 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_6843cb1ad00e6c48 from "node:module";
|
|
15
4
|
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_6843cb1ad00e6c48.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_6843cb1ad00e6c48.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_6843cb1ad00e6c48.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
package/dist/preset.js
CHANGED
|
@@ -1,105 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
import CJS_COMPAT_NODE_URL_6843cb1ad00e6c48 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_6843cb1ad00e6c48 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_6843cb1ad00e6c48 from "node:module";
|
|
29
4
|
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_6843cb1ad00e6c48.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_6843cb1ad00e6c48.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_6843cb1ad00e6c48.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
var __require = /* @__PURE__ */ ((x) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(x, {
|
|
13
|
+
get: (a, b) => (typeof require < "u" ? require : a)[b]
|
|
14
|
+
}) : x)(function(x) {
|
|
15
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
16
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
34
17
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const projectVersion = await getVersion(process.cwd());
|
|
54
|
-
const recommandVersion = await getVersion(
|
|
55
|
-
require.resolve("@modern-js/app-tools")
|
|
56
|
-
);
|
|
57
|
-
const installedVersion = await getVersion(require.resolve("@rsbuild/core"));
|
|
18
|
+
|
|
19
|
+
// src/preset.ts
|
|
20
|
+
import {
|
|
21
|
+
builderPluginAdapterBasic,
|
|
22
|
+
builderPluginAdapterHooks,
|
|
23
|
+
parseRspackConfig as parseToRsbuildConfig
|
|
24
|
+
} from "@modern-js/app-tools/builder";
|
|
25
|
+
import { createStorybookOptions } from "@modern-js/plugin-v2/cli";
|
|
26
|
+
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
27
|
+
import findUp from "find-up";
|
|
28
|
+
import { logger } from "rslog";
|
|
29
|
+
var MODERN_META_NAME = "modern-js", MODERN_CONFIG_FILE = "modern.config.ts", PKG_NAME = "@rsbuild/core", getVersion = async (cwd) => {
|
|
30
|
+
let pkgPath = await findUp("package.json", { cwd }), pkg = __require(pkgPath);
|
|
31
|
+
return pkg.name === PKG_NAME ? pkg.version : pkg.dependencies[PKG_NAME] || pkg.devDependencies[PKG_NAME];
|
|
32
|
+
}, checkDependency = async () => {
|
|
33
|
+
let projectVersion = await getVersion(process.cwd()), recommandVersion = await getVersion(
|
|
34
|
+
__require.resolve("@modern-js/app-tools")
|
|
35
|
+
), installedVersion = await getVersion(__require.resolve("@rsbuild/core"));
|
|
58
36
|
if (!projectVersion) {
|
|
59
|
-
|
|
37
|
+
logger.error(
|
|
60
38
|
`Missing required dependency @rsbuild/core, please install @rsbuild/core@${recommandVersion}`
|
|
61
39
|
);
|
|
62
40
|
return;
|
|
63
41
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
var rsbuildFinal = async (config, options) => {
|
|
42
|
+
recommandVersion !== installedVersion && logger.warn(
|
|
43
|
+
`@rsbuild/core version mismatch: expected ${recommandVersion}, got ${installedVersion}. Please install @rsbuild/core@${recommandVersion}`
|
|
44
|
+
);
|
|
45
|
+
}, rsbuildFinal = async (config, options) => {
|
|
71
46
|
await checkDependency();
|
|
72
|
-
|
|
73
|
-
const { config: resolveConfig, getAppContext } = await (0, import_cli.createStorybookOptions)({
|
|
47
|
+
let cwd = process.cwd(), { config: resolveConfig, getAppContext } = await createStorybookOptions({
|
|
74
48
|
cwd,
|
|
75
49
|
configFile: options.configPath || MODERN_CONFIG_FILE,
|
|
76
50
|
metaName: MODERN_META_NAME
|
|
77
|
-
})
|
|
78
|
-
const nonStandardConfig = {
|
|
51
|
+
}), nonStandardConfig = {
|
|
79
52
|
...resolveConfig,
|
|
80
53
|
plugins: [resolveConfig.builderPlugins]
|
|
81
|
-
}
|
|
82
|
-
const { rsbuildConfig, rsbuildPlugins } = await (0, import_builder.parseRspackConfig)(
|
|
54
|
+
}, { rsbuildConfig, rsbuildPlugins } = await parseToRsbuildConfig(
|
|
83
55
|
nonStandardConfig,
|
|
84
56
|
{
|
|
85
57
|
cwd
|
|
86
58
|
}
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
const adapterParams = {
|
|
90
|
-
appContext,
|
|
59
|
+
), adapterParams = {
|
|
60
|
+
appContext: getAppContext(),
|
|
91
61
|
normalizedConfig: resolveConfig
|
|
92
62
|
};
|
|
93
|
-
rsbuildConfig.plugins = [
|
|
63
|
+
return rsbuildConfig.plugins = [
|
|
94
64
|
...rsbuildPlugins,
|
|
95
65
|
...rsbuildConfig.plugins || [],
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
];
|
|
99
|
-
const finalConfig = (0, import_core.mergeRsbuildConfig)(config, rsbuildConfig);
|
|
100
|
-
return finalConfig;
|
|
66
|
+
builderPluginAdapterBasic(adapterParams),
|
|
67
|
+
builderPluginAdapterHooks(adapterParams)
|
|
68
|
+
], mergeRsbuildConfig(config, rsbuildConfig);
|
|
101
69
|
};
|
|
102
|
-
|
|
103
|
-
0 && (module.exports = {
|
|
70
|
+
export {
|
|
104
71
|
rsbuildFinal
|
|
105
|
-
}
|
|
72
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook-addon-modernjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "Storybook addon for loading configuration of Modern.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -19,15 +19,14 @@
|
|
|
19
19
|
"directory": "packages/addon-modernjs"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"type": "module",
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
"require": "./dist/index.js",
|
|
27
|
-
"import": "./dist/index.mjs"
|
|
26
|
+
"default": "./dist/index.js"
|
|
28
27
|
},
|
|
29
|
-
"./
|
|
30
|
-
"./
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
"./preset": "./dist/preset.js"
|
|
31
30
|
},
|
|
32
31
|
"main": "dist/index.js",
|
|
33
32
|
"types": "dist/index.d.ts",
|
|
@@ -46,10 +45,10 @@
|
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@modern-js/app-tools": "^2.68.18",
|
|
48
47
|
"@rsbuild/core": "^1.5.17",
|
|
49
|
-
"@types/node": "^
|
|
50
|
-
"storybook": "
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"storybook": "10.0.7",
|
|
51
50
|
"typescript": "^5.9.3",
|
|
52
|
-
"storybook-builder-rsbuild": "
|
|
51
|
+
"storybook-builder-rsbuild": "3.0.0-beta.2"
|
|
53
52
|
},
|
|
54
53
|
"peerDependencies": {
|
|
55
54
|
"@modern-js/app-tools": "^2.67.9",
|
|
@@ -72,8 +71,8 @@
|
|
|
72
71
|
"platform": "node"
|
|
73
72
|
},
|
|
74
73
|
"scripts": {
|
|
75
|
-
"build": "pnpm run prep
|
|
76
|
-
"check": "jiti ../../scripts/
|
|
77
|
-
"prep": "jiti ../../scripts/
|
|
74
|
+
"build": "pnpm run prep",
|
|
75
|
+
"check": "jiti ../../scripts/check/check-package.ts",
|
|
76
|
+
"prep": "jiti ../../scripts/build/build-package.ts"
|
|
78
77
|
}
|
|
79
78
|
}
|
package/preset.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './dist/preset.js'
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/dist/preset.d.ts
DELETED