@cucumber/gherkin-streams
Advanced tools
Comparing version 4.0.0 to 5.0.0
{ | ||
"name": "@cucumber/gherkin-streams", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Streams for reading Gherkin parser output", | ||
@@ -12,3 +12,3 @@ "main": "dist/src/index.js", | ||
"type": "git", | ||
"url": "git://github.com/cucumber/cucumber.git" | ||
"url": "git://github.com/cucumber/gherkin-streams.git" | ||
}, | ||
@@ -19,22 +19,39 @@ "author": "Cucumber Limited <cukes@googlegroups.com>", | ||
"test": "mocha", | ||
"prepublishOnly": "tsc --build tsconfig.build.json" | ||
"build": "tsc --build tsconfig.build.json", | ||
"prepublishOnly": "npm run build", | ||
"eslint:fix": "eslint --ext ts,tsx --max-warnings 0 --fix src test", | ||
"eslint": "eslint --ext ts,tsx --max-warnings 0 src test" | ||
}, | ||
"dependencies": { | ||
"@cucumber/messages": "^17.1.0", | ||
"@cucumber/message-streams": "^3.0.0", | ||
"@cucumber/gherkin": "^21.0.0", | ||
"commander": "8.1.0", | ||
"source-map-support": "0.5.19" | ||
"commander": "9.0.0", | ||
"source-map-support": "0.5.21" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "9.0.0", | ||
"@types/node": "14.17.14", | ||
"mocha": "9.1.1", | ||
"@cucumber/gherkin": "^22.0.0", | ||
"@types/mocha": "9.1.0", | ||
"@types/node": "17.0.21", | ||
"@typescript-eslint/eslint-plugin": "^5.13.0", | ||
"@typescript-eslint/parser": "^5.13.0", | ||
"eslint": "^8.10.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"mocha": "9.2.1", | ||
"nyc": "15.1.0", | ||
"typescript": "4.4.2" | ||
"prettier": "^2.5.1", | ||
"ts-node": "^10.7.0", | ||
"tsconfig-paths": "^3.13.0", | ||
"typescript": "4.6.2" | ||
}, | ||
"peerDependencies": { | ||
"@cucumber/gherkin": "^22.0.0", | ||
"@cucumber/messages": "^17.1.1", | ||
"@cucumber/message-streams": "^3.0.0" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/cucumber/cucumber/issues" | ||
"url": "https://github.com/cucumber/gherkin-streams/issues" | ||
}, | ||
"homepage": "https://github.com/cucumber/cucumber#readme", | ||
"homepage": "https://github.com/cucumber/gherkin-streams#readme", | ||
"directories": { | ||
@@ -41,0 +58,0 @@ "test": "test" |
@@ -6,12 +6,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const message_streams_1 = require("@cucumber/message-streams"); | ||
const messages_1 = require("@cucumber/messages"); | ||
const commander_1 = require("commander"); | ||
const package_json_1 = __importDefault(require("../../package.json")); | ||
const GherkinStreams_1 = __importDefault(require("../GherkinStreams")); | ||
const messages_1 = require("@cucumber/messages"); | ||
const message_streams_1 = require("@cucumber/message-streams"); | ||
const program = new commander_1.Command(); | ||
program.version(package_json_1.default.version); | ||
program.option('--no-source', 'Do not output Source messages', false); | ||
program.option('--no-ast', 'Do not output GherkinDocument messages', false); | ||
program.option('--no-pickles', 'Do not output Pickle messages', false); | ||
program.option('--no-source', 'Do not output Source messages'); | ||
program.option('--no-ast', 'Do not output GherkinDocument messages'); | ||
program.option('--no-pickles', 'Do not output Pickle messages'); | ||
program.option('--predictable-ids', 'Use predictable ids', false); | ||
@@ -25,5 +25,9 @@ program.parse(process.argv); | ||
includePickles: program.opts().pickles, | ||
newId: program.opts().predictableIds ? messages_1.IdGenerator.incrementing() : messages_1.IdGenerator.uuid(), | ||
newId: program.opts().predictableIds | ||
? messages_1.IdGenerator.incrementing() | ||
: messages_1.IdGenerator.uuid(), | ||
}; | ||
GherkinStreams_1.default.fromPaths(paths, options).pipe(new message_streams_1.MessageToNdjsonStream()).pipe(process.stdout); | ||
GherkinStreams_1.default.fromPaths(paths, options) | ||
.pipe(new message_streams_1.MessageToNdjsonStream()) | ||
.pipe(process.stdout); | ||
//# sourceMappingURL=main.js.map |
/// <reference types="node" /> | ||
import { IGherkinOptions } from '@cucumber/gherkin'; | ||
import * as messages from '@cucumber/messages'; | ||
import { Readable } from 'stream'; | ||
import * as messages from '@cucumber/messages'; | ||
import { IGherkinOptions } from '@cucumber/gherkin'; | ||
export interface IGherkinStreamOptions extends IGherkinOptions { | ||
@@ -6,0 +6,0 @@ relativeTo?: string; |
@@ -6,7 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs_1 = __importDefault(require("fs")); | ||
const stream_1 = require("stream"); | ||
const makeGherkinOptions_1 = __importDefault(require("./makeGherkinOptions")); | ||
const ParserMessageStream_1 = __importDefault(require("./ParserMessageStream")); | ||
const SourceMessageStream_1 = __importDefault(require("./SourceMessageStream")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const makeGherkinOptions_1 = __importDefault(require("./makeGherkinOptions")); | ||
function fromPaths(paths, options) { | ||
@@ -13,0 +13,0 @@ const pathsCopy = paths.slice(); |
/// <reference types="node" /> | ||
import { IGherkinOptions } from '@cucumber/gherkin'; | ||
import * as messages from '@cucumber/messages'; | ||
import { Transform, TransformCallback } from 'stream'; | ||
import * as messages from '@cucumber/messages'; | ||
import { IGherkinOptions } from '@cucumber/gherkin'; | ||
/** | ||
@@ -6,0 +6,0 @@ * Stream that reads Source messages and writes GherkinDocument and Pickle messages. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const gherkin_1 = require("@cucumber/gherkin"); | ||
const stream_1 = require("stream"); | ||
const gherkin_1 = require("@cucumber/gherkin"); | ||
/** | ||
@@ -6,0 +6,0 @@ * Stream that reads Source messages and writes GherkinDocument and Pickle messages. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const gherkin_1 = require("@cucumber/gherkin"); | ||
const path_1 = require("path"); | ||
const stream_1 = require("stream"); | ||
const path_1 = require("path"); | ||
/** | ||
@@ -7,0 +7,0 @@ * Stream that reads a string and writes a single Source message. |
@@ -15,4 +15,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const gherkin_1 = require("@cucumber/gherkin"); | ||
const assert_1 = __importDefault(require("assert")); | ||
const gherkin_1 = require("@cucumber/gherkin"); | ||
const src_1 = require("../src"); | ||
@@ -19,0 +19,0 @@ const defaultOptions = {}; |
{ | ||
"name": "@cucumber/gherkin-streams", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Streams for reading Gherkin parser output", | ||
@@ -12,3 +12,3 @@ "main": "dist/src/index.js", | ||
"type": "git", | ||
"url": "git://github.com/cucumber/cucumber.git" | ||
"url": "git://github.com/cucumber/gherkin-streams.git" | ||
}, | ||
@@ -19,22 +19,39 @@ "author": "Cucumber Limited <cukes@googlegroups.com>", | ||
"test": "mocha", | ||
"prepublishOnly": "tsc --build tsconfig.build.json" | ||
"build": "tsc --build tsconfig.build.json", | ||
"prepublishOnly": "npm run build", | ||
"eslint:fix": "eslint --ext ts,tsx --max-warnings 0 --fix src test", | ||
"eslint": "eslint --ext ts,tsx --max-warnings 0 src test" | ||
}, | ||
"dependencies": { | ||
"@cucumber/messages": "^17.1.0", | ||
"@cucumber/message-streams": "^3.0.0", | ||
"@cucumber/gherkin": "^21.0.0", | ||
"commander": "8.1.0", | ||
"source-map-support": "0.5.19" | ||
"commander": "9.0.0", | ||
"source-map-support": "0.5.21" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "9.0.0", | ||
"@types/node": "14.17.14", | ||
"mocha": "9.1.1", | ||
"@cucumber/gherkin": "^22.0.0", | ||
"@types/mocha": "9.1.0", | ||
"@types/node": "17.0.21", | ||
"@typescript-eslint/eslint-plugin": "^5.13.0", | ||
"@typescript-eslint/parser": "^5.13.0", | ||
"eslint": "^8.10.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"mocha": "9.2.1", | ||
"nyc": "15.1.0", | ||
"typescript": "4.4.2" | ||
"prettier": "^2.5.1", | ||
"ts-node": "^10.7.0", | ||
"tsconfig-paths": "^3.13.0", | ||
"typescript": "4.6.2" | ||
}, | ||
"peerDependencies": { | ||
"@cucumber/gherkin": "^22.0.0", | ||
"@cucumber/messages": "^17.1.1", | ||
"@cucumber/message-streams": "^3.0.0" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/cucumber/cucumber/issues" | ||
"url": "https://github.com/cucumber/gherkin-streams/issues" | ||
}, | ||
"homepage": "https://github.com/cucumber/cucumber#readme", | ||
"homepage": "https://github.com/cucumber/gherkin-streams#readme", | ||
"directories": { | ||
@@ -41,0 +58,0 @@ "test": "test" |
@@ -0,13 +1,14 @@ | ||
import { IGherkinOptions } from '@cucumber/gherkin' | ||
import { MessageToNdjsonStream } from '@cucumber/message-streams' | ||
import { IdGenerator } from '@cucumber/messages' | ||
import { Command } from 'commander' | ||
import packageJson from '../../package.json' | ||
import GherkinStreams from '../GherkinStreams' | ||
import { IdGenerator } from '@cucumber/messages' | ||
import { MessageToNdjsonStream } from '@cucumber/message-streams' | ||
import { IGherkinOptions } from '@cucumber/gherkin' | ||
const program = new Command() | ||
program.version(packageJson.version) | ||
program.option('--no-source', 'Do not output Source messages', false) | ||
program.option('--no-ast', 'Do not output GherkinDocument messages', false) | ||
program.option('--no-pickles', 'Do not output Pickle messages', false) | ||
program.option('--no-source', 'Do not output Source messages') | ||
program.option('--no-ast', 'Do not output GherkinDocument messages') | ||
program.option('--no-pickles', 'Do not output Pickle messages') | ||
program.option('--predictable-ids', 'Use predictable ids', false) | ||
@@ -22,5 +23,9 @@ program.parse(process.argv) | ||
includePickles: program.opts().pickles, | ||
newId: program.opts().predictableIds ? IdGenerator.incrementing() : IdGenerator.uuid(), | ||
newId: program.opts().predictableIds | ||
? IdGenerator.incrementing() | ||
: IdGenerator.uuid(), | ||
} | ||
GherkinStreams.fromPaths(paths, options).pipe(new MessageToNdjsonStream()).pipe(process.stdout) | ||
GherkinStreams.fromPaths(paths, options) | ||
.pipe(new MessageToNdjsonStream()) | ||
.pipe(process.stdout) |
@@ -0,8 +1,9 @@ | ||
import { IGherkinOptions } from '@cucumber/gherkin' | ||
import * as messages from '@cucumber/messages' | ||
import fs from 'fs' | ||
import { PassThrough, Readable } from 'stream' | ||
import * as messages from '@cucumber/messages' | ||
import makeGherkinOptions from './makeGherkinOptions' | ||
import ParserMessageStream from './ParserMessageStream' | ||
import SourceMessageStream from './SourceMessageStream' | ||
import fs from 'fs' | ||
import { IGherkinOptions } from '@cucumber/gherkin' | ||
import makeGherkinOptions from './makeGherkinOptions' | ||
@@ -13,3 +14,6 @@ export interface IGherkinStreamOptions extends IGherkinOptions { | ||
function fromPaths(paths: readonly string[], options: IGherkinStreamOptions): Readable { | ||
function fromPaths( | ||
paths: readonly string[], | ||
options: IGherkinStreamOptions | ||
): Readable { | ||
const pathsCopy = paths.slice() | ||
@@ -46,3 +50,6 @@ options = makeGherkinOptions(options) | ||
function fromSources(envelopes: readonly messages.Envelope[], options: IGherkinOptions): Readable { | ||
function fromSources( | ||
envelopes: readonly messages.Envelope[], | ||
options: IGherkinOptions | ||
): Readable { | ||
const envelopesCopy = envelopes.slice() | ||
@@ -49,0 +56,0 @@ options = makeGherkinOptions(options) |
@@ -0,4 +1,4 @@ | ||
import { generateMessages, IGherkinOptions } from '@cucumber/gherkin' | ||
import * as messages from '@cucumber/messages' | ||
import { Transform, TransformCallback } from 'stream' | ||
import * as messages from '@cucumber/messages' | ||
import { generateMessages, IGherkinOptions } from '@cucumber/gherkin' | ||
@@ -13,3 +13,7 @@ /** | ||
public _transform(envelope: messages.Envelope, encoding: string, callback: TransformCallback) { | ||
public _transform( | ||
envelope: messages.Envelope, | ||
encoding: string, | ||
callback: TransformCallback | ||
) { | ||
if (envelope.source) { | ||
@@ -16,0 +20,0 @@ const messageList = generateMessages( |
import { makeSourceEnvelope } from '@cucumber/gherkin' | ||
import { relative } from 'path' | ||
import { Transform, TransformCallback } from 'stream' | ||
import { relative } from 'path' | ||
@@ -11,7 +11,14 @@ /** | ||
constructor(private readonly uri: string, private readonly relativeTo?: string) { | ||
constructor( | ||
private readonly uri: string, | ||
private readonly relativeTo?: string | ||
) { | ||
super({ readableObjectMode: true, writableObjectMode: false }) | ||
} | ||
public _transform(chunk: Buffer, encoding: string, callback: TransformCallback) { | ||
public _transform( | ||
chunk: Buffer, | ||
encoding: string, | ||
callback: TransformCallback | ||
) { | ||
this.buffer = Buffer.concat([this.buffer, chunk]) | ||
@@ -18,0 +25,0 @@ callback() |
@@ -0,5 +1,10 @@ | ||
import { | ||
dialects, | ||
IGherkinOptions, | ||
makeSourceEnvelope, | ||
} from '@cucumber/gherkin' | ||
import * as messages from '@cucumber/messages' | ||
import assert from 'assert' | ||
import { Readable } from 'stream' | ||
import * as messages from '@cucumber/messages' | ||
import { dialects, IGherkinOptions, makeSourceEnvelope } from '@cucumber/gherkin' | ||
import { GherkinStreams } from '../src' | ||
@@ -12,7 +17,13 @@ | ||
const envelopes = await streamToArray( | ||
GherkinStreams.fromPaths(['testdata/good/minimal.feature'], defaultOptions) | ||
GherkinStreams.fromPaths( | ||
['testdata/good/minimal.feature'], | ||
defaultOptions | ||
) | ||
) | ||
assert.strictEqual(envelopes.length, 3) | ||
assert.strictEqual(envelopes[0].source.uri, 'testdata/good/minimal.feature') | ||
assert.strictEqual(envelopes[1].gherkinDocument.uri, 'testdata/good/minimal.feature') | ||
assert.strictEqual( | ||
envelopes[1].gherkinDocument.uri, | ||
'testdata/good/minimal.feature' | ||
) | ||
assert.strictEqual(envelopes[2].pickle.uri, 'testdata/good/minimal.feature') | ||
@@ -50,3 +61,5 @@ }) | ||
const envelopes = await streamToArray(GherkinStreams.fromSources([source], defaultOptions)) | ||
const envelopes = await streamToArray( | ||
GherkinStreams.fromSources([source], defaultOptions) | ||
) | ||
assert.strictEqual(envelopes.length, 3) | ||
@@ -74,5 +87,10 @@ }) | ||
async function streamToArray(readableStream: Readable): Promise<messages.Envelope[]> { | ||
async function streamToArray( | ||
readableStream: Readable | ||
): Promise<messages.Envelope[]> { | ||
return new Promise<messages.Envelope[]>( | ||
(resolve: (wrappers: messages.Envelope[]) => void, reject: (err: Error) => void) => { | ||
( | ||
resolve: (wrappers: messages.Envelope[]) => void, | ||
reject: (err: Error) => void | ||
) => { | ||
const items: messages.Envelope[] = [] | ||
@@ -79,0 +97,0 @@ readableStream.on('data', items.push.bind(items)) |
{ | ||
"extends": "../../tsconfig.build.json", | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"outDir": "dist" | ||
"outDir": "dist", | ||
"composite": true, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"target": "es6", | ||
"module": "commonjs" | ||
}, | ||
"files": [], | ||
"include": [ | ||
@@ -8,0 +15,0 @@ "package.json", |
{ | ||
"extends": "../../tsconfig.json" | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"noEmit": true | ||
}, | ||
"ts-node": { | ||
"files": true | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
54
664
65045
17
+ Added@cucumber/gherkin@22.0.0(transitive)
+ Addedcommander@9.0.0(transitive)
+ Addedsource-map-support@0.5.21(transitive)
- Removed@cucumber/gherkin@^21.0.0
- Removed@cucumber/message-streams@^3.0.0
- Removed@cucumber/messages@^17.1.0
- Removed@cucumber/gherkin@21.0.0(transitive)
- Removedcommander@8.1.0(transitive)
- Removedsource-map-support@0.5.19(transitive)
Updatedcommander@9.0.0
Updatedsource-map-support@0.5.21