implement platform info - #412
Draft
Uzlopak wants to merge 16 commits into
Draft
Conversation
commit: |
size-limit report 馃摝
|
Uzlopak
marked this pull request as draft
November 8, 2025 02:57
Contributor
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- types: collapse PlatformMetrics to a single flat interface (drop the non-discriminable Omit-based union; runtime: JSRuntime) - machine: normalize to the process.arch vocabulary (drop phantom x32); align the Machine union to the closed process.arch set - browser: derive OS from a navigator.platform prefix map instead of routing it through the arch normalizer (MacIntel -> darwin, etc.) - cache: only memoize the default environment; custom g/runtime bypass it entirely (no stale reads, no poisoning on useCache:false) - priority defaults to null (unknown), not -1 (a valid nice value) - export getPlatformMetrics/normalizeMachine/normalizeOSType + types - misc: hoist os.cpus(), consistent @ts-expect-error, type-only import, statement-form normalizers, richer JSDoc, drop interface semicolons - tests: update arch expectations to process.arch; add browser + cache regression tests
- browserOSType now takes userAgent: real Android reports navigator.platform 'Linux armv8l', not 'Android', so detect it from the user agent before the linux prefix (fixes the dead android branch) - machineLookup: map armv6l/armv7l/armv8l -> 'arm' so 32-bit ARM tokens stay in the process.arch vocabulary instead of leaking via the escape hatch - add 'armv' to the cspell word list - tests: Android-via-UA detection, desktop-linux stays linux, armv* arch
size-limit bundles dist/index.js with esbuild (browser target), which
cannot resolve the dynamic `import('node:os')` used by the platform
feature. Declaring it as ignored lets size-limit resolve and measure the
bundle instead of failing to build.
typedoc --treatWarningsAsErrors fails because normalizeOSType's public
doc comment linked to browserOSType, an internal (non-exported) helper.
Replace the {@link} with plain text so a public symbol no longer links
to a private one.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #176
It is actually quite annoying to implement this without trying to start implementing stuff like useragent parsing. So the focus is nodejs.
I am not happy with some of the names.
Still need some input on how to show this information.