fimo 0.3.1 → 0.3.2-experimental.1783328062928
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 +6 -12
- package/assets/agents-starter/AGENTS.md +14 -2
- package/assets/skills/fimo/SKILL.md +1 -1
- package/assets/skills/fimo/references/content.md +14 -2
- package/assets/skills/fimo/references/setup-plain-vite.md +8 -3
- package/assets/skills/fimo/references/setup-react-router.md +13 -6
- package/assets/skills/fimo/references/ui.md +1 -1
- package/assets/skills/fimo-cli/SKILL.md +30 -18
- package/assets/skills/fimo-cli/references/account.md +4 -2
- package/assets/skills/fimo-cli/references/agent-setup.md +14 -16
- package/assets/skills/fimo-cli/references/agents.md +2 -0
- package/assets/skills/fimo-cli/references/analytics.md +2 -0
- package/assets/skills/fimo-cli/references/assets.md +2 -0
- package/assets/skills/fimo-cli/references/branches.md +2 -0
- package/assets/skills/fimo-cli/references/content.md +3 -1
- package/assets/skills/fimo-cli/references/credits.md +2 -0
- package/assets/skills/fimo-cli/references/deploy.md +10 -4
- package/assets/skills/fimo-cli/references/describe.md +2 -0
- package/assets/skills/fimo-cli/references/domains.md +2 -0
- package/assets/skills/fimo-cli/references/forms.md +2 -0
- package/assets/skills/fimo-cli/references/init.md +114 -0
- package/assets/skills/fimo-cli/references/integrations/firecrawl.md +2 -0
- package/assets/skills/fimo-cli/references/integrations.md +2 -0
- package/assets/skills/fimo-cli/references/invite.md +2 -0
- package/assets/skills/fimo-cli/references/labels.md +2 -0
- package/assets/skills/fimo-cli/references/locales.md +2 -0
- package/assets/skills/fimo-cli/references/media.md +2 -0
- package/assets/skills/fimo-cli/references/preview.md +2 -0
- package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +3 -1
- package/assets/skills/fimo-cli/references/projects.md +5 -3
- package/assets/skills/fimo-cli/references/schedules.md +2 -0
- package/assets/skills/fimo-migration/SKILL.md +16 -1
- package/assets/skills/fimo-migration/references/manifest.md +40 -1
- package/assets/skills/fimo-migration/references/qa.md +21 -2
- package/assets/skills/fimo-migration/references/workflow.md +12 -1
- package/assets/skills/fimo-migration/references/wrap.md +155 -0
- package/assets/skills/fimo-studio/references/visual-editing.md +5 -3
- package/dist/build/vite/index.d.ts.map +1 -1
- package/dist/build/vite/index.js +8 -6
- package/dist/build/vite/plugins/translations.d.ts +2 -8
- package/dist/build/vite/plugins/translations.d.ts.map +1 -1
- package/dist/build/vite/plugins/translations.js +3 -121
- package/dist/cli/bundle.json +2 -2
- package/dist/cli/index.js +4547 -3255
- package/dist/runtime/app/FimoProviders.d.ts +1 -11
- package/dist/runtime/app/FimoProviders.d.ts.map +1 -1
- package/dist/runtime/app/FimoProviders.js +2 -23
- package/dist/runtime/i18n/FimoLocaleContext.d.ts.map +1 -1
- package/dist/runtime/i18n/FimoLocaleContext.js +1 -0
- package/dist/runtime/next/FimoFileLink.d.ts +17 -0
- package/dist/runtime/next/FimoFileLink.d.ts.map +1 -0
- package/dist/runtime/next/FimoFileLink.js +19 -0
- package/dist/runtime/next/FimoMediaImage.d.ts +14 -0
- package/dist/runtime/next/FimoMediaImage.d.ts.map +1 -0
- package/dist/runtime/next/FimoMediaImage.js +20 -0
- package/dist/runtime/next/FimoMediaVideo.d.ts +14 -0
- package/dist/runtime/next/FimoMediaVideo.d.ts.map +1 -0
- package/dist/runtime/next/FimoMediaVideo.js +20 -0
- package/dist/runtime/next/FimoNextProviders.d.ts +30 -0
- package/dist/runtime/next/FimoNextProviders.d.ts.map +1 -0
- package/dist/runtime/next/FimoNextProviders.js +106 -0
- package/dist/runtime/next/FimoNextScripts.d.ts +10 -0
- package/dist/runtime/next/FimoNextScripts.d.ts.map +1 -0
- package/dist/runtime/next/FimoNextScripts.js +19 -0
- package/dist/runtime/next/FimoRichTextBlock.d.ts +23 -0
- package/dist/runtime/next/FimoRichTextBlock.d.ts.map +1 -0
- package/dist/runtime/next/FimoRichTextBlock.js +22 -0
- package/dist/runtime/next/FimoText.d.ts +22 -0
- package/dist/runtime/next/FimoText.d.ts.map +1 -0
- package/dist/runtime/next/FimoText.js +20 -0
- package/dist/runtime/next/WrappedContentContext.d.ts +28 -0
- package/dist/runtime/next/WrappedContentContext.d.ts.map +1 -0
- package/dist/runtime/next/WrappedContentContext.js +30 -0
- package/dist/runtime/next/index.d.ts +14 -0
- package/dist/runtime/next/index.d.ts.map +1 -0
- package/dist/runtime/next/index.js +14 -0
- package/dist/runtime/next/server.d.ts +33 -0
- package/dist/runtime/next/server.d.ts.map +1 -0
- package/dist/runtime/next/server.js +107 -0
- package/dist/runtime/primitives/labels-hook.d.ts +33 -0
- package/dist/runtime/primitives/labels-hook.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-hook.js +41 -0
- package/dist/runtime/primitives/labels-store.d.ts +12 -0
- package/dist/runtime/primitives/labels-store.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-store.js +60 -0
- package/dist/runtime/primitives/labels-store.test.d.ts +2 -0
- package/dist/runtime/primitives/labels-store.test.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-store.test.js +66 -0
- package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts +5 -3
- package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts.map +1 -1
- package/dist/runtime/primitives/lib/useFimoLiveValue.js +8 -4
- package/dist/runtime/primitives/translations.d.ts +1 -27
- package/dist/runtime/primitives/translations.d.ts.map +1 -1
- package/dist/runtime/primitives/translations.js +7 -85
- package/dist/runtime/react/index.d.ts +24 -0
- package/dist/runtime/react/index.d.ts.map +1 -0
- package/dist/runtime/react/index.js +28 -0
- package/dist/runtime/shared/display-routes.d.ts +14 -0
- package/dist/runtime/shared/display-routes.d.ts.map +1 -0
- package/dist/runtime/shared/display-routes.js +25 -0
- package/dist/runtime/shared/fimo-config.server.d.ts.map +1 -1
- package/dist/runtime/shared/fimo-config.server.js +1 -0
- package/dist/runtime/shared/fimo-config.types.d.ts +2 -0
- package/dist/runtime/shared/fimo-config.types.d.ts.map +1 -1
- package/dist/runtime/shared/labels-fetch.server.d.ts +14 -0
- package/dist/runtime/shared/labels-fetch.server.d.ts.map +1 -0
- package/dist/runtime/shared/labels-fetch.server.js +145 -0
- package/dist/scripts/detect-framework.d.ts +12 -0
- package/dist/scripts/detect-framework.js +32 -0
- package/dist/scripts/detect-framework.test.d.ts +1 -0
- package/dist/scripts/detect-framework.test.js +39 -0
- package/dist/scripts/lib/discover-next-routes.d.ts +11 -0
- package/dist/scripts/lib/discover-next-routes.js +76 -0
- package/dist/scripts/lib/discover-next-routes.test.d.ts +1 -0
- package/dist/scripts/lib/discover-next-routes.test.js +40 -0
- package/dist/scripts/scan-wrappable.d.ts +29 -0
- package/dist/scripts/scan-wrappable.js +191 -0
- package/dist/scripts/scan-wrappable.test.d.ts +1 -0
- package/dist/scripts/scan-wrappable.test.js +48 -0
- package/dist/scripts/validate-route-metadata.js +11 -0
- package/dist/scripts/validate-schemas.d.ts +13 -0
- package/dist/scripts/validate-schemas.js +113 -0
- package/dist/scripts/validate-schemas.test.d.ts +1 -0
- package/dist/scripts/validate-schemas.test.js +132 -0
- package/package.json +29 -1
- package/release.json +2 -2
- package/scripts/postinstall.mjs +10 -54
- package/templates/react-router/package.json +1 -1
- package/assets/agents-starter/claude/settings.json +0 -19
- package/assets/skills/fimo-cli/references/create.md +0 -90
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/translations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAElD,OAAO,EAIL,eAAe,EAIhB,MAAM,gDAAgD,CAAC;AA2CxD,MAAM,CAAC,OAAO,UAAU,kBAAkB,IAAI,MAAM,CAmOnD;AA4CD,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { Buffer } from 'node:buffer';
|
|
3
2
|
import { readFile } from 'node:fs/promises';
|
|
4
3
|
import { homedir } from 'node:os';
|
|
5
4
|
import { join } from 'node:path';
|
|
6
|
-
import {
|
|
7
|
-
import { getConfigServer } from '../../../runtime/shared/fimo-config.server.js';
|
|
5
|
+
import { emptyLabelBundle, labelSignature, loadLabelBundle, readProjectEnv, resolveTenantApiUrl, serializeBundle, } from '../../../runtime/shared/labels-fetch.server.js';
|
|
8
6
|
const VIRTUAL_ID = 'virtual:translations';
|
|
9
7
|
const RESOLVED_ID = '\0' + VIRTUAL_ID;
|
|
10
8
|
export default function translationsPlugin() {
|
|
@@ -145,7 +143,7 @@ export default function translationsPlugin() {
|
|
|
145
143
|
};
|
|
146
144
|
async function connectLabelEvents(root, onLabelsChanged) {
|
|
147
145
|
const env = await readProjectEnv(root);
|
|
148
|
-
const apiUrl = env
|
|
146
|
+
const apiUrl = resolveTenantApiUrl(env);
|
|
149
147
|
if (!apiUrl) {
|
|
150
148
|
return [];
|
|
151
149
|
}
|
|
@@ -229,24 +227,6 @@ function parseContentChangePayload(payload) {
|
|
|
229
227
|
updatedAt: typeof source.updatedAt === 'string' ? source.updatedAt : undefined,
|
|
230
228
|
};
|
|
231
229
|
}
|
|
232
|
-
function serializeBundle(bundle) {
|
|
233
|
-
return JSON.stringify({
|
|
234
|
-
dictionaries: bundle.dictionaries,
|
|
235
|
-
defaultLocale: bundle.defaultLocale,
|
|
236
|
-
locales: bundle.locales,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
function emptyLabelBundle(rootDir) {
|
|
240
|
-
const config = getConfigServer(rootDir);
|
|
241
|
-
const defaultLocale = getFimoDefaultLocale(config);
|
|
242
|
-
const locales = getFimoLocales(config);
|
|
243
|
-
return {
|
|
244
|
-
dictionaries: Object.fromEntries(locales.map((locale) => [locale, {}])),
|
|
245
|
-
defaultLocale,
|
|
246
|
-
locales,
|
|
247
|
-
updatedAt: null,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
230
|
function findVirtualTranslationModules(server) {
|
|
251
231
|
const direct = server.moduleGraph.getModuleById(RESOLVED_ID);
|
|
252
232
|
const matches = new Set(direct ? [direct] : []);
|
|
@@ -257,73 +237,13 @@ function findVirtualTranslationModules(server) {
|
|
|
257
237
|
}
|
|
258
238
|
return [...matches];
|
|
259
239
|
}
|
|
260
|
-
function labelSignature(bundle) {
|
|
261
|
-
return Buffer.from(serializeBundle(bundle)).toString('base64');
|
|
262
|
-
}
|
|
263
240
|
function labelUpdatePayload(bundle) {
|
|
264
241
|
return {
|
|
265
242
|
...bundle,
|
|
266
243
|
signature: labelSignature(bundle),
|
|
267
244
|
};
|
|
268
245
|
}
|
|
269
|
-
export
|
|
270
|
-
const config = getConfigServer(rootDir);
|
|
271
|
-
const defaultLocale = getFimoDefaultLocale(config);
|
|
272
|
-
const locales = getFimoLocales(config);
|
|
273
|
-
const env = await readProjectEnv(rootDir);
|
|
274
|
-
const apiUrl = env.VITE_API_URL;
|
|
275
|
-
if (!apiUrl) {
|
|
276
|
-
return {
|
|
277
|
-
dictionaries: Object.fromEntries(locales.map((locale) => [locale, {}])),
|
|
278
|
-
defaultLocale,
|
|
279
|
-
locales,
|
|
280
|
-
updatedAt: null,
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
try {
|
|
284
|
-
const loaded = await Promise.all(locales.map((locale) => fetchLabelDictionary(apiUrl, locale).catch(() => ({ locale, labels: {}, updatedAt: null }))));
|
|
285
|
-
const updatedAt = loaded
|
|
286
|
-
.map((entry) => entry.updatedAt)
|
|
287
|
-
.filter((value) => typeof value === 'string')
|
|
288
|
-
.sort()
|
|
289
|
-
.at(-1);
|
|
290
|
-
return {
|
|
291
|
-
dictionaries: Object.fromEntries(loaded.map((entry) => [entry.locale, entry.labels])),
|
|
292
|
-
defaultLocale,
|
|
293
|
-
locales,
|
|
294
|
-
updatedAt: updatedAt ?? null,
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
catch {
|
|
298
|
-
return {
|
|
299
|
-
dictionaries: Object.fromEntries(locales.map((locale) => [locale, {}])),
|
|
300
|
-
defaultLocale,
|
|
301
|
-
locales,
|
|
302
|
-
updatedAt: null,
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
async function fetchLabelDictionary(apiUrl, locale) {
|
|
307
|
-
const url = new URL('/labels', apiUrl);
|
|
308
|
-
url.searchParams.set('locale', locale);
|
|
309
|
-
const response = await fetchWithTimeout(url, 4000);
|
|
310
|
-
if (!response.ok) {
|
|
311
|
-
return { locale, labels: {}, updatedAt: null };
|
|
312
|
-
}
|
|
313
|
-
const body = (await response.json());
|
|
314
|
-
if (Array.isArray(body.data)) {
|
|
315
|
-
return {
|
|
316
|
-
locale,
|
|
317
|
-
labels: Object.fromEntries(body.data.map((row) => [row.key, row.value ?? row.defaultValue ?? ''])),
|
|
318
|
-
updatedAt: null,
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
return {
|
|
322
|
-
locale,
|
|
323
|
-
labels: body.data?.labels ?? {},
|
|
324
|
-
updatedAt: body.data?.updatedAt ?? null,
|
|
325
|
-
};
|
|
326
|
-
}
|
|
246
|
+
export { loadLabelBundle };
|
|
327
247
|
async function loadRuntimeConfig(apiUrl) {
|
|
328
248
|
try {
|
|
329
249
|
const response = await fetchWithTimeout(new URL('/runtime-config', apiUrl), 2000);
|
|
@@ -358,44 +278,6 @@ async function fetchWithTimeout(url, timeoutMs) {
|
|
|
358
278
|
clearTimeout(timeout);
|
|
359
279
|
}
|
|
360
280
|
}
|
|
361
|
-
async function readProjectEnv(rootDir) {
|
|
362
|
-
const values = {
|
|
363
|
-
...(await readEnvFile(join(rootDir, '.env'))),
|
|
364
|
-
...(await readEnvFile(join(rootDir, '.env.local'))),
|
|
365
|
-
};
|
|
366
|
-
for (const key of ['VITE_API_URL']) {
|
|
367
|
-
if (process.env[key]) {
|
|
368
|
-
values[key] = process.env[key];
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return values;
|
|
372
|
-
}
|
|
373
|
-
async function readEnvFile(filePath) {
|
|
374
|
-
try {
|
|
375
|
-
const content = await readFile(filePath, 'utf8');
|
|
376
|
-
const values = {};
|
|
377
|
-
for (const line of content.split(/\r?\n/)) {
|
|
378
|
-
const trimmed = line.trim();
|
|
379
|
-
if (!trimmed || trimmed.startsWith('#')) {
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
const index = trimmed.indexOf('=');
|
|
383
|
-
if (index === -1) {
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
const key = trimmed.slice(0, index).trim();
|
|
387
|
-
const value = trimmed
|
|
388
|
-
.slice(index + 1)
|
|
389
|
-
.trim()
|
|
390
|
-
.replace(/^['"]|['"]$/g, '');
|
|
391
|
-
values[key] = value;
|
|
392
|
-
}
|
|
393
|
-
return values;
|
|
394
|
-
}
|
|
395
|
-
catch {
|
|
396
|
-
return {};
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
281
|
async function readProjectSettings(rootDir) {
|
|
400
282
|
try {
|
|
401
283
|
const raw = await readFile(join(rootDir, '.fimo.settings.json'), 'utf8');
|
package/dist/cli/bundle.json
CHANGED