@commercetools-frontend/mc-scripts 21.7.0 → 21.9.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 +361 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +361 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +345 -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-5357ad26.cjs.prod.js +224 -0
- package/dist/build-9b6d7eee.cjs.dev.js +224 -0
- package/dist/build-c483e87f.esm.js +209 -0
- package/dist/build-vite-3b82522e.cjs.dev.js +151 -0
- package/dist/build-vite-93abdc95.esm.js +139 -0
- package/dist/build-vite-b7cd993a.cjs.prod.js +151 -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-4361a0b3.esm.js +77 -0
- package/dist/compile-html-d6331c35.cjs.prod.js +87 -0
- package/dist/compile-html-d9e731aa.cjs.dev.js +87 -0
- package/dist/config-sync-6b31d972.esm.js +840 -0
- package/dist/config-sync-a478bc0f.cjs.dev.js +864 -0
- package/dist/config-sync-f07734e4.cjs.prod.js +859 -0
- package/{build/config/create-postcss-config.js → dist/create-postcss-config-04243dea.esm.js} +27 -25
- package/dist/create-postcss-config-760e2dc5.cjs.dev.js +90 -0
- package/dist/create-postcss-config-ddc3abee.cjs.prod.js +90 -0
- package/dist/create-webpack-config-for-development-76fdab59.cjs.prod.js +419 -0
- package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-d93ae4b2.esm.js} +94 -57
- package/dist/create-webpack-config-for-development-dfd1c174.cjs.dev.js +419 -0
- package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-9290479a.esm.js} +120 -54
- package/dist/create-webpack-config-for-production-bc8c1f37.cjs.dev.js +469 -0
- package/dist/create-webpack-config-for-production-d652ad1a.cjs.prod.js +469 -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/moment-locales.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 +2485 -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/vite-plugins/vite-plugin-custom-application.d.ts +4 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-dynamic-base-assets-globals.d.ts +3 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-svgr.d.ts +3 -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-7b7ae27e.esm.js +155 -0
- package/dist/login-b13f26e7.cjs.dev.js +165 -0
- package/dist/login-c11fb977.cjs.prod.js +165 -0
- package/dist/package-4b4fcf02.cjs.prod.js +139 -0
- package/dist/package-4c3e3fb7.cjs.dev.js +139 -0
- package/dist/package-8e6305bd.esm.js +137 -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-1b7dad90.cjs.prod.js +209 -0
- package/dist/start-45ca01f2.cjs.dev.js +209 -0
- package/dist/start-600d06a3.esm.js +194 -0
- package/dist/start-vite-22de08dc.cjs.dev.js +151 -0
- package/dist/start-vite-dc046cba.esm.js +138 -0
- package/dist/start-vite-fe13330b.cjs.prod.js +151 -0
- package/dist/user-agent-5f8ec93d.cjs.prod.js +106 -0
- package/dist/user-agent-ca628320.esm.js +94 -0
- package/dist/user-agent-ee57c98a.cjs.dev.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/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +110 -0
- package/dist/vite-plugin-svgr-eb8524fa.esm.js +85 -0
- package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +110 -0
- package/package.json +56 -50
- 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
package/{build/config/create-postcss-config.js → dist/create-postcss-config-04243dea.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-8e6305bd.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 };
|
|
@@ -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-4c3e3fb7.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-4b4fcf02.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;
|