@commercetools-frontend/mc-scripts 21.23.10 → 21.24.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 (89) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +120 -326
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +120 -326
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +116 -321
  4. package/dist/build-980cf2c9.cjs.prod.js +170 -0
  5. package/dist/build-c9601b07.esm.js +156 -0
  6. package/dist/build-e8a49b56.cjs.dev.js +170 -0
  7. package/dist/build-vite-b531d3d3.esm.js +118 -0
  8. package/dist/build-vite-c40a55c3.cjs.dev.js +129 -0
  9. package/dist/build-vite-d17432ec.cjs.prod.js +129 -0
  10. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -2
  11. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -2
  12. package/dist/commercetools-frontend-mc-scripts.esm.js +2 -2
  13. package/dist/compile-html-41195e35.cjs.dev.js +49 -0
  14. package/dist/compile-html-5abd78aa.cjs.prod.js +49 -0
  15. package/dist/compile-html-f9de842c.esm.js +40 -0
  16. package/dist/config-sync-0ecc13b3.cjs.dev.js +783 -0
  17. package/dist/config-sync-4b1ddec3.esm.js +759 -0
  18. package/dist/config-sync-bb59a82d.cjs.prod.js +778 -0
  19. package/dist/{create-postcss-config-f65c7e31.cjs.dev.js → create-postcss-config-5cc679d5.cjs.dev.js} +9 -14
  20. package/dist/{create-postcss-config-06b2e5c2.esm.js → create-postcss-config-a0d4cffa.esm.js} +9 -13
  21. package/dist/{create-postcss-config-787d905f.cjs.prod.js → create-postcss-config-f94c07fd.cjs.prod.js} +9 -14
  22. package/dist/{create-webpack-config-for-development-fd365d6a.esm.js → create-webpack-config-for-development-95334073.esm.js} +21 -25
  23. package/dist/{create-webpack-config-for-development-d46ef148.cjs.dev.js → create-webpack-config-for-development-a53bab71.cjs.dev.js} +24 -28
  24. package/dist/{create-webpack-config-for-development-59faaed8.cjs.prod.js → create-webpack-config-for-development-c915ec0c.cjs.prod.js} +24 -28
  25. package/dist/{create-webpack-config-for-production-b28b3d33.esm.js → create-webpack-config-for-production-342485cd.esm.js} +18 -21
  26. package/dist/{create-webpack-config-for-production-1af3a454.cjs.prod.js → create-webpack-config-for-production-af6f3138.cjs.prod.js} +20 -23
  27. package/dist/{create-webpack-config-for-production-e12e3c30.cjs.dev.js → create-webpack-config-for-production-db45d9ab.cjs.dev.js} +20 -23
  28. package/dist/{user-agent-9a470e39.cjs.dev.js → credentials-storage-a37a8915.cjs.dev.js} +24 -24
  29. package/dist/{user-agent-6e8d0e0b.cjs.prod.js → credentials-storage-b803a804.cjs.prod.js} +24 -24
  30. package/dist/{user-agent-4b60934e.esm.js → credentials-storage-cb88e8fc.esm.js} +22 -22
  31. package/dist/declarations/src/deprecated-entry-points.d.ts +1 -1
  32. package/dist/login-35040a86.cjs.dev.js +93 -0
  33. package/dist/login-6e17747d.esm.js +84 -0
  34. package/dist/login-90736d7e.cjs.prod.js +93 -0
  35. package/dist/{package-a5454c97.esm.js → package-17f18481.esm.js} +17 -16
  36. package/dist/{package-e2d9b5e0.cjs.dev.js → package-c42dc2ac.cjs.dev.js} +17 -16
  37. package/dist/{package-808a31f1.cjs.prod.js → package-db15171f.cjs.prod.js} +17 -16
  38. package/dist/{paths-76b66e74.cjs.prod.js → paths-284c77fb.cjs.prod.js} +6 -8
  39. package/dist/{paths-ed23d5a1.esm.js → paths-55c5d5a2.esm.js} +6 -8
  40. package/dist/{paths-16823f56.cjs.dev.js → paths-db35ac0f.cjs.dev.js} +6 -8
  41. package/dist/serve-41077dad.cjs.prod.js +48 -0
  42. package/dist/serve-660e2ee0.esm.js +41 -0
  43. package/dist/serve-b8063204.cjs.dev.js +48 -0
  44. package/dist/start-0aa71e9a.esm.js +166 -0
  45. package/dist/start-2e7ec87c.cjs.dev.js +180 -0
  46. package/dist/start-c0ffe8d7.cjs.prod.js +180 -0
  47. package/dist/start-vite-324af14d.cjs.prod.js +119 -0
  48. package/dist/start-vite-7d10ae71.esm.js +107 -0
  49. package/dist/start-vite-8f03b0df.cjs.dev.js +119 -0
  50. package/dist/{vendors-to-transpile-367e0ba8.cjs.prod.js → vendors-to-transpile-04a49d40.cjs.prod.js} +1 -1
  51. package/dist/{vendors-to-transpile-b51af5d3.cjs.dev.js → vendors-to-transpile-6ab4ea06.cjs.dev.js} +1 -1
  52. package/dist/{vendors-to-transpile-68e03526.esm.js → vendors-to-transpile-7dc84a72.esm.js} +1 -1
  53. package/dist/vite-plugin-svgr-9a4e7f77.cjs.prod.js +79 -0
  54. package/dist/vite-plugin-svgr-f17db78a.esm.js +55 -0
  55. package/dist/vite-plugin-svgr-fdb37ccf.cjs.dev.js +79 -0
  56. package/package.json +17 -16
  57. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -4
  58. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -4
  59. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -4
  60. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +12 -13
  61. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +12 -13
  62. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +12 -13
  63. package/dist/build-0e6d74d1.esm.js +0 -209
  64. package/dist/build-9074fc85.cjs.dev.js +0 -224
  65. package/dist/build-ae132901.cjs.prod.js +0 -224
  66. package/dist/build-vite-482a21b8.cjs.dev.js +0 -151
  67. package/dist/build-vite-cc68e3bf.esm.js +0 -139
  68. package/dist/build-vite-f095b68d.cjs.prod.js +0 -151
  69. package/dist/compile-html-4361a0b3.esm.js +0 -77
  70. package/dist/compile-html-d6331c35.cjs.prod.js +0 -87
  71. package/dist/compile-html-d9e731aa.cjs.dev.js +0 -87
  72. package/dist/config-sync-2a9945bc.cjs.dev.js +0 -989
  73. package/dist/config-sync-43a80f60.cjs.prod.js +0 -984
  74. package/dist/config-sync-c6c4d1cf.esm.js +0 -964
  75. package/dist/login-7f1cc8d0.cjs.prod.js +0 -167
  76. package/dist/login-d21a49e8.esm.js +0 -157
  77. package/dist/login-ed827138.cjs.dev.js +0 -167
  78. package/dist/serve-12de323b.cjs.dev.js +0 -70
  79. package/dist/serve-784f4fcd.cjs.prod.js +0 -70
  80. package/dist/serve-d6b437b1.esm.js +0 -62
  81. package/dist/start-10a4d95a.esm.js +0 -194
  82. package/dist/start-d021fa98.cjs.prod.js +0 -209
  83. package/dist/start-eea524f2.cjs.dev.js +0 -209
  84. package/dist/start-vite-57ec5175.cjs.dev.js +0 -146
  85. package/dist/start-vite-94c2db8c.esm.js +0 -133
  86. package/dist/start-vite-fc0b15d3.cjs.prod.js +0 -146
  87. package/dist/vite-plugin-svgr-4205f2b5.cjs.dev.js +0 -110
  88. package/dist/vite-plugin-svgr-eb8524fa.esm.js +0 -85
  89. package/dist/vite-plugin-svgr-f3bbedbe.cjs.prod.js +0 -110
