Skip to content
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

feat(devtools): implement header modifier #4978

Merged
merged 11 commits into from
Nov 27, 2023
Merged

Conversation

Asuka109
Copy link
Contributor

@Asuka109 Asuka109 commented Nov 21, 2023

Summary

🤖[deprecated] Generated by Copilot at 4a14bab

This pull request adds a new feature to the devtools client, which allows users to modify request headers for debugging purposes. It implements a custom webpack plugin to create a service worker file that modifies headers based on rules stored in IndexedDB. It also adds a new header modifier tab to the devtools client, which provides a UI for editing and managing the rules and the service worker. It updates the package.json, tsconfig.json, and eslint files to support the new feature. It refactors the rpc module to split the server and client logic into separate files. It adds some utility functions and interfaces for the header modifier feature.

Details

🤖[deprecated] Generated by Copilot at 4a14bab

  • Add a header modifier feature to the devtools client, which allows users to create and apply rules for modifying the headers of requests (link, link, link, link, link)
  • Use a service worker to intercept and modify the requests based on the rules, and store and retrieve the rules in the IndexedDB using the idb-keyval package (link, link)
  • Use the ServiceWorkerCompilerPlugin to create the service worker file from the src/service.worker.ts file, and inject the version from the package.json file (link, link, link, link, link)
  • Use the navigator.serviceWorker API to register, unregister, and query the service worker, and expose some functions and state for the client components (link, link, link)
  • Render a tab with an icon for the header modifier feature, and navigate to different subpages based on the service status (link, link, link)
  • Render a welcome page with a button to enable the feature, and a link to the service worker file (link)
  • Render an editor page with a list of inputs for the rules, and buttons for registering and unregistering the service worker (link)
  • Refactor the rpc module to split the server and client logic into separate files, and re-export everything from the rpc/index.ts file (link, link)
  • Add the assert function to the utils module, which checks for falsy values and throws an error, and use the asserts type predicate to narrow the types (link, link)
  • Add a type annotation for the module.exports object in the .eslintrc.js file, using the import syntax from the eslint package (link)
  • Add the outDir property to the tsconfig.json file, and include the plugins folder in the compilation (link, link)
  • Add the @rspack/core package as a devDependency, and reorder the devDependencies in alphabetical order (link, link)

Related Issue

Checklist

  • I have added changeset via pnpm run change.
  • I have updated the documentation.
  • I have added tests to cover my changes.

Copy link

changeset-bot bot commented Nov 21, 2023

⚠️ No Changeset found

Latest commit: ab19c5f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Asuka109 Asuka109 changed the title feat: implement basic header modifier base on service worker (#4975) [WIP] feat(devtools): implement header modifier Nov 21, 2023
@Asuka109 Asuka109 changed the title [WIP] feat(devtools): implement header modifier feat(devtools): implement header modifier Nov 27, 2023
@chenjiahan chenjiahan merged commit e387aa4 into main Nov 27, 2023
10 checks passed
@chenjiahan chenjiahan deleted the dev/devtools-header-modifier branch November 27, 2023 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants