Socket
Socket
Sign inDemoInstall

yaml

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml - npm Package Compare versions

Comparing version 2.4.3 to 2.4.4

19

browser/dist/compose/resolve-props.js

@@ -10,2 +10,3 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) {

let reqSpace = false;
let tab = null;
let anchor = null;

@@ -24,2 +25,8 @@ let tag = null;

}
if (tab) {
if (token.type !== 'comment') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
}
tab = null;
}
switch (token.type) {

@@ -32,5 +39,6 @@ case 'space':

atNewline &&
indicator !== 'doc-start' &&
token.source[0] === '\t')
onError(token, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
token.source[0] === '\t') {
tab = token;
}
hasSpace = true;

@@ -121,4 +129,7 @@ break;

next.type !== 'comma' &&
(next.type !== 'scalar' || next.source !== ''))
(next.type !== 'scalar' || next.source !== '')) {
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
}
if (tab)
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
return {

@@ -125,0 +136,0 @@ comma,

@@ -82,7 +82,7 @@ import { BOM, DOCUMENT, FLOW_END, SCALAR } from './cst.js';

}
const hexDigits = '0123456789ABCDEFabcdef'.split('');
const tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split('');
const invalidFlowScalarChars = ',[]{}'.split('');
const invalidAnchorChars = ' ,[]{}\n\r\t'.split('');
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch);
const hexDigits = new Set('0123456789ABCDEFabcdef');
const tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
const flowIndicatorChars = new Set(',[]{}');
const invalidAnchorChars = new Set(' ,[]{}\n\r\t');
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
/**

@@ -529,4 +529,6 @@ * Splits an input string into lexical tokens, i.e. smaller strings that are

this.indentNext = indent;
else
this.indentNext += this.blockScalarIndent;
else {
this.indentNext =
this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
}
do {

@@ -571,3 +573,3 @@ const cs = this.continueScalar(nl + 1);

const next = this.buffer[i + 1];
if (isEmpty(next) || (inFlow && next === ','))
if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))
break;

@@ -587,3 +589,3 @@ end = i;

}
if (next === '#' || (inFlow && invalidFlowScalarChars.includes(next)))
if (next === '#' || (inFlow && flowIndicatorChars.has(next)))
break;

@@ -598,3 +600,3 @@ if (ch === '\n') {

else {
if (inFlow && invalidFlowScalarChars.includes(ch))
if (inFlow && flowIndicatorChars.has(ch))
break;

@@ -644,3 +646,3 @@ end = i;

const ch1 = this.charAt(1);
if (isEmpty(ch1) || (inFlow && invalidFlowScalarChars.includes(ch1))) {
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
if (!inFlow)

@@ -670,7 +672,7 @@ this.indentNext = this.indentValue + 1;

while (ch) {
if (tagChars.includes(ch))
if (tagChars.has(ch))
ch = this.buffer[++i];
else if (ch === '%' &&
hexDigits.includes(this.buffer[i + 1]) &&
hexDigits.includes(this.buffer[i + 2])) {
hexDigits.has(this.buffer[i + 1]) &&
hexDigits.has(this.buffer[i + 2])) {
ch = this.buffer[(i += 3)];

@@ -677,0 +679,0 @@ }

@@ -307,3 +307,3 @@ import { tokenType } from './cst.js';

Object.assign(it, { key: token, sep: [] });
this.onKeyLine = !includesToken(it.start, 'explicit-key-ind');
this.onKeyLine = !it.explicitKey;
return;

@@ -517,5 +517,5 @@ }

if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine &&
this.indent === map.indent &&
it.sep &&
const atMapIndent = !this.onKeyLine && this.indent === map.indent;
const atNextItem = atMapIndent &&
(it.sep || it.explicitKey) &&
this.type !== 'seq-item-ind';

@@ -561,8 +561,9 @@ // For empty nodes, assign newline-separated not indented empty tokens to following node

case 'explicit-key-ind':
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
if (!it.sep && !it.explicitKey) {
it.start.push(this.sourceToken);
it.explicitKey = true;
}
else if (atNextItem || it.value) {
start.push(this.sourceToken);
map.items.push({ start });
map.items.push({ start, explicitKey: true });
}

@@ -574,3 +575,3 @@ else {

indent: this.indent,
items: [{ start: [this.sourceToken] }]
items: [{ start: [this.sourceToken], explicitKey: true }]
});

@@ -581,3 +582,3 @@ }

case 'map-value-ind':
if (includesToken(it.start, 'explicit-key-ind')) {
if (it.explicitKey) {
if (!it.sep) {

@@ -673,5 +674,3 @@ if (includesToken(it.start, 'newline')) {

if (bv) {
if (atNextItem &&
bv.type !== 'block-seq' &&
includesToken(it.start, 'explicit-key-ind')) {
if (atMapIndent && bv.type !== 'block-seq') {
map.items.push({ start });

@@ -897,3 +896,3 @@ }

indent: this.indent,
items: [{ start }]
items: [{ start, explicitKey: true }]
};

@@ -900,0 +899,0 @@ }

@@ -12,2 +12,3 @@ 'use strict';

let reqSpace = false;
let tab = null;
let anchor = null;

@@ -26,2 +27,8 @@ let tag = null;

}
if (tab) {
if (token.type !== 'comment') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
}
tab = null;
}
switch (token.type) {

@@ -34,5 +41,6 @@ case 'space':

atNewline &&
indicator !== 'doc-start' &&
token.source[0] === '\t')
onError(token, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
token.source[0] === '\t') {
tab = token;
}
hasSpace = true;

@@ -123,4 +131,7 @@ break;

next.type !== 'comma' &&
(next.type !== 'scalar' || next.source !== ''))
(next.type !== 'scalar' || next.source !== '')) {
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
}
if (tab)
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
return {

@@ -127,0 +138,0 @@ comma,

@@ -54,2 +54,3 @@ export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js';

start: SourceToken[];
explicitKey?: true;
key?: never;

@@ -60,2 +61,3 @@ sep?: never;

start: SourceToken[];
explicitKey?: true;
key: Token | null;

@@ -62,0 +64,0 @@ sep: SourceToken[];

@@ -84,7 +84,7 @@ 'use strict';

}
const hexDigits = '0123456789ABCDEFabcdef'.split('');
const tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split('');
const invalidFlowScalarChars = ',[]{}'.split('');
const invalidAnchorChars = ' ,[]{}\n\r\t'.split('');
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch);
const hexDigits = new Set('0123456789ABCDEFabcdef');
const tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
const flowIndicatorChars = new Set(',[]{}');
const invalidAnchorChars = new Set(' ,[]{}\n\r\t');
const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);
/**

@@ -531,4 +531,6 @@ * Splits an input string into lexical tokens, i.e. smaller strings that are

this.indentNext = indent;
else
this.indentNext += this.blockScalarIndent;
else {
this.indentNext =
this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
}
do {

@@ -573,3 +575,3 @@ const cs = this.continueScalar(nl + 1);

const next = this.buffer[i + 1];
if (isEmpty(next) || (inFlow && next === ','))
if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))
break;

@@ -589,3 +591,3 @@ end = i;

}
if (next === '#' || (inFlow && invalidFlowScalarChars.includes(next)))
if (next === '#' || (inFlow && flowIndicatorChars.has(next)))
break;

@@ -600,3 +602,3 @@ if (ch === '\n') {

else {
if (inFlow && invalidFlowScalarChars.includes(ch))
if (inFlow && flowIndicatorChars.has(ch))
break;

@@ -646,3 +648,3 @@ end = i;

const ch1 = this.charAt(1);
if (isEmpty(ch1) || (inFlow && invalidFlowScalarChars.includes(ch1))) {
if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {
if (!inFlow)

@@ -672,7 +674,7 @@ this.indentNext = this.indentValue + 1;

while (ch) {
if (tagChars.includes(ch))
if (tagChars.has(ch))
ch = this.buffer[++i];
else if (ch === '%' &&
hexDigits.includes(this.buffer[i + 1]) &&
hexDigits.includes(this.buffer[i + 2])) {
hexDigits.has(this.buffer[i + 1]) &&
hexDigits.has(this.buffer[i + 2])) {
ch = this.buffer[(i += 3)];

@@ -679,0 +681,0 @@ }

@@ -311,3 +311,3 @@ 'use strict';

Object.assign(it, { key: token, sep: [] });
this.onKeyLine = !includesToken(it.start, 'explicit-key-ind');
this.onKeyLine = !it.explicitKey;
return;

@@ -521,5 +521,5 @@ }

if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine &&
this.indent === map.indent &&
it.sep &&
const atMapIndent = !this.onKeyLine && this.indent === map.indent;
const atNextItem = atMapIndent &&
(it.sep || it.explicitKey) &&
this.type !== 'seq-item-ind';

@@ -565,8 +565,9 @@ // For empty nodes, assign newline-separated not indented empty tokens to following node

case 'explicit-key-ind':
if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
if (!it.sep && !it.explicitKey) {
it.start.push(this.sourceToken);
it.explicitKey = true;
}
else if (atNextItem || it.value) {
start.push(this.sourceToken);
map.items.push({ start });
map.items.push({ start, explicitKey: true });
}

@@ -578,3 +579,3 @@ else {

indent: this.indent,
items: [{ start: [this.sourceToken] }]
items: [{ start: [this.sourceToken], explicitKey: true }]
});

@@ -585,3 +586,3 @@ }

case 'map-value-ind':
if (includesToken(it.start, 'explicit-key-ind')) {
if (it.explicitKey) {
if (!it.sep) {

@@ -677,5 +678,3 @@ if (includesToken(it.start, 'newline')) {

if (bv) {
if (atNextItem &&
bv.type !== 'block-seq' &&
includesToken(it.start, 'explicit-key-ind')) {
if (atMapIndent && bv.type !== 'block-seq') {
map.items.push({ start });

@@ -901,3 +900,3 @@ }

indent: this.indent,
items: [{ start }]
items: [{ start, explicitKey: true }]
};

@@ -904,0 +903,0 @@ }

{
"name": "yaml",
"version": "2.4.3",
"version": "2.4.4",
"license": "ISC",

@@ -47,4 +47,4 @@ "author": "Eemeli Aro <eemeli@gmail.com>",

"prettier": "prettier --write .",
"prestart": "npm run build:node",
"start": "node -i -e 'YAML=require(\"./dist/index.js\")'",
"prestart": "rollup --sourcemap -c config/rollup.node-config.mjs",
"start": "node --enable-source-maps -i -e 'YAML=require(\"./dist/index.js\");const{parse,parseDocument,parseAllDocuments}=YAML'",
"test": "jest --config config/jest.config.js",

@@ -51,0 +51,0 @@ "test:all": "npm test && npm run test:types && npm run test:dist && npm run test:dist:types",

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