@commercetools-frontend/mc-scripts 27.5.1 → 27.5.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/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +19 -39
- package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +19 -39
- package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +11 -11
- package/dist/{build-7c7442bd.cjs.prod.js → build-BP3m-wjz.cjs.prod.js} +23 -23
- package/dist/{build-2cbde331.cjs.dev.js → build-Dq8dqtsd.cjs.dev.js} +23 -23
- package/dist/{build-4ab9306b.esm.js → build-GEMI3W9m.esm.js} +7 -7
- package/dist/{build-vite-1526e4f8.esm.js → build-vite-CO8mi4hd.esm.js} +20 -10
- package/dist/{build-vite-71889a4a.cjs.prod.js → build-vite-D67xSRU1.cjs.prod.js} +46 -36
- package/dist/{build-vite-2fb9320e.cjs.dev.js → build-vite-Dxi3rfHf.cjs.dev.js} +46 -36
- package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +2 -4
- package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +2 -4
- package/dist/commercetools-frontend-mc-scripts.esm.js +2 -2
- package/dist/{compile-html-025cd493.esm.js → compile-html-BVvy3IQD.esm.js} +2 -2
- package/dist/{compile-html-f4ac88cc.cjs.dev.js → compile-html-DZlUpFXg.cjs.prod.js} +8 -8
- package/dist/{compile-html-50fd05ec.cjs.prod.js → compile-html-Ds1YojsY.cjs.dev.js} +8 -8
- package/dist/{config-sync-d5c4aa9b.esm.js → config-sync-Bu7U5gn5.esm.js} +5 -5
- package/dist/{config-sync-7ae74804.cjs.dev.js → config-sync-Cd0sSSrd.cjs.dev.js} +22 -22
- package/dist/{config-sync-d3d5d721.cjs.prod.js → config-sync-D6xLjo9S.cjs.prod.js} +22 -22
- package/dist/{config-sync-ci-d3104a62.cjs.prod.js → config-sync-ci-CXgQcemF.cjs.prod.js} +21 -21
- package/dist/{config-sync-ci-9c50ed6f.esm.js → config-sync-ci-Dq7bAqeu.esm.js} +5 -5
- package/dist/{config-sync-ci-732e0c5d.cjs.dev.js → config-sync-ci-SDsF-Onw.cjs.dev.js} +21 -21
- package/dist/{config-sync-helpers-ea628bce.cjs.prod.js → config-sync-helpers-9kvPwuoy.cjs.prod.js} +47 -47
- package/dist/{config-sync-helpers-bea5f027.esm.js → config-sync-helpers-BLXJp1-D.esm.js} +3 -3
- package/dist/{config-sync-helpers-178da465.cjs.dev.js → config-sync-helpers-DUK45F_R.cjs.dev.js} +47 -47
- package/dist/{create-postcss-config-f6a5f68b.esm.js → create-postcss-config-CN9_8Usa.esm.js} +1 -1
- package/dist/{create-postcss-config-3f3bda09.cjs.prod.js → create-postcss-config-DAShdAyB.cjs.prod.js} +3 -3
- package/dist/{create-postcss-config-e4c767b4.cjs.dev.js → create-postcss-config-NN2FAhvH.cjs.dev.js} +3 -3
- package/dist/{create-webpack-config-for-development-c6e48557.esm.js → create-webpack-config-for-development-5HpRHV9G.esm.js} +5 -5
- package/dist/{create-webpack-config-for-development-4a2616e9.cjs.prod.js → create-webpack-config-for-development-CxGehl7I.cjs.prod.js} +25 -25
- package/dist/{create-webpack-config-for-development-a2df037a.cjs.dev.js → create-webpack-config-for-development-hxSNyq2_.cjs.dev.js} +25 -25
- package/dist/{create-webpack-config-for-production-04a7a9f8.esm.js → create-webpack-config-for-production-BY0UNoNz.esm.js} +5 -5
- package/dist/{create-webpack-config-for-production-443f6fe7.cjs.prod.js → create-webpack-config-for-production-CW0DlZBz.cjs.prod.js} +32 -32
- package/dist/{create-webpack-config-for-production-12e257fc.cjs.dev.js → create-webpack-config-for-production-Edp9dzmw.cjs.dev.js} +32 -32
- package/dist/{credentials-storage-fd195144.cjs.dev.js → credentials-storage-B0tDCH7i.cjs.dev.js} +10 -10
- package/dist/{credentials-storage-67deadc3.esm.js → credentials-storage-B79bb0Ns.esm.js} +1 -1
- package/dist/{credentials-storage-ea1c16dc.cjs.prod.js → credentials-storage-C3TlK0a8.cjs.prod.js} +10 -10
- package/dist/{deployment-previews-set-491442d7.cjs.dev.js → deployment-previews-set-BuHX8wKo.cjs.dev.js} +22 -22
- package/dist/{deployment-previews-set-4b020cb4.esm.js → deployment-previews-set-C2OPIfy-.esm.js} +4 -4
- package/dist/{deployment-previews-set-2b334c11.cjs.prod.js → deployment-previews-set-nvkAPwYw.cjs.prod.js} +22 -22
- package/dist/{does-file-exist-be53305d.cjs.prod.js → does-file-exist-DrcZIPe6.cjs.dev.js} +2 -2
- package/dist/{does-file-exist-eb86baca.cjs.dev.js → does-file-exist-DrcZIPe6.cjs.prod.js} +2 -2
- package/dist/{graphql-requests-bd7a3fe9.cjs.dev.js → graphql-requests-BeUd4g3v.cjs.dev.js} +9 -9
- package/dist/{graphql-requests-6ead2029.cjs.prod.js → graphql-requests-D0rtMo7K.cjs.prod.js} +9 -9
- package/dist/{graphql-requests-87338c52.esm.js → graphql-requests-DCLX_2y0.esm.js} +4 -4
- package/dist/{i18n-message-complilation-7311cb29.cjs.dev.js → i18n-message-complilation-CdVhuyWk.cjs.dev.js} +3 -3
- package/dist/{i18n-message-complilation-7762da61.cjs.prod.js → i18n-message-complilation-CdVhuyWk.cjs.prod.js} +3 -3
- package/dist/{login-2d10deff.cjs.dev.js → login-BagHOLO1.cjs.prod.js} +42 -60
- package/dist/{login-26cfe1af.cjs.prod.js → login-DKzmRa46.cjs.dev.js} +42 -60
- package/dist/{login-ab249036.esm.js → login-DZVfG3Jq.esm.js} +3 -3
- package/dist/{optimizations-da5a0cfa.cjs.prod.js → optimizations-CEaq4axa.cjs.dev.js} +8 -8
- package/dist/{optimizations-56be74d6.cjs.dev.js → optimizations-CEaq4axa.cjs.prod.js} +8 -8
- package/dist/{optimizations-54382f7b.esm.js → optimizations-Cjrg77Gu.esm.js} +1 -1
- package/dist/package-B1Y3_DDl.cjs.dev.js +17 -0
- package/dist/package-BiK3ergJ.esm.js +15 -0
- package/dist/package-DxhqRLHb.cjs.prod.js +12 -0
- package/dist/{paths-b76fc753.cjs.dev.js → paths-B0WM5jb9.cjs.dev.js} +5 -5
- package/dist/{paths-39f22b8b.esm.js → paths-Cg5Vq6RE.esm.js} +1 -1
- package/dist/{paths-7768b440.cjs.prod.js → paths-DtvtCG0U.cjs.prod.js} +5 -5
- package/dist/{serve-b1c12985.cjs.dev.js → serve-BwNRk6vi.cjs.prod.js} +13 -13
- package/dist/{serve-3837602d.cjs.prod.js → serve-BxRJOSeR.cjs.dev.js} +13 -13
- package/dist/{serve-22475fec.esm.js → serve-fXDv4-Pm.esm.js} +2 -2
- package/dist/{start-19facf6d.cjs.prod.js → start-CQgQhNhU.cjs.prod.js} +17 -17
- package/dist/{start-9b1252f9.cjs.dev.js → start-OjGog63p.cjs.dev.js} +17 -17
- package/dist/{start-3c1e5902.esm.js → start-suUcoYml.esm.js} +7 -7
- package/dist/{start-vite-7d1161e8.esm.js → start-vite-BOrX5xsW.esm.js} +3 -3
- package/dist/{start-vite-29078b3a.cjs.prod.js → start-vite-Bf9UIg63.cjs.prod.js} +14 -14
- package/dist/{start-vite-068e9f73.cjs.dev.js → start-vite-CeaoWKrT.cjs.dev.js} +14 -14
- package/dist/{vite-plugin-svgr-4034a834.cjs.prod.js → vite-plugin-svgr-CRRIY_Py.cjs.dev.js} +6 -24
- package/dist/{vite-plugin-svgr-7d06f400.cjs.dev.js → vite-plugin-svgr-CRRIY_Py.cjs.prod.js} +6 -24
- package/package.json +8 -8
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -4
- package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +8 -10
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +8 -10
- package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +8 -8
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.dev.js +2 -2
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.cjs.prod.js +2 -2
- package/webpack-loaders/i18n-message-compilation-loader/dist/commercetools-frontend-mc-scripts-webpack-loaders-i18n-message-compilation-loader.esm.js +1 -1
- package/dist/package-62998a4b.cjs.prod.js +0 -167
- package/dist/package-a686a0ee.esm.js +0 -165
- package/dist/package-fe1840f3.cjs.dev.js +0 -167
- /package/dist/{does-file-exist-32618334.esm.js → does-file-exist-C7l6j7NP.esm.js} +0 -0
- /package/dist/{i18n-message-complilation-21d3b0aa.esm.js → i18n-message-complilation-BRZ7ffQI.esm.js} +0 -0
- /package/dist/{vendors-to-transpile-04a49d40.cjs.prod.js → vendors-to-transpile-DLHlk7c-.cjs.dev.js} +0 -0
- /package/dist/{vendors-to-transpile-6ab4ea06.cjs.dev.js → vendors-to-transpile-DLHlk7c-.cjs.prod.js} +0 -0
- /package/dist/{vendors-to-transpile-7dc84a72.esm.js → vendors-to-transpile-uu9TNPDO.esm.js} +0 -0
- /package/dist/{vite-plugin-svgr-de6ee7da.esm.js → vite-plugin-svgr-B1JerYlQ.esm.js} +0 -0
|
@@ -29,12 +29,12 @@ var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
29
29
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
30
30
|
var fs = require('fs');
|
|
31
31
|
var path = require('path');
|
|
32
|
-
var createPostcssConfig = require('./create-postcss-config-
|
|
33
|
-
var optimizations = require('./optimizations-
|
|
34
|
-
var paths = require('./paths-
|
|
35
|
-
var vendorsToTranspile = require('./vendors-to-transpile-
|
|
32
|
+
var createPostcssConfig = require('./create-postcss-config-DAShdAyB.cjs.prod.js');
|
|
33
|
+
var optimizations = require('./optimizations-CEaq4axa.cjs.prod.js');
|
|
34
|
+
var paths = require('./paths-DtvtCG0U.cjs.prod.js');
|
|
35
|
+
var vendorsToTranspile = require('./vendors-to-transpile-DLHlk7c-.cjs.prod.js');
|
|
36
36
|
|
|
37
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
37
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
38
38
|
|
|
39
39
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
40
40
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -82,11 +82,11 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
|
|
|
82
82
|
// https://webpack.js.org/api/plugins/#plugin-types
|
|
83
83
|
if (compiler.hooks) {
|
|
84
84
|
var _context;
|
|
85
|
-
compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty__default
|
|
85
|
+
compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty__default.default(_context = this.writeStats).call(_context, this));
|
|
86
86
|
} else {
|
|
87
87
|
var _context2;
|
|
88
88
|
// @ts-ignore
|
|
89
|
-
compiler.plugin('done', _bindInstanceProperty__default
|
|
89
|
+
compiler.plugin('done', _bindInstanceProperty__default.default(_context2 = this.writeStats).call(_context2, this));
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}, {
|
|
@@ -97,15 +97,15 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
|
|
|
97
97
|
// Filter only included fields
|
|
98
98
|
if (this.config.includeFields) {
|
|
99
99
|
var _context3;
|
|
100
|
-
finalStats = _reduceInstanceProperty__default
|
|
100
|
+
finalStats = _reduceInstanceProperty__default.default(_context3 = this.config.includeFields).call(_context3, (aggregatedStats, key) =>
|
|
101
101
|
// eslint-disable-next-line
|
|
102
|
-
_Object$assign__default
|
|
102
|
+
_Object$assign__default.default({}, aggregatedStats, {
|
|
103
103
|
[key]: finalStats[key]
|
|
104
104
|
}), {});
|
|
105
105
|
}
|
|
106
106
|
try {
|
|
107
|
-
fs__default
|
|
108
|
-
fs__default
|
|
107
|
+
fs__default.default.accessSync(this.config.outputPath, fs__default.default.constants.F_OK);
|
|
108
|
+
fs__default.default.writeFileSync(path__default.default.join(this.config.outputPath, 'stats.json'), _JSON$stringify__default.default(finalStats, null, 2));
|
|
109
109
|
} catch (error) {
|
|
110
110
|
// eslint-disable-next-line no-console
|
|
111
111
|
console.warn(`[FinalStatsWriterPlugin] The dist folder could not be found at ${this.config.outputPath}. Check the console for errors during the webpack compilation.`);
|
|
@@ -114,8 +114,8 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
|
|
|
114
114
|
}]);
|
|
115
115
|
}();
|
|
116
116
|
|
|
117
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
118
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
117
|
+
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; }
|
|
118
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context5 = ownKeys(Object(t), true)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
119
119
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
120
120
|
const momentLocalesToKeep = ["de", "de-at", "de-ch", "en-gb", "en-au", "en-ca", "en-ie", "en-in", "en-nz", "en-sg", "es", "es-do", "es-mx", "fr", "pt-br"];
|
|
121
121
|
const defaultToggleFlags = {
|
|
@@ -171,7 +171,7 @@ function createWebpackConfigForProduction() {
|
|
|
171
171
|
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
|
172
172
|
// https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a
|
|
173
173
|
optimization: {
|
|
174
|
-
minimizer: [new TerserPlugin__default
|
|
174
|
+
minimizer: [new TerserPlugin__default.default({
|
|
175
175
|
terserOptions: {
|
|
176
176
|
parse: {
|
|
177
177
|
// we want terser to parse ecma 8 code. However, we don't want it
|
|
@@ -211,7 +211,7 @@ function createWebpackConfigForProduction() {
|
|
|
211
211
|
// Use multi-process parallel running to improve the build speed
|
|
212
212
|
// Default number of concurrent runs: os.cpus().length - 1
|
|
213
213
|
parallel: mergedOptions.toggleFlags.parallelism
|
|
214
|
-
}), mergedOptions.toggleFlags.enableExtractCss && new CssMinimizerPlugin__default
|
|
214
|
+
}), mergedOptions.toggleFlags.enableExtractCss && new CssMinimizerPlugin__default.default()],
|
|
215
215
|
// Keep the runtime chunk separated to enable long term caching
|
|
216
216
|
runtimeChunk: {
|
|
217
217
|
name: 'runtime'
|
|
@@ -229,7 +229,7 @@ function createWebpackConfigForProduction() {
|
|
|
229
229
|
// https://github.com/facebook/create-react-app/issues/290
|
|
230
230
|
// `web` extension prefixes have been added for better support
|
|
231
231
|
// for React Native Web.
|
|
232
|
-
extensions: _mapInstanceProperty__default
|
|
232
|
+
extensions: _mapInstanceProperty__default.default(_context = ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx']).call(_context, ext => `.${ext}`),
|
|
233
233
|
// NOTE: this is meant to be a temporary list of fallback/polyfills for certain
|
|
234
234
|
// nodejs modules. With Webpack <5 these polyfills were included by default in Webpack,
|
|
235
235
|
// however now it's not the case anymore.
|
|
@@ -240,7 +240,7 @@ function createWebpackConfigForProduction() {
|
|
|
240
240
|
},
|
|
241
241
|
// In production, we only want to load the polyfills and the app code.
|
|
242
242
|
entry: {
|
|
243
|
-
app: _filterInstanceProperty__default
|
|
243
|
+
app: _filterInstanceProperty__default.default(_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), mergedOptions.entryPoint]).call(_context2, Boolean)
|
|
244
244
|
},
|
|
245
245
|
output: {
|
|
246
246
|
// Generated JS file names (with nested folders).
|
|
@@ -256,7 +256,7 @@ function createWebpackConfigForProduction() {
|
|
|
256
256
|
plugins: [
|
|
257
257
|
// Allows to "assign" custom options to the `webpack` object.
|
|
258
258
|
// At the moment, this is used to share some props with `postcss.config`.
|
|
259
|
-
new webpack__default
|
|
259
|
+
new webpack__default.default.LoaderOptionsPlugin({
|
|
260
260
|
options: {
|
|
261
261
|
sourceFolders: mergedOptions.sourceFolders,
|
|
262
262
|
context: __dirname
|
|
@@ -264,14 +264,14 @@ function createWebpackConfigForProduction() {
|
|
|
264
264
|
}),
|
|
265
265
|
// Makes some environment variables available to the JS code, for example:
|
|
266
266
|
// if (process.env.NODE_ENV === 'production') { ... }.
|
|
267
|
-
new webpack__default
|
|
267
|
+
new webpack__default.default.DefinePlugin({
|
|
268
268
|
__DEV__: 'false',
|
|
269
269
|
'process.env': {
|
|
270
|
-
NODE_ENV: _JSON$stringify__default
|
|
270
|
+
NODE_ENV: _JSON$stringify__default.default('production')
|
|
271
271
|
}
|
|
272
272
|
}),
|
|
273
273
|
// Only keep locales that are available in the Merchant Center.
|
|
274
|
-
new MomentLocalesPlugin__default
|
|
274
|
+
new MomentLocalesPlugin__default.default({
|
|
275
275
|
localesToKeep: momentLocalesToKeep
|
|
276
276
|
}),
|
|
277
277
|
// Generate a `stats.json` file containing information and paths to
|
|
@@ -281,13 +281,13 @@ function createWebpackConfigForProduction() {
|
|
|
281
281
|
new FinalStatsWriterPlugin({
|
|
282
282
|
outputPath: paths.paths.appBuild,
|
|
283
283
|
includeFields: ['entrypoints', 'assets', 'publicPath', 'time']
|
|
284
|
-
}), mergedOptions.toggleFlags.generateIndexHtml && new HtmlWebpackPlugin__default
|
|
284
|
+
}), mergedOptions.toggleFlags.generateIndexHtml && new HtmlWebpackPlugin__default.default({
|
|
285
285
|
inject: false,
|
|
286
286
|
filename: 'index.html.template',
|
|
287
287
|
template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
|
|
288
288
|
}), mergedOptions.toggleFlags.enableExtractCss &&
|
|
289
289
|
// Extracts CSS into one CSS file to mimic CSS order in dev
|
|
290
|
-
new MiniCssExtractPlugin__default
|
|
290
|
+
new MiniCssExtractPlugin__default.default({
|
|
291
291
|
filename: '[name].[chunkhash].css',
|
|
292
292
|
chunkFilename: '[id].[name].[chunkhash].css'
|
|
293
293
|
}), process.env.ANALYZE_BUNDLE === 'true' && new webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
|
@@ -296,7 +296,7 @@ function createWebpackConfigForProduction() {
|
|
|
296
296
|
module: {
|
|
297
297
|
// Makes missing exports an error instead of warning.
|
|
298
298
|
strictExportPresence: true,
|
|
299
|
-
rules: _filterInstanceProperty__default
|
|
299
|
+
rules: _filterInstanceProperty__default.default(_context3 = [
|
|
300
300
|
// For svg icons, we want to get them transformed into React components
|
|
301
301
|
// when we import them.
|
|
302
302
|
{
|
|
@@ -359,7 +359,7 @@ function createWebpackConfigForProduction() {
|
|
|
359
359
|
name: 'prefixIds',
|
|
360
360
|
params: {
|
|
361
361
|
delim: '',
|
|
362
|
-
prefix: (_, info) => `svg${crypto__default
|
|
362
|
+
prefix: (_, info) => `svg${crypto__default.default.createHash('shake256', {
|
|
363
363
|
outputLength: 6
|
|
364
364
|
}).update(info.path || '').digest('hex')}`
|
|
365
365
|
}
|
|
@@ -375,7 +375,7 @@ function createWebpackConfigForProduction() {
|
|
|
375
375
|
return (
|
|
376
376
|
// Use this only for plain SVG.
|
|
377
377
|
// For SVG as React components, see loader above.
|
|
378
|
-
_endsWithInstanceProperty__default
|
|
378
|
+
_endsWithInstanceProperty__default.default(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty__default.default(fileName).call(fileName, '.react.svg')
|
|
379
379
|
);
|
|
380
380
|
},
|
|
381
381
|
use: [{
|
|
@@ -395,7 +395,7 @@ function createWebpackConfigForProduction() {
|
|
|
395
395
|
{
|
|
396
396
|
test: /\.(mod|module)\.css$/,
|
|
397
397
|
include: mergedOptions.sourceFolders,
|
|
398
|
-
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default
|
|
398
|
+
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default.default.loader : require.resolve('style-loader'), {
|
|
399
399
|
loader: require.resolve('css-loader'),
|
|
400
400
|
options: {
|
|
401
401
|
modules: {
|
|
@@ -416,7 +416,7 @@ function createWebpackConfigForProduction() {
|
|
|
416
416
|
return (
|
|
417
417
|
// Use this only for plain CSS.
|
|
418
418
|
// For css-modules, see loader above.
|
|
419
|
-
_endsWithInstanceProperty__default
|
|
419
|
+
_endsWithInstanceProperty__default.default(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty__default.default(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty__default.default(fileName).call(fileName, '.module.css'))
|
|
420
420
|
);
|
|
421
421
|
},
|
|
422
422
|
// "postcss" loader applies autoprefixer to our CSS.
|
|
@@ -425,7 +425,7 @@ function createWebpackConfigForProduction() {
|
|
|
425
425
|
oneOf: [{
|
|
426
426
|
// Use "postcss" for all the included source folders.
|
|
427
427
|
include: mergedOptions.sourceFolders,
|
|
428
|
-
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default
|
|
428
|
+
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default.default.loader : require.resolve('style-loader'), {
|
|
429
429
|
loader: require.resolve('css-loader'),
|
|
430
430
|
options: {
|
|
431
431
|
modules: {
|
|
@@ -443,7 +443,7 @@ function createWebpackConfigForProduction() {
|
|
|
443
443
|
// For all other vendor CSS, do not use "postcss" loader.
|
|
444
444
|
// But still use MiniCssExtractPlugin :)
|
|
445
445
|
include: /node_modules/,
|
|
446
|
-
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default
|
|
446
|
+
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default.default.loader : require.resolve('style-loader'), {
|
|
447
447
|
loader: require.resolve('css-loader'),
|
|
448
448
|
options: {
|
|
449
449
|
modules: {
|
|
@@ -477,7 +477,7 @@ function createWebpackConfigForProduction() {
|
|
|
477
477
|
// improves compile time on larger projects
|
|
478
478
|
{
|
|
479
479
|
loader: require.resolve('thread-loader'),
|
|
480
|
-
options: _objectSpread({}, _Number$isInteger__default
|
|
480
|
+
options: _objectSpread({}, _Number$isInteger__default.default(mergedOptions.toggleFlags.parallelism) ? {
|
|
481
481
|
workers: mergedOptions.toggleFlags.parallelism
|
|
482
482
|
} : {})
|
|
483
483
|
}, {
|
|
@@ -496,7 +496,7 @@ function createWebpackConfigForProduction() {
|
|
|
496
496
|
highlightCode: true
|
|
497
497
|
}
|
|
498
498
|
}],
|
|
499
|
-
include: _concatInstanceProperty__default
|
|
499
|
+
include: _concatInstanceProperty__default.default(_context4 = mergedOptions.sourceFolders).call(_context4, vendorsToTranspile.vendorsToTranspile),
|
|
500
500
|
// Disable require.ensure as it's not a standard language feature.
|
|
501
501
|
parser: {
|
|
502
502
|
requireEnsure: false
|
|
@@ -29,12 +29,12 @@ var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
29
29
|
var _Object$assign = require('@babel/runtime-corejs3/core-js-stable/object/assign');
|
|
30
30
|
var fs = require('fs');
|
|
31
31
|
var path = require('path');
|
|
32
|
-
var createPostcssConfig = require('./create-postcss-config-
|
|
33
|
-
var optimizations = require('./optimizations-
|
|
34
|
-
var paths = require('./paths-
|
|
35
|
-
var vendorsToTranspile = require('./vendors-to-transpile-
|
|
32
|
+
var createPostcssConfig = require('./create-postcss-config-NN2FAhvH.cjs.dev.js');
|
|
33
|
+
var optimizations = require('./optimizations-CEaq4axa.cjs.dev.js');
|
|
34
|
+
var paths = require('./paths-B0WM5jb9.cjs.dev.js');
|
|
35
|
+
var vendorsToTranspile = require('./vendors-to-transpile-DLHlk7c-.cjs.dev.js');
|
|
36
36
|
|
|
37
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
37
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
38
38
|
|
|
39
39
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
40
40
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -82,11 +82,11 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
|
|
|
82
82
|
// https://webpack.js.org/api/plugins/#plugin-types
|
|
83
83
|
if (compiler.hooks) {
|
|
84
84
|
var _context;
|
|
85
|
-
compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty__default
|
|
85
|
+
compiler.hooks.done.tap('custom-stats-writer-plugin', _bindInstanceProperty__default.default(_context = this.writeStats).call(_context, this));
|
|
86
86
|
} else {
|
|
87
87
|
var _context2;
|
|
88
88
|
// @ts-ignore
|
|
89
|
-
compiler.plugin('done', _bindInstanceProperty__default
|
|
89
|
+
compiler.plugin('done', _bindInstanceProperty__default.default(_context2 = this.writeStats).call(_context2, this));
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}, {
|
|
@@ -97,15 +97,15 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
|
|
|
97
97
|
// Filter only included fields
|
|
98
98
|
if (this.config.includeFields) {
|
|
99
99
|
var _context3;
|
|
100
|
-
finalStats = _reduceInstanceProperty__default
|
|
100
|
+
finalStats = _reduceInstanceProperty__default.default(_context3 = this.config.includeFields).call(_context3, (aggregatedStats, key) =>
|
|
101
101
|
// eslint-disable-next-line
|
|
102
|
-
_Object$assign__default
|
|
102
|
+
_Object$assign__default.default({}, aggregatedStats, {
|
|
103
103
|
[key]: finalStats[key]
|
|
104
104
|
}), {});
|
|
105
105
|
}
|
|
106
106
|
try {
|
|
107
|
-
fs__default
|
|
108
|
-
fs__default
|
|
107
|
+
fs__default.default.accessSync(this.config.outputPath, fs__default.default.constants.F_OK);
|
|
108
|
+
fs__default.default.writeFileSync(path__default.default.join(this.config.outputPath, 'stats.json'), _JSON$stringify__default.default(finalStats, null, 2));
|
|
109
109
|
} catch (error) {
|
|
110
110
|
// eslint-disable-next-line no-console
|
|
111
111
|
console.warn(`[FinalStatsWriterPlugin] The dist folder could not be found at ${this.config.outputPath}. Check the console for errors during the webpack compilation.`);
|
|
@@ -114,8 +114,8 @@ let FinalStatsWriterPlugin = /*#__PURE__*/function () {
|
|
|
114
114
|
}]);
|
|
115
115
|
}();
|
|
116
116
|
|
|
117
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
118
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
117
|
+
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; }
|
|
118
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context5 = ownKeys(Object(t), true)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
119
119
|
// https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
|
|
120
120
|
const momentLocalesToKeep = ["de", "de-at", "de-ch", "en-gb", "en-au", "en-ca", "en-ie", "en-in", "en-nz", "en-sg", "es", "es-do", "es-mx", "fr", "pt-br"];
|
|
121
121
|
const defaultToggleFlags = {
|
|
@@ -171,7 +171,7 @@ function createWebpackConfigForProduction() {
|
|
|
171
171
|
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
|
|
172
172
|
// https://medium.com/webpack/webpack-4-mode-and-optimization-5423a6bc597a
|
|
173
173
|
optimization: {
|
|
174
|
-
minimizer: [new TerserPlugin__default
|
|
174
|
+
minimizer: [new TerserPlugin__default.default({
|
|
175
175
|
terserOptions: {
|
|
176
176
|
parse: {
|
|
177
177
|
// we want terser to parse ecma 8 code. However, we don't want it
|
|
@@ -211,7 +211,7 @@ function createWebpackConfigForProduction() {
|
|
|
211
211
|
// Use multi-process parallel running to improve the build speed
|
|
212
212
|
// Default number of concurrent runs: os.cpus().length - 1
|
|
213
213
|
parallel: mergedOptions.toggleFlags.parallelism
|
|
214
|
-
}), mergedOptions.toggleFlags.enableExtractCss && new CssMinimizerPlugin__default
|
|
214
|
+
}), mergedOptions.toggleFlags.enableExtractCss && new CssMinimizerPlugin__default.default()],
|
|
215
215
|
// Keep the runtime chunk separated to enable long term caching
|
|
216
216
|
runtimeChunk: {
|
|
217
217
|
name: 'runtime'
|
|
@@ -229,7 +229,7 @@ function createWebpackConfigForProduction() {
|
|
|
229
229
|
// https://github.com/facebook/create-react-app/issues/290
|
|
230
230
|
// `web` extension prefixes have been added for better support
|
|
231
231
|
// for React Native Web.
|
|
232
|
-
extensions: _mapInstanceProperty__default
|
|
232
|
+
extensions: _mapInstanceProperty__default.default(_context = ['js', 'mjs', 'cjs', 'ts', 'tsx', 'json', 'jsx']).call(_context, ext => `.${ext}`),
|
|
233
233
|
// NOTE: this is meant to be a temporary list of fallback/polyfills for certain
|
|
234
234
|
// nodejs modules. With Webpack <5 these polyfills were included by default in Webpack,
|
|
235
235
|
// however now it's not the case anymore.
|
|
@@ -240,7 +240,7 @@ function createWebpackConfigForProduction() {
|
|
|
240
240
|
},
|
|
241
241
|
// In production, we only want to load the polyfills and the app code.
|
|
242
242
|
entry: {
|
|
243
|
-
app: _filterInstanceProperty__default
|
|
243
|
+
app: _filterInstanceProperty__default.default(_context2 = [require.resolve('@commercetools-frontend/mc-scripts/application-runtime'), !mergedOptions.toggleFlags.disableCoreJs && require.resolve('core-js/stable'), mergedOptions.entryPoint]).call(_context2, Boolean)
|
|
244
244
|
},
|
|
245
245
|
output: {
|
|
246
246
|
// Generated JS file names (with nested folders).
|
|
@@ -256,7 +256,7 @@ function createWebpackConfigForProduction() {
|
|
|
256
256
|
plugins: [
|
|
257
257
|
// Allows to "assign" custom options to the `webpack` object.
|
|
258
258
|
// At the moment, this is used to share some props with `postcss.config`.
|
|
259
|
-
new webpack__default
|
|
259
|
+
new webpack__default.default.LoaderOptionsPlugin({
|
|
260
260
|
options: {
|
|
261
261
|
sourceFolders: mergedOptions.sourceFolders,
|
|
262
262
|
context: __dirname
|
|
@@ -264,14 +264,14 @@ function createWebpackConfigForProduction() {
|
|
|
264
264
|
}),
|
|
265
265
|
// Makes some environment variables available to the JS code, for example:
|
|
266
266
|
// if (process.env.NODE_ENV === 'production') { ... }.
|
|
267
|
-
new webpack__default
|
|
267
|
+
new webpack__default.default.DefinePlugin({
|
|
268
268
|
__DEV__: 'false',
|
|
269
269
|
'process.env': {
|
|
270
|
-
NODE_ENV: _JSON$stringify__default
|
|
270
|
+
NODE_ENV: _JSON$stringify__default.default('production')
|
|
271
271
|
}
|
|
272
272
|
}),
|
|
273
273
|
// Only keep locales that are available in the Merchant Center.
|
|
274
|
-
new MomentLocalesPlugin__default
|
|
274
|
+
new MomentLocalesPlugin__default.default({
|
|
275
275
|
localesToKeep: momentLocalesToKeep
|
|
276
276
|
}),
|
|
277
277
|
// Generate a `stats.json` file containing information and paths to
|
|
@@ -281,13 +281,13 @@ function createWebpackConfigForProduction() {
|
|
|
281
281
|
new FinalStatsWriterPlugin({
|
|
282
282
|
outputPath: paths.paths.appBuild,
|
|
283
283
|
includeFields: ['entrypoints', 'assets', 'publicPath', 'time']
|
|
284
|
-
}), mergedOptions.toggleFlags.generateIndexHtml && new HtmlWebpackPlugin__default
|
|
284
|
+
}), mergedOptions.toggleFlags.generateIndexHtml && new HtmlWebpackPlugin__default.default({
|
|
285
285
|
inject: false,
|
|
286
286
|
filename: 'index.html.template',
|
|
287
287
|
template: require.resolve('@commercetools-frontend/mc-html-template/webpack')
|
|
288
288
|
}), mergedOptions.toggleFlags.enableExtractCss &&
|
|
289
289
|
// Extracts CSS into one CSS file to mimic CSS order in dev
|
|
290
|
-
new MiniCssExtractPlugin__default
|
|
290
|
+
new MiniCssExtractPlugin__default.default({
|
|
291
291
|
filename: '[name].[chunkhash].css',
|
|
292
292
|
chunkFilename: '[id].[name].[chunkhash].css'
|
|
293
293
|
}), process.env.ANALYZE_BUNDLE === 'true' && new webpackBundleAnalyzer.BundleAnalyzerPlugin({
|
|
@@ -296,7 +296,7 @@ function createWebpackConfigForProduction() {
|
|
|
296
296
|
module: {
|
|
297
297
|
// Makes missing exports an error instead of warning.
|
|
298
298
|
strictExportPresence: true,
|
|
299
|
-
rules: _filterInstanceProperty__default
|
|
299
|
+
rules: _filterInstanceProperty__default.default(_context3 = [
|
|
300
300
|
// For svg icons, we want to get them transformed into React components
|
|
301
301
|
// when we import them.
|
|
302
302
|
{
|
|
@@ -359,7 +359,7 @@ function createWebpackConfigForProduction() {
|
|
|
359
359
|
name: 'prefixIds',
|
|
360
360
|
params: {
|
|
361
361
|
delim: '',
|
|
362
|
-
prefix: (_, info) => `svg${crypto__default
|
|
362
|
+
prefix: (_, info) => `svg${crypto__default.default.createHash('shake256', {
|
|
363
363
|
outputLength: 6
|
|
364
364
|
}).update(info.path || '').digest('hex')}`
|
|
365
365
|
}
|
|
@@ -375,7 +375,7 @@ function createWebpackConfigForProduction() {
|
|
|
375
375
|
return (
|
|
376
376
|
// Use this only for plain SVG.
|
|
377
377
|
// For SVG as React components, see loader above.
|
|
378
|
-
_endsWithInstanceProperty__default
|
|
378
|
+
_endsWithInstanceProperty__default.default(fileName).call(fileName, '.svg') && !_endsWithInstanceProperty__default.default(fileName).call(fileName, '.react.svg')
|
|
379
379
|
);
|
|
380
380
|
},
|
|
381
381
|
use: [{
|
|
@@ -395,7 +395,7 @@ function createWebpackConfigForProduction() {
|
|
|
395
395
|
{
|
|
396
396
|
test: /\.(mod|module)\.css$/,
|
|
397
397
|
include: mergedOptions.sourceFolders,
|
|
398
|
-
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default
|
|
398
|
+
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default.default.loader : require.resolve('style-loader'), {
|
|
399
399
|
loader: require.resolve('css-loader'),
|
|
400
400
|
options: {
|
|
401
401
|
modules: {
|
|
@@ -416,7 +416,7 @@ function createWebpackConfigForProduction() {
|
|
|
416
416
|
return (
|
|
417
417
|
// Use this only for plain CSS.
|
|
418
418
|
// For css-modules, see loader above.
|
|
419
|
-
_endsWithInstanceProperty__default
|
|
419
|
+
_endsWithInstanceProperty__default.default(fileName).call(fileName, '.css') && !(_endsWithInstanceProperty__default.default(fileName).call(fileName, '.mod.css') || _endsWithInstanceProperty__default.default(fileName).call(fileName, '.module.css'))
|
|
420
420
|
);
|
|
421
421
|
},
|
|
422
422
|
// "postcss" loader applies autoprefixer to our CSS.
|
|
@@ -425,7 +425,7 @@ function createWebpackConfigForProduction() {
|
|
|
425
425
|
oneOf: [{
|
|
426
426
|
// Use "postcss" for all the included source folders.
|
|
427
427
|
include: mergedOptions.sourceFolders,
|
|
428
|
-
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default
|
|
428
|
+
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default.default.loader : require.resolve('style-loader'), {
|
|
429
429
|
loader: require.resolve('css-loader'),
|
|
430
430
|
options: {
|
|
431
431
|
modules: {
|
|
@@ -443,7 +443,7 @@ function createWebpackConfigForProduction() {
|
|
|
443
443
|
// For all other vendor CSS, do not use "postcss" loader.
|
|
444
444
|
// But still use MiniCssExtractPlugin :)
|
|
445
445
|
include: /node_modules/,
|
|
446
|
-
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default
|
|
446
|
+
use: [mergedOptions.toggleFlags.enableExtractCss ? MiniCssExtractPlugin__default.default.loader : require.resolve('style-loader'), {
|
|
447
447
|
loader: require.resolve('css-loader'),
|
|
448
448
|
options: {
|
|
449
449
|
modules: {
|
|
@@ -477,7 +477,7 @@ function createWebpackConfigForProduction() {
|
|
|
477
477
|
// improves compile time on larger projects
|
|
478
478
|
{
|
|
479
479
|
loader: require.resolve('thread-loader'),
|
|
480
|
-
options: _objectSpread({}, _Number$isInteger__default
|
|
480
|
+
options: _objectSpread({}, _Number$isInteger__default.default(mergedOptions.toggleFlags.parallelism) ? {
|
|
481
481
|
workers: mergedOptions.toggleFlags.parallelism
|
|
482
482
|
} : {})
|
|
483
483
|
}, {
|
|
@@ -496,7 +496,7 @@ function createWebpackConfigForProduction() {
|
|
|
496
496
|
highlightCode: true
|
|
497
497
|
}
|
|
498
498
|
}],
|
|
499
|
-
include: _concatInstanceProperty__default
|
|
499
|
+
include: _concatInstanceProperty__default.default(_context4 = mergedOptions.sourceFolders).call(_context4, vendorsToTranspile.vendorsToTranspile),
|
|
500
500
|
// Disable require.ensure as it's not a standard language feature.
|
|
501
501
|
parser: {
|
|
502
502
|
requireEnsure: false
|
package/dist/{credentials-storage-fd195144.cjs.dev.js → credentials-storage-B0tDCH7i.cjs.dev.js}
RENAMED
|
@@ -7,9 +7,9 @@ var _Date$now = require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
|
7
7
|
var fs = require('node:fs');
|
|
8
8
|
var os = require('node:os');
|
|
9
9
|
var path = require('node:path');
|
|
10
|
-
var doesFileExist = require('./does-file-exist-
|
|
10
|
+
var doesFileExist = require('./does-file-exist-DrcZIPe6.cjs.dev.js');
|
|
11
11
|
|
|
12
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
|
|
14
14
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
15
15
|
var _Date$now__default = /*#__PURE__*/_interopDefault(_Date$now);
|
|
@@ -26,9 +26,9 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
26
26
|
function CredentialsStorage() {
|
|
27
27
|
_classCallCheck(this, CredentialsStorage);
|
|
28
28
|
this.credentialsFilePath = void 0;
|
|
29
|
-
const homedir = os__default
|
|
30
|
-
const credentialsFolderPath = path__default
|
|
31
|
-
this.credentialsFilePath = path__default
|
|
29
|
+
const homedir = os__default.default.homedir();
|
|
30
|
+
const credentialsFolderPath = path__default.default.join(homedir, `.commercetools`);
|
|
31
|
+
this.credentialsFilePath = path__default.default.join(credentialsFolderPath, 'mc-credentials.json');
|
|
32
32
|
|
|
33
33
|
// Ensure the credentials file is present (skip if using env var token)
|
|
34
34
|
if (!process.env[MC_ACCESS_TOKEN_ENV_VAR]) {
|
|
@@ -39,8 +39,8 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
39
39
|
key: "_ensureCredentialsFileExists",
|
|
40
40
|
value: function _ensureCredentialsFileExists() {
|
|
41
41
|
if (!doesFileExist.doesFileExist(this.credentialsFilePath)) {
|
|
42
|
-
const credentialsFolderPath = path__default
|
|
43
|
-
fs__default
|
|
42
|
+
const credentialsFolderPath = path__default.default.dirname(this.credentialsFilePath);
|
|
43
|
+
fs__default.default.mkdirSync(credentialsFolderPath, {
|
|
44
44
|
recursive: true
|
|
45
45
|
});
|
|
46
46
|
this._writeCredentials();
|
|
@@ -49,14 +49,14 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
49
49
|
}, {
|
|
50
50
|
key: "_writeCredentials",
|
|
51
51
|
value: function _writeCredentials(credentials) {
|
|
52
|
-
fs__default
|
|
52
|
+
fs__default.default.writeFileSync(this.credentialsFilePath, _JSON$stringify__default.default(credentials || {}, null, 2), {
|
|
53
53
|
encoding: 'utf8'
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}, {
|
|
57
57
|
key: "_loadCredentials",
|
|
58
58
|
value: function _loadCredentials() {
|
|
59
|
-
const data = fs__default
|
|
59
|
+
const data = fs__default.default.readFileSync(this.credentialsFilePath, {
|
|
60
60
|
encoding: 'utf8'
|
|
61
61
|
});
|
|
62
62
|
return JSON.parse(data);
|
|
@@ -95,7 +95,7 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
95
95
|
if (!credentials) {
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
|
-
const now = Math.floor(_Date$now__default
|
|
98
|
+
const now = Math.floor(_Date$now__default.default() / 1000);
|
|
99
99
|
return now < credentials.expiresAt;
|
|
100
100
|
}
|
|
101
101
|
}]);
|
|
@@ -5,7 +5,7 @@ import _Date$now from '@babel/runtime-corejs3/core-js-stable/date/now';
|
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import os from 'node:os';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
import { d as doesFileExist } from './does-file-exist-
|
|
8
|
+
import { d as doesFileExist } from './does-file-exist-C7l6j7NP.esm.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Environment variable name for providing a token directly (useful for CI).
|
package/dist/{credentials-storage-ea1c16dc.cjs.prod.js → credentials-storage-C3TlK0a8.cjs.prod.js}
RENAMED
|
@@ -7,9 +7,9 @@ var _Date$now = require('@babel/runtime-corejs3/core-js-stable/date/now');
|
|
|
7
7
|
var fs = require('node:fs');
|
|
8
8
|
var os = require('node:os');
|
|
9
9
|
var path = require('node:path');
|
|
10
|
-
var doesFileExist = require('./does-file-exist-
|
|
10
|
+
var doesFileExist = require('./does-file-exist-DrcZIPe6.cjs.prod.js');
|
|
11
11
|
|
|
12
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
|
|
14
14
|
var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
|
|
15
15
|
var _Date$now__default = /*#__PURE__*/_interopDefault(_Date$now);
|
|
@@ -26,9 +26,9 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
26
26
|
function CredentialsStorage() {
|
|
27
27
|
_classCallCheck(this, CredentialsStorage);
|
|
28
28
|
this.credentialsFilePath = void 0;
|
|
29
|
-
const homedir = os__default
|
|
30
|
-
const credentialsFolderPath = path__default
|
|
31
|
-
this.credentialsFilePath = path__default
|
|
29
|
+
const homedir = os__default.default.homedir();
|
|
30
|
+
const credentialsFolderPath = path__default.default.join(homedir, `.commercetools`);
|
|
31
|
+
this.credentialsFilePath = path__default.default.join(credentialsFolderPath, 'mc-credentials.json');
|
|
32
32
|
|
|
33
33
|
// Ensure the credentials file is present (skip if using env var token)
|
|
34
34
|
if (!process.env[MC_ACCESS_TOKEN_ENV_VAR]) {
|
|
@@ -39,8 +39,8 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
39
39
|
key: "_ensureCredentialsFileExists",
|
|
40
40
|
value: function _ensureCredentialsFileExists() {
|
|
41
41
|
if (!doesFileExist.doesFileExist(this.credentialsFilePath)) {
|
|
42
|
-
const credentialsFolderPath = path__default
|
|
43
|
-
fs__default
|
|
42
|
+
const credentialsFolderPath = path__default.default.dirname(this.credentialsFilePath);
|
|
43
|
+
fs__default.default.mkdirSync(credentialsFolderPath, {
|
|
44
44
|
recursive: true
|
|
45
45
|
});
|
|
46
46
|
this._writeCredentials();
|
|
@@ -49,14 +49,14 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
49
49
|
}, {
|
|
50
50
|
key: "_writeCredentials",
|
|
51
51
|
value: function _writeCredentials(credentials) {
|
|
52
|
-
fs__default
|
|
52
|
+
fs__default.default.writeFileSync(this.credentialsFilePath, _JSON$stringify__default.default(credentials || {}, null, 2), {
|
|
53
53
|
encoding: 'utf8'
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}, {
|
|
57
57
|
key: "_loadCredentials",
|
|
58
58
|
value: function _loadCredentials() {
|
|
59
|
-
const data = fs__default
|
|
59
|
+
const data = fs__default.default.readFileSync(this.credentialsFilePath, {
|
|
60
60
|
encoding: 'utf8'
|
|
61
61
|
});
|
|
62
62
|
return JSON.parse(data);
|
|
@@ -95,7 +95,7 @@ let CredentialsStorage = /*#__PURE__*/function () {
|
|
|
95
95
|
if (!credentials) {
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
|
-
const now = Math.floor(_Date$now__default
|
|
98
|
+
const now = Math.floor(_Date$now__default.default() / 1000);
|
|
99
99
|
return now < credentials.expiresAt;
|
|
100
100
|
}
|
|
101
101
|
}]);
|