@commercetools-frontend/mc-scripts 21.7.0 → 21.8.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/LICENSE +1 -1
- package/README.md +1 -42
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +1 -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/{build/config/application-runtime.js → application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js} +2 -2
- 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 +1 -1
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +1 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +354 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +354 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +338 -0
- package/cli/package.json +4 -0
- package/config/create-webpack-config-for-development.js +7 -1
- package/config/create-webpack-config-for-production.js +7 -1
- package/config/vendors-to-transpile.js +5 -1
- package/dist/build-8582b673.esm.js +209 -0
- package/dist/build-9395925a.cjs.prod.js +224 -0
- package/dist/build-97278377.cjs.dev.js +224 -0
- package/dist/build-vite-6c987a60.cjs.dev.js +109 -0
- package/dist/build-vite-76d44332.cjs.prod.js +109 -0
- package/dist/build-vite-a9602b19.esm.js +97 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +1 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +30 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +30 -0
- package/dist/commercetools-frontend-mc-scripts.esm.js +22 -0
- package/dist/compile-html-0c588a89.cjs.dev.js +93 -0
- package/dist/compile-html-4832f8c5.esm.js +83 -0
- package/dist/compile-html-7654b5e6.cjs.prod.js +93 -0
- package/dist/config-sync-20bc05e8.esm.js +868 -0
- package/dist/config-sync-62824317.cjs.prod.js +887 -0
- package/dist/config-sync-d52e73f6.cjs.dev.js +892 -0
- package/dist/create-postcss-config-4cbe10ab.cjs.dev.js +90 -0
- package/dist/create-postcss-config-8ea16440.cjs.prod.js +90 -0
- package/{build/config/create-postcss-config.js → dist/create-postcss-config-c1aa3525.esm.js} +27 -25
- package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-8a8b84d6.esm.js} +92 -56
- package/dist/create-webpack-config-for-development-a5e73092.cjs.prod.js +418 -0
- package/dist/create-webpack-config-for-development-e2735e02.cjs.dev.js +418 -0
- package/dist/create-webpack-config-for-production-4e7b56c0.cjs.prod.js +468 -0
- package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-7dc669e5.esm.js} +117 -52
- package/dist/create-webpack-config-for-production-d9bf281c.cjs.dev.js +468 -0
- package/dist/declarations/src/application-runtime.d.ts +1 -0
- package/dist/declarations/src/cli.d.ts +4 -0
- package/dist/declarations/src/commands/build-vite.d.ts +2 -0
- package/dist/declarations/src/commands/build.d.ts +2 -0
- package/dist/declarations/src/commands/compile-html.d.ts +3 -0
- package/dist/declarations/src/commands/config-sync.d.ts +3 -0
- package/dist/declarations/src/commands/login.d.ts +2 -0
- package/dist/declarations/src/commands/serve.d.ts +2 -0
- package/dist/declarations/src/commands/start-vite.d.ts +2 -0
- package/dist/declarations/src/commands/start.d.ts +2 -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/has-jsx-runtime.d.ts +2 -0
- package/dist/declarations/src/config/paths.d.ts +12 -0
- package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
- package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
- package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
- package/dist/declarations/src/generated/core.d.ts +710 -0
- package/dist/declarations/src/generated/settings.d.ts +2383 -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 +82 -0
- package/dist/declarations/src/utils/auth.d.ts +6 -0
- package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
- package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
- package/dist/declarations/src/utils/graphql-requests.d.ts +80 -0
- package/dist/declarations/src/utils/user-agent.d.ts +2 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
- package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
- package/dist/declarations/src/webpack.d.ts +2 -0
- package/dist/has-jsx-runtime-0b03b72e.cjs.prod.js +17 -0
- package/dist/has-jsx-runtime-3d4bb633.cjs.dev.js +17 -0
- package/{build/config/has-jsx-runtime.js → dist/has-jsx-runtime-8314226e.esm.js} +1 -3
- package/dist/login-706ccc9a.cjs.prod.js +165 -0
- package/dist/login-779552b7.cjs.dev.js +165 -0
- package/dist/login-7d94659e.esm.js +155 -0
- package/dist/package-a98de907.esm.js +133 -0
- package/dist/package-aaf61bf0.cjs.dev.js +135 -0
- package/dist/package-b5c040f3.cjs.prod.js +135 -0
- package/dist/paths-16823f56.cjs.dev.js +55 -0
- package/dist/paths-76b66e74.cjs.prod.js +55 -0
- package/dist/paths-ed23d5a1.esm.js +46 -0
- package/dist/serve-12de323b.cjs.dev.js +70 -0
- package/dist/serve-784f4fcd.cjs.prod.js +70 -0
- package/dist/serve-d6b437b1.esm.js +62 -0
- package/dist/start-2b953ab0.cjs.dev.js +209 -0
- package/dist/start-e3ccd672.cjs.prod.js +209 -0
- package/dist/start-e924bd5d.esm.js +194 -0
- package/dist/start-vite-737bacca.cjs.dev.js +149 -0
- package/dist/start-vite-b0f58ae4.cjs.prod.js +149 -0
- package/dist/start-vite-ec5d40b5.esm.js +136 -0
- package/dist/user-agent-5da1830b.cjs.dev.js +106 -0
- package/dist/user-agent-8044acd6.esm.js +94 -0
- package/dist/user-agent-d18809af.cjs.prod.js +106 -0
- package/dist/vendors-to-transpile-367e0ba8.cjs.prod.js +5 -0
- package/dist/vendors-to-transpile-68e03526.esm.js +3 -0
- package/dist/vendors-to-transpile-b51af5d3.cjs.dev.js +5 -0
- package/package.json +41 -39
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +1 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +14 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +14 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +6 -0
- package/postcss/package.json +4 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +1 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +51 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +51 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +42 -0
- package/webpack/package.json +4 -0
- package/build/bin/cli.js +0 -264
- package/build/commands/build-vite.js +0 -91
- package/build/commands/build.js +0 -140
- package/build/commands/compile-html.js +0 -53
- package/build/commands/config-sync.js +0 -176
- package/build/commands/login.js +0 -60
- package/build/commands/serve.js +0 -37
- package/build/commands/start-vite.js +0 -138
- package/build/commands/start.js +0 -108
- package/build/config/paths.js +0 -38
- package/build/config/vendors-to-transpile.js +0 -3
- package/build/config/webpack-dev-server.config.js +0 -69
- package/build/index.js +0 -16
- package/build/utils/auth.js +0 -34
- package/build/utils/auth.spec.js +0 -61
- package/build/utils/create-custom-application.settings.graphql +0 -8
- package/build/utils/credentials-storage.js +0 -72
- package/build/utils/credentials-storage.spec.js +0 -69
- package/build/utils/fetch-custom-application.settings.graphql +0 -36
- package/build/utils/fetch-user-organizations.core.graphql +0 -9
- package/build/utils/get-config-diff.js +0 -308
- package/build/utils/get-config-diff.spec.js +0 -285
- package/build/utils/graphql-requests.js +0 -105
- package/build/utils/graphql-requests.spec.js +0 -159
- package/build/utils/require-graphql.js +0 -15
- package/build/utils/update-custom-application.settings.graphql +0 -13
- package/build/utils/user-agent.js +0 -15
- package/build/webpack-plugins/final-stats-writer-plugin.js +0 -50
- package/build/webpack-plugins/local-html-webpack-plugin.js +0 -38
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
4
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var _package = require('./package-aaf61bf0.cjs.dev.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
12
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
13
|
+
|
|
14
|
+
// This function aims to return the same result as `require.resolve`.
|
|
15
|
+
// However, resolving a path to a `.css` file does not return the real
|
|
16
|
+
// path when this file is executed within a Jest environment, because
|
|
17
|
+
// of the `identity-obj-proxy` resolver.
|
|
18
|
+
// Therefore, we trick it by resolving the package entry point and
|
|
19
|
+
// constructing the real path manually.
|
|
20
|
+
var safeResolvePath = function safeResolvePath(packageName, fileRelativePath) {
|
|
21
|
+
var defaultPackageEntryPoint = require.resolve(packageName);
|
|
22
|
+
|
|
23
|
+
var _defaultPackageEntryP = defaultPackageEntryPoint.split('dist'),
|
|
24
|
+
_defaultPackageEntryP2 = _slicedToArray(_defaultPackageEntryP, 1),
|
|
25
|
+
pathToPackage = _defaultPackageEntryP2[0];
|
|
26
|
+
|
|
27
|
+
return path__default["default"].join(pathToPackage, fileRelativePath);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function createPostcssConfig() {
|
|
31
|
+
var _context, _context2;
|
|
32
|
+
|
|
33
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
34
|
+
_ref$postcssImportPat = _ref.postcssImportPaths,
|
|
35
|
+
postcssImportPaths = _ref$postcssImportPat === void 0 ? [] : _ref$postcssImportPat,
|
|
36
|
+
_ref$postcssCustomMed = _ref.postcssCustomMediaPaths,
|
|
37
|
+
postcssCustomMediaPaths = _ref$postcssCustomMed === void 0 ? [] : _ref$postcssCustomMed,
|
|
38
|
+
_ref$postcssCustomPro = _ref.postcssCustomPropertiesPaths,
|
|
39
|
+
postcssCustomPropertiesPaths = _ref$postcssCustomPro === void 0 ? [] : _ref$postcssCustomPro;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
parser: false,
|
|
43
|
+
map: false,
|
|
44
|
+
plugins: [
|
|
45
|
+
/**
|
|
46
|
+
* Plugin to transform `@import` rules by inlining content.
|
|
47
|
+
* https://github.com/postcss/postcss-import
|
|
48
|
+
*/
|
|
49
|
+
require('postcss-import')({
|
|
50
|
+
path: postcssImportPaths
|
|
51
|
+
}),
|
|
52
|
+
/**
|
|
53
|
+
* Plugin to parse CSS and add vendor prefixes to CSS rules
|
|
54
|
+
* using values from "[Can I Use](https://caniuse.com/)".
|
|
55
|
+
* https://github.com/postcss/autoprefixer
|
|
56
|
+
*/
|
|
57
|
+
require('autoprefixer')({
|
|
58
|
+
// Enables `-ms-` prefixes for Grid Layout including some
|
|
59
|
+
// limited autoplacement support.
|
|
60
|
+
// https://github.com/postcss/autoprefixer#grid-autoplacement-support-in-ie
|
|
61
|
+
grid: 'autoplace',
|
|
62
|
+
overrideBrowserslist: process.env.NODE_ENV === 'production' ? _package.pkgJson.browserslist.production : _package.pkgJson.browserslist.development
|
|
63
|
+
}),
|
|
64
|
+
/**
|
|
65
|
+
* Plugin to enable Custom Media Queries in CSS, following
|
|
66
|
+
* the [CSS Media Queries](https://drafts.csswg.org/mediaqueries-5/#custom-mq) specification.
|
|
67
|
+
* https://github.com/postcss/postcss-custom-media
|
|
68
|
+
*/
|
|
69
|
+
require('postcss-custom-media')({
|
|
70
|
+
importFrom: _concatInstanceProperty__default["default"](_context = [safeResolvePath('@commercetools-frontend/application-components', 'materials/media-queries.css')]).call(_context, _toConsumableArray(postcssCustomMediaPaths))
|
|
71
|
+
}),
|
|
72
|
+
/**
|
|
73
|
+
* Plugin to enable Custom Properties in CSS, following
|
|
74
|
+
* the [CSS Custom Properties](https://www.w3.org/TR/css-variables-1/) specification.
|
|
75
|
+
* https://github.com/postcss/postcss-custom-properties
|
|
76
|
+
*/
|
|
77
|
+
require('postcss-custom-properties')({
|
|
78
|
+
preserve: false,
|
|
79
|
+
importFrom: _concatInstanceProperty__default["default"](_context2 = [safeResolvePath('@commercetools-uikit/design-system', 'materials/custom-properties.css')]).call(_context2, _toConsumableArray(postcssCustomPropertiesPaths))
|
|
80
|
+
}),
|
|
81
|
+
/**
|
|
82
|
+
* Plugin to `console.log()` the messages (warnings, etc.)
|
|
83
|
+
* registered by other PostCSS plugins.
|
|
84
|
+
* https://github.com/postcss/postcss-reporter
|
|
85
|
+
*/
|
|
86
|
+
require('postcss-reporter')()]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
exports.createPostcssConfig = createPostcssConfig;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
4
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
5
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var _package = require('./package-b5c040f3.cjs.prod.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
12
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
13
|
+
|
|
14
|
+
// This function aims to return the same result as `require.resolve`.
|
|
15
|
+
// However, resolving a path to a `.css` file does not return the real
|
|
16
|
+
// path when this file is executed within a Jest environment, because
|
|
17
|
+
// of the `identity-obj-proxy` resolver.
|
|
18
|
+
// Therefore, we trick it by resolving the package entry point and
|
|
19
|
+
// constructing the real path manually.
|
|
20
|
+
var safeResolvePath = function safeResolvePath(packageName, fileRelativePath) {
|
|
21
|
+
var defaultPackageEntryPoint = require.resolve(packageName);
|
|
22
|
+
|
|
23
|
+
var _defaultPackageEntryP = defaultPackageEntryPoint.split('dist'),
|
|
24
|
+
_defaultPackageEntryP2 = _slicedToArray(_defaultPackageEntryP, 1),
|
|
25
|
+
pathToPackage = _defaultPackageEntryP2[0];
|
|
26
|
+
|
|
27
|
+
return path__default["default"].join(pathToPackage, fileRelativePath);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function createPostcssConfig() {
|
|
31
|
+
var _context, _context2;
|
|
32
|
+
|
|
33
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
34
|
+
_ref$postcssImportPat = _ref.postcssImportPaths,
|
|
35
|
+
postcssImportPaths = _ref$postcssImportPat === void 0 ? [] : _ref$postcssImportPat,
|
|
36
|
+
_ref$postcssCustomMed = _ref.postcssCustomMediaPaths,
|
|
37
|
+
postcssCustomMediaPaths = _ref$postcssCustomMed === void 0 ? [] : _ref$postcssCustomMed,
|
|
38
|
+
_ref$postcssCustomPro = _ref.postcssCustomPropertiesPaths,
|
|
39
|
+
postcssCustomPropertiesPaths = _ref$postcssCustomPro === void 0 ? [] : _ref$postcssCustomPro;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
parser: false,
|
|
43
|
+
map: false,
|
|
44
|
+
plugins: [
|
|
45
|
+
/**
|
|
46
|
+
* Plugin to transform `@import` rules by inlining content.
|
|
47
|
+
* https://github.com/postcss/postcss-import
|
|
48
|
+
*/
|
|
49
|
+
require('postcss-import')({
|
|
50
|
+
path: postcssImportPaths
|
|
51
|
+
}),
|
|
52
|
+
/**
|
|
53
|
+
* Plugin to parse CSS and add vendor prefixes to CSS rules
|
|
54
|
+
* using values from "[Can I Use](https://caniuse.com/)".
|
|
55
|
+
* https://github.com/postcss/autoprefixer
|
|
56
|
+
*/
|
|
57
|
+
require('autoprefixer')({
|
|
58
|
+
// Enables `-ms-` prefixes for Grid Layout including some
|
|
59
|
+
// limited autoplacement support.
|
|
60
|
+
// https://github.com/postcss/autoprefixer#grid-autoplacement-support-in-ie
|
|
61
|
+
grid: 'autoplace',
|
|
62
|
+
overrideBrowserslist: _package.pkgJson.browserslist.production
|
|
63
|
+
}),
|
|
64
|
+
/**
|
|
65
|
+
* Plugin to enable Custom Media Queries in CSS, following
|
|
66
|
+
* the [CSS Media Queries](https://drafts.csswg.org/mediaqueries-5/#custom-mq) specification.
|
|
67
|
+
* https://github.com/postcss/postcss-custom-media
|
|
68
|
+
*/
|
|
69
|
+
require('postcss-custom-media')({
|
|
70
|
+
importFrom: _concatInstanceProperty__default["default"](_context = [safeResolvePath('@commercetools-frontend/application-components', 'materials/media-queries.css')]).call(_context, _toConsumableArray(postcssCustomMediaPaths))
|
|
71
|
+
}),
|
|
72
|
+
/**
|
|
73
|
+
* Plugin to enable Custom Properties in CSS, following
|
|
74
|
+
* the [CSS Custom Properties](https://www.w3.org/TR/css-variables-1/) specification.
|
|
75
|
+
* https://github.com/postcss/postcss-custom-properties
|
|
76
|
+
*/
|
|
77
|
+
require('postcss-custom-properties')({
|
|
78
|
+
preserve: false,
|
|
79
|
+
importFrom: _concatInstanceProperty__default["default"](_context2 = [safeResolvePath('@commercetools-uikit/design-system', 'materials/custom-properties.css')]).call(_context2, _toConsumableArray(postcssCustomPropertiesPaths))
|
|
80
|
+
}),
|
|
81
|
+
/**
|
|
82
|
+
* Plugin to `console.log()` the messages (warnings, etc.)
|
|
83
|
+
* registered by other PostCSS plugins.
|
|
84
|
+
* https://github.com/postcss/postcss-reporter
|
|
85
|
+
*/
|
|
86
|
+
require('postcss-reporter')()]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
exports.createPostcssConfig = createPostcssConfig;
|
package/{build/config/create-postcss-config.js → dist/create-postcss-config-c1aa3525.esm.js}
RENAMED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import _toConsumableArray from '@babel/runtime-corejs3/helpers/esm/toConsumableArray';
|
|
2
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
3
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { p as pkgJson } from './package-a98de907.esm.js';
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
browserslist
|
|
7
|
-
} = require('../../package.json'); // This function aims to return the same result as `require.resolve`.
|
|
7
|
+
// This function aims to return the same result as `require.resolve`.
|
|
8
8
|
// However, resolving a path to a `.css` file does not return the real
|
|
9
9
|
// path when this file is executed within a Jest environment, because
|
|
10
10
|
// of the `identity-obj-proxy` resolver.
|
|
11
11
|
// Therefore, we trick it by resolving the package entry point and
|
|
12
12
|
// constructing the real path manually.
|
|
13
|
+
var safeResolvePath = function safeResolvePath(packageName, fileRelativePath) {
|
|
14
|
+
var defaultPackageEntryPoint = require.resolve(packageName);
|
|
13
15
|
|
|
16
|
+
var _defaultPackageEntryP = defaultPackageEntryPoint.split('dist'),
|
|
17
|
+
_defaultPackageEntryP2 = _slicedToArray(_defaultPackageEntryP, 1),
|
|
18
|
+
pathToPackage = _defaultPackageEntryP2[0];
|
|
14
19
|
|
|
15
|
-
const safeResolvePath = (packageName, fileRelativePath) => {
|
|
16
|
-
const defaultPackageEntryPoint = require.resolve(packageName);
|
|
17
|
-
|
|
18
|
-
const [pathToPackage] = defaultPackageEntryPoint.split('dist');
|
|
19
20
|
return path.join(pathToPackage, fileRelativePath);
|
|
20
21
|
};
|
|
21
|
-
/**
|
|
22
|
-
* @param {Object} options - Configuration options to extend the default configuration
|
|
23
|
-
* @param {string[]} options.postcssImportPaths[] - A list of paths where to look for files used by the `@import` statements.
|
|
24
|
-
* @param {string[]} options.postcssCustomMediaPaths[] - A list of paths where to look for files with custom media queries.
|
|
25
|
-
* @param {string[]} options.postcssCustomPropertiesPaths[] - A list of paths where to look for files with custom properties.
|
|
26
|
-
*/
|
|
27
22
|
|
|
23
|
+
function createPostcssConfig() {
|
|
24
|
+
var _context, _context2;
|
|
25
|
+
|
|
26
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
27
|
+
_ref$postcssImportPat = _ref.postcssImportPaths,
|
|
28
|
+
postcssImportPaths = _ref$postcssImportPat === void 0 ? [] : _ref$postcssImportPat,
|
|
29
|
+
_ref$postcssCustomMed = _ref.postcssCustomMediaPaths,
|
|
30
|
+
postcssCustomMediaPaths = _ref$postcssCustomMed === void 0 ? [] : _ref$postcssCustomMed,
|
|
31
|
+
_ref$postcssCustomPro = _ref.postcssCustomPropertiesPaths,
|
|
32
|
+
postcssCustomPropertiesPaths = _ref$postcssCustomPro === void 0 ? [] : _ref$postcssCustomPro;
|
|
28
33
|
|
|
29
|
-
module.exports = function createPostcssConfig({
|
|
30
|
-
postcssImportPaths = [],
|
|
31
|
-
postcssCustomMediaPaths = [],
|
|
32
|
-
postcssCustomPropertiesPaths = []
|
|
33
|
-
} = {}) {
|
|
34
34
|
return {
|
|
35
35
|
parser: false,
|
|
36
36
|
map: false,
|
|
@@ -52,7 +52,7 @@ module.exports = function createPostcssConfig({
|
|
|
52
52
|
// limited autoplacement support.
|
|
53
53
|
// https://github.com/postcss/autoprefixer#grid-autoplacement-support-in-ie
|
|
54
54
|
grid: 'autoplace',
|
|
55
|
-
overrideBrowserslist: process.env.NODE_ENV === 'production' ? browserslist.production : browserslist.development
|
|
55
|
+
overrideBrowserslist: process.env.NODE_ENV === 'production' ? pkgJson.browserslist.production : pkgJson.browserslist.development
|
|
56
56
|
}),
|
|
57
57
|
/**
|
|
58
58
|
* Plugin to enable Custom Media Queries in CSS, following
|
|
@@ -60,7 +60,7 @@ module.exports = function createPostcssConfig({
|
|
|
60
60
|
* https://github.com/postcss/postcss-custom-media
|
|
61
61
|
*/
|
|
62
62
|
require('postcss-custom-media')({
|
|
63
|
-
importFrom: [safeResolvePath('@commercetools-frontend/application-components', 'materials/media-queries.css'),
|
|
63
|
+
importFrom: _concatInstanceProperty(_context = [safeResolvePath('@commercetools-frontend/application-components', 'materials/media-queries.css')]).call(_context, _toConsumableArray(postcssCustomMediaPaths))
|
|
64
64
|
}),
|
|
65
65
|
/**
|
|
66
66
|
* Plugin to enable Custom Properties in CSS, following
|
|
@@ -69,7 +69,7 @@ module.exports = function createPostcssConfig({
|
|
|
69
69
|
*/
|
|
70
70
|
require('postcss-custom-properties')({
|
|
71
71
|
preserve: false,
|
|
72
|
-
importFrom: [safeResolvePath('@commercetools-uikit/design-system', 'materials/custom-properties.css'),
|
|
72
|
+
importFrom: _concatInstanceProperty(_context2 = [safeResolvePath('@commercetools-uikit/design-system', 'materials/custom-properties.css')]).call(_context2, _toConsumableArray(postcssCustomPropertiesPaths))
|
|
73
73
|
}),
|
|
74
74
|
/**
|
|
75
75
|
* Plugin to `console.log()` the messages (warnings, etc.)
|
|
@@ -78,4 +78,6 @@ module.exports = function createPostcssConfig({
|
|
|
78
78
|
*/
|
|
79
79
|
require('postcss-reporter')()]
|
|
80
80
|
};
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { createPostcssConfig as c };
|
|
@@ -1,35 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
2
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
3
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
4
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
5
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
6
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
7
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
8
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
9
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
10
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
11
|
+
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
12
|
+
import _endsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/ends-with';
|
|
13
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import webpack from 'webpack';
|
|
16
|
+
import WebpackBar from 'webpackbar';
|
|
17
|
+
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
18
|
+
import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
|
|
19
|
+
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
20
|
+
import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
|
|
21
|
+
import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
|
|
22
|
+
import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
23
|
+
import { processConfig } from '@commercetools-frontend/application-config';
|
|
24
|
+
import { replaceHtmlPlaceholders } from '@commercetools-frontend/mc-html-template';
|
|
25
|
+
import { p as paths } from './paths-ed23d5a1.esm.js';
|
|
26
|
+
import { v as vendorsToTranspile } from './vendors-to-transpile-68e03526.esm.js';
|
|
27
|
+
import { c as createPostcssConfig } from './create-postcss-config-c1aa3525.esm.js';
|
|
28
|
+
import { h as hasJsxRuntime } from './has-jsx-runtime-8314226e.esm.js';
|
|
2
29
|
|
|
3
|
-
|
|
4
|
-
|
|
30
|
+
var LocalHtmlWebpackPlugin = /*#__PURE__*/function () {
|
|
31
|
+
function LocalHtmlWebpackPlugin() {
|
|
32
|
+
_classCallCheck(this, LocalHtmlWebpackPlugin);
|
|
33
|
+
}
|
|
5
34
|
|
|
6
|
-
|
|
35
|
+
_createClass(LocalHtmlWebpackPlugin, [{
|
|
36
|
+
key: "apply",
|
|
37
|
+
value: function apply(compiler) {
|
|
38
|
+
compiler.hooks.compilation.tap('LocalHtmlWebpackPlugin', function (compilation) {
|
|
39
|
+
HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync('LocalHtmlWebpackPlugin', function (data, cb) {
|
|
40
|
+
var applicationConfig = processConfig();
|
|
7
41
|
|
|
8
|
-
|
|
42
|
+
var enhancedLocalEnv = _Object$assign({}, applicationConfig.env, // Now that the app config is defined as a `env.json`, when we start the FE app
|
|
43
|
+
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
44
|
+
// work anymore). To make it work again, we can override the `env.json` config
|
|
45
|
+
// with the env variable before injecting the values into the index.html.
|
|
46
|
+
// NOTE: this is only necessary for development.
|
|
47
|
+
process.env.MC_API_URL ? {
|
|
48
|
+
mcApiUrl: process.env.MC_API_URL
|
|
49
|
+
} : {});
|
|
9
50
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
51
|
+
data.html = replaceHtmlPlaceholders(data.html, {
|
|
52
|
+
env: enhancedLocalEnv,
|
|
53
|
+
headers: {}
|
|
54
|
+
});
|
|
55
|
+
cb(null, data);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}]);
|
|
19
60
|
|
|
20
|
-
|
|
61
|
+
return LocalHtmlWebpackPlugin;
|
|
62
|
+
}();
|
|
21
63
|
|
|
22
|
-
|
|
64
|
+
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; }
|
|
23
65
|
|
|
24
|
-
|
|
25
|
-
|
|
66
|
+
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
|
+
var defaultToggleFlags = {
|
|
26
68
|
generateIndexHtml: true,
|
|
27
|
-
// Some environemnts do not require `core-js` and can hence disable
|
|
28
|
-
// it explicitely. This will disable `core-js` for `preset-env` and the
|
|
29
|
-
// `plugin-transform-runtime`.
|
|
30
69
|
disableCoreJs: false
|
|
31
70
|
};
|
|
32
|
-
|
|
71
|
+
var defaultOptions = {
|
|
33
72
|
entryPoint: paths.entryPoint,
|
|
34
73
|
sourceFolders: paths.sourceFolders,
|
|
35
74
|
postcssOptions: {},
|
|
@@ -37,32 +76,28 @@ const defaultOptions = {
|
|
|
37
76
|
}; // Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
38
77
|
// which is why it's disabled by default.
|
|
39
78
|
|
|
40
|
-
|
|
79
|
+
var hasReactRefresh = process.env.FAST_REFRESH === 'true';
|
|
41
80
|
|
|
42
|
-
|
|
81
|
+
var webpackDevClientEntry = require.resolve('react-dev-utils/webpackHotDevClient');
|
|
43
82
|
|
|
44
|
-
|
|
83
|
+
var reactRefreshOverlayEntry = require.resolve('react-dev-utils/refreshOverlayInterop');
|
|
45
84
|
/**
|
|
46
85
|
* This is a factory function to create the default webpack config
|
|
47
86
|
* for a MC Application in `development` mode.
|
|
48
87
|
* The function requires the file path to the related application
|
|
49
88
|
* "entry point".
|
|
50
|
-
*
|
|
51
|
-
* @param {Object} options - Options to configure the Webpack config
|
|
52
|
-
* @param {string} options.entryPoint - The absolute path to the application entry point file.
|
|
53
|
-
* @param {string[]} options.sourceFolders[] - A list of folders where Webpack should look for source files.
|
|
54
|
-
* @param {Object} options.postcssOptions - Options related to Postcss plugins. See `createPostcssConfig` function.
|
|
55
|
-
* @param {Object} options.toggleFlags - Options to enable/disable certain functionalities of the Webpack config.
|
|
56
89
|
*/
|
|
57
90
|
|
|
58
91
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
92
|
+
function createWebpackConfigForDevelopment() {
|
|
93
|
+
var _context, _context2, _context3, _context4, _context5;
|
|
94
|
+
|
|
95
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
96
|
+
|
|
97
|
+
var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
|
|
98
|
+
toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
|
|
99
|
+
});
|
|
100
|
+
|
|
66
101
|
return {
|
|
67
102
|
// https://webpack.js.org/concepts/#mode
|
|
68
103
|
mode: 'development',
|
|
@@ -96,7 +131,9 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
96
131
|
// https://github.com/facebook/create-react-app/issues/290
|
|
97
132
|
// `web` extension prefixes have been added for better support
|
|
98
133
|
// for React Native Web.
|
|
99
|
-
extensions: ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx'].
|
|
134
|
+
extensions: _mapInstanceProperty(_context = ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx']).call(_context, function (ext) {
|
|
135
|
+
return ".".concat(ext);
|
|
136
|
+
}),
|
|
100
137
|
// NOTE: this is meant to be a temporary list of fallback/polyfills for certain
|
|
101
138
|
// nodejs modules. With Webpack <5 these polyfills were included by default in Webpack,
|
|
102
139
|
// however now it's not the case anymore.
|
|
@@ -107,7 +144,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
107
144
|
}
|
|
108
145
|
},
|
|
109
146
|
entry: {
|
|
110
|
-
app: [require.resolve('
|
|
147
|
+
app: _filterInstanceProperty(_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), // When using the experimental `react-refresh` integration,
|
|
111
148
|
// the webpack plugin takes care of injecting the dev client for us.
|
|
112
149
|
!hasReactRefresh && // Include an alternative client for WebpackDevServer. A client's job is to
|
|
113
150
|
// connect to WebpackDevServer by a socket and get notified about changes.
|
|
@@ -124,7 +161,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
124
161
|
mergedOptions.entryPoint // We include the app code last so that if there is a runtime error during
|
|
125
162
|
// initialization, it doesn't blow up the WebpackDevServer client, and
|
|
126
163
|
// changing JS code would still trigger a refresh.
|
|
127
|
-
].
|
|
164
|
+
]).call(_context2, Boolean)
|
|
128
165
|
},
|
|
129
166
|
output: {
|
|
130
167
|
// This does not produce a real file. It's just the virtual path that is
|
|
@@ -140,9 +177,11 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
140
177
|
// This is the URL that app is served from. We use "/" in development.
|
|
141
178
|
publicPath: '/',
|
|
142
179
|
// Point sourcemap entries to the original disk location (format as URL on Windows)
|
|
143
|
-
devtoolModuleFilenameTemplate:
|
|
180
|
+
devtoolModuleFilenameTemplate: function devtoolModuleFilenameTemplate(info) {
|
|
181
|
+
return path.resolve(info.absoluteResourcePath).replace(/\\/g, '/');
|
|
182
|
+
}
|
|
144
183
|
},
|
|
145
|
-
plugins: [new WebpackBar(), // Allows to "assign" custom options to the `webpack` object.
|
|
184
|
+
plugins: _filterInstanceProperty(_context3 = [new WebpackBar(), // Allows to "assign" custom options to the `webpack` object.
|
|
146
185
|
// At the moment, this is used to share some props with `postcss.config`.
|
|
147
186
|
new webpack.LoaderOptionsPlugin({
|
|
148
187
|
options: {
|
|
@@ -154,18 +193,13 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
154
193
|
new webpack.DefinePlugin({
|
|
155
194
|
__DEV__: 'true',
|
|
156
195
|
'process.env': {
|
|
157
|
-
NODE_ENV:
|
|
196
|
+
NODE_ENV: _JSON$stringify('development')
|
|
158
197
|
}
|
|
159
198
|
}), mergedOptions.toggleFlags.generateIndexHtml && new HtmlWebpackPlugin({
|
|
160
199
|
inject: false,
|
|
161
200
|
filename: paths.appIndexHtml,
|
|
162
201
|
template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
|
|
163
|
-
}), mergedOptions.toggleFlags.generateIndexHtml && (
|
|
164
|
-
// eslint-disable-next-line global-require
|
|
165
|
-
const LocalHtmlWebpackPlugin = require('../webpack-plugins/local-html-webpack-plugin');
|
|
166
|
-
|
|
167
|
-
return new LocalHtmlWebpackPlugin();
|
|
168
|
-
})(), // Strip all locales except `en`, `de`
|
|
202
|
+
}), mergedOptions.toggleFlags.generateIndexHtml && new LocalHtmlWebpackPlugin(), // Strip all locales except `en`, `de`
|
|
169
203
|
// (`en` is built into Moment and can't be removed).
|
|
170
204
|
new MomentLocalesPlugin({
|
|
171
205
|
localesToKeep: ['de', 'es', 'fr', 'zh-cn', 'ja']
|
|
@@ -182,7 +216,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
182
216
|
// the bundled socket handling logic can be eliminated.
|
|
183
217
|
sockIntegration: false
|
|
184
218
|
}
|
|
185
|
-
})].
|
|
219
|
+
})]).call(_context3, Boolean),
|
|
186
220
|
module: {
|
|
187
221
|
// Makes missing exports an error instead of warning.
|
|
188
222
|
strictExportPresence: true,
|
|
@@ -227,7 +261,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
227
261
|
test: function testForNormalSvgFiles(fileName) {
|
|
228
262
|
return (// Use this only for plain SVG.
|
|
229
263
|
// For SVG as React components, see loader above.
|
|
230
|
-
fileName.
|
|
264
|
+
_endsWithInstanceProperty(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty(fileName).call(fileName, '.react.svg')
|
|
231
265
|
);
|
|
232
266
|
},
|
|
233
267
|
use: [{
|
|
@@ -262,7 +296,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
262
296
|
test: function testForNormalCssFiles(fileName) {
|
|
263
297
|
return (// Use this only for plain CSS.
|
|
264
298
|
// For css-modules, see loader above.
|
|
265
|
-
fileName.
|
|
299
|
+
_endsWithInstanceProperty(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty(fileName).call(fileName, '.module.css'))
|
|
266
300
|
);
|
|
267
301
|
},
|
|
268
302
|
// "postcss" loader applies autoprefixer to our CSS.
|
|
@@ -327,7 +361,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
327
361
|
presets: [[require.resolve('@commercetools-frontend/babel-preset-mc-app'), {
|
|
328
362
|
runtime: hasJsxRuntime() ? 'automatic' : 'classic'
|
|
329
363
|
}]],
|
|
330
|
-
plugins: [hasReactRefresh && require.resolve('react-refresh/babel')].
|
|
364
|
+
plugins: _filterInstanceProperty(_context4 = [hasReactRefresh && require.resolve('react-refresh/babel')]).call(_context4, Boolean),
|
|
331
365
|
// This is a feature of `babel-loader` for webpack (not Babel itself).
|
|
332
366
|
// It enables caching results in ./node_modules/.cache/babel-loader/
|
|
333
367
|
// directory for faster rebuilds.
|
|
@@ -335,7 +369,7 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
335
369
|
highlightCode: true
|
|
336
370
|
}
|
|
337
371
|
}],
|
|
338
|
-
include: mergedOptions.sourceFolders.
|
|
372
|
+
include: _concatInstanceProperty(_context5 = mergedOptions.sourceFolders).call(_context5, vendorsToTranspile),
|
|
339
373
|
// Disable require.ensure as it's not a standard language feature.
|
|
340
374
|
parser: {
|
|
341
375
|
requireEnsure: false
|
|
@@ -355,4 +389,6 @@ module.exports = function createWebpackConfigForDevelopment(options = {}) {
|
|
|
355
389
|
level: 'none'
|
|
356
390
|
}
|
|
357
391
|
};
|
|
358
|
-
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export { createWebpackConfigForDevelopment as c };
|