-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove webapi in favor of a smaller polyfill (#7840)
* feat: remove webapi in favor of a smaller polyfill * test: remove old test * test: 🤦♀️ * chore: changeset
- Loading branch information
1 parent
7d2f311
commit 148e61d
Showing
84 changed files
with
37 additions
and
3,775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'astro': major | ||
'@astrojs/netlify': major | ||
'@astrojs/vercel': major | ||
'@astrojs/node': major | ||
--- | ||
|
||
Reduced the amount of polyfills provided by Astro. Astro will no longer provide (no-op) polyfills for several web apis such as HTMLElement, Image or Document. If you need access to those APIs on the server, we recommend using more proper polyfills available on npm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,4 @@ benchmark/results/ | |
.changeset | ||
|
||
# Files | ||
packages/webapi/mod.d.ts | ||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { polyfill } from '@astrojs/webapi'; | ||
import { File } from 'node:buffer'; | ||
import crypto from 'node:crypto'; | ||
|
||
// NOTE: This file does not intend to polyfill everything that exists, its main goal is to make life easier | ||
// for users deploying to runtime that do support these features. In the future, we hope for this file to disappear. | ||
|
||
export function apply() { | ||
// polyfill WebAPIs for Node.js runtime | ||
polyfill(globalThis, { | ||
exclude: 'window document', | ||
}); | ||
// Remove when Node 18 is dropped for Node 20 | ||
if (!globalThis.crypto) { | ||
Object.defineProperty(globalThis, 'crypto', { | ||
value: crypto.webcrypto, | ||
}); | ||
} | ||
|
||
// Remove when Node 18 is dropped for Node 20 | ||
if (!globalThis.File) { | ||
Object.defineProperty(globalThis, 'File', { | ||
value: File, | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/astro/test/fixtures/custom-elements/astro.config.mjs
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/astro/test/fixtures/custom-elements/my-component-lib/hydration-polyfill.js
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
packages/astro/test/fixtures/custom-elements/my-component-lib/index.js
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
packages/astro/test/fixtures/custom-elements/my-component-lib/package.json
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
packages/astro/test/fixtures/custom-elements/my-component-lib/polyfill.js
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
packages/astro/test/fixtures/custom-elements/my-component-lib/server.js
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
packages/astro/test/fixtures/custom-elements/my-component-lib/shim.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
packages/astro/test/fixtures/custom-elements/src/components/my-element.js
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
packages/astro/test/fixtures/custom-elements/src/pages/ctr.astro
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
packages/astro/test/fixtures/custom-elements/src/pages/index.astro
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
packages/astro/test/fixtures/custom-elements/src/pages/nested.astro
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
packages/astro/test/fixtures/custom-elements/src/pages/nossr.astro
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.