unified
Advanced tools
Comparing version 9.2.0 to 9.2.1
73
index.js
@@ -29,5 +29,5 @@ 'use strict' | ||
function done(err, tree, file) { | ||
if (err) { | ||
next(err) | ||
function done(error, tree, file) { | ||
if (error) { | ||
next(error) | ||
} else { | ||
@@ -43,3 +43,2 @@ ctx.tree = tree | ||
var result = p.stringify(ctx.tree, ctx.file) | ||
var file = ctx.file | ||
@@ -49,5 +48,5 @@ if (result === undefined || result === null) { | ||
} else if (typeof result === 'string' || buffer(result)) { | ||
file.contents = result | ||
ctx.file.contents = result | ||
} else { | ||
file.result = result | ||
ctx.file.result = result | ||
} | ||
@@ -61,4 +60,4 @@ } | ||
var namespace = {} | ||
var frozen = false | ||
var freezeIndex = -1 | ||
var frozen | ||
@@ -89,6 +88,5 @@ // Data management. | ||
var destination = unified() | ||
var length = attachers.length | ||
var index = -1 | ||
while (++index < length) { | ||
while (++index < attachers.length) { | ||
destination.use.apply(null, attachers[index]) | ||
@@ -111,4 +109,2 @@ } | ||
var values | ||
var plugin | ||
var options | ||
var transformer | ||
@@ -122,15 +118,12 @@ | ||
values = attachers[freezeIndex] | ||
plugin = values[0] | ||
options = values[1] | ||
transformer = null | ||
if (options === false) { | ||
if (values[1] === false) { | ||
continue | ||
} | ||
if (options === true) { | ||
if (values[1] === true) { | ||
values[1] = undefined | ||
} | ||
transformer = plugin.apply(processor, values.slice(1)) | ||
transformer = values[0].apply(processor, values.slice(1)) | ||
@@ -155,5 +148,3 @@ if (typeof transformer === 'function') { | ||
assertUnfrozen('data', frozen) | ||
namespace[key] = value | ||
return processor | ||
@@ -232,4 +223,3 @@ } | ||
function addList(plugins) { | ||
var length | ||
var index | ||
var index = -1 | ||
@@ -239,6 +229,3 @@ if (plugins === null || plugins === undefined) { | ||
} else if (typeof plugins === 'object' && 'length' in plugins) { | ||
length = plugins.length | ||
index = -1 | ||
while (++index < length) { | ||
while (++index < plugins.length) { | ||
add(plugins[index]) | ||
@@ -256,3 +243,3 @@ } | ||
if (plain(entry[1]) && plain(value)) { | ||
value = extend(entry[1], value) | ||
value = extend(true, entry[1], value) | ||
} | ||
@@ -268,11 +255,7 @@ | ||
function find(plugin) { | ||
var length = attachers.length | ||
var index = -1 | ||
var entry | ||
while (++index < length) { | ||
entry = attachers[index] | ||
if (entry[0] === plugin) { | ||
return entry | ||
while (++index < attachers.length) { | ||
if (attachers[index][0] === plugin) { | ||
return attachers[index] | ||
} | ||
@@ -319,6 +302,6 @@ } | ||
function done(err, tree, file) { | ||
function done(error, tree, file) { | ||
tree = tree || node | ||
if (err) { | ||
reject(err) | ||
if (error) { | ||
reject(error) | ||
} else if (resolve) { | ||
@@ -336,4 +319,4 @@ resolve(tree) | ||
function runSync(node, file) { | ||
var complete = false | ||
var result | ||
var complete | ||
@@ -346,6 +329,6 @@ run(node, file, done) | ||
function done(err, tree) { | ||
function done(error, tree) { | ||
complete = true | ||
bail(err) | ||
result = tree | ||
bail(error) | ||
} | ||
@@ -392,5 +375,5 @@ } | ||
function done(err) { | ||
if (err) { | ||
reject(err) | ||
function done(error) { | ||
if (error) { | ||
reject(error) | ||
} else if (resolve) { | ||
@@ -407,4 +390,4 @@ resolve(file) | ||
function processSync(doc) { | ||
var complete = false | ||
var file | ||
var complete | ||
@@ -422,5 +405,5 @@ freeze() | ||
function done(err) { | ||
function done(error) { | ||
complete = true | ||
bail(err) | ||
bail(error) | ||
} | ||
@@ -427,0 +410,0 @@ } |
{ | ||
"name": "unified", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"description": "Interface for parsing, inspecting, transforming, and serializing content through syntax trees", | ||
@@ -62,14 +62,14 @@ "license": "MIT", | ||
"devDependencies": { | ||
"browserify": "^16.0.0", | ||
"browserify": "^17.0.0", | ||
"c8": "^7.0.0", | ||
"dtslint": "^3.0.0", | ||
"dtslint": "^4.0.0", | ||
"prettier": "^2.0.0", | ||
"remark-cli": "^8.0.0", | ||
"remark-preset-wooorm": "^7.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"tape": "^5.0.0", | ||
"tinyify": "^3.0.0", | ||
"xo": "^0.33.0" | ||
"xo": "^0.38.0" | ||
}, | ||
"scripts": { | ||
"format": "remark . -qfo && prettier . --write && xo --fix", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"build-bundle": "browserify index.js -s unified -o unified.js", | ||
@@ -99,3 +99,3 @@ "build-mangle": "browserify index.js -s unified -p tinyify -o unified.min.js", | ||
"no-unreachable-loop": "off", | ||
"unicorn/catch-error-name": "off", | ||
"unicorn/prefer-number-properties": "off", | ||
"unicorn/prefer-optional-catch-binding": "off", | ||
@@ -102,0 +102,0 @@ "unicorn/prefer-reflect-apply": "off", |
# [![unified][logo]][site] | ||
[![GitHub CI][github-ci-badge]][github-ci] | ||
[![Build][build-badge]][build] | ||
@@ -21,3 +20,3 @@ [![Coverage][coverage-badge]][coverage] | ||
[MDX][] to embed [JSX][], and [Prettier][] to format it. | ||
It’s used in about 350k projects on GitHub and has about 15m downloads each | ||
It’s used in about 500k projects on GitHub and has about 25m downloads each | ||
month on npm: you’re probably using it. | ||
@@ -66,4 +65,4 @@ Some notable users are [Node.js][], [Vercel][], [Netlify][], [GitHub][], | ||
<td width="10%" align="center"> | ||
<a href="https://boostio.co">BoostIO</a><br><br> | ||
<a href="https://boostio.co"><img src="https://avatars1.githubusercontent.com/u/13612118?s=128&v=4" width="64"></a> | ||
<a href="https://boosthub.io">Boost Hub</a><br><br> | ||
<a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> | ||
</td> | ||
@@ -652,9 +651,2 @@ <td width="10%" align="center"> | ||
Be aware that [*compiler*][compiler]s typically, but not always, return | ||
`string`. | ||
Some compilers, such as the one configured with [`rehype-react`][rehype-react], | ||
return other values (in this case, a React tree). | ||
When using TypeScript, cast the type of [`file.contents`][vfile-contents] on | ||
your side. | ||
unified typically compiles by serializing: most [*compiler*][compiler]s return | ||
@@ -1211,12 +1203,8 @@ `string` (or `Buffer`). | ||
[logo]: https://raw.githubusercontent.com/unifiedjs/unified/39917ea/logo.svg?sanitize=true | ||
[logo]: https://raw.githubusercontent.com/unifiedjs/unified/93862e5/logo.svg?sanitize=true | ||
[github-ci-badge]: https://github.com/unifiedjs/unified/workflows/CI/badge.svg | ||
[build-badge]: https://github.com/unifiedjs/unified/workflows/main/badge.svg | ||
[github-ci]: https://github.com/unifiedjs/unified/actions | ||
[build]: https://github.com/unifiedjs/unified/actions | ||
[build-badge]: https://img.shields.io/travis/unifiedjs/unified.svg | ||
[build]: https://travis-ci.org/unifiedjs/unified | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified.svg | ||
@@ -1223,0 +1211,0 @@ |
@@ -62,3 +62,3 @@ // TypeScript Version: 3.4 | ||
* | ||
* @see Processor | ||
* See `Processor`. | ||
*/ | ||
@@ -65,0 +65,0 @@ interface FrozenProcessor<P = Settings> { |
@@ -62,3 +62,3 @@ // TypeScript Version: 4.0 | ||
* | ||
* @see Processor | ||
* See `Processor`. | ||
*/ | ||
@@ -65,0 +65,0 @@ interface FrozenProcessor<P = Settings> { |
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
0
80910
1097
1387