Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Switch to streamx #119

Merged
merged 7 commits into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

A [Readable Stream][readable-stream-url] interface over [anymatch][anymatch-url].
[Readable streamx][streamx-url] interface over [anymatch][anymatch-url].

## Usage

Expand Down Expand Up @@ -104,7 +104,7 @@ MIT
[picomatch-options-url]: https://github.com/micromatch/picomatch#options
[glob-parent-url]: https://github.com/es128/glob-parent
[allow-empty-url]: #optionsallowempty
[readable-stream-url]: https://nodejs.org/api/stream.html#stream_readable_streams
[streamx-url]: https://github.com/streamxorg/streamx#readable-stream

[downloads-image]: https://img.shields.io/npm/dm/glob-stream.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/glob-stream
Expand Down
18 changes: 5 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var EventEmitter = require('events');

var fastq = require('fastq');
var anymatch = require('anymatch');
var Readable = require('readable-stream').Readable;
var Readable = require('streamx').Readable;
var isGlob = require('is-glob');
var globParent = require('glob-parent');
var normalizePath = require('normalize-path');
Expand Down Expand Up @@ -172,7 +172,6 @@ function globStream(globs, opt) {
var ourOpt = Object.assign(
{},
{
highWaterMark: 16,
phated marked this conversation as resolved.
Show resolved Hide resolved
cwd: process.cwd(),
dot: false,
cwdbase: false,
Expand All @@ -196,10 +195,9 @@ function globStream(globs, opt) {
var walker = walkdir();

var stream = new Readable({
objectMode: true,
highWaterMark: ourOpt.highWaterMark,
read: read,
destroy: destroy,
predestroy: predestroy,
});

// Remove path relativity to make globs make sense
Expand All @@ -217,19 +215,13 @@ function globStream(globs, opt) {
walker.once('error', onError);
walker.walk(ourOpt.cwd);
sttk marked this conversation as resolved.
Show resolved Hide resolved

function read() {
function read(cb) {
walker.resume();
cb();
}

function destroy(err) {
function predestroy() {
walker.end();

process.nextTick(function () {
if (err) {
stream.emit('error', err);
}
stream.emit('close');
});
}

function resolveGlob(glob) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "glob-stream",
"version": "7.0.0",
"description": "A Readable Stream interface over anymatch.",
"description": "Readable streamx interface over anymatch.",
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
"contributors": [
"Eric Schoffstall <yo@contra.io>",
Expand Down Expand Up @@ -30,16 +30,16 @@
"is-glob": "^4.0.3",
"is-negated-glob": "^1.0.0",
"normalize-path": "^3.0.0",
"readable-stream": "^3.6.0"
"streamx": "^2.12.5"
},
"devDependencies": {
"eslint": "^7.0.0",
"eslint-config-gulp": "^5.0.0",
"eslint-plugin-node": "^11.1.0",
"expect": "^27.0.0",
"mississippi": "^4.0.0",
"mocha": "^8.0.0",
"nyc": "^15.0.1",
"readable-stream": "^3.6.0",
"sinon": "^9.2.3"
},
"nyc": {
Expand Down
Loading