@salesforce/pwa-kit-dev 3.9.2 → 3.10.0-dev
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.
|
@@ -45,6 +45,9 @@ const INSPECT = process.execArgv.some(arg => /^--inspect(?:-brk)?(?:$|=)/.test(a
|
|
|
45
45
|
const DEBUG = mode !== production && process.env.DEBUG === 'true';
|
|
46
46
|
const CI = process.env.CI;
|
|
47
47
|
const disableHMR = process.env.HMR === 'false';
|
|
48
|
+
if (process.env.PWA_KIT_SSR_SOURCE_MAP) {
|
|
49
|
+
console.warn('PWA_KIT_SSR_SOURCE_MAP env variable will be deprecated for source-map in the next major release. Please use PWA_KIT_SOURCE_MAP');
|
|
50
|
+
}
|
|
48
51
|
if ([production, development].indexOf(mode) < 0) {
|
|
49
52
|
throw new Error(`Invalid mode "${mode}"`);
|
|
50
53
|
}
|
|
@@ -309,7 +312,7 @@ const client = entryPointExists(['app', 'main']) && baseConfig('web').extend(wit
|
|
|
309
312
|
// Must be named "client". See - https://www.npmjs.com/package/webpack-hot-server-middleware#usage
|
|
310
313
|
name: _configNames.CLIENT,
|
|
311
314
|
// use source map to make debugging easier
|
|
312
|
-
devtool: mode === development ? 'source-map' : false,
|
|
315
|
+
devtool: mode === development || process.env.PWA_KIT_SOURCE_MAP === 'true' ? 'source-map' : false,
|
|
313
316
|
entry: {
|
|
314
317
|
main: getAppEntryPoint()
|
|
315
318
|
},
|
|
@@ -332,7 +335,7 @@ const clientOptional = baseConfig('web').extend(config => {
|
|
|
332
335
|
name: _configNames.CLIENT_OPTIONAL,
|
|
333
336
|
entry: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, optional('loader', (0, _path.resolve)(projectDir, EXT_OVERRIDES_DIR, 'app', 'loader.js'))), optional('worker', (0, _path.resolve)(projectDir, 'worker', 'main.js'))), optional('core-polyfill', (0, _path.resolve)(projectDir, 'node_modules', 'core-js'))), optional('fetch-polyfill', (0, _path.resolve)(projectDir, 'node_modules', 'whatwg-fetch'))),
|
|
334
337
|
// use source map to make debugging easier
|
|
335
|
-
devtool: mode === development ? 'source-map' : false,
|
|
338
|
+
devtool: mode === development || process.env.PWA_KIT_SOURCE_MAP === 'true' ? 'source-map' : false,
|
|
336
339
|
plugins: [...config.plugins, analyzeBundle && getBundleAnalyzerPlugin(_configNames.CLIENT_OPTIONAL)].filter(Boolean)
|
|
337
340
|
});
|
|
338
341
|
}).build();
|
|
@@ -342,7 +345,7 @@ const renderer = _fsExtra.default.existsSync((0, _path.resolve)(projectDir, 'nod
|
|
|
342
345
|
name: _configNames.SERVER,
|
|
343
346
|
entry: '@salesforce/pwa-kit-react-sdk/ssr/server/react-rendering.js',
|
|
344
347
|
// use eval-source-map for server-side debugging
|
|
345
|
-
devtool: mode === development && INSPECT ? 'eval-source-map' : false,
|
|
348
|
+
devtool: mode === development && INSPECT || process.env.PWA_KIT_SOURCE_MAP === 'true' ? 'eval-source-map' : false,
|
|
346
349
|
output: {
|
|
347
350
|
path: buildDir,
|
|
348
351
|
// We want to split the build on local development to reduce memory usage.
|
|
@@ -364,7 +367,7 @@ const ssr = (() => {
|
|
|
364
367
|
// Only compile the ssr file when we're building for prod.
|
|
365
368
|
if (mode === production) {
|
|
366
369
|
return baseConfig('node').extend(config => {
|
|
367
|
-
return _objectSpread(_objectSpread(_objectSpread({}, config), process.env.PWA_KIT_SSR_SOURCE_MAP === 'true' ? {
|
|
370
|
+
return _objectSpread(_objectSpread(_objectSpread({}, config), process.env.PWA_KIT_SSR_SOURCE_MAP === 'true' || process.env.PWA_KIT_SOURCE_MAP === 'true' ? {
|
|
368
371
|
devtool: 'source-map'
|
|
369
372
|
} : {}), {}, {
|
|
370
373
|
// Must *not* be named "server". See - https://www.npmjs.com/package/webpack-hot-server-middleware#usage
|
|
@@ -393,7 +396,7 @@ const requestProcessor = entryPointExists(['app', 'request-processor']) && baseC
|
|
|
393
396
|
libraryTarget: 'commonjs2'
|
|
394
397
|
},
|
|
395
398
|
// use eval-source-map for server-side debugging
|
|
396
|
-
devtool: mode === development && INSPECT ? 'eval-source-map' : false,
|
|
399
|
+
devtool: mode === development && INSPECT || process.env.PWA_KIT_SOURCE_MAP === 'true' ? 'eval-source-map' : false,
|
|
397
400
|
plugins: [...config.plugins, analyzeBundle && getBundleAnalyzerPlugin(_configNames.REQUEST_PROCESSOR)].filter(Boolean)
|
|
398
401
|
});
|
|
399
402
|
}).build();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/pwa-kit-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0-dev",
|
|
4
4
|
"description": "Build tools for pwa-kit",
|
|
5
5
|
"homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/pwa-kit-dev#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"@loadable/server": "^5.15.3",
|
|
59
59
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
60
60
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
61
|
-
"@salesforce/pwa-kit-runtime": "3.
|
|
61
|
+
"@salesforce/pwa-kit-runtime": "3.10.0-dev",
|
|
62
62
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
63
63
|
"@typescript-eslint/parser": "^5.57.0",
|
|
64
64
|
"archiver": "1.3.0",
|
|
65
65
|
"babel-jest": "^26.6.3",
|
|
66
66
|
"babel-loader": "^8.3.0",
|
|
67
67
|
"babel-plugin-dynamic-import-node-babel-7": "^2.0.7",
|
|
68
|
-
"babel-plugin-formatjs": "10.
|
|
68
|
+
"babel-plugin-formatjs": "10.5.36",
|
|
69
69
|
"chalk": "^4.1.2",
|
|
70
70
|
"commander": "^9.5.0",
|
|
71
71
|
"compression": "1.7.4",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@types/node": "~16.0.3",
|
|
122
122
|
"@types/node-fetch": "~2.6.3",
|
|
123
123
|
"@types/validator": "~13.7.14",
|
|
124
|
-
"internal-lib-build": "3.
|
|
124
|
+
"internal-lib-build": "3.10.0-dev",
|
|
125
125
|
"nock": "^13.3.0",
|
|
126
126
|
"nodemon": "^2.0.22",
|
|
127
127
|
"superagent": "^6.1.0",
|
|
@@ -147,5 +147,5 @@
|
|
|
147
147
|
"publishConfig": {
|
|
148
148
|
"directory": "dist"
|
|
149
149
|
},
|
|
150
|
-
"gitHead": "
|
|
150
|
+
"gitHead": "d86dc7bea3fe03a0f475ecf1a0ab878374f07026"
|
|
151
151
|
}
|
|
@@ -560,7 +560,7 @@ describe('DevServer rendering', () => {
|
|
|
560
560
|
});
|
|
561
561
|
describe('DevServer service worker', () => {
|
|
562
562
|
let tmpDir;
|
|
563
|
-
beforeEach(
|
|
563
|
+
beforeEach(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
564
564
|
tmpDir = yield _fsExtra.default.mkdtemp(_path.default.join(_os.default.tmpdir(), 'pwa-kit-test-'));
|
|
565
565
|
}));
|
|
566
566
|
afterEach(() => {
|
package/utils/script-utils.js
CHANGED
|
@@ -83,7 +83,7 @@ const walkDir = exports.walkDir = /*#__PURE__*/function () {
|
|
|
83
83
|
const entries = yield (0, _fsExtra.readdir)(dir, {
|
|
84
84
|
withFileTypes: true
|
|
85
85
|
});
|
|
86
|
-
yield Promise.all(entries.map(
|
|
86
|
+
yield Promise.all(entries.map(/*#__PURE__*/function () {
|
|
87
87
|
var _ref4 = _asyncToGenerator(function* (entry) {
|
|
88
88
|
const entryPath = _path.default.join(dir, entry.name);
|
|
89
89
|
if (entry.isDirectory()) {
|
|
@@ -375,7 +375,7 @@ const createBundle = exports.createBundle = /*#__PURE__*/function () {
|
|
|
375
375
|
archive.on('error', reject);
|
|
376
376
|
output.on('finish', resolve);
|
|
377
377
|
archive.finalize();
|
|
378
|
-
})).then(
|
|
378
|
+
})).then(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
379
379
|
const {
|
|
380
380
|
dependencies = {},
|
|
381
381
|
devDependencies = {},
|
|
@@ -41,7 +41,7 @@ jest.mock('child_process', () => {
|
|
|
41
41
|
describe('scriptUtils', () => {
|
|
42
42
|
const originalEnv = process.env;
|
|
43
43
|
let tmpDir;
|
|
44
|
-
beforeEach(
|
|
44
|
+
beforeEach(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
45
45
|
process.env = _objectSpread({}, originalEnv);
|
|
46
46
|
tmpDir = yield (0, _fsExtra.mkdtemp)(_path.default.join(_os.default.tmpdir(), 'scriptUtils-tests'));
|
|
47
47
|
// This is a workaround for jest.spyOn(), since I guess it doesn't work with our imports?
|
|
@@ -49,7 +49,7 @@ describe('scriptUtils', () => {
|
|
|
49
49
|
_fsExtra.readJson.mockReset().mockImplementation(actualReadJson);
|
|
50
50
|
_child_process.execSync.mockReset().mockImplementation(actualExecSync);
|
|
51
51
|
}));
|
|
52
|
-
afterEach(
|
|
52
|
+
afterEach(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
53
53
|
process.env = originalEnv;
|
|
54
54
|
tmpDir && (yield (0, _fsExtra.rm)(tmpDir, {
|
|
55
55
|
recursive: true
|
|
@@ -250,14 +250,14 @@ describe('scriptUtils', () => {
|
|
|
250
250
|
}));
|
|
251
251
|
test('should throw', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
252
252
|
const thePath = _path.default.join(tmpDir, '.mobify.test');
|
|
253
|
-
yield expect(
|
|
253
|
+
yield expect(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
254
254
|
return yield scriptUtils.readCredentials(thePath);
|
|
255
255
|
})).rejects.toThrow(Error);
|
|
256
256
|
}));
|
|
257
257
|
});
|
|
258
258
|
describe('createBundle', () => {
|
|
259
259
|
test('should throw if ssr_only and ssr_shared is empty', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
260
|
-
yield expect(
|
|
260
|
+
yield expect(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
261
261
|
return yield scriptUtils.createBundle({
|
|
262
262
|
message: null,
|
|
263
263
|
ssr_parameters: {},
|
|
@@ -269,7 +269,7 @@ describe('scriptUtils', () => {
|
|
|
269
269
|
})).rejects.toThrow('no ssrOnly or ssrShared files are defined');
|
|
270
270
|
}));
|
|
271
271
|
test('should throw buildDir does not exist', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
272
|
-
yield expect(
|
|
272
|
+
yield expect(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
273
273
|
return yield scriptUtils.createBundle({
|
|
274
274
|
message: null,
|
|
275
275
|
ssr_parameters: {},
|
|
@@ -357,7 +357,7 @@ describe('scriptUtils', () => {
|
|
|
357
357
|
text,
|
|
358
358
|
json
|
|
359
359
|
};
|
|
360
|
-
const fetchMock = jest.fn(
|
|
360
|
+
const fetchMock = jest.fn(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
361
361
|
return responseMock;
|
|
362
362
|
}));
|
|
363
363
|
const client = new scriptUtils.CloudAPIClient({
|
|
@@ -410,7 +410,7 @@ describe('scriptUtils', () => {
|
|
|
410
410
|
const json = () => Promise.resolve({
|
|
411
411
|
token: 'token-value'
|
|
412
412
|
});
|
|
413
|
-
const fetchMock = jest.fn(
|
|
413
|
+
const fetchMock = jest.fn(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
414
414
|
return {
|
|
415
415
|
status: 200,
|
|
416
416
|
text,
|
|
@@ -474,8 +474,8 @@ describe('scriptUtils', () => {
|
|
|
474
474
|
});
|
|
475
475
|
describe('walkDir', () => {
|
|
476
476
|
const files = ['a', 'b/1', 'b/2', 'c/d/e'].map(_path.default.normalize);
|
|
477
|
-
beforeEach(
|
|
478
|
-
yield Promise.all(files.map(
|
|
477
|
+
beforeEach(/*#__PURE__*/_asyncToGenerator(function* () {
|
|
478
|
+
yield Promise.all(files.map(/*#__PURE__*/function () {
|
|
479
479
|
var _ref38 = _asyncToGenerator(function* (file) {
|
|
480
480
|
return yield (0, _fsExtra.createFile)(_path.default.join(tmpDir, file));
|
|
481
481
|
});
|