@absolutejs/absolute 0.19.0-beta.1031 → 0.19.0-beta.1032
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/dist/angular/browser.js +18 -16
- package/dist/angular/browser.js.map +5 -5
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +83 -118
- package/dist/angular/index.js +49 -49
- package/dist/angular/index.js.map +12 -12
- package/dist/angular/server.js +34 -34
- package/dist/angular/server.js.map +10 -10
- package/dist/build.js +135 -135
- package/dist/build.js.map +26 -26
- package/dist/cli/config/client.js +1 -1
- package/dist/cli/config/server.js +43 -43
- package/dist/cli/index.js +23 -13
- package/dist/client/index.js +9 -9
- package/dist/client/index.js.map +8 -8
- package/dist/dev/client/errorOverlay.ts +4 -4
- package/dist/dev/client/handlers/angularHmrShim.ts +17 -17
- package/dist/dev/client/handlers/angularRemount.ts +6 -4
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -1
- package/dist/dev/client/hmrToast.ts +18 -18
- package/dist/index.js +149 -150
- package/dist/index.js.map +31 -31
- package/dist/islands/browser.js.map +1 -1
- package/dist/islands/index.js +5 -5
- package/dist/islands/index.js.map +6 -6
- package/dist/react/browser.js.map +1 -1
- package/dist/react/components/index.js +2 -2
- package/dist/react/components/index.js.map +3 -3
- package/dist/react/hooks/index.js.map +1 -1
- package/dist/react/index.js +21 -21
- package/dist/react/index.js.map +9 -9
- package/dist/react/server.js +17 -17
- package/dist/react/server.js.map +5 -5
- package/dist/src/angular/hmrPreserveCore.d.ts +5 -18
- package/dist/src/angular/islands.d.ts +1 -1
- package/dist/src/cli/config/packageJson/editPackageJson.d.ts +2 -2
- package/dist/src/cli/config/schema/fromJsonSchema.d.ts +1 -1
- package/dist/src/client/hydrators/react.d.ts +1 -1
- package/dist/src/client/hydrators/svelte.d.ts +1 -1
- package/dist/src/client/hydrators/vue.d.ts +1 -1
- package/dist/src/client/islandStore.d.ts +3 -3
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -5
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +2 -2
- package/dist/src/dev/angular/hmrCompiler.d.ts +1 -1
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +1 -1
- package/dist/src/svelte/router/hashMode.d.ts +1 -6
- package/dist/src/svelte/router/matchPath.d.ts +2 -22
- package/dist/src/svelte/router/page.svelte.d.ts +1 -10
- package/dist/src/svelte/router/prefetchCache.d.ts +2 -6
- package/dist/src/utils/generatedDir.d.ts +1 -1
- package/dist/src/utils/inlinePageCss.d.ts +1 -3
- package/dist/src/utils/jsonLd.d.ts +1 -1
- package/dist/src/utils/loadConfig.d.ts +2 -3
- package/dist/src/utils/resolveConvention.d.ts +1 -1
- package/dist/src/utils/runtimeMode.d.ts +1 -1
- package/dist/src/vue/defineVuePage.d.ts +1 -11
- package/dist/svelte/browser.js.map +1 -1
- package/dist/svelte/index.js +26 -26
- package/dist/svelte/index.js.map +9 -9
- package/dist/svelte/router/hashMode.ts +6 -12
- package/dist/svelte/router/matchPath.ts +23 -45
- package/dist/svelte/router/page.d.ts +1 -10
- package/dist/svelte/router/page.js +6 -6
- package/dist/svelte/router/prefetchCache.ts +12 -20
- package/dist/svelte/server.js +22 -22
- package/dist/svelte/server.js.map +5 -5
- package/dist/vue/browser.js +2 -2
- package/dist/vue/browser.js.map +4 -4
- package/dist/vue/index.js +29 -29
- package/dist/vue/index.js.map +11 -11
- package/dist/vue/server.js +24 -24
- package/dist/vue/server.js.map +6 -6
- package/package.json +38 -38
|
@@ -13,8 +13,13 @@
|
|
|
13
13
|
* Returns the part after `#/`, prefixed with `/` so it parses as a
|
|
14
14
|
* normal pathname.
|
|
15
15
|
*/
|
|
16
|
+
export const buildHashHref = (pathname: string) => {
|
|
17
|
+
const trimmed = pathname.replace(/^\/+/, '');
|
|
18
|
+
|
|
19
|
+
return trimmed === '' ? '#/' : `#/${trimmed}`;
|
|
20
|
+
};
|
|
16
21
|
export const hashPathnameOf = (url: URL) => {
|
|
17
|
-
const hash = url
|
|
22
|
+
const {hash} = url;
|
|
18
23
|
if (!hash || hash === '#') return '/';
|
|
19
24
|
|
|
20
25
|
// Tolerate both `#/foo` and `#foo`.
|
|
@@ -24,14 +29,3 @@ export const hashPathnameOf = (url: URL) => {
|
|
|
24
29
|
|
|
25
30
|
return `/${trimmed.replace(/^\/+/, '')}`;
|
|
26
31
|
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Build a hash URL from a routable pathname. Used by goto() / pushState()
|
|
30
|
-
* when in hash mode — converts `/dashboard/settings` to `#/dashboard/settings`
|
|
31
|
-
* and writes the result back to the URL.
|
|
32
|
-
*/
|
|
33
|
-
export const buildHashHref = (pathname: string) => {
|
|
34
|
-
const trimmed = pathname.replace(/^\/+/, '');
|
|
35
|
-
|
|
36
|
-
return trimmed === '' ? '#/' : `#/${trimmed}`;
|
|
37
|
-
};
|
|
@@ -45,6 +45,14 @@ const compileSegment = (raw: string): CompiledSegment => {
|
|
|
45
45
|
* Compile a `<Route path>` pattern into segments + a specificity score.
|
|
46
46
|
* Higher score = more specific (longer static prefix beats parameterised).
|
|
47
47
|
*/
|
|
48
|
+
export const comparePatterns = (
|
|
49
|
+
a: { score: number; index: number },
|
|
50
|
+
b: { score: number; index: number }
|
|
51
|
+
) => {
|
|
52
|
+
if (a.score !== b.score) return b.score - a.score;
|
|
53
|
+
|
|
54
|
+
return a.index - b.index;
|
|
55
|
+
};
|
|
48
56
|
export const compilePattern = (pattern: string): CompiledPattern => {
|
|
49
57
|
const segments = splitPath(pattern).map(compileSegment);
|
|
50
58
|
|
|
@@ -58,13 +66,22 @@ export const compilePattern = (pattern: string): CompiledPattern => {
|
|
|
58
66
|
score += WILDCARD_SEGMENT_WEIGHT;
|
|
59
67
|
}
|
|
60
68
|
|
|
61
|
-
return {
|
|
69
|
+
return { score, segments };
|
|
62
70
|
};
|
|
71
|
+
export const joinBasepath = (basepath: string, pattern: string) => {
|
|
72
|
+
const trimmedBase = basepath.replace(/\/+$/, '');
|
|
73
|
+
const trimmedPattern = pattern.replace(/^\/+/, '');
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
if (trimmedPattern === '') {
|
|
76
|
+
return trimmedBase === '' ? '/' : trimmedBase;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (trimmedBase === '') {
|
|
80
|
+
return `/${trimmedPattern}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return `${trimmedBase}/${trimmedPattern}`;
|
|
84
|
+
};
|
|
68
85
|
export const matchPattern = <Path extends string>(
|
|
69
86
|
pattern: CompiledPattern,
|
|
70
87
|
pathname: string
|
|
@@ -79,6 +96,7 @@ export const matchPattern = <Path extends string>(
|
|
|
79
96
|
|
|
80
97
|
if (segment.kind === 'wildcard') {
|
|
81
98
|
params['wildcard'] = pathSegments.slice(pi).join('/');
|
|
99
|
+
|
|
82
100
|
return {
|
|
83
101
|
matched: true,
|
|
84
102
|
params: params as ExtractRouteParams<Path>
|
|
@@ -116,43 +134,3 @@ export const matchPattern = <Path extends string>(
|
|
|
116
134
|
params: params as ExtractRouteParams<Path>
|
|
117
135
|
};
|
|
118
136
|
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Stable comparator for compiled patterns. Higher specificity sorts first.
|
|
122
|
-
* When two patterns have equal score, declaration order (the original index)
|
|
123
|
-
* decides — passed in via the `index` field on each entry.
|
|
124
|
-
*/
|
|
125
|
-
export const comparePatterns = (
|
|
126
|
-
a: { score: number; index: number },
|
|
127
|
-
b: { score: number; index: number }
|
|
128
|
-
) => {
|
|
129
|
-
if (a.score !== b.score) return b.score - a.score;
|
|
130
|
-
|
|
131
|
-
return a.index - b.index;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Join a basepath stack with a child pattern, producing an absolute pattern
|
|
136
|
-
* that the route matcher can compile against an incoming pathname.
|
|
137
|
-
*
|
|
138
|
-
* Handles slash edge cases:
|
|
139
|
-
* joinBasepath('', '/users') → '/users'
|
|
140
|
-
* joinBasepath('/portal', '/users') → '/portal/users'
|
|
141
|
-
* joinBasepath('/portal/', '/users') → '/portal/users'
|
|
142
|
-
* joinBasepath('/portal', 'users') → '/portal/users'
|
|
143
|
-
* joinBasepath('/portal', '/') → '/portal'
|
|
144
|
-
*/
|
|
145
|
-
export const joinBasepath = (basepath: string, pattern: string) => {
|
|
146
|
-
const trimmedBase = basepath.replace(/\/+$/, '');
|
|
147
|
-
const trimmedPattern = pattern.replace(/^\/+/, '');
|
|
148
|
-
|
|
149
|
-
if (trimmedPattern === '') {
|
|
150
|
-
return trimmedBase === '' ? '/' : trimmedBase;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (trimmedBase === '') {
|
|
154
|
-
return `/${trimmedPattern}`;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return `${trimmedBase}/${trimmedPattern}`;
|
|
158
|
-
};
|
|
@@ -11,14 +11,5 @@ import type { PageState } from '../../types/svelteRouter';
|
|
|
11
11
|
* Backed by `$state`. Direct property access in templates re-renders.
|
|
12
12
|
*/
|
|
13
13
|
export declare const page: PageState;
|
|
14
|
-
/**
|
|
15
|
-
* Internal — only Router.svelte and the navigation primitives call this.
|
|
16
|
-
* Replaces the entire page state in one assignment so subscribers fire
|
|
17
|
-
* once per navigation rather than once per mutated field.
|
|
18
|
-
*/
|
|
19
|
-
export declare const setPage: (next: Partial<PageState>) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Internal — used during SSR to seed the page state before render so
|
|
22
|
-
* `<Route>` blocks see the correct `page.url`.
|
|
23
|
-
*/
|
|
24
14
|
export declare const seedPage: (url: URL, params?: Record<string, string | undefined>) => void;
|
|
15
|
+
export declare const setPage: (next: Partial<PageState>) => void;
|
|
@@ -14,14 +14,14 @@ const inner = $.proxy(initialState());
|
|
|
14
14
|
|
|
15
15
|
export const page = inner;
|
|
16
16
|
|
|
17
|
-
export const setPage = (next) => {
|
|
18
|
-
if (next.url !== undefined) inner.url = next.url;
|
|
19
|
-
if (next.params !== undefined) inner.params = next.params;
|
|
20
|
-
if (next.state !== undefined) inner.state = next.state;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
17
|
export const seedPage = (url, params = {}) => {
|
|
24
18
|
inner.url = url;
|
|
25
19
|
inner.params = params;
|
|
26
20
|
inner.state = undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const setPage = (next) => {
|
|
24
|
+
if (next.url !== undefined) inner.url = next.url;
|
|
25
|
+
if (next.params !== undefined) inner.params = next.params;
|
|
26
|
+
if (next.state !== undefined) inner.state = next.state;
|
|
27
27
|
};
|
|
@@ -11,11 +11,9 @@ const cache = new Map<string, CacheEntry>();
|
|
|
11
11
|
const isSlowConnection = () => {
|
|
12
12
|
if (typeof navigator === 'undefined') return false;
|
|
13
13
|
|
|
14
|
-
const connection = (
|
|
15
|
-
navigator as Navigator & {
|
|
14
|
+
const {connection} = (navigator as Navigator & {
|
|
16
15
|
connection?: { saveData?: boolean };
|
|
17
|
-
}
|
|
18
|
-
).connection;
|
|
16
|
+
});
|
|
19
17
|
|
|
20
18
|
return connection?.saveData === true;
|
|
21
19
|
};
|
|
@@ -36,6 +34,16 @@ const evictOldest = () => {
|
|
|
36
34
|
* Prefetch a URL into the in-memory cache. No-op if the user has signalled
|
|
37
35
|
* data-saver / reduced-data, or if the URL is already cached.
|
|
38
36
|
*/
|
|
37
|
+
export const clearPrefetchCache = () => {
|
|
38
|
+
cache.clear();
|
|
39
|
+
};
|
|
40
|
+
export const consumePrefetch = (url: string) => {
|
|
41
|
+
const entry = cache.get(url);
|
|
42
|
+
if (!entry) return undefined;
|
|
43
|
+
cache.delete(url);
|
|
44
|
+
|
|
45
|
+
return entry.promise;
|
|
46
|
+
};
|
|
39
47
|
export const prefetch = (url: string) => {
|
|
40
48
|
if (typeof fetch === 'undefined') return;
|
|
41
49
|
if (isSlowConnection() || prefersReducedData()) return;
|
|
@@ -49,22 +57,6 @@ export const prefetch = (url: string) => {
|
|
|
49
57
|
cache.set(url, { promise, url });
|
|
50
58
|
};
|
|
51
59
|
|
|
52
|
-
/**
|
|
53
|
-
* Consume a cached prefetch entry on actual navigation, removing it from
|
|
54
|
-
* the cache. Returns the cached Promise<Response> or undefined.
|
|
55
|
-
*/
|
|
56
|
-
export const consumePrefetch = (url: string) => {
|
|
57
|
-
const entry = cache.get(url);
|
|
58
|
-
if (!entry) return undefined;
|
|
59
|
-
cache.delete(url);
|
|
60
|
-
|
|
61
|
-
return entry.promise;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const clearPrefetchCache = () => {
|
|
65
|
-
cache.clear();
|
|
66
|
-
};
|
|
67
|
-
|
|
68
60
|
type HoverHandle = {
|
|
69
61
|
cancel: () => void;
|
|
70
62
|
};
|
package/dist/svelte/server.js
CHANGED
|
@@ -1075,6 +1075,12 @@ import { Elysia } from "elysia";
|
|
|
1075
1075
|
var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES, PAGE_HANDLER_NAMES, pageHandlerWrappers, handlerSourceMentionsPageHelper = (handler) => {
|
|
1076
1076
|
const source = handler.toString();
|
|
1077
1077
|
return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
|
|
1078
|
+
}, getOriginalPageHandlerSource = (handler) => {
|
|
1079
|
+
if (typeof handler !== "function")
|
|
1080
|
+
return;
|
|
1081
|
+
const fn = handler;
|
|
1082
|
+
const info = pageHandlerWrappers.get(fn);
|
|
1083
|
+
return (info?.originalHandler ?? fn).toString();
|
|
1078
1084
|
}, isPageHandler = (handler) => {
|
|
1079
1085
|
if (typeof handler !== "function")
|
|
1080
1086
|
return false;
|
|
@@ -1082,12 +1088,6 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
|
1082
1088
|
if (pageHandlerWrappers.has(fn))
|
|
1083
1089
|
return true;
|
|
1084
1090
|
return handlerSourceMentionsPageHelper(fn);
|
|
1085
|
-
}, getOriginalPageHandlerSource = (handler) => {
|
|
1086
|
-
if (typeof handler !== "function")
|
|
1087
|
-
return;
|
|
1088
|
-
const fn = handler;
|
|
1089
|
-
const info = pageHandlerWrappers.get(fn);
|
|
1090
|
-
return (info?.originalHandler ?? fn).toString();
|
|
1091
1091
|
}, isObjectRecord3 = (value) => Boolean(value) && typeof value === "object", isAsyncLocalStorage2 = (value) => isObjectRecord3(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", isRouteMethod = (value) => typeof value === "function", getRouteCallsiteStorage = () => {
|
|
1092
1092
|
const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
|
|
1093
1093
|
if (value === null || typeof value === "undefined") {
|
|
@@ -2554,6 +2554,12 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
|
|
|
2554
2554
|
|
|
2555
2555
|
// src/utils/inlinePageCss.ts
|
|
2556
2556
|
var siblingCssCache = new Map;
|
|
2557
|
+
var injectInlineCss = (headTag, css) => {
|
|
2558
|
+
if (!css)
|
|
2559
|
+
return headTag;
|
|
2560
|
+
const styleBlock = `<style data-absolute-page-css>${css}</style>`;
|
|
2561
|
+
return headTag.replace("</head>", `${styleBlock}</head>`);
|
|
2562
|
+
};
|
|
2557
2563
|
var readSiblingCss = async (siblingJsPath) => {
|
|
2558
2564
|
if (!siblingJsPath)
|
|
2559
2565
|
return "";
|
|
@@ -2573,12 +2579,6 @@ var readSiblingCss = async (siblingJsPath) => {
|
|
|
2573
2579
|
return "";
|
|
2574
2580
|
}
|
|
2575
2581
|
};
|
|
2576
|
-
var injectInlineCss = (headTag, css) => {
|
|
2577
|
-
if (!css)
|
|
2578
|
-
return headTag;
|
|
2579
|
-
const styleBlock = `<style data-absolute-page-css>${css}</style>`;
|
|
2580
|
-
return headTag.replace("</head>", `${styleBlock}</head>`);
|
|
2581
|
-
};
|
|
2582
2582
|
// src/utils/resolveConvention.ts
|
|
2583
2583
|
import { basename as basename2 } from "path";
|
|
2584
2584
|
var CONVENTIONS_KEY = "__absoluteConventions";
|
|
@@ -2597,6 +2597,14 @@ var derivePageName = (pagePath) => {
|
|
|
2597
2597
|
return toPascal(name);
|
|
2598
2598
|
};
|
|
2599
2599
|
var normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, "");
|
|
2600
|
+
var hasErrorConvention = (framework) => {
|
|
2601
|
+
const conventions = getMap()[framework];
|
|
2602
|
+
if (!conventions)
|
|
2603
|
+
return false;
|
|
2604
|
+
if (conventions.defaults?.error)
|
|
2605
|
+
return true;
|
|
2606
|
+
return Object.values(conventions.pages ?? {}).some((page) => Boolean(page.error));
|
|
2607
|
+
};
|
|
2600
2608
|
var resolveErrorConventionPath = (framework, pageName) => {
|
|
2601
2609
|
const conventions = getMap()[framework];
|
|
2602
2610
|
if (!conventions)
|
|
@@ -2613,14 +2621,6 @@ var resolveErrorConventionPath = (framework, pageName) => {
|
|
|
2613
2621
|
return conventions.defaults?.error;
|
|
2614
2622
|
};
|
|
2615
2623
|
var resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound;
|
|
2616
|
-
var hasErrorConvention = (framework) => {
|
|
2617
|
-
const conventions = getMap()[framework];
|
|
2618
|
-
if (!conventions)
|
|
2619
|
-
return false;
|
|
2620
|
-
if (conventions.defaults?.error)
|
|
2621
|
-
return true;
|
|
2622
|
-
return Object.values(conventions.pages ?? {}).some((page) => Boolean(page.error));
|
|
2623
|
-
};
|
|
2624
2624
|
var setConventions = (map) => {
|
|
2625
2625
|
Reflect.set(globalThis, CONVENTIONS_KEY, map);
|
|
2626
2626
|
};
|
|
@@ -2633,7 +2633,7 @@ var buildErrorProps = (error) => {
|
|
|
2633
2633
|
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
2634
2634
|
};
|
|
2635
2635
|
}
|
|
2636
|
-
return {
|
|
2636
|
+
return { message: String(error), name: "Error" };
|
|
2637
2637
|
};
|
|
2638
2638
|
var renderReactError = async (conventionPath, errorProps) => {
|
|
2639
2639
|
const { createElement } = await import("react");
|
|
@@ -2992,5 +2992,5 @@ export {
|
|
|
2992
2992
|
handleSveltePageRequest
|
|
2993
2993
|
};
|
|
2994
2994
|
|
|
2995
|
-
//# debugId=
|
|
2995
|
+
//# debugId=60043A1DAC6A8BBA64756E2164756E21
|
|
2996
2996
|
//# sourceMappingURL=server.js.map
|