wiki-viewer 1.8.2 → 1.8.3
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/app-proxy/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/browse/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/signin/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/signin/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-inabx._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00lep-u._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{0~w0_katex_dist_katex_mjs_04mhawr._.js → 0~w0_katex_dist_katex_mjs_0hyln.b._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__09~x2v~._.js → [root-of-the-server]__0du58sw._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0pqaawz._.js +19 -19
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0shlang._.js → node_modules__pnpm_0.kyqfq._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_04n0h6.._.js → node_modules__pnpm_0.~goq~._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_011vy_q._.js → node_modules__pnpm_00y7foi._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0yiz.-t._.js → node_modules__pnpm_03.1jli._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_093dp2q._.js → node_modules__pnpm_03z3na-._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_01o_5qt._.js → node_modules__pnpm_05~w-ok._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0b8qx0g._.js → node_modules__pnpm_09d5yyu._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0wmx9kq._.js → node_modules__pnpm_09eo8jh._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0nw5ou2._.js → node_modules__pnpm_0adm8h6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0bbc---._.js → node_modules__pnpm_0arbjru._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0t9jb7d._.js → node_modules__pnpm_0b5fla7._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_124u4o2._.js → node_modules__pnpm_0beormu._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_13tajgx._.js → node_modules__pnpm_0c7u76a._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09ej62_._.js → node_modules__pnpm_0dbr7c2._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0s0ur~d._.js → node_modules__pnpm_0d~ida~._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09ljbdz._.js → node_modules__pnpm_0elpfsb._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hlzy8f._.js → node_modules__pnpm_0fh.6ir._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_09~_ob2._.js → node_modules__pnpm_0fm6wcx._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0o.dn8o._.js → node_modules__pnpm_0iikbcy._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0hk6xys._.js → node_modules__pnpm_0mvih7b._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0a01ng7._.js → node_modules__pnpm_0qd2ovj._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c.309.._.js → node_modules__pnpm_0s4yn43._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0sq3c2r._.js → node_modules__pnpm_0s8fvbn._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0xfx0sf._.js → node_modules__pnpm_0tq8zs6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_11sut1u._.js → node_modules__pnpm_0vyv.lz._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0c8aunj._.js → node_modules__pnpm_0xa.ko1._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules__pnpm_0.96tmo._.js → node_modules__pnpm_12.ymhl._.js} +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/{0vp-ahhagxptc.js → 06iw_iy5e90d4.js} +1 -1
- package/.next/standalone/.next/static/chunks/0d~o0h0ssgra7.js +129 -0
- package/.next/standalone/.next/static/chunks/167ph4xws_-61.css +2 -0
- package/.next/standalone/.next/static/chunks/{turbopack-12~z-mr7b9b50.js → turbopack-0lf4~b-ofzbm6.js} +1 -1
- package/.next/standalone/AGENTS.md +104 -0
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/src/app/api/wiki/app/route.ts +7 -4
- package/.next/standalone/src/app/page.tsx +580 -192
- package/.next/standalone/src/components/editor/backlinks-panel.tsx +152 -0
- package/.next/standalone/src/components/editor/document-outline.tsx +221 -0
- package/.next/standalone/src/components/editor/editor.tsx +145 -48
- package/.next/standalone/src/components/editor/node-app-viewer.tsx +65 -7
- package/.next/standalone/src/components/editor/slash-commands.tsx +216 -41
- package/.next/standalone/src/components/editor/source-viewer.tsx +29 -2
- package/.next/standalone/src/components/search/search-command-dialog.tsx +183 -46
- package/.next/standalone/src/lib/app-runner.ts +57 -16
- package/.next/standalone/src/stores/pin-store.ts +55 -0
- package/.next/standalone/src/stores/recent-store.ts +50 -0
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/.next/standalone/.next/static/chunks/0c_~zevf2n0r4.css +0 -2
- package/.next/standalone/.next/static/chunks/16r--8~rpehcz.js +0 -129
- package/.next/standalone/src/components/wiki/markdown-preview.tsx +0 -120
- /package/.next/standalone/.next/static/{t_k0ztuf0V-iA-kgeez18 → Pkj31aCfRVk0Zy2rKA1wf}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{t_k0ztuf0V-iA-kgeez18 → Pkj31aCfRVk0Zy2rKA1wf}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{t_k0ztuf0V-iA-kgeez18 → Pkj31aCfRVk0Zy2rKA1wf}/_ssgManifest.js +0 -0
|
@@ -73,30 +73,71 @@ interface Cmd {
|
|
|
73
73
|
isVite: boolean;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
interface Pkg {
|
|
77
|
+
scripts?: Record<string, string>;
|
|
78
|
+
main?: string;
|
|
79
|
+
dependencies?: Record<string, string>;
|
|
80
|
+
devDependencies?: Record<string, string>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function readPkg(dir: string): Pkg | null {
|
|
77
84
|
const pkgPath = path.join(dir, "package.json");
|
|
78
85
|
if (!existsSync(pkgPath)) return null;
|
|
86
|
+
try {
|
|
87
|
+
return JSON.parse(readFileSync(pkgPath, "utf-8")) as Pkg;
|
|
88
|
+
} catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
79
92
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
function hasViteDep(pkg: Pkg): boolean {
|
|
94
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
95
|
+
return Object.keys(allDeps).some((k) => k === "vite" || k.includes("vite"));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Default script chosen when the user doesn't pick one explicitly.
|
|
100
|
+
* Priority: start > preview (built) > dev.
|
|
101
|
+
*/
|
|
102
|
+
function defaultScript(dir: string, scripts: Record<string, string>): string | null {
|
|
103
|
+
if (scripts.start) return "start";
|
|
104
|
+
if (scripts.preview && existsSync(path.join(dir, "dist"))) return "preview";
|
|
105
|
+
if (scripts.dev) return "dev";
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* List the npm scripts available to launch, plus which one is the default.
|
|
111
|
+
* Returns empty scripts list when only `main` is runnable (node entry).
|
|
112
|
+
*/
|
|
113
|
+
export function getScripts(absPath: string): { scripts: string[]; defaultScript: string | null } {
|
|
114
|
+
const pkg = readPkg(absPath);
|
|
115
|
+
if (!pkg) return { scripts: [], defaultScript: null };
|
|
116
|
+
const scripts = pkg.scripts ?? {};
|
|
117
|
+
return {
|
|
118
|
+
scripts: Object.keys(scripts),
|
|
119
|
+
defaultScript: defaultScript(absPath, scripts),
|
|
85
120
|
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function detectCmd(dir: string, pm: PM, script?: string): Cmd | null {
|
|
124
|
+
const pkg = readPkg(dir);
|
|
125
|
+
if (!pkg) return null;
|
|
126
|
+
|
|
86
127
|
const scripts = pkg.scripts ?? {};
|
|
87
|
-
const
|
|
88
|
-
const hasVite = Object.keys(allDeps).some((k) => k === "vite" || k.includes("vite"));
|
|
128
|
+
const hasVite = hasViteDep(pkg);
|
|
89
129
|
|
|
90
|
-
const run = (
|
|
130
|
+
const run = (s: string, extraArgs: string[] = []): Cmd => ({
|
|
91
131
|
bin: pm,
|
|
92
|
-
args: ["run",
|
|
132
|
+
args: ["run", s, ...(extraArgs.length ? ["--", ...extraArgs] : [])],
|
|
93
133
|
isVite: hasVite,
|
|
94
134
|
});
|
|
95
135
|
|
|
96
|
-
//
|
|
97
|
-
if (scripts
|
|
98
|
-
|
|
99
|
-
|
|
136
|
+
// Explicit script choice wins
|
|
137
|
+
if (script && scripts[script]) return run(script);
|
|
138
|
+
|
|
139
|
+
const def = defaultScript(dir, scripts);
|
|
140
|
+
if (def) return run(def);
|
|
100
141
|
if (pkg.main) return { bin: "node", args: [pkg.main], isVite: false };
|
|
101
142
|
return null;
|
|
102
143
|
}
|
|
@@ -121,7 +162,7 @@ export function getStatus(relPath: string): { status: AppStatus; port?: number;
|
|
|
121
162
|
return { status: app.status, port: app.port || undefined, error: app.error, logs: app.logs };
|
|
122
163
|
}
|
|
123
164
|
|
|
124
|
-
export async function startApp(relPath: string, absPath: string): Promise<{ port: number }> {
|
|
165
|
+
export async function startApp(relPath: string, absPath: string, script?: string): Promise<{ port: number }> {
|
|
125
166
|
const existing = apps.get(relPath);
|
|
126
167
|
if (existing && existing.status !== "stopped" && existing.status !== "error") {
|
|
127
168
|
return { port: existing.port };
|
|
@@ -129,7 +170,7 @@ export async function startApp(relPath: string, absPath: string): Promise<{ port
|
|
|
129
170
|
|
|
130
171
|
const port = await findFreePort();
|
|
131
172
|
const pm = detectPM(absPath);
|
|
132
|
-
const cmd = detectCmd(absPath, pm);
|
|
173
|
+
const cmd = detectCmd(absPath, pm, script);
|
|
133
174
|
if (!cmd) throw new Error("No runnable script found in package.json (need start, preview, or dev)");
|
|
134
175
|
|
|
135
176
|
const entry: RunningApp = { port, process: null, status: "installing", logs: [] };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
|
|
4
|
+
export interface PinnedEntry {
|
|
5
|
+
path: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface PinState {
|
|
10
|
+
pins: PinnedEntry[];
|
|
11
|
+
loadForWorkspace: (workspaceId: string | null | undefined) => void;
|
|
12
|
+
toggle: (entry: PinnedEntry, workspaceId: string | null | undefined) => void;
|
|
13
|
+
isPinned: (path: string) => boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function storageKey(ws: string | null | undefined): string {
|
|
17
|
+
return ws ? `wiki-pinned-files-${ws}` : "wiki-pinned-files";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function readStorage(ws: string | null | undefined): PinnedEntry[] {
|
|
21
|
+
if (typeof window === "undefined") return [];
|
|
22
|
+
try {
|
|
23
|
+
const raw = localStorage.getItem(storageKey(ws));
|
|
24
|
+
return raw ? (JSON.parse(raw) as PinnedEntry[]) : [];
|
|
25
|
+
} catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function writeStorage(ws: string | null | undefined, items: PinnedEntry[]): void {
|
|
31
|
+
if (typeof window === "undefined") return;
|
|
32
|
+
localStorage.setItem(storageKey(ws), JSON.stringify(items));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const usePinStore = create<PinState>((set, get) => ({
|
|
36
|
+
pins: [],
|
|
37
|
+
|
|
38
|
+
loadForWorkspace: (ws) => {
|
|
39
|
+
set({ pins: readStorage(ws) });
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
toggle: (entry, ws) => {
|
|
43
|
+
const current = readStorage(ws);
|
|
44
|
+
const exists = current.some((p) => p.path === entry.path);
|
|
45
|
+
const next = exists
|
|
46
|
+
? current.filter((p) => p.path !== entry.path)
|
|
47
|
+
: [...current, entry];
|
|
48
|
+
writeStorage(ws, next);
|
|
49
|
+
set({ pins: next });
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
isPinned: (path) => {
|
|
53
|
+
return get().pins.some((p) => p.path === path);
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create } from "zustand";
|
|
3
|
+
|
|
4
|
+
export interface RecentEntry {
|
|
5
|
+
path: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface RecentState {
|
|
10
|
+
recents: RecentEntry[];
|
|
11
|
+
loadForWorkspace: (workspaceId: string | null | undefined) => void;
|
|
12
|
+
push: (entry: RecentEntry, workspaceId: string | null | undefined) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const MAX_RECENTS = 15;
|
|
16
|
+
|
|
17
|
+
function storageKey(ws: string | null | undefined): string {
|
|
18
|
+
return ws ? `wiki-recent-files-${ws}` : "wiki-recent-files";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function readStorage(ws: string | null | undefined): RecentEntry[] {
|
|
22
|
+
if (typeof window === "undefined") return [];
|
|
23
|
+
try {
|
|
24
|
+
const raw = localStorage.getItem(storageKey(ws));
|
|
25
|
+
return raw ? (JSON.parse(raw) as RecentEntry[]) : [];
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function writeStorage(ws: string | null | undefined, items: RecentEntry[]): void {
|
|
32
|
+
if (typeof window === "undefined") return;
|
|
33
|
+
localStorage.setItem(storageKey(ws), JSON.stringify(items));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const useRecentStore = create<RecentState>((set) => ({
|
|
37
|
+
recents: [],
|
|
38
|
+
|
|
39
|
+
loadForWorkspace: (ws) => {
|
|
40
|
+
set({ recents: readStorage(ws) });
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
push: (entry, ws) => {
|
|
44
|
+
const current = readStorage(ws);
|
|
45
|
+
const deduped = current.filter((r) => r.path !== entry.path);
|
|
46
|
+
const next = [entry, ...deduped].slice(0, MAX_RECENTS);
|
|
47
|
+
writeStorage(ws, next);
|
|
48
|
+
set({ recents: next });
|
|
49
|
+
},
|
|
50
|
+
}));
|