/** * vapor-chamber/vapor - the entry for Vue 3.6 apps that call the library's * Vapor API (`createVaporChamberApp`, the `defineVapor*` component wrappers, * `getVaporInteropPlugin`). Any other Vue app, Vapor included, takes * `vapor-chamber/vue`. * * Import from HERE and Vapor wiring stops being something you can forget or get * subtly wrong. No `configureVue()` call, no probe to lose a race with, no list * of names to keep in sync: this module imports Vue's Vapor APIs statically, so * the consumer's bundler resolves them at build time and they reach the registry * the moment the module is evaluated. * * @example * import { createVaporChamberApp } from 'vapor-chamber/vapor'; * import App from './App.vue'; * * createVaporChamberApp(App).mount('#app'); * * WHY THIS EXISTS - and why it is a THIRD entry rather than part of * `vapor-chamber/vue`. That module is scoped, deliberately, to the surface that * exists on Vue **3.5**, which the peer range still supports. The Vapor names * below do not exist there, and importing a missing name is a link error, not a * soft failure - so a 3.5 consumer importing `vapor-chamber/vue` must not be * made to resolve them. Splitting them out is what lets both audiences have a * static entry. `src/vue.ts`'s SCOPE note puts Vapor wiring in a 3.6-only * subpath; this is that subpath. * * WHAT IT FIXES, concretely. The package root reaches Vue through a runtime * probe - a bare dynamic `import()` of a specifier held in a variable - because * the root must survive with no Vue in the tree at all. That probe answers * correctly under a dev server and **cannot resolve in a production bundle**, * where a bare specifier has nothing to resolve against and the rejection is * swallowed. Two failures follow: * * 1. Vapor detection comes up empty, so `createVaporChamberApp()` throws * "Vue 3.6+ with Vapor mode required. No Vue detected." on a page with * Vapor bundled into it. Pinned by * `tests/vapor-sfc-prod-detection.test.ts`. * 2. Registry entries the probe would have supplied are simply absent, and * guards that depend on them go quietly inert - a missing * `hasInjectionContext` disables the KeepAlive guard in * `useCommandHistory` / `useCommandError`. Pinned by * `tests/vue-subpath-wiring-fixture.test.ts`. * * Both are dev-correct / prod-broken, which is the worst shape a defect can * have. A static entry removes the class rather than the instances. * * COST: none beyond what you already ship. `vue` is external, so these resolve * to the copy already in the consumer's graph - never a second reactivity * instance. Named imports, not `import * as Vue`: a namespace object forces the * bundler to retain every Vue export (measured at 3x bundle size on the * vapor-sfc example, v1.18.0). * * SUPERSET: re-exports everything `vapor-chamber/vue` does. Importing this * module runs that one's wiring too - the 3.5-safe primitives and the * `@vue/reactivity` tracking pair that keeps `untracked()` from degrading to a * pass-through once built. That includes the root's framework-agnostic surface * (`createCommandBus`, `getCommandBus` / `setCommandBus`, plugins, transports), * which `/vue` re-exports, so such an app imports this one entry: * * ```ts * import { createCommandBus, setCommandBus, createVaporChamberApp, useCommand } from 'vapor-chamber/vapor'; * ``` * * The root still carries that surface for apps with no Vue in the tree. */ import type { App, Directive, ShallowRef, VaporComponent, VaporDirective } from 'vue'; declare module './signal' { interface Signal extends ShallowRef { } } export * from './vue'; /** * A Vapor app: Vue's `App` whose `directive()` also takes a Vapor directive, * `(el, value, argument, modifiers) => cleanup`. Vue's own `App.directive` * takes the vDOM shape only (rc.12), so `createVaporApp(App).directive( * 'vc-command', vcCommandVapor)` fails the type check. A Vapor app runs a * function directive and skips an object one. Extending the interface keeps * `this` the Vapor app after `use()`. tests/vapor-app-types.test.ts. */ export interface VaporChamberApp extends App { directive(name: string, directive: VaporDirective): this; directive(name: string): Directive | undefined; directive(name: string, directive: Directive): this; } /** * createVaporChamberApp - Vue's `createVaporApp`, typed as a * {@link VaporChamberApp}, so the Vapor directives register app-wide: * * @example * import { createVaporChamberApp } from 'vapor-chamber/vapor'; * import { vcCommandVapor } from 'vapor-chamber/directives'; * createVaporChamberApp(App).directive('vc-command', vcCommandVapor).mount('#app'); */ export declare const createVaporChamberApp: (rootComponent: VaporComponent, rootProps?: Record) => VaporChamberApp; export { getVaporInteropPlugin, defineVaporCommand, defineVaporCustomElement, defineVaporComponent, useVaporAsyncCommand, } from './chamber-vapor'; /** * defineVaporAsyncComponent - define an async Vapor component for lazy loading. * * This entry's own wrapper, the one exception to the list above: it calls * Vue's function directly, so it reads no registry and never returns null. * Under `vaporChamberWire({ entry: 'vapor' })` the root exports this one too * (decision 6); everywhere else the root's wrapper reads the registry this * module seeds. Same contract as the root's: see `chamber-vapor.ts`. * * @example * import { defineVaporAsyncComponent } from 'vapor-chamber/vapor'; * const AsyncPanel = defineVaporAsyncComponent(() => import('./Panel.vue')); */ export declare function defineVaporAsyncComponent(loader: (() => Promise) | object): T; //# sourceMappingURL=vapor.d.ts.map