@salesforce/pwa-kit-dev 3.11.0 → 3.12.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.
|
@@ -13,6 +13,7 @@ var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
|
|
13
13
|
var _webpackPlugin = _interopRequireDefault(require("@loadable/webpack-plugin"));
|
|
14
14
|
var _reactRefreshWebpackPlugin = _interopRequireDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
|
|
15
15
|
var _speedMeasureWebpackPlugin = _interopRequireDefault(require("speed-measure-webpack-plugin"));
|
|
16
|
+
var _ssrNamespacePaths = require("@salesforce/pwa-kit-runtime/utils/ssr-namespace-paths");
|
|
16
17
|
var _overridesPlugin = _interopRequireDefault(require("./overrides-plugin"));
|
|
17
18
|
var _plugins = require("./plugins");
|
|
18
19
|
var _configNames = require("./config-names");
|
|
@@ -94,9 +95,6 @@ const entryPointExists = segments => {
|
|
|
94
95
|
const getAppEntryPoint = () => {
|
|
95
96
|
return (0, _path.resolve)('./', EXT_OVERRIDES_DIR_NO_SLASH, 'app', 'main');
|
|
96
97
|
};
|
|
97
|
-
const getPublicPathEntryPoint = () => {
|
|
98
|
-
return (0, _path.resolve)(projectDir, 'node_modules', '@salesforce', 'pwa-kit-dev', 'ssr', 'server', 'public-path');
|
|
99
|
-
};
|
|
100
98
|
const findDepInStack = pkg => {
|
|
101
99
|
// Look for the SDK node_modules in two places because in CI,
|
|
102
100
|
// pwa-kit-dev is published under a 'dist' directory, which
|
|
@@ -295,12 +293,16 @@ const enableReactRefresh = config => {
|
|
|
295
293
|
}
|
|
296
294
|
const newRule = ruleForBabelLoader([require.resolve('react-refresh/babel')]);
|
|
297
295
|
const rules = findAndReplace(config.module.rules, rule => rule.id === 'babel-loader', newRule);
|
|
296
|
+
const hmrBasePath = `${(0, _ssrNamespacePaths.getEnvBasePath)()}${_ssrNamespacePaths.bundleBasePath}/development/`;
|
|
298
297
|
return _objectSpread(_objectSpread({}, config), {}, {
|
|
299
298
|
module: _objectSpread(_objectSpread({}, config.module), {}, {
|
|
300
299
|
rules
|
|
301
300
|
}),
|
|
302
301
|
entry: _objectSpread(_objectSpread({}, config.entry), {}, {
|
|
303
|
-
main: ['webpack-hot-middleware/client?path=/__mrt/hmr',
|
|
302
|
+
main: ['webpack-hot-middleware/client?path=/__mrt/hmr', getAppEntryPoint()]
|
|
303
|
+
}),
|
|
304
|
+
output: _objectSpread(_objectSpread({}, config.output), {}, {
|
|
305
|
+
publicPath: hmrBasePath
|
|
304
306
|
}),
|
|
305
307
|
plugins: [...config.plugins, new _webpack.default.HotModuleReplacementPlugin(), new _reactRefreshWebpackPlugin.default({
|
|
306
308
|
overlay: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/pwa-kit-dev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.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,7 +58,7 @@
|
|
|
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.12.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",
|
|
@@ -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.12.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": "60d9a47ad71824709be52bbe1110b092f7698244"
|
|
151
151
|
}
|
|
@@ -60,31 +60,32 @@ const insecureFetch = (url, opts) => {
|
|
|
60
60
|
agent: _parsedURL => _parsedURL.protocol === 'https:' ? httpsAgent : httpAgent
|
|
61
61
|
}));
|
|
62
62
|
};
|
|
63
|
+
const mobifyConfig = {
|
|
64
|
+
ssrEnabled: true,
|
|
65
|
+
ssrOnly: ['main.js.map', 'ssr.js', 'ssr.js.map'],
|
|
66
|
+
ssrShared: ['main.js', 'ssr-loader.js', 'worker.js'],
|
|
67
|
+
ssrParameters: {
|
|
68
|
+
proxyConfigs: [{
|
|
69
|
+
protocol: 'https',
|
|
70
|
+
host: 'test.proxy.com',
|
|
71
|
+
path: 'base'
|
|
72
|
+
}, {
|
|
73
|
+
protocol: 'https',
|
|
74
|
+
// This is intentionally an unreachable host
|
|
75
|
+
host: '0.0.0.0',
|
|
76
|
+
path: 'base2'
|
|
77
|
+
}, {
|
|
78
|
+
protocol: 'https',
|
|
79
|
+
host: 'test.proxy.com',
|
|
80
|
+
path: 'base3',
|
|
81
|
+
caching: true
|
|
82
|
+
}]
|
|
83
|
+
}
|
|
84
|
+
};
|
|
63
85
|
const opts = (overrides = {}) => {
|
|
64
86
|
const defaults = {
|
|
65
87
|
buildDir: _path.default.join(testFixtures, 'build'),
|
|
66
|
-
mobify:
|
|
67
|
-
ssrEnabled: true,
|
|
68
|
-
ssrOnly: ['main.js.map', 'ssr.js', 'ssr.js.map'],
|
|
69
|
-
ssrShared: ['main.js', 'ssr-loader.js', 'worker.js'],
|
|
70
|
-
ssrParameters: {
|
|
71
|
-
proxyConfigs: [{
|
|
72
|
-
protocol: 'https',
|
|
73
|
-
host: 'test.proxy.com',
|
|
74
|
-
path: 'base'
|
|
75
|
-
}, {
|
|
76
|
-
protocol: 'https',
|
|
77
|
-
// This is intentionally an unreachable host
|
|
78
|
-
host: '0.0.0.0',
|
|
79
|
-
path: 'base2'
|
|
80
|
-
}, {
|
|
81
|
-
protocol: 'https',
|
|
82
|
-
host: 'test.proxy.com',
|
|
83
|
-
path: 'base3',
|
|
84
|
-
caching: true
|
|
85
|
-
}]
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
+
mobify: mobifyConfig,
|
|
88
89
|
quiet: true,
|
|
89
90
|
port: TEST_PORT,
|
|
90
91
|
protocol: 'http',
|
|
@@ -92,6 +93,11 @@ const opts = (overrides = {}) => {
|
|
|
92
93
|
};
|
|
93
94
|
return _objectSpread(_objectSpread({}, defaults), overrides);
|
|
94
95
|
};
|
|
96
|
+
jest.mock('@salesforce/pwa-kit-runtime/utils/ssr-config', () => {
|
|
97
|
+
return {
|
|
98
|
+
getConfig: () => mobifyConfig
|
|
99
|
+
};
|
|
100
|
+
});
|
|
95
101
|
describe('DevServer error handlers', () => {
|
|
96
102
|
const expectServerErrorHandled = (error, times) => {
|
|
97
103
|
const proc = {
|
|
@@ -646,6 +652,7 @@ describe('DevServer serveStaticFile', () => {
|
|
|
646
652
|
});
|
|
647
653
|
describe('SLAS private client proxy', () => {
|
|
648
654
|
test('should throw error if PWA_KIT_SLAS_CLIENT_SECRET env var not set', () => {
|
|
655
|
+
delete process.env.PWA_KIT_SLAS_CLIENT_SECRET;
|
|
649
656
|
expect(() => {
|
|
650
657
|
NoWebpackDevServerFactory._createApp(opts({
|
|
651
658
|
useSLASPrivateClient: true
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _ssrNamespacePaths = require("@salesforce/pwa-kit-runtime/utils/ssr-namespace-paths");
|
|
4
|
-
/*
|
|
5
|
-
* Copyright (c) 2024, salesforce.com, inc.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This file is used to dynamically set the webpack public path used by HMR via the global webpack variable
|
|
13
|
-
* __webpack_public_path__
|
|
14
|
-
* See https://webpack.js.org/guides/public-path/
|
|
15
|
-
*
|
|
16
|
-
* Previously, we hard coded the public path in our webpack config to '/mobify/bundle/development/'
|
|
17
|
-
* but we need something more dynamic to support namespaced /mobify paths.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/* global __webpack_public_path__: writable */
|
|
21
|
-
__webpack_public_path__ = `${_ssrNamespacePaths.bundleBasePath}/development/`;
|