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

Local Mode Console Support #2193

Merged
merged 9 commits into from
Nov 16, 2022
Merged

Conversation

JacobMGEvans
Copy link
Contributor

Added support for console logging when using miniflare3

resolves #2122

@changeset-bot
Copy link

changeset-bot bot commented Nov 15, 2022

🦋 Changeset detected

Latest commit: cda7e9d

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

This PR includes changesets to release 1 package
Name Type
wrangler Minor

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 15, 2022

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

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/3481535103/npm-package-wrangler-2193

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/2193/npm-package-wrangler-2193

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/3481535103/npm-package-wrangler-2193 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.developers.workers.dev/runs/3481535103/npm-package-cloudflare-pages-shared-2193

@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Merging #2193 (cda7e9d) into main (add4278) will decrease coverage by 0.09%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2193      +/-   ##
==========================================
- Coverage   71.88%   71.79%   -0.10%     
==========================================
  Files         145      145              
  Lines        9441     9452      +11     
  Branches     2459     2463       +4     
==========================================
- Hits         6787     6786       -1     
- Misses       2654     2666      +12     
Impacted Files Coverage Δ
packages/wrangler/src/dev/local.tsx 23.29% <0.00%> (-1.50%) ⬇️
packages/wrangler/src/dev/start-server.ts 63.22% <ø> (ø)
packages/wrangler/src/dialogs.tsx 23.72% <0.00%> (ø)

Copy link
Contributor

@mrbbot mrbbot left a comment

Choose a reason for hiding this comment

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

Nice! :) Added some comments. I'm still a little confused how this works, as the Wrangler inspector proxy and the workerd inspector are binding to the same port, but I've tested multiple Wrangler instances and seems fine. 😕

.changeset/strange-wolves-pull.md Outdated Show resolved Hide resolved
packages/wrangler/src/__tests__/dev.test.tsx Show resolved Hide resolved
packages/wrangler/src/dev/local.tsx Outdated Show resolved Hide resolved
packages/wrangler/src/dev/local.tsx Outdated Show resolved Hide resolved
packages/wrangler/src/dev/local.tsx Outdated Show resolved Hide resolved
packages/wrangler/src/dev/local.tsx Outdated Show resolved Hide resolved
@JacobMGEvans JacobMGEvans force-pushed the jacobmgevans/console-support-local branch from 2057fd5 to d9789b4 Compare November 16, 2022 15:48
Copy link
Contributor

@mrbbot mrbbot left a comment

Choose a reason for hiding this comment

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

Looks good, assuming CI passes ✅

@JacobMGEvans JacobMGEvans force-pushed the jacobmgevans/console-support-local branch from ba0f368 to cda7e9d Compare November 16, 2022 17:12
@JacobMGEvans JacobMGEvans merged commit 0047ad3 into main Nov 16, 2022
@JacobMGEvans JacobMGEvans deleted the jacobmgevans/console-support-local branch November 16, 2022 17:24
@github-actions github-actions bot mentioned this pull request Nov 16, 2022
try {
// fetch the inspector JSON response from the DevTools Inspector protocol
const inspectorJSONArr = (await (
await fetch(`http://127.0.0.1:${inspectorPort}/json`)
Copy link
Member

Choose a reason for hiding this comment

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

FYI, this fetch() fails on Node 16, which doesn't have fetch() as a built-in yet. You'll have to import node-fetch or change the package.json to require Node 18.

Copy link
Contributor

Choose a reason for hiding this comment

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

This was fixed in #2377, but it looks like this hasn't had a stable release yet. You should be able to npm install wrangler@beta to use the main branch.

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.

🚀 Feature: console.log support for object properties
4 participants