@tanstack/start-server-core 1.136.2 → 1.136.4

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.
@@ -1,4 +1,3 @@
1
- import { RouterManagedTag } from '@tanstack/router-core';
2
1
  /**
3
2
  * @description Returns the router manifest that should be sent to the client.
4
3
  * This includes only the assets and preloads for the current route and any
@@ -6,11 +5,5 @@ import { RouterManagedTag } from '@tanstack/router-core';
6
5
  * between routes or any other data that is not needed for the client.
7
6
  */
8
7
  export declare function getStartManifest(): Promise<{
9
- routes: {
10
- [k: string]: {
11
- preloads?: Array<string>;
12
- assets?: Array<RouterManagedTag>;
13
- };
14
- };
15
- clientEntry: string;
8
+ routes: any;
16
9
  }>;
@@ -21,16 +21,21 @@ async function getStartManifest() {
21
21
  children: script
22
22
  });
23
23
  const manifest = {
24
- ...startManifest,
25
24
  routes: Object.fromEntries(
26
25
  Object.entries(startManifest.routes).map(([k, v]) => {
27
26
  const { preloads, assets } = v;
28
27
  const result = {};
29
- if (preloads) {
28
+ let hasData = false;
29
+ if (preloads && preloads.length > 0) {
30
30
  result["preloads"] = preloads;
31
+ hasData = true;
31
32
  }
32
- if (assets) {
33
+ if (assets && assets.length > 0) {
33
34
  result["assets"] = assets;
35
+ hasData = true;
36
+ }
37
+ if (!hasData) {
38
+ return [];
34
39
  }
35
40
  return [k, result];
36
41
  })
@@ -1 +1 @@
1
- {"version":3,"file":"router-manifest.js","sources":["../../src/router-manifest.ts"],"sourcesContent":["import { rootRouteId } from '@tanstack/router-core'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * @description Returns the router manifest that should be sent to the client.\n * This includes only the assets and preloads for the current route and any\n * special assets that are needed for the client. It does not include relationships\n * between routes or any other data that is not needed for the client.\n */\nexport async function getStartManifest() {\n const { tsrStartManifest } = await import('tanstack-start-manifest:v')\n const startManifest = tsrStartManifest()\n\n const rootRoute = (startManifest.routes[rootRouteId] =\n startManifest.routes[rootRouteId] || {})\n\n rootRoute.assets = rootRoute.assets || []\n\n let script = `import('${startManifest.clientEntry}')`\n if (process.env.TSS_DEV_SERVER === 'true') {\n const { injectedHeadScripts } = await import(\n 'tanstack-start-injected-head-scripts:v'\n )\n if (injectedHeadScripts) {\n script = `${injectedHeadScripts + ';'}${script}`\n }\n }\n rootRoute.assets.push({\n tag: 'script',\n attrs: {\n type: 'module',\n suppressHydrationWarning: true,\n async: true,\n },\n children: script,\n })\n\n const manifest = {\n ...startManifest,\n routes: Object.fromEntries(\n Object.entries(startManifest.routes).map(([k, v]) => {\n const { preloads, assets } = v\n const result = {} as {\n preloads?: Array<string>\n assets?: Array<RouterManagedTag>\n }\n if (preloads) {\n result['preloads'] = preloads\n }\n if (assets) {\n result['assets'] = assets\n }\n return [k, result]\n }),\n ),\n }\n\n // Strip out anything that isn't needed for the client\n return manifest\n}\n"],"names":[],"mappings":";AASA,eAAsB,mBAAmB;AACvC,QAAM,EAAE,iBAAA,IAAqB,MAAM,OAAO,2BAA2B;AACrE,QAAM,gBAAgB,iBAAA;AAEtB,QAAM,YAAa,cAAc,OAAO,WAAW,IACjD,cAAc,OAAO,WAAW,KAAK,CAAA;AAEvC,YAAU,SAAS,UAAU,UAAU,CAAA;AAEvC,MAAI,SAAS,WAAW,cAAc,WAAW;AACjD,MAAI,QAAQ,IAAI,mBAAmB,QAAQ;AACzC,UAAM,EAAE,oBAAA,IAAwB,MAAM,OACpC,wCACF;AACA,QAAI,qBAAqB;AACvB,eAAS,GAAG,sBAAsB,GAAG,GAAG,MAAM;AAAA,IAChD;AAAA,EACF;AACA,YAAU,OAAO,KAAK;AAAA,IACpB,KAAK;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,0BAA0B;AAAA,MAC1B,OAAO;AAAA,IAAA;AAAA,IAET,UAAU;AAAA,EAAA,CACX;AAED,QAAM,WAAW;AAAA,IACf,GAAG;AAAA,IACH,QAAQ,OAAO;AAAA,MACb,OAAO,QAAQ,cAAc,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM;AACnD,cAAM,EAAE,UAAU,OAAA,IAAW;AAC7B,cAAM,SAAS,CAAA;AAIf,YAAI,UAAU;AACZ,iBAAO,UAAU,IAAI;AAAA,QACvB;AACA,YAAI,QAAQ;AACV,iBAAO,QAAQ,IAAI;AAAA,QACrB;AACA,eAAO,CAAC,GAAG,MAAM;AAAA,MACnB,CAAC;AAAA,IAAA;AAAA,EACH;AAIF,SAAO;AACT;"}
1
+ {"version":3,"file":"router-manifest.js","sources":["../../src/router-manifest.ts"],"sourcesContent":["import { rootRouteId } from '@tanstack/router-core'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * @description Returns the router manifest that should be sent to the client.\n * This includes only the assets and preloads for the current route and any\n * special assets that are needed for the client. It does not include relationships\n * between routes or any other data that is not needed for the client.\n */\nexport async function getStartManifest() {\n const { tsrStartManifest } = await import('tanstack-start-manifest:v')\n const startManifest = tsrStartManifest()\n\n const rootRoute = (startManifest.routes[rootRouteId] =\n startManifest.routes[rootRouteId] || {})\n\n rootRoute.assets = rootRoute.assets || []\n\n let script = `import('${startManifest.clientEntry}')`\n if (process.env.TSS_DEV_SERVER === 'true') {\n const { injectedHeadScripts } = await import(\n 'tanstack-start-injected-head-scripts:v'\n )\n if (injectedHeadScripts) {\n script = `${injectedHeadScripts + ';'}${script}`\n }\n }\n rootRoute.assets.push({\n tag: 'script',\n attrs: {\n type: 'module',\n suppressHydrationWarning: true,\n async: true,\n },\n children: script,\n })\n\n const manifest = {\n routes: Object.fromEntries(\n Object.entries(startManifest.routes).map(([k, v]) => {\n const { preloads, assets } = v\n const result = {} as {\n preloads?: Array<string>\n assets?: Array<RouterManagedTag>\n }\n let hasData = false\n if (preloads && preloads.length > 0) {\n result['preloads'] = preloads\n hasData = true\n }\n if (assets && assets.length > 0) {\n result['assets'] = assets\n hasData = true\n }\n if (!hasData) {\n return []\n }\n return [k, result]\n }),\n ),\n }\n\n // Strip out anything that isn't needed for the client\n return manifest\n}\n"],"names":[],"mappings":";AASA,eAAsB,mBAAmB;AACvC,QAAM,EAAE,iBAAA,IAAqB,MAAM,OAAO,2BAA2B;AACrE,QAAM,gBAAgB,iBAAA;AAEtB,QAAM,YAAa,cAAc,OAAO,WAAW,IACjD,cAAc,OAAO,WAAW,KAAK,CAAA;AAEvC,YAAU,SAAS,UAAU,UAAU,CAAA;AAEvC,MAAI,SAAS,WAAW,cAAc,WAAW;AACjD,MAAI,QAAQ,IAAI,mBAAmB,QAAQ;AACzC,UAAM,EAAE,oBAAA,IAAwB,MAAM,OACpC,wCACF;AACA,QAAI,qBAAqB;AACvB,eAAS,GAAG,sBAAsB,GAAG,GAAG,MAAM;AAAA,IAChD;AAAA,EACF;AACA,YAAU,OAAO,KAAK;AAAA,IACpB,KAAK;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,0BAA0B;AAAA,MAC1B,OAAO;AAAA,IAAA;AAAA,IAET,UAAU;AAAA,EAAA,CACX;AAED,QAAM,WAAW;AAAA,IACf,QAAQ,OAAO;AAAA,MACb,OAAO,QAAQ,cAAc,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM;AACnD,cAAM,EAAE,UAAU,OAAA,IAAW;AAC7B,cAAM,SAAS,CAAA;AAIf,YAAI,UAAU;AACd,YAAI,YAAY,SAAS,SAAS,GAAG;AACnC,iBAAO,UAAU,IAAI;AACrB,oBAAU;AAAA,QACZ;AACA,YAAI,UAAU,OAAO,SAAS,GAAG;AAC/B,iBAAO,QAAQ,IAAI;AACnB,oBAAU;AAAA,QACZ;AACA,YAAI,CAAC,SAAS;AACZ,iBAAO,CAAA;AAAA,QACT;AACA,eAAO,CAAC,GAAG,MAAM;AAAA,MACnB,CAAC;AAAA,IAAA;AAAA,EACH;AAIF,SAAO;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/start-server-core",
3
- "version": "1.136.2",
3
+ "version": "1.136.4",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -64,9 +64,9 @@
64
64
  "seroval": "^1.3.2",
65
65
  "tiny-invariant": "^1.3.3",
66
66
  "@tanstack/history": "1.133.28",
67
- "@tanstack/router-core": "1.136.2",
68
- "@tanstack/start-storage-context": "1.136.2",
69
- "@tanstack/start-client-core": "1.136.2"
67
+ "@tanstack/router-core": "1.136.4",
68
+ "@tanstack/start-storage-context": "1.136.4",
69
+ "@tanstack/start-client-core": "1.136.4"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@standard-schema/spec": "^1.0.0",
@@ -36,7 +36,6 @@ export async function getStartManifest() {
36
36
  })
37
37
 
38
38
  const manifest = {
39
- ...startManifest,
40
39
  routes: Object.fromEntries(
41
40
  Object.entries(startManifest.routes).map(([k, v]) => {
42
41
  const { preloads, assets } = v
@@ -44,11 +43,17 @@ export async function getStartManifest() {
44
43
  preloads?: Array<string>
45
44
  assets?: Array<RouterManagedTag>
46
45
  }
47
- if (preloads) {
46
+ let hasData = false
47
+ if (preloads && preloads.length > 0) {
48
48
  result['preloads'] = preloads
49
+ hasData = true
49
50
  }
50
- if (assets) {
51
+ if (assets && assets.length > 0) {
51
52
  result['assets'] = assets
53
+ hasData = true
54
+ }
55
+ if (!hasData) {
56
+ return []
52
57
  }
53
58
  return [k, result]
54
59
  }),