Skip to content

Commit 93e6a38

Browse files
committed
fix(event-client): update event client to latest
1 parent eba4084 commit 93e6a38

4 files changed

Lines changed: 61 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/form-core': patch
3+
---
4+
5+
Bump `@tanstack/devtools-event-client` to `^0.5.1`.

‎packages/form-core/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"scripts": {
1818
"clean": "premove ./dist ./coverage",
19-
"test:eslint": "eslint ./src ./tests",
19+
"test:eslint": "eslint ./src ./tests ./test-build",
2020
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
2121
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
2222
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
@@ -26,7 +26,7 @@
2626
"test:types:ts59": "tsc",
2727
"test:lib": "vitest",
2828
"test:lib:dev": "pnpm run test:lib --watch",
29-
"test:build": "publint --strict",
29+
"test:build": "publint --strict && vitest --dir ./test-build --coverage.enabled=false --typecheck.enabled=false",
3030
"build": "vite build"
3131
},
3232
"type": "module",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { fileURLToPath } from 'node:url'
2+
import { describe, expect, it } from 'vitest'
3+
import { build } from 'vite'
4+
import type { Rollup } from 'vite'
5+
6+
const entry = fileURLToPath(new URL('../dist/esm/index.js', import.meta.url))
7+
8+
const eventClientPackage = '@tanstack/devtools-event-client'
9+
const eventClientModule = 'plugin.js'
10+
11+
async function bundle(mode: 'production' | 'development') {
12+
const result = (await build({
13+
configFile: false,
14+
logLevel: 'silent',
15+
mode,
16+
define: { 'process.env.NODE_ENV': JSON.stringify(mode) },
17+
build: {
18+
write: false,
19+
minify: false,
20+
lib: { entry, formats: ['es'], fileName: 'index' },
21+
},
22+
})) as Array<Rollup.RollupOutput>
23+
24+
return result
25+
.flatMap((output) => output.output)
26+
.filter((chunk): chunk is Rollup.OutputChunk => chunk.type === 'chunk')
27+
}
28+
29+
function renderedEventClientModules(chunks: Array<Rollup.OutputChunk>) {
30+
return chunks
31+
.flatMap((chunk) => Object.entries(chunk.modules))
32+
.filter(
33+
([id, module]) =>
34+
id.includes(eventClientPackage) &&
35+
id.endsWith(`/${eventClientModule}`) &&
36+
module.renderedLength > 0,
37+
)
38+
.map(([id, module]) => ({ id, renderedLength: module.renderedLength }))
39+
}
40+
41+
describe('bundle', () => {
42+
it('excludes the devtools event client from production bundles', async () => {
43+
const chunks = await bundle('production')
44+
45+
expect(renderedEventClientModules(chunks)).toEqual([])
46+
})
47+
48+
it('includes the devtools event client in development bundles', async () => {
49+
const chunks = await bundle('development')
50+
51+
expect(renderedEventClientModules(chunks)).not.toEqual([])
52+
})
53+
})

‎packages/form-core/tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"moduleResolution": "Bundler"
55
// "noErrorTruncation": true
66
},
7-
"include": ["src", "tests", "eslint.config.js", "vite.config.ts"]
7+
"include": ["src", "tests", "test-build", "eslint.config.js", "vite.config.ts"]
88
}

0 commit comments

Comments
 (0)