@commercetools-frontend/mc-scripts 22.2.1 → 22.3.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/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-8227e71d.esm.js} +22 -31
- package/dist/{build-4773d61a.cjs.dev.js → build-a888cacd.cjs.dev.js} +22 -31
- package/dist/{build-0ef080b9.cjs.prod.js → build-a9f085a0.cjs.prod.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-8e8e18a9.cjs.prod.js → config-sync-058dca05.cjs.prod.js} +81 -193
- package/dist/{config-sync-c914ca7a.cjs.dev.js → config-sync-866d8c22.cjs.dev.js} +83 -194
- package/dist/{config-sync-54299066.esm.js → config-sync-dc5a68ed.esm.js} +83 -194
- package/dist/{create-postcss-config-f39f54b5.esm.js → create-postcss-config-9d266de4.esm.js} +9 -13
- package/dist/{create-postcss-config-a0659cf5.cjs.dev.js → create-postcss-config-a29e83fc.cjs.dev.js} +9 -13
- package/dist/{create-postcss-config-6277233e.cjs.prod.js → create-postcss-config-d4f8ca51.cjs.prod.js} +9 -13
- package/dist/{create-webpack-config-for-development-629a8982.cjs.prod.js → create-webpack-config-for-development-02fa9041.cjs.prod.js} +46 -37
- package/dist/{create-webpack-config-for-development-9539f804.esm.js → create-webpack-config-for-development-17376d1f.esm.js} +46 -37
- package/dist/{create-webpack-config-for-development-9aa85081.cjs.dev.js → create-webpack-config-for-development-ac4ad0b2.cjs.dev.js} +46 -37
- package/dist/{create-webpack-config-for-production-84e2db7d.cjs.prod.js → create-webpack-config-for-production-190c7797.cjs.prod.js} +37 -32
- package/dist/{create-webpack-config-for-production-4476fc5f.esm.js → create-webpack-config-for-production-25d7c593.esm.js} +37 -32
- package/dist/{create-webpack-config-for-production-0fac47e1.cjs.dev.js → create-webpack-config-for-production-c1ec1058.cjs.dev.js} +37 -32
- package/dist/{credentials-storage-5939dd35.esm.js → credentials-storage-5a3b88be.esm.js} +3 -15
- package/dist/{credentials-storage-da0754c9.cjs.dev.js → credentials-storage-5d3da1c0.cjs.prod.js} +3 -15
- package/dist/{credentials-storage-fc0c59c3.cjs.prod.js → credentials-storage-6c51d561.cjs.dev.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-0dc4f62a.cjs.prod.js} +12 -23
- package/dist/{login-d1c2268a.esm.js → login-1b051481.esm.js} +12 -23
- package/dist/{login-f747390f.cjs.prod.js → login-9f35d543.cjs.dev.js} +12 -23
- package/dist/{package-83202e32.cjs.prod.js → package-46d27f5f.cjs.dev.js} +15 -13
- package/dist/{package-e6713e98.esm.js → package-4fcd2667.esm.js} +15 -13
- package/dist/{package-cc5b8665.cjs.dev.js → package-6ee0354d.cjs.prod.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-216f84b7.cjs.dev.js} +26 -34
- package/dist/{start-93205b87.esm.js → start-4a922c4f.esm.js} +26 -34
- package/dist/{start-f93c62f9.cjs.prod.js → start-b2e2dab7.cjs.prod.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
package/dist/{create-postcss-config-f39f54b5.esm.js → create-postcss-config-9d266de4.esm.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { p as pkgJson } from './package-
|
|
3
|
+
import { p as pkgJson } from './package-4fcd2667.esm.js';
|
|
4
4
|
|
|
5
5
|
// This function aims to return the same result as `require.resolve`.
|
|
6
6
|
// However, resolving a path to a `.css` file does not return the real
|
|
@@ -10,23 +10,19 @@ import { p as pkgJson } from './package-e6713e98.esm.js';
|
|
|
10
10
|
// constructing the real path manually.
|
|
11
11
|
const safeResolvePath = (packageName, fileRelativePath) => {
|
|
12
12
|
const defaultPackageEntryPoint = require.resolve(packageName);
|
|
13
|
-
|
|
14
13
|
const _defaultPackageEntryP = defaultPackageEntryPoint.split('dist'),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
_defaultPackageEntryP2 = _slicedToArray(_defaultPackageEntryP, 1),
|
|
15
|
+
pathToPackage = _defaultPackageEntryP2[0];
|
|
18
16
|
return path.join(pathToPackage, fileRelativePath);
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
function createPostcssConfig() {
|
|
22
19
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
_ref$postcssImportPat = _ref.postcssImportPaths,
|
|
21
|
+
postcssImportPaths = _ref$postcssImportPat === void 0 ? [] : _ref$postcssImportPat,
|
|
22
|
+
_ref$postcssCustomMed = _ref.postcssCustomMediaPaths,
|
|
23
|
+
postcssCustomMediaPaths = _ref$postcssCustomMed === void 0 ? [] : _ref$postcssCustomMed,
|
|
24
|
+
_ref$postcssCustomPro = _ref.postcssCustomPropertiesPaths,
|
|
25
|
+
postcssCustomPropertiesPaths = _ref$postcssCustomPro === void 0 ? [] : _ref$postcssCustomPro;
|
|
30
26
|
return {
|
|
31
27
|
parser: false,
|
|
32
28
|
map: false,
|
package/dist/{create-postcss-config-a0659cf5.cjs.dev.js → create-postcss-config-a29e83fc.cjs.dev.js}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
4
|
var path = require('path');
|
|
5
|
-
var _package = require('./package-
|
|
5
|
+
var _package = require('./package-46d27f5f.cjs.dev.js');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -16,23 +16,19 @@ var path__default = /*#__PURE__*/_interopDefault(path);
|
|
|
16
16
|
// constructing the real path manually.
|
|
17
17
|
const safeResolvePath = (packageName, fileRelativePath) => {
|
|
18
18
|
const defaultPackageEntryPoint = require.resolve(packageName);
|
|
19
|
-
|
|
20
19
|
const _defaultPackageEntryP = defaultPackageEntryPoint.split('dist'),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
_defaultPackageEntryP2 = _slicedToArray(_defaultPackageEntryP, 1),
|
|
21
|
+
pathToPackage = _defaultPackageEntryP2[0];
|
|
24
22
|
return path__default["default"].join(pathToPackage, fileRelativePath);
|
|
25
23
|
};
|
|
26
|
-
|
|
27
24
|
function createPostcssConfig() {
|
|
28
25
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
_ref$postcssImportPat = _ref.postcssImportPaths,
|
|
27
|
+
postcssImportPaths = _ref$postcssImportPat === void 0 ? [] : _ref$postcssImportPat,
|
|
28
|
+
_ref$postcssCustomMed = _ref.postcssCustomMediaPaths,
|
|
29
|
+
postcssCustomMediaPaths = _ref$postcssCustomMed === void 0 ? [] : _ref$postcssCustomMed,
|
|
30
|
+
_ref$postcssCustomPro = _ref.postcssCustomPropertiesPaths,
|
|
31
|
+
postcssCustomPropertiesPaths = _ref$postcssCustomPro === void 0 ? [] : _ref$postcssCustomPro;
|
|
36
32
|
return {
|
|
37
33
|
parser: false,
|
|
38
34
|
map: false,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
4
4
|
var path = require('path');
|
|
5
|
-
var _package = require('./package-
|
|
5
|
+
var _package = require('./package-6ee0354d.cjs.prod.js');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -16,23 +16,19 @@ var path__default = /*#__PURE__*/_interopDefault(path);
|
|
|
16
16
|
// constructing the real path manually.
|
|
17
17
|
const safeResolvePath = (packageName, fileRelativePath) => {
|
|
18
18
|
const defaultPackageEntryPoint = require.resolve(packageName);
|
|
19
|
-
|
|
20
19
|
const _defaultPackageEntryP = defaultPackageEntryPoint.split('dist'),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
_defaultPackageEntryP2 = _slicedToArray(_defaultPackageEntryP, 1),
|
|
21
|
+
pathToPackage = _defaultPackageEntryP2[0];
|
|
24
22
|
return path__default["default"].join(pathToPackage, fileRelativePath);
|
|
25
23
|
};
|
|
26
|
-
|
|
27
24
|
function createPostcssConfig() {
|
|
28
25
|
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
_ref$postcssImportPat = _ref.postcssImportPaths,
|
|
27
|
+
postcssImportPaths = _ref$postcssImportPat === void 0 ? [] : _ref$postcssImportPat,
|
|
28
|
+
_ref$postcssCustomMed = _ref.postcssCustomMediaPaths,
|
|
29
|
+
postcssCustomMediaPaths = _ref$postcssCustomMed === void 0 ? [] : _ref$postcssCustomMed,
|
|
30
|
+
_ref$postcssCustomPro = _ref.postcssCustomPropertiesPaths,
|
|
31
|
+
postcssCustomPropertiesPaths = _ref$postcssCustomPro === void 0 ? [] : _ref$postcssCustomPro;
|
|
36
32
|
return {
|
|
37
33
|
parser: false,
|
|
38
34
|
map: false,
|
|
@@ -24,9 +24,9 @@ var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
|
24
24
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
25
25
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
26
26
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
27
|
-
var createPostcssConfig = require('./create-postcss-config-
|
|
28
|
-
var hasJsxRuntime = require('./has-jsx-runtime-
|
|
29
|
-
var paths = require('./paths-
|
|
27
|
+
var createPostcssConfig = require('./create-postcss-config-d4f8ca51.cjs.prod.js');
|
|
28
|
+
var hasJsxRuntime = require('./has-jsx-runtime-c3202df5.cjs.prod.js');
|
|
29
|
+
var paths = require('./paths-854af5ef.cjs.prod.js');
|
|
30
30
|
var vendorsToTranspile = require('./vendors-to-transpile-04a49d40.cjs.prod.js');
|
|
31
31
|
|
|
32
32
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -55,15 +55,14 @@ let LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
|
55
55
|
function LocalHtmlWebpackPlugin() {
|
|
56
56
|
_classCallCheck(this, LocalHtmlWebpackPlugin);
|
|
57
57
|
}
|
|
58
|
-
|
|
59
58
|
_createClass(LocalHtmlWebpackPlugin, [{
|
|
60
59
|
key: "apply",
|
|
61
60
|
value: function apply(compiler) {
|
|
62
61
|
compiler.hooks.compilation.tap('LocalHtmlWebpackPlugin', compilation => {
|
|
63
62
|
HtmlWebpackPlugin__default["default"].getHooks(compilation).beforeEmit.tapAsync('LocalHtmlWebpackPlugin', (data, cb) => {
|
|
64
63
|
const applicationConfig$1 = applicationConfig.processConfig();
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig$1.env,
|
|
65
|
+
// Now that the app config is defined as a `env.json`, when we start the FE app
|
|
67
66
|
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
68
67
|
// work anymore). To make it work again, we can override the `env.json` config
|
|
69
68
|
// with the env variable before injecting the values into the index.html.
|
|
@@ -71,7 +70,6 @@ let LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
|
71
70
|
process.env.MC_API_URL ? {
|
|
72
71
|
mcApiUrl: process.env.MC_API_URL
|
|
73
72
|
} : {});
|
|
74
|
-
|
|
75
73
|
data.html = mcHtmlTemplate.replaceHtmlPlaceholders(data.html, {
|
|
76
74
|
env: enhancedLocalEnv,
|
|
77
75
|
headers: {}
|
|
@@ -81,14 +79,13 @@ let LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
|
81
79
|
});
|
|
82
80
|
}
|
|
83
81
|
}]);
|
|
84
|
-
|
|
85
82
|
return LocalHtmlWebpackPlugin;
|
|
86
83
|
}();
|
|
87
84
|
|
|
88
85
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
89
|
-
|
|
90
86
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
91
87
|
const momentLocalesToKeep = ["de", "de-at", "de-ch", "en-au", "en-ca", "en-gb", "en-ie", "en-in", "en-nz", "en-sg", "es", "es-do", "es-mx", "fr", "zh-cn"];
|
|
88
|
+
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
92
89
|
|
|
93
90
|
const defaultToggleFlags = {
|
|
94
91
|
generateIndexHtml: true,
|
|
@@ -99,31 +96,26 @@ const defaultOptions = {
|
|
|
99
96
|
sourceFolders: paths.paths.sourceFolders,
|
|
100
97
|
postcssOptions: {},
|
|
101
98
|
toggleFlags: defaultToggleFlags
|
|
102
|
-
};
|
|
103
|
-
// which is why it's disabled by default.
|
|
99
|
+
};
|
|
104
100
|
|
|
101
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
102
|
+
// which is why it's disabled by default.
|
|
105
103
|
const hasReactRefresh = process.env.FAST_REFRESH === 'true';
|
|
106
|
-
|
|
107
104
|
const webpackDevClientEntry = require.resolve('react-dev-utils/webpackHotDevClient');
|
|
108
|
-
|
|
109
105
|
const reactRefreshOverlayEntry = require.resolve('react-dev-utils/refreshOverlayInterop');
|
|
106
|
+
|
|
110
107
|
/**
|
|
111
108
|
* This is a factory function to create the default webpack config
|
|
112
109
|
* for a MC Application in `development` mode.
|
|
113
110
|
* The function requires the file path to the related application
|
|
114
111
|
* "entry point".
|
|
115
112
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
113
|
function createWebpackConfigForDevelopment() {
|
|
119
114
|
var _context, _context2, _context3, _context4, _context5;
|
|
120
|
-
|
|
121
115
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
122
|
-
|
|
123
116
|
const mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
|
|
124
117
|
toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
|
|
125
118
|
});
|
|
126
|
-
|
|
127
119
|
return {
|
|
128
120
|
// https://webpack.js.org/concepts/#mode
|
|
129
121
|
mode: 'development',
|
|
@@ -168,9 +160,11 @@ function createWebpackConfigForDevelopment() {
|
|
|
168
160
|
}
|
|
169
161
|
},
|
|
170
162
|
entry: {
|
|
171
|
-
app: _filterInstanceProperty__default["default"](_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'),
|
|
163
|
+
app: _filterInstanceProperty__default["default"](_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'),
|
|
164
|
+
// When using the experimental `react-refresh` integration,
|
|
172
165
|
// the webpack plugin takes care of injecting the dev client for us.
|
|
173
|
-
!hasReactRefresh &&
|
|
166
|
+
!hasReactRefresh &&
|
|
167
|
+
// Include an alternative client for WebpackDevServer. A client's job is to
|
|
174
168
|
// connect to WebpackDevServer by a socket and get notified about changes.
|
|
175
169
|
// When you save a file, the client will either apply hot updates (in case
|
|
176
170
|
// of CSS changes), or refresh the page (in case of JS changes). When you
|
|
@@ -181,8 +175,10 @@ function createWebpackConfigForDevelopment() {
|
|
|
181
175
|
//
|
|
182
176
|
// require.resolve('webpack-dev-server/client') + '?/',
|
|
183
177
|
// require.resolve('webpack/hot/dev-server'),
|
|
184
|
-
webpackDevClientEntry,
|
|
185
|
-
|
|
178
|
+
webpackDevClientEntry,
|
|
179
|
+
// Finally, this is your app's code
|
|
180
|
+
mergedOptions.entryPoint
|
|
181
|
+
// We include the app code last so that if there is a runtime error during
|
|
186
182
|
// initialization, it doesn't blow up the WebpackDevServer client, and
|
|
187
183
|
// changing JS code would still trigger a refresh.
|
|
188
184
|
]).call(_context2, Boolean)
|
|
@@ -203,14 +199,16 @@ function createWebpackConfigForDevelopment() {
|
|
|
203
199
|
// Point sourcemap entries to the original disk location (format as URL on Windows)
|
|
204
200
|
devtoolModuleFilenameTemplate: info => path__default["default"].resolve(info.absoluteResourcePath).replace(/\\/g, '/')
|
|
205
201
|
},
|
|
206
|
-
plugins: _filterInstanceProperty__default["default"](_context3 = [new WebpackBar__default["default"](),
|
|
202
|
+
plugins: _filterInstanceProperty__default["default"](_context3 = [new WebpackBar__default["default"](),
|
|
203
|
+
// Allows to "assign" custom options to the `webpack` object.
|
|
207
204
|
// At the moment, this is used to share some props with `postcss.config`.
|
|
208
205
|
new webpack__default["default"].LoaderOptionsPlugin({
|
|
209
206
|
options: {
|
|
210
207
|
sourceFolders: mergedOptions.sourceFolders,
|
|
211
208
|
context: __dirname
|
|
212
209
|
}
|
|
213
|
-
}),
|
|
210
|
+
}),
|
|
211
|
+
// Makes some environment variables available to the JS code, for example:
|
|
214
212
|
// if (process.env.NODE_ENV === 'development') { ... }.
|
|
215
213
|
new webpack__default["default"].DefinePlugin({
|
|
216
214
|
__DEV__: 'true',
|
|
@@ -221,11 +219,14 @@ function createWebpackConfigForDevelopment() {
|
|
|
221
219
|
inject: false,
|
|
222
220
|
filename: paths.paths.appIndexHtml,
|
|
223
221
|
template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
|
|
224
|
-
}), mergedOptions.toggleFlags.generateIndexHtml && new LocalHtmlWebpackPlugin(),
|
|
222
|
+
}), mergedOptions.toggleFlags.generateIndexHtml && new LocalHtmlWebpackPlugin(),
|
|
223
|
+
// Only keep locales that are available in the Merchant Center.
|
|
225
224
|
new MomentLocalesPlugin__default["default"]({
|
|
226
225
|
localesToKeep: momentLocalesToKeep
|
|
227
|
-
}),
|
|
228
|
-
|
|
226
|
+
}),
|
|
227
|
+
// This is necessary to emit hot updates (CSS and Fast Refresh):
|
|
228
|
+
new webpack__default["default"].HotModuleReplacementPlugin(),
|
|
229
|
+
// Experimental hot reloading for React .
|
|
229
230
|
// https://github.com/facebook/react/tree/master/packages/react-refresh
|
|
230
231
|
hasReactRefresh && new ReactRefreshWebpackPlugin__default["default"]({
|
|
231
232
|
overlay: {
|
|
@@ -241,7 +242,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
241
242
|
module: {
|
|
242
243
|
// Makes missing exports an error instead of warning.
|
|
243
244
|
strictExportPresence: true,
|
|
244
|
-
rules: [
|
|
245
|
+
rules: [
|
|
246
|
+
// For svg icons, we want to get them transformed into React components
|
|
245
247
|
// when we import them.
|
|
246
248
|
{
|
|
247
249
|
test: /\.react\.svg$/,
|
|
@@ -276,11 +278,13 @@ function createWebpackConfigForDevelopment() {
|
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
280
|
}]
|
|
279
|
-
},
|
|
281
|
+
},
|
|
282
|
+
// For normal svg files (not icons) we should load the file normally
|
|
280
283
|
// and simply use it as a `<img src/>`.
|
|
281
284
|
{
|
|
282
285
|
test: function testForNormalSvgFiles(fileName) {
|
|
283
|
-
return (
|
|
286
|
+
return (
|
|
287
|
+
// Use this only for plain SVG.
|
|
284
288
|
// For SVG as React components, see loader above.
|
|
285
289
|
_endsWithInstanceProperty__default["default"](fileName).call(fileName, '.svg') && !_endsWithInstanceProperty__default["default"](fileName).call(fileName, '.react.svg')
|
|
286
290
|
);
|
|
@@ -291,7 +295,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
291
295
|
}, {
|
|
292
296
|
test: /\.png$/,
|
|
293
297
|
type: 'asset/resource'
|
|
294
|
-
},
|
|
298
|
+
},
|
|
299
|
+
// "postcss" loader applies autoprefixer to our CSS
|
|
295
300
|
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
296
301
|
// "style" loader turns CSS into JS modules that inject <style> tags.
|
|
297
302
|
{
|
|
@@ -315,7 +320,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
315
320
|
}]
|
|
316
321
|
}, {
|
|
317
322
|
test: function testForNormalCssFiles(fileName) {
|
|
318
|
-
return (
|
|
323
|
+
return (
|
|
324
|
+
// Use this only for plain CSS.
|
|
319
325
|
// For css-modules, see loader above.
|
|
320
326
|
_endsWithInstanceProperty__default["default"](fileName).call(fileName, '.css') && !(_endsWithInstanceProperty__default["default"](fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty__default["default"](fileName).call(fileName, '.module.css'))
|
|
321
327
|
);
|
|
@@ -358,7 +364,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
358
364
|
// See https://github.com/webpack/webpack/issues/6571
|
|
359
365
|
sideEffects: true
|
|
360
366
|
}]
|
|
361
|
-
},
|
|
367
|
+
},
|
|
368
|
+
// Fix for react-intl
|
|
362
369
|
// https://github.com/formatjs/formatjs/issues/143#issuecomment-518774786
|
|
363
370
|
{
|
|
364
371
|
test: /\.mjs$/,
|
|
@@ -367,16 +374,17 @@ function createWebpackConfigForDevelopment() {
|
|
|
367
374
|
// https://webpack.js.org/configuration/module/#resolvefullyspecified
|
|
368
375
|
fullySpecified: false
|
|
369
376
|
}
|
|
370
|
-
},
|
|
377
|
+
},
|
|
378
|
+
// Process JS with Babel.
|
|
371
379
|
{
|
|
372
380
|
test: /\.(js|mjs|cjs|jsx|ts|tsx)$/,
|
|
373
|
-
use: [
|
|
381
|
+
use: [
|
|
382
|
+
// This loader parallelizes code compilation, it is optional but
|
|
374
383
|
// improves compile time on larger projects
|
|
375
384
|
{
|
|
376
385
|
loader: require.resolve('thread-loader'),
|
|
377
386
|
options: {
|
|
378
387
|
poolTimeout: Infinity // keep workers alive for more effective watch mode
|
|
379
|
-
|
|
380
388
|
}
|
|
381
389
|
}, {
|
|
382
390
|
loader: require.resolve('babel-loader'),
|
|
@@ -400,7 +408,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
400
408
|
parser: {
|
|
401
409
|
requireEnsure: false
|
|
402
410
|
}
|
|
403
|
-
},
|
|
411
|
+
},
|
|
412
|
+
// Allow to import `*.graphql` SDL files.
|
|
404
413
|
{
|
|
405
414
|
test: /\.graphql$/,
|
|
406
415
|
include: mergedOptions.sourceFolders,
|
|
@@ -22,24 +22,23 @@ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
|
22
22
|
import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
23
23
|
import { processConfig } from '@commercetools-frontend/application-config';
|
|
24
24
|
import { replaceHtmlPlaceholders } from '@commercetools-frontend/mc-html-template';
|
|
25
|
-
import { c as createPostcssConfig } from './create-postcss-config-
|
|
26
|
-
import { h as hasJsxRuntime } from './has-jsx-runtime-
|
|
27
|
-
import { p as paths } from './paths-
|
|
25
|
+
import { c as createPostcssConfig } from './create-postcss-config-9d266de4.esm.js';
|
|
26
|
+
import { h as hasJsxRuntime } from './has-jsx-runtime-e3ecb09b.esm.js';
|
|
27
|
+
import { p as paths } from './paths-ded20ae1.esm.js';
|
|
28
28
|
import { v as vendorsToTranspile } from './vendors-to-transpile-7dc84a72.esm.js';
|
|
29
29
|
|
|
30
30
|
let LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
31
31
|
function LocalHtmlWebpackPlugin() {
|
|
32
32
|
_classCallCheck(this, LocalHtmlWebpackPlugin);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
34
|
_createClass(LocalHtmlWebpackPlugin, [{
|
|
36
35
|
key: "apply",
|
|
37
36
|
value: function apply(compiler) {
|
|
38
37
|
compiler.hooks.compilation.tap('LocalHtmlWebpackPlugin', compilation => {
|
|
39
38
|
HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync('LocalHtmlWebpackPlugin', (data, cb) => {
|
|
40
39
|
const applicationConfig = processConfig();
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const enhancedLocalEnv = _Object$assign({}, applicationConfig.env,
|
|
41
|
+
// Now that the app config is defined as a `env.json`, when we start the FE app
|
|
43
42
|
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
44
43
|
// work anymore). To make it work again, we can override the `env.json` config
|
|
45
44
|
// with the env variable before injecting the values into the index.html.
|
|
@@ -47,7 +46,6 @@ let LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
|
47
46
|
process.env.MC_API_URL ? {
|
|
48
47
|
mcApiUrl: process.env.MC_API_URL
|
|
49
48
|
} : {});
|
|
50
|
-
|
|
51
49
|
data.html = replaceHtmlPlaceholders(data.html, {
|
|
52
50
|
env: enhancedLocalEnv,
|
|
53
51
|
headers: {}
|
|
@@ -57,14 +55,13 @@ let LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
}]);
|
|
60
|
-
|
|
61
58
|
return LocalHtmlWebpackPlugin;
|
|
62
59
|
}();
|
|
63
60
|
|
|
64
61
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
65
|
-
|
|
66
62
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context6, _context7; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(source), !0)).call(_context6, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context7 = ownKeys(Object(source))).call(_context7, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
67
63
|
const momentLocalesToKeep = ["de", "de-at", "de-ch", "en-au", "en-ca", "en-gb", "en-ie", "en-in", "en-nz", "en-sg", "es", "es-do", "es-mx", "fr", "zh-cn"];
|
|
64
|
+
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
68
65
|
|
|
69
66
|
const defaultToggleFlags = {
|
|
70
67
|
generateIndexHtml: true,
|
|
@@ -75,31 +72,26 @@ const defaultOptions = {
|
|
|
75
72
|
sourceFolders: paths.sourceFolders,
|
|
76
73
|
postcssOptions: {},
|
|
77
74
|
toggleFlags: defaultToggleFlags
|
|
78
|
-
};
|
|
79
|
-
// which is why it's disabled by default.
|
|
75
|
+
};
|
|
80
76
|
|
|
77
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
78
|
+
// which is why it's disabled by default.
|
|
81
79
|
const hasReactRefresh = process.env.FAST_REFRESH === 'true';
|
|
82
|
-
|
|
83
80
|
const webpackDevClientEntry = require.resolve('react-dev-utils/webpackHotDevClient');
|
|
84
|
-
|
|
85
81
|
const reactRefreshOverlayEntry = require.resolve('react-dev-utils/refreshOverlayInterop');
|
|
82
|
+
|
|
86
83
|
/**
|
|
87
84
|
* This is a factory function to create the default webpack config
|
|
88
85
|
* for a MC Application in `development` mode.
|
|
89
86
|
* The function requires the file path to the related application
|
|
90
87
|
* "entry point".
|
|
91
88
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
89
|
function createWebpackConfigForDevelopment() {
|
|
95
90
|
var _context, _context2, _context3, _context4, _context5;
|
|
96
|
-
|
|
97
91
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
98
|
-
|
|
99
92
|
const mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
|
|
100
93
|
toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
|
|
101
94
|
});
|
|
102
|
-
|
|
103
95
|
return {
|
|
104
96
|
// https://webpack.js.org/concepts/#mode
|
|
105
97
|
mode: 'development',
|
|
@@ -144,9 +136,11 @@ function createWebpackConfigForDevelopment() {
|
|
|
144
136
|
}
|
|
145
137
|
},
|
|
146
138
|
entry: {
|
|
147
|
-
app: _filterInstanceProperty(_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'),
|
|
139
|
+
app: _filterInstanceProperty(_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'),
|
|
140
|
+
// When using the experimental `react-refresh` integration,
|
|
148
141
|
// the webpack plugin takes care of injecting the dev client for us.
|
|
149
|
-
!hasReactRefresh &&
|
|
142
|
+
!hasReactRefresh &&
|
|
143
|
+
// Include an alternative client for WebpackDevServer. A client's job is to
|
|
150
144
|
// connect to WebpackDevServer by a socket and get notified about changes.
|
|
151
145
|
// When you save a file, the client will either apply hot updates (in case
|
|
152
146
|
// of CSS changes), or refresh the page (in case of JS changes). When you
|
|
@@ -157,8 +151,10 @@ function createWebpackConfigForDevelopment() {
|
|
|
157
151
|
//
|
|
158
152
|
// require.resolve('webpack-dev-server/client') + '?/',
|
|
159
153
|
// require.resolve('webpack/hot/dev-server'),
|
|
160
|
-
webpackDevClientEntry,
|
|
161
|
-
|
|
154
|
+
webpackDevClientEntry,
|
|
155
|
+
// Finally, this is your app's code
|
|
156
|
+
mergedOptions.entryPoint
|
|
157
|
+
// We include the app code last so that if there is a runtime error during
|
|
162
158
|
// initialization, it doesn't blow up the WebpackDevServer client, and
|
|
163
159
|
// changing JS code would still trigger a refresh.
|
|
164
160
|
]).call(_context2, Boolean)
|
|
@@ -179,14 +175,16 @@ function createWebpackConfigForDevelopment() {
|
|
|
179
175
|
// Point sourcemap entries to the original disk location (format as URL on Windows)
|
|
180
176
|
devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')
|
|
181
177
|
},
|
|
182
|
-
plugins: _filterInstanceProperty(_context3 = [new WebpackBar(),
|
|
178
|
+
plugins: _filterInstanceProperty(_context3 = [new WebpackBar(),
|
|
179
|
+
// Allows to "assign" custom options to the `webpack` object.
|
|
183
180
|
// At the moment, this is used to share some props with `postcss.config`.
|
|
184
181
|
new webpack.LoaderOptionsPlugin({
|
|
185
182
|
options: {
|
|
186
183
|
sourceFolders: mergedOptions.sourceFolders,
|
|
187
184
|
context: __dirname
|
|
188
185
|
}
|
|
189
|
-
}),
|
|
186
|
+
}),
|
|
187
|
+
// Makes some environment variables available to the JS code, for example:
|
|
190
188
|
// if (process.env.NODE_ENV === 'development') { ... }.
|
|
191
189
|
new webpack.DefinePlugin({
|
|
192
190
|
__DEV__: 'true',
|
|
@@ -197,11 +195,14 @@ function createWebpackConfigForDevelopment() {
|
|
|
197
195
|
inject: false,
|
|
198
196
|
filename: paths.appIndexHtml,
|
|
199
197
|
template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
|
|
200
|
-
}), mergedOptions.toggleFlags.generateIndexHtml && new LocalHtmlWebpackPlugin(),
|
|
198
|
+
}), mergedOptions.toggleFlags.generateIndexHtml && new LocalHtmlWebpackPlugin(),
|
|
199
|
+
// Only keep locales that are available in the Merchant Center.
|
|
201
200
|
new MomentLocalesPlugin({
|
|
202
201
|
localesToKeep: momentLocalesToKeep
|
|
203
|
-
}),
|
|
204
|
-
|
|
202
|
+
}),
|
|
203
|
+
// This is necessary to emit hot updates (CSS and Fast Refresh):
|
|
204
|
+
new webpack.HotModuleReplacementPlugin(),
|
|
205
|
+
// Experimental hot reloading for React .
|
|
205
206
|
// https://github.com/facebook/react/tree/master/packages/react-refresh
|
|
206
207
|
hasReactRefresh && new ReactRefreshWebpackPlugin({
|
|
207
208
|
overlay: {
|
|
@@ -217,7 +218,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
217
218
|
module: {
|
|
218
219
|
// Makes missing exports an error instead of warning.
|
|
219
220
|
strictExportPresence: true,
|
|
220
|
-
rules: [
|
|
221
|
+
rules: [
|
|
222
|
+
// For svg icons, we want to get them transformed into React components
|
|
221
223
|
// when we import them.
|
|
222
224
|
{
|
|
223
225
|
test: /\.react\.svg$/,
|
|
@@ -252,11 +254,13 @@ function createWebpackConfigForDevelopment() {
|
|
|
252
254
|
}
|
|
253
255
|
}
|
|
254
256
|
}]
|
|
255
|
-
},
|
|
257
|
+
},
|
|
258
|
+
// For normal svg files (not icons) we should load the file normally
|
|
256
259
|
// and simply use it as a `<img src/>`.
|
|
257
260
|
{
|
|
258
261
|
test: function testForNormalSvgFiles(fileName) {
|
|
259
|
-
return (
|
|
262
|
+
return (
|
|
263
|
+
// Use this only for plain SVG.
|
|
260
264
|
// For SVG as React components, see loader above.
|
|
261
265
|
_endsWithInstanceProperty(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty(fileName).call(fileName, '.react.svg')
|
|
262
266
|
);
|
|
@@ -267,7 +271,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
267
271
|
}, {
|
|
268
272
|
test: /\.png$/,
|
|
269
273
|
type: 'asset/resource'
|
|
270
|
-
},
|
|
274
|
+
},
|
|
275
|
+
// "postcss" loader applies autoprefixer to our CSS
|
|
271
276
|
// "css" loader resolves paths in CSS and adds assets as dependencies.
|
|
272
277
|
// "style" loader turns CSS into JS modules that inject <style> tags.
|
|
273
278
|
{
|
|
@@ -291,7 +296,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
291
296
|
}]
|
|
292
297
|
}, {
|
|
293
298
|
test: function testForNormalCssFiles(fileName) {
|
|
294
|
-
return (
|
|
299
|
+
return (
|
|
300
|
+
// Use this only for plain CSS.
|
|
295
301
|
// For css-modules, see loader above.
|
|
296
302
|
_endsWithInstanceProperty(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty(fileName).call(fileName, '.module.css'))
|
|
297
303
|
);
|
|
@@ -334,7 +340,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
334
340
|
// See https://github.com/webpack/webpack/issues/6571
|
|
335
341
|
sideEffects: true
|
|
336
342
|
}]
|
|
337
|
-
},
|
|
343
|
+
},
|
|
344
|
+
// Fix for react-intl
|
|
338
345
|
// https://github.com/formatjs/formatjs/issues/143#issuecomment-518774786
|
|
339
346
|
{
|
|
340
347
|
test: /\.mjs$/,
|
|
@@ -343,16 +350,17 @@ function createWebpackConfigForDevelopment() {
|
|
|
343
350
|
// https://webpack.js.org/configuration/module/#resolvefullyspecified
|
|
344
351
|
fullySpecified: false
|
|
345
352
|
}
|
|
346
|
-
},
|
|
353
|
+
},
|
|
354
|
+
// Process JS with Babel.
|
|
347
355
|
{
|
|
348
356
|
test: /\.(js|mjs|cjs|jsx|ts|tsx)$/,
|
|
349
|
-
use: [
|
|
357
|
+
use: [
|
|
358
|
+
// This loader parallelizes code compilation, it is optional but
|
|
350
359
|
// improves compile time on larger projects
|
|
351
360
|
{
|
|
352
361
|
loader: require.resolve('thread-loader'),
|
|
353
362
|
options: {
|
|
354
363
|
poolTimeout: Infinity // keep workers alive for more effective watch mode
|
|
355
|
-
|
|
356
364
|
}
|
|
357
365
|
}, {
|
|
358
366
|
loader: require.resolve('babel-loader'),
|
|
@@ -376,7 +384,8 @@ function createWebpackConfigForDevelopment() {
|
|
|
376
384
|
parser: {
|
|
377
385
|
requireEnsure: false
|
|
378
386
|
}
|
|
379
|
-
},
|
|
387
|
+
},
|
|
388
|
+
// Allow to import `*.graphql` SDL files.
|
|
380
389
|
{
|
|
381
390
|
test: /\.graphql$/,
|
|
382
391
|
include: mergedOptions.sourceFolders,
|