@storybook/core-server 6.4.0-rc.3 → 6.4.0-rc.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.
@@ -127,7 +127,8 @@ async function buildStaticStandalone(options) {
127
127
  };
128
128
  var stories = (0, _coreCommon.normalizeStories)(await presets.apply('stories'), directories);
129
129
  await (0, _storiesJson.extractStoriesJson)(_path.default.join(options.outputDir, 'stories.json'), stories, _objectSpread(_objectSpread({}, directories), {}, {
130
- storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7)
130
+ storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
131
+ storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
131
132
  }));
132
133
  }
133
134
 
@@ -47,15 +47,6 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
47
47
 
48
48
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
49
 
50
- function sortExtractedStories(stories, storySortParameter, fileNameOrder) {
51
- var sortableStories = Object.values(stories);
52
- (0, _store.sortStoriesV7)(sortableStories, storySortParameter, fileNameOrder);
53
- return sortableStories.reduce(function (acc, item) {
54
- acc[item.id] = item;
55
- return acc;
56
- }, {});
57
- }
58
-
59
50
  class StoryIndexGenerator {
60
51
  // An internal cache mapping specifiers to a set of path=><set of stories>
61
52
  // Later, we'll combine each of these subsets together to form the full index
@@ -152,8 +143,19 @@ class StoryIndexGenerator {
152
143
  storiesList.forEach(function (subStories) {
153
144
  Object.assign(stories, subStories);
154
145
  });
155
- var storySortParameter = await this.getStorySortParameter();
156
- return sortExtractedStories(stories, storySortParameter, this.storyFileNames());
146
+ var sortableStories = Object.values(stories); // Skip sorting if we're in v6 mode because we don't have
147
+ // all the info we need here
148
+
149
+ if (this.options.storyStoreV7) {
150
+ var storySortParameter = await this.getStorySortParameter();
151
+ var fileNameOrder = this.storyFileNames();
152
+ (0, _store.sortStoriesV7)(sortableStories, storySortParameter, fileNameOrder);
153
+ }
154
+
155
+ return sortableStories.reduce(function (acc, item) {
156
+ acc[item.id] = item;
157
+ return acc;
158
+ }, {});
157
159
  }
158
160
 
159
161
  async getIndex() {
@@ -42,7 +42,8 @@ async function useStoriesJson(router, serverChannel, options, workingDir = proce
42
42
  var generator = new _StoryIndexGenerator.StoryIndexGenerator(normalizedStories, {
43
43
  configDir: options.configDir,
44
44
  workingDir: workingDir,
45
- storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7)
45
+ storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
46
+ storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
46
47
  }); // Wait until someone actually requests `stories.json` before we start generating/watching.
47
48
  // This is mainly for testing purposes.
48
49
 
@@ -98,7 +98,8 @@ export async function buildStaticStandalone(options) {
98
98
  };
99
99
  var stories = normalizeStories(await presets.apply('stories'), directories);
100
100
  await extractStoriesJson(path.join(options.outputDir, 'stories.json'), stories, _objectSpread(_objectSpread({}, directories), {}, {
101
- storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7)
101
+ storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
102
+ storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
102
103
  }));
103
104
  }
104
105
 
@@ -27,16 +27,6 @@ import slash from 'slash';
27
27
  import { autoTitleFromSpecifier, sortStoriesV7 } from '@storybook/store';
28
28
  import { logger } from '@storybook/node-logger';
29
29
  import { readCsfOrMdx, getStorySortParameter } from '@storybook/csf-tools';
