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.0.0-6 to 2.0.0-7

9

browser/dist/compose/compose-node.js

@@ -36,2 +36,4 @@ import { Alias } from '../nodes/Alias.js';

}
if (anchor && node.anchor === '')
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
if (spaceBefore)

@@ -55,4 +57,7 @@ node.spaceBefore = true;

const node = composeScalar(ctx, token, tag, onError);
if (anchor)
if (anchor) {
node.anchor = anchor.source.substring(1);
if (node.anchor === '')
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
}
if (spaceBefore)

@@ -66,2 +71,4 @@ node.spaceBefore = true;

const alias = new Alias(source.substring(1));
if (alias.source === '')
onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');
const valueEnd = offset + source.length;

@@ -68,0 +75,0 @@ const re = resolveEnd(end, valueEnd, options.strict, onError);

3

browser/dist/compose/composer.js

@@ -18,2 +18,3 @@ import { Directives } from '../doc/directives.js';

function parsePrelude(prelude) {
var _a;
let comment = '';

@@ -33,3 +34,3 @@ let atComment = false;

case '%':
if (prelude[i + 1][0] !== '#')
if (((_a = prelude[i + 1]) === null || _a === void 0 ? void 0 : _a[0]) !== '#')
i += 1;

@@ -36,0 +37,0 @@ atComment = false;

@@ -42,11 +42,17 @@ import { Scalar } from '../nodes/Scalar.js';

function plainValue(source, onError) {
let message = '';
let badChar = '';
switch (source[0]) {
/* istanbul ignore next should not happen */
case '\t':
message = 'Plain value cannot start with a tab character';
badChar = 'a tab character';
break;
case ',':
badChar = 'flow indicator character ,';
break;
case '%':
badChar = 'directive indicator character %';
break;
case '|':
case '>': {
message = `Plain value cannot start with block scalar indicator ${source[0]}`;
badChar = `block scalar indicator ${source[0]}`;
break;

@@ -56,8 +62,8 @@ }

case '`': {
message = `Plain value cannot start with reserved character ${source[0]}`;
badChar = `reserved character ${source[0]}`;
break;
}
}
if (message)
onError(0, 'BAD_SCALAR_START', message);
if (badChar)
onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);
return foldLines(source);

@@ -64,0 +70,0 @@ }

@@ -55,4 +55,8 @@ import { Alias } from '../nodes/Alias.js';

value = value.toJSON();
if (!value || typeof value !== 'object')
return new Scalar(value);
if (!value || typeof value !== 'object') {
const node = new Scalar(value);
if (ref)
ref.node = node;
return node;
}
tagObj =

@@ -59,0 +63,0 @@ value instanceof Map

@@ -55,5 +55,5 @@ import { warn } from '../log.js';

