@commercetools-frontend/mc-scripts 0.0.0-FEC-157-preview-releases-20241126230331
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/LICENSE +21 -0
- package/README.md +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts +2 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.d.ts.map +1 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.dev.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.cjs.prod.js +7 -0
- package/application-runtime/dist/commercetools-frontend-mc-scripts-application-runtime.esm.js +5 -0
- package/application-runtime/package.json +4 -0
- package/bin/cli.js +8 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts +2 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.d.ts.map +1 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +211 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +211 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +196 -0
- package/cli/package.json +4 -0
- package/config/create-webpack-config-for-development.js +8 -0
- package/config/create-webpack-config-for-production.js +8 -0
- package/config/vendors-to-transpile.js +6 -0
- package/dist/build-99744dae.cjs.prod.js +166 -0
- package/dist/build-a93715aa.esm.js +152 -0
- package/dist/build-f56ce7ec.cjs.dev.js +166 -0
- package/dist/build-vite-000f0a2d.cjs.prod.js +193 -0
- package/dist/build-vite-722f0dcf.esm.js +182 -0
- package/dist/build-vite-838c8e01.cjs.dev.js +193 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +2 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.d.ts.map +1 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +29 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.js +7 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +29 -0
- package/dist/commercetools-frontend-mc-scripts.esm.js +21 -0
- package/dist/compile-html-025cd493.esm.js +34 -0
- package/dist/compile-html-50fd05ec.cjs.prod.js +42 -0
- package/dist/compile-html-f4ac88cc.cjs.dev.js +42 -0
- package/dist/config-sync-2ff62f08.cjs.dev.js +845 -0
- package/dist/config-sync-b57f79e2.cjs.prod.js +839 -0
- package/dist/config-sync-cda7662e.esm.js +823 -0
- package/dist/create-postcss-config-2f709335.esm.js +75 -0
- package/dist/create-postcss-config-3b540c7c.cjs.prod.js +81 -0
- package/dist/create-postcss-config-5962fa01.cjs.dev.js +81 -0
- package/dist/create-webpack-config-for-development-7d9e4dc4.cjs.prod.js +463 -0
- package/dist/create-webpack-config-for-development-86baace3.esm.js +438 -0
- package/dist/create-webpack-config-for-development-b379913b.cjs.dev.js +463 -0
- package/dist/create-webpack-config-for-production-3a40f56b.cjs.dev.js +518 -0
- package/dist/create-webpack-config-for-production-5ec9d0e2.cjs.prod.js +518 -0
- package/dist/create-webpack-config-for-production-b6ee3116.esm.js +488 -0
- package/dist/credentials-storage-3cea94ea.cjs.dev.js +95 -0
- package/dist/credentials-storage-b13e1406.esm.js +83 -0
- package/dist/credentials-storage-dc849808.cjs.prod.js +95 -0
- package/dist/declarations/src/application-runtime.d.ts +1 -0
- package/dist/declarations/src/cli.d.ts +4 -0
- package/dist/declarations/src/commands/build-vite.d.ts +2 -0
- package/dist/declarations/src/commands/build.d.ts +2 -0
- package/dist/declarations/src/commands/compile-html.d.ts +3 -0
- package/dist/declarations/src/commands/config-sync.d.ts +3 -0
- package/dist/declarations/src/commands/deployment-previews-set.d.ts +3 -0
- package/dist/declarations/src/commands/login.d.ts +2 -0
- package/dist/declarations/src/commands/serve.d.ts +2 -0
- package/dist/declarations/src/commands/start-vite.d.ts +2 -0
- package/dist/declarations/src/commands/start.d.ts +2 -0
- package/dist/declarations/src/config/create-postcss-config.d.ts +4 -0
- package/dist/declarations/src/config/create-webpack-config-for-development.d.ts +10 -0
- package/dist/declarations/src/config/create-webpack-config-for-production.d.ts +10 -0
- package/dist/declarations/src/config/has-jsx-runtime.d.ts +2 -0
- package/dist/declarations/src/config/moment-locales.d.ts +2 -0
- package/dist/declarations/src/config/optimizations.d.ts +2 -0
- package/dist/declarations/src/config/paths.d.ts +12 -0
- package/dist/declarations/src/config/vendors-to-transpile.d.ts +2 -0
- package/dist/declarations/src/config/webpack-dev-server.config.d.ts +6 -0
- package/dist/declarations/src/deprecated-entry-points.d.ts +7 -0
- package/dist/declarations/src/generated/core.d.ts +739 -0
- package/dist/declarations/src/generated/settings.d.ts +2116 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/postcss.d.ts +1 -0
- package/dist/declarations/src/types.d.ts +87 -0
- package/dist/declarations/src/utils/auth.d.ts +6 -0
- package/dist/declarations/src/utils/credentials-storage.d.ts +11 -0
- package/dist/declarations/src/utils/does-file-exist.d.ts +2 -0
- package/dist/declarations/src/utils/get-config-diff.d.ts +3 -0
- package/dist/declarations/src/utils/graphql-requests.d.ts +172 -0
- package/dist/declarations/src/utils/i18n-message-complilation.d.ts +4 -0
- package/dist/declarations/src/utils/user-agent.d.ts +2 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-dynamic-base-assets-globals.d.ts +3 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-i18n-message-compilation.d.ts +3 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-merchant-center-customization.d.ts +4 -0
- package/dist/declarations/src/vite-plugins/vite-plugin-svgr.d.ts +3 -0
- package/dist/declarations/src/webpack-loaders/i18n-message-compilation-loader.d.ts +3 -0
- package/dist/declarations/src/webpack-plugins/final-stats-writer-plugin.d.ts +12 -0
- package/dist/declarations/src/webpack-plugins/local-html-webpack-plugin.d.ts +5 -0
- package/dist/declarations/src/webpack.d.ts +2 -0
- package/dist/deployment-previews-set-173d8491.cjs.dev.js +203 -0
- package/dist/deployment-previews-set-923f79de.esm.js +192 -0
- package/dist/deployment-previews-set-f451242a.cjs.prod.js +203 -0
- package/dist/does-file-exist-32618334.esm.js +12 -0
- package/dist/does-file-exist-be53305d.cjs.prod.js +18 -0
- package/dist/does-file-exist-eb86baca.cjs.dev.js +18 -0
- package/dist/graphql-requests-0e427050.esm.js +243 -0
- package/dist/graphql-requests-733aac06.cjs.dev.js +266 -0
- package/dist/graphql-requests-db54706e.cjs.prod.js +266 -0
- package/dist/has-jsx-runtime-aa5d21ee.cjs.dev.js +15 -0
- package/dist/has-jsx-runtime-c3202df5.cjs.prod.js +15 -0
- package/dist/has-jsx-runtime-e3ecb09b.esm.js +13 -0
- package/dist/i18n-message-complilation-21d3b0aa.esm.js +15 -0
- package/dist/i18n-message-complilation-7311cb29.cjs.dev.js +23 -0
- package/dist/i18n-message-complilation-7762da61.cjs.prod.js +23 -0
- package/dist/login-35f578e3.esm.js +86 -0
- package/dist/login-65c78b83.cjs.dev.js +103 -0
- package/dist/login-c616d769.cjs.prod.js +103 -0
- package/dist/optimizations-7789145e.cjs.dev.js +85 -0
- package/dist/optimizations-bf991634.esm.js +67 -0
- package/dist/optimizations-fb93514f.cjs.prod.js +85 -0
- package/dist/package-436331e6.cjs.dev.js +151 -0
- package/dist/package-a7096308.cjs.prod.js +151 -0
- package/dist/package-b2f2b4e5.esm.js +149 -0
- package/dist/paths-39f22b8b.esm.js +36 -0
- package/dist/paths-7768b440.cjs.prod.js +44 -0
- package/dist/paths-b76fc753.cjs.dev.js +44 -0
- package/dist/serve-5666b16a.cjs.prod.js +48 -0
- package/dist/serve-6a951584.esm.js +41 -0
- package/dist/serve-f898c45e.cjs.dev.js +48 -0
- package/dist/start-4e79e08f.esm.js +164 -0
- package/dist/start-569eb0f9.cjs.dev.js +177 -0
- package/dist/start-b0765c9a.cjs.prod.js +177 -0
- package/dist/start-vite-45bfc42f.esm.js +110 -0
- package/dist/start-vite-a68e1b9f.cjs.prod.js +122 -0
- package/dist/start-vite-a787f80d.cjs.dev.js +122 -0
- package/dist/vendors-to-transpile-04a49d40.cjs.prod.js +5 -0
- package/dist/vendors-to-transpile-6ab4ea06.cjs.dev.js +5 -0
- package/dist/vendors-to-transpile-7dc84a72.esm.js +3 -0
- package/dist/vite-plugin-svgr-069f402d.esm.js +83 -0
- package/dist/vite-plugin-svgr-7fb42bbf.cjs.dev.js +108 -0
- package/dist/vite-plugin-svgr-b080c510.cjs.prod.js +108 -0
- package/package.json +147 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +2 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts.map +1 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +12 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.js +7 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +12 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +4 -0
- package/postcss/package.json +4 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts +2 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.d.ts.map +1 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +57 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.js +7 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +57 -0
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +48 -0
- package/webpack/package.json +4 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.d.ts +3 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.d.ts.map +1 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +30 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.js +7 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +30 -0
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +26 -0
- package/webpack-loaders/i18n-message-compilation-loader/package.json +4 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
4
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
7
|
+
var clearConsole = require('react-dev-utils/clearConsole');
|
|
8
|
+
var openBrowser = require('react-dev-utils/openBrowser');
|
|
9
|
+
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
10
|
+
var webpack = require('webpack');
|
|
11
|
+
var WebpackDevServer = require('webpack-dev-server');
|
|
12
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-b379913b.cjs.dev.js');
|
|
13
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
14
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
|
+
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
17
|
+
var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
24
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
30
|
+
require('crypto');
|
|
31
|
+
require('path');
|
|
32
|
+
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
33
|
+
require('html-webpack-plugin');
|
|
34
|
+
require('moment-locales-webpack-plugin');
|
|
35
|
+
require('webpackbar');
|
|
36
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
37
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
38
|
+
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
39
|
+
require('./create-postcss-config-5962fa01.cjs.dev.js');
|
|
40
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
+
require('./package-436331e6.cjs.dev.js');
|
|
42
|
+
require('./has-jsx-runtime-aa5d21ee.cjs.dev.js');
|
|
43
|
+
require('./optimizations-7789145e.cjs.dev.js');
|
|
44
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
45
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
46
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
+
require('./vendors-to-transpile-6ab4ea06.cjs.dev.js');
|
|
48
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
49
|
+
require('fs');
|
|
50
|
+
require('node:fs');
|
|
51
|
+
|
|
52
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
53
|
+
|
|
54
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
55
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
56
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
57
|
+
var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
|
|
58
|
+
var clearConsole__default = /*#__PURE__*/_interopDefault(clearConsole);
|
|
59
|
+
var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
60
|
+
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
61
|
+
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
62
|
+
|
|
63
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
64
|
+
// We support configuring the sockjs pathname during development.
|
|
65
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
66
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
67
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
68
|
+
// and `sockPort` options in webpack-dev-server.
|
|
69
|
+
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
70
|
+
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
71
|
+
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
72
|
+
const createWebpackDevServerConfig = _ref => {
|
|
73
|
+
let port = _ref.port,
|
|
74
|
+
publicPath = _ref.publicPath;
|
|
75
|
+
const applicationConfig$1 = applicationConfig.processConfig();
|
|
76
|
+
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
77
|
+
return {
|
|
78
|
+
client: {
|
|
79
|
+
overlay: false,
|
|
80
|
+
webSocketURL: {
|
|
81
|
+
hostname: sockHost,
|
|
82
|
+
pathname: sockPath,
|
|
83
|
+
port: sockPort
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Enable gzip compression of generated files.
|
|
87
|
+
compress: true,
|
|
88
|
+
devMiddleware: {
|
|
89
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
90
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
91
|
+
// from the root.
|
|
92
|
+
publicPath
|
|
93
|
+
},
|
|
94
|
+
headers: compiledHeaders,
|
|
95
|
+
historyApiFallback: {
|
|
96
|
+
// Paths with dots should still use the history fallback.
|
|
97
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
98
|
+
disableDotRule: true,
|
|
99
|
+
index: publicPath
|
|
100
|
+
},
|
|
101
|
+
host,
|
|
102
|
+
hot: true,
|
|
103
|
+
https: false,
|
|
104
|
+
port,
|
|
105
|
+
setupMiddlewares(middlewares, devServer) {
|
|
106
|
+
if (!devServer) {
|
|
107
|
+
throw new Error('webpack-dev-server is not defined');
|
|
108
|
+
}
|
|
109
|
+
devServer.app?.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
110
|
+
return middlewares;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
async function run() {
|
|
116
|
+
var _context;
|
|
117
|
+
const useYarn = doesFileExist.doesFileExist(paths.paths.yarnLockFile);
|
|
118
|
+
const isInteractive = process.stdout.isTTY;
|
|
119
|
+
|
|
120
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
121
|
+
// which is why it's disabled by default.
|
|
122
|
+
|
|
123
|
+
const hasWebpackConfig = doesFileExist.doesFileExist(paths.paths.appWebpackConfig);
|
|
124
|
+
|
|
125
|
+
// Warn and crash if required files are missing
|
|
126
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Tools like Cloud9 rely on this.
|
|
131
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
132
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
133
|
+
|
|
134
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
135
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
136
|
+
const port = await WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
137
|
+
if (port == null) {
|
|
138
|
+
console.warn('Could not find a free port. Aborting.');
|
|
139
|
+
// We have not found a port.
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
143
|
+
const appName = require(paths.paths.appPackageJson).name;
|
|
144
|
+
const urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port);
|
|
145
|
+
// Get webpack config
|
|
146
|
+
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment();
|
|
147
|
+
|
|
148
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
149
|
+
const compiler = WebpackDevServerUtils.createCompiler({
|
|
150
|
+
appName,
|
|
151
|
+
config,
|
|
152
|
+
useYarn,
|
|
153
|
+
webpack: webpack__default["default"],
|
|
154
|
+
urls
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
158
|
+
const serverConfig = createWebpackDevServerConfig({
|
|
159
|
+
port,
|
|
160
|
+
publicPath: config.output?.publicPath
|
|
161
|
+
});
|
|
162
|
+
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
163
|
+
await devServer.start();
|
|
164
|
+
if (isInteractive) {
|
|
165
|
+
clearConsole__default["default"]();
|
|
166
|
+
}
|
|
167
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
168
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
169
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
170
|
+
process.on(sig, () => {
|
|
171
|
+
devServer.close();
|
|
172
|
+
process.exit();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _parseInt = require('@babel/runtime-corejs3/core-js-stable/parse-int');
|
|
4
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
7
|
+
var clearConsole = require('react-dev-utils/clearConsole');
|
|
8
|
+
var openBrowser = require('react-dev-utils/openBrowser');
|
|
9
|
+
var WebpackDevServerUtils = require('react-dev-utils/WebpackDevServerUtils');
|
|
10
|
+
var webpack = require('webpack');
|
|
11
|
+
var WebpackDevServer = require('webpack-dev-server');
|
|
12
|
+
var createWebpackConfigForDevelopment = require('./create-webpack-config-for-development-7d9e4dc4.cjs.prod.js');
|
|
13
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
14
|
+
var applicationConfig = require('@commercetools-frontend/application-config');
|
|
15
|
+
var mcDevAuthentication = require('@commercetools-frontend/mc-dev-authentication');
|
|
16
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
17
|
+
var doesFileExist = require('./does-file-exist-be53305d.cjs.prod.js');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
24
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/ends-with');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
30
|
+
require('crypto');
|
|
31
|
+
require('path');
|
|
32
|
+
require('@pmmmwh/react-refresh-webpack-plugin');
|
|
33
|
+
require('html-webpack-plugin');
|
|
34
|
+
require('moment-locales-webpack-plugin');
|
|
35
|
+
require('webpackbar');
|
|
36
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
37
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
38
|
+
require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
39
|
+
require('./create-postcss-config-3b540c7c.cjs.prod.js');
|
|
40
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
41
|
+
require('./package-a7096308.cjs.prod.js');
|
|
42
|
+
require('./has-jsx-runtime-c3202df5.cjs.prod.js');
|
|
43
|
+
require('./optimizations-fb93514f.cjs.prod.js');
|
|
44
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
45
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
46
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
47
|
+
require('./vendors-to-transpile-04a49d40.cjs.prod.js');
|
|
48
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
49
|
+
require('fs');
|
|
50
|
+
require('node:fs');
|
|
51
|
+
|
|
52
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
53
|
+
|
|
54
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
55
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
56
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
57
|
+
var checkRequiredFiles__default = /*#__PURE__*/_interopDefault(checkRequiredFiles);
|
|
58
|
+
var clearConsole__default = /*#__PURE__*/_interopDefault(clearConsole);
|
|
59
|
+
var openBrowser__default = /*#__PURE__*/_interopDefault(openBrowser);
|
|
60
|
+
var webpack__default = /*#__PURE__*/_interopDefault(webpack);
|
|
61
|
+
var WebpackDevServer__default = /*#__PURE__*/_interopDefault(WebpackDevServer);
|
|
62
|
+
|
|
63
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
64
|
+
// We support configuring the sockjs pathname during development.
|
|
65
|
+
// These settings let a developer run multiple simultaneous projects.
|
|
66
|
+
// They are used as the connection `hostname`, `pathname` and `port`
|
|
67
|
+
// in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
|
|
68
|
+
// and `sockPort` options in webpack-dev-server.
|
|
69
|
+
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
70
|
+
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
71
|
+
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
72
|
+
const createWebpackDevServerConfig = _ref => {
|
|
73
|
+
let port = _ref.port,
|
|
74
|
+
publicPath = _ref.publicPath;
|
|
75
|
+
const applicationConfig$1 = applicationConfig.processConfig();
|
|
76
|
+
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig$1);
|
|
77
|
+
return {
|
|
78
|
+
client: {
|
|
79
|
+
overlay: false,
|
|
80
|
+
webSocketURL: {
|
|
81
|
+
hostname: sockHost,
|
|
82
|
+
pathname: sockPath,
|
|
83
|
+
port: sockPort
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
// Enable gzip compression of generated files.
|
|
87
|
+
compress: true,
|
|
88
|
+
devMiddleware: {
|
|
89
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
90
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
91
|
+
// from the root.
|
|
92
|
+
publicPath
|
|
93
|
+
},
|
|
94
|
+
headers: compiledHeaders,
|
|
95
|
+
historyApiFallback: {
|
|
96
|
+
// Paths with dots should still use the history fallback.
|
|
97
|
+
// See https://github.com/facebookincubator/create-react-app/issues/387.
|
|
98
|
+
disableDotRule: true,
|
|
99
|
+
index: publicPath
|
|
100
|
+
},
|
|
101
|
+
host,
|
|
102
|
+
hot: true,
|
|
103
|
+
https: false,
|
|
104
|
+
port,
|
|
105
|
+
setupMiddlewares(middlewares, devServer) {
|
|
106
|
+
if (!devServer) {
|
|
107
|
+
throw new Error('webpack-dev-server is not defined');
|
|
108
|
+
}
|
|
109
|
+
devServer.app?.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig$1));
|
|
110
|
+
return middlewares;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
async function run() {
|
|
116
|
+
var _context;
|
|
117
|
+
const useYarn = doesFileExist.doesFileExist(paths.paths.yarnLockFile);
|
|
118
|
+
const isInteractive = process.stdout.isTTY;
|
|
119
|
+
|
|
120
|
+
// Whether or not `react-refresh` is enabled, `react-refresh` is not 100% stable at this time,
|
|
121
|
+
// which is why it's disabled by default.
|
|
122
|
+
|
|
123
|
+
const hasWebpackConfig = doesFileExist.doesFileExist(paths.paths.appWebpackConfig);
|
|
124
|
+
|
|
125
|
+
// Warn and crash if required files are missing
|
|
126
|
+
if (!checkRequiredFiles__default["default"]([])) {
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Tools like Cloud9 rely on this.
|
|
131
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
132
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
133
|
+
|
|
134
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
135
|
+
// run on a different port. `detect()` Promise resolves to the next free port.
|
|
136
|
+
const port = await WebpackDevServerUtils.choosePort(HOST, DEFAULT_PORT);
|
|
137
|
+
if (port == null) {
|
|
138
|
+
console.warn('Could not find a free port. Aborting.');
|
|
139
|
+
// We have not found a port.
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
143
|
+
const appName = require(paths.paths.appPackageJson).name;
|
|
144
|
+
const urls = WebpackDevServerUtils.prepareUrls(protocol, HOST, port);
|
|
145
|
+
// Get webpack config
|
|
146
|
+
const config = hasWebpackConfig ? require(paths.paths.appWebpackConfig) : createWebpackConfigForDevelopment.createWebpackConfigForDevelopment();
|
|
147
|
+
|
|
148
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
149
|
+
const compiler = WebpackDevServerUtils.createCompiler({
|
|
150
|
+
appName,
|
|
151
|
+
config,
|
|
152
|
+
useYarn,
|
|
153
|
+
webpack: webpack__default["default"],
|
|
154
|
+
urls
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Serve webpack assets generated by the compiler over a web sever.
|
|
158
|
+
const serverConfig = createWebpackDevServerConfig({
|
|
159
|
+
port,
|
|
160
|
+
publicPath: config.output?.publicPath
|
|
161
|
+
});
|
|
162
|
+
const devServer = new WebpackDevServer__default["default"](serverConfig, compiler);
|
|
163
|
+
await devServer.start();
|
|
164
|
+
if (isInteractive) {
|
|
165
|
+
clearConsole__default["default"]();
|
|
166
|
+
}
|
|
167
|
+
console.log(chalk__default["default"].cyan('Starting the development server...\n'));
|
|
168
|
+
openBrowser__default["default"](urls.localUrlForBrowser);
|
|
169
|
+
_forEachInstanceProperty__default["default"](_context = ['SIGINT', 'SIGTERM']).call(_context, sig => {
|
|
170
|
+
process.on(sig, () => {
|
|
171
|
+
devServer.close();
|
|
172
|
+
process.exit();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,110 @@
|
|
|
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-39f22b8b.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-069f402d.esm.js';
|
|
15
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
16
|
+
import 'fs';
|
|
17
|
+
import './does-file-exist-32618334.esm.js';
|
|
18
|
+
import 'node:fs';
|
|
19
|
+
import 'crypto';
|
|
20
|
+
import '@rollup/pluginutils';
|
|
21
|
+
|
|
22
|
+
const vitePluginCustomApplication = applicationConfig => {
|
|
23
|
+
return {
|
|
24
|
+
name: 'custom-application',
|
|
25
|
+
configureServer(server) {
|
|
26
|
+
return () => {
|
|
27
|
+
// Users do not need to have/maintain the `index.html` (as expected by Vite)
|
|
28
|
+
// as it's generated and maintained by the Merchant Center customization CLI.
|
|
29
|
+
// Therefore, the generated `index.html` (template) is written into the `/public`
|
|
30
|
+
// folder so that it's gitignored.
|
|
31
|
+
// As a result, we need to make sure to point the URI path to the correct location.
|
|
32
|
+
server.middlewares.use((req, _res, next) => {
|
|
33
|
+
if (req.url === '/index.html') {
|
|
34
|
+
req.url = '/public/index.html';
|
|
35
|
+
}
|
|
36
|
+
next();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Handle auth routes for internal local development.
|
|
40
|
+
server.middlewares.use(createMcDevAuthenticationMiddleware(applicationConfig));
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* @type {import('vite').IndexHtmlTransformHook}
|
|
45
|
+
*/
|
|
46
|
+
transformIndexHtml(rawHtml, _ctx) {
|
|
47
|
+
const compiledHeaders = processHeaders(applicationConfig);
|
|
48
|
+
const enhancedLocalEnv = _Object$assign({}, applicationConfig.env,
|
|
49
|
+
// 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
|
+
} : {});
|
|
57
|
+
|
|
58
|
+
// Resolve the placeholders of the `index.html` (template) file, before serving it.
|
|
59
|
+
const html = replaceHtmlPlaceholders(rawHtml, {
|
|
60
|
+
env: enhancedLocalEnv,
|
|
61
|
+
headers: compiledHeaders
|
|
62
|
+
});
|
|
63
|
+
return html;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
async function run() {
|
|
69
|
+
const DEFAULT_PORT = _parseInt(String(process.env.HTTP_PORT), 10) || 3001;
|
|
70
|
+
|
|
71
|
+
// Load the Merchant Center customization config file first.
|
|
72
|
+
const applicationConfig = processConfig();
|
|
73
|
+
|
|
74
|
+
// Ensure the `/public` folder exists.
|
|
75
|
+
fs.mkdirSync(paths.appBuild, {
|
|
76
|
+
recursive: true
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Generate `index.html` (template).
|
|
80
|
+
const appEntryPoint = path.relative(paths.appRoot, paths.entryPoint);
|
|
81
|
+
const html = generateTemplate({
|
|
82
|
+
// Define the module entry point (path relative to the `/public` folder).
|
|
83
|
+
// NOTE: that this is different from the production configuration.
|
|
84
|
+
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
85
|
+
});
|
|
86
|
+
// Write `index.html` (template) into the `/public` folder.
|
|
87
|
+
fs.writeFileSync(paths.appIndexHtml, html, {
|
|
88
|
+
encoding: 'utf8'
|
|
89
|
+
});
|
|
90
|
+
const server = await createServer({
|
|
91
|
+
root: paths.appRoot,
|
|
92
|
+
define: {
|
|
93
|
+
'process.env.DEBUG': _JSON$stringify(false),
|
|
94
|
+
'process.env.NODE_ENV': _JSON$stringify('development')
|
|
95
|
+
},
|
|
96
|
+
server: {
|
|
97
|
+
port: DEFAULT_PORT
|
|
98
|
+
},
|
|
99
|
+
plugins: [pluginGraphql(), pluginReact(), vitePluginSvgr(), vitePluginCustomApplication(applicationConfig)]
|
|
100
|
+
});
|
|
101
|
+
await server.listen();
|
|
102
|
+
|
|
103
|
+
// Copy public assets to `/public` folder (even in development).
|
|
104
|
+
fs.copySync(path.join(packageLocation, 'html-page'), paths.appBuild, {
|
|
105
|
+
dereference: true
|
|
106
|
+
});
|
|
107
|
+
server.printUrls();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { run as default };
|
|
@@ -0,0 +1,122 @@
|
|
|
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-7768b440.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-b080c510.cjs.prod.js');
|
|
17
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
18
|
+
require('fs');
|
|
19
|
+
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
20
|
+
require('node:fs');
|
|
21
|
+
require('crypto');
|
|
22
|
+
require('@rollup/pluginutils');
|
|
23
|
+
|
|
24
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
25
|
+
|
|
26
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
27
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
28
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
29
|
+
var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
|
|
30
|
+
var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
|
|
31
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
32
|
+
var _Object$assign__default = /*#__PURE__*/_interopDefault(_Object$assign);
|
|
33
|
+
|
|
34
|
+
const vitePluginCustomApplication = applicationConfig => {
|
|
35
|
+
return {
|
|
36
|
+
name: 'custom-application',
|
|
37
|
+
configureServer(server) {
|
|
38
|
+
return () => {
|
|
39
|
+
// Users do not need to have/maintain the `index.html` (as expected by Vite)
|
|
40
|
+
// as it's generated and maintained by the Merchant Center customization CLI.
|
|
41
|
+
// Therefore, the generated `index.html` (template) is written into the `/public`
|
|
42
|
+
// folder so that it's gitignored.
|
|
43
|
+
// As a result, we need to make sure to point the URI path to the correct location.
|
|
44
|
+
server.middlewares.use((req, _res, next) => {
|
|
45
|
+
if (req.url === '/index.html') {
|
|
46
|
+
req.url = '/public/index.html';
|
|
47
|
+
}
|
|
48
|
+
next();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Handle auth routes for internal local development.
|
|
52
|
+
server.middlewares.use(mcDevAuthentication.createMcDevAuthenticationMiddleware(applicationConfig));
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* @type {import('vite').IndexHtmlTransformHook}
|
|
57
|
+
*/
|
|
58
|
+
transformIndexHtml(rawHtml, _ctx) {
|
|
59
|
+
const compiledHeaders = mcHtmlTemplate.processHeaders(applicationConfig);
|
|
60
|
+
const enhancedLocalEnv = _Object$assign__default["default"]({}, applicationConfig.env,
|
|
61
|
+
// 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
|
+
} : {});
|
|
69
|
+
|
|
70
|
+
// Resolve the placeholders of the `index.html` (template) file, before serving it.
|
|
71
|
+
const html = mcHtmlTemplate.replaceHtmlPlaceholders(rawHtml, {
|
|
72
|
+
env: enhancedLocalEnv,
|
|
73
|
+
headers: compiledHeaders
|
|
74
|
+
});
|
|
75
|
+
return html;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
async function run() {
|
|
81
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
82
|
+
|
|
83
|
+
// Load the Merchant Center customization config file first.
|
|
84
|
+
const applicationConfig$1 = applicationConfig.processConfig();
|
|
85
|
+
|
|
86
|
+
// Ensure the `/public` folder exists.
|
|
87
|
+
fs__default["default"].mkdirSync(paths.paths.appBuild, {
|
|
88
|
+
recursive: true
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Generate `index.html` (template).
|
|
92
|
+
const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
|
|
93
|
+
const html = mcHtmlTemplate.generateTemplate({
|
|
94
|
+
// Define the module entry point (path relative to the `/public` folder).
|
|
95
|
+
// NOTE: that this is different from the production configuration.
|
|
96
|
+
scriptImports: [`<script type="module" src="/../${appEntryPoint}" defer></script>`]
|
|
97
|
+
});
|
|
98
|
+
// Write `index.html` (template) into the `/public` folder.
|
|
99
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
100
|
+
encoding: 'utf8'
|
|
101
|
+
});
|
|
102
|
+
const server = await vite.createServer({
|
|
103
|
+
root: paths.paths.appRoot,
|
|
104
|
+
define: {
|
|
105
|
+
'process.env.DEBUG': _JSON$stringify__default["default"](false),
|
|
106
|
+
'process.env.NODE_ENV': _JSON$stringify__default["default"]('development')
|
|
107
|
+
},
|
|
108
|
+
server: {
|
|
109
|
+
port: DEFAULT_PORT
|
|
110
|
+
},
|
|
111
|
+
plugins: [pluginGraphql__default["default"](), pluginReact__default["default"](), vitePluginSvgr.vitePluginSvgr(), vitePluginCustomApplication(applicationConfig$1)]
|
|
112
|
+
});
|
|
113
|
+
await server.listen();
|
|
114
|
+
|
|
115
|
+
// Copy public assets to `/public` folder (even in development).
|
|
116
|
+
fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
|
|
117
|
+
dereference: true
|
|
118
|
+
});
|
|
119
|
+
server.printUrls();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
exports["default"] = run;
|