@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
22 lines • 1.01 kB
TypeScript
import type { ParsedEvent } from './events';
/**
* Transform a <script client> block's content into a fully processed <script> tag.
*
* - Auto-imports from 'stx' and '@stacksjs/browser' (no explicit imports needed)
* - Resolves `import { x } from '@stores'` to runtime store access
* - Appends event binding code inside the script scope
* - Wraps everything in a scoped IIFE
*
* @param scriptContent - The raw content inside <script client>...</script>
* @param options - Event bindings and other processing options
* @returns A complete `<script>...</script>` tag ready for browser injection
*/
export declare function processClientScript(scriptContent: string, options?: ClientScriptOptions): string;
// =============================================================================
// Types
// =============================================================================
export declare interface ClientScriptOptions {
eventBindings?: ParsedEvent[]
autoImports?: boolean
attrs?: string
}