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: support for raw "unsafe bindings" #411

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/healthy-cooks-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"wrangler": patch
---

feat: unsafe-bindings

Adds support for "unsafe bindings", that is, bindings that aren't supported by wrangler, but are
desired when uploading a Worker to Cloudflare. This allows you to use beta features before
official support is added to wrangler, while also letting you migrate to proper support for the
feature when desired. Note: these bindings may not work everywhere, and may break at any time.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"xxhash"
],
"cSpell.ignoreWords": ["yxxx"],
"eslint.runtime": "node"
"eslint.runtime": "node",
"files.trimTrailingWhitespace": false
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have it configured to trim trailing whitespace on save on VS Code (which makes sense for most projects I work on). But in this project from what I can tell trailing whitespace is necessary for tests that test console output (since they make empty lines).

Copy link
Contributor

Choose a reason for hiding this comment

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

I would really like to have all trailing whitespace removed in this project.
Which tests were failing when trimmed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any test with a snapshot with an empty line. It makes an inline snapshot like this

      expect(std.out).toMatchInlineSnapshot(`
        "Uploaded
        test-name
        (TIMINGS)
        Deployed
        test-name
        (TIMINGS)
         
        test-name.test-sub-domain.workers.dev"
      `);

Which if you have trim whitespace on save enabled will immediately remove the spaces that are actually needed for the snapshot. An alternative solution to this is moving the snapshots to their own files instead and just not editing them manually.

Copy link
Contributor

@threepointone threepointone Feb 10, 2022

Choose a reason for hiding this comment

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

I'm not sure I follow, does it trim whitespace inside the snapshot string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there's significant whitespace on this "empty" line

        (TIMINGS)
         
        test-name.test-sub-domain.workers.dev"

Remove trailing whitespace would delete all the whitespace on the line, including the significant whitespace required for the test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh!!! That's really horrible.

We should fix the std.out to remove such blank lines, since we are already do other processing on this output for testing.

Either way, we should not allow trailing whitespace in our code.

}
Loading