@modern-js/storybook 0.0.0-next-20231016112821 → 0.0.0-next-20231024040526

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.
@@ -0,0 +1 @@
1
+ export { decorators } from '@modern-js/storybook-builder/addons';
package/dist/addons.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decorators = void 0;
4
+ var addons_1 = require("@modern-js/storybook-builder/addons");
5
+ Object.defineProperty(exports, "decorators", { enumerable: true, get: function () { return addons_1.decorators; } });
6
+ //# sourceMappingURL=addons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addons.js","sourceRoot":"","sources":["../src/addons.ts"],"names":[],"mappings":";;;AAAA,8DAAiE;AAAxD,oGAAA,UAAU,OAAA"}
package/dist/preset.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.core = exports.modern = exports.frameworkOptions = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const utils_1 = require("@modern-js/utils");
8
9
  const frameworkOptions = async (_, options) => {
9
10
  const config = await options.presets.apply('framework');
10
11
  if (typeof config === 'string') {
@@ -33,10 +34,9 @@ const modern = (config, _options) => {
33
34
  ...config,
34
35
  source: {
35
36
  ...config.source,
36
- alias: {
37
- ...config.source?.alias,
37
+ alias: (0, utils_1.applyOptionsChain)({
38
38
  '@storybook/react': absPath('@storybook/react'),
39
- },
39
+ }, config.source?.alias),
40
40
  },
41
41
  };
42
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"preset.js","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAIjB,MAAM,gBAAgB,GAAG,KAAK,EAAE,CAAQ,EAAE,OAAgB,EAAE,EAAE;IACnE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CA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IACtD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE3D,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE;YACP,IAAI,EAAE,OAAO,CAAC,8BAA8B,CAAC;YAC7C,OAAO,EACL,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;SACzE;QACD,gDAAgD;QAChD,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,IAAI,QAaf;AAEF,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/storybook",
3
- "version": "0.0.0-next-20231016112821",
3
+ "version": "0.0.0-next-20231024040526",
4
4
  "description": "modern.js support for storybook",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,17 +9,36 @@
9
9
  },
10
10
  "jsnext:source": "./src/index.ts",
11
11
  "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
12
13
  "bin": {
13
14
  "storybook": "./bin.js",
14
15
  "sb": "./bin.js"
15
16
  },
16
- "types": "./dist/index.d.ts",
17
+ "files": [
18
+ "dist",
19
+ "bin.js"
20
+ ],
21
+ "typesVersions": {
22
+ "*": {
23
+ "addons": [
24
+ "./dist/addons.d.ts"
25
+ ],
26
+ "types": [
27
+ "./dist/types.d.ts"
28
+ ]
29
+ }
30
+ },
17
31
  "exports": {
18
32
  ".": {
19
33
  "jsnext:source": "./src/index.ts",
20
34
  "types": "./dist/index.d.ts",
21
35
  "default": "./dist/index.js"
22
36
  },
37
+ "./addons": {
38
+ "jsnext:source": "./src/addons.ts",
39
+ "types": "./dist/addons.d.ts",
40
+ "default": "./dist/addons.js"
41
+ },
23
42
  "./preset": {
24
43
  "jsnext:source": "./src/preset.ts",
25
44
  "types": "./dist/preset.d.ts",
@@ -36,16 +55,16 @@
36
55
  "engines": {
37
56
  "node": ">=16.0.0"
38
57
  },
39
- "keywords": [],
40
- "author": "",
41
58
  "license": "MIT",
42
59
  "dependencies": {
43
- "@storybook/react": "^7.4.6",
44
- "storybook": "^7.4.6",
45
- "@modern-js/storybook-builder": "0.0.0-next-20231016112821"
60
+ "@storybook/react": "^7.5.1",
61
+ "storybook": "^7.5.1",
62
+ "@modern-js/storybook-builder": "0.0.0-next-20231024040526",
63
+ "@modern-js/utils": "0.0.0-next-20231024040526"
46
64
  },
47
65
  "devDependencies": {
48
- "@storybook/types": "^7.4.6",
66
+ "@storybook/types": "^7.5.1",
67
+ "typescript": "^5.2.2",
49
68
  "@types/node": "^20.5.6"
50
69
  },
51
70
  "publishConfig": {
package/.eslintrc.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- ignorePatterns: ['compiled/', 'fixtures/**', 'tests/**', 'modern.config.ts'],
4
- parserOptions: {
5
- project: require.resolve('./tsconfig.json'),
6
- },
7
- };
@@ -1,4 +0,0 @@
1
-
2
- > @modern-js/storybook@2.31.2 build /home/runner/work/modern.js/modern.js/packages/storybook/framework
3
- > tsc
4
-
package/CHANGELOG.md DELETED
@@ -1,10 +0,0 @@
1
- # @modern-js/storybook
2
-
3
- ## 0.0.0-next-20231016112821
4
-
5
- ### Patch Changes
6
-
7
- - 94139b417: feat: add storybook-framework
8
- feat: 支持 storybook-framework
9
- - Updated dependencies [94139b417]
10
- - @modern-js/storybook-builder@0.0.0-next-20231016112821
package/dist/upgrade.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Old storybook:
3
- * - `path/config/storybook` move to `path/.storybook/main.ts`
4
- * - stories folder -> configure in `.storybook/main.ts`
5
- */
6
- export declare function upgrade(cwd: string): void;
package/dist/upgrade.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.upgrade = void 0;
4
- /**
5
- * Old storybook:
6
- * - `path/config/storybook` move to `path/.storybook/main.ts`
7
- * - stories folder -> configure in `.storybook/main.ts`
8
- */
9
- function upgrade(cwd) {
10
- console.log(cwd);
11
- }
12
- exports.upgrade = upgrade;
13
- //# sourceMappingURL=upgrade.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAgB,OAAO,CAAC,GAAW;IACjC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAFD,0BAEC"}
package/preset.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./dist/preset');
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './preset';
2
- export * from './types';
package/src/preset.ts DELETED
@@ -1,63 +0,0 @@
1
- import path from 'path';
2
- import type { Options } from '@storybook/types';
3
- import type { BuilderConfig } from '@modern-js/storybook-builder/types';
4
-
5
- export const frameworkOptions = async (_: never, options: Options) => {
6
- const config = await options.presets.apply('framework');
7
-
8
- if (typeof config === 'string') {
9
- return {
10
- name: config,
11
- options: {},
12
- };
13
- }
14
- if (typeof config === 'undefined') {
15
- return {
16
- name: '@modern-js/storybook',
17
- options: {},
18
- };
19
- }
20
-
21
- return {
22
- name: config.name,
23
- options: {
24
- ...config.options,
25
- },
26
- };
27
- };
28
-
29
- export const modern = (
30
- config: BuilderConfig,
31
- _options: Options,
32
- ): BuilderConfig => {
33
- // @ts-expect-error
34
- return {
35
- ...config,
36
- source: {
37
- ...config.source,
38
- alias: {
39
- ...config.source?.alias,
40
- '@storybook/react': absPath('@storybook/react'),
41
- },
42
- },
43
- };
44
- };
45
-
46
- export const core = async (config: any, options: any) => {
47
- const framework = await options.presets.apply('framework');
48
-
49
- return {
50
- ...config,
51
- builder: {
52
- name: absPath('@modern-js/storybook-builder'),
53
- options:
54
- typeof framework === 'string' ? {} : framework?.options?.builder || {},
55
- },
56
- // FIXME: renderer: absPath('@storybook/react'),
57
- renderer: '@storybook/react',
58
- };
59
- };
60
-
61
- function absPath(pkg: string) {
62
- return path.dirname(require.resolve(path.join(pkg, 'package.json')));
63
- }
package/src/types.ts DELETED
@@ -1,21 +0,0 @@
1
- import type { StorybookConfig as StorybookConfigBase } from '@storybook/types';
2
- import type { BuilderOptions } from '@modern-js/storybook-builder';
3
-
4
- export {
5
- defineConfig,
6
- type BuilderOptions,
7
- } from '@modern-js/storybook-builder';
8
-
9
- export type FrameworkName = '@modern-js/storybook' | string;
10
-
11
- export interface StorybookConfig extends StorybookConfigBase {
12
- framework:
13
- | FrameworkName
14
- | {
15
- name: FrameworkName;
16
- options: BuilderOptions;
17
- };
18
- typescript?: {
19
- reactDocgen?: 'react-docgen' | 'react-docgen-typescript' | false;
20
- } & StorybookConfigBase['typescript'];
21
- }
package/src/upgrade.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Old storybook:
3
- * - `path/config/storybook` move to `path/.storybook/main.ts`
4
- * - stories folder -> configure in `.storybook/main.ts`
5
- */
6
- export function upgrade(cwd: string) {
7
- console.log(cwd);
8
- }
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "@modern-js/tsconfig/base",
3
- "compilerOptions": {
4
- "target": "ES2020",
5
- "declaration": true,
6
- "outDir": "dist",
7
- "isolatedModules": true,
8
- "noImplicitAny": true,
9
- "skipLibCheck": true,
10
- "sourceMap": true,
11
- "moduleResolution": "NodeNext",
12
- "module": "NodeNext",
13
- "esModuleInterop": true
14
- },
15
- "include": ["./src"]
16
- }