@timber-js/app 0.2.0-alpha.76 → 0.2.0-alpha.78
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/index.js +4 -9
- package/dist/index.js.map +1 -1
- package/dist/plugins/shims.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/plugins/shims.ts +13 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../../src/plugins/shims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAsE1D;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"shims.d.ts","sourceRoot":"","sources":["../../src/plugins/shims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAsE1D;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CA0OvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timber-js/app",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.78",
|
|
4
4
|
"description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare-workers",
|
package/src/plugins/shims.ts
CHANGED
|
@@ -178,17 +178,10 @@ export function timberShims(_ctx: PluginContext): Plugin {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
if (cleanId === '#client-internal') {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// Resolving to src/ bypasses the optimizer and creates split
|
|
186
|
-
// module instances — globalRouter set in one copy reads as
|
|
187
|
-
// null from the other. dist/ is the published entrypoint and
|
|
188
|
-
// works in both dev (optimizer deduplicates) and prod build.
|
|
189
|
-
return resolve(PKG_ROOT, 'dist', 'client', 'internal.js');
|
|
190
|
-
}
|
|
191
|
-
// RSC/SSR: resolve to src/ for Vite transform correctness.
|
|
181
|
+
// Always resolve to src/ — all environments (RSC, SSR, client)
|
|
182
|
+
// use src/ for framework internals. In the client env, this
|
|
183
|
+
// ensures browser-entry and @timber-js/app/client share the
|
|
184
|
+
// same module graph (both resolve to src/).
|
|
192
185
|
return resolve(PKG_ROOT, 'src', 'client', 'internal.ts');
|
|
193
186
|
}
|
|
194
187
|
|
|
@@ -211,11 +204,7 @@ export function timberShims(_ctx: PluginContext): Plugin {
|
|
|
211
204
|
}
|
|
212
205
|
|
|
213
206
|
if (cleanId === '@timber-js/app/client/internal') {
|
|
214
|
-
|
|
215
|
-
if (envName === 'client') {
|
|
216
|
-
// Same as #client-internal above — resolve to dist/.
|
|
217
|
-
return resolve(PKG_ROOT, 'dist', 'client', 'internal.js');
|
|
218
|
-
}
|
|
207
|
+
// Same as #client-internal above — always resolve to src/.
|
|
219
208
|
return resolve(PKG_ROOT, 'src', 'client', 'internal.ts');
|
|
220
209
|
}
|
|
221
210
|
|
|
@@ -230,8 +219,14 @@ export function timberShims(_ctx: PluginContext): Plugin {
|
|
|
230
219
|
|
|
231
220
|
if (cleanId === '@timber-js/app/client') {
|
|
232
221
|
const envName = (this as unknown as { environment?: { name?: string } }).environment?.name;
|
|
233
|
-
//
|
|
234
|
-
|
|
222
|
+
// RSC: return null — needs dist/ for 'use client' boundary detection.
|
|
223
|
+
// SSR + Client: resolve to src/ so that browser-entry (which uses
|
|
224
|
+
// relative imports from src/) and user code (which uses the bare
|
|
225
|
+
// specifier @timber-js/app/client) share the same module instances.
|
|
226
|
+
// Without this, state.ts is loaded twice (src/ and dist/) and
|
|
227
|
+
// setGlobalRouter() writes to one copy while getRouterOrNull()
|
|
228
|
+
// reads from the other (always null).
|
|
229
|
+
if (envName === 'ssr' || envName === 'client') {
|
|
235
230
|
return resolve(PKG_ROOT, 'src', 'client', 'index.ts');
|
|
236
231
|
}
|
|
237
232
|
return null;
|