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 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
- const safeName = JSON.stringify(name);
129
- const safePath = JSON.stringify(path);
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 = ${safeName} + "=; Max-Age=0; path=" + ${safePath} + ";";</script>`,
138
+ `<script>document.cookie = ${safeCookieStr};</script>`,
132
139
  );
133
140
  return;
134
141
  }
@@ -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
- const cookieStr = `${name}=; Max-Age=0; path=${path};`;
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
  },
@@ -1,4 +1,7 @@
1
1
  function resolveRelativeUrl(href, currentPathname) {
2
+ if (!href || typeof href !== "string") {
3
+ return "/";
4
+ }
2
5
  if (href.startsWith("/") || href.includes("://")) {
3
6
  return href;
4
7
  }
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?: { domain?: string; path?: string }): void;
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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou-ejected",
3
- "version": "4.0.15",
3
+ "version": "4.0.16",
4
4
  "main": "index.js",
5
5
  "private": true,
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinou",
3
- "version": "4.0.15",
3
+ "version": "4.0.16",
4
4
  "description": "Full-Stack React 19 framework with React Server Components, Server Functions, and Streaming SSR.",
5
5
  "main": "index.js",
6
6
  "bin": {