fimo 0.5.0 → 0.6.0-experimental.2
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/assets/content-templates/hooks-template.eta +83 -38
- package/assets/content-templates/types-template.eta +6 -2
- package/assets/skills/fimo/SKILL.md +1 -1
- package/assets/skills/fimo/references/content.md +13 -14
- package/assets/skills/fimo/references/locales.md +8 -0
- package/assets/skills/fimo/references/setup-react-router.md +2 -2
- package/assets/skills/fimo/references/ui.md +1 -1
- package/assets/skills/fimo-cli/references/content.md +9 -6
- package/assets/skills/fimo-cli/references/locales.md +6 -0
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +112 -55
- package/dist/runtime/app/prefetch.js +1 -1
- package/dist/runtime/content/utils/retrieve-data-sources.d.ts +1 -0
- package/dist/runtime/content/utils/retrieve-data-sources.d.ts.map +1 -1
- package/dist/runtime/content/utils/retrieve-data-sources.js +27 -4
- package/dist/runtime/paths/get-fimo-paths.d.ts.map +1 -1
- package/dist/runtime/paths/get-fimo-paths.js +16 -6
- package/dist/runtime/paths/get-fimo-paths.test.d.ts +2 -0
- package/dist/runtime/paths/get-fimo-paths.test.d.ts.map +1 -0
- package/dist/runtime/paths/get-fimo-paths.test.js +69 -0
- package/dist/runtime/primitives/lib/query.d.ts +11 -9
- package/dist/runtime/primitives/lib/query.d.ts.map +1 -1
- package/dist/runtime/primitives/public-surface.test.js +3 -3
- package/dist/runtime/seo/buildSeoForPath.d.ts +1 -3
- package/dist/runtime/seo/buildSeoForPath.d.ts.map +1 -1
- package/dist/runtime/seo/buildSeoForPath.js +4 -1
- package/dist/scripts/resolve-routes.js +1 -1
- package/dist/scripts/sync-schemas.test.js +14 -3
- package/package.json +2 -2
- package/release.json +2 -2
- package/templates/react-router/package.json +10 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSeoForPath.d.ts","sourceRoot":"","sources":["../../../src/runtime/seo/buildSeoForPath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAK1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAExF;AA+BD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMrE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"buildSeoForPath.d.ts","sourceRoot":"","sources":["../../../src/runtime/seo/buildSeoForPath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAK1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAExF;AA+BD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMrE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAclG"}
|
|
@@ -42,7 +42,10 @@ export function buildMetaForPath(pathname, routeData) {
|
|
|
42
42
|
}
|
|
43
43
|
export function buildFimoMeta(args) {
|
|
44
44
|
const pathname = args.location.pathname;
|
|
45
|
-
const
|
|
45
|
+
const firstMatch = args.matches[0];
|
|
46
|
+
const rootData = firstMatch && typeof firstMatch === 'object' && 'data' in firstMatch
|
|
47
|
+
? firstMatch.data
|
|
48
|
+
: undefined;
|
|
46
49
|
const routeData = rootData && typeof rootData === 'object' ? rootData.fimoMetaData : undefined;
|
|
47
50
|
const seo = getSeoForPath(pathname, routeData);
|
|
48
51
|
if (!seo) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Given a list of changed files, resolves which preview routes are affected
|
|
5
5
|
* by walking the reverse import graph from changed files up to page entry points
|
|
6
|
-
* referenced in src/routes.ts (
|
|
6
|
+
* referenced in src/routes.ts (React Router framework-mode config).
|
|
7
7
|
*
|
|
8
8
|
* Output (JSON):
|
|
9
9
|
* {
|
|
@@ -37,6 +37,8 @@ describe('syncSchemas', () => {
|
|
|
37
37
|
const post = readFileSync(join(scratch, 'src/schemas/Post.ts'), 'utf-8');
|
|
38
38
|
const postTypes = readFileSync(join(scratch, 'src/schemas/Post.types.ts'), 'utf-8');
|
|
39
39
|
expect(post).toContain('import { wrapWithSource as wrapAuthorWithSource } from "./Author";');
|
|
40
|
+
expect(post).toContain('isPopulatedEntry(value) ? wrapAuthorWithSource(value) : value');
|
|
41
|
+
expect(post).toContain('function isPopulatedEntry(value: unknown): value is PopulatedEntryRecord');
|
|
40
42
|
expect(post).toContain('import type { Post, PostInput, PostPopulate, PostResult, PostFields, PostQuery } from "./Post.types";');
|
|
41
43
|
expect(post).toContain('from "./Post.types";');
|
|
42
44
|
expect(post).not.toContain('import type { Author } from "./Author";');
|
|
@@ -47,9 +49,14 @@ describe('syncSchemas', () => {
|
|
|
47
49
|
expect(post).toContain('wrapAuthorWithSource(value)');
|
|
48
50
|
expect(post).toContain('wrapWithSource(value)');
|
|
49
51
|
expect(post).toContain('export async function create(payload: PostInput): Promise<Post>');
|
|
52
|
+
expect(post).toContain('export async function getByDocumentId');
|
|
53
|
+
expect(post).toContain('/v2/entries/Post/');
|
|
50
54
|
expect(post).toContain('return wrapWithSource(data.data);');
|
|
51
55
|
expect(postTypes).toContain('import type { Author } from "./Author.types";');
|
|
52
56
|
expect(postTypes).toContain('export interface Post extends WithReferences<PostReferences>');
|
|
57
|
+
expect(postTypes).not.toContain(' id: string;');
|
|
58
|
+
expect(postTypes).toContain(' documentId: string;');
|
|
59
|
+
expect(postTypes).toContain(' locale: string;');
|
|
53
60
|
expect(postTypes).toContain('type FimoReference');
|
|
54
61
|
expect(postTypes).toContain('author: FimoReference | null;');
|
|
55
62
|
expect(postTypes).toContain('contributors: FimoReference[];');
|
|
@@ -88,15 +95,15 @@ describe('syncSchemas', () => {
|
|
|
88
95
|
const settings = readFileSync(join(scratch, 'src/schemas/Settings.ts'), 'utf-8');
|
|
89
96
|
const settingsTypes = readFileSync(join(scratch, 'src/schemas/Settings.types.ts'), 'utf-8');
|
|
90
97
|
const homepageTypes = readFileSync(join(scratch, 'src/schemas/Homepage.types.ts'), 'utf-8');
|
|
91
|
-
expect(settingsTypes).
|
|
98
|
+
expect(settingsTypes).toContain('locale: string;');
|
|
92
99
|
expect(settingsTypes).not.toContain('locale?: string;');
|
|
93
100
|
expect(homepageTypes).toContain('locale: string;');
|
|
94
101
|
expect(settings).toContain('const LOCALIZED_CONTENT = false;');
|
|
95
102
|
expect(settings).toContain('const LOCALIZED_REFERENCE_FIELDS = new Set<string>(["homepage"]);');
|
|
96
|
-
expect(settings).
|
|
103
|
+
expect(settings).toContain(' locale,');
|
|
97
104
|
expect(settings).toContain('readLocale(params, LOCALIZED_CONTENT, useQueryLocale(params.locale))');
|
|
98
105
|
expect(settings.match(/readLocale\(params, LOCALIZED_CONTENT, useQueryLocale\(params\.locale\)\)/g)?.length).toBe(4);
|
|
99
|
-
expect(settings.match(/
|
|
106
|
+
expect(settings.match(/const locale = useQueryLocale\(options\.locale\);/g)?.length).toBe(2);
|
|
100
107
|
});
|
|
101
108
|
it('generates singleton document APIs without collection mutations', () => {
|
|
102
109
|
writeSchema('Settings', {
|
|
@@ -110,6 +117,10 @@ describe('syncSchemas', () => {
|
|
|
110
117
|
const settings = readFileSync(join(scratch, 'src/schemas/Settings.ts'), 'utf-8');
|
|
111
118
|
const settingsTypes = readFileSync(join(scratch, 'src/schemas/Settings.types.ts'), 'utf-8');
|
|
112
119
|
expect(settings).toContain('fetch(`${base}${withReadOptions(`/documents/Settings`, options)}`');
|
|
120
|
+
expect(settings).toContain('const usesV2Identity = typeof id !== "string";');
|
|
121
|
+
expect(settings).toContain('`Settings.v2:${documentId}:${encodeURIComponent(locale)}`');
|
|
122
|
+
expect(settingsTypes).toContain('id?: string;');
|
|
123
|
+
expect(settingsTypes).toContain('locale?: string;');
|
|
113
124
|
expect(settings).toContain('export async function update(payload: Partial<SettingsInput>)');
|
|
114
125
|
expect(settings).toContain('export function useSuspenseGet');
|
|
115
126
|
expect(settings).not.toContain('export async function create(');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fimo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-experimental.2",
|
|
4
4
|
"description": "Fimo CLI - create, deploy, and manage Fimo projects",
|
|
5
5
|
"bin": {
|
|
6
6
|
"fimo": "dist/cli/index.js"
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@tanstack/react-query": "^5.80.6",
|
|
100
100
|
"react": "^19.0.0",
|
|
101
101
|
"react-dom": "^19.0.0",
|
|
102
|
-
"react-router": "^7.0.0",
|
|
102
|
+
"react-router": "^7.0.0 || ^8.0.0",
|
|
103
103
|
"vite": "^7.0.0 || ^8.0.0"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
package/release.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "react-router dev --port 5173",
|
|
8
|
-
"build": "react-router build && fimo export-static",
|
|
8
|
+
"build": "tsc --noEmit && react-router build && fimo export-static",
|
|
9
9
|
"lint": "oxlint --deny-warnings",
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
11
11
|
"preview": "vite preview --host 0.0.0.0 --port 4173"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@base-ui/react": "^1.3.0",
|
|
15
15
|
"@hookform/resolvers": "^5.2.2",
|
|
16
|
-
"@react-router/node": "^
|
|
16
|
+
"@react-router/node": "^8.2.0",
|
|
17
17
|
"@tailwindcss/typography": "^0.5.19",
|
|
18
18
|
"@tanstack/react-query": "^5.80.6",
|
|
19
19
|
"class-variance-authority": "^0.7.1",
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"cmdk": "^1.1.1",
|
|
22
22
|
"date-fns": "^4.1.0",
|
|
23
23
|
"embla-carousel-react": "^8.6.0",
|
|
24
|
-
"fimo": "0.
|
|
24
|
+
"fimo": "0.6.0-experimental.2",
|
|
25
25
|
"input-otp": "^1.4.2",
|
|
26
26
|
"isbot": "^5",
|
|
27
27
|
"lucide-react": "^0.577.0",
|
|
28
28
|
"motion": "^12.36.0",
|
|
29
29
|
"next-themes": "^0.4.6",
|
|
30
30
|
"radix-ui": "^1.4.3",
|
|
31
|
-
"react": "^19.2.
|
|
31
|
+
"react": "^19.2.7",
|
|
32
32
|
"react-day-picker": "^9.14.0",
|
|
33
|
-
"react-dom": "^19.2.
|
|
33
|
+
"react-dom": "^19.2.7",
|
|
34
34
|
"react-error-boundary": "^6.0.0",
|
|
35
35
|
"react-hook-form": "^7.72.1",
|
|
36
36
|
"react-resizable-panels": "^4.9.0",
|
|
37
|
-
"react-router": "^
|
|
37
|
+
"react-router": "^8.2.0",
|
|
38
38
|
"recharts": "^3.8.0",
|
|
39
39
|
"sonner": "^2.0.7",
|
|
40
40
|
"tailwind-merge": "^3.2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"zod": "^4.3.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@react-router/dev": "^
|
|
45
|
+
"@react-router/dev": "^8.2.0",
|
|
46
46
|
"@tailwindcss/vite": "^4.3.0",
|
|
47
47
|
"@types/node": "^24.12.0",
|
|
48
48
|
"@types/react": "^19.2.14",
|
|
@@ -52,5 +52,8 @@
|
|
|
52
52
|
"tw-animate-css": "^1.4.0",
|
|
53
53
|
"typescript": "5.9.3",
|
|
54
54
|
"vite": "^8.0.13"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.22.0"
|
|
55
58
|
}
|
|
56
59
|
}
|