@tanstack/start-server-core 1.169.3 → 1.169.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/esm/constants.js.map +1 -1
- package/dist/esm/createServerRpc.js.map +1 -1
- package/dist/esm/createSsrRpc.js.map +1 -1
- package/dist/esm/createStartHandler.js.map +1 -1
- package/dist/esm/early-hints.js.map +1 -1
- package/dist/esm/empty-plugin-adapters.d.ts +3 -0
- package/dist/esm/empty-plugin-adapters.js +7 -0
- package/dist/esm/empty-plugin-adapters.js.map +1 -0
- package/dist/esm/fake-start-server-fn-resolver.js.map +1 -1
- package/dist/esm/finalManifest.d.ts +5 -5
- package/dist/esm/finalManifest.js +2 -2
- package/dist/esm/finalManifest.js.map +1 -1
- package/dist/esm/frame-protocol.js.map +1 -1
- package/dist/esm/inlineCss.js.map +1 -1
- package/dist/esm/request-response.js.map +1 -1
- package/dist/esm/router-manifest.d.ts +2 -6
- package/dist/esm/router-manifest.js +3 -19
- package/dist/esm/router-manifest.js.map +1 -1
- package/dist/esm/serializer/ServerFunctionSerializationAdapter.js.map +1 -1
- package/dist/esm/server-functions-handler.js.map +1 -1
- package/dist/esm/transformAssetUrls.d.ts +5 -14
- package/dist/esm/transformAssetUrls.js +10 -45
- package/dist/esm/transformAssetUrls.js.map +1 -1
- package/dist/esm/virtual-modules.d.ts +0 -1
- package/dist/esm/virtual-modules.js +0 -1
- package/dist/esm/virtual-modules.js.map +1 -1
- package/package.json +5 -2
- package/src/empty-plugin-adapters.ts +4 -0
- package/src/finalManifest.ts +10 -15
- package/src/router-manifest.ts +7 -28
- package/src/tanstack-start.d.ts +1 -5
- package/src/transformAssetUrls.ts +10 -88
- package/src/virtual-modules.ts +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getManifestScriptFormat,
|
|
3
2
|
resolveManifestAssetLink,
|
|
4
3
|
resolveManifestCssLink,
|
|
5
4
|
} from '@tanstack/router-core'
|
|
@@ -9,8 +8,6 @@ import type {
|
|
|
9
8
|
Awaitable,
|
|
10
9
|
ManifestAssetLink,
|
|
11
10
|
ManifestCssLink,
|
|
12
|
-
ManifestScript,
|
|
13
|
-
ScriptFormat,
|
|
14
11
|
ServerManifest,
|
|
15
12
|
} from '@tanstack/router-core'
|
|
16
13
|
|
|
@@ -322,30 +319,6 @@ export function resolveTransformAssetsConfig(
|
|
|
322
319
|
}
|
|
323
320
|
}
|
|
324
321
|
|
|
325
|
-
export interface StartManifestWithClientEntry {
|
|
326
|
-
manifest: ServerManifest
|
|
327
|
-
clientEntry: string
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Builds the client entry `<script>` tag from a (possibly transformed) client
|
|
332
|
-
* entry URL.
|
|
333
|
-
*/
|
|
334
|
-
export function buildClientEntryScriptTag(
|
|
335
|
-
clientEntry: string,
|
|
336
|
-
scriptFormat: ScriptFormat = 'module',
|
|
337
|
-
crossOrigin?: AssetCrossOrigin,
|
|
338
|
-
): ManifestScript {
|
|
339
|
-
return {
|
|
340
|
-
attrs: {
|
|
341
|
-
...(scriptFormat === 'module' ? { type: 'module' } : {}),
|
|
342
|
-
async: true,
|
|
343
|
-
src: clientEntry,
|
|
344
|
-
...(crossOrigin ? { crossOrigin } : {}),
|
|
345
|
-
},
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
322
|
type AssignableManifestLink = ManifestAssetLink | ManifestCssLink
|
|
350
323
|
|
|
351
324
|
function assignManifestLink(
|
|
@@ -378,60 +351,15 @@ function assignManifestLink(
|
|
|
378
351
|
return nextLink
|
|
379
352
|
}
|
|
380
353
|
|
|
381
|
-
function appendUniqueManifestAssetLink(
|
|
382
|
-
target: Array<ManifestAssetLink> | undefined,
|
|
383
|
-
link: ManifestAssetLink,
|
|
384
|
-
) {
|
|
385
|
-
const href = typeof link === 'string' ? link : link.href
|
|
386
|
-
|
|
387
|
-
if (target) {
|
|
388
|
-
for (const item of target) {
|
|
389
|
-
if ((typeof item === 'string' ? item : item.href) === href) {
|
|
390
|
-
return target
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return [...(target ?? []), link]
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function addClientEntryToManifest(
|
|
399
|
-
manifest: ServerManifest,
|
|
400
|
-
clientEntry: string,
|
|
401
|
-
) {
|
|
402
|
-
const rootRoute = manifest.routes.__root__ ?? {}
|
|
403
|
-
const rootScripts = rootRoute.scripts ?? []
|
|
404
|
-
const scripts = rootScripts.some(
|
|
405
|
-
(script) => script.attrs?.src === clientEntry,
|
|
406
|
-
)
|
|
407
|
-
? rootScripts
|
|
408
|
-
: [
|
|
409
|
-
...rootScripts,
|
|
410
|
-
buildClientEntryScriptTag(
|
|
411
|
-
clientEntry,
|
|
412
|
-
getManifestScriptFormat(manifest),
|
|
413
|
-
),
|
|
414
|
-
]
|
|
415
|
-
|
|
416
|
-
manifest.routes = {
|
|
417
|
-
...manifest.routes,
|
|
418
|
-
__root__: {
|
|
419
|
-
...rootRoute,
|
|
420
|
-
preloads: appendUniqueManifestAssetLink(rootRoute.preloads, clientEntry),
|
|
421
|
-
scripts,
|
|
422
|
-
},
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
354
|
export async function transformManifestAssets(
|
|
427
|
-
source:
|
|
355
|
+
source: ServerManifest,
|
|
428
356
|
transformFn: TransformAssetsFn,
|
|
429
357
|
_opts?: {
|
|
430
358
|
clone?: boolean
|
|
431
359
|
inlineCss?: boolean
|
|
432
360
|
},
|
|
433
361
|
): Promise<ServerManifest> {
|
|
434
|
-
const manifest = structuredClone(source
|
|
362
|
+
const manifest = structuredClone(source)
|
|
435
363
|
const inlineCssEnabled = _opts?.inlineCss !== false
|
|
436
364
|
const scriptTransforms = new Map<
|
|
437
365
|
string,
|
|
@@ -462,8 +390,6 @@ export async function transformManifestAssets(
|
|
|
462
390
|
)
|
|
463
391
|
}
|
|
464
392
|
|
|
465
|
-
addClientEntryToManifest(manifest, source.clientEntry)
|
|
466
|
-
|
|
467
393
|
for (const route of Object.values(manifest.routes)) {
|
|
468
394
|
if (route.preloads?.length) {
|
|
469
395
|
route.preloads = await Promise.all(
|
|
@@ -524,28 +450,24 @@ export async function transformManifestAssets(
|
|
|
524
450
|
}
|
|
525
451
|
|
|
526
452
|
/**
|
|
527
|
-
* Builds a final ServerManifest
|
|
528
|
-
*
|
|
453
|
+
* Builds a final ServerManifest without URL transforms. Used when no
|
|
454
|
+
* transformAssets option is provided.
|
|
529
455
|
*
|
|
530
456
|
* Returns a new manifest object so the cached base manifest is never mutated.
|
|
531
457
|
*/
|
|
532
|
-
export function
|
|
533
|
-
source:
|
|
458
|
+
export function buildManifest(
|
|
459
|
+
source: ServerManifest,
|
|
534
460
|
opts?: { inlineCss?: boolean },
|
|
535
461
|
): ServerManifest {
|
|
536
462
|
const manifest: ServerManifest = {
|
|
537
|
-
...(source.
|
|
538
|
-
|
|
539
|
-
:
|
|
540
|
-
...(opts?.inlineCss !== false && source.manifest.inlineCss
|
|
541
|
-
? { inlineCss: structuredClone(source.manifest.inlineCss) }
|
|
463
|
+
...(source.scriptFormat ? { scriptFormat: source.scriptFormat } : {}),
|
|
464
|
+
...(opts?.inlineCss !== false && source.inlineCss
|
|
465
|
+
? { inlineCss: structuredClone(source.inlineCss) }
|
|
542
466
|
: {}),
|
|
543
467
|
routes: {
|
|
544
|
-
...source.
|
|
468
|
+
...source.routes,
|
|
545
469
|
},
|
|
546
470
|
}
|
|
547
471
|
|
|
548
|
-
addClientEntryToManifest(manifest, source.clientEntry)
|
|
549
|
-
|
|
550
472
|
return manifest
|
|
551
473
|
}
|
package/src/virtual-modules.ts
CHANGED