@@ -1,224 +0,0 @@
1
- 'use strict';
2
-
3
- var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
4
- var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
5
- var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
6
- var path = require('path');
7
- var fs = require('fs-extra');
8
- var webpack = require('webpack');
9
- var chalk = require('chalk');
10
- var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
11
- var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
12
- var FileSizeReporter = require('react-dev-utils/FileSizeReporter');
13
- var printBuildError = require('react-dev-utils/printBuildError');
14
- var assets = require('@commercetools-frontend/assets');
15
- var paths = require('./paths-76b66e74.cjs.prod.js');
16
- var createWebpackConfigForProduction = require('./create-webpack-config-for-production-1af3a454.cjs.prod.js');
17
- require('@babel/runtime-corejs3/core-js-stable/instance/find');
18
- require('@babel/runtime-corejs3/core-js-stable/instance/concat');
19
- require('fs');
20
- require('@babel/runtime-corejs3/core-js-stable/object/keys');
21
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
22
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
23
- require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
24
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
25
- require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
26
- require('@babel/runtime-corejs3/core-js-stable/object/define-property');
27
- require('@babel/runtime-corejs3/helpers/defineProperty');
28
- require('@babel/runtime-corejs3/core-js-stable/instance/filter');
29
- require('@babel/runtime-corejs3/core-js-stable/instance/map');
30
- require('@babel/runtime-corejs3/core-js-stable/json/stringify');
31
- require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
32
- require('@babel/runtime-corejs3/core-js-stable/number/is-integer');
33
- require('html-webpack-plugin');
34
- require('webpack-bundle-analyzer');
35
- require('css-minimizer-webpack-plugin');
36
- require('mini-css-extract-plugin');
37
- require('moment-locales-webpack-plugin');
38
- require('terser-webpack-plugin');
39
- require('@babel/runtime-corejs3/helpers/classCallCheck');
40
- require('@babel/runtime-corejs3/helpers/createClass');
41
- require('@babel/runtime-corejs3/core-js-stable/instance/bind');
42
- require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
43
- require('@babel/runtime-corejs3/core-js-stable/object/assign');
44
- require('./vendors-to-transpile-367e0ba8.cjs.prod.js');
45
- require('./create-postcss-config-787d905f.cjs.prod.js');
46
- require('@babel/runtime-corejs3/helpers/toConsumableArray');
47
- require('@babel/runtime-corejs3/helpers/slicedToArray');
48
- require('./package-808a31f1.cjs.prod.js');
49
- require('./has-jsx-runtime-0b03b72e.cjs.prod.js');
50
-
51
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
52
-
53
- var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
54
- var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
55
- var path__default = /*#__PURE__*/_interopDefault(path);
56
- var fs__default = /*#__PURE__*/_interopDefault(fs);
57
- var webpack__default = /*#__PURE__*/_interopDefault(webpack);
58
- var chalk__default = /*#__PURE__*/_interopDefault(chalk);
59
- var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
60
- var formatWebpackMessages__default = /*#__PURE__*/_interopDefault(formatWebpackMessages);
61
- var FileSizeReporter__default = /*#__PURE__*/_interopDefault(FileSizeReporter);
62
- var printBuildError__default = /*#__PURE__*/_interopDefault(printBuildError);
63
-
64
- var measureFileSizesBeforeBuild = FileSizeReporter__default["default"].measureFileSizesBeforeBuild;
65
- var printFileSizesAfterBuild = FileSizeReporter__default["default"].printFileSizesAfterBuild; // These sizes are pretty large. We'll warn for bundles exceeding them.
66
-
67
- var WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
68
- var WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
69
-
70
- function run() {
71
- return _run.apply(this, arguments);
72
- }
73
-
74
- function _run() {
75
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2() {
76
- var hasWebpackConfig, previousFileSizes, result, build, _build, copyDefaultFiles;
77
-
78
- return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
79
- while (1) {
80
- switch (_context2.prev = _context2.next) {
81
- case 0:
82
- copyDefaultFiles = function _copyDefaultFiles() {
83
- fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
84
- dereference: true
85
- });
86
- };
87
-
88
- _build = function _build3() {
89
- _build = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
90
- var config, compiler;
91
- return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
92
- while (1) {
93
- switch (_context.prev = _context.next) {
94
- case 0:
95
- console.log('Creating an optimized production build...');
96
- config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForProduction.createWebpackConfigForProduction();
97
- compiler = webpack__default["default"](config);
98
- return _context.abrupt("return", new _Promise__default["default"](function (resolve, reject) {
99
- compiler.run(function (err, stats) {
100
- var messages;
101
-
102
- if (err) {
103
- if (!err.message) {
104
- return reject(err);
105
- }
106
-
107
- var errMessage = err.message; // Add additional information for postcss errors
108
-
109
- // Add additional information for postcss errors
110
- if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
111
- errMessage += '\nCompileError: Begins at CSS selector ' + // @ts-ignore
112
- err['postcssNode'].selector;
113
- }
114
-
115
- messages = formatWebpackMessages__default["default"]({
116
- // @ts-ignore
117
- errors: [errMessage],
118
- warnings: []
119
- });
120
- } else {
121
- messages = formatWebpackMessages__default["default"](stats === null || stats === void 0 ? void 0 : stats.toJson({
122
- all: false,
123
- warnings: true,
124
- errors: true
125
- }));
126
- }
127
-
128
- if (messages.errors.length) {
129
- // Only keep the first error. Others are often indicative
130
- // of the same problem, but confuse the reader with noise.
131
- if (messages.errors.length > 1) {
132
- messages.errors.length = 1;
133
- }
134
-
135
- return reject(new Error(messages.errors.join('\n\n')));
136
- }
137
-
138
- if (process.env.CI && (typeof process.env.CI !== 'string' || process.env.CI.toLowerCase() !== 'false') && messages.warnings.length) {
139
- console.log(chalk__default["default"].yellow('\nTreating warnings as errors because process.env.CI = true.\n' + 'Most CI servers set it automatically.\n'));
140
- return reject(new Error(messages.warnings.join('\n\n')));
141
- }
142
-
143
- return resolve({
144
- stats: stats,
145
- warnings: messages.warnings
146
- });
147
- });
148
- }));
149
-
150
- case 4:
151
- case "end":
152
- return _context.stop();
153
- }
154
- }
155
- }, _callee);
156
- }));
157
- return _build.apply(this, arguments);
158
- };
159
-
160
- build = function _build2() {
161
- return _build.apply(this, arguments);
162
- };
163
-
164
- hasWebpackConfig = fs__default["default"].existsSync(paths.paths.appWebpackConfig); // Warn and crash if required files are missing
165
-
166
- if (!checkRequiredFiles__default["default"]([])) {
167
- process.exit(1);
168
- } // First, read the current file sizes in build directory.
169
- // This lets us display how much they changed later.
170
-
171
-
172
- _context2.next = 7;
173
- return measureFileSizesBeforeBuild(paths.paths.appBuild);
174
-
175
- case 7:
176
- previousFileSizes = _context2.sent;
177
- // Remove all content but keep the directory so that
178
- // if you're in it, you don't end up in Trash
179
- fs__default["default"].emptyDirSync(paths.paths.appBuild); // Copy default files
180
-
181
- copyDefaultFiles();
182
- _context2.prev = 10;
183
- _context2.next = 13;
184
- return build();
185
-
186
- case 13:
187
- result = _context2.sent;
188
-
189
- if (result.warnings.length) {
190
- console.log(chalk__default["default"].yellow('Compiled with warnings.\n'));
191
- console.log(result.warnings.join('\n\n'));
192
- console.log("\nSearch for the ".concat(chalk__default["default"].underline(chalk__default["default"].yellow('keywords')), " to learn more about each warning."));
193
- console.log("To ignore, add ".concat(chalk__default["default"].cyan('// eslint-disable-next-line'), " to the line before.\n"));
194
- } else {
195
- console.log(chalk__default["default"].green('Compiled successfully.\n'));
196
- }
197
-
198
- console.log('File sizes after gzip:\n');
199
- printFileSizesAfterBuild(result.stats, previousFileSizes, paths.paths.appBuild, WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_CHUNK_GZIP_SIZE);
200
- console.log();
201
- _context2.next = 24;
202
- break;
203
-
204
- case 20:
205
- _context2.prev = 20;
206
- _context2.t0 = _context2["catch"](10);
207
-
208
- if (_context2.t0 instanceof Error) {
209
- printBuildError__default["default"](_context2.t0);
210
- }
211
-
212
- throw new Error("Failed to compile");
213
-
214
- case 24:
215
- case "end":
216
- return _context2.stop();
217
- }
218
- }
219
- }, _callee2, null, [[10, 20]]);
220
- }));
221
- return _run.apply(this, arguments);
222
- }
223
-
224
- exports["default"] = run;
@@ -1,151 +0,0 @@
1
- 'use strict';
2
-
3
- var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
4
- var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
5
- var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
6
- var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
7
- var fs = require('fs-extra');
8
- var path = require('path');
9
- var vite = require('vite');
10
- var pluginGraphql = require('@rollup/plugin-graphql');
11
- var pluginReact = require('@vitejs/plugin-react');
12
- var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
13
- var assets = require('@commercetools-frontend/assets');
14
- var paths = require('./paths-16823f56.cjs.dev.js');
15
- var vitePluginSvgr = require('./vite-plugin-svgr-4205f2b5.cjs.dev.js');
16
- require('@babel/runtime-corejs3/core-js-stable/instance/find');
17
- require('@babel/runtime-corejs3/core-js-stable/instance/concat');
18
- require('fs');
19
- require('@rollup/pluginutils');
20
-
21
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
22
-
23
- var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
24
- var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
25
- var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
26
- var fs__default = /*#__PURE__*/_interopDefault(fs);
27
- var path__default = /*#__PURE__*/_interopDefault(path);
28
- var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
29
- var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
30
-
31
- // This script/function is injected into the `index.html` and used by Vite
32
- // on runtime to build the assets URL (for example when using a separate CDN for the assets).
33
- // Inspired by https://github.com/vitejs/vite/blob/main/playground/assets/vite.config-runtime-base.js
34
- var dynamicBaseAssetsCode = "globalThis.__toCdnUrl = filePath => window.app.cdnUrl.replace(/\\/$/, '') + '/' + filePath;";
35
-
36
- function vitePluginDynamicBaseAssetsGlobals() {
37
- return {
38
- name: 'dynamic-base-assets-globals',
39
- transformIndexHtml: function transformIndexHtml(html, ctx) {
40
- if (ctx.bundle) {
41
- // Only inject during build
42
- return [{
43
- tag: 'script',
44
- attrs: {
45
- type: 'module'
46
- },
47
- children: dynamicBaseAssetsCode
48
- }];
49
- }
50
-
51
- return html;
52
- }
53
- };
54
- }
55
-
56
- function run() {
57
- return _run.apply(this, arguments);
58
- }
59
-
60
- function _run() {
61
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
62
- var DEFAULT_PORT, appEntryPoint, html;
63
- return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
64
- while (1) {
65
- switch (_context.prev = _context.next) {
66
- case 0:
67
- DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001; // Ensure the `/public` folder exists.
68
-
69
- fs__default["default"].mkdirSync(paths.paths.appBuild, {
70
- recursive: true
71
- }); // Generate `index.html` (template).
72
-
73
- appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
74
- html = mcHtmlTemplate.generateTemplate({
75
- // Define the module entry point (path relative from the `/public` folder).
76
- // NOTE: that this is different from the development configuration.
77
- scriptImports: ["<script type=\"module\" src=\"/".concat(appEntryPoint, "\"></script>")]
78
- }); // Write `index.html` (template) into the `/public` folder.
79
-
80
- fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
81
- encoding: 'utf8'
82
- });
83
- _context.next = 7;
84
- return vite.build({
85
- root: paths.paths.appRoot,
86
- base: './',
87
- // <-- Important to allow configuring the runtime base path.
88
- define: {
89
- 'process.env.DEBUG': _JSON$stringify__default["default"](false),
90
- 'process.env.NODE_ENV': _JSON$stringify__default["default"]('production')
91
- },
92
- build: {
93
- outDir: 'public',
94
- rollupOptions: {
95
- // This is necessary to instruct Vite that the `index.html` (template)
96
- // is located in the `/public` folder.
97
- // NOTE that after the build, Vite will write the `index.html` (template)
98
- // at the `/public/public/index.html` location. See `fs.renameSync` below.
99
- input: paths.paths.appIndexHtml
100
- }
101
- },
102
- server: {
103
- port: DEFAULT_PORT
104
- },
105
- experimental: {
106
- // https://vitejs.dev/guide/build.html#advanced-base-options
107
- renderBuiltUrl: function renderBuiltUrl(filename, _ref) {
108
- var hostType = _ref.hostType;
109
-
110
- if (hostType === 'html') {
111
- return "__CDN_URL__".concat(filename);
112
- }
113
-
114
- return {
115
- runtime: "window.__toCdnUrl(".concat(_JSON$stringify__default["default"](filename), ")")
116
- };
117
- }
118
- },
119
- plugins: [pluginGraphql__default["default"](), pluginReact__default["default"]({
120
- jsxImportSource: '@emotion/react',
121
- babel: {
122
- plugins: ['@emotion/babel-plugin', '@babel/plugin-proposal-do-expressions']
123
- }
124
- }), vitePluginSvgr.vitePluginSvgr(), vitePluginDynamicBaseAssetsGlobals()]
125
- });
126
-
127
- case 7:
128
- // Rename `/public/public/index.html` to `/public/index.html.template`
129
- fs__default["default"].renameSync( // Because of our custom entry point path (`/public/index.html`),
130
- // Vite will write the `index.html` to `/public/public/index.html`.
131
- // We need to move this file to the `/public` folder and rename it
132
- // to `index.html.template` (as expected by the `compile-html` command).
133
- path__default["default"].join(paths.paths.appBuild, 'public/index.html'), paths.paths.appIndexHtmlTemplate); // Clean up nested folder
134
-
135
- fs__default["default"].rmdirSync(path__default["default"].join(paths.paths.appBuild, 'public')); // Copy public assets
136
-
137
- fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
138
- dereference: true
139
- });
140
-
141
- case 10:
142
- case "end":
143
- return _context.stop();
144
- }
145
- }
146
- }, _callee);
147
- }));
148
- return _run.apply(this, arguments);
149
- }
150
-
151
- exports["default"] = run;
@@ -1,139 +0,0 @@
1
- import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
2
- import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
3
- import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
4
- import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
5
- import fs from 'fs-extra';
6
- import path from 'path';
7
- import { build } from 'vite';
8
- import pluginGraphql from '@rollup/plugin-graphql';
9
- import pluginReact from '@vitejs/plugin-react';
10
- import { generateTemplate } from '@commercetools-frontend/mc-html-template';
11
- import { packageLocation } from '@commercetools-frontend/assets';
12
- import { p as paths } from './paths-ed23d5a1.esm.js';
13
- import { v as vitePluginSvgr } from './vite-plugin-svgr-eb8524fa.esm.js';
14
- import '@babel/runtime-corejs3/core-js-stable/instance/find';
15
- import '@babel/runtime-corejs3/core-js-stable/instance/concat';
16
- import 'fs';
17
- import '@rollup/pluginutils';
18
-
19
- // This script/function is injected into the `index.html` and used by Vite
20
- // on runtime to build the assets URL (for example when using a separate CDN for the assets).
21
- // Inspired by https://github.com/vitejs/vite/blob/main/playground/assets/vite.config-runtime-base.js
22
- var dynamicBaseAssetsCode = "globalThis.__toCdnUrl = filePath => window.app.cdnUrl.replace(/\\/$/, '') + '/' + filePath;";
23
-
24
- function vitePluginDynamicBaseAssetsGlobals() {
25
- return {
26
- name: 'dynamic-base-assets-globals',
27
- transformIndexHtml: function transformIndexHtml(html, ctx) {
28
- if (ctx.bundle) {
29
- // Only inject during build
30
- return [{
31
- tag: 'script',
32
- attrs: {
33
- type: 'module'
34
- },
35
- children: dynamicBaseAssetsCode
36
- }];
37
- }
38
-
39
- return html;
40
- }
41
- };
42
- }
43
-
44
- function run() {
45
- return _run.apply(this, arguments);
46
- }
47
-
48
- function _run() {
49
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
50
- var DEFAULT_PORT, appEntryPoint, html;
51
- return _regeneratorRuntime.wrap(function _callee$(_context) {
52
- while (1) {
53
- switch (_context.prev = _context.next) {
54
- case 0:
55
- DEFAULT_PORT = _parseInt(String(process.env.HTTP_PORT), 10) || 3001; // Ensure the `/public` folder exists.
56
-
57
- fs.mkdirSync(paths.appBuild, {
58
- recursive: true
59
- }); // Generate `index.html` (template).
60
-
61
- appEntryPoint = path.relative(paths.appRoot, paths.entryPoint);
62
- html = generateTemplate({
63
- // Define the module entry point (path relative from the `/public` folder).
64
- // NOTE: that this is different from the development configuration.
65
- scriptImports: ["<script type=\"module\" src=\"/".concat(appEntryPoint, "\"></script>")]
66
- }); // Write `index.html` (template) into the `/public` folder.
67
-
68
- fs.writeFileSync(paths.appIndexHtml, html, {
69
- encoding: 'utf8'
70
- });
71
- _context.next = 7;
72
- return build({
73
- root: paths.appRoot,
74
- base: './',
75
- // <-- Important to allow configuring the runtime base path.
76
- define: {
77
- 'process.env.DEBUG': _JSON$stringify(false),
78
- 'process.env.NODE_ENV': _JSON$stringify('production')
79
- },
80
- build: {
81
- outDir: 'public',
82
- rollupOptions: {
83
- // This is necessary to instruct Vite that the `index.html` (template)
84
- // is located in the `/public` folder.
85
- // NOTE that after the build, Vite will write the `index.html` (template)
86
- // at the `/public/public/index.html` location. See `fs.renameSync` below.
87
- input: paths.appIndexHtml
88
- }
89
- },
90
- server: {
91
- port: DEFAULT_PORT
92
- },
93
- experimental: {
94
- // https://vitejs.dev/guide/build.html#advanced-base-options
95
- renderBuiltUrl: function renderBuiltUrl(filename, _ref) {
96
- var hostType = _ref.hostType;
97
-
98
- if (hostType === 'html') {
99
- return "__CDN_URL__".concat(filename);
100
- }
101
-
102
- return {
103
- runtime: "window.__toCdnUrl(".concat(_JSON$stringify(filename), ")")
104
- };
105
- }
106
- },
107
- plugins: [pluginGraphql(), pluginReact({
108
- jsxImportSource: '@emotion/react',
109
- babel: {
110
- plugins: ['@emotion/babel-plugin', '@babel/plugin-proposal-do-expressions']
111
- }
112
- }), vitePluginSvgr(), vitePluginDynamicBaseAssetsGlobals()]
113
- });
114
-
115
- case 7:
116
- // Rename `/public/public/index.html` to `/public/index.html.template`
117
- fs.renameSync( // Because of our custom entry point path (`/public/index.html`),
118
- // Vite will write the `index.html` to `/public/public/index.html`.
119
- // We need to move this file to the `/public` folder and rename it
120
- // to `index.html.template` (as expected by the `compile-html` command).
121
- path.join(paths.appBuild, 'public/index.html'), paths.appIndexHtmlTemplate); // Clean up nested folder
122
-
123
- fs.rmdirSync(path.join(paths.appBuild, 'public')); // Copy public assets
124
-
125
- fs.copySync(path.join(packageLocation, 'html-page'), paths.appBuild, {
126
- dereference: true
127
- });
128
-
129
- case 10:
130
- case "end":
131
- return _context.stop();
132
- }
133
- }
134
- }, _callee);
135
- }));
136
- return _run.apply(this, arguments);
137
- }
138
-
139
- export { run as default };
@@ -1,151 +0,0 @@
1
- 'use strict';
2
-
3
- var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator');
4
- var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
5
- var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
6
- var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
7
- var fs = require('fs-extra');
8
- var path = require('path');
9
- var vite = require('vite');
10
- var pluginGraphql = require('@rollup/plugin-graphql');
11
- var pluginReact = require('@vitejs/plugin-react');
12
- var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
13
- var assets = require('@commercetools-frontend/assets');
14
- var paths = require('./paths-76b66e74.cjs.prod.js');
15
- var vitePluginSvgr = require('./vite-plugin-svgr-f3bbedbe.cjs.prod.js');
16
- require('@babel/runtime-corejs3/core-js-stable/instance/find');
17
- require('@babel/runtime-corejs3/core-js-stable/instance/concat');
18
- require('fs');
19
- require('@rollup/pluginutils');
20
-
21
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
22
-
23
- var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
24
- var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
25
- var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
26
- var fs__default = /*#__PURE__*/_interopDefault(fs);
27
- var path__default = /*#__PURE__*/_interopDefault(path);
28
- var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
29
- var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
30
-
31
- // This script/function is injected into the `index.html` and used by Vite
32
- // on runtime to build the assets URL (for example when using a separate CDN for the assets).
33
- // Inspired by https://github.com/vitejs/vite/blob/main/playground/assets/vite.config-runtime-base.js
34
- var dynamicBaseAssetsCode = "globalThis.__toCdnUrl = filePath => window.app.cdnUrl.replace(/\\/$/, '') + '/' + filePath;";
35
-
36
- function vitePluginDynamicBaseAssetsGlobals() {
37
- return {
38
- name: 'dynamic-base-assets-globals',
39
- transformIndexHtml: function transformIndexHtml(html, ctx) {
40
- if (ctx.bundle) {
41
- // Only inject during build
42
- return [{
43
- tag: 'script',
44
- attrs: {
45
- type: 'module'
46
- },
47
- children: dynamicBaseAssetsCode
48
- }];
49
- }
50
-
51
- return html;
52
- }
53
- };
54
- }
55
-
56
- function run() {
57
- return _run.apply(this, arguments);
58
- }
59
-
60
- function _run() {
61
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
62
- var DEFAULT_PORT, appEntryPoint, html;
63
- return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
64
- while (1) {
65
- switch (_context.prev = _context.next) {
66
- case 0:
67
- DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001; // Ensure the `/public` folder exists.
68
-
69
- fs__default["default"].mkdirSync(paths.paths.appBuild, {
70
- recursive: true
71
- }); // Generate `index.html` (template).
72
-
73
- appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
74
- html = mcHtmlTemplate.generateTemplate({
75
- // Define the module entry point (path relative from the `/public` folder).
76
- // NOTE: that this is different from the development configuration.
77
- scriptImports: ["<script type=\"module\" src=\"/".concat(appEntryPoint, "\"></script>")]
78
- }); // Write `index.html` (template) into the `/public` folder.
79
-
80
- fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
81
- encoding: 'utf8'
82
- });
83
- _context.next = 7;
84
- return vite.build({
85
- root: paths.paths.appRoot,
86
- base: './',
87
- // <-- Important to allow configuring the runtime base path.
88
- define: {
89
- 'process.env.DEBUG': _JSON$stringify__default["default"](false),
90
- 'process.env.NODE_ENV': _JSON$stringify__default["default"]('production')
91
- },
92
- build: {
93
- outDir: 'public',
94
- rollupOptions: {
95
- // This is necessary to instruct Vite that the `index.html` (template)
96
- // is located in the `/public` folder.
97
- // NOTE that after the build, Vite will write the `index.html` (template)
98
- // at the `/public/public/index.html` location. See `fs.renameSync` below.
99
- input: paths.paths.appIndexHtml
100
- }
101
- },
102
- server: {
103
- port: DEFAULT_PORT
104
- },
105
- experimental: {
106
- // https://vitejs.dev/guide/build.html#advanced-base-options
107
- renderBuiltUrl: function renderBuiltUrl(filename, _ref) {
108
- var hostType = _ref.hostType;
109
-
110
- if (hostType === 'html') {
111
- return "__CDN_URL__".concat(filename);
112
- }
113
-
114
- return {
115
- runtime: "window.__toCdnUrl(".concat(_JSON$stringify__default["default"](filename), ")")
116
- };
117
- }
118
- },
119
- plugins: [pluginGraphql__default["default"](), pluginReact__default["default"]({
120
- jsxImportSource: '@emotion/react',
121
- babel: {
122
- plugins: ['@emotion/babel-plugin', '@babel/plugin-proposal-do-expressions']
123
- }
124
- }), vitePluginSvgr.vitePluginSvgr(), vitePluginDynamicBaseAssetsGlobals()]
125
- });
126
-
127
- case 7:
128
- // Rename `/public/public/index.html` to `/public/index.html.template`
129
- fs__default["default"].renameSync( // Because of our custom entry point path (`/public/index.html`),
130
- // Vite will write the `index.html` to `/public/public/index.html`.
131
- // We need to move this file to the `/public` folder and rename it
132
- // to `index.html.template` (as expected by the `compile-html` command).
133
- path__default["default"].join(paths.paths.appBuild, 'public/index.html'), paths.paths.appIndexHtmlTemplate); // Clean up nested folder
134
-
135
- fs__default["default"].rmdirSync(path__default["default"].join(paths.paths.appBuild, 'public')); // Copy public assets
136
-
137
- fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
138
- dereference: true
139
- });
140
-
141
- case 10:
142
- case "end":
143
- return _context.stop();
144
- }
145
- }
146
- }, _callee);
147
- }));
148
- return _run.apply(this, arguments);
149
- }
150
-
151
- exports["default"] = run;