Skip to content

Commit

Permalink
Merge pull request #138 from MattiasBuelens/revert-breaking-changes
Browse files Browse the repository at this point in the history
Revert breaking changes from 3.3.0
  • Loading branch information
MattiasBuelens authored Jan 4, 2024
2 parents 78409d3 + e1c7284 commit a1c2ab3
Show file tree
Hide file tree
Showing 15 changed files with 262 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ typings/

### Project
/dist/
!/dist/types/ts3.6/polyfill.d.ts
/lib/
/temp/
/types/ponyfill.d.ts
/types/tsdoc-metadata.json
1 change: 1 addition & 0 deletions .idea/web-streams-polyfill.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
> - 🏠 Internal
> - 💅 Polish
## Unreleased

* 🐛 Revert `engines` bump in `package.json`. ([#137](https://github.com/MattiasBuelens/web-streams-polyfill/issues/137), [#138](https://github.com/MattiasBuelens/web-streams-polyfill/pull/138))
* 🐛 Re-introduce support for TypeScript 3.6 and below. ([#137](https://github.com/MattiasBuelens/web-streams-polyfill/issues/137), [#138](https://github.com/MattiasBuelens/web-streams-polyfill/pull/138))

## 3.3.0 (2024-01-04)

* 🚀 Added global augmentations for `ReadableStream` to the polyfill's type definitions. ([#130](https://github.com/MattiasBuelens/web-streams-polyfill/pull/130))
* This allows TypeScript users to use new methods such as `ReadableStream.prototype[Symbol.asyncIterator]()`,
even when TypeScript doesn't yet have a built-in type definition for them.
* 💥 The type definitions now require TypeScript 3.5 or higher. ([#130](https://github.com/MattiasBuelens/web-streams-polyfill/pull/130))
* ~~💥 The type definitions now require TypeScript 3.6 or higher. ([#130](https://github.com/MattiasBuelens/web-streams-polyfill/pull/130))~~ (Reverted in version 3.3.1)
* 👓 Align with [spec version `4dc123a`](https://github.com/whatwg/streams/tree/4dc123a6e7f7ba89a8c6a7975b021156f39cab52/) ([#115](https://github.com/MattiasBuelens/web-streams-polyfill/issues/115), [#134](https://github.com/MattiasBuelens/web-streams-polyfill/pull/134))
* Added `ReadableStream.from(asyncIterable)`, which creates a `ReadableStream` wrapping the given iterable or async iterable.
This can also be used to wrap a native `ReadableStream` (e.g. a `Response.body` from `fetch()`),
Expand Down
7 changes: 3 additions & 4 deletions api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/
"untrimmedFilePath": "<projectFolder>/types/ponyfill.d.ts",
"untrimmedFilePath": "<projectFolder>/dist/types/ts3.6/ponyfill.d.ts",

/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
Expand Down Expand Up @@ -242,7 +242,7 @@
*
* DEFAULT VALUE: true
*/
// "enabled": true,
"enabled": true,
/**
* Specifies where the TSDoc metadata file should be written.
*
Expand All @@ -256,9 +256,8 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<lookup>"
*/
// "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
"tsdocMetadataFilePath": "<projectFolder>/dist/types/tsdoc-metadata.json"
},

/**
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
* will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
Expand Down
28 changes: 28 additions & 0 deletions build/downlevel-dts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Based on downlevel-dts (MIT licensed) by Nathan Shively-Sanders
// https://github.com/sandersn/downlevel-dts/blob/e7d1cb5aced5686826fe8aac4d4af2f745a9ef60/index.js

const { Project } = require('ts-morph');
const path = require('path');

const project = new Project();
const inputDir = project.addDirectoryAtPath(path.join(__dirname, '../dist/types/'));

// Down-level all *.d.ts files in input directory
const files = inputDir.addSourceFilesAtPaths('*.d.ts');
for (const file of files) {
downlevelTS34(file);
}
project.saveSync();

/**
* Down-level TypeScript 3.4 types in the given source file
*/
function downlevelTS34(f) {
// Replace "es2018.asynciterable" with "esnext.asynciterable" in lib references
const refs = f.getLibReferenceDirectives();
for (const r of refs) {
if (r.getFileName() === 'es2018.asynciterable') {
f.replaceText([r.getPos(), r.getEnd()], 'esnext.asynciterable');
}
}
}
File renamed without changes.
9 changes: 8 additions & 1 deletion es2018/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"main": "../dist/polyfill.es2018",
"browser": "../dist/polyfill.es2018.min.js",
"module": "../dist/polyfill.es2018.mjs",
"types": "../types/polyfill.d.ts"
"types": "../dist/types/polyfill.d.ts",
"typesVersions": {
">=3.6": {
"../dist/types/*": [
"../dist/types/ts3.6/*"
]
}
}
}
9 changes: 8 additions & 1 deletion es6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"main": "../dist/polyfill.es6",
"browser": "../dist/polyfill.es6.min.js",
"module": "../dist/polyfill.es6.mjs",
"types": "../types/polyfill.d.ts"
"types": "../dist/types/polyfill.d.ts",
"typesVersions": {
">=3.6": {
"../dist/types/*": [
"../dist/types/ts3.6/*"
]
}
}
}
166 changes: 165 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a1c2ab3

Please sign in to comment.