@salesforce/pwa-kit-runtime 3.0.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +24 -0
- package/package.json +76 -0
- package/scripts/version.js +22 -0
- package/ssr/server/build-remote-server.js +1025 -0
- package/ssr/server/build-remote-server.test.js +24 -0
- package/ssr/server/constants.js +37 -0
- package/ssr/server/express.js +460 -0
- package/ssr/server/express.lambda.test.js +383 -0
- package/ssr/server/express.test.js +847 -0
- package/ssr/server/test_fixtures/favicon.ico +0 -0
- package/ssr/server/test_fixtures/loadable-stats.json +1 -0
- package/ssr/server/test_fixtures/localhost.pem +45 -0
- package/ssr/server/test_fixtures/main.js +7 -0
- package/ssr/server/test_fixtures/mobify.png +0 -0
- package/ssr/server/test_fixtures/server-renderer.js +12 -0
- package/ssr/server/test_fixtures/worker.js +7 -0
- package/ssr/server/test_fixtures/worker.js.map +1 -0
- package/utils/morgan-stream.js +26 -0
- package/utils/ssr-cache.js +177 -0
- package/utils/ssr-cache.test.js +64 -0
- package/utils/ssr-config.client.js +23 -0
- package/utils/ssr-config.client.test.js +25 -0
- package/utils/ssr-config.js +20 -0
- package/utils/ssr-config.server.js +88 -0
- package/utils/ssr-config.server.test.js +30 -0
- package/utils/ssr-proxying.js +804 -0
- package/utils/ssr-proxying.test.js +591 -0
- package/utils/ssr-request-processing.js +164 -0
- package/utils/ssr-request-processing.test.js +95 -0
- package/utils/ssr-server/cached-response.js +116 -0
- package/utils/ssr-server/configure-proxy.js +241 -0
- package/utils/ssr-server/metrics-sender.js +191 -0
- package/utils/ssr-server/outgoing-request-hook.js +139 -0
- package/utils/ssr-server/parse-end-parameters.js +38 -0
- package/utils/ssr-server/process-express-response.js +56 -0
- package/utils/ssr-server/process-lambda-response.js +36 -0
- package/utils/ssr-server/update-global-agent-options.js +42 -0
- package/utils/ssr-server/update-global-agent-options.test.js +28 -0
- package/utils/ssr-server/utils.js +119 -0
- package/utils/ssr-server/utils.test.js +64 -0
- package/utils/ssr-server/wrap-response-write.js +40 -0
- package/utils/ssr-server.js +115 -0
- package/utils/ssr-server.test.js +835 -0
- package/utils/ssr-shared.js +185 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021, Salesforce.com, Inc.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
11
|
+
|
|
12
|
+
3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# The PWA Kit Runtime
|
|
2
|
+
|
|
3
|
+
A library of runtime environments that enable Node.js applications to run on Managed Runtime.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
The full documentation for PWA Kit and Managed Runtime is hosted on the [Salesforce Developers](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/overview) portal.
|
|
8
|
+
|
|
9
|
+
### Useful Links:
|
|
10
|
+
|
|
11
|
+
- [Get Started](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/getting-started.html)
|
|
12
|
+
- [Skills for Success](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/skills-for-success.html)
|
|
13
|
+
- [Set Up API Access](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/setting-up-api-access.html)
|
|
14
|
+
- [Configuration Options](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/configuration-options.html)
|
|
15
|
+
- [Proxy Requests](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/proxying-requests.html)
|
|
16
|
+
- [Push and Deploy Bundles](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pushing-and-deploying-bundles.html)
|
|
17
|
+
- [The Retail React App](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/retail-react-app.html)
|
|
18
|
+
- [Rendering](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/rendering.html)
|
|
19
|
+
- [Routing](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/routing.html)
|
|
20
|
+
- [Phased Headless Rollouts](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html)
|
|
21
|
+
- [Launch Your Storefront](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/launching-your-storefront.html)
|
|
22
|
+
|
|
23
|
+
## Support Policy
|
|
24
|
+
Security patches are provided for 24 months after the general availability of each major version of the SDK (1.0, 2.0, and so on).
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/pwa-kit-runtime",
|
|
3
|
+
"version": "3.0.0-preview.0",
|
|
4
|
+
"description": "The PWAKit Runtime",
|
|
5
|
+
"homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/pwa-kit-runtime#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/SalesforceCommerceCloud/pwa-kit/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/SalesforceCommerceCloud/pwa-kit.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
14
|
+
"author": "cc-pwa-kit@salesforce.com",
|
|
15
|
+
"files": [
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"scripts",
|
|
18
|
+
"ssr",
|
|
19
|
+
"utils"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "cross-env NODE_ENV=production internal-lib-build build",
|
|
23
|
+
"build:watch": "nodemon --watch 'src/**' --exec 'npm run build'",
|
|
24
|
+
"format": "internal-lib-build format \"**/*.{js,jsx}\"",
|
|
25
|
+
"lint": "npm run lint:js",
|
|
26
|
+
"lint:fix": "npm run lint:js -- --fix",
|
|
27
|
+
"lint:js": "pwa-kit-dev lint .",
|
|
28
|
+
"prepare": "npm run build",
|
|
29
|
+
"test": "internal-lib-build test",
|
|
30
|
+
"version": "node ./scripts/version.js"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@loadable/babel-plugin": "^5.15.3",
|
|
34
|
+
"aws-sdk": "^2.1354.0",
|
|
35
|
+
"aws-serverless-express": "3.4.0",
|
|
36
|
+
"cosmiconfig": "^8.1.3",
|
|
37
|
+
"cross-env": "^5.2.1",
|
|
38
|
+
"express": "^4.18.2",
|
|
39
|
+
"header-case": "1.0.1",
|
|
40
|
+
"http-proxy-middleware": "0.21.0",
|
|
41
|
+
"merge-descriptors": "^1.0.1",
|
|
42
|
+
"morgan": "^1.10.0",
|
|
43
|
+
"semver": "^7.3.8",
|
|
44
|
+
"set-cookie-parser": "^2.6.0",
|
|
45
|
+
"whatwg-encoding": "^1.0.5"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@loadable/component": "^5.15.3",
|
|
49
|
+
"@salesforce/pwa-kit-dev": "3.0.0-preview.0",
|
|
50
|
+
"@serverless/event-mocks": "^1.1.1",
|
|
51
|
+
"aws-lambda-mock-context": "^3.2.1",
|
|
52
|
+
"fs-extra": "^10.1.0",
|
|
53
|
+
"internal-lib-build": "3.0.0-preview.0",
|
|
54
|
+
"nock": "^13.3.0",
|
|
55
|
+
"nodemon": "^2.0.22",
|
|
56
|
+
"sinon": "^13.0.2",
|
|
57
|
+
"superagent": "^6.1.0",
|
|
58
|
+
"supertest": "^4.0.2"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@salesforce/pwa-kit-dev": "^3.0.0-preview.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"@salesforce/pwa-kit-dev": {
|
|
65
|
+
"optional": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": "^16.11.0 || ^18.0.0",
|
|
70
|
+
"npm": "^8.0.0 || ^9.0.0"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"directory": "dist"
|
|
74
|
+
},
|
|
75
|
+
"gitHead": "a9f820893b7714244a0af509a5aefecc1344153c"
|
|
76
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
9
|
+
// Update Change Log heading
|
|
10
|
+
const pkg = require('../package.json')
|
|
11
|
+
const path = require('path')
|
|
12
|
+
const os = require('os')
|
|
13
|
+
const fs = require('fs')
|
|
14
|
+
|
|
15
|
+
const date = new Date().toString().split(' ').slice(1, 4)
|
|
16
|
+
const heading = `## v${pkg.version} (${date[0]} ${date[1]}, ${date[2]})\n`
|
|
17
|
+
|
|
18
|
+
const changelog = path.resolve(os.tmpdir(), 'CHANGELOG.md')
|
|
19
|
+
|
|
20
|
+
fs.writeFileSync(changelog, heading, 'utf8')
|
|
21
|
+
fs.appendFileSync(changelog, fs.readFileSync('CHANGELOG.md'), 'utf8')
|
|
22
|
+
fs.copyFileSync(changelog, 'CHANGELOG.md')
|