foldkit-ssr 0.1.0 → 0.3.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/README.md +267 -49
- package/dist/client-4jzvxuwf.d.mts +360 -0
- package/dist/client-4jzvxuwf.d.mts.map +1 -0
- package/dist/client-CsCXJa_9.mjs +1058 -0
- package/dist/client-CsCXJa_9.mjs.map +1 -0
- package/dist/client.d.mts +2 -0
- package/dist/client.mjs +2 -0
- package/dist/index.d.mts +75 -252
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +265 -939
- package/dist/index.mjs.map +1 -1
- package/dist/vite.d.mts +94 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +151 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +26 -11
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { SSR } from "./index.mjs";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
5
|
+
//#region src/vite.ts
|
|
6
|
+
/**
|
|
7
|
+
* `foldkit-ssr/vite`: the static half of a build, as a Vite plugin. After
|
|
8
|
+
* Vite writes the client bundle, `staticSite` renders every path with
|
|
9
|
+
* `SSR.generate` and writes each page where a static host serves its
|
|
10
|
+
* address, with the sitemap and `robots.txt` beside them. It owns no build:
|
|
11
|
+
* it runs as a `closeBundle` step on the application's own client build,
|
|
12
|
+
* with the application's own template.
|
|
13
|
+
*
|
|
14
|
+
* The application describes its site in a module the plugin evaluates
|
|
15
|
+
* through a server (workspace packages resolve to source, as the build
|
|
16
|
+
* does), so `vite.config.ts` names a file, never application code.
|
|
17
|
+
*/
|
|
18
|
+
const pathOf = (spec) => typeof spec === "string" ? spec : spec.path;
|
|
19
|
+
const modifiedOf = (spec) => typeof spec === "string" ? void 0 : spec.modified;
|
|
20
|
+
/**
|
|
21
|
+
* The file a static host serves for a path. `directory` is the package's
|
|
22
|
+
* own layout (`/about` as `about/index.html`); `flat` writes `about.html`,
|
|
23
|
+
* for hosts with clean addresses and no directory indexes. `generate`
|
|
24
|
+
* refuses what is not servable (a query, a fragment, an unresolvable
|
|
25
|
+
* address) before this maps it, so this maps and never validates.
|
|
26
|
+
*/
|
|
27
|
+
const fileFor = (path, layout) => {
|
|
28
|
+
const trimmed = path.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
29
|
+
if (trimmed === "") return "index.html";
|
|
30
|
+
if (layout === "flat") return trimmed.endsWith(".html") ? trimmed : `${trimmed}.html`;
|
|
31
|
+
return trimmed.endsWith(".html") ? trimmed : `${trimmed}/index.html`;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Renders a static site: every path through `SSR.generate`, one page per
|
|
35
|
+
* path in order, with the sitemap and robots text the options ask for. A
|
|
36
|
+
* build id must never be a secret, and two deployments must never share
|
|
37
|
+
* one; empty is refused with the deployment's name missing.
|
|
38
|
+
*/
|
|
39
|
+
const generateStaticSite = (site) => {
|
|
40
|
+
const buildId = site.buildId ?? process.env.FOLDKIT_BUILD_ID ?? "";
|
|
41
|
+
if (buildId === "") throw new Error("set FOLDKIT_BUILD_ID to the deployment this build belongs to, the same value `vite build` saw");
|
|
42
|
+
return Effect.gen(function* () {
|
|
43
|
+
const pathsInput = site.paths;
|
|
44
|
+
const specs = typeof pathsInput === "function" ? yield* Effect.promise(() => Promise.resolve(pathsInput())) : pathsInput;
|
|
45
|
+
const files = site.files ?? "directory";
|
|
46
|
+
const configInput = site.config;
|
|
47
|
+
if (specs.length === 0) throw new Error("foldkit-ssr: the site lists no paths: a site of nothing is a misconfigured paths");
|
|
48
|
+
const claimed = /* @__PURE__ */ new Map();
|
|
49
|
+
for (const spec of specs) {
|
|
50
|
+
const file = fileFor(pathOf(spec), files);
|
|
51
|
+
const other = claimed.get(file);
|
|
52
|
+
if (other !== void 0) throw new Error(`foldkit-ssr: "${pathOf(spec)}" and "${other}" would both be written to ${file}`);
|
|
53
|
+
claimed.set(file, pathOf(spec));
|
|
54
|
+
}
|
|
55
|
+
const pages = [];
|
|
56
|
+
for (const spec of specs) {
|
|
57
|
+
const path = pathOf(spec);
|
|
58
|
+
const config = typeof configInput === "function" ? yield* Effect.promise(async () => configInput(path)) : configInput;
|
|
59
|
+
const [page] = yield* SSR.generate(config, site.plan, {
|
|
60
|
+
buildId,
|
|
61
|
+
template: site.template,
|
|
62
|
+
origin: site.origin,
|
|
63
|
+
paths: [path],
|
|
64
|
+
...site.flags === void 0 ? {} : { flags: site.flags },
|
|
65
|
+
...site.head === void 0 ? {} : { head: site.head }
|
|
66
|
+
});
|
|
67
|
+
pages.push({
|
|
68
|
+
path,
|
|
69
|
+
file: fileFor(path, files),
|
|
70
|
+
html: page.html,
|
|
71
|
+
...modifiedOf(spec) === void 0 ? {} : { modified: modifiedOf(spec) }
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
pages,
|
|
76
|
+
...site.sitemap === true ? { sitemap: SSR.sitemap(pages, { origin: site.origin }) } : {},
|
|
77
|
+
...site.robots === true ? { robots: SSR.robots({ origin: site.origin }) } : {}
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
/** Workspace packages resolve to their source, so the site builds as edited. */
|
|
82
|
+
const conditions = ["foldkit-plus:source"];
|
|
83
|
+
/**
|
|
84
|
+
* A static site as a Vite plugin: after the client bundle is written, the
|
|
85
|
+
* site module is evaluated, every path is rendered into the built shell,
|
|
86
|
+
* and the pages land in the output beside the sitemap and robots text.
|
|
87
|
+
* The config names the module, never application code, so nothing resolves
|
|
88
|
+
* through a stale build.
|
|
89
|
+
*/
|
|
90
|
+
const staticSite = (options) => {
|
|
91
|
+
let outDir = options.outDir ?? "dist";
|
|
92
|
+
let root = process.cwd();
|
|
93
|
+
return {
|
|
94
|
+
name: "foldkit-ssr",
|
|
95
|
+
apply: "build",
|
|
96
|
+
configResolved(config) {
|
|
97
|
+
root = config.root;
|
|
98
|
+
outDir = options.outDir === void 0 ? isAbsolute(config.build.outDir) ? config.build.outDir : resolve(config.root, config.build.outDir) : isAbsolute(options.outDir) ? options.outDir : resolve(config.root, options.outDir);
|
|
99
|
+
},
|
|
100
|
+
async closeBundle() {
|
|
101
|
+
const { createServer } = await import("vite").catch(() => {
|
|
102
|
+
throw new Error("foldkit-ssr/vite needs the 'vite' package: add it where the build runs");
|
|
103
|
+
});
|
|
104
|
+
const server = await createServer({
|
|
105
|
+
configFile: false,
|
|
106
|
+
root,
|
|
107
|
+
logLevel: "error",
|
|
108
|
+
appType: "custom",
|
|
109
|
+
server: {
|
|
110
|
+
middlewareMode: true,
|
|
111
|
+
hmr: false
|
|
112
|
+
},
|
|
113
|
+
resolve: { conditions },
|
|
114
|
+
ssr: { resolve: { conditions } },
|
|
115
|
+
optimizeDeps: {
|
|
116
|
+
noDiscovery: true,
|
|
117
|
+
include: []
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
try {
|
|
121
|
+
const site = (await server.ssrLoadModule(options.site.module))[options.site.export ?? "site"];
|
|
122
|
+
if (site === void 0 || site === null || typeof site !== "object") throw new Error(`foldkit-ssr: ${options.site.module} exports no ${options.site.export ?? "site"} site description`);
|
|
123
|
+
const shell = join(outDir, "index.html");
|
|
124
|
+
let built;
|
|
125
|
+
try {
|
|
126
|
+
built = await readFile(shell, "utf8");
|
|
127
|
+
} catch {
|
|
128
|
+
throw new Error(`foldkit-ssr: no built index.html at ${shell}: the client build failed or outDir is wrong`);
|
|
129
|
+
}
|
|
130
|
+
const result = await Effect.runPromise(generateStaticSite({
|
|
131
|
+
...site,
|
|
132
|
+
template: site.template?.(built) ?? built
|
|
133
|
+
}));
|
|
134
|
+
for (const page of result.pages) {
|
|
135
|
+
const file = join(outDir, page.file);
|
|
136
|
+
await mkdir(dirname(file), { recursive: true });
|
|
137
|
+
await writeFile(file, page.html);
|
|
138
|
+
}
|
|
139
|
+
if (result.sitemap !== void 0) await writeFile(join(outDir, "sitemap.xml"), result.sitemap);
|
|
140
|
+
if (result.robots !== void 0) await writeFile(join(outDir, "robots.txt"), result.robots);
|
|
141
|
+
console.log(`foldkit-ssr: generated ${result.pages.length} pages${result.sitemap === void 0 ? "" : ", a sitemap"}${result.robots === void 0 ? "" : " and robots.txt"} into ${outDir}`);
|
|
142
|
+
} finally {
|
|
143
|
+
await server.close();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
149
|
+
export { fileFor, generateStaticSite, staticSite };
|
|
150
|
+
|
|
151
|
+
//# sourceMappingURL=vite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":[],"sources":["../src/vite.ts"],"sourcesContent":["/**\n * `foldkit-ssr/vite`: the static half of a build, as a Vite plugin. After\n * Vite writes the client bundle, `staticSite` renders every path with\n * `SSR.generate` and writes each page where a static host serves its\n * address, with the sitemap and `robots.txt` beside them. It owns no build:\n * it runs as a `closeBundle` step on the application's own client build,\n * with the application's own template.\n *\n * The application describes its site in a module the plugin evaluates\n * through a server (workspace packages resolve to source, as the build\n * does), so `vite.config.ts` names a file, never application code.\n */\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\nimport { dirname, isAbsolute, join, resolve } from 'node:path'\nimport { Effect, Schema } from 'effect'\nimport type { RenderError } from 'foldkit/experimental/server'\nimport type { Plugin } from 'vite'\nimport { SSR, type Head, type ResumeUnsafe } from './index.js'\nimport type { ResumableConfig, ResumePlan } from './shared.js'\n\n/** What a page adds to its head, given what it rendered: for site descriptions. */\nexport type { Head }\n\n/** A path the site generates, with the date its sitemap names when it has one. */\nexport type SitePath = string | { readonly path: string; readonly modified?: string | undefined }\n\nconst pathOf = (spec: SitePath): string => (typeof spec === 'string' ? spec : spec.path)\nconst modifiedOf = (spec: SitePath): string | undefined =>\n typeof spec === 'string' ? undefined : spec.modified\n\n/**\n * The file a static host serves for a path. `directory` is the package's\n * own layout (`/about` as `about/index.html`); `flat` writes `about.html`,\n * for hosts with clean addresses and no directory indexes. `generate`\n * refuses what is not servable (a query, a fragment, an unresolvable\n * address) before this maps it, so this maps and never validates.\n */\nexport const fileFor = (path: string, layout: 'directory' | 'flat'): string => {\n const trimmed = path.replace(/^\\/+/, '').replace(/\\/+$/, '')\n if (trimmed === '') return 'index.html'\n if (layout === 'flat') return trimmed.endsWith('.html') ? trimmed : `${trimmed}.html`\n return trimmed.endsWith('.html') ? trimmed : `${trimmed}/index.html`\n}\n\n/**\n * What a static site is: everything `SSR.generate` takes, plus where its\n * pages land. `config` may read the path (a site whose Model is prepared\n * per page satisfies and returns its own config for it); `paths` may close\n * over what the site serves (a thunk that seeds and lists, evaluated when\n * the build runs). `template` is the built shell the pages are rendered\n * into; `files` is the host's layout; `sitemap` and `robots` write their\n * files from the generated pages.\n */\nexport interface StaticSite<\n Model,\n Fields extends Schema.Struct.Fields,\n Message,\n // Unconstrained on purpose: a site's config carries its own services (a\n // Remote layer, flags), which no bound here could name without threading\n // the whole service graph through. The narrowed call still checks: a\n // config that is not a config or a function of a path fails where used.\n Resolved = ResumableConfig<Model, Message>,\n> {\n readonly config: Resolved | ((path: string) => Resolved | Promise<Resolved>)\n readonly plan: ResumePlan<Model, Fields>\n readonly buildId?: string | undefined\n readonly origin: string\n readonly paths:\n ReadonlyArray<SitePath> | (() => ReadonlyArray<SitePath> | Promise<ReadonlyArray<SitePath>>)\n readonly template: string\n readonly head?: Head | undefined\n readonly flags?: ((path: string) => unknown) | undefined\n readonly files?: 'directory' | 'flat' | undefined\n readonly sitemap?: boolean | undefined\n readonly robots?: boolean | undefined\n}\n\n/** One generated page, with the file the host serves it from. */\nexport interface BuiltPage {\n readonly path: string\n readonly file: string\n readonly html: string\n readonly modified?: string | undefined\n}\n\n/** What a static site build produced: its pages, and its sitemap and robots text. */\nexport interface BuiltSite {\n readonly pages: ReadonlyArray<BuiltPage>\n readonly sitemap?: string | undefined\n readonly robots?: string | undefined\n}\n\n/**\n * Renders a static site: every path through `SSR.generate`, one page per\n * path in order, with the sitemap and robots text the options ask for. A\n * build id must never be a secret, and two deployments must never share\n * one; empty is refused with the deployment's name missing.\n */\nexport const generateStaticSite = <Model, Fields extends Schema.Struct.Fields, Message = any>(\n site: StaticSite<Model, Fields, Message>,\n): Effect.Effect<BuiltSite, RenderError | ResumeUnsafe> => {\n const buildId = site.buildId ?? process.env.FOLDKIT_BUILD_ID ?? ''\n if (buildId === '') {\n throw new Error(\n 'set FOLDKIT_BUILD_ID to the deployment this build belongs to, the same value `vite build` saw',\n )\n }\n return Effect.gen(function* () {\n // Read into locals first: a call inside the thunks below would lose the\n // narrowing of a property access.\n const pathsInput = site.paths\n const specs =\n typeof pathsInput === 'function'\n ? yield* Effect.promise(() => Promise.resolve(pathsInput()))\n : pathsInput\n const files = site.files ?? 'directory'\n const configInput = site.config\n if (specs.length === 0) {\n throw new Error(\n 'foldkit-ssr: the site lists no paths: a site of nothing is a misconfigured paths',\n )\n }\n // Two specs may name one file (`/about` and `/about/`, or a `.html`\n // path beside its directory twin): `generate` sees one path at a time\n // and cannot catch it, so the collision is refused before rendering.\n const claimed = new Map<string, string>()\n for (const spec of specs) {\n const file = fileFor(pathOf(spec), files)\n const other = claimed.get(file)\n if (other !== undefined) {\n throw new Error(\n `foldkit-ssr: \"${pathOf(spec)}\" and \"${other}\" would both be written to ${file}`,\n )\n }\n claimed.set(file, pathOf(spec))\n }\n const pages: Array<BuiltPage> = []\n for (const spec of specs) {\n const path = pathOf(spec)\n const config =\n typeof configInput === 'function'\n ? yield* Effect.promise(async () => configInput(path))\n : configInput\n const [page] = yield* SSR.generate(config, site.plan, {\n buildId,\n template: site.template,\n origin: site.origin,\n paths: [path] as const,\n ...(site.flags === undefined ? {} : { flags: site.flags }),\n ...(site.head === undefined ? {} : { head: site.head }),\n })\n pages.push({\n path,\n file: fileFor(path, files),\n html: page.html,\n ...(modifiedOf(spec) === undefined ? {} : { modified: modifiedOf(spec) }),\n })\n }\n return {\n pages,\n ...(site.sitemap === true ? { sitemap: SSR.sitemap(pages, { origin: site.origin }) } : {}),\n ...(site.robots === true ? { robots: SSR.robots({ origin: site.origin }) } : {}),\n }\n })\n}\n\n/** A site description as a module exports it, for the plugin to evaluate. */\nexport interface SiteModule {\n readonly config:\n | ResumableConfig<any, any>\n | ((path: string) => ResumableConfig<any, any> | Promise<ResumableConfig<any, any>>)\n readonly plan: ResumePlan<any, any>\n readonly buildId?: string | undefined\n readonly origin: string\n readonly paths:\n ReadonlyArray<SitePath> | (() => ReadonlyArray<SitePath> | Promise<ReadonlyArray<SitePath>>)\n readonly template?: ((built: string) => string) | undefined\n readonly head?: Head | undefined\n readonly flags?: ((path: string) => unknown) | undefined\n readonly files?: 'directory' | 'flat' | undefined\n readonly sitemap?: boolean | undefined\n readonly robots?: boolean | undefined\n}\n\n/** Workspace packages resolve to their source, so the site builds as edited. */\nconst conditions = ['foldkit-plus:source']\n\n/**\n * A static site as a Vite plugin: after the client bundle is written, the\n * site module is evaluated, every path is rendered into the built shell,\n * and the pages land in the output beside the sitemap and robots text.\n * The config names the module, never application code, so nothing resolves\n * through a stale build.\n */\nexport const staticSite = (options: {\n /** The site description's module, root-relative (`/src/site.ts`), and its export. */\n readonly site: { readonly module: string; readonly export?: string | undefined }\n /** What `vite build` wrote: defaults to the resolved `build.outDir`. */\n readonly outDir?: string | undefined\n}): Plugin => {\n let outDir = options.outDir ?? 'dist'\n let root = process.cwd()\n return {\n name: 'foldkit-ssr',\n apply: 'build',\n configResolved(config) {\n // The site module resolves against the application, not this process:\n // the test runs from the workspace root while the site lives elsewhere.\n root = config.root\n // An explicit outDir reads as Vite reads it: against the root.\n outDir =\n options.outDir === undefined\n ? isAbsolute(config.build.outDir)\n ? config.build.outDir\n : resolve(config.root, config.build.outDir)\n : isAbsolute(options.outDir)\n ? options.outDir\n : resolve(config.root, options.outDir)\n },\n async closeBundle() {\n // No dev server runs during a build: one of its own, closed after.\n // `vite` loads only here, never by a page: a build without it fails\n // naming the package, not with a resolution error.\n const { createServer } = await import('vite').catch(() => {\n throw new Error(\"foldkit-ssr/vite needs the 'vite' package: add it where the build runs\")\n })\n const server = await createServer({\n configFile: false,\n root,\n logLevel: 'error',\n appType: 'custom',\n server: { middlewareMode: true, hmr: false },\n resolve: { conditions },\n ssr: { resolve: { conditions } },\n optimizeDeps: { noDiscovery: true, include: [] },\n })\n try {\n const exported = await server.ssrLoadModule(options.site.module)\n const site = exported[options.site.export ?? 'site'] as SiteModule\n if (site === undefined || site === null || typeof site !== 'object')\n throw new Error(\n `foldkit-ssr: ${options.site.module} exports no ${options.site.export ?? 'site'} site description`,\n )\n const shell = join(outDir, 'index.html')\n let built: string\n try {\n built = await readFile(shell, 'utf8')\n } catch {\n // Rollup runs closeBundle after a failed client build too: name\n // the missing shell instead of its ENOENT.\n throw new Error(\n `foldkit-ssr: no built index.html at ${shell}: the client build failed or outDir is wrong`,\n )\n }\n const result = await Effect.runPromise(\n generateStaticSite({\n ...site,\n template: site.template?.(built) ?? built,\n }),\n )\n for (const page of result.pages) {\n const file = join(outDir, page.file)\n await mkdir(dirname(file), { recursive: true })\n await writeFile(file, page.html)\n }\n if (result.sitemap !== undefined)\n await writeFile(join(outDir, 'sitemap.xml'), result.sitemap)\n if (result.robots !== undefined) await writeFile(join(outDir, 'robots.txt'), result.robots)\n console.log(\n `foldkit-ssr: generated ${result.pages.length} pages${result.sitemap === undefined ? '' : ', a sitemap'}${result.robots === undefined ? '' : ' and robots.txt'} into ${outDir}`,\n )\n } finally {\n await server.close()\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAM,UAAU,SAA4B,OAAO,SAAS,WAAW,OAAO,KAAK;AACnF,MAAM,cAAc,SAClB,OAAO,SAAS,WAAW,KAAA,IAAY,KAAK;;;;;;;;AAS9C,MAAa,WAAW,MAAc,WAAyC;CAC7E,MAAM,UAAU,KAAK,QAAQ,QAAQ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",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Server rendering for Foldkit Plus: render once on the server, hand the Model over, and hydrate without rerunning init.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -26,8 +26,19 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"foldkit-plus:source": "./src/index.ts",
|
|
29
30
|
"types": "./dist/index.d.mts",
|
|
30
31
|
"import": "./dist/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./client": {
|
|
34
|
+
"foldkit-plus:source": "./src/client.ts",
|
|
35
|
+
"types": "./dist/client.d.mts",
|
|
36
|
+
"import": "./dist/client.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./vite": {
|
|
39
|
+
"foldkit-plus:source": "./src/vite.ts",
|
|
40
|
+
"types": "./dist/vite.d.mts",
|
|
41
|
+
"import": "./dist/vite.mjs"
|
|
31
42
|
}
|
|
32
43
|
},
|
|
33
44
|
"files": [
|
|
@@ -36,23 +47,27 @@
|
|
|
36
47
|
"LICENSE"
|
|
37
48
|
],
|
|
38
49
|
"peerDependencies": {
|
|
39
|
-
"effect": "^4.0.0
|
|
40
|
-
"foldkit": "^0.
|
|
50
|
+
"effect": "^4.0.0",
|
|
51
|
+
"foldkit": "^0.165.0"
|
|
41
52
|
},
|
|
42
53
|
"dependencies": {
|
|
43
|
-
"foldkit-surface": "0.
|
|
54
|
+
"foldkit-surface": "0.6.0"
|
|
44
55
|
},
|
|
45
56
|
"devDependencies": {
|
|
46
|
-
"@effect/platform-browser": "4.0.0
|
|
47
|
-
"
|
|
48
|
-
"
|
|
57
|
+
"@effect/platform-browser": "4.0.0",
|
|
58
|
+
"@types/jsdom": "21.1.7",
|
|
59
|
+
"effect": "4.0.0",
|
|
60
|
+
"esbuild": "0.28.2",
|
|
61
|
+
"foldkit": "0.165.0",
|
|
49
62
|
"jsdom": "26.1.0",
|
|
63
|
+
"playwright-core": "1.63.0",
|
|
50
64
|
"tsdown": "^0.23.0",
|
|
51
65
|
"typescript": "5.9.3",
|
|
52
|
-
"
|
|
53
|
-
"foldkit-entity": "0.
|
|
54
|
-
"foldkit-
|
|
55
|
-
"foldkit-mirror": "0.
|
|
66
|
+
"vite": "5.4.21",
|
|
67
|
+
"foldkit-entity": "0.6.0",
|
|
68
|
+
"foldkit-bundle": "0.5.0",
|
|
69
|
+
"foldkit-mirror": "0.5.0",
|
|
70
|
+
"foldkit-remote": "0.10.0"
|
|
56
71
|
},
|
|
57
72
|
"scripts": {
|
|
58
73
|
"build": "tsdown",
|