Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

feat: support custom fallback routes #14

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

fubhy
Copy link
Collaborator

@fubhy fubhy commented Apr 26, 2023

PR-Codex overview

This PR adds support for custom fallback routes to the @viem/anvil package. It also includes changes to improve code readability, fix bugs and add types.

Detailed summary

  • Added support for custom fallback routes.
  • Changed the type of pool in startProxy and createPool to Pool instead of Pool<number>.
  • Changed the return type of fetchLogs to Promise<string[]>.
  • Improved the regex in parseRequest to handle more cases.
  • Added types and type aliases for ProxyResponse, ProxyRequestHandler, ProxyRequestContext, AnvilProxyOptionsFn, InstanceRequestContext.
  • Changed the type of options in CreateProxyOptions to AnvilProxyOptions.
  • Added a new property fallback to CreateProxyOptions to handle custom proxy requests.
  • Fixed a bug where stop would throw an error when trying to stop a non-existent instance.
  • Updated the on method in createPool to be typed via the return type instead of using any.
  • Added error handling to fetchLogs and createAnvil.
  • Improved code readability with better variable names and comments.

The following files were skipped due to too many changes: packages/anvil.js/src/proxy/createProxy.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented Apr 26, 2023

🦋 Changeset detected

Latest commit: a2fe260

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@viem/anvil Patch

Not sure what this means? Click here to learn what changesets are.

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

@commit-lint
Copy link

commit-lint bot commented Apr 26, 2023

Features

  • support custom fallback routes (3496862)

Chore

Contributors

fubhy

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

@fubhy fubhy force-pushed the feat/proxy-request-handler-fallback branch from 89ad472 to 3496862 Compare April 26, 2023 11:58
@github-actions
Copy link
Contributor

github-actions bot commented Apr 26, 2023

Size Change: +966 B (+8%) 🔍

Total Size: 13.5 kB

Filename Size Change
packages/anvil.js/dist/cjs/anvil/createAnvil.js 1.61 kB +24 B (+2%)
packages/anvil.js/dist/cjs/pool/createPool.js 906 B -8 B (-1%)
packages/anvil.js/dist/cjs/proxy/createProxy.js 1.31 kB +326 B (+33%) 🚨
packages/anvil.js/dist/cjs/proxy/fetchLogs.js 408 B +59 B (+17%) ⚠️
packages/anvil.js/dist/cjs/proxy/parseRequest.js 495 B +77 B (+18%) ⚠️
packages/anvil.js/dist/esm/anvil/createAnvil.js 1.51 kB +22 B (+1%)
packages/anvil.js/dist/esm/pool/createPool.js 815 B -7 B (-1%)
packages/anvil.js/dist/esm/proxy/createProxy.js 1.25 kB +335 B (+37%) 🚨
packages/anvil.js/dist/esm/proxy/fetchLogs.js 338 B +56 B (+20%) 🚨
packages/anvil.js/dist/esm/proxy/parseRequest.js 436 B +82 B (+23%) 🚨
ℹ️ View Unchanged
Filename Size
packages/anvil.js/dist/cjs/anvil/getVersion.js 316 B
packages/anvil.js/dist/cjs/anvil/stripColors.js 327 B
packages/anvil.js/dist/cjs/anvil/toArgs.js 405 B
packages/anvil.js/dist/cjs/anvil/toFlagCase.js 282 B
packages/anvil.js/dist/cjs/index.js 355 B
packages/anvil.js/dist/cjs/proxy/startProxy.js 725 B
packages/anvil.js/dist/cjs/types.js 124 B
packages/anvil.js/dist/esm/anvil/getVersion.js 239 B
packages/anvil.js/dist/esm/anvil/stripColors.js 260 B
packages/anvil.js/dist/esm/anvil/toArgs.js 334 B
packages/anvil.js/dist/esm/anvil/toFlagCase.js 216 B
packages/anvil.js/dist/esm/index.js 165 B
packages/anvil.js/dist/esm/proxy/startProxy.js 645 B
packages/anvil.js/dist/esm/types.js 64 B

compressed-size-action

@fubhy fubhy merged commit c617901 into main Apr 26, 2023
7 checks passed
@fubhy fubhy deleted the feat/proxy-request-handler-fallback branch April 26, 2023 12:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant