@abs-test/absolutejs-test 0.1.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 +10 -0
- package/.hmr-temp/App.3e3a3834.js +65 -0
- package/.hmr-temp/App.462a6bf2.js +65 -0
- package/.hmr-temp/App.9d060aa8.js +65 -0
- package/.hmr-temp/Dropdown.4cb79868.js +43 -0
- package/.hmr-temp/Head.92c96724.js +51 -0
- package/.hmr-temp/ReactExample.031ea6c9.js +28 -0
- package/.hmr-temp/ReactExample.3ad8f8c9.js +29 -0
- package/.hmr-temp/ReactExample.b28ebc93.js +27 -0
- package/.hmr-temp/ReactExample.c4bbd06e.js +27 -0
- package/.hmr-temp/ReactExample.dcc8d0d4.js +27 -0
- package/CLAUDE.md +65 -0
- package/LICENSE +80 -0
- package/README.md +163 -0
- package/THIRD_PARTY_NOTICES.md +61 -0
- package/abs-test-absolutejs-test-0.1.0.tgz +0 -0
- package/absolutejs-absolute-0.15.12.tgz +0 -0
- package/dist/cli/index.js +98 -0
- package/dist/dev/client/cssUtils.ts +288 -0
- package/dist/dev/client/domDiff.ts +261 -0
- package/dist/dev/client/domState.ts +271 -0
- package/dist/dev/client/errorOverlay.ts +168 -0
- package/dist/dev/client/frameworkDetect.ts +63 -0
- package/dist/dev/client/handlers/html.ts +415 -0
- package/dist/dev/client/handlers/htmx.ts +248 -0
- package/dist/dev/client/handlers/react.ts +86 -0
- package/dist/dev/client/handlers/rebuild.ts +153 -0
- package/dist/dev/client/handlers/svelte.ts +129 -0
- package/dist/dev/client/handlers/vue.ts +254 -0
- package/dist/dev/client/headPatch.ts +213 -0
- package/dist/dev/client/hmrClient.ts +237 -0
- package/dist/dev/client/moduleVersions.ts +57 -0
- package/dist/dev/client/reactRefreshSetup.ts +21 -0
- package/dist/index.js +3667 -0
- package/dist/index.js.map +65 -0
- package/dist/src/build/buildReactVendor.d.ts +8 -0
- package/dist/src/build/compileSvelte.d.ts +11 -0
- package/dist/src/build/compileVue.d.ts +33 -0
- package/dist/src/build/generateManifest.d.ts +2 -0
- package/dist/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/src/build/htmlScriptHMRPlugin.d.ts +13 -0
- package/dist/src/build/outputLogs.d.ts +1 -0
- package/dist/src/build/rewriteReactImports.d.ts +8 -0
- package/dist/src/build/scanEntryPoints.d.ts +1 -0
- package/dist/src/build/updateAssetPaths.d.ts +1 -0
- package/dist/src/build/wrapHTMLScript.d.ts +24 -0
- package/dist/src/cli/index.d.ts +2 -0
- package/dist/src/constants.d.ts +12 -0
- package/dist/src/core/build.d.ts +2 -0
- package/dist/src/core/devBuild.d.ts +6 -0
- package/dist/src/core/devVendorPaths.d.ts +7 -0
- package/dist/src/core/index.d.ts +4 -0
- package/dist/src/core/lookup.d.ts +3 -0
- package/dist/src/core/pageHandlers.d.ts +15 -0
- 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/src/index.d.ts +5 -0
- package/dist/src/plugins/hmr.d.ts +62 -0
- package/dist/src/plugins/index.d.ts +3 -0
- package/dist/src/plugins/networking.d.ts +29 -0
- package/dist/src/plugins/pageRouter.d.ts +1 -0
- package/dist/src/svelte/renderToPipeableStream.d.ts +12 -0
- package/dist/src/svelte/renderToReadableStream.d.ts +13 -0
- package/dist/src/svelte/renderToString.d.ts +9 -0
- package/dist/src/utils/cleanup.d.ts +7 -0
- package/dist/src/utils/commonAncestor.d.ts +1 -0
- package/dist/src/utils/escapeScriptContent.d.ts +1 -0
- package/dist/src/utils/generateHeadElement.d.ts +17 -0
- package/dist/src/utils/getDurationString.d.ts +1 -0
- package/dist/src/utils/getEnv.d.ts +1 -0
- package/dist/src/utils/getRegisterClientScript.d.ts +10 -0
- package/dist/src/utils/index.d.ts +6 -0
- package/dist/src/utils/logger.d.ts +54 -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/src/utils/stringModifiers.d.ts +2 -0
- package/dist/src/utils/validateSafePath.d.ts +1 -0
- package/dist/types/build.d.ts +41 -0
- package/dist/types/client.d.ts +108 -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 -0
- package/package.json +67 -0
- package/tsconfig.build.json +20 -0
- package/types/build.ts +54 -0
- package/types/client.ts +111 -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
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateSafePath: (targetPath: string, baseDirectory: string) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentType as ReactComponent } from 'react';
|
|
2
|
+
import { Component as SvelteComponent } from 'svelte';
|
|
3
|
+
import { Component as VueComponent } from 'vue';
|
|
4
|
+
import { build } from '../src/core/build';
|
|
5
|
+
import { devBuild } from '../src/core/devBuild';
|
|
6
|
+
export type BuildOptions = {
|
|
7
|
+
preserveIntermediateFiles?: boolean;
|
|
8
|
+
/** When true, build() throws on error instead of exit(1) - used by HMR rebuilds */
|
|
9
|
+
throwOnError?: boolean;
|
|
10
|
+
/** When true, HMR client code is injected into built assets. Set by devBuild(). */
|
|
11
|
+
injectHMR?: boolean;
|
|
12
|
+
hmr?: {
|
|
13
|
+
debounceMs?: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type BuildConfig = {
|
|
17
|
+
buildDirectory?: string;
|
|
18
|
+
assetsDirectory?: string;
|
|
19
|
+
publicDirectory?: string;
|
|
20
|
+
reactDirectory?: string;
|
|
21
|
+
vueDirectory?: string;
|
|
22
|
+
angularDirectory?: string;
|
|
23
|
+
astroDirectory?: string;
|
|
24
|
+
svelteDirectory?: string;
|
|
25
|
+
htmlDirectory?: string;
|
|
26
|
+
htmxDirectory?: string;
|
|
27
|
+
tailwind?: {
|
|
28
|
+
input: string;
|
|
29
|
+
output: string;
|
|
30
|
+
};
|
|
31
|
+
options?: BuildOptions;
|
|
32
|
+
incrementalFiles?: string[];
|
|
33
|
+
};
|
|
34
|
+
export type BuildResult = ReturnType<typeof build>;
|
|
35
|
+
export type DevBuildResult = ReturnType<typeof devBuild>;
|
|
36
|
+
export type Result = BuildResult | DevBuildResult;
|
|
37
|
+
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>;
|
|
38
|
+
export type PropsArgs<C> = keyof PropsOf<C> extends never ? [] : [PropsOf<C>];
|
|
39
|
+
export type Prettify<T> = {
|
|
40
|
+
[K in keyof T]: T[K];
|
|
41
|
+
} & {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export interface ErrorOverlayOptions {
|
|
2
|
+
column?: number;
|
|
3
|
+
file?: string;
|
|
4
|
+
framework?: string;
|
|
5
|
+
kind?: 'compilation' | 'runtime';
|
|
6
|
+
line?: number;
|
|
7
|
+
lineText?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DOMStateEntry {
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
id?: string;
|
|
13
|
+
idx: number;
|
|
14
|
+
name?: string;
|
|
15
|
+
open?: boolean;
|
|
16
|
+
selEnd?: number;
|
|
17
|
+
selStart?: number;
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
tag: string;
|
|
20
|
+
text?: string;
|
|
21
|
+
type?: string;
|
|
22
|
+
value?: string;
|
|
23
|
+
values?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface DOMStateSnapshot {
|
|
26
|
+
activeKey: string | null;
|
|
27
|
+
items: DOMStateEntry[];
|
|
28
|
+
}
|
|
29
|
+
export interface SavedComponentState {
|
|
30
|
+
count: number;
|
|
31
|
+
}
|
|
32
|
+
export interface SavedState {
|
|
33
|
+
componentState: SavedComponentState;
|
|
34
|
+
forms: Record<string, Record<string, boolean | string>>;
|
|
35
|
+
scroll: {
|
|
36
|
+
window: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface ScriptInfo {
|
|
43
|
+
src: string;
|
|
44
|
+
type: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CSSUpdateResult {
|
|
47
|
+
linksToActivate: HTMLLinkElement[];
|
|
48
|
+
linksToRemove: HTMLLinkElement[];
|
|
49
|
+
linksToWaitFor: Promise<void>[];
|
|
50
|
+
}
|
|
51
|
+
export declare const hmrState: {
|
|
52
|
+
isConnected: boolean;
|
|
53
|
+
isFirstHMRUpdate: boolean;
|
|
54
|
+
isHMRUpdating: boolean;
|
|
55
|
+
pingInterval: ReturnType<typeof setInterval> | null;
|
|
56
|
+
reconnectTimeout: ReturnType<typeof setTimeout> | null;
|
|
57
|
+
};
|
|
58
|
+
declare global {
|
|
59
|
+
interface Window {
|
|
60
|
+
$RefreshReg$?: (type: unknown, id: string) => void;
|
|
61
|
+
$RefreshRuntime$?: {
|
|
62
|
+
createSignatureFunctionForTransform: () => (type: unknown) => unknown;
|
|
63
|
+
injectIntoGlobalHook: (win: Window) => void;
|
|
64
|
+
performReactRefresh: () => void;
|
|
65
|
+
register: (type: unknown, id: string) => void;
|
|
66
|
+
};
|
|
67
|
+
$RefreshSig$?: () => (type: unknown) => unknown;
|
|
68
|
+
__HMR_DOM_STATE__?: {
|
|
69
|
+
count?: number;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
};
|
|
72
|
+
__HMR_FRAMEWORK__?: string;
|
|
73
|
+
__HMR_MANIFEST__?: Record<string, string>;
|
|
74
|
+
__HMR_MODULE_UPDATES__?: Array<unknown>;
|
|
75
|
+
__HMR_MODULE_VERSIONS__?: Record<string, number>;
|
|
76
|
+
__HMR_PRESERVED_STATE__?: Record<string, unknown>;
|
|
77
|
+
__HMR_SERVER_VERSIONS__?: Record<string, number>;
|
|
78
|
+
__HMR_UPDATE_COUNT__?: number;
|
|
79
|
+
__HMR_WS__?: WebSocket;
|
|
80
|
+
__ERROR_BOUNDARY__?: {
|
|
81
|
+
reset: () => void;
|
|
82
|
+
};
|
|
83
|
+
__INITIAL_PROPS__?: Record<string, unknown>;
|
|
84
|
+
__REACT_ROOT__?: {
|
|
85
|
+
render: (element: unknown) => void;
|
|
86
|
+
};
|
|
87
|
+
__SVELTE_COMPONENT__?: Record<string, unknown>;
|
|
88
|
+
__SVELTE_UNMOUNT__?: () => void;
|
|
89
|
+
__VUE_APP__?: ({
|
|
90
|
+
unmount: () => void;
|
|
91
|
+
_instance?: {
|
|
92
|
+
setupState?: Record<string, unknown>;
|
|
93
|
+
subTree?: {
|
|
94
|
+
children?: unknown[];
|
|
95
|
+
component?: {
|
|
96
|
+
setupState?: Record<string, unknown>;
|
|
97
|
+
subTree?: unknown;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
} & Record<string, unknown>) | null;
|
|
102
|
+
__VUE_HMR_COMPONENTS__?: Record<string, unknown>;
|
|
103
|
+
htmx?: {
|
|
104
|
+
process: (element: HTMLElement | Document) => void;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export type PingMessage = {
|
|
2
|
+
type: 'ping';
|
|
3
|
+
};
|
|
4
|
+
export type ReadyMessage = {
|
|
5
|
+
type: 'ready';
|
|
6
|
+
framework?: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type RequestRebuildMessage = {
|
|
9
|
+
type: 'request-rebuild';
|
|
10
|
+
};
|
|
11
|
+
export type HydrationErrorMessage = {
|
|
12
|
+
type: 'hydration-error';
|
|
13
|
+
data?: {
|
|
14
|
+
componentName?: string;
|
|
15
|
+
componentPath?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type HMRClientMessage = PingMessage | ReadyMessage | RequestRebuildMessage | HydrationErrorMessage;
|
|
20
|
+
export type ManifestMessage = {
|
|
21
|
+
type: 'manifest';
|
|
22
|
+
data: {
|
|
23
|
+
manifest: Record<string, string>;
|
|
24
|
+
serverVersions?: Record<string, number>;
|
|
25
|
+
};
|
|
26
|
+
timestamp: number;
|
|
27
|
+
};
|
|
28
|
+
export type RebuildStartMessage = {
|
|
29
|
+
type: 'rebuild-start';
|
|
30
|
+
data: {
|
|
31
|
+
affectedFrameworks: string[];
|
|
32
|
+
};
|
|
33
|
+
timestamp: number;
|
|
34
|
+
};
|
|
35
|
+
export type RebuildCompleteMessage = {
|
|
36
|
+
type: 'rebuild-complete';
|
|
37
|
+
data: {
|
|
38
|
+
affectedFrameworks: string[];
|
|
39
|
+
manifest: Record<string, string>;
|
|
40
|
+
};
|
|
41
|
+
timestamp: number;
|
|
42
|
+
};
|
|
43
|
+
export type FrameworkUpdateMessage = {
|
|
44
|
+
type: 'framework-update';
|
|
45
|
+
data: {
|
|
46
|
+
framework: string;
|
|
47
|
+
manifest?: Record<string, string>;
|
|
48
|
+
};
|
|
49
|
+
timestamp: number;
|
|
50
|
+
};
|
|
51
|
+
export type ModuleUpdateMessage = {
|
|
52
|
+
type: 'module-update';
|
|
53
|
+
data: {
|
|
54
|
+
framework: string;
|
|
55
|
+
manifest?: Record<string, string>;
|
|
56
|
+
modules?: Array<{
|
|
57
|
+
sourceFile: string;
|
|
58
|
+
moduleKeys: string[];
|
|
59
|
+
modulePaths: Record<string, string>;
|
|
60
|
+
componentType?: 'client' | 'server';
|
|
61
|
+
version?: number;
|
|
62
|
+
}>;
|
|
63
|
+
moduleVersions?: Record<string, number>;
|
|
64
|
+
serverVersions?: Record<string, number>;
|
|
65
|
+
};
|
|
66
|
+
timestamp: number;
|
|
67
|
+
};
|
|
68
|
+
export type ReactUpdateMessage = {
|
|
69
|
+
type: 'react-update';
|
|
70
|
+
data: {
|
|
71
|
+
sourceFile: string;
|
|
72
|
+
html?: string;
|
|
73
|
+
manifest?: Record<string, string>;
|
|
74
|
+
};
|
|
75
|
+
timestamp: number;
|
|
76
|
+
};
|
|
77
|
+
export type HTMLUpdateMessage = {
|
|
78
|
+
type: 'html-update';
|
|
79
|
+
data: {
|
|
80
|
+
sourceFile: string;
|
|
81
|
+
html?: string;
|
|
82
|
+
};
|
|
83
|
+
timestamp: number;
|
|
84
|
+
};
|
|
85
|
+
export type HTMXUpdateMessage = {
|
|
86
|
+
type: 'htmx-update';
|
|
87
|
+
data: {
|
|
88
|
+
sourceFile: string;
|
|
89
|
+
html?: string;
|
|
90
|
+
};
|
|
91
|
+
timestamp: number;
|
|
92
|
+
};
|
|
93
|
+
export type SvelteUpdateMessage = {
|
|
94
|
+
type: 'svelte-update';
|
|
95
|
+
data: {
|
|
96
|
+
sourceFile: string;
|
|
97
|
+
html?: string;
|
|
98
|
+
manifest?: Record<string, string>;
|
|
99
|
+
cssUrl?: string;
|
|
100
|
+
cssBaseName?: string;
|
|
101
|
+
updateType?: string;
|
|
102
|
+
};
|
|
103
|
+
timestamp: number;
|
|
104
|
+
};
|
|
105
|
+
export type VueUpdateMessage = {
|
|
106
|
+
type: 'vue-update';
|
|
107
|
+
data: {
|
|
108
|
+
sourceFile: string;
|
|
109
|
+
html?: string;
|
|
110
|
+
manifest?: Record<string, string>;
|
|
111
|
+
hmrId?: string;
|
|
112
|
+
changeType?: 'style-only' | 'template-only' | 'script' | 'full';
|
|
113
|
+
componentPath?: string;
|
|
114
|
+
cssUrl?: string;
|
|
115
|
+
cssBaseName?: string;
|
|
116
|
+
updateType?: 'css-only' | 'full';
|
|
117
|
+
};
|
|
118
|
+
timestamp: number;
|
|
119
|
+
};
|
|
120
|
+
export type RebuildErrorMessage = {
|
|
121
|
+
type: 'rebuild-error';
|
|
122
|
+
data: {
|
|
123
|
+
affectedFrameworks: string[];
|
|
124
|
+
error: string;
|
|
125
|
+
};
|
|
126
|
+
timestamp: number;
|
|
127
|
+
};
|
|
128
|
+
export type PongMessage = {
|
|
129
|
+
type: 'pong';
|
|
130
|
+
timestamp: number;
|
|
131
|
+
};
|
|
132
|
+
export type ConnectedMessage = {
|
|
133
|
+
type: 'connected';
|
|
134
|
+
message?: string;
|
|
135
|
+
timestamp: number;
|
|
136
|
+
};
|
|
137
|
+
export type HMRServerMessage = ManifestMessage | RebuildStartMessage | RebuildCompleteMessage | FrameworkUpdateMessage | ModuleUpdateMessage | ReactUpdateMessage | HTMLUpdateMessage | HTMXUpdateMessage | SvelteUpdateMessage | VueUpdateMessage | RebuildErrorMessage | PongMessage | ConnectedMessage;
|
|
138
|
+
export declare const isValidHMRClientMessage: (data: unknown) => data is HMRClientMessage;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// eslint.config.mjs
|
|
2
|
+
import { dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import pluginJs from '@eslint/js';
|
|
5
|
+
import stylisticTs from '@stylistic/eslint-plugin-ts';
|
|
6
|
+
import tsParser from '@typescript-eslint/parser';
|
|
7
|
+
import { defineConfig } from 'eslint/config';
|
|
8
|
+
import absolutePlugin from 'eslint-plugin-absolute';
|
|
9
|
+
import importPlugin from 'eslint-plugin-import';
|
|
10
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
11
|
+
import securityPlugin from 'eslint-plugin-security';
|
|
12
|
+
import globals from 'globals';
|
|
13
|
+
import tseslint from 'typescript-eslint';
|
|
14
|
+
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
|
|
17
|
+
export default defineConfig([
|
|
18
|
+
{
|
|
19
|
+
ignores: [
|
|
20
|
+
'dist/**',
|
|
21
|
+
'**/compiled/**',
|
|
22
|
+
'**/*/htmx.*.min.js',
|
|
23
|
+
'example/build/**',
|
|
24
|
+
'tailwind.config.ts',
|
|
25
|
+
'postcss.config.ts',
|
|
26
|
+
'example/react/indexes/*'
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
pluginJs.configs.recommended,
|
|
31
|
+
|
|
32
|
+
...tseslint.configs.recommended,
|
|
33
|
+
|
|
34
|
+
{
|
|
35
|
+
files: ['**/*.{ts,tsx}'],
|
|
36
|
+
languageOptions: {
|
|
37
|
+
globals: {
|
|
38
|
+
...globals.node,
|
|
39
|
+
// TODO: These should only be applied to the src/core/build.ts file.
|
|
40
|
+
BuildMessage: 'readonly',
|
|
41
|
+
ResolveMessage: 'readonly',
|
|
42
|
+
NodeJS: 'readonly',
|
|
43
|
+
Bun: 'readonly',
|
|
44
|
+
Buffer: 'readonly'
|
|
45
|
+
},
|
|
46
|
+
parser: tsParser,
|
|
47
|
+
parserOptions: {
|
|
48
|
+
createDefaultProgram: true,
|
|
49
|
+
project: './tsconfig.json',
|
|
50
|
+
tsconfigRootDir: __dirname
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
plugins: { '@stylistic/ts': stylisticTs },
|
|
54
|
+
rules: {
|
|
55
|
+
'@stylistic/ts/padding-line-between-statements': [
|
|
56
|
+
'error',
|
|
57
|
+
{ blankLine: 'always', next: 'return', prev: '*' }
|
|
58
|
+
],
|
|
59
|
+
|
|
60
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
files: ['**/*.{js,mjs,cjs,json,ts,tsx,jsx}'],
|
|
65
|
+
ignores: ['node_modules/**'],
|
|
66
|
+
languageOptions: {
|
|
67
|
+
globals: {
|
|
68
|
+
...globals.browser
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
plugins: {
|
|
72
|
+
absolute: absolutePlugin,
|
|
73
|
+
import: importPlugin,
|
|
74
|
+
promise: promisePlugin,
|
|
75
|
+
security: securityPlugin
|
|
76
|
+
},
|
|
77
|
+
rules: {
|
|
78
|
+
'absolute/explicit-object-types': 'error',
|
|
79
|
+
'absolute/localize-react-props': 'error',
|
|
80
|
+
'absolute/max-depth-extended': ['error', 1],
|
|
81
|
+
'absolute/max-jsxnesting': ['error', 5],
|
|
82
|
+
'absolute/min-var-length': [
|
|
83
|
+
'error',
|
|
84
|
+
{ allowedVars: ['_', 'id', 'db', 'OK'], minLength: 3 }
|
|
85
|
+
],
|
|
86
|
+
'absolute/no-explicit-return-type': 'error',
|
|
87
|
+
'absolute/no-useless-function': 'error',
|
|
88
|
+
'absolute/sort-exports': [
|
|
89
|
+
'error',
|
|
90
|
+
{
|
|
91
|
+
caseSensitive: true,
|
|
92
|
+
natural: true,
|
|
93
|
+
order: 'asc',
|
|
94
|
+
variablesBeforeFunctions: true
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
'absolute/sort-keys-fixable': [
|
|
98
|
+
'error',
|
|
99
|
+
{
|
|
100
|
+
caseSensitive: true,
|
|
101
|
+
natural: true,
|
|
102
|
+
order: 'asc',
|
|
103
|
+
variablesBeforeFunctions: true
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
107
|
+
'consistent-return': 'error',
|
|
108
|
+
eqeqeq: 'error',
|
|
109
|
+
'func-style': [
|
|
110
|
+
'error',
|
|
111
|
+
'expression',
|
|
112
|
+
{ allowArrowFunctions: true }
|
|
113
|
+
],
|
|
114
|
+
'import/no-cycle': 'error',
|
|
115
|
+
'import/no-default-export': 'error',
|
|
116
|
+
'import/no-relative-packages': 'error',
|
|
117
|
+
'import/no-unused-modules': ['error', { missingExports: true }],
|
|
118
|
+
'import/order': ['error', { alphabetize: { order: 'asc' } }],
|
|
119
|
+
'no-await-in-loop': 'error',
|
|
120
|
+
'no-debugger': 'error',
|
|
121
|
+
'no-duplicate-case': 'error',
|
|
122
|
+
'no-duplicate-imports': 'error',
|
|
123
|
+
'no-else-return': 'error',
|
|
124
|
+
'no-empty-function': 'error',
|
|
125
|
+
'no-empty-pattern': 'error',
|
|
126
|
+
'no-empty-static-block': 'error',
|
|
127
|
+
'no-fallthrough': 'error',
|
|
128
|
+
'no-floating-decimal': 'error',
|
|
129
|
+
'no-global-assign': 'error',
|
|
130
|
+
'no-implicit-coercion': 'error',
|
|
131
|
+
'no-implicit-globals': 'error',
|
|
132
|
+
'no-loop-func': 'error',
|
|
133
|
+
'no-magic-numbers': [
|
|
134
|
+
'warn',
|
|
135
|
+
{ detectObjects: false, enforceConst: true, ignore: [0, 1, 2] }
|
|
136
|
+
],
|
|
137
|
+
'no-misleading-character-class': 'error',
|
|
138
|
+
'no-nested-ternary': 'error',
|
|
139
|
+
'no-new-native-nonconstructor': 'error',
|
|
140
|
+
'no-new-wrappers': 'error',
|
|
141
|
+
'no-param-reassign': 'error',
|
|
142
|
+
'no-restricted-imports': [
|
|
143
|
+
'error',
|
|
144
|
+
{
|
|
145
|
+
paths: [
|
|
146
|
+
{
|
|
147
|
+
importNames: ['default'],
|
|
148
|
+
message:
|
|
149
|
+
'Import only named React exports for tree-shaking.',
|
|
150
|
+
name: 'react'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
importNames: ['default'],
|
|
154
|
+
message: 'Import only the required Bun exports.',
|
|
155
|
+
name: 'bun'
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
'no-return-await': 'error',
|
|
161
|
+
'no-shadow': 'error',
|
|
162
|
+
'no-undef': 'error',
|
|
163
|
+
'no-unneeded-ternary': 'error',
|
|
164
|
+
'no-unreachable': 'error',
|
|
165
|
+
'no-useless-assignment': 'error',
|
|
166
|
+
'no-useless-concat': 'error',
|
|
167
|
+
'no-useless-return': 'error',
|
|
168
|
+
'no-var': 'error',
|
|
169
|
+
'prefer-arrow-callback': 'error',
|
|
170
|
+
'prefer-const': 'error',
|
|
171
|
+
'prefer-destructuring': [
|
|
172
|
+
'error',
|
|
173
|
+
{ array: true, object: true },
|
|
174
|
+
{ enforceForRenamedProperties: false }
|
|
175
|
+
],
|
|
176
|
+
'prefer-template': 'error',
|
|
177
|
+
'promise/always-return': 'warn',
|
|
178
|
+
'promise/avoid-new': 'warn',
|
|
179
|
+
'promise/catch-or-return': 'error',
|
|
180
|
+
'promise/no-callback-in-promise': 'warn',
|
|
181
|
+
'promise/no-nesting': 'warn',
|
|
182
|
+
'promise/no-promise-in-callback': 'warn',
|
|
183
|
+
'promise/no-return-wrap': 'error',
|
|
184
|
+
'promise/param-names': 'error'
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
//TODO: Add official eslint support for Svelte.
|
|
189
|
+
files: ['**/*.svelte.ts'],
|
|
190
|
+
languageOptions: {
|
|
191
|
+
globals: {
|
|
192
|
+
$derived: 'readonly',
|
|
193
|
+
$effect: 'readonly',
|
|
194
|
+
$props: 'readonly',
|
|
195
|
+
$state: 'readonly'
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
files: ['eslint.config.mjs', 'src/constants.ts'],
|
|
201
|
+
rules: {
|
|
202
|
+
'no-magic-numbers': 'off'
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
files: ['eslint.config.mjs'],
|
|
207
|
+
rules: {
|
|
208
|
+
'import/no-default-export': 'off'
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
files: [
|
|
213
|
+
'src/utils/index.ts',
|
|
214
|
+
'src/plugins/index.ts',
|
|
215
|
+
'src/core/index.ts',
|
|
216
|
+
'src/index.ts',
|
|
217
|
+
'example/html/scripts/*',
|
|
218
|
+
'tsconfig.json',
|
|
219
|
+
'tsconfig.build.json',
|
|
220
|
+
'package.json',
|
|
221
|
+
'.prettierrc.json'
|
|
222
|
+
],
|
|
223
|
+
rules: {
|
|
224
|
+
'import/no-unused-modules': 'off'
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
files: [
|
|
229
|
+
'tsconfig.json',
|
|
230
|
+
'tsconfig.build.json',
|
|
231
|
+
'package.json',
|
|
232
|
+
'.prettierrc.json'
|
|
233
|
+
],
|
|
234
|
+
rules: {
|
|
235
|
+
'@typescript-eslint/no-unused-expressions': 'off'
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
]);
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Eugene Graves III",
|
|
3
|
+
"bin": {
|
|
4
|
+
"absolutejs": "dist/cli/index.js"
|
|
5
|
+
},
|
|
6
|
+
"description": "Testing Ajs",
|
|
7
|
+
"engines": {
|
|
8
|
+
"bun": ">=1.3.6"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@elysiajs/static": "1.4.0",
|
|
12
|
+
"@stylistic/eslint-plugin-ts": "4.2.0",
|
|
13
|
+
"@tailwindcss/cli": "4.1.7",
|
|
14
|
+
"@types/bun": "1.3.9",
|
|
15
|
+
"@types/react": "19.2.0",
|
|
16
|
+
"@types/react-dom": "19.2.0",
|
|
17
|
+
"autoprefixer": "10.4.21",
|
|
18
|
+
"elysia": "1.4.18",
|
|
19
|
+
"elysia-scoped-state": "0.1.1",
|
|
20
|
+
"eslint": "9.26.0",
|
|
21
|
+
"eslint-plugin-absolute": "0.1.4",
|
|
22
|
+
"eslint-plugin-import": "2.31.0",
|
|
23
|
+
"eslint-plugin-promise": "7.2.1",
|
|
24
|
+
"eslint-plugin-security": "3.0.1",
|
|
25
|
+
"postcss": "8.5.3",
|
|
26
|
+
"prettier": "3.5.3",
|
|
27
|
+
"prettier-plugin-svelte": "3.4.0",
|
|
28
|
+
"react": "19.2.1",
|
|
29
|
+
"react-dom": "19.2.1",
|
|
30
|
+
"svelte": "5.35.2",
|
|
31
|
+
"tailwindcss": "4.1.7",
|
|
32
|
+
"typescript": "5.8.3",
|
|
33
|
+
"typescript-eslint": "8.32.0",
|
|
34
|
+
"vue": "3.5.27"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"react-refresh": "^0.18.0"
|
|
38
|
+
},
|
|
39
|
+
"license": "BSL-1.1",
|
|
40
|
+
"main": "./dist/index.js",
|
|
41
|
+
"name": "@abs-test/absolutejs-test",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"elysia": "^1.4.0",
|
|
44
|
+
"react": "^19.2.0",
|
|
45
|
+
"react-dom": "^19.2.0",
|
|
46
|
+
"svelte": "^5.35.2",
|
|
47
|
+
"vue": "^3.5.27"
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/absolutejs/absolutejs.git"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "rm -rf dist && bun build src/index.ts --outdir dist --sourcemap --target=bun --external react --external react-dom --external vue --external @vue/compiler-sfc --external svelte --external elysia && bun build src/cli/index.ts --outfile dist/cli/index.js --target=bun && tsc --emitDeclarationOnly --project tsconfig.build.json && mkdir -p dist/dev && cp -r src/dev/client dist/dev/client",
|
|
55
|
+
"db:push": "drizzle-kit push",
|
|
56
|
+
"db:studio": "drizzle-kit studio",
|
|
57
|
+
"dev": "bun run src/cli/index.ts dev example/server.ts",
|
|
58
|
+
"start": "NODE_ENV=production bun run example/server.ts",
|
|
59
|
+
"format": "prettier --write \"./**/*.{js,jsx,ts,tsx,css,json,mjs,md,svelte,html,vue}\"",
|
|
60
|
+
"lint": "eslint ./",
|
|
61
|
+
"release": "bun run format && bun run build && bun publish",
|
|
62
|
+
"test": "bun test",
|
|
63
|
+
"typecheck": "bun run tsc --noEmit"
|
|
64
|
+
},
|
|
65
|
+
"types": "./dist/src/index.d.ts",
|
|
66
|
+
"version": "0.1.0"
|
|
67
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noUncheckedIndexedAccess": true,
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"strict": true,
|
|
16
|
+
"target": "ESNext"
|
|
17
|
+
},
|
|
18
|
+
"exclude": ["node_modules", "src/dev/client"],
|
|
19
|
+
"include": ["src/**/*"]
|
|
20
|
+
}
|