micromark-util-resolve-all
Advanced tools
Comparing version 1.0.0 to 1.1.0
/** | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Event} Event | ||
* @typedef {import('micromark-util-types').Resolver} Resolver | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
*/ | ||
@@ -9,16 +9,20 @@ /** | ||
* | ||
* @param {{resolveAll?: Resolver}[]} constructs | ||
* @param {Event[]} events | ||
* @param {Array<{resolveAll?: Resolver | undefined}>} constructs | ||
* List of constructs, optionally with `resolveAll`s. | ||
* @param {Array<Event>} events | ||
* List of events. | ||
* @param {TokenizeContext} context | ||
* @returns {Event[]} | ||
* Context used by `tokenize`. | ||
* @returns {Array<Event>} | ||
* Changed events. | ||
*/ | ||
export function resolveAll( | ||
constructs: { | ||
resolveAll?: Resolver | ||
}[], | ||
events: import('micromark-util-types').Event[], | ||
constructs: Array<{ | ||
resolveAll?: Resolver | undefined | ||
}>, | ||
events: Array<import('micromark-util-types').Event>, | ||
context: TokenizeContext | ||
): import('micromark-util-types').Event[] | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext | ||
): Array<import('micromark-util-types').Event> | ||
export type Event = import('micromark-util-types').Event | ||
export type Resolver = import('micromark-util-types').Resolver | ||
export type TokenizeContext = import('micromark-util-types').TokenizeContext |
14
index.js
/** | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
* @typedef {import('micromark-util-types').Event} Event | ||
* @typedef {import('micromark-util-types').Resolver} Resolver | ||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext | ||
*/ | ||
@@ -10,9 +10,13 @@ | ||
* | ||
* @param {{resolveAll?: Resolver}[]} constructs | ||
* @param {Event[]} events | ||
* @param {Array<{resolveAll?: Resolver | undefined}>} constructs | ||
* List of constructs, optionally with `resolveAll`s. | ||
* @param {Array<Event>} events | ||
* List of events. | ||
* @param {TokenizeContext} context | ||
* @returns {Event[]} | ||
* Context used by `tokenize`. | ||
* @returns {Array<Event>} | ||
* Changed events. | ||
*/ | ||
export function resolveAll(constructs, events, context) { | ||
/** @type {Resolver[]} */ | ||
/** @type {Array<Resolver>} */ | ||
const called = [] | ||
@@ -19,0 +23,0 @@ let index = -1 |
{ | ||
"name": "micromark-util-resolve-all", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "micromark utility to resolve subtokens", | ||
@@ -40,5 +40,3 @@ "license": "MIT", | ||
}, | ||
"scripts": { | ||
"build": "rimraf \"*.d.ts\" && tsc && type-coverage" | ||
}, | ||
"scripts": {}, | ||
"xo": false, | ||
@@ -45,0 +43,0 @@ "typeCoverage": { |
@@ -11,3 +11,3 @@ # micromark-util-resolve-all | ||
micromark utility to resolve subtokens. | ||
[micromark][] utility to resolve subtokens. | ||
@@ -24,2 +24,4 @@ [Resolvers][resolver] are functions that take events and manipulate them. | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
@@ -29,2 +31,4 @@ * [Use](#use) | ||
* [`resolveAll(constructs, events, context)`](#resolveallconstructs-events-context) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
@@ -34,5 +38,14 @@ * [Contribute](#contribute) | ||
## What is this? | ||
This package exposes a micromark internal that you probably don’t need. | ||
## When should I use this? | ||
This package might be useful when you are making your own micromark extensions. | ||
## Install | ||
[npm][]: | ||
This package is [ESM only][esm]. | ||
In Node.js (version 16+), install with [npm][]: | ||
@@ -43,2 +56,16 @@ ```sh | ||
In Deno with [`esm.sh`][esmsh]: | ||
```js | ||
import {resolveAll} from 'https://esm.sh/micromark-util-resolve-all@1' | ||
``` | ||
In browsers with [`esm.sh`][esmsh]: | ||
```html | ||
<script type="module"> | ||
import {resolveAll} from 'https://esm.sh/micromark-util-resolve-all@1?bundle' | ||
</script> | ||
``` | ||
## Use | ||
@@ -106,3 +133,3 @@ | ||
This module exports the following identifiers: `resolveAll`. | ||
This module exports the identifier [`resolveAll`][api-resolve-all]. | ||
There is no default export. | ||
@@ -116,13 +143,30 @@ | ||
* `constructs` (`Construct[]`) — List of constructs, optionally with | ||
`resolveAll`s | ||
* `events` (`Event[]`) — List of events | ||
* `context` (`TokenizeContext`) — Context used by `tokenize` | ||
* `constructs` (`Array<Construct>`) | ||
— list of constructs, optionally with `resolveAll`s | ||
* `events` (`Array<Event>`) | ||
— list of events | ||
* `context` (`TokenizeContext`) | ||
— context used by `tokenize` | ||
###### Returns | ||
`Events[]` — Changed events. | ||
Changed events (`Array<Events>`). | ||
## Types | ||
This package is fully typed with [TypeScript][]. | ||
It exports no additional types. | ||
## Compatibility | ||
Projects maintained by the unified collective are compatible with all maintained | ||
versions of Node.js. | ||
As of now, that is Node.js 16+. | ||
Our projects sometimes work with older versions, but this is not guaranteed. | ||
This package works with `micromark` version 3+. | ||
## Security | ||
This package is safe. | ||
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to | ||
@@ -159,5 +203,5 @@ submit a security report. | ||
[bundle-size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-util-resolve-all.svg | ||
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-resolve-all | ||
[bundle-size]: https://bundlephobia.com/result?p=micromark-util-resolve-all | ||
[bundle-size]: https://bundlejs.com/?q=micromark-util-resolve-all | ||
@@ -172,2 +216,6 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
[esmsh]: https://esm.sh | ||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg | ||
@@ -183,10 +231,16 @@ | ||
[securitymd]: https://github.com/micromark/.github/blob/HEAD/security.md | ||
[securitymd]: https://github.com/micromark/.github/blob/main/security.md | ||
[contributing]: https://github.com/micromark/.github/blob/HEAD/contributing.md | ||
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md | ||
[support]: https://github.com/micromark/.github/blob/HEAD/support.md | ||
[support]: https://github.com/micromark/.github/blob/main/support.md | ||
[coc]: https://github.com/micromark/.github/blob/HEAD/code-of-conduct.md | ||
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md | ||
[resolver]: https://github.com/micromark/micromark/blob/a571c09/packages/micromark-util-types/index.js#L219 | ||
[typescript]: https://www.typescriptlang.org | ||
[micromark]: https://github.com/micromark/micromark | ||
[api-resolve-all]: #resolveallconstructs-events-context |
9181
57
237