Skip to content

Commit ac48da8

Browse files
committed
Fix site
1 parent 3caaab4 commit ac48da8

File tree

7 files changed

+28
-15
lines changed

7 files changed

+28
-15
lines changed

docs-svelte-kit/src/lib/footer/Footer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<div class="edit-link">
4343
<a
4444
href="https://github.com/ota-meshi/eslint-plugin-svelte/edit/main/docs/{markdownPath(
45-
$page.path,
45+
$page.url.pathname,
4646
)}"
4747
target="_blank"
4848
rel="noopener noreferrer">Edit this page</a

docs-svelte-kit/src/lib/sidemenu/UlMenu.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { page } from "$app/stores"
3-
import { isActive } from "../utils.js"
3+
import { isActive, stripBaseUrl } from "../utils.js"
44
import { base as baseUrl } from "$app/paths"
55
export let children
66
export let level = 1
@@ -17,8 +17,8 @@
1717
class="sidebar-menu-item-title"
1818
class:active={item.active ||
1919
(item.path && isActive(item.path, $page))}
20-
href="{baseUrl}{item.path || `${$page.path}#${item.id}`}"
21-
>{item.title}</a
20+
href="{baseUrl}{item.path ||
21+
`${stripBaseUrl($page.url.pathname)}#${item.id}`}">{item.title}</a
2222
>
2323
{:else}
2424
<span class="sidebar-menu-item-title">{item.title}</span>

docs-svelte-kit/src/lib/utils.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ import { rules } from "../../../src/utils/rules.ts"
33
import { readable, writable } from "svelte/store"
44
// eslint-disable-next-line node/no-missing-import -- ignore
55
import { page } from "$app/stores"
6+
// eslint-disable-next-line node/no-missing-import -- ignore
7+
import { base as baseUrl } from "$app/paths"
8+
9+
export function stripBaseUrl(path) {
10+
if (path.startsWith(baseUrl)) {
11+
return path.slice(baseUrl.length)
12+
}
13+
return path
14+
}
615

716
const svelteRules = rules.filter((rule) => !rule.meta.deprecated)
817

@@ -53,10 +62,13 @@ const SIDE_MENU = {
5362
}
5463

5564
export function isActive(path, $page) {
56-
return markdownPath($page.path) === markdownPath(path)
65+
return markdownPath($page.url.pathname) === markdownPath(path)
5766
}
5867

5968
export function markdownPath(path) {
69+
// eslint-disable-next-line no-param-reassign -- ignore
70+
path = stripBaseUrl(path)
71+
6072
let normalized = path === "/" ? "README" : path.replace(/^\/|\/$/g, "")
6173
return `${normalized}.md`
6274
}
@@ -84,8 +96,9 @@ export const menuItems = readable([], function start(set) {
8496
function generateMenu($page, toc) {
8597
const result = []
8698
const [, menus] =
87-
Object.entries(SIDE_MENU).find(([k]) => $page.path.startsWith(k)) ||
88-
SIDE_MENU["/"]
99+
Object.entries(SIDE_MENU).find(([k]) =>
100+
stripBaseUrl($page.url.pathname).startsWith(k),
101+
) || SIDE_MENU["/"]
89102
for (const { path, title, children } of menus) {
90103
const active = isActive(path, $page)
91104
if (active) {

docs/__layout.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const docs = import.meta.glob("./**/*.md")
44
55
/** @type {import('@sveltejs/kit').Load} */
6-
export async function load({ page }) {
7-
const markdown = `./${markdownPath(page.path)}`
6+
export async function load({ url }) {
7+
const markdown = `./${markdownPath(url.pathname)}`
88
if (docs[markdown]) {
99
return {
1010
props: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"stylelint": "^14.0.0",
120120
"stylelint-config-standard": "^24.0.0",
121121
"svelte": "^3.37.0",
122-
"svelte-adapter-ghpages": "0.0.1",
122+
"svelte-adapter-ghpages": "0.0.2",
123123
"ts-node": "^10.0.0",
124124
"typescript": "^4.5.2",
125125
"vite-plugin-svelte-md": "^0.1.3",

svelte-kit-import-hook.mjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ function ________adjustModule(m) {
4343
default: ________adjustModule(m.default)
4444
}
4545
for (const key of Object.keys(m.default)) {
46-
if (typeof m.default[key] === 'function') {
47-
result[key] = (...args) => m.default[key](...args);
48-
} else {
49-
result[key] = m.default[key]
50-
}
46+
result[key] = m.default[key]
5147
}
5248
return result
5349
}

svelte.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ esbuild.buildSync({
1616
"path",
1717
"cross-spawn",
1818
"prismjs",
19+
"os",
20+
"fs",
21+
"stream",
22+
"zlib",
1923
"./docs-svelte-kit/build-system/build.js",
2024
],
2125
})

0 commit comments

Comments
 (0)