kiru 0.51.0-preview.2 → 0.51.1
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/router/client/index.d.ts.map +1 -1
- package/dist/router/client/index.js +47 -0
- package/dist/router/client/index.js.map +1 -1
- package/dist/router/head.d.ts +4 -36
- package/dist/router/head.d.ts.map +1 -1
- package/dist/router/head.js +33 -53
- package/dist/router/head.js.map +1 -1
- package/dist/router/index.d.ts +55 -4
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +64 -6
- package/dist/router/index.js.map +1 -1
- package/dist/router/server/index.d.ts +1 -3
- package/dist/router/server/index.d.ts.map +1 -1
- package/dist/router/server/index.js +6 -9
- package/dist/router/server/index.js.map +1 -1
- package/dist/types.dom.d.ts +3 -2
- package/dist/types.dom.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/appContext.ts +3 -0
- package/src/globals.ts +5 -1
- package/src/hooks/usePromise.ts +3 -2
- package/src/router/client/index.ts +67 -1
- package/src/router/head.ts +44 -54
- package/src/router/index.ts +65 -6
- package/src/router/server/index.ts +8 -15
- package/src/ssr/client.ts +17 -2
- package/src/types.dom.ts +6 -1
- package/dist/router/dev/index.d.ts +0 -2
- package/dist/router/dev/index.d.ts.map +0 -1
- package/dist/router/dev/index.js +0 -46
- package/dist/router/dev/index.js.map +0 -1
- package/src/router/dev/index.ts +0 -63
package/dist/router/dev/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { __DEV__ } from "../../env.js";
|
|
2
|
-
export function onLoadedDev() {
|
|
3
|
-
if (!__DEV__) {
|
|
4
|
-
throw new Error("onLoadedDev should not have been included in production build.");
|
|
5
|
-
}
|
|
6
|
-
clean();
|
|
7
|
-
}
|
|
8
|
-
function clean() {
|
|
9
|
-
let isCleaned = true;
|
|
10
|
-
const VITE_ID = "data-vite-dev-id";
|
|
11
|
-
const injectedByVite = [
|
|
12
|
-
...document.querySelectorAll(`style[${VITE_ID}]`),
|
|
13
|
-
].map((style) => style.getAttribute(VITE_ID));
|
|
14
|
-
const suffix = "?temp";
|
|
15
|
-
const injectedByKiru = [
|
|
16
|
-
...document.querySelectorAll(`link[rel="stylesheet"][type="text/css"][href$="${suffix}"]`),
|
|
17
|
-
];
|
|
18
|
-
injectedByKiru.forEach((linkKiru) => {
|
|
19
|
-
const href = linkKiru.getAttribute("href");
|
|
20
|
-
let filePathAbsoluteUserRootDir = href.slice(0, -suffix.length);
|
|
21
|
-
const prefix = "/@fs/";
|
|
22
|
-
if (filePathAbsoluteUserRootDir.startsWith(prefix))
|
|
23
|
-
filePathAbsoluteUserRootDir = filePathAbsoluteUserRootDir.slice(prefix.length);
|
|
24
|
-
if (injectedByVite.some((filePathAbsoluteFilesystem) => filePathAbsoluteFilesystem.endsWith(filePathAbsoluteUserRootDir))) {
|
|
25
|
-
linkKiru.remove();
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
isCleaned = false;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return isCleaned;
|
|
32
|
-
}
|
|
33
|
-
function removeInjectedStyles() {
|
|
34
|
-
let sleep = 2;
|
|
35
|
-
function runClean() {
|
|
36
|
-
if (clean())
|
|
37
|
-
return;
|
|
38
|
-
if (sleep < 1000) {
|
|
39
|
-
sleep *= 2;
|
|
40
|
-
}
|
|
41
|
-
setTimeout(runClean, sleep);
|
|
42
|
-
}
|
|
43
|
-
setTimeout(runClean, sleep);
|
|
44
|
-
}
|
|
45
|
-
removeInjectedStyles();
|
|
46
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,gEAAgE,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AAI,KAAK,EAAE;YAAE,OAAM;QAEnB,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;YACjB,KAAK,IAAI,CAAC,CAAA;QACZ,CAAC;QACD,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAC7B,CAAC;IAED,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;AAC7B,CAAC;AAED,oBAAoB,EAAE,CAAA"}
|
package/src/router/dev/index.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { __DEV__ } from "../../env.js"
|
|
2
|
-
|
|
3
|
-
export function onLoadedDev() {
|
|
4
|
-
if (!__DEV__) {
|
|
5
|
-
throw new Error(
|
|
6
|
-
"onLoadedDev should not have been included in production build."
|
|
7
|
-
)
|
|
8
|
-
}
|
|
9
|
-
clean()
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function clean() {
|
|
13
|
-
let isCleaned = true
|
|
14
|
-
const VITE_ID = "data-vite-dev-id"
|
|
15
|
-
const injectedByVite = [
|
|
16
|
-
...document.querySelectorAll(`style[${VITE_ID}]`),
|
|
17
|
-
].map((style) => style.getAttribute(VITE_ID))
|
|
18
|
-
|
|
19
|
-
const suffix = "?temp"
|
|
20
|
-
const injectedByKiru = [
|
|
21
|
-
...document.querySelectorAll(
|
|
22
|
-
`link[rel="stylesheet"][type="text/css"][href$="${suffix}"]`
|
|
23
|
-
),
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
injectedByKiru.forEach((linkKiru) => {
|
|
27
|
-
const href = linkKiru.getAttribute("href")!
|
|
28
|
-
let filePathAbsoluteUserRootDir = href.slice(0, -suffix.length)
|
|
29
|
-
const prefix = "/@fs/"
|
|
30
|
-
if (filePathAbsoluteUserRootDir.startsWith(prefix))
|
|
31
|
-
filePathAbsoluteUserRootDir = filePathAbsoluteUserRootDir.slice(
|
|
32
|
-
prefix.length
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
injectedByVite.some((filePathAbsoluteFilesystem) =>
|
|
37
|
-
filePathAbsoluteFilesystem!.endsWith(filePathAbsoluteUserRootDir)
|
|
38
|
-
)
|
|
39
|
-
) {
|
|
40
|
-
linkKiru.remove()
|
|
41
|
-
} else {
|
|
42
|
-
isCleaned = false
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
return isCleaned
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function removeInjectedStyles() {
|
|
49
|
-
let sleep = 2
|
|
50
|
-
|
|
51
|
-
function runClean() {
|
|
52
|
-
if (clean()) return
|
|
53
|
-
|
|
54
|
-
if (sleep < 1000) {
|
|
55
|
-
sleep *= 2
|
|
56
|
-
}
|
|
57
|
-
setTimeout(runClean, sleep)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
setTimeout(runClean, sleep)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
removeInjectedStyles()
|