@hybridly/core 0.8.3 → 0.9.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/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -12
- package/dist/index.d.mts +3 -12
- package/dist/index.d.ts +3 -12
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -405,7 +405,7 @@ function urlMatchesRoute(fullUrl, name, routeParameters) {
|
|
|
405
405
|
}
|
|
406
406
|
function generateRouteFromName(name, parameters, absolute, shouldThrow) {
|
|
407
407
|
const url = getUrlFromName(name, parameters);
|
|
408
|
-
return absolute === false ? url.toString().replace(url.origin, "") : url.toString();
|
|
408
|
+
return absolute === false ? url.toString().replace(url.origin, "") || "/" : url.toString();
|
|
409
409
|
}
|
|
410
410
|
function getNameFromUrl(url, parameters) {
|
|
411
411
|
const routing = getRouting();
|
|
@@ -499,7 +499,7 @@ function getRouting() {
|
|
|
499
499
|
return routing;
|
|
500
500
|
}
|
|
501
501
|
function route(name, parameters, absolute) {
|
|
502
|
-
return generateRouteFromName(name, parameters, absolute);
|
|
502
|
+
return generateRouteFromName(name, parameters, absolute ?? getRouting().absolute ?? true);
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
function getCurrentUrl() {
|
package/dist/index.d.cts
CHANGED
|
@@ -51,18 +51,8 @@ interface RequestHooks {
|
|
|
51
51
|
}
|
|
52
52
|
interface Hooks extends RequestHooks {
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
///////////////////////
|
|
57
|
-
///////////////////////
|
|
58
|
-
///////////////////////
|
|
59
|
-
///////////////////////
|
|
60
|
-
///////////////////////
|
|
61
|
-
///////////////////////
|
|
62
|
-
///////////////////////
|
|
63
|
-
///////////////////////
|
|
64
|
-
///////////////////////
|
|
65
|
-
*/
|
|
54
|
+
* Called when Hybridly's context is initialized.
|
|
55
|
+
*/
|
|
66
56
|
initialized: (context: InternalRouterContext) => MaybePromise<any>;
|
|
67
57
|
/**
|
|
68
58
|
* Called after Hybridly's initial load.
|
|
@@ -113,6 +103,7 @@ interface RoutingConfiguration {
|
|
|
113
103
|
port?: number;
|
|
114
104
|
defaults: Record<string, any>;
|
|
115
105
|
routes: Record<string, RouteDefinition>;
|
|
106
|
+
absolute: boolean;
|
|
116
107
|
}
|
|
117
108
|
interface RouteDefinition {
|
|
118
109
|
uri: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -51,18 +51,8 @@ interface RequestHooks {
|
|
|
51
51
|
}
|
|
52
52
|
interface Hooks extends RequestHooks {
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
///////////////////////
|
|
57
|
-
///////////////////////
|
|
58
|
-
///////////////////////
|
|
59
|
-
///////////////////////
|
|
60
|
-
///////////////////////
|
|
61
|
-
///////////////////////
|
|
62
|
-
///////////////////////
|
|
63
|
-
///////////////////////
|
|
64
|
-
///////////////////////
|
|
65
|
-
*/
|
|
54
|
+
* Called when Hybridly's context is initialized.
|
|
55
|
+
*/
|
|
66
56
|
initialized: (context: InternalRouterContext) => MaybePromise<any>;
|
|
67
57
|
/**
|
|
68
58
|
* Called after Hybridly's initial load.
|
|
@@ -113,6 +103,7 @@ interface RoutingConfiguration {
|
|
|
113
103
|
port?: number;
|
|
114
104
|
defaults: Record<string, any>;
|
|
115
105
|
routes: Record<string, RouteDefinition>;
|
|
106
|
+
absolute: boolean;
|
|
116
107
|
}
|
|
117
108
|
interface RouteDefinition {
|
|
118
109
|
uri: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -51,18 +51,8 @@ interface RequestHooks {
|
|
|
51
51
|
}
|
|
52
52
|
interface Hooks extends RequestHooks {
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
///////////////////////
|
|
57
|
-
///////////////////////
|
|
58
|
-
///////////////////////
|
|
59
|
-
///////////////////////
|
|
60
|
-
///////////////////////
|
|
61
|
-
///////////////////////
|
|
62
|
-
///////////////////////
|
|
63
|
-
///////////////////////
|
|
64
|
-
///////////////////////
|
|
65
|
-
*/
|
|
54
|
+
* Called when Hybridly's context is initialized.
|
|
55
|
+
*/
|
|
66
56
|
initialized: (context: InternalRouterContext) => MaybePromise<any>;
|
|
67
57
|
/**
|
|
68
58
|
* Called after Hybridly's initial load.
|
|
@@ -113,6 +103,7 @@ interface RoutingConfiguration {
|
|
|
113
103
|
port?: number;
|
|
114
104
|
defaults: Record<string, any>;
|
|
115
105
|
routes: Record<string, RouteDefinition>;
|
|
106
|
+
absolute: boolean;
|
|
116
107
|
}
|
|
117
108
|
interface RouteDefinition {
|
|
118
109
|
uri: string;
|
package/dist/index.mjs
CHANGED
|
@@ -398,7 +398,7 @@ function urlMatchesRoute(fullUrl, name, routeParameters) {
|
|
|
398
398
|
}
|
|
399
399
|
function generateRouteFromName(name, parameters, absolute, shouldThrow) {
|
|
400
400
|
const url = getUrlFromName(name, parameters);
|
|
401
|
-
return absolute === false ? url.toString().replace(url.origin, "") : url.toString();
|
|
401
|
+
return absolute === false ? url.toString().replace(url.origin, "") || "/" : url.toString();
|
|
402
402
|
}
|
|
403
403
|
function getNameFromUrl(url, parameters) {
|
|
404
404
|
const routing = getRouting();
|
|
@@ -492,7 +492,7 @@ function getRouting() {
|
|
|
492
492
|
return routing;
|
|
493
493
|
}
|
|
494
494
|
function route(name, parameters, absolute) {
|
|
495
|
-
return generateRouteFromName(name, parameters, absolute);
|
|
495
|
+
return generateRouteFromName(name, parameters, absolute ?? getRouting().absolute ?? true);
|
|
496
496
|
}
|
|
497
497
|
|
|
498
498
|
function getCurrentUrl() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"description": "Core functionality of Hybridly",
|
|
6
6
|
"author": "Enzo Innocenzi <enzo@innocenzi.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"qs": "^6.14.0",
|
|
45
45
|
"superjson": "^2.2.2",
|
|
46
|
-
"@hybridly/utils": "0.
|
|
46
|
+
"@hybridly/utils": "0.9.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"defu": "^6.1.4"
|