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,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.httpProxy = httpProxy;
|
|
7
|
-
|
|
8
|
-
var _httpProxyMiddleware = require("http-proxy-middleware");
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
function httpProxy(_ref) {
|
|
13
|
-
var cosmosConfig = _ref.cosmosConfig,
|
|
14
|
-
expressApp = _ref.expressApp;
|
|
15
|
-
var httpProxyConfig = getHttpProxyCosmosConfig(cosmosConfig);
|
|
16
|
-
Object.keys(httpProxyConfig).forEach(function (context) {
|
|
17
|
-
var config = httpProxyConfig[context];
|
|
18
|
-
|
|
19
|
-
if (typeof config === 'string') {
|
|
20
|
-
expressApp.use(context, (0, _httpProxyMiddleware.createProxyMiddleware)(context, {
|
|
21
|
-
target: config
|
|
22
|
-
}));
|
|
23
|
-
} else if (_typeof(config) === 'object') {
|
|
24
|
-
expressApp.use(context, (0, _httpProxyMiddleware.createProxyMiddleware)(context, config));
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getHttpProxyCosmosConfig(cosmosConfig) {
|
|
30
|
-
return cosmosConfig.httpProxy || {};
|
|
31
|
-
}
|
package/dist/plugins/openFile.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.openFile = openFile;
|
|
7
|
-
|
|
8
|
-
var _launchEditor = _interopRequireDefault(require("@skidding/launch-editor"));
|
|
9
|
-
|
|
10
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
11
|
-
|
|
12
|
-
var _open = _interopRequireDefault(require("open"));
|
|
13
|
-
|
|
14
|
-
var _path = _interopRequireDefault(require("path"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function openFile(_ref) {
|
|
19
|
-
var cosmosConfig = _ref.cosmosConfig,
|
|
20
|
-
expressApp = _ref.expressApp;
|
|
21
|
-
expressApp.get('/_open', function (req, res) {
|
|
22
|
-
var _getReqQuery = getReqQuery(req),
|
|
23
|
-
filePath = _getReqQuery.filePath,
|
|
24
|
-
line = _getReqQuery.line,
|
|
25
|
-
column = _getReqQuery.column;
|
|
26
|
-
|
|
27
|
-
if (!filePath) {
|
|
28
|
-
res.status(400).send("File path missing");
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var absFilePath = resolveFilePath(cosmosConfig, filePath);
|
|
33
|
-
|
|
34
|
-
if (!_fs.default.existsSync(absFilePath)) {
|
|
35
|
-
res.status(404).send("File not found at path: ".concat(absFilePath));
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
new Promise(function (resolve, reject) {
|
|
40
|
-
var file = "".concat(absFilePath, ":").concat(line, ":").concat(column);
|
|
41
|
-
(0, _launchEditor.default)(file, function (fileName, errorMsg) {
|
|
42
|
-
return reject(errorMsg);
|
|
43
|
-
}); // If launchEditor doesn't report error within 500ms we assume it worked
|
|
44
|
-
|
|
45
|
-
setTimeout(resolve, 500);
|
|
46
|
-
}) // Fall back to open in case launchEditor fails. launchEditor only works
|
|
47
|
-
// when the editor app is already open, but is favorable because it can
|
|
48
|
-
// open a code file on a specific line & column.
|
|
49
|
-
.catch(function (err) {
|
|
50
|
-
return (0, _open.default)(absFilePath);
|
|
51
|
-
}).catch(function (err) {
|
|
52
|
-
return res.status(500).send('Failed to open file');
|
|
53
|
-
}).then(function () {
|
|
54
|
-
return res.send();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function getReqQuery(req) {
|
|
60
|
-
var _req$query = req.query,
|
|
61
|
-
filePath = _req$query.filePath,
|
|
62
|
-
line = _req$query.line,
|
|
63
|
-
column = _req$query.column;
|
|
64
|
-
if (typeof filePath !== 'string') throw new Error('filePath missing');
|
|
65
|
-
return {
|
|
66
|
-
filePath: filePath,
|
|
67
|
-
line: typeof line === 'string' ? parseInt(line, 10) : 1,
|
|
68
|
-
column: typeof column === 'string' ? parseInt(column, 10) : 1
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function resolveFilePath(cosmosConfig, filePath) {
|
|
73
|
-
// This heuristic is needed because the open file endpoint is used for
|
|
74
|
-
// multiple applications, which provide different file path types:
|
|
75
|
-
// 1. Edit fixture button: Sends path relative to Cosmos rootDir
|
|
76
|
-
// 2. react-error-overlay runtime error: Sends absolute path
|
|
77
|
-
// 3. react-error-overlay compile error: Sends path relative to CWD
|
|
78
|
-
if (_path.default.isAbsolute(filePath)) {
|
|
79
|
-
return filePath;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var cosmosRelPath = _path.default.join(cosmosConfig.rootDir, filePath);
|
|
83
|
-
|
|
84
|
-
var cwdRelPath = _path.default.join(process.cwd(), filePath);
|
|
85
|
-
|
|
86
|
-
return _fs.default.existsSync(cosmosRelPath) ? cosmosRelPath : cwdRelPath;
|
|
87
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.userDepsFile = userDepsFile;
|
|
7
|
-
|
|
8
|
-
var _chokidar = require("chokidar");
|
|
9
|
-
|
|
10
|
-
var _fs = require("fs");
|
|
11
|
-
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
|
-
var _path = _interopRequireDefault(require("path"));
|
|
15
|
-
|
|
16
|
-
var _util = _interopRequireDefault(require("util.promisify"));
|
|
17
|
-
|
|
18
|
-
var _cli = require("../shared/cli");
|
|
19
|
-
|
|
20
|
-
var _generateUserDepsModule = require("../userDeps/generateUserDepsModule");
|
|
21
|
-
|
|
22
|
-
var _shared = require("../userDeps/shared");
|
|
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 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); } }
|
|
39
|
-
|
|
40
|
-
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); }); }; }
|
|
41
|
-
|
|
42
|
-
var writeFileAsync = (0, _util.default)(_fs.writeFile);
|
|
43
|
-
|
|
44
|
-
function userDepsFile(_x) {
|
|
45
|
-
return _userDepsFile.apply(this, arguments);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _userDepsFile() {
|
|
49
|
-
_userDepsFile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) {
|
|
50
|
-
var cosmosConfig, watcher;
|
|
51
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
52
|
-
while (1) {
|
|
53
|
-
switch (_context.prev = _context.next) {
|
|
54
|
-
case 0:
|
|
55
|
-
if (shouldGenerateUserDepsFile(args)) {
|
|
56
|
-
_context.next = 2;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return _context.abrupt("return");
|
|
61
|
-
|
|
62
|
-
case 2:
|
|
63
|
-
cosmosConfig = args.cosmosConfig;
|
|
64
|
-
_context.next = 5;
|
|
65
|
-
return generateUserDepsFile(cosmosConfig);
|
|
66
|
-
|
|
67
|
-
case 5:
|
|
68
|
-
_context.next = 7;
|
|
69
|
-
return startFixtureFileWatcher(cosmosConfig);
|
|
70
|
-
|
|
71
|
-
case 7:
|
|
72
|
-
watcher = _context.sent;
|
|
73
|
-
return _context.abrupt("return", function () {
|
|
74
|
-
watcher.close();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
case 9:
|
|
78
|
-
case "end":
|
|
79
|
-
return _context.stop();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, _callee);
|
|
83
|
-
}));
|
|
84
|
-
return _userDepsFile.apply(this, arguments);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function shouldGenerateUserDepsFile(_ref) {
|
|
88
|
-
var cosmosConfig = _ref.cosmosConfig,
|
|
89
|
-
platformType = _ref.platformType;
|
|
90
|
-
return platformType === 'native' || cosmosConfig.experimentalRendererUrl !== null || // CLI support for --external-userdeps flag (useful with react-native-web)
|
|
91
|
-
Boolean((0, _cli.getCliArgs)().externalUserdeps);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var DEBOUNCE_INTERVAL = 50;
|
|
95
|
-
|
|
96
|
-
function startFixtureFileWatcher(_x2) {
|
|
97
|
-
return _startFixtureFileWatcher.apply(this, arguments);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function _startFixtureFileWatcher() {
|
|
101
|
-
_startFixtureFileWatcher = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(cosmosConfig) {
|
|
102
|
-
var fixturesDir, fixtureFileSuffix, FILE_PATTERNS;
|
|
103
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
104
|
-
while (1) {
|
|
105
|
-
switch (_context2.prev = _context2.next) {
|
|
106
|
-
case 0:
|
|
107
|
-
fixturesDir = cosmosConfig.fixturesDir, fixtureFileSuffix = cosmosConfig.fixtureFileSuffix;
|
|
108
|
-
FILE_PATTERNS = [].concat(_toConsumableArray((0, _shared.getFixturePatterns)(fixturesDir, fixtureFileSuffix)), _toConsumableArray((0, _shared.getDecoratorPatterns)()));
|
|
109
|
-
return _context2.abrupt("return", new Promise(function (resolve) {
|
|
110
|
-
var watcher = (0, _chokidar.watch)(FILE_PATTERNS, {
|
|
111
|
-
ignored: (0, _shared.getIgnorePatterns)(),
|
|
112
|
-
ignoreInitial: true,
|
|
113
|
-
cwd: cosmosConfig.rootDir
|
|
114
|
-
}).on('ready', function () {
|
|
115
|
-
return resolve(watcher);
|
|
116
|
-
}).on('all', (0, _lodash.debounce)(function () {
|
|
117
|
-
return generateUserDepsFile(cosmosConfig);
|
|
118
|
-
}, DEBOUNCE_INTERVAL));
|
|
119
|
-
}));
|
|
120
|
-
|
|
121
|
-
case 3:
|
|
122
|
-
case "end":
|
|
123
|
-
return _context2.stop();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}, _callee2);
|
|
127
|
-
}));
|
|
128
|
-
return _startFixtureFileWatcher.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function generateUserDepsFile(_x3) {
|
|
132
|
-
return _generateUserDepsFile.apply(this, arguments);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function _generateUserDepsFile() {
|
|
136
|
-
_generateUserDepsFile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(cosmosConfig) {
|
|
137
|
-
var userDepsFilePath, port, rendererConfig, userDepsModule, relUserDepsFilePath;
|
|
138
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
139
|
-
while (1) {
|
|
140
|
-
switch (_context3.prev = _context3.next) {
|
|
141
|
-
case 0:
|
|
142
|
-
userDepsFilePath = cosmosConfig.userDepsFilePath, port = cosmosConfig.port;
|
|
143
|
-
rendererConfig = {
|
|
144
|
-
port: port
|
|
145
|
-
};
|
|
146
|
-
userDepsModule = (0, _generateUserDepsModule.generateUserDepsModule)({
|
|
147
|
-
cosmosConfig: cosmosConfig,
|
|
148
|
-
rendererConfig: rendererConfig,
|
|
149
|
-
relativeToDir: _path.default.dirname(userDepsFilePath)
|
|
150
|
-
});
|
|
151
|
-
_context3.next = 5;
|
|
152
|
-
return writeFileAsync(userDepsFilePath, userDepsModule, 'utf8');
|
|
153
|
-
|
|
154
|
-
case 5:
|
|
155
|
-
relUserDepsFilePath = _path.default.relative(process.cwd(), userDepsFilePath);
|
|
156
|
-
console.log("[Cosmos] Generated ".concat(relUserDepsFilePath));
|
|
157
|
-
|
|
158
|
-
case 7:
|
|
159
|
-
case "end":
|
|
160
|
-
return _context3.stop();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}, _callee3);
|
|
164
|
-
}));
|
|
165
|
-
return _generateUserDepsFile.apply(this, arguments);
|
|
166
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function dismissErrorOverlay(): void;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dismissErrorOverlay = dismissErrorOverlay;
|
|
7
|
-
|
|
8
|
-
if (__DEV__) {
|
|
9
|
-
require('./reactErrorOverlay').init();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function dismissErrorOverlay() {
|
|
13
|
-
if (__DEV__) {
|
|
14
|
-
require('./reactErrorOverlay').dismiss();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,63 +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.dismiss = dismiss;
|
|
9
|
-
exports.init = init;
|
|
10
|
-
|
|
11
|
-
var _url = require("react-cosmos-shared2/url");
|
|
12
|
-
|
|
13
|
-
var ErrorOverlay = _interopRequireWildcard(require("react-error-overlay"));
|
|
14
|
-
|
|
15
|
-
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); }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
|
-
var LAUNCH_EDITOR_ENDPOINT = '/_open';
|
|
20
|
-
|
|
21
|
-
function init() {
|
|
22
|
-
ErrorOverlay.startReportingRuntimeErrors({
|
|
23
|
-
filename: process.env.PUBLIC_URL + '/main.js'
|
|
24
|
-
});
|
|
25
|
-
ErrorOverlay.setEditorHandler(function (errorLocation) {
|
|
26
|
-
return window.fetch(getLaunchEditorUrl(errorLocation));
|
|
27
|
-
});
|
|
28
|
-
setUpBuildErrorReporting();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function dismiss() {
|
|
32
|
-
ErrorOverlay.dismissRuntimeErrors();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getLaunchEditorUrl(errorLocation) {
|
|
36
|
-
return "".concat(LAUNCH_EDITOR_ENDPOINT, "?").concat((0, _url.stringifyUrlQuery)({
|
|
37
|
-
filePath: errorLocation.fileName,
|
|
38
|
-
line: errorLocation.lineNumber || 1,
|
|
39
|
-
column: errorLocation.colNumber || 1
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function setUpBuildErrorReporting() {
|
|
44
|
-
var clientWindow = window;
|
|
45
|
-
|
|
46
|
-
if (clientWindow.__webpack_hot_middleware_reporter__ === undefined) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
clientWindow.__webpack_hot_middleware_reporter__.useCustomOverlay({
|
|
51
|
-
showProblems: function showProblems(type, obj) {
|
|
52
|
-
if (type !== 'errors') {
|
|
53
|
-
// We might've went from errors -> warnings
|
|
54
|
-
ErrorOverlay.dismissBuildError();
|
|
55
|
-
} else {
|
|
56
|
-
ErrorOverlay.reportBuildError(obj[0]);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
clear: function clear() {
|
|
60
|
-
ErrorOverlay.dismissBuildError();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _dom = require("../../../dom");
|
|
4
|
-
|
|
5
|
-
if (__DEV__) {
|
|
6
|
-
var webpackRendererConnect = _dom.rendererConnect;
|
|
7
|
-
|
|
8
|
-
window.onHotReloadError = function () {
|
|
9
|
-
return webpackRendererConnect.postMessage({
|
|
10
|
-
type: 'rendererHmrFail',
|
|
11
|
-
payload: {
|
|
12
|
-
rendererId: _dom.rendererId
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("regenerator-runtime/runtime");
|
|
4
|
-
|
|
5
|
-
require("core-js/features/promise");
|
|
6
|
-
|
|
7
|
-
require("core-js/features/array/find");
|
|
8
|
-
|
|
9
|
-
require("core-js/features/array/includes");
|
|
10
|
-
|
|
11
|
-
require("core-js/features/array/fill");
|
|
12
|
-
|
|
13
|
-
var _dom = require("../../../dom");
|
|
14
|
-
|
|
15
|
-
var _errorOverlay = require("./errorOverlay");
|
|
16
|
-
|
|
17
|
-
require("./hmrErrorHandler");
|
|
18
|
-
|
|
19
|
-
mount();
|
|
20
|
-
|
|
21
|
-
function mount() {
|
|
22
|
-
// Use dynamic import to load updated modules upon hot reloading
|
|
23
|
-
var _require = require('./userDeps'),
|
|
24
|
-
rendererConfig = _require.rendererConfig,
|
|
25
|
-
fixtures = _require.fixtures,
|
|
26
|
-
decorators = _require.decorators;
|
|
27
|
-
|
|
28
|
-
(0, _dom.mountDomRenderer)({
|
|
29
|
-
rendererConfig: rendererConfig,
|
|
30
|
-
fixtures: fixtures,
|
|
31
|
-
decorators: decorators,
|
|
32
|
-
onErrorReset: _errorOverlay.dismissErrorOverlay
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (module.hot) {
|
|
37
|
-
module.hot.accept('./userDeps', function () {
|
|
38
|
-
// If a previous error has been solved, the error overlay auto-closes nicely.
|
|
39
|
-
// If the error persists, however, the overlay will pop up again on its own
|
|
40
|
-
(0, _errorOverlay.dismissErrorOverlay)();
|
|
41
|
-
mount();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// TLDR: This has to be done before React is imported
|
|
4
|
-
// https://github.com/facebook/react-devtools/issues/76#issuecomment-128091900
|
|
5
|
-
// More context: User-defined "global imports" have to be imported *after* this
|
|
6
|
-
// file (because they can import React), but *before* the main renderer entry
|
|
7
|
-
// point (because the user's global imports have to take effect before we
|
|
8
|
-
// import fixture and decorator modules). For this reason this file has to be
|
|
9
|
-
// imported by hand in each renderer implementation.
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
if (process.env.NODE_ENV === 'development') {
|
|
12
|
-
// Accessing the parent window can throw when loading a static export without
|
|
13
|
-
// a web server (i.e. via file:/// protocol)
|
|
14
|
-
try {
|
|
15
|
-
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
16
|
-
} catch (err) {
|
|
17
|
-
console.warn('Could not access parent React devtools hook');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ReactDecorators, ReactFixtureWrappers } from 'react-cosmos-shared2/react';
|
|
2
|
-
import { DomRendererConfig } from '../../../shared/rendererConfig';
|
|
3
|
-
export declare const rendererConfig: DomRendererConfig;
|
|
4
|
-
export declare const fixtures: ReactFixtureWrappers;
|
|
5
|
-
export declare const decorators: ReactDecorators;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.rendererConfig = exports.fixtures = exports.decorators = void 0;
|
|
7
|
-
// NOTE: Renderer data is statically injected at compile time
|
|
8
|
-
var rendererConfig = {
|
|
9
|
-
containerQuerySelector: null
|
|
10
|
-
};
|
|
11
|
-
exports.rendererConfig = rendererConfig;
|
|
12
|
-
var fixtures = {};
|
|
13
|
-
exports.fixtures = fixtures;
|
|
14
|
-
var decorators = {};
|
|
15
|
-
exports.decorators = decorators;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDomCosmosConfig = createDomCosmosConfig;
|
|
7
|
-
|
|
8
|
-
function createDomCosmosConfig(cosmosConfig) {
|
|
9
|
-
var configInput = cosmosConfig.dom || {};
|
|
10
|
-
return {
|
|
11
|
-
containerQuerySelector: getContainerQuerySelector(configInput)
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getContainerQuerySelector(_ref) {
|
|
16
|
-
var _ref$containerQuerySe = _ref.containerQuerySelector,
|
|
17
|
-
containerQuerySelector = _ref$containerQuerySe === void 0 ? null : _ref$containerQuerySe;
|
|
18
|
-
return containerQuerySelector;
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CosmosConfig } from '../../../config/shared';
|
|
2
|
-
declare type WebpackCosmosConfig = {
|
|
3
|
-
configPath: null | string;
|
|
4
|
-
overridePath: null | string;
|
|
5
|
-
includeHashInOutputFilename: boolean;
|
|
6
|
-
hotReload: boolean;
|
|
7
|
-
reloadOnFail: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare function createWebpackCosmosConfig(cosmosConfig: CosmosConfig): WebpackCosmosConfig;
|
|
10
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createWebpackCosmosConfig = createWebpackCosmosConfig;
|
|
7
|
-
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
-
var _resolveModule = require("../../../config/resolveModule");
|
|
11
|
-
|
|
12
|
-
var _fs = require("../../../shared/fs");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function createWebpackCosmosConfig(cosmosConfig) {
|
|
17
|
-
var rootDir = cosmosConfig.rootDir;
|
|
18
|
-
var configInput = cosmosConfig.webpack || {};
|
|
19
|
-
return {
|
|
20
|
-
configPath: getWebpackConfigPath(configInput, rootDir),
|
|
21
|
-
overridePath: getWebpackOverridePath(configInput, rootDir),
|
|
22
|
-
includeHashInOutputFilename: getIncludeHashInOutputFilename(configInput),
|
|
23
|
-
hotReload: getHotReload(configInput),
|
|
24
|
-
reloadOnFail: getReloadOnFail(configInput)
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getWebpackConfigPath(_ref, rootDir) {
|
|
29
|
-
var configPath = _ref.configPath;
|
|
30
|
-
|
|
31
|
-
if (typeof configPath === 'undefined') {
|
|
32
|
-
return (0, _resolveModule.resolveModule)(rootDir, 'webpack.config.js');
|
|
33
|
-
} // User can choose to prevent automatical use of an existing webpack.config.js
|
|
34
|
-
// file (relative to the root dir) by setting configPath to null
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!configPath) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var absPath = (0, _resolveModule.resolveModule)(rootDir, configPath);
|
|
42
|
-
|
|
43
|
-
if (!(0, _fs.fileExists)(absPath)) {
|
|
44
|
-
var relPath = _path.default.relative(process.cwd(), absPath);
|
|
45
|
-
|
|
46
|
-
throw new Error("webpack config not found at path: ".concat(relPath));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return absPath;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function getWebpackOverridePath(_ref2, rootDir) {
|
|
53
|
-
var overridePath = _ref2.overridePath;
|
|
54
|
-
|
|
55
|
-
if (typeof overridePath === 'undefined') {
|
|
56
|
-
return (0, _resolveModule.resolveModule)(rootDir, 'webpack.override.js');
|
|
57
|
-
} // User can choose to prevent automatical use of an existing webpack.override.js
|
|
58
|
-
// file (relative to the root dir) by setting overridePath to null
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!overridePath) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
var absPath = (0, _resolveModule.resolveModule)(rootDir, overridePath);
|
|
66
|
-
|
|
67
|
-
if (!(0, _fs.fileExists)(absPath)) {
|
|
68
|
-
var relPath = _path.default.relative(process.cwd(), absPath);
|
|
69
|
-
|
|
70
|
-
throw new Error("webpack override module not found at path: ".concat(relPath));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return absPath;
|
|
74
|
-
} // Default value is False to not break backwards compatibility
|
|
75
|
-
// In future releases it's better to mark this as @deprecated and set
|
|
76
|
-
// output.filename to "[name].[contenthash].js" by default
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function getIncludeHashInOutputFilename(_ref3) {
|
|
80
|
-
var _ref3$includeHashInOu = _ref3.includeHashInOutputFilename,
|
|
81
|
-
includeHashInOutputFilename = _ref3$includeHashInOu === void 0 ? false : _ref3$includeHashInOu;
|
|
82
|
-
return includeHashInOutputFilename;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function getHotReload(_ref4) {
|
|
86
|
-
var _ref4$hotReload = _ref4.hotReload,
|
|
87
|
-
hotReload = _ref4$hotReload === void 0 ? true : _ref4$hotReload;
|
|
88
|
-
return hotReload;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function getReloadOnFail(_ref5) {
|
|
92
|
-
var _ref5$reloadOnFail = _ref5.reloadOnFail,
|
|
93
|
-
reloadOnFail = _ref5$reloadOnFail === void 0 ? true : _ref5$reloadOnFail;
|
|
94
|
-
return reloadOnFail;
|
|
95
|
-
}
|