@a-la/context
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -1,2 +0,1 @@ | ||
const { debuglog } = require('util'); | ||
const { Replaceable } = require('restream'); | ||
@@ -6,11 +5,10 @@ const Catchment = require('catchment'); | ||
const LOG = debuglog('@a-la/context') | ||
/** | ||
* A context for testing à la transforms which will allow to use its `stream` property. | ||
*/ | ||
class ALaContext { | ||
class ALaContext { | ||
constructor(file) { | ||
this.file = file | ||
this.config = {} | ||
this.props = null | ||
} | ||
@@ -34,2 +32,3 @@ /** | ||
replaceable.file = this.file | ||
if (this.props) Object.assign(replaceable, this.props) | ||
const events = eventKeys.reduce((acc, key) => ({ ...acc, [key]: [] }), {}) | ||
@@ -58,2 +57,9 @@ eventKeys.forEach((key) => { | ||
} | ||
/** | ||
* Set properties on the ÀLaMode transform stream. | ||
* @param {Object<string, *>} props | ||
*/ | ||
setProps(props) { | ||
this.props = props | ||
} | ||
} | ||
@@ -60,0 +66,0 @@ |
@@ -0,1 +1,7 @@ | ||
## 14 March 2020 | ||
### [1.4.0](https://github.com/a-la/context/compare/v1.3.0...v1.4.0) | ||
- [feature] Set properties on the stream. | ||
## 16 May 2019 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "@a-la/context", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A test context for @a-la packages.", | ||
@@ -42,7 +42,7 @@ "main": "build", | ||
"devDependencies": { | ||
"alamode": "2.2.0", | ||
"documentary": "1.27.3", | ||
"alamode": "3.5.2", | ||
"documentary": "1.37.1", | ||
"eslint-config-artdeco": "1.0.1", | ||
"yarn-s": "1.1.0", | ||
"zoroaster": "4.1.1-alpha" | ||
"yarn-s": "1.2.3", | ||
"zoroaster": "4.3.0" | ||
}, | ||
@@ -53,4 +53,4 @@ "dependencies": { | ||
"erte": "1.2.0", | ||
"restream": "3.7.1" | ||
"restream": "3.7.4" | ||
} | ||
} |
# @a-la/context | ||
[![npm version](https://badge.fury.io/js/%40a-la%2Fcontext.svg)](https://npmjs.org/package/@a-la/context) | ||
[![npm version](https://badge.fury.io/js/%40a-la%2Fcontext.svg)](https://www.npmjs.com/package/@a-la/context) | ||
@@ -19,2 +19,3 @@ `@a-la/context` is a a test context for `@a-la` packages used in [`alamode`](https://alamode.cc) transpiler. It will provide a means to record the result of transforms for given rules, as well as emitted events. | ||
- [`setFile(file: string)`](#setfilefile-string-void) | ||
- [`setProps(props: !Object)`](#setpropsprops-object-void) | ||
- [Copyright](#copyright) | ||
@@ -32,5 +33,7 @@ | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/0.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/0.svg?sanitize=true"> | ||
</a></p> | ||
## `async stream(`<br/> `rules: Rule|Rule[],`<br/> `text: string,`<br/> `eventKeys?: string[],`<br/>`): ReturnType` | ||
## <code>async <ins>stream</ins>(</code><sub><br/> `rules: Rule|Rule[],`<br/> `text: string,`<br/> `eventKeys?: string[],`<br/></sub><code>): <i>ReturnType</i></code> | ||
@@ -108,16 +111,31 @@ Creates a `Replaceable` stream according to a rule or set of rules, asynchronously ends it with passed text and returns the outcome. | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/1.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/1.svg?sanitize=true"> | ||
</a></p> | ||
## `setConfig(`<br/> `config: Object,`<br/>`): void` | ||
## <code><ins>setConfig</ins>(</code><sub><br/> `config: Object,`<br/></sub><code>): <i>void</i></code> | ||
This method allows to set the `config` property of the _Replaceable_ instance created inside of the `stream` method. Some transform may use `config` for certain functionality, e.g., replacing of the source string in the [`@a-la/import`](https://github.com/a-la/import) transform. | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/2.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/2.svg?sanitize=true"> | ||
</a></p> | ||
## `setFile(`<br/> `file: string,`<br/>`): void` | ||
## <code><ins>setFile</ins>(</code><sub><br/> `file: string,`<br/></sub><code>): <i>void</i></code> | ||
Sets the `file` property on the replaceable stream. This is required by the import transform to find the _package.json_ file of the imported module to check whether it has the `alamode` property so that the `esCheck` can be skipped. | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/3.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/3.svg?sanitize=true"> | ||
</a></p> | ||
## <code><ins>setProps</ins>(</code><sub><br/> `props: !Object,`<br/></sub><code>): <i>void</i></code> | ||
Assigns properties to the transform stream. The rules will be able to access them via their `this` context. | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/4.svg?sanitize=true"> | ||
</a></p> | ||
## Copyright | ||
@@ -128,17 +146,13 @@ | ||
<th> | ||
<a href="https://artd.eco"> | ||
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco" /> | ||
<a href="https://www.artd.eco"> | ||
<img width="100" src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" | ||
alt="Art Deco"> | ||
</a> | ||
</th> | ||
<th>© <a href="https://artd.eco">Art Deco</a> for <a href="https://alamode.cc">À La Mode</a> 2019</th> | ||
<th> | ||
<a href="https://www.technation.sucks" title="Tech Nation Visa"> | ||
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif" | ||
alt="Tech Nation Visa" /> | ||
</a> | ||
</th> | ||
<th><a href="https://www.technation.sucks">Tech Nation Visa Sucks</a></th> | ||
<th>© <a href="https://www.artd.eco">Art Deco™</a> for <a href="https://alamode.cc">À La Mode</a> 2020</th> | ||
</tr> | ||
</table> | ||
<p align="center"><a href="#table-of-contents"><img src="/.documentary/section-breaks/-1.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"> | ||
<img src="/.documentary/section-breaks/-1.svg?sanitize=true"> | ||
</a></p> |
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
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
11293
69
154
+ Addedrestream@3.7.4(transitive)
- Removedrestream@3.7.1(transitive)
Updatedrestream@3.7.4