@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
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
4
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
5
+ var path = require('path');
6
+ var pluginGraphql = require('@rollup/plugin-graphql');
7
+ var pluginReact = require('@vitejs/plugin-react-swc');
8
+ var fs = require('fs-extra');
9
+ var vite = require('vite');
10
+ var applicationConfig = require('@commercetools-frontend/application-config');
11
+ var assets = require('@commercetools-frontend/assets');
12
+ var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
13
+ var paths = require('./paths-284c77fb.cjs.prod.js');
14
+ var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
15
+ var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
16
+ var vitePluginSvgr = require('./vite-plugin-svgr-9a4e7f77.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('@rollup/pluginutils');
21
+
22
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
23
+
24
+ var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
25
+ var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
26
+ var path__default = /*#__PURE__*/_interopDefault(path);
27
+ var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
28
+ var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
29
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
30
+ var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
31
+
32
+ const vitePluginCustomApplication = applicationConfig => {
33
+ return {
34
+ name: 'custom-application',
35
+
36
+ configureServer(server) {
37
+ return () => {
38
+ // Users do not need to have/maintain the `index.html` (as expected by Vite)
39
+ // as it's generated and maintained by the Custom Application CLI.
40
+ // Therefore, the generated `index.html` (template) is written into the `/public`
41
+ // folder so that it's gitignored.
42
+ // As a result, we need to make sure to point the URI path to the correct location.
43
+ server.middlewares.use((req, _res, next) => {
44
+ if (req.url === '/index.html') {
45
+ req.url = '/public/index.html';
46
+ }
47
+
48
+ next();
49
+ }); // Handle auth routes for internal local development.
50
+
51
+ server.middlewares.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig));
52
+ };
53
+ },
54
+
55
+ /**
56
+ * @type {import('vite').IndexHtmlTransformHook}
57
+ */
58
+ transformIndexHtml(rawHtml, _ctx) {
59
+ const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
60
+
61
+ const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env, // Now that the app config is defined as a `env.json`, when we start the FE app
62
+ // to point to the local backend API by passing the `MC_API_URL` env does not
63
+ // work anymore). To make it work again, we can override the `env.json` config
64
+ // with the env variable before injecting the values into the index.html.
65
+ // NOTE: this is only necessary for development.
66
+ process.env.MC_API_URL ? {
67
+ mcApiUrl: process.env.MC_API_URL
68
+ } : {}); // Resolve the placeholders of the `index.html` (template) file, before serving it.
69
+
70
+
71
+ const html = mcHtmlTemplate.replaceHtmlPlaceholders(rawHtml, {
72
+ env: enhancedLocalEnv,
73
+ headers: compiledHeaders
74
+ });
75
+ return html;
76
+ }
77
+
78
+ };
79
+ };
80
+
81
+ async function run() {
82
+ const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001; // Load the Custom Application config file first.
83
+
84
+ const applicationConfig$1 = applicationConfig.processConfig(); // Ensure the `/public` folder exists.
85
+
86
+ fs__default["default"].mkdirSync(paths.paths.appBuild, {
87
+ recursive: true
88
+ }); // Generate `index.html` (template).
89
+
90
+ const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
91
+ const html = mcHtmlTemplate.generateTemplate({
92
+ // Define the module entry point (path relative to the `/public` folder).
93
+ // NOTE: that this is different from the production configuration.
94
+ scriptImports: ["<script type=\"module\" src=\"/../".concat(appEntryPoint, "\"></script>")]
95
+ }); // Write `index.html` (template) into the `/public` folder.
96
+
97
+ fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
98
+ encoding: 'utf8'
99
+ });
100
+ const server = await vite.createServer({
101
+ root: paths.paths.appRoot,
102
+ define: {
103
+ 'process.env.DEBUG': _JSON$stringify__default["default"](false),
104
+ 'process.env.NODE_ENV': _JSON$stringify__default["default"]('development')
105
+ },
106
+ server: {
107
+ port: DEFAULT_PORT
108
+ },
109
+ plugins: [pluginGraphql__default["default"](), pluginReact__default["default"](), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
110
+ });
111
+ await server.listen(); // Copy public assets to `/public` folder (even in development).
112
+
113
+ fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
114
+ dereference: true
115
+ });
116
+ server.printUrls();
117
+ }
118
+
119
+ exports["default"] = run;
@@ -0,0 +1,107 @@
1
+ import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
2
+ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
3
+ import path from 'path';
4
+ import pluginGraphql from '@rollup/plugin-graphql';
5
+ import pluginReact from '@vitejs/plugin-react-swc';
6
+ import fs from 'fs-extra';
7
+ import { createServer } from 'vite';
8
+ import { processConfig } from '@commercetools-frontend/application-config';
9
+ import { packageLocation } from '@commercetools-frontend/assets';
10
+ import { processHeaders, replaceHtmlPlaceholders, generateTemplate } from '@commercetools-frontend/mc-html-template';
11
+ import { p as paths } from './paths-55c5d5a2.esm.js';
12
+ import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
13
+ import { createMcDevAuthenticationMiddleware } from '@commercetools-frontend/mc-dev-authentication';
14
+ import { v as vitePluginSvgr } from './vite-plugin-svgr-f17db78a.esm.js';
15
+ import '@babel/runtime-corejs3/core-js-stable/instance/find';
16
+ import '@babel/runtime-corejs3/core-js-stable/instance/concat';
17
+ import 'fs';
18
+ import '@rollup/pluginutils';
19
+
20
+ const vitePluginCustomApplication = applicationConfig => {
21
+ return {
22
+ name: 'custom-application',
23
+
24
+ configureServer(server) {
25
+ return () => {
26
+ // Users do not need to have/maintain the `index.html` (as expected by Vite)
27
+ // as it's generated and maintained by the Custom Application CLI.
28
+ // Therefore, the generated `index.html` (template) is written into the `/public`
29
+ // folder so that it's gitignored.
30
+ // As a result, we need to make sure to point the URI path to the correct location.
31
+ server.middlewares.use((req, _res, next) => {
32
+ if (req.url === '/index.html') {
33
+ req.url = '/public/index.html';
34
+ }
35
+
36
+ next();
37
+ }); // Handle auth routes for internal local development.
38
+
39
+ server.middlewares.use(createMcDevAuthenticationMiddleware(applicationConfig));
40
+ };
41
+ },
42
+
43
+ /**
44
+ * @type {import('vite').IndexHtmlTransformHook}
45
+ */
46
+ transformIndexHtml(rawHtml, _ctx) {
47
+ const compiledHeaders = processHeaders(applicationConfig);
48
+
49
+ const enhancedLocalEnv = _Object$assign({}, applicationConfig.env, // Now that the app config is defined as a `env.json`, when we start the FE app
50
+ // to point to the local backend API by passing the `MC_API_URL` env does not
51
+ // work anymore). To make it work again, we can override the `env.json` config
52
+ // with the env variable before injecting the values into the index.html.
53
+ // NOTE: this is only necessary for development.
54
+ process.env.MC_API_URL ? {
55
+ mcApiUrl: process.env.MC_API_URL
56
+ } : {}); // Resolve the placeholders of the `index.html` (template) file, before serving it.
57
+
58
+
59
+ const html = replaceHtmlPlaceholders(rawHtml, {
60
+ env: enhancedLocalEnv,
61
+ headers: compiledHeaders
62
+ });
63
+ return html;
64
+ }
65
+
66
+ };
67
+ };
68
+
69
+ async function run() {
70
+ const DEFAULT_PORT = _parseInt(String(process.env.HTTP_PORT), 10) || 3001; // Load the Custom Application config file first.
71
+
72
+ const applicationConfig = processConfig(); // Ensure the `/public` folder exists.
73
+
74
+ fs.mkdirSync(paths.appBuild, {
75
+ recursive: true
76
+ }); // Generate `index.html` (template).
77
+
78
+ const appEntryPoint = path.relative(paths.appRoot, paths.entryPoint);
79
+ const html = generateTemplate({
80
+ // Define the module entry point (path relative to the `/public` folder).
81
+ // NOTE: that this is different from the production configuration.
82
+ scriptImports: ["<script type=\"module\" src=\"/../".concat(appEntryPoint, "\"></script>")]
83
+ }); // Write `index.html` (template) into the `/public` folder.
84
+
85
+ fs.writeFileSync(paths.appIndexHtml, html, {
86
+ encoding: 'utf8'
87
+ });
88
+ const server = await createServer({
89
+ root: paths.appRoot,
90
+ define: {
91
+ 'process.env.DEBUG': _JSON$stringify(false),
92
+ 'process.env.NODE_ENV': _JSON$stringify('development')
93
+ },
94
+ server: {
95
+ port: DEFAULT_PORT
96
+ },
97
+ plugins: [pluginGraphql(), pluginReact(), vitePluginSvgr(), vitePluginCustomApplication(applicationConfig)]
98
+ });
99
+ await server.listen(); // Copy public assets to `/public` folder (even in development).
100
+
101
+ fs.copySync(path.join(packageLocation, 'html-page'), paths.appBuild, {
102
+ dereference: true
103
+ });
104
+ server.printUrls();
105
+ }
106
+
107
+ export { run as default };
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
4
+ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
5
+ var path = require('path');
6
+ var pluginGraphql = require('@rollup/plugin-graphql');
7
+ var pluginReact = require('@vitejs/plugin-react-swc');
8
+ var fs = require('fs-extra');
9
+ var vite = require('vite');
10
+ var applicationConfig = require('@commercetools-frontend/application-config');
11
+ var assets = require('@commercetools-frontend/assets');
12
+ var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
13
+ var paths = require('./paths-db35ac0f.cjs.dev.js');
14
+ var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
15
+ var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
16
+ var vitePluginSvgr = require('./vite-plugin-svgr-fdb37ccf.cjs.dev.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('@rollup/pluginutils');
21
+
22
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
23
+
24
+ var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
25
+ var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
26
+ var path__default = /*#__PURE__*/_interopDefault(path);
27
+ var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
28
+ var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
29
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
30
+ var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
31
+
32
+ const vitePluginCustomApplication = applicationConfig => {
33
+ return {
34
+ name: 'custom-application',
35
+
36
+ configureServer(server) {
37
+ return () => {
38
+ // Users do not need to have/maintain the `index.html` (as expected by Vite)
39
+ // as it's generated and maintained by the Custom Application CLI.
40
+ // Therefore, the generated `index.html` (template) is written into the `/public`
41
+ // folder so that it's gitignored.
42
+ // As a result, we need to make sure to point the URI path to the correct location.
43
+ server.middlewares.use((req, _res, next) => {
44
+ if (req.url === '/index.html') {
45
+ req.url = '/public/index.html';
46
+ }
47
+
48
+ next();
49
+ }); // Handle auth routes for internal local development.
50
+
51
+ server.middlewares.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig));
52
+ };
53
+ },
54
+
55
+ /**
56
+ * @type {import('vite').IndexHtmlTransformHook}
57
+ */
58
+ transformIndexHtml(rawHtml, _ctx) {
59
+ const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
60
+
61
+ const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env, // Now that the app config is defined as a `env.json`, when we start the FE app
62
+ // to point to the local backend API by passing the `MC_API_URL` env does not
63
+ // work anymore). To make it work again, we can override the `env.json` config
64
+ // with the env variable before injecting the values into the index.html.
65
+ // NOTE: this is only necessary for development.
66
+ process.env.MC_API_URL ? {
67
+ mcApiUrl: process.env.MC_API_URL
68
+ } : {}); // Resolve the placeholders of the `index.html` (template) file, before serving it.
69
+
70
+
71
+ const html = mcHtmlTemplate.replaceHtmlPlaceholders(rawHtml, {
72
+ env: enhancedLocalEnv,
73
+ headers: compiledHeaders
74
+ });
75
+ return html;
76
+ }
77
+
78
+ };
79
+ };
80
+
81
+ async function run() {
82
+ const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001; // Load the Custom Application config file first.
83
+
84
+ const applicationConfig$1 = applicationConfig.processConfig(); // Ensure the `/public` folder exists.
85
+
86
+ fs__default["default"].mkdirSync(paths.paths.appBuild, {
87
+ recursive: true
88
+ }); // Generate `index.html` (template).
89
+
90
+ const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
91
+ const html = mcHtmlTemplate.generateTemplate({
92
+ // Define the module entry point (path relative to the `/public` folder).
93
+ // NOTE: that this is different from the production configuration.
94
+ scriptImports: ["<script type=\"module\" src=\"/../".concat(appEntryPoint, "\"></script>")]
95
+ }); // Write `index.html` (template) into the `/public` folder.
96
+
97
+ fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
98
+ encoding: 'utf8'
99
+ });
100
+ const server = await vite.createServer({
101
+ root: paths.paths.appRoot,
102
+ define: {
103
+ 'process.env.DEBUG': _JSON$stringify__default["default"](false),
104
+ 'process.env.NODE_ENV': _JSON$stringify__default["default"]('development')
105
+ },
106
+ server: {
107
+ port: DEFAULT_PORT
108
+ },
109
+ plugins: [pluginGraphql__default["default"](), pluginReact__default["default"](), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
110
+ });
111
+ await server.listen(); // Copy public assets to `/public` folder (even in development).
112
+
113
+ fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
114
+ dereference: true
115
+ });
116
+ server.printUrls();
117
+ }
118
+
119
+ exports["default"] = run;
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var vendorsToTranspile = [];
3
+ const vendorsToTranspile = [];
4
4
 
5
5
  exports.vendorsToTranspile = vendorsToTranspile;
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var vendorsToTranspile = [];
3
+ const vendorsToTranspile = [];
4
4
 
5
5
  exports.vendorsToTranspile = vendorsToTranspile;
@@ -1,3 +1,3 @@
1
- var vendorsToTranspile = [];
1
+ const vendorsToTranspile = [];
2
2
 
3
3
  export { vendorsToTranspile as v };
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var pluginutils = require('@rollup/pluginutils');
5
+ var vite = require('vite');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
28
+
29
+ /**
30
+ * COPIED FROM https://github.com/pd4d10/vite-plugin-svgr
31
+ */
32
+
33
+ function vitePluginSvgr() {
34
+ const filter = pluginutils.createFilter('**/*.react.svg');
35
+ return {
36
+ name: 'vite-plugin-svgr',
37
+
38
+ async transform(_code, id) {
39
+ if (filter(id)) {
40
+ const _await$import = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@svgr/core')); }),
41
+ transform = _await$import.transform;
42
+
43
+ const svgCode = await fs__default["default"].promises.readFile(id, 'utf8');
44
+ const componentCode = await transform(svgCode, {
45
+ icon: false,
46
+ svgoConfig: {
47
+ plugins: [{
48
+ // https://github.com/svg/svgo#default-preset
49
+ name: 'preset-default',
50
+ params: {
51
+ overrides: {
52
+ removeViewBox: false
53
+ }
54
+ }
55
+ }]
56
+ }
57
+ }, {
58
+ filePath: id,
59
+ caller: {
60
+ previousExport: null
61
+ }
62
+ });
63
+ const res = await vite.transformWithEsbuild(componentCode, id, {
64
+ loader: 'jsx'
65
+ });
66
+ return {
67
+ code: res.code,
68
+ map: null // TODO:
69
+
70
+ };
71
+ }
72
+
73
+ return null;
74
+ }
75
+
76
+ };
77
+ }
78
+
79
+ exports.vitePluginSvgr = vitePluginSvgr;
@@ -0,0 +1,55 @@
1
+ import fs from 'fs';
2
+ import { createFilter } from '@rollup/pluginutils';
3
+ import { transformWithEsbuild } from 'vite';
4
+
5
+ /**
6
+ * COPIED FROM https://github.com/pd4d10/vite-plugin-svgr
7
+ */
8
+
9
+ function vitePluginSvgr() {
10
+ const filter = createFilter('**/*.react.svg');
11
+ return {
12
+ name: 'vite-plugin-svgr',
13
+
14
+ async transform(_code, id) {
15
+ if (filter(id)) {
16
+ const _await$import = await import('@svgr/core'),
17
+ transform = _await$import.transform;
18
+
19
+ const svgCode = await fs.promises.readFile(id, 'utf8');
20
+ const componentCode = await transform(svgCode, {
21
+ icon: false,
22
+ svgoConfig: {
23
+ plugins: [{
24
+ // https://github.com/svg/svgo#default-preset
25
+ name: 'preset-default',
26
+ params: {
27
+ overrides: {
28
+ removeViewBox: false
29
+ }
30
+ }
31
+ }]
32
+ }
33
+ }, {
34
+ filePath: id,
35
+ caller: {
36
+ previousExport: null
37
+ }
38
+ });
39
+ const res = await transformWithEsbuild(componentCode, id, {
40
+ loader: 'jsx'
41
+ });
42
+ return {
43
+ code: res.code,
44
+ map: null // TODO:
45
+
46
+ };
47
+ }
48
+
49
+ return null;
50
+ }
51
+
52
+ };
53
+ }
54
+
55
+ export { vitePluginSvgr as v };
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var pluginutils = require('@rollup/pluginutils');
5
+ var vite = require('vite');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
28
+
29
+ /**
30
+ * COPIED FROM https://github.com/pd4d10/vite-plugin-svgr
31
+ */
32
+
33
+ function vitePluginSvgr() {
34
+ const filter = pluginutils.createFilter('**/*.react.svg');
35
+ return {
36
+ name: 'vite-plugin-svgr',
37
+
38
+ async transform(_code, id) {
39
+ if (filter(id)) {
40
+ const _await$import = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@svgr/core')); }),
41
+ transform = _await$import.transform;
42
+
43
+ const svgCode = await fs__default["default"].promises.readFile(id, 'utf8');
44
+ const componentCode = await transform(svgCode, {
45
+ icon: false,
46
+ svgoConfig: {
47
+ plugins: [{
48
+ // https://github.com/svg/svgo#default-preset
49
+ name: 'preset-default',
50
+ params: {
51
+ overrides: {
52
+ removeViewBox: false
53
+ }
54
+ }
55
+ }]
56
+ }
57
+ }, {
58
+ filePath: id,
59
+ caller: {
60
+ previousExport: null
61
+ }
62
+ });
63
+ const res = await vite.transformWithEsbuild(componentCode, id, {
64
+ loader: 'jsx'
65
+ });
66
+ return {
67
+ code: res.code,
68
+ map: null // TODO:
69
+
70
+ };
71
+ }
72
+
73
+ return null;
74
+ }
75
+
76
+ };
77
+ }
78
+
79
+ exports.vitePluginSvgr = vitePluginSvgr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-scripts",
3
- "version": "21.23.10",
3
+ "version": "21.24.0",
4
4
  "description": "Configuration and scripts for developing a MC application",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -46,12 +46,12 @@
46
46
  "@babel/core": "^7.20.12",
47
47
  "@babel/runtime": "^7.20.13",
48
48
  "@babel/runtime-corejs3": "^7.20.13",
49
- "@commercetools-frontend/application-config": "21.23.10",
50
- "@commercetools-frontend/assets": "21.23.10",
51
- "@commercetools-frontend/babel-preset-mc-app": "21.23.10",
52
- "@commercetools-frontend/constants": "21.23.10",
53
- "@commercetools-frontend/mc-dev-authentication": "21.23.10",
54
- "@commercetools-frontend/mc-html-template": "21.23.10",
49
+ "@commercetools-frontend/application-config": "21.24.0",
50
+ "@commercetools-frontend/assets": "21.24.0",
51
+ "@commercetools-frontend/babel-preset-mc-app": "21.24.0",
52
+ "@commercetools-frontend/constants": "21.24.0",
53
+ "@commercetools-frontend/mc-dev-authentication": "21.24.0",
54
+ "@commercetools-frontend/mc-html-template": "21.24.0",
55
55
  "@commercetools/http-user-agent": "3.0.0",
56
56
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
57
57
  "@rollup/plugin-graphql": "2.0.3",
@@ -61,8 +61,9 @@
61
61
  "@svgr/webpack": "^6.5.1",
