async-transforms
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "async-transforms", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Asynchronous stream transforms", | ||
"type": "module", | ||
"module": "./transforms.js", | ||
"main": "./dist/transforms.cjs", | ||
"module": "./lib/transforms.js", | ||
"main": "./require/transforms.cjs", | ||
"exports": { | ||
"import": "./transforms.js", | ||
"default": "./dist/transforms.cjs" | ||
"import": "./lib/transforms.js", | ||
"require": "./require/transforms.cjs", | ||
"./worker": { | ||
"import": "./lib/worker.js", | ||
"require": "./require/worker.cjs" | ||
} | ||
}, | ||
@@ -21,5 +25,5 @@ "repository": "https://github.com/samthor/async-transforms", | ||
"scripts": { | ||
"prepare": "rollup --format=cjs --file=dist/transforms.cjs -- transforms.js", | ||
"prepare": "bash build.sh", | ||
"test": "mocha" | ||
} | ||
} |
@@ -66,2 +66,32 @@ [![Build](https://api.travis-ci.org/samthor/async-transforms.svg?branch=master)](https://travis-ci.org/samthor/async-transforms) | ||
While Gulp plugins for Less already exist, this makes it easier to write general-purpose, modern plugins with `async` and `await` syntax. | ||
While Gulp plugins for Less already exist, this makes it easier to write general-purpose, modern plugins with `async` and `await` syntax. | ||
## Worker Pool | ||
This includes a submodule which provides a worker pool. | ||
It's useful when combined with the above transforms handler. | ||
For example: | ||
```js | ||
import {pool} from 'async-transforms/worker'; | ||
const compilationPool = pool(path.resolve('./compile.js')); | ||
// use directly | ||
compilationPool(123, {tasks: 2}) | ||
.then((result) => console.info('result from passing value to worker', result)); | ||
// or as part of a transform | ||
stream.Readable.from([object1, object2]) | ||
.pipe(transforms.map(compilationPool)) | ||
.pipe(transforms.map(() => { | ||
// do something with the result | ||
})); | ||
``` | ||
The pool invokes the default export (or `module.exports` for CJS) of the target file. | ||
By default, it utilizes 75% of your local CPUs, but set `tasks` to control this—use a fraction from 0-1 to set a ratio, and higher for absolute. | ||
Use this for CPU-bound tasks like JS minification. | ||
This doesn't really belong in this module. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33290
9
570
97
3
1