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.4 to 2.4.5

1

browser/dist/compose/compose-doc.js

@@ -20,2 +20,3 @@ import { Document } from '../doc/Document.js';

onError,
parentIndent: 0,
startOnNewline: true

@@ -22,0 +23,0 @@ });

2

browser/dist/compose/compose-scalar.js

@@ -8,3 +8,3 @@ import { SCALAR, isScalar } from '../nodes/identity.js';

const { value, type, comment, range } = token.type === 'block-scalar'
? resolveBlockScalar(token, ctx.options.strict, onError)
? resolveBlockScalar(ctx, token, onError)
: resolveFlowScalar(token, ctx.options.strict, onError);

@@ -11,0 +11,0 @@ const tagName = tagToken

@@ -24,2 +24,3 @@ import { Pair } from '../nodes/Pair.js';

onError,
parentIndent: bm.indent,
startOnNewline: true

@@ -67,2 +68,3 @@ });

onError,
parentIndent: bm.indent,
startOnNewline: !key || key.type === 'block-scalar'

@@ -69,0 +71,0 @@ });

import { Scalar } from '../nodes/Scalar.js';
function resolveBlockScalar(scalar, strict, onError) {
function resolveBlockScalar(ctx, scalar, onError) {
const start = scalar.offset;
const header = parseBlockScalarHeader(scalar, strict, onError);
const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
if (!header)

@@ -47,2 +47,6 @@ return { value: '', type: null, comment: '', range: [start, start, start] };

contentStart = i;
if (trimIndent === 0 && !ctx.atRoot) {
const message = 'Block scalar values in collections must be indented';
onError(offset, 'BAD_INDENT', message);
}
break;

@@ -49,0 +53,0 @@ }

@@ -18,2 +18,3 @@ import { YAMLSeq } from '../nodes/YAMLSeq.js';

onError,
parentIndent: bs.indent,
startOnNewline: true

@@ -20,0 +21,0 @@ });

@@ -31,2 +31,3 @@ import { isPair } from '../nodes/identity.js';

onError,
parentIndent: fc.indent,
startOnNewline: false

@@ -113,2 +114,3 @@ });

onError,
parentIndent: fc.indent,
startOnNewline: false

@@ -115,0 +117,0 @@ });

@@ -1,2 +0,2 @@

function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) {
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
let spaceBefore = false;

@@ -25,3 +25,3 @@ let atNewline = startOnNewline;

if (tab) {
if (token.type !== 'comment') {
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');

@@ -37,5 +37,4 @@ }

if (!flow &&
atNewline &&
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
token.source[0] === '\t') {
token.source.includes('\t')) {
tab = token;

@@ -102,3 +101,4 @@ }

found = token;
atNewline = false;
atNewline =
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
hasSpace = false;

@@ -132,3 +132,6 @@ break;

}
if (tab)
if (tab &&
((atNewline && tab.indent <= parentIndent) ||
next?.type === 'block-map' ||
next?.type === 'block-seq'))
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');

@@ -135,0 +138,0 @@ return {

@@ -21,3 +21,3 @@ import { resolveBlockScalar } from '../compose/resolve-block-scalar.js';

case 'block-scalar':
return resolveBlockScalar(token, strict, _onError);
return resolveBlockScalar({ options: { strict } }, token, _onError);
}

@@ -24,0 +24,0 @@ }

@@ -544,3 +544,14 @@ import { BOM, DOCUMENT, FLOW_END, SCALAR } from './cst.js';

}
if (!this.blockScalarKeep) {
// Trailing insufficiently indented tabs are invalid.
// To catch that during parsing, we include them in the block scalar value.
let i = nl + 1;
ch = this.buffer[i];
while (ch === ' ')
ch = this.buffer[++i];
if (ch === '\t') {
while (ch === '\t' || ch === ' ' || ch === '\r' || ch === '\n')
ch = this.buffer[++i];
nl = i - 1;
}
else if (!this.blockScalarKeep) {
do {

@@ -552,3 +563,3 @@ let i = nl - 1;

const lastChar = i; // Drop the line if last char not more indented
while (ch === ' ' || ch === '\t')
while (ch === ' ')
ch = this.buffer[--i];

@@ -555,0 +566,0 @@ if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)

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

onError,
parentIndent: 0,
startOnNewline: true

@@ -24,0 +25,0 @@ });

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

const { value, type, comment, range } = token.type === 'block-scalar'
? resolveBlockScalar.resolveBlockScalar(token, ctx.options.strict, onError)
? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)
: resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);

@@ -13,0 +13,0 @@ const tagName = tagToken

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

onError,
parentIndent: bm.indent,
startOnNewline: true

@@ -69,2 +70,3 @@ });

onError,
parentIndent: bm.indent,
startOnNewline: !key || key.type === 'block-scalar'

@@ -71,0 +73,0 @@ });

import { Range } from '../nodes/Node.js';
import { Scalar } from '../nodes/Scalar.js';
import type { BlockScalar } from '../parse/cst.js';
import type { ComposeContext } from './compose-node.js';
import type { ComposeErrorHandler } from './composer.js';
export declare function resolveBlockScalar(scalar: BlockScalar, strict: boolean, onError: ComposeErrorHandler): {
export declare function resolveBlockScalar(ctx: ComposeContext, scalar: BlockScalar, onError: ComposeErrorHandler): {
value: string;

@@ -7,0 +8,0 @@ type: Scalar.BLOCK_FOLDED | Scalar.BLOCK_LITERAL | null;

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

function resolveBlockScalar(scalar, strict, onError) {
function resolveBlockScalar(ctx, scalar, onError) {
const start = scalar.offset;
const header = parseBlockScalarHeader(scalar, strict, onError);
const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
if (!header)

@@ -50,2 +50,6 @@ return { value: '', type: null, comment: '', range: [start, start, start] };

contentStart = i;
if (trimIndent === 0 && !ctx.atRoot) {
const message = 'Block scalar values in collections must be indented';
onError(offset, 'BAD_INDENT', message);
}
break;

@@ -52,0 +56,0 @@ }

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

onError,
parentIndent: bs.indent,
startOnNewline: true

@@ -22,0 +23,0 @@ });

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

onError,
parentIndent: fc.indent,
startOnNewline: false

@@ -115,2 +116,3 @@ });

onError,
parentIndent: fc.indent,
startOnNewline: false

@@ -117,0 +119,0 @@ });

@@ -9,5 +9,6 @@ import type { SourceToken, Token } from '../parse/cst.js';

onError: ComposeErrorHandler;
parentIndent: number;
startOnNewline: boolean;
}
export declare function resolveProps(tokens: SourceToken[], { flow, indicator, next, offset, onError, startOnNewline }: ResolvePropsArg): {
export declare function resolveProps(tokens: SourceToken[], { flow, indicator, next, offset, onError, parentIndent, startOnNewline }: ResolvePropsArg): {
comma: SourceToken | null;

@@ -14,0 +15,0 @@ found: SourceToken | null;

'use strict';
function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) {
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
let spaceBefore = false;

@@ -27,3 +27,3 @@ let atNewline = startOnNewline;

if (tab) {
if (token.type !== 'comment') {
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');

@@ -39,5 +39,4 @@ }

if (!flow &&
atNewline &&
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
token.source[0] === '\t') {
token.source.includes('\t')) {
tab = token;

@@ -104,3 +103,4 @@ }

found = token;
atNewline = false;
atNewline =
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
hasSpace = false;

@@ -134,3 +134,6 @@ break;

}
if (tab)
if (tab &&
((atNewline && tab.indent <= parentIndent) ||
next?.type === 'block-map' ||
next?.type === 'block-seq'))
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');

@@ -137,0 +140,0 @@ return {

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

case 'block-scalar':
return resolveBlockScalar.resolveBlockScalar(token, strict, _onError);
return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);
}

@@ -26,0 +26,0 @@ }

@@ -546,3 +546,14 @@ 'use strict';

}
if (!this.blockScalarKeep) {
// Trailing insufficiently indented tabs are invalid.
// To catch that during parsing, we include them in the block scalar value.
let i = nl + 1;
ch = this.buffer[i];
while (ch === ' ')
ch = this.buffer[++i];
if (ch === '\t') {
while (ch === '\t' || ch === ' ' || ch === '\r' || ch === '\n')
ch = this.buffer[++i];
nl = i - 1;
}
else if (!this.blockScalarKeep) {
do {

@@ -554,3 +565,3 @@ let i = nl - 1;

const lastChar = i; // Drop the line if last char not more indented
while (ch === ' ' || ch === '\t')
while (ch === ' ')
ch = this.buffer[--i];

@@ -557,0 +568,0 @@ if (ch === '\n' && i >= this.pos && i + 1 + indent > lastChar)

{
"name": "yaml",
"version": "2.4.4",
"version": "2.4.5",
"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