fimo 0.11.0-staging.14 → 0.11.0-staging.16
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 +7 -1
- package/dist/build/vite/index.d.ts +10 -0
- package/dist/build/vite/index.js +56 -8
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +1 -1
- package/package.json +1 -1
- package/templates/react-router/package.json +1 -1
- package/templates/react-router/react-router.config.ts +6 -0
- package/templates/react-router/index.html +0 -15
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
<!-- npm renders this README from the published tarball, so this URL is frozen into every
|
|
2
|
+
version already on the registry: the object must stay at this exact key forever, and
|
|
3
|
+
nothing in CI catches its removal. It is served from the R2 assets bucket rather than
|
|
4
|
+
fimo.ai on purpose — the marketing site rewrites unmatched paths to index.html, so a
|
|
5
|
+
missing asset there returns 200 with an HTML body instead of a 404, which is how the
|
|
6
|
+
previous logo URL stayed broken without anyone noticing. -->
|
|
1
7
|
<p align="center">
|
|
2
8
|
<a href="https://fimo.ai">
|
|
3
|
-
<img src="https://fimo.ai/
|
|
9
|
+
<img src="https://assets.fimo.ai/brand/fimo-mark-512.png" height="80" alt="Fimo" />
|
|
4
10
|
</a>
|
|
5
11
|
</p>
|
|
6
12
|
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { PluginOption } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the project at `root` is a React Router framework-mode app.
|
|
4
|
+
*
|
|
5
|
+
* Gates the one React-Router-specific line in this otherwise
|
|
6
|
+
* framework-neutral plugin, so a future `fimo/next` or plain-Vite project
|
|
7
|
+
* never inherits it. Checks the manifest first: the config file can carry any
|
|
8
|
+
* of four extensions, but framework mode is impossible without
|
|
9
|
+
* `@react-router/dev`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isReactRouterProject(root: string): boolean;
|
|
2
12
|
export interface FimoViteOptions {
|
|
3
13
|
/**
|
|
4
14
|
* Emit `sitemap.xml` at build (and serve at `/sitemap.xml` in dev). Reads
|
package/dist/build/vite/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
1
3
|
import contentSyncPlugin from './plugins/content-sync.js';
|
|
2
4
|
import dataIdPlugin from './plugins/data-id.js';
|
|
3
5
|
import fimoConfigPlugin from './plugins/fimo-config.js';
|
|
@@ -28,26 +30,72 @@ import translationsPlugin from './plugins/translations.js';
|
|
|
28
30
|
// dep chunks and resolves bare specifiers through the plugin container,
|
|
29
31
|
// rewriting them to `/@id/` URLs itself. A pre-prefixed path fails that
|
|
30
32
|
// resolve ("Failed to resolve import '/@id/virtual:fimo-config'").
|
|
33
|
+
const REACT_ROUTER_CONFIG_FILES = [
|
|
34
|
+
'react-router.config.ts',
|
|
35
|
+
'react-router.config.js',
|
|
36
|
+
'react-router.config.mjs',
|
|
37
|
+
'react-router.config.cjs',
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Whether the project at `root` is a React Router framework-mode app.
|
|
41
|
+
*
|
|
42
|
+
* Gates the one React-Router-specific line in this otherwise
|
|
43
|
+
* framework-neutral plugin, so a future `fimo/next` or plain-Vite project
|
|
44
|
+
* never inherits it. Checks the manifest first: the config file can carry any
|
|
45
|
+
* of four extensions, but framework mode is impossible without
|
|
46
|
+
* `@react-router/dev`.
|
|
47
|
+
*/
|
|
48
|
+
export function isReactRouterProject(root) {
|
|
49
|
+
try {
|
|
50
|
+
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf-8'));
|
|
51
|
+
if (pkg.devDependencies?.['@react-router/dev'] ?? pkg.dependencies?.['@react-router/dev']) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// No readable manifest — fall through to the config-file probe.
|
|
57
|
+
}
|
|
58
|
+
return REACT_ROUTER_CONFIG_FILES.some((file) => existsSync(join(root, file)));
|
|
59
|
+
}
|
|
31
60
|
function bundleFimoIntoSsrPlugin() {
|
|
32
61
|
return {
|
|
33
62
|
name: 'vite-plugin-fimo-ssr-bundle',
|
|
34
|
-
config: () => ({
|
|
63
|
+
config: (userConfig) => ({
|
|
35
64
|
ssr: { noExternal: ['fimo'] },
|
|
36
65
|
optimizeDeps: {
|
|
66
|
+
// Compatibility shim for React Router projects scaffolded before the
|
|
67
|
+
// template set `future.unstable_optimizeDeps`. React Router passes
|
|
68
|
+
// Vite an EMPTY `entries` array without that flag (see
|
|
69
|
+
// getOptimizeDepsEntries in @react-router/dev), so NOTHING is
|
|
70
|
+
// pre-bundled: every dep a route imports is discovered on that
|
|
71
|
+
// route's first visit, and vite answers by re-optimizing and
|
|
72
|
+
// full-reloading the document. In the preview that reads as "links
|
|
73
|
+
// aren't SPA links" — client state lost, plus a transient duplicate
|
|
74
|
+
// React while the new chunks land.
|
|
75
|
+
//
|
|
76
|
+
// Gated on React Router, and assumes sources live in `src/`. The flag
|
|
77
|
+
// supersedes it (it derives entries from the real route table,
|
|
78
|
+
// whatever the appDirectory) and the two merge additively — drop this
|
|
79
|
+
// once no supported project predates the flag.
|
|
80
|
+
...(isReactRouterProject(typeof userConfig.root === 'string' ? userConfig.root : process.cwd())
|
|
81
|
+
? { entries: ['src/**/*.{ts,tsx,js,jsx}'] }
|
|
82
|
+
: {}),
|
|
37
83
|
// Pre-include fimo's scanner-invisible dependency surface. The
|
|
38
84
|
// scanner can't traverse the fimo package (virtual: imports), so deps
|
|
39
85
|
// reached only THROUGH fimo (its react-router adapter subpath, its
|
|
40
|
-
// internal react-query usage) get discovered
|
|
41
|
-
// re-optimizes and 504s the in-flight
|
|
42
|
-
// Optimize Dep") and the app never
|
|
43
|
-
// content/query e2e).
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
86
|
+
// internal react-query usage, its error boundary) get discovered
|
|
87
|
+
// mid-first-load — vite re-optimizes and 504s the in-flight
|
|
88
|
+
// generation's chunks ("Outdated Optimize Dep") and the app never
|
|
89
|
+
// mounts (blank preview; caught by content/query e2e).
|
|
90
|
+
// react/react-dom/react-router are listed too: the template imports
|
|
91
|
+
// them, but fimo's imports of them are invisible to the scan, so
|
|
92
|
+
// leaving them to discovery makes the first optimize pass depend on
|
|
93
|
+
// which entry the browser happens to request first.
|
|
47
94
|
include: [
|
|
48
95
|
'react',
|
|
49
96
|
'react-dom',
|
|
50
97
|
'react-router',
|
|
98
|
+
'react-error-boundary',
|
|
51
99
|
'fimo/ui',
|
|
52
100
|
'fimo/react-router',
|
|
53
101
|
'@tanstack/react-query',
|