@whatwg-node/server 0.9.64-rc-20241217131723-ff31d6accae8af9e276eb3d79387d28fb11b6b5f → 0.9.65-alpha-20241224144308-cda07d199da2a29f42043448a40e85b64d51d8a4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/cjs/createServerAdapter.js +14 -8
- package/esm/createServerAdapter.js +14 -8
- package/package.json +1 -1
package/README.md
CHANGED
@@ -40,7 +40,7 @@ nodeServer.listen(4000)
|
|
40
40
|
### AWS Lambda
|
41
41
|
|
42
42
|
AWS Lambda is a serverless computing platform that makes it easy to build applications that run on
|
43
|
-
the AWS cloud. Our
|
43
|
+
the AWS cloud. Our adapter is platform agnostic so they can fit together easily. In order to reduce
|
44
44
|
the boilerplate we prefer to use
|
45
45
|
[Serverless Express from Vendia](https://github.com/vendia/serverless-express).
|
46
46
|
|
@@ -48,14 +48,16 @@ function createServerAdapter(serverAdapterBaseObject, options) {
|
|
48
48
|
}
|
49
49
|
function waitUntil(promiseLike) {
|
50
50
|
// Ensure that the disposable stack is created
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
if ((0, utils_js_1.isPromise)(promiseLike)) {
|
52
|
+
ensureDisposableStack();
|
53
|
+
waitUntilPromises.add(promiseLike);
|
54
|
+
promiseLike.then(() => {
|
55
|
+
waitUntilPromises.delete(promiseLike);
|
56
|
+
}, err => {
|
57
|
+
console.error(`Unexpected error while waiting: ${err.message || err}`);
|
58
|
+
waitUntilPromises.delete(promiseLike);
|
59
|
+
});
|
60
|
+
}
|
59
61
|
}
|
60
62
|
if (options?.plugins != null) {
|
61
63
|
for (const plugin of options.plugins) {
|
@@ -149,6 +151,10 @@ function createServerAdapter(serverAdapterBaseObject, options) {
|
|
149
151
|
// TODO: Remove this on the next major version
|
150
152
|
function handleNodeRequest(nodeRequest, ...ctx) {
|
151
153
|
const serverContext = ctx.length > 1 ? (0, utils_js_1.completeAssign)(...ctx) : ctx[0] || {};
|
154
|
+
// Ensure `waitUntil` is available in the server context
|
155
|
+
if (!serverContext.waitUntil) {
|
156
|
+
serverContext.waitUntil = waitUntil;
|
157
|
+
}
|
152
158
|
const request = (0, utils_js_1.normalizeNodeRequest)(nodeRequest, fetchAPI);
|
153
159
|
return handleRequest(request, serverContext);
|
154
160
|
}
|
@@ -44,14 +44,16 @@ function createServerAdapter(serverAdapterBaseObject, options) {
|
|
44
44
|
}
|
45
45
|
function waitUntil(promiseLike) {
|
46
46
|
// Ensure that the disposable stack is created
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
if (isPromise(promiseLike)) {
|
48
|
+
ensureDisposableStack();
|
49
|
+
waitUntilPromises.add(promiseLike);
|
50
|
+
promiseLike.then(() => {
|
51
|
+
waitUntilPromises.delete(promiseLike);
|
52
|
+
}, err => {
|
53
|
+
console.error(`Unexpected error while waiting: ${err.message || err}`);
|
54
|
+
waitUntilPromises.delete(promiseLike);
|
55
|
+
});
|
56
|
+
}
|
55
57
|
}
|
56
58
|
if (options?.plugins != null) {
|
57
59
|
for (const plugin of options.plugins) {
|
@@ -145,6 +147,10 @@ function createServerAdapter(serverAdapterBaseObject, options) {
|
|
145
147
|
// TODO: Remove this on the next major version
|
146
148
|
function handleNodeRequest(nodeRequest, ...ctx) {
|
147
149
|
const serverContext = ctx.length > 1 ? completeAssign(...ctx) : ctx[0] || {};
|
150
|
+
// Ensure `waitUntil` is available in the server context
|
151
|
+
if (!serverContext.waitUntil) {
|
152
|
+
serverContext.waitUntil = waitUntil;
|
153
|
+
}
|
148
154
|
const request = normalizeNodeRequest(nodeRequest, fetchAPI);
|
149
155
|
return handleRequest(request, serverContext);
|
150
156
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/server",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.65-alpha-20241224144308-cda07d199da2a29f42043448a40e85b64d51d8a4",
|
4
4
|
"description": "Fetch API compliant HTTP Server adapter",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|