From 79939aee56c467ab8f866eac3ebc591279b2f6f2 Mon Sep 17 00:00:00 2001 From: David Worms Date: Mon, 9 Oct 2023 10:17:57 +0200 Subject: [PATCH] chore(release): publish - csv-demo-browser@0.1.15 - csv-demo-cjs@0.2.13 - csv-demo-eslint@0.1.18 - csv-demo-esm@0.0.27 - csv-issues-cjs@0.2.2 - csv-issues-esm@0.0.18 - csv-demo-ts-cjs-node16@0.2.13 - csv-demo-ts-module-node16@0.2.13 - csv-demo-webpack-ts@0.1.15 - csv-demo-webpack@0.1.17 - csv-parse@5.5.2 - csv-stringify@6.4.4 - csv@6.3.5 - stream-transform@3.2.10 --- demo/browser/CHANGELOG.md | 8 ++++++++ demo/browser/package.json | 10 +++++----- demo/cjs/CHANGELOG.md | 8 ++++++++ demo/cjs/package.json | 8 ++++---- demo/eslint/CHANGELOG.md | 8 ++++++++ demo/eslint/package.json | 4 ++-- demo/esm/CHANGELOG.md | 8 ++++++++ demo/esm/package.json | 6 +++--- demo/issues-cjs/CHANGELOG.md | 8 ++++++++ demo/issues-cjs/package.json | 6 +++--- demo/issues-esm/CHANGELOG.md | 9 +++++++++ demo/issues-esm/package.json | 6 +++--- demo/ts-cjs-node16/CHANGELOG.md | 8 ++++++++ demo/ts-cjs-node16/package.json | 8 ++++---- demo/ts-esm-node16/CHANGELOG.md | 8 ++++++++ demo/ts-esm-node16/package.json | 8 ++++---- demo/webpack-ts/CHANGELOG.md | 8 ++++++++ demo/webpack-ts/package.json | 8 ++++---- demo/webpack/CHANGELOG.md | 8 ++++++++ demo/webpack/package.json | 10 +++++----- packages/csv-parse/CHANGELOG.md | 8 ++++++++ packages/csv-parse/package.json | 4 ++-- packages/csv-stringify/CHANGELOG.md | 9 +++++++++ packages/csv-stringify/package.json | 2 +- packages/csv/CHANGELOG.md | 8 ++++++++ packages/csv/dist/cjs/index.cjs | 15 ++++++++------- packages/csv/dist/cjs/sync.cjs | 15 ++++++++------- packages/csv/dist/esm/index.js | 15 ++++++++------- packages/csv/dist/esm/sync.js | 15 ++++++++------- packages/csv/dist/iife/index.js | 15 ++++++++------- packages/csv/dist/iife/sync.js | 15 ++++++++------- packages/csv/dist/umd/index.js | 15 ++++++++------- packages/csv/dist/umd/sync.js | 15 ++++++++------- packages/csv/package.json | 8 ++++---- packages/stream-transform/CHANGELOG.md | 9 +++++++++ packages/stream-transform/package.json | 2 +- 36 files changed, 224 insertions(+), 101 deletions(-) diff --git a/demo/browser/CHANGELOG.md b/demo/browser/CHANGELOG.md index a09c7225..ba32067a 100644 --- a/demo/browser/CHANGELOG.md +++ b/demo/browser/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.15](https://github.com/adaltas/node-csv/compare/csv-demo-browser@0.1.14...csv-demo-browser@0.1.15) (2023-10-09) + +**Note:** Version bump only for package csv-demo-browser + + + + + ## [0.1.14](https://github.com/adaltas/node-csv/compare/csv-demo-browser@0.1.13...csv-demo-browser@0.1.14) (2023-10-05) **Note:** Version bump only for package csv-demo-browser diff --git a/demo/browser/package.json b/demo/browser/package.json index d76b61c9..03c1de61 100644 --- a/demo/browser/package.json +++ b/demo/browser/package.json @@ -1,6 +1,6 @@ { "name": "csv-demo-browser", - "version": "0.1.14", + "version": "0.1.15", "main": "index.js", "license": "MIT", "type": "module", @@ -20,11 +20,11 @@ "start": "node server.js" }, "dependencies": { - "csv": "^6.3.4", + "csv": "^6.3.5", "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", "express": "^4.18.2", - "stream-transform": "^3.2.9" + "stream-transform": "^3.2.10" } } diff --git a/demo/cjs/CHANGELOG.md b/demo/cjs/CHANGELOG.md index e2109c84..b5e3ae97 100644 --- a/demo/cjs/CHANGELOG.md +++ b/demo/cjs/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.13](https://github.com/adaltas/node-csv/compare/csv-demo-cjs@0.2.12...csv-demo-cjs@0.2.13) (2023-10-09) + +**Note:** Version bump only for package csv-demo-cjs + + + + + ## [0.2.12](https://github.com/adaltas/node-csv/compare/csv-demo-cjs@0.2.11...csv-demo-cjs@0.2.12) (2023-10-05) **Note:** Version bump only for package csv-demo-cjs diff --git a/demo/cjs/package.json b/demo/cjs/package.json index 8dade2b3..1b79269e 100644 --- a/demo/cjs/package.json +++ b/demo/cjs/package.json @@ -1,14 +1,14 @@ { "name": "csv-demo-cjs", - "version": "0.2.12", + "version": "0.2.13", "main": "index.js", "license": "MIT", "type": "commonjs", "private": true, "dependencies": { - "csv": "^6.3.4", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3" + "csv": "^6.3.5", + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4" }, "devDependencies": { "@types/node": "^20.5.6", diff --git a/demo/eslint/CHANGELOG.md b/demo/eslint/CHANGELOG.md index 05810409..4ad1797a 100644 --- a/demo/eslint/CHANGELOG.md +++ b/demo/eslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.18](https://github.com/adaltas/node-csv/compare/csv-demo-eslint@0.1.17...csv-demo-eslint@0.1.18) (2023-10-09) + +**Note:** Version bump only for package csv-demo-eslint + + + + + ## [0.1.17](https://github.com/adaltas/node-csv/compare/csv-demo-eslint@0.1.16...csv-demo-eslint@0.1.17) (2023-10-05) **Note:** Version bump only for package csv-demo-eslint diff --git a/demo/eslint/package.json b/demo/eslint/package.json index 50fcc251..4eefdd69 100644 --- a/demo/eslint/package.json +++ b/demo/eslint/package.json @@ -1,6 +1,6 @@ { "name": "csv-demo-eslint", - "version": "0.1.17", + "version": "0.1.18", "description": "", "main": "index.js", "private": true, @@ -10,7 +10,7 @@ }, "license": "MIT", "dependencies": { - "csv-stringify": "^6.4.3" + "csv-stringify": "^6.4.4" }, "devDependencies": { "eslint": "^8.47.0", diff --git a/demo/esm/CHANGELOG.md b/demo/esm/CHANGELOG.md index 830d015f..88ab4f53 100644 --- a/demo/esm/CHANGELOG.md +++ b/demo/esm/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.0.27](https://github.com/adaltas/node-csv/compare/csv-demo-esm@0.0.26...csv-demo-esm@0.0.27) (2023-10-09) + +**Note:** Version bump only for package csv-demo-esm + + + + + ## [0.0.26](https://github.com/adaltas/node-csv/compare/csv-demo-esm@0.0.25...csv-demo-esm@0.0.26) (2023-10-05) **Note:** Version bump only for package csv-demo-esm diff --git a/demo/esm/package.json b/demo/esm/package.json index a250ab29..af5c25f1 100644 --- a/demo/esm/package.json +++ b/demo/esm/package.json @@ -1,13 +1,13 @@ { "name": "csv-demo-esm", - "version": "0.0.26", + "version": "0.0.27", "main": "index.js", "license": "MIT", "type": "module", "private": true, "dependencies": { - "csv": "^6.3.4", - "csv-parse": "^5.5.1" + "csv": "^6.3.5", + "csv-parse": "^5.5.2" }, "devDependencies": { "coffeescript": "^2.7.0", diff --git a/demo/issues-cjs/CHANGELOG.md b/demo/issues-cjs/CHANGELOG.md index e94ada32..793d12a2 100644 --- a/demo/issues-cjs/CHANGELOG.md +++ b/demo/issues-cjs/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.2](https://github.com/adaltas/node-csv/compare/csv-issues-cjs@0.2.1...csv-issues-cjs@0.2.2) (2023-10-09) + +**Note:** Version bump only for package csv-issues-cjs + + + + + ## [0.2.1](https://github.com/adaltas/node-csv/compare/csv-issues-cjs@0.2.0...csv-issues-cjs@0.2.1) (2023-10-05) **Note:** Version bump only for package csv-issues-cjs diff --git a/demo/issues-cjs/package.json b/demo/issues-cjs/package.json index c5e2c9d5..d24c3f1d 100644 --- a/demo/issues-cjs/package.json +++ b/demo/issues-cjs/package.json @@ -1,12 +1,12 @@ { "name": "csv-issues-cjs", - "version": "0.2.1", + "version": "0.2.2", "main": "index.js", "license": "MIT", "private": true, "dependencies": { - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3" + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4" }, "devDependencies": { "coffeescript": "^2.7.0", diff --git a/demo/issues-esm/CHANGELOG.md b/demo/issues-esm/CHANGELOG.md index 5a33d2bc..6a6f8c23 100644 --- a/demo/issues-esm/CHANGELOG.md +++ b/demo/issues-esm/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.0.18](https://github.com/adaltas/node-csv/compare/csv-issues-esm@0.0.17...csv-issues-esm@0.0.18) (2023-10-09) + + +### Bug Fixes + +* **stream-transform:** backpressure after push ([3e83f4e](https://github.com/adaltas/node-csv/commit/3e83f4e604b7b944835de18afcb41716ce4bbfad)) + + + ## [0.0.17](https://github.com/adaltas/node-csv/compare/csv-issues-esm@0.0.16...csv-issues-esm@0.0.17) (2023-10-05) **Note:** Version bump only for package csv-issues-esm diff --git a/demo/issues-esm/package.json b/demo/issues-esm/package.json index 79155201..1505f5c4 100644 --- a/demo/issues-esm/package.json +++ b/demo/issues-esm/package.json @@ -1,6 +1,6 @@ { "name": "csv-issues-esm", - "version": "0.0.17", + "version": "0.0.18", "main": "index.js", "license": "MIT", "type": "module", @@ -27,8 +27,8 @@ }, "dependencies": { "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", "desm": "^1.3.0" } } diff --git a/demo/ts-cjs-node16/CHANGELOG.md b/demo/ts-cjs-node16/CHANGELOG.md index 8880222d..06afe2ae 100644 --- a/demo/ts-cjs-node16/CHANGELOG.md +++ b/demo/ts-cjs-node16/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.13](https://github.com/adaltas/node-csv/compare/csv-demo-ts-cjs-node16@0.2.12...csv-demo-ts-cjs-node16@0.2.13) (2023-10-09) + +**Note:** Version bump only for package csv-demo-ts-cjs-node16 + + + + + ## [0.2.12](https://github.com/adaltas/node-csv/compare/csv-demo-ts-cjs-node16@0.2.11...csv-demo-ts-cjs-node16@0.2.12) (2023-10-05) **Note:** Version bump only for package csv-demo-ts-cjs-node16 diff --git a/demo/ts-cjs-node16/package.json b/demo/ts-cjs-node16/package.json index 6b38e4bb..eead7cf5 100644 --- a/demo/ts-cjs-node16/package.json +++ b/demo/ts-cjs-node16/package.json @@ -1,11 +1,11 @@ { "name": "csv-demo-ts-cjs-node16", - "version": "0.2.12", + "version": "0.2.13", "dependencies": { "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", - "stream-transform": "^3.2.9" + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", + "stream-transform": "^3.2.10" }, "main": "index.js", "license": "MIT", diff --git a/demo/ts-esm-node16/CHANGELOG.md b/demo/ts-esm-node16/CHANGELOG.md index 82e2175a..c1d0043e 100644 --- a/demo/ts-esm-node16/CHANGELOG.md +++ b/demo/ts-esm-node16/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.13](https://github.com/adaltas/node-csv/compare/csv-demo-ts-module-node16@0.2.12...csv-demo-ts-module-node16@0.2.13) (2023-10-09) + +**Note:** Version bump only for package csv-demo-ts-module-node16 + + + + + ## [0.2.12](https://github.com/adaltas/node-csv/compare/csv-demo-ts-module-node16@0.2.11...csv-demo-ts-module-node16@0.2.12) (2023-10-05) **Note:** Version bump only for package csv-demo-ts-module-node16 diff --git a/demo/ts-esm-node16/package.json b/demo/ts-esm-node16/package.json index a4f2a02a..6bff6db4 100644 --- a/demo/ts-esm-node16/package.json +++ b/demo/ts-esm-node16/package.json @@ -1,15 +1,15 @@ { "name": "csv-demo-ts-module-node16", - "version": "0.2.12", + "version": "0.2.13", "main": "index.js", "license": "MIT", "type": "module", "private": true, "dependencies": { "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", - "stream-transform": "^3.2.9" + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", + "stream-transform": "^3.2.10" }, "devDependencies": { "@types/node": "^20.5.6", diff --git a/demo/webpack-ts/CHANGELOG.md b/demo/webpack-ts/CHANGELOG.md index d56b9cc3..ab9b28c3 100644 --- a/demo/webpack-ts/CHANGELOG.md +++ b/demo/webpack-ts/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.15](https://github.com/adaltas/node-csv/compare/csv-demo-webpack-ts@0.1.14...csv-demo-webpack-ts@0.1.15) (2023-10-09) + +**Note:** Version bump only for package csv-demo-webpack-ts + + + + + ## [0.1.14](https://github.com/adaltas/node-csv/compare/csv-demo-webpack-ts@0.1.13...csv-demo-webpack-ts@0.1.14) (2023-10-05) **Note:** Version bump only for package csv-demo-webpack-ts diff --git a/demo/webpack-ts/package.json b/demo/webpack-ts/package.json index 1cef1908..108d3989 100644 --- a/demo/webpack-ts/package.json +++ b/demo/webpack-ts/package.json @@ -1,6 +1,6 @@ { "name": "csv-demo-webpack-ts", - "version": "0.1.14", + "version": "0.1.15", "description": "", "private": true, "keywords": [], @@ -8,10 +8,10 @@ "license": "ISC", "dependencies": { "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", "http-server": "^14.1.1", - "stream-transform": "^3.2.9" + "stream-transform": "^3.2.10" }, "devDependencies": { "buffer-browserify": "^0.2.5", diff --git a/demo/webpack/CHANGELOG.md b/demo/webpack/CHANGELOG.md index c622814c..9c08f8c7 100644 --- a/demo/webpack/CHANGELOG.md +++ b/demo/webpack/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.17](https://github.com/adaltas/node-csv/compare/csv-demo-webpack@0.1.16...csv-demo-webpack@0.1.17) (2023-10-09) + +**Note:** Version bump only for package csv-demo-webpack + + + + + ## [0.1.16](https://github.com/adaltas/node-csv/compare/csv-demo-webpack@0.1.15...csv-demo-webpack@0.1.16) (2023-10-05) **Note:** Version bump only for package csv-demo-webpack diff --git a/demo/webpack/package.json b/demo/webpack/package.json index f80f580e..7eff72c5 100644 --- a/demo/webpack/package.json +++ b/demo/webpack/package.json @@ -1,6 +1,6 @@ { "name": "csv-demo-webpack", - "version": "0.1.16", + "version": "0.1.17", "description": "", "private": true, "scripts": { @@ -16,12 +16,12 @@ "webpack-cli": "^5.1.4" }, "dependencies": { - "csv": "^6.3.4", + "csv": "^6.3.5", "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", "http-server": "^14.1.1", "stream-browserify": "^3.0.0", - "stream-transform": "^3.2.9" + "stream-transform": "^3.2.10" } } diff --git a/packages/csv-parse/CHANGELOG.md b/packages/csv-parse/CHANGELOG.md index 9594659b..9955eb64 100644 --- a/packages/csv-parse/CHANGELOG.md +++ b/packages/csv-parse/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [5.5.2](https://github.com/adaltas/node-csv/compare/csv-parse@5.5.1...csv-parse@5.5.2) (2023-10-09) + +**Note:** Version bump only for package csv-parse + + + + + ## [5.5.1](https://github.com/adaltas/node-csv/compare/csv-parse@5.5.0...csv-parse@5.5.1) (2023-10-05) diff --git a/packages/csv-parse/package.json b/packages/csv-parse/package.json index 805768d1..e80352e9 100644 --- a/packages/csv-parse/package.json +++ b/packages/csv-parse/package.json @@ -1,5 +1,5 @@ { - "version": "5.5.1", + "version": "5.5.2", "name": "csv-parse", "description": "CSV parsing implementing the Node.js `stream.Transform` API", "keywords": [ @@ -76,7 +76,7 @@ "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "should": "^13.2.3", - "stream-transform": "^3.2.9", + "stream-transform": "^3.2.10", "ts-node": "^10.9.1", "typescript": "^5.2.2" }, diff --git a/packages/csv-stringify/CHANGELOG.md b/packages/csv-stringify/CHANGELOG.md index 94c4aee6..b4e60af6 100644 --- a/packages/csv-stringify/CHANGELOG.md +++ b/packages/csv-stringify/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.4.4](https://github.com/adaltas/node-csv/compare/csv-stringify@6.4.3...csv-stringify@6.4.4) (2023-10-09) + + +### Bug Fixes + +* **csv-stringify:** remove non-functional auto value ([6e8a9ca](https://github.com/adaltas/node-csv/commit/6e8a9ca0a712c56c73eabeb8aa052bd6d197cb3f)) + + + ## [6.4.3](https://github.com/adaltas/node-csv/compare/csv-stringify@6.4.2...csv-stringify@6.4.3) (2023-10-05) **Note:** Version bump only for package csv-stringify diff --git a/packages/csv-stringify/package.json b/packages/csv-stringify/package.json index 5b5b2447..2c3ce835 100644 --- a/packages/csv-stringify/package.json +++ b/packages/csv-stringify/package.json @@ -1,5 +1,5 @@ { - "version": "6.4.3", + "version": "6.4.4", "name": "csv-stringify", "description": "CSV stringifier implementing the Node.js `stream.Transform` API", "keywords": [ diff --git a/packages/csv/CHANGELOG.md b/packages/csv/CHANGELOG.md index f572c1c1..7327ab0d 100644 --- a/packages/csv/CHANGELOG.md +++ b/packages/csv/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.3.5](https://github.com/adaltas/node-csv/compare/csv@6.3.4...csv@6.3.5) (2023-10-09) + +**Note:** Version bump only for package csv + + + + + ## [6.3.4](https://github.com/adaltas/node-csv/compare/csv@6.3.3...csv@6.3.4) (2023-10-05) **Note:** Version bump only for package csv diff --git a/packages/csv/dist/cjs/index.cjs b/packages/csv/dist/cjs/index.cjs index 8819cbb7..f5bd2115 100644 --- a/packages/csv/dist/cjs/index.cjs +++ b/packages/csv/dist/cjs/index.cjs @@ -1700,7 +1700,8 @@ const Transformer = function(options = {}, handler){ this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -1710,7 +1711,8 @@ util.inherits(Transformer, stream.Transform); Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -1720,7 +1722,8 @@ Transformer.prototype._transform = function(chunk, _, cb){ l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -1755,9 +1758,10 @@ Transformer.prototype.__done = function(err, chunks, cb){ // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } @@ -2123,9 +2127,6 @@ const normalize_options = function(opts) { return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; diff --git a/packages/csv/dist/cjs/sync.cjs b/packages/csv/dist/cjs/sync.cjs index 77a26757..c0c6efdf 100644 --- a/packages/csv/dist/cjs/sync.cjs +++ b/packages/csv/dist/cjs/sync.cjs @@ -1892,9 +1892,6 @@ const normalize_options = function(opts) { return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; @@ -2211,7 +2208,8 @@ const Transformer = function(options = {}, handler){ this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -2221,7 +2219,8 @@ util.inherits(Transformer, stream.Transform); Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -2231,7 +2230,8 @@ Transformer.prototype._transform = function(chunk, _, cb){ l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -2266,9 +2266,10 @@ Transformer.prototype.__done = function(err, chunks, cb){ // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } diff --git a/packages/csv/dist/esm/index.js b/packages/csv/dist/esm/index.js index 4213830a..60b105f5 100644 --- a/packages/csv/dist/esm/index.js +++ b/packages/csv/dist/esm/index.js @@ -6891,7 +6891,8 @@ const Transformer = function(options = {}, handler){ this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -6901,7 +6902,8 @@ util.inherits(Transformer, Stream.Transform); Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -6911,7 +6913,8 @@ Transformer.prototype._transform = function(chunk, _, cb){ l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -6946,9 +6949,10 @@ Transformer.prototype.__done = function(err, chunks, cb){ // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } @@ -7314,9 +7318,6 @@ const normalize_options = function(opts) { return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; diff --git a/packages/csv/dist/esm/sync.js b/packages/csv/dist/esm/sync.js index d2e5a848..c20c49e7 100644 --- a/packages/csv/dist/esm/sync.js +++ b/packages/csv/dist/esm/sync.js @@ -7083,9 +7083,6 @@ const normalize_options = function(opts) { return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; @@ -7402,7 +7399,8 @@ const Transformer = function(options = {}, handler){ this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -7412,7 +7410,8 @@ util.inherits(Transformer, Stream.Transform); Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -7422,7 +7421,8 @@ Transformer.prototype._transform = function(chunk, _, cb){ l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -7457,9 +7457,10 @@ Transformer.prototype.__done = function(err, chunks, cb){ // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } diff --git a/packages/csv/dist/iife/index.js b/packages/csv/dist/iife/index.js index a40245b7..5913904c 100644 --- a/packages/csv/dist/iife/index.js +++ b/packages/csv/dist/iife/index.js @@ -6894,7 +6894,8 @@ var csv = (function (exports) { this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -6904,7 +6905,8 @@ var csv = (function (exports) { Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -6914,7 +6916,8 @@ var csv = (function (exports) { l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -6949,9 +6952,10 @@ var csv = (function (exports) { // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } @@ -7317,9 +7321,6 @@ var csv = (function (exports) { return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; diff --git a/packages/csv/dist/iife/sync.js b/packages/csv/dist/iife/sync.js index e737c31e..205ea51f 100644 --- a/packages/csv/dist/iife/sync.js +++ b/packages/csv/dist/iife/sync.js @@ -7086,9 +7086,6 @@ var csv_sync = (function (exports) { return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; @@ -7405,7 +7402,8 @@ var csv_sync = (function (exports) { this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -7415,7 +7413,8 @@ var csv_sync = (function (exports) { Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -7425,7 +7424,8 @@ var csv_sync = (function (exports) { l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -7460,9 +7460,10 @@ var csv_sync = (function (exports) { // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } diff --git a/packages/csv/dist/umd/index.js b/packages/csv/dist/umd/index.js index 429a5717..f48c84cb 100644 --- a/packages/csv/dist/umd/index.js +++ b/packages/csv/dist/umd/index.js @@ -6897,7 +6897,8 @@ this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -6907,7 +6908,8 @@ Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -6917,7 +6919,8 @@ l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -6952,9 +6955,10 @@ // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } @@ -7320,9 +7324,6 @@ return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; diff --git a/packages/csv/dist/umd/sync.js b/packages/csv/dist/umd/sync.js index 77cda582..8dc916f8 100644 --- a/packages/csv/dist/umd/sync.js +++ b/packages/csv/dist/umd/sync.js @@ -7089,9 +7089,6 @@ return [Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)]; } switch(options.record_delimiter){ - case 'auto': - options.record_delimiter = null; - break; case 'unix': options.record_delimiter = "\n"; break; @@ -7408,7 +7405,8 @@ this.state = { running: 0, started: 0, - finished: 0 + finished: 0, + paused: false, }; return this; }; @@ -7418,7 +7416,8 @@ Transformer.prototype._transform = function(chunk, _, cb){ this.state.started++; this.state.running++; - if(this.state.running < this.options.parallel){ + // Accept additionnal chunks to be processed in parallel + if(!this.state.paused && this.state.running < this.options.parallel){ cb(); cb = null; // Cancel further callback execution } @@ -7428,7 +7427,8 @@ l--; } if(l === 1){ // sync - this.__done(null, [this.handler.call(this, chunk, this.options.params)], cb); + const result = this.handler.call(this, chunk, this.options.params); + this.__done(null, [result], cb); }else if(l === 2){ // async const callback = (err, ...chunks) => this.__done(err, chunks, cb); @@ -7463,9 +7463,10 @@ // We dont push empty string // See https://nodejs.org/api/stream.html#stream_readable_push if(chunk !== undefined && chunk !== null && chunk !== ''){ - this.push(chunk); + this.state.paused = !this.push(chunk); } } + // Chunk has been processed if(cb){ cb(); } diff --git a/packages/csv/package.json b/packages/csv/package.json index 3aef2966..0d8e3be4 100644 --- a/packages/csv/package.json +++ b/packages/csv/package.json @@ -1,6 +1,6 @@ { "name": "csv", - "version": "6.3.4", + "version": "6.3.5", "description": "A mature CSV toolset with simple api, full of options and tested against large datasets.", "keywords": [ "node", @@ -22,9 +22,9 @@ ], "dependencies": { "csv-generate": "^4.3.0", - "csv-parse": "^5.5.1", - "csv-stringify": "^6.4.3", - "stream-transform": "^3.2.9" + "csv-parse": "^5.5.2", + "csv-stringify": "^6.4.4", + "stream-transform": "^3.2.10" }, "devDependencies": { "@rollup/plugin-eslint": "^9.0.4", diff --git a/packages/stream-transform/CHANGELOG.md b/packages/stream-transform/CHANGELOG.md index 076b8dfd..7a8882c5 100644 --- a/packages/stream-transform/CHANGELOG.md +++ b/packages/stream-transform/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.2.10](https://github.com/adaltas/node-csv/compare/stream-transform@3.2.9...stream-transform@3.2.10) (2023-10-09) + + +### Bug Fixes + +* **stream-transform:** backpressure after push ([3e83f4e](https://github.com/adaltas/node-csv/commit/3e83f4e604b7b944835de18afcb41716ce4bbfad)) + + + ## [3.2.9](https://github.com/adaltas/node-csv/compare/stream-transform@3.2.8...stream-transform@3.2.9) (2023-10-05) diff --git a/packages/stream-transform/package.json b/packages/stream-transform/package.json index 07b5d053..a0c649f2 100644 --- a/packages/stream-transform/package.json +++ b/packages/stream-transform/package.json @@ -1,5 +1,5 @@ { - "version": "3.2.9", + "version": "3.2.10", "name": "stream-transform", "description": "Object transformations implementing the Node.js `stream.Transform` API", "keywords": [