react-cosmos 5.7.2 → 6.0.0-alpha.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/bin/cosmos-export.js +4 -3
- package/bin/cosmos-native.js +4 -3
- package/bin/cosmos.js +5 -4
- package/config.schema.json +14 -4
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -70
- package/dist/jest.d.ts +7 -0
- package/dist/jest.js +7 -0
- package/dist/{config → server/cosmosConfig}/createCosmosConfig.d.ts +1 -1
- package/dist/server/cosmosConfig/createCosmosConfig.js +84 -0
- package/dist/server/cosmosConfig/detectCosmosConfig.d.ts +2 -0
- package/dist/server/cosmosConfig/detectCosmosConfig.js +38 -0
- package/dist/{config → server/cosmosConfig}/getCosmosConfigAtPath.d.ts +1 -1
- package/dist/server/cosmosConfig/getCosmosConfigAtPath.js +12 -0
- package/dist/server/cosmosConfig/shared.d.ts +2 -0
- package/dist/server/cosmosConfig/shared.js +7 -0
- package/dist/{config/shared.d.ts → server/cosmosConfig/types.d.ts} +5 -5
- package/dist/server/cosmosPlugin/findCosmosPluginConfigs.d.ts +8 -0
- package/dist/server/cosmosPlugin/findCosmosPluginConfigs.js +14 -0
- package/dist/server/cosmosPlugin/pluginConfigs.d.ts +8 -0
- package/dist/server/cosmosPlugin/pluginConfigs.js +16 -0
- package/dist/server/cosmosPlugin/readCosmosPluginConfig.d.ts +8 -0
- package/dist/server/cosmosPlugin/readCosmosPluginConfig.js +31 -0
- package/dist/server/cosmosPlugin/types.d.ts +21 -0
- package/dist/server/devServer/corePlugins/httpProxy.d.ts +2 -0
- package/dist/server/devServer/corePlugins/httpProxy.js +18 -0
- package/dist/server/devServer/corePlugins/openFile.d.ts +2 -0
- package/dist/server/devServer/corePlugins/openFile.js +53 -0
- package/dist/server/devServer/corePlugins/pluginEndpoint.d.ts +2 -0
- package/dist/server/devServer/corePlugins/pluginEndpoint.js +17 -0
- package/dist/server/devServer/corePlugins/userDepsFile.d.ts +2 -0
- package/dist/server/devServer/corePlugins/userDepsFile.js +37 -0
- package/dist/server/devServer/expressApp.d.ts +5 -0
- package/dist/server/devServer/expressApp.js +21 -0
- package/dist/server/devServer/httpServer.d.ts +12 -0
- package/dist/server/devServer/httpServer.js +42 -0
- package/dist/{devServer → server/devServer}/messageHandler.d.ts +2 -2
- package/dist/server/devServer/messageHandler.js +29 -0
- package/dist/server/devServer/startDevServer.d.ts +2 -0
- package/dist/server/devServer/startDevServer.js +91 -0
- package/dist/server/export/generateExport.d.ts +1 -0
- package/dist/server/export/generateExport.js +97 -0
- package/dist/server/getFixtures/getFixtures.d.ts +14 -0
- package/dist/server/getFixtures/getFixtures.js +63 -0
- package/dist/server/shared/logPluginInfo.d.ts +2 -0
- package/dist/server/shared/logPluginInfo.js +8 -0
- package/dist/server/shared/playgroundHtml.d.ts +6 -0
- package/dist/server/shared/playgroundHtml.js +85 -0
- package/dist/server/shared/playgroundUrl.d.ts +2 -0
- package/dist/server/shared/playgroundUrl.js +6 -0
- package/dist/server/shared/requirePluginModule.d.ts +2 -0
- package/dist/server/shared/requirePluginModule.js +10 -0
- package/dist/server/shared/resolveUrlPath.d.ts +1 -0
- package/dist/server/shared/resolveUrlPath.js +12 -0
- package/dist/server/shared/staticPath.d.ts +1 -0
- package/dist/server/shared/staticPath.js +4 -0
- package/dist/{shared/static.d.ts → server/shared/staticServer.d.ts} +0 -1
- package/dist/server/shared/staticServer.js +12 -0
- package/dist/{shared → server}/static/index.html +1 -1
- package/dist/server/testHelpers/cwd.d.ts +1 -0
- package/dist/server/testHelpers/cwd.js +4 -0
- package/dist/server/testHelpers/mockConsole.d.ts +5 -0
- package/dist/server/testHelpers/mockConsole.js +11 -0
- package/dist/server/testHelpers/mockEsmRequire.js +13 -0
- package/dist/server/testHelpers/mockEsmResolve.d.ts +1 -0
- package/dist/server/testHelpers/mockEsmResolve.js +13 -0
- package/dist/server/testHelpers/mockEsmStaticPath.d.ts +1 -0
- package/dist/server/testHelpers/mockEsmStaticPath.js +7 -0
- package/dist/server/testHelpers/mockFetch.d.ts +2 -0
- package/dist/server/testHelpers/mockFetch.js +7 -0
- package/dist/server/testHelpers/mockFs.d.ts +5 -0
- package/dist/server/testHelpers/mockFs.js +64 -0
- package/dist/server/testHelpers/mockYargs.d.ts +2 -0
- package/dist/server/testHelpers/mockYargs.js +21 -0
- package/dist/{userDeps → server/userDeps}/findUserModulePaths.d.ts +2 -2
- package/dist/server/userDeps/findUserModulePaths.js +20 -0
- package/dist/server/userDeps/fixtureWatcher.d.ts +3 -0
- package/dist/server/userDeps/fixtureWatcher.js +20 -0
- package/dist/{userDeps → server/userDeps}/generateUserDepsModule.d.ts +3 -3
- package/dist/server/userDeps/generateUserDepsModule.js +18 -0
- package/dist/{userDeps → server/userDeps}/getUserModules.d.ts +3 -3
- package/dist/server/userDeps/getUserModules.js +25 -0
- package/dist/{userDeps → server/userDeps}/shared.d.ts +1 -1
- package/dist/server/userDeps/shared.js +20 -0
- package/dist/{userDeps → server/userDeps}/userDepsTemplate.d.ts +2 -2
- package/dist/server/userDeps/userDepsTemplate.js +49 -0
- package/dist/server/utils/cli.js +4 -0
- package/dist/server/utils/fs.d.ts +4 -0
- package/dist/server/utils/fs.js +24 -0
- package/dist/server/utils/isNodeError.d.ts +2 -0
- package/dist/server/utils/isNodeError.js +3 -0
- package/dist/server/utils/requireModule.d.ts +2 -0
- package/dist/server/utils/requireModule.js +13 -0
- package/dist/server/utils/requireSilent.d.ts +1 -0
- package/dist/server/utils/requireSilent.js +11 -0
- package/dist/server/utils/resolve.d.ts +2 -0
- package/dist/server/utils/resolve.js +14 -0
- package/dist/server/utils/resolveLoose.d.ts +1 -0
- package/dist/server/utils/resolveLoose.js +12 -0
- package/dist/server/utils/resolveSilent.d.ts +2 -0
- package/dist/server/utils/resolveSilent.js +22 -0
- package/dist/server/utils/slash.d.ts +1 -0
- package/dist/server/utils/slash.js +5 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.js +20 -0
- package/index.d.ts +1 -1
- package/index.js +1 -2
- package/jest.d.ts +1 -0
- package/jest.js +1 -0
- package/package.json +17 -28
- package/server.d.ts +1 -0
- package/server.js +1 -0
- package/dist/config/createCosmosConfig.js +0 -133
- package/dist/config/detectCosmosConfig.d.ts +0 -2
- package/dist/config/detectCosmosConfig.js +0 -57
- package/dist/config/getCosmosConfigAtPath.js +0 -28
- package/dist/config/resolveModule.d.ts +0 -1
- package/dist/config/resolveModule.js +0 -20
- package/dist/config/shared.js +0 -17
- package/dist/devServer/app.d.ts +0 -5
- package/dist/devServer/app.js +0 -51
- package/dist/devServer/httpServer.d.ts +0 -11
- package/dist/devServer/httpServer.js +0 -183
- package/dist/devServer/messageHandler.js +0 -42
- package/dist/devServer/startDevServer.d.ts +0 -18
- package/dist/devServer/startDevServer.js +0 -209
- package/dist/dom/DomFixtureLoader.d.ts +0 -9
- package/dist/dom/DomFixtureLoader.js +0 -38
- package/dist/dom/ErrorCatch.d.ts +0 -15
- package/dist/dom/ErrorCatch.js +0 -117
- package/dist/dom/container.d.ts +0 -1
- package/dist/dom/container.js +0 -32
- package/dist/dom/globalErrorHandler.js +0 -14
- package/dist/dom/index.d.ts +0 -13
- package/dist/dom/index.js +0 -47
- package/dist/dom/renderMessage.d.ts +0 -4
- package/dist/dom/renderMessage.js +0 -30
- package/dist/dom/rendererConnect.d.ts +0 -1
- package/dist/dom/rendererConnect.js +0 -18
- package/dist/dom/rendererId.d.ts +0 -1
- package/dist/dom/rendererId.js +0 -26
- package/dist/dom/selectedFixtureId.d.ts +0 -2
- package/dist/dom/selectedFixtureId.js +0 -41
- package/dist/dom/shared.d.ts +0 -1
- package/dist/dom/shared.js +0 -14
- package/dist/export/generateExport.d.ts +0 -6
- package/dist/export/generateExport.js +0 -137
- package/dist/fixture.d.ts +0 -1
- package/dist/fixture.js +0 -31
- package/dist/generateWebExport.d.ts +0 -1
- package/dist/generateWebExport.js +0 -37
- package/dist/getFixtureUrls.d.ts +0 -8
- package/dist/getFixtureUrls.js +0 -97
- package/dist/getFixtures.d.ts +0 -13
- package/dist/getFixtures.js +0 -89
- package/dist/getFixtures2.d.ts +0 -14
- package/dist/getFixtures2.js +0 -117
- package/dist/native/NativeFixtureLoader.d.ts +0 -12
- package/dist/native/NativeFixtureLoader.js +0 -67
- package/dist/native/index.d.ts +0 -1
- package/dist/native/index.js +0 -25
- package/dist/plugins/httpProxy.d.ts +0 -2
- package/dist/plugins/httpProxy.js +0 -31
- package/dist/plugins/openFile.d.ts +0 -2
- package/dist/plugins/openFile.js +0 -87
- package/dist/plugins/userDepsFile.d.ts +0 -2
- package/dist/plugins/userDepsFile.js +0 -166
- package/dist/plugins/webpack/client/errorOverlay/index.d.ts +0 -1
- package/dist/plugins/webpack/client/errorOverlay/index.js +0 -16
- package/dist/plugins/webpack/client/errorOverlay/reactErrorOverlay.d.ts +0 -2
- package/dist/plugins/webpack/client/errorOverlay/reactErrorOverlay.js +0 -63
- package/dist/plugins/webpack/client/hmrErrorHandler.js +0 -16
- package/dist/plugins/webpack/client/index.d.ts +0 -6
- package/dist/plugins/webpack/client/index.js +0 -43
- package/dist/plugins/webpack/client/reactDevtoolsHook.d.ts +0 -0
- package/dist/plugins/webpack/client/reactDevtoolsHook.js +0 -19
- package/dist/plugins/webpack/client/userDeps.d.ts +0 -5
- package/dist/plugins/webpack/client/userDeps.js +0 -15
- package/dist/plugins/webpack/cosmosConfig/dom.d.ts +0 -6
- package/dist/plugins/webpack/cosmosConfig/dom.js +0 -19
- package/dist/plugins/webpack/cosmosConfig/webpack.d.ts +0 -10
- package/dist/plugins/webpack/cosmosConfig/webpack.js +0 -95
- package/dist/plugins/webpack/devServer.d.ts +0 -2
- package/dist/plugins/webpack/devServer.js +0 -168
- package/dist/plugins/webpack/export.d.ts +0 -2
- package/dist/plugins/webpack/export.js +0 -139
- package/dist/plugins/webpack/index.d.ts +0 -2
- package/dist/plugins/webpack/index.js +0 -21
- package/dist/plugins/webpack/shared.d.ts +0 -2
- package/dist/plugins/webpack/shared.js +0 -22
- package/dist/plugins/webpack/webpackConfig/getDefaultWebpackConfig.d.ts +0 -2
- package/dist/plugins/webpack/webpackConfig/getDefaultWebpackConfig.js +0 -152
- package/dist/plugins/webpack/webpackConfig/getDevWebpackConfig.d.ts +0 -3
- package/dist/plugins/webpack/webpackConfig/getDevWebpackConfig.js +0 -146
- package/dist/plugins/webpack/webpackConfig/getExportWebpackConfig.d.ts +0 -3
- package/dist/plugins/webpack/webpackConfig/getExportWebpackConfig.js +0 -111
- package/dist/plugins/webpack/webpackConfig/getUserWebpackConfig.d.ts +0 -3
- package/dist/plugins/webpack/webpackConfig/getUserWebpackConfig.js +0 -136
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigModule.d.ts +0 -2
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigModule.js +0 -45
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigResolve.d.ts +0 -4
- package/dist/plugins/webpack/webpackConfig/getWebpackConfigResolve.js +0 -107
- package/dist/plugins/webpack/webpackConfig/getWebpackNodeEnv.d.ts +0 -1
- package/dist/plugins/webpack/webpackConfig/getWebpackNodeEnv.js +0 -12
- package/dist/plugins/webpack/webpackConfig/htmlPlugin.d.ts +0 -16
- package/dist/plugins/webpack/webpackConfig/htmlPlugin.js +0 -80
- package/dist/plugins/webpack/webpackConfig/plugins.d.ts +0 -5
- package/dist/plugins/webpack/webpackConfig/plugins.js +0 -37
- package/dist/plugins/webpack/webpackConfig/resolveWebpackClientPath.d.ts +0 -1
- package/dist/plugins/webpack/webpackConfig/resolveWebpackClientPath.js +0 -10
- package/dist/plugins/webpack/webpackConfig/userDepsLoader.js +0 -36
- package/dist/shared/cli.js +0 -14
- package/dist/shared/fs.d.ts +0 -4
- package/dist/shared/fs.js +0 -37
- package/dist/shared/playgroundHtml.d.ts +0 -6
- package/dist/shared/playgroundHtml.js +0 -116
- package/dist/shared/pluginConfigs.d.ts +0 -2
- package/dist/shared/pluginConfigs.js +0 -15
- package/dist/shared/rendererConfig.d.ts +0 -6
- package/dist/shared/rendererConfig.js +0 -5
- package/dist/shared/static.js +0 -30
- package/dist/shared/types.d.ts +0 -1
- package/dist/shared/types.js +0 -5
- package/dist/shared/utils.d.ts +0 -5
- package/dist/shared/utils.js +0 -22
- package/dist/startNativeServer.d.ts +0 -1
- package/dist/startNativeServer.js +0 -39
- package/dist/startWebServer.d.ts +0 -1
- package/dist/startWebServer.js +0 -43
- package/dist/userDeps/findUserModulePaths.js +0 -45
- package/dist/userDeps/generateUserDepsModule.js +0 -37
- package/dist/userDeps/getUserModules.js +0 -45
- package/dist/userDeps/shared.js +0 -32
- package/dist/userDeps/userDepsTemplate.js +0 -52
- package/dom.d.ts +0 -1
- package/dom.js +0 -2
- package/fixture.d.ts +0 -1
- package/fixture.js +0 -2
- package/native.d.ts +0 -1
- package/native.js +0 -2
- package/yarn-error.log +0 -13450
- /package/dist/{dom/globalErrorHandler.d.ts → server/cosmosConfig/types.js} +0 -0
- /package/dist/{plugins/webpack/client/hmrErrorHandler.d.ts → server/cosmosPlugin/types.js} +0 -0
- /package/dist/{shared → server}/static/favicon.ico +0 -0
- /package/dist/{plugins/webpack/webpackConfig/userDepsLoader.d.ts → server/testHelpers/mockEsmRequire.d.ts} +0 -0
- /package/dist/{shared → server/utils}/cli.d.ts +0 -0
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateExport = generateExport;
|
|
7
|
-
|
|
8
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
9
|
-
|
|
10
|
-
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
|
|
12
|
-
var _detectCosmosConfig = require("../config/detectCosmosConfig");
|
|
13
|
-
|
|
14
|
-
var _playgroundHtml = require("../shared/playgroundHtml");
|
|
15
|
-
|
|
16
|
-
var _pluginConfigs = require("../shared/pluginConfigs");
|
|
17
|
-
|
|
18
|
-
var _static = require("../shared/static");
|
|
19
|
-
|
|
20
|
-
var _utils = require("../shared/utils");
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
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); } }
|
|
25
|
-
|
|
26
|
-
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); }); }; }
|
|
27
|
-
|
|
28
|
-
function generateExport() {
|
|
29
|
-
return _generateExport.apply(this, arguments);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _generateExport() {
|
|
33
|
-
_generateExport = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
34
|
-
var plugins,
|
|
35
|
-
cosmosConfig,
|
|
36
|
-
exportPath,
|
|
37
|
-
_args = arguments;
|
|
38
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) {
|
|
40
|
-
switch (_context.prev = _context.next) {
|
|
41
|
-
case 0:
|
|
42
|
-
plugins = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
43
|
-
cosmosConfig = (0, _detectCosmosConfig.detectCosmosConfig)(); // Clear previous export (or other files at export path)
|
|
44
|
-
|
|
45
|
-
exportPath = cosmosConfig.exportPath;
|
|
46
|
-
|
|
47
|
-
_fsExtra.default.removeSync(exportPath); // Copy static assets first, so that the built index.html overrides the its
|
|
48
|
-
// template file (in case the static assets are served from the root path)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
copyStaticAssets(cosmosConfig);
|
|
52
|
-
_context.next = 7;
|
|
53
|
-
return Promise.all(plugins.map(function (plugin) {
|
|
54
|
-
return plugin({
|
|
55
|
-
cosmosConfig: cosmosConfig
|
|
56
|
-
});
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
case 7:
|
|
60
|
-
exportPlaygroundFiles(cosmosConfig);
|
|
61
|
-
console.log('[Cosmos] Export complete!');
|
|
62
|
-
console.log("Export path: ".concat(cosmosConfig.exportPath));
|
|
63
|
-
|
|
64
|
-
case 10:
|
|
65
|
-
case "end":
|
|
66
|
-
return _context.stop();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, _callee);
|
|
70
|
-
}));
|
|
71
|
-
return _generateExport.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function copyStaticAssets(cosmosConfig) {
|
|
75
|
-
var staticPath = cosmosConfig.staticPath;
|
|
76
|
-
|
|
77
|
-
if (!staticPath) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var exportPath = cosmosConfig.exportPath;
|
|
82
|
-
|
|
83
|
-
if (exportPath.indexOf(staticPath) !== -1) {
|
|
84
|
-
console.warn("[Cosmos] Warning: Can't export static path because it contains the export path! (avoiding infinite loop)");
|
|
85
|
-
console.warn('Public path:', staticPath);
|
|
86
|
-
console.warn('Export path:', exportPath);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (!_fsExtra.default.existsSync(staticPath)) {
|
|
91
|
-
console.log('[Cosmos] Warning: config.staticPath points to missing dir', staticPath);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var publicUrl = cosmosConfig.publicUrl;
|
|
96
|
-
|
|
97
|
-
var exportStaticPath = _path.default.resolve(exportPath, (0, _utils.removeLeadingSlash)(publicUrl));
|
|
98
|
-
|
|
99
|
-
_fsExtra.default.copySync(staticPath, exportStaticPath);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function exportPlaygroundFiles(cosmosConfig) {
|
|
103
|
-
var exportPath = cosmosConfig.exportPath;
|
|
104
|
-
var pluginConfigs = (0, _pluginConfigs.getPluginConfigs)(cosmosConfig);
|
|
105
|
-
pluginConfigs.forEach(function (pluginConfig) {
|
|
106
|
-
return exportPlugin(cosmosConfig, pluginConfig);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
_fsExtra.default.copySync(require.resolve('react-cosmos-playground2/dist'), _path.default.resolve(exportPath, '_playground.js'));
|
|
110
|
-
|
|
111
|
-
_fsExtra.default.copySync((0, _static.getStaticPath)('favicon.ico'), _path.default.resolve(exportPath, '_cosmos.ico'));
|
|
112
|
-
|
|
113
|
-
var playgroundHtml = (0, _playgroundHtml.getExportPlaygroundHtml)(cosmosConfig, pluginConfigs);
|
|
114
|
-
|
|
115
|
-
_fsExtra.default.writeFileSync(_path.default.resolve(exportPath, 'index.html'), playgroundHtml);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function exportPlugin(cosmosConfig, pluginConfig) {
|
|
119
|
-
var rootDir = cosmosConfig.rootDir,
|
|
120
|
-
exportPath = cosmosConfig.exportPath;
|
|
121
|
-
|
|
122
|
-
var pluginExportDir = _path.default.resolve(exportPath, '_plugin'); // Copy plugin config
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var relConfigPath = _path.default.join(pluginConfig.rootDir, 'cosmos.plugin.json');
|
|
126
|
-
|
|
127
|
-
var absConfigPath = _path.default.resolve(rootDir, relConfigPath);
|
|
128
|
-
|
|
129
|
-
_fsExtra.default.copySync(absConfigPath, _path.default.resolve(pluginExportDir, relConfigPath)); // Copy UI script
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (pluginConfig.ui) {
|
|
133
|
-
var absUiPath = _path.default.resolve(rootDir, pluginConfig.ui);
|
|
134
|
-
|
|
135
|
-
_fsExtra.default.copySync(absUiPath, _path.default.resolve(pluginExportDir, pluginConfig.ui));
|
|
136
|
-
}
|
|
137
|
-
}
|
package/dist/fixture.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { FixtureContext, useSelect, useValue, Viewport, } from 'react-cosmos-shared2/FixtureLoader';
|
package/dist/fixture.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "FixtureContext", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _FixtureLoader.FixtureContext;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "Viewport", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _FixtureLoader.Viewport;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "useSelect", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _FixtureLoader.useSelect;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "useValue", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _FixtureLoader.useValue;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
var _FixtureLoader = require("react-cosmos-shared2/FixtureLoader");
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateWebExport(): Promise<void>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateWebExport = generateWebExport;
|
|
7
|
-
|
|
8
|
-
var _generateExport = require("./export/generateExport");
|
|
9
|
-
|
|
10
|
-
var _webpack = require("./plugins/webpack");
|
|
11
|
-
|
|
12
|
-
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); } }
|
|
13
|
-
|
|
14
|
-
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); }); }; }
|
|
15
|
-
|
|
16
|
-
function generateWebExport() {
|
|
17
|
-
return _generateWebExport.apply(this, arguments);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _generateWebExport() {
|
|
21
|
-
_generateWebExport = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
22
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
|
-
while (1) {
|
|
24
|
-
switch (_context.prev = _context.next) {
|
|
25
|
-
case 0:
|
|
26
|
-
_context.next = 2;
|
|
27
|
-
return (0, _generateExport.generateExport)([_webpack.webpackExport]);
|
|
28
|
-
|
|
29
|
-
case 2:
|
|
30
|
-
case "end":
|
|
31
|
-
return _context.stop();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, _callee);
|
|
35
|
-
}));
|
|
36
|
-
return _generateWebExport.apply(this, arguments);
|
|
37
|
-
}
|
package/dist/getFixtureUrls.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CosmosConfig } from './config/shared';
|
|
2
|
-
declare type Args = {
|
|
3
|
-
cosmosConfig: CosmosConfig;
|
|
4
|
-
fullScreen?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare const getFixtureUrls: (args: Args) => Promise<string[]>;
|
|
7
|
-
export declare function getFixtureUrlsSync({ cosmosConfig, fullScreen }: Args): string[];
|
|
8
|
-
export {};
|
package/dist/getFixtureUrls.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getFixtureUrls = void 0;
|
|
7
|
-
exports.getFixtureUrlsSync = getFixtureUrlsSync;
|
|
8
|
-
|
|
9
|
-
var _react = require("react-cosmos-shared2/react");
|
|
10
|
-
|
|
11
|
-
var _url = require("react-cosmos-shared2/url");
|
|
12
|
-
|
|
13
|
-
var _playgroundHtml = require("./shared/playgroundHtml");
|
|
14
|
-
|
|
15
|
-
var _getUserModules2 = require("./userDeps/getUserModules");
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
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); }); }; }
|
|
20
|
-
|
|
21
|
-
var getFixtureUrls = /*#__PURE__*/function () {
|
|
22
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) {
|
|
23
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
|
-
while (1) {
|
|
25
|
-
switch (_context.prev = _context.next) {
|
|
26
|
-
case 0:
|
|
27
|
-
return _context.abrupt("return", getFixtureUrlsSync(args));
|
|
28
|
-
|
|
29
|
-
case 1:
|
|
30
|
-
case "end":
|
|
31
|
-
return _context.stop();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, _callee);
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
return function getFixtureUrls(_x) {
|
|
38
|
-
return _ref.apply(this, arguments);
|
|
39
|
-
};
|
|
40
|
-
}();
|
|
41
|
-
|
|
42
|
-
exports.getFixtureUrls = getFixtureUrls;
|
|
43
|
-
|
|
44
|
-
function getFixtureUrlsSync(_ref2) {
|
|
45
|
-
var cosmosConfig = _ref2.cosmosConfig,
|
|
46
|
-
_ref2$fullScreen = _ref2.fullScreen,
|
|
47
|
-
fullScreen = _ref2$fullScreen === void 0 ? false : _ref2$fullScreen;
|
|
48
|
-
var host = getPlaygroundHost(cosmosConfig);
|
|
49
|
-
var fixtureUrls = [];
|
|
50
|
-
|
|
51
|
-
function pushFixtureUrl(fixtureId) {
|
|
52
|
-
fixtureUrls.push(createFixtureUrl(host, fixtureId, fullScreen));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var _getUserModules = (0, _getUserModules2.getUserModules)(cosmosConfig),
|
|
56
|
-
fixtures = _getUserModules.fixtures;
|
|
57
|
-
|
|
58
|
-
var fixtureList = (0, _react.getFixtureListFromExports)(fixtures);
|
|
59
|
-
Object.keys(fixtureList).forEach(function (fixturePath) {
|
|
60
|
-
var fixtureItem = fixtureList[fixturePath];
|
|
61
|
-
|
|
62
|
-
if (fixtureItem.type === 'single') {
|
|
63
|
-
pushFixtureUrl({
|
|
64
|
-
path: fixturePath
|
|
65
|
-
});
|
|
66
|
-
} else if (fixtureItem.type === 'multi') {
|
|
67
|
-
fixtureItem.fixtureNames.forEach(function (fixtureName) {
|
|
68
|
-
pushFixtureUrl({
|
|
69
|
-
path: fixturePath,
|
|
70
|
-
name: fixtureName
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return fixtureUrls;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function createFixtureUrl(host, fixtureId, fullScreen) {
|
|
79
|
-
if (fullScreen) {
|
|
80
|
-
var _query = (0, _url.stringifyRendererUrlQuery)({
|
|
81
|
-
_fixtureId: fixtureId
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return "".concat(host, "/").concat(_playgroundHtml.RENDERER_FILENAME, "?").concat(_query);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var query = (0, _url.stringifyPlaygroundUrlQuery)({
|
|
88
|
-
fixtureId: fixtureId
|
|
89
|
-
});
|
|
90
|
-
return "".concat(host, "/?").concat(query);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function getPlaygroundHost(_ref3) {
|
|
94
|
-
var hostname = _ref3.hostname,
|
|
95
|
-
port = _ref3.port;
|
|
96
|
-
return "".concat(hostname || 'localhost', ":").concat(port);
|
|
97
|
-
}
|
package/dist/getFixtures.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FixtureId } from 'react-cosmos-shared2/renderer';
|
|
3
|
-
import { CosmosConfig } from './config/shared';
|
|
4
|
-
declare type Args = {
|
|
5
|
-
cosmosConfig: CosmosConfig;
|
|
6
|
-
};
|
|
7
|
-
declare type RenderableFixture = {
|
|
8
|
-
fixtureId: FixtureId;
|
|
9
|
-
getElement: () => React.ReactElement<any>;
|
|
10
|
-
};
|
|
11
|
-
export declare const getFixtures: (args: Args) => Promise<RenderableFixture[]>;
|
|
12
|
-
export declare function getFixturesSync({ cosmosConfig }: Args): RenderableFixture[];
|
|
13
|
-
export {};
|
package/dist/getFixtures.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getFixtures = void 0;
|
|
7
|
-
exports.getFixturesSync = getFixturesSync;
|
|
8
|
-
|
|
9
|
-
var _FixtureLoader = require("react-cosmos-shared2/FixtureLoader");
|
|
10
|
-
|
|
11
|
-
var _react = require("react-cosmos-shared2/react");
|
|
12
|
-
|
|
13
|
-
var _getUserModules2 = require("./userDeps/getUserModules");
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
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); }); }; }
|
|
18
|
-
|
|
19
|
-
var getFixtures = /*#__PURE__*/function () {
|
|
20
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) {
|
|
21
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
-
while (1) {
|
|
23
|
-
switch (_context.prev = _context.next) {
|
|
24
|
-
case 0:
|
|
25
|
-
return _context.abrupt("return", getFixturesSync(args));
|
|
26
|
-
|
|
27
|
-
case 1:
|
|
28
|
-
case "end":
|
|
29
|
-
return _context.stop();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}, _callee);
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
return function getFixtures(_x) {
|
|
36
|
-
return _ref.apply(this, arguments);
|
|
37
|
-
};
|
|
38
|
-
}();
|
|
39
|
-
|
|
40
|
-
exports.getFixtures = getFixtures;
|
|
41
|
-
|
|
42
|
-
function getFixturesSync(_ref2) {
|
|
43
|
-
var cosmosConfig = _ref2.cosmosConfig;
|
|
44
|
-
|
|
45
|
-
var _getUserModules = (0, _getUserModules2.getUserModules)(cosmosConfig),
|
|
46
|
-
fixtures = _getUserModules.fixtures,
|
|
47
|
-
decorators = _getUserModules.decorators;
|
|
48
|
-
|
|
49
|
-
var result = [];
|
|
50
|
-
Object.keys(fixtures).forEach(function (fixturePath) {
|
|
51
|
-
var fixtureExport = fixtures[fixturePath];
|
|
52
|
-
|
|
53
|
-
if ((0, _react.isMultiFixture)(fixtureExport)) {
|
|
54
|
-
// FIXME: Why does fixtureExport need to be cast as ReactFixtureMap when
|
|
55
|
-
// the type predicate returned by isMultiFixture already ensures it?
|
|
56
|
-
var multiFixtureExport = fixtureExport;
|
|
57
|
-
Object.keys(fixtureExport).forEach(function (fixtureName) {
|
|
58
|
-
var fixtureId = {
|
|
59
|
-
path: fixturePath,
|
|
60
|
-
name: fixtureName
|
|
61
|
-
};
|
|
62
|
-
result.push({
|
|
63
|
-
fixtureId: fixtureId,
|
|
64
|
-
getElement: createFixtureElementGetter(multiFixtureExport[fixtureName], fixturePath, decorators)
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
var fixtureId = {
|
|
69
|
-
path: fixturePath
|
|
70
|
-
};
|
|
71
|
-
result.push({
|
|
72
|
-
fixtureId: fixtureId,
|
|
73
|
-
getElement: createFixtureElementGetter(fixtureExport, fixturePath, decorators)
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function createFixtureElementGetter(fixture, fixturePath, decoratorsByPath) {
|
|
81
|
-
var decorators = (0, _react.getSortedDecoratorsForFixturePath)(fixturePath, decoratorsByPath);
|
|
82
|
-
return function () {
|
|
83
|
-
return (0, _FixtureLoader.getDecoratedFixtureElement)(fixture, decorators, {
|
|
84
|
-
fixtureState: {},
|
|
85
|
-
setFixtureState: function setFixtureState() {},
|
|
86
|
-
onErrorReset: function onErrorReset() {}
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
}
|
package/dist/getFixtures2.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CosmosConfig } from './config/shared';
|
|
3
|
-
export declare type FixtureApi = {
|
|
4
|
-
absoluteFilePath: string;
|
|
5
|
-
fileName: string;
|
|
6
|
-
getElement: () => React.ReactElement<any>;
|
|
7
|
-
name: string | null;
|
|
8
|
-
parents: string[];
|
|
9
|
-
playgroundUrl: string;
|
|
10
|
-
relativeFilePath: string;
|
|
11
|
-
rendererUrl: string;
|
|
12
|
-
treePath: string[];
|
|
13
|
-
};
|
|
14
|
-
export declare function getFixtures2(cosmosConfig: CosmosConfig): FixtureApi[];
|
package/dist/getFixtures2.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getFixtures2 = getFixtures2;
|
|
7
|
-
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
-
var _FixtureLoader = require("react-cosmos-shared2/FixtureLoader");
|
|
11
|
-
|
|
12
|
-
var _fixtureTree = require("react-cosmos-shared2/fixtureTree");
|
|
13
|
-
|
|
14
|
-
var _react = require("react-cosmos-shared2/react");
|
|
15
|
-
|
|
16
|
-
var _url = require("react-cosmos-shared2/url");
|
|
17
|
-
|
|
18
|
-
var _url2 = _interopRequireDefault(require("url"));
|
|
19
|
-
|
|
20
|
-
var _playgroundHtml = require("./shared/playgroundHtml");
|
|
21
|
-
|
|
22
|
-
var _getUserModules2 = require("./userDeps/getUserModules");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
27
|
-
|
|
28
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
-
|
|
30
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
-
|
|
32
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
-
|
|
34
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
35
|
-
|
|
36
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
-
|
|
38
|
-
function getFixtures2(cosmosConfig) {
|
|
39
|
-
var fixturesDir = cosmosConfig.fixturesDir,
|
|
40
|
-
fixtureFileSuffix = cosmosConfig.fixtureFileSuffix,
|
|
41
|
-
rootDir = cosmosConfig.rootDir;
|
|
42
|
-
var fixtureInfo = [];
|
|
43
|
-
|
|
44
|
-
var _getUserModules = (0, _getUserModules2.getUserModules)(cosmosConfig),
|
|
45
|
-
fixtures = _getUserModules.fixtures,
|
|
46
|
-
decorators = _getUserModules.decorators;
|
|
47
|
-
|
|
48
|
-
var fixtureList = (0, _react.getFixtureListFromExports)(fixtures);
|
|
49
|
-
var fixtureTree = (0, _fixtureTree.createFixtureTree)({
|
|
50
|
-
fixtures: fixtureList,
|
|
51
|
-
fixturesDir: fixturesDir,
|
|
52
|
-
fixtureFileSuffix: fixtureFileSuffix
|
|
53
|
-
});
|
|
54
|
-
var flatFixtureTree = (0, _fixtureTree.flattenFixtureTree)(fixtureTree);
|
|
55
|
-
flatFixtureTree.forEach(function (_ref) {
|
|
56
|
-
var fileName = _ref.fileName,
|
|
57
|
-
fixtureId = _ref.fixtureId,
|
|
58
|
-
name = _ref.name,
|
|
59
|
-
parents = _ref.parents;
|
|
60
|
-
var fixtureExport = fixtures[fixtureId.path];
|
|
61
|
-
var fixture = fixtureId.name === undefined ? fixtureExport : fixtureExport[fixtureId.name];
|
|
62
|
-
var treePath = [].concat(_toConsumableArray(parents), [fileName]);
|
|
63
|
-
if (name) treePath.push(name);
|
|
64
|
-
fixtureInfo.push({
|
|
65
|
-
absoluteFilePath: _path.default.join(rootDir, fixtureId.path),
|
|
66
|
-
fileName: fileName,
|
|
67
|
-
getElement: createFixtureElementGetter(fixture, fixtureId.path, decorators),
|
|
68
|
-
name: name,
|
|
69
|
-
parents: parents,
|
|
70
|
-
playgroundUrl: getPlaygroundUrl(cosmosConfig, fixtureId),
|
|
71
|
-
relativeFilePath: fixtureId.path,
|
|
72
|
-
rendererUrl: getRendererUrl(cosmosConfig, fixtureId),
|
|
73
|
-
treePath: treePath
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
return fixtureInfo;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function getPlaygroundUrl(cosmosConfig, fixtureId) {
|
|
80
|
-
var host = getPlaygroundHost(cosmosConfig);
|
|
81
|
-
var query = (0, _url.stringifyPlaygroundUrlQuery)({
|
|
82
|
-
fixtureId: fixtureId
|
|
83
|
-
});
|
|
84
|
-
return "".concat(host, "/?").concat(query);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function getRendererUrl(cosmosConfig, fixtureId) {
|
|
88
|
-
var publicUrl = cosmosConfig.publicUrl,
|
|
89
|
-
experimentalRendererUrl = cosmosConfig.experimentalRendererUrl;
|
|
90
|
-
var query = (0, _url.stringifyRendererUrlQuery)({
|
|
91
|
-
_fixtureId: fixtureId
|
|
92
|
-
});
|
|
93
|
-
if (experimentalRendererUrl) return "".concat(experimentalRendererUrl, "?").concat(query);
|
|
94
|
-
var host = getPlaygroundHost(cosmosConfig);
|
|
95
|
-
|
|
96
|
-
var urlPath = _url2.default.resolve(publicUrl, _playgroundHtml.RENDERER_FILENAME);
|
|
97
|
-
|
|
98
|
-
return "".concat(host).concat(urlPath, "?").concat(query);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function getPlaygroundHost(_ref2) {
|
|
102
|
-
var hostname = _ref2.hostname,
|
|
103
|
-
port = _ref2.port,
|
|
104
|
-
https = _ref2.https;
|
|
105
|
-
return "".concat(https ? 'https' : 'http', "://").concat(hostname || 'localhost', ":").concat(port);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function createFixtureElementGetter(fixture, fixturePath, decoratorsByPath) {
|
|
109
|
-
var decorators = (0, _react.getSortedDecoratorsForFixturePath)(fixturePath, decoratorsByPath);
|
|
110
|
-
return function () {
|
|
111
|
-
return (0, _FixtureLoader.getDecoratedFixtureElement)(fixture, decorators, {
|
|
112
|
-
fixtureState: {},
|
|
113
|
-
setFixtureState: function setFixtureState() {},
|
|
114
|
-
onErrorReset: function onErrorReset() {}
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ReactDecorators, ReactFixtureWrappers } from 'react-cosmos-shared2/react';
|
|
3
|
-
import { FixtureId } from 'react-cosmos-shared2/renderer';
|
|
4
|
-
import { NativeRendererConfig } from '../shared/rendererConfig';
|
|
5
|
-
declare type Props = {
|
|
6
|
-
rendererConfig: NativeRendererConfig;
|
|
7
|
-
fixtures: ReactFixtureWrappers;
|
|
8
|
-
decorators: ReactDecorators;
|
|
9
|
-
initialFixtureId?: FixtureId;
|
|
10
|
-
};
|
|
11
|
-
export declare function NativeFixtureLoader({ rendererConfig: { port }, fixtures, decorators, initialFixtureId, }: Props): JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.NativeFixtureLoader = NativeFixtureLoader;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _FixtureLoader = require("react-cosmos-shared2/FixtureLoader");
|
|
13
|
-
|
|
14
|
-
var ReactNative = _interopRequireWildcard(require("react-native"));
|
|
15
|
-
|
|
16
|
-
var _urlParse = _interopRequireDefault(require("url-parse"));
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
var View = ReactNative.View,
|
|
25
|
-
Text = ReactNative.Text,
|
|
26
|
-
StyleSheet = ReactNative.StyleSheet,
|
|
27
|
-
NativeModules = ReactNative.NativeModules; // TODO: Generate unique ID per device
|
|
28
|
-
|
|
29
|
-
var rendererId = 'native-renderer';
|
|
30
|
-
|
|
31
|
-
function NativeFixtureLoader(_ref) {
|
|
32
|
-
var port = _ref.rendererConfig.port,
|
|
33
|
-
fixtures = _ref.fixtures,
|
|
34
|
-
decorators = _ref.decorators,
|
|
35
|
-
initialFixtureId = _ref.initialFixtureId;
|
|
36
|
-
var socketUrl = getSocketUrl(port);
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(_FixtureLoader.FixtureLoader, {
|
|
38
|
-
rendererId: rendererId,
|
|
39
|
-
rendererConnect: (0, _FixtureLoader.createWebSocketsConnect)(socketUrl),
|
|
40
|
-
fixtures: fixtures,
|
|
41
|
-
initialFixtureId: initialFixtureId,
|
|
42
|
-
systemDecorators: [],
|
|
43
|
-
userDecorators: decorators,
|
|
44
|
-
renderMessage: renderMessage
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getSocketUrl(port) {
|
|
49
|
-
var host = (0, _urlParse.default)(NativeModules.SourceCode.scriptURL).hostname;
|
|
50
|
-
return "ws://".concat(host, ":").concat(port);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function renderMessage(_ref2) {
|
|
54
|
-
var msg = _ref2.msg;
|
|
55
|
-
return /*#__PURE__*/_react.default.createElement(View, {
|
|
56
|
-
style: styles.container
|
|
57
|
-
}, /*#__PURE__*/_react.default.createElement(Text, null, msg));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var styles = StyleSheet.create({
|
|
61
|
-
container: {
|
|
62
|
-
flex: 1,
|
|
63
|
-
backgroundColor: '#fff',
|
|
64
|
-
alignItems: 'center',
|
|
65
|
-
justifyContent: 'center'
|
|
66
|
-
}
|
|
67
|
-
});
|
package/dist/native/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NativeFixtureLoader } from './NativeFixtureLoader';
|
package/dist/native/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports, "NativeFixtureLoader", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _NativeFixtureLoader.NativeFixtureLoader;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
var ReactNative = _interopRequireWildcard(require("react-native"));
|
|
16
|
-
|
|
17
|
-
var _NativeFixtureLoader = require("./NativeFixtureLoader");
|
|
18
|
-
|
|
19
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
-
|
|
21
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
-
|
|
23
|
-
// https://stackoverflow.com/a/53655887/128816
|
|
24
|
-
var wsWarning = 'Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?';
|
|
25
|
-
if (ReactNative.LogBox) ReactNative.LogBox.ignoreLogs([wsWarning]);else if (ReactNative.YellowBox) ReactNative.YellowBox.ignoreWarnings([wsWarning]);
|