Skip to content

Commit e79a2fb

Browse files
Merge remote-tracking branch 'origin/master' into HEAD
2 parents cc7dccc + 886bb20 commit e79a2fb

12 files changed

Lines changed: 349 additions & 202 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**Description of the change**
2+
3+
Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR.
4+
5+
---
6+
7+
**Checklist:**
8+
9+
- [ ] Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
10+
- [ ] Linked any existing issues or proposals that this pull request should close
11+
- [ ] Updated or added relevant documentation
12+
- [ ] Added a test for the contribution (if applicable)

‎.github/workflows/ci.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: purescript-contrib/setup-purescript@main
16+
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: "10"
20+
21+
- name: Install dependencies
22+
run: |
23+
npm install -g bower
24+
npm install
25+
bower install --production
26+
27+
- name: Build source
28+
run: npm run-script build
29+
30+
- name: Run tests
31+
run: |
32+
bower install
33+
npm run-script test --if-present

‎.gitignore‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/.*
22
!/.gitignore
3-
!/.jscsrc
4-
!/.jshintrc
5-
!/.travis.yml
3+
!/.eslintrc.json
4+
!/.github/
65
/bower_components/
76
/node_modules/
87
/output/
8+
package-lock.json

‎.travis.yml‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎CHANGELOG.md‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Changelog
2+
3+
Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4+
5+
## [Unreleased]
6+
7+
Breaking changes:
8+
9+
New features:
10+
11+
Bugfixes:
12+
13+
Other improvements:
14+
15+
## [v5.0.0](https://github.com/purescript-node/purescript-posix-types/releases/tag/v5.0.0) - 2021-02-26
16+
17+
Breaking changes:
18+
- Added support for PureScript 0.14 and dropped support for all previous versions (#31)
19+
20+
Other improvements:
21+
- Migrated CI to GitHub Actions, updated installation instructions to use Spago, and switched from `jshint` to `eslint` (#30)
22+
- Added a changelog and pull request template (#32)
23+
24+
## [v4.0.1](https://github.com/purescript-node/purescript-node-streams/releases/tag/v4.0.1) - 2019-07-24
25+
26+
- Relax upper bound on `purescript-node-buffer`
27+
28+
## [v4.0.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v4.0.0) - 2018-05-27
29+
30+
- Updated for PureScript 0.12
31+
32+
## [v3.3.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v3.3.0) - 2017-11-29
33+
34+
- Added `unpipe` and `destroy` functions (@matthewleon)
35+
36+
## [v3.2.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v3.2.0) - 2017-11-26
37+
38+
- Allow `onClose` to be used on writable streams (@matthewleon)
39+
40+
## [v3.1.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v3.1.0) - 2017-04-20
41+
42+
- Added `onFinish` event (@felixSchl)
43+
44+
## [v3.0.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v3.0.0) - 2017-04-04
45+
46+
- Updated for 0.11 (@anilanar)
47+
48+
## [v2.0.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v2.0.0) - 2016-10-17
49+
50+
- Updated dependencies
51+
52+
## [v1.0.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v1.0.0) - 2016-06-07
53+
54+
- Compatibility with 0.9.x of the PureScript compiler.
55+
56+
## [v0.6.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.6.0) - 2016-05-25
57+
58+
- Made the `size` parameter available to the `read` functions (@felixSchl).
59+
60+
## [v0.5.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.5.0) - 2016-05-20
61+
62+
- Added `read`, `readString`, `readEither`, and `onReadable` (@felixSchl)
63+
64+
## [v0.4.1](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.4.1) - 2016-05-02
65+
66+
- Fixed license in bower.json for Pursuit.
67+
68+
## [v0.4.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.4.0) - 2016-03-31
69+
70+
- Made the `Error` value available to the `onError` callback.
71+
72+
## [v0.3.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.3.0) - 2015-12-14
73+
74+
- Removed the last type parameter to `Stream` (#4)
75+
- Added `onDataEither`, for reading from a stream that might or might not have an encoding set. (#4)
76+
77+
## [v0.2.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.2.0) - 2015-12-09
78+
79+
- Updated dependencies
80+
81+
## [v0.1.4](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.1.4) - 2015-12-05
82+
83+
- Fixed warnings (@thimoteus)
84+
85+
## [v0.1.3](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.1.3) - 2015-10-02
86+
87+
- Fixed an issue in the FFI.
88+
89+
## [v0.1.2](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.1.2) - 2015-09-24
90+
91+
- Fixed some JS errors.
92+
93+
## [v0.1.1](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.1.1) - 2015-09-23
94+
95+
- Released to Pursuit
96+
97+
## [v0.1.0](https://github.com/purescript-node/purescript-node-streams/releases/tag/v0.1.0) - 2015-09-23
98+
99+
- Initial release.

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# purescript-node-streams
22

33
[![Latest release](http://img.shields.io/github/release/purescript-node/purescript-node-streams.svg)](https://github.com/purescript-node/purescript-node-streams/releases)
4-
[![Build Status](https://travis-ci.org/purescript-node/purescript-node-streams.svg?branch=master)](https://travis-ci.org/purescript-node/purescript-node-streams)
4+
[![Build status](https://github.com/purescript-node/purescript-node-streams/workflows/CI/badge.svg?branch=master)](https://github.com/purescript-node/purescript-node-streams/actions?query=workflow%3ACI+branch%3Amaster)
5+
[![Pursuit](https://pursuit.purescript.org/packages/purescript-node-streams/badge)](https://pursuit.purescript.org/packages/purescript-node-streams)
56

67
A wrapper for Node's [Stream API](https://nodejs.org/api/stream.html).
78

@@ -10,7 +11,7 @@ See the `example` directory for a usage example.
1011
## Installation
1112

1213
```
13-
bower install purescript-node-streams
14+
spago install node-streams
1415
```
1516

1617
## Documentation

‎bower.json‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
],
1010
"repository": {
1111
"type": "git",
12-
"url": "git://github.com/purescript-node/purescript-node-streams.git"
12+
"url": "https://github.com/purescript-node/purescript-node-streams.git"
1313
},
1414
"devDependencies": {
15-
"purescript-console": "^3.0.0",
16-
"purescript-assert": "^3.0.0",
17-
"purescript-partial": "^1.2.0"
15+
"purescript-assert": "^5.0.0",
16+
"purescript-console": "^5.0.0",
17+
"purescript-partial": "^3.0.0"
1818
},
1919
"dependencies": {
20-
"purescript-eff": "^3.0.0",
21-
"purescript-node-buffer": "^3.0.0",
22-
"purescript-prelude": "^3.0.0",
23-
"purescript-either": "^3.0.0",
24-
"purescript-exceptions": "^3.0.0"
20+
"purescript-effect": "^3.0.0",
21+
"purescript-either": "^5.0.0",
22+
"purescript-exceptions": "^5.0.0",
23+
"purescript-node-buffer": "^7.0.0",
24+
"purescript-prelude": "^5.0.0"
2525
}
2626
}

‎example/Gzip.purs‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@ module Gzip where
22

33
import Prelude
44

5-
import Control.Monad.Eff (Eff, kind Effect)
6-
import Control.Monad.Eff.Console (CONSOLE, log)
5+
import Effect (Effect)
6+
import Effect.Console (log)
77
import Node.Stream (Duplex, Readable, Writable, onEnd, pipe)
88

9-
foreign import data GZIP :: Effect
9+
foreign import gzip :: Effect Duplex
10+
foreign import fileStream :: Readable ()
11+
foreign import stdout :: Writable ()
1012

11-
foreign import gzip :: forall eff. Eff (gzip :: GZIP | eff) (Duplex (gzip :: GZIP | eff))
12-
foreign import fileStream :: forall eff. Readable () (console :: CONSOLE | eff)
13-
foreign import stdout :: forall eff. Writable () (console :: CONSOLE | eff)
14-
15-
main :: forall eff. Eff (gzip :: GZIP, console :: CONSOLE | eff) Unit
13+
main :: Effect Unit
1614
main = do
1715
z <- gzip
1816
_ <- fileStream `pipe` z
1917
_ <- z `pipe` stdout
20-
void <<< onEnd fileStream $
18+
void $ onEnd fileStream do
2119
log "Done reading file, gzip output below"

‎package.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"build": "eslint src && pulp build -- --censor-lib --strict",
66
"example:build": "eslint example && pulp build -I example -- --censor-lib --strict",
77
"example": "eslint example && pulp run -I example -m Gzip",
8-
"test": "pulp test"
8+
"test": "pulp test -- --censor-lib --strict"
99
},
1010
"devDependencies": {
11-
"eslint": "^4.11.0",
12-
"pulp": "^12.0.1",
13-
"purescript-psa": "^0.5.1",
14-
"rimraf": "^2.6.2",
15-
"stream-buffers": "^3.0.1"
11+
"eslint": "^7.15.0",
12+
"pulp": "^15.0.0",
13+
"purescript-psa": "^0.8.0",
14+
"rimraf": "^3.0.2",
15+
"stream-buffers": "^3.0.2"
1616
}
1717
}

‎src/Node/Stream.js‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global Buffer */
12
"use strict";
23

34
exports.undefined = undefined;
@@ -20,8 +21,9 @@ exports.readChunkImpl = function (Left) {
2021
} else {
2122
throw new Error(
2223
"Node.Stream.readChunkImpl: Unrecognised " +
23-
"chunk type; expected String or Buffer, got: " +
24-
chunk);
24+
"chunk type; expected String or Buffer, got: " +
25+
chunk
26+
);
2527
}
2628
};
2729
};
@@ -107,6 +109,20 @@ exports.pipe = function (r) {
107109
};
108110
};
109111

112+
exports.unpipe = function (r) {
113+
return function (w) {
114+
return function () {
115+
return r.unpipe(w);
116+
};
117+
};
118+
};
119+
120+
exports.unpipeAll = function (r) {
121+
return function () {
122+
return r.unpipe();
123+
};
124+
};
125+
110126
exports.readImpl = function (readChunk) {
111127
return function (Nothing) {
112128
return function (Just) {
@@ -177,3 +193,17 @@ exports.end = function (w) {
177193
};
178194
};
179195
};
196+
197+
exports.destroy = function (strm) {
198+
return function () {
199+
strm.destroy(null);
200+
};
201+
};
202+
203+
exports.destroyWithError = function (strm) {
204+
return function (e) {
205+
return function () {
206+
strm.destroy(e);
207+
};
208+
};
209+
};

0 commit comments

Comments
 (0)