@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.
Files changed (152) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -42
  3. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +1 -0
  4. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
  5. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
  6. package/{build/config/application-runtime.js → application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js} +2 -2
  7. package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
  8. package/application-runtime/package.json +4 -0
  9. package/bin/cli.js +1 -1
  10. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +1 -0
  11. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +361 -0
  12. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
  13. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +361 -0
  14. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +345 -0
  15. package/cli/package.json +4 -0
  16. package/config/create-webpack-config-for-development.js +7 -1
  17. package/config/create-webpack-config-for-production.js +7 -1
  18. package/config/vendors-to-transpile.js +5 -1
  19. package/dist/build-5357ad26.cjs.prod.js +224 -0
  20. package/dist/build-9b6d7eee.cjs.dev.js +224 -0
  21. package/dist/build-c483e87f.esm.js +209 -0
  22. package/dist/build-vite-3b82522e.cjs.dev.js +151 -0
  23. package/dist/build-vite-93abdc95.esm.js +139 -0
  24. package/dist/build-vite-b7cd993a.cjs.prod.js +151 -0
  25. package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +1 -0
  26. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +30 -0
  27. package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
  28. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +30 -0
  29. package/dist/commercetools-frontend-mc-scripts.esm.js +22 -0
  30. package/dist/compile-html-4361a0b3.esm.js +77 -0
  31. package/dist/compile-html-d6331c35.cjs.prod.js +87 -0
  32. package/dist/compile-html-d9e731aa.cjs.dev.js +87 -0
  33. package/dist/config-sync-6b31d972.esm.js +840 -0
  34. package/dist/config-sync-a478bc0f.cjs.dev.js +864 -0
  35. package/dist/config-sync-f07734e4.cjs.prod.js +859 -0
  36. package/{build/config/create-postcss-config.js → dist/create-postcss-config-04243dea.esm.js} +27 -25
  37. package/dist/create-postcss-config-760e2dc5.cjs.dev.js +90 -0
  38. package/dist/create-postcss-config-ddc3abee.cjs.prod.js +90 -0
  39. package/dist/create-webpack-config-for-development-76fdab59.cjs.prod.js +419 -0
  40. package/{build/config/create-webpack-config-for-development.js → dist/create-webpack-config-for-development-d93ae4b2.esm.js} +94 -57
  41. package/dist/create-webpack-config-for-development-dfd1c174.cjs.dev.js +419 -0
  42. package/{build/config/create-webpack-config-for-production.js → dist/create-webpack-config-for-production-9290479a.esm.js} +120 -54
  43. package/dist/create-webpack-config-for-production-bc8c1f37.cjs.dev.js +469 -0
  44. package/dist/create-webpack-config-for-production-d652ad1a.cjs.prod.js +469 -0
  45. package/dist/declarations/src/application-runtime.d.ts +1 -0
  46. package/dist/declarations/src/cli.d.ts +4 -0
  47. package/dist/declarations/src/commands/build-vite.d.ts +2 -0
  48. package/dist/declarations/src/commands/build.d.ts +2 -0
  49. package/dist/declarations/src/commands/compile-html.d.ts +3 -0
  50. package/dist/declarations/src/commands/config-sync.d.ts +3 -0
  51. package/dist/declarations/src/commands/login.d.ts +2 -0
  52. package/dist/declarations/src/commands/serve.d.ts +2 -0
  53. package/dist/declarations/src/commands/start-vite.d.ts +2 -0
  54. package/dist/declarations/src/commands/start.d.ts +2 -0
  55. package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
  56. package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
  57. package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
  58. package/dist/declarations/src/config/has-jsx-runtime.d.ts +2 -0
  59. package/dist/declarations/src/config/moment-locales.d.ts +2 -0
  60. package/dist/declarations/src/config/paths.d.ts +12 -0
  61. package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
  62. package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
  63. package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
  64. package/dist/declarations/src/generated/core.d.ts +710 -0
  65. package/dist/declarations/src/generated/settings.d.ts +2485 -0
  66. package/dist/declarations/src/index.d.ts +3 -0
  67. package/dist/declarations/src/postcss.d.ts +1 -0
  68. package/dist/declarations/src/types.d.ts +82 -0
  69. package/dist/declarations/src/utils/auth.d.ts +6 -0
  70. package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
  71. package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
  72. package/dist/declarations/src/utils/graphql-requests.d.ts +80 -0
  73. package/dist/declarations/src/utils/user-agent.d.ts +2 -0
  74. package/dist/declarations/src/version.d.ts +2 -0
  75. package/dist/declarations/src/vite-plugins/vite-plugin-custom-application.d.ts +4 -0
  76. package/dist/declarations/src/vite-plugins/vite-plugin-dynamic-base-assets-globals.d.ts +3 -0
  77. package/dist/declarations/src/vite-plugins/vite-plugin-svgr.d.ts +3 -0
  78. package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
  79. package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
  80. package/dist/declarations/src/webpack.d.ts +2 -0
  81. package/dist/has-jsx-runtime-0b03b72e.cjs.prod.js +17 -0
  82. package/dist/has-jsx-runtime-3d4bb633.cjs.dev.js +17 -0
  83. package/{build/config/has-jsx-runtime.js → dist/has-jsx-runtime-8314226e.esm.js} +1 -3
  84. package/dist/login-7b7ae27e.esm.js +155 -0
  85. package/dist/login-b13f26e7.cjs.dev.js +165 -0
  86. package/dist/login-c11fb977.cjs.prod.js +165 -0
  87. package/dist/package-4b4fcf02.cjs.prod.js +139 -0
  88. package/dist/package-4c3e3fb7.cjs.dev.js +139 -0
  89. package/dist/package-8e6305bd.esm.js +137 -0
  90. package/dist/paths-16823f56.cjs.dev.js +55 -0
  91. package/dist/paths-76b66e74.cjs.prod.js +55 -0
  92. package/dist/paths-ed23d5a1.esm.js +46 -0
  93. package/dist/serve-12de323b.cjs.dev.js +70 -0
  94. package/dist/serve-784f4fcd.cjs.prod.js +70 -0
  95. package/dist/serve-d6b437b1.esm.js +62 -0
  96. package/dist/start-1b7dad90.cjs.prod.js +209 -0
  97. package/dist/start-45ca01f2.cjs.dev.js +209 -0
  98. package/dist/start-600d06a3.esm.js +194 -0
  99. package/dist/start-vite-22de08dc.cjs.dev.js +151 -0
  100. package/dist/start-vite-dc046cba.esm.js +138 -0
  101. package/dist/start-vite-fe13330b.cjs.prod.js +151 -0
  102. package/dist/user-agent-5f8ec93d.cjs.prod.js +106 -0
  103. package/dist/user-agent-ca628320.esm.js +94 -0
  104. package/dist/user-agent-ee57c98a.cjs.dev.js +106 -0
  105. package/dist/vendors-to-transpile-367e0ba8.cjs.prod.js +5 -0
  106. package/dist/vendors-to-transpile-68e03526.esm.js +3 -0
  107. package/dist/vendors-to-transpile-b51af5d3.cjs.dev.js +5 -0
  108. package/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +110 -0
  109. package/dist/vite-plugin-svgr-eb8524fa.esm.js +85 -0
  110. package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +110 -0
  111. package/package.json +56 -50
  112. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +1 -0
  113. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +14 -0
  114. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
  115. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +14 -0
  116. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +6 -0
  117. package/postcss/package.json +4 -0
  118. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +1 -0
  119. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +51 -0
  120. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
  121. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +51 -0
  122. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +42 -0
  123. package/webpack/package.json +4 -0
  124. package/build/bin/cli.js +0 -264
  125. package/build/commands/build-vite.js +0 -91
  126. package/build/commands/build.js +0 -140
  127. package/build/commands/compile-html.js +0 -53
  128. package/build/commands/config-sync.js +0 -176
  129. package/build/commands/login.js +0 -60
  130. package/build/commands/serve.js +0 -37
  131. package/build/commands/start-vite.js +0 -138
  132. package/build/commands/start.js +0 -108
  133. package/build/config/paths.js +0 -38
  134. package/build/config/vendors-to-transpile.js +0 -3
  135. package/build/config/webpack-dev-server.config.js +0 -69
  136. package/build/index.js +0 -16
  137. package/build/utils/auth.js +0 -34
  138. package/build/utils/auth.spec.js +0 -61
  139. package/build/utils/create-custom-application.settings.graphql +0 -8
  140. package/build/utils/credentials-storage.js +0 -72
  141. package/build/utils/credentials-storage.spec.js +0 -69
  142. package/build/utils/fetch-custom-application.settings.graphql +0 -36
  143. package/build/utils/fetch-user-organizations.core.graphql +0 -9
  144. package/build/utils/get-config-diff.js +0 -308
  145. package/build/utils/get-config-diff.spec.js +0 -285
  146. package/build/utils/graphql-requests.js +0 -105
  147. package/build/utils/graphql-requests.spec.js +0 -159
  148. package/build/utils/require-graphql.js +0 -15
  149. package/build/utils/update-custom-application.settings.graphql +0 -13
  150. package/build/utils/user-agent.js +0 -15
  151. package/build/webpack-plugins/final-stats-writer-plugin.js +0 -50
  152. package/build/webpack-plugins/local-html-webpack-plugin.js +0 -38
