@timber-js/app 0.1.56 → 0.1.57

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.
@@ -23,6 +23,11 @@
23
23
  * that depend on these APIs are safe to call from any environment —
24
24
  * they return null or no-op when the APIs aren't available.
25
25
  *
26
+ * Singleton guarantee: With the simplified chunking strategy (LOCAL-337),
27
+ * this module lives in exactly one client chunk. The previous globalThis +
28
+ * Symbol.for workaround for cross-chunk duplication is no longer needed.
29
+ * See design/27-chunking-strategy.md.
30
+ *
26
31
  * See design/19-client-navigation.md §"NavigationContext"
27
32
  */
28
33
  import React, { type ReactNode } from 'react';
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-context.d.ts","sourceRoot":"","sources":["../../src/client/navigation-context.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAM7D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAyCD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,GAAG,IAAI,CAM7D;AAMD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAO9C;AA6BD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAE/D;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AA6BD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAKvD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,KAAK,CAAC,YAAY,CAMrB"}
1
+ {"version":3,"file":"navigation-context.d.ts","sourceRoot":"","sources":["../../src/client/navigation-context.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAM7D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAyBD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,eAAe,GAAG,IAAI,CAM7D;AAMD,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAO9C;AAiBD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAE/D;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAqBD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAKvD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,KAAK,CAAC,YAAY,CAMrB"}
@@ -13,8 +13,13 @@
13
13
  * width over ~30s using ease-out timing. When navigation completes, the bar
14
14
  * snaps to 100% and fades out over 200ms. No JS animation loops (RAF, setInterval).
15
15
  *
16
- * The bar respects a configurable delay (default 150ms) — if navigation
17
- * resolves faster than the delay, the bar never appears.
16
+ * Phase transitions are derived synchronously during render (React's
17
+ * getDerivedStateFromProps pattern) — no useEffect needed for state tracking.
18
+ * The finishing → hidden cleanup uses onTransitionEnd from the CSS transition.
19
+ *
20
+ * When delay > 0, CSS animation-delay + a visibility keyframe ensure the bar
21
+ * stays invisible during the delay period. If navigation finishes before the
22
+ * delay, the bar was never visible so the finish transition is also invisible.
18
23
  *
19
24
  * See design/19-client-navigation.md §"useNavigationPending()"
20
25
  * See LOCAL-336 for design decisions.
@@ -28,7 +33,7 @@ export interface TopLoaderConfig {
28
33
  height?: number;
29
34
  /** Show subtle glow/shadow effect. Default: true. */
30
35
  shadow?: boolean;
31
- /** Delay in ms before showing the bar. Default: 150. */
36
+ /** Delay in ms before showing the bar. Default: 0. */
32
37
  delay?: number;
33
38
  /** CSS z-index. Default: 1600. */
34
39
  zIndex?: number;
@@ -37,8 +42,15 @@ export interface TopLoaderConfig {
37
42
  * Internal top-loader component. Injected by TransitionRoot.
38
43
  *
39
44
  * Reads pending navigation state from PendingNavigationContext.
40
- * Shows nothing when no navigation is pending or when the navigation
41
- * resolves before the delay threshold.
45
+ * Phase transitions are derived synchronously during render:
46
+ *
47
+ * hidden → crawling: when isPending becomes true
48
+ * crawling → finishing: when isPending becomes false
49
+ * finishing → hidden: when CSS transition ends (onTransitionEnd)
50
+ * finishing → crawling: when isPending becomes true again
51
+ *
52
+ * No useEffect — all state changes are either derived during render
53
+ * (getDerivedStateFromProps pattern) or triggered by DOM events.
42
54
  */
43
55
  export declare function TopLoader({ config }: {
44
56
  config?: TopLoaderConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"top-loader.d.ts","sourceRoot":"","sources":["../../src/client/top-loader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuCD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CA4H7F"}
1
+ {"version":3,"file":"top-loader.d.ts","sourceRoot":"","sources":["../../src/client/top-loader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AASH,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA6CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAyF7F"}
package/dist/index.d.ts CHANGED
@@ -102,7 +102,7 @@ export interface TimberUserConfig {
102
102
  height?: number;
103
103
  /** Show subtle glow/shadow effect. Default: true. */
104
104
  shadow?: boolean;
105
- /** Delay in ms before showing the bar (avoids flash on fast navs). Default: 150. */
105
+ /** Delay in ms before showing the bar (avoids flash on fast navs). Default: 0. */
106
106
  delay?: number;
107
107
  /** CSS z-index. Default: 1600. */
108
108
  zIndex?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,MAAM,CAAC;AAwBjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,uDAAuD;AACvD,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,qEAAqE;AACrE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,m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QACjB,kFAAkF;QAClF,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,kCAAkC;QAClC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,wBAAwB,CAmB1F;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IACzB,+CAA+C;IAC/C,gBAAgB,EAAE,wBAAwB,CAAC;IAC3C,uFAAuF;IACvF,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,GAAG,EAAE,OAAO,CAAC;IACb,gFAAgF;IAChF,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,mFAAmF;IACnF,KAAK,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBzE;AAmCD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,gBAAgB,GAC3B,MAAM,EAAE,CAiBV;AA6BD,wBAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAkIhE;AAED;;;;;;;;;GASG;AAEH,MAAM,WAAW,MAAM;CAAG;AAE1B,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { r as setViteServer, t as formatSize } from "./_chunks/format-DNt20Kt8.js";
2
2
  import { i as scanRoutes, n as generateRouteMap, t as collectInterceptionRewrites } from "./_chunks/interception-DGDIjDbR.js";
3
- import { existsSync, readFileSync, statSync } from "node:fs";
3
+ import { existsSync, readFileSync } from "node:fs";
4
4
  import { dirname, extname, join, resolve } from "node:path";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import { createRequire } from "node:module";
@@ -14233,156 +14233,14 @@ function timberReactProd() {
14233
14233
  //#endregion
14234
14234
  //#region src/plugins/chunks.ts
14235
14235
  /**
14236
- * timber-chunks — Vite sub-plugin for intelligent client chunk splitting.
14237
- *
14238
- * Splits client bundles into cache tiers based on update frequency:
14239
- *
14240
- * Tier 1: vendor-react — react, react-dom, scheduler (changes rarely)
14241
- * Tier 2: vendor-timber — timber runtime, RSC runtime (changes per framework update)
14242
- * Tier 3: vendor-app — user node_modules (changes on dependency updates)
14243
- * Tier 4: shared-app — small shared app utilities/components (< 5KB source)
14244
- * Tier 5: [route]-* — per-route page/layout chunks (default Rollup splitting)
14245
- *
14246
- * The shared-app tier prevents tiny utility modules (constants, helpers,
14247
- * small UI components) from becoming individual chunks when shared across
14248
- * routes. Without this, Rolldown creates per-module chunks for any code
14249
- * shared between two or more entry points, producing many sub-1KB chunks.
14250
- *
14251
- * Server environments (RSC, SSR) are left to Vite's default chunking since
14252
- * Cloudflare Workers load all code from a single deployment bundle with no
14253
- * benefit from cache-tier separation.
14254
- *
14255
- * Design docs: 27-chunking-strategy.md
14256
- */
14257
- /**
14258
- * Source file size threshold for the shared-app chunk.
14259
- * Modules under this size that aren't route files get merged into shared-app
14260
- * instead of getting their own tiny chunks.
14261
- */
14262
- var SMALL_MODULE_THRESHOLD = 5 * 1024;
14263
- /**
14264
- * Route convention file basenames (without extension).
14265
- * These files define route segments and must stay in per-route chunks
14266
- * to preserve route-based code splitting.
14267
- */
14268
- var ROUTE_FILE_BASENAMES = new Set([
14269
- "page",
14270
- "layout",
14271
- "loading",
14272
- "error",
14273
- "not-found",
14274
- "template",
14275
- "access",
14276
- "middleware",
14277
- "default",
14278
- "route"
14279
- ]);
14280
- /**
14281
- * Cache for source file sizes to avoid repeated statSync calls.
14282
- * Populated lazily during the build.
14283
- */
14284
- var sizeCache = /* @__PURE__ */ new Map();
14285
- /**
14286
- * Get the source file size, with caching.
14287
- * Returns Infinity for virtual modules or files that can't be stat'd.
14288
- */
14289
- function getSourceSize(id) {
14290
- const cached = sizeCache.get(id);
14291
- if (cached !== void 0) return cached;
14292
- try {
14293
- const size = statSync(id).size;
14294
- sizeCache.set(id, size);
14295
- return size;
14296
- } catch {
14297
- sizeCache.set(id, Infinity);
14298
- return Infinity;
14299
- }
14300
- }
14301
- /**
14302
- * Extract the basename without extension from a module ID.
14303
- * e.g. '/project/app/dashboard/page.tsx' → 'page'
14304
- */
14305
- function getBasename(id) {
14306
- const lastSlash = id.lastIndexOf("/");
14307
- const filename = lastSlash >= 0 ? id.substring(lastSlash + 1) : id;
14308
- const dotIndex = filename.indexOf(".");
14309
- return dotIndex >= 0 ? filename.substring(0, dotIndex) : filename;
14310
- }
14311
- /**
14312
- * Check if a module is a React ecosystem package (tier 1).
14313
- */
14314
- function isReactVendor(id) {
14315
- return id.includes("node_modules/react-dom") || id.includes("node_modules/react/") || id.includes("node_modules/scheduler");
14316
- }
14317
- /**
14318
- * Check if a module is part of the timber framework runtime (tier 2).
14319
- *
14320
- * Matches both monorepo paths (packages/timber-app/...) and consumer
14321
- * project paths (node_modules/@timber-js/app/...) so the chunk
14322
- * assignment is consistent regardless of how timber is installed.
14323
- */
14324
- function isTimberRuntime(id) {
14325
- return id.includes("/timber-app/") || id.includes("/@timber-js/app/") || id.includes("react-server-dom") || id.includes("@vitejs/plugin-rsc");
14326
- }
14327
- /**
14328
- * Check if a module is a user-installed node_modules dependency (tier 3).
14329
- * Excludes React ecosystem and timber runtime packages which have their own tiers.
14330
- */
14331
- function isUserVendor(id) {
14332
- return id.includes("node_modules/") && !isReactVendor(id) && !isTimberRuntime(id);
14333
- }
14334
- /**
14335
- * Check if a module is a route convention file that should stay per-route.
14336
- */
14337
- function isRouteFile(id) {
14338
- return ROUTE_FILE_BASENAMES.has(getBasename(id));
14339
- }
14340
- /**
14341
- * Categorize a module ID into a cache tier chunk name.
14342
- *
14343
- * Returns a chunk name for vendor modules and small shared app code,
14344
- * or undefined to let Rollup's default splitting handle route code.
14345
- */
14346
- function assignChunk(id) {
14347
- if (isReactVendor(id)) return "vendor-react";
14348
- if (isTimberRuntime(id)) return "vendor-timber";
14349
- if (isUserVendor(id)) return "vendor-app";
14350
- if (!id.includes("\0") && id.startsWith("/") && !isRouteFile(id)) {
14351
- if (getSourceSize(id) < SMALL_MODULE_THRESHOLD) return "shared-app";
14352
- }
14353
- }
14354
- /**
14355
- * Group timber's internal 'use client' modules into the vendor-timber chunk.
14356
- *
14357
- * The RSC plugin creates separate entry points for each 'use client' module,
14358
- * which manualChunks can't merge. This function is passed as the RSC plugin's
14359
- * `clientChunks` callback to group timber internals into a single chunk.
14360
- *
14361
- * User client components that are small (< 5KB) are grouped into shared-client
14362
- * to prevent thin facade wrappers from becoming individual chunks. This handles
14363
- * the RSC client reference facade problem where each 'use client' module gets
14364
- * a ~100-300 byte re-export wrapper chunk.
14365
- */
14366
- function assignClientChunk(meta) {
14367
- if (meta.id.includes("/timber-app/") || meta.id.includes("/@timber-js/app/")) return "vendor-timber";
14368
- if (!meta.id.includes("\0") && meta.id.startsWith("/")) {
14369
- if (getSourceSize(meta.id) < SMALL_MODULE_THRESHOLD) return "shared-client";
14370
- }
14371
- }
14372
- /**
14373
14236
  * Create the timber-chunks Vite plugin.
14374
14237
  *
14375
- * Uses Vite's per-environment config to apply manualChunks only to
14376
- * the client build. The config hook runs before environments are
14377
- * created, so we use `environments.client` to target the client.
14238
+ * Currently a no-op — Rolldown's default splitting produces the desired
14239
+ * output (one main bundle + per-route chunks). The plugin is retained as
14240
+ * a hook point for future chunking adjustments if needed.
14378
14241
  */
14379
14242
  function timberChunks() {
14380
- return {
14381
- name: "timber-chunks",
14382
- config() {
14383
- return { environments: { client: { build: { rollupOptions: { output: { manualChunks: assignChunk } } } } } };
14384
- }
14385
- };
14243
+ return { name: "timber-chunks" };
14386
14244
  }
14387
14245
  //#endregion
14388
14246
  //#region src/plugins/server-bundle.ts
@@ -14949,8 +14807,7 @@ function timber(config) {
14949
14807
  rsc: "virtual:timber-rsc-entry",
14950
14808
  ssr: "virtual:timber-ssr-entry",
14951
14809
  client: "virtual:timber-browser-entry"
14952
- },
14953
- clientChunks: assignClientChunk
14810
+ }
14954
14811
  });
14955
14812
  });
14956
14813
  return [