@weaverse/next 1.0.0 → 1.0.2
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/README.md +7 -1
- package/dist/client-boundary.js +1061 -0
- package/dist/client-boundary.js.map +1 -0
- package/dist/client-boundary.mjs +1017 -0
- package/dist/client-boundary.mjs.map +1 -0
- package/dist/index.js +307 -1477
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -1100
- package/dist/index.mjs.map +1 -1
- package/dist/seo-BCFNGChj.js +319 -0
- package/dist/seo-BCFNGChj.js.map +1 -0
- package/dist/seo-C-S2viuI.mjs +242 -0
- package/dist/seo-C-S2viuI.mjs.map +1 -0
- package/dist/server.js +626 -1076
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +620 -803
- package/dist/server.mjs.map +1 -1
- package/dist/types/client-boundary.d.ts +25 -0
- package/dist/types/client-boundary.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/item.d.ts +1 -1
- package/dist/types/item.d.ts.map +1 -1
- package/dist/types/provider.d.ts +1 -1
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/revalidate-item.d.ts +1 -1
- package/dist/types/revalidate-item.d.ts.map +1 -1
- package/dist/types/root-provider.d.ts +1 -1
- package/dist/types/root-provider.d.ts.map +1 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/translate.d.ts +56 -0
- package/dist/types/translate.d.ts.map +1 -0
- package/dist/types/translation-context.d.ts +1 -48
- package/dist/types/translation-context.d.ts.map +1 -1
- package/dist/types/translation-store.d.ts.map +1 -1
- package/dist/types/types.d.ts +6 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +10 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +5 -24
- package/src/client-boundary.ts +50 -0
- package/src/index.ts +42 -52
- package/src/provider.tsx +2 -4
- package/src/root-provider.tsx +2 -4
- package/src/translate.ts +125 -0
- package/src/translation-context.tsx +1 -118
- package/src/types.ts +6 -0
- package/src/utils.ts +12 -0
- package/dist/chunk-LH6AAEIK.mjs +0 -326
- package/dist/chunk-LH6AAEIK.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -81,11 +81,15 @@ So the mental model is still `weaverse.loadPage(...)`; only the injection mechan
|
|
|
81
81
|
|
|
82
82
|
| Import | Use in | Purpose |
|
|
83
83
|
| --- | --- | --- |
|
|
84
|
-
| `@weaverse/next` |
|
|
84
|
+
| `@weaverse/next` | Server and Client Components | Component registry, provider, renderer, hooks, Studio runtime/bind components, schema re-exports. |
|
|
85
85
|
| `@weaverse/next/server` | Server only | Real Weaverse API client, config resolution, page URL normalization, per-item revalidation route handler. |
|
|
86
86
|
|
|
87
87
|
The server API lives under `@weaverse/next/server` so client components can safely import the root entry without pulling server-only fetch code into the client bundle.
|
|
88
88
|
|
|
89
|
+
The root entry is safe to import from Server Components (since `1.0.1`). Its components, hooks and runtime ship as a separate `'use client'` module (`dist/client-boundary.*`), so a Server Component can render `WeaverseNextRootProvider` or `WeaverseNextStudioConnect` directly, and server code gets the real `createSchema`, `generateDataFromSchema`, `runWeaverseComponentLoaders`, SEO helpers, translate helpers (`createTranslate`, `getNestedKey`, `interpolate`) and `isBrowser`/`isIframe` instead of client references.
|
|
90
|
+
|
|
91
|
+
These are client-only: from a Server Component they are client references you can render or pass down but not call. Components and providers (`WeaverseNextRootProvider`, `WeaverseNextProvider`, `WeaverseNextRenderer`, `WeaverseNextStudio`, `WeaverseNextStudioBridge`, `WeaverseNextStudioConnect`, `TranslationProvider`), hooks (`useThemeSettings`, `useTranslation`, `useWeaverse`, `useItemInstance`, `useParentInstance`, `useChildInstances`, `useWeaversePageData`, `useWeaverseRootData`, `useWeaverseCommerce`, `useWeaverseNextStudioInternals`), and the client runtime (`createWeaverseNextClient`, `createWeaverseNextRuntime`, `bindWeaverseNextStudioRuntime`, `WeaverseNextRuntime`, `loadWeaverseNextStudioScript`).
|
|
92
|
+
|
|
89
93
|
## Package structure
|
|
90
94
|
|
|
91
95
|
```text
|
|
@@ -617,6 +621,8 @@ Server config resolution intentionally mirrors Hydrogen where possible:
|
|
|
617
621
|
|
|
618
622
|
### Bundle note
|
|
619
623
|
|
|
624
|
+
The root entry is built as two files: `dist/index.*` (server-safe exports) and `dist/client-boundary.*` (client code under a `'use client'` banner, imported by name from `dist/index.*`). Bundling drops module-level directives, so the banner is applied to the built boundary file; `scripts/check-packed-packages.mjs` fails the package check if the boundary loses it or if any other file reaches React client APIs.
|
|
625
|
+
|
|
620
626
|
The Next package build keeps `@weaverse/schema` as an external package re-export. It does not inline Zod/schema validators into `@weaverse/next`'s generated `dist/index.*` bundles. App-level bundle size still depends on what a consuming Next app imports and how its bundler tree-shakes `@weaverse/schema`.
|
|
621
627
|
|
|
622
628
|
## Current limitations
|