30
-
31
- function sortExtractedStories(stories, storySortParameter, fileNameOrder) {
32
- var sortableStories = Object.values(stories);
33
- sortStoriesV7(sortableStories, storySortParameter, fileNameOrder);
34
- return sortableStories.reduce(function (acc, item) {
35
- acc[item.id] = item;
36
- return acc;
37
- }, {});
38
- }
39
-
40
30
  export class StoryIndexGenerator {
41
31
  // An internal cache mapping specifiers to a set of path=><set of stories>
42
32
  // Later, we'll combine each of these subsets together to form the full index
@@ -129,8 +119,19 @@ export class StoryIndexGenerator {
129
119
  storiesList.forEach(function (subStories) {
130
120
  Object.assign(stories, subStories);
131
121
  });
132
- var storySortParameter = await this.getStorySortParameter();
133
- return sortExtractedStories(stories, storySortParameter, this.storyFileNames());
122
+ var sortableStories = Object.values(stories); // Skip sorting if we're in v6 mode because we don't have
123
+ // all the info we need here
124
+
125
+ if (this.options.storyStoreV7) {
126
+ var storySortParameter = await this.getStorySortParameter();
127
+ var fileNameOrder = this.storyFileNames();
128
+ sortStoriesV7(sortableStories, storySortParameter, fileNameOrder);
129
+ }
130
+
131
+ return sortableStories.reduce(function (acc, item) {
132
+ acc[item.id] = item;
133
+ return acc;
134
+ }, {});
134
135
  }
135
136
 
136
137
  async getIndex() {
@@ -21,7 +21,8 @@ export async function useStoriesJson(router, serverChannel, options, workingDir
21
21
  var generator = new StoryIndexGenerator(normalizedStories, {
22
22
  configDir: options.configDir,
23
23
  workingDir: workingDir,
24
- storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7)
24
+ storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
25
+ storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
25
26
  }); // Wait until someone actually requests `stories.json` before we start generating/watching.
26
27
  // This is mainly for testing purposes.
27
28
 
@@ -98,7 +98,8 @@ export async function buildStaticStandalone(options) {
98
98
  };
99
99
  var stories = normalizeStories(await presets.apply('stories'), directories);
100
100
  await extractStoriesJson(path.join(options.outputDir, 'stories.json'), stories, _objectSpread(_objectSpread({}, directories), {}, {
101
- storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7)
101
+ storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
102
+ storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
102
103
  }));
103
104
  }
104
105
 
@@ -27,16 +27,6 @@ import slash from 'slash';
27
27
  import { autoTitleFromSpecifier, sortStoriesV7 } from '@storybook/store';
28
28
  import { logger } from '@storybook/node-logger';
29
29
  import { readCsfOrMdx, getStorySortParameter } from '@storybook/csf-tools';
30
-
31
- function sortExtractedStories(stories, storySortParameter, fileNameOrder) {
32
- var sortableStories = Object.values(stories);
33
- sortStoriesV7(sortableStories, storySortParameter, fileNameOrder);
34
- return sortableStories.reduce(function (acc, item) {
35
- acc[item.id] = item;
36
- return acc;
37
- }, {});
38
- }
39
-
40
30
  export class StoryIndexGenerator {
41
31
  // An internal cache mapping specifiers to a set of path=><set of stories>
42
32
  // Later, we'll combine each of these subsets together to form the full index
@@ -129,8 +119,19 @@ export class StoryIndexGenerator {
129
119
  storiesList.forEach(function (subStories) {
130
120
  Object.assign(stories, subStories);
131
121
  });
132
- var storySortParameter = await this.getStorySortParameter();
133
- return sortExtractedStories(stories, storySortParameter, this.storyFileNames());
122
+ var sortableStories = Object.values(stories); // Skip sorting if we're in v6 mode because we don't have
123
+ // all the info we need here
124
+
125
+ if (this.options.storyStoreV7) {
126
+ var storySortParameter = await this.getStorySortParameter();
127
+ var fileNameOrder = this.storyFileNames();
128
+ sortStoriesV7(sortableStories, storySortParameter, fileNameOrder);
129
+ }
130
+
131
+ return sortableStories.reduce(function (acc, item) {
132
+ acc[item.id] = item;
133
+ return acc;
134
+ }, {});
134
135
  }
135
136
 
136
137
  async getIndex() {
@@ -21,7 +21,8 @@ export async function useStoriesJson(router, serverChannel, options, workingDir
21
21
  var generator = new StoryIndexGenerator(normalizedStories, {
22
22
  configDir: options.configDir,
23
23
  workingDir: workingDir,
24
- storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7)
24
+ storiesV2Compatibility: !(features !== null && features !== void 0 && features.breakingChangesV7) && !(features !== null && features !== void 0 && features.storyStoreV7),
25
+ storyStoreV7: features === null || features === void 0 ? void 0 : features.storyStoreV7
25
26
  }); // Wait until someone actually requests `stories.json` before we start generating/watching.
26
27
  // This is mainly for testing purposes.
27
28
 
@@ -6,6 +6,7 @@ export declare class StoryIndexGenerator {
6
6
  workingDir: Path;
7
7
  configDir: Path;
8
8
  storiesV2Compatibility: boolean;
9
+ storyStoreV7: boolean;
9
10
  };
10
11
  private storyIndexEntries;
11
12
  private lastIndex?;
@@ -13,6 +14,7 @@ export declare class StoryIndexGenerator {
13
14
  workingDir: Path;
14
15
  configDir: Path;
15
16
  storiesV2Compatibility: boolean;
17
+ storyStoreV7: boolean;
16
18
  });
17
19
  initialize(): Promise<void>;
18
20
  ensureExtracted(): Promise<StoryIndex['stories'][]>;
@@ -6,5 +6,6 @@ export declare function extractStoriesJson(outputFile: string, normalizedStories
6
6
  configDir: string;
7
7
  workingDir: string;
8
8
  storiesV2Compatibility: boolean;
9
+ storyStoreV7: boolean;
9
10
  }): Promise<void>;
