-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
12,556 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"jsx": "react", | ||
"module": "ESNext", | ||
"target": "ESNext", | ||
"esModuleInterop": true, | ||
"strictNullChecks": true, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"lib": [ | ||
"esnext", | ||
"dom" | ||
], | ||
"moduleResolution": "bundler" | ||
}, | ||
"include": [ | ||
"src", | ||
"vitest.config.ts", | ||
"tsup.config.ts" | ||
], | ||
"exclude": [ | ||
"**/node_modules/**", | ||
"dist" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "@bippy/scan", | ||
"private": true, | ||
"type": "module", | ||
"main": "../bippy/dist/scan/index.js", | ||
"module": "../bippy/dist/scan/index.js", | ||
"types": "../bippy/dist/scan/index.d.ts", | ||
"scripts": { | ||
"dev": "NODE_ENV=development vite build --watch", | ||
"build": "vite build", | ||
"dev2": "vite" | ||
}, | ||
"dependencies": { | ||
"@preact/signals": "^1.3.1", | ||
"bippy": "workspace:*", | ||
"preact": "^10.25.1" | ||
}, | ||
"devDependencies": { | ||
"@pivanov/vite-plugin-svg-sprite": "3.0.0-rc-0.0.10", | ||
"@remix-run/react": "*", | ||
"@types/rollup": "^0.54.0", | ||
"autoprefixer": "^10.4.20", | ||
"clsx": "^2.1.1", | ||
"next": "*", | ||
"postcss": "^8.4.49", | ||
"react": "*", | ||
"react-dom": "*", | ||
"react-router": "^5.0.0", | ||
"react-router-dom": "^5.0.0 || ^6.0.0 || ^7.0.0", | ||
"rollup": "^4.29.1", | ||
"tailwind-merge": "^2.6.0", | ||
"tailwindcss": "^3.4.17", | ||
"vite": "^6.0.7", | ||
"vite-plugin-dts": "^4.4.0", | ||
"vite-tsconfig-paths": "^5.1.4", | ||
"vitest": "^2.1.8" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@remix-run/react": { | ||
"optional": true | ||
}, | ||
"next": { | ||
"optional": true | ||
}, | ||
"react-router": { | ||
"optional": true | ||
}, | ||
"react-router-dom": { | ||
"optional": true | ||
} | ||
}, | ||
"optionalDependencies": { | ||
"unplugin": "2.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## todo | ||
|
||
- think of ways to highlight what the actual problems are | ||
- service worker | ||
- port over select tool | ||
|
||
## notes | ||
|
||
- feature compat with existing version (core, instrumentation, highlighting) | ||
- refactor main website | ||
- playwright version | ||
|
||
# react scan v1 architecture | ||
|
||
- `bippy` / `@react-scan/web-vitals` | ||
- `@react-scan/web-instrumentation`: web instrumentation, export API for renders, types of renders, FPS, CWV | ||
- `react-scan`: | ||
- web highlighting overlay | ||
- web toolbar | ||
- `@react-scan/playwright`: | ||
- playwright plugin (... for each testing lib) | ||
- `@react-scan/sdk`: | ||
- observability sdk | ||
- `@react-scan/native-instrumentation`: native instrumentation, export API for renders, types of renders, FPS, CWV | ||
- `@react-scan/native`: | ||
- native highlighting overlay | ||
- native toolbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// <reference types="astro/client" /> | ||
|
||
declare module '*.astro' { | ||
const Component: unknown; | ||
export default Component; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import { fastSerialize } from '~core/instrumentation'; | ||
|
||
describe('fastSerialize', () => { | ||
it('serializes null', () => { | ||
expect(fastSerialize(null)).toBe('null'); | ||
}); | ||
|
||
it('serializes undefined', () => { | ||
expect(fastSerialize(undefined)).toBe('undefined'); | ||
}); | ||
|
||
it('serializes strings', () => { | ||
expect(fastSerialize('hello')).toBe('hello'); | ||
expect(fastSerialize('')).toBe(''); | ||
}); | ||
|
||
it('serializes numbers', () => { | ||
expect(fastSerialize(42)).toBe('42'); | ||
expect(fastSerialize(0)).toBe('0'); | ||
expect(fastSerialize(Number.NaN)).toBe('NaN'); | ||
}); | ||
|
||
it('serializes booleans', () => { | ||
expect(fastSerialize(true)).toBe('true'); | ||
expect(fastSerialize(false)).toBe('false'); | ||
}); | ||
|
||
it('serializes functions', () => { | ||
const testFunc = (_x: 2) => 3 | ||
expect(fastSerialize(testFunc)).toBe('(_x) => 3'); | ||
}); | ||
|
||
it('serializes arrays', () => { | ||
expect(fastSerialize([])).toBe('[]'); | ||
expect(fastSerialize([1, 2, 3])).toBe('[3]'); | ||
}); | ||
|
||
it('serializes plain objects', () => { | ||
expect(fastSerialize({})).toBe('{}'); | ||
expect(fastSerialize({ a: 1, b: 2 })).toBe('{2}'); | ||
}); | ||
|
||
it('serializes deeply nested objects with depth limit', () => { | ||
const nested = { a: { b: { c: 1 } } }; | ||
expect(fastSerialize(nested, 0)).toBe('{1}'); | ||
expect(fastSerialize(nested, -1)).toBe('…'); | ||
}); | ||
|
||
it('serializes objects with custom constructors', () => { | ||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
class CustomClass {} | ||
const instance = new CustomClass(); | ||
expect(fastSerialize(instance)).toBe('CustomClass{…}'); | ||
}); | ||
|
||
it('serializes unknown objects gracefully', () => { | ||
const date = new Date(); | ||
const serialized = fastSerialize(date); | ||
expect(serialized.includes('Date')).toBe(true); | ||
}); | ||
}); |
Oops, something went wrong.