@absolutejs/absolute 0.13.11 → 0.15.0
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.
- package/.claude/settings.local.json +7 -1
- package/CLAUDE.md +65 -56
- package/LICENSE +80 -24
- package/README.md +163 -163
- package/THIRD_PARTY_NOTICES.md +61 -0
- package/dist/cli/index.js +24 -8
- package/dist/index.js +3013 -480
- package/dist/index.js.map +56 -26
- package/dist/{build → src/build}/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +33 -0
- package/dist/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/src/build/htmlScriptHMRPlugin.d.ts +13 -0
- package/dist/src/build/wrapHTMLScript.d.ts +24 -0
- package/dist/src/core/build.d.ts +2 -0
- package/dist/src/core/devBuild.d.ts +6 -0
- package/dist/{core → src/core}/index.d.ts +2 -1
- package/dist/src/core/lookup.d.ts +3 -0
- package/dist/{core → src/core}/pageHandlers.d.ts +4 -4
- package/dist/src/dev/assetStore.d.ts +12 -0
- package/dist/src/dev/buildHMRClient.d.ts +1 -0
- package/dist/src/dev/clientManager.d.ts +26 -0
- package/dist/src/dev/configResolver.d.ts +13 -0
- package/dist/src/dev/dependencyGraph.d.ts +13 -0
- package/dist/src/dev/fileHashTracker.d.ts +2 -0
- package/dist/src/dev/fileWatcher.d.ts +3 -0
- package/dist/src/dev/moduleMapper.d.ts +21 -0
- package/dist/src/dev/moduleVersionTracker.d.ts +7 -0
- package/dist/src/dev/pathUtils.d.ts +5 -0
- package/dist/src/dev/reactComponentClassifier.d.ts +2 -0
- package/dist/src/dev/rebuildTrigger.d.ts +10 -0
- package/dist/src/dev/simpleHTMLHMR.d.ts +4 -0
- package/dist/src/dev/simpleHTMXHMR.d.ts +4 -0
- package/dist/src/dev/simpleSvelteHMR.d.ts +1 -0
- package/dist/src/dev/simpleVueHMR.d.ts +1 -0
- package/dist/src/dev/webSocket.d.ts +9 -0
- package/dist/{index.d.ts → src/index.d.ts} +1 -0
- package/dist/src/plugins/hmr.d.ts +62 -0
- package/dist/{plugins → src/plugins}/index.d.ts +2 -1
- package/dist/{plugins → src/plugins}/networking.d.ts +3 -0
- package/dist/{svelte → src/svelte}/renderToReadableStream.d.ts +3 -1
- package/dist/src/utils/getRegisterClientScript.d.ts +10 -0
- package/dist/{utils → src/utils}/index.d.ts +2 -0
- package/dist/src/utils/logger.d.ts +45 -0
- package/dist/src/utils/networking.d.ts +2 -0
- package/dist/src/utils/normalizePath.d.ts +9 -0
- package/dist/src/utils/registerClientScript.d.ts +51 -0
- package/dist/{types.d.ts → types/build.d.ts} +7 -0
- package/dist/types/client.d.ts +104 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/messages.d.ts +138 -0
- package/dist/types/websocket.d.ts +6 -0
- package/eslint.config.mjs +238 -234
- package/package.json +17 -12
- package/tsconfig.build.json +20 -20
- package/types/build.ts +46 -0
- package/types/client.ts +109 -0
- package/types/index.ts +4 -0
- package/types/messages.ts +205 -0
- package/types/websocket.ts +12 -0
- package/types/window-globals.ts +53 -0
- package/dist/build/compileVue.d.ts +0 -5
- package/dist/build/generateReactIndexes.d.ts +0 -1
- package/dist/core/build.d.ts +0 -2
- package/dist/core/lookup.d.ts +0 -1
- package/dist/utils/networking.d.ts +0 -1
- /package/dist/{build → src/build}/generateManifest.d.ts +0 -0
- /package/dist/{build → src/build}/outputLogs.d.ts +0 -0
- /package/dist/{build → src/build}/scanEntryPoints.d.ts +0 -0
- /package/dist/{build → src/build}/updateAssetPaths.d.ts +0 -0
- /package/dist/{cli → src/cli}/index.d.ts +0 -0
- /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
- /package/dist/{plugins → src/plugins}/pageRouter.d.ts +0 -0
- /package/dist/{svelte → src/svelte}/renderToPipeableStream.d.ts +0 -0
- /package/dist/{svelte → src/svelte}/renderToString.d.ts +0 -0
- /package/dist/{utils → src/utils}/cleanup.d.ts +0 -0
- /package/dist/{utils → src/utils}/commonAncestor.d.ts +0 -0
- /package/dist/{utils → src/utils}/escapeScriptContent.d.ts +0 -0
- /package/dist/{utils → src/utils}/generateHeadElement.d.ts +0 -0
- /package/dist/{utils → src/utils}/getDurationString.d.ts +0 -0
- /package/dist/{utils → src/utils}/getEnv.d.ts +0 -0
- /package/dist/{utils → src/utils}/stringModifiers.d.ts +0 -0
- /package/dist/{utils → src/utils}/validateSafePath.d.ts +0 -0
|
@@ -3,7 +3,8 @@ type Built = {
|
|
|
3
3
|
client: string;
|
|
4
4
|
};
|
|
5
5
|
type Cache = Map<string, Built>;
|
|
6
|
-
export declare const compileSvelte: (entryPoints: string[], svelteRoot: string, cache?: Cache) => Promise<{
|
|
6
|
+
export declare const compileSvelte: (entryPoints: string[], svelteRoot: string, cache?: Cache, isDev?: boolean) => Promise<{
|
|
7
|
+
svelteIndexPaths: string[];
|
|
7
8
|
svelteClientPaths: string[];
|
|
8
9
|
svelteServerPaths: string[];
|
|
9
10
|
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type SFCDescriptor } from '@vue/compiler-sfc';
|
|
2
|
+
export type VueChangeType = 'style-only' | 'template-only' | 'script' | 'full';
|
|
3
|
+
export declare const vueHmrMetadata: Map<string, {
|
|
4
|
+
hmrId: string;
|
|
5
|
+
changeType: VueChangeType;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Detect what type of change occurred in a Vue component
|
|
9
|
+
* Returns 'template-only' for template changes (supports rerender)
|
|
10
|
+
* Returns 'script' for script/scriptSetup changes (requires reload)
|
|
11
|
+
* Returns 'full' for first compile or when detection fails
|
|
12
|
+
*/
|
|
13
|
+
export declare const detectVueChangeType: (filePath: string, descriptor: SFCDescriptor) => VueChangeType;
|
|
14
|
+
/**
|
|
15
|
+
* Generate a stable HMR ID for a Vue component
|
|
16
|
+
* Uses relative path from Vue root without extension
|
|
17
|
+
* Example: "pages/VueExample" or "components/CountButton"
|
|
18
|
+
*/
|
|
19
|
+
export declare const generateVueHmrId: (sourceFilePath: string, vueRootDir: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Clear HMR caches (useful for testing or full rebuilds)
|
|
22
|
+
*/
|
|
23
|
+
export declare const clearVueHmrCaches: () => void;
|
|
24
|
+
export declare const compileVue: (entryPoints: string[], vueRootDir: string, isDev?: boolean) => Promise<{
|
|
25
|
+
vueClientPaths: string[];
|
|
26
|
+
vueCssPaths: string[];
|
|
27
|
+
vueIndexPaths: string[];
|
|
28
|
+
vueServerPaths: string[];
|
|
29
|
+
hmrMetadata: Map<string, {
|
|
30
|
+
hmrId: string;
|
|
31
|
+
changeType: VueChangeType;
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateReactIndexFiles: (reactPagesDirectory: string, reactIndexesDirectory: string, isDev?: boolean) => Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun build plugin that wraps HTML/HTMX scripts with import.meta.hot support
|
|
3
|
+
* for granular HMR. This allows script changes to hot-reload independently
|
|
4
|
+
* without triggering a full HTML page rebuild.
|
|
5
|
+
*/
|
|
6
|
+
import type { BunPlugin } from 'bun';
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Bun build plugin that wraps HTML/HTMX scripts with HMR support
|
|
9
|
+
* @param htmlDir - The HTML directory path (normalized with forward slashes)
|
|
10
|
+
* @param htmxDir - The HTMX directory path (normalized with forward slashes)
|
|
11
|
+
* @returns Bun build plugin
|
|
12
|
+
*/
|
|
13
|
+
export declare const createHTMLScriptHMRPlugin: (htmlDir?: string, htmxDir?: string) => BunPlugin;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps HTML/HTMX TypeScript/JavaScript scripts with import.meta.hot support
|
|
3
|
+
* for granular HMR updates. This allows script changes to hot-reload
|
|
4
|
+
* without triggering a full HTML page rebuild.
|
|
5
|
+
*
|
|
6
|
+
* The wrapper is minimal - it just adds import.meta.hot.accept() so Bun
|
|
7
|
+
* knows this module can be hot-reloaded. Event listener cleanup is handled
|
|
8
|
+
* by the HMR client (cloning elements before script re-execution).
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Wrap a script with HMR support using Bun's import.meta.hot API
|
|
12
|
+
* @param code - The original script code
|
|
13
|
+
* @param scriptId - Unique identifier for this script (usually the file path)
|
|
14
|
+
* @returns Wrapped code with HMR support
|
|
15
|
+
*/
|
|
16
|
+
export declare const wrapHTMLScriptWithHMR: (code: string, scriptId: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a file path is an HTML/HTMX script that should be wrapped
|
|
19
|
+
* @param filePath - The file path to check
|
|
20
|
+
* @param htmlDir - The HTML directory path
|
|
21
|
+
* @param htmxDir - The HTMX directory path
|
|
22
|
+
* @returns true if this script should be wrapped with HMR
|
|
23
|
+
*/
|
|
24
|
+
export declare const isHTMLScript: (filePath: string, htmlDir?: string, htmxDir?: string) => boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { BuildConfig } from '../../types/build';
|
|
2
|
+
export declare const build: ({ buildDirectory, assetsDirectory, publicDirectory, reactDirectory, htmlDirectory, htmxDirectory, angularDirectory, svelteDirectory, vueDirectory, tailwind, options, incrementalFiles }: BuildConfig) => Promise<Record<string, string>>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ComponentType as ReactComponent } from 'react';
|
|
2
2
|
import { Component as SvelteComponent } from 'svelte';
|
|
3
3
|
import { Component as VueComponent } from 'vue';
|
|
4
|
-
import { PropsArgs } from '
|
|
5
|
-
export declare const handleReactPageRequest: <Props extends Record<string, unknown> = Record<never, never>>(
|
|
4
|
+
import { PropsArgs } from '../../types/build';
|
|
5
|
+
export declare const handleReactPageRequest: <Props extends Record<string, unknown> = Record<never, never>>(PageComponent: ReactComponent<Props>, index: string, ...props: keyof Props extends never ? [] : [props: Props]) => Promise<Response>;
|
|
6
6
|
type HandleSveltePageRequest = {
|
|
7
7
|
(PageComponent: SvelteComponent<Record<string, never>>, pagePath: string, indexPath: string): Promise<Response>;
|
|
8
8
|
<P extends Record<string, unknown>>(PageComponent: SvelteComponent<P>, pagePath: string, indexPath: string, props: P): Promise<Response>;
|
|
9
9
|
};
|
|
10
10
|
export declare const handleSveltePageRequest: HandleSveltePageRequest;
|
|
11
11
|
export declare const handleVuePageRequest: <Props extends Record<string, unknown> = Record<never, never>>(_PageComponent: VueComponent<Props>, pagePath: string, indexPath: string, headTag?: `<head>${string}</head>`, ...props: keyof Props extends never ? [] : [props: Props]) => Promise<Response>;
|
|
12
|
-
export declare const handleHTMLPageRequest: (
|
|
13
|
-
export declare const handleHTMXPageRequest: (
|
|
12
|
+
export declare const handleHTMLPageRequest: (pagePath: string) => Bun.BunFile;
|
|
13
|
+
export declare const handleHTMXPageRequest: (pagePath: string) => Bun.BunFile;
|
|
14
14
|
export declare const handlePageRequest: <Component>(PageComponent: Component, ...props: PropsArgs<Component>) => void;
|
|
15
15
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Determine Content-Type from a file path extension */
|
|
2
|
+
export declare const getMimeType: (filePath: string) => string;
|
|
3
|
+
/** Upsert build outputs into the in-memory asset store.
|
|
4
|
+
* Evicts previous entries for the same logical asset (same base name,
|
|
5
|
+
* different hash) so stale paths don't accumulate. */
|
|
6
|
+
export declare const populateAssetStore: (store: Map<string, Uint8Array>, manifest: Record<string, string>, buildDir: string) => Promise<void>;
|
|
7
|
+
/** Remove hashed build files whose logical identity has a newer version.
|
|
8
|
+
* Checks both client assets (from the store) and SSR server files (from
|
|
9
|
+
* the manifest's absolute-path entries). Non-blocking async version. */
|
|
10
|
+
export declare const cleanStaleAssets: (store: Map<string, Uint8Array>, manifest: Record<string, string>, buildDir: string) => Promise<void>;
|
|
11
|
+
/** Look up an asset by its web path. Returns bytes or undefined. */
|
|
12
|
+
export declare const lookupAsset: (store: Map<string, Uint8Array>, path: string) => Uint8Array | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildHMRClient: () => Promise<string>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FSWatcher } from 'fs';
|
|
2
|
+
import { type DependencyGraph } from './dependencyGraph';
|
|
3
|
+
import { type ModuleVersions } from './moduleVersionTracker';
|
|
4
|
+
import type { HMRWebSocket } from '../../types/websocket';
|
|
5
|
+
import type { BuildConfig } from '../../types/build';
|
|
6
|
+
import { type ResolvedBuildPaths } from './configResolver';
|
|
7
|
+
export type HMRState = {
|
|
8
|
+
connectedClients: Set<HMRWebSocket>;
|
|
9
|
+
dependencyGraph: DependencyGraph;
|
|
10
|
+
isRebuilding: boolean;
|
|
11
|
+
rebuildQueue: Set<string>;
|
|
12
|
+
rebuildTimeout: NodeJS.Timeout | null;
|
|
13
|
+
fileChangeQueue: Map<string, string[]>;
|
|
14
|
+
debounceTimeout: NodeJS.Timeout | null;
|
|
15
|
+
fileHashes: Map<string, string>;
|
|
16
|
+
watchers: FSWatcher[];
|
|
17
|
+
moduleVersions: ModuleVersions;
|
|
18
|
+
sourceFileVersions: Map<string, number>;
|
|
19
|
+
config: BuildConfig;
|
|
20
|
+
resolvedPaths: ResolvedBuildPaths;
|
|
21
|
+
vueChangeTypes: Map<string, 'template-only' | 'script' | 'full'>;
|
|
22
|
+
assetStore: Map<string, Uint8Array>;
|
|
23
|
+
};
|
|
24
|
+
export declare const createHMRState: (config: BuildConfig) => HMRState;
|
|
25
|
+
export declare const incrementSourceFileVersion: (state: HMRState, filePath: string) => number;
|
|
26
|
+
export declare const incrementSourceFileVersions: (state: HMRState, filePaths: string[]) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BuildConfig } from '../../types/build';
|
|
2
|
+
/** Normalize and default build paths so HMR works outside the example app. */
|
|
3
|
+
export declare const resolveBuildPaths: (config: BuildConfig) => {
|
|
4
|
+
buildDir: string;
|
|
5
|
+
assetsDir: string | undefined;
|
|
6
|
+
reactDir: string | undefined;
|
|
7
|
+
svelteDir: string | undefined;
|
|
8
|
+
vueDir: string | undefined;
|
|
9
|
+
angularDir: string | undefined;
|
|
10
|
+
htmlDir: string | undefined;
|
|
11
|
+
htmxDir: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
export type ResolvedBuildPaths = ReturnType<typeof resolveBuildPaths>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type DependencyGraph = {
|
|
2
|
+
dependents: Map<string, Set<string>>;
|
|
3
|
+
dependencies: Map<string, Set<string>>;
|
|
4
|
+
};
|
|
5
|
+
export declare const createDependencyGraph: () => {
|
|
6
|
+
dependencies: Map<any, any>;
|
|
7
|
+
dependents: Map<any, any>;
|
|
8
|
+
};
|
|
9
|
+
export declare const extractDependencies: (filePath: string) => string[];
|
|
10
|
+
export declare const addFileToGraph: (graph: DependencyGraph, filePath: string) => void;
|
|
11
|
+
export declare const getAffectedFiles: (graph: DependencyGraph, changedFile: string) => string[];
|
|
12
|
+
export declare const removeFileFromGraph: (graph: DependencyGraph, filePath: string) => void;
|
|
13
|
+
export declare const buildInitialDependencyGraph: (graph: DependencyGraph, directories: string[]) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ComponentType } from './reactComponentClassifier';
|
|
2
|
+
export type ModuleUpdate = {
|
|
3
|
+
sourceFile: string;
|
|
4
|
+
framework: string;
|
|
5
|
+
moduleKeys: string[];
|
|
6
|
+
modulePaths: Record<string, string>;
|
|
7
|
+
componentType?: ComponentType;
|
|
8
|
+
};
|
|
9
|
+
export declare const mapSourceFileToManifestKeys: (sourceFile: string, framework: string, resolvedPaths?: {
|
|
10
|
+
reactDir?: string;
|
|
11
|
+
svelteDir?: string;
|
|
12
|
+
vueDir?: string;
|
|
13
|
+
angularDir?: string;
|
|
14
|
+
}) => string[];
|
|
15
|
+
export declare const createModuleUpdates: (changedFiles: string[], framework: string, manifest: Record<string, string>, resolvedPaths?: {
|
|
16
|
+
reactDir?: string;
|
|
17
|
+
svelteDir?: string;
|
|
18
|
+
vueDir?: string;
|
|
19
|
+
angularDir?: string;
|
|
20
|
+
}) => ModuleUpdate[];
|
|
21
|
+
export declare const groupModuleUpdatesByFramework: (updates: ModuleUpdate[]) => Map<string, ModuleUpdate[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ModuleVersion = number;
|
|
2
|
+
export type ModuleVersions = Map<string, ModuleVersion>;
|
|
3
|
+
export declare const getNextVersion: () => number;
|
|
4
|
+
export declare const createModuleVersionTracker: () => Map<string, number>;
|
|
5
|
+
export declare const incrementModuleVersion: (versions: ModuleVersions, modulePath: string) => number;
|
|
6
|
+
export declare const incrementModuleVersions: (versions: ModuleVersions, modulePaths: string[]) => Map<string, number>;
|
|
7
|
+
export declare const serializeModuleVersions: (versions: ModuleVersions) => Record<string, number>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BuildConfig } from '../../types/build';
|
|
2
|
+
import type { ResolvedBuildPaths } from './configResolver';
|
|
3
|
+
export declare const getWatchPaths: (config: BuildConfig, resolved?: ResolvedBuildPaths) => string[];
|
|
4
|
+
export declare const shouldIgnorePath: (path: string) => boolean;
|
|
5
|
+
export declare const detectFramework: (filePath: string, resolved?: ResolvedBuildPaths) => "react" | "vue" | "svelte" | "html" | "assets" | "htmx" | "ignored" | "angular" | "unknown";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BuildConfig } from '../../types/build';
|
|
2
|
+
import type { HMRState } from './clientManager';
|
|
3
|
+
export declare const queueFileChange: (state: HMRState, filePath: string, config: BuildConfig, onRebuildComplete: (result: {
|
|
4
|
+
manifest: Record<string, string>;
|
|
5
|
+
hmrState: HMRState;
|
|
6
|
+
}) => void) => void;
|
|
7
|
+
export declare const triggerRebuild: (state: HMRState, config: BuildConfig, onRebuildComplete: (result: {
|
|
8
|
+
manifest: Record<string, string>;
|
|
9
|
+
hmrState: HMRState;
|
|
10
|
+
}) => void, filesToRebuild?: string[]) => Promise<Record<string, string> | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handleSvelteUpdate: (svelteFilePath: string, manifest: Record<string, string>, buildDir?: string) => Promise<string | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const handleVueUpdate: (vueFilePath: string, manifest: Record<string, string>, buildDir?: string) => Promise<string | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HMRState } from './clientManager';
|
|
2
|
+
import type { HMRWebSocket } from '../../types/websocket';
|
|
3
|
+
export declare const handleClientConnect: (state: HMRState, client: HMRWebSocket, manifest: Record<string, string>) => void;
|
|
4
|
+
export declare const handleClientDisconnect: (state: HMRState, client: HMRWebSocket) => void;
|
|
5
|
+
export declare const handleHMRMessage: (state: HMRState, client: HMRWebSocket, message: unknown) => void;
|
|
6
|
+
export declare const broadcastToClients: (state: HMRState, message: {
|
|
7
|
+
type: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}) => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Elysia from 'elysia';
|
|
2
|
+
import { HMRState } from '../dev/clientManager';
|
|
3
|
+
export declare const hmr: (hmrState: HMRState, manifest: Record<string, string>) => (app: Elysia) => Elysia<"", {
|
|
4
|
+
decorator: {};
|
|
5
|
+
store: {};
|
|
6
|
+
derive: {};
|
|
7
|
+
resolve: {};
|
|
8
|
+
}, {
|
|
9
|
+
typebox: {};
|
|
10
|
+
error: {};
|
|
11
|
+
}, {
|
|
12
|
+
schema: {};
|
|
13
|
+
standaloneSchema: {};
|
|
14
|
+
macro: {};
|
|
15
|
+
macroFn: {};
|
|
16
|
+
parser: {};
|
|
17
|
+
response: {};
|
|
18
|
+
}, {
|
|
19
|
+
hmr: {
|
|
20
|
+
subscribe: {
|
|
21
|
+
body: unknown;
|
|
22
|
+
params: {};
|
|
23
|
+
query: unknown;
|
|
24
|
+
headers: unknown;
|
|
25
|
+
response: {
|
|
26
|
+
200: Response;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
} & {
|
|
31
|
+
"hmr-status": {
|
|
32
|
+
get: {
|
|
33
|
+
body: unknown;
|
|
34
|
+
params: {};
|
|
35
|
+
query: unknown;
|
|
36
|
+
headers: unknown;
|
|
37
|
+
response: {
|
|
38
|
+
200: Response | {
|
|
39
|
+
connectedClients: number;
|
|
40
|
+
isRebuilding: boolean;
|
|
41
|
+
manifestKeys: string[];
|
|
42
|
+
rebuildQueue: string[];
|
|
43
|
+
timestamp: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}, {
|
|
49
|
+
derive: {};
|
|
50
|
+
resolve: {};
|
|
51
|
+
schema: {};
|
|
52
|
+
standaloneSchema: {};
|
|
53
|
+
response: {};
|
|
54
|
+
}, {
|
|
55
|
+
derive: {};
|
|
56
|
+
resolve: {};
|
|
57
|
+
schema: {};
|
|
58
|
+
standaloneSchema: {};
|
|
59
|
+
response: {
|
|
60
|
+
200: Response;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
@@ -13,14 +13,17 @@ export declare const networking: (app: Elysia) => Elysia<"", {
|
|
|
13
13
|
macro: {};
|
|
14
14
|
macroFn: {};
|
|
15
15
|
parser: {};
|
|
16
|
+
response: {};
|
|
16
17
|
}, {}, {
|
|
17
18
|
derive: {};
|
|
18
19
|
resolve: {};
|
|
19
20
|
schema: {};
|
|
20
21
|
standaloneSchema: {};
|
|
22
|
+
response: {};
|
|
21
23
|
}, {
|
|
22
24
|
derive: {};
|
|
23
25
|
resolve: {};
|
|
24
26
|
schema: {};
|
|
25
27
|
standaloneSchema: {};
|
|
28
|
+
response: {};
|
|
26
29
|
}>;
|
|
@@ -7,5 +7,7 @@ export type RenderStreamOptions = {
|
|
|
7
7
|
onError?: (error: unknown) => void;
|
|
8
8
|
progressiveChunkSize?: number;
|
|
9
9
|
signal?: AbortSignal;
|
|
10
|
+
headContent?: string;
|
|
11
|
+
bodyContent?: string;
|
|
10
12
|
};
|
|
11
|
-
export declare const renderToReadableStream: <Props extends Record<string, unknown> = Record<string, never>>(component: Component<Props>, props?: Props, { bootstrapScriptContent, bootstrapScripts, bootstrapModules, nonce, onError, progressiveChunkSize, signal }?: RenderStreamOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
13
|
+
export declare const renderToReadableStream: <Props extends Record<string, unknown> = Record<string, never>>(component: Component<Props>, props?: Props, { bootstrapScriptContent, bootstrapScripts, bootstrapModules, nonce, onError, progressiveChunkSize, signal, headContent, bodyContent }?: RenderStreamOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe helper to get the registerClientScript function during SSR.
|
|
3
|
+
*
|
|
4
|
+
* This function safely accesses the global registerClientScript that's made
|
|
5
|
+
* available during Angular SSR rendering. It returns null if not available
|
|
6
|
+
* (e.g., when running outside of SSR context).
|
|
7
|
+
*
|
|
8
|
+
* @returns The registerClientScript function if available, null otherwise
|
|
9
|
+
*/
|
|
10
|
+
export declare const getRegisterClientScript: () => ((script: () => void) => string) | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized logger utility for AbsoluteJS
|
|
3
|
+
* Provides Vite-style formatted output with ANSI colors and timestamps
|
|
4
|
+
*/
|
|
5
|
+
export declare const logger: {
|
|
6
|
+
/**
|
|
7
|
+
* HMR update message
|
|
8
|
+
* Format: "10:30:45 AM [hmr] hmr update /pages/App.tsx"
|
|
9
|
+
*/
|
|
10
|
+
hmrUpdate(path: string, framework?: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Page reload message
|
|
13
|
+
* Format: "10:30:45 AM [hmr] page reload /src/App.tsx"
|
|
14
|
+
*/
|
|
15
|
+
pageReload(path: string, framework?: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* CSS update message
|
|
18
|
+
* Format: "10:30:45 AM [hmr] css update /styles/main.css"
|
|
19
|
+
*/
|
|
20
|
+
cssUpdate(path: string, framework?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Script update message
|
|
23
|
+
* Format: "10:30:45 AM [hmr] script update /scripts/counter.ts"
|
|
24
|
+
*/
|
|
25
|
+
scriptUpdate(path: string, framework?: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Rebuild complete message
|
|
28
|
+
* Format: "10:30:45 AM [hmr] rebuilt (125ms)"
|
|
29
|
+
*/
|
|
30
|
+
rebuilt(duration: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Build error
|
|
33
|
+
* Format: "10:30:45 AM [hmr] error Build failed: ..."
|
|
34
|
+
*/
|
|
35
|
+
error(message: string, error?: Error | string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Warning message
|
|
38
|
+
* Format: "10:30:45 AM [hmr] warning ..."
|
|
39
|
+
*/
|
|
40
|
+
warn(message: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Generic info message
|
|
43
|
+
*/
|
|
44
|
+
info(message: string): void;
|
|
45
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize file paths to use forward slashes for cross-platform compatibility.
|
|
3
|
+
* Windows uses backslashes, but this codebase standardizes on forward slashes.
|
|
4
|
+
*/
|
|
5
|
+
export declare const normalizePath: (path: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Normalize all paths in an array.
|
|
8
|
+
*/
|
|
9
|
+
export declare const normalizePaths: (paths: string[]) => string[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for registering client-side scripts that need to run after Angular SSR hydration.
|
|
3
|
+
*
|
|
4
|
+
* This is necessary because Angular's lifecycle hooks don't always run reliably on the client
|
|
5
|
+
* after SSR hydration, especially for event listeners attached to DOM elements.
|
|
6
|
+
*
|
|
7
|
+
* Usage in Angular components:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { registerClientScript } from '@absolutejs/absolute';
|
|
10
|
+
*
|
|
11
|
+
* // Register an event listener script
|
|
12
|
+
* registerClientScript(() => {
|
|
13
|
+
* const element = document.querySelector('.my-element');
|
|
14
|
+
* if (element) {
|
|
15
|
+
* element.addEventListener('click', () => {
|
|
16
|
+
* console.log('Clicked!');
|
|
17
|
+
* });
|
|
18
|
+
* }
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* The script will be automatically injected into the HTML response and executed on the client.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Register a client-side script to be injected into the HTML response.
|
|
26
|
+
*
|
|
27
|
+
* @param script - A function containing the client-side code to execute
|
|
28
|
+
* @param requestId - Optional request ID. If not provided, uses the current request context.
|
|
29
|
+
* @returns The request ID for this script registration
|
|
30
|
+
*/
|
|
31
|
+
export declare const registerClientScript: (script: () => void, requestId?: string) => any;
|
|
32
|
+
/**
|
|
33
|
+
* Get all registered scripts for a request and clear them.
|
|
34
|
+
* This is called by the page handler after rendering.
|
|
35
|
+
*
|
|
36
|
+
* @param requestId - The request ID to get scripts for
|
|
37
|
+
* @returns Array of script functions, or empty array if none registered
|
|
38
|
+
*/
|
|
39
|
+
export declare const getAndClearClientScripts: (requestId: string) => (() => void)[];
|
|
40
|
+
/**
|
|
41
|
+
* Generate JavaScript code from registered scripts.
|
|
42
|
+
* Wraps each script in an IIFE and combines them.
|
|
43
|
+
*
|
|
44
|
+
* @param scripts - Array of script functions
|
|
45
|
+
* @returns JavaScript code string to inject
|
|
46
|
+
*/
|
|
47
|
+
export declare const generateClientScriptCode: (scripts: (() => void)[]) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Clear all registered scripts (useful for cleanup or testing)
|
|
50
|
+
*/
|
|
51
|
+
export declare const clearAllClientScripts: () => void;
|
|
@@ -3,10 +3,16 @@ import { Component as SvelteComponent } from 'svelte';
|
|
|
3
3
|
import { Component as VueComponent } from 'vue';
|
|
4
4
|
export type BuildOptions = {
|
|
5
5
|
preserveIntermediateFiles?: boolean;
|
|
6
|
+
/** When true, build() throws on error instead of exit(1) - used by HMR rebuilds */
|
|
7
|
+
throwOnError?: boolean;
|
|
8
|
+
hmr?: {
|
|
9
|
+
debounceMs?: number;
|
|
10
|
+
};
|
|
6
11
|
};
|
|
7
12
|
export type BuildConfig = {
|
|
8
13
|
buildDirectory?: string;
|
|
9
14
|
assetsDirectory?: string;
|
|
15
|
+
publicDirectory?: string;
|
|
10
16
|
reactDirectory?: string;
|
|
11
17
|
vueDirectory?: string;
|
|
12
18
|
angularDirectory?: string;
|
|
@@ -19,6 +25,7 @@ export type BuildConfig = {
|
|
|
19
25
|
output: string;
|
|
20
26
|
};
|
|
21
27
|
options?: BuildOptions;
|
|
28
|
+
incrementalFiles?: string[];
|
|
22
29
|
};
|
|
23
30
|
export type PropsOf<Component> = Component extends ReactComponent<infer Props> ? Props : Component extends SvelteComponent<infer Props> ? Props : Component extends VueComponent<infer Props> ? Props : Record<string, never>;
|
|
24
31
|
export type PropsArgs<C> = keyof PropsOf<C> extends never ? [] : [PropsOf<C>];
|