@@ -1,33 +1,101 @@
1
- "use strict";
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 _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
10
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
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 _Number$isInteger from '@babel/runtime-corejs3/core-js-stable/number/is-integer';
14
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
15
+ import webpack from 'webpack';
16
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
17
+ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
18
+ import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
19
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
20
+ import MomentLocalesPlugin from 'moment-locales-webpack-plugin';
21
+ import TerserPlugin from 'terser-webpack-plugin';
22
+ import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
23
+ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
24
+ import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
25
+ import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
26
+ import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
27
+ import fs from 'fs';
28
+ import path from 'path';
29
+ import { p as paths } from './paths-ed23d5a1.esm.js';
30
+ import { v as vendorsToTranspile } from './vendors-to-transpile-68e03526.esm.js';
31
+ import { c as createPostcssConfig } from './create-postcss-config-04243dea.esm.js';
32
+ import { h as hasJsxRuntime } from './has-jsx-runtime-8314226e.esm.js';
2
33
 
3
- /* eslint-disable prettier/prettier */
4
- const webpack = require('webpack');
34
+ var FinalStatsWriterPlugin = /*#__PURE__*/function () {
35
+ // Expected options:
36
+ // - `outputPath`
37
+ // - `includeFields`
38
+ function FinalStatsWriterPlugin(config) {
39
+ _classCallCheck(this, FinalStatsWriterPlugin);
5
40
 
6
- const HtmlWebpackPlugin = require('html-webpack-plugin');
41
+ this.config = void 0;
42
+ if (!config) throw new Error('Missing config options');
43
+ this.config = config;
44
+ }
7
45
 
8
- const {
9
- BundleAnalyzerPlugin
10
- } = require('webpack-bundle-analyzer');
46
+ _createClass(FinalStatsWriterPlugin, [{
47
+ key: "apply",
48
+ value: function apply(compiler) {
49
+ // This is the only hook that return the `stats` plugin
50
+ // with the `time` info. It also contains all the stats that
51
+ // we would get from the original `emit` hook.
52
+ // https://webpack.js.org/api/compiler-hooks/#done
53
+ // https://webpack.js.org/api/plugins/#plugin-types
54
+ if (compiler.hooks) {
55
+ var _context;
11
56
 
12
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
57
+ compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty(_context = this.writeStats).call(_context, this));
58
+ } else {
59
+ var _context2;
13
60
 
14
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
15
-
16
- const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
61
+ // @ts-ignore
62
+ compiler.plugin('done', _bindInstanceProperty(_context2 = this.writeStats).call(_context2, this));
63
+ }
64
+ }
65
+ }, {
66
+ key: "writeStats",
67
+ value: function writeStats(stats) {
68
+ var finalStats = stats.toJson(); // Filter only included fields
17
69
 
18
- const TerserPlugin = require('terser-webpack-plugin');
70
+ if (this.config.includeFields) {
71
+ var _context3;
19
72
 
20
- const FinalStatsWriterPlugin = require('../webpack-plugins/final-stats-writer-plugin');
73
+ finalStats = _reduceInstanceProperty(_context3 = this.config.includeFields).call(_context3, function (aggregatedStats, key) {
74
+ return (// eslint-disable-next-line
75
+ _Object$assign({}, aggregatedStats, _defineProperty({}, key, finalStats[key]))
76
+ );
77
+ }, {});
78
+ }
21
79
 
22
- const paths = require('./paths');
80
+ try {
81
+ fs.accessSync(this.config.outputPath, fs.constants.F_OK);
82
+ fs.writeFileSync(path.join(this.config.outputPath, 'stats.json'), _JSON$stringify(finalStats, null, 2));
83
+ } catch (error) {
84
+ // eslint-disable-next-line no-console
85
+ console.warn("[FinalStatsWriterPlugin] The dist folder could not be found at ".concat(this.config.outputPath, ". Check the console for errors during the webpack compilation."));
86
+ }
87
+ }
88
+ }]);
23
89
 
24
- const vendorsToTranspile = require('./vendors-to-transpile');
90
+ return FinalStatsWriterPlugin;
91
+ }();
25
92
 
26
- const createPostcssConfig = require('./create-postcss-config');
93
+ 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; }
27
94
 
28
- const hasJsxRuntime = require('./has-jsx-runtime');
95
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context7, _context8; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context8 = ownKeys(Object(source))).call(_context8, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
29
96
 
30
- const defaultToggleFlags = {
97
+ var 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", "ja", "zh-cn"];
98
+ var defaultToggleFlags = {
31
99
  // Allow to disable CSS extraction in case it's not necessary (e.g. for Storybook)
32
100
  enableExtractCss: true,
33
101
  // Allow to disable index.html generation in case it's not necessary (e.g. for Storybook)
@@ -44,7 +112,7 @@ const defaultToggleFlags = {
44
112
  // `plugin-transform-runtime`.
45
113
  disableCoreJs: false
46
114
  };
47
- const defaultOptions = {
115
+ var defaultOptions = {
48
116
  entryPoint: paths.entryPoint,
49
117
  sourceFolders: paths.sourceFolders,
50
118
  postcssOptions: {},
@@ -55,21 +123,17 @@ const defaultOptions = {
55
123
  * for a MC Application in `production` mode.
56
124
  * The function requires the file path to the related application
57
125
  * "entry point".
58
- *
59
- * @param {Object} options - Options to configure the Webpack config
60
- * @param {string} options.entryPoint - The absolute path to the application entry point file.
61
- * @param {string[]} options.sourceFolders[] - A list of folders where Webpack should look for source files.
62
- * @param {Object} options.postcssOptions - Options related to Postcss plugins. See `createPostcssConfig` function.
63
- * @param {Object} options.toggleFlags - Options to enable/disable certain functionalities of the Webpack config.
64
126
  */
65
127
 
66
- module.exports = function createWebpackConfigForProduction(options = {}) {
67
- const mergedOptions = { ...defaultOptions,
68
- ...options,
69
- toggleFlags: { ...defaultToggleFlags,
70
- ...options.toggleFlags
71
- }
72
- };
128
+ function createWebpackConfigForProduction() {
129
+ var _context, _context2, _context3, _context4, _context5, _context6;
130
+
131
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
132
+
133
+ var mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
134
+ toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
135
+ });
136
+
73
137
  return {
74
138
  // Don't attempt to continue if there are any errors.
75
139
  bail: true,
@@ -82,15 +146,15 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
82
146
  // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
83
147
  // https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a
84
148
  optimization: {
85
- minimizer: [new TerserPlugin({
149
+ minimizer: _filterInstanceProperty(_context = [new TerserPlugin({
86
150
  terserOptions: {
87
151
  parse: {
88
152
  // we want terser to parse ecma 8 code. However, we don't want it
89
- // to apply any minfication steps that turns valid ecma 5 code
153
+ // to apply any minification steps that turns valid ecma 5 code
90
154
  // into invalid ecma 5 code. This is why the 'compress' and 'output'
91
155
  // sections only apply transformations that are ecma 5 safe
92
156
  // https://github.com/facebook/create-react-app/pull/4234
93
- ecma: 8
157
+ ecma: 2018
94
158
  },
95
159
  compress: {
96
160
  ecma: 5,
@@ -123,7 +187,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
123
187
  // Use multi-process parallel running to improve the build speed
124
188
  // Default number of concurrent runs: os.cpus().length - 1
125
189
  parallel: mergedOptions.toggleFlags.parallelism
126
- }), mergedOptions.toggleFlags.enableExtractCss && new CssMinimizerPlugin()].filter(Boolean),
190
+ }), mergedOptions.toggleFlags.enableExtractCss && new CssMinimizerPlugin()]).call(_context, Boolean),
127
191
  // Keep the runtime chunk separated to enable long term caching
128
192
  runtimeChunk: {
129
193
  name: 'runtime'
@@ -138,7 +202,9 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
138
202
  // https://github.com/facebook/create-react-app/issues/290
139
203
  // `web` extension prefixes have been added for better support
140
204
  // for React Native Web.
141
- extensions: ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx'].map(ext => `.${ext}`),
205
+ extensions: _mapInstanceProperty(_context2 = ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx']).call(_context2, function (ext) {
206
+ return ".".concat(ext);
207
+ }),
142
208
  // NOTE: this is meant to be a temporary list of fallback/polyfills for certain
143
209
  // nodejs modules. With Webpack <5 these polyfills were included by default in Webpack,
144
210
  // however now it's not the case anymore.
@@ -149,7 +215,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
149
215
  },
150
216
  // In production, we only want to load the polyfills and the app code.
151
217
  entry: {
152
- app: [require.resolve('./application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), mergedOptions.entryPoint]
218
+ app: _filterInstanceProperty(_context3 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), mergedOptions.entryPoint]).call(_context3, Boolean)
153
219
  },
154
220
  output: {
155
221
  // Generated JS file names (with nested folders).
@@ -162,7 +228,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
162
228
  // Will be injected on runtime. See `packages/application-shell/src/public-path.js`
163
229
  publicPath: ''
164
230
  },
165
- plugins: [// Allows to "assign" custom options to the `webpack` object.
231
+ plugins: _filterInstanceProperty(_context4 = [// Allows to "assign" custom options to the `webpack` object.
166
232
  // At the moment, this is used to share some props with `postcss.config`.
167
233
  new webpack.LoaderOptionsPlugin({
168
234
  options: {
@@ -174,12 +240,11 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
174
240
  new webpack.DefinePlugin({
175
241
  __DEV__: 'false',
176
242
  'process.env': {
177
- NODE_ENV: JSON.stringify('production')
243
+ NODE_ENV: _JSON$stringify('production')
178
244
  }
179
- }), // Strip all locales except `en`, `de`
180
- // (`en` is built into Moment and can't be removed)
245
+ }), // Only keep locales that are available in the Merchant Center.
181
246
  new MomentLocalesPlugin({
182
- localesToKeep: ['de', 'es', 'fr', 'zh-cn', 'ja']
247
+ localesToKeep: momentLocalesToKeep
183
248
  }), // Generate a `stats.json` file containing information and paths to
184
249
  // the assets that webpack created.
185
250
  // This is necessary to programmatically refer to the correct bundle path
@@ -197,11 +262,11 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
197
262
  chunkFilename: '[id].[name].[chunkhash].css'
198
263
  }), process.env.ANALYZE_BUNDLE === 'true' && new BundleAnalyzerPlugin({
199
264
  defaultSizes: 'gzip'
200
- })].filter(Boolean),
265
+ })]).call(_context4, Boolean),
201
266
  module: {
202
267
  // Makes missing exports an error instead of warning.
203
268
  strictExportPresence: true,
204
- rules: [// For svg icons, we want to get them transformed into React components
269
+ rules: _filterInstanceProperty(_context5 = [// For svg icons, we want to get them transformed into React components
205
270
  // when we import them.
206
271
  {
207
272
  test: /\.react\.svg$/,
@@ -242,7 +307,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
242
307
  test: function testForNormalSvgFiles(fileName) {
243
308
  return (// Use this only for plain SVG.
244
309
  // For SVG as React components, see loader above.
245
- fileName.endsWith('.svg') && !fileName.endsWith('.react.svg')
310
+ _endsWithInstanceProperty(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty(fileName).call(fileName, '.react.svg')
246
311
  );
247
312
  },
248
313
  use: [{
@@ -281,7 +346,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
281
346
  test: function testForNormalCssFiles(fileName) {
282
347
  return (// Use this only for plain CSS.
283
348
  // For css-modules, see loader above.
284
- fileName.endsWith('.css') && !(fileName.endsWith('.mod.css') || fileName.endsWith('.module.css'))
349
+ _endsWithInstanceProperty(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty(fileName).call(fileName, '.module.css'))
285
350
  );
286
351
  },
287
352
  // "postcss" loader applies autoprefixer to our CSS.
@@ -334,10 +399,9 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
334
399
  // improves compile time on larger projects
335
400
  {
336
401
  loader: require.resolve('thread-loader'),
337
- options: { ...(Number.isInteger(mergedOptions.toggleFlags.parallelism) ? {
338
- workers: mergedOptions.toggleFlags.parallelism
339
- } : {})
340
- }
402
+ options: _objectSpread({}, _Number$isInteger(mergedOptions.toggleFlags.parallelism) ? {
403
+ workers: mergedOptions.toggleFlags.parallelism
404
+ } : {})
341
405
  }, {
342
406
  loader: require.resolve('babel-loader'),
343
407
  options: {
@@ -354,7 +418,7 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
354
418
  highlightCode: true
355
419
  }
356
420
  }],
357
- include: mergedOptions.sourceFolders.concat(vendorsToTranspile),
421
+ include: _concatInstanceProperty(_context6 = mergedOptions.sourceFolders).call(_context6, vendorsToTranspile),
358
422
  // Disable require.ensure as it's not a standard language feature.
359
423
  parser: {
360
424
  requireEnsure: false
@@ -365,10 +429,12 @@ module.exports = function createWebpackConfigForProduction(options = {}) {
365
429
  include: mergedOptions.sourceFolders,
366
430
  exclude: /node_modules/,
367
431
  use: [require.resolve('graphql-tag/loader')]
368
- }].filter(Boolean)
432
+ }]).call(_context5, Boolean)
369
433
  },
370
434
  // Turn off performance processing because we utilize
371
435
  // our own hints via the FileSizeReporter
372
436
  performance: false
373
437
  };
374
- };
438
+ }
439
+
440
+ export { createWebpackConfigForProduction as c };