@decocms/tanstack 7.2.1 → 7.2.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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/vite/plugin.js +19 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/tanstack",
3
- "version": "7.2.1",
3
+ "version": "7.2.2",
4
4
  "type": "module",
5
5
  "description": "Deco framework binding for TanStack Start + Cloudflare Workers",
6
6
  "repository": {
@@ -21,9 +21,9 @@
21
21
  "lint:unused": "knip"
22
22
  },
23
23
  "dependencies": {
24
- "@decocms/blocks": "7.2.1",
25
- "@decocms/blocks-admin": "7.2.1",
26
- "@decocms/blocks-cli": "7.2.1",
24
+ "@decocms/blocks": "7.2.2",
25
+ "@decocms/blocks-admin": "7.2.2",
26
+ "@decocms/blocks-cli": "7.2.2",
27
27
  "@deco-cx/warp-node": "^0.3.16",
28
28
  "fast-json-patch": "^3.1.0",
29
29
  "ws": "^8.18.0"
@@ -588,14 +588,25 @@ export function decoVitePlugin() {
588
588
  env.optimizeDeps.esbuildOptions.jsxImportSource = "react";
589
589
  }
590
590
 
591
- // Force @decocms/tanstack through the SSR transform pipeline so
592
- // TanStack Start's compiler can register its createServerFn handlers
591
+ // Force these packages through the SSR transform pipeline so
592
+ // TanStack Start's compiler can register their createServerFn handlers
593
593
  // (loadDeferredSection in routes/cmsRoute.ts, and loadCmsPage /
594
- // loadCmsHomePage alongside it) in the per-environment serverFnsById
595
- // manifest. Without this, Vite pre-bundles the package via
596
- // optimizeDeps before plugins run, the handler never enters the
597
- // manifest, and every POST /_serverFn/* call from the browser returns
598
- // HTTP 500 ("Invalid server function ID"). See #197.
594
+ // loadCmsHomePage alongside it, for @decocms/tanstack) in the
595
+ // per-environment serverFnsById manifest. Without this, Vite
596
+ // pre-bundles the package via optimizeDeps before plugins run, the
597
+ // handler never enters the manifest, and every POST /_serverFn/* call
598
+ // from the browser returns HTTP 500 ("Invalid server function ID").
599
+ // See #197.
600
+ //
601
+ // @decocms/apps-vtex needs this too: its invoke.ts wraps 18 actions/
602
+ // loaders via createInvokeFn (packages/tanstack/src/sdk/createInvoke.ts),
603
+ // each a real `createServerFn(...)` call site. This was missed when
604
+ // createInvokeFn's export was added to @decocms/tanstack's public
605
+ // barrel (apps-monorepo-migration Task 7) — worked by accident under
606
+ // `bun link` (Vite treats symlinked/workspace packages as live source,
607
+ // skipping optimizeDeps pre-bundling for them) but hard-crashes with
608
+ // a real npm install: "createServerFn must be assigned to a variable!"
609
+ // from the Cloudflare Workers runtime's static entry-export scan.
599
610
  //
600
611
  // @decocms/blocks does NOT need this: despite its
601
612
  // validateSection.ts / useScript.ts doc comments mentioning
@@ -607,7 +618,7 @@ export function decoVitePlugin() {
607
618
  if (name === "ssr") {
608
619
  env.resolve = env.resolve || {};
609
620
  const existing = env.resolve.noExternal;
610
- const additions = ["@decocms/tanstack"];
621
+ const additions = ["@decocms/tanstack", "@decocms/apps-vtex"];
611
622
  if (existing === true) {
612
623
  // Already noExternal everything — nothing to add.
613
624
  } else if (Array.isArray(existing)) {