function mergeToJSMap(ctx, map, value) {
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : null;
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
if (!isMap(source))
throw new Error('Merge sources must be map aliases');
throw new Error('Merge sources must be maps or map aliases');
const srcMap = source.toJSON(null, ctx, Map);

@@ -60,0 +60,0 @@ for (const [key, value] of srcMap) {

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

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

@@ -329,3 +331,3 @@ * Splits an input string into lexical tokens, i.e. smaller strings that are

case '*':
yield* this.pushUntil(isNotIdentifierChar);
yield* this.pushUntil(isNotAnchorChar);
return 'doc';

@@ -398,3 +400,3 @@ case '"':

case '*':
yield* this.pushUntil(isNotIdentifierChar);
yield* this.pushUntil(isNotAnchorChar);
return 'flow';

@@ -599,9 +601,7 @@ case '"':

case '!':
if (this.charAt(1) === '<')
return ((yield* this.pushVerbatimTag()) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
// fallthrough
return ((yield* this.pushTag()) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
case '&':
return ((yield* this.pushUntil(isNotIdentifierChar)) +
return ((yield* this.pushUntil(isNotAnchorChar)) +
(yield* this.pushSpaces(true)) +

@@ -622,8 +622,26 @@ (yield* this.pushIndicators()));

}
*pushVerbatimTag() {
let i = this.pos + 2;
let ch = this.buffer[i];
while (!isEmpty(ch) && ch !== '>')
ch = this.buffer[++i];
return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);
*pushTag() {
if (this.charAt(1) === '<') {
let i = this.pos + 2;
let ch = this.buffer[i];
while (!isEmpty(ch) && ch !== '>')
ch = this.buffer[++i];
return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);
}
else {
let i = this.pos + 1;
let ch = this.buffer[i];
while (ch) {
if (tagChars.includes(ch))
ch = this.buffer[++i];
else if (ch === '%' &&
hexDigits.includes(this.buffer[i + 1]) &&
hexDigits.includes(this.buffer[i + 2])) {
ch = this.buffer[(i += 3)];
}
else
break;
}
return yield* this.pushToIndex(i, false);
}
}

@@ -630,0 +648,0 @@ *pushNewline() {

@@ -38,2 +38,4 @@ 'use strict';

}
if (anchor && node.anchor === '')
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
if (spaceBefore)

@@ -57,4 +59,7 @@ node.spaceBefore = true;

const node = composeScalar.composeScalar(ctx, token, tag, onError);
if (anchor)
if (anchor) {
node.anchor = anchor.source.substring(1);
if (node.anchor === '')
onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
}
if (spaceBefore)

@@ -68,2 +73,4 @@ node.spaceBefore = true;

const alias = new Alias.Alias(source.substring(1));
if (alias.source === '')
onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');
const valueEnd = offset + source.length;

@@ -70,0 +77,0 @@ const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);

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

function parsePrelude(prelude) {
var _a;
let comment = '';

@@ -35,3 +36,3 @@ let atComment = false;

case '%':
if (prelude[i + 1][0] !== '#')
if (((_a = prelude[i + 1]) === null || _a === void 0 ? void 0 : _a[0]) !== '#')
i += 1;

@@ -38,0 +39,0 @@ atComment = false;

@@ -44,11 +44,17 @@ 'use strict';

function plainValue(source, onError) {
let message = '';
let badChar = '';
switch (source[0]) {
/* istanbul ignore next should not happen */
case '\t':
message = 'Plain value cannot start with a tab character';
badChar = 'a tab character';
break;
case ',':
badChar = 'flow indicator character ,';
break;
case '%':
badChar = 'directive indicator character %';
break;
case '|':
case '>': {
message = `Plain value cannot start with block scalar indicator ${source[0]}`;
badChar = `block scalar indicator ${source[0]}`;
break;

@@ -58,8 +64,8 @@ }

case '`': {
message = `Plain value cannot start with reserved character ${source[0]}`;
badChar = `reserved character ${source[0]}`;
break;
}
}
if (message)
onError(0, 'BAD_SCALAR_START', message);
if (badChar)
onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);
return foldLines(source);

@@ -66,0 +72,0 @@ }

@@ -57,4 +57,8 @@ 'use strict';

value = value.toJSON();
if (!value || typeof value !== 'object')
return new Scalar.Scalar(value);
if (!value || typeof value !== 'object') {
const node = new Scalar.Scalar(value);
if (ref)
ref.node = node;
return node;
}
tagObj =

@@ -61,0 +65,0 @@ value instanceof Map

import type { LineCounter } from './parse/line-counter';
export declare type ErrorCode = 'ALIAS_PROPS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_ANCHOR' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN';
export declare type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN';
export declare type LinePos = {

@@ -4,0 +4,0 @@ line: number;

@@ -57,5 +57,5 @@ 'use strict';

function mergeToJSMap(ctx, map, value) {
const source = ctx && Node.isAlias(value) ? value.resolve(ctx.doc) : null;
const source = ctx && Node.isAlias(value) ? value.resolve(ctx.doc) : value;
if (!Node.isMap(source))
throw new Error('Merge sources must be map aliases');
throw new Error('Merge sources must be maps or map aliases');
const srcMap = source.toJSON(null, ctx, Map);

@@ -62,0 +62,0 @@ for (const [key, value] of srcMap) {

@@ -81,3 +81,3 @@ /**

private pushIndicators;
private pushVerbatimTag;
private pushTag;
private pushNewline;

@@ -84,0 +84,0 @@ private pushSpaces;

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

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

@@ -331,3 +333,3 @@ * Splits an input string into lexical tokens, i.e. smaller strings that are

case '*':
yield* this.pushUntil(isNotIdentifierChar);
yield* this.pushUntil(isNotAnchorChar);
return 'doc';

@@ -400,3 +402,3 @@ case '"':

case '*':
yield* this.pushUntil(isNotIdentifierChar);
yield* this.pushUntil(isNotAnchorChar);
return 'flow';

@@ -601,9 +603,7 @@ case '"':

case '!':
if (this.charAt(1) === '<')
return ((yield* this.pushVerbatimTag()) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
// fallthrough
return ((yield* this.pushTag()) +
(yield* this.pushSpaces(true)) +
(yield* this.pushIndicators()));
case '&':
return ((yield* this.pushUntil(isNotIdentifierChar)) +
return ((yield* this.pushUntil(isNotAnchorChar)) +
(yield* this.pushSpaces(true)) +

@@ -624,8 +624,26 @@ (yield* this.pushIndicators()));

}
*pushVerbatimTag() {
let i = this.pos + 2;
let ch = this.buffer[i];
while (!isEmpty(ch) && ch !== '>')
ch = this.buffer[++i];
return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);
*pushTag() {
if (this.charAt(1) === '<') {
let i = this.pos + 2;
let ch = this.buffer[i];
while (!isEmpty(ch) && ch !== '>')
ch = this.buffer[++i];
return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);
}
else {
let i = this.pos + 1;
let ch = this.buffer[i];
while (ch) {
if (tagChars.includes(ch))
ch = this.buffer[++i];
else if (ch === '%' &&
hexDigits.includes(this.buffer[i + 1]) &&
hexDigits.includes(this.buffer[i + 2])) {
ch = this.buffer[(i += 3)];
}
else
break;
}
return yield* this.pushToIndex(i, false);
}
}

@@ -632,0 +650,0 @@ *pushNewline() {

{
"name": "yaml",
"version": "2.0.0-6",
"version": "2.0.0-7",
"license": "ISC",

@@ -5,0 +5,0 @@ "author": "Eemeli Aro <eemeli@gmail.com>",

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