Skip to content

Commit 64cbc3a

Browse files
committed
Merge branch 'ref-props' into next
2 parents 7d21e27 + ea011a3 commit 64cbc3a

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ export interface ExtensionOptions {
179179
}
180180

181181
export type Compiler = 'babel' | 'native';
182-
export type SolidOptions = Omit<JsxCompilerOptions, 'filename' | 'sourceMap'>;
182+
// `serverComponents` ships in @dom-expressions/compiler's TransformOptions
183+
// from 0.50.0-next.44; the intersection member is redundant (and droppable)
184+
// once the dependency floor moves past it.
185+
export type SolidOptions = Omit<JsxCompilerOptions, 'filename' | 'sourceMap'> & {
186+
serverComponents?: boolean;
187+
};
183188
type NativeCompiler = typeof import('@dom-expressions/compiler');
184189
let nativeCompilerPromise: Promise<NativeCompiler> | undefined;
185190

@@ -465,12 +470,21 @@ function getSolidOptions(
465470
solidOptions = { generate: 'dom', hydratable: false };
466471
}
467472

473+
// Server components (serverFunctions.components) turn on the SSR-side
474+
// behavior-claims transform: ref/on* positions on intrinsic elements
475+
// compile to guarded `_bnd` claim holes instead of dropping. SSR-only
476+
// by construction (the dom generate ignores the flag), and apps without
477+
// the flag compile byte-for-byte as before.
478+
const serverComponents =
479+
typeof options.serverFunctions === 'object' && !!options.serverFunctions.components;
480+
468481
return {
469482
moduleName: '@solidjs/web',
470483
builtIns: SOLID_BUILT_INS,
471484
contextToCustomElements: true,
472485
wrapConditionals: true,
473486
...solidOptions,
487+
...(serverComponents && solidOptions.generate === 'ssr' ? { serverComponents: true } : {}),
474488
dev,
475489
...(options.solid || {}),
476490
};

0 commit comments

Comments
 (0)