-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] main from regenrek:main #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…trics - Added `@cloudflare/workers-types` as a devDependency for improved type support. - Introduced `PerformanceMetrics` interface to track performance metrics in `FetchMetadata`. - Updated `FileContent` interface to include optional properties for better file handling. - Adjusted `build.config.ts` to disable warnings during build. - Enhanced type definitions across various files for improved usability and maintainability. These changes improve the SDK's type definitions and enhance its functionality for developers working with Cloudflare Workers.
Feat/cloudflare support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detailed code review comments
| return parts.every((part) => { | ||
| const num = Number.parseInt(part, 10); | ||
| return !isNaN(num) && num >= 0 && num <= 255 && part === num.toString(); | ||
| return !Number.isNaN(num) && num >= 0 && num <= 255 && part === num.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvement: Using Number.isNaN() instead of global isNaN() is more precise and safer
| const size = Number.parseInt(sizeStr, 8); | ||
| const typeFlag = String.fromCharCode(block[156]); | ||
| const typeFlag = String.fromCodePoint(block[156]); | ||
| return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good update: fromCodePoint() is more modern and has better Unicode support than fromCharCode()
| private url: string; | ||
| private result: FetchResult; | ||
| root: FileNode; | ||
| url: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing private fields to public may break encapsulation. Consider if this is intentional
| // Check if expired | ||
| const metadata = await kv.getWithMetadata(key); | ||
| if (metadata.metadata?.expires) { | ||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good enhancement to add type checking for metadata object structure, making the code more type-safe
| if (cacheStorage.type === "cache-api") { | ||
| const cache = cacheStorage.instance as Cache; | ||
| const _cache = cacheStorage.instance as Cache; | ||
| // Cache API doesn't support listing, so we can't clear by pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable renamed with underscore prefix, but consider removing it entirely if not used
| return parts.every((part) => { | ||
| const num = Number.parseInt(part, 10); | ||
| return !isNaN(num) && num >= 0 && num <= 255 && part === num.toString(); | ||
| return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change replacing isNaN() with Number.isNaN() for more precise NaN checking
| declaration: true, | ||
| clean: true, | ||
| failOnWarn: false, | ||
| externals: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling build warnings could hide potential issues. Consider handling warnings instead of suppressing them.
| */ | ||
|
|
||
| // @ts-ignore - importing from built file | ||
| import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using @ts-ignore. Consider fixing the underlying import issue or using @ts-expect-error with explanation if absolutely necessary.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )
Summary by Sourcery
Introduce comprehensive enhancements to the SDK’s streaming, caching, migration, tree utilities, error handling, and type definitions, alongside build and CI updates.
New Features:
Enhancements:
Build:
CI:
Chores: