Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type of run signature #174

Merged
merged 2 commits into from
Nov 18, 2021
Merged

Conversation

alvinleung1996
Copy link
Contributor

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

The 3rd overload signature (the promise variant) of FrozenProcessor.run now correctly accepts a tree of type ParseTree instead of CompileTree.

Fix #173.

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Nov 18, 2021
@codecov-commenter

This comment has been minimized.

Copy link
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, would it make sense to add a type test to cover this? (https://github.com/unifiedjs/unified/blob/main/index.test-d.ts)

@wooorm wooorm changed the title Fix FrozenProcessor.run 3rd overload signature Fix type of run signature Nov 18, 2021
@wooorm wooorm merged commit 6b060c2 into unifiedjs:main Nov 18, 2021
@wooorm wooorm added the 💪 phase/solved Post is done label Nov 18, 2021
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Nov 18, 2021
@wooorm wooorm added ☂️ area/types This affects typings 🐛 type/bug This is a problem 👶 semver/patch This is a backwards-compatible fix labels Nov 18, 2021
@wooorm
Copy link
Member

wooorm commented Nov 18, 2021

thanks, released!

kodiakhq bot referenced this pull request in X-oss-byte/Nextjs Oct 16, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [unified](https://unifiedjs.com) ([source](https://togithub.com/unifiedjs/unified)) | [`8.4.2` -> `11.0.3`](https://renovatebot.com/diffs/npm/unified/8.4.2/11.0.3) | [![age](https://developer.mend.io/api/mc/badges/age/npm/unified/11.0.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/unified/11.0.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/unified/8.4.2/11.0.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/unified/8.4.2/11.0.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>unifiedjs/unified (unified)</summary>

### [`v11.0.3`](https://togithub.com/unifiedjs/unified/releases/tag/11.0.3)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/11.0.2...11.0.3)

##### Fix

-   [`8dee2ab`](https://togithub.com/unifiedjs/unified/commit/8dee2ab) Fix support for functions in data

**Full Changelog**: unifiedjs/unified@11.0.2...11.0.3

### [`v11.0.2`](https://togithub.com/unifiedjs/unified/releases/tag/11.0.2)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/11.0.1...11.0.2)

-   [`cea788b`](https://togithub.com/unifiedjs/unified/commit/cea788b) Fix type of settings if nothing is registered yet

**Full Changelog**: unifiedjs/unified@11.0.1...11.0.2

### [`v11.0.1`](https://togithub.com/unifiedjs/unified/releases/tag/11.0.1)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/11.0.0...11.0.1)

-   [`d1a915d`](https://togithub.com/unifiedjs/unified/commit/d1a915d) Fix incorrect type of `settings` in presets

**Full Changelog**: unifiedjs/unified@11.0.0...11.0.1

### [`v11.0.0`](https://togithub.com/unifiedjs/unified/releases/tag/11.0.0)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/10.1.2...11.0.0)

##### Change

-   [`baf80b2`](https://togithub.com/unifiedjs/unified/commit/baf80b2) Change to require Node.js 16
    **migrate**: update too
-   [`dd9834a`](https://togithub.com/unifiedjs/unified/commit/dd9834a) Update `@types/unist`
    **migrate**: update too
-   [`620ccf9`](https://togithub.com/unifiedjs/unified/commit/620ccf9) Update [`vfile`](https://togithub.com/vfile/vfile/releases/tag/6.0.0)
    **migrate**: update too

##### Change (unlikey to affect you)

-   [`a44db46`](https://togithub.com/unifiedjs/unified/commit/a44db46) Add `Data`, `Settings` types to augment shared data
    **migrate**: if you deal with data, type it, see commit for info
-   [`fb49556`](https://togithub.com/unifiedjs/unified/commit/fb49556) Change to replace `Buffer` with `Uint8Array`
    **migrate**: you’re probably fine unless you use weird encodings, see commit for details if so
-   [`f3e71a8`](https://togithub.com/unifiedjs/unified/commit/f3e71a8) Remove `Attacher` type
    **migrate**: use `Plugin` instead
-   [`cc53bb6`](https://togithub.com/unifiedjs/unified/commit/cc53bb6) Remove `FrozenProcessor` type
    **migrate**: use `Processor` instead
-   [`1aa3494`](https://togithub.com/unifiedjs/unified/commit/1aa3494) Change to yield `undefined`, not `null`
    **migrate**: expect `undefined`
-   [`932c140`](https://togithub.com/unifiedjs/unified/commit/932c140) Change to use `exports`
    **migrate**: don’t use private APIs
-   [`8e57478`](https://togithub.com/unifiedjs/unified/commit/8e57478) Remove support for classes as compilers, parsers
    **migrate**: if you love classes, see commit message
-   [`4676814`](https://togithub.com/unifiedjs/unified/commit/4676814) Remove support for compilers returning nullish
    **migrate**: nobody did that
-   [`807ffb9`](https://togithub.com/unifiedjs/unified/commit/807ffb9) Add improved types
    **migrate**: it’s probably just better if anything changed at all
-   [`b35afe0`](https://togithub.com/unifiedjs/unified/commit/b35afe0) Add useful error on empty presets
    by [@&#8203;wooorm](https://togithub.com/wooorm) in [https://github.com/unifiedjs/unified/pull/202](https://togithub.com/unifiedjs/unified/pull/202)
-   [`6f068a0`](https://togithub.com/unifiedjs/unified/commit/6f068a0) Fix to deep clone preset settings
-   [`56ee288`](https://togithub.com/unifiedjs/unified/commit/56ee288) Fix non-first parameter merging when reconfiguring plugins

##### Misc

-   [`e58b095`](https://togithub.com/unifiedjs/unified/commit/e58b095) [`ad06700`](https://togithub.com/unifiedjs/unified/commit/ad06700) [`40f0329`](https://togithub.com/unifiedjs/unified/commit/40f0329) Refactor code-style
-   [`ffc146c`](https://togithub.com/unifiedjs/unified/commit/ffc146c) Update `typescript`
    by [@&#8203;ChristianMurphy](https://togithub.com/ChristianMurphy) in [https://github.com/unifiedjs/unified/pull/216](https://togithub.com/unifiedjs/unified/pull/216)
-   [`7148746`](https://togithub.com/unifiedjs/unified/commit/7148746) [`144eec0`](https://togithub.com/unifiedjs/unified/commit/144eec0) [`2d95451`](https://togithub.com/unifiedjs/unified/commit/2d95451) Add improved docs
-   [`afb704a`](https://togithub.com/unifiedjs/unified/commit/afb704a) Fix some typos
    by [@&#8203;ChristianMurphy](https://togithub.com/ChristianMurphy) in [https://github.com/unifiedjs/unified/pull/225](https://togithub.com/unifiedjs/unified/pull/225)
-   [`2aa15ea`](https://togithub.com/unifiedjs/unified/commit/2aa15ea) Refactor types
-   [`a06537c`](https://togithub.com/unifiedjs/unified/commit/a06537c) Add sponsor

**Full Changelog**: unifiedjs/unified@10.1.2...11.0.0

### [`v10.1.2`](https://togithub.com/unifiedjs/unified/releases/tag/10.1.2)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/10.1.1...10.1.2)

-   [`dc85d21`](https://togithub.com/unifiedjs/unified/commit/dc85d21) Fix typo
    by [@&#8203;jablko](https://togithub.com/jablko) in [https://github.com/unifiedjs/unified/pull/185](https://togithub.com/unifiedjs/unified/pull/185)

**Full Changelog**: unifiedjs/unified@10.1.1...10.1.2

### [`v10.1.1`](https://togithub.com/unifiedjs/unified/releases/tag/10.1.1)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/10.1.0...10.1.1)

-   [`6b060c2`](https://togithub.com/unifiedjs/unified/commit/6b060c2) Fix type of `run` signature
    by [@&#8203;alvinleung1996](https://togithub.com/alvinleung1996) in [https://github.com/unifiedjs/unified/pull/174](https://togithub.com/unifiedjs/unified/pull/174)

**Full Changelog**: unifiedjs/unified@10.1.0...10.1.1

### [`v10.1.0`](https://togithub.com/unifiedjs/unified/releases/tag/10.1.0)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/10.0.1...10.1.0)

-   [`134ecad`](https://togithub.com/unifiedjs/unified/commit/134ecad) Add plugin input/output type parameters

### [`v10.0.1`](https://togithub.com/unifiedjs/unified/releases/tag/10.0.1)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/10.0.0...10.0.1)

-   [`591b0c0`](https://togithub.com/unifiedjs/unified/commit/591b0c0) Fix types to support `void` async transformers

### [`v10.0.0`](https://togithub.com/unifiedjs/unified/releases/tag/10.0.0)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/9.2.2...10.0.0)

##### Breaking

-   [`dc46bc5`](https://togithub.com/unifiedjs/unified/commit/dc46bc5) Use ESM and update `vfile`
    -   Change:

        ```js
        // from cjs import
        var unified = require('unified')

        // to esm import
        import {unified} from 'unified'
        ```

        Learn [more about ESM in this guide](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
    -   **Breaking**: this updates `vfile`, which importantly renames ~~`vfile.contents`~~ to `vfile.value`. See [`vfile@5`](https://togithub.com/vfile/vfile/releases/tag/5.0.0)
    -   Inconsequential: this updates `trough`, which removes support for Promise-like objects returned from plugins, in favor of only support actual promises. To update, instead of returning an object with a `then` function, return and *actual* promise

##### Types

-   [`b3e2464`](https://togithub.com/unifiedjs/unified/commit/b3e2464) Rewrite types
    -   Removed the type parameter `P` for processor settings
    -   Use `any[]` instead of `[Record<string, unknown>?]` for the default plugin type parameters
-   [`45eb72e`](https://togithub.com/unifiedjs/unified/commit/45eb72e) Update types for ESM
-   [`2c7ba99`](https://togithub.com/unifiedjs/unified/commit/2c7ba99) [`8eda349`](https://togithub.com/unifiedjs/unified/commit/8eda349) Add explicit dependency on `@types/unist`
-   [`0e8f611`](https://togithub.com/unifiedjs/unified/commit/0e8f611) Remove typescript@3 legacy support
-   [`350ed9d`](https://togithub.com/unifiedjs/unified/commit/350ed9d) Fix `next` in types of transformer signature
-   [`b22bf8e`](https://togithub.com/unifiedjs/unified/commit/b22bf8e) Add support for buffer, other return values
-   [`4bfd6c8`](https://togithub.com/unifiedjs/unified/commit/4bfd6c8) [`b8fe5ec`](https://togithub.com/unifiedjs/unified/commit/b8fe5ec) [`6ef3933`](https://togithub.com/unifiedjs/unified/commit/6ef3933) Add support for boolean plugin options

##### Project

-   [`88374fc`](https://togithub.com/unifiedjs/unified/commit/88374fc) Add `esast` to list of syntax trees
-   [`a6ff3c1`](https://togithub.com/unifiedjs/unified/commit/a6ff3c1) Fix links
-   [`ee6ee47`](https://togithub.com/unifiedjs/unified/commit/ee6ee47) Update examples in `readme.md`
-   [`32abf7c`](https://togithub.com/unifiedjs/unified/commit/32abf7c) [`60de570`](https://togithub.com/unifiedjs/unified/commit/60de570) [`115898a`](https://togithub.com/unifiedjs/unified/commit/115898a) Refactor code style

### [`v9.2.2`](https://togithub.com/unifiedjs/unified/releases/tag/9.2.2)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/9.2.1...9.2.2)

-   [`bc50a01`](https://togithub.com/unifiedjs/unified/commit/bc50a01) Fix to set `vfile.value` if a vfile@5 is given

### [`v9.2.1`](https://togithub.com/unifiedjs/unified/releases/tag/9.2.1)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/9.2.0...9.2.1)

-   [`fe51be2`](https://togithub.com/unifiedjs/unified/commit/fe51be2) Fix mutating options
-   [`8f135d0`](https://togithub.com/unifiedjs/unified/commit/8f135d0) Refactor to improve bundle size
-   [`ad12369`](https://togithub.com/unifiedjs/unified/commit/ad12369) Remove outdated description of compile results

### [`v9.2.0`](https://togithub.com/unifiedjs/unified/releases/tag/9.2.0)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/9.1.0...9.2.0)

-   [`7fc4271`](https://togithub.com/unifiedjs/unified/commit/7fc4271) Add variadic tuple types for plugin tuple

### [`v9.1.0`](https://togithub.com/unifiedjs/unified/releases/tag/9.1.0)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/9.0.0...9.1.0)

-   [`56fdba4`](https://togithub.com/unifiedjs/unified/commit/56fdba4) Add `FrozenProcessor` interface to types

### [`v9.0.0`](https://togithub.com/unifiedjs/unified/releases/tag/9.0.0)

[Compare Source](https://togithub.com/unifiedjs/unified/compare/8.4.2...9.0.0)

-   [`c3ba172`](https://togithub.com/unifiedjs/unified/commit/c3ba172) Set `file.result` when processing to non-text
    (**breaking**, if you’re using `.process` or `.processSync` with a compiler that returns an object, then those results were available at ~~`file.contents`~~ and are now at `file.result`)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/X-oss-byte/Nextjs).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☂️ area/types This affects typings 💪 phase/solved Post is done 👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem
Development

Successfully merging this pull request may close these issues.

3rd overload signature of FrozenProcessor.run should accept ParseTree instead of CompileTree
4 participants