Skip to content

Conversation

@ItsWendell
Copy link
Contributor

@ItsWendell ItsWendell commented Mar 28, 2025

Additionally adds a --metafile flag and adjusts tests and added it to all build flows.

fixes #4633

(first attempyt #7927)

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • Wrangler E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: not affected
  • Public documentation
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: not a patch change

@ItsWendell ItsWendell requested review from a team as code owners March 28, 2025 17:38
@changeset-bot
Copy link

changeset-bot bot commented Mar 28, 2025

🦋 Changeset detected

Latest commit: 37250ad

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

This PR includes changesets to release 2 packages
Name Type
wrangler Minor
@cloudflare/vitest-pool-workers 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

Copy link
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for putting this PR up, sorry its been sitting a while - dev week has been a bit hectic :)

Couple of things:

  • can you rebase on main? the original pr was from quite a while ago, and there's been some refactoring in the deploy command.
  • can you add a changeset?

@ItsWendell ItsWendell changed the base branch from meta-file to main April 15, 2025 10:48
@ItsWendell ItsWendell force-pushed the meta-file branch 3 times, most recently from ad64979 to 8a71cb7 Compare April 15, 2025 11:14
@ItsWendell ItsWendell force-pushed the meta-file branch 2 times, most recently from 9d79b21 to c8cc2be Compare April 15, 2025 11:41
@ItsWendell
Copy link
Contributor Author

@emily-shen I added a changeset, rebased, cleaned up and adjusted the PR to point to main. If there's any adjustments I can make let me know!

@github-actions
Copy link
Contributor

github-actions bot commented Apr 16, 2025

A Wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-wrangler-8716
Prereleases for other packages:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-workers-bindings-extension-8716 -O ./cloudflare-workers-bindings-extension.0.0.0-v20eb42421.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v20eb42421.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-create-cloudflare-8716 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-kv-asset-handler-8716

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-miniflare-8716

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-pages-shared-8716

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-unenv-preset-8716

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-vite-plugin-8716

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-vitest-pool-workers-8716

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-workers-editor-shared-8716

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-workers-shared-8716

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14973160571/npm-package-cloudflare-workflows-shared-8716

Note that these links will no longer work once the GitHub Actions artifact expires.

@ItsWendell
Copy link
Contributor Author

ItsWendell commented Apr 16, 2025

Here's something cool that we can explore potentially after this patch too, with an --analyze flag for example, if I link the latest version of this PR to a simple hono project and add the following script to my pacakge.json:

    "analyze": "wrangler deploy --dry-run --metafile=./meta.json && bunx esbuild-visualizer --metadata ./meta.json && xdg-open stats.html"

Using esbuild-visualiser since it runs locally and was easy to add to the command here, but there's alternatives like https://github.com/filipsobol/sonda too.

I get the following when I run pnpm run analyze:

image

@ItsWendell ItsWendell force-pushed the meta-file branch 2 times, most recently from 6463630 to edaf351 Compare April 17, 2025 12:07
@ItsWendell
Copy link
Contributor Author

@emily-shen Thanks for the review, I've done the changes you requested and simplified the flag description.

@vicb
Copy link
Contributor

vicb commented May 5, 2025

@ItsWendell Thanks for the PR and sorry for the delay.

Could you please work on a doc PR (https://github.com/cloudflare/cloudflare-docs) or at least create an issue there.

Please mention me (@vicb) when you rebase the current PR and on the doc PR/issue to make sure I don't miss the notification.

Copy link
Contributor

@emily-shen emily-shen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm pending some minor changes! let me know if you need a hand with docs, and thanks so much for the contribution 🧡

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk May 12, 2025
@emily-shen emily-shen added this pull request to the merge queue May 12, 2025
Merged via the queue into cloudflare:main with commit 63a6504 May 12, 2025
15 of 16 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk May 12, 2025
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes an open-source contribution, big or small label May 12, 2025
@holopin-bot
Copy link

holopin-bot bot commented May 12, 2025

Congratulations @ItsWendell, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cmal7025c09130djsl1bsd50u

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

@DaniFoldi
Copy link
Contributor

Many many thanks @ItsWendell for implementing this 🔥

@vicb
Copy link
Contributor

vicb commented May 13, 2025

Awesome feature, thanks to @ItsWendell and @emily-shen 🙏

@ItsWendell
Copy link
Contributor Author

As a potential follow-up, it would be cool if wrangler had a built-in bundle analyzer.

wrangler analyze

Or something similar, are you open to discussing this and how it would fit within the repository? E.g. by using CLI-based output or potentially one of the few open source projects / dependencies that take an esbuild metafile and shows a GUI web interface for it, as a optional dependency, or something self built?

@vicb @emily-shen

@vicb
Copy link
Contributor

vicb commented May 13, 2025

@ItsWendell feel free to start a discussion (ping me there so that I get notified).

IMO we don't want to add this to the workers-sdk because that it something we would have to maintain. There is also https://esbuild.github.io/analyze/ already and improving that is probably is better idea rather than duplicating.

But again if you start a discussion, we can discuss internally to see if others have a different opinion.

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

Labels

contribution [Holopin] Recognizes an open-source contribution, big or small

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

🚀 Feature Request: Option to output esbuild metafile

5 participants