@storybook/core-server 7.0.0-alpha.51 → 7.0.0-alpha.52

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.
@@ -13,6 +13,7 @@ var _coreCommon = require("@storybook/core-common");
13
13
  var _nodeLogger = require("@storybook/node-logger");
14
14
  var _csfTools = require("@storybook/csf-tools");
15
15
  var _csf = require("@storybook/csf");
16
+ var _docsMdx = require("@storybook/docs-mdx");
16
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
19
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -231,18 +232,8 @@ class StoryIndexGenerator {
231
232
  }
232
233
  var normalizedPath = (0, _coreCommon.normalizeStoryPath)(relativePath);
233
234
  var importPath = (0, _slash.default)(normalizedPath);
234
-
235
- // This `await require(...)` is a bit of a hack. It's necessary because
236
- // `docs-mdx` depends on ESM code, which must be asynchronously imported
237
- // to be used in CJS. Unfortunately, we cannot use `import()` here, because
238
- // it will be transpiled down to `require()` by Babel. So instead, we require
239
- // a CJS export from `@storybook/docs-mdx` that does the `async import` for us.
240
-
241
- // eslint-disable-next-line global-require
242
- var _await$require = await require('@storybook/docs-mdx'),
243
- analyze = _await$require.analyze;
244
235
  var content = await _fsExtra.default.readFile(absolutePath, 'utf8');
245
- var result = analyze(content);
236
+ var result = (0, _docsMdx.analyze)(content);
246
237
 
247
238
  // Templates are not indexed
248
239
  if (result.isTemplate) return false;
@@ -252,7 +243,7 @@ class StoryIndexGenerator {
252
243
 
253
244
  // Go through the cache and collect all of the cache entries that this docs file depends on.
254
245
  // We'll use this to make sure this docs cache entry is invalidated when any of its dependents
255
- // are invalidated.
246
+ // are invalidated.f
256
247
  var dependencies = this.findDependencies(absoluteImports);
257
248
 
258
249
  // Also, if `result.of` is set, it means that we're using the `<Meta of={XStories} />` syntax,
@@ -287,7 +278,7 @@ class StoryIndexGenerator {
287
278
  return dep.entries[0].importPath;
288
279
  }),
289
280
  type: 'docs',
290
- tags: [...(result.tags || []), 'docs'],
281
+ tags: [...(result.tags || []), 'docs', 'mdx'],
291
282
  standalone: true
292
283
  };
293
284
  return docsEntry;
@@ -16,6 +16,7 @@ import { normalizeStoryPath } from '@storybook/core-common';
16
16
  import { logger } from '@storybook/node-logger';
17
17
  import { getStorySortParameter, NoMetaError } from '@storybook/csf-tools';
18
18
  import { toId } from '@storybook/csf';
19
+ import { analyze } from '@storybook/docs-mdx';
19
20
 
20
21
  /** A .mdx file will produce a "standalone" docs entry */
21
22
 
@@ -227,16 +228,6 @@ export class StoryIndexGenerator {
227
228
  }
228
229
  var normalizedPath = normalizeStoryPath(relativePath);
229
230
  var importPath = slash(normalizedPath);
230
-
231
- // This `await require(...)` is a bit of a hack. It's necessary because
232
- // `docs-mdx` depends on ESM code, which must be asynchronously imported
233
- // to be used in CJS. Unfortunately, we cannot use `import()` here, because
234
- // it will be transpiled down to `require()` by Babel. So instead, we require
235
- // a CJS export from `@storybook/docs-mdx` that does the `async import` for us.
236
-
237
- // eslint-disable-next-line global-require
238
- var _await$require = await require('@storybook/docs-mdx'),
239
- analyze = _await$require.analyze;
240
231
  var content = await fs.readFile(absolutePath, 'utf8');
241
232
  var result = analyze(content);
242
233
 
@@ -248,7 +239,7 @@ export class StoryIndexGenerator {
248
239
 
249
240
  // Go through the cache and collect all of the cache entries that this docs file depends on.
250
241
  // We'll use this to make sure this docs cache entry is invalidated when any of its dependents
251
- // are invalidated.
242
+ // are invalidated.f
252
243
  var dependencies = this.findDependencies(absoluteImports);
253
244
 
254
245
  // Also, if `result.of` is set, it means that we're using the `<Meta of={XStories} />` syntax,
@@ -283,7 +274,7 @@ export class StoryIndexGenerator {
283
274
  return dep.entries[0].importPath;
284
275
  }),
285
276
  type: 'docs',
286
- tags: [...(result.tags || []), 'docs'],
277
+ tags: [...(result.tags || []), 'docs', 'mdx'],
287
278
  standalone: true
288
279
  };
289
280
  return docsEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/core-server",
3
- "version": "7.0.0-alpha.51",
3
+ "version": "7.0.0-alpha.52",
4
4
  "description": "Storybook framework-agnostic API",
5
5
  "keywords": [
6
6
  "storybook"
@@ -35,17 +35,17 @@
35
35
  "dependencies": {
36
36
  "@aw-web-design/x-default-browser": "1.4.88",
37
37
  "@discoveryjs/json-ext": "^0.5.3",
38
- "@storybook/builder-manager": "7.0.0-alpha.51",
39
- "@storybook/core-client": "7.0.0-alpha.51",
40
- "@storybook/core-common": "7.0.0-alpha.51",
41
- "@storybook/core-events": "7.0.0-alpha.51",
38
+ "@storybook/builder-manager": "7.0.0-alpha.52",
39
+ "@storybook/core-client": "7.0.0-alpha.52",
40
+ "@storybook/core-common": "7.0.0-alpha.52",
41
+ "@storybook/core-events": "7.0.0-alpha.52",
42
42
  "@storybook/csf": "next",
43
- "@storybook/csf-tools": "7.0.0-alpha.51",
44
- "@storybook/docs-mdx": "0.0.1-canary.12433cf.0",
45
- "@storybook/node-logger": "7.0.0-alpha.51",
46
- "@storybook/store": "7.0.0-alpha.51",
47
- "@storybook/telemetry": "7.0.0-alpha.51",
48
- "@storybook/types": "7.0.0-alpha.51",
43
+ "@storybook/csf-tools": "7.0.0-alpha.52",
44
+ "@storybook/docs-mdx": "next",
45
+ "@storybook/node-logger": "7.0.0-alpha.52",
46
+ "@storybook/store": "7.0.0-alpha.52",
47
+ "@storybook/telemetry": "7.0.0-alpha.52",
48
+ "@storybook/types": "7.0.0-alpha.52",
49
49
  "@types/node": "^16.0.0 || ^18.0.0",
50
50
  "@types/node-fetch": "^2.5.7",
51
51
  "@types/pretty-hrtime": "^1.0.0",
@@ -77,7 +77,7 @@
77
77
  "ws": "^8.2.3"
78
78
  },
79
79
  "devDependencies": {
80
- "@storybook/builder-webpack5": "7.0.0-alpha.51",
80
+ "@storybook/builder-webpack5": "7.0.0-alpha.52",
81
81
  "@types/compression": "^1.7.0",
82
82
  "@types/ip": "^1.1.0",
83
83
  "@types/serve-favicon": "^2.5.2",
@@ -102,5 +102,5 @@
102
102
  "publishConfig": {
103
103
  "access": "public"
104
104
  },
105
- "gitHead": "4fec76c3f5135854d9834ebc1cf2f1f325696ded"
105
+ "gitHead": "d2494e3f51ce0f55bcb1ef693a6477c669fbe666"
106
106
  }