@timber-js/app 0.1.3 → 0.1.5
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/_chunks/{interception-DIaZN1bF.js → interception-c-a3uODY.js} +8 -8
- package/dist/_chunks/interception-c-a3uODY.js.map +1 -0
- package/dist/_chunks/{registry-DUIpYD_x.js → registry-BfPM41ri.js} +1 -1
- package/dist/_chunks/{registry-DUIpYD_x.js.map → registry-BfPM41ri.js.map} +1 -1
- package/dist/_chunks/{request-context-D6XHINkR.js → request-context-BzES06i1.js} +2 -1
- package/dist/_chunks/request-context-BzES06i1.js.map +1 -0
- package/dist/_chunks/{use-cookie-8ZlA0rr3.js → use-cookie-HcvNlW4L.js} +1 -1
- package/dist/_chunks/{use-cookie-8ZlA0rr3.js.map → use-cookie-HcvNlW4L.js.map} +1 -1
- package/dist/adapters/cloudflare.d.ts +2 -2
- package/dist/adapters/cloudflare.js +4 -4
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/nitro.d.ts +1 -1
- package/dist/adapters/nitro.js +4 -4
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/{_chunks/error-boundary-dj-WO5uq.js → client/error-boundary.js} +4 -2
- package/dist/client/error-boundary.js.map +1 -0
- package/dist/client/form.d.ts +1 -1
- package/dist/client/index.js +10 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/link.d.ts.map +1 -1
- package/dist/client/slot-error-fallback.d.ts +13 -0
- package/dist/client/slot-error-fallback.d.ts.map +1 -0
- package/dist/client/use-link-status.d.ts +1 -1
- package/dist/client/use-navigation-pending.d.ts +1 -1
- package/dist/content/index.d.ts +1 -1
- package/dist/cookies/define-cookie.d.ts +2 -2
- package/dist/cookies/index.d.ts +1 -1
- package/dist/cookies/index.d.ts.map +1 -1
- package/dist/cookies/index.js +4 -4
- package/dist/cookies/index.js.map +1 -1
- package/dist/index.js +23 -22
- package/dist/index.js.map +1 -1
- package/dist/plugins/dev-logs.d.ts +1 -1
- package/dist/plugins/dynamic-transform.d.ts +1 -1
- package/dist/plugins/shims.d.ts +5 -0
- package/dist/plugins/shims.d.ts.map +1 -1
- package/dist/routing/codegen.d.ts +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/search-params/codecs.d.ts +2 -2
- package/dist/search-params/create.d.ts +1 -1
- package/dist/search-params/index.js +5 -5
- package/dist/search-params/index.js.map +1 -1
- package/dist/server/action-client.d.ts +1 -1
- package/dist/server/dev-fetch-instrumentation.d.ts +22 -0
- package/dist/server/dev-fetch-instrumentation.d.ts.map +1 -0
- package/dist/server/dev-logger.d.ts.map +1 -1
- package/dist/server/form-flash.d.ts +1 -1
- package/dist/server/index.js +4 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/primitives.d.ts +15 -0
- package/dist/server/primitives.d.ts.map +1 -1
- package/dist/server/request-context.d.ts +32 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/route-element-builder.d.ts.map +1 -1
- package/dist/server/rsc-entry/index.d.ts.map +1 -1
- package/dist/server/slot-resolver.d.ts.map +1 -1
- package/dist/server/ssr-entry.d.ts.map +1 -1
- package/dist/shims/headers.d.ts +5 -7
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/link.d.ts +1 -1
- package/dist/shims/link.d.ts.map +1 -1
- package/dist/shims/navigation.d.ts +5 -15
- package/dist/shims/navigation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/cloudflare.ts +4 -4
- package/src/adapters/nitro.ts +4 -4
- package/src/cache/index.ts +1 -1
- package/src/client/form.tsx +1 -1
- package/src/client/index.ts +1 -1
- package/src/client/link.tsx +2 -0
- package/src/client/slot-error-fallback.tsx +16 -0
- package/src/client/use-link-status.ts +1 -1
- package/src/client/use-navigation-pending.ts +1 -1
- package/src/content/index.ts +1 -1
- package/src/cookies/define-cookie.ts +2 -2
- package/src/cookies/index.ts +2 -6
- package/src/plugins/cache-transform.ts +1 -1
- package/src/plugins/dev-logs.ts +2 -2
- package/src/plugins/dynamic-transform.ts +2 -2
- package/src/plugins/shims.ts +48 -22
- package/src/routing/codegen.ts +9 -9
- package/src/search-params/codecs.ts +2 -2
- package/src/search-params/create.ts +3 -3
- package/src/search-params/index.ts +1 -1
- package/src/server/action-client.ts +1 -1
- package/src/server/asset-headers.ts +1 -1
- package/src/server/dev-fetch-instrumentation.ts +96 -0
- package/src/server/dev-logger.ts +49 -0
- package/src/server/form-flash.ts +1 -1
- package/src/server/index.ts +1 -1
- package/src/server/primitives.ts +24 -1
- package/src/server/request-context.ts +7 -1
- package/src/server/route-element-builder.ts +2 -5
- package/src/server/rsc-entry/index.ts +33 -1
- package/src/server/slot-resolver.ts +20 -1
- package/src/server/ssr-entry.ts +21 -5
- package/src/shims/headers.ts +5 -7
- package/src/shims/link.ts +3 -1
- package/src/shims/navigation.ts +7 -17
- package/dist/_chunks/error-boundary-dj-WO5uq.js.map +0 -1
- package/dist/_chunks/interception-DIaZN1bF.js.map +0 -1
- package/dist/_chunks/request-context-D6XHINkR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as setViteServer, t as formatSize } from "./_chunks/format-DNt20Kt8.js";
|
|
2
|
-
import { i as scanRoutes, n as generateRouteMap, t as collectInterceptionRewrites } from "./_chunks/interception-
|
|
2
|
+
import { i as scanRoutes, n as generateRouteMap, t as collectInterceptionRewrites } from "./_chunks/interception-c-a3uODY.js";
|
|
3
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";
|
|
@@ -11273,7 +11273,7 @@ function transformUseCache(code, fileId) {
|
|
|
11273
11273
|
result = result.slice(0, fn.start) + replacement + result.slice(fn.end);
|
|
11274
11274
|
needsImport = true;
|
|
11275
11275
|
}
|
|
11276
|
-
if (needsImport) result = `import { registerCachedFunction } from '@timber/app/cache';\n` + result;
|
|
11276
|
+
if (needsImport) result = `import { registerCachedFunction } from '@timber-js/app/cache';\n` + result;
|
|
11277
11277
|
return {
|
|
11278
11278
|
code: result,
|
|
11279
11279
|
map: null,
|
|
@@ -12287,7 +12287,8 @@ function generateManifestModule(tree) {
|
|
|
12287
12287
|
//#endregion
|
|
12288
12288
|
//#region src/plugins/shims.ts
|
|
12289
12289
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12290
|
-
var
|
|
12290
|
+
var PKG_ROOT = __dirname.endsWith("plugins") ? resolve(__dirname, "..", "..") : resolve(__dirname, "..");
|
|
12291
|
+
var SHIMS_DIR = resolve(PKG_ROOT, "src", "shims");
|
|
12291
12292
|
/**
|
|
12292
12293
|
* Virtual module IDs for server-only and client-only poison pills.
|
|
12293
12294
|
*
|
|
@@ -12321,19 +12322,6 @@ var SHIM_MAP = {
|
|
|
12321
12322
|
*/
|
|
12322
12323
|
var CLIENT_SHIM_OVERRIDES = { "next/navigation": resolve(SHIMS_DIR, "navigation-client.ts") };
|
|
12323
12324
|
/**
|
|
12324
|
-
* Map from @timber/app/* subpath imports to real source files.
|
|
12325
|
-
*
|
|
12326
|
-
* These resolve subpath imports like `@timber/app/server` to the
|
|
12327
|
-
* real entry files in the package source.
|
|
12328
|
-
*/
|
|
12329
|
-
var TIMBER_SUBPATH_MAP = {
|
|
12330
|
-
"@timber/app/server": resolve(__dirname, "..", "server", "index.ts"),
|
|
12331
|
-
"@timber/app/client": resolve(__dirname, "..", "client", "index.ts"),
|
|
12332
|
-
"@timber/app/cache": resolve(__dirname, "..", "cache", "index.ts"),
|
|
12333
|
-
"@timber/app/search-params": resolve(__dirname, "..", "search-params", "index.ts"),
|
|
12334
|
-
"@timber/app/routing": resolve(__dirname, "..", "routing", "index.ts")
|
|
12335
|
-
};
|
|
12336
|
-
/**
|
|
12337
12325
|
* Strip .js extension from an import specifier.
|
|
12338
12326
|
*
|
|
12339
12327
|
* Libraries like nuqs import `next/navigation.js` with an explicit
|
|
@@ -12359,7 +12347,10 @@ function timberShims(_ctx) {
|
|
|
12359
12347
|
if (this.environment?.name === "client" && cleanId in CLIENT_SHIM_OVERRIDES) return CLIENT_SHIM_OVERRIDES[cleanId];
|
|
12360
12348
|
return SHIM_MAP[cleanId];
|
|
12361
12349
|
}
|
|
12362
|
-
if (cleanId
|
|
12350
|
+
if (cleanId === "@timber-js/app/server") {
|
|
12351
|
+
if (this.environment?.name === "client") return "\0timber:server-empty";
|
|
12352
|
+
return resolve(PKG_ROOT, "src", "server", "index.ts");
|
|
12353
|
+
}
|
|
12363
12354
|
return null;
|
|
12364
12355
|
},
|
|
12365
12356
|
load(id) {
|
|
@@ -12378,7 +12369,17 @@ function timberShims(_ctx) {
|
|
|
12378
12369
|
);`;
|
|
12379
12370
|
return "export {};";
|
|
12380
12371
|
}
|
|
12381
|
-
return
|
|
12372
|
+
if (id === "\0timber:server-empty") return `
|
|
12373
|
+
const stub = (name) => () => { throw new Error(name + "() is a server-only function and cannot be called in client code."); };
|
|
12374
|
+
export const headers = stub("headers");
|
|
12375
|
+
export const cookies = stub("cookies");
|
|
12376
|
+
export const notFound = stub("notFound");
|
|
12377
|
+
export const redirect = stub("redirect");
|
|
12378
|
+
export const permanentRedirect = stub("permanentRedirect");
|
|
12379
|
+
export const deny = stub("deny");
|
|
12380
|
+
export const searchParams = stub("searchParams");
|
|
12381
|
+
export const RedirectType = { push: "push", replace: "replace" };
|
|
12382
|
+
`;
|
|
12382
12383
|
}
|
|
12383
12384
|
};
|
|
12384
12385
|
}
|
|
@@ -13543,7 +13544,7 @@ function containsUseDynamic(code) {
|
|
|
13543
13544
|
*
|
|
13544
13545
|
* Output:
|
|
13545
13546
|
* ```tsx
|
|
13546
|
-
* import { markDynamic as __markDynamic } from '@timber/app/runtime';
|
|
13547
|
+
* import { markDynamic as __markDynamic } from '@timber-js/app/runtime';
|
|
13547
13548
|
* export default async function AddToCartButton({ productId }) {
|
|
13548
13549
|
* __markDynamic();
|
|
13549
13550
|
* const user = await getUser()
|
|
@@ -13564,7 +13565,7 @@ function transformUseDynamic(code) {
|
|
|
13564
13565
|
const cleanBody = fn.bodyContent.replace(/['"]use dynamic['"];?/, "__markDynamic();");
|
|
13565
13566
|
result = result.slice(0, fn.bodyStart) + cleanBody + result.slice(fn.bodyEnd);
|
|
13566
13567
|
}
|
|
13567
|
-
result = `import { markDynamic as __markDynamic } from '@timber/app/runtime';\n` + result;
|
|
13568
|
+
result = `import { markDynamic as __markDynamic } from '@timber-js/app/runtime';\n` + result;
|
|
13568
13569
|
return {
|
|
13569
13570
|
code: result,
|
|
13570
13571
|
map: null
|
|
@@ -13962,7 +13963,7 @@ function extractCallerLocation(projectRoot) {
|
|
|
13962
13963
|
* (render errors, action errors, route handler errors, etc.).
|
|
13963
13964
|
*
|
|
13964
13965
|
* Handles both monorepo paths (timber-app/src/plugins/) and installed
|
|
13965
|
-
* package paths (@timber/app/dist/plugins/).
|
|
13966
|
+
* package paths (@timber-js/app/dist/plugins/).
|
|
13966
13967
|
*/
|
|
13967
13968
|
function isFrameworkInternalCaller() {
|
|
13968
13969
|
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
@@ -13972,7 +13973,7 @@ function isFrameworkInternalCaller() {
|
|
|
13972
13973
|
const line = lines[i].trim();
|
|
13973
13974
|
if (line.includes("dev-logs")) continue;
|
|
13974
13975
|
if (line.includes("node:")) continue;
|
|
13975
|
-
if (!(line.includes("timber-app/") || line.includes("@timber/app/"))) return false;
|
|
13976
|
+
if (!(line.includes("timber-app/") || line.includes("@timber-js/app/"))) return false;
|
|
13976
13977
|
return line.includes("/plugins/") || line.includes("/adapters/");
|
|
13977
13978
|
}
|
|
13978
13979
|
return false;
|