import type { ImportMap } from './ImportMap.js'; import type { LinkedPath } from './LinkedPath.js'; import type { ResolveMap } from './ResolveMap.js'; import type { CloudpackConfig } from './CloudpackConfig.js'; export interface Session { /** * UUID for the session. */ readonly id: string; /** * The config used by the session. */ config: CloudpackConfig; /** * Used to resolve packages in the dependency graph. * Setting this will clear the `importMap`. * * NOTE: If the session (or whole API context) was created with `skipResolveDependencies`, * this will only contain the entry point package(s). With `onlyResolveDependencies`/`onlyInlinedDependencies`, * it will only contain those dependencies. */ resolveMap: ResolveMap; /** * Reload sequence to ensure that the client is always up to date with the latest changes. * (This is initially sent to the client via `pageSessionContext.currentSequence` and is updated * via the `reloadCountSource`. It's read directly, not used as a URL cache breaker.) */ sequence: number; /** * URLs of the active servers hosting this session. * Each URL will only be set after the server is started. */ urls: { appServer?: string; /** If `useSingleWebServer` is enabled, this will be a URL for bundles under the app server. */ bundleServer?: string; apiServer?: string; /** Api server urls only used for linking */ hostApiServer?: string[]; }; /** * Used to force a hard refresh on the client. * (Update with `incrementSessionVersion`.) */ readonly sessionVersion: number; /** * Increment the session version to force a hard refresh on the client. */ readonly incrementSessionVersion: () => void; /** * The name of the project folder. * Used to differentiate between multiple projects. */ readonly projectName: string; /** * Cache-breaker version of each target (input path). * Used to force a client cache refresh on a single target. * * Update with `incrementTargetVersion`. (This will be empty by default.) */ readonly targetVersions: Readonly>; /** * Increments the cache-breaker version for the given target (input path). * Used to force a client cache refresh on a single target. */ readonly incrementTargetVersion: (inputPath: string) => void; /** * The current import map **for the browser**. * This will only be set in contexts where an import map is needed, such as during `start`. */ importMap: ImportMap | undefined; /** * Cached mapping from absolute package path to all import paths for that package, calculated by * `createImportMap`. This is used by `addImportMapHash` to update the import map after bundling. * (Caching the import paths is useful for performance, as calculating them can be expensive.) * @example '/path/to/foo': `['foo', 'foo/bar']` */ readonly packageImportPaths: Map; /** * Linked paths that are used to resolve packages from other repos. */ linkedPaths: LinkedPath[]; /** * Add the linked path and regenerates the resolve map. */ readonly addLinkedPath: (linkedPath: LinkedPath) => Promise<{ resolveMap: ResolveMap; linkedPaths: LinkedPath[]; }>; /** * Remove the linked path and regenerates the resolve map. */ readonly removeLinkedPath: (linkedPath: LinkedPath) => Promise<{ resolveMap: ResolveMap; linkedPaths: LinkedPath[]; }>; /** * The path to the cache folder for the session. */ readonly cachePath: string; /** * Cached bundler aliases for deduped packages. * Maps package names to their resolved paths to ensure all imports use the same version. * Recalculated when resolveMap changes. * * Note: Using package names (without versions) as keys is safe here because packages in * resolve.dedupe are guaranteed to have only one version used throughout the entire app. * The dedupe configuration enforces that all imports resolve to a single canonical version. */ readonly dedupeAliases: Record; } //# sourceMappingURL=Session.d.ts.map