@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,7 +1,7 @@
|
|
|
1
1
|
import _Promise from '@babel/runtime-corejs3/core-js-stable/promise';
|
|
2
2
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
3
3
|
import _startsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
4
|
-
import
|
|
4
|
+
import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
|
|
5
5
|
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
6
6
|
import _flatMapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat-map';
|
|
7
7
|
import _setTimeout from '@babel/runtime-corejs3/core-js-stable/set-timeout';
|
|
@@ -13,10 +13,10 @@ import crypto from 'node:crypto';
|
|
|
13
13
|
import process, { exit } from 'node:process';
|
|
14
14
|
import chalk from 'chalk';
|
|
15
15
|
import { processConfig } from '@commercetools-frontend/application-config';
|
|
16
|
-
import { p as pkgJson } from './package-
|
|
16
|
+
import { p as pkgJson } from './package-76b6a39c.esm.js';
|
|
17
17
|
import http from 'node:http';
|
|
18
18
|
import { jwtDecode } from 'jwt-decode';
|
|
19
|
-
import { C as CredentialsStorage } from './credentials-storage-
|
|
19
|
+
import { C as CredentialsStorage } from './credentials-storage-67deadc3.esm.js';
|
|
20
20
|
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
21
21
|
import '@babel/runtime-corejs3/helpers/createClass';
|
|
22
22
|
import '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
@@ -28,8 +28,8 @@ import './does-file-exist-32618334.esm.js';
|
|
|
28
28
|
function createAuthCallbackServer(options) {
|
|
29
29
|
const server = http.createServer(async (request, response) => {
|
|
30
30
|
try {
|
|
31
|
-
var
|
|
32
|
-
if ((
|
|
31
|
+
var _context, _context2;
|
|
32
|
+
if (((_context = request.url) == null ? void 0 : _bindInstanceProperty(_context2 = Function.call).call(_context2, _includesInstanceProperty(_context), _context))?.(`/${options.clientIdentifier}/oidc/callback`)) {
|
|
33
33
|
const incomingUrl = new _URL(request.url, 'http://localhost');
|
|
34
34
|
const sessionToken = incomingUrl.searchParams.get('sessionToken');
|
|
35
35
|
const requestedState = incomingUrl.searchParams.get('state');
|
|
@@ -37,7 +37,7 @@ function createAuthCallbackServer(options) {
|
|
|
37
37
|
throw new Error('Invalid authentication flow (missing sessionToken)');
|
|
38
38
|
}
|
|
39
39
|
const decodedSessionToken = jwtDecode(sessionToken);
|
|
40
|
-
if (
|
|
40
|
+
if (decodedSessionToken?.nonce !== options.nonce) {
|
|
41
41
|
throw new Error('Invalid authentication flow (nonce mismatch)');
|
|
42
42
|
}
|
|
43
43
|
if (requestedState !== options.state) {
|
|
@@ -60,7 +60,7 @@ function createAuthCallbackServer(options) {
|
|
|
60
60
|
response.end(error.message);
|
|
61
61
|
} else {
|
|
62
62
|
console.error(error);
|
|
63
|
-
response.end(
|
|
63
|
+
response.end(`Invalid authentication flow.`);
|
|
64
64
|
}
|
|
65
65
|
server.close(() => {
|
|
66
66
|
exit();
|
|
@@ -72,14 +72,14 @@ function createAuthCallbackServer(options) {
|
|
|
72
72
|
|
|
73
73
|
const credentialsStorage = new CredentialsStorage();
|
|
74
74
|
const port = 3001;
|
|
75
|
-
const clientIdentifier =
|
|
75
|
+
const clientIdentifier = `mc-scripts-${pkgJson.version}`;
|
|
76
76
|
const isServerError = error => {
|
|
77
77
|
return error instanceof Error && 'code' in error;
|
|
78
78
|
};
|
|
79
79
|
const startServer = server => new _Promise((resolve, reject) => {
|
|
80
80
|
server.listen(port, 'localhost').on('listening', resolve).on('error', error => {
|
|
81
81
|
if (isServerError(error) && error.code === 'EADDRINUSE') {
|
|
82
|
-
return reject(new Error(
|
|
82
|
+
return reject(new Error(`The address "localhost:${port}" is already in use. Are you running a Merchant Center application in other process? Please stop that and try again.`, {
|
|
83
83
|
cause: error
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
@@ -115,9 +115,8 @@ const resolveProjectKey = async options => {
|
|
|
115
115
|
return process.env.CTP_PROJECT_KEY;
|
|
116
116
|
}
|
|
117
117
|
try {
|
|
118
|
-
var _applicationConfig$en;
|
|
119
118
|
const applicationConfig = await processConfig();
|
|
120
|
-
return
|
|
119
|
+
return applicationConfig.env.__DEVELOPMENT__?.oidc?.initialProjectKey;
|
|
121
120
|
} catch (error) {
|
|
122
121
|
// It's ok if there's not application config file or if it does not contain the initialProjectKey
|
|
123
122
|
return;
|
|
@@ -126,10 +125,10 @@ const resolveProjectKey = async options => {
|
|
|
126
125
|
const mapOAuthScopesToClaims = scopes => {
|
|
127
126
|
return _mapInstanceProperty(scopes).call(scopes, scope => {
|
|
128
127
|
if (_startsWithInstanceProperty(scope).call(scope, 'view_')) {
|
|
129
|
-
return
|
|
128
|
+
return `view:${scope}`;
|
|
130
129
|
}
|
|
131
130
|
if (_startsWithInstanceProperty(scope).call(scope, 'manage_')) {
|
|
132
|
-
return
|
|
131
|
+
return `manage:${scope}`;
|
|
133
132
|
}
|
|
134
133
|
return scope;
|
|
135
134
|
});
|
|
@@ -137,12 +136,10 @@ const mapOAuthScopesToClaims = scopes => {
|
|
|
137
136
|
const mapAdditionalOAuthScopesToClaims = (name, scopes) => {
|
|
138
137
|
return _mapInstanceProperty(scopes).call(scopes, scope => {
|
|
139
138
|
if (_startsWithInstanceProperty(scope).call(scope, 'view_')) {
|
|
140
|
-
|
|
141
|
-
return _concatInstanceProperty(_context = "view/".concat(name, ":")).call(_context, scope);
|
|
139
|
+
return `view/${name}:${scope}`;
|
|
142
140
|
}
|
|
143
141
|
if (_startsWithInstanceProperty(scope).call(scope, 'manage_')) {
|
|
144
|
-
|
|
145
|
-
return _concatInstanceProperty(_context2 = "manage/".concat(name, ":")).call(_context2, scope);
|
|
142
|
+
return `manage/${name}:${scope}`;
|
|
146
143
|
}
|
|
147
144
|
return scope;
|
|
148
145
|
});
|
|
@@ -154,15 +151,15 @@ const resolveOAuthScopes = async options => {
|
|
|
154
151
|
|
|
155
152
|
// We first check whether the user has set the CTP_OAUTH_SCOPES environment variable
|
|
156
153
|
if (process.env.CTP_OAUTH_SCOPES) {
|
|
157
|
-
var
|
|
158
|
-
return mapOAuthScopesToClaims((
|
|
154
|
+
var _context, _context2;
|
|
155
|
+
return mapOAuthScopesToClaims(((_context = process.env.CTP_OAUTH_SCOPES?.split(',')) == null ? void 0 : _bindInstanceProperty(_context2 = Function.call).call(_context2, _mapInstanceProperty(_context), _context))?.(scope => _trimInstanceProperty(scope).call(scope)) ?? []);
|
|
159
156
|
}
|
|
160
157
|
try {
|
|
161
|
-
var
|
|
158
|
+
var _context3, _context4, _context5, _context6;
|
|
162
159
|
const applicationConfig = await processConfig();
|
|
163
|
-
const configuredOAuthScopes =
|
|
164
|
-
const configuredAdditionalOAuthScopes =
|
|
165
|
-
return [...mapOAuthScopesToClaims(
|
|
160
|
+
const configuredOAuthScopes = applicationConfig.env.__DEVELOPMENT__?.oidc?.oAuthScopes;
|
|
161
|
+
const configuredAdditionalOAuthScopes = applicationConfig.env.__DEVELOPMENT__?.oidc?.additionalOAuthScopes;
|
|
162
|
+
return [...mapOAuthScopesToClaims(configuredOAuthScopes?.view ?? []), ...mapOAuthScopesToClaims(configuredOAuthScopes?.manage ?? []), ...(((_context3 = configuredAdditionalOAuthScopes) == null ? void 0 : _bindInstanceProperty(_context4 = Function.call).call(_context4, _flatMapInstanceProperty(_context3), _context3))?.(scope => mapAdditionalOAuthScopesToClaims(scope.name, scope.view)) ?? []), ...(((_context5 = configuredAdditionalOAuthScopes) == null ? void 0 : _bindInstanceProperty(_context6 = Function.call).call(_context6, _flatMapInstanceProperty(_context5), _context5))?.(scope => mapAdditionalOAuthScopesToClaims(scope.name, scope.manage)) ?? [])];
|
|
166
163
|
} catch (error) {
|
|
167
164
|
// It's ok if there's not application config file or if it does not contain the initialProjectKey
|
|
168
165
|
return [];
|
|
@@ -186,7 +183,7 @@ async function runHeadlessLogin(authUrl) {
|
|
|
186
183
|
let puppeteer;
|
|
187
184
|
try {
|
|
188
185
|
puppeteer = await import('puppeteer');
|
|
189
|
-
} catch
|
|
186
|
+
} catch {
|
|
190
187
|
throw new Error('Puppeteer is required for headless login. Install it with: npm install puppeteer');
|
|
191
188
|
}
|
|
192
189
|
const browser = await puppeteer.default.launch({
|
|
@@ -207,9 +204,17 @@ async function runHeadlessLogin(authUrl) {
|
|
|
207
204
|
// Dismiss cookie banner if present
|
|
208
205
|
// Note: Using string-based evaluate to avoid bundler transforming Array.from
|
|
209
206
|
try {
|
|
210
|
-
await page.evaluate(
|
|
207
|
+
await page.evaluate(`
|
|
208
|
+
(function() {
|
|
209
|
+
var buttons = Array.from(document.querySelectorAll('button'));
|
|
210
|
+
var acceptBtn = buttons.find(function(btn) {
|
|
211
|
+
return btn.textContent && btn.textContent.includes('Accept all cookies');
|
|
212
|
+
});
|
|
213
|
+
if (acceptBtn) acceptBtn.click();
|
|
214
|
+
})()
|
|
215
|
+
`);
|
|
211
216
|
await new _Promise(resolve => _setTimeout(resolve, 500));
|
|
212
|
-
} catch
|
|
217
|
+
} catch {
|
|
213
218
|
// Cookie banner not found or already dismissed
|
|
214
219
|
}
|
|
215
220
|
|
|
@@ -218,7 +223,15 @@ async function runHeadlessLogin(authUrl) {
|
|
|
218
223
|
await new _Promise(resolve => _setTimeout(resolve, 500));
|
|
219
224
|
|
|
220
225
|
// Click "Next" button
|
|
221
|
-
await page.evaluate(
|
|
226
|
+
await page.evaluate(`
|
|
227
|
+
(function() {
|
|
228
|
+
var buttons = Array.from(document.querySelectorAll('button'));
|
|
229
|
+
var nextBtn = buttons.find(function(btn) {
|
|
230
|
+
return btn.textContent && btn.textContent.toLowerCase().includes('next');
|
|
231
|
+
});
|
|
232
|
+
if (nextBtn) nextBtn.click();
|
|
233
|
+
})()
|
|
234
|
+
`);
|
|
222
235
|
|
|
223
236
|
// Wait for password field
|
|
224
237
|
await page.waitForSelector('input[name="password"]', {
|
|
@@ -231,7 +244,15 @@ async function runHeadlessLogin(authUrl) {
|
|
|
231
244
|
await new _Promise(resolve => _setTimeout(resolve, 500));
|
|
232
245
|
|
|
233
246
|
// Click "Submit" button
|
|
234
|
-
await page.evaluate(
|
|
247
|
+
await page.evaluate(`
|
|
248
|
+
(function() {
|
|
249
|
+
var buttons = Array.from(document.querySelectorAll('button'));
|
|
250
|
+
var submitBtn = buttons.find(function(btn) {
|
|
251
|
+
return btn.textContent && btn.textContent.toLowerCase().includes('submit');
|
|
252
|
+
});
|
|
253
|
+
if (submitBtn) submitBtn.click();
|
|
254
|
+
})()
|
|
255
|
+
`);
|
|
235
256
|
|
|
236
257
|
// Wait for the callback to be processed (the server will close and exit)
|
|
237
258
|
// We just need to keep the browser alive until the redirect happens
|
|
@@ -263,17 +284,17 @@ async function run(options) {
|
|
|
263
284
|
if (!mcApiUrl) {
|
|
264
285
|
throw new Error('No Merchant Center API URL found. Aborting.');
|
|
265
286
|
}
|
|
266
|
-
console.log(
|
|
287
|
+
console.log(`Using Merchant Center environment "${chalk.green(mcApiUrl)}".`);
|
|
267
288
|
console.log();
|
|
268
289
|
if (!options.force && credentialsStorage.isSessionValid(mcApiUrl)) {
|
|
269
|
-
console.log(
|
|
290
|
+
console.log(`You already have a valid session.`);
|
|
270
291
|
return;
|
|
271
292
|
}
|
|
272
293
|
const projectKey = await resolveProjectKey(options);
|
|
273
294
|
const oauthScopes = await resolveOAuthScopes(options);
|
|
274
295
|
const scopes = ['openid'];
|
|
275
296
|
if (projectKey) {
|
|
276
|
-
scopes.push(
|
|
297
|
+
scopes.push(`project_key:${projectKey}`);
|
|
277
298
|
_forEachInstanceProperty(oauthScopes).call(oauthScopes, scope => {
|
|
278
299
|
scopes.push(scope);
|
|
279
300
|
});
|
|
@@ -283,7 +304,7 @@ async function run(options) {
|
|
|
283
304
|
const authUrl = new _URL('/login/authorize', mcApiUrl);
|
|
284
305
|
authUrl.searchParams.set('response_type', 'id_token');
|
|
285
306
|
authUrl.searchParams.set('response_mode', 'query');
|
|
286
|
-
authUrl.searchParams.set('client_id',
|
|
307
|
+
authUrl.searchParams.set('client_id', `__local:${clientIdentifier}`);
|
|
287
308
|
authUrl.searchParams.set('scope', scopes.join(' '));
|
|
288
309
|
authUrl.searchParams.set('state', state);
|
|
289
310
|
authUrl.searchParams.set('nonce', nonce);
|
|
@@ -294,18 +315,18 @@ async function run(options) {
|
|
|
294
315
|
onSuccess: tokenContext => {
|
|
295
316
|
credentialsStorage.setToken(mcApiUrl, tokenContext);
|
|
296
317
|
console.log();
|
|
297
|
-
console.log(chalk.green(
|
|
318
|
+
console.log(chalk.green(`Login successful.`));
|
|
298
319
|
console.log();
|
|
299
320
|
}
|
|
300
321
|
});
|
|
301
322
|
await startServer(server);
|
|
302
323
|
if (options.headless) {
|
|
303
|
-
console.log(
|
|
324
|
+
console.log(`Initiating headless authentication flow using Puppeteer...`);
|
|
304
325
|
console.log();
|
|
305
326
|
await runHeadlessLogin(authUrl);
|
|
306
327
|
} else {
|
|
307
|
-
console.log(
|
|
308
|
-
console.log(
|
|
328
|
+
console.log(`Initiating the OIDC authentication flow, opening the login page in your browser...`);
|
|
329
|
+
console.log(` ${authUrl}`);
|
|
309
330
|
console.log();
|
|
310
331
|
const open = await import('open');
|
|
311
332
|
await open.default(authUrl.toString());
|
|
@@ -4,7 +4,6 @@ import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/insta
|
|
|
4
4
|
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
5
5
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
6
6
|
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
7
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
8
7
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
9
8
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
10
9
|
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
@@ -27,7 +26,7 @@ function hasJsxRuntime() {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
29
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
30
|
|
|
32
31
|
// Dependencies to be split/grouped into separate chunks for the Webpack build.
|
|
33
32
|
// This is useful to reduce the main bundle size and have more dedicated
|
|
@@ -55,8 +54,7 @@ const removeNonExistantDependencies = (manualChunks, appDependencies) => {
|
|
|
55
54
|
if (existingVendors.length > 0) {
|
|
56
55
|
chunkGroups[chunkName] = existingVendors;
|
|
57
56
|
} else {
|
|
58
|
-
|
|
59
|
-
console.log(chalk.yellow(_concatInstanceProperty(_context2 = "\nFiltering out chunk \"".concat(chunkName, "\" because its configured dependencies does not exist in the application: ")).call(_context2, vendors, "\n")));
|
|
57
|
+
console.log(chalk.yellow(`\nFiltering out chunk "${chunkName}" because its configured dependencies does not exist in the application: ${vendors}\n`));
|
|
60
58
|
}
|
|
61
59
|
return chunkGroups;
|
|
62
60
|
}, {});
|
|
@@ -64,15 +62,15 @@ const removeNonExistantDependencies = (manualChunks, appDependencies) => {
|
|
|
64
62
|
|
|
65
63
|
// Reference: https://webpack.js.org/plugins/split-chunks-plugin/
|
|
66
64
|
function getWepbackCacheGroups(appDependencies) {
|
|
67
|
-
var
|
|
65
|
+
var _context2;
|
|
68
66
|
const filteredDependencies = removeNonExistantDependencies(manualChunks, _Object$keys(appDependencies));
|
|
69
|
-
const result = _reduceInstanceProperty(
|
|
67
|
+
const result = _reduceInstanceProperty(_context2 = _Object$entries(filteredDependencies)).call(_context2, (previousChunks, _ref3) => {
|
|
70
68
|
let _ref4 = _slicedToArray(_ref3, 2),
|
|
71
69
|
chunkName = _ref4[0],
|
|
72
70
|
vendors = _ref4[1];
|
|
73
71
|
return _objectSpread(_objectSpread({}, previousChunks), {}, {
|
|
74
72
|
[chunkName]: {
|
|
75
|
-
test: new RegExp(
|
|
73
|
+
test: new RegExp(`[\\/]node_modules[\\/](${vendors.join('|')})[\\/]`),
|
|
76
74
|
name: chunkName,
|
|
77
75
|
chunks: 'all'
|
|
78
76
|
}
|
|
@@ -6,7 +6,6 @@ var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
6
6
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
7
7
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
8
8
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
9
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
10
9
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
11
10
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
12
11
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
@@ -22,7 +21,6 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
22
21
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
23
22
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
24
23
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
25
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
26
24
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
27
25
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
28
26
|
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
@@ -45,7 +43,7 @@ function hasJsxRuntime() {
|
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
48
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
46
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
49
47
|
|
|
50
48
|
// Dependencies to be split/grouped into separate chunks for the Webpack build.
|
|
51
49
|
// This is useful to reduce the main bundle size and have more dedicated
|
|
@@ -73,8 +71,7 @@ const removeNonExistantDependencies = (manualChunks, appDependencies) => {
|
|
|
73
71
|
if (existingVendors.length > 0) {
|
|
74
72
|
chunkGroups[chunkName] = existingVendors;
|
|
75
73
|
} else {
|
|
76
|
-
|
|
77
|
-
console.log(chalk__default["default"].yellow(_concatInstanceProperty__default["default"](_context2 = "\nFiltering out chunk \"".concat(chunkName, "\" because its configured dependencies does not exist in the application: ")).call(_context2, vendors, "\n")));
|
|
74
|
+
console.log(chalk__default["default"].yellow(`\nFiltering out chunk "${chunkName}" because its configured dependencies does not exist in the application: ${vendors}\n`));
|
|
78
75
|
}
|
|
79
76
|
return chunkGroups;
|
|
80
77
|
}, {});
|
|
@@ -82,15 +79,15 @@ const removeNonExistantDependencies = (manualChunks, appDependencies) => {
|
|
|
82
79
|
|
|
83
80
|
// Reference: https://webpack.js.org/plugins/split-chunks-plugin/
|
|
84
81
|
function getWepbackCacheGroups(appDependencies) {
|
|
85
|
-
var
|
|
82
|
+
var _context2;
|
|
86
83
|
const filteredDependencies = removeNonExistantDependencies(manualChunks, _Object$keys__default["default"](appDependencies));
|
|
87
|
-
const result = _reduceInstanceProperty__default["default"](
|
|
84
|
+
const result = _reduceInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](filteredDependencies)).call(_context2, (previousChunks, _ref3) => {
|
|
88
85
|
let _ref4 = _slicedToArray(_ref3, 2),
|
|
89
86
|
chunkName = _ref4[0],
|
|
90
87
|
vendors = _ref4[1];
|
|
91
88
|
return _objectSpread(_objectSpread({}, previousChunks), {}, {
|
|
92
89
|
[chunkName]: {
|
|
93
|
-
test: new RegExp(
|
|
90
|
+
test: new RegExp(`[\\/]node_modules[\\/](${vendors.join('|')})[\\/]`),
|
|
94
91
|
name: chunkName,
|
|
95
92
|
chunks: 'all'
|
|
96
93
|
}
|
|
@@ -6,7 +6,6 @@ var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
6
6
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
7
7
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
8
8
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
9
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
10
9
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
11
10
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
12
11
|
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
@@ -22,7 +21,6 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
22
21
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
23
22
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
24
23
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
25
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
26
24
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
27
25
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
28
26
|
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
@@ -45,7 +43,7 @@ function hasJsxRuntime() {
|
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
48
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
46
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
49
47
|
|
|
50
48
|
// Dependencies to be split/grouped into separate chunks for the Webpack build.
|
|
51
49
|
// This is useful to reduce the main bundle size and have more dedicated
|
|
@@ -73,8 +71,7 @@ const removeNonExistantDependencies = (manualChunks, appDependencies) => {
|
|
|
73
71
|
if (existingVendors.length > 0) {
|
|
74
72
|
chunkGroups[chunkName] = existingVendors;
|
|
75
73
|
} else {
|
|
76
|
-
|
|
77
|
-
console.log(chalk__default["default"].yellow(_concatInstanceProperty__default["default"](_context2 = "\nFiltering out chunk \"".concat(chunkName, "\" because its configured dependencies does not exist in the application: ")).call(_context2, vendors, "\n")));
|
|
74
|
+
console.log(chalk__default["default"].yellow(`\nFiltering out chunk "${chunkName}" because its configured dependencies does not exist in the application: ${vendors}\n`));
|
|
78
75
|
}
|
|
79
76
|
return chunkGroups;
|
|
80
77
|
}, {});
|
|
@@ -82,15 +79,15 @@ const removeNonExistantDependencies = (manualChunks, appDependencies) => {
|
|
|
82
79
|
|
|
83
80
|
// Reference: https://webpack.js.org/plugins/split-chunks-plugin/
|
|
84
81
|
function getWepbackCacheGroups(appDependencies) {
|
|
85
|
-
var
|
|
82
|
+
var _context2;
|
|
86
83
|
const filteredDependencies = removeNonExistantDependencies(manualChunks, _Object$keys__default["default"](appDependencies));
|
|
87
|
-
const result = _reduceInstanceProperty__default["default"](
|
|
84
|
+
const result = _reduceInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](filteredDependencies)).call(_context2, (previousChunks, _ref3) => {
|
|
88
85
|
let _ref4 = _slicedToArray(_ref3, 2),
|
|
89
86
|
chunkName = _ref4[0],
|
|
90
87
|
vendors = _ref4[1];
|
|
91
88
|
return _objectSpread(_objectSpread({}, previousChunks), {}, {
|
|
92
89
|
[chunkName]: {
|
|
93
|
-
test: new RegExp(
|
|
90
|
+
test: new RegExp(`[\\/]node_modules[\\/](${vendors.join('|')})[\\/]`),
|
|
94
91
|
name: chunkName,
|
|
95
92
|
chunks: 'all'
|
|
96
93
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var pkgJson = {
|
|
4
4
|
name: "@commercetools-frontend/mc-scripts",
|
|
5
|
-
version: "27.9.
|
|
5
|
+
version: "27.9.3",
|
|
6
6
|
description: "Configuration and scripts for developing a MC application",
|
|
7
7
|
bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
8
8
|
repository: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var pkgJson = {
|
|
4
4
|
name: "@commercetools-frontend/mc-scripts",
|
|
5
|
-
version: "27.9.
|
|
5
|
+
version: "27.9.3",
|
|
6
6
|
description: "Configuration and scripts for developing a MC application",
|
|
7
7
|
bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
8
8
|
repository: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var pkgJson = {
|
|
2
2
|
name: "@commercetools-frontend/mc-scripts",
|
|
3
|
-
version: "27.9.
|
|
3
|
+
version: "27.9.3",
|
|
4
4
|
description: "Configuration and scripts for developing a MC application",
|
|
5
5
|
bugs: "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
repository: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
2
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
3
2
|
import fs from 'fs';
|
|
4
3
|
import path from 'path';
|
|
5
4
|
import { d as doesFileExist } from './does-file-exist-32618334.esm.js';
|
|
@@ -13,15 +12,11 @@ const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
|
|
13
12
|
|
|
14
13
|
// Resolve file paths in the order given
|
|
15
14
|
const resolveModule = (resolveFn, filePath) => {
|
|
16
|
-
const extension = _findInstanceProperty(moduleFileExtensions).call(moduleFileExtensions, extension => {
|
|
17
|
-
var _context;
|
|
18
|
-
return doesFileExist(resolveFn(_concatInstanceProperty(_context = "".concat(filePath, ".")).call(_context, extension)));
|
|
19
|
-
});
|
|
15
|
+
const extension = _findInstanceProperty(moduleFileExtensions).call(moduleFileExtensions, extension => doesFileExist(resolveFn(`${filePath}.${extension}`)));
|
|
20
16
|
if (extension) {
|
|
21
|
-
|
|
22
|
-
return resolveFn(_concatInstanceProperty(_context2 = "".concat(filePath, ".")).call(_context2, extension));
|
|
17
|
+
return resolveFn(`${filePath}.${extension}`);
|
|
23
18
|
}
|
|
24
|
-
return resolveFn(
|
|
19
|
+
return resolveFn(`${filePath}.js`);
|
|
25
20
|
};
|
|
26
21
|
|
|
27
22
|
// Resolve the absolute path of the caller location. This is necessary
|
|
@@ -31,7 +26,7 @@ const paths = {
|
|
|
31
26
|
appBuild: resolveApp('public'),
|
|
32
27
|
appIndexHtmlTemplate: resolveApp('public/index.html.template'),
|
|
33
28
|
appIndexHtml: resolveApp('public/index.html'),
|
|
34
|
-
appWebpackConfig: resolveModule(resolveApp,
|
|
29
|
+
appWebpackConfig: resolveModule(resolveApp, `webpack.config.${process.env.NODE_ENV === 'production' ? 'prod' : 'dev'}`),
|
|
35
30
|
yarnLockFile: resolveApp('yarn.lock'),
|
|
36
31
|
appRoot: resolveApp('.'),
|
|
37
32
|
entryPoint: resolveModule(resolveApp, 'src/index'),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
4
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
5
4
|
var fs = require('fs');
|
|
6
5
|
var path = require('path');
|
|
7
6
|
var doesFileExist = require('./does-file-exist-be53305d.cjs.prod.js');
|
|
@@ -9,7 +8,6 @@ var doesFileExist = require('./does-file-exist-be53305d.cjs.prod.js');
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
9
|
|
|
11
10
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
12
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
13
11
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
14
12
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
15
13
|
|
|
@@ -22,15 +20,11 @@ const resolveApp = relativePath => path__default["default"].resolve(appDirectory
|
|
|
22
20
|
|
|
23
21
|
// Resolve file paths in the order given
|
|
24
22
|
const resolveModule = (resolveFn, filePath) => {
|
|
25
|
-
const extension = _findInstanceProperty__default["default"](moduleFileExtensions).call(moduleFileExtensions, extension => {
|
|
26
|
-
var _context;
|
|
27
|
-
return doesFileExist.doesFileExist(resolveFn(_concatInstanceProperty__default["default"](_context = "".concat(filePath, ".")).call(_context, extension)));
|
|
28
|
-
});
|
|
23
|
+
const extension = _findInstanceProperty__default["default"](moduleFileExtensions).call(moduleFileExtensions, extension => doesFileExist.doesFileExist(resolveFn(`${filePath}.${extension}`)));
|
|
29
24
|
if (extension) {
|
|
30
|
-
|
|
31
|
-
return resolveFn(_concatInstanceProperty__default["default"](_context2 = "".concat(filePath, ".")).call(_context2, extension));
|
|
25
|
+
return resolveFn(`${filePath}.${extension}`);
|
|
32
26
|
}
|
|
33
|
-
return resolveFn(
|
|
27
|
+
return resolveFn(`${filePath}.js`);
|
|
34
28
|
};
|
|
35
29
|
|
|
36
30
|
// Resolve the absolute path of the caller location. This is necessary
|
|
@@ -40,7 +34,7 @@ const paths = {
|
|
|
40
34
|
appBuild: resolveApp('public'),
|
|
41
35
|
appIndexHtmlTemplate: resolveApp('public/index.html.template'),
|
|
42
36
|
appIndexHtml: resolveApp('public/index.html'),
|
|
43
|
-
appWebpackConfig: resolveModule(resolveApp,
|
|
37
|
+
appWebpackConfig: resolveModule(resolveApp, `webpack.config.${'prod' }`),
|
|
44
38
|
yarnLockFile: resolveApp('yarn.lock'),
|
|
45
39
|
appRoot: resolveApp('.'),
|
|
46
40
|
entryPoint: resolveModule(resolveApp, 'src/index'),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
4
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
5
4
|
var fs = require('fs');
|
|
6
5
|
var path = require('path');
|
|
7
6
|
var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
@@ -9,7 +8,6 @@ var doesFileExist = require('./does-file-exist-eb86baca.cjs.dev.js');
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
9
|
|
|
11
10
|
var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
|
|
12
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
13
11
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
14
12
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
15
13
|
|
|
@@ -22,15 +20,11 @@ const resolveApp = relativePath => path__default["default"].resolve(appDirectory
|
|
|
22
20
|
|
|
23
21
|
// Resolve file paths in the order given
|
|
24
22
|
const resolveModule = (resolveFn, filePath) => {
|
|
25
|
-
const extension = _findInstanceProperty__default["default"](moduleFileExtensions).call(moduleFileExtensions, extension => {
|
|
26
|
-
var _context;
|
|
27
|
-
return doesFileExist.doesFileExist(resolveFn(_concatInstanceProperty__default["default"](_context = "".concat(filePath, ".")).call(_context, extension)));
|
|
28
|
-
});
|
|
23
|
+
const extension = _findInstanceProperty__default["default"](moduleFileExtensions).call(moduleFileExtensions, extension => doesFileExist.doesFileExist(resolveFn(`${filePath}.${extension}`)));
|
|
29
24
|
if (extension) {
|
|
30
|
-
|
|
31
|
-
return resolveFn(_concatInstanceProperty__default["default"](_context2 = "".concat(filePath, ".")).call(_context2, extension));
|
|
25
|
+
return resolveFn(`${filePath}.${extension}`);
|
|
32
26
|
}
|
|
33
|
-
return resolveFn(
|
|
27
|
+
return resolveFn(`${filePath}.js`);
|
|
34
28
|
};
|
|
35
29
|
|
|
36
30
|
// Resolve the absolute path of the caller location. This is necessary
|
|
@@ -40,7 +34,7 @@ const paths = {
|
|
|
40
34
|
appBuild: resolveApp('public'),
|
|
41
35
|
appIndexHtmlTemplate: resolveApp('public/index.html.template'),
|
|
42
36
|
appIndexHtml: resolveApp('public/index.html'),
|
|
43
|
-
appWebpackConfig: resolveModule(resolveApp,
|
|
37
|
+
appWebpackConfig: resolveModule(resolveApp, `webpack.config.${process.env.NODE_ENV === 'production' ? 'prod' : 'dev'}`),
|
|
44
38
|
yarnLockFile: resolveApp('yarn.lock'),
|
|
45
39
|
appRoot: resolveApp('.'),
|
|
46
40
|
entryPoint: resolveModule(resolveApp, 'src/index'),
|