react-cosmos 5.6.7 → 5.7.2
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 +1 -1
- package/bin/cosmos-native.js +1 -1
- package/bin/cosmos.js +1 -1
- package/dist/config/createCosmosConfig.js +2 -2
- 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 +1 -1
- 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 +3 -3
- package/dist/dom/index.d.ts +3 -3
- package/dist/{shared/export.d.ts → export/generateExport.d.ts} +1 -1
- package/dist/{shared/export.js → export/generateExport.js} +7 -7
- package/dist/{webExport.d.ts → generateWebExport.d.ts} +0 -0
- package/dist/{webExport.js → generateWebExport.js} +2 -2
- package/dist/getFixtureUrls.d.ts +1 -1
- package/dist/getFixtureUrls.js +10 -11
- package/dist/getFixtures.d.ts +1 -1
- package/dist/getFixtures.js +13 -14
- package/dist/getFixtures2.d.ts +1 -1
- package/dist/getFixtures2.js +9 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -4
- package/dist/native/NativeFixtureLoader.d.ts +12 -0
- package/dist/{native.js → native/NativeFixtureLoader.js} +4 -6
- package/dist/native/index.d.ts +1 -0
- package/dist/native/index.js +25 -0
- package/dist/plugins/httpProxy.d.ts +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/userDeps.d.ts +3 -3
- 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 +2 -2
- package/dist/plugins/webpack/webpackConfig/{default.d.ts → getDefaultWebpackConfig.d.ts} +0 -0
- package/dist/plugins/webpack/webpackConfig/{default.js → getDefaultWebpackConfig.js} +2 -2
- package/dist/plugins/webpack/webpackConfig/{devServer.d.ts → getDevWebpackConfig.d.ts} +1 -1
- package/dist/plugins/webpack/webpackConfig/{devServer.js → getDevWebpackConfig.js} +16 -15
- package/dist/plugins/webpack/webpackConfig/{export.d.ts → getExportWebpackConfig.d.ts} +1 -1
- package/dist/plugins/webpack/webpackConfig/{export.js → getExportWebpackConfig.js} +17 -16
- 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 +3 -3
- 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/playgroundHtml.d.ts +2 -2
- package/dist/shared/playgroundHtml.js +3 -3
- 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} +0 -0
- package/dist/{nativeServer.d.ts → startNativeServer.d.ts} +0 -0
- package/dist/{nativeServer.js → startNativeServer.js} +3 -3
- package/dist/{webServer.d.ts → startWebServer.d.ts} +0 -0
- package/dist/{webServer.js → startWebServer.js} +3 -3
- 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 +2 -2
- package/dist/{shared/userDeps → userDeps}/userDepsTemplate.d.ts +0 -0
- package/dist/{shared/userDeps → userDeps}/userDepsTemplate.js +1 -1
- package/package.json +4 -4
- package/dist/config/index.d.ts +0 -5
- package/dist/config/index.js +0 -51
- package/dist/native.d.ts +0 -10
- 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
|
@@ -12,7 +12,7 @@ var _lodash = require("lodash");
|
|
|
12
12
|
|
|
13
13
|
var _playgroundHtml = require("../../../shared/playgroundHtml");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _plugins = require("./plugins");
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
@@ -37,7 +37,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
37
37
|
function ensureHtmlWebackPlugin(_ref, plugins) {
|
|
38
38
|
var rootDir = _ref.rootDir;
|
|
39
39
|
|
|
40
|
-
if ((0,
|
|
40
|
+
if ((0, _plugins.hasPlugin)(plugins, 'HtmlWebpackPlugin')) {
|
|
41
41
|
return plugins.map(function (plugin) {
|
|
42
42
|
return isHtmlWebpackPlugin(plugin) ? changeHtmlPluginFilename(plugin) : plugin;
|
|
43
43
|
});
|
|
@@ -60,7 +60,7 @@ function getHtmlWebpackPlugin(rootDir) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function isHtmlWebpackPlugin(plugin) {
|
|
63
|
-
return (0,
|
|
63
|
+
return (0, _plugins.isInstanceOfWebpackPlugin)(plugin, 'HtmlWebpackPlugin');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function changeHtmlPluginFilename(htmlPlugin) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import webpack from 'webpack';
|
|
2
|
+
import { CosmosConfig } from '../../../config/shared';
|
|
3
|
+
export declare function getGlobalsPlugin({ publicUrl }: CosmosConfig, userWebpack: typeof webpack, devServerOn: boolean): webpack.DefinePlugin;
|
|
4
|
+
export declare function hasPlugin(plugins: void | webpack.WebpackPluginInstance[], pluginName: string): boolean | void;
|
|
5
|
+
export declare function isInstanceOfWebpackPlugin(plugin: webpack.WebpackPluginInstance, constructorName: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getGlobalsPlugin = getGlobalsPlugin;
|
|
7
|
+
exports.hasPlugin = hasPlugin;
|
|
8
|
+
exports.isInstanceOfWebpackPlugin = isInstanceOfWebpackPlugin;
|
|
9
|
+
|
|
10
|
+
var _getWebpackNodeEnv = require("./getWebpackNodeEnv");
|
|
11
|
+
|
|
12
|
+
function getGlobalsPlugin(_ref, userWebpack, devServerOn) {
|
|
13
|
+
var publicUrl = _ref.publicUrl;
|
|
14
|
+
var cleanPublicUrl = removeTrailingSlash(publicUrl);
|
|
15
|
+
return new userWebpack.DefinePlugin({
|
|
16
|
+
// "if (__DEV__)" blocks get stripped when compiling a static export build
|
|
17
|
+
__DEV__: JSON.stringify(devServerOn),
|
|
18
|
+
'process.env': {
|
|
19
|
+
NODE_ENV: JSON.stringify((0, _getWebpackNodeEnv.getWebpackNodeEnv)()),
|
|
20
|
+
PUBLIC_URL: JSON.stringify(cleanPublicUrl)
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function hasPlugin(plugins, pluginName) {
|
|
26
|
+
return plugins && plugins.filter(function (p) {
|
|
27
|
+
return isInstanceOfWebpackPlugin(p, pluginName);
|
|
28
|
+
}).length > 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isInstanceOfWebpackPlugin(plugin, constructorName) {
|
|
32
|
+
return plugin.constructor && plugin.constructor.name === constructorName;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function removeTrailingSlash(url) {
|
|
36
|
+
return url.replace(/\/$/, '');
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveWebpackClientPath(relPath: string): string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _detectCosmosConfig = require("../../../config/detectCosmosConfig");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _generateUserDepsModule = require("../../../userDeps/generateUserDepsModule");
|
|
6
6
|
|
|
7
7
|
var _dom = require("../cosmosConfig/dom");
|
|
8
8
|
|
|
9
9
|
module.exports = function injectUserDeps() {
|
|
10
10
|
var _this = this;
|
|
11
11
|
|
|
12
|
-
var cosmosConfig = (0,
|
|
12
|
+
var cosmosConfig = (0, _detectCosmosConfig.detectCosmosConfig)(); // This ensures this loader is invalidated whenever a new file is added to or
|
|
13
13
|
// removed from user's project, which in turn triggers react-cosmos-voyager2
|
|
14
14
|
// to detect fixture files and finally update fixture list inside Playground.
|
|
15
15
|
// Note that while this may not be very performant, it's not the equivalent
|
|
@@ -28,7 +28,7 @@ module.exports = function injectUserDeps() {
|
|
|
28
28
|
var rendererConfig = {
|
|
29
29
|
containerQuerySelector: containerQuerySelector
|
|
30
30
|
};
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, _generateUserDepsModule.generateUserDepsModule)({
|
|
32
32
|
cosmosConfig: cosmosConfig,
|
|
33
33
|
rendererConfig: rendererConfig,
|
|
34
34
|
relativeToDir: null
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CosmosPluginConfig } from 'react-cosmos-plugin';
|
|
2
|
-
import { CosmosConfig } from '../config';
|
|
3
|
-
import { PlatformType } from './
|
|
2
|
+
import { CosmosConfig } from '../config/shared';
|
|
3
|
+
import { PlatformType } from './types';
|
|
4
4
|
export declare const RENDERER_FILENAME = "_renderer.html";
|
|
5
5
|
export declare function getDevPlaygroundHtml(platformType: PlatformType, cosmosConfig: CosmosConfig, pluginConfigs: CosmosPluginConfig[]): string;
|
|
6
6
|
export declare function getExportPlaygroundHtml(cosmosConfig: CosmosConfig, pluginConfigs: CosmosPluginConfig[]): string;
|
|
@@ -13,10 +13,10 @@ var _pkgUp = _interopRequireDefault(require("pkg-up"));
|
|
|
13
13
|
|
|
14
14
|
var _url = _interopRequireDefault(require("url"));
|
|
15
15
|
|
|
16
|
-
var _shared = require("./shared");
|
|
17
|
-
|
|
18
16
|
var _static = require("./static");
|
|
19
17
|
|
|
18
|
+
var _utils = require("./utils");
|
|
19
|
+
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
22
|
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; }
|
|
@@ -106,7 +106,7 @@ function getWebRendererUrl(_ref) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
function getPlaygroundHtml(playgroundArgs) {
|
|
109
|
-
return (0,
|
|
109
|
+
return (0, _utils.replaceKeys)(getPlaygroundHtmlTemplate(), {
|
|
110
110
|
__PLAYGROUND_ARGS: JSON.stringify(playgroundArgs)
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CosmosConfig } from '../config';
|
|
1
|
+
import { CosmosConfig } from '../config/shared';
|
|
2
2
|
export declare function getPluginConfigs(cosmosConfig: CosmosConfig): import("react-cosmos-plugin").CosmosPluginConfig[];
|
package/dist/shared/static.js
CHANGED
|
@@ -10,7 +10,7 @@ var _express = _interopRequireDefault(require("express"));
|
|
|
10
10
|
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _utils = require("./utils");
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ function serveStaticDir(app, staticPath, publicUrl) {
|
|
|
22
22
|
var relStaticPath = _path.default.relative(process.cwd(), staticPath);
|
|
23
23
|
|
|
24
24
|
console.log("[Cosmos] Serving static files from ".concat(relStaticPath));
|
|
25
|
-
app.use((0,
|
|
25
|
+
app.use((0, _utils.removeLeadingDot)(publicUrl), _express.default.static(staticPath, {
|
|
26
26
|
// Ensure loader index (generated by html-webpack-plugin) loads instead
|
|
27
27
|
// of the index.html from staticPath
|
|
28
28
|
index: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type PlatformType = 'web' | 'native';
|
|
File without changes
|
|
File without changes
|
|
@@ -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":
|
|
File without changes
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.startWebServer = startWebServer;
|
|
7
7
|
|
|
8
|
+
var _startDevServer = require("./devServer/startDevServer");
|
|
9
|
+
|
|
8
10
|
var _httpProxy = require("./plugins/httpProxy");
|
|
9
11
|
|
|
10
12
|
var _openFile = require("./plugins/openFile");
|
|
@@ -13,8 +15,6 @@ var _userDepsFile = require("./plugins/userDepsFile");
|
|
|
13
15
|
|
|
14
16
|
var _webpack = require("./plugins/webpack");
|
|
15
17
|
|
|
16
|
-
var _devServer = require("./shared/devServer");
|
|
17
|
-
|
|
18
18
|
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); } }
|
|
19
19
|
|
|
20
20
|
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); }); }; }
|
|
@@ -30,7 +30,7 @@ function _startWebServer() {
|
|
|
30
30
|
switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
32
32
|
_context.next = 2;
|
|
33
|
-
return (0,
|
|
33
|
+
return (0, _startDevServer.startDevServer)('web', [_openFile.openFile, _webpack.webpackDevServer, _httpProxy.httpProxy, _userDepsFile.userDepsFile]);
|
|
34
34
|
|
|
35
35
|
case 2:
|
|
36
36
|
case "end":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactDecorators, ReactFixtureExports } from 'react-cosmos-shared2/react';
|
|
2
|
+
import { CosmosConfig } from '../config/shared';
|
|
3
|
+
declare type UserModules = {
|
|
4
|
+
fixtures: ReactFixtureExports;
|
|
5
|
+
decorators: ReactDecorators;
|
|
6
|
+
};
|
|
7
|
+
export declare function getUserModules({ rootDir, fixturesDir, fixtureFileSuffix, }: CosmosConfig): UserModules;
|
|
8
|
+
export {};
|
|
@@ -7,10 +7,10 @@ exports.getUserModules = getUserModules;
|
|
|
7
7
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
|
10
|
-
var _ = require(".");
|
|
11
|
-
|
|
12
10
|
var _slash = _interopRequireDefault(require("slash"));
|
|
13
11
|
|
|
12
|
+
var _findUserModulePaths2 = require("./findUserModulePaths");
|
|
13
|
+
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
16
|
function getUserModules(_ref) {
|
|
@@ -18,7 +18,7 @@ function getUserModules(_ref) {
|
|
|
18
18
|
fixturesDir = _ref.fixturesDir,
|
|
19
19
|
fixtureFileSuffix = _ref.fixtureFileSuffix;
|
|
20
20
|
|
|
21
|
-
var _findUserModulePaths = (0,
|
|
21
|
+
var _findUserModulePaths = (0, _findUserModulePaths2.findUserModulePaths)({
|
|
22
22
|
rootDir: rootDir,
|
|
23
23
|
fixturesDir: fixturesDir,
|
|
24
24
|
fixtureFileSuffix: fixtureFileSuffix
|
|
@@ -27,12 +27,12 @@ function getUserModules(_ref) {
|
|
|
27
27
|
decoratorPaths = _findUserModulePaths.decoratorPaths;
|
|
28
28
|
|
|
29
29
|
return {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
fixtures: getDefaultExports(fixturePaths, rootDir),
|
|
31
|
+
decorators: getDefaultExports(decoratorPaths, rootDir)
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function
|
|
35
|
+
function getDefaultExports(paths, rootDir) {
|
|
36
36
|
var exportsByPath = {};
|
|
37
37
|
paths.forEach(function (p) {
|
|
38
38
|
// Converting to forward slashes on Windows is important because the
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ exports.getDecoratorPatterns = getDecoratorPatterns;
|
|
|
7
7
|
exports.getFixturePatterns = getFixturePatterns;
|
|
8
8
|
exports.getIgnorePatterns = getIgnorePatterns;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _utils = require("../shared/utils");
|
|
11
11
|
|
|
12
12
|
// NODE: These can be made configurable if a proper need arises
|
|
13
13
|
var FIXTURE_PATTERNS = ['**/<fixturesDir>/**/*.{js,jsx,ts,tsx}', '**/*.<fixtureFileSuffix>.{js,jsx,ts,tsx}'];
|
|
@@ -16,7 +16,7 @@ var IGNORE_PATTERNS = ['**/node_modules/**'];
|
|
|
16
16
|
|
|
17
17
|
function getFixturePatterns(fixturesDir, fixtureFileSuffix) {
|
|
18
18
|
return FIXTURE_PATTERNS.map(function (pattern) {
|
|
19
|
-
return (0,
|
|
19
|
+
return (0, _utils.replaceKeys)(pattern, {
|
|
20
20
|
'<fixturesDir>': fixturesDir,
|
|
21
21
|
'<fixtureFileSuffix>': fixtureFileSuffix
|
|
22
22
|
});
|
|
File without changes
|
|
@@ -35,7 +35,7 @@ function userDepsTemplate(_ref) {
|
|
|
35
35
|
}).join("\n"), "\n\n").concat(decoratorKeys.map(function (k, i) {
|
|
36
36
|
return "import decorator".concat(i, " from '").concat(decorators[k], "';");
|
|
37
37
|
}).join("\n"), "\n\nexport const rendererConfig = ").concat(JSON.stringify(rendererConfig, null, 2), ";\n\nexport const fixtures = {\n").concat(fixtureKeys.map(function (k, i) {
|
|
38
|
-
return " '".concat(k, "': fixture").concat(i);
|
|
38
|
+
return " '".concat(k, "': { module: { default: fixture").concat(i, " } }");
|
|
39
39
|
}).join(",\n"), "\n};\n\nexport const decorators = {\n").concat(decoratorKeys.map(function (k, i) {
|
|
40
40
|
return " '".concat(k, "': decorator").concat(i);
|
|
41
41
|
}).join(",\n"), "\n};\n").trimLeft();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.2",
|
|
4
4
|
"description": "CLI for running React Cosmos inside webpack-powered apps",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"open": "^8.4.0",
|
|
21
21
|
"pem": "^1.14.4",
|
|
22
22
|
"pkg-up": "^3.1.0",
|
|
23
|
-
"react-cosmos-playground2": "^5.
|
|
23
|
+
"react-cosmos-playground2": "^5.7.2",
|
|
24
24
|
"react-cosmos-plugin": "^5.6.0",
|
|
25
|
-
"react-cosmos-shared2": "^5.
|
|
25
|
+
"react-cosmos-shared2": "^5.7.1",
|
|
26
26
|
"react-error-overlay": "6.0.9",
|
|
27
27
|
"regenerator-runtime": "^0.13.9",
|
|
28
28
|
"resolve-from": "^5.0.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"cosmos-export": "./bin/cosmos-export.js",
|
|
39
39
|
"cosmos-native": "./bin/cosmos-native.js"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a796ba262ccd58881a39d2b17d7e4443561d07b4"
|
|
42
42
|
}
|
package/dist/config/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { createCosmosConfig } from './createCosmosConfig';
|
|
2
|
-
export { detectCosmosConfig, detectCosmosConfigPath, } from './detectCosmosConfig';
|
|
3
|
-
export { getCosmosConfigAtPath } from './getCosmosConfigAtPath';
|
|
4
|
-
export { resolveModule } from './resolve';
|
|
5
|
-
export { CosmosConfig } from './shared';
|
package/dist/config/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "CosmosConfig", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _shared.CosmosConfig;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "createCosmosConfig", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _createCosmosConfig.createCosmosConfig;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "detectCosmosConfig", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _detectCosmosConfig.detectCosmosConfig;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "detectCosmosConfigPath", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _detectCosmosConfig.detectCosmosConfigPath;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "getCosmosConfigAtPath", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _getCosmosConfigAtPath.getCosmosConfigAtPath;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "resolveModule", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _resolve.resolveModule;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
var _createCosmosConfig = require("./createCosmosConfig");
|
|
44
|
-
|
|
45
|
-
var _detectCosmosConfig = require("./detectCosmosConfig");
|
|
46
|
-
|
|
47
|
-
var _getCosmosConfigAtPath = require("./getCosmosConfigAtPath");
|
|
48
|
-
|
|
49
|
-
var _resolve = require("./resolve");
|
|
50
|
-
|
|
51
|
-
var _shared = require("./shared");
|
package/dist/native.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ReactDecoratorsByPath, ReactFixtureExportsByPath } from 'react-cosmos-shared2/react';
|
|
3
|
-
import { NativeRendererConfig } from './shared/rendererConfig';
|
|
4
|
-
declare type Props = {
|
|
5
|
-
rendererConfig: NativeRendererConfig;
|
|
6
|
-
fixtures: ReactFixtureExportsByPath;
|
|
7
|
-
decorators: ReactDecoratorsByPath;
|
|
8
|
-
};
|
|
9
|
-
export declare function NativeFixtureLoader({ rendererConfig: { port }, fixtures, decorators, }: Props): JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "getDevWebpackConfig", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _devServer.getDevWebpackConfig;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getExportWebpackConfig", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _export.getExportWebpackConfig;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
var _devServer = require("./devServer");
|
|
20
|
-
|
|
21
|
-
var _export = require("./export");
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDefaultExport = getDefaultExport;
|
|
7
|
-
|
|
8
|
-
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); }
|
|
9
|
-
|
|
10
|
-
// Get "default" export from either an ES or CJS module
|
|
11
|
-
// More context: https://github.com/react-cosmos/react-cosmos/issues/895
|
|
12
|
-
function getDefaultExport(module) {
|
|
13
|
-
if (_typeof(module) === 'object' && 'default' in module) {
|
|
14
|
-
return module.default;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return module;
|
|
18
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import webpack from 'webpack';
|
|
2
|
-
import { CosmosConfig } from '../../../config';
|
|
3
|
-
export declare function getUserWebpackConfig(cosmosConfig: CosmosConfig, userWebpack: typeof webpack): Promise<webpack.Configuration>;
|
|
4
|
-
export declare function getBaseWebpackConfig(cosmosConfig: CosmosConfig, userWebpack: typeof webpack): Promise<webpack.Configuration>;
|
|
5
|
-
export declare function resolveClientPath(relPath: string): string;
|
|
6
|
-
export declare function getUserDepsLoaderRule(): webpack.RuleSetRule;
|
|
7
|
-
export declare function resolveLocalReactDeps(cosmosConfig: CosmosConfig, baseWebpackConfig: webpack.Configuration): webpack.ResolveOptions;
|
|
8
|
-
export declare function getGlobalsPlugin({ publicUrl }: CosmosConfig, userWebpack: typeof webpack, devServerOn: boolean): webpack.DefinePlugin;
|
|
9
|
-
export declare function hasPlugin(plugins: void | webpack.WebpackPluginInstance[], pluginName: string): boolean | void;
|
|
10
|
-
export declare function isInstanceOfPlugin(plugin: webpack.WebpackPluginInstance, constructorName: string): boolean;
|
|
11
|
-
export declare function getNodeEnv(): "production" | "development";
|