Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unified-engine

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unified-engine - npm Package Compare versions

Comparing version 11.1.0 to 11.1.1

32

lib/configuration.js

@@ -87,3 +87,3 @@ /**

import path from 'node:path'
import {pathToFileURL} from 'node:url'
import {fileURLToPath, pathToFileURL} from 'node:url'
import structuredClone from '@ungap/structured-clone'

@@ -288,3 +288,3 @@ import createDebug from 'debug'

const result = /** @type {Result} */ (
await loadFromAbsolutePath(filePath, this.cwd)
await loadFromAbsolutePath(pathToFileURL(filePath).href, this.cwd)
)

@@ -426,7 +426,7 @@ return result

/** @type {string} */
let fp
let fileUrl
try {
fp = await resolvePlugin(id, {
cwd: options.root,
fileUrl = await resolvePlugin(id, {
from: pathToFileURL(options.root) + '/',
prefix: options.prefix

@@ -441,3 +441,3 @@ })

const result = await loadFromAbsolutePath(fp, options.root)
const result = await loadFromAbsolutePath(fileUrl, options.root)

@@ -452,3 +452,6 @@ try {

const preset = /** @type {Preset} */ (result)
await merge(target, preset, {...options, root: path.dirname(fp)})
await merge(target, preset, {
...options,
root: path.dirname(fileURLToPath(fileUrl))
})
}

@@ -460,3 +463,3 @@ } catch (error) {

'`, at `' +
path.relative(options.root, fp) +
path.relative(options.root, fileURLToPath(fileUrl)) +
'`',

@@ -527,3 +530,3 @@ {cause: error}

/**
* @param {string} fp
* @param {string} fileUrl
* Specifier.

@@ -535,6 +538,6 @@ * @param {string} base

*/
async function loadFromAbsolutePath(fp, base) {
async function loadFromAbsolutePath(fileUrl, base) {
try {
/** @type {ImportResult} */
const result = await import(pathToFileURL(fp).href)
const result = await import(fileUrl)

@@ -549,6 +552,7 @@ if (!('default' in result)) {

} catch (error) {
throw new Error('Cannot import `' + path.relative(base, fp) + '`', {
cause: error
})
throw new Error(
'Cannot import `' + path.relative(base, fileURLToPath(fileUrl)) + '`',
{cause: error}
)
}
}

@@ -9,2 +9,3 @@ /**

import {pathToFileURL} from 'node:url'
import {loadPlugin} from 'load-plugin'

@@ -39,3 +40,3 @@ import {reporter} from 'vfile-reporter'

await loadPlugin(settings.reporter, {
cwd: settings.cwd,
from: pathToFileURL(settings.cwd) + '/',
prefix: 'vfile-reporter'

@@ -42,0 +43,0 @@ })

{
"name": "unified-engine",
"version": "11.1.0",
"version": "11.1.1",
"description": "unified engine to process multiple files, lettings users configure from the file system",

@@ -43,3 +43,3 @@ "license": "MIT",

"is-plain-obj": "^4.0.0",
"load-plugin": "^5.0.0",
"load-plugin": "^6.0.0",
"parse-json": "^7.0.0",

@@ -59,6 +59,7 @@ "trough": "^2.0.0",

"prettier": "^3.0.0",
"remark": "^14.0.0",
"remark-cli": "^11.0.0",
"remark": "^15.0.0",
"remark-cli": "^12.0.0",
"remark-gfm": "^4.0.0",
"remark-preset-wooorm": "^9.0.0",
"remark-toc": "^8.0.0",
"remark-toc": "^9.0.0",
"strip-ansi": "^7.0.0",

@@ -92,8 +93,9 @@ "type-coverage": "^2.0.0",

[
"remark-toc",
{
"heading": "contents",
"maxDepth": 3,
"tight": true
}
"remark-preset-wooorm/node_modules/remark-gfm/index.js",
false
],
"remark-gfm",
[
"remark-lint-list-item-indent",
"space"
]

@@ -100,0 +102,0 @@ ]

@@ -15,68 +15,68 @@ # unified-engine

* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`engine(options, callback)`](#engineoptions-callback)
* [`Configuration`](#configuration)
* [`Completer`](#completer)
* [`Callback`](#callback)
* [`ConfigTransform`](#configtransform)
* [`Context`](#context)
* [`FileSet`](#fileset)
* [`Options`](#options)
* [`Preset`](#preset)
* [`ResolveFrom`](#resolvefrom)
* [`VFileReporter`](#vfilereporter)
* [Config files](#config-files)
* [Explicit configuration](#explicit-configuration)
* [Implicit configuration](#implicit-configuration)
* [Examples](#examples)
* [Ignore files](#ignore-files)
* [Explicit ignoring](#explicit-ignoring)
* [Implicit ignoring](#implicit-ignoring)
* [Extra ignoring](#extra-ignoring)
* [Ignoring](#ignoring)
* [Examples](#examples-1)
* [Plugins](#plugins)
* [Examples](#examples-2)
* [`options.alwaysStringify`](#optionsalwaysstringify)
* [`options.configTransform`](#optionsconfigtransform)
* [`options.defaultConfig`](#optionsdefaultconfig)
* [`options.detectConfig`](#optionsdetectconfig)
* [`options.detectIgnore`](#optionsdetectignore)
* [`options.extensions`](#optionsextensions)
* [`options.filePath`](#optionsfilepath)
* [`options.files`](#optionsfiles)
* [`options.frail`](#optionsfrail)
* [`options.ignoreName`](#optionsignorename)
* [`options.ignorePath`](#optionsignorepath)
* [`options.ignorePathResolveFrom`](#optionsignorepathresolvefrom)
* [`options.ignorePatterns`](#optionsignorepatterns)
* [`options.ignoreUnconfigured`](#optionsignoreunconfigured)
* [`options.inspect`](#optionsinspect)
* [`options.out`](#optionsout)
* [`options.output`](#optionsoutput)
* [`options.packageField`](#optionspackagefield)
* [`options.pluginPrefix`](#optionspluginprefix)
* [`options.plugins`](#optionsplugins)
* [`options.processor`](#optionsprocessor)
* [`options.quiet`](#optionsquiet)
* [`options.rcName`](#optionsrcname)
* [`options.rcPath`](#optionsrcpath)
* [`options.reporter` and `options.reporterOptions`](#optionsreporter-and-optionsreporteroptions)
* [`options.settings`](#optionssettings)
* [`options.silent`](#optionssilent)
* [`options.streamError`](#optionsstreamerror)
* [`options.streamIn`](#optionsstreamin)
* [`options.streamOut`](#optionsstreamout)
* [`options.tree`](#optionstree)
* [`options.treeIn`](#optionstreein)
* [`options.treeOut`](#optionstreeout)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Contribute](#contribute)
* [License](#license)
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`engine(options, callback)`](#engineoptions-callback)
* [`Configuration`](#configuration)
* [`Completer`](#completer)
* [`Callback`](#callback)
* [`ConfigTransform`](#configtransform)
* [`Context`](#context)
* [`FileSet`](#fileset)
* [`Options`](#options)
* [`Preset`](#preset)
* [`ResolveFrom`](#resolvefrom)
* [`VFileReporter`](#vfilereporter)
* [Config files](#config-files)
* [Explicit configuration](#explicit-configuration)
* [Implicit configuration](#implicit-configuration)
* [Examples](#examples)
* [Ignore files](#ignore-files)
* [Explicit ignoring](#explicit-ignoring)
* [Implicit ignoring](#implicit-ignoring)
* [Extra ignoring](#extra-ignoring)
* [Ignoring](#ignoring)
* [Examples](#examples-1)
* [Plugins](#plugins)
* [Examples](#examples-2)
* [`options.alwaysStringify`](#optionsalwaysstringify)
* [`options.configTransform`](#optionsconfigtransform)
* [`options.defaultConfig`](#optionsdefaultconfig)
* [`options.detectConfig`](#optionsdetectconfig)
* [`options.detectIgnore`](#optionsdetectignore)
* [`options.extensions`](#optionsextensions)
* [`options.filePath`](#optionsfilepath)
* [`options.files`](#optionsfiles)
* [`options.frail`](#optionsfrail)
* [`options.ignoreName`](#optionsignorename)
* [`options.ignorePath`](#optionsignorepath)
* [`options.ignorePathResolveFrom`](#optionsignorepathresolvefrom)
* [`options.ignorePatterns`](#optionsignorepatterns)
* [`options.ignoreUnconfigured`](#optionsignoreunconfigured)
* [`options.inspect`](#optionsinspect)
* [`options.out`](#optionsout)
* [`options.output`](#optionsoutput)
* [`options.packageField`](#optionspackagefield)
* [`options.pluginPrefix`](#optionspluginprefix)
* [`options.plugins`](#optionsplugins)
* [`options.processor`](#optionsprocessor)
* [`options.quiet`](#optionsquiet)
* [`options.rcName`](#optionsrcname)
* [`options.rcPath`](#optionsrcpath)
* [`options.reporter` and `options.reporterOptions`](#optionsreporter-and-optionsreporteroptions)
* [`options.settings`](#optionssettings)
* [`options.silent`](#optionssilent)
* [`options.streamError`](#optionsstreamerror)
* [`options.streamIn`](#optionsstreamin)
* [`options.streamOut`](#optionsstreamout)
* [`options.tree`](#optionstree)
* [`options.treeIn`](#optionstreein)
* [`options.treeOut`](#optionstreeout)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Contribute](#contribute)
* [License](#license)

@@ -96,8 +96,8 @@ ## What is this?

* [`unified-args`][unified-args]
— create CLIs
* [`unified-engine-gulp`][unified-engine-gulp]
— create Gulp plugins
* [`unified-language-server`][unified-language-server]
— create language servers
* [`unified-args`][unified-args]
— create CLIs
* [`unified-engine-gulp`][unified-engine-gulp]
— create Gulp plugins
* [`unified-language-server`][unified-language-server]
— create language servers

@@ -164,6 +164,6 @@ You can use this to make such things.

* `options` ([`Options`][api-options], required)
— configuration
* `callback` ([`Callback`][api-callback], required)
— configuration
* `options` ([`Options`][api-options], required)
— configuration
* `callback` ([`Callback`][api-callback], required)
— configuration

@@ -182,9 +182,9 @@ ###### Returns

* `options` (subset of [`Options`][api-options], required)
— configuration (`cwd` is required)
* `options` (subset of [`Options`][api-options], required)
— configuration (`cwd` is required)
###### Fields
* `load(string, (Error?[, Result?]): undefined): undefined`
— get the config for a file
* `load(string, (Error?[, Result?]): undefined): undefined`
— get the config for a file

@@ -216,8 +216,8 @@ ### `Completer`

* `error` (`Error`, optional)
— error
* `code` (`0` or `1`, optional)
— exit code, `0` if successful or `1` if unsuccessful
* `context` ([`Context`][api-context], optional)
— processing context
* `error` (`Error`, optional)
— error
* `code` (`0` or `1`, optional)
— exit code, `0` if successful or `1` if unsuccessful
* `context` ([`Context`][api-context], optional)
— processing context

@@ -234,6 +234,6 @@ ###### Returns

* `config` (`unknown`)
— arbitrary config
* `filePath` (`string`)
— file path of config file
* `config` (`unknown`)
— arbitrary config
* `filePath` (`string`)
— file path of config file

@@ -250,6 +250,6 @@ ###### Returns

* `fileSet` ([`FileSet`][api-file-set])
— internally used info
* `files` ([`Array<VFile>`][vfile])
— processed files
* `fileSet` ([`FileSet`][api-file-set])
— internally used info
* `files` ([`Array<VFile>`][vfile])
— processed files

@@ -269,10 +269,10 @@ ### `FileSet`

* `valueOf(): Array<VFile>`
— get files in a set
* `use(completer: Completer): this`
— add middleware to be called when done (see: [`Completer`][api-completer])
* `add(file: VFile | string): this`
— add a file; the given file is processed like other files with a few
differences: it’s ignored when their file path is already added, never
written to the file system or `streamOut`, and not included in the report
* `valueOf(): Array<VFile>`
— get files in a set
* `use(completer: Completer): this`
— add middleware to be called when done (see: [`Completer`][api-completer])
* `add(file: VFile | string): this`
— add a file; the given file is processed like other files with a few
differences: it’s ignored when their file path is already added, never
written to the file system or `streamOut`, and not included in the report

@@ -287,98 +287,98 @@ ### `Options`

* `alwaysStringify` (`boolean`, default: `false`)
— whether to always serialize successfully processed files
* `color` (`boolean`, default: `false`)
— whether to report with ANSI color sequences; given to the reporter
* `configTransform` ([`ConfigTransform`][api-config-transform], optional)
— transform config files from a different schema
* `cwd` (`URL` or `string`, default: `process.cwd()`)
— folder to search files in, load plugins from, and more
* `defaultConfig` ([`Preset`][api-preset], optional)
— default configuration to use if no config file is given or found
* `detectConfig` (`boolean`, default: `true` if `options.packageField` or
`options.rcName`)
— whether to search for configuration files
* `detectIgnore` (`boolean`, default: `true` if `options.ignoreName`)
— whether to search for ignore files
* `extensions` (`Array<string>`, optional)
— search for files with these extensions, when folders are passed;
generated files are also given the first extension if `treeIn` is on and
`output` is on or points to a folder
* `filePath` (`URL` or `string`, optional)
— file path to process the given file on `streamIn` as
* `files` (`Array<URL | VFile | string>`, optional)
— paths or [globs][node-glob] to files and folder, or virtual files, to
process
* `frail` (`boolean`, default: `false`)
— call back with an unsuccessful (`1`) code on warnings as well as errors
* `ignoreName` (`string`, optional)
— name of ignore files to load
* `ignorePath` (`URL` or `string`, optional)
— filepath to an ignore file to load
* `ignorePathResolveFrom` ([`ResolveFrom`][api-resolve-from], default:
`'dir'`)
— resolve patterns in `ignorePath` from the current working folder
(`'cwd'`) or the ignore file’s folder (`'dir'`)
* `ignorePatterns` (optional)
— patterns to ignore in addition to ignore files
* `ignoreUnconfigured` (`boolean`, default: `false`)
— ignore files that do not have an associated detected configuration file;
either `rcName` or `packageField` must be defined too; cannot be combined
with `rcPath` or `detectConfig: false`
* `inspect` (`boolean`, default: `false`)
— whether to output a formatted syntax tree for debugging
* `out` (`boolean`, default: `false`)
— whether to write the processed file to `streamOut`
* `output` (`URL`, `boolean` or `string`, default: `false`)
— whether to write successfully processed files, and where to; when `true`,
overwrites the given files, when `false`, does not write to the file system;
when pointing to an existing folder, files are written to that folder and
keep their original basenames; when the parent folder of the given path
exists and one file is processed, the file is written to the given path
* `packageField` (`string`, optional)
— field where configuration can be found in `package.json` files
* `pluginPrefix` (`string`, optional)
— prefix to use when searching for plugins
* `plugins` ([`Preset['plugins']`][api-preset], optional)
— plugins to use
* `processor` ([`Processor`][unified-processor], **required**)
— unified processor to transform files
* `quiet` (`boolean`, default: `false`)
— do not report successful files; given to the reporter
* `rcName` (`string`, optional)
— name of configuration files to load
* `rcPath` (`URL` or `string`, optional)
— filepath to a configuration file to load
* `reporter` ([`VFileReporter`][api-vfile-reporter] or `string`, default:
`vfile-reporter`)
— reporter to use; if a `string` is passed, it’s loaded from `cwd`, and
`'vfile-reporter-'` can be omitted
* `reporterOptions` ([`Options`][vfile-reporter-options] from
`vfile-reporter`, optional)
— config to pass to the used reporter
* `settings` ([`Settings`][unified-settings] from `unified`, optional)
— configuration for the parser and compiler of the processor
* `silent` (`boolean`, default: `false`)
— report only fatal errors; given to the reporter
* `silentlyIgnore` (`boolean`, default: `false`)
— skip given files if they are ignored
* `streamError` ([`WritableStream`][node-writable-stream] from Node.js,
default: `process.stderr`)
— stream to write the report (if any) to
* `streamIn` ([`ReadableStream`][node-readable-stream] from Node.js,
default: `process.stdin`)
— stream to read from if no files are found or given
* `streamOut` ([`WritableStream`][node-writable-stream] from Node.js,
default: `process.stdout`)
— stream to write processed files to, nothing is streamed if either `out`
is `false`, `output` is not `false`, multiple files are processed, or a
fatal error occurred while processing a file
* `tree` (`boolean`, default: `false`)
— whether to treat both input and output as a syntax tree
* `treeIn` (`boolean`, default: `options.tree`)
— whether to treat input as a syntax tree
* `treeOut` (`boolean`, default: `options.tree`)
— whether to output as a syntax tree
* `verbose` (`boolean`, default: `false`)
— report extra info; given to the reporter
* `alwaysStringify` (`boolean`, default: `false`)
— whether to always serialize successfully processed files
* `color` (`boolean`, default: `false`)
— whether to report with ANSI color sequences; given to the reporter
* `configTransform` ([`ConfigTransform`][api-config-transform], optional)
— transform config files from a different schema
* `cwd` (`URL` or `string`, default: `process.cwd()`)
— folder to search files in, load plugins from, and more
* `defaultConfig` ([`Preset`][api-preset], optional)
— default configuration to use if no config file is given or found
* `detectConfig` (`boolean`, default: `true` if `options.packageField` or
`options.rcName`)
— whether to search for configuration files
* `detectIgnore` (`boolean`, default: `true` if `options.ignoreName`)
— whether to search for ignore files
* `extensions` (`Array<string>`, optional)
— search for files with these extensions, when folders are passed;
generated files are also given the first extension if `treeIn` is on and
`output` is on or points to a folder
* `filePath` (`URL` or `string`, optional)
— file path to process the given file on `streamIn` as
* `files` (`Array<URL | VFile | string>`, optional)
— paths or [globs][node-glob] to files and folder, or virtual files, to
process
* `frail` (`boolean`, default: `false`)
— call back with an unsuccessful (`1`) code on warnings as well as errors
* `ignoreName` (`string`, optional)
— name of ignore files to load
* `ignorePath` (`URL` or `string`, optional)
— filepath to an ignore file to load
* `ignorePathResolveFrom` ([`ResolveFrom`][api-resolve-from], default:
`'dir'`)
— resolve patterns in `ignorePath` from the current working folder
(`'cwd'`) or the ignore file’s folder (`'dir'`)
* `ignorePatterns` (optional)
— patterns to ignore in addition to ignore files
* `ignoreUnconfigured` (`boolean`, default: `false`)
— ignore files that do not have an associated detected configuration file;
either `rcName` or `packageField` must be defined too; cannot be combined
with `rcPath` or `detectConfig: false`
* `inspect` (`boolean`, default: `false`)
— whether to output a formatted syntax tree for debugging
* `out` (`boolean`, default: `false`)
— whether to write the processed file to `streamOut`
* `output` (`URL`, `boolean` or `string`, default: `false`)
— whether to write successfully processed files, and where to; when `true`,
overwrites the given files, when `false`, does not write to the file system;
when pointing to an existing folder, files are written to that folder and
keep their original basenames; when the parent folder of the given path
exists and one file is processed, the file is written to the given path
* `packageField` (`string`, optional)
— field where configuration can be found in `package.json` files
* `pluginPrefix` (`string`, optional)
— prefix to use when searching for plugins
* `plugins` ([`Preset['plugins']`][api-preset], optional)
— plugins to use
* `processor` ([`Processor`][unified-processor], **required**)
— unified processor to transform files
* `quiet` (`boolean`, default: `false`)
— do not report successful files; given to the reporter
* `rcName` (`string`, optional)
— name of configuration files to load
* `rcPath` (`URL` or `string`, optional)
— filepath to a configuration file to load
* `reporter` ([`VFileReporter`][api-vfile-reporter] or `string`, default:
`vfile-reporter`)
— reporter to use; if a `string` is passed, it’s loaded from `cwd`, and
`'vfile-reporter-'` can be omitted
* `reporterOptions` ([`Options`][vfile-reporter-options] from
`vfile-reporter`, optional)
— config to pass to the used reporter
* `settings` ([`Settings`][unified-settings] from `unified`, optional)
— configuration for the parser and compiler of the processor
* `silent` (`boolean`, default: `false`)
— report only fatal errors; given to the reporter
* `silentlyIgnore` (`boolean`, default: `false`)
— skip given files if they are ignored
* `streamError` ([`WritableStream`][node-writable-stream] from Node.js,
default: `process.stderr`)
— stream to write the report (if any) to
* `streamIn` ([`ReadableStream`][node-readable-stream] from Node.js,
default: `process.stdin`)
— stream to read from if no files are found or given
* `streamOut` ([`WritableStream`][node-writable-stream] from Node.js,
default: `process.stdout`)
— stream to write processed files to, nothing is streamed if either `out`
is `false`, `output` is not `false`, multiple files are processed, or a
fatal error occurred while processing a file
* `tree` (`boolean`, default: `false`)
— whether to treat both input and output as a syntax tree
* `treeIn` (`boolean`, default: `options.tree`)
— whether to treat input as a syntax tree
* `treeOut` (`boolean`, default: `options.tree`)
— whether to output as a syntax tree
* `verbose` (`boolean`, default: `false`)
— report extra info; given to the reporter

@@ -438,7 +438,7 @@ ### `Preset`

* `files` ([`Array<VFile>`][vfile])
— files
* `options` ([`Options`][vfile-reporter-options] from `vfile-reporter`,
optional)
— configuration
* `files` ([`Array<VFile>`][vfile])
— files
* `options` ([`Options`][vfile-reporter-options] from `vfile-reporter`,
optional)
— configuration

@@ -464,8 +464,8 @@ ###### Returns

* if `options.rcName` is given, `$rcName` (JSON), `$rcName.js` (CommonJS or
ESM depending on the `type` field of the closest `package.json`),
`$rcName.cjs` (CommonJS), `$rcName.mjs` (ESM), `$rcName.yml` (YAML),
and `$rcName.yaml` (YAML) are loaded
* if `options.packageField` is given, `package.json` (JSON) files are loaded
and the configuration at their `$packageField` field is used
* if `options.rcName` is given, `$rcName` (JSON), `$rcName.js` (CommonJS or
ESM depending on the `type` field of the closest `package.json`),
`$rcName.cjs` (CommonJS), `$rcName.mjs` (ESM), `$rcName.yml` (YAML),
and `$rcName.yaml` (YAML) are loaded
* if `options.packageField` is given, `package.json` (JSON) files are loaded
and the configuration at their `$packageField` field is used

@@ -472,0 +472,0 @@ The first file that is searched for in a folder is used as the configuration.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc