@commercetools-frontend/mc-scripts 27.4.1 → 27.4.2

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 (64) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +12 -9
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +12 -9
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +12 -9
  4. package/dist/{build-43e4ad06.esm.js → build-2b934f0c.esm.js} +4 -5
  5. package/dist/{build-34cff19d.cjs.dev.js → build-b59ae957.cjs.dev.js} +4 -5
  6. package/dist/{build-8941e757.cjs.prod.js → build-cebaad1c.cjs.prod.js} +4 -5
  7. package/dist/{build-vite-8cae71a0.esm.js → build-vite-1526e4f8.esm.js} +109 -20
  8. package/dist/{build-vite-837e7c94.cjs.dev.js → build-vite-2fb9320e.cjs.dev.js} +118 -20
  9. package/dist/{build-vite-b007241b.cjs.prod.js → build-vite-71889a4a.cjs.prod.js} +118 -20
  10. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
  11. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
  12. package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
  13. package/dist/{config-sync-c3777ff2.esm.js → config-sync-3be9dd65.esm.js} +3 -3
  14. package/dist/{config-sync-670fe293.cjs.prod.js → config-sync-6707192b.cjs.prod.js} +3 -3
  15. package/dist/{config-sync-91880023.cjs.dev.js → config-sync-7bd473d2.cjs.dev.js} +3 -3
  16. package/dist/{config-sync-ci-2a86810d.cjs.dev.js → config-sync-ci-3fabd319.cjs.dev.js} +3 -3
  17. package/dist/{config-sync-ci-d2a1a560.esm.js → config-sync-ci-ceed6879.esm.js} +3 -3
  18. package/dist/{config-sync-ci-c239e83b.cjs.prod.js → config-sync-ci-eaa2c74c.cjs.prod.js} +3 -3
  19. package/dist/{config-sync-helpers-afd3d75e.cjs.prod.js → config-sync-helpers-2f9ce5e7.cjs.prod.js} +1 -1
  20. package/dist/{config-sync-helpers-9c2cbd1b.esm.js → config-sync-helpers-4c1e6ef7.esm.js} +1 -1
  21. package/dist/{config-sync-helpers-2bbb7ef2.cjs.dev.js → config-sync-helpers-9e7101ca.cjs.dev.js} +1 -1
  22. package/dist/{create-postcss-config-257247d7.esm.js → create-postcss-config-040fa794.esm.js} +1 -1
  23. package/dist/{create-postcss-config-880af1a5.cjs.dev.js → create-postcss-config-7cebb3e2.cjs.dev.js} +1 -1
  24. package/dist/{create-postcss-config-f732c04c.cjs.prod.js → create-postcss-config-82c6d99e.cjs.prod.js} +1 -1
  25. package/dist/{create-webpack-config-for-development-fa4927c0.esm.js → create-webpack-config-for-development-5fba3c63.esm.js} +2 -3
  26. package/dist/{create-webpack-config-for-development-736b37a1.cjs.dev.js → create-webpack-config-for-development-835be72f.cjs.dev.js} +4 -5
  27. package/dist/{create-webpack-config-for-development-22db7e21.cjs.prod.js → create-webpack-config-for-development-9d0b5ccd.cjs.prod.js} +4 -5
  28. package/dist/{create-webpack-config-for-production-cfb9e90a.esm.js → create-webpack-config-for-production-1c770191.esm.js} +2 -3
  29. package/dist/{create-webpack-config-for-production-da525cc3.cjs.prod.js → create-webpack-config-for-production-8c3f894b.cjs.prod.js} +4 -5
  30. package/dist/{create-webpack-config-for-production-7888ee9e.cjs.dev.js → create-webpack-config-for-production-ffeb4a22.cjs.dev.js} +4 -5
  31. package/dist/{deployment-previews-set-8c400e53.cjs.dev.js → deployment-previews-set-68c37d9d.cjs.dev.js} +2 -2
  32. package/dist/{deployment-previews-set-0a6480d0.cjs.prod.js → deployment-previews-set-6dd7e367.cjs.prod.js} +2 -2
  33. package/dist/{deployment-previews-set-4ee2a4e5.esm.js → deployment-previews-set-add2d9c6.esm.js} +2 -2
  34. package/dist/{graphql-requests-25e057ed.cjs.dev.js → graphql-requests-24e04c13.cjs.dev.js} +1 -1
  35. package/dist/{graphql-requests-eb88492d.cjs.prod.js → graphql-requests-5e31d639.cjs.prod.js} +1 -1
  36. package/dist/{graphql-requests-569dae6e.esm.js → graphql-requests-c07e7b8f.esm.js} +1 -1
  37. package/dist/{login-1fd80a8d.cjs.dev.js → login-a1ad5f07.cjs.dev.js} +1 -1
  38. package/dist/{login-c18cb968.esm.js → login-af2522fd.esm.js} +1 -1
  39. package/dist/{login-a6d93fd3.cjs.prod.js → login-c05816f1.cjs.prod.js} +1 -1
  40. package/dist/{optimizations-bf991634.esm.js → optimizations-54382f7b.esm.js} +24 -9
  41. package/dist/{optimizations-fb93514f.cjs.prod.js → optimizations-56be74d6.cjs.dev.js} +24 -9
  42. package/dist/{optimizations-7789145e.cjs.dev.js → optimizations-da5a0cfa.cjs.prod.js} +24 -9
  43. package/dist/{package-8926f3f0.esm.js → package-14789720.esm.js} +9 -10
  44. package/dist/{package-2bdb4e7b.cjs.prod.js → package-6dcc2c4f.cjs.dev.js} +9 -10
  45. package/dist/{package-d8f5b403.cjs.dev.js → package-d75d6b9f.cjs.prod.js} +9 -10
  46. package/dist/serve-4062385a.esm.js +70 -0
  47. package/dist/serve-5a455e72.cjs.prod.js +81 -0
  48. package/dist/serve-b9ac0b0c.cjs.dev.js +81 -0
  49. package/dist/{start-8d77546d.esm.js → start-c9b32028.esm.js} +4 -5
  50. package/dist/{start-a35e973b.cjs.prod.js → start-f52d8e68.cjs.prod.js} +4 -5
  51. package/dist/{start-e1dffbe2.cjs.dev.js → start-f93cb36f.cjs.dev.js} +4 -5
  52. package/package.json +9 -10
  53. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  54. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  55. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  56. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +5 -6
  57. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +5 -6
  58. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +5 -6
  59. package/dist/has-jsx-runtime-aa5d21ee.cjs.dev.js +0 -15
  60. package/dist/has-jsx-runtime-c3202df5.cjs.prod.js +0 -15
  61. package/dist/has-jsx-runtime-e3ecb09b.esm.js +0 -13
  62. package/dist/serve-38456e1b.cjs.dev.js +0 -67
  63. package/dist/serve-be1f9439.esm.js +0 -57
  64. package/dist/serve-cc4a766d.cjs.prod.js +0 -67
@@ -12,8 +12,16 @@ var vite = require('vite');
12
12
  var viteBundleAnalyzer = require('vite-bundle-analyzer');
13
13
  var assets = require('@commercetools-frontend/assets');
14
14
  var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
15
- var optimizations = require('./optimizations-7789145e.cjs.dev.js');
16
15
  var paths = require('./paths-b76fc753.cjs.dev.js');
16
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
17
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
18
+ var _Map = require('@babel/runtime-corejs3/core-js-stable/map');
19
+ var _keysInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/keys');
20
+ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
21
+ var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
22
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
23
+ var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
24
+ var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
17
25
  var cliLib = require('@formatjs/cli-lib');
18
26
  var pluginutils = require('@rollup/pluginutils');
19
27
  var i18nMessageComplilation = require('./i18n-message-complilation-7311cb29.cjs.dev.js');
@@ -21,23 +29,10 @@ var fs = require('node:fs');
21
29
  var path = require('node:path');
22
30
  var glob = require('glob');
23
31
  var vitePluginSvgr = require('./vite-plugin-svgr-7d06f400.cjs.dev.js');
24
- require('@babel/runtime-corejs3/helpers/defineProperty');
25
- require('@babel/runtime-corejs3/helpers/slicedToArray');
26
- require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
27
- require('@babel/runtime-corejs3/core-js-stable/object/entries');
28
- require('@babel/runtime-corejs3/core-js-stable/instance/includes');
29
- require('@babel/runtime-corejs3/core-js-stable/object/keys');
30
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
31
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
32
- require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
33
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
34
- require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
35
- require('@babel/runtime-corejs3/core-js-stable/object/define-property');
36
- require('chalk');
37
32
  require('@babel/runtime-corejs3/core-js-stable/instance/find');
38
33
  require('fs');
39
34
  require('./does-file-exist-eb86baca.cjs.dev.js');
40
- require('@babel/runtime-corejs3/core-js-stable/object/values');
35
+ require('chalk');
41
36
  require('crypto');
42
37
  require('@babel/runtime-corejs3/core-js/instance/match-all');
43
38
 
@@ -50,6 +45,15 @@ var path__default$1 = /*#__PURE__*/_interopDefault(path$1);
50
45
  var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
51
46
  var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
52
47
  var fs__default$1 = /*#__PURE__*/_interopDefault(fs$1);
48
+ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
49
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
50
+ var _Map__default = /*#__PURE__*/_interopDefault(_Map);
51
+ var _keysInstanceProperty__default = /*#__PURE__*/_interopDefault(_keysInstanceProperty);
52
+ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
53
+ var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
54
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
55
+ var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
56
+ var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
53
57
  var fs__default = /*#__PURE__*/_interopDefault(fs);
54
58
  var path__default = /*#__PURE__*/_interopDefault(path);
55
59
 
@@ -58,6 +62,94 @@ function nonNullable(value) {
58
62
  return value !== null && value !== undefined;
59
63
  }
60
64
 
65
+ // Structural subset of Rollup's OutputChunk / OutputBundle. We avoid
66
+ // importing the real types because Rollup is a transitive dep via Vite and
67
+ // is not declared in mc-scripts' own `dependencies`. We only touch three
68
+ // fields, so a local type is cheaper than adding a dep.
69
+
70
+ /**
71
+ * Health check: after Rollup produces the output bundle, verify that the
72
+ * graph of cross-chunk imports is a DAG. Chunk-level cycles are a class of
73
+ * bug that doesn't fail at build time but crashes at runtime the moment one
74
+ * chunk reads a variable from its partner before that partner finishes
75
+ * initializing (TDZ). The historical failure mode was `@commercetools-uikit/icons`
76
+ * ↔ `app-shell` under `manualChunks`.
77
+ */
78
+ function pluginChunkCycleCheck() {
79
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
80
+ const onCycle = options.onCycle ?? 'error';
81
+ return {
82
+ name: 'vite-plugin-chunk-cycle-check',
83
+ apply: 'build',
84
+ // `generateBundle` runs once the chunk graph is final but before files
85
+ // hit disk — the cheapest place to inspect it.
86
+ generateBundle(_, bundle) {
87
+ const cycles = findChunkCycles(bundle);
88
+ if (cycles.length === 0) return;
89
+ const formatted = _mapInstanceProperty__default["default"](cycles).call(cycles, cycle => ` ${cycle.join(' → ')}`).join('\n');
90
+ const message = `Detected circular imports between output chunks:\n${formatted}\n` + `\nChunk cycles produce TDZ runtime errors (e.g. "X is undefined") ` + `because Rollup emits real ESM and one chunk can observe another ` + `chunk's not-yet-initialized top-level vars mid-evaluation. ` + `Review \`output.manualChunks\` or any plugin assigning chunks.`;
91
+ if (onCycle === 'error') {
92
+ this.error(message);
93
+ } else {
94
+ this.warn(message);
95
+ }
96
+ }
97
+ };
98
+ }
99
+
100
+ /**
101
+ * Pure graph algorithm extracted for direct unit testing. Builds the
102
+ * chunk-to-chunk import graph and returns every elementary cycle found.
103
+ */
104
+ function findChunkCycles(bundle) {
105
+ var _context;
106
+ const chunks = _filterInstanceProperty__default["default"](_context = _Object$values__default["default"](bundle)).call(_context, entry => entry.type === 'chunk');
107
+ const graph = new _Map__default["default"]();
108
+ for (const chunk of chunks) {
109
+ // `imports` covers static imports between chunks. `dynamicImports` are
110
+ // deliberately ignored — those create legitimate lazy boundaries that
111
+ // can back-reference the parent without a runtime cycle.
112
+ graph.set(chunk.fileName, chunk.imports);
113
+ }
114
+ const WHITE = 0;
115
+ const GRAY = 1;
116
+ const BLACK = 2;
117
+ const color = new _Map__default["default"]();
118
+ for (const name of _keysInstanceProperty__default["default"](graph).call(graph)) color.set(name, WHITE);
119
+ const cycles = [];
120
+ const seenCycleKeys = new _Set__default["default"]();
121
+ const pathStack = [];
122
+ const visit = node => {
123
+ color.set(node, GRAY);
124
+ pathStack.push(node);
125
+ for (const next of graph.get(node) ?? []) {
126
+ // Imports may reference assets or chunks outside our map (e.g. CSS).
127
+ if (!graph.has(next)) continue;
128
+ const nextColor = color.get(next);
129
+ if (nextColor === GRAY) {
130
+ var _context2, _context3, _context4;
131
+ const startIdx = _indexOfInstanceProperty__default["default"](pathStack).call(pathStack, next);
132
+ const cycle = _concatInstanceProperty__default["default"](_context2 = _sliceInstanceProperty__default["default"](pathStack).call(pathStack, startIdx)).call(_context2, next);
133
+ // Normalize so we report each elementary cycle only once regardless
134
+ // of which node in the cycle DFS entered from.
135
+ const key = _sortInstanceProperty__default["default"](_context3 = _sliceInstanceProperty__default["default"](_context4 = [...cycle]).call(_context4, 0, -1)).call(_context3).join('|');
136
+ if (!seenCycleKeys.has(key)) {
137
+ seenCycleKeys.add(key);
138
+ cycles.push(cycle);
139
+ }
140
+ } else if (nextColor === WHITE) {
141
+ visit(next);
142
+ }
143
+ }
144
+ pathStack.pop();
145
+ color.set(node, BLACK);
146
+ };
147
+ for (const node of _keysInstanceProperty__default["default"](graph).call(graph)) {
148
+ if (color.get(node) === WHITE) visit(node);
149
+ }
150
+ return cycles;
151
+ }
152
+
61
153
  // This script/function is injected into the `index.html` and used by Vite
62
154
  // on runtime to build the assets URL (for example when using a separate CDN for the assets).
63
155
  // Inspired by https://github.com/vitejs/vite/blob/main/playground/assets/vite.config-runtime-base.js
@@ -165,7 +257,6 @@ async function run() {
165
257
  fs__default$1["default"].writeFileSync(paths.paths.appIndexHtml, html, {
166
258
  encoding: 'utf8'
167
259
  });
168
- const appDependencies = require(paths.paths.appPackageJson).dependencies;
169
260
  await vite.build({
170
261
  root: paths.paths.appRoot,
171
262
  base: './',
@@ -184,9 +275,12 @@ async function run() {
184
275
  // NOTE that after the build, Vite will write the `index.html` (template)
185
276
  // at the `/public/public/index.html` location. See `fs.renameSync` below.
186
277
  input: paths.paths.appIndexHtml,
187
- output: {
188
- manualChunks: optimizations.getViteCacheGroups(appDependencies)
189
- },
278
+ // NOTE: we intentionally do not set `output.manualChunks` here. The
279
+ // declarative form does not claim transitive deps, so shared packages
280
+ // (babel-runtime, emotion, uikit internals) can land in a chunk that
281
+ // also imports back from another chunk — producing a TDZ cycle at
282
+ // runtime (historical "aM is undefined" crash with the icons/app-shell
283
+ // split). Rollup's default chunking handles co-location correctly.
190
284
  // Reduce the memory footprint when building sourcemaps.
191
285
  // https://github.com/vitejs/vite/issues/2433#issuecomment-1361094727
192
286
  cache: false
@@ -232,7 +326,11 @@ async function run() {
232
326
  outputDir: paths.paths.appBuild,
233
327
  patterns: ['*.react-*.svg'],
234
328
  verbose: true // logs the files that are removed
235
- }), vitePluginDynamicBaseAssetsGlobals(), vitePluginI18nMessageCompilation(), process.env.ANALYZE_BUNDLE === 'true' && viteBundleAnalyzer.analyzer({
329
+ }), vitePluginDynamicBaseAssetsGlobals(), vitePluginI18nMessageCompilation(),
330
+ // Fail the build if the emitted chunk graph contains circular imports.
331
+ // Chunk cycles are silent at build time but crash at runtime with TDZ
332
+ // errors (historical "aM is undefined" from the icons/app-shell split).
333
+ pluginChunkCycleCheck(), process.env.ANALYZE_BUNDLE === 'true' && viteBundleAnalyzer.analyzer({
236
334
  defaultSizes: 'stat',
237
335
  openAnalyzer: true
238
336
  }), process.env.ANALYZE_BUNDLE_TREE === 'true' && rollupPluginVisualizer.visualizer({
@@ -12,8 +12,16 @@ var vite = require('vite');
12
12
  var viteBundleAnalyzer = require('vite-bundle-analyzer');
13
13
  var assets = require('@commercetools-frontend/assets');
14
14
  var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
15
- var optimizations = require('./optimizations-fb93514f.cjs.prod.js');
16
15
  var paths = require('./paths-7768b440.cjs.prod.js');
16
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
17
+ var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
18
+ var _Map = require('@babel/runtime-corejs3/core-js-stable/map');
19
+ var _keysInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/keys');
20
+ var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
21
+ var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
22
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
23
+ var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
24
+ var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/sort');
17
25
  var cliLib = require('@formatjs/cli-lib');
18
26
  var pluginutils = require('@rollup/pluginutils');
19
27
  var i18nMessageComplilation = require('./i18n-message-complilation-7762da61.cjs.prod.js');
@@ -21,23 +29,10 @@ var fs = require('node:fs');
21
29
  var path = require('node:path');
22
30
  var glob = require('glob');
23
31
  var vitePluginSvgr = require('./vite-plugin-svgr-4034a834.cjs.prod.js');
24
- require('@babel/runtime-corejs3/helpers/defineProperty');
25
- require('@babel/runtime-corejs3/helpers/slicedToArray');
26
- require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
27
- require('@babel/runtime-corejs3/core-js-stable/object/entries');
28
- require('@babel/runtime-corejs3/core-js-stable/instance/includes');
29
- require('@babel/runtime-corejs3/core-js-stable/object/keys');
30
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
31
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
32
- require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
33
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
34
- require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
35
- require('@babel/runtime-corejs3/core-js-stable/object/define-property');
36
- require('chalk');
37
32
  require('@babel/runtime-corejs3/core-js-stable/instance/find');
38
33
  require('fs');
39
34
  require('./does-file-exist-be53305d.cjs.prod.js');
40
- require('@babel/runtime-corejs3/core-js-stable/object/values');
35
+ require('chalk');
41
36
  require('crypto');
42
37
  require('@babel/runtime-corejs3/core-js/instance/match-all');
43
38
 
@@ -50,6 +45,15 @@ var path__default$1 = /*#__PURE__*/_interopDefault(path$1);
50
45
  var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
51
46
  var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
52
47
  var fs__default$1 = /*#__PURE__*/_interopDefault(fs$1);
48
+ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
49
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
50
+ var _Map__default = /*#__PURE__*/_interopDefault(_Map);
51
+ var _keysInstanceProperty__default = /*#__PURE__*/_interopDefault(_keysInstanceProperty);
52
+ var _Set__default = /*#__PURE__*/_interopDefault(_Set);
53
+ var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
54
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
55
+ var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
56
+ var _sortInstanceProperty__default = /*#__PURE__*/_interopDefault(_sortInstanceProperty);
53
57
  var fs__default = /*#__PURE__*/_interopDefault(fs);
54
58
  var path__default = /*#__PURE__*/_interopDefault(path);
55
59
 
@@ -58,6 +62,94 @@ function nonNullable(value) {
58
62
  return value !== null && value !== undefined;
59
63
  }
60
64
 
65
+ // Structural subset of Rollup's OutputChunk / OutputBundle. We avoid
66
+ // importing the real types because Rollup is a transitive dep via Vite and
67
+ // is not declared in mc-scripts' own `dependencies`. We only touch three
68
+ // fields, so a local type is cheaper than adding a dep.
69
+
70
+ /**
71
+ * Health check: after Rollup produces the output bundle, verify that the
72
+ * graph of cross-chunk imports is a DAG. Chunk-level cycles are a class of
73
+ * bug that doesn't fail at build time but crashes at runtime the moment one
74
+ * chunk reads a variable from its partner before that partner finishes
75
+ * initializing (TDZ). The historical failure mode was `@commercetools-uikit/icons`
76
+ * ↔ `app-shell` under `manualChunks`.
77
+ */
78
+ function pluginChunkCycleCheck() {
79
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
80
+ const onCycle = options.onCycle ?? 'error';
81
+ return {
82
+ name: 'vite-plugin-chunk-cycle-check',
83
+ apply: 'build',
84
+ // `generateBundle` runs once the chunk graph is final but before files
85
+ // hit disk — the cheapest place to inspect it.
86
+ generateBundle(_, bundle) {
87
+ const cycles = findChunkCycles(bundle);
88
+ if (cycles.length === 0) return;
89
+ const formatted = _mapInstanceProperty__default["default"](cycles).call(cycles, cycle => ` ${cycle.join(' → ')}`).join('\n');
90
+ const message = `Detected circular imports between output chunks:\n${formatted}\n` + `\nChunk cycles produce TDZ runtime errors (e.g. "X is undefined") ` + `because Rollup emits real ESM and one chunk can observe another ` + `chunk's not-yet-initialized top-level vars mid-evaluation. ` + `Review \`output.manualChunks\` or any plugin assigning chunks.`;
91
+ if (onCycle === 'error') {
92
+ this.error(message);
93
+ } else {
94
+ this.warn(message);
95
+ }
96
+ }
97
+ };
98
+ }
99
+
100
+ /**
101
+ * Pure graph algorithm extracted for direct unit testing. Builds the
102
+ * chunk-to-chunk import graph and returns every elementary cycle found.
103
+ */
104
+ function findChunkCycles(bundle) {
105
+ var _context;
106
+ const chunks = _filterInstanceProperty__default["default"](_context = _Object$values__default["default"](bundle)).call(_context, entry => entry.type === 'chunk');
107
+ const graph = new _Map__default["default"]();
108
+ for (const chunk of chunks) {
109
+ // `imports` covers static imports between chunks. `dynamicImports` are
110
+ // deliberately ignored — those create legitimate lazy boundaries that
111
+ // can back-reference the parent without a runtime cycle.
112
+ graph.set(chunk.fileName, chunk.imports);
113
+ }
114
+ const WHITE = 0;
115
+ const GRAY = 1;
116
+ const BLACK = 2;
117
+ const color = new _Map__default["default"]();
118
+ for (const name of _keysInstanceProperty__default["default"](graph).call(graph)) color.set(name, WHITE);
119
+ const cycles = [];
120
+ const seenCycleKeys = new _Set__default["default"]();
121
+ const pathStack = [];
122
+ const visit = node => {
123
+ color.set(node, GRAY);
124
+ pathStack.push(node);
125
+ for (const next of graph.get(node) ?? []) {
126
+ // Imports may reference assets or chunks outside our map (e.g. CSS).
127
+ if (!graph.has(next)) continue;
128
+ const nextColor = color.get(next);
129
+ if (nextColor === GRAY) {
130
+ var _context2, _context3, _context4;
131
+ const startIdx = _indexOfInstanceProperty__default["default"](pathStack).call(pathStack, next);
132
+ const cycle = _concatInstanceProperty__default["default"](_context2 = _sliceInstanceProperty__default["default"](pathStack).call(pathStack, startIdx)).call(_context2, next);
133
+ // Normalize so we report each elementary cycle only once regardless
134
+ // of which node in the cycle DFS entered from.
135
+ const key = _sortInstanceProperty__default["default"](_context3 = _sliceInstanceProperty__default["default"](_context4 = [...cycle]).call(_context4, 0, -1)).call(_context3).join('|');
136
+ if (!seenCycleKeys.has(key)) {
137
+ seenCycleKeys.add(key);
138
+ cycles.push(cycle);
139
+ }
140
+ } else if (nextColor === WHITE) {
141
+ visit(next);
142
+ }
143
+ }
144
+ pathStack.pop();
145
+ color.set(node, BLACK);
146
+ };
147
+ for (const node of _keysInstanceProperty__default["default"](graph).call(graph)) {
148
+ if (color.get(node) === WHITE) visit(node);
149
+ }
150
+ return cycles;
151
+ }
152
+
61
153
  // This script/function is injected into the `index.html` and used by Vite
62
154
  // on runtime to build the assets URL (for example when using a separate CDN for the assets).
63
155
  // Inspired by https://github.com/vitejs/vite/blob/main/playground/assets/vite.config-runtime-base.js
@@ -165,7 +257,6 @@ async function run() {
165
257
  fs__default$1["default"].writeFileSync(paths.paths.appIndexHtml, html, {
166
258
  encoding: 'utf8'
167
259
  });
168
- const appDependencies = require(paths.paths.appPackageJson).dependencies;
169
260
  await vite.build({
170
261
  root: paths.paths.appRoot,
171
262
  base: './',
@@ -184,9 +275,12 @@ async function run() {
184
275
  // NOTE that after the build, Vite will write the `index.html` (template)
185
276
  // at the `/public/public/index.html` location. See `fs.renameSync` below.
186
277
  input: paths.paths.appIndexHtml,
187
- output: {
188
- manualChunks: optimizations.getViteCacheGroups(appDependencies)
189
- },
278
+ // NOTE: we intentionally do not set `output.manualChunks` here. The
279
+ // declarative form does not claim transitive deps, so shared packages
280
+ // (babel-runtime, emotion, uikit internals) can land in a chunk that
281
+ // also imports back from another chunk — producing a TDZ cycle at
282
+ // runtime (historical "aM is undefined" crash with the icons/app-shell
283
+ // split). Rollup's default chunking handles co-location correctly.
190
284
  // Reduce the memory footprint when building sourcemaps.
191
285
  // https://github.com/vitejs/vite/issues/2433#issuecomment-1361094727
192
286
  cache: false
@@ -232,7 +326,11 @@ async function run() {
232
326
  outputDir: paths.paths.appBuild,
233
327
  patterns: ['*.react-*.svg'],
234
328
  verbose: true // logs the files that are removed
235
- }), vitePluginDynamicBaseAssetsGlobals(), vitePluginI18nMessageCompilation(), process.env.ANALYZE_BUNDLE === 'true' && viteBundleAnalyzer.analyzer({
329
+ }), vitePluginDynamicBaseAssetsGlobals(), vitePluginI18nMessageCompilation(),
330
+ // Fail the build if the emitted chunk graph contains circular imports.
331
+ // Chunk cycles are silent at build time but crash at runtime with TDZ
332
+ // errors (historical "aM is undefined" from the icons/app-shell split).
333
+ pluginChunkCycleCheck(), process.env.ANALYZE_BUNDLE === 'true' && viteBundleAnalyzer.analyzer({
236
334
  defaultSizes: 'stat',
237
335
  openAnalyzer: true
238
336
  }), process.env.ANALYZE_BUNDLE_TREE === 'true' && rollupPluginVisualizer.visualizer({
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var vendorsToTranspile = require('./vendors-to-transpile-6ab4ea06.cjs.dev.js');
6
6
 
7
7
  // NOTE: This string will be replaced on build time with the package version.
8
- var version = "27.4.0";
8
+ var version = "27.4.2";
9
9
 
10
10
  // These exports are deprecated.
11
11
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var vendorsToTranspile = require('./vendors-to-transpile-04a49d40.cjs.prod.js');
6
6
 
7
7
  // NOTE: This string will be replaced on build time with the package version.
8
- var version = "27.4.0";
8
+ var version = "27.4.2";
9
9
 
10
10
  // These exports are deprecated.
11
11
 
@@ -1,7 +1,7 @@
1
1
  export { v as vendorsToTranspile } from './vendors-to-transpile-7dc84a72.esm.js';
2
2
 
3
3
  // NOTE: This string will be replaced on build time with the package version.
4
- var version = "27.4.0";
4
+ var version = "27.4.2";
5
5
 
6
6
  // These exports are deprecated.
7
7
 
@@ -5,9 +5,9 @@ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
5
5
  import chalk from 'chalk';
6
6
  import prompts from 'prompts';
7
7
  import { processConfig } from '@commercetools-frontend/application-config';
8
- import { i as isCustomViewData, c as checkCustomApplicationStatus, p as performCreateCustomApplication, a as performUpdateCustomApplication, b as checkCustomViewStatus, d as performCreateCustomView, e as performUpdateCustomView } from './config-sync-helpers-9c2cbd1b.esm.js';
8
+ import { i as isCustomViewData, c as checkCustomApplicationStatus, p as performCreateCustomApplication, a as performUpdateCustomApplication, b as checkCustomViewStatus, d as performCreateCustomView, e as performUpdateCustomView } from './config-sync-helpers-4c1e6ef7.esm.js';
9
9
  import { C as CredentialsStorage } from './credentials-storage-67deadc3.esm.js';
10
- import { f as fetchUserOrganizations } from './graphql-requests-569dae6e.esm.js';
10
+ import { f as fetchUserOrganizations } from './graphql-requests-c07e7b8f.esm.js';
11
11
  import '@babel/runtime-corejs3/core-js-stable/json/stringify';
12
12
  import 'lodash/omit';
13
13
  import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
@@ -34,7 +34,7 @@ import 'graphql';
34
34
  import 'graphql-request';
35
35
  import '@commercetools-frontend/constants';
36
36
  import '@commercetools/http-user-agent';
37
- import './package-8926f3f0.esm.js';
37
+ import './package-14789720.esm.js';
38
38
 
39
39
  const credentialsStorage = new CredentialsStorage();
40
40
  async function promptForOrganization(_ref) {
@@ -7,9 +7,9 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
7
7
  var chalk = require('chalk');
8
8
  var prompts = require('prompts');
9
9
  var applicationConfig = require('@commercetools-frontend/application-config');
10
- var configSyncHelpers = require('./config-sync-helpers-afd3d75e.cjs.prod.js');
10
+ var configSyncHelpers = require('./config-sync-helpers-2f9ce5e7.cjs.prod.js');
11
11
  var credentialsStorage$1 = require('./credentials-storage-ea1c16dc.cjs.prod.js');
12
- var graphqlRequests = require('./graphql-requests-eb88492d.cjs.prod.js');
12
+ var graphqlRequests = require('./graphql-requests-5e31d639.cjs.prod.js');
13
13
  require('@babel/runtime-corejs3/core-js-stable/json/stringify');
14
14
  require('lodash/omit');
15
15
  require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -36,7 +36,7 @@ require('graphql');
36
36
  require('graphql-request');
37
37
  require('@commercetools-frontend/constants');
38
38
  require('@commercetools/http-user-agent');
39
- require('./package-2bdb4e7b.cjs.prod.js');
39
+ require('./package-d75d6b9f.cjs.prod.js');
40
40
 
41
41
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
42
42
 
@@ -7,9 +7,9 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
7
7
  var chalk = require('chalk');
8
8
  var prompts = require('prompts');
9
9
  var applicationConfig = require('@commercetools-frontend/application-config');
10
- var configSyncHelpers = require('./config-sync-helpers-2bbb7ef2.cjs.dev.js');
10
+ var configSyncHelpers = require('./config-sync-helpers-9e7101ca.cjs.dev.js');
11
11
  var credentialsStorage$1 = require('./credentials-storage-fd195144.cjs.dev.js');
12
- var graphqlRequests = require('./graphql-requests-25e057ed.cjs.dev.js');
12
+ var graphqlRequests = require('./graphql-requests-24e04c13.cjs.dev.js');
13
13
  require('@babel/runtime-corejs3/core-js-stable/json/stringify');
14
14
  require('lodash/omit');
15
15
  require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -36,7 +36,7 @@ require('graphql');
36
36
  require('graphql-request');
37
37
  require('@commercetools-frontend/constants');
38
38
  require('@commercetools/http-user-agent');
39
- require('./package-d8f5b403.cjs.dev.js');
39
+ require('./package-6dcc2c4f.cjs.dev.js');
40
40
 
41
41
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
42
42
 
@@ -5,8 +5,8 @@ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/insta
5
5
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
6
6
  var chalk = require('chalk');
7
7
  var applicationConfig = require('@commercetools-frontend/application-config');
8
- var configSyncHelpers = require('./config-sync-helpers-2bbb7ef2.cjs.dev.js');
9
- var graphqlRequests = require('./graphql-requests-25e057ed.cjs.dev.js');
8
+ var configSyncHelpers = require('./config-sync-helpers-9e7101ca.cjs.dev.js');
9
+ var graphqlRequests = require('./graphql-requests-24e04c13.cjs.dev.js');
10
10
  var _Date$now = require('@babel/runtime-corejs3/core-js-stable/date/now');
11
11
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
12
12
  var jwtDecode = require('jwt-decode');
@@ -31,7 +31,7 @@ require('graphql');
31
31
  require('graphql-request');
32
32
  require('@commercetools-frontend/constants');
33
33
  require('@commercetools/http-user-agent');
34
- require('./package-d8f5b403.cjs.dev.js');
34
+ require('./package-6dcc2c4f.cjs.dev.js');
35
35
  require('@babel/runtime-corejs3/helpers/classCallCheck');
36
36
  require('@babel/runtime-corejs3/helpers/createClass');
37
37
  require('node:fs');
@@ -3,8 +3,8 @@ import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instanc
3
3
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
4
4
  import chalk from 'chalk';
5
5
  import { processConfig } from '@commercetools-frontend/application-config';
6
- import { i as isCustomViewData, c as checkCustomApplicationStatus, p as performCreateCustomApplication, a as performUpdateCustomApplication, b as checkCustomViewStatus, d as performCreateCustomView, e as performUpdateCustomView } from './config-sync-helpers-9c2cbd1b.esm.js';
7
- import { f as fetchUserOrganizations } from './graphql-requests-569dae6e.esm.js';
6
+ import { i as isCustomViewData, c as checkCustomApplicationStatus, p as performCreateCustomApplication, a as performUpdateCustomApplication, b as checkCustomViewStatus, d as performCreateCustomView, e as performUpdateCustomView } from './config-sync-helpers-4c1e6ef7.esm.js';
7
+ import { f as fetchUserOrganizations } from './graphql-requests-c07e7b8f.esm.js';
8
8
  import _Date$now from '@babel/runtime-corejs3/core-js-stable/date/now';
9
9
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
10
10
  import jwtDecode from 'jwt-decode';
@@ -29,7 +29,7 @@ import 'graphql';
29
29
  import 'graphql-request';
30
30
  import '@commercetools-frontend/constants';
31
31
  import '@commercetools/http-user-agent';
32
- import './package-8926f3f0.esm.js';
32
+ import './package-14789720.esm.js';
33
33
  import '@babel/runtime-corejs3/helpers/classCallCheck';
34
34
  import '@babel/runtime-corejs3/helpers/createClass';
35
35
  import 'node:fs';
@@ -5,8 +5,8 @@ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/insta
5
5
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
6
6
  var chalk = require('chalk');
7
7
  var applicationConfig = require('@commercetools-frontend/application-config');
8
- var configSyncHelpers = require('./config-sync-helpers-afd3d75e.cjs.prod.js');
9
- var graphqlRequests = require('./graphql-requests-eb88492d.cjs.prod.js');
8
+ var configSyncHelpers = require('./config-sync-helpers-2f9ce5e7.cjs.prod.js');
9
+ var graphqlRequests = require('./graphql-requests-5e31d639.cjs.prod.js');
10
10
  var _Date$now = require('@babel/runtime-corejs3/core-js-stable/date/now');
11
11
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
12
12
  var jwtDecode = require('jwt-decode');
@@ -31,7 +31,7 @@ require('graphql');
31
31
  require('graphql-request');
32
32
  require('@commercetools-frontend/constants');
33
33
  require('@commercetools/http-user-agent');
34
- require('./package-2bdb4e7b.cjs.prod.js');
34
+ require('./package-d75d6b9f.cjs.prod.js');
35
35
  require('@babel/runtime-corejs3/helpers/classCallCheck');
36
36
  require('@babel/runtime-corejs3/helpers/createClass');
37
37
  require('node:fs');
@@ -18,7 +18,7 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
18
18
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
19
19
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
20
20
  var applicationConfig = require('@commercetools-frontend/application-config');
21
- var graphqlRequests = require('./graphql-requests-eb88492d.cjs.prod.js');
21
+ var graphqlRequests = require('./graphql-requests-5e31d639.cjs.prod.js');
22
22
 
23
23
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
24
24
 
@@ -16,7 +16,7 @@ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
16
16
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
17
17
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
18
18
  import { sanitizeSvg } from '@commercetools-frontend/application-config';
19
- import { c as createCustomApplication, u as updateCustomApplication, a as createCustomView, b as updateCustomView, d as fetchCustomApplication, e as fetchCustomView } from './graphql-requests-569dae6e.esm.js';
19
+ import { c as createCustomApplication, u as updateCustomApplication, a as createCustomView, b as updateCustomView, d as fetchCustomApplication, e as fetchCustomView } from './graphql-requests-c07e7b8f.esm.js';
20
20
 
21
21
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
22
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context0; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context9 = ownKeys(Object(t), !0)).call(_context9, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context0 = ownKeys(Object(t))).call(_context0, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -18,7 +18,7 @@ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
18
18
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
19
19
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
20
20
  var applicationConfig = require('@commercetools-frontend/application-config');
21
- var graphqlRequests = require('./graphql-requests-25e057ed.cjs.dev.js');
21
+ var graphqlRequests = require('./graphql-requests-24e04c13.cjs.dev.js');
22
22
 
23
23
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
24
24
 
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
2
2
  import path from 'path';
3
- import { p as pkgJson } from './package-8926f3f0.esm.js';
3
+ import { p as pkgJson } from './package-14789720.esm.js';
4
4
 
5
5
  // This function aims to return the same result as `require.resolve`.
6
6
  // However, resolving a path to a `.css` file does not return the real
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
4
4
  var path = require('path');
5
- var _package = require('./package-d8f5b403.cjs.dev.js');
5
+ var _package = require('./package-6dcc2c4f.cjs.dev.js');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
4
4
  var path = require('path');
5
- var _package = require('./package-2bdb4e7b.cjs.prod.js');
5
+ var _package = require('./package-d75d6b9f.cjs.prod.js');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
8
 
@@ -23,9 +23,8 @@ import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
23
23
  import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
24
24
  import { processConfig } from '@commercetools-frontend/application-config';
25
25
  import { replaceHtmlPlaceholders } from '@commercetools-frontend/mc-html-template';
26
- import { c as createPostcssConfig } from './create-postcss-config-257247d7.esm.js';
27
- import { h as hasJsxRuntime } from './has-jsx-runtime-e3ecb09b.esm.js';
28
- import { g as getWepbackCacheGroups } from './optimizations-bf991634.esm.js';
26
+ import { c as createPostcssConfig } from './create-postcss-config-040fa794.esm.js';
27
+ import { g as getWepbackCacheGroups, h as hasJsxRuntime } from './optimizations-54382f7b.esm.js';
29
28
  import { p as paths } from './paths-39f22b8b.esm.js';
30
29
  import { v as vendorsToTranspile } from './vendors-to-transpile-7dc84a72.esm.js';
31
30