Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cucumber/gherkin

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/gherkin - npm Package Compare versions

Comparing version 13.0.0 to 14.0.0

4

.eslintrc.json

@@ -26,4 +26,6 @@ {

"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/interface-name-prefix": "off",

@@ -30,0 +32,0 @@ "@typescript-eslint/member-delimiter-style": "off",

{
"name": "@cucumber/gherkin",
"version": "13.0.0",
"version": "14.0.0",
"description": "Gherkin parser",

@@ -34,21 +34,22 @@ "main": "dist/src/index.js",

"@types/mocha": "^7.0.2",
"@types/node": "^13.11.1",
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"@types/node": "^14.0.14",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"mocha": "^7.1.1",
"nyc": "^15.0.1",
"prettier": "^2.0.4",
"ts-node": "^8.8.2",
"typescript": "^3.8.3"
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"json-schema": "^0.2.5",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"ts-node": "^8.10.2",
"typescript": "^3.9.5"
},
"dependencies": {
"@cucumber/messages": "^12.0.0",
"@cucumber/messages": "^12.2.0",
"@teppeis/multimaps": "^1.1.0",
"commander": "^5.0.0",
"source-map-support": "^0.5.16"
"commander": "^5.1.0",
"source-map-support": "^0.5.19"
},

@@ -55,0 +56,0 @@ "directories": {

@@ -19,2 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.NoSuchLanguageException = exports.AstBuilderException = exports.UnexpectedEOFException = exports.UnexpectedTokenException = exports.CompositeParserException = exports.ParserException = void 0;
var createLocation_1 = __importDefault(require("./cli/createLocation"));

@@ -21,0 +22,0 @@ var GherkinException = /** @class */ (function (_super) {

@@ -9,5 +9,6 @@ import GherkinStreams from './stream/GherkinStreams';

import compile from './pickles/compile';
import { parse, parseAndCompile } from '../test/utils/parse';
declare const dialects: Readonly<{
[key: string]: Dialect;
}>;
export { GherkinStreams, IGherkinOptions, Query, dialects, Dialect, Parser, AstBuilder, TokenScanner, compile, };
export { GherkinStreams, IGherkinOptions, Query, dialects, Dialect, Parser, AstBuilder, TokenScanner, compile, parse, parseAndCompile, };

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAndCompile = exports.parse = exports.compile = exports.TokenScanner = exports.AstBuilder = exports.Parser = exports.dialects = exports.Query = exports.GherkinStreams = void 0;
var GherkinStreams_1 = __importDefault(require("./stream/GherkinStreams"));

@@ -20,4 +21,7 @@ exports.GherkinStreams = GherkinStreams_1.default;

var gherkin_languages_json_1 = __importDefault(require("./gherkin-languages.json"));
var parse_1 = require("../test/utils/parse");
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
Object.defineProperty(exports, "parseAndCompile", { enumerable: true, get: function () { return parse_1.parseAndCompile; } });
var dialects = gherkin_languages_json_1.default;
exports.dialects = dialects;
//# sourceMappingURL=index.js.map

@@ -127,7 +127,9 @@ "use strict";

var valueCell = valueCells[n];
var search = new RegExp('<' + variableCell.value + '>', 'g');
var valuePattern = '<' + variableCell.value + '>';
var escapedPattern = valuePattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
var regexp = new RegExp(escapedPattern, 'g');
// JS Specific - dollar sign needs to be escaped with another dollar sign
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
var replacement = valueCell.value.replace(new RegExp('\\$', 'g'), '$$$$');
name = name.replace(search, replacement);
name = name.replace(regexp, replacement);
});

@@ -134,0 +136,0 @@ return name;

@@ -8,3 +8,4 @@ import { messages } from '@cucumber/messages';

private readonly pickleIdsMapByUri;
private readonly pickleStepIdsMapByUri;
private readonly pickleIdsByAstNodeId;
private readonly pickleStepIdsByAstNodeId;
/**

@@ -16,3 +17,3 @@ * Gets the location (line and column) of an AST node.

getGherkinDocuments(): ReadonlyArray<messages.IGherkinDocument>;
getPickles(): ReadonlyArray<messages.IGherkinDocument>;
getPickles(): ReadonlyArray<messages.IPickle>;
/**

@@ -23,4 +24,4 @@ * Gets all the pickle IDs

*/
getPickleIds(uri: string, lineNumber?: number): ReadonlyArray<string>;
getPickleStepIds(uri: string, lineNumber: number): ReadonlyArray<string>;
getPickleIds(uri: string, astNodeId?: string): ReadonlyArray<string>;
getPickleStepIds(astNodeId: string): ReadonlyArray<string>;
update(message: messages.IEnvelope): Query;

@@ -27,0 +28,0 @@ private updateGherkinBackground;

@@ -22,3 +22,4 @@ "use strict";

this.pickleIdsMapByUri = new Map();
this.pickleStepIdsMapByUri = new Map();
this.pickleIdsByAstNodeId = new Map();
this.pickleStepIdsByAstNodeId = new Map();
}

@@ -43,11 +44,10 @@ /**

*/
Query.prototype.getPickleIds = function (uri, lineNumber) {
var pickleIdsByLineNumber = this.pickleIdsMapByUri.get(uri);
return lineNumber === undefined
? Array.from(new Set(pickleIdsByLineNumber.values()))
: pickleIdsByLineNumber.get(lineNumber);
Query.prototype.getPickleIds = function (uri, astNodeId) {
var pickleIdsByAstNodeId = this.pickleIdsMapByUri.get(uri);
return astNodeId === undefined
? Array.from(new Set(pickleIdsByAstNodeId.values()))
: pickleIdsByAstNodeId.get(astNodeId);
};
Query.prototype.getPickleStepIds = function (uri, lineNumber) {
var pickleStepIdsByLineNumber = this.pickleStepIdsMapByUri.get(uri);
return pickleStepIdsByLineNumber.get(lineNumber);
Query.prototype.getPickleStepIds = function (astNodeId) {
return this.pickleStepIdsByAstNodeId.get(astNodeId) || [];
};

@@ -60,3 +60,2 @@ Query.prototype.update = function (message) {

this.pickleIdsMapByUri.set(message.gherkinDocument.uri, new multimaps_1.ArrayMultimap());
this.pickleStepIdsMapByUri.set(message.gherkinDocument.uri, new multimaps_1.ArrayMultimap());
try {

@@ -172,12 +171,8 @@ for (var _c = __values(message.gherkinDocument.feature.children), _d = _c.next(); !_d.done; _d = _c.next()) {

Query.prototype.updatePickle = function (pickle) {
var e_7, _a;
var _this = this;
var e_7, _a, e_8, _b;
var pickleIdsByLineNumber = this.pickleIdsMapByUri.get(pickle.uri);
var pickleLineNumbers = pickle.astNodeIds.map(function (astNodeId) { return _this.locationByAstNodeId.get(astNodeId).line; });
try {
for (var pickleLineNumbers_1 = __values(pickleLineNumbers), pickleLineNumbers_1_1 = pickleLineNumbers_1.next(); !pickleLineNumbers_1_1.done; pickleLineNumbers_1_1 = pickleLineNumbers_1.next()) {
var pickleLineNumber = pickleLineNumbers_1_1.value;
// if (!pickleIdsByLineNumber.has(pickleLineNumber)) {
pickleIdsByLineNumber.put(pickleLineNumber, pickle.id);
// }
for (var _c = __values(pickle.astNodeIds), _d = _c.next(); !_d.done; _d = _c.next()) {
var astNodeId = _d.value;
pickleIdsByLineNumber.put(astNodeId, pickle.id);
}

@@ -188,3 +183,3 @@ }

try {
if (pickleLineNumbers_1_1 && !pickleLineNumbers_1_1.done && (_a = pickleLineNumbers_1.return)) _a.call(pickleLineNumbers_1);
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}

@@ -195,7 +190,21 @@ finally { if (e_7) throw e_7.error; }

this.pickles.push(pickle);
try {
for (var _e = __values(pickle.astNodeIds), _f = _e.next(); !_f.done; _f = _e.next()) {
var astNodeId = _f.value;
if (!this.pickleIdsByAstNodeId.has(astNodeId)) {
this.pickleIdsByAstNodeId.set(astNodeId, []);
}
this.pickleIdsByAstNodeId.get(astNodeId).push(pickle.id);
}
}
catch (e_8_1) { e_8 = { error: e_8_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_8) throw e_8.error; }
}
};
Query.prototype.updatePickleSteps = function (pickle) {
var e_8, _a, e_9, _b;
var _this = this;
var pickleStepIdsByLineNumber = this.pickleStepIdsMapByUri.get(pickle.uri);
var e_9, _a, e_10, _b;
var pickleSteps = pickle.steps;

@@ -205,19 +214,21 @@ try {

var pickleStep = pickleSteps_1_1.value;
var stepLineNumbers = pickleStep.astNodeIds.map(function (astNodeId) { return _this.locationByAstNodeId.get(astNodeId).line; });
try {
for (var stepLineNumbers_1 = (e_9 = void 0, __values(stepLineNumbers)), stepLineNumbers_1_1 = stepLineNumbers_1.next(); !stepLineNumbers_1_1.done; stepLineNumbers_1_1 = stepLineNumbers_1.next()) {
var stepLineNumber = stepLineNumbers_1_1.value;
pickleStepIdsByLineNumber.put(stepLineNumber, pickleStep.id);
for (var _c = (e_10 = void 0, __values(pickleStep.astNodeIds)), _d = _c.next(); !_d.done; _d = _c.next()) {
var astNodeId = _d.value;
if (!this.pickleStepIdsByAstNodeId.has(astNodeId)) {
this.pickleStepIdsByAstNodeId.set(astNodeId, []);
}
this.pickleStepIdsByAstNodeId.get(astNodeId).push(pickleStep.id);
}
}
catch (e_9_1) { e_9 = { error: e_9_1 }; }
catch (e_10_1) { e_10 = { error: e_10_1 }; }
finally {
try {
if (stepLineNumbers_1_1 && !stepLineNumbers_1_1.done && (_b = stepLineNumbers_1.return)) _b.call(stepLineNumbers_1);
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
}
finally { if (e_9) throw e_9.error; }
finally { if (e_10) throw e_10.error; }
}
}
}
catch (e_8_1) { e_8 = { error: e_8_1 }; }
catch (e_9_1) { e_9 = { error: e_9_1 }; }
finally {

@@ -227,3 +238,3 @@ try {

}
finally { if (e_8) throw e_8.error; }
finally { if (e_9) throw e_9.error; }
}

@@ -230,0 +241,0 @@ };

@@ -37,3 +37,3 @@ "use strict";

SourceMessageStream.prototype._flush = function (callback) {
var data = this.buffer.toString('UTF-8');
var data = this.buffer.toString('utf8');
var chunk = makeSourceEnvelope_1.default(data, this.uri);

@@ -40,0 +40,0 @@ this.push(chunk);

{
"name": "@cucumber/gherkin",
"version": "13.0.0",
"version": "14.0.0",
"description": "Gherkin parser",

@@ -34,21 +34,22 @@ "main": "dist/src/index.js",

"@types/mocha": "^7.0.2",
"@types/node": "^13.11.1",
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"@types/node": "^14.0.14",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.19.0",
"mocha": "^7.1.1",
"nyc": "^15.0.1",
"prettier": "^2.0.4",
"ts-node": "^8.8.2",
"typescript": "^3.8.3"
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"json-schema": "^0.2.5",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"ts-node": "^8.10.2",
"typescript": "^3.9.5"
},
"dependencies": {
"@cucumber/messages": "^12.0.0",
"@cucumber/messages": "^12.2.0",
"@teppeis/multimaps": "^1.1.0",
"commander": "^5.0.0",
"source-map-support": "^0.5.16"
"commander": "^5.1.0",
"source-map-support": "^0.5.19"
},

@@ -55,0 +56,0 @@ "directories": {

@@ -608,3 +608,6 @@ {

"background": [
"Grundlage"
"Grundlage",
"Hintergrund",
"Voraussetzungen",
"Vorbedingungen"
],

@@ -619,3 +622,4 @@ "but": [

"feature": [
"Funktionalität"
"Funktionalität",
"Funktion"
],

@@ -631,3 +635,4 @@ "given": [

"rule": [
"Rule"
"Rule",
"Regel"
],

@@ -639,3 +644,4 @@ "scenario": [

"scenarioOutline": [
"Szenariogrundriss"
"Szenariogrundriss",
"Szenarien"
],

@@ -1134,3 +1140,3 @@ "then": [

"rule": [
"Rule"
"Reegel"
],

@@ -1142,3 +1148,3 @@ "scenario": [

"scenarioOutline": [
"Raamstjuhtum",
"Raamjuhtum",
"Raamstsenaarium"

@@ -1474,3 +1480,3 @@ ],

"rule": [
"Rule"
"כלל"
],

@@ -1702,10 +1708,13 @@ "scenario": [

"background": [
"Dasar"
"Dasar",
"Latar Belakang"
],
"but": [
"* ",
"Tapi "
"Tapi ",
"Tetapi "
],
"examples": [
"Contoh"
"Contoh",
"Misal"
],

@@ -1717,3 +1726,7 @@ "feature": [

"* ",
"Dengan "
"Dengan ",
"Diketahui ",
"Diasumsikan ",
"Bila ",
"Jika "
],

@@ -1723,3 +1736,4 @@ "name": "Indonesian",

"rule": [
"Rule"
"Rule",
"Aturan"
],

@@ -1730,7 +1744,9 @@ "scenario": [

"scenarioOutline": [
"Skenario konsep"
"Skenario konsep",
"Garis-Besar Skenario"
],
"then": [
"* ",
"Maka "
"Maka ",
"Kemudian "
],

@@ -2344,2 +2360,50 @@ "when": [

},
"ne": {
"and": [
"* ",
"र ",
"अनी "
],
"background": [
"पृष्ठभूमी"
],
"but": [
"* ",
"तर "
],
"examples": [
"उदाहरण",
"उदाहरणहरु"
],
"feature": [
"सुविधा",
"विशेषता"
],
"given": [
"* ",
"दिइएको ",
"दिएको ",
"यदि "
],
"name": "Nepali",
"native": "नेपाली",
"rule": [
"नियम"
],
"scenario": [
"परिदृश्य"
],
"scenarioOutline": [
"परिदृश्य रूपरेखा"
],
"then": [
"* ",
"त्यसपछि ",
"अनी "
],
"when": [
"* ",
"जब "
]
},
"nl": {

@@ -2680,3 +2744,3 @@ "and": [

"rule": [
"Rule"
"Правило"
],

@@ -3526,3 +3590,50 @@ "scenario": [

]
},
"mr": {
"and": [
"* ",
"आणि ",
"तसेच "
],
"background": [
"पार्श्वभूमी"
],
"but": [
"* ",
"पण ",
"परंतु "
],
"examples": [
"उदाहरण"
],
"feature": [
"वैशिष्ट्य",
"सुविधा"
],
"given": [
"* ",
"जर",
"दिलेल्या प्रमाणे "
],
"name": "Marathi",
"native": "मराठी",
"rule": [
"नियम"
],
"scenario": [
"परिदृश्य"
],
"scenarioOutline": [
"परिदृश्य रूपरेखा"
],
"then": [
"* ",
"मग ",
"तेव्हा "
],
"when": [
"* ",
"जेव्हा "
]
}
}

@@ -10,2 +10,3 @@ import GherkinStreams from './stream/GherkinStreams'

import DIALECTS from './gherkin-languages.json'
import { parse, parseAndCompile } from '../test/utils/parse'

@@ -24,2 +25,4 @@ const dialects = DIALECTS as Readonly<{ [key: string]: Dialect }>

compile,
parse,
parseAndCompile,
}

@@ -225,7 +225,9 @@ import { messages, IdGenerator } from '@cucumber/messages'

const valueCell = valueCells[n]
const search = new RegExp('<' + variableCell.value + '>', 'g')
const valuePattern = '<' + variableCell.value + '>'
const escapedPattern = valuePattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')
const regexp = new RegExp(escapedPattern, 'g')
// JS Specific - dollar sign needs to be escaped with another dollar sign
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
const replacement = valueCell.value.replace(new RegExp('\\$', 'g'), '$$$$')
name = name.replace(search, replacement)
name = name.replace(regexp, replacement)
})

@@ -232,0 +234,0 @@ return name

@@ -14,9 +14,9 @@ import { messages } from '@cucumber/messages'

string,
ArrayMultimap<number, string>
ArrayMultimap<string, string>
>()
private readonly pickleStepIdsMapByUri = new Map<
string,
ArrayMultimap<number, string>
>()
private readonly pickleIdsByAstNodeId = new Map<string, string[]>()
private readonly pickleStepIdsByAstNodeId = new Map<string, string[]>()
/**

@@ -34,3 +34,3 @@ * Gets the location (line and column) of an AST node.

public getPickles(): ReadonlyArray<messages.IGherkinDocument> {
public getPickles(): ReadonlyArray<messages.IPickle> {
return this.pickles

@@ -44,15 +44,11 @@ }

*/
public getPickleIds(uri: string, lineNumber?: number): ReadonlyArray<string> {
const pickleIdsByLineNumber = this.pickleIdsMapByUri.get(uri)
return lineNumber === undefined
? Array.from(new Set(pickleIdsByLineNumber.values()))
: pickleIdsByLineNumber.get(lineNumber)
public getPickleIds(uri: string, astNodeId?: string): ReadonlyArray<string> {
const pickleIdsByAstNodeId = this.pickleIdsMapByUri.get(uri)
return astNodeId === undefined
? Array.from(new Set(pickleIdsByAstNodeId.values()))
: pickleIdsByAstNodeId.get(astNodeId)
}
public getPickleStepIds(
uri: string,
lineNumber: number
): ReadonlyArray<string> {
const pickleStepIdsByLineNumber = this.pickleStepIdsMapByUri.get(uri)
return pickleStepIdsByLineNumber.get(lineNumber)
public getPickleStepIds(astNodeId: string): ReadonlyArray<string> {
return this.pickleStepIdsByAstNodeId.get(astNodeId) || []
}

@@ -63,11 +59,8 @@

this.gherkinDocuments.push(message.gherkinDocument)
if (message.gherkinDocument.feature) {
this.pickleIdsMapByUri.set(
message.gherkinDocument.uri,
new ArrayMultimap<number, string>()
new ArrayMultimap<string, string>()
)
this.pickleStepIdsMapByUri.set(
message.gherkinDocument.uri,
new ArrayMultimap<number, string>()
)

@@ -137,23 +130,25 @@ for (const featureChild of message.gherkinDocument.feature.children) {

const pickleIdsByLineNumber = this.pickleIdsMapByUri.get(pickle.uri)
const pickleLineNumbers = pickle.astNodeIds.map(
(astNodeId) => this.locationByAstNodeId.get(astNodeId).line
)
for (const pickleLineNumber of pickleLineNumbers) {
// if (!pickleIdsByLineNumber.has(pickleLineNumber)) {
pickleIdsByLineNumber.put(pickleLineNumber, pickle.id)
// }
for (const astNodeId of pickle.astNodeIds) {
pickleIdsByLineNumber.put(astNodeId, pickle.id)
}
this.updatePickleSteps(pickle)
this.pickles.push(pickle)
for (const astNodeId of pickle.astNodeIds) {
if (!this.pickleIdsByAstNodeId.has(astNodeId)) {
this.pickleIdsByAstNodeId.set(astNodeId, [])
}
this.pickleIdsByAstNodeId.get(astNodeId).push(pickle.id)
}
}
private updatePickleSteps(pickle: messages.IPickle) {
const pickleStepIdsByLineNumber = this.pickleStepIdsMapByUri.get(pickle.uri)
const pickleSteps = pickle.steps
for (const pickleStep of pickleSteps) {
const stepLineNumbers = pickleStep.astNodeIds.map(
(astNodeId) => this.locationByAstNodeId.get(astNodeId).line
)
for (const stepLineNumber of stepLineNumbers) {
pickleStepIdsByLineNumber.put(stepLineNumber, pickleStep.id)
for (const astNodeId of pickleStep.astNodeIds) {
if (!this.pickleStepIdsByAstNodeId.has(astNodeId)) {
this.pickleStepIdsByAstNodeId.set(astNodeId, [])
}
this.pickleStepIdsByAstNodeId.get(astNodeId).push(pickleStep.id)
}

@@ -160,0 +155,0 @@ }

@@ -24,3 +24,3 @@ import { Transform, TransformCallback } from 'stream'

public _flush(callback: TransformCallback) {
const data = this.buffer.toString('UTF-8')
const data = this.buffer.toString('utf8')
const chunk = makeSourceEnvelope(data, this.uri)

@@ -27,0 +27,0 @@ this.push(chunk)

@@ -6,7 +6,3 @@ {

"lib": [
"es5",
"es6",
"es7",
"es2015",
"es2017",
"es2019",
"dom"

@@ -13,0 +9,0 @@ ],

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc