@commercetools-frontend/mc-scripts 27.5.3 → 27.6.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.
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +39 -19
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +39 -19
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +11 -11
- package/dist/{build-BP3m-wjz.cjs.prod.js → build-74ba5097.cjs.prod.js} +23 -23
- package/dist/{build-Dq8dqtsd.cjs.dev.js → build-7c291b9e.cjs.dev.js} +23 -23
- package/dist/{build-GEMI3W9m.esm.js → build-bfc4d2be.esm.js} +7 -7
- package/dist/{build-vite-D67xSRU1.cjs.prod.js → build-vite-73361390.cjs.prod.js} +32 -32
- package/dist/{build-vite-Dxi3rfHf.cjs.dev.js → build-vite-8453739c.cjs.dev.js} +32 -32
- package/dist/{build-vite-CO8mi4hd.esm.js → build-vite-a9c1c374.esm.js} +5 -5
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +4 -2
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +4 -2
- package/dist/commercetools-frontend-mc-scripts.esm.js +2 -2
- package/dist/{compile-html-BVvy3IQD.esm.js → compile-html-025cd493.esm.js} +2 -2
- package/dist/{compile-html-Ds1YojsY.cjs.dev.js → compile-html-50fd05ec.cjs.prod.js} +8 -8
- package/dist/{compile-html-DZlUpFXg.cjs.prod.js → compile-html-f4ac88cc.cjs.dev.js} +8 -8
- package/dist/{config-sync-D6xLjo9S.cjs.prod.js → config-sync-09f66547.cjs.prod.js} +22 -22
- package/dist/{config-sync-Bu7U5gn5.esm.js → config-sync-15eb8589.esm.js} +5 -5
- package/dist/{config-sync-ci-SDsF-Onw.cjs.dev.js → config-sync-ci-61250b40.cjs.dev.js} +21 -21
- package/dist/{config-sync-ci-CXgQcemF.cjs.prod.js → config-sync-ci-72d17127.cjs.prod.js} +21 -21
- package/dist/{config-sync-ci-Dq7bAqeu.esm.js → config-sync-ci-906ef640.esm.js} +5 -5
- package/dist/{config-sync-Cd0sSSrd.cjs.dev.js → config-sync-fa80ea02.cjs.dev.js} +22 -22
- package/dist/{config-sync-helpers-9kvPwuoy.cjs.prod.js → config-sync-helpers-9e749cc1.cjs.prod.js} +47 -47
- package/dist/{config-sync-helpers-DUK45F_R.cjs.dev.js → config-sync-helpers-f35fab2b.cjs.dev.js} +47 -47
- package/dist/{config-sync-helpers-BLXJp1-D.esm.js → config-sync-helpers-f3861cb3.esm.js} +3 -3
- package/dist/{create-postcss-config-CN9_8Usa.esm.js → create-postcss-config-9f7fc8fe.esm.js} +1 -1
- package/dist/{create-postcss-config-DAShdAyB.cjs.prod.js → create-postcss-config-aa65bd02.cjs.prod.js} +3 -3
- package/dist/{create-postcss-config-NN2FAhvH.cjs.dev.js → create-postcss-config-bda2f46f.cjs.dev.js} +3 -3
- package/dist/{create-webpack-config-for-development-hxSNyq2_.cjs.dev.js → create-webpack-config-for-development-37fd15dd.cjs.dev.js} +25 -25
- package/dist/{create-webpack-config-for-development-CxGehl7I.cjs.prod.js → create-webpack-config-for-development-7f9ac343.cjs.prod.js} +25 -25
- package/dist/{create-webpack-config-for-development-5HpRHV9G.esm.js → create-webpack-config-for-development-cfc8c0d8.esm.js} +5 -5
- package/dist/{create-webpack-config-for-production-BY0UNoNz.esm.js → create-webpack-config-for-production-0ed3db08.esm.js} +5 -5
- package/dist/{create-webpack-config-for-production-CW0DlZBz.cjs.prod.js → create-webpack-config-for-production-c6f5fc5e.cjs.prod.js} +32 -32
- package/dist/{create-webpack-config-for-production-Edp9dzmw.cjs.dev.js → create-webpack-config-for-production-f0692e4f.cjs.dev.js} +32 -32
- package/dist/{credentials-storage-B79bb0Ns.esm.js → credentials-storage-67deadc3.esm.js} +1 -1
- package/dist/{credentials-storage-C3TlK0a8.cjs.prod.js → credentials-storage-ea1c16dc.cjs.prod.js} +10 -10
- package/dist/{credentials-storage-B0tDCH7i.cjs.dev.js → credentials-storage-fd195144.cjs.dev.js} +10 -10
- package/dist/{deployment-previews-set-nvkAPwYw.cjs.prod.js → deployment-previews-set-77a06501.cjs.prod.js} +22 -22
- package/dist/{deployment-previews-set-C2OPIfy-.esm.js → deployment-previews-set-8e17e07a.esm.js} +4 -4
- package/dist/{deployment-previews-set-BuHX8wKo.cjs.dev.js → deployment-previews-set-bfc5a58a.cjs.dev.js} +22 -22
- package/dist/{does-file-exist-DrcZIPe6.cjs.dev.js → does-file-exist-be53305d.cjs.prod.js} +2 -2
- package/dist/{does-file-exist-DrcZIPe6.cjs.prod.js → does-file-exist-eb86baca.cjs.dev.js} +2 -2
- package/dist/{graphql-requests-DCLX_2y0.esm.js → graphql-requests-1afa51b6.esm.js} +4 -4
- package/dist/{graphql-requests-D0rtMo7K.cjs.prod.js → graphql-requests-65332887.cjs.prod.js} +9 -9
- package/dist/{graphql-requests-BeUd4g3v.cjs.dev.js → graphql-requests-8c5aeb2f.cjs.dev.js} +9 -9
- package/dist/{i18n-message-complilation-CdVhuyWk.cjs.dev.js → i18n-message-complilation-7311cb29.cjs.dev.js} +3 -3
- package/dist/{i18n-message-complilation-CdVhuyWk.cjs.prod.js → i18n-message-complilation-7762da61.cjs.prod.js} +3 -3
- package/dist/{login-DKzmRa46.cjs.dev.js → login-3dbe724f.cjs.prod.js} +60 -42
- package/dist/{login-BagHOLO1.cjs.prod.js → login-6bc2696b.cjs.dev.js} +60 -42
- package/dist/{login-DZVfG3Jq.esm.js → login-dbab5c47.esm.js} +3 -3
- package/dist/{optimizations-Cjrg77Gu.esm.js → optimizations-54382f7b.esm.js} +1 -1
- package/dist/{optimizations-CEaq4axa.cjs.dev.js → optimizations-56be74d6.cjs.dev.js} +8 -8
- package/dist/{optimizations-CEaq4axa.cjs.prod.js → optimizations-da5a0cfa.cjs.prod.js} +8 -8
- package/dist/package-7c551972.esm.js +165 -0
- package/dist/package-7fcd7258.cjs.prod.js +167 -0
- package/dist/package-8cf0508d.cjs.dev.js +167 -0
- package/dist/{paths-Cg5Vq6RE.esm.js → paths-39f22b8b.esm.js} +1 -1
- package/dist/{paths-DtvtCG0U.cjs.prod.js → paths-7768b440.cjs.prod.js} +5 -5
- package/dist/{paths-B0WM5jb9.cjs.dev.js → paths-b76fc753.cjs.dev.js} +5 -5
- package/dist/{serve-fXDv4-Pm.esm.js → serve-22475fec.esm.js} +2 -2
- package/dist/{serve-BxRJOSeR.cjs.dev.js → serve-3837602d.cjs.prod.js} +13 -13
- package/dist/{serve-BwNRk6vi.cjs.prod.js → serve-b1c12985.cjs.dev.js} +13 -13
- package/dist/{start-suUcoYml.esm.js → start-5985f6fa.esm.js} +7 -7
- package/dist/{start-OjGog63p.cjs.dev.js → start-633a16e4.cjs.dev.js} +17 -17
- package/dist/{start-CQgQhNhU.cjs.prod.js → start-e7fdfc20.cjs.prod.js} +17 -17
- package/dist/{start-vite-CeaoWKrT.cjs.dev.js → start-vite-068e9f73.cjs.dev.js} +14 -14
- package/dist/{start-vite-Bf9UIg63.cjs.prod.js → start-vite-29078b3a.cjs.prod.js} +14 -14
- package/dist/{start-vite-BOrX5xsW.esm.js → start-vite-7d1161e8.esm.js} +3 -3
- package/dist/{vite-plugin-svgr-CRRIY_Py.cjs.prod.js → vite-plugin-svgr-4034a834.cjs.prod.js} +24 -6
- package/dist/{vite-plugin-svgr-CRRIY_Py.cjs.dev.js → vite-plugin-svgr-7d06f400.cjs.dev.js} +24 -6
- package/package.json +8 -8
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +4 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +4 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +10 -8
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +10 -8
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +8 -8
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +2 -2
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +2 -2
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +1 -1
- package/dist/package-B1Y3_DDl.cjs.dev.js +0 -17
- package/dist/package-BiK3ergJ.esm.js +0 -15
- package/dist/package-DxhqRLHb.cjs.prod.js +0 -12
- /package/dist/{does-file-exist-C7l6j7NP.esm.js → does-file-exist-32618334.esm.js} +0 -0
- /package/dist/{i18n-message-complilation-BRZ7ffQI.esm.js → i18n-message-complilation-21d3b0aa.esm.js} +0 -0
- /package/dist/{vendors-to-transpile-DLHlk7c-.cjs.dev.js → vendors-to-transpile-04a49d40.cjs.prod.js} +0 -0
- /package/dist/{vendors-to-transpile-DLHlk7c-.cjs.prod.js → vendors-to-transpile-6ab4ea06.cjs.dev.js} +0 -0
- /package/dist/{vendors-to-transpile-uu9TNPDO.esm.js → vendors-to-transpile-7dc84a72.esm.js} +0 -0
- /package/dist/{vite-plugin-svgr-B1JerYlQ.esm.js → vite-plugin-svgr-de6ee7da.esm.js} +0 -0
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var path = require('path');
|
|
6
|
-
var doesFileExist = require('./does-file-exist-
|
|
6
|
+
var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
7
7
|
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
10
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
11
11
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
@@ -15,12 +15,12 @@ const moduleFileExtensions = ['js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx'];
|
|
|
15
15
|
|
|
16
16
|
// Make sure any symlinks in the project folder are resolved:
|
|
17
17
|
// https://github.com/facebook/create-react-app/issues/637
|
|
18
|
-
const appDirectory = fs__default
|
|
19
|
-
const resolveApp = relativePath => path__default
|
|
18
|
+
const appDirectory = fs__default["default"].realpathSync(process.cwd());
|
|
19
|
+
const resolveApp = relativePath => path__default["default"].resolve(appDirectory, relativePath);
|
|
20
20
|
|
|
21
21
|
// Resolve file paths in the order given
|
|
22
22
|
const resolveModule = (resolveFn, filePath) => {
|
|
23
|
-
const extension = _findInstanceProperty__default
|
|
23
|
+
const extension = _findInstanceProperty__default["default"](moduleFileExtensions).call(moduleFileExtensions, extension => doesFileExist.doesFileExist(resolveFn(`${filePath}.${extension}`)));
|
|
24
24
|
if (extension) {
|
|
25
25
|
return resolveFn(`${filePath}.${extension}`);
|
|
26
26
|
}
|
|
@@ -4,11 +4,11 @@ import _URL from '@babel/runtime-corejs3/core-js-stable/url';
|
|
|
4
4
|
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
5
5
|
import http from 'http';
|
|
6
6
|
import sirv from 'sirv';
|
|
7
|
-
import { p as paths } from './paths-
|
|
7
|
+
import { p as paths } from './paths-39f22b8b.esm.js';
|
|
8
8
|
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
9
9
|
import 'fs';
|
|
10
10
|
import 'path';
|
|
11
|
-
import './does-file-exist-
|
|
11
|
+
import './does-file-exist-32618334.esm.js';
|
|
12
12
|
import 'node:fs';
|
|
13
13
|
|
|
14
14
|
const DEFAULT_PORT = 3001;
|
|
@@ -6,14 +6,14 @@ var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
|
6
6
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
7
7
|
var http = require('http');
|
|
8
8
|
var sirv = require('sirv');
|
|
9
|
-
var paths = require('./paths-
|
|
9
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
10
10
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
11
11
|
require('fs');
|
|
12
12
|
require('path');
|
|
13
|
-
require('./does-file-exist-
|
|
13
|
+
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
14
14
|
require('node:fs');
|
|
15
15
|
|
|
16
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
17
|
|
|
18
18
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
19
19
|
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
@@ -30,16 +30,16 @@ async function run() {
|
|
|
30
30
|
const publicPath = options.publicPath ?? paths.paths.appBuild;
|
|
31
31
|
const handleAuthRoutes = options.handleAuthRoutes ?? true;
|
|
32
32
|
const applicationConfig = options.applicationConfig;
|
|
33
|
-
const isLocalMcApi = ((_context = applicationConfig) == null ? void 0 : _bindInstanceProperty__default
|
|
33
|
+
const isLocalMcApi = ((_context = applicationConfig) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default["default"](_context2 = _context.env.mcApiUrl), _context2))?.('http://localhost') ?? false;
|
|
34
34
|
|
|
35
35
|
// `single: true` gives us the SPA fallback — any unmatched path is served as
|
|
36
36
|
// the root `index.html`. This replaces the complex glob workaround that
|
|
37
37
|
// `serve-handler` needed because of vercel/serve-handler#71.
|
|
38
|
-
const staticHandler = sirv__default
|
|
38
|
+
const staticHandler = sirv__default["default"](publicPath, {
|
|
39
39
|
single: true,
|
|
40
40
|
etag: true
|
|
41
41
|
});
|
|
42
|
-
const server = http__default
|
|
42
|
+
const server = http__default["default"].createServer((request, response) => {
|
|
43
43
|
var _context10, _context11;
|
|
44
44
|
// The auth-route handlers are the only consumer of `applicationConfig`,
|
|
45
45
|
// so the branch is entered only when both the flag is on AND the caller
|
|
@@ -52,14 +52,14 @@ async function run() {
|
|
|
52
52
|
var _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1;
|
|
53
53
|
// Localhost-only: inline replacement for the login/logout UI that
|
|
54
54
|
// `mc-dev-authentication` used to ship as static HTML (#3734).
|
|
55
|
-
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
56
|
-
const redirectTo = new _URL__default
|
|
55
|
+
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _startsWithInstanceProperty__default["default"](_context4), _context4))?.('/login/authorize')) {
|
|
56
|
+
const redirectTo = new _URL__default["default"](request.url, applicationConfig.env.mcApiUrl);
|
|
57
57
|
response.writeHead(301, {
|
|
58
58
|
Location: redirectTo.toString()
|
|
59
59
|
}).end();
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
62
|
+
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context7 = Function.call).call(_context7, _startsWithInstanceProperty__default["default"](_context6), _context6))?.('/logout')) {
|
|
63
63
|
response.end('Please clear your session storage.');
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@ async function run() {
|
|
|
68
68
|
// request (bare `/login`, non-localhost auth callbacks, etc.) must NOT
|
|
69
69
|
// fall back to the SPA — that would mask OAuth callback
|
|
70
70
|
// misconfigurations by rendering the app on a URL the backend owns.
|
|
71
|
-
if (((_context8 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
71
|
+
if (((_context8 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context9 = Function.call).call(_context9, _startsWithInstanceProperty__default["default"](_context8), _context8))?.('/login') || ((_context0 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context1 = Function.call).call(_context1, _startsWithInstanceProperty__default["default"](_context0), _context0))?.('/logout')) {
|
|
72
72
|
response.writeHead(404).end();
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -76,16 +76,16 @@ async function run() {
|
|
|
76
76
|
|
|
77
77
|
// Absorb `/favicon*` variants (e.g. `/favicon.ico`, `/favicon-32x32.png`)
|
|
78
78
|
// into the single PNG the app ships.
|
|
79
|
-
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
79
|
+
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context11 = Function.call).call(_context11, _startsWithInstanceProperty__default["default"](_context10), _context10))?.('/favicon')) {
|
|
80
80
|
request.url = '/favicon.png';
|
|
81
81
|
}
|
|
82
82
|
staticHandler(request, response, () => {
|
|
83
83
|
response.writeHead(404).end();
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
-
return new _Promise__default
|
|
86
|
+
return new _Promise__default["default"](resolve => {
|
|
87
87
|
server.listen(port, () => resolve(server));
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
exports
|
|
91
|
+
exports["default"] = run;
|
|
@@ -6,14 +6,14 @@ var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
|
6
6
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
7
7
|
var http = require('http');
|
|
8
8
|
var sirv = require('sirv');
|
|
9
|
-
var paths = require('./paths-
|
|
9
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
10
10
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
11
11
|
require('fs');
|
|
12
12
|
require('path');
|
|
13
|
-
require('./does-file-exist-
|
|
13
|
+
require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
14
14
|
require('node:fs');
|
|
15
15
|
|
|
16
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
17
|
|
|
18
18
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
19
19
|
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
@@ -30,16 +30,16 @@ async function run() {
|
|
|
30
30
|
const publicPath = options.publicPath ?? paths.paths.appBuild;
|
|
31
31
|
const handleAuthRoutes = options.handleAuthRoutes ?? true;
|
|
32
32
|
const applicationConfig = options.applicationConfig;
|
|
33
|
-
const isLocalMcApi = ((_context = applicationConfig) == null ? void 0 : _bindInstanceProperty__default
|
|
33
|
+
const isLocalMcApi = ((_context = applicationConfig) == null ? void 0 : _bindInstanceProperty__default["default"](_context3 = Function.call).call(_context3, _startsWithInstanceProperty__default["default"](_context2 = _context.env.mcApiUrl), _context2))?.('http://localhost') ?? false;
|
|
34
34
|
|
|
35
35
|
// `single: true` gives us the SPA fallback — any unmatched path is served as
|
|
36
36
|
// the root `index.html`. This replaces the complex glob workaround that
|
|
37
37
|
// `serve-handler` needed because of vercel/serve-handler#71.
|
|
38
|
-
const staticHandler = sirv__default
|
|
38
|
+
const staticHandler = sirv__default["default"](publicPath, {
|
|
39
39
|
single: true,
|
|
40
40
|
etag: true
|
|
41
41
|
});
|
|
42
|
-
const server = http__default
|
|
42
|
+
const server = http__default["default"].createServer((request, response) => {
|
|
43
43
|
var _context10, _context11;
|
|
44
44
|
// The auth-route handlers are the only consumer of `applicationConfig`,
|
|
45
45
|
// so the branch is entered only when both the flag is on AND the caller
|
|
@@ -52,14 +52,14 @@ async function run() {
|
|
|
52
52
|
var _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1;
|
|
53
53
|
// Localhost-only: inline replacement for the login/logout UI that
|
|
54
54
|
// `mc-dev-authentication` used to ship as static HTML (#3734).
|
|
55
|
-
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
56
|
-
const redirectTo = new _URL__default
|
|
55
|
+
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _startsWithInstanceProperty__default["default"](_context4), _context4))?.('/login/authorize')) {
|
|
56
|
+
const redirectTo = new _URL__default["default"](request.url, applicationConfig.env.mcApiUrl);
|
|
57
57
|
response.writeHead(301, {
|
|
58
58
|
Location: redirectTo.toString()
|
|
59
59
|
}).end();
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
62
|
+
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context7 = Function.call).call(_context7, _startsWithInstanceProperty__default["default"](_context6), _context6))?.('/logout')) {
|
|
63
63
|
response.end('Please clear your session storage.');
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
@@ -68,7 +68,7 @@ async function run() {
|
|
|
68
68
|
// request (bare `/login`, non-localhost auth callbacks, etc.) must NOT
|
|
69
69
|
// fall back to the SPA — that would mask OAuth callback
|
|
70
70
|
// misconfigurations by rendering the app on a URL the backend owns.
|
|
71
|
-
if (((_context8 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
71
|
+
if (((_context8 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context9 = Function.call).call(_context9, _startsWithInstanceProperty__default["default"](_context8), _context8))?.('/login') || ((_context0 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context1 = Function.call).call(_context1, _startsWithInstanceProperty__default["default"](_context0), _context0))?.('/logout')) {
|
|
72
72
|
response.writeHead(404).end();
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -76,16 +76,16 @@ async function run() {
|
|
|
76
76
|
|
|
77
77
|
// Absorb `/favicon*` variants (e.g. `/favicon.ico`, `/favicon-32x32.png`)
|
|
78
78
|
// into the single PNG the app ships.
|
|
79
|
-
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty__default
|
|
79
|
+
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context11 = Function.call).call(_context11, _startsWithInstanceProperty__default["default"](_context10), _context10))?.('/favicon')) {
|
|
80
80
|
request.url = '/favicon.png';
|
|
81
81
|
}
|
|
82
82
|
staticHandler(request, response, () => {
|
|
83
83
|
response.writeHead(404).end();
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
-
return new _Promise__default
|
|
86
|
+
return new _Promise__default["default"](resolve => {
|
|
87
87
|
server.listen(port, () => resolve(server));
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
exports
|
|
91
|
+
exports["default"] = run;
|
|
@@ -7,12 +7,12 @@ import openBrowser from 'react-dev-utils/openBrowser';
|
|
|
7
7
|
import { choosePort, prepareUrls, createCompiler } from 'react-dev-utils/WebpackDevServerUtils';
|
|
8
8
|
import webpack from 'webpack';
|
|
9
9
|
import WebpackDevServer from 'webpack-dev-server';
|
|
10
|
-
import { c as createWebpackConfigForDevelopment } from './create-webpack-config-for-development-
|
|
11
|
-
import { p as paths } from './paths-
|
|
10
|
+
import { c as createWebpackConfigForDevelopment } from './create-webpack-config-for-development-cfc8c0d8.esm.js';
|
|
11
|
+
import { p as paths } from './paths-39f22b8b.esm.js';
|
|
12
12
|
import { processConfig } from '@commercetools-frontend/application-config';
|
|
13
13
|
import { createMcDevAuthenticationMiddleware } from '@commercetools-frontend/mc-dev-authentication';
|
|
14
14
|
import { processHeaders } from '@commercetools-frontend/mc-html-template';
|
|
15
|
-
import { d as doesFileExist } from './does-file-exist-
|
|
15
|
+
import { d as doesFileExist } from './does-file-exist-32618334.esm.js';
|
|
16
16
|
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
17
17
|
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
18
18
|
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
@@ -34,14 +34,14 @@ import 'webpackbar';
|
|
|
34
34
|
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
35
35
|
import '@babel/runtime-corejs3/helpers/createClass';
|
|
36
36
|
import '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
37
|
-
import './create-postcss-config-
|
|
37
|
+
import './create-postcss-config-9f7fc8fe.esm.js';
|
|
38
38
|
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
39
|
-
import './package-
|
|
40
|
-
import './optimizations-
|
|
39
|
+
import './package-7c551972.esm.js';
|
|
40
|
+
import './optimizations-54382f7b.esm.js';
|
|
41
41
|
import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
42
42
|
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
43
43
|
import '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
44
|
-
import './vendors-to-transpile-
|
|
44
|
+
import './vendors-to-transpile-7dc84a72.esm.js';
|
|
45
45
|
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
46
46
|
import 'fs';
|
|
47
47
|
import 'node:fs';
|
|
@@ -9,12 +9,12 @@ var openBrowser = require('react-dev-utils/openBrowser');
|
|
|
9
9
|
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
10
10
|
var webpack = require('webpack');
|
|
11
11
|
var WebpackDevServer = require('webpack-dev-server');
|
|
12
|
-
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-
|
|
13
|
-
var paths = require('./paths-
|
|
12
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-37fd15dd.cjs.dev.js');
|
|
13
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
14
14
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
15
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
16
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
17
|
-
var doesFileExist = require('./does-file-exist-
|
|
17
|
+
var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
18
18
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
19
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
20
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
@@ -36,19 +36,19 @@ require('webpackbar');
|
|
|
36
36
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
37
37
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
38
38
|
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
39
|
-
require('./create-postcss-config-
|
|
39
|
+
require('./create-postcss-config-bda2f46f.cjs.dev.js');
|
|
40
40
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
-
require('./package-
|
|
42
|
-
require('./optimizations-
|
|
41
|
+
require('./package-8cf0508d.cjs.dev.js');
|
|
42
|
+
require('./optimizations-56be74d6.cjs.dev.js');
|
|
43
43
|
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
44
44
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
45
45
|
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
46
|
-
require('./vendors-to-transpile-
|
|
46
|
+
require('./vendors-to-transpile-6ab4ea06.cjs.dev.js');
|
|
47
47
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
48
48
|
require('fs');
|
|
49
49
|
require('node:fs');
|
|
50
50
|
|
|
51
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
51
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
52
52
|
|
|
53
53
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
54
54
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
@@ -122,12 +122,12 @@ async function run() {
|
|
|
122
122
|
const hasWebpackConfig = doesFileExist.doesFileExist(paths.paths.appWebpackConfig);
|
|
123
123
|
|
|
124
124
|
// Warn and crash if required files are missing
|
|
125
|
-
if (!checkRequiredFiles__default
|
|
125
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
126
126
|
process.exit(1);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// Tools like Cloud9 rely on this.
|
|
130
|
-
const DEFAULT_PORT = _parseInt__default
|
|
130
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
131
131
|
const HOST = process.env.HOST || '0.0.0.0';
|
|
132
132
|
|
|
133
133
|
// We attempt to use the default port but if it is busy, we offer the user to
|
|
@@ -149,7 +149,7 @@ async function run() {
|
|
|
149
149
|
appName,
|
|
150
150
|
config,
|
|
151
151
|
useYarn,
|
|
152
|
-
webpack: webpack__default
|
|
152
|
+
webpack: webpack__default["default"],
|
|
153
153
|
urls
|
|
154
154
|
});
|
|
155
155
|
|
|
@@ -158,14 +158,14 @@ async function run() {
|
|
|
158
158
|
port,
|
|
159
159
|
publicPath: config.output?.publicPath
|
|
160
160
|
});
|
|
161
|
-
const devServer = new WebpackDevServer__default
|
|
161
|
+
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
162
162
|
await devServer.start();
|
|
163
163
|
if (isInteractive) {
|
|
164
|
-
clearConsole__default
|
|
164
|
+
clearConsole__default["default"]();
|
|
165
165
|
}
|
|
166
|
-
console.log(chalk__default
|
|
167
|
-
openBrowser__default
|
|
168
|
-
_forEachInstanceProperty__default
|
|
166
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
167
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
168
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
169
169
|
process.on(sig, () => {
|
|
170
170
|
devServer.close();
|
|
171
171
|
process.exit();
|
|
@@ -173,4 +173,4 @@ async function run() {
|
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
exports
|
|
176
|
+
exports["default"] = run;
|
|
@@ -9,12 +9,12 @@ var openBrowser = require('react-dev-utils/openBrowser');
|
|
|
9
9
|
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
10
10
|
var webpack = require('webpack');
|
|
11
11
|
var WebpackDevServer = require('webpack-dev-server');
|
|
12
|
-
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-
|
|
13
|
-
var paths = require('./paths-
|
|
12
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-7f9ac343.cjs.prod.js');
|
|
13
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
14
14
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
15
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
16
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
17
|
-
var doesFileExist = require('./does-file-exist-
|
|
17
|
+
var doesFileExist = require('./does-file-exist-be53305d.cjs.prod.js');
|
|
18
18
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
19
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
20
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
@@ -36,19 +36,19 @@ require('webpackbar');
|
|
|
36
36
|
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
37
37
|
require('@babel/runtime-corejs3/helpers/createClass');
|
|
38
38
|
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
39
|
-
require('./create-postcss-config-
|
|
39
|
+
require('./create-postcss-config-aa65bd02.cjs.prod.js');
|
|
40
40
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
-
require('./package-
|
|
42
|
-
require('./optimizations-
|
|
41
|
+
require('./package-7fcd7258.cjs.prod.js');
|
|
42
|
+
require('./optimizations-da5a0cfa.cjs.prod.js');
|
|
43
43
|
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
44
44
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
45
45
|
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
46
|
-
require('./vendors-to-transpile-
|
|
46
|
+
require('./vendors-to-transpile-04a49d40.cjs.prod.js');
|
|
47
47
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
48
48
|
require('fs');
|
|
49
49
|
require('node:fs');
|
|
50
50
|
|
|
51
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
51
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
52
52
|
|
|
53
53
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
54
54
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
@@ -122,12 +122,12 @@ async function run() {
|
|
|
122
122
|
const hasWebpackConfig = doesFileExist.doesFileExist(paths.paths.appWebpackConfig);
|
|
123
123
|
|
|
124
124
|
// Warn and crash if required files are missing
|
|
125
|
-
if (!checkRequiredFiles__default
|
|
125
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
126
126
|
process.exit(1);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// Tools like Cloud9 rely on this.
|
|
130
|
-
const DEFAULT_PORT = _parseInt__default
|
|
130
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
131
131
|
const HOST = process.env.HOST || '0.0.0.0';
|
|
132
132
|
|
|
133
133
|
// We attempt to use the default port but if it is busy, we offer the user to
|
|
@@ -149,7 +149,7 @@ async function run() {
|
|
|
149
149
|
appName,
|
|
150
150
|
config,
|
|
151
151
|
useYarn,
|
|
152
|
-
webpack: webpack__default
|
|
152
|
+
webpack: webpack__default["default"],
|
|
153
153
|
urls
|
|
154
154
|
});
|
|
155
155
|
|
|
@@ -158,14 +158,14 @@ async function run() {
|
|
|
158
158
|
port,
|
|
159
159
|
publicPath: config.output?.publicPath
|
|
160
160
|
});
|
|
161
|
-
const devServer = new WebpackDevServer__default
|
|
161
|
+
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
162
162
|
await devServer.start();
|
|
163
163
|
if (isInteractive) {
|
|
164
|
-
clearConsole__default
|
|
164
|
+
clearConsole__default["default"]();
|
|
165
165
|
}
|
|
166
|
-
console.log(chalk__default
|
|
167
|
-
openBrowser__default
|
|
168
|
-
_forEachInstanceProperty__default
|
|
166
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
167
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
168
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
169
169
|
process.on(sig, () => {
|
|
170
170
|
devServer.close();
|
|
171
171
|
process.exit();
|
|
@@ -173,4 +173,4 @@ async function run() {
|
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
exports
|
|
176
|
+
exports["default"] = run;
|
|
@@ -10,19 +10,19 @@ var vite = require('vite');
|
|
|
10
10
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
11
11
|
var assets = require('@commercetools-frontend/assets');
|
|
12
12
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
13
|
-
var paths = require('./paths-
|
|
13
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
14
14
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
15
15
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
-
var vitePluginSvgr = require('./vite-plugin-svgr-
|
|
16
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-7d06f400.cjs.dev.js');
|
|
17
17
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
18
18
|
require('fs');
|
|
19
|
-
require('./does-file-exist-
|
|
19
|
+
require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
20
20
|
require('node:fs');
|
|
21
21
|
require('crypto');
|
|
22
22
|
require('@rollup/pluginutils');
|
|
23
23
|
require('@babel/runtime-corejs3/core-js/instance/match-all');
|
|
24
24
|
|
|
25
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
26
26
|
|
|
27
27
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
28
28
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
@@ -58,7 +58,7 @@ const vitePluginCustomApplication = applicationConfig => {
|
|
|
58
58
|
*/
|
|
59
59
|
transformIndexHtml(rawHtml, _ctx) {
|
|
60
60
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
|
|
61
|
-
const enhancedLocalEnv = _Object$assign__default
|
|
61
|
+
const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env,
|
|
62
62
|
// Now that the app config is defined as a `env.json`, when we start the FE app
|
|
63
63
|
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
64
64
|
// work anymore). To make it work again, we can override the `env.json` config
|
|
@@ -79,50 +79,50 @@ const vitePluginCustomApplication = applicationConfig => {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
async function run() {
|
|
82
|
-
const DEFAULT_PORT = _parseInt__default
|
|
82
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
83
83
|
|
|
84
84
|
// Load the Merchant Center customization config file first.
|
|
85
85
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
86
86
|
|
|
87
87
|
// Ensure the `/public` folder exists.
|
|
88
|
-
fs__default
|
|
88
|
+
fs__default["default"].mkdirSync(paths.paths.appBuild, {
|
|
89
89
|
recursive: true
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
// Generate `index.html` (template).
|
|
93
|
-
const appEntryPoint = path__default
|
|
93
|
+
const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
|
|
94
94
|
const html = mcHtmlTemplate.generateTemplate({
|
|
95
95
|
// Define the module entry point (path relative to the `/public` folder).
|
|
96
96
|
// NOTE: that this is different from the production configuration.
|
|
97
97
|
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
98
98
|
});
|
|
99
99
|
// Write `index.html` (template) into the `/public` folder.
|
|
100
|
-
fs__default
|
|
100
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
101
101
|
encoding: 'utf8'
|
|
102
102
|
});
|
|
103
103
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
104
104
|
const server = await vite.createServer({
|
|
105
105
|
root: paths.paths.appRoot,
|
|
106
106
|
define: {
|
|
107
|
-
'process.env.DEBUG': _JSON$stringify__default
|
|
108
|
-
'process.env.NODE_ENV': _JSON$stringify__default
|
|
107
|
+
'process.env.DEBUG': _JSON$stringify__default["default"](false),
|
|
108
|
+
'process.env.NODE_ENV': _JSON$stringify__default["default"]('development')
|
|
109
109
|
},
|
|
110
110
|
server: {
|
|
111
111
|
open: true,
|
|
112
112
|
port: DEFAULT_PORT,
|
|
113
113
|
headers: compiledHeaders
|
|
114
114
|
},
|
|
115
|
-
plugins: [pluginGraphql__default
|
|
115
|
+
plugins: [pluginGraphql__default["default"](), pluginReact__default["default"]({
|
|
116
116
|
jsxImportSource: '@emotion/react'
|
|
117
117
|
}), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
|
|
118
118
|
});
|
|
119
119
|
await server.listen();
|
|
120
120
|
|
|
121
121
|
// Copy public assets to `/public` folder (even in development).
|
|
122
|
-
fs__default
|
|
122
|
+
fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
|
|
123
123
|
dereference: true
|
|
124
124
|
});
|
|
125
125
|
server.printUrls();
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
exports
|
|
128
|
+
exports["default"] = run;
|
|
@@ -10,19 +10,19 @@ var vite = require('vite');
|
|
|
10
10
|
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
11
11
|
var assets = require('@commercetools-frontend/assets');
|
|
12
12
|
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
13
|
-
var paths = require('./paths-
|
|
13
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
14
14
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
15
15
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
-
var vitePluginSvgr = require('./vite-plugin-svgr-
|
|
16
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-4034a834.cjs.prod.js');
|
|
17
17
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
18
18
|
require('fs');
|
|
19
|
-
require('./does-file-exist-
|
|
19
|
+
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
20
20
|
require('node:fs');
|
|
21
21
|
require('crypto');
|
|
22
22
|
require('@rollup/pluginutils');
|
|
23
23
|
require('@babel/runtime-corejs3/core-js/instance/match-all');
|
|
24
24
|
|
|
25
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
26
26
|
|
|
27
27
|
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
28
28
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
@@ -58,7 +58,7 @@ const vitePluginCustomApplication = applicationConfig => {
|
|
|
58
58
|
*/
|
|
59
59
|
transformIndexHtml(rawHtml, _ctx) {
|
|
60
60
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
|
|
61
|
-
const enhancedLocalEnv = _Object$assign__default
|
|
61
|
+
const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env,
|
|
62
62
|
// Now that the app config is defined as a `env.json`, when we start the FE app
|
|
63
63
|
// to point to the local backend API by passing the `MC_API_URL` env does not
|
|
64
64
|
// work anymore). To make it work again, we can override the `env.json` config
|
|
@@ -79,50 +79,50 @@ const vitePluginCustomApplication = applicationConfig => {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
async function run() {
|
|
82
|
-
const DEFAULT_PORT = _parseInt__default
|
|
82
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
83
83
|
|
|
84
84
|
// Load the Merchant Center customization config file first.
|
|
85
85
|
const applicationConfig$1 = await applicationConfig.processConfig();
|
|
86
86
|
|
|
87
87
|
// Ensure the `/public` folder exists.
|
|
88
|
-
fs__default
|
|
88
|
+
fs__default["default"].mkdirSync(paths.paths.appBuild, {
|
|
89
89
|
recursive: true
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
// Generate `index.html` (template).
|
|
93
|
-
const appEntryPoint = path__default
|
|
93
|
+
const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
|
|
94
94
|
const html = mcHtmlTemplate.generateTemplate({
|
|
95
95
|
// Define the module entry point (path relative to the `/public` folder).
|
|
96
96
|
// NOTE: that this is different from the production configuration.
|
|
97
97
|
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
98
98
|
});
|
|
99
99
|
// Write `index.html` (template) into the `/public` folder.
|
|
100
|
-
fs__default
|
|
100
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
101
101
|
encoding: 'utf8'
|
|
102
102
|
});
|
|
103
103
|
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
104
104
|
const server = await vite.createServer({
|
|
105
105
|
root: paths.paths.appRoot,
|
|
106
106
|
define: {
|
|
107
|
-
'process.env.DEBUG': _JSON$stringify__default
|
|
108
|
-
'process.env.NODE_ENV': _JSON$stringify__default
|
|
107
|
+
'process.env.DEBUG': _JSON$stringify__default["default"](false),
|
|
108
|
+
'process.env.NODE_ENV': _JSON$stringify__default["default"]('development')
|
|
109
109
|
},
|
|
110
110
|
server: {
|
|
111
111
|
open: true,
|
|
112
112
|
port: DEFAULT_PORT,
|
|
113
113
|
headers: compiledHeaders
|
|
114
114
|
},
|
|
115
|
-
plugins: [pluginGraphql__default
|
|
115
|
+
plugins: [pluginGraphql__default["default"](), pluginReact__default["default"]({
|
|
116
116
|
jsxImportSource: '@emotion/react'
|
|
117
117
|
}), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
|
|
118
118
|
});
|
|
119
119
|
await server.listen();
|
|
120
120
|
|
|
121
121
|
// Copy public assets to `/public` folder (even in development).
|
|
122
|
-
fs__default
|
|
122
|
+
fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
|
|
123
123
|
dereference: true
|
|
124
124
|
});
|
|
125
125
|
server.printUrls();
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
exports
|
|
128
|
+
exports["default"] = run;
|