fimo 0.6.0 → 0.7.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.
Files changed (145) hide show
  1. package/README.md +1 -1
  2. package/assets/content-templates/hooks-template.eta +73 -27
  3. package/assets/content-templates/types-template.eta +4 -1
  4. package/assets/skills/fimo/references/content.md +46 -42
  5. package/assets/skills/fimo-cli/references/content.md +14 -14
  6. package/assets/skills/fimo-cli/references/domains.md +1 -1
  7. package/assets/skills/fimo-studio/references/custom-domains.md +1 -1
  8. package/dist/cli/bundle.json +3 -2
  9. package/dist/cli/index.js +1203 -110450
  10. package/dist/runtime/content/client/createContentClient.d.ts +5 -0
  11. package/dist/runtime/content/client/createContentClient.js +300 -0
  12. package/dist/runtime/content/client/createSingletonClient.d.ts +5 -0
  13. package/dist/runtime/content/client/createSingletonClient.js +108 -0
  14. package/dist/runtime/content/client/internal.d.ts +44 -0
  15. package/dist/runtime/content/client/internal.js +236 -0
  16. package/dist/runtime/content/client/types.d.ts +136 -0
  17. package/dist/runtime/content/client/useQueryLocale.d.ts +2 -0
  18. package/dist/runtime/content/client/useQueryLocale.js +6 -0
  19. package/dist/runtime/content/utils/retrieve-data-sources.d.ts +1 -0
  20. package/dist/runtime/content/utils/retrieve-data-sources.js +27 -4
  21. package/dist/runtime/iframe/runtime/overlay-hmr.js +3 -0
  22. package/dist/runtime/index.d.ts +3 -0
  23. package/dist/runtime/index.js +2 -0
  24. package/dist/runtime/primitives/lib/primitives.d.ts +2 -2
  25. package/dist/runtime/primitives/lib/query.d.ts +5 -3
  26. package/package.json +31 -13
  27. package/release.json +2 -2
  28. package/templates/react-router/package.json +1 -1
  29. package/templates/react-router/src/pages/Index.tsx +1 -1
  30. package/dist/build/vite/index.d.ts.map +0 -1
  31. package/dist/build/vite/plugins/content-sync.d.ts.map +0 -1
  32. package/dist/build/vite/plugins/content-sync.test.d.ts +0 -2
  33. package/dist/build/vite/plugins/content-sync.test.d.ts.map +0 -1
  34. package/dist/build/vite/plugins/content-sync.test.js +0 -64
  35. package/dist/build/vite/plugins/data-id.d.ts.map +0 -1
  36. package/dist/build/vite/plugins/fimo-config.d.ts.map +0 -1
  37. package/dist/build/vite/plugins/fimo-config.test.d.ts +0 -2
  38. package/dist/build/vite/plugins/fimo-config.test.d.ts.map +0 -1
  39. package/dist/build/vite/plugins/fimo-config.test.js +0 -46
  40. package/dist/build/vite/plugins/overlay.d.ts.map +0 -1
  41. package/dist/build/vite/plugins/robots.d.ts.map +0 -1
  42. package/dist/build/vite/plugins/seo.d.ts.map +0 -1
  43. package/dist/build/vite/plugins/server-config.d.ts.map +0 -1
  44. package/dist/build/vite/plugins/sitemap.d.ts.map +0 -1
  45. package/dist/build/vite/plugins/translations.d.ts.map +0 -1
  46. package/dist/build/vite/plugins/translations.test.d.ts +0 -2
  47. package/dist/build/vite/plugins/translations.test.d.ts.map +0 -1
  48. package/dist/build/vite/plugins/translations.test.js +0 -266
  49. package/dist/runtime/app/FimoProviders.d.ts.map +0 -1
  50. package/dist/runtime/app/FimoScripts.d.ts.map +0 -1
  51. package/dist/runtime/app/index.d.ts.map +0 -1
  52. package/dist/runtime/app/prefetch.d.ts.map +0 -1
  53. package/dist/runtime/content/DataSourcesProvider.d.ts.map +0 -1
  54. package/dist/runtime/content/RefreshContentProvider.d.ts.map +0 -1
  55. package/dist/runtime/content/RefreshContentProvider.test.d.ts +0 -2
  56. package/dist/runtime/content/RefreshContentProvider.test.d.ts.map +0 -1
  57. package/dist/runtime/content/RefreshContentProvider.test.js +0 -33
  58. package/dist/runtime/content/parseCollectionResponse.d.ts.map +0 -1
  59. package/dist/runtime/content/parseCollectionResponse.test.d.ts +0 -2
  60. package/dist/runtime/content/parseCollectionResponse.test.d.ts.map +0 -1
  61. package/dist/runtime/content/parseCollectionResponse.test.js +0 -20
  62. package/dist/runtime/content/utils/retrieve-data-sources.d.ts.map +0 -1
  63. package/dist/runtime/core/AppErrorBoundary.d.ts.map +0 -1
  64. package/dist/runtime/core/ViteLifecycles.d.ts.map +0 -1
  65. package/dist/runtime/i18n/FimoLocaleContext.d.ts.map +0 -1
  66. package/dist/runtime/i18n/locale.d.ts.map +0 -1
  67. package/dist/runtime/i18n/locale.test.d.ts +0 -2
  68. package/dist/runtime/i18n/locale.test.d.ts.map +0 -1
  69. package/dist/runtime/i18n/locale.test.js +0 -58
  70. package/dist/runtime/iframe/ConsoleErrorProvider.d.ts.map +0 -1
  71. package/dist/runtime/iframe/ScreenshotProvider.d.ts.map +0 -1
  72. package/dist/runtime/iframe/runtime/overlay-hmr.d.ts.map +0 -1
  73. package/dist/runtime/iframe/runtime/overlay-runtime.d.ts.map +0 -1
  74. package/dist/runtime/index.d.ts.map +0 -1
  75. package/dist/runtime/paths/get-fimo-paths.d.ts.map +0 -1
  76. package/dist/runtime/paths/get-fimo-paths.test.d.ts +0 -2
  77. package/dist/runtime/paths/get-fimo-paths.test.d.ts.map +0 -1
  78. package/dist/runtime/paths/get-fimo-paths.test.js +0 -69
  79. package/dist/runtime/paths/index.d.ts.map +0 -1
  80. package/dist/runtime/paths/types.d.ts.map +0 -1
  81. package/dist/runtime/primitives/components/Boolean.d.ts.map +0 -1
  82. package/dist/runtime/primitives/components/Date.d.ts.map +0 -1
  83. package/dist/runtime/primitives/components/Image.d.ts.map +0 -1
  84. package/dist/runtime/primitives/components/RichText.d.ts.map +0 -1
  85. package/dist/runtime/primitives/components/StaticImage.d.ts.map +0 -1
  86. package/dist/runtime/primitives/components/Text.d.ts.map +0 -1
  87. package/dist/runtime/primitives/components/Video.d.ts.map +0 -1
  88. package/dist/runtime/primitives/components/index.d.ts.map +0 -1
  89. package/dist/runtime/primitives/index.d.ts.map +0 -1
  90. package/dist/runtime/primitives/lib/image-optimization.d.ts.map +0 -1
  91. package/dist/runtime/primitives/lib/index.d.ts.map +0 -1
  92. package/dist/runtime/primitives/lib/primitives.d.ts.map +0 -1
  93. package/dist/runtime/primitives/lib/query.d.ts.map +0 -1
  94. package/dist/runtime/primitives/lib/template.d.ts.map +0 -1
  95. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts.map +0 -1
  96. package/dist/runtime/primitives/public-surface.test.d.ts +0 -2
  97. package/dist/runtime/primitives/public-surface.test.d.ts.map +0 -1
  98. package/dist/runtime/primitives/public-surface.test.js +0 -45
  99. package/dist/runtime/primitives/translations.d.ts.map +0 -1
  100. package/dist/runtime/react-router/index.d.ts.map +0 -1
  101. package/dist/runtime/react-router/navigation-utils.d.ts.map +0 -1
  102. package/dist/runtime/react-router/navigation.d.ts.map +0 -1
  103. package/dist/runtime/react-router/navigation.test.d.ts +0 -2
  104. package/dist/runtime/react-router/navigation.test.d.ts.map +0 -1
  105. package/dist/runtime/react-router/navigation.test.js +0 -35
  106. package/dist/runtime/react-router/routes.d.ts.map +0 -1
  107. package/dist/runtime/react-router/routes.test.d.ts +0 -2
  108. package/dist/runtime/react-router/routes.test.d.ts.map +0 -1
  109. package/dist/runtime/react-router/routes.test.js +0 -67
  110. package/dist/runtime/routing/AppResetScrollOnNavigate.d.ts.map +0 -1
  111. package/dist/runtime/routing/AppRoutesProvider.d.ts.map +0 -1
  112. package/dist/runtime/seo/buildSeoForPath.d.ts.map +0 -1
  113. package/dist/runtime/seo/htmlProps.d.ts.map +0 -1
  114. package/dist/runtime/seo/index.d.ts.map +0 -1
  115. package/dist/runtime/seo/resolver.d.ts.map +0 -1
  116. package/dist/runtime/shared/fimo-config.server.d.ts.map +0 -1
  117. package/dist/runtime/shared/fimo-config.types.d.ts.map +0 -1
  118. package/dist/runtime/t/OptionalTracking.d.ts.map +0 -1
  119. package/dist/runtime/t/OptionalTracking.test.d.ts +0 -2
  120. package/dist/runtime/t/OptionalTracking.test.d.ts.map +0 -1
  121. package/dist/runtime/t/OptionalTracking.test.js +0 -11
  122. package/dist/runtime/t/Pageview.d.ts.map +0 -1
  123. package/dist/runtime/templates.d.ts.map +0 -1
  124. package/dist/scripts/generated-types.test.js +0 -212
  125. package/dist/scripts/lint-translation-keys.test.d.ts +0 -1
  126. package/dist/scripts/lint-translation-keys.test.js +0 -16
  127. package/dist/scripts/sync-schemas.test.d.ts +0 -1
  128. package/dist/scripts/sync-schemas.test.js +0 -124
  129. package/dist/scripts/validate-route-metadata.test.d.ts +0 -1
  130. package/dist/scripts/validate-route-metadata.test.js +0 -116
  131. package/dist/scripts/validate-schemas.test.d.ts +0 -1
  132. package/dist/scripts/validate-schemas.test.js +0 -263
  133. package/scripts/add-ext.mjs +0 -47
  134. package/scripts/bump-version.mjs +0 -58
  135. package/scripts/bundle-cli.mjs +0 -123
  136. package/scripts/install-cli.mjs +0 -36
  137. package/scripts/lib/channels.mjs +0 -70
  138. package/scripts/lib/dev-release-state.mjs +0 -44
  139. package/scripts/lib/dev-release-state.test.ts +0 -36
  140. package/scripts/lib/postinstall-onboarding.test.ts +0 -82
  141. package/scripts/lib/release-core.mjs +0 -225
  142. package/scripts/lib/release-core.test.ts +0 -147
  143. package/scripts/migration-qa-gate.test.ts +0 -155
  144. package/scripts/publish-npm.mjs +0 -180
  145. /package/dist/{scripts/generated-types.test.d.ts → runtime/content/client/types.js} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,MAAM,CAAC;AAmFjD,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;;OAUG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAGD,wBAAgB,IAAI,CAAC,IAAI,GAAE,eAAoB,GAAG,YAAY,EAAE,CAsB/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-sync.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/content-sync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAKlD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,MAAM,CAkClD"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=content-sync.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-sync.test.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/content-sync.test.ts"],"names":[],"mappings":""}
