react-cosmos 5.6.5 → 5.7.0
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/config/createCosmosConfig.js +4 -4
- package/dist/config/{resolve.d.ts → resolveModule.d.ts} +0 -0
- package/dist/config/{resolve.js → resolveModule.js} +0 -0
- package/dist/{shared/devServer → devServer}/app.d.ts +2 -2
- package/dist/{shared/devServer → devServer}/app.js +2 -2
- package/dist/{shared/devServer → devServer}/httpServer.d.ts +2 -2
- package/dist/{shared/devServer → devServer}/httpServer.js +0 -0
- package/dist/{shared/devServer → devServer}/messageHandler.d.ts +0 -0
- package/dist/{shared/devServer → devServer}/messageHandler.js +0 -0
- package/dist/{shared/devServer/index.d.ts → devServer/startDevServer.d.ts} +2 -2
- package/dist/{shared/devServer/index.js → devServer/startDevServer.js} +5 -5
- package/dist/dom/DomFixtureLoader.d.ts +4 -3
- package/dist/dom/ErrorCatch.js +4 -4
- package/dist/dom/index.d.ts +3 -3
- package/dist/dom/renderMessage.d.ts +1 -0
- package/dist/{shared/export.d.ts → export/generateExport.d.ts} +1 -1
- package/dist/{shared/export.js → export/generateExport.js} +7 -7
- package/dist/fixture.js +6 -6
- package/dist/getFixtureUrls.d.ts +1 -1
- package/dist/getFixtureUrls.js +11 -12
- package/dist/getFixtures.d.ts +1 -1
- package/dist/getFixtures.js +14 -15
- package/dist/getFixtures2.d.ts +1 -1
- package/dist/getFixtures2.js +9 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +22 -18
- package/dist/native.d.ts +7 -4
- package/dist/native.js +4 -3
- package/dist/nativeServer.js +3 -3
- package/dist/plugins/httpProxy.d.ts +1 -1
- package/dist/plugins/httpProxy.js +1 -1
- package/dist/plugins/openFile.d.ts +1 -1
- package/dist/plugins/openFile.js +3 -3
- package/dist/plugins/userDepsFile.d.ts +1 -1
- package/dist/plugins/userDepsFile.js +6 -4
- package/dist/plugins/webpack/client/errorOverlay/reactErrorOverlay.js +2 -2
- package/dist/plugins/webpack/client/userDeps.d.ts +3 -3
- package/dist/plugins/webpack/client/userDeps.js +1 -1
- package/dist/plugins/webpack/cosmosConfig/dom.d.ts +1 -1
- package/dist/plugins/webpack/cosmosConfig/webpack.d.ts +1 -1
- package/dist/plugins/webpack/cosmosConfig/webpack.js +5 -5
- package/dist/plugins/webpack/devServer.d.ts +1 -1
- package/dist/plugins/webpack/devServer.js +7 -7
- package/dist/plugins/webpack/export.d.ts +1 -1
- package/dist/plugins/webpack/export.js +10 -6
- package/dist/plugins/webpack/webpackConfig/{default.d.ts → getDefaultWebpackConfig.d.ts} +0 -0
- package/dist/plugins/webpack/webpackConfig/{default.js → getDefaultWebpackConfig.js} +4 -4
- package/dist/plugins/webpack/webpackConfig/{devServer.d.ts → getDevWebpackConfig.d.ts} +1 -1
- package/dist/plugins/webpack/webpackConfig/{devServer.js → getDevWebpackConfig.js} +18 -17
- package/dist/plugins/webpack/webpackConfig/{export.d.ts → getExportWebpackConfig.d.ts} +1 -1
- package/dist/plugins/webpack/webpackConfig/{export.js → getExportWebpackConfig.js} +19 -18
- package/dist/plugins/webpack/webpackConfig/getUserWebpackConfig.d.ts +3 -0
- package/dist/plugins/webpack/webpackConfig/getUserWebpackConfig.js +136 -0
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigModule.d.ts +2 -0
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigModule.js +45 -0
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigResolve.d.ts +4 -0
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigResolve.js +107 -0
- package/dist/plugins/webpack/webpackConfig/getWebpackNodeEnv.d.ts +1 -0
- package/dist/plugins/webpack/webpackConfig/getWebpackNodeEnv.js +12 -0
- package/dist/plugins/webpack/webpackConfig/htmlPlugin.d.ts +1 -1
- package/dist/plugins/webpack/webpackConfig/htmlPlugin.js +5 -5
- package/dist/plugins/webpack/webpackConfig/plugins.d.ts +5 -0
- package/dist/plugins/webpack/webpackConfig/plugins.js +37 -0
- package/dist/plugins/webpack/webpackConfig/resolveWebpackClientPath.d.ts +1 -0
- package/dist/plugins/webpack/webpackConfig/resolveWebpackClientPath.js +10 -0
- package/dist/plugins/webpack/webpackConfig/userDepsLoader.js +4 -4
- package/dist/shared/fs.js +3 -3
- package/dist/shared/playgroundHtml.d.ts +2 -2
- package/dist/shared/playgroundHtml.js +6 -6
- package/dist/shared/pluginConfigs.d.ts +1 -1
- package/dist/shared/static.js +2 -2
- package/dist/shared/types.d.ts +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/shared/{shared.d.ts → utils.d.ts} +0 -1
- package/dist/shared/{shared.js → utils.js} +2 -2
- package/dist/{shared/userDeps → userDeps}/findUserModulePaths.d.ts +0 -0
- package/dist/{shared/userDeps → userDeps}/findUserModulePaths.js +0 -0
- package/dist/{shared/userDeps → userDeps}/generateUserDepsModule.d.ts +1 -1
- package/dist/{shared/userDeps → userDeps}/generateUserDepsModule.js +0 -0
- package/dist/userDeps/getUserModules.d.ts +8 -0
- package/dist/{shared/userDeps → userDeps}/getUserModules.js +6 -6
- package/dist/{shared/userDeps → userDeps}/shared.d.ts +0 -0
- package/dist/{shared/userDeps → userDeps}/shared.js +3 -3
- package/dist/{shared/userDeps → userDeps}/userDepsTemplate.d.ts +0 -0
- package/dist/{shared/userDeps → userDeps}/userDepsTemplate.js +3 -3
- package/dist/webExport.js +2 -2
- package/dist/webServer.js +3 -3
- package/package.json +13 -13
- package/dist/config/index.d.ts +0 -5
- package/dist/config/index.js +0 -51
- package/dist/plugins/webpack/webpackConfig/index.d.ts +0 -2
- package/dist/plugins/webpack/webpackConfig/index.js +0 -21
- package/dist/plugins/webpack/webpackConfig/module.d.ts +0 -3
- package/dist/plugins/webpack/webpackConfig/module.js +0 -18
- package/dist/plugins/webpack/webpackConfig/shared.d.ts +0 -11
- package/dist/plugins/webpack/webpackConfig/shared.js +0 -254
- package/dist/shared/userDeps/getUserModules.d.ts +0 -8
- package/dist/shared/userDeps/index.d.ts +0 -4
- package/dist/shared/userDeps/index.js +0 -49
|
@@ -9,13 +9,13 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
|
|
10
10
|
var _cli = require("../shared/cli");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _resolveModule = require("./resolveModule");
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
19
|
|
|
20
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
21
|
|
|
@@ -128,6 +128,6 @@ function getGlobalImports(cosmosConfigInput, rootDir) {
|
|
|
128
128
|
var _cosmosConfigInput$gl = cosmosConfigInput.globalImports,
|
|
129
129
|
globalImports = _cosmosConfigInput$gl === void 0 ? [] : _cosmosConfigInput$gl;
|
|
130
130
|
return globalImports.map(function (globalImport) {
|
|
131
|
-
return (0,
|
|
131
|
+
return (0, _resolveModule.resolveModule)(rootDir, globalImport);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { CosmosPluginConfig } from 'react-cosmos-plugin';
|
|
3
|
-
import { CosmosConfig } from '
|
|
4
|
-
import { PlatformType } from '../shared';
|
|
3
|
+
import { CosmosConfig } from '../config/shared';
|
|
4
|
+
import { PlatformType } from '../shared/types';
|
|
5
5
|
export declare function createApp(platformType: PlatformType, cosmosConfig: CosmosConfig, pluginConfigs: CosmosPluginConfig[]): express.Express;
|
|
@@ -9,9 +9,9 @@ var _express = _interopRequireDefault(require("express"));
|
|
|
9
9
|
|
|
10
10
|
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
11
11
|
|
|
12
|
-
var _playgroundHtml = require("../playgroundHtml");
|
|
12
|
+
var _playgroundHtml = require("../shared/playgroundHtml");
|
|
13
13
|
|
|
14
|
-
var _static = require("../static");
|
|
14
|
+
var _static = require("../shared/static");
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import http from 'http';
|
|
3
3
|
import https from 'https';
|
|
4
|
-
import { CosmosConfig } from '
|
|
4
|
+
import { CosmosConfig } from '../config/shared';
|
|
5
5
|
declare type RequestListener = (request: http.IncomingMessage, response: http.ServerResponse) => void;
|
|
6
6
|
export declare function createHttpServer(cosmosConfig: CosmosConfig, requestListener: RequestListener): Promise<{
|
|
7
|
-
server:
|
|
7
|
+
server: http.Server | https.Server;
|
|
8
8
|
start: () => Promise<void>;
|
|
9
9
|
stop: () => Promise<void>;
|
|
10
10
|
}>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import http from 'http';
|
|
4
4
|
import { Message } from 'react-cosmos-shared2/util';
|
|
5
|
-
import { CosmosConfig } from '
|
|
6
|
-
import { PlatformType } from '../shared';
|
|
5
|
+
import { CosmosConfig } from '../config/shared';
|
|
6
|
+
import { PlatformType } from '../shared/types';
|
|
7
7
|
declare type PluginCleanupCallback = () => unknown;
|
|
8
8
|
declare type PluginReturn = void | null | PluginCleanupCallback;
|
|
9
9
|
export declare type DevServerPluginArgs = {
|
|
@@ -7,11 +7,11 @@ exports.startDevServer = startDevServer;
|
|
|
7
7
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _detectCosmosConfig = require("../config/detectCosmosConfig");
|
|
11
11
|
|
|
12
|
-
var _pluginConfigs = require("../pluginConfigs");
|
|
12
|
+
var _pluginConfigs = require("../shared/pluginConfigs");
|
|
13
13
|
|
|
14
|
-
var _static = require("../static");
|
|
14
|
+
var _static = require("../shared/static");
|
|
15
15
|
|
|
16
16
|
var _app = require("./app");
|
|
17
17
|
|
|
@@ -89,7 +89,7 @@ function _startDevServer() {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
plugins = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : [];
|
|
92
|
-
cosmosConfig = (0,
|
|
92
|
+
cosmosConfig = (0, _detectCosmosConfig.detectCosmosConfig)();
|
|
93
93
|
logCosmosConfigInfo();
|
|
94
94
|
pluginConfigs = (0, _pluginConfigs.getPluginConfigs)(cosmosConfig);
|
|
95
95
|
logPluginInfo(pluginConfigs);
|
|
@@ -184,7 +184,7 @@ function _startDevServer() {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
function logCosmosConfigInfo() {
|
|
187
|
-
var cosmosConfigPath = (0,
|
|
187
|
+
var cosmosConfigPath = (0, _detectCosmosConfig.detectCosmosConfigPath)();
|
|
188
188
|
|
|
189
189
|
if (!cosmosConfigPath) {
|
|
190
190
|
console.log("[Cosmos] Using default cosmos config");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ReactDecorators, ReactFixtureWrappers } from 'react-cosmos-shared2/react';
|
|
2
3
|
declare type Props = {
|
|
3
|
-
fixtures:
|
|
4
|
-
decorators:
|
|
4
|
+
fixtures: ReactFixtureWrappers;
|
|
5
|
+
decorators: ReactDecorators;
|
|
5
6
|
onErrorReset?: () => unknown;
|
|
6
7
|
};
|
|
7
8
|
export declare function DomFixtureLoader({ fixtures, decorators, onErrorReset, }: Props): JSX.Element;
|
package/dist/dom/ErrorCatch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -19,15 +19,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
19
19
|
|
|
20
20
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
21
|
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
23
|
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
25
|
|
|
26
26
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
27
|
|
|
28
28
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
29
|
|
|
30
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
31
31
|
|
|
32
32
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
33
|
|
package/dist/dom/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactDecorators, ReactFixtureWrappers } from 'react-cosmos-shared2/react';
|
|
2
2
|
import { DomRendererConfig } from '../shared/rendererConfig';
|
|
3
3
|
import './globalErrorHandler';
|
|
4
4
|
import { rendererConnect } from './rendererConnect';
|
|
@@ -6,8 +6,8 @@ import { rendererId } from './rendererId';
|
|
|
6
6
|
export { rendererId, rendererConnect };
|
|
7
7
|
declare type Args = {
|
|
8
8
|
rendererConfig: DomRendererConfig;
|
|
9
|
-
fixtures:
|
|
10
|
-
decorators:
|
|
9
|
+
fixtures: ReactFixtureWrappers;
|
|
10
|
+
decorators: ReactDecorators;
|
|
11
11
|
onErrorReset?: () => unknown;
|
|
12
12
|
};
|
|
13
13
|
export declare function mountDomRenderer({ rendererConfig, fixtures, decorators, onErrorReset, }: Args): void;
|
|
@@ -9,15 +9,15 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
9
9
|
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _detectCosmosConfig = require("../config/detectCosmosConfig");
|
|
13
13
|
|
|
14
|
-
var _playgroundHtml = require("
|
|
14
|
+
var _playgroundHtml = require("../shared/playgroundHtml");
|
|
15
15
|
|
|
16
|
-
var _pluginConfigs = require("
|
|
16
|
+
var _pluginConfigs = require("../shared/pluginConfigs");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _static = require("../shared/static");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _utils = require("../shared/utils");
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
@@ -40,7 +40,7 @@ function _generateExport() {
|
|
|
40
40
|
switch (_context.prev = _context.next) {
|
|
41
41
|
case 0:
|
|
42
42
|
plugins = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
43
|
-
cosmosConfig = (0,
|
|
43
|
+
cosmosConfig = (0, _detectCosmosConfig.detectCosmosConfig)(); // Clear previous export (or other files at export path)
|
|
44
44
|
|
|
45
45
|
exportPath = cosmosConfig.exportPath;
|
|
46
46
|
|
|
@@ -94,7 +94,7 @@ function copyStaticAssets(cosmosConfig) {
|
|
|
94
94
|
|
|
95
95
|
var publicUrl = cosmosConfig.publicUrl;
|
|
96
96
|
|
|
97
|
-
var exportStaticPath = _path.default.resolve(exportPath, (0,
|
|
97
|
+
var exportStaticPath = _path.default.resolve(exportPath, (0, _utils.removeLeadingSlash)(publicUrl));
|
|
98
98
|
|
|
99
99
|
_fsExtra.default.copySync(staticPath, exportStaticPath);
|
|
100
100
|
}
|
package/dist/fixture.js
CHANGED
|
@@ -9,22 +9,22 @@ Object.defineProperty(exports, "FixtureContext", {
|
|
|
9
9
|
return _FixtureLoader.FixtureContext;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "Viewport", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _FixtureLoader.
|
|
15
|
+
return _FixtureLoader.Viewport;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "useSelect", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return _FixtureLoader.
|
|
21
|
+
return _FixtureLoader.useSelect;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "useValue", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return _FixtureLoader.
|
|
27
|
+
return _FixtureLoader.useValue;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
|
package/dist/getFixtureUrls.d.ts
CHANGED
package/dist/getFixtureUrls.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getFixtureUrlsSync = getFixtureUrlsSync;
|
|
7
6
|
exports.getFixtureUrls = void 0;
|
|
7
|
+
exports.getFixtureUrlsSync = getFixtureUrlsSync;
|
|
8
8
|
|
|
9
9
|
var _react = require("react-cosmos-shared2/react");
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ var _url = require("react-cosmos-shared2/url");
|
|
|
12
12
|
|
|
13
13
|
var _playgroundHtml = require("./shared/playgroundHtml");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _getUserModules2 = require("./userDeps/getUserModules");
|
|
16
16
|
|
|
17
17
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
18
18
|
|
|
@@ -52,20 +52,19 @@ function getFixtureUrlsSync(_ref2) {
|
|
|
52
52
|
fixtureUrls.push(createFixtureUrl(host, fixtureId, fullScreen));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
var _getUserModules = (0,
|
|
56
|
-
|
|
55
|
+
var _getUserModules = (0, _getUserModules2.getUserModules)(cosmosConfig),
|
|
56
|
+
fixtures = _getUserModules.fixtures;
|
|
57
57
|
|
|
58
|
-
var
|
|
59
|
-
Object.keys(
|
|
60
|
-
var
|
|
58
|
+
var fixtureList = (0, _react.getFixtureListFromExports)(fixtures);
|
|
59
|
+
Object.keys(fixtureList).forEach(function (fixturePath) {
|
|
60
|
+
var fixtureItem = fixtureList[fixturePath];
|
|
61
61
|
|
|
62
|
-
if (
|
|
62
|
+
if (fixtureItem.type === 'single') {
|
|
63
63
|
pushFixtureUrl({
|
|
64
|
-
path: fixturePath
|
|
65
|
-
name: null
|
|
64
|
+
path: fixturePath
|
|
66
65
|
});
|
|
67
|
-
} else {
|
|
68
|
-
fixtureNames.forEach(function (fixtureName) {
|
|
66
|
+
} else if (fixtureItem.type === 'multi') {
|
|
67
|
+
fixtureItem.fixtureNames.forEach(function (fixtureName) {
|
|
69
68
|
pushFixtureUrl({
|
|
70
69
|
path: fixturePath,
|
|
71
70
|
name: fixtureName
|
package/dist/getFixtures.d.ts
CHANGED
package/dist/getFixtures.js
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getFixturesSync = getFixturesSync;
|
|
7
6
|
exports.getFixtures = void 0;
|
|
7
|
+
exports.getFixturesSync = getFixturesSync;
|
|
8
8
|
|
|
9
9
|
var _FixtureLoader = require("react-cosmos-shared2/FixtureLoader");
|
|
10
10
|
|
|
11
11
|
var _react = require("react-cosmos-shared2/react");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _getUserModules2 = require("./userDeps/getUserModules");
|
|
14
14
|
|
|
15
15
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
16
|
|
|
@@ -42,13 +42,13 @@ exports.getFixtures = getFixtures;
|
|
|
42
42
|
function getFixturesSync(_ref2) {
|
|
43
43
|
var cosmosConfig = _ref2.cosmosConfig;
|
|
44
44
|
|
|
45
|
-
var _getUserModules = (0,
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
var _getUserModules = (0, _getUserModules2.getUserModules)(cosmosConfig),
|
|
46
|
+
fixtures = _getUserModules.fixtures,
|
|
47
|
+
decorators = _getUserModules.decorators;
|
|
48
48
|
|
|
49
|
-
var
|
|
50
|
-
Object.keys(
|
|
51
|
-
var fixtureExport =
|
|
49
|
+
var result = [];
|
|
50
|
+
Object.keys(fixtures).forEach(function (fixturePath) {
|
|
51
|
+
var fixtureExport = fixtures[fixturePath];
|
|
52
52
|
|
|
53
53
|
if ((0, _react.isMultiFixture)(fixtureExport)) {
|
|
54
54
|
// FIXME: Why does fixtureExport need to be cast as ReactFixtureMap when
|
|
@@ -59,23 +59,22 @@ function getFixturesSync(_ref2) {
|
|
|
59
59
|
path: fixturePath,
|
|
60
60
|
name: fixtureName
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
result.push({
|
|
63
63
|
fixtureId: fixtureId,
|
|
64
|
-
getElement: createFixtureElementGetter(multiFixtureExport[fixtureName], fixturePath,
|
|
64
|
+
getElement: createFixtureElementGetter(multiFixtureExport[fixtureName], fixturePath, decorators)
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
} else {
|
|
68
68
|
var fixtureId = {
|
|
69
|
-
path: fixturePath
|
|
70
|
-
name: null
|
|
69
|
+
path: fixturePath
|
|
71
70
|
};
|
|
72
|
-
|
|
71
|
+
result.push({
|
|
73
72
|
fixtureId: fixtureId,
|
|
74
|
-
getElement: createFixtureElementGetter(fixtureExport, fixturePath,
|
|
73
|
+
getElement: createFixtureElementGetter(fixtureExport, fixturePath, decorators)
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
76
|
});
|
|
78
|
-
return
|
|
77
|
+
return result;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
function createFixtureElementGetter(fixture, fixturePath, decoratorsByPath) {
|
package/dist/getFixtures2.d.ts
CHANGED
package/dist/getFixtures2.js
CHANGED
|
@@ -19,7 +19,7 @@ var _url2 = _interopRequireDefault(require("url"));
|
|
|
19
19
|
|
|
20
20
|
var _playgroundHtml = require("./shared/playgroundHtml");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _getUserModules2 = require("./userDeps/getUserModules");
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
@@ -41,13 +41,13 @@ function getFixtures2(cosmosConfig) {
|
|
|
41
41
|
rootDir = cosmosConfig.rootDir;
|
|
42
42
|
var fixtureInfo = [];
|
|
43
43
|
|
|
44
|
-
var _getUserModules = (0,
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
var _getUserModules = (0, _getUserModules2.getUserModules)(cosmosConfig),
|
|
45
|
+
fixtures = _getUserModules.fixtures,
|
|
46
|
+
decorators = _getUserModules.decorators;
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var fixtureList = (0, _react.getFixtureListFromExports)(fixtures);
|
|
49
49
|
var fixtureTree = (0, _fixtureTree.createFixtureTree)({
|
|
50
|
-
fixtures:
|
|
50
|
+
fixtures: fixtureList,
|
|
51
51
|
fixturesDir: fixturesDir,
|
|
52
52
|
fixtureFileSuffix: fixtureFileSuffix
|
|
53
53
|
});
|
|
@@ -57,14 +57,14 @@ function getFixtures2(cosmosConfig) {
|
|
|
57
57
|
fixtureId = _ref.fixtureId,
|
|
58
58
|
name = _ref.name,
|
|
59
59
|
parents = _ref.parents;
|
|
60
|
-
var fixtureExport =
|
|
61
|
-
var fixture = fixtureId.name ===
|
|
60
|
+
var fixtureExport = fixtures[fixtureId.path];
|
|
61
|
+
var fixture = fixtureId.name === undefined ? fixtureExport : fixtureExport[fixtureId.name];
|
|
62
62
|
var treePath = [].concat(_toConsumableArray(parents), [fileName]);
|
|
63
63
|
if (name) treePath.push(name);
|
|
64
64
|
fixtureInfo.push({
|
|
65
65
|
absoluteFilePath: _path.default.join(rootDir, fixtureId.path),
|
|
66
66
|
fileName: fileName,
|
|
67
|
-
getElement: createFixtureElementGetter(fixture, fixtureId.path,
|
|
67
|
+
getElement: createFixtureElementGetter(fixture, fixtureId.path, decorators),
|
|
68
68
|
name: name,
|
|
69
69
|
parents: parents,
|
|
70
70
|
playgroundUrl: getPlaygroundUrl(cosmosConfig, fixtureId),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { createCosmosConfig
|
|
1
|
+
export { createCosmosConfig } from './config/createCosmosConfig';
|
|
2
|
+
export { detectCosmosConfig } from './config/detectCosmosConfig';
|
|
3
|
+
export { getCosmosConfigAtPath } from './config/getCosmosConfigAtPath';
|
|
2
4
|
export { getFixtures, getFixturesSync } from './getFixtures';
|
|
3
5
|
export { FixtureApi, getFixtures2 } from './getFixtures2';
|
|
4
6
|
export { getFixtureUrls, getFixtureUrlsSync } from './getFixtureUrls';
|
package/dist/index.js
CHANGED
|
@@ -3,40 +3,46 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "FixtureApi", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _getFixtures2.FixtureApi;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "createCosmosConfig", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
9
|
-
return
|
|
15
|
+
return _createCosmosConfig.createCosmosConfig;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
18
|
Object.defineProperty(exports, "detectCosmosConfig", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function get() {
|
|
15
|
-
return
|
|
21
|
+
return _detectCosmosConfig.detectCosmosConfig;
|
|
16
22
|
}
|
|
17
23
|
});
|
|
18
24
|
Object.defineProperty(exports, "getCosmosConfigAtPath", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function get() {
|
|
21
|
-
return
|
|
27
|
+
return _getCosmosConfigAtPath.getCosmosConfigAtPath;
|
|
22
28
|
}
|
|
23
29
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "getFixtureUrls", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function get() {
|
|
27
|
-
return
|
|
33
|
+
return _getFixtureUrls.getFixtureUrls;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "getFixtureUrlsSync", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function get() {
|
|
33
|
-
return
|
|
39
|
+
return _getFixtureUrls.getFixtureUrlsSync;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
42
|
+
Object.defineProperty(exports, "getFixtures", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function get() {
|
|
39
|
-
return
|
|
45
|
+
return _getFixtures.getFixtures;
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
48
|
Object.defineProperty(exports, "getFixtures2", {
|
|
@@ -45,20 +51,18 @@ Object.defineProperty(exports, "getFixtures2", {
|
|
|
45
51
|
return _getFixtures2.getFixtures2;
|
|
46
52
|
}
|
|
47
53
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _getFixtureUrls.getFixtureUrls;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "getFixtureUrlsSync", {
|
|
54
|
+
Object.defineProperty(exports, "getFixturesSync", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function get() {
|
|
57
|
-
return
|
|
57
|
+
return _getFixtures.getFixturesSync;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var _createCosmosConfig = require("./config/createCosmosConfig");
|
|
62
|
+
|
|
63
|
+
var _detectCosmosConfig = require("./config/detectCosmosConfig");
|
|
64
|
+
|
|
65
|
+
var _getCosmosConfigAtPath = require("./config/getCosmosConfigAtPath");
|
|
62
66
|
|
|
63
67
|
var _getFixtures = require("./getFixtures");
|
|
64
68
|
|
package/dist/native.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ReactDecorators, ReactFixtureWrappers } from 'react-cosmos-shared2/react';
|
|
3
|
+
import { FixtureId } from 'react-cosmos-shared2/renderer';
|
|
2
4
|
import { NativeRendererConfig } from './shared/rendererConfig';
|
|
3
5
|
declare type Props = {
|
|
4
6
|
rendererConfig: NativeRendererConfig;
|
|
5
|
-
fixtures:
|
|
6
|
-
decorators:
|
|
7
|
+
fixtures: ReactFixtureWrappers;
|
|
8
|
+
decorators: ReactDecorators;
|
|
9
|
+
initialFixtureId?: FixtureId;
|
|
7
10
|
};
|
|
8
|
-
export declare function NativeFixtureLoader({ rendererConfig: { port }, fixtures, decorators, }: Props): JSX.Element;
|
|
11
|
+
export declare function NativeFixtureLoader({ rendererConfig: { port }, fixtures, decorators, initialFixtureId, }: Props): JSX.Element;
|
|
9
12
|
export {};
|
package/dist/native.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -34,13 +34,14 @@ var rendererId = 'native-renderer';
|
|
|
34
34
|
function NativeFixtureLoader(_ref) {
|
|
35
35
|
var port = _ref.rendererConfig.port,
|
|
36
36
|
fixtures = _ref.fixtures,
|
|
37
|
-
decorators = _ref.decorators
|
|
37
|
+
decorators = _ref.decorators,
|
|
38
|
+
initialFixtureId = _ref.initialFixtureId;
|
|
38
39
|
var socketUrl = getSocketUrl(port);
|
|
39
40
|
return /*#__PURE__*/_react.default.createElement(_FixtureLoader.FixtureLoader, {
|
|
40
41
|
rendererId: rendererId,
|
|
41
42
|
rendererConnect: (0, _FixtureLoader.createWebSocketsConnect)(socketUrl),
|
|
42
43
|
fixtures: fixtures,
|
|
43
|
-
selectedFixtureId: null,
|
|
44
|
+
selectedFixtureId: initialFixtureId !== null && initialFixtureId !== void 0 ? initialFixtureId : null,
|
|
44
45
|
systemDecorators: [],
|
|
45
46
|
userDecorators: decorators,
|
|
46
47
|
renderMessage: renderMessage
|
package/dist/nativeServer.js
CHANGED
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.startNativeServer = startNativeServer;
|
|
7
7
|
|
|
8
|
+
var _startDevServer = require("./devServer/startDevServer");
|
|
9
|
+
|
|
8
10
|
var _openFile = require("./plugins/openFile");
|
|
9
11
|
|
|
10
12
|
var _userDepsFile = require("./plugins/userDepsFile");
|
|
11
13
|
|
|
12
|
-
var _devServer = require("./shared/devServer");
|
|
13
|
-
|
|
14
14
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
15
15
|
|
|
16
16
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -26,7 +26,7 @@ function _startNativeServer() {
|
|
|
26
26
|
switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
28
|
_context.next = 2;
|
|
29
|
-
return (0,
|
|
29
|
+
return (0, _startDevServer.startDevServer)('native', [_userDepsFile.userDepsFile, _openFile.openFile]);
|
|
30
30
|
|
|
31
31
|
case 2:
|
|
32
32
|
case "end":
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DevServerPluginArgs } from '../
|
|
1
|
+
import { DevServerPluginArgs } from '../devServer/startDevServer';
|
|
2
2
|
export declare function httpProxy({ cosmosConfig, expressApp }: DevServerPluginArgs): void;
|
|
@@ -7,7 +7,7 @@ exports.httpProxy = httpProxy;
|
|
|
7
7
|
|
|
8
8
|
var _httpProxyMiddleware = require("http-proxy-middleware");
|
|
9
9
|
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
10
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
11
11
|
|
|
12
12
|
function httpProxy(_ref) {
|
|
13
13
|
var cosmosConfig = _ref.cosmosConfig,
|