formdata-node
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -13,3 +13,3 @@ /*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank */ | ||
} | ||
export declare type BlobParts = unknown[] | Iterable<unknown>; | ||
export type BlobParts = unknown[] | Iterable<unknown>; | ||
export interface BlobPropertyBag { | ||
@@ -16,0 +16,0 @@ /** |
import type { Blob, BlobLike } from "./Blob.js"; | ||
export declare type BlobPart = BlobLike | Blob | Uint8Array; | ||
export type BlobPart = BlobLike | Blob | Uint8Array; |
import type { FilePropertyBag } from "./File.js"; | ||
import { File } from "./File.js"; | ||
export * from "./isFile.js"; | ||
export declare type FileFromPathOptions = Omit<FilePropertyBag, "lastModified">; | ||
export type FileFromPathOptions = Omit<FilePropertyBag, "lastModified">; | ||
/** | ||
@@ -6,0 +6,0 @@ * Creates a `File` referencing the one on a disk by given path. Synchronous version of the `fileFromPath` |
@@ -5,3 +5,3 @@ import { File } from "./File.js"; | ||
*/ | ||
export declare type FormDataEntryValue = string | File; | ||
export type FormDataEntryValue = string | File; | ||
/** | ||
@@ -8,0 +8,0 @@ * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch(). |
@@ -18,2 +18,10 @@ /*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank */ | ||
export class Blob { | ||
static [(_Blob_parts = new WeakMap(), _Blob_type = new WeakMap(), _Blob_size = new WeakMap(), Symbol.hasInstance)](value) { | ||
return Boolean(value | ||
&& typeof value === "object" | ||
&& isFunction(value.constructor) | ||
&& (isFunction(value.stream) | ||
|| isFunction(value.arrayBuffer)) | ||
&& /^(Blob|File)$/.test(value[Symbol.toStringTag])); | ||
} | ||
constructor(blobParts = [], options = {}) { | ||
@@ -56,10 +64,2 @@ _Blob_parts.set(this, []); | ||
} | ||
static [(_Blob_parts = new WeakMap(), _Blob_type = new WeakMap(), _Blob_size = new WeakMap(), Symbol.hasInstance)](value) { | ||
return Boolean(value | ||
&& typeof value === "object" | ||
&& isFunction(value.constructor) | ||
&& (isFunction(value.stream) | ||
|| isFunction(value.arrayBuffer)) | ||
&& /^(Blob|File)$/.test(value[Symbol.toStringTag])); | ||
} | ||
get type() { | ||
@@ -66,0 +66,0 @@ return __classPrivateFieldGet(this, _Blob_type, "f"); |
@@ -15,2 +15,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
export class File extends Blob { | ||
static [(_File_name = new WeakMap(), _File_lastModified = new WeakMap(), Symbol.hasInstance)](value) { | ||
return value instanceof Blob | ||
&& value[Symbol.toStringTag] === "File" | ||
&& typeof value.name === "string"; | ||
} | ||
constructor(fileBits, name, options = {}) { | ||
@@ -32,7 +37,2 @@ super(fileBits, options); | ||
} | ||
static [(_File_name = new WeakMap(), _File_lastModified = new WeakMap(), Symbol.hasInstance)](value) { | ||
return value instanceof Blob | ||
&& value[Symbol.toStringTag] === "File" | ||
&& typeof value.name === "string"; | ||
} | ||
get name() { | ||
@@ -39,0 +39,0 @@ return __classPrivateFieldGet(this, _File_name, "f"); |
{ | ||
"name": "formdata-node", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"type": "module", | ||
@@ -32,3 +32,6 @@ "description": "Spec-compliant FormData implementation for Node.js", | ||
}, | ||
"default": "./lib/index.js" | ||
"default": { | ||
"types": "./@type/index.d.ts", | ||
"import": "./lib/index.js" | ||
} | ||
}, | ||
@@ -52,2 +55,3 @@ "./file-from-path": { | ||
"scripts": { | ||
"lint:types": "tsc --noEmit", | ||
"eslint": "eslint src/**/*.ts", | ||
@@ -60,3 +64,3 @@ "staged": "lint-staged", | ||
"build": "tsc && npm run build:types", | ||
"test": "ava --fail-fast", | ||
"test": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" ava", | ||
"cleanup": "del-cli @type lib", | ||
@@ -68,20 +72,21 @@ "prepare": "npm run cleanup && npm run build", | ||
"@octetstream/eslint-config": "6.2.2", | ||
"@types/node": "18.6.3", | ||
"@types/node": "18.15.3", | ||
"@types/sinon": "10.0.13", | ||
"@typescript-eslint/eslint-plugin": "5.32.0", | ||
"@typescript-eslint/parser": "5.32.0", | ||
"ava": "4.3.1", | ||
"c8": "7.12.0", | ||
"@typescript-eslint/eslint-plugin": "5.55.0", | ||
"@typescript-eslint/parser": "5.55.0", | ||
"ava": "5.2.0", | ||
"c8": "7.13.0", | ||
"cross-env": "^7.0.3", | ||
"del-cli": "5.0.0", | ||
"eslint": "8.21.0", | ||
"eslint": "8.36.0", | ||
"eslint-config-airbnb-typescript": "17.0.0", | ||
"eslint-import-resolver-typescript": "3.4.0", | ||
"eslint-plugin-ava": "13.2.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"husky": "8.0.1", | ||
"lint-staged": "13.0.3", | ||
"eslint-import-resolver-typescript": "3.5.3", | ||
"eslint-plugin-ava": "14.0.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"husky": "8.0.3", | ||
"lint-staged": "13.2.0", | ||
"pinst": "3.0.0", | ||
"sinon": "14.0.0", | ||
"sinon": "15.0.2", | ||
"ts-node": "10.9.1", | ||
"typescript": "4.7.4" | ||
"typescript": "5.0.2" | ||
}, | ||
@@ -88,0 +93,0 @@ "dependencies": { |
@@ -8,2 +8,3 @@ # FormData | ||
[![ESLint](https://github.com/octet-stream/form-data/workflows/ESLint/badge.svg)](https://github.com/octet-stream/form-data/actions/workflows/eslint.yml) | ||
[![TypeScript Types](https://github.com/octet-stream/form-data/actions/workflows/typescript.yml/badge.svg)](https://github.com/octet-stream/form-data/actions/workflows/typescript.yml) | ||
@@ -279,3 +280,3 @@ ## Highlights | ||
<sup>1</sup> Does not support Blob and File in entry value, but allows streams and Buffer (which is not spec-compiant, however). | ||
<sup>1</sup> Does not support Blob and File in entry value, but allows streams and Buffer (which is not spec-compliant, however). | ||
@@ -282,0 +283,0 @@ <sup>2</sup> Can be imported in ESM, because Node.js support for CJS modules in ESM context, but it does not have ESM entry point. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
63347
486
0
20