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: second-cut of using unenv to create a hybrid node.js compatibility setting (via inject) #5878

Merged
merged 29 commits into from
Jun 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
61cbf9d
feat: first-cut of using unenv to create a hybrid node.js compatibili…
petebacondarwin Mar 11, 2024
617a949
fix up pg cloudflare socket detection
petebacondarwin Mar 12, 2024
6e425c2
fix up unenv integration, use inject instead of various hacks
IgorMinar May 21, 2024
a4f1e21
make the side-effects of injected globals tree-shakeable
IgorMinar May 21, 2024
3618331
mark unenv as external so that it doesn't get bundled into wrangler
IgorMinar May 22, 2024
2437267
don't configure esbuild with a define to rewrite global to globalThis…
IgorMinar May 22, 2024
8c640b8
correctly provide the global polyfill if inject is defined as a string
IgorMinar May 22, 2024
c45a91b
fix lint issues
IgorMinar May 22, 2024
8b62219
add turbo.json file
IgorMinar May 22, 2024
b47cf6c
update the activation mechanism to be just a runtime flag 'nodejs_com…
IgorMinar Jun 4, 2024
dfbf85f
update to unenv-nightly@1.10.0-1717495514.cea841e
IgorMinar Jun 4, 2024
d064991
switch to experimenta:nodejs_compat_v2 activation flag
IgorMinar Jun 4, 2024
7f09dba
fix: ignore aliases for packages that are not installed in the curren…
IgorMinar Jun 5, 2024
5d00d69
prettify
IgorMinar Jun 5, 2024
961d1a2
fixup: update unenv to 1.10.0-1717606461.a117952
IgorMinar Jun 5, 2024
1e9b4a6
post-review fixups
petebacondarwin Jun 5, 2024
461e1ae
Add changeset
petebacondarwin Jun 5, 2024
ae685f9
Update the fixture and add a test
petebacondarwin Jun 5, 2024
55f3f14
Separate out the require call conversion from the alias import handli…
petebacondarwin Jun 5, 2024
3d84d9d
Make sure we don't match packages that don't exist
petebacondarwin Jun 5, 2024
3c854aa
Fix formatting on the new fixture test
petebacondarwin Jun 5, 2024
564311d
Fix deploy test snapshot for change to warning
petebacondarwin Jun 5, 2024
7a4c8f4
Fix fixture test to be resilient to timezone changes
petebacondarwin Jun 5, 2024
d3022e0
update the fixture to include an built-in alias
IgorMinar Jun 6, 2024
6de7e89
Match externals against the alias rather than the original path
petebacondarwin Jun 6, 2024
12b2b8e
Refactor node-compat validation and handling into a helper function
petebacondarwin Jun 6, 2024
b8493ef
Remove extra node-compat validation call, which was messing things up…
petebacondarwin Jun 6, 2024
0ec2e86
Use a global (Buffer) in the fixture and test it works
petebacondarwin Jun 6, 2024
8639e8b
Use named parameters for the validateNodeCompat() function
petebacondarwin Jun 6, 2024
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
Prev Previous commit
Next Next commit
don't configure esbuild with a define to rewrite global to globalThis…
… - use unenv instead
  • Loading branch information
IgorMinar authored and petebacondarwin committed Jun 6, 2024
commit 24372674dfda3e1a3d9f4cdad8a2720783af68c6
2 changes: 1 addition & 1 deletion packages/wrangler/src/deployment-bundle/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export async function bundleWorker(
// use process.env["NODE_ENV" + ""] so that esbuild doesn't replace it
// when we do a build of wrangler. (re: /~https://github.com/cloudflare/workers-sdk/issues/1477)
"process.env.NODE_ENV": `"${process.env["NODE_ENV" + ""]}"`,
...(legacyNodeCompat ? { global: "globalThis" } : {}),
...(legacyNodeCompat && !nodejsCompat ? { global: "globalThis" } : {}),
...define,
},
}),
Expand Down