@commercetools-frontend/mc-scripts 22.2.1 → 22.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +51 -41
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +51 -41
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +51 -41
  4. package/dist/{build-72d9896f.esm.js → build-7993cea9.esm.js} +22 -31
  5. package/dist/{build-0ef080b9.cjs.prod.js → build-8c9e8a8b.cjs.prod.js} +22 -31
  6. package/dist/{build-4773d61a.cjs.dev.js → build-94dc48cd.cjs.dev.js} +22 -31
  7. package/dist/{build-vite-2dc2b366.cjs.prod.js → build-vite-1ba28dd8.cjs.prod.js} +18 -19
  8. package/dist/{build-vite-290aaf04.esm.js → build-vite-9de4820c.esm.js} +18 -19
  9. package/dist/{build-vite-b5c7ac91.cjs.dev.js → build-vite-e7a6315c.cjs.dev.js} +18 -19
  10. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -3
  11. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -3
  12. package/dist/commercetools-frontend-mc-scripts.esm.js +2 -3
  13. package/dist/{compile-html-41195e35.cjs.dev.js → compile-html-079067bd.cjs.prod.js} +1 -7
  14. package/dist/{compile-html-5abd78aa.cjs.prod.js → compile-html-3ff2fed0.cjs.dev.js} +1 -7
  15. package/dist/{compile-html-f9de842c.esm.js → compile-html-606b302e.esm.js} +1 -7
  16. package/dist/{config-sync-54299066.esm.js → config-sync-15f35d05.esm.js} +83 -194
  17. package/dist/{config-sync-c914ca7a.cjs.dev.js → config-sync-782033fb.cjs.dev.js} +83 -194
  18. package/dist/{config-sync-8e8e18a9.cjs.prod.js → config-sync-8f0326af.cjs.prod.js} +81 -193
  19. package/dist/{create-postcss-config-6277233e.cjs.prod.js → create-postcss-config-254aa0d9.cjs.prod.js} +9 -13
  20. package/dist/{create-postcss-config-a0659cf5.cjs.dev.js → create-postcss-config-aaff8b1e.cjs.dev.js} +9 -13
  21. package/dist/{create-postcss-config-f39f54b5.esm.js → create-postcss-config-e44b5231.esm.js} +9 -13
  22. package/dist/{create-webpack-config-for-development-9539f804.esm.js → create-webpack-config-for-development-12d3233c.esm.js} +46 -37
  23. package/dist/{create-webpack-config-for-development-9aa85081.cjs.dev.js → create-webpack-config-for-development-30914bb4.cjs.dev.js} +46 -37
  24. package/dist/{create-webpack-config-for-development-629a8982.cjs.prod.js → create-webpack-config-for-development-c90350a7.cjs.prod.js} +46 -37
  25. package/dist/{create-webpack-config-for-production-0fac47e1.cjs.dev.js → create-webpack-config-for-production-410e4748.cjs.dev.js} +37 -32
  26. package/dist/{create-webpack-config-for-production-4476fc5f.esm.js → create-webpack-config-for-production-487aa17d.esm.js} +37 -32
  27. package/dist/{create-webpack-config-for-production-84e2db7d.cjs.prod.js → create-webpack-config-for-production-48ef18fc.cjs.prod.js} +37 -32
  28. package/dist/{credentials-storage-da0754c9.cjs.dev.js → credentials-storage-935d3ca1.cjs.prod.js} +3 -15
  29. package/dist/{credentials-storage-fc0c59c3.cjs.prod.js → credentials-storage-a0ea2ecc.cjs.dev.js} +3 -15
  30. package/dist/{credentials-storage-5939dd35.esm.js → credentials-storage-beb854dd.esm.js} +3 -15
  31. package/dist/declarations/src/generated/settings.d.ts +90 -1172
  32. package/dist/{has-jsx-runtime-0b03b72e.cjs.prod.js → has-jsx-runtime-aa5d21ee.cjs.dev.js} +0 -2
  33. package/dist/{has-jsx-runtime-3d4bb633.cjs.dev.js → has-jsx-runtime-c3202df5.cjs.prod.js} +0 -2
  34. package/dist/{has-jsx-runtime-8314226e.esm.js → has-jsx-runtime-e3ecb09b.esm.js} +0 -2
  35. package/dist/{login-9f821336.cjs.dev.js → login-7b8b5027.cjs.prod.js} +12 -23
  36. package/dist/{login-d1c2268a.esm.js → login-c806579c.esm.js} +12 -23
  37. package/dist/{login-f747390f.cjs.prod.js → login-ceb541f1.cjs.dev.js} +12 -23
  38. package/dist/{package-83202e32.cjs.prod.js → package-4276a7a9.cjs.prod.js} +15 -13
  39. package/dist/{package-cc5b8665.cjs.dev.js → package-70894b4c.cjs.dev.js} +15 -13
  40. package/dist/{package-e6713e98.esm.js → package-834453bb.esm.js} +15 -13
  41. package/dist/{paths-284c77fb.cjs.prod.js → paths-854af5ef.cjs.prod.js} +8 -12
  42. package/dist/{paths-db35ac0f.cjs.dev.js → paths-d1febc82.cjs.dev.js} +8 -12
  43. package/dist/{paths-55c5d5a2.esm.js → paths-ded20ae1.esm.js} +8 -12
  44. package/dist/{serve-b8063204.cjs.dev.js → serve-12571b42.cjs.prod.js} +1 -2
  45. package/dist/{serve-660e2ee0.esm.js → serve-65b5a149.esm.js} +1 -2
  46. package/dist/{serve-41077dad.cjs.prod.js → serve-7339c495.cjs.dev.js} +1 -2
  47. package/dist/{start-33fd6d70.cjs.dev.js → start-03683a4d.cjs.dev.js} +26 -34
  48. package/dist/{start-f93c62f9.cjs.prod.js → start-763b3477.cjs.prod.js} +26 -34
  49. package/dist/{start-93205b87.esm.js → start-d3e82b50.esm.js} +26 -34
  50. package/dist/{start-vite-8f03b0df.cjs.dev.js → start-vite-3966d625.cjs.dev.js} +18 -17
  51. package/dist/{start-vite-324af14d.cjs.prod.js → start-vite-5c78605b.cjs.prod.js} +18 -17
  52. package/dist/{start-vite-7d10ae71.esm.js → start-vite-cf0213a1.esm.js} +18 -17
  53. package/dist/{vite-plugin-svgr-f17db78a.esm.js → vite-plugin-svgr-5c953fe7.esm.js} +1 -6
  54. package/dist/{vite-plugin-svgr-fdb37ccf.cjs.dev.js → vite-plugin-svgr-5eb1c511.cjs.dev.js} +1 -6
  55. package/dist/{vite-plugin-svgr-9a4e7f77.cjs.prod.js → vite-plugin-svgr-a732f8df.cjs.prod.js} +1 -6
  56. package/package.json +31 -17
  57. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  58. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  59. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  60. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +6 -6
  61. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +6 -6
  62. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +6 -6
@@ -26,9 +26,9 @@ import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
26
26
  import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
27
27
  import fs from 'fs';
28
28
  import path from 'path';
29
- import { c as createPostcssConfig } from './create-postcss-config-f39f54b5.esm.js';
30
- import { h as hasJsxRuntime } from './has-jsx-runtime-8314226e.esm.js';
31
- import { p as paths } from './paths-55c5d5a2.esm.js';
29
+ import { c as createPostcssConfig } from './create-postcss-config-e44b5231.esm.js';
30
+ import { h as hasJsxRuntime } from './has-jsx-runtime-e3ecb09b.esm.js';
31
+ import { p as paths } from './paths-ded20ae1.esm.js';
32
32
  import { v as vendorsToTranspile } from './vendors-to-transpile-7dc84a72.esm.js';
33
33
 
34
34
  let FinalStatsWriterPlugin = /*#__PURE__*/function () {
@@ -37,12 +37,10 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
37
37
  // - `includeFields`
38
38
  function FinalStatsWriterPlugin(config) {
39
39
  _classCallCheck(this, FinalStatsWriterPlugin);
40
-
41
40
  this.config = void 0;
42
41
  if (!config) throw new Error('Missing config options');
43
42
  this.config = config;
44
43
  }
45
-
46
44
  _createClass(FinalStatsWriterPlugin, [{
47
45
  key: "apply",
48
46
  value: function apply(compiler) {
@@ -53,11 +51,9 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
53
51
  // https://webpack.js.org/api/plugins/#plugin-types
54
52
  if (compiler.hooks) {
55
53
  var _context;
56
-
57
54
  compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty(_context = this.writeStats).call(_context, this));
58
55
  } else {
59
56
  var _context2;
60
-
61
57
  // @ts-ignore
62
58
  compiler.plugin('done', _bindInstanceProperty(_context2 = this.writeStats).call(_context2, this));
63
59
  }
@@ -65,17 +61,17 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
65
61
  }, {
66
62
  key: "writeStats",
67
63
  value: function writeStats(stats) {
68
- let finalStats = stats.toJson(); // Filter only included fields
64
+ let finalStats = stats.toJson();
69
65
 
66
+ // Filter only included fields
70
67
  if (this.config.includeFields) {
71
68
  var _context3;
72
-
73
- finalStats = _reduceInstanceProperty(_context3 = this.config.includeFields).call(_context3, (aggregatedStats, key) => // eslint-disable-next-line
69
+ finalStats = _reduceInstanceProperty(_context3 = this.config.includeFields).call(_context3, (aggregatedStats, key) =>
70
+ // eslint-disable-next-line
74
71
  _Object$assign({}, aggregatedStats, {
75
72
  [key]: finalStats[key]
76
73
  }), {});
77
74
  }
78
-
79
75
  try {
80
76
  fs.accessSync(this.config.outputPath, fs.constants.F_OK);
81
77
  fs.writeFileSync(path.join(this.config.outputPath, 'stats.json'), _JSON$stringify(finalStats, null, 2));
@@ -85,14 +81,12 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
85
81
  }
86
82
  }
87
83
  }]);
88
-
89
84
  return FinalStatsWriterPlugin;
90
85
  }();
91
86
 
92
87
  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; }
93
-
94
88
  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; }
95
-
89
+ // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
96
90
  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"];
97
91
  const defaultToggleFlags = {
98
92
  // Allow to disable CSS extraction in case it's not necessary (e.g. for Storybook)
@@ -117,22 +111,19 @@ const defaultOptions = {
117
111
  postcssOptions: {},
118
112
  toggleFlags: defaultToggleFlags
119
113
  };
114
+
120
115
  /**
121
116
  * This is a factory function to create the default webpack config
122
117
  * for a MC Application in `production` mode.
123
118
  * The function requires the file path to the related application
124
119
  * "entry point".
125
120
  */
126
-
127
121
  function createWebpackConfigForProduction() {
128
122
  var _context, _context2, _context3, _context4, _context5, _context6;
129
-
130
123
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
131
-
132
124
  const mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
133
125
  toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
134
126
  });
135
-
136
127
  return {
137
128
  // Don't attempt to continue if there are any errors.
138
129
  bail: true,
@@ -224,24 +215,28 @@ function createWebpackConfigForProduction() {
224
215
  // Will be injected on runtime. See `packages/application-shell/src/public-path.js`
225
216
  publicPath: ''
226
217
  },
227
- plugins: _filterInstanceProperty(_context4 = [// Allows to "assign" custom options to the `webpack` object.
218
+ plugins: _filterInstanceProperty(_context4 = [
219
+ // Allows to "assign" custom options to the `webpack` object.
228
220
  // At the moment, this is used to share some props with `postcss.config`.
229
221
  new webpack.LoaderOptionsPlugin({
230
222
  options: {
231
223
  sourceFolders: mergedOptions.sourceFolders,
232
224
  context: __dirname
233
225
  }
234
- }), // Makes some environment variables available to the JS code, for example:
226
+ }),
227
+ // Makes some environment variables available to the JS code, for example:
235
228
  // if (process.env.NODE_ENV === 'production') { ... }.
236
229
  new webpack.DefinePlugin({
237
230
  __DEV__: 'false',
238
231
  'process.env': {
239
232
  NODE_ENV: _JSON$stringify('production')
240
233
  }
241
- }), // Only keep locales that are available in the Merchant Center.
234
+ }),
235
+ // Only keep locales that are available in the Merchant Center.
242
236
  new MomentLocalesPlugin({
243
237
  localesToKeep: momentLocalesToKeep
244
- }), // Generate a `stats.json` file containing information and paths to
238
+ }),
239
+ // Generate a `stats.json` file containing information and paths to
245
240
  // the assets that webpack created.
246
241
  // This is necessary to programmatically refer to the correct bundle path
247
242
  // in the `index.html`.
@@ -252,7 +247,8 @@ function createWebpackConfigForProduction() {
252
247
  inject: false,
253
248
  filename: 'index.html.template',
254
249
  template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
255
- }), mergedOptions.toggleFlags.enableExtractCss && // Extracts CSS into one CSS file to mimic CSS order in dev
250
+ }), mergedOptions.toggleFlags.enableExtractCss &&
251
+ // Extracts CSS into one CSS file to mimic CSS order in dev
256
252
  new MiniCssExtractPlugin({
257
253
  filename: '[name].[chunkhash].css',
258
254
  chunkFilename: '[id].[name].[chunkhash].css'
@@ -262,7 +258,8 @@ function createWebpackConfigForProduction() {
262
258
  module: {
263
259
  // Makes missing exports an error instead of warning.
264
260
  strictExportPresence: true,
265
- rules: _filterInstanceProperty(_context5 = [// For svg icons, we want to get them transformed into React components
261
+ rules: _filterInstanceProperty(_context5 = [
262
+ // For svg icons, we want to get them transformed into React components
266
263
  // when we import them.
267
264
  {
268
265
  test: /\.react\.svg$/,
@@ -297,11 +294,13 @@ function createWebpackConfigForProduction() {
297
294
  }
298
295
  }
299
296
  }]
300
- }, // For normal svg files (not icons) we should load the file normally
297
+ },
298
+ // For normal svg files (not icons) we should load the file normally
301
299
  // and simply use it as a `<img src/>`.
302
300
  {
303
301
  test: function testForNormalSvgFiles(fileName) {
304
- return (// Use this only for plain SVG.
302
+ return (
303
+ // Use this only for plain SVG.
305
304
  // For SVG as React components, see loader above.
306
305
  _endsWithInstanceProperty(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty(fileName).call(fileName, '.react.svg')
307
306
  );
@@ -312,7 +311,8 @@ function createWebpackConfigForProduction() {
312
311
  }, {
313
312
  test: /\.png$/,
314
313
  type: 'asset/resource'
315
- }, // "postcss" loader applies autoprefixer to our CSS
314
+ },
315
+ // "postcss" loader applies autoprefixer to our CSS
316
316
  // "css" loader resolves paths in CSS and adds assets as dependencies.
317
317
  // "style" loader turns CSS into JS modules that inject <style> tags.
318
318
  // In production, we use MiniCSSExtractPlugin to extract that CSS
@@ -340,7 +340,8 @@ function createWebpackConfigForProduction() {
340
340
  }]
341
341
  }, {
342
342
  test: function testForNormalCssFiles(fileName) {
343
- return (// Use this only for plain CSS.
343
+ return (
344
+ // Use this only for plain CSS.
344
345
  // For css-modules, see loader above.
345
346
  _endsWithInstanceProperty(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty(fileName).call(fileName, '.module.css'))
346
347
  );
@@ -384,7 +385,8 @@ function createWebpackConfigForProduction() {
384
385
  // See https://github.com/webpack/webpack/issues/6571
385
386
  sideEffects: true
386
387
  }]
387
- }, // Fix for react-intl
388
+ },
389
+ // Fix for react-intl
388
390
  // https://github.com/formatjs/formatjs/issues/143#issuecomment-518774786
389
391
  {
390
392
  test: /\.mjs$/,
@@ -393,10 +395,12 @@ function createWebpackConfigForProduction() {
393
395
  // https://webpack.js.org/configuration/module/#resolvefullyspecified
394
396
  fullySpecified: false
395
397
  }
396
- }, // Process application JavaScript with Babel.
398
+ },
399
+ // Process application JavaScript with Babel.
397
400
  {
398
401
  test: /\.(js|mjs|cjs|jsx|ts|tsx)$/,
399
- use: [// This loader parallelizes code compilation, it is optional but
402
+ use: [
403
+ // This loader parallelizes code compilation, it is optional but
400
404
  // improves compile time on larger projects
401
405
  {
402
406
  loader: require.resolve('thread-loader'),
@@ -424,7 +428,8 @@ function createWebpackConfigForProduction() {
424
428
  parser: {
425
429
  requireEnsure: false
426
430
  }
427
- }, // Allow to import `*.graphql` SDL files.
431
+ },
432
+ // Allow to import `*.graphql` SDL files.
428
433
  {
429
434
  test: /\.graphql$/,
430
435
  include: mergedOptions.sourceFolders,
@@ -28,9 +28,9 @@ var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
28
28
  var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
29
29
  var fs = require('fs');
30
30
  var path = require('path');
31
- var createPostcssConfig = require('./create-postcss-config-6277233e.cjs.prod.js');
32
- var hasJsxRuntime = require('./has-jsx-runtime-0b03b72e.cjs.prod.js');
33
- var paths = require('./paths-284c77fb.cjs.prod.js');
31
+ var createPostcssConfig = require('./create-postcss-config-254aa0d9.cjs.prod.js');
32
+ var hasJsxRuntime = require('./has-jsx-runtime-c3202df5.cjs.prod.js');
33
+ var paths = require('./paths-854af5ef.cjs.prod.js');
34
34
  var vendorsToTranspile = require('./vendors-to-transpile-04a49d40.cjs.prod.js');
35
35
 
36
36
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -66,12 +66,10 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
66
66
  // - `includeFields`
67
67
  function FinalStatsWriterPlugin(config) {
68
68
  _classCallCheck(this, FinalStatsWriterPlugin);
69
-
70
69
  this.config = void 0;
71
70
  if (!config) throw new Error('Missing config options');
72
71
  this.config = config;
73
72
  }
74
-
75
73
  _createClass(FinalStatsWriterPlugin, [{
76
74
  key: "apply",
77
75
  value: function apply(compiler) {
@@ -82,11 +80,9 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
82
80
  // https://webpack.js.org/api/plugins/#plugin-types
83
81
  if (compiler.hooks) {
84
82
  var _context;
85
-
86
83
  compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty__default["default"](_context = this.writeStats).call(_context, this));
87
84
  } else {
88
85
  var _context2;
89
-
90
86
  // @ts-ignore
91
87
  compiler.plugin('done', _bindInstanceProperty__default["default"](_context2 = this.writeStats).call(_context2, this));
92
88
  }
@@ -94,17 +90,17 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
94
90
  }, {
95
91
  key: "writeStats",
96
92
  value: function writeStats(stats) {
97
- let finalStats = stats.toJson(); // Filter only included fields
93
+ let finalStats = stats.toJson();
98
94
 
95
+ // Filter only included fields
99
96
  if (this.config.includeFields) {
100
97
  var _context3;
101
-
102
- finalStats = _reduceInstanceProperty__default["default"](_context3 = this.config.includeFields).call(_context3, (aggregatedStats, key) => // eslint-disable-next-line
98
+ finalStats = _reduceInstanceProperty__default["default"](_context3 = this.config.includeFields).call(_context3, (aggregatedStats, key) =>
99
+ // eslint-disable-next-line
103
100
  _Object$assign__default["default"]({}, aggregatedStats, {
104
101
  [key]: finalStats[key]
105
102
  }), {});
106
103
  }
107
-
108
104
  try {
109
105
  fs__default["default"].accessSync(this.config.outputPath, fs__default["default"].constants.F_OK);
110
106
  fs__default["default"].writeFileSync(path__default["default"].join(this.config.outputPath, 'stats.json'), _JSON$stringify__default["default"](finalStats, null, 2));
@@ -114,14 +110,12 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
114
110
  }
115
111
  }
116
112
  }]);
117
-
118
113
  return FinalStatsWriterPlugin;
119
114
  }();
120
115
 
121
116
  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; }
122
-
123
117
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context7, _context8; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context7 = ownKeys(Object(source), !0)).call(_context7, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context8 = ownKeys(Object(source))).call(_context8, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
124
-
118
+ // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
125
119
  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"];
126
120
  const defaultToggleFlags = {
127
121
  // Allow to disable CSS extraction in case it's not necessary (e.g. for Storybook)
@@ -146,22 +140,19 @@ const defaultOptions = {
146
140
  postcssOptions: {},
147
141
  toggleFlags: defaultToggleFlags
148
142
  };
143
+
149
144
  /**
150
145
  * This is a factory function to create the default webpack config
151
146
  * for a MC Application in `production` mode.
152
147
  * The function requires the file path to the related application
153
148
  * "entry point".
154
149
  */
155
-
156
150
  function createWebpackConfigForProduction() {
157
151
  var _context, _context2, _context3, _context4, _context5, _context6;
158
-
159
152
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
160
-
161
153
  const mergedOptions = _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
162
154
  toggleFlags: _objectSpread(_objectSpread({}, defaultToggleFlags), options.toggleFlags)
163
155
  });
164
-
165
156
  return {
166
157
  // Don't attempt to continue if there are any errors.
167
158
  bail: true,
@@ -253,24 +244,28 @@ function createWebpackConfigForProduction() {
253
244
  // Will be injected on runtime. See `packages/application-shell/src/public-path.js`
254
245
  publicPath: ''
255
246
  },
256
- plugins: _filterInstanceProperty__default["default"](_context4 = [// Allows to "assign" custom options to the `webpack` object.
247
+ plugins: _filterInstanceProperty__default["default"](_context4 = [
248
+ // Allows to "assign" custom options to the `webpack` object.
257
249
  // At the moment, this is used to share some props with `postcss.config`.
258
250
  new webpack__default["default"].LoaderOptionsPlugin({
259
251
  options: {
260
252
  sourceFolders: mergedOptions.sourceFolders,
261
253
  context: __dirname
262
254
  }
263
- }), // Makes some environment variables available to the JS code, for example:
255
+ }),
256
+ // Makes some environment variables available to the JS code, for example:
264
257
  // if (process.env.NODE_ENV === 'production') { ... }.
265
258
  new webpack__default["default"].DefinePlugin({
266
259
  __DEV__: 'false',
267
260
  'process.env': {
268
261
  NODE_ENV: _JSON$stringify__default["default"]('production')
269
262
  }
270
- }), // Only keep locales that are available in the Merchant Center.
263
+ }),
264
+ // Only keep locales that are available in the Merchant Center.
271
265
  new MomentLocalesPlugin__default["default"]({
272
266
  localesToKeep: momentLocalesToKeep
273
- }), // Generate a `stats.json` file containing information and paths to
267
+ }),
268
+ // Generate a `stats.json` file containing information and paths to
274
269
  // the assets that webpack created.
275
270
  // This is necessary to programmatically refer to the correct bundle path
276
271
  // in the `index.html`.
@@ -281,7 +276,8 @@ function createWebpackConfigForProduction() {
281
276
  inject: false,
282
277
  filename: 'index.html.template',
283
278
  template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
284
- }), mergedOptions.toggleFlags.enableExtractCss && // Extracts CSS into one CSS file to mimic CSS order in dev
279
+ }), mergedOptions.toggleFlags.enableExtractCss &&
280
+ // Extracts CSS into one CSS file to mimic CSS order in dev
285
281
  new MiniCssExtractPlugin__default["default"]({
286
282
  filename: '[name].[chunkhash].css',
287
283
  chunkFilename: '[id].[name].[chunkhash].css'
@@ -291,7 +287,8 @@ function createWebpackConfigForProduction() {
291
287
  module: {
292
288
  // Makes missing exports an error instead of warning.
293
289
  strictExportPresence: true,
294
- rules: _filterInstanceProperty__default["default"](_context5 = [// For svg icons, we want to get them transformed into React components
290
+ rules: _filterInstanceProperty__default["default"](_context5 = [
291
+ // For svg icons, we want to get them transformed into React components
295
292
  // when we import them.
296
293
  {
297
294
  test: /\.react\.svg$/,
@@ -326,11 +323,13 @@ function createWebpackConfigForProduction() {
326
323
  }
327
324
  }
328
325
  }]
329
- }, // For normal svg files (not icons) we should load the file normally
326
+ },
327
+ // For normal svg files (not icons) we should load the file normally
330
328
  // and simply use it as a `<img src/>`.
331
329
  {
332
330
  test: function testForNormalSvgFiles(fileName) {
333
- return (// Use this only for plain SVG.
331
+ return (
332
+ // Use this only for plain SVG.
334
333
  // For SVG as React components, see loader above.
335
334
  _endsWithInstanceProperty__default["default"](fileName).call(fileName, '.svg') && !_endsWithInstanceProperty__default["default"](fileName).call(fileName, '.react.svg')
336
335
  );
@@ -341,7 +340,8 @@ function createWebpackConfigForProduction() {
341
340
  }, {
342
341
  test: /\.png$/,
343
342
  type: 'asset/resource'
344
- }, // "postcss" loader applies autoprefixer to our CSS
343
+ },
344
+ // "postcss" loader applies autoprefixer to our CSS
345
345
  // "css" loader resolves paths in CSS and adds assets as dependencies.
346
346
  // "style" loader turns CSS into JS modules that inject <style> tags.
347
347
  // In production, we use MiniCSSExtractPlugin to extract that CSS
@@ -369,7 +369,8 @@ function createWebpackConfigForProduction() {
369
369
  }]
370
370
  }, {
371
371
  test: function testForNormalCssFiles(fileName) {
372
- return (// Use this only for plain CSS.
372
+ return (
373
+ // Use this only for plain CSS.
373
374
  // For css-modules, see loader above.
374
375
  _endsWithInstanceProperty__default["default"](fileName).call(fileName, '.css') && !(_endsWithInstanceProperty__default["default"](fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty__default["default"](fileName).call(fileName, '.module.css'))
375
376
  );
@@ -413,7 +414,8 @@ function createWebpackConfigForProduction() {
413
414
  // See https://github.com/webpack/webpack/issues/6571
414
415
  sideEffects: true
415
416
  }]
416
- }, // Fix for react-intl
417
+ },
418
+ // Fix for react-intl
417
419
  // https://github.com/formatjs/formatjs/issues/143#issuecomment-518774786
418
420
  {
419
421
  test: /\.mjs$/,
@@ -422,10 +424,12 @@ function createWebpackConfigForProduction() {
422
424
  // https://webpack.js.org/configuration/module/#resolvefullyspecified
423
425
  fullySpecified: false
424
426
  }
425
- }, // Process application JavaScript with Babel.
427
+ },
428
+ // Process application JavaScript with Babel.
426
429
  {
427
430
  test: /\.(js|mjs|cjs|jsx|ts|tsx)$/,
428
- use: [// This loader parallelizes code compilation, it is optional but
431
+ use: [
432
+ // This loader parallelizes code compilation, it is optional but
429
433
  // improves compile time on larger projects
430
434
  {
431
435
  loader: require.resolve('thread-loader'),
@@ -453,7 +457,8 @@ function createWebpackConfigForProduction() {
453
457
  parser: {
454
458
  requireEnsure: false
455
459
  }
456
- }, // Allow to import `*.graphql` SDL files.
460
+ },
461
+ // Allow to import `*.graphql` SDL files.
457
462
  {
458
463
  test: /\.graphql$/,
459
464
  include: mergedOptions.sourceFolders,
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var createHttpUserAgent = require('@commercetools/http-user-agent');
4
- var _package = require('./package-cc5b8665.cjs.dev.js');
4
+ var _package = require('./package-4276a7a9.cjs.prod.js');
5
5
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
6
6
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
7
7
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
@@ -31,21 +31,18 @@ const userAgent = createHttpUserAgent__default["default"]({
31
31
  const homedir = os__default["default"].homedir();
32
32
  const credentialsFolderPath = path__default["default"].join(homedir, ".commercetools");
33
33
  const credentialsFilePath = path__default["default"].join(credentialsFolderPath, 'mc-credentials.json');
34
-
35
34
  let CredentialsStorage = /*#__PURE__*/function () {
36
35
  function CredentialsStorage() {
37
36
  _classCallCheck(this, CredentialsStorage);
38
-
39
37
  // Ensure the credentials file is present
40
38
  if (!fs__default["default"].existsSync(credentialsFilePath)) {
41
39
  fs__default["default"].mkdirSync(credentialsFolderPath, {
42
40
  recursive: true
43
- }); // Initialize with an empty object
44
-
41
+ });
42
+ // Initialize with an empty object
45
43
  this._writeCredentials();
46
44
  }
47
45
  }
48
-
49
46
  _createClass(CredentialsStorage, [{
50
47
  key: "_writeCredentials",
51
48
  value: function _writeCredentials(credentials) {
@@ -65,41 +62,32 @@ let CredentialsStorage = /*#__PURE__*/function () {
65
62
  key: "getToken",
66
63
  value: function getToken(environmentKey) {
67
64
  const allCredentials = this._loadCredentials();
68
-
69
65
  if (!this.isSessionValid(environmentKey)) {
70
66
  return null;
71
67
  }
72
-
73
68
  return allCredentials[environmentKey].token;
74
69
  }
75
70
  }, {
76
71
  key: "setToken",
77
72
  value: function setToken(environmentKey, credentials) {
78
73
  const allCredentials = this._loadCredentials();
79
-
80
74
  allCredentials[environmentKey] = credentials;
81
-
82
75
  this._writeCredentials(allCredentials);
83
76
  }
84
77
  }, {
85
78
  key: "isSessionValid",
86
79
  value: function isSessionValid(environmentKey) {
87
80
  const allCredentials = this._loadCredentials();
88
-
89
81
  const credentials = allCredentials[environmentKey];
90
-
91
82
  if (!credentials) {
92
83
  return false;
93
84
  }
94
-
95
85
  const now = Math.floor(_Date$now__default["default"]() / 1000);
96
86
  return now < credentials.expiresAt;
97
87
  }
98
88
  }]);
99
-
100
89
  return CredentialsStorage;
101
90
  }();
102
-
103
91
  CredentialsStorage.location = credentialsFilePath;
104
92
 
105
93
  exports.CredentialsStorage = CredentialsStorage;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var createHttpUserAgent = require('@commercetools/http-user-agent');
4
- var _package = require('./package-83202e32.cjs.prod.js');
4
+ var _package = require('./package-70894b4c.cjs.dev.js');
5
5
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
6
6
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
7
7
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
@@ -31,21 +31,18 @@ const userAgent = createHttpUserAgent__default["default"]({
31
31
  const homedir = os__default["default"].homedir();
32
32
  const credentialsFolderPath = path__default["default"].join(homedir, ".commercetools");
33
33
  const credentialsFilePath = path__default["default"].join(credentialsFolderPath, 'mc-credentials.json');
34
-
35
34
  let CredentialsStorage = /*#__PURE__*/function () {
36
35
  function CredentialsStorage() {
37
36
  _classCallCheck(this, CredentialsStorage);
38
-
39
37
  // Ensure the credentials file is present
40
38
  if (!fs__default["default"].existsSync(credentialsFilePath)) {
41
39
  fs__default["default"].mkdirSync(credentialsFolderPath, {
42
40
  recursive: true
43
- }); // Initialize with an empty object
44
-
41
+ });
42
+ // Initialize with an empty object
45
43
  this._writeCredentials();
46
44
  }
47
45
  }
48
-
49
46
  _createClass(CredentialsStorage, [{
50
47
  key: "_writeCredentials",
51
48
  value: function _writeCredentials(credentials) {
@@ -65,41 +62,32 @@ let CredentialsStorage = /*#__PURE__*/function () {
65
62
  key: "getToken",
66
63
  value: function getToken(environmentKey) {
67
64
  const allCredentials = this._loadCredentials();
68
-
69
65
  if (!this.isSessionValid(environmentKey)) {
70
66
  return null;
71
67
  }
72
-
73
68
  return allCredentials[environmentKey].token;
74
69
  }
75
70
  }, {
76
71
  key: "setToken",
77
72
  value: function setToken(environmentKey, credentials) {
78
73
  const allCredentials = this._loadCredentials();
79
-
80
74
  allCredentials[environmentKey] = credentials;
81
-
82
75
  this._writeCredentials(allCredentials);
83
76
  }
84
77
  }, {
85
78
  key: "isSessionValid",
86
79
  value: function isSessionValid(environmentKey) {
87
80
  const allCredentials = this._loadCredentials();
88
-
89
81
  const credentials = allCredentials[environmentKey];
90
-
91
82
  if (!credentials) {
92
83
  return false;
93
84
  }
94
-
95
85
  const now = Math.floor(_Date$now__default["default"]() / 1000);
96
86
  return now < credentials.expiresAt;
97
87
  }
98
88
  }]);
99
-
100
89
  return CredentialsStorage;
101
90
  }();
102
-
103
91
  CredentialsStorage.location = credentialsFilePath;
104
92
 
105
93
  exports.CredentialsStorage = CredentialsStorage;
@@ -1,5 +1,5 @@
1
1
  import createHttpUserAgent from '@commercetools/http-user-agent';
2
- import { p as pkgJson } from './package-e6713e98.esm.js';
2
+ import { p as pkgJson } from './package-834453bb.esm.js';
3
3
  import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
4
4
  import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
5
5
  import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
@@ -20,21 +20,18 @@ const userAgent = createHttpUserAgent({
20
20
  const homedir = os.homedir();
21
21
  const credentialsFolderPath = path.join(homedir, ".commercetools");
22
22
  const credentialsFilePath = path.join(credentialsFolderPath, 'mc-credentials.json');
23
-
24
23
  let CredentialsStorage = /*#__PURE__*/function () {
25
24
  function CredentialsStorage() {
26
25
  _classCallCheck(this, CredentialsStorage);
27
-
28
26
  // Ensure the credentials file is present
29
27
  if (!fs.existsSync(credentialsFilePath)) {
30
28
  fs.mkdirSync(credentialsFolderPath, {
31
29
  recursive: true
32
- }); // Initialize with an empty object
33
-
30
+ });
31
+ // Initialize with an empty object
34
32
  this._writeCredentials();
35
33
  }
36
34
  }
37
-
38
35
  _createClass(CredentialsStorage, [{
39
36
  key: "_writeCredentials",
40
37
  value: function _writeCredentials(credentials) {
@@ -54,41 +51,32 @@ let CredentialsStorage = /*#__PURE__*/function () {
54
51
  key: "getToken",
55
52
  value: function getToken(environmentKey) {
56
53
  const allCredentials = this._loadCredentials();
57
-
58
54
  if (!this.isSessionValid(environmentKey)) {
59
55
  return null;
60
56
  }
61
-
62
57
  return allCredentials[environmentKey].token;
63
58
  }
64
59
  }, {
65
60
  key: "setToken",
66
61
  value: function setToken(environmentKey, credentials) {
67
62
  const allCredentials = this._loadCredentials();
68
-
69
63
  allCredentials[environmentKey] = credentials;
70
-
71
64
  this._writeCredentials(allCredentials);
72
65
  }
73
66
  }, {
74
67
  key: "isSessionValid",
75
68
  value: function isSessionValid(environmentKey) {
76
69
  const allCredentials = this._loadCredentials();
77
-
78
70
  const credentials = allCredentials[environmentKey];
79
-
80
71
  if (!credentials) {
81
72
  return false;
82
73
  }
83
-
84
74
  const now = Math.floor(_Date$now() / 1000);
85
75
  return now < credentials.expiresAt;
86
76
  }
87
77
  }]);
88
-
89
78
  return CredentialsStorage;
90
79
  }();
91
-
92
80
  CredentialsStorage.location = credentialsFilePath;
93
81
 
94
82
  export { CredentialsStorage as C, userAgent as u };