62
62
  "@types/prompts": "^2.4.2",
63
63
  "@types/svgo": "^2.6.4",
64
+ "@types/webpack-bundle-analyzer": "^4.6.0",
64
65
  "@vitejs/plugin-react": "3.1.0",
65
- "@vitejs/plugin-react-swc": "3.1.0",
66
+ "@vitejs/plugin-react-swc": "3.2.0",
66
67
  "autoprefixer": "^10.4.13",
67
68
  "babel-loader": "8.3.0",
68
69
  "browserslist": "^4.21.5",
@@ -75,12 +76,12 @@
75
76
  "dotenv-expand": "8.0.3",
76
77
  "fs-extra": "10.1.0",
77
78
  "graphql": "16.6.0",
78
- "graphql-request": "5.1.0",
79
+ "graphql-request": "5.2.0",
79
80
  "graphql-tag": "^2.12.6",
80
81
  "html-webpack-plugin": "5.5.0",
81
82
  "json-loader": "0.5.7",
82
83
  "lodash": "4.17.21",
83
- "mini-css-extract-plugin": "2.7.2",
84
+ "mini-css-extract-plugin": "2.7.5",
84
85
  "moment-locales-webpack-plugin": "1.2.0",
85
86
  "node-fetch": "2.6.9",
86
87
  "postcss": "8.4.21",