10
11
  export declare function useStoriesJson(router: Router, serverChannel: ServerChannel, options: Options, workingDir?: string): Promise<void>;
@@ -6,6 +6,7 @@ export declare class StoryIndexGenerator {
6
6
  workingDir: Path;
7
7
  configDir: Path;
8
8
  storiesV2Compatibility: boolean;
9
+ storyStoreV7: boolean;
9
10
  };
10
11
  private storyIndexEntries;
11
12
  private lastIndex?;
@@ -13,6 +14,7 @@ export declare class StoryIndexGenerator {
13
14
  workingDir: Path;
14
15
  configDir: Path;
15
16
  storiesV2Compatibility: boolean;
17
+ storyStoreV7: boolean;
16
18
  });
17
19
  initialize(): Promise<void>;
18
20
  ensureExtracted(): Promise<StoryIndex['stories'][]>;
@@ -6,5 +6,6 @@ export declare function extractStoriesJson(outputFile: string, normalizedStories
6
6
  configDir: string;
7
7
  workingDir: string;
8
8
  storiesV2Compatibility: boolean;
9
+ storyStoreV7: boolean;
9
10
  }): Promise<void>;
10
11
  export declare function useStoriesJson(router: Router, serverChannel: ServerChannel, options: Options, workingDir?: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/core-server",
3
- "version": "6.4.0-rc.3",
3
+ "version": "6.4.0-rc.4",
4
4
  "description": "Storybook framework-agnostic API",
5
5
  "keywords": [
6
6
  "storybook"
@@ -41,16 +41,16 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@discoveryjs/json-ext": "^0.5.3",
44
- "@storybook/builder-webpack4": "6.4.0-rc.3",
45
- "@storybook/core-client": "6.4.0-rc.3",
46
- "@storybook/core-common": "6.4.0-rc.3",
47
- "@storybook/core-events": "6.4.0-rc.3",
44
+ "@storybook/builder-webpack4": "6.4.0-rc.4",
45
+ "@storybook/core-client": "6.4.0-rc.4",
46
+ "@storybook/core-common": "6.4.0-rc.4",
47
+ "@storybook/core-events": "6.4.0-rc.4",
48
48
  "@storybook/csf": "0.0.2--canary.87bc651.0",
49
- "@storybook/csf-tools": "6.4.0-rc.3",
50
- "@storybook/manager-webpack4": "6.4.0-rc.3",
51
- "@storybook/node-logger": "6.4.0-rc.3",
49
+ "@storybook/csf-tools": "6.4.0-rc.4",
50
+ "@storybook/manager-webpack4": "6.4.0-rc.4",
51
+ "@storybook/node-logger": "6.4.0-rc.4",
52
52
  "@storybook/semver": "^7.3.2",
53
- "@storybook/store": "6.4.0-rc.3",
53
+ "@storybook/store": "6.4.0-rc.4",
54
54
  "@types/node": "^14.0.10",
55
55
  "@types/node-fetch": "^2.5.7",
56
56
  "@types/pretty-hrtime": "^1.0.0",
@@ -84,7 +84,7 @@
84
84
  "ws": "^8.2.3"
85
85
  },
86
86
  "devDependencies": {
87
- "@storybook/builder-webpack5": "6.4.0-rc.3",
87
+ "@storybook/builder-webpack5": "6.4.0-rc.4",
88
88
  "@types/compression": "^1.7.0",
89
89
  "@types/ip": "^1.1.0",
90
90
  "@types/serve-favicon": "^2.5.2",
@@ -92,8 +92,8 @@
92
92
  "jest-specific-snapshot": "^4.0.0"
93
93
  },
94
94
  "peerDependencies": {
95
- "@storybook/builder-webpack5": "6.4.0-rc.3",
96
- "@storybook/manager-webpack5": "6.4.0-rc.3",
95
+ "@storybook/builder-webpack5": "6.4.0-rc.4",
96
+ "@storybook/manager-webpack5": "6.4.0-rc.4",
97
97
  "react": "^16.8.0 || ^17.0.0",
98
98
  "react-dom": "^16.8.0 || ^17.0.0"
99
99
  },
@@ -111,6 +111,6 @@
111
111
  "publishConfig": {
112
112
  "access": "public"
113
113
  },
114
- "gitHead": "f23a6daa88a2f051e2a94d803431ab3b3d11e26b",
114
+ "gitHead": "43653ad69c8c10840e3f35a831ed8bd36b9c90dd",
115
115
  "sbmodern": "dist/modern/index.js"
116
116
  }