Skip to content

Conversation

@DIYgod
Copy link
Owner

@DIYgod DIYgod commented Jan 3, 2026

Involved Issue / 该 PR 相关 Issue

Close #

Example for the Proposed Route(s) / 路由地址示例

NOROUTE

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

Summary

  • Add Cloudflare Workers deployment support with dedicated worker entry point and configuration
  • Implement automatic .worker.ts module resolution to minimize manual aliases
  • Create lightweight Worker-specific app with optimized middleware for edge runtime

Changes

  • Add lib/worker.ts as Worker entry point with MessagePort polyfill for undici compatibility
  • Add lib/app.worker.tsx with simplified middleware stack (excludes heavy dependencies like Sentry, Cheerio, Redis)
  • Add Worker-specific utility modules: logger, cache, metrics, directory import, is-worker detection
  • Add tsdown-worker.config.ts with automatic .worker.ts resolution plugin
  • Update build scripts and wrangler configuration for Worker deployment
  • Configure Cloudflare Static Assets for favicon serving

Test Plan

  • Build worker bundle with npm run build:worker
  • Verify bundle is minified (~300KB gzipped)
  • Test RSS routes on Cloudflare Workers: /test/1 should return valid feed
  • Verify static assets (favicon, logo) are served correctly

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions github-actions bot added dependencies This PR involves changes to dependencies core enhancement labels Jan 3, 2026
@DIYgod DIYgod marked this pull request as draft January 3, 2026 03:19
import * as buffer from 'node:buffer';
import * as child_process from 'node:child_process';
import * as console_module from 'node:console';
import * as constants from 'node:constants';

Check warning

Code scanning / ESLint

disallow deprecated APIs Warning

'constants' module was deprecated since v6.3.0. Use 'constants' property of each module instead.
import path from 'node:path';
import * as perf_hooks from 'node:perf_hooks';
import * as process from 'node:process';
import * as punycode from 'node:punycode';

Check warning

Code scanning / ESLint

disallow deprecated APIs Warning

'punycode' module was deprecated since v7.0.0. Use 'https://www.npmjs.com/package/punycode' instead.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2026

Auto Route Test failed, please check your PR body format and reopen pull request. Check logs for more details.
自动路由测试失败,请确认 PR 正文部分符合格式规范并重新开启,详情请检查 日志

@github-actions github-actions bot added the auto: route no found Automated test failed due to route can not be found in PR description body label Jan 3, 2026
@github-actions github-actions bot closed this Jan 3, 2026
@DIYgod DIYgod reopened this Jan 3, 2026
@github-actions github-actions bot added auto: route test bypassed and removed auto: route no found Automated test failed due to route can not be found in PR description body labels Jan 3, 2026
DIYgod and others added 12 commits January 3, 2026 21:34
- Create Worker entry point (lib/worker.ts) with polyfills
- Implement Worker-specific app configuration (lib/app.worker.tsx)
- Add automatic .worker.ts resolution plugin for cleaner config
- Simplify build configuration with only 3 essential shims
- Enable static asset serving via Cloudflare Static Assets feature
- Support dynamic route loading with proper module aliasing

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
- Add @cloudflare/puppeteer for Browser Rendering API support
- Create puppeteer.worker.ts with Cloudflare Browser binding
- Add request-rewriter Worker version with static browser headers
- Add vm module shim to node-module.ts for JSDOM compatibility
- Configure __dirname/__filename in tsdown for CommonJS compat
- Update wrangler.toml with BROWSER binding configuration
- Dynamically extract namespaces from foloAnalysisTop100 for routes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The async initialization caused cache tests to fail because the cache
module wasn't ready when tests ran. Restored synchronous imports while
keeping Worker-specific no-op behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add miniflare for Worker environment simulation
- Create lib/worker.worker.test.ts with integration tests
- Test basic routes (/test/1, /, unknown routes)
- Test RSS feed routes (hackernews, v2ex)
- Test error handling for puppeteer routes without BROWSER binding
- Add worker-test npm script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Replace third-party routes (hackernews, v2ex, weibo) with /test/* routes
- Remove miniflare dependency (wrangler includes it internally)
- Simplify test setup using wrangler's unstable_dev API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The header-generator library may return different platform values due to
internal randomness. Update test to check for valid format instead of
exact value.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Worker tests require the dist-worker bundle to be built first,
which is not part of the regular CI test workflow. These tests
should be run separately using 'pnpm worker-test'.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add worker-build step to CI workflow before running tests
- Revert exclusion of worker tests from vitest coverage run
- Worker tests now run as part of the regular test suite

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Change alias key from absolute path to relative import path to match
how it's imported in lib/registry.ts. This fixes the worker build
failing with "Could not resolve '../assets/build/routes.js'" error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The worker build requires routes-worker.js which is generated by
running build:routes with WORKER_BUILD=true. This was missing in CI,
causing the worker build to fail with "Could not resolve routes.js".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Worker tests need more time in CI environments. Increase individual
test timeouts from default 10s to 30s for each test case.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@DIYgod DIYgod force-pushed the DIYgod/cf-worker-deploy branch from 562230b to ae6bb33 Compare January 3, 2026 13:34
@DIYgod DIYgod marked this pull request as ready for review January 4, 2026 01:21
@DIYgod DIYgod merged commit 1131350 into master Jan 4, 2026
48 of 50 checks passed
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@DIYgod DIYgod deleted the DIYgod/cf-worker-deploy branch January 4, 2026 01:22
@whitewatercn
Copy link

tqlyy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants