@commercetools-frontend/mc-scripts 22.2.1 → 22.3.1
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/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +51 -41
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +51 -41
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +51 -41
- package/dist/{build-72d9896f.esm.js → build-7993cea9.esm.js} +22 -31
- package/dist/{build-0ef080b9.cjs.prod.js → build-8c9e8a8b.cjs.prod.js} +22 -31
- package/dist/{build-4773d61a.cjs.dev.js → build-94dc48cd.cjs.dev.js} +22 -31
- package/dist/{build-vite-2dc2b366.cjs.prod.js → build-vite-1ba28dd8.cjs.prod.js} +18 -19
- package/dist/{build-vite-290aaf04.esm.js → build-vite-9de4820c.esm.js} +18 -19
- package/dist/{build-vite-b5c7ac91.cjs.dev.js → build-vite-e7a6315c.cjs.dev.js} +18 -19
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -3
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -3
- package/dist/commercetools-frontend-mc-scripts.esm.js +2 -3
- package/dist/{compile-html-41195e35.cjs.dev.js → compile-html-079067bd.cjs.prod.js} +1 -7
- package/dist/{compile-html-5abd78aa.cjs.prod.js → compile-html-3ff2fed0.cjs.dev.js} +1 -7
- package/dist/{compile-html-f9de842c.esm.js → compile-html-606b302e.esm.js} +1 -7
- package/dist/{config-sync-54299066.esm.js → config-sync-15f35d05.esm.js} +83 -194
- package/dist/{config-sync-c914ca7a.cjs.dev.js → config-sync-782033fb.cjs.dev.js} +83 -194
- package/dist/{config-sync-8e8e18a9.cjs.prod.js → config-sync-8f0326af.cjs.prod.js} +81 -193
- package/dist/{create-postcss-config-6277233e.cjs.prod.js → create-postcss-config-254aa0d9.cjs.prod.js} +9 -13
- package/dist/{create-postcss-config-a0659cf5.cjs.dev.js → create-postcss-config-aaff8b1e.cjs.dev.js} +9 -13
- package/dist/{create-postcss-config-f39f54b5.esm.js → create-postcss-config-e44b5231.esm.js} +9 -13
- package/dist/{create-webpack-config-for-development-9539f804.esm.js → create-webpack-config-for-development-12d3233c.esm.js} +46 -37
- package/dist/{create-webpack-config-for-development-9aa85081.cjs.dev.js → create-webpack-config-for-development-30914bb4.cjs.dev.js} +46 -37
- package/dist/{create-webpack-config-for-development-629a8982.cjs.prod.js → create-webpack-config-for-development-c90350a7.cjs.prod.js} +46 -37
- package/dist/{create-webpack-config-for-production-0fac47e1.cjs.dev.js → create-webpack-config-for-production-410e4748.cjs.dev.js} +37 -32
- package/dist/{create-webpack-config-for-production-4476fc5f.esm.js → create-webpack-config-for-production-487aa17d.esm.js} +37 -32
- package/dist/{create-webpack-config-for-production-84e2db7d.cjs.prod.js → create-webpack-config-for-production-48ef18fc.cjs.prod.js} +37 -32
- package/dist/{credentials-storage-da0754c9.cjs.dev.js → credentials-storage-935d3ca1.cjs.prod.js} +3 -15
- package/dist/{credentials-storage-fc0c59c3.cjs.prod.js → credentials-storage-a0ea2ecc.cjs.dev.js} +3 -15
- package/dist/{credentials-storage-5939dd35.esm.js → credentials-storage-beb854dd.esm.js} +3 -15
- package/dist/declarations/src/generated/settings.d.ts +90 -1172
- package/dist/{has-jsx-runtime-0b03b72e.cjs.prod.js → has-jsx-runtime-aa5d21ee.cjs.dev.js} +0 -2
- package/dist/{has-jsx-runtime-3d4bb633.cjs.dev.js → has-jsx-runtime-c3202df5.cjs.prod.js} +0 -2
- package/dist/{has-jsx-runtime-8314226e.esm.js → has-jsx-runtime-e3ecb09b.esm.js} +0 -2
- package/dist/{login-9f821336.cjs.dev.js → login-7b8b5027.cjs.prod.js} +12 -23
- package/dist/{login-d1c2268a.esm.js → login-c806579c.esm.js} +12 -23
- package/dist/{login-f747390f.cjs.prod.js → login-ceb541f1.cjs.dev.js} +12 -23
- package/dist/{package-83202e32.cjs.prod.js → package-4276a7a9.cjs.prod.js} +15 -13
- package/dist/{package-cc5b8665.cjs.dev.js → package-70894b4c.cjs.dev.js} +15 -13
- package/dist/{package-e6713e98.esm.js → package-834453bb.esm.js} +15 -13
- package/dist/{paths-284c77fb.cjs.prod.js → paths-854af5ef.cjs.prod.js} +8 -12
- package/dist/{paths-db35ac0f.cjs.dev.js → paths-d1febc82.cjs.dev.js} +8 -12
- package/dist/{paths-55c5d5a2.esm.js → paths-ded20ae1.esm.js} +8 -12
- package/dist/{serve-b8063204.cjs.dev.js → serve-12571b42.cjs.prod.js} +1 -2
- package/dist/{serve-660e2ee0.esm.js → serve-65b5a149.esm.js} +1 -2
- package/dist/{serve-41077dad.cjs.prod.js → serve-7339c495.cjs.dev.js} +1 -2
- package/dist/{start-33fd6d70.cjs.dev.js → start-03683a4d.cjs.dev.js} +26 -34
- package/dist/{start-f93c62f9.cjs.prod.js → start-763b3477.cjs.prod.js} +26 -34
- package/dist/{start-93205b87.esm.js → start-d3e82b50.esm.js} +26 -34
- package/dist/{start-vite-8f03b0df.cjs.dev.js → start-vite-3966d625.cjs.dev.js} +18 -17
- package/dist/{start-vite-324af14d.cjs.prod.js → start-vite-5c78605b.cjs.prod.js} +18 -17
- package/dist/{start-vite-7d10ae71.esm.js → start-vite-cf0213a1.esm.js} +18 -17
- package/dist/{vite-plugin-svgr-f17db78a.esm.js → vite-plugin-svgr-5c953fe7.esm.js} +1 -6
- package/dist/{vite-plugin-svgr-fdb37ccf.cjs.dev.js → vite-plugin-svgr-5eb1c511.cjs.dev.js} +1 -6
- package/dist/{vite-plugin-svgr-9a4e7f77.cjs.prod.js → vite-plugin-svgr-a732f8df.cjs.prod.js} +1 -6
- package/package.json +31 -17
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +6 -6
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +6 -6
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +6 -6
|
@@ -10,8 +10,8 @@ var openBrowser = require('react-dev-utils/openBrowser');
|
|
|
10
10
|
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
11
11
|
var webpack = require('webpack');
|
|
12
12
|
var WebpackDevServer = require('webpack-dev-server');
|
|
13
|
-
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-
|
|
14
|
-
var paths = require('./paths-
|
|
13
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-30914bb4.cjs.dev.js');
|
|
14
|
+
var paths = require('./paths-d1febc82.cjs.dev.js');
|
|
15
15
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
16
16
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
17
17
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
@@ -35,10 +35,10 @@ require('webpackbar');
|
|
|
35
35
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
36
36
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
37
37
|
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
38
|
-
require('./create-postcss-config-
|
|
38
|
+
require('./create-postcss-config-aaff8b1e.cjs.dev.js');
|
|
39
39
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
40
|
-
require('./package-
|
|
41
|
-
require('./has-jsx-runtime-
|
|
40
|
+
require('./package-70894b4c.cjs.dev.js');
|
|
41
|
+
require('./has-jsx-runtime-aa5d21ee.cjs.dev.js');
|
|
42
42
|
require('./vendors-to-transpile-6ab4ea06.cjs.dev.js');
|
|
43
43
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
44
44
|
|
|
@@ -54,20 +54,18 @@ var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
|
54
54
|
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
55
55
|
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
56
56
|
|
|
57
|
-
const host = process.env.HOST || '0.0.0.0';
|
|
57
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
58
|
+
// We support configuring the sockjs pathname during development.
|
|
58
59
|
// These settings let a developer run multiple simultaneous projects.
|
|
59
60
|
// They are used as the connection `hostname`, `pathname` and `port`
|
|
60
61
|
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
61
62
|
// and `sockPort` options in webpack-dev-server.
|
|
62
|
-
|
|
63
63
|
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
64
64
|
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
65
|
-
|
|
66
65
|
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
67
|
-
|
|
68
66
|
const createWebpackDevServerConfig = _ref => {
|
|
69
67
|
let port = _ref.port,
|
|
70
|
-
|
|
68
|
+
publicPath = _ref.publicPath;
|
|
71
69
|
const applicationConfig$1 = applicationConfig.processConfig();
|
|
72
70
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
73
71
|
return {
|
|
@@ -98,77 +96,71 @@ const createWebpackDevServerConfig = _ref => {
|
|
|
98
96
|
hot: true,
|
|
99
97
|
https: false,
|
|
100
98
|
port,
|
|
101
|
-
|
|
102
99
|
setupMiddlewares(middlewares, devServer) {
|
|
103
100
|
var _devServer$app;
|
|
104
|
-
|
|
105
101
|
if (!devServer) {
|
|
106
102
|
throw new Error('webpack-dev-server is not defined');
|
|
107
103
|
}
|
|
108
|
-
|
|
109
104
|
(_devServer$app = devServer.app) === null || _devServer$app === void 0 ? void 0 : _devServer$app.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
110
105
|
return middlewares;
|
|
111
106
|
}
|
|
112
|
-
|
|
113
107
|
};
|
|
114
108
|
};
|
|
115
109
|
|
|
116
110
|
async function run() {
|
|
117
111
|
var _config$output, _context;
|
|
118
|
-
|
|
119
112
|
const useYarn = fs__default["default"].existsSync(paths.paths.yarnLockFile);
|
|
120
|
-
const isInteractive = process.stdout.isTTY;
|
|
113
|
+
const isInteractive = process.stdout.isTTY;
|
|
114
|
+
|
|
115
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
121
116
|
// which is why it's disabled by default.
|
|
122
117
|
|
|
123
|
-
const hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig);
|
|
118
|
+
const hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig);
|
|
124
119
|
|
|
120
|
+
// Warn and crash if required files are missing
|
|
125
121
|
if (!checkRequiredFiles__default["default"]([])) {
|
|
126
122
|
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
|
|
123
|
+
}
|
|
129
124
|
|
|
125
|
+
// Tools like Cloud9 rely on this.
|
|
130
126
|
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
131
|
-
const HOST = process.env.HOST || '0.0.0.0';
|
|
132
|
-
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
127
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
133
128
|
|
|
129
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
130
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
134
131
|
const port = await WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
135
|
-
|
|
136
132
|
if (port == null) {
|
|
137
|
-
console.warn('Could not find a free port. Aborting.');
|
|
138
|
-
|
|
133
|
+
console.warn('Could not find a free port. Aborting.');
|
|
134
|
+
// We have not found a port.
|
|
139
135
|
return;
|
|
140
136
|
}
|
|
141
|
-
|
|
142
137
|
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
143
|
-
|
|
144
138
|
const appName = require(paths.paths.appPackageJson).name;
|
|
139
|
+
const urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port);
|
|
140
|
+
// Get webpack config
|
|
141
|
+
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment();
|
|
145
142
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment(); // Create a webpack compiler that is configured with custom messages.
|
|
149
|
-
|
|
143
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
150
144
|
const compiler = WebpackDevServerUtils.createCompiler({
|
|
151
145
|
appName,
|
|
152
146
|
config,
|
|
153
147
|
useYarn,
|
|
154
148
|
webpack: webpack__default["default"],
|
|
155
149
|
urls
|
|
156
|
-
});
|
|
150
|
+
});
|
|
157
151
|
|
|
152
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
158
153
|
const serverConfig = createWebpackDevServerConfig({
|
|
159
154
|
port,
|
|
160
155
|
publicPath: (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.publicPath
|
|
161
156
|
});
|
|
162
157
|
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
163
158
|
await devServer.start();
|
|
164
|
-
|
|
165
159
|
if (isInteractive) {
|
|
166
160
|
clearConsole__default["default"]();
|
|
167
161
|
}
|
|
168
|
-
|
|
169
162
|
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
170
163
|
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
171
|
-
|
|
172
164
|
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
173
165
|
process.on(sig, () => {
|
|
174
166
|
devServer.close();
|
|
@@ -10,8 +10,8 @@ var openBrowser = require('react-dev-utils/openBrowser');
|
|
|
10
10
|
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
11
11
|
var webpack = require('webpack');
|
|
12
12
|
var WebpackDevServer = require('webpack-dev-server');
|
|
13
|
-
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-
|
|
14
|
-
var paths = require('./paths-
|
|
13
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-c90350a7.cjs.prod.js');
|
|
14
|
+
var paths = require('./paths-854af5ef.cjs.prod.js');
|
|
15
15
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
16
16
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
17
17
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
@@ -35,10 +35,10 @@ require('webpackbar');
|
|
|
35
35
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
36
36
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
37
37
|
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
38
|
-
require('./create-postcss-config-
|
|
38
|
+
require('./create-postcss-config-254aa0d9.cjs.prod.js');
|
|
39
39
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
40
|
-
require('./package-
|
|
41
|
-
require('./has-jsx-runtime-
|
|
40
|
+
require('./package-4276a7a9.cjs.prod.js');
|
|
41
|
+
require('./has-jsx-runtime-c3202df5.cjs.prod.js');
|
|
42
42
|
require('./vendors-to-transpile-04a49d40.cjs.prod.js');
|
|
43
43
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
44
44
|
|
|
@@ -54,20 +54,18 @@ var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
|
54
54
|
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
55
55
|
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
56
56
|
|
|
57
|
-
const host = process.env.HOST || '0.0.0.0';
|
|
57
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
58
|
+
// We support configuring the sockjs pathname during development.
|
|
58
59
|
// These settings let a developer run multiple simultaneous projects.
|
|
59
60
|
// They are used as the connection `hostname`, `pathname` and `port`
|
|
60
61
|
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
61
62
|
// and `sockPort` options in webpack-dev-server.
|
|
62
|
-
|
|
63
63
|
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
64
64
|
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
65
|
-
|
|
66
65
|
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
67
|
-
|
|
68
66
|
const createWebpackDevServerConfig = _ref => {
|
|
69
67
|
let port = _ref.port,
|
|
70
|
-
|
|
68
|
+
publicPath = _ref.publicPath;
|
|
71
69
|
const applicationConfig$1 = applicationConfig.processConfig();
|
|
72
70
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
73
71
|
return {
|
|
@@ -98,77 +96,71 @@ const createWebpackDevServerConfig = _ref => {
|
|
|
98
96
|
hot: true,
|
|
99
97
|
https: false,
|
|
100
98
|
port,
|
|
101
|
-
|
|
102
99
|
setupMiddlewares(middlewares, devServer) {
|
|
103
100
|
var _devServer$app;
|
|
104
|
-
|
|
105
101
|
if (!devServer) {
|
|
106
102
|
throw new Error('webpack-dev-server is not defined');
|
|
107
103
|
}
|
|
108
|
-
|
|
109
104
|
(_devServer$app = devServer.app) === null || _devServer$app === void 0 ? void 0 : _devServer$app.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
110
105
|
return middlewares;
|
|
111
106
|
}
|
|
112
|
-
|
|
113
107
|
};
|
|
114
108
|
};
|
|
115
109
|
|
|
116
110
|
async function run() {
|
|
117
111
|
var _config$output, _context;
|
|
118
|
-
|
|
119
112
|
const useYarn = fs__default["default"].existsSync(paths.paths.yarnLockFile);
|
|
120
|
-
const isInteractive = process.stdout.isTTY;
|
|
113
|
+
const isInteractive = process.stdout.isTTY;
|
|
114
|
+
|
|
115
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
121
116
|
// which is why it's disabled by default.
|
|
122
117
|
|
|
123
|
-
const hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig);
|
|
118
|
+
const hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig);
|
|
124
119
|
|
|
120
|
+
// Warn and crash if required files are missing
|
|
125
121
|
if (!checkRequiredFiles__default["default"]([])) {
|
|
126
122
|
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
|
|
123
|
+
}
|
|
129
124
|
|
|
125
|
+
// Tools like Cloud9 rely on this.
|
|
130
126
|
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
131
|
-
const HOST = process.env.HOST || '0.0.0.0';
|
|
132
|
-
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
127
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
133
128
|
|
|
129
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
130
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
134
131
|
const port = await WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
135
|
-
|
|
136
132
|
if (port == null) {
|
|
137
|
-
console.warn('Could not find a free port. Aborting.');
|
|
138
|
-
|
|
133
|
+
console.warn('Could not find a free port. Aborting.');
|
|
134
|
+
// We have not found a port.
|
|
139
135
|
return;
|
|
140
136
|
}
|
|
141
|
-
|
|
142
137
|
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
143
|
-
|
|
144
138
|
const appName = require(paths.paths.appPackageJson).name;
|
|
139
|
+
const urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port);
|
|
140
|
+
// Get webpack config
|
|
141
|
+
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment();
|
|
145
142
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment(); // Create a webpack compiler that is configured with custom messages.
|
|
149
|
-
|
|
143
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
150
144
|
const compiler = WebpackDevServerUtils.createCompiler({
|
|
151
145
|
appName,
|
|
152
146
|
config,
|
|
153
147
|
useYarn,
|
|
154
148
|
webpack: webpack__default["default"],
|
|
155
149
|
urls
|
|
156
|
-
});
|
|
150
|
+
});
|
|
157
151
|
|
|
152
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
158
153
|
const serverConfig = createWebpackDevServerConfig({
|
|
159
154
|
port,
|
|
160
155
|
publicPath: (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.publicPath
|
|
161
156
|
});
|
|
162
157
|
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
163
158
|
await devServer.start();
|
|
164
|
-
|
|
165
159
|
if (isInteractive) {
|
|
166
160
|
clearConsole__default["default"]();
|
|
167
161
|
}
|
|
168
|
-
|
|
169
162
|
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
170
163
|
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
171
|
-
|
|
172
164
|
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
173
165
|
process.on(sig, () => {
|
|
174
166
|
devServer.close();
|
|
@@ -8,8 +8,8 @@ import openBrowser from 'react-dev-utils/openBrowser';
|
|
|
8
8
|
import { choosePort, prepareUrls, createCompiler } from 'react-dev-utils/WebpackDevServerUtils';
|
|
9
9
|
import webpack from 'webpack';
|
|
10
10
|
import WebpackDevServer from 'webpack-dev-server';
|
|
11
|
-
import { c as createWebpackConfigForDevelopment } from './create-webpack-config-for-development-
|
|
12
|
-
import { p as paths } from './paths-
|
|
11
|
+
import { c as createWebpackConfigForDevelopment } from './create-webpack-config-for-development-12d3233c.esm.js';
|
|
12
|
+
import { p as paths } from './paths-ded20ae1.esm.js';
|
|
13
13
|
import { processConfig } from '@commercetools-frontend/application-config';
|
|
14
14
|
import { createMcDevAuthenticationMiddleware } from '@commercetools-frontend/mc-dev-authentication';
|
|
15
15
|
import { processHeaders } from '@commercetools-frontend/mc-html-template';
|
|
@@ -33,27 +33,25 @@ import 'webpackbar';
|
|
|
33
33
|
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
34
34
|
import '@babel/runtime-corejs3/helpers/createClass';
|
|
35
35
|
import '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
36
|
-
import './create-postcss-config-
|
|
36
|
+
import './create-postcss-config-e44b5231.esm.js';
|
|
37
37
|
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
38
|
-
import './package-
|
|
39
|
-
import './has-jsx-runtime-
|
|
38
|
+
import './package-834453bb.esm.js';
|
|
39
|
+
import './has-jsx-runtime-e3ecb09b.esm.js';
|
|
40
40
|
import './vendors-to-transpile-7dc84a72.esm.js';
|
|
41
41
|
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
42
42
|
|
|
43
|
-
const host = process.env.HOST || '0.0.0.0';
|
|
43
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
44
|
+
// We support configuring the sockjs pathname during development.
|
|
44
45
|
// These settings let a developer run multiple simultaneous projects.
|
|
45
46
|
// They are used as the connection `hostname`, `pathname` and `port`
|
|
46
47
|
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
47
48
|
// and `sockPort` options in webpack-dev-server.
|
|
48
|
-
|
|
49
49
|
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
50
50
|
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
51
|
-
|
|
52
51
|
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
53
|
-
|
|
54
52
|
const createWebpackDevServerConfig = _ref => {
|
|
55
53
|
let port = _ref.port,
|
|
56
|
-
|
|
54
|
+
publicPath = _ref.publicPath;
|
|
57
55
|
const applicationConfig = processConfig();
|
|
58
56
|
const compiledHeaders = processHeaders(applicationConfig);
|
|
59
57
|
return {
|
|
@@ -84,77 +82,71 @@ const createWebpackDevServerConfig = _ref => {
|
|
|
84
82
|
hot: true,
|
|
85
83
|
https: false,
|
|
86
84
|
port,
|
|
87
|
-
|
|
88
85
|
setupMiddlewares(middlewares, devServer) {
|
|
89
86
|
var _devServer$app;
|
|
90
|
-
|
|
91
87
|
if (!devServer) {
|
|
92
88
|
throw new Error('webpack-dev-server is not defined');
|
|
93
89
|
}
|
|
94
|
-
|
|
95
90
|
(_devServer$app = devServer.app) === null || _devServer$app === void 0 ? void 0 : _devServer$app.use(createMcDevAuthenticationMiddleware(applicationConfig));
|
|
96
91
|
return middlewares;
|
|
97
92
|
}
|
|
98
|
-
|
|
99
93
|
};
|
|
100
94
|
};
|
|
101
95
|
|
|
102
96
|
async function run() {
|
|
103
97
|
var _config$output, _context;
|
|
104
|
-
|
|
105
98
|
const useYarn = fs.existsSync(paths.yarnLockFile);
|
|
106
|
-
const isInteractive = process.stdout.isTTY;
|
|
99
|
+
const isInteractive = process.stdout.isTTY;
|
|
100
|
+
|
|
101
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
107
102
|
// which is why it's disabled by default.
|
|
108
103
|
|
|
109
|
-
const hasWebpackConfig = fs.existsSync(paths.appWebpackConfig);
|
|
104
|
+
const hasWebpackConfig = fs.existsSync(paths.appWebpackConfig);
|
|
110
105
|
|
|
106
|
+
// Warn and crash if required files are missing
|
|
111
107
|
if (!checkRequiredFiles([])) {
|
|
112
108
|
process.exit(1);
|
|
113
|
-
}
|
|
114
|
-
|
|
109
|
+
}
|
|
115
110
|
|
|
111
|
+
// Tools like Cloud9 rely on this.
|
|
116
112
|
const DEFAULT_PORT = _parseInt(String(process.env.HTTP_PORT), 10) || 3001;
|
|
117
|
-
const HOST = process.env.HOST || '0.0.0.0';
|
|
118
|
-
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
113
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
119
114
|
|
|
115
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
116
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
120
117
|
const port = await choosePort(HOST, DEFAULT_PORT);
|
|
121
|
-
|
|
122
118
|
if (port == null) {
|
|
123
|
-
console.warn('Could not find a free port. Aborting.');
|
|
124
|
-
|
|
119
|
+
console.warn('Could not find a free port. Aborting.');
|
|
120
|
+
// We have not found a port.
|
|
125
121
|
return;
|
|
126
122
|
}
|
|
127
|
-
|
|
128
123
|
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
129
|
-
|
|
130
124
|
const appName = require(paths.appPackageJson).name;
|
|
125
|
+
const urls = prepareUrls(protocol, HOST, port);
|
|
126
|
+
// Get webpack config
|
|
127
|
+
const config = hasWebpackConfig ? require(paths.appWebpackConfig) : createWebpackConfigForDevelopment();
|
|
131
128
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const config = hasWebpackConfig ? require(paths.appWebpackConfig) : createWebpackConfigForDevelopment(); // Create a webpack compiler that is configured with custom messages.
|
|
135
|
-
|
|
129
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
136
130
|
const compiler = createCompiler({
|
|
137
131
|
appName,
|
|
138
132
|
config,
|
|
139
133
|
useYarn,
|
|
140
134
|
webpack,
|
|
141
135
|
urls
|
|
142
|
-
});
|
|
136
|
+
});
|
|
143
137
|
|
|
138
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
144
139
|
const serverConfig = createWebpackDevServerConfig({
|
|
145
140
|
port,
|
|
146
141
|
publicPath: (_config$output = config.output) === null || _config$output === void 0 ? void 0 : _config$output.publicPath
|
|
147
142
|
});
|
|
148
143
|
const devServer = new WebpackDevServer(serverConfig, compiler);
|
|
149
144
|
await devServer.start();
|
|
150
|
-
|
|
151
145
|
if (isInteractive) {
|
|
152
146
|
clearConsole();
|
|
153
147
|
}
|
|
154
|
-
|
|
155
148
|
console.log(chalk.cyan('Starting the development server...\n'));
|
|
156
149
|
openBrowser(urls.localUrlForBrowser);
|
|
157
|
-
|
|
158
150
|
_forEachInstanceProperty(_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
159
151
|
process.on(sig, () => {
|
|
160
152
|
devServer.close();
|
|
@@ -10,10 +10,10 @@ var vite = require('vite');
|
|
|
10
10
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
11
11
|
var assets = require('@commercetools-frontend/assets');
|
|
12
12
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
13
|
-
var paths = require('./paths-
|
|
13
|
+
var paths = require('./paths-d1febc82.cjs.dev.js');
|
|
14
14
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
15
15
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
-
var vitePluginSvgr = require('./vite-plugin-svgr-
|
|
16
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-5eb1c511.cjs.dev.js');
|
|
17
17
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
18
18
|
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
19
19
|
require('fs');
|
|
@@ -32,7 +32,6 @@ var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
|
32
32
|
const vitePluginCustomApplication = applicationConfig => {
|
|
33
33
|
return {
|
|
34
34
|
name: 'custom-application',
|
|
35
|
-
|
|
36
35
|
configureServer(server) {
|
|
37
36
|
return () => {
|
|
38
37
|
// Users do not need to have/maintain the `index.html` (as expected by Vite)
|
|
@@ -44,56 +43,57 @@ const vitePluginCustomApplication = applicationConfig => {
|
|
|
44
43
|
if (req.url === '/index.html') {
|
|
45
44
|
req.url = '/public/index.html';
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
next();
|
|
49
|
-
});
|
|
47
|
+
});
|
|
50
48
|
|
|
49
|
+
// Handle auth routes for internal local development.
|
|
51
50
|
server.middlewares.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig));
|
|
52
51
|
};
|
|
53
52
|
},
|
|
54
|
-
|
|
55
53
|
/**
|
|
56
54
|
* @type {import('vite').IndexHtmlTransformHook}
|
|
57
55
|
*/
|
|
58
56
|
transformIndexHtml(rawHtml, _ctx) {
|
|
59
57
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env,
|
|
59
|
+
// Now that the app config is defined as a `env.json`, when we start the FE app
|
|
62
60
|
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
63
61
|
// work anymore). To make it work again, we can override the `env.json` config
|
|
64
62
|
// with the env variable before injecting the values into the index.html.
|
|
65
63
|
// NOTE: this is only necessary for development.
|
|
66
64
|
process.env.MC_API_URL ? {
|
|
67
65
|
mcApiUrl: process.env.MC_API_URL
|
|
68
|
-
} : {});
|
|
69
|
-
|
|
66
|
+
} : {});
|
|
70
67
|
|
|
68
|
+
// Resolve the placeholders of the `index.html` (template) file, before serving it.
|
|
71
69
|
const html = mcHtmlTemplate.replaceHtmlPlaceholders(rawHtml, {
|
|
72
70
|
env: enhancedLocalEnv,
|
|
73
71
|
headers: compiledHeaders
|
|
74
72
|
});
|
|
75
73
|
return html;
|
|
76
74
|
}
|
|
77
|
-
|
|
78
75
|
};
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
async function run() {
|
|
82
|
-
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
79
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
// Load the Custom Application config file first.
|
|
82
|
+
const applicationConfig$1 = applicationConfig.processConfig();
|
|
85
83
|
|
|
84
|
+
// Ensure the `/public` folder exists.
|
|
86
85
|
fs__default["default"].mkdirSync(paths.paths.appBuild, {
|
|
87
86
|
recursive: true
|
|
88
|
-
});
|
|
87
|
+
});
|
|
89
88
|
|
|
89
|
+
// Generate `index.html` (template).
|
|
90
90
|
const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
|
|
91
91
|
const html = mcHtmlTemplate.generateTemplate({
|
|
92
92
|
// Define the module entry point (path relative to the `/public` folder).
|
|
93
93
|
// NOTE: that this is different from the production configuration.
|
|
94
94
|
scriptImports: ["<script type=\"module\" src=\"/../".concat(appEntryPoint, "\"></script>")]
|
|
95
|
-
});
|
|
96
|
-
|
|
95
|
+
});
|
|
96
|
+
// Write `index.html` (template) into the `/public` folder.
|
|
97
97
|
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
98
98
|
encoding: 'utf8'
|
|
99
99
|
});
|
|
@@ -108,8 +108,9 @@ async function run() {
|
|
|
108
108
|
},
|
|
109
109
|
plugins: [pluginGraphql__default["default"](), pluginReact__default["default"](), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
|
|
110
110
|
});
|
|
111
|
-
await server.listen();
|
|
111
|
+
await server.listen();
|
|
112
112
|
|
|
113
|
+
// Copy public assets to `/public` folder (even in development).
|
|
113
114
|
fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
|
|
114
115
|
dereference: true
|
|
115
116
|
});
|
|
@@ -10,10 +10,10 @@ var vite = require('vite');
|
|
|
10
10
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
11
11
|
var assets = require('@commercetools-frontend/assets');
|
|
12
12
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
13
|
-
var paths = require('./paths-
|
|
13
|
+
var paths = require('./paths-854af5ef.cjs.prod.js');
|
|
14
14
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
15
15
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
-
var vitePluginSvgr = require('./vite-plugin-svgr-
|
|
16
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-a732f8df.cjs.prod.js');
|
|
17
17
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
18
18
|
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
19
19
|
require('fs');
|
|
@@ -32,7 +32,6 @@ var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
|
32
32
|
const vitePluginCustomApplication = applicationConfig => {
|
|
33
33
|
return {
|
|
34
34
|
name: 'custom-application',
|
|
35
|
-
|
|
36
35
|
configureServer(server) {
|
|
37
36
|
return () => {
|
|
38
37
|
// Users do not need to have/maintain the `index.html` (as expected by Vite)
|
|
@@ -44,56 +43,57 @@ const vitePluginCustomApplication = applicationConfig => {
|
|
|
44
43
|
if (req.url === '/index.html') {
|
|
45
44
|
req.url = '/public/index.html';
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
next();
|
|
49
|
-
});
|
|
47
|
+
});
|
|
50
48
|
|
|
49
|
+
// Handle auth routes for internal local development.
|
|
51
50
|
server.middlewares.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig));
|
|
52
51
|
};
|
|
53
52
|
},
|
|
54
|
-
|
|
55
53
|
/**
|
|
56
54
|
* @type {import('vite').IndexHtmlTransformHook}
|
|
57
55
|
*/
|
|
58
56
|
transformIndexHtml(rawHtml, _ctx) {
|
|
59
57
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env,
|
|
59
|
+
// Now that the app config is defined as a `env.json`, when we start the FE app
|
|
62
60
|
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
63
61
|
// work anymore). To make it work again, we can override the `env.json` config
|
|
64
62
|
// with the env variable before injecting the values into the index.html.
|
|
65
63
|
// NOTE: this is only necessary for development.
|
|
66
64
|
process.env.MC_API_URL ? {
|
|
67
65
|
mcApiUrl: process.env.MC_API_URL
|
|
68
|
-
} : {});
|
|
69
|
-
|
|
66
|
+
} : {});
|
|
70
67
|
|
|
68
|
+
// Resolve the placeholders of the `index.html` (template) file, before serving it.
|
|
71
69
|
const html = mcHtmlTemplate.replaceHtmlPlaceholders(rawHtml, {
|
|
72
70
|
env: enhancedLocalEnv,
|
|
73
71
|
headers: compiledHeaders
|
|
74
72
|
});
|
|
75
73
|
return html;
|
|
76
74
|
}
|
|
77
|
-
|
|
78
75
|
};
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
async function run() {
|
|
82
|
-
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
79
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
// Load the Custom Application config file first.
|
|
82
|
+
const applicationConfig$1 = applicationConfig.processConfig();
|
|
85
83
|
|
|
84
|
+
// Ensure the `/public` folder exists.
|
|
86
85
|
fs__default["default"].mkdirSync(paths.paths.appBuild, {
|
|
87
86
|
recursive: true
|
|
88
|
-
});
|
|
87
|
+
});
|
|
89
88
|
|
|
89
|
+
// Generate `index.html` (template).
|
|
90
90
|
const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
|
|
91
91
|
const html = mcHtmlTemplate.generateTemplate({
|
|
92
92
|
// Define the module entry point (path relative to the `/public` folder).
|
|
93
93
|
// NOTE: that this is different from the production configuration.
|
|
94
94
|
scriptImports: ["<script type=\"module\" src=\"/../".concat(appEntryPoint, "\"></script>")]
|
|
95
|
-
});
|
|
96
|
-
|
|
95
|
+
});
|
|
96
|
+
// Write `index.html` (template) into the `/public` folder.
|
|
97
97
|
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
98
98
|
encoding: 'utf8'
|
|
99
99
|
});
|
|
@@ -108,8 +108,9 @@ async function run() {
|
|
|
108
108
|
},
|
|
109
109
|
plugins: [pluginGraphql__default["default"](), pluginReact__default["default"](), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
|
|
110
110
|
});
|
|
111
|
-
await server.listen();
|
|
111
|
+
await server.listen();
|
|
112
112
|
|
|
113
|
+
// Copy public assets to `/public` folder (even in development).
|
|
113
114
|
fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
|
|
114
115
|
dereference: true
|
|
115
116
|
});
|