@teyik0/furin 0.2.0-alpha.1 → 0.2.0-alpha.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.
Files changed (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +33 -33
  3. package/dist/adapter/static.d.ts +1 -1
  4. package/dist/build/compile-entry.ts +109 -109
  5. package/dist/build/entry-template.ts +156 -156
  6. package/dist/build/index.js +1724 -687
  7. package/dist/build/route-types.d.ts +3 -1
  8. package/dist/build/server-routes-entry.ts +36 -36
  9. package/dist/build/shared.d.ts +1 -0
  10. package/dist/build/ssg-cache.d.ts +1 -1
  11. package/dist/cli/index.js +1673 -658
  12. package/dist/client/link.js +883 -89
  13. package/dist/client/router/index.d.ts +4 -0
  14. package/dist/client/router/link-utils.d.ts +3 -1
  15. package/dist/client/router/navigation.d.ts +10 -0
  16. package/dist/client/router/provider.d.ts +1 -1
  17. package/dist/client/router/search/index.d.ts +18 -0
  18. package/dist/client/router/search-store.d.ts +21 -0
  19. package/dist/client/router/types.d.ts +14 -1
  20. package/dist/client/sync.d.ts +25 -0
  21. package/dist/client.d.ts +1 -0
  22. package/dist/client.js +44 -0
  23. package/dist/furin.d.ts +9 -1
  24. package/dist/furin.js +1578 -258
  25. package/dist/server/auto-invalidate/runtime.d.ts +1 -1
  26. package/dist/server/dev-page-plugin.d.ts +3 -0
  27. package/dist/server/render/assemble.d.ts +2 -0
  28. package/dist/server/render/isr.d.ts +2 -1
  29. package/dist/server/render/ssg.d.ts +3 -2
  30. package/dist/server/render/ssr.d.ts +5 -4
  31. package/dist/server/router/hmr.d.ts +4 -3
  32. package/dist/server/router/index.d.ts +1 -1
  33. package/dist/server/router/index.js +1 -2
  34. package/dist/server/router/index.ts +1 -2
  35. package/dist/server/router/plugin.d.ts +2 -1
  36. package/dist/server/router/schemas.d.ts +25 -17
  37. package/dist/server/sync/config.d.ts +6 -0
  38. package/dist/server/sync/index.d.ts +4 -0
  39. package/dist/server/sync/plugin.d.ts +369 -0
  40. package/dist/server/sync/stream.d.ts +47 -0
  41. package/dist/shared/search-params.d.ts +17 -0
  42. package/package.json +10 -5
  43. package/src/adapter/README.md +13 -13
  44. package/src/adapter/static.ts +23 -6
  45. package/src/build/client.ts +152 -149
  46. package/src/build/compile-entry.ts +109 -109
  47. package/src/build/entry-template.ts +156 -156
  48. package/src/build/hydrate.ts +340 -331
  49. package/src/build/index.ts +152 -152
  50. package/src/build/route-types.ts +145 -115
  51. package/src/build/scan-server.ts +95 -95
  52. package/src/build/server-routes-entry.ts +36 -36
  53. package/src/build/shared.ts +80 -78
  54. package/src/build/ssg-cache.ts +32 -31
  55. package/src/build/types.ts +89 -89
  56. package/src/client/link.tsx +13 -4
  57. package/src/client/router/context.ts +2 -0
  58. package/src/client/router/index.ts +9 -0
  59. package/src/client/router/link-utils.ts +184 -180
  60. package/src/client/router/navigation.ts +61 -0
  61. package/src/client/router/provider.tsx +804 -723
  62. package/src/client/router/search/index.ts +99 -0
  63. package/src/client/router/search-store.ts +86 -0
  64. package/src/client/router/types.ts +276 -263
  65. package/src/client/sync.ts +98 -0
  66. package/src/client.ts +369 -355
  67. package/src/furin.ts +465 -437
  68. package/src/server/auto-invalidate/runtime.ts +134 -133
  69. package/src/server/dev-page-plugin.ts +454 -449
  70. package/src/server/render/assemble.ts +160 -133
  71. package/src/server/render/isr.ts +323 -295
  72. package/src/server/render/not-found.ts +2 -0
  73. package/src/server/render/ssg.ts +15 -4
  74. package/src/server/render/ssr.ts +585 -545
  75. package/src/server/router/hmr.ts +14 -10
  76. package/src/server/router/index.ts +1 -2
  77. package/src/server/router/patterns.ts +5 -0
  78. package/src/server/router/plugin.ts +384 -401
  79. package/src/server/router/schemas.ts +172 -57
  80. package/src/server/sync/config.ts +29 -0
  81. package/src/server/sync/index.ts +14 -0
  82. package/src/server/sync/plugin.ts +108 -0
  83. package/src/server/sync/stream.ts +144 -0
  84. package/src/shared/search-params.ts +182 -0
@@ -1,95 +1,95 @@
1
- import { readFileSync } from "node:fs";
2
- import { parse, type CallExpression, type ObjectExpression, type ObjectProperty } from "yuku-parser";
3
- import { detectLangFromPath, unwrapTSExpression } from "../server/lang-detect.ts";
4
- import { walkAST } from "../shared/utils/ast-walk.ts";
5
-
6
- /**
7
- * Statically scans a server entry file and returns all `pagesDir` string
8
- * literal values found inside `furin({ pagesDir: "..." })` call expressions.
9
- *
10
- * Dynamic paths (template literals, variables) are silently ignored.
11
- * Returns an empty array when nothing is detected.
12
- */
13
- export function scanFurinInstances(serverEntryPath: string): string[] {
14
- const code = readFileSync(serverEntryPath, "utf8");
15
- const lang = detectLangFromPath(serverEntryPath);
16
-
17
- // Declaration files contain no runtime code — skip parsing.
18
- if (lang === "dts") {
19
- return [];
20
- }
21
-
22
- const { program, diagnostics } = parse(code, { sourceType: "module", lang });
23
- const firstError = diagnostics.find((d) => d.severity === "error");
24
- if (firstError) {
25
- console.error("[furin] scan-server: parse error:", firstError.message, "in", serverEntryPath);
26
- return [];
27
- }
28
-
29
- const results: string[] = [];
30
- walkAST(program, (node) => {
31
- if (node.type === "CallExpression") {
32
- checkFurinCall(node as unknown as CallExpression, results);
33
- }
34
- });
35
- return results;
36
- }
37
-
38
- /** Checks whether `node` is a `furin({ pagesDir: "..." })` call and, if so, pushes the value. */
39
- function checkFurinCall(node: CallExpression, out: string[]): void {
40
- const isFurinCall = node.callee.type === "Identifier" && node.callee.name === "furin";
41
-
42
- if (!isFurinCall || node.arguments.length === 0) {
43
- return;
44
- }
45
-
46
- // Unwrap TS expression wrappers like `furin({...} as Config)` or
47
- // `furin({...} satisfies Options)` so we still see the ObjectExpression.
48
- const firstArgNode = node.arguments[0];
49
- if (!firstArgNode) {
50
- return;
51
- }
52
- const firstArg = unwrapTSExpression(firstArgNode);
53
- if (!isObjectExpressionNode(firstArg)) {
54
- return;
55
- }
56
-
57
- const pagesDir = extractStringProperty(firstArg, "pagesDir");
58
- if (pagesDir !== null) {
59
- out.push(pagesDir);
60
- }
61
- }
62
-
63
- function isObjectExpressionNode(node: { type: string }): node is ObjectExpression {
64
- return node.type === "ObjectExpression";
65
- }
66
-
67
- function extractStringProperty(obj: ObjectExpression, propName: string): string | null {
68
- for (const prop of obj.properties) {
69
- if (prop.type !== "Property") {
70
- continue;
71
- }
72
- const value = getStringPropertyValue(prop, propName);
73
-
74
- if (value !== undefined) {
75
- return value;
76
- }
77
- }
78
- return null;
79
- }
80
-
81
- function getStringPropertyValue(prop: ObjectProperty, propName: string): string | null | undefined {
82
- const keyMatches =
83
- (prop.key.type === "Identifier" && prop.key.name === propName) ||
84
- (prop.key.type === "Literal" && prop.key.value === propName);
85
-
86
- if (!keyMatches) {
87
- return undefined;
88
- }
89
-
90
- // Only accept string literals — ignore template literals, identifiers, etc.
91
- if (prop.value.type === "Literal" && typeof prop.value.value === "string") {
92
- return prop.value.value;
93
- }
94
- return null; // dynamic path — silently skip
95
- }
1
+ import { readFileSync } from "node:fs";
2
+ import { parse, type CallExpression, type ObjectExpression, type ObjectProperty } from "yuku-parser";
3
+ import { detectLangFromPath, unwrapTSExpression } from "../server/lang-detect.ts";
4
+ import { walkAST } from "../shared/utils/ast-walk.ts";
5
+
6
+ /**
7
+ * Statically scans a server entry file and returns all `pagesDir` string
8
+ * literal values found inside `furin({ pagesDir: "..." })` call expressions.
9
+ *
10
+ * Dynamic paths (template literals, variables) are silently ignored.
11
+ * Returns an empty array when nothing is detected.
12
+ */
13
+ export function scanFurinInstances(serverEntryPath: string): string[] {
14
+ const code = readFileSync(serverEntryPath, "utf8");
15
+ const lang = detectLangFromPath(serverEntryPath);
16
+
17
+ // Declaration files contain no runtime code — skip parsing.
18
+ if (lang === "dts") {
19
+ return [];
20
+ }
21
+
22
+ const { program, diagnostics } = parse(code, { sourceType: "module", lang });
23
+ const firstError = diagnostics.find((d) => d.severity === "error");
24
+ if (firstError) {
25
+ console.error("[furin] scan-server: parse error:", firstError.message, "in", serverEntryPath);
26
+ return [];
27
+ }
28
+
29
+ const results: string[] = [];
30
+ walkAST(program, (node) => {
31
+ if (node.type === "CallExpression") {
32
+ checkFurinCall(node as unknown as CallExpression, results);
33
+ }
34
+ });
35
+ return results;
36
+ }
37
+
38
+ /** Checks whether `node` is a `furin({ pagesDir: "..." })` call and, if so, pushes the value. */
39
+ function checkFurinCall(node: CallExpression, out: string[]): void {
40
+ const isFurinCall = node.callee.type === "Identifier" && node.callee.name === "furin";
41
+
42
+ if (!isFurinCall || node.arguments.length === 0) {
43
+ return;
44
+ }
45
+
46
+ // Unwrap TS expression wrappers like `furin({...} as Config)` or
47
+ // `furin({...} satisfies Options)` so we still see the ObjectExpression.
48
+ const firstArgNode = node.arguments[0];
49
+ if (!firstArgNode) {
50
+ return;
51
+ }
52
+ const firstArg = unwrapTSExpression(firstArgNode);
53
+ if (!isObjectExpressionNode(firstArg)) {
54
+ return;
55
+ }
56
+
57
+ const pagesDir = extractStringProperty(firstArg, "pagesDir");
58
+ if (pagesDir !== null) {
59
+ out.push(pagesDir);
60
+ }
61
+ }
62
+
63
+ function isObjectExpressionNode(node: { type: string }): node is ObjectExpression {
64
+ return node.type === "ObjectExpression";
65
+ }
66
+
67
+ function extractStringProperty(obj: ObjectExpression, propName: string): string | null {
68
+ for (const prop of obj.properties) {
69
+ if (prop.type !== "Property") {
70
+ continue;
71
+ }
72
+ const value = getStringPropertyValue(prop, propName);
73
+
74
+ if (value !== undefined) {
75
+ return value;
76
+ }
77
+ }
78
+ return null;
79
+ }
80
+
81
+ function getStringPropertyValue(prop: ObjectProperty, propName: string): string | null | undefined {
82
+ const keyMatches =
83
+ (prop.key.type === "Identifier" && prop.key.name === propName) ||
84
+ (prop.key.type === "Literal" && prop.key.value === propName);
85
+
86
+ if (!keyMatches) {
87
+ return undefined;
88
+ }
89
+
90
+ // Only accept string literals — ignore template literals, identifiers, etc.
91
+ if (prop.value.type === "Literal" && typeof prop.value.value === "string") {
92
+ return prop.value.value;
93
+ }
94
+ return null; // dynamic path — silently skip
95
+ }
@@ -1,36 +1,36 @@
1
- import { writeFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { buildEntrySource, type BuildEntryOptions } from "./entry-template";
4
- import { ensureDir } from "./shared";
5
-
6
- /**
7
- * Generates `server.ts` — an intermediate entry used to produce `server.js`.
8
- *
9
- * Equivalent to `_compile-entry.ts` but for disk (non-binary) production builds:
10
- * 1. Statically imports every page module so Bun bundles them into server.js
11
- * 2. Sets production mode and registers everything in a single CompileContext
12
- * 3. Imports server.ts to boot the app
13
- *
14
- * This file is intermediate: `adapter/bun.ts` runs `Bun.build()` on it to produce
15
- * the self-contained `server.js` bundle, then deletes this file.
16
- */
17
- export function generateServerRoutesEntry(options: BuildEntryOptions): string {
18
- const { buildId, outDir, rootPath, routes, serverEntry, rootConventions, routeMetadata, ssgCache } =
19
- options;
20
- ensureDir(outDir);
21
- const source = buildEntrySource({
22
- buildId,
23
- headerComment: "// Auto-generated by furin build — do not edit",
24
- rootPath,
25
- routes,
26
- serverEntry,
27
- rootConventions,
28
- routeMetadata,
29
- ssgCache,
30
- });
31
-
32
- // Named "server.ts" so Bun.build() outputs "server.js"
33
- const entryPath = join(outDir, "server.ts");
34
- writeFileSync(entryPath, source);
35
- return entryPath;
36
- }
1
+ import { writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { buildEntrySource, type BuildEntryOptions } from "./entry-template";
4
+ import { ensureDir } from "./shared";
5
+
6
+ /**
7
+ * Generates `server.ts` — an intermediate entry used to produce `server.js`.
8
+ *
9
+ * Equivalent to `_compile-entry.ts` but for disk (non-binary) production builds:
10
+ * 1. Statically imports every page module so Bun bundles them into server.js
11
+ * 2. Sets production mode and registers everything in a single CompileContext
12
+ * 3. Imports server.ts to boot the app
13
+ *
14
+ * This file is intermediate: `adapter/bun.ts` runs `Bun.build()` on it to produce
15
+ * the self-contained `server.js` bundle, then deletes this file.
16
+ */
17
+ export function generateServerRoutesEntry(options: BuildEntryOptions): string {
18
+ const { buildId, outDir, rootPath, routes, serverEntry, rootConventions, routeMetadata, ssgCache } =
19
+ options;
20
+ ensureDir(outDir);
21
+ const source = buildEntrySource({
22
+ buildId,
23
+ headerComment: "// Auto-generated by furin build — do not edit",
24
+ rootPath,
25
+ routes,
26
+ serverEntry,
27
+ rootConventions,
28
+ routeMetadata,
29
+ ssgCache,
30
+ });
31
+
32
+ // Named "server.ts" so Bun.build() outputs "server.js"
33
+ const entryPath = join(outDir, "server.ts");
34
+ writeFileSync(entryPath, source);
35
+ return entryPath;
36
+ }
@@ -1,78 +1,80 @@
1
- import { cpSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
2
- import { join, relative } from "node:path";
3
- import type { BuildTarget } from "../config";
4
- import type { ResolvedRoute } from "../server/router/index.ts";
5
- import type { BuildRouteManifestEntry, TargetBuildManifest } from "./types";
6
-
7
- // import.meta.dir/path/url are inlined at bundle time to the OUTPUT file's
8
- // location — so relative paths break when bundled. import.meta.resolve() is a
9
- // function call (not inlined), runs at runtime, and resolves through package
10
- // exports. This is the Web-standard approach (Bun, Node 20.6+, browsers).
11
- export const CLIENT_MODULE_PATH = new URL(import.meta.resolve("@teyik0/furin/client")).pathname;
12
- export const LINK_MODULE_PATH = new URL(import.meta.resolve("@teyik0/furin/link")).pathname;
13
-
14
- export function ensureDir(path: string): void {
15
- if (!existsSync(path)) {
16
- mkdirSync(path, { recursive: true });
17
- }
18
- }
19
-
20
- export function toPosixPath(path: string): string {
21
- return path.replace(/\\/g, "/");
22
- }
23
-
24
- export function collectFilesRecursive(dir: string): string[] {
25
- const files: string[] = [];
26
- const entries = readdirSync(dir, { withFileTypes: true });
27
-
28
- for (const entry of entries) {
29
- const absolutePath = join(dir, entry.name);
30
- if (entry.isDirectory()) {
31
- files.push(...collectFilesRecursive(absolutePath));
32
- continue;
33
- }
34
- if (entry.isFile()) {
35
- files.push(absolutePath);
36
- }
37
- }
38
-
39
- return files.sort();
40
- }
41
-
42
- export function copyDirRecursive(sourceDir: string, targetDir: string): void {
43
- rmSync(targetDir, { force: true, recursive: true });
44
- cpSync(sourceDir, targetDir, { recursive: true });
45
- }
46
-
47
- export function toBuildRouteManifestEntry(
48
- route: ResolvedRoute,
49
- rootDir: string
50
- ): BuildRouteManifestEntry {
51
- return {
52
- pattern: route.pattern,
53
- mode: route.mode,
54
- pagePath: toPosixPath(relative(rootDir, route.path)),
55
- hasLayout: route.routeChain.some((entry) => !!entry.layout),
56
- hasStaticParams: !!route.page?.staticParams,
57
- revalidate: route.page?._route.revalidate ?? null,
58
- };
59
- }
60
-
61
- export function buildTargetManifest(
62
- rootDir: string,
63
- buildRoot: string,
64
- target: BuildTarget,
65
- serverEntry: string | null
66
- ): TargetBuildManifest {
67
- const targetDir = join(buildRoot, target);
68
-
69
- return {
70
- buildId: "", // populated by adapter after buildClient() completes
71
- generatedAt: new Date().toISOString(),
72
- targetDir: toPosixPath(relative(rootDir, targetDir)),
73
- clientDir: toPosixPath(relative(rootDir, join(targetDir, "client"))),
74
- templatePath: toPosixPath(relative(rootDir, join(targetDir, "client", "index.html"))),
75
- serverPath: null,
76
- serverEntry: serverEntry ? toPosixPath(relative(rootDir, serverEntry)) : null,
77
- };
78
- }
1
+ import { cpSync, existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
2
+ import { join, relative } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import type { BuildTarget } from "../config";
5
+ import type { ResolvedRoute } from "../server/router/index.ts";
6
+ import type { BuildRouteManifestEntry, TargetBuildManifest } from "./types";
7
+
8
+ // import.meta.dir/path/url are inlined at bundle time to the OUTPUT file's
9
+ // location — so relative paths break when bundled. import.meta.resolve() is a
10
+ // function call (not inlined), runs at runtime, and resolves through package
11
+ // exports. This is the Web-standard approach (Bun, Node 20.6+, browsers).
12
+ export const CLIENT_MODULE_PATH = fileURLToPath(import.meta.resolve("@teyik0/furin/client"));
13
+ export const LINK_MODULE_PATH = fileURLToPath(import.meta.resolve("@teyik0/furin/link"));
14
+ export const SEARCH_MODULE_PATH = fileURLToPath(import.meta.resolve("@teyik0/furin/search"));
15
+
16
+ export function ensureDir(path: string): void {
17
+ if (!existsSync(path)) {
18
+ mkdirSync(path, { recursive: true });
19
+ }
20
+ }
21
+
22
+ export function toPosixPath(path: string): string {
23
+ return path.replace(/\\/g, "/");
24
+ }
25
+
26
+ export function collectFilesRecursive(dir: string): string[] {
27
+ const files: string[] = [];
28
+ const entries = readdirSync(dir, { withFileTypes: true });
29
+
30
+ for (const entry of entries) {
31
+ const absolutePath = join(dir, entry.name);
32
+ if (entry.isDirectory()) {
33
+ files.push(...collectFilesRecursive(absolutePath));
34
+ continue;
35
+ }
36
+ if (entry.isFile()) {
37
+ files.push(absolutePath);
38
+ }
39
+ }
40
+
41
+ return files.sort();
42
+ }
43
+
44
+ export function copyDirRecursive(sourceDir: string, targetDir: string): void {
45
+ rmSync(targetDir, { force: true, recursive: true });
46
+ cpSync(sourceDir, targetDir, { recursive: true });
47
+ }
48
+
49
+ export function toBuildRouteManifestEntry(
50
+ route: ResolvedRoute,
51
+ rootDir: string
52
+ ): BuildRouteManifestEntry {
53
+ return {
54
+ pattern: route.pattern,
55
+ mode: route.mode,
56
+ pagePath: toPosixPath(relative(rootDir, route.path)),
57
+ hasLayout: route.routeChain.some((entry) => !!entry.layout),
58
+ hasStaticParams: !!route.page?.staticParams,
59
+ revalidate: route.page?._route.revalidate ?? null,
60
+ };
61
+ }
62
+
63
+ export function buildTargetManifest(
64
+ rootDir: string,
65
+ buildRoot: string,
66
+ target: BuildTarget,
67
+ serverEntry: string | null
68
+ ): TargetBuildManifest {
69
+ const targetDir = join(buildRoot, target);
70
+
71
+ return {
72
+ buildId: "", // populated by adapter after buildClient() completes
73
+ generatedAt: new Date().toISOString(),
74
+ targetDir: toPosixPath(relative(rootDir, targetDir)),
75
+ clientDir: toPosixPath(relative(rootDir, join(targetDir, "client"))),
76
+ templatePath: toPosixPath(relative(rootDir, join(targetDir, "client", "index.html"))),
77
+ serverPath: null,
78
+ serverEntry: serverEntry ? toPosixPath(relative(rootDir, serverEntry)) : null,
79
+ };
80
+ }
@@ -1,31 +1,32 @@
1
- import type { SsgCacheEntry } from "../server/cache/index.ts";
2
- import { prerenderSSG } from "../server/render/index.ts";
3
- import type { ResolvedRoute, RootLayout } from "../server/router/index.ts";
4
- import { resolvePath } from "../server/render/assemble.ts";
5
-
6
- export type SSGCacheSnapshot = Record<string, SsgCacheEntry>;
7
-
8
- export async function buildSSGCacheSnapshot(
9
- routes: ResolvedRoute[],
10
- root: RootLayout,
11
- origin: string
12
- ): Promise<SSGCacheSnapshot> {
13
- const snapshot: SSGCacheSnapshot = {};
14
-
15
- for (const route of routes) {
16
- if (route.mode !== "ssg" || !route.page.staticParams) {
17
- continue;
18
- }
19
-
20
- const paramSets = await route.page.staticParams();
21
- for (const params of paramSets) {
22
- const entry = await prerenderSSG(route, params, root, origin, undefined);
23
- if (entry instanceof Response) {
24
- continue;
25
- }
26
- snapshot[resolvePath(route.pattern, params)] = entry;
27
- }
28
- }
29
-
30
- return snapshot;
31
- }
1
+ import type { SsgCacheEntry } from "../server/cache/index.ts";
2
+ import { prerenderSSG } from "../server/render/index.ts";
3
+ import { createSearchRouteMetadata, type ResolvedRoute, type RootLayout } from "../server/router/index.ts";
4
+ import { resolvePath } from "../server/render/assemble.ts";
5
+
6
+ export type SSGCacheSnapshot = Record<string, SsgCacheEntry>;
7
+
8
+ export async function buildSSGCacheSnapshot(
9
+ routes: ResolvedRoute[],
10
+ root: RootLayout,
11
+ origin: string
12
+ ): Promise<SSGCacheSnapshot> {
13
+ const snapshot: SSGCacheSnapshot = {};
14
+ const searchRoutes = createSearchRouteMetadata(routes);
15
+
16
+ for (const route of routes) {
17
+ if (route.mode !== "ssg" || !route.page.staticParams) {
18
+ continue;
19
+ }
20
+
21
+ const paramSets = await route.page.staticParams();
22
+ for (const params of paramSets) {
23
+ const entry = await prerenderSSG(route, params, root, origin, undefined, searchRoutes);
24
+ if (entry instanceof Response) {
25
+ continue;
26
+ }
27
+ snapshot[resolvePath(route.pattern, params)] = entry;
28
+ }
29
+ }
30
+
31
+ return snapshot;
32
+ }