@commercetools-frontend/mc-scripts 27.9.1 → 27.9.3
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/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +1 -1
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js +1 -1
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +1 -1
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +16 -15
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +16 -15
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +16 -15
- package/dist/{build-b9cbc1d1.cjs.dev.js → build-0e40ae4b.cjs.dev.js} +8 -8
- package/dist/{build-cdeab3a8.cjs.prod.js → build-30150f3a.cjs.prod.js} +8 -8
- package/dist/{build-5a0c84e7.esm.js → build-d34f0880.esm.js} +8 -8
- package/dist/{build-vite-ce3c4fb6.esm.js → build-vite-2ea8a241.esm.js} +14 -16
- package/dist/{build-vite-aa0e7242.cjs.prod.js → build-vite-377f721f.cjs.prod.js} +14 -16
- package/dist/{build-vite-0e8f3463.cjs.dev.js → build-vite-e4eeb1a3.cjs.dev.js} +14 -16
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
- package/dist/{compile-html-adfef598.esm.js → compile-html-025cd493.esm.js} +2 -4
- package/dist/{compile-html-b80f9651.cjs.prod.js → compile-html-50fd05ec.cjs.prod.js} +2 -5
- package/dist/{compile-html-8679f721.cjs.dev.js → compile-html-f4ac88cc.cjs.dev.js} +2 -5
- package/dist/{config-sync-7031a7de.esm.js → config-sync-2d02ffa8.esm.js} +17 -17
- package/dist/{config-sync-2b56a941.cjs.dev.js → config-sync-9bb37ec5.cjs.dev.js} +17 -17
- package/dist/{config-sync-41bc7f5e.cjs.prod.js → config-sync-a16795bc.cjs.prod.js} +17 -17
- package/dist/{config-sync-ci-6d12f2f3.cjs.dev.js → config-sync-ci-7f4935ea.cjs.dev.js} +19 -25
- package/dist/{config-sync-ci-1866c188.esm.js → config-sync-ci-b3ea139f.esm.js} +19 -24
- package/dist/{config-sync-ci-ea943de9.cjs.prod.js → config-sync-ci-bfd6918d.cjs.prod.js} +19 -25
- package/dist/{config-sync-helpers-36985f8c.cjs.dev.js → config-sync-helpers-1bd93aad.cjs.dev.js} +48 -57
- package/dist/{config-sync-helpers-79ccaaad.cjs.prod.js → config-sync-helpers-5a1b172b.cjs.prod.js} +46 -55
- package/dist/{config-sync-helpers-875ef4a4.esm.js → config-sync-helpers-9439de91.esm.js} +47 -56
- package/dist/{create-postcss-config-13cb1cb8.cjs.dev.js → create-postcss-config-24861798.cjs.dev.js} +1 -1
- package/dist/{create-postcss-config-390e8a52.esm.js → create-postcss-config-3b68ddee.esm.js} +1 -1
- package/dist/{create-postcss-config-1eeb3d9d.cjs.prod.js → create-postcss-config-9acd005d.cjs.prod.js} +1 -1
- package/dist/{create-webpack-config-for-development-dd95f3d5.esm.js → create-webpack-config-for-development-7787fa87.esm.js} +7 -7
- package/dist/{create-webpack-config-for-development-9a3a3a93.cjs.dev.js → create-webpack-config-for-development-ac4d9b95.cjs.dev.js} +7 -7
- package/dist/{create-webpack-config-for-development-6608b4e4.cjs.prod.js → create-webpack-config-for-development-ba55541a.cjs.prod.js} +7 -7
- package/dist/{create-webpack-config-for-production-29b34b8c.cjs.dev.js → create-webpack-config-for-production-4f0c062f.cjs.dev.js} +8 -8
- package/dist/{create-webpack-config-for-production-31bb3d24.esm.js → create-webpack-config-for-production-6f78b27b.esm.js} +8 -8
- package/dist/{create-webpack-config-for-production-2e6e5036.cjs.prod.js → create-webpack-config-for-production-b054a984.cjs.prod.js} +8 -8
- package/dist/{credentials-storage-bfaa78f0.esm.js → credentials-storage-67deadc3.esm.js} +1 -1
- package/dist/{credentials-storage-60a63c81.cjs.prod.js → credentials-storage-ea1c16dc.cjs.prod.js} +1 -1
- package/dist/{credentials-storage-1826f1a2.cjs.dev.js → credentials-storage-fd195144.cjs.dev.js} +1 -1
- package/dist/{deployment-previews-set-bebd7a04.cjs.prod.js → deployment-previews-set-370f5bce.cjs.prod.js} +22 -28
- package/dist/{deployment-previews-set-410cecf1.esm.js → deployment-previews-set-6ce467f3.esm.js} +22 -27
- package/dist/{deployment-previews-set-a04efad3.cjs.dev.js → deployment-previews-set-fa6468e1.cjs.dev.js} +22 -28
- package/dist/{graphql-requests-c491206a.esm.js → graphql-requests-0e55505c.esm.js} +5 -8
- package/dist/{graphql-requests-1ea68584.cjs.dev.js → graphql-requests-6e742563.cjs.prod.js} +5 -8
- package/dist/{graphql-requests-98b1b779.cjs.prod.js → graphql-requests-af3ea6c9.cjs.dev.js} +5 -8
- package/dist/{i18n-message-complilation-8aec9d1b.esm.js → i18n-message-complilation-21d3b0aa.esm.js} +1 -1
- package/dist/{i18n-message-complilation-3f80e8d6.cjs.dev.js → i18n-message-complilation-7311cb29.cjs.dev.js} +1 -1
- package/dist/{i18n-message-complilation-393d344a.cjs.prod.js → i18n-message-complilation-7762da61.cjs.prod.js} +1 -1
- package/dist/{login-cd99208a.cjs.dev.js → login-8b1925fa.cjs.dev.js} +58 -37
- package/dist/{login-a99d14e6.cjs.prod.js → login-93faaa9c.cjs.prod.js} +58 -37
- package/dist/{login-b935aede.esm.js → login-d6b9b61b.esm.js} +57 -36
- package/dist/{optimizations-1b3f8157.esm.js → optimizations-54382f7b.esm.js} +5 -7
- package/dist/{optimizations-09a6638c.cjs.prod.js → optimizations-56be74d6.cjs.dev.js} +5 -8
- package/dist/{optimizations-640ffcac.cjs.dev.js → optimizations-da5a0cfa.cjs.prod.js} +5 -8
- package/dist/{package-98adb0d5.cjs.dev.js → package-2a97179c.cjs.prod.js} +1 -1
- package/dist/{package-90af7dfe.cjs.prod.js → package-42b38ba8.cjs.dev.js} +1 -1
- package/dist/{package-15124b28.esm.js → package-76b6a39c.esm.js} +1 -1
- package/dist/{paths-7bf7e88e.esm.js → paths-39f22b8b.esm.js} +4 -9
- package/dist/{paths-af1a725a.cjs.prod.js → paths-7768b440.cjs.prod.js} +4 -10
- package/dist/{paths-ec3e3a7d.cjs.dev.js → paths-b76fc753.cjs.dev.js} +4 -10
- package/dist/{serve-ddf30b4c.esm.js → serve-22475fec.esm.js} +13 -13
- package/dist/{serve-87ef7d4f.cjs.prod.js → serve-3837602d.cjs.prod.js} +14 -13
- package/dist/{serve-760fc169.cjs.dev.js → serve-b1c12985.cjs.dev.js} +14 -13
- package/dist/{start-a0945fde.cjs.dev.js → start-bf7fee92.cjs.dev.js} +9 -10
- package/dist/{start-08895b5f.esm.js → start-d66f7fa7.esm.js} +9 -10
- package/dist/{start-d9bd5dfb.cjs.prod.js → start-e2f64f34.cjs.prod.js} +9 -10
- package/dist/{start-vite-745d3123.esm.js → start-vite-4b0df191.esm.js} +4 -5
- package/dist/{start-vite-10e49e5c.cjs.dev.js → start-vite-698c9e82.cjs.dev.js} +4 -5
- package/dist/{start-vite-00514c35.cjs.prod.js → start-vite-dd8a1e26.cjs.prod.js} +4 -5
- package/dist/{try-load-nimbus-plugins-526dccbd.esm.js → try-load-nimbus-plugins-2f528d8f.esm.js} +1 -1
- package/dist/{try-load-nimbus-plugins-59c3a594.cjs.prod.js → try-load-nimbus-plugins-a713d7d3.cjs.prod.js} +1 -1
- package/dist/{try-load-nimbus-plugins-06ce5d83.cjs.dev.js → try-load-nimbus-plugins-d502a5fe.cjs.dev.js} +1 -1
- package/dist/{vite-plugin-svgr-5de1cad9.cjs.prod.js → vite-plugin-svgr-4034a834.cjs.prod.js} +4 -4
- package/dist/{vite-plugin-svgr-53ef97c7.cjs.dev.js → vite-plugin-svgr-7d06f400.cjs.dev.js} +4 -4
- package/dist/{vite-plugin-svgr-22c8d518.esm.js → vite-plugin-svgr-de6ee7da.esm.js} +4 -4
- package/package.json +10 -10
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +7 -7
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +7 -7
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +7 -7
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +1 -1
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +1 -1
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _startsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
2
|
+
import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
|
|
2
3
|
import _URL from '@babel/runtime-corejs3/core-js-stable/url';
|
|
3
4
|
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
4
5
|
import http from 'http';
|
|
5
6
|
import sirv from 'sirv';
|
|
6
|
-
import { p as paths } from './paths-
|
|
7
|
+
import { p as paths } from './paths-39f22b8b.esm.js';
|
|
7
8
|
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
8
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
9
9
|
import 'fs';
|
|
10
10
|
import 'path';
|
|
11
11
|
import './does-file-exist-32618334.esm.js';
|
|
@@ -13,13 +13,13 @@ import 'node:fs';
|
|
|
13
13
|
|
|
14
14
|
const DEFAULT_PORT = 3001;
|
|
15
15
|
async function run() {
|
|
16
|
-
var
|
|
16
|
+
var _context, _context2, _context3;
|
|
17
17
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
|
-
const port =
|
|
19
|
-
const publicPath =
|
|
20
|
-
const handleAuthRoutes =
|
|
18
|
+
const port = options.port ?? DEFAULT_PORT;
|
|
19
|
+
const publicPath = options.publicPath ?? paths.appBuild;
|
|
20
|
+
const handleAuthRoutes = options.handleAuthRoutes ?? true;
|
|
21
21
|
const applicationConfig = options.applicationConfig;
|
|
22
|
-
const isLocalMcApi = (
|
|
22
|
+
const isLocalMcApi = ((_context = applicationConfig) == null ? void 0 : _bindInstanceProperty(_context3 = Function.call).call(_context3, _startsWithInstanceProperty(_context2 = _context.env.mcApiUrl), _context2))?.('http://localhost') ?? false;
|
|
23
23
|
|
|
24
24
|
// `single: true` gives us the SPA fallback — any unmatched path is served as
|
|
25
25
|
// the root `index.html`. This replaces the complex glob workaround that
|
|
@@ -29,7 +29,7 @@ async function run() {
|
|
|
29
29
|
etag: true
|
|
30
30
|
});
|
|
31
31
|
const server = http.createServer((request, response) => {
|
|
32
|
-
var
|
|
32
|
+
var _context10, _context11;
|
|
33
33
|
// The auth-route handlers are the only consumer of `applicationConfig`,
|
|
34
34
|
// so the branch is entered only when both the flag is on AND the caller
|
|
35
35
|
// supplied a config. The CLI pairs the two — see `serve` action in
|
|
@@ -38,17 +38,17 @@ async function run() {
|
|
|
38
38
|
// `--handle-auth-routes=false` so those paths flow through to the SPA
|
|
39
39
|
// fallback like any other route.
|
|
40
40
|
if (handleAuthRoutes && applicationConfig) {
|
|
41
|
-
var
|
|
41
|
+
var _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1;
|
|
42
42
|
// Localhost-only: inline replacement for the login/logout UI that
|
|
43
43
|
// `mc-dev-authentication` used to ship as static HTML (#3734).
|
|
44
|
-
if (isLocalMcApi && (
|
|
44
|
+
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty(_context5 = Function.call).call(_context5, _startsWithInstanceProperty(_context4), _context4))?.('/login/authorize')) {
|
|
45
45
|
const redirectTo = new _URL(request.url, applicationConfig.env.mcApiUrl);
|
|
46
46
|
response.writeHead(301, {
|
|
47
47
|
Location: redirectTo.toString()
|
|
48
48
|
}).end();
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
if (isLocalMcApi && (
|
|
51
|
+
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty(_context7 = Function.call).call(_context7, _startsWithInstanceProperty(_context6), _context6))?.('/logout')) {
|
|
52
52
|
response.end('Please clear your session storage.');
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -57,7 +57,7 @@ async function run() {
|
|
|
57
57
|
// request (bare `/login`, non-localhost auth callbacks, etc.) must NOT
|
|
58
58
|
// fall back to the SPA — that would mask OAuth callback
|
|
59
59
|
// misconfigurations by rendering the app on a URL the backend owns.
|
|
60
|
-
if ((
|
|
60
|
+
if (((_context8 = request.url) == null ? void 0 : _bindInstanceProperty(_context9 = Function.call).call(_context9, _startsWithInstanceProperty(_context8), _context8))?.('/login') || ((_context0 = request.url) == null ? void 0 : _bindInstanceProperty(_context1 = Function.call).call(_context1, _startsWithInstanceProperty(_context0), _context0))?.('/logout')) {
|
|
61
61
|
response.writeHead(404).end();
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -65,7 +65,7 @@ async function run() {
|
|
|
65
65
|
|
|
66
66
|
// Absorb `/favicon*` variants (e.g. `/favicon.ico`, `/favicon-32x32.png`)
|
|
67
67
|
// into the single PNG the app ships.
|
|
68
|
-
if ((
|
|
68
|
+
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty(_context11 = Function.call).call(_context11, _startsWithInstanceProperty(_context10), _context10))?.('/favicon')) {
|
|
69
69
|
request.url = '/favicon.png';
|
|
70
70
|
}
|
|
71
71
|
staticHandler(request, response, () => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
4
|
+
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
4
5
|
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
5
6
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
6
7
|
var http = require('http');
|
|
7
8
|
var sirv = require('sirv');
|
|
8
|
-
var paths = require('./paths-
|
|
9
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
9
10
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
10
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
11
11
|
require('fs');
|
|
12
12
|
require('path');
|
|
13
13
|
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
@@ -16,6 +16,7 @@ require('node:fs');
|
|
|
16
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
17
|
|
|
18
18
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
19
|
+
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
19
20
|
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
20
21
|
var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
|
|
21
22
|
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
@@ -23,13 +24,13 @@ var sirv__default = /*#__PURE__*/_interopDefault(sirv);
|
|
|
23
24
|
|
|
24
25
|
const DEFAULT_PORT = 3001;
|
|
25
26
|
async function run() {
|
|
26
|
-
var
|
|
27
|
+
var _context, _context2, _context3;
|
|
27
28
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
|
-
const port =
|
|
29
|
-
const publicPath =
|
|
30
|
-
const handleAuthRoutes =
|
|
29
|
+
const port = options.port ?? DEFAULT_PORT;
|
|
30
|
+
const publicPath = options.publicPath ?? paths.paths.appBuild;
|
|
31
|
+
const handleAuthRoutes = options.handleAuthRoutes ?? true;
|
|
31
32
|
const applicationConfig = options.applicationConfig;
|
|
32
|
-
const isLocalMcApi = (
|
|
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;
|
|
33
34
|
|
|
34
35
|
// `single: true` gives us the SPA fallback — any unmatched path is served as
|
|
35
36
|
// the root `index.html`. This replaces the complex glob workaround that
|
|
@@ -39,7 +40,7 @@ async function run() {
|
|
|
39
40
|
etag: true
|
|
40
41
|
});
|
|
41
42
|
const server = http__default["default"].createServer((request, response) => {
|
|
42
|
-
var
|
|
43
|
+
var _context10, _context11;
|
|
43
44
|
// The auth-route handlers are the only consumer of `applicationConfig`,
|
|
44
45
|
// so the branch is entered only when both the flag is on AND the caller
|
|
45
46
|
// supplied a config. The CLI pairs the two — see `serve` action in
|
|
@@ -48,17 +49,17 @@ async function run() {
|
|
|
48
49
|
// `--handle-auth-routes=false` so those paths flow through to the SPA
|
|
49
50
|
// fallback like any other route.
|
|
50
51
|
if (handleAuthRoutes && applicationConfig) {
|
|
51
|
-
var
|
|
52
|
+
var _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1;
|
|
52
53
|
// Localhost-only: inline replacement for the login/logout UI that
|
|
53
54
|
// `mc-dev-authentication` used to ship as static HTML (#3734).
|
|
54
|
-
if (isLocalMcApi && (
|
|
55
|
+
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _startsWithInstanceProperty__default["default"](_context4), _context4))?.('/login/authorize')) {
|
|
55
56
|
const redirectTo = new _URL__default["default"](request.url, applicationConfig.env.mcApiUrl);
|
|
56
57
|
response.writeHead(301, {
|
|
57
58
|
Location: redirectTo.toString()
|
|
58
59
|
}).end();
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
if (isLocalMcApi && (
|
|
62
|
+
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context7 = Function.call).call(_context7, _startsWithInstanceProperty__default["default"](_context6), _context6))?.('/logout')) {
|
|
62
63
|
response.end('Please clear your session storage.');
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
@@ -67,7 +68,7 @@ async function run() {
|
|
|
67
68
|
// request (bare `/login`, non-localhost auth callbacks, etc.) must NOT
|
|
68
69
|
// fall back to the SPA — that would mask OAuth callback
|
|
69
70
|
// misconfigurations by rendering the app on a URL the backend owns.
|
|
70
|
-
if ((
|
|
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')) {
|
|
71
72
|
response.writeHead(404).end();
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
@@ -75,7 +76,7 @@ async function run() {
|
|
|
75
76
|
|
|
76
77
|
// Absorb `/favicon*` variants (e.g. `/favicon.ico`, `/favicon-32x32.png`)
|
|
77
78
|
// into the single PNG the app ships.
|
|
78
|
-
if ((
|
|
79
|
+
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context11 = Function.call).call(_context11, _startsWithInstanceProperty__default["default"](_context10), _context10))?.('/favicon')) {
|
|
79
80
|
request.url = '/favicon.png';
|
|
80
81
|
}
|
|
81
82
|
staticHandler(request, response, () => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
4
|
+
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
4
5
|
var _URL = require('@babel/runtime-corejs3/core-js-stable/url');
|
|
5
6
|
var _Promise = require('@babel/runtime-corejs3/core-js-stable/promise');
|
|
6
7
|
var http = require('http');
|
|
7
8
|
var sirv = require('sirv');
|
|
8
|
-
var paths = require('./paths-
|
|
9
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
9
10
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
10
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
11
11
|
require('fs');
|
|
12
12
|
require('path');
|
|
13
13
|
require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
@@ -16,6 +16,7 @@ require('node:fs');
|
|
|
16
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
17
|
|
|
18
18
|
var _startsWithInstanceProperty__default = /*#__PURE__*/_interopDefault(_startsWithInstanceProperty);
|
|
19
|
+
var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
|
|
19
20
|
var _URL__default = /*#__PURE__*/_interopDefault(_URL);
|
|
20
21
|
var _Promise__default = /*#__PURE__*/_interopDefault(_Promise);
|
|
21
22
|
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
@@ -23,13 +24,13 @@ var sirv__default = /*#__PURE__*/_interopDefault(sirv);
|
|
|
23
24
|
|
|
24
25
|
const DEFAULT_PORT = 3001;
|
|
25
26
|
async function run() {
|
|
26
|
-
var
|
|
27
|
+
var _context, _context2, _context3;
|
|
27
28
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
|
-
const port =
|
|
29
|
-
const publicPath =
|
|
30
|
-
const handleAuthRoutes =
|
|
29
|
+
const port = options.port ?? DEFAULT_PORT;
|
|
30
|
+
const publicPath = options.publicPath ?? paths.paths.appBuild;
|
|
31
|
+
const handleAuthRoutes = options.handleAuthRoutes ?? true;
|
|
31
32
|
const applicationConfig = options.applicationConfig;
|
|
32
|
-
const isLocalMcApi = (
|
|
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;
|
|
33
34
|
|
|
34
35
|
// `single: true` gives us the SPA fallback — any unmatched path is served as
|
|
35
36
|
// the root `index.html`. This replaces the complex glob workaround that
|
|
@@ -39,7 +40,7 @@ async function run() {
|
|
|
39
40
|
etag: true
|
|
40
41
|
});
|
|
41
42
|
const server = http__default["default"].createServer((request, response) => {
|
|
42
|
-
var
|
|
43
|
+
var _context10, _context11;
|
|
43
44
|
// The auth-route handlers are the only consumer of `applicationConfig`,
|
|
44
45
|
// so the branch is entered only when both the flag is on AND the caller
|
|
45
46
|
// supplied a config. The CLI pairs the two — see `serve` action in
|
|
@@ -48,17 +49,17 @@ async function run() {
|
|
|
48
49
|
// `--handle-auth-routes=false` so those paths flow through to the SPA
|
|
49
50
|
// fallback like any other route.
|
|
50
51
|
if (handleAuthRoutes && applicationConfig) {
|
|
51
|
-
var
|
|
52
|
+
var _context4, _context5, _context6, _context7, _context8, _context9, _context0, _context1;
|
|
52
53
|
// Localhost-only: inline replacement for the login/logout UI that
|
|
53
54
|
// `mc-dev-authentication` used to ship as static HTML (#3734).
|
|
54
|
-
if (isLocalMcApi && (
|
|
55
|
+
if (isLocalMcApi && ((_context4 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context5 = Function.call).call(_context5, _startsWithInstanceProperty__default["default"](_context4), _context4))?.('/login/authorize')) {
|
|
55
56
|
const redirectTo = new _URL__default["default"](request.url, applicationConfig.env.mcApiUrl);
|
|
56
57
|
response.writeHead(301, {
|
|
57
58
|
Location: redirectTo.toString()
|
|
58
59
|
}).end();
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
if (isLocalMcApi && (
|
|
62
|
+
if (isLocalMcApi && ((_context6 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context7 = Function.call).call(_context7, _startsWithInstanceProperty__default["default"](_context6), _context6))?.('/logout')) {
|
|
62
63
|
response.end('Please clear your session storage.');
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
@@ -67,7 +68,7 @@ async function run() {
|
|
|
67
68
|
// request (bare `/login`, non-localhost auth callbacks, etc.) must NOT
|
|
68
69
|
// fall back to the SPA — that would mask OAuth callback
|
|
69
70
|
// misconfigurations by rendering the app on a URL the backend owns.
|
|
70
|
-
if ((
|
|
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')) {
|
|
71
72
|
response.writeHead(404).end();
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
@@ -75,7 +76,7 @@ async function run() {
|
|
|
75
76
|
|
|
76
77
|
// Absorb `/favicon*` variants (e.g. `/favicon.ico`, `/favicon-32x32.png`)
|
|
77
78
|
// into the single PNG the app ships.
|
|
78
|
-
if ((
|
|
79
|
+
if (((_context10 = request.url) == null ? void 0 : _bindInstanceProperty__default["default"](_context11 = Function.call).call(_context11, _startsWithInstanceProperty__default["default"](_context10), _context10))?.('/favicon')) {
|
|
79
80
|
request.url = '/favicon.png';
|
|
80
81
|
}
|
|
81
82
|
staticHandler(request, response, () => {
|
|
@@ -9,8 +9,8 @@ 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-ac4d9b95.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');
|
|
@@ -32,14 +32,14 @@ require('path');
|
|
|
32
32
|
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
33
33
|
require('html-webpack-plugin');
|
|
34
34
|
require('moment-locales-webpack-plugin');
|
|
35
|
-
require('./try-load-nimbus-plugins-
|
|
35
|
+
require('./try-load-nimbus-plugins-d502a5fe.cjs.dev.js');
|
|
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-24861798.cjs.dev.js');
|
|
40
40
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
-
require('./package-
|
|
42
|
-
require('./optimizations-
|
|
41
|
+
require('./package-42b38ba8.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');
|
|
@@ -101,18 +101,17 @@ const createWebpackDevServerConfig = async _ref => {
|
|
|
101
101
|
hot: true,
|
|
102
102
|
port,
|
|
103
103
|
setupMiddlewares(middlewares, devServer) {
|
|
104
|
-
var _devServer$app;
|
|
105
104
|
if (!devServer) {
|
|
106
105
|
throw new Error('webpack-dev-server is not defined');
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
devServer.app?.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
109
108
|
return middlewares;
|
|
110
109
|
}
|
|
111
110
|
};
|
|
112
111
|
};
|
|
113
112
|
|
|
114
113
|
async function run() {
|
|
115
|
-
var
|
|
114
|
+
var _context;
|
|
116
115
|
const useYarn = doesFileExist.doesFileExist(paths.paths.yarnLockFile);
|
|
117
116
|
const isInteractive = process.stdout.isTTY;
|
|
118
117
|
|
|
@@ -156,7 +155,7 @@ async function run() {
|
|
|
156
155
|
// Serve webpack assets generated by the compiler over a web sever.
|
|
157
156
|
const serverConfig = await createWebpackDevServerConfig({
|
|
158
157
|
port,
|
|
159
|
-
publicPath:
|
|
158
|
+
publicPath: config.output?.publicPath
|
|
160
159
|
});
|
|
161
160
|
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
162
161
|
await devServer.start();
|
|
@@ -7,8 +7,8 @@ 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-7787fa87.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';
|
|
@@ -30,14 +30,14 @@ import 'path';
|
|
|
30
30
|
import '@pmmmwh/react-refresh-webpack-plugin';
|
|
31
31
|
import 'html-webpack-plugin';
|
|
32
32
|
import 'moment-locales-webpack-plugin';
|
|
33
|
-
import './try-load-nimbus-plugins-
|
|
33
|
+
import './try-load-nimbus-plugins-2f528d8f.esm.js';
|
|
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-3b68ddee.esm.js';
|
|
38
38
|
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
39
|
-
import './package-
|
|
40
|
-
import './optimizations-
|
|
39
|
+
import './package-76b6a39c.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';
|
|
@@ -88,18 +88,17 @@ const createWebpackDevServerConfig = async _ref => {
|
|
|
88
88
|
hot: true,
|
|
89
89
|
port,
|
|
90
90
|
setupMiddlewares(middlewares, devServer) {
|
|
91
|
-
var _devServer$app;
|
|
92
91
|
if (!devServer) {
|
|
93
92
|
throw new Error('webpack-dev-server is not defined');
|
|
94
93
|
}
|
|
95
|
-
|
|
94
|
+
devServer.app?.use(createMcDevAuthenticationMiddleware(applicationConfig));
|
|
96
95
|
return middlewares;
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
};
|
|
100
99
|
|
|
101
100
|
async function run() {
|
|
102
|
-
var
|
|
101
|
+
var _context;
|
|
103
102
|
const useYarn = doesFileExist(paths.yarnLockFile);
|
|
104
103
|
const isInteractive = process.stdout.isTTY;
|
|
105
104
|
|
|
@@ -143,7 +142,7 @@ async function run() {
|
|
|
143
142
|
// Serve webpack assets generated by the compiler over a web sever.
|
|
144
143
|
const serverConfig = await createWebpackDevServerConfig({
|
|
145
144
|
port,
|
|
146
|
-
publicPath:
|
|
145
|
+
publicPath: config.output?.publicPath
|
|
147
146
|
});
|
|
148
147
|
const devServer = new WebpackDevServer(serverConfig, compiler);
|
|
149
148
|
await devServer.start();
|
|
@@ -9,8 +9,8 @@ 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-ba55541a.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');
|
|
@@ -32,14 +32,14 @@ require('path');
|
|
|
32
32
|
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
33
33
|
require('html-webpack-plugin');
|
|
34
34
|
require('moment-locales-webpack-plugin');
|
|
35
|
-
require('./try-load-nimbus-plugins-
|
|
35
|
+
require('./try-load-nimbus-plugins-a713d7d3.cjs.prod.js');
|
|
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-9acd005d.cjs.prod.js');
|
|
40
40
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
-
require('./package-
|
|
42
|
-
require('./optimizations-
|
|
41
|
+
require('./package-2a97179c.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');
|
|
@@ -101,18 +101,17 @@ const createWebpackDevServerConfig = async _ref => {
|
|
|
101
101
|
hot: true,
|
|
102
102
|
port,
|
|
103
103
|
setupMiddlewares(middlewares, devServer) {
|
|
104
|
-
var _devServer$app;
|
|
105
104
|
if (!devServer) {
|
|
106
105
|
throw new Error('webpack-dev-server is not defined');
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
devServer.app?.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
109
108
|
return middlewares;
|
|
110
109
|
}
|
|
111
110
|
};
|
|
112
111
|
};
|
|
113
112
|
|
|
114
113
|
async function run() {
|
|
115
|
-
var
|
|
114
|
+
var _context;
|
|
116
115
|
const useYarn = doesFileExist.doesFileExist(paths.paths.yarnLockFile);
|
|
117
116
|
const isInteractive = process.stdout.isTTY;
|
|
118
117
|
|
|
@@ -156,7 +155,7 @@ async function run() {
|
|
|
156
155
|
// Serve webpack assets generated by the compiler over a web sever.
|
|
157
156
|
const serverConfig = await createWebpackDevServerConfig({
|
|
158
157
|
port,
|
|
159
|
-
publicPath:
|
|
158
|
+
publicPath: config.output?.publicPath
|
|
160
159
|
});
|
|
161
160
|
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
162
161
|
await devServer.start();
|
|
@@ -8,13 +8,12 @@ import { createServer } from 'vite';
|
|
|
8
8
|
import { processConfig } from '@commercetools-frontend/application-config';
|
|
9
9
|
import { packageLocation } from '@commercetools-frontend/assets';
|
|
10
10
|
import { processHeaders, replaceHtmlPlaceholders, generateTemplate } from '@commercetools-frontend/mc-html-template';
|
|
11
|
-
import { p as paths } from './paths-
|
|
12
|
-
import { a as loadNimbusVitePlugin } from './try-load-nimbus-plugins-
|
|
11
|
+
import { p as paths } from './paths-39f22b8b.esm.js';
|
|
12
|
+
import { a as loadNimbusVitePlugin } from './try-load-nimbus-plugins-2f528d8f.esm.js';
|
|
13
13
|
import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
|
|
14
14
|
import { createMcDevAuthenticationMiddleware } from '@commercetools-frontend/mc-dev-authentication';
|
|
15
|
-
import { v as vitePluginSvgr } from './vite-plugin-svgr-
|
|
15
|
+
import { v as vitePluginSvgr } from './vite-plugin-svgr-de6ee7da.esm.js';
|
|
16
16
|
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
17
|
-
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
18
17
|
import 'fs';
|
|
19
18
|
import './does-file-exist-32618334.esm.js';
|
|
20
19
|
import 'node:fs';
|
|
@@ -86,7 +85,7 @@ async function run() {
|
|
|
86
85
|
const html = generateTemplate({
|
|
87
86
|
// Define the module entry point (path relative to the `/public` folder).
|
|
88
87
|
// NOTE: that this is different from the production configuration.
|
|
89
|
-
scriptImports: [
|
|
88
|
+
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
90
89
|
});
|
|
91
90
|
// Write `index.html` (template) into the `/public` folder.
|
|
92
91
|
fs.writeFileSync(paths.appIndexHtml, html, {
|
|
@@ -10,13 +10,12 @@ 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-
|
|
14
|
-
var tryLoadNimbusPlugins = require('./try-load-nimbus-plugins-
|
|
13
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
14
|
+
var tryLoadNimbusPlugins = require('./try-load-nimbus-plugins-d502a5fe.cjs.dev.js');
|
|
15
15
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
16
16
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
17
|
-
var vitePluginSvgr = require('./vite-plugin-svgr-
|
|
17
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-7d06f400.cjs.dev.js');
|
|
18
18
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
19
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
20
19
|
require('fs');
|
|
21
20
|
require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
22
21
|
require('node:fs');
|
|
@@ -98,7 +97,7 @@ async function run() {
|
|
|
98
97
|
const html = mcHtmlTemplate.generateTemplate({
|
|
99
98
|
// Define the module entry point (path relative to the `/public` folder).
|
|
100
99
|
// NOTE: that this is different from the production configuration.
|
|
101
|
-
scriptImports: [
|
|
100
|
+
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
102
101
|
});
|
|
103
102
|
// Write `index.html` (template) into the `/public` folder.
|
|
104
103
|
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
@@ -10,13 +10,12 @@ 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-
|
|
14
|
-
var tryLoadNimbusPlugins = require('./try-load-nimbus-plugins-
|
|
13
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
14
|
+
var tryLoadNimbusPlugins = require('./try-load-nimbus-plugins-a713d7d3.cjs.prod.js');
|
|
15
15
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
16
16
|
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
17
|
-
var vitePluginSvgr = require('./vite-plugin-svgr-
|
|
17
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-4034a834.cjs.prod.js');
|
|
18
18
|
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
19
|
-
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
20
19
|
require('fs');
|
|
21
20
|
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
22
21
|
require('node:fs');
|
|
@@ -98,7 +97,7 @@ async function run() {
|
|
|
98
97
|
const html = mcHtmlTemplate.generateTemplate({
|
|
99
98
|
// Define the module entry point (path relative to the `/public` folder).
|
|
100
99
|
// NOTE: that this is different from the production configuration.
|
|
101
|
-
scriptImports: [
|
|
100
|
+
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
102
101
|
});
|
|
103
102
|
// Write `index.html` (template) into the `/public` folder.
|
|
104
103
|
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
package/dist/{try-load-nimbus-plugins-526dccbd.esm.js → try-load-nimbus-plugins-2f528d8f.esm.js}
RENAMED
|
@@ -87,7 +87,7 @@ function loadNimbusWebpackPlugin(options) {
|
|
|
87
87
|
// Nimbus is not installed: its own plugin can't be loaded (it lives inside
|
|
88
88
|
// Nimbus), so mc-scripts stubs the imports itself. Any other error (e.g. a
|
|
89
89
|
// present-but-broken Nimbus) still surfaces.
|
|
90
|
-
if (isModuleNotFound(error)) return new NimbusStubWebpackPlugin(options
|
|
90
|
+
if (isModuleNotFound(error)) return new NimbusStubWebpackPlugin(options?.cwd);
|
|
91
91
|
throw error;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -89,7 +89,7 @@ function loadNimbusWebpackPlugin(options) {
|
|
|
89
89
|
// Nimbus is not installed: its own plugin can't be loaded (it lives inside
|
|
90
90
|
// Nimbus), so mc-scripts stubs the imports itself. Any other error (e.g. a
|
|
91
91
|
// present-but-broken Nimbus) still surfaces.
|
|
92
|
-
if (isModuleNotFound(error)) return new NimbusStubWebpackPlugin(options
|
|
92
|
+
if (isModuleNotFound(error)) return new NimbusStubWebpackPlugin(options?.cwd);
|
|
93
93
|
throw error;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -89,7 +89,7 @@ function loadNimbusWebpackPlugin(options) {
|
|
|
89
89
|
// Nimbus is not installed: its own plugin can't be loaded (it lives inside
|
|
90
90
|
// Nimbus), so mc-scripts stubs the imports itself. Any other error (e.g. a
|
|
91
91
|
// present-but-broken Nimbus) still surfaces.
|
|
92
|
-
if (isModuleNotFound(error)) return new NimbusStubWebpackPlugin(options
|
|
92
|
+
if (isModuleNotFound(error)) return new NimbusStubWebpackPlugin(options?.cwd);
|
|
93
93
|
throw error;
|
|
94
94
|
}
|
|
95
95
|
}
|
package/dist/{vite-plugin-svgr-5de1cad9.cjs.prod.js → vite-plugin-svgr-4034a834.cjs.prod.js}
RENAMED
|
@@ -31,7 +31,7 @@ var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
|
31
31
|
var _matchAllInstanceProperty__default = /*#__PURE__*/_interopDefault(_matchAllInstanceProperty);
|
|
32
32
|
|
|
33
33
|
async function optimizeEmbeddedPngs(code, id) {
|
|
34
|
-
const pngRegex = /href="data:image\/png;base64,([a-zA-Z0-9+/]+=*)"/
|
|
34
|
+
const pngRegex = /href="data:image\/png;base64,([a-zA-Z0-9+/]+=*)"/gs;
|
|
35
35
|
let modifiedCode = code;
|
|
36
36
|
const matchesIterator = _matchAllInstanceProperty__default["default"](code).call(code, pngRegex);
|
|
37
37
|
for (const match of matchesIterator) {
|
|
@@ -40,7 +40,7 @@ async function optimizeEmbeddedPngs(code, id) {
|
|
|
40
40
|
// This length would indicate that the match is greater than ~1mb
|
|
41
41
|
if (originalBase64.length > 1000000) {
|
|
42
42
|
const fileName = id.split('/').pop();
|
|
43
|
-
console.warn(
|
|
43
|
+
console.warn(`\n🚨 You have a large png embedded in ${fileName} - consider using an image tag instead 🚨`);
|
|
44
44
|
try {
|
|
45
45
|
const pngBuffer = Buffer.from(originalBase64, 'base64');
|
|
46
46
|
const sharp = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('sharp')); })).default;
|
|
@@ -123,9 +123,9 @@ function vitePluginSvgr() {
|
|
|
123
123
|
name: 'prefixIds',
|
|
124
124
|
params: {
|
|
125
125
|
delim: '',
|
|
126
|
-
prefix: (_, info) =>
|
|
126
|
+
prefix: (_, info) => `svg${crypto__default["default"].createHash('shake256', {
|
|
127
127
|
outputLength: 6
|
|
128
|
-
}).update(info.path || '').digest('hex')
|
|
128
|
+
}).update(info.path || '').digest('hex')}`
|
|
129
129
|
}
|
|
130
130
|
}]
|
|
131
131
|
}
|