vike 0.4.242-commit-4a9fae0 → 0.4.243
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/esm/client/runtime-client-routing/initOnLinkClick.js +3 -1
- package/dist/esm/client/runtime-client-routing/skipLink.d.ts +2 -0
- package/dist/esm/client/runtime-client-routing/skipLink.js +10 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +9 -4
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { initOnLinkClick };
|
|
2
|
-
import { isSameAsCurrentUrl, skipLink } from './skipLink.js';
|
|
2
|
+
import { isLinkIgnored, isSameAsCurrentUrl, skipLink } from './skipLink.js';
|
|
3
3
|
import { renderPageClientSide } from './renderPageClientSide.js';
|
|
4
4
|
import { scrollToHashOrTop } from './setScrollPosition.js';
|
|
5
5
|
function initOnLinkClick() {
|
|
@@ -14,6 +14,8 @@ async function onLinkClick(ev) {
|
|
|
14
14
|
const href = linkTag.getAttribute('href');
|
|
15
15
|
if (href === null)
|
|
16
16
|
return;
|
|
17
|
+
if (isLinkIgnored(linkTag))
|
|
18
|
+
return;
|
|
17
19
|
// Workaround for Firefox bug: clicking on a hash link that doesn't change the current URL causes Firefox to erroneously set `window.history.state = null` without firing any signal that we can detect.
|
|
18
20
|
// - https://github.com/vikejs/vike/issues/1962
|
|
19
21
|
// - https://github.com/sveltejs/kit/issues/8725
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
// TODO: rename_full skipLink isLinkSkipped
|
|
1
2
|
export { skipLink };
|
|
3
|
+
export { isLinkIgnored };
|
|
2
4
|
export { isSameAsCurrentUrl };
|
|
3
5
|
import { normalizeClientSideUrl } from '../shared/normalizeClientSideUrl.js';
|
|
4
6
|
import { getBaseServer } from './getBaseServer.js';
|
|
@@ -11,6 +13,7 @@ function skipLink(linkTag) {
|
|
|
11
13
|
isUrlExternal(href) ||
|
|
12
14
|
isSamePageHashLink(href) ||
|
|
13
15
|
isNewTabLink(linkTag) ||
|
|
16
|
+
isLinkIgnored(linkTag) ||
|
|
14
17
|
!hasBaseServer(href) ||
|
|
15
18
|
// Purposely last because disableAutomaticLinkInterception will be removed in the next major release
|
|
16
19
|
!isVikeLink(linkTag));
|
|
@@ -22,18 +25,25 @@ function isVikeLink(linkTag) {
|
|
|
22
25
|
return true;
|
|
23
26
|
}
|
|
24
27
|
else {
|
|
28
|
+
// TODO: rename target attrVal
|
|
25
29
|
const target = linkTag.getAttribute('data-vike-link');
|
|
26
30
|
return target !== null && target !== 'false';
|
|
27
31
|
}
|
|
28
32
|
}
|
|
33
|
+
// TODO rename
|
|
29
34
|
function isNewTabLink(linkTag) {
|
|
30
35
|
const target = linkTag.getAttribute('target');
|
|
31
36
|
const rel = linkTag.getAttribute('rel');
|
|
32
37
|
return target === '_blank' || target === '_external' || rel === 'external' || linkTag.hasAttribute('download');
|
|
33
38
|
}
|
|
39
|
+
function isLinkIgnored(linkTag) {
|
|
40
|
+
return linkTag.getAttribute('data-vike') === 'false';
|
|
41
|
+
}
|
|
42
|
+
// TODO refactor both functions below?
|
|
34
43
|
function isSamePageHashLink(href) {
|
|
35
44
|
if (href.startsWith('#'))
|
|
36
45
|
return true;
|
|
46
|
+
// TODO: remove?
|
|
37
47
|
if (href.includes('#') &&
|
|
38
48
|
normalizeClientSideUrl(href, { withoutHash: true }) ===
|
|
39
49
|
normalizeClientSideUrl(window.location.href, { withoutHash: true })) {
|
|
@@ -740,10 +740,15 @@ function getConfigDefinitions(plusFilesRelevant, filter) {
|
|
|
740
740
|
});
|
|
741
741
|
objectEntries(meta).forEach(([configName, configDefinitionUserLand]) => {
|
|
742
742
|
if ('isDefinedByPeerDependency' in configDefinitionUserLand) {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
743
|
+
/* vike-server@1.0.24 wrongfully sets `stream: { env: { config: true }, isDefinedByPeerDependency: true }`
|
|
744
|
+
assert(deepEqual(Object.keys(configDefinitionUserLand), ['isDefinedByPeerDependency']))
|
|
745
|
+
//*/
|
|
746
|
+
if (!configDefinitions[configName]) {
|
|
747
|
+
configDefinitions[configName] = {
|
|
748
|
+
env: { client: false, server: false, config: false },
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
return;
|
|
747
752
|
}
|
|
748
753
|
// User can override an existing config definition
|
|
749
754
|
configDefinitions[configName] = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.243";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.243';
|