fondu 0.9.6 → 0.11.0
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 +11 -15
- package/dist/client/app.d.ts +40 -0
- package/dist/client/app.js +185 -0
- package/dist/client/navigation.d.ts +36 -0
- package/dist/client/navigation.js +432 -0
- package/dist/client/progress.d.ts +16 -0
- package/dist/client/progress.js +64 -0
- package/dist/client.d.ts +4 -15
- package/dist/client.js +3 -47
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/paths.d.ts +23 -8
- package/dist/paths.js +52 -21
- package/dist/server/app.d.ts +4 -5
- package/dist/server/app.js +81 -16
- package/dist/server/document.d.ts +3 -3
- package/dist/server/document.js +27 -6
- package/dist/server/errors.d.ts +4 -2
- package/dist/server/errors.js +23 -10
- package/dist/server/flash.d.ts +4 -7
- package/dist/server/flash.js +9 -14
- package/dist/server/handler.d.ts +1 -1
- package/dist/server/handler.js +1 -1
- package/dist/server/http.d.ts +7 -5
- package/dist/server/http.js +15 -6
- package/dist/server/prerender.d.ts +1 -1
- package/dist/server/prerender.js +18 -10
- package/dist/server/protocol.d.ts +22 -35
- package/dist/server/protocol.js +67 -195
- package/dist/server/routes.d.ts +1 -1
- package/dist/server/validate.d.ts +8 -9
- package/dist/server/validate.js +23 -37
- package/dist/types.d.ts +10 -6
- package/dist/virtual.d.ts +3 -5
- package/dist/vite/hmr.d.ts +3 -3
- package/dist/vite/hmr.js +5 -5
- package/dist/vite/index.d.ts +9 -5
- package/dist/vite/index.js +174 -80
- package/dist/vite/prerender.d.ts +3 -3
- package/dist/vite/prerender.js +17 -12
- package/dist/vite/strip.d.ts +21 -0
- package/dist/vite/strip.js +306 -0
- package/dist/vite/typegen.d.ts +3 -2
- package/dist/vite/typegen.js +6 -10
- package/package.json +2 -9
- package/dist/server/props.d.ts +0 -85
- package/dist/server/props.js +0 -44
- package/dist/vite/layouts.d.ts +0 -10
- package/dist/vite/layouts.js +0 -110
- package/dist/vite/vitest-cache.d.ts +0 -19
- package/dist/vite/vitest-cache.js +0 -30
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
type CacheKeyGenerator = (context: {
|
|
3
|
-
id: string;
|
|
4
|
-
}) => string | false | undefined;
|
|
5
|
-
type CacheKeyContext = {
|
|
6
|
-
defineCacheKeyGenerator?: (generator: CacheKeyGenerator) => void;
|
|
7
|
-
/** Vitest 4's name for it */
|
|
8
|
-
experimental_defineCacheKeyGenerator?: (generator: CacheKeyGenerator) => void;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Vitest's file cache keys a transformed module by its code. Two modules' transforms read more than that, so the next
|
|
12
|
-
* run would see them as they were: a page's layout chain (the `_layout.tsx` files above it) goes in its key; the
|
|
13
|
-
* entry, `app/app.tsx`, is not cached, its transform writing the list of pages (`@inertiajs/vite`'s glob) and the code
|
|
14
|
-
* Fondu's options add. Vitest itself skips only modules whose own code has `import.meta.glob`.
|
|
15
|
-
*/
|
|
16
|
-
export declare function vitestCache(entry: string): Plugin & {
|
|
17
|
-
configureVitest(context: CacheKeyContext): void;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { relative, sep } from 'node:path';
|
|
2
|
-
import { isPageFile } from '../paths.js';
|
|
3
|
-
import { layoutChain } from './layouts.js';
|
|
4
|
-
/**
|
|
5
|
-
* Vitest's file cache keys a transformed module by its code. Two modules' transforms read more than that, so the next
|
|
6
|
-
* run would see them as they were: a page's layout chain (the `_layout.tsx` files above it) goes in its key; the
|
|
7
|
-
* entry, `app/app.tsx`, is not cached, its transform writing the list of pages (`@inertiajs/vite`'s glob) and the code
|
|
8
|
-
* Fondu's options add. Vitest itself skips only modules whose own code has `import.meta.glob`.
|
|
9
|
-
*/
|
|
10
|
-
export function vitestCache(entry) {
|
|
11
|
-
let root = process.cwd();
|
|
12
|
-
return {
|
|
13
|
-
name: 'fondu:vitest-cache',
|
|
14
|
-
configResolved(c) {
|
|
15
|
-
root = c.root;
|
|
16
|
-
},
|
|
17
|
-
configureVitest(context) {
|
|
18
|
-
const define = context.defineCacheKeyGenerator ?? context.experimental_defineCacheKeyGenerator;
|
|
19
|
-
define?.(({ id }) => {
|
|
20
|
-
const file = relative(root, id.split('?')[0]).split(sep).join('/');
|
|
21
|
-
if (file === entry)
|
|
22
|
-
return false;
|
|
23
|
-
const page = file.startsWith('app/pages/') ? file.slice('app/pages/'.length) : undefined;
|
|
24
|
-
if (page === undefined || !isPageFile(page))
|
|
25
|
-
return undefined;
|
|
26
|
-
return `fondu:layouts:${layoutChain(root, page).join('|')}`;
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|