@@ -96,15 +97,15 @@
96
97
  "react-refresh": "0.14.0",
97
98
  "serve-handler": "6.1.5",
98
99
  "shelljs": "0.8.5",
99
- "style-loader": "3.3.1",
100
+ "style-loader": "3.3.2",
100
101
  "svg-url-loader": "7.1.1",
101
- "terser-webpack-plugin": "5.3.6",
102
+ "terser-webpack-plugin": "5.3.7",
102
103
  "thread-loader": "3.0.4",
103
104
  "url": "^0.11.0",
104
- "vite": "4.1.1",
105
- "webpack": "5.75.0",
105
+ "vite": "4.2.0",
106
+ "webpack": "5.76.2",
106
107
  "webpack-bundle-analyzer": "4.8.0",
107
- "webpack-dev-server": "4.11.1",
108
+ "webpack-dev-server": "4.12.0",
108
109
  "webpackbar": "5.0.2"
109
110
  },
110
111
  "devDependencies": {
@@ -115,7 +116,7 @@
115
116
  "@types/node-fetch": "2.6.2",
116
117
  "@types/serve-handler": "^6.1.1",
117
118
  "mock-fs": "^5.2.0",
118
- "msw": "0.47.4",
119
+ "msw": "0.49.3",
119
120
  "rimraf": "3.0.2"
120
121
  },
121
122
  "engines": {
@@ -2,12 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createPostcssConfig = require('../../dist/create-postcss-config-f65c7e31.cjs.dev.js');
6
- require('@babel/runtime-corejs3/helpers/toConsumableArray');
5
+ var createPostcssConfig = require('../../dist/create-postcss-config-5cc679d5.cjs.dev.js');
7
6
  require('@babel/runtime-corejs3/helpers/slicedToArray');
8
- require('@babel/runtime-corejs3/core-js-stable/instance/concat');
9
7
  require('path');
10
- require('../../dist/package-e2d9b5e0.cjs.dev.js');
8
+ require('../../dist/package-c42dc2ac.cjs.dev.js');
11
9
 
12
10
 
13
11