@commercetools-frontend/mc-scripts 0.0.0-CRAFT-1791-20251006162610
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/LICENSE +21 -0
- package/README.md +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +2 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
- package/application-runtime/package.json +4 -0
- package/bin/cli.js +8 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +2 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +199 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +199 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +184 -0
- package/cli/package.json +4 -0
- package/config/create-webpack-config-for-development.js +8 -0
- package/config/create-webpack-config-for-production.js +8 -0
- package/config/vendors-to-transpile.js +6 -0
- package/dist/build-2a0a18bd.esm.js +155 -0
- package/dist/build-521f3f9f.cjs.prod.js +169 -0
- package/dist/build-988fc0f7.cjs.dev.js +169 -0
- package/dist/build-vite-16b1a575.cjs.dev.js +238 -0
- package/dist/build-vite-59e1f185.esm.js +208 -0
- package/dist/build-vite-5d317720.cjs.prod.js +238 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +2 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +29 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +29 -0
- package/dist/commercetools-frontend-mc-scripts.esm.js +21 -0
- package/dist/compile-html-025cd493.esm.js +34 -0
- package/dist/compile-html-50fd05ec.cjs.prod.js +42 -0
- package/dist/compile-html-f4ac88cc.cjs.dev.js +42 -0
- package/dist/config-sync-70a16916.cjs.dev.js +852 -0
- package/dist/config-sync-72c20d80.cjs.prod.js +846 -0
- package/dist/config-sync-bc895390.esm.js +830 -0
- package/dist/create-postcss-config-cb7be312.cjs.dev.js +81 -0
- package/dist/create-postcss-config-dde0ccf1.esm.js +75 -0
- package/dist/create-postcss-config-edca0c33.cjs.prod.js +81 -0
- package/dist/create-webpack-config-for-development-1aed1cc0.cjs.prod.js +465 -0
- package/dist/create-webpack-config-for-development-a95f3634.esm.js +440 -0
- package/dist/create-webpack-config-for-development-d003697b.cjs.dev.js +465 -0
- package/dist/create-webpack-config-for-production-15fbe7db.cjs.dev.js +523 -0
- package/dist/create-webpack-config-for-production-764c482f.cjs.prod.js +523 -0
- package/dist/create-webpack-config-for-production-9f42c336.esm.js +493 -0
- package/dist/credentials-storage-66c1e51f.cjs.prod.js +95 -0
- package/dist/credentials-storage-d001f726.esm.js +83 -0
- package/dist/credentials-storage-e7884d17.cjs.dev.js +95 -0
- package/dist/declarations/src/application-runtime.d.ts +1 -0
- package/dist/declarations/src/cli.d.ts +4 -0
- package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
- package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
- package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
- package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
- package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/postcss.d.ts +1 -0
- package/dist/declarations/src/types.d.ts +94 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations/src/webpack-loaders/i18n-message-compilation-loader.d.ts +3 -0
- package/dist/declarations/src/webpack.d.ts +2 -0
- package/dist/deployment-previews-set-17e8ed48.cjs.prod.js +202 -0
- package/dist/deployment-previews-set-3648972f.esm.js +191 -0
- package/dist/deployment-previews-set-37aef990.cjs.dev.js +202 -0
- package/dist/does-file-exist-32618334.esm.js +12 -0
- package/dist/does-file-exist-be53305d.cjs.prod.js +18 -0
- package/dist/does-file-exist-eb86baca.cjs.dev.js +18 -0
- package/dist/graphql-requests-6a47ad5b.esm.js +247 -0
- package/dist/graphql-requests-779b867b.cjs.dev.js +270 -0
- package/dist/graphql-requests-8086eba7.cjs.prod.js +270 -0
- package/dist/has-jsx-runtime-aa5d21ee.cjs.dev.js +15 -0
- package/dist/has-jsx-runtime-c3202df5.cjs.prod.js +15 -0
- package/dist/has-jsx-runtime-e3ecb09b.esm.js +13 -0
- package/dist/i18n-message-complilation-21d3b0aa.esm.js +15 -0
- package/dist/i18n-message-complilation-7311cb29.cjs.dev.js +23 -0
- package/dist/i18n-message-complilation-7762da61.cjs.prod.js +23 -0
- package/dist/login-0a728449.esm.js +229 -0
- package/dist/login-817a5a26.cjs.dev.js +270 -0
- package/dist/login-85c25393.cjs.prod.js +270 -0
- package/dist/optimizations-7789145e.cjs.dev.js +85 -0
- package/dist/optimizations-bf991634.esm.js +67 -0
- package/dist/optimizations-fb93514f.cjs.prod.js +85 -0
- package/dist/package-7e170dc4.cjs.dev.js +160 -0
- package/dist/package-940b0a2a.cjs.prod.js +160 -0
- package/dist/package-99e547a7.esm.js +158 -0
- package/dist/paths-39f22b8b.esm.js +36 -0
- package/dist/paths-7768b440.cjs.prod.js +44 -0
- package/dist/paths-b76fc753.cjs.dev.js +44 -0
- package/dist/serve-1036c2de.esm.js +55 -0
- package/dist/serve-50d33f0b.cjs.dev.js +64 -0
- package/dist/serve-8a506da6.cjs.prod.js +64 -0
- package/dist/start-1d677ad8.cjs.dev.js +177 -0
- package/dist/start-2a7ae03d.esm.js +164 -0
- package/dist/start-f56cb5f7.cjs.prod.js +177 -0
- package/dist/start-vite-068e9f73.cjs.dev.js +128 -0
- package/dist/start-vite-29078b3a.cjs.prod.js +128 -0
- package/dist/start-vite-7d1161e8.esm.js +116 -0
- package/dist/vendors-to-transpile-04a49d40.cjs.prod.js +5 -0
- package/dist/vendors-to-transpile-6ab4ea06.cjs.dev.js +5 -0
- package/dist/vendors-to-transpile-7dc84a72.esm.js +3 -0
- package/dist/vite-plugin-svgr-4034a834.cjs.prod.js +151 -0
- package/dist/vite-plugin-svgr-7d06f400.cjs.dev.js +151 -0
- package/dist/vite-plugin-svgr-de6ee7da.esm.js +125 -0
- package/package.json +156 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +2 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +12 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +12 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +4 -0
- package/postcss/package.json +4 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +2 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +57 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +57 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +48 -0
- package/webpack/package.json +4 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.d.ts +3 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +30 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.js +7 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +30 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +26 -0
- package/webpack-loaders/i18n-message-compilation-loader/package.json +4 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
4
|
+
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
5
|
+
var http = require('http');
|
|
6
|
+
var serveHandler = require('serve-handler');
|
|
7
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
8
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
10
|
+
require('fs');
|
|
11
|
+
require('path');
|
|
12
|
+
require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
13
|
+
require('node:fs');
|
|
14
|
+
|
|
15
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
18
|
+
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
19
|
+
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
20
|
+
var serveHandler__default = /*#__PURE__*/_interopDefault(serveHandler);
|
|
21
|
+
|
|
22
|
+
const port = 3001;
|
|
23
|
+
async function run() {
|
|
24
|
+
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
25
|
+
const server = http__default["default"].createServer((request, response) => {
|
|
26
|
+
var _context;
|
|
27
|
+
// When developing against local APIs, handle the login|logout routes separately.
|
|
28
|
+
if (_startsWithInstanceProperty__default["default"](_context = applicationConfig$1.env.mcApiUrl).call(_context, 'http://localhost')) {
|
|
29
|
+
if (request.url?.startsWith('/login/authorize')) {
|
|
30
|
+
const redirectTo = new _URL__default["default"](request.url, applicationConfig$1.env.mcApiUrl);
|
|
31
|
+
response.writeHead(301, {
|
|
32
|
+
Location: redirectTo.toString()
|
|
33
|
+
}).end();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (request.url?.startsWith('/logout')) {
|
|
37
|
+
response.end('Please clear your session storage.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// You pass two more arguments for config and middleware
|
|
43
|
+
// More details here: https://github.com/vercel/serve-handler#options
|
|
44
|
+
return serveHandler__default["default"](request, response, {
|
|
45
|
+
public: paths.paths.appBuild,
|
|
46
|
+
rewrites: [{
|
|
47
|
+
source: '/favicon*',
|
|
48
|
+
destination: '/favicon.png'
|
|
49
|
+
}, {
|
|
50
|
+
// Match all routes except for the login, logout, and favicon routes.
|
|
51
|
+
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
52
|
+
// implementation would stop at the first match.
|
|
53
|
+
// See https://github.com/vercel/serve-handler/issues/71
|
|
54
|
+
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
55
|
+
destination: '/index.html'
|
|
56
|
+
}]
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
server.listen(port, () => {
|
|
60
|
+
console.log(`Running at http://localhost:${port}`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
4
|
+
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
5
|
+
var http = require('http');
|
|
6
|
+
var serveHandler = require('serve-handler');
|
|
7
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
8
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
10
|
+
require('fs');
|
|
11
|
+
require('path');
|
|
12
|
+
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
13
|
+
require('node:fs');
|
|
14
|
+
|
|
15
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
18
|
+
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
19
|
+
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
20
|
+
var serveHandler__default = /*#__PURE__*/_interopDefault(serveHandler);
|
|
21
|
+
|
|
22
|
+
const port = 3001;
|
|
23
|
+
async function run() {
|
|
24
|
+
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
25
|
+
const server = http__default["default"].createServer((request, response) => {
|
|
26
|
+
var _context;
|
|
27
|
+
// When developing against local APIs, handle the login|logout routes separately.
|
|
28
|
+
if (_startsWithInstanceProperty__default["default"](_context = applicationConfig$1.env.mcApiUrl).call(_context, 'http://localhost')) {
|
|
29
|
+
if (request.url?.startsWith('/login/authorize')) {
|
|
30
|
+
const redirectTo = new _URL__default["default"](request.url, applicationConfig$1.env.mcApiUrl);
|
|
31
|
+
response.writeHead(301, {
|
|
32
|
+
Location: redirectTo.toString()
|
|
33
|
+
}).end();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (request.url?.startsWith('/logout')) {
|
|
37
|
+
response.end('Please clear your session storage.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// You pass two more arguments for config and middleware
|
|
43
|
+
// More details here: https://github.com/vercel/serve-handler#options
|
|
44
|
+
return serveHandler__default["default"](request, response, {
|
|
45
|
+
public: paths.paths.appBuild,
|
|
46
|
+
rewrites: [{
|
|
47
|
+
source: '/favicon*',
|
|
48
|
+
destination: '/favicon.png'
|
|
49
|
+
}, {
|
|
50
|
+
// Match all routes except for the login, logout, and favicon routes.
|
|
51
|
+
// NOTE: this complex glob pattern would not be necessary if the rewrite
|
|
52
|
+
// implementation would stop at the first match.
|
|
53
|
+
// See https://github.com/vercel/serve-handler/issues/71
|
|
54
|
+
source: '{/!(favicon|login|logout)*/**,/!(favicon|login|logout)*}',
|
|
55
|
+
destination: '/index.html'
|
|
56
|
+
}]
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
server.listen(port, () => {
|
|
60
|
+
console.log(`Running at http://localhost:${port}`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
4
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
7
|
+
var clearConsole = require('react-dev-utils/clearConsole');
|
|
8
|
+
var openBrowser = require('react-dev-utils/openBrowser');
|
|
9
|
+
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
10
|
+
var webpack = require('webpack');
|
|
11
|
+
var WebpackDevServer = require('webpack-dev-server');
|
|
12
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-d003697b.cjs.dev.js');
|
|
13
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
14
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
|
+
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
17
|
+
var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
24
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
30
|
+
require('crypto');
|
|
31
|
+
require('path');
|
|
32
|
+
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
33
|
+
require('html-webpack-plugin');
|
|
34
|
+
require('moment-locales-webpack-plugin');
|
|
35
|
+
require('webpackbar');
|
|
36
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
37
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
38
|
+
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
39
|
+
require('./create-postcss-config-cb7be312.cjs.dev.js');
|
|
40
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
+
require('./package-7e170dc4.cjs.dev.js');
|
|
42
|
+
require('./has-jsx-runtime-aa5d21ee.cjs.dev.js');
|
|
43
|
+
require('./optimizations-7789145e.cjs.dev.js');
|
|
44
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
45
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
46
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
+
require('./vendors-to-transpile-6ab4ea06.cjs.dev.js');
|
|
48
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
49
|
+
require('fs');
|
|
50
|
+
require('node:fs');
|
|
51
|
+
|
|
52
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
53
|
+
|
|
54
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
55
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
56
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
57
|
+
var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
|
|
58
|
+
var clearConsole__default = /*#__PURE__*/_interopDefault(clearConsole);
|
|
59
|
+
var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
60
|
+
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
61
|
+
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
62
|
+
|
|
63
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
64
|
+
// We support configuring the sockjs pathname during development.
|
|
65
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
66
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
67
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
68
|
+
// and `sockPort` options in webpack-dev-server.
|
|
69
|
+
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
70
|
+
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
71
|
+
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
72
|
+
const createWebpackDevServerConfig = async _ref => {
|
|
73
|
+
let port = _ref.port,
|
|
74
|
+
publicPath = _ref.publicPath;
|
|
75
|
+
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
76
|
+
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
77
|
+
return {
|
|
78
|
+
client: {
|
|
79
|
+
overlay: false,
|
|
80
|
+
webSocketURL: {
|
|
81
|
+
hostname: sockHost,
|
|
82
|
+
pathname: sockPath,
|
|
83
|
+
port: sockPort
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Enable gzip compression of generated files.
|
|
87
|
+
compress: true,
|
|
88
|
+
devMiddleware: {
|
|
89
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
90
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
91
|
+
// from the root.
|
|
92
|
+
publicPath
|
|
93
|
+
},
|
|
94
|
+
headers: compiledHeaders,
|
|
95
|
+
historyApiFallback: {
|
|
96
|
+
// Paths with dots should still use the history fallback.
|
|
97
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
98
|
+
disableDotRule: true,
|
|
99
|
+
index: publicPath
|
|
100
|
+
},
|
|
101
|
+
host,
|
|
102
|
+
hot: true,
|
|
103
|
+
https: false,
|
|
104
|
+
port,
|
|
105
|
+
setupMiddlewares(middlewares, devServer) {
|
|
106
|
+
if (!devServer) {
|
|
107
|
+
throw new Error('webpack-dev-server is not defined');
|
|
108
|
+
}
|
|
109
|
+
devServer.app?.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
110
|
+
return middlewares;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
async function run() {
|
|
116
|
+
var _context;
|
|
117
|
+
const useYarn = doesFileExist.doesFileExist(paths.paths.yarnLockFile);
|
|
118
|
+
const isInteractive = process.stdout.isTTY;
|
|
119
|
+
|
|
120
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
121
|
+
// which is why it's disabled by default.
|
|
122
|
+
|
|
123
|
+
const hasWebpackConfig = doesFileExist.doesFileExist(paths.paths.appWebpackConfig);
|
|
124
|
+
|
|
125
|
+
// Warn and crash if required files are missing
|
|
126
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Tools like Cloud9 rely on this.
|
|
131
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
132
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
133
|
+
|
|
134
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
135
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
136
|
+
const port = await WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
137
|
+
if (port == null) {
|
|
138
|
+
console.warn('Could not find a free port. Aborting.');
|
|
139
|
+
// We have not found a port.
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
143
|
+
const appName = require(paths.paths.appPackageJson).name;
|
|
144
|
+
const urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port);
|
|
145
|
+
// Get webpack config
|
|
146
|
+
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment();
|
|
147
|
+
|
|
148
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
149
|
+
const compiler = WebpackDevServerUtils.createCompiler({
|
|
150
|
+
appName,
|
|
151
|
+
config,
|
|
152
|
+
useYarn,
|
|
153
|
+
webpack: webpack__default["default"],
|
|
154
|
+
urls
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
158
|
+
const serverConfig = await createWebpackDevServerConfig({
|
|
159
|
+
port,
|
|
160
|
+
publicPath: config.output?.publicPath
|
|
161
|
+
});
|
|
162
|
+
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
163
|
+
await devServer.start();
|
|
164
|
+
if (isInteractive) {
|
|
165
|
+
clearConsole__default["default"]();
|
|
166
|
+
}
|
|
167
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
168
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
169
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
170
|
+
process.on(sig, () => {
|
|
171
|
+
devServer.close();
|
|
172
|
+
process.exit();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
|
|
2
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import checkRequiredFiles from 'react-dev-utils/checkRequiredFiles';
|
|
5
|
+
import clearConsole from 'react-dev-utils/clearConsole';
|
|
6
|
+
import openBrowser from 'react-dev-utils/openBrowser';
|
|
7
|
+
import { choosePort, prepareUrls, createCompiler } from 'react-dev-utils/WebpackDevServerUtils';
|
|
8
|
+
import webpack from 'webpack';
|
|
9
|
+
import WebpackDevServer from 'webpack-dev-server';
|
|
10
|
+
import { c as createWebpackConfigForDevelopment } from './create-webpack-config-for-development-a95f3634.esm.js';
|
|
11
|
+
import { p as paths } from './paths-39f22b8b.esm.js';
|
|
12
|
+
import { processConfig } from '@commercetools-frontend/application-config';
|
|
13
|
+
import { createMcDevAuthenticationMiddleware } from '@commercetools-frontend/mc-dev-authentication';
|
|
14
|
+
import { processHeaders } from '@commercetools-frontend/mc-html-template';
|
|
15
|
+
import { d as doesFileExist } from './does-file-exist-32618334.esm.js';
|
|
16
|
+
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
17
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
18
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
19
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
20
|
+
import '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
21
|
+
import '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
22
|
+
import '@babel/runtime-corejs3/helpers/defineProperty';
|
|
23
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
24
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
25
|
+
import '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
26
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/ends-with';
|
|
27
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
28
|
+
import 'crypto';
|
|
29
|
+
import 'path';
|
|
30
|
+
import '@pmmmwh/react-refresh-webpack-plugin';
|
|
31
|
+
import 'html-webpack-plugin';
|
|
32
|
+
import 'moment-locales-webpack-plugin';
|
|
33
|
+
import 'webpackbar';
|
|
34
|
+
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
35
|
+
import '@babel/runtime-corejs3/helpers/createClass';
|
|
36
|
+
import '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
37
|
+
import './create-postcss-config-dde0ccf1.esm.js';
|
|
38
|
+
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
39
|
+
import './package-99e547a7.esm.js';
|
|
40
|
+
import './has-jsx-runtime-e3ecb09b.esm.js';
|
|
41
|
+
import './optimizations-bf991634.esm.js';
|
|
42
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
43
|
+
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
44
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
45
|
+
import './vendors-to-transpile-7dc84a72.esm.js';
|
|
46
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
47
|
+
import 'fs';
|
|
48
|
+
import 'node:fs';
|
|
49
|
+
|
|
50
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
51
|
+
// We support configuring the sockjs pathname during development.
|
|
52
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
53
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
54
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
55
|
+
// and `sockPort` options in webpack-dev-server.
|
|
56
|
+
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
57
|
+
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
58
|
+
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
59
|
+
const createWebpackDevServerConfig = async _ref => {
|
|
60
|
+
let port = _ref.port,
|
|
61
|
+
publicPath = _ref.publicPath;
|
|
62
|
+
const applicationConfig = await processConfig();
|
|
63
|
+
const compiledHeaders = processHeaders(applicationConfig);
|
|
64
|
+
return {
|
|
65
|
+
client: {
|
|
66
|
+
overlay: false,
|
|
67
|
+
webSocketURL: {
|
|
68
|
+
hostname: sockHost,
|
|
69
|
+
pathname: sockPath,
|
|
70
|
+
port: sockPort
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
// Enable gzip compression of generated files.
|
|
74
|
+
compress: true,
|
|
75
|
+
devMiddleware: {
|
|
76
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
77
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
78
|
+
// from the root.
|
|
79
|
+
publicPath
|
|
80
|
+
},
|
|
81
|
+
headers: compiledHeaders,
|
|
82
|
+
historyApiFallback: {
|
|
83
|
+
// Paths with dots should still use the history fallback.
|
|
84
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
85
|
+
disableDotRule: true,
|
|
86
|
+
index: publicPath
|
|
87
|
+
},
|
|
88
|
+
host,
|
|
89
|
+
hot: true,
|
|
90
|
+
https: false,
|
|
91
|
+
port,
|
|
92
|
+
setupMiddlewares(middlewares, devServer) {
|
|
93
|
+
if (!devServer) {
|
|
94
|
+
throw new Error('webpack-dev-server is not defined');
|
|
95
|
+
}
|
|
96
|
+
devServer.app?.use(createMcDevAuthenticationMiddleware(applicationConfig));
|
|
97
|
+
return middlewares;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
async function run() {
|
|
103
|
+
var _context;
|
|
104
|
+
const useYarn = doesFileExist(paths.yarnLockFile);
|
|
105
|
+
const isInteractive = process.stdout.isTTY;
|
|
106
|
+
|
|
107
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
108
|
+
// which is why it's disabled by default.
|
|
109
|
+
|
|
110
|
+
const hasWebpackConfig = doesFileExist(paths.appWebpackConfig);
|
|
111
|
+
|
|
112
|
+
// Warn and crash if required files are missing
|
|
113
|
+
if (!checkRequiredFiles([])) {
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Tools like Cloud9 rely on this.
|
|
118
|
+
const DEFAULT_PORT = _parseInt(String(process.env.HTTP_PORT), 10) || 3001;
|
|
119
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
120
|
+
|
|
121
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
122
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
123
|
+
const port = await choosePort(HOST, DEFAULT_PORT);
|
|
124
|
+
if (port == null) {
|
|
125
|
+
console.warn('Could not find a free port. Aborting.');
|
|
126
|
+
// We have not found a port.
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
130
|
+
const appName = require(paths.appPackageJson).name;
|
|
131
|
+
const urls = prepareUrls(protocol, HOST, port);
|
|
132
|
+
// Get webpack config
|
|
133
|
+
const config = hasWebpackConfig ? require(paths.appWebpackConfig) : createWebpackConfigForDevelopment();
|
|
134
|
+
|
|
135
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
136
|
+
const compiler = createCompiler({
|
|
137
|
+
appName,
|
|
138
|
+
config,
|
|
139
|
+
useYarn,
|
|
140
|
+
webpack,
|
|
141
|
+
urls
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
145
|
+
const serverConfig = await createWebpackDevServerConfig({
|
|
146
|
+
port,
|
|
147
|
+
publicPath: config.output?.publicPath
|
|
148
|
+
});
|
|
149
|
+
const devServer = new WebpackDevServer(serverConfig, compiler);
|
|
150
|
+
await devServer.start();
|
|
151
|
+
if (isInteractive) {
|
|
152
|
+
clearConsole();
|
|
153
|
+
}
|
|
154
|
+
console.log(chalk.cyan('Starting the development server...\n'));
|
|
155
|
+
openBrowser(urls.localUrlForBrowser);
|
|
156
|
+
_forEachInstanceProperty(_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
157
|
+
process.on(sig, () => {
|
|
158
|
+
devServer.close();
|
|
159
|
+
process.exit();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { run as default };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
4
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
7
|
+
var clearConsole = require('react-dev-utils/clearConsole');
|
|
8
|
+
var openBrowser = require('react-dev-utils/openBrowser');
|
|
9
|
+
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
10
|
+
var webpack = require('webpack');
|
|
11
|
+
var WebpackDevServer = require('webpack-dev-server');
|
|
12
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-1aed1cc0.cjs.prod.js');
|
|
13
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
14
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
|
+
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
17
|
+
var doesFileExist = require('./does-file-exist-be53305d.cjs.prod.js');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
24
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
30
|
+
require('crypto');
|
|
31
|
+
require('path');
|
|
32
|
+
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
33
|
+
require('html-webpack-plugin');
|
|
34
|
+
require('moment-locales-webpack-plugin');
|
|
35
|
+
require('webpackbar');
|
|
36
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
37
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
38
|
+
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
39
|
+
require('./create-postcss-config-edca0c33.cjs.prod.js');
|
|
40
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
+
require('./package-940b0a2a.cjs.prod.js');
|
|
42
|
+
require('./has-jsx-runtime-c3202df5.cjs.prod.js');
|
|
43
|
+
require('./optimizations-fb93514f.cjs.prod.js');
|
|
44
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
45
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
46
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
+
require('./vendors-to-transpile-04a49d40.cjs.prod.js');
|
|
48
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
49
|
+
require('fs');
|
|
50
|
+
require('node:fs');
|
|
51
|
+
|
|
52
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
53
|
+
|
|
54
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
55
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
56
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
57
|
+
var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
|
|
58
|
+
var clearConsole__default = /*#__PURE__*/_interopDefault(clearConsole);
|
|
59
|
+
var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
60
|
+
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
61
|
+
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
62
|
+
|
|
63
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
64
|
+
// We support configuring the sockjs pathname during development.
|
|
65
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
66
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
67
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
68
|
+
// and `sockPort` options in webpack-dev-server.
|
|
69
|
+
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
70
|
+
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
71
|
+
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
72
|
+
const createWebpackDevServerConfig = async _ref => {
|
|
73
|
+
let port = _ref.port,
|
|
74
|
+
publicPath = _ref.publicPath;
|
|
75
|
+
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
76
|
+
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
77
|
+
return {
|
|
78
|
+
client: {
|
|
79
|
+
overlay: false,
|
|
80
|
+
webSocketURL: {
|
|
81
|
+
hostname: sockHost,
|
|
82
|
+
pathname: sockPath,
|
|
83
|
+
port: sockPort
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Enable gzip compression of generated files.
|
|
87
|
+
compress: true,
|
|
88
|
+
devMiddleware: {
|
|
89
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
90
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
91
|
+
// from the root.
|
|
92
|
+
publicPath
|
|
93
|
+
},
|
|
94
|
+
headers: compiledHeaders,
|
|
95
|
+
historyApiFallback: {
|
|
96
|
+
// Paths with dots should still use the history fallback.
|
|
97
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
98
|
+
disableDotRule: true,
|
|
99
|
+
index: publicPath
|
|
100
|
+
},
|
|
101
|
+
host,
|
|
102
|
+
hot: true,
|
|
103
|
+
https: false,
|
|
104
|
+
port,
|
|
105
|
+
setupMiddlewares(middlewares, devServer) {
|
|
106
|
+
if (!devServer) {
|
|
107
|
+
throw new Error('webpack-dev-server is not defined');
|
|
108
|
+
}
|
|
109
|
+
devServer.app?.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
110
|
+
return middlewares;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
async function run() {
|
|
116
|
+
var _context;
|
|
117
|
+
const useYarn = doesFileExist.doesFileExist(paths.paths.yarnLockFile);
|
|
118
|
+
const isInteractive = process.stdout.isTTY;
|
|
119
|
+
|
|
120
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
121
|
+
// which is why it's disabled by default.
|
|
122
|
+
|
|
123
|
+
const hasWebpackConfig = doesFileExist.doesFileExist(paths.paths.appWebpackConfig);
|
|
124
|
+
|
|
125
|
+
// Warn and crash if required files are missing
|
|
126
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Tools like Cloud9 rely on this.
|
|
131
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
132
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
133
|
+
|
|
134
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
135
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
136
|
+
const port = await WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
137
|
+
if (port == null) {
|
|
138
|
+
console.warn('Could not find a free port. Aborting.');
|
|
139
|
+
// We have not found a port.
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
143
|
+
const appName = require(paths.paths.appPackageJson).name;
|
|
144
|
+
const urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port);
|
|
145
|
+
// Get webpack config
|
|
146
|
+
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment();
|
|
147
|
+
|
|
148
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
149
|
+
const compiler = WebpackDevServerUtils.createCompiler({
|
|
150
|
+
appName,
|
|
151
|
+
config,
|
|
152
|
+
useYarn,
|
|
153
|
+
webpack: webpack__default["default"],
|
|
154
|
+
urls
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
158
|
+
const serverConfig = await createWebpackDevServerConfig({
|
|
159
|
+
port,
|
|
160
|
+
publicPath: config.output?.publicPath
|
|
161
|
+
});
|
|
162
|
+
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
163
|
+
await devServer.start();
|
|
164
|
+
if (isInteractive) {
|
|
165
|
+
clearConsole__default["default"]();
|
|
166
|
+
}
|
|
167
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
168
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
169
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
170
|
+
process.on(sig, () => {
|
|
171
|
+
devServer.close();
|
|
172
|
+
process.exit();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
exports["default"] = run;
|