dinou 4.0.15 → 4.0.16
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/CHANGELOG.md +7 -0
- package/dinou/core/render-app-to-html.js +11 -4
- package/dinou/core/server.js +9 -3
- package/dinou/core/url-resolver.js +3 -0
- package/dinou/index.d.ts +1 -1
- package/dinou/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [4.0.16] - 2026-06-30
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Cookie Deletion Attributes**: Reconstructed streaming cookie deletion to serialize and include `domain`, `secure`, and `sameSite` properties, ensuring browsers match scopes and delete cookies correctly.
|
|
12
|
+
- **Defensive Redirects**: Added a safety check in `resolveRelativeUrl` to fallback to `/` if the destination path is invalid (such as undefined or null), avoiding server crashes.
|
|
13
|
+
- **TypeScript Type Definitions**: Updated the `clearCookie` signature in `index.d.ts` to accept the full `CookieOptions` interface, resolving compilation errors when using `sameSite` or `secure` attributes.
|
|
14
|
+
|
|
8
15
|
## [4.0.15] - 2026-06-29
|
|
9
16
|
|
|
10
17
|
### Added
|
|
@@ -121,14 +121,21 @@ function renderAppToHtml(
|
|
|
121
121
|
// --- CLEAR COOKIE (JS Injection - Only Non-HttpOnly) ---
|
|
122
122
|
if (command === "clearCookie") {
|
|
123
123
|
const [name, options] = args;
|
|
124
|
-
const path = options && options.path ? options.path : "/";
|
|
125
124
|
console.log(
|
|
126
125
|
`[Dinou] Streaming active. Clearing cookie '${name}' via JS.`,
|
|
127
126
|
);
|
|
128
|
-
|
|
129
|
-
const
|
|
127
|
+
let cookieStr = `${name}=; Max-Age=0`;
|
|
128
|
+
const path = options?.path || "/";
|
|
129
|
+
cookieStr += `; path=${path}`;
|
|
130
|
+
if (options) {
|
|
131
|
+
if (options.domain) cookieStr += `; domain=${options.domain}`;
|
|
132
|
+
if (options.secure) cookieStr += `; secure`;
|
|
133
|
+
if (options.sameSite) cookieStr += `; samesite=${options.sameSite}`;
|
|
134
|
+
}
|
|
135
|
+
cookieStr += ";";
|
|
136
|
+
const safeCookieStr = JSON.stringify(cookieStr);
|
|
130
137
|
res.write(
|
|
131
|
-
`<script>document.cookie = ${
|
|
138
|
+
`<script>document.cookie = ${safeCookieStr};</script>`,
|
|
132
139
|
);
|
|
133
140
|
return;
|
|
134
141
|
}
|
package/dinou/core/server.js
CHANGED
|
@@ -447,8 +447,6 @@ function getContextForServerFunctionEndpoint(req, res) {
|
|
|
447
447
|
},
|
|
448
448
|
|
|
449
449
|
clearCookie: (name, options) => {
|
|
450
|
-
const path = options?.path || "/";
|
|
451
|
-
|
|
452
450
|
// SCENARIO A: Native
|
|
453
451
|
if (!res.headersSent) {
|
|
454
452
|
res.setHeader("Content-Type", "text/x-component");
|
|
@@ -457,7 +455,15 @@ function getContextForServerFunctionEndpoint(req, res) {
|
|
|
457
455
|
}
|
|
458
456
|
|
|
459
457
|
// SCENARIO B: Custom stream command
|
|
460
|
-
|
|
458
|
+
let cookieStr = `${name}=; Max-Age=0`;
|
|
459
|
+
const path = options?.path || "/";
|
|
460
|
+
cookieStr += `; path=${path}`;
|
|
461
|
+
if (options) {
|
|
462
|
+
if (options.domain) cookieStr += `; domain=${options.domain}`;
|
|
463
|
+
if (options.secure) cookieStr += `; secure`;
|
|
464
|
+
if (options.sameSite) cookieStr += `; samesite=${options.sameSite}`;
|
|
465
|
+
}
|
|
466
|
+
cookieStr += ";";
|
|
461
467
|
const safeCookieStr = JSON.stringify(cookieStr);
|
|
462
468
|
res.write(`D:{"type":"cookie","cookie":${safeCookieStr}}\n`);
|
|
463
469
|
},
|
package/dinou/index.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface ResponseProxy {
|
|
|
55
55
|
* @param name Name of the cookie to clear.
|
|
56
56
|
* @param options Cookie options (e.g., domain, path).
|
|
57
57
|
*/
|
|
58
|
-
clearCookie(name: string, options?:
|
|
58
|
+
clearCookie(name: string, options?: CookieOptions): void;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Sends a command to the main process to set an HTTP header.
|
package/dinou/package.json
CHANGED