@commercetools-frontend/mc-scripts 0.0.0-CRAFT-1791-20251006162610
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.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.dev.js +199 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +199 -0
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +184 -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-2a0a18bd.esm.js +155 -0
- package/dist/build-521f3f9f.cjs.prod.js +169 -0
- package/dist/build-988fc0f7.cjs.dev.js +169 -0
- package/dist/build-vite-16b1a575.cjs.dev.js +238 -0
- package/dist/build-vite-59e1f185.esm.js +208 -0
- package/dist/build-vite-5d317720.cjs.prod.js +238 -0
- package/dist/commercetools-frontend-mc-scripts.cjs.d.ts +2 -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-70a16916.cjs.dev.js +852 -0
- package/dist/config-sync-72c20d80.cjs.prod.js +846 -0
- package/dist/config-sync-bc895390.esm.js +830 -0
- package/dist/create-postcss-config-cb7be312.cjs.dev.js +81 -0
- package/dist/create-postcss-config-dde0ccf1.esm.js +75 -0
- package/dist/create-postcss-config-edca0c33.cjs.prod.js +81 -0
- package/dist/create-webpack-config-for-development-1aed1cc0.cjs.prod.js +465 -0
- package/dist/create-webpack-config-for-development-a95f3634.esm.js +440 -0
- package/dist/create-webpack-config-for-development-d003697b.cjs.dev.js +465 -0
- package/dist/create-webpack-config-for-production-15fbe7db.cjs.dev.js +523 -0
- package/dist/create-webpack-config-for-production-764c482f.cjs.prod.js +523 -0
- package/dist/create-webpack-config-for-production-9f42c336.esm.js +493 -0
- package/dist/credentials-storage-66c1e51f.cjs.prod.js +95 -0
- package/dist/credentials-storage-d001f726.esm.js +83 -0
- package/dist/credentials-storage-e7884d17.cjs.dev.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/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/vendors-to-transpile.d.ts +2 -0
- package/dist/declarations/src/deprecated-entry-points.d.ts +7 -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 +94 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations/src/webpack-loaders/i18n-message-compilation-loader.d.ts +3 -0
- package/dist/declarations/src/webpack.d.ts +2 -0
- package/dist/deployment-previews-set-17e8ed48.cjs.prod.js +202 -0
- package/dist/deployment-previews-set-3648972f.esm.js +191 -0
- package/dist/deployment-previews-set-37aef990.cjs.dev.js +202 -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-6a47ad5b.esm.js +247 -0
- package/dist/graphql-requests-779b867b.cjs.dev.js +270 -0
- package/dist/graphql-requests-8086eba7.cjs.prod.js +270 -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-0a728449.esm.js +229 -0
- package/dist/login-817a5a26.cjs.dev.js +270 -0
- package/dist/login-85c25393.cjs.prod.js +270 -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-7e170dc4.cjs.dev.js +160 -0
- package/dist/package-940b0a2a.cjs.prod.js +160 -0
- package/dist/package-99e547a7.esm.js +158 -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-1036c2de.esm.js +55 -0
- package/dist/serve-50d33f0b.cjs.dev.js +64 -0
- package/dist/serve-8a506da6.cjs.prod.js +64 -0
- package/dist/start-1d677ad8.cjs.dev.js +177 -0
- package/dist/start-2a7ae03d.esm.js +164 -0
- package/dist/start-f56cb5f7.cjs.prod.js +177 -0
- package/dist/start-vite-068e9f73.cjs.dev.js +128 -0
- package/dist/start-vite-29078b3a.cjs.prod.js +128 -0
- package/dist/start-vite-7d1161e8.esm.js +116 -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-4034a834.cjs.prod.js +151 -0
- package/dist/vite-plugin-svgr-7d06f400.cjs.dev.js +151 -0
- package/dist/vite-plugin-svgr-de6ee7da.esm.js +125 -0
- package/package.json +156 -0
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.d.ts +2 -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.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.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,238 @@
|
|
|
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 _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var pluginGraphql = require('@rollup/plugin-graphql');
|
|
8
|
+
var pluginReact = require('@vitejs/plugin-react');
|
|
9
|
+
var fs = require('fs-extra');
|
|
10
|
+
var rollupPluginVisualizer = require('rollup-plugin-visualizer');
|
|
11
|
+
var vite = require('vite');
|
|
12
|
+
var viteBundleAnalyzer = require('vite-bundle-analyzer');
|
|
13
|
+
var assets = require('@commercetools-frontend/assets');
|
|
14
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
15
|
+
var optimizations = require('./optimizations-fb93514f.cjs.prod.js');
|
|
16
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
17
|
+
var cliLib = require('@formatjs/cli-lib');
|
|
18
|
+
var pluginutils = require('@rollup/pluginutils');
|
|
19
|
+
var i18nMessageComplilation = require('./i18n-message-complilation-7762da61.cjs.prod.js');
|
|
20
|
+
var vitePluginSvgr = require('./vite-plugin-svgr-4034a834.cjs.prod.js');
|
|
21
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
22
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
29
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
30
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
31
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
32
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
33
|
+
require('chalk');
|
|
34
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
35
|
+
require('fs');
|
|
36
|
+
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
37
|
+
require('node:fs');
|
|
38
|
+
require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
39
|
+
require('crypto');
|
|
40
|
+
require('@babel/runtime-corejs3/core-js/instance/match-all');
|
|
41
|
+
|
|
42
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
43
|
+
|
|
44
|
+
function _interopNamespace(e) {
|
|
45
|
+
if (e && e.__esModule) return e;
|
|
46
|
+
var n = Object.create(null);
|
|
47
|
+
if (e) {
|
|
48
|
+
Object.keys(e).forEach(function (k) {
|
|
49
|
+
if (k !== 'default') {
|
|
50
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
51
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return e[k]; }
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
n["default"] = e;
|
|
59
|
+
return Object.freeze(n);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var _parseInt__default = /*#__PURE__*/_interopDefault(_parseInt);
|
|
63
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
64
|
+
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
65
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
66
|
+
var pluginGraphql__default = /*#__PURE__*/_interopDefault(pluginGraphql);
|
|
67
|
+
var pluginReact__default = /*#__PURE__*/_interopDefault(pluginReact);
|
|
68
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
69
|
+
|
|
70
|
+
// Type guard to help with filtering arrays for nullish elements.
|
|
71
|
+
function nonNullable(value) {
|
|
72
|
+
return value !== null && value !== undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// This script/function is injected into the `index.html` and used by Vite
|
|
76
|
+
// on runtime to build the assets URL (for example when using a separate CDN for the assets).
|
|
77
|
+
// Inspired by https://github.com/vitejs/vite/blob/main/playground/assets/vite.config-runtime-base.js
|
|
78
|
+
const dynamicBaseAssetsCode = `globalThis.__toCdnUrl = filePath => window.app.cdnUrl.replace(/\\/$/, '') + '/' + filePath;`;
|
|
79
|
+
function vitePluginDynamicBaseAssetsGlobals() {
|
|
80
|
+
return {
|
|
81
|
+
name: 'dynamic-base-assets-globals',
|
|
82
|
+
transformIndexHtml(html, ctx) {
|
|
83
|
+
if (ctx.bundle) {
|
|
84
|
+
// Only inject during build
|
|
85
|
+
return [{
|
|
86
|
+
tag: 'script',
|
|
87
|
+
attrs: {
|
|
88
|
+
type: 'module'
|
|
89
|
+
},
|
|
90
|
+
children: dynamicBaseAssetsCode
|
|
91
|
+
}];
|
|
92
|
+
}
|
|
93
|
+
return html;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function vitePluginI18nMessageCompilation() {
|
|
99
|
+
const filter = pluginutils.createFilter('**/i18n/data/*.json');
|
|
100
|
+
return {
|
|
101
|
+
name: 'vite-plugin-i18n-message-compilation',
|
|
102
|
+
enforce: 'pre',
|
|
103
|
+
async transform(code, id) {
|
|
104
|
+
if (!process.env.DISABLE_I18N_MESSAGE_COMPILATION && filter(id)) {
|
|
105
|
+
try {
|
|
106
|
+
const format = i18nMessageComplilation.getI18nMessageFormat(code);
|
|
107
|
+
const res = await cliLib.compile([id], {
|
|
108
|
+
ast: true,
|
|
109
|
+
format
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
code: res,
|
|
113
|
+
map: null
|
|
114
|
+
};
|
|
115
|
+
} catch (error) {
|
|
116
|
+
i18nMessageComplilation.handleMessageCompilationError(id, error, this.warn);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function run() {
|
|
125
|
+
var _context;
|
|
126
|
+
const CleanBuild = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('vite-plugin-clean-build')); })).default;
|
|
127
|
+
const DEFAULT_PORT = _parseInt__default["default"](String(process.env.HTTP_PORT), 10) || 3001;
|
|
128
|
+
|
|
129
|
+
// Ensure the `/public` folder exists.
|
|
130
|
+
fs__default["default"].mkdirSync(paths.paths.appBuild, {
|
|
131
|
+
recursive: true
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Generate `index.html` (template).
|
|
135
|
+
const appEntryPoint = path__default["default"].relative(paths.paths.appRoot, paths.paths.entryPoint);
|
|
136
|
+
const html = mcHtmlTemplate.generateTemplate({
|
|
137
|
+
// Define the module entry point (path relative from the `/public` folder).
|
|
138
|
+
// NOTE: that this is different from the development configuration.
|
|
139
|
+
scriptImports: [`<script type="module" src="/${appEntryPoint}" defer></script>`]
|
|
140
|
+
});
|
|
141
|
+
// Write `index.html` (template) into the `/public` folder.
|
|
142
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, html, {
|
|
143
|
+
encoding: 'utf8'
|
|
144
|
+
});
|
|
145
|
+
const appDependencies = require(paths.paths.appPackageJson).dependencies;
|
|
146
|
+
await vite.build({
|
|
147
|
+
root: paths.paths.appRoot,
|
|
148
|
+
base: './',
|
|
149
|
+
// <-- Important to allow configuring the runtime base path.
|
|
150
|
+
define: {
|
|
151
|
+
'process.env.DEBUG': _JSON$stringify__default["default"](false),
|
|
152
|
+
'process.env.NODE_ENV': _JSON$stringify__default["default"]('production')
|
|
153
|
+
},
|
|
154
|
+
build: {
|
|
155
|
+
outDir: 'public',
|
|
156
|
+
// Outputs all build assets directly under the `/public` folder.
|
|
157
|
+
assetsDir: '',
|
|
158
|
+
rollupOptions: {
|
|
159
|
+
// This is necessary to instruct Vite that the `index.html` (template)
|
|
160
|
+
// is located in the `/public` folder.
|
|
161
|
+
// NOTE that after the build, Vite will write the `index.html` (template)
|
|
162
|
+
// at the `/public/public/index.html` location. See `fs.renameSync` below.
|
|
163
|
+
input: paths.paths.appIndexHtml,
|
|
164
|
+
output: {
|
|
165
|
+
manualChunks: optimizations.getViteCacheGroups(appDependencies)
|
|
166
|
+
},
|
|
167
|
+
// Reduce the memory footprint when building sourcemaps.
|
|
168
|
+
// https://github.com/vitejs/vite/issues/2433#issuecomment-1361094727
|
|
169
|
+
cache: false
|
|
170
|
+
},
|
|
171
|
+
sourcemap:
|
|
172
|
+
// Generating sourcemaps can increase the memory footprint of the build process,
|
|
173
|
+
// therefore it's an opt-in option.
|
|
174
|
+
// TODO: make it a CLI option when Vite support becomes stable.
|
|
175
|
+
process.env.ENABLE_EXPERIMENTAL_VITE_BUNDLER_SOURCEMAP === 'true'
|
|
176
|
+
},
|
|
177
|
+
server: {
|
|
178
|
+
port: DEFAULT_PORT
|
|
179
|
+
},
|
|
180
|
+
experimental: {
|
|
181
|
+
// https://vitejs.dev/guide/build.html#advanced-base-options
|
|
182
|
+
renderBuiltUrl(filename, _ref) {
|
|
183
|
+
let hostType = _ref.hostType;
|
|
184
|
+
if (hostType === 'html') {
|
|
185
|
+
return `__CDN_URL__${filename}`;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
runtime: `window.__toCdnUrl(${_JSON$stringify__default["default"](filename)})`
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
plugins: [vitePluginSvgr.vitePluginSvgr(), pluginGraphql__default["default"](), pluginReact__default["default"]({
|
|
193
|
+
jsxImportSource: '@emotion/react',
|
|
194
|
+
babel: {
|
|
195
|
+
plugins: _filterInstanceProperty__default["default"](_context = ['@emotion/babel-plugin', '@babel/plugin-proposal-do-expressions', process.env.ENABLE_BABEL_PLUGIN_FORMATJS === 'true' ? ['babel-plugin-formatjs', {
|
|
196
|
+
removeDefaultMessage:
|
|
197
|
+
// Remove default `formatjs` messages from bundles.
|
|
198
|
+
// TODO: make it a CLI option when Vite support becomes stable.
|
|
199
|
+
process.env.ENABLE_I18N_REMOVE_DEFAULT_MESSAGE === 'true',
|
|
200
|
+
ast:
|
|
201
|
+
// Enable pre-parse default `formatjs` messages into AST.
|
|
202
|
+
// TODO: make it a CLI option when Vite support becomes stable.
|
|
203
|
+
process.env.ENABLE_I18N_AST === 'true'
|
|
204
|
+
}] : undefined]).call(_context, nonNullable)
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
// cleanbuild is needed to remove large svg assets
|
|
208
|
+
// that are not used after the build.
|
|
209
|
+
CleanBuild({
|
|
210
|
+
outputDir: paths.paths.appBuild,
|
|
211
|
+
patterns: ['*.react-*.svg'],
|
|
212
|
+
verbose: true // logs the files that are removed
|
|
213
|
+
}), vitePluginDynamicBaseAssetsGlobals(), vitePluginI18nMessageCompilation(), process.env.ANALYZE_BUNDLE === 'true' && viteBundleAnalyzer.analyzer({
|
|
214
|
+
defaultSizes: 'stat',
|
|
215
|
+
openAnalyzer: true
|
|
216
|
+
}), process.env.ANALYZE_BUNDLE_TREE === 'true' && rollupPluginVisualizer.visualizer({
|
|
217
|
+
open: true,
|
|
218
|
+
template: 'network'
|
|
219
|
+
})]
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Rename `/public/public/index.html` to `/public/index.html.template`
|
|
223
|
+
fs__default["default"].renameSync(
|
|
224
|
+
// Because of our custom entry point path (`/public/index.html`),
|
|
225
|
+
// Vite will write the `index.html` to `/public/public/index.html`.
|
|
226
|
+
// We need to move this file to the `/public` folder and rename it
|
|
227
|
+
// to `index.html.template` (as expected by the `compile-html` command).
|
|
228
|
+
path__default["default"].join(paths.paths.appBuild, 'public/index.html'), paths.paths.appIndexHtmlTemplate);
|
|
229
|
+
// Clean up nested folder
|
|
230
|
+
fs__default["default"].rmdirSync(path__default["default"].join(paths.paths.appBuild, 'public'));
|
|
231
|
+
|
|
232
|
+
// Copy public assets
|
|
233
|
+
fs__default["default"].copySync(path__default["default"].join(assets.packageLocation, 'html-page'), paths.paths.appBuild, {
|
|
234
|
+
dereference: true
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1tYy1zY3JpcHRzLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vendorsToTranspile = require('./vendors-to-transpile-6ab4ea06.cjs.dev.js');
|
|
6
|
+
|
|
7
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
8
|
+
var version = "24.7.2";
|
|
9
|
+
|
|
10
|
+
// These exports are deprecated.
|
|
11
|
+
|
|
12
|
+
function createWebpackConfigForDevelopment(options) {
|
|
13
|
+
console.log('Importing the function "createWebpackConfigForDevelopment" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
14
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForDevelopment(options);
|
|
15
|
+
}
|
|
16
|
+
function createWebpackConfigForProduction(options) {
|
|
17
|
+
console.log('Importing the function "createWebpackConfigForProduction" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
18
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForProduction(options);
|
|
19
|
+
}
|
|
20
|
+
function createPostcssConfig(options) {
|
|
21
|
+
console.log('Importing the function "createPostcssConfig" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-postcss-config" instead.');
|
|
22
|
+
return require('@commercetools-frontend/mc-scripts/postcss').createPostcssConfig(options);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.vendorsToTranspile = vendorsToTranspile.vendorsToTranspile;
|
|
26
|
+
exports.createPostcssConfig = createPostcssConfig;
|
|
27
|
+
exports.createWebpackConfigForDevelopment = createWebpackConfigForDevelopment;
|
|
28
|
+
exports.createWebpackConfigForProduction = createWebpackConfigForProduction;
|
|
29
|
+
exports.version = version;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vendorsToTranspile = require('./vendors-to-transpile-04a49d40.cjs.prod.js');
|
|
6
|
+
|
|
7
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
8
|
+
var version = "24.7.2";
|
|
9
|
+
|
|
10
|
+
// These exports are deprecated.
|
|
11
|
+
|
|
12
|
+
function createWebpackConfigForDevelopment(options) {
|
|
13
|
+
console.log('Importing the function "createWebpackConfigForDevelopment" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
14
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForDevelopment(options);
|
|
15
|
+
}
|
|
16
|
+
function createWebpackConfigForProduction(options) {
|
|
17
|
+
console.log('Importing the function "createWebpackConfigForProduction" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
18
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForProduction(options);
|
|
19
|
+
}
|
|
20
|
+
function createPostcssConfig(options) {
|
|
21
|
+
console.log('Importing the function "createPostcssConfig" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-postcss-config" instead.');
|
|
22
|
+
return require('@commercetools-frontend/mc-scripts/postcss').createPostcssConfig(options);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.vendorsToTranspile = vendorsToTranspile.vendorsToTranspile;
|
|
26
|
+
exports.createPostcssConfig = createPostcssConfig;
|
|
27
|
+
exports.createWebpackConfigForDevelopment = createWebpackConfigForDevelopment;
|
|
28
|
+
exports.createWebpackConfigForProduction = createWebpackConfigForProduction;
|
|
29
|
+
exports.version = version;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { v as vendorsToTranspile } from './vendors-to-transpile-7dc84a72.esm.js';
|
|
2
|
+
|
|
3
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
4
|
+
var version = "24.7.2";
|
|
5
|
+
|
|
6
|
+
// These exports are deprecated.
|
|
7
|
+
|
|
8
|
+
function createWebpackConfigForDevelopment(options) {
|
|
9
|
+
console.log('Importing the function "createWebpackConfigForDevelopment" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
10
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForDevelopment(options);
|
|
11
|
+
}
|
|
12
|
+
function createWebpackConfigForProduction(options) {
|
|
13
|
+
console.log('Importing the function "createWebpackConfigForProduction" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-webpack-config" instead.');
|
|
14
|
+
return require('@commercetools-frontend/mc-scripts/webpack').createWebpackConfigForProduction(options);
|
|
15
|
+
}
|
|
16
|
+
function createPostcssConfig(options) {
|
|
17
|
+
console.log('Importing the function "createPostcssConfig" from the main entry point "@commercetools-frontend/mc-scripts" is deprecated. Use the entry point "@commercetools-frontend/mc-scripts/create-postcss-config" instead.');
|
|
18
|
+
return require('@commercetools-frontend/mc-scripts/postcss').createPostcssConfig(options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { createPostcssConfig, createWebpackConfigForDevelopment, createWebpackConfigForProduction, version };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { compileHtml } from '@commercetools-frontend/mc-html-template';
|
|
5
|
+
import { p as paths } from './paths-39f22b8b.esm.js';
|
|
6
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
7
|
+
import 'path';
|
|
8
|
+
import './does-file-exist-32618334.esm.js';
|
|
9
|
+
import 'node:fs';
|
|
10
|
+
|
|
11
|
+
const appDirectory = fs.realpathSync(process.cwd());
|
|
12
|
+
async function run(options) {
|
|
13
|
+
console.log('Compiling index.html...');
|
|
14
|
+
const compiled = await compileHtml(paths.appIndexHtmlTemplate);
|
|
15
|
+
fs.writeFileSync(paths.appIndexHtml, compiled.indexHtmlContent, {
|
|
16
|
+
encoding: 'utf8'
|
|
17
|
+
});
|
|
18
|
+
if (options.transformer) {
|
|
19
|
+
try {
|
|
20
|
+
const transformerPath = require.resolve(options.transformer, {
|
|
21
|
+
paths: [appDirectory]
|
|
22
|
+
});
|
|
23
|
+
const transformerFn = require(transformerPath);
|
|
24
|
+
transformerFn(compiled);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw new Error(`Could not load transformer module "${options.transformer}"\n${error instanceof Error ? error.stack : ''}`);
|
|
27
|
+
}
|
|
28
|
+
} else if (options.printSecurityHeaders) {
|
|
29
|
+
console.log(_JSON$stringify(compiled.headers));
|
|
30
|
+
}
|
|
31
|
+
console.log(chalk.green('Compiled successfully.\n'));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { run as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
7
|
+
var paths = require('./paths-7768b440.cjs.prod.js');
|
|
8
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
+
require('path');
|
|
10
|
+
require('./does-file-exist-be53305d.cjs.prod.js');
|
|
11
|
+
require('node:fs');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
16
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
17
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
18
|
+
|
|
19
|
+
const appDirectory = fs__default["default"].realpathSync(process.cwd());
|
|
20
|
+
async function run(options) {
|
|
21
|
+
console.log('Compiling index.html...');
|
|
22
|
+
const compiled = await mcHtmlTemplate.compileHtml(paths.paths.appIndexHtmlTemplate);
|
|
23
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, compiled.indexHtmlContent, {
|
|
24
|
+
encoding: 'utf8'
|
|
25
|
+
});
|
|
26
|
+
if (options.transformer) {
|
|
27
|
+
try {
|
|
28
|
+
const transformerPath = require.resolve(options.transformer, {
|
|
29
|
+
paths: [appDirectory]
|
|
30
|
+
});
|
|
31
|
+
const transformerFn = require(transformerPath);
|
|
32
|
+
transformerFn(compiled);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
throw new Error(`Could not load transformer module "${options.transformer}"\n${error instanceof Error ? error.stack : ''}`);
|
|
35
|
+
}
|
|
36
|
+
} else if (options.printSecurityHeaders) {
|
|
37
|
+
console.log(_JSON$stringify__default["default"](compiled.headers));
|
|
38
|
+
}
|
|
39
|
+
console.log(chalk__default["default"].green('Compiled successfully.\n'));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports["default"] = run;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var chalk = require('chalk');
|
|
6
|
+
var mcHtmlTemplate = require('@commercetools-frontend/mc-html-template');
|
|
7
|
+
var paths = require('./paths-b76fc753.cjs.dev.js');
|
|
8
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
9
|
+
require('path');
|
|
10
|
+
require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
11
|
+
require('node:fs');
|
|
12
|
+
|
|
13
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
16
|
+
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
17
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
18
|
+
|
|
19
|
+
const appDirectory = fs__default["default"].realpathSync(process.cwd());
|
|
20
|
+
async function run(options) {
|
|
21
|
+
console.log('Compiling index.html...');
|
|
22
|
+
const compiled = await mcHtmlTemplate.compileHtml(paths.paths.appIndexHtmlTemplate);
|
|
23
|
+
fs__default["default"].writeFileSync(paths.paths.appIndexHtml, compiled.indexHtmlContent, {
|
|
24
|
+
encoding: 'utf8'
|
|
25
|
+
});
|
|
26
|
+
if (options.transformer) {
|
|
27
|
+
try {
|
|
28
|
+
const transformerPath = require.resolve(options.transformer, {
|
|
29
|
+
paths: [appDirectory]
|
|
30
|
+
});
|
|
31
|
+
const transformerFn = require(transformerPath);
|
|
32
|
+
transformerFn(compiled);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
throw new Error(`Could not load transformer module "${options.transformer}"\n${error instanceof Error ? error.stack : ''}`);
|
|
35
|
+
}
|
|
36
|
+
} else if (options.printSecurityHeaders) {
|
|
37
|
+
console.log(_JSON$stringify__default["default"](compiled.headers));
|
|
38
|
+
}
|
|
39
|
+
console.log(chalk__default["default"].green('Compiled successfully.\n'));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports["default"] = run;
|