@stacksjs/stx 0.2.189 → 0.2.191

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/dist/signals.js CHANGED
@@ -5413,16 +5413,34 @@ catch (e) {} }
5413
5413
  if (opts.domain) parts.push('domain=' + opts.domain);
5414
5414
  if (value === '') parts.push('max-age=0');
5415
5415
  else if (typeof opts.maxAge === 'number') parts.push('max-age=' + opts.maxAge);
5416
- else if (opts.expires) parts.push('expires=' + opts.expires.toUTCString());
5416
+ else if (opts.expires !== undefined) {
5417
+ // Date, seconds-from-now, or anything Date can parse \u2014 matching the
5418
+ // composable. Accepting only a Date here meant the same option silently
5419
+ // produced a session cookie on the runtime path.
5420
+ var expiresDate = opts.expires instanceof Date
5421
+ ? opts.expires
5422
+ : (typeof opts.expires === 'number' ? new Date(Date.now() + opts.expires * 1000) : new Date(opts.expires));
5423
+ parts.push('expires=' + expiresDate.toUTCString());
5424
+ }
5417
5425
  parts.push('SameSite=' + (opts.sameSite || 'Lax'));
5418
5426
  var secure = opts.secure;
5419
5427
  if (secure === undefined) secure = typeof location !== 'undefined' && location.protocol === 'https:';
5420
5428
  if (secure) parts.push('Secure');
5421
5429
  return parts.join('; ');
5422
5430
  }
5423
- effect(function() {
5431
+ // subscribe, not effect: an effect runs once at creation, so merely
5432
+ // DECLARING a cookie rewrote it from these options. A second declaration
5433
+ // that only wanted to read - no options, because it is not the owner of the
5434
+ // policy - therefore reserialised it with no max-age, which is the
5435
+ // definition of a session cookie. A 30-day login died at browser close
5436
+ // because the user opened a settings page (#1933).
5437
+ //
5438
+ // subscribe fires on set() only, so construction is a pure read: read()
5439
+ // above already seeds the signal. This matches the composable, which has
5440
+ // always used subscribe.
5441
+ s.subscribe(function(value) {
5424
5442
  if (typeof document === 'undefined') return;
5425
- document.cookie = serialise(s());
5443
+ document.cookie = serialise(value);
5426
5444
  });
5427
5445
  return s;
5428
5446
  }
package/dist/ssg.d.ts CHANGED
@@ -123,6 +123,19 @@ export interface SSGConfig {
123
123
  trailingSlash?: boolean;
124
124
  /** Clean output directory before build */
125
125
  cleanOutput?: boolean;
126
+ /**
127
+ * Extra input folded into every page's cache key.
128
+ *
129
+ * A page's key is its own file plus the dependencies collected while
130
+ * rendering it, which covers templates, components and layouts and nothing
131
+ * else. Anything build-wide — the Crosswind config, an env var the pages read
132
+ * — is invisible to it, and a build that reports every route `Cached` and
133
+ * exits 0 gives no signal that it used the old value (#1940).
134
+ *
135
+ * Defaults to a digest of the resolved Crosswind config. Set it to add your
136
+ * own build inputs; set it to a constant to opt out of that default.
137
+ */
138
+ cacheSalt?: string;
126
139
  /**
127
140
  * Per-island chunking (#1746): lift each `client="<trigger>"` island's inline
128
141
  * setup script into a content-hashed chunk under `_stx/islands/` that the