Use undici's FormData for polyfilling (#6413)
* fix(webapi): Use undici's FormData instead of a polyfill * chore: changeset
This commit is contained in:
parent
13f6f591e3
commit
0abd1d3e42
7 changed files with 25 additions and 25 deletions
5
.changeset/cool-bags-mix.md
Normal file
5
.changeset/cool-bags-mix.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/webapi': patch
|
||||
---
|
||||
|
||||
Use undici's FormData instead of a polyfill
|
|
@ -25,5 +25,3 @@ THE SOFTWARE.
|
|||
Code from [@astrocommunity/webapi](https://www.npmjs.com/@astrocommunity/webapi) is licensed under the CC0-1.0 License.
|
||||
|
||||
Code from [event-target-shim](https://www.npmjs.com/package/event-target-shim) is licensed under the MIT License (MIT), Copyright Toru Nagashima.
|
||||
|
||||
Code from [formdata-polyfill](https://www.npmjs.com/package/formdata-polyfill) is licensed under the MIT License (MIT), Copyright Jimmy Wärting.
|
||||
|
|
|
@ -155,5 +155,3 @@ polyfill(globalThis, {
|
|||
Thank you to Jon Neal for his work on the original [webapi](https://github.com/astro-community/webapi) project that this package is forked from. Licensed under the CC0-1.0 License.
|
||||
|
||||
Code from [event-target-shim](https://www.npmjs.com/package/event-target-shim) is licensed under the MIT License (MIT), Copyright Toru Nagashima.
|
||||
|
||||
Code from [formdata-polyfill](https://www.npmjs.com/package/formdata-polyfill) is licensed under the MIT License (MIT), Copyright Jimmy Wärting.
|
||||
|
|
24
packages/webapi/mod.d.ts
vendored
24
packages/webapi/mod.d.ts
vendored
|
@ -1,13 +1,13 @@
|
|||
// organize-imports-ignore
|
||||
export { pathToPosix } from './lib/utils';
|
||||
export { alert, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
|
||||
export declare const polyfill: {
|
||||
(target: any, options?: PolyfillOptions): any;
|
||||
internals(target: any, name: string): any;
|
||||
};
|
||||
interface PolyfillOptions {
|
||||
exclude?: string | string[];
|
||||
override?: Record<string, {
|
||||
(...args: any[]): any;
|
||||
}>;
|
||||
}
|
||||
export { pathToPosix } from './lib/utils';
|
||||
export { alert, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
|
||||
export declare const polyfill: {
|
||||
(target: any, options?: PolyfillOptions): any;
|
||||
internals(target: any, name: string): any;
|
||||
};
|
||||
interface PolyfillOptions {
|
||||
exclude?: string | string[];
|
||||
override?: Record<string, {
|
||||
(...args: any[]): any;
|
||||
}>;
|
||||
}
|
|
@ -63,7 +63,6 @@
|
|||
"@ungap/structured-clone": "^0.3.4",
|
||||
"chai": "^4.3.6",
|
||||
"event-target-shim": "^6.0.2",
|
||||
"formdata-polyfill": "^4.0.10",
|
||||
"magic-string": "^0.27.0",
|
||||
"mocha": "^9.2.2",
|
||||
"rollup": "^2.79.1",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// @ts-check
|
||||
import { Event, EventTarget } from 'event-target-shim'
|
||||
import { FormData } from 'formdata-polyfill/esm.min.js'
|
||||
import { Event, EventTarget } from 'event-target-shim' // Look into removing when Node 18 is dropped for Node 20
|
||||
import {
|
||||
ByteLengthQueuingStrategy,
|
||||
CountQueuingStrategy,
|
||||
|
@ -14,18 +13,18 @@ import {
|
|||
WritableStream,
|
||||
WritableStreamDefaultController,
|
||||
WritableStreamDefaultWriter,
|
||||
} from 'node:stream/web'
|
||||
import { fetch, File, Headers, Request, Response } from 'undici'
|
||||
} from 'node:stream/web' // Remove when Node 16 is dropped for Node 18.
|
||||
import { fetch, File, FormData, Headers, Request, Response } from 'undici' // Remove when Node 16 is dropped for Node 18.
|
||||
import { URLPattern } from 'urlpattern-polyfill'
|
||||
import {
|
||||
cancelAnimationFrame,
|
||||
requestAnimationFrame,
|
||||
} from './lib/AnimationFrame'
|
||||
import { CharacterData, Comment, Text } from './lib/CharacterData'
|
||||
import { CustomEvent } from './lib/CustomEvent'
|
||||
import { CustomEvent } from './lib/CustomEvent' // Look into removing when Node 18 is dropped for Node 20
|
||||
import { DOMException } from './lib/DOMException'
|
||||
import { cancelIdleCallback, requestIdleCallback } from './lib/IdleCallback'
|
||||
import structuredClone from './lib/structuredClone'
|
||||
import structuredClone from './lib/structuredClone' // Remove when Node 16 is dropped for Node 18.
|
||||
import { clearTimeout, setTimeout } from './lib/Timeout'
|
||||
import { TreeWalker } from './lib/TreeWalker'
|
||||
|
||||
|
|
|
@ -3694,7 +3694,6 @@ importers:
|
|||
'@ungap/structured-clone': ^0.3.4
|
||||
chai: ^4.3.6
|
||||
event-target-shim: ^6.0.2
|
||||
formdata-polyfill: ^4.0.10
|
||||
magic-string: ^0.27.0
|
||||
mocha: ^9.2.2
|
||||
rollup: ^2.79.1
|
||||
|
@ -3715,7 +3714,6 @@ importers:
|
|||
'@ungap/structured-clone': 0.3.4
|
||||
chai: 4.3.7
|
||||
event-target-shim: 6.0.2
|
||||
formdata-polyfill: 4.0.10
|
||||
magic-string: 0.27.0
|
||||
mocha: 9.2.2
|
||||
rollup: 2.79.1
|
||||
|
@ -10032,6 +10030,7 @@ packages:
|
|||
dependencies:
|
||||
node-domexception: 1.0.0
|
||||
web-streams-polyfill: 3.2.1
|
||||
dev: false
|
||||
|
||||
/file-entry-cache/6.0.1:
|
||||
resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==}
|
||||
|
@ -10144,6 +10143,7 @@ packages:
|
|||
engines: {node: '>=12.20.0'}
|
||||
dependencies:
|
||||
fetch-blob: 3.2.0
|
||||
dev: false
|
||||
|
||||
/fraction.js/4.2.0:
|
||||
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
|
||||
|
@ -12380,6 +12380,7 @@ packages:
|
|||
/node-domexception/1.0.0:
|
||||
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
|
||||
engines: {node: '>=10.5.0'}
|
||||
dev: false
|
||||
|
||||
/node-fetch-native/1.0.1:
|
||||
resolution: {integrity: sha512-VzW+TAk2wE4X9maiKMlT+GsPU4OMmR1U9CrHSmd3DFLn2IcZ9VJ6M6BBugGfYUnPCLSYxXdZy17M0BEJyhUTwg==}
|
||||
|
|
Loading…
Reference in a new issue