@@ -1,64 +0,0 @@
1
- import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
- import { tmpdir } from 'node:os';
3
- import { join } from 'node:path';
4
- import { afterEach, describe, expect, it, vi } from 'vitest';
5
- import contentSyncPlugin from './content-sync';
6
- let scratch = null;
7
- const pluginContext = {
8
- addWatchFile: vi.fn(),
9
- meta: {},
10
- error: (error) => {
11
- throw error;
12
- },
13
- info: () => undefined,
14
- warn: () => undefined,
15
- debug: () => undefined,
16
- };
17
- afterEach(() => {
18
- if (scratch) {
19
- rmSync(scratch, { recursive: true, force: true });
20
- scratch = null;
21
- }
22
- vi.clearAllMocks();
23
- });
24
- function createProjectRoot() {
25
- scratch = mkdtempSync(join(tmpdir(), 'fimo-content-sync-plugin-'));
26
- mkdirSync(join(scratch, 'src/schemas'), { recursive: true });
27
- return scratch;
28
- }
29
- function configurePlugin(plugin, root) {
30
- if (typeof plugin.configResolved === 'function') {
31
- plugin.configResolved.call(pluginContext, { root });
32
- }
33
- }
34
- describe('contentSyncPlugin', () => {
35
- it('does not mutate generated files during a production build', () => {
36
- const plugin = contentSyncPlugin();
37
- expect(plugin.buildStart).toBeUndefined();
38
- expect(plugin.generateBundle).toBeUndefined();
39
- expect(plugin.writeBundle).toBeUndefined();
40
- });
41
- it('regenerates schema clients after a schema changes in dev', () => {
42
- const root = createProjectRoot();
43
- const schemaPath = join(root, 'src/schemas/Post.json');
44
- writeFileSync(schemaPath, JSON.stringify({ uid: 'Post', name: 'Posts', fields: { title: { type: 'string' } } }, null, 2));
45
- const listeners = new Map();
46
- const server = {
47
- watcher: {
48
- add: vi.fn(),
49
- on: vi.fn((event, listener) => {
50
- listeners.set(event, listener);
51
- }),
52
- },
53
- };
54
- const plugin = contentSyncPlugin();
55
- configurePlugin(plugin, root);
56
- if (typeof plugin.configureServer !== 'function') {
57
- throw new Error('Expected configureServer hook');
58
- }
59
- plugin.configureServer.call(pluginContext, server);
60
- listeners.get('change')?.(schemaPath);
61
- expect(readFileSync(join(root, 'src/schemas/Post.ts'), 'utf8')).toContain('from "./Post.types";');
62
- expect(readFileSync(join(root, 'src/schemas/Post.types.ts'), 'utf8')).toContain('export interface Post');
63
- });
64
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-id.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/data-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAOnC,MAAM,CAAC,OAAO,UAAU,YAAY,IAAI,MAAM,CA2F7C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fimo-config.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/fimo-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAKnC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,IAAI,MAAM,CA6CjD"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=fimo-config.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fimo-config.test.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/fimo-config.test.ts"],"names":[],"mappings":""}
@@ -1,46 +0,0 @@
1
- import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
- import { tmpdir } from 'node:os';
3
- import { join } from 'node:path';
4
- import { afterEach, describe, expect, it } from 'vitest';
5
- import fimoConfigPlugin from './fimo-config';
6
- let scratch = null;
7
- const pluginContext = {
8
- meta: {},
9
- error: (error) => {
10
- throw error;
11
- },
12
- info: () => undefined,
13
- warn: () => undefined,
14
- debug: () => undefined,
15
- };
16
- afterEach(() => {
17
- if (scratch) {
18
- rmSync(scratch, { recursive: true, force: true });
19
- scratch = null;
20
- }
21
- });
22
- function createPluginWithConfig(config) {
23
- scratch = mkdtempSync(join(tmpdir(), 'fimo-config-plugin-'));
24
- writeFileSync(join(scratch, 'fimo-config.json'), JSON.stringify(config, null, 2));
25
- const plugin = fimoConfigPlugin();
26
- if (typeof plugin.config === 'function') {
27
- plugin.config.call(pluginContext, { root: scratch }, { command: 'build', mode: 'production' });
28
- }
29
- return plugin;
30
- }
31
- function transformHtml(plugin, html) {
32
- if (typeof plugin.transformIndexHtml !== 'function') {
33
- throw new Error('Expected transformIndexHtml function');
34
- }
35
- return plugin.transformIndexHtml.call(pluginContext, html, {});
36
- }
37
- describe('fimoConfigPlugin', () => {
38
- it('sets html lang from i18n.defaultLocale', () => {
39
- const plugin = createPluginWithConfig({ seo: { locale: 'es_ES' }, i18n: { defaultLocale: 'fr' } });
40
- expect(transformHtml(plugin, '<html><head></head><body></body></html>')).toContain('<html lang="fr">');
41
- });
42
- it('falls back to en when i18n.defaultLocale is absent', () => {
43
- const plugin = createPluginWithConfig({ seo: { locale: 'es_ES' } });
44
- expect(transformHtml(plugin, '<html lang="fr"><head></head><body></body></html>')).toContain('<html lang="en">');
45
- });
46
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/overlay.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAoEnC,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,MAAM,CA+E9C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"robots.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/robots.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AA6BnC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,IAAI,MAAM,CAuB7C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/seo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AA2BnC,MAAM,CAAC,OAAO,UAAU,SAAS,IAAI,MAAM,CA2G1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/server-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,CAAC,OAAO,UAAU,kBAAkB,IAAI,MAAM,CAsBnD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/sitemap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAkDnC,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,MAAM,CA8B9C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/translations.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAQlD,UAAU,WAAW;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAwCD,MAAM,CAAC,OAAO,UAAU,kBAAkB,IAAI,MAAM,CAmOnD;AAoED,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAwC3E"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=translations.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translations.test.d.ts","sourceRoot":"","sources":["../../../../src/build/vite/plugins/translations.test.ts"],"names":[],"mappings":""}
@@ -1,266 +0,0 @@
1
- import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
2
- import { tmpdir } from 'node:os';
3
- import { join } from 'node:path';
4
- import { afterEach, describe, expect, it, vi } from 'vitest';
5
- import translationsPlugin from './translations';
6
- let scratch = null;
7
- let activePlugin = null;
8
- const originalFimoApiToken = process.env.FIMO_API_TOKEN;
9
- const pluginContext = {
10
- addWatchFile: vi.fn(),
11
- meta: {},
12
- error: (error) => {
13
- throw error;
14
- },
15
- info: () => undefined,
16
- warn: () => undefined,
17
- debug: () => undefined,
18
- };
19
- afterEach(() => {
20
- if (activePlugin && typeof activePlugin.closeBundle === 'function') {
21
- activePlugin.closeBundle.call(pluginContext);
22
- activePlugin = null;
23
- }
24
- if (scratch) {
25
- rmSync(scratch, { recursive: true, force: true });
26
- scratch = null;
27
- }
28
- if (originalFimoApiToken === undefined) {
29
- delete process.env.FIMO_API_TOKEN;
30
- }
31
- else {
32
- process.env.FIMO_API_TOKEN = originalFimoApiToken;
33
- }
34
- vi.unstubAllGlobals();
35
- vi.clearAllMocks();
36
- });
37
- function createProjectRoot() {
38
- scratch = mkdtempSync(join(tmpdir(), 'fimo-translations-plugin-'));
39
- writeFileSync(join(scratch, 'fimo-config.json'), JSON.stringify({ i18n: { defaultLocale: 'es', locales: ['es'] } }, null, 2));
40
- writeFileSync(join(scratch, '.env'), 'VITE_API_URL=https://tenant.example.test\n');
41
- return scratch;
42
- }
43
- function createPlugin(root, command) {
44
- const plugin = translationsPlugin();
45
- activePlugin = plugin;
46
- if (typeof plugin.configResolved === 'function') {
47
- plugin.configResolved.call(pluginContext, { root, command });
48
- }
49
- return plugin;
50
- }
51
- async function buildStart(plugin) {
52
- if (typeof plugin.buildStart !== 'function') {
53
- throw new Error('Expected buildStart hook');
54
- }
55
- await plugin.buildStart.call(pluginContext, {});
56
- }
57
- async function loadTranslations(plugin) {
58
- if (typeof plugin.resolveId !== 'function' || typeof plugin.load !== 'function') {
59
- throw new Error('Expected resolveId/load hooks');
60
- }
61
- const id = await plugin.resolveId.call(pluginContext, 'virtual:translations', undefined, {});
62
- if (typeof id !== 'string') {
63
- throw new Error('Expected virtual translations module id');
64
- }
65
- const result = await plugin.load.call(pluginContext, id, {});
66
- if (typeof result !== 'string') {
67
- throw new Error('Expected virtual translations source');
68
- }
69
- return result;
70
- }
71
- function createDevServer() {
72
- return {
73
- watcher: { add: vi.fn() },
74
- moduleGraph: {
75
- getModuleById: vi.fn(() => null),
76
- idToModuleMap: new Map(),
77
- },
78
- ws: { send: vi.fn() },
79
- };
80
- }
81
- function mockLabels(labels) {
82
- const fetchMock = vi.fn(async () => jsonResponse({ data: { labels, updatedAt: '2026-06-24T00:00:00.000Z' } }));
83
- vi.stubGlobal('fetch', fetchMock);
84
- return fetchMock;
85
- }
86
- function jsonResponse(body) {
87
- return {
88
- ok: true,
89
- json: async () => body,
90
- };
91
- }
92
- async function waitFor(condition) {
93
- const deadline = Date.now() + 1000;
94
- while (Date.now() < deadline) {
95
- if (condition()) {
96
- return;
97
- }
98
- await new Promise((resolve) => setTimeout(resolve, 10));
99
- }
100
- throw new Error('Timed out waiting for condition');
101
- }
102
- describe('translationsPlugin', () => {
103
- it('does not block dev startup on the initial label fetch', async () => {
104
- const root = createProjectRoot();
105
- const fetchMock = mockLabels({ headline: 'Hola' });
106
- const plugin = createPlugin(root, 'serve');
107
- await buildStart(plugin);
108
- expect(fetchMock).not.toHaveBeenCalled();
109
- const source = await loadTranslations(plugin);
110
- expect(source).toContain('export const translations = {};');
111
- expect(source).toContain('export const defaultLocale = "es";');
112
- });
113
- it('pushes updated labels over custom HMR without a full page reload', async () => {
114
- const root = createProjectRoot();
115
- mockLabels({ headline: 'Hola' });
116
- const plugin = createPlugin(root, 'serve');
117
- await buildStart(plugin);
118
- const server = createDevServer();
119
- if (typeof plugin.configureServer !== 'function') {
120
- throw new Error('Expected configureServer hook');
121
- }
122
- plugin.configureServer.call(pluginContext, server);
123
- await waitFor(() => server.ws.send.mock.calls.length > 0);
124
- expect(server.ws.send).toHaveBeenCalledWith({
125
- type: 'custom',
126
- event: 'fimo:labels-updated',
127
- data: expect.objectContaining({
128
- defaultLocale: 'es',
129
- dictionaries: { es: { headline: 'Hola' } },
130
- locales: ['es'],
131
- signature: expect.any(String),
132
- updatedAt: '2026-06-24T00:00:00.000Z',
133
- }),
134
- });
135
- expect(server.ws.send).not.toHaveBeenCalledWith({ type: 'full-reload', path: '*' });
136
- const source = await loadTranslations(plugin);
137
- expect(source).toContain('"headline":"Hola"');
138
- });
139
- it('discovers the events URL from tenant runtime config when env is absent', async () => {
140
- const root = createProjectRoot();
141
- const projectId = '11111111-1111-4111-8111-111111111111';
142
- writeFileSync(join(root, '.fimo.settings.json'), JSON.stringify({ projectId, apiUrl: 'https://api.example.test' }));
143
- process.env.FIMO_API_TOKEN = 'test-api-token';
144
- const socketUrls = [];
145
- vi.stubGlobal('WebSocket', class {
146
- onopen = null;
147
- onmessage = null;
148
- onclose = null;
149
- onerror = null;
150
- constructor(url) {
151
- socketUrls.push(url);
152
- }
153
- close() { }
154
- });
155
- const fetchMock = vi.fn(async (input, init) => {
156
- const url = new URL(input.toString());
157
- if (url.pathname === '/labels') {
158
- return jsonResponse({ data: { labels: {}, updatedAt: null } });
159
- }
160
- if (url.pathname === '/runtime-config') {
161
- return jsonResponse({ data: { eventsServerUrl: 'https://events.example.test' } });
162
- }
163
- if (url.pathname === '/api/auth/one-time-token/generate') {
164
- expect(init?.method).toBe('GET');
165
- return jsonResponse({ token: 'event-token' });
166
- }
167
- return { ok: false, json: async () => ({}) };
168
- });
169
- vi.stubGlobal('fetch', fetchMock);
170
- const plugin = createPlugin(root, 'serve');
171
- await buildStart(plugin);
172
- const server = createDevServer();
173
- if (typeof plugin.configureServer !== 'function') {
174
- throw new Error('Expected configureServer hook');
175
- }
176
- plugin.configureServer.call(pluginContext, server);
177
- await waitFor(() => socketUrls.length > 0);
178
- expect(socketUrls[0]).toContain(`wss://events.example.test/parties/events/${projectId}`);
179
- expect(socketUrls[0]).toContain('authToken=event-token');
180
- });
181
- it('forwards content changes over custom HMR without a full page reload', async () => {
182
- const root = createProjectRoot();
183
- const projectId = '11111111-1111-4111-8111-111111111111';
184
- writeFileSync(join(root, '.fimo.settings.json'), JSON.stringify({ projectId, apiUrl: 'https://api.example.test' }));
185
- process.env.FIMO_API_TOKEN = 'test-api-token';
186
- const sockets = [];
187
- vi.stubGlobal('WebSocket', class {
188
- onopen = null;
189
- onmessage = null;
190
- onclose = null;
191
- onerror = null;
192
- constructor(_url) {
193
- sockets.push(this);
194
- }
195
- close() { }
196
- });
197
- vi.stubGlobal('fetch', vi.fn(async (input) => {
198
- const url = new URL(input.toString());
199
- if (url.pathname === '/labels') {
200
- return jsonResponse({ data: { labels: {}, updatedAt: null } });
201
- }
202
- if (url.pathname === '/runtime-config') {
203
- return jsonResponse({ data: { eventsServerUrl: 'https://events.example.test' } });
204
- }
205
- if (url.pathname === '/api/auth/one-time-token/generate') {
206
- return jsonResponse({ data: { token: 'event-token' } });
207
- }
208
- return { ok: false, json: async () => ({}) };
209
- }));
210
- const plugin = createPlugin(root, 'serve');
211
- await buildStart(plugin);
212
- const server = createDevServer();
213
- if (typeof plugin.configureServer !== 'function') {
214
- throw new Error('Expected configureServer hook');
215
- }
216
- plugin.configureServer.call(pluginContext, server);
217
- await waitFor(() => sockets.length > 0);
218
- sockets[0].onmessage?.({
219
- data: JSON.stringify({
220
- type: 'content:changed',
221
- payload: {
222
- changes: [{ action: 'update', contentType: 'LiveNote', id: 'entry-1', locale: 'en' }],
223
- updatedAt: '2026-06-24T00:00:00.000Z',
224
- },
225
- }),
226
- });
227
- expect(server.ws.send).toHaveBeenCalledWith({
228
- type: 'custom',
229
- event: 'fimo:content-updated',
230
- data: {
231
- changes: [{ action: 'update', contentType: 'LiveNote', id: 'entry-1', locale: 'en' }],
232
- updatedAt: '2026-06-24T00:00:00.000Z',
233
- },
234
- });
235
- expect(server.ws.send).not.toHaveBeenCalledWith({ type: 'full-reload', path: '*' });
236
- });
237
- it('still waits for labels during production builds', async () => {
238
- const root = createProjectRoot();
239
- const fetchMock = mockLabels({ headline: 'Hola' });
240
- const plugin = createPlugin(root, 'build');
241
- await buildStart(plugin);
242
- expect(fetchMock).toHaveBeenCalled();
243
- const source = await loadTranslations(plugin);
244
- expect(source).toContain('"headline":"Hola"');
245
- });
246
- it('loads one dictionary per configured locale', async () => {
247
- const root = createProjectRoot();
248
- writeFileSync(join(root, 'fimo-config.json'), JSON.stringify({ i18n: { defaultLocale: 'en', locales: ['en', 'es'] } }, null, 2));
249
- vi.stubGlobal('fetch', vi.fn(async (input) => {
250
- const url = new URL(input.toString());
251
- const locale = url.searchParams.get('locale');
252
- return jsonResponse({
253
- data: {
254
- labels: locale === 'es' ? { headline: 'Hola' } : { headline: 'Hello' },
255
- updatedAt: `2026-06-24T00:00:0${locale === 'es' ? '2' : '1'}.000Z`,
256
- },
257
- });
258
- }));
259
- const plugin = createPlugin(root, 'build');
260
- await buildStart(plugin);
261
- const source = await loadTranslations(plugin);
262
- expect(source).toContain('export const dictionaries = {"en":{"headline":"Hello"},"es":{"headline":"Hola"}};');
263
- expect(source).toContain('export const translations = {"headline":"Hello"};');
264
- expect(source).toContain('export const updatedAt = "2026-06-24T00:00:02.000Z";');
265
- });
266
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"FimoProviders.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/FimoProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAezE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAwFD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,2CAwCrE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FimoScripts.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/FimoScripts.tsx"],"names":[],"mappings":"AAKA,OAAO,0BAA0B,CAAC;AA6BlC;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,4CAc1B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtF,YAAY,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefetch.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/prefetch.ts"],"names":[],"mappings":"AAkFA,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,6CAElD;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAqClG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataSourcesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/DataSourcesProvider.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CA8B9E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RefreshContentProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/RefreshContentProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGnD,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAYD,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAWpF;AAmBD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,OAAO,EAAE,qBAAqB,GAAG,IAAI,GACpC,OAAO,CAUT;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CAiCxD,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RefreshContentProvider.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RefreshContentProvider.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/RefreshContentProvider.test.ts"],"names":[],"mappings":""}
@@ -1,33 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { getContentRefreshPayload, normalizeContentQueryRoot, shouldInvalidateContentQuery, } from './RefreshContentProvider.js';
3
- describe('RefreshContentProvider content invalidation', () => {
4
- it('keeps broad invalidation when no content type is provided', () => {
5
- expect(shouldInvalidateContentQuery(['BlogPost'], null)).toBe(true);
6
- expect(shouldInvalidateContentQuery(['Author'], {})).toBe(true);
7
- });
8
- it('invalidates only matching generated content query roots', () => {
9
- const payload = { contentType: 'BlogPost', locale: 'en' };
10
- expect(shouldInvalidateContentQuery(['BlogPost', 'entry-1', 'en'], payload)).toBe(true);
11
- expect(shouldInvalidateContentQuery(['Author', 'entry-1', 'en'], payload)).toBe(false);
12
- });
13
- it('normalizes schema-style content type names to generated query roots', () => {
14
- expect(normalizeContentQueryRoot('blog-post')).toBe('BlogPost');
15
- expect(shouldInvalidateContentQuery(['BlogPost'], { contentType: 'blog-post' })).toBe(true);
16
- });
17
- it('supports events with multiple changed content types', () => {
18
- const payload = {
19
- changes: [
20
- { contentType: 'BlogPost', id: 'post-1' },
21
- { contentType: 'author-profile', id: 'author-1' },
22
- ],
23
- };
24
- expect(shouldInvalidateContentQuery(['BlogPost'], payload)).toBe(true);
25
- expect(shouldInvalidateContentQuery(['AuthorProfile'], payload)).toBe(true);
26
- expect(shouldInvalidateContentQuery(['Product'], payload)).toBe(false);
27
- });
28
- it('reads payloads from window messages and direct HMR payloads', () => {
29
- const payload = { contentType: 'BlogPost', locale: 'en' };
30
- expect(getContentRefreshPayload({ type: 'content/refresh', payload })).toEqual(payload);
31
- expect(getContentRefreshPayload(payload)).toEqual(payload);
32
- });
33
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseCollectionResponse.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/parseCollectionResponse.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B,CAAC;CACH;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAE1E"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parseCollectionResponse.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseCollectionResponse.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/parseCollectionResponse.test.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { parseCollectionResponse } from './parseCollectionResponse.js';
3
- describe('parseCollectionResponse', () => {
4
- it('accepts the collection envelope used by generated clients', () => {
5
- const response = parseCollectionResponse({
6
- data: [{ id: 'post-1', title: 'Hello' }],
7
- meta: { limit: 12, offset: 24, total: 40, hasMore: true },
8
- });
9
- expect(response).toEqual({
10
- data: [{ id: 'post-1', title: 'Hello' }],
11
- meta: { limit: 12, offset: 24, total: 40, hasMore: true },
12
- });
13
- });
14
- it('rejects invalid pagination metadata', () => {
15
- expect(() => parseCollectionResponse({
16
- data: [],
17
- meta: { limit: 0, offset: -1, total: '40', hasMore: 'yes' },
18
- })).toThrow();
19
- });
20
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"retrieve-data-sources.d.ts","sourceRoot":"","sources":["../../../../src/runtime/content/utils/retrieve-data-sources.ts"],"names":[],"mappings":"AACA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExC,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AA8B9D;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,kBAAkB,CAiD/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/AppErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,QAmBrC;AAGD,wBAAgB,gBAAgB,4CAM/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ViteLifecycles.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/ViteLifecycles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAkCzE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"FimoLocaleContext.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/FimoLocaleContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,oBAAoB,EACpB,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAC1E,CAAC;AAaF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAEpH;AAED,wBAAgB,SAAS,IAAI,sBAAsB,CAElD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,GAAG,EAAE,KAAK,GAAG,KAAK,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAEzF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAUrF;AAED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,GAAG,GAAG,qBAAqB,EACjD,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAC3C,oBAAoB,CA8CtB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAgBnH;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAGlE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAYpF"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=locale.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/locale.test.ts"],"names":[],"mappings":""}
@@ -1,58 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { localizeFimoPath, resolveFimoLocale } from './locale';
3
- describe('Fimo locale routing', () => {
4
- const config = {
5
- i18n: {
6
- defaultLocale: 'en',
7
- locales: ['en', 'es'],
8
- routing: {
9
- strategy: 'path-prefix',
10
- prefixDefaultLocale: false,
11
- },
12
- },
13
- };
14
- it('uses the unprefixed URL for the default locale', () => {
15
- expect(resolveFimoLocale('/pricing', config)).toMatchObject({
16
- locale: 'en',
17
- routePath: '/pricing',
18
- prefix: null,
19
- isDefaultLocale: true,
20
- });
21
- });
22
- it('strips non-default locale prefixes before route matching', () => {
23
- expect(resolveFimoLocale('/es/blog/hola-mundo', config)).toMatchObject({
24
- locale: 'es',
25
- routePath: '/blog/hola-mundo',
26
- prefix: 'es',
27
- isDefaultLocale: false,
28
- });
29
- });
30
- it('builds localized paths for enabled locales', () => {
31
- expect(localizeFimoPath('/pricing', 'en', config)).toBe('/pricing');
32
- expect(localizeFimoPath('/pricing', 'es', config)).toBe('/es/pricing');
33
- expect(localizeFimoPath('/', 'es', config)).toBe('/es');
34
- });
35
- it('can prefix the default locale when configured', () => {
36
- const prefixed = {
37
- i18n: {
38
- ...config.i18n,
39
- routing: {
40
- strategy: 'path-prefix',
41
- prefixDefaultLocale: true,
42
- },
43
- },
44
- };
45
- expect(localizeFimoPath('/pricing', 'en', prefixed)).toBe('/en/pricing');
46
- });
47
- it('canonicalizes structurally valid locale tags', () => {
48
- expect(resolveFimoLocale('/es-419/pricing', {
49
- i18n: {
50
- defaultLocale: 'en_us',
51
- locales: ['en_us', 'es-419'],
52
- },
53
- })).toMatchObject({
54
- locale: 'es-419',
55
- defaultLocale: 'en-US',
56
- });
57
- });
58
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConsoleErrorProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/iframe/ConsoleErrorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAkEnD,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,iBAAiB,CA0CtD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScreenshotProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/iframe/ScreenshotProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAkEnD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,CAOpD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay-hmr.d.ts","sourceRoot":"","sources":["../../../../src/runtime/iframe/runtime/overlay-hmr.ts"],"names":[],"mappings":""}