@octanejs/tanstack-start 0.1.1 → 0.1.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 (33) hide show
  1. package/package.json +13 -8
  2. package/src/GenericHydrate.tsrx +396 -0
  3. package/src/GenericHydrate.tsrx.d.ts +5 -0
  4. package/src/Hydrate.tsrx +106 -0
  5. package/src/Hydrate.tsrx.d.ts +63 -0
  6. package/src/client-only-server-strip.js +76 -0
  7. package/src/hydration/generic.d.ts +18 -0
  8. package/src/hydration/generic.js +26 -0
  9. package/src/hydration/idle.d.ts +9 -0
  10. package/src/hydration/idle.js +10 -0
  11. package/src/hydration/load.tsrx +38 -0
  12. package/src/hydration/load.tsrx.d.ts +8 -0
  13. package/src/hydration/never.tsrx +71 -0
  14. package/src/hydration/never.tsrx.d.ts +6 -0
  15. package/src/hydration/visible.tsrx +123 -0
  16. package/src/hydration/visible.tsrx.d.ts +12 -0
  17. package/src/hydration.d.ts +20 -0
  18. package/src/hydration.js +8 -0
  19. package/src/index.d.ts +11 -0
  20. package/src/index.js +2 -0
  21. package/src/internal/router-generator/filesystem/physical/getRouteNodes.js +4 -6
  22. package/src/internal/router-generator/generator.js +3 -0
  23. package/src/internal/router-plugin/core/code-splitter/compilers.js +3 -6
  24. package/src/internal/router-plugin/core/config.d.ts +1 -3
  25. package/src/internal/router-plugin/esbuild.d.ts +4 -10
  26. package/src/internal/router-plugin/vite.d.ts +4 -10
  27. package/src/internal/start-plugin-core/import-protection/analysis.js +13 -12
  28. package/src/internal/start-plugin-core/schema.d.ts +4 -14
  29. package/src/internal/start-plugin-core/start-compiler/compiler.d.ts +1 -6
  30. package/src/internal/start-plugin-core/types.d.ts +1 -2
  31. package/src/internal/start-plugin-core/vite/import-protection-plugin/plugin.js +16 -16
  32. package/src/internal/start-plugin-core/vite/schema.d.ts +3 -12
  33. package/src/plugin-vite.js +5 -0
@@ -1,4 +1,4 @@
1
- import { VITE_ENVIRONMENT_NAMES } from '../../constants.js';
1
+ import { TRANSFORM_ID_REGEX, VITE_ENVIRONMENT_NAMES } from '../../constants.js';
2
2
  import { escapeRegExp, resolveViteId } from '../../utils.js';
3
3
  import {
4
4
  IMPORT_PROTECTION_DEBUG,
@@ -415,12 +415,10 @@ function importProtectionPlugin(opts) {
415
415
  ) {
416
416
  const normalizedResolvedId = normalizeFilePath(resolvedId);
417
417
  const markerKind = shared.fileMarkerKind.get(normalizedResolvedId);
418
- if (
419
- !(
420
- (envType === 'client' && markerKind === 'server') ||
421
- (envType === 'server' && markerKind === 'client')
422
- )
423
- )
418
+ if (!(
419
+ (envType === 'client' && markerKind === 'server') ||
420
+ (envType === 'server' && markerKind === 'client')
421
+ ))
424
422
  return void 0;
425
423
  return buildViolationInfo(
426
424
  envName,
@@ -1081,14 +1079,12 @@ function importProtectionPlugin(opts) {
1081
1079
  if (internalVirtualId) return internalVirtualId;
1082
1080
  if (!importer) {
1083
1081
  const normalizedSource = normalizeFilePath(source);
1084
- if (
1085
- !(
1086
- config.command === 'serve' &&
1087
- config.bundledDev &&
1088
- envType === 'client' &&
1089
- isInsideDirectory(normalizedSource, config.srcDirectory)
1090
- )
1091
- )
1082
+ if (!(
1083
+ config.command === 'serve' &&
1084
+ config.bundledDev &&
1085
+ envType === 'client' &&
1086
+ isInsideDirectory(normalizedSource, config.srcDirectory)
1087
+ ))
1092
1088
  env.graph.addEntry(source);
1093
1089
  await processPendingViolations(env, this.warn.bind(this));
1094
1090
  return;
@@ -1389,7 +1385,11 @@ function importProtectionPlugin(opts) {
1389
1385
  return environmentNames.has(env.name);
1390
1386
  },
1391
1387
  transform: {
1392
- filter: { id: { include: [/\.[cm]?[tj]sx?($|\?)/] } },
1388
+ // TRANSFORM_ID_REGEX includes .tsrx the hand-rolled react-only
1389
+ // regex here silently skipped octane importers, so denied *.client.*
1390
+ // imports were never edge-rewritten/deferred and hard-errored at
1391
+ // resolve instead of tree-shake-verified like react's do.
1392
+ filter: { id: { include: [...TRANSFORM_ID_REGEX] } },
1393
1393
  async handler(code, id) {
1394
1394
  perf?.count('transform.calls');
1395
1395
  const envName = this.environment.name;
@@ -1810,8 +1810,7 @@ export declare function parseStartConfig(
1810
1810
  base: string;
1811
1811
  disableCsrfMiddlewareWarning: boolean;
1812
1812
  generateFunctionId?:
1813
- | ((opts: { filename: string; functionName: string }) => string | undefined)
1814
- | undefined;
1813
+ ((opts: { filename: string; functionName: string }) => string | undefined) | undefined;
1815
1814
  };
1816
1815
  pages: {
1817
1816
  path: string;
@@ -1820,14 +1819,7 @@ export declare function parseStartConfig(
1820
1819
  exclude?: boolean | undefined;
1821
1820
  priority?: number | undefined;
1822
1821
  changefreq?:
1823
- | 'never'
1824
- | 'always'
1825
- | 'hourly'
1826
- | 'daily'
1827
- | 'weekly'
1828
- | 'monthly'
1829
- | 'yearly'
1830
- | undefined;
1822
+ 'never' | 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | undefined;
1831
1823
  lastmod?: string | Date | undefined;
1832
1824
  alternateRefs?:
1833
1825
  | {
@@ -2390,8 +2382,7 @@ export declare function parseStartConfig(
2390
2382
  | undefined;
2391
2383
  mockAccess?: 'error' | 'warn' | 'off' | undefined;
2392
2384
  onViolation?:
2393
- | ((violation: unknown) => boolean | void | Promise<boolean | void>)
2394
- | undefined;
2385
+ ((violation: unknown) => boolean | void | Promise<boolean | void>) | undefined;
2395
2386
  include?: (string | RegExp)[] | undefined;
2396
2387
  exclude?: (string | RegExp)[] | undefined;
2397
2388
  client?:
@@ -1,6 +1,7 @@
1
1
  import { START_ENVIRONMENT_NAMES, tanStackStartVite } from '#tanstack-start/plugin-core/vite';
2
2
  import { octaneRouteGeneratorPlugin } from '@octanejs/tanstack-router/generator-plugin';
3
3
  import { octane } from 'octane/compiler/vite';
4
+ import { octaneClientOnlyServerStrip } from './client-only-server-strip.js';
4
5
  import { octaneStartDefaultEntryPaths } from './default-entry-paths.js';
5
6
  import { validateOctaneCompilerOptions } from './validate-options.js';
6
7
 
@@ -23,6 +24,7 @@ const WORKSPACE_SOURCE_EXCLUDES = [
23
24
  const WORKSPACE_SOURCE_INCLUDES = [
24
25
  '@octanejs/tanstack-router > @tanstack/router-core/isServer',
25
26
  '@octanejs/tanstack-router > @tanstack/router-core/scroll-restoration-script',
27
+ '@octanejs/tanstack-start > @tanstack/router-core/isServer',
26
28
  ];
27
29
 
28
30
  export function tanstackStart(options) {
@@ -39,6 +41,9 @@ export function tanstackStart(options) {
39
41
  };
40
42
 
41
43
  return [
44
+ // Must run before the octane compiler: strips <ClientOnly> children on
45
+ // the server (the octane analogue of start-compiler handleClientOnlyJSX).
46
+ octaneClientOnlyServerStrip(),
42
47
  octane(octaneOptions),
43
48
  {
44
49
  name: 'octanejs-tanstack-start:workspace-source-deps',