web-streams-polyfill 4.0.0-beta.1 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "web-streams-polyfill",
3
+ "main": "../dist/ponyfill.es5.js",
4
+ "module": "../dist/ponyfill.es5.mjs",
5
+ "types": "../types/ponyfill.d.ts"
6
+ }
package/package.json CHANGED
@@ -1,51 +1,45 @@
1
1
  {
2
2
  "name": "web-streams-polyfill",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "Web Streams, based on the WHATWG spec reference implementation",
5
5
  "main": "dist/ponyfill.js",
6
6
  "module": "dist/ponyfill.mjs",
7
+ "types": "types/ponyfill.d.ts",
7
8
  "exports": {
8
9
  ".": {
10
+ "types": "./types/ponyfill.d.ts",
9
11
  "import": "./dist/ponyfill.mjs",
10
12
  "require": "./dist/ponyfill.js"
11
13
  },
12
14
  "./es5": {
15
+ "types": "./types/ponyfill.d.ts",
13
16
  "import": "./dist/ponyfill.es5.mjs",
14
17
  "require": "./dist/ponyfill.es5.js"
15
18
  },
16
- "./polyfill": "./dist/polyfill.js",
17
- "./polyfill/es5": "./dist/polyfill.es5.js",
19
+ "./polyfill": {
20
+ "types": "./types/polyfill.d.ts",
21
+ "default": "./dist/polyfill.js"
22
+ },
23
+ "./polyfill/es5": {
24
+ "types": "./types/polyfill.d.ts",
25
+ "default": "./dist/polyfill.es5.js"
26
+ },
18
27
  "./dist/*": "./dist/*",
19
28
  "./types/*": "./types/*",
20
29
  "./package": "./package.json",
21
30
  "./package.json": "./package.json"
22
31
  },
23
- "types": "types/ponyfill.d.ts",
24
- "typesVersions": {
25
- ">=3.6": {
26
- ".": [
27
- "./types/ponyfill.d.ts"
28
- ],
29
- "./es5": [
30
- "./types/ponyfill.d.ts"
31
- ],
32
- "./polyfill": [
33
- "./types/polyfill.d.ts"
34
- ],
35
- "./polyfill/es5": [
36
- "./types/polyfill.d.ts"
37
- ]
38
- }
39
- },
40
32
  "scripts": {
41
- "test": "npm run test:types && npm run test:unit && npm run test:wpt && npm run test:bundlers",
42
- "test:wpt": "node --expose_gc ./test/run-web-platform-tests.js",
43
- "test:bundlers": "npm run test:rollup && npm run test:webpack",
44
- "test:rollup": "cd test/rollup && npm ci && npm test",
45
- "test:webpack": "cd test/webpack && npm ci && npm test",
46
- "pretest:wpt": "git submodule update --init --recursive",
33
+ "test": "npm run test:types && npm run test:unit && npm run test:wpt && npm run test:bundler",
34
+ "test:wpt": "npm run test:wpt:node && npm run test:wpt:chromium && npm run test:wpt:firefox",
35
+ "test:wpt:node": "node --expose_gc ./test/wpt/node/run.js",
36
+ "test:wpt:chromium": "node ./test/wpt/browser/run.js --browser chromium",
37
+ "test:wpt:firefox": "node ./test/wpt/browser/run.js --browser firefox",
38
+ "test:bundler": "npm run test:bundler:rollup && npm run test:bundler:webpack",
39
+ "test:bundler:rollup": "cd test/rollup && npm ci && npm test",
40
+ "test:bundler:webpack": "cd test/webpack && npm ci && npm test",
47
41
  "test:types": "tsc -p ./test/types/tsconfig.json",
48
- "test:unit": "jasmine --config=test/unit/jasmine.json",
42
+ "test:unit": "node --experimental-import-meta-resolve ./node_modules/jasmine/bin/jasmine.js --config=test/unit/jasmine.json",
49
43
  "lint": "eslint \"src/**/*.ts\"",
50
44
  "build": "npm run build:bundle && npm run build:types",
51
45
  "build:bundle": "rollup -c",
@@ -55,10 +49,12 @@
55
49
  },
56
50
  "files": [
57
51
  "dist",
52
+ "es5",
53
+ "polyfill",
58
54
  "types"
59
55
  ],
60
56
  "engines": {
61
- "node": ">= 12"
57
+ "node": ">= 14"
62
58
  },
63
59
  "repository": {
64
60
  "type": "git",
@@ -79,22 +75,27 @@
79
75
  },
80
76
  "homepage": "https://github.com/MattiasBuelens/web-streams-polyfill#readme",
81
77
  "devDependencies": {
82
- "@microsoft/api-extractor": "^7.18.7",
83
- "@rollup/plugin-inject": "^4.0.2",
84
- "@rollup/plugin-replace": "^3.0.0",
78
+ "@microsoft/api-extractor": "^7.21.2",
79
+ "@rollup/plugin-inject": "^4.0.4",
80
+ "@rollup/plugin-replace": "^4.0.0",
85
81
  "@rollup/plugin-strip": "^2.1.0",
86
- "@rollup/plugin-typescript": "^8.2.5",
87
- "@types/node": "^14.17.12",
88
- "@typescript-eslint/eslint-plugin": "^4.29.3",
89
- "@typescript-eslint/parser": "^4.29.3",
82
+ "@rollup/plugin-typescript": "^8.3.1",
83
+ "@types/jasmine": "^4.0.2",
84
+ "@types/node": "^14.18.12",
85
+ "@typescript-eslint/eslint-plugin": "^5.19.0",
86
+ "@typescript-eslint/parser": "^5.19.0",
90
87
  "@ungap/promise-all-settled": "^1.1.2",
91
- "eslint": "^7.32.0",
92
- "jasmine": "^3.9.0",
93
- "micromatch": "^4.0.4",
94
- "rollup": "^2.56.3",
88
+ "abort-controller": "^3.0.0",
89
+ "eslint": "^8.13.0",
90
+ "jasmine": "^4.0.2",
91
+ "micromatch": "^4.0.5",
92
+ "minimist": "^1.2.6",
93
+ "playwright": "^1.20.2",
94
+ "recursive-readdir": "^2.2.2",
95
+ "rollup": "^2.70.1",
95
96
  "rollup-plugin-terser": "^7.0.2",
96
- "tslib": "^2.3.0",
97
- "typescript": "~4.3.5",
98
- "wpt-runner": "^3.2.1"
97
+ "tslib": "^2.3.1",
98
+ "typescript": "^4.7.0-beta",
99
+ "wpt-runner": "^4.1.0"
99
100
  }
100
101
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "web-streams-polyfill",
3
+ "main": "../../dist/polyfill.es5.js",
4
+ "types": "../../types/polyfill.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "web-streams-polyfill",
3
+ "main": "../dist/polyfill.js",
4
+ "types": "../types/polyfill.d.ts"
5
+ }
@@ -16,6 +16,10 @@ export declare interface AbortSignal {
16
16
  * Whether the request is aborted.
17
17
  */
18
18
  readonly aborted: boolean;
19
+ /**
20
+ * The abort reason.
21
+ */
22
+ readonly reason?: any;
19
23
  /**
20
24
  * Add an event listener to be triggered when this signal becomes aborted.
21
25
  */
@@ -687,6 +691,10 @@ export declare class WritableStreamDefaultController<W = any> {
687
691
  private constructor();
688
692
  /**
689
693
  * The reason which was passed to `WritableStream.abort(reason)` when the stream was aborted.
694
+ *
695
+ * @deprecated
696
+ * This property has been removed from the specification, see https://github.com/whatwg/streams/pull/1177.
697
+ * Use {@link WritableStreamDefaultController.signal}'s `reason` instead.
690
698
  */
691
699
  get abortReason(): any;
692
700
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.7"
8
+ "packageVersion": "7.21.2"
9
9
  }
10
10
  ]
11
11
  }
package/CHANGELOG.md DELETED
@@ -1,146 +0,0 @@
1
- # Changelog
2
-
3
- > **Tags:**
4
- > - 💥 Breaking Change
5
- > - 👓 Spec Compliance
6
- > - 🚀 New Feature
7
- > - 🐛 Bug Fix
8
- > - 📝 Documentation
9
- > - 🏠 Internal
10
- > - 💅 Polish
11
-
12
- ## v4.0.0-beta.1 (2021-09-06)
13
-
14
- * 💥 Rework the list of variants to have more modern defaults.
15
- The table below shows how to upgrade your v3 import to their equivalent v4 import.
16
- See the [migration guide](https://github.com/MattiasBuelens/web-streams-polyfill/v4.0.0-beta.1/next/MIGRATING.md) for more information.
17
- ([#82](https://github.com/MattiasBuelens/web-streams-polyfill/issues/82), [#83](https://github.com/MattiasBuelens/web-streams-polyfill/pull/83))
18
- * 💥 Remove the ES2018 variant, in favor of the ES2015 variant.
19
- * 🚀 Support [importing as ESM in Node](https://nodejs.org/api/esm.html).
20
- * 💅 Minify all code in the published package, to reduce the download size.
21
-
22
- | v3 import | v4 import | description |
23
- | --- | --- | --- |
24
- | `web-streams-polyfill` | `web-streams-polyfill/polyfill/es5` | ES5+ polyfill |
25
- | `web-streams-polyfill/es6` | `web-streams-polyfill/polyfill` | ES2015+ polyfill |
26
- | `web-streams-polyfill/es2018` | `web-streams-polyfill/polyfill` | ES2015+ polyfill |
27
- | `web-streams-polyfill/ponyfill` | `web-streams-polyfill/es5` | ES5+ ponyfill |
28
- | `web-streams-polyfill/ponyfill/es6` | `web-streams-polyfill` | ES2015+ ponyfill |
29
- | `web-streams-polyfill/ponyfill/es2018` | `web-streams-polyfill` | ES2015+ ponyfill |
30
-
31
- ## v3.1.1 (2021-09-06)
32
-
33
- * 🐛 Fix compatibility with TypeScript's DOM types for `ReadableStream` and `TransformStream` ([#85](https://github.com/MattiasBuelens/web-streams-polyfill/issues/85), [#86](https://github.com/MattiasBuelens/web-streams-polyfill/pull/86))
34
-
35
- ## v3.1.0 (2021-07-21)
36
-
37
- * 🚀 Calling `ReadableStream.tee()` on a readable byte stream now returns two readable byte streams. ([#81](https://github.com/MattiasBuelens/web-streams-polyfill/pull/81))
38
- * 🚀 Add `WritableStreamDefaultController.signal` and `.abortReason`. ([#81](https://github.com/MattiasBuelens/web-streams-polyfill/pull/81))
39
- * `.signal` requires a global `AbortController` constructor to be available. If necessary, use a polyfill.
40
- * 🐛 Make sure streams created with a different version of the polyfill do not pass the brand checks. ([#75](https://github.com/MattiasBuelens/web-streams-polyfill/issues/75), [#77](https://github.com/MattiasBuelens/web-streams-polyfill/pull/77))
41
- * 👓 Align with [spec version `cada812`](https://github.com/whatwg/streams/tree/cada8129edcc4803b2878a7a3f5e1d8325dc0c23/) ([#79](https://github.com/MattiasBuelens/web-streams-polyfill/pull/79), [#81](https://github.com/MattiasBuelens/web-streams-polyfill/pull/81))
42
-
43
- ## v3.0.3 (2021-04-09)
44
-
45
- * 💅 Change `Promise<void>` to `Promise<undefined>` in TypeScript type definitions ([#72](https://github.com/MattiasBuelens/web-streams-polyfill/pull/72))
46
- * 🐛 Fix `ReadableStream.tee()` resolving its `cancel()` promise too early ([#73](https://github.com/MattiasBuelens/web-streams-polyfill/pull/73))
47
- * 👓 Align with [spec version `6762cdb`](https://github.com/whatwg/streams/tree/6762cdb4c6421cfa0da1d834d5a14fdd7326aaa5/) ([#73](https://github.com/MattiasBuelens/web-streams-polyfill/pull/73))
48
-
49
- ## v3.0.2 (2021-02-10)
50
-
51
- * 👓 Align with [spec version `200c971`](https://github.com/whatwg/streams/tree/200c971563b1a695fce3eebe6dab45c348ff0ac0/) ([#69](https://github.com/MattiasBuelens/web-streams-polyfill/pull/69))
52
-
53
- ## v3.0.1 (2020-11-12)
54
-
55
- * 📝 Add documentation to type definitions ([#62](https://github.com/MattiasBuelens/web-streams-polyfill/pull/62))
56
- * 👓 Align with [spec version `6cd5e81`](https://github.com/whatwg/streams/tree/6cd5e81f6191fed9e7d99ee73d4941e3060311ce/) ([#63](https://github.com/MattiasBuelens/web-streams-polyfill/pull/63))
57
- * 🐛 Fix an issue where the polyfill could throw an error when resolving/rejecting `reader.closed` when it was already resolved/rejected ([#66](https://github.com/MattiasBuelens/web-streams-polyfill/issues/66), [#67](https://github.com/MattiasBuelens/web-streams-polyfill/pull/67))
58
-
59
- ## v3.0.0 (2020-07-20)
60
-
61
- * 💥 Align with [spec version `62fe4c8`](https://github.com/whatwg/streams/tree/62fe4c8c0df34cec4ff28db9bfa69aec6c65e38d/) ([#52](https://github.com/MattiasBuelens/web-streams-polyfill/pull/52), [#57](https://github.com/MattiasBuelens/web-streams-polyfill/pull/57), [#59](https://github.com/MattiasBuelens/web-streams-polyfill/pull/59))
62
- This includes the following **breaking changes**:
63
- * All classes are now exposed globally. Concretely, this adds the following classes:
64
- * `ReadableStreamDefaultController`
65
- * `ReadableByteStreamController`
66
- * `ReadableStreamBYOBRequest`
67
- * `ReadableStreamDefaultReader`
68
- * `ReadableStreamBYOBReader`
69
- * `WritableStreamDefaultController`
70
- * `WritableStreamDefaultWriter`
71
- * `TransformStreamDefaultController`
72
- * `ReadableStream.getIterator()` is renamed to `ReadableStream.values()`
73
- * `ReadableByteStreamController.byobRequest` can be `null` (instead of `undefined`) if there is no current BYOB request.
74
- * `ReadableStreamBYOBRequest.view` can be `null` (instead of `undefined`) if the BYOB request has already been responded to.
75
- * Constructors and methods have stricter type checking for object arguments. For example, `new ReadableStream(null)` would previously behave like `new ReadableStream({})`, but now it throws a `TypeError` instead.
76
- * Some constructors and methods may throw slightly different errors when given invalid arguments.
77
- * Various byte-stream-related APIs now prohibit zero-length views or buffers.
78
- * The async iterator of a `ReadableStream` now behaves more like an async generator, e.g. returning promises fulfilled with `{ value: undefined, done: true }` after `return()`ing the iterator, instead of returning a rejected promise.
79
- * 💥 Updated TypeScript types to align with new specification ([#60](https://github.com/MattiasBuelens/web-streams-polyfill/pull/60))
80
- While these are _technically_ breaking changes, you should only be affected if you manually reference these types from your code.
81
- * `PipeOptions` is renamed to `StreamPipeOptions`
82
- * `ReadResult` is replaced by `ReadableStreamDefaultReadResult` and `ReadableStreamBYOBReadResult`
83
- * `ReadableStreamDefaultControllerCallback` is replaced by `UnderlyingSourceStartCallback` and `UnderlyingSourcePullCallback`
84
- * `ReadableByteStreamControllerCallback` is replaced by `UnderlyingByteSourceStartCallback` and `UnderlyingByteSourcePullCallback`
85
- * `ReadableStreamErrorCallback` is renamed to `UnderlyingSourceCancelCallback`
86
- * `WritableStreamDefaultControllerStartCallback` is renamed to `UnderlyingSinkStartCallback`
87
- * `WritableStreamDefaultControllerWriteCallback` is renamed to `UnderlyingSinkWriteCallback`
88
- * `WritableStreamDefaultControllerCloseCallback` is renamed to `UnderlyingSinkCloseCallback`
89
- * `WritableStreamErrorCallback` is renamed to `UnderlyingSinkAbortCallback`
90
- * `TransformStreamDefaultControllerCallback` is replaced by `TransformerStartCallback` and `TransformerFlushCallback`
91
- * `TransformStreamDefaultControllerTransformCallback` is renamed to `TransformerTransformCallback`
92
-
93
- ## v2.1.1 (2020-04-11)
94
-
95
- * 💅 Improve `ReadResult` in TypeScript type definitions. ([759506e](https://github.com/MattiasBuelens/web-streams-polyfill/commit/759506e00e55289ae6f92f30922b8855fcddd9ab), [#49](https://github.com/MattiasBuelens/web-streams-polyfill/pull/49))
96
-
97
- ## v2.1.0 (2020-02-23)
98
-
99
- * 👓 Align with [spec version `ed00d2f`](https://github.com/whatwg/streams/tree/ed00d2fe2d53ac5ad9ff8e727c7ef0a68f424074/) ([#43](https://github.com/MattiasBuelens/web-streams-polyfill/issues/43), [#44](https://github.com/MattiasBuelens/web-streams-polyfill/pull/44))
100
- * 🏠 Down-level type definitions for older TypeScript versions. ([#41](https://github.com/MattiasBuelens/web-streams-polyfill/pull/41))
101
-
102
- ## v2.0.6 (2019-11-08)
103
-
104
- * 🐛 Fix type definitions to be compatible with TypeScript 3.3 and lower. ([#39](https://github.com/MattiasBuelens/web-streams-polyfill/issues/39), [#40](https://github.com/MattiasBuelens/web-streams-polyfill/pull/40))
105
-
106
- ## v2.0.5 (2019-10-08)
107
-
108
- * 👓 Align with [spec version `ae5e0cb`](https://github.com/whatwg/streams/tree/ae5e0cb41e9f72cdd97f3a6d47bc674c1f4049d1/) ([#33](https://github.com/MattiasBuelens/web-streams-polyfill/pull/33))
109
- * 🐛 Fix support for non-browser environments, such as Node.
110
- * Accept polyfilled `AbortSignal`s. ([#36](https://github.com/MattiasBuelens/web-streams-polyfill/pull/36))
111
- * Polyfill `DOMException` if necessary. ([#37](https://github.com/MattiasBuelens/web-streams-polyfill/pull/37))
112
-
113
- ## v2.0.4 (2019-08-01)
114
-
115
- * 🐛 Fix pipe not aborting when both `preventAbort` and `preventCancel` are set ([#31](https://github.com/MattiasBuelens/web-streams-polyfill/pull/31))
116
- * 👓 Align with [spec version `e4d3b1a`](https://github.com/whatwg/streams/tree/e4d3b1a826e34d27a7cb5485a1cc4b078608c9ec/) ([#31](https://github.com/MattiasBuelens/web-streams-polyfill/pull/31))
117
-
118
- ## v2.0.3 (2019-04-04)
119
-
120
- * 👓 Align with [spec version `6f94580`](https://github.com/whatwg/streams/tree/6f94580f6731d1e017c516af097d47c45aad1f56/) ([#21](https://github.com/MattiasBuelens/web-streams-polyfill/pull/21))
121
- * 🏠 Run web platform tests on ES5 variant ([#19](https://github.com/MattiasBuelens/web-streams-polyfill/pull/19))
122
-
123
- ## v2.0.2 (2019-03-17)
124
-
125
- * 💅 Improve performance of `reader.read()` and `writer.write()` ([#17](https://github.com/MattiasBuelens/web-streams-polyfill/pull/17), [#18](https://github.com/MattiasBuelens/web-streams-polyfill/pull/18))
126
-
127
- ## v2.0.1 (2019-03-16)
128
-
129
- * 🐛 Fix performance issue with large queues ([#15](https://github.com/MattiasBuelens/web-streams-polyfill/pull/15), [#16](https://github.com/MattiasBuelens/web-streams-polyfill/pull/16))
130
-
131
- ## v2.0.0 (2019-03-10)
132
-
133
- * 💥 Ownership change: [@mattiasbuelens/web-streams-polyfill](https://www.npmjs.com/package/@mattiasbuelens/web-streams-polyfill/v/0.3.2) has been republished as [web-streams-polyfill](https://www.npmjs.com/package/web-streams-polyfill).
134
- For the full list of changes between web-streams-polyfill v1.3.2 and this version, [visit the fork's changelog](https://github.com/MattiasBuelens/web-streams-polyfill/blob/v0.3.2/CHANGELOG.md).
135
-
136
- * 💥 CommonJS entry points have been moved to `dist/`:
137
- * `index.js` ➡ `dist/polyfill.js`
138
- * `index.es6.js` ➡ `dist/polyfill.es6.js`
139
-
140
- However, we recommend migrating to a [variant sub-package](https://github.com/MattiasBuelens/web-streams-polyfill#usage) instead:
141
- * `require('web-streams-polyfill/index.js')` ➡ `require('web-streams-polyfill')`
142
- * `require('web-streams-polyfill/index.es6.js')` ➡ `require('web-streams-polyfill/es6')`
143
-
144
- * 👓 Align with [spec version `2c8f35e`](https://github.com/whatwg/streams/tree/2c8f35ed23451ffc9b32ec37b56def4a5349abb1/)
145
-
146
- * 🏠 Code moved from [creatorrr/web-streams-polyfill](https://github.com/creatorrr/web-streams-polyfill) to [MattiasBuelens/web-streams-polyfill](https://github.com/MattiasBuelens/web-streams-polyfill)