Skip to content

Commit 7b25c83

Browse files
author
Vitaly Puzrin
committed
Browser files rebuild
1 parent 6f73473 commit 7b25c83

File tree

2 files changed

+64
-21
lines changed

2 files changed

+64
-21
lines changed

dist/js-yaml.js

+63-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* js-yaml 3.13.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
1+
/* js-yaml 3.14.0 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
22
'use strict';
33

44

@@ -115,6 +115,7 @@ var _hasOwnProperty = Object.prototype.hasOwnProperty;
115115

116116
var CHAR_TAB = 0x09; /* Tab */
117117
var CHAR_LINE_FEED = 0x0A; /* LF */
118+
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
118119
var CHAR_SPACE = 0x20; /* Space */
119120
var CHAR_EXCLAMATION = 0x21; /* ! */
120121
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
@@ -126,6 +127,7 @@ var CHAR_ASTERISK = 0x2A; /* * */
126127
var CHAR_COMMA = 0x2C; /* , */
127128
var CHAR_MINUS = 0x2D; /* - */
128129
var CHAR_COLON = 0x3A; /* : */
130+
var CHAR_EQUALS = 0x3D; /* = */
129131
var CHAR_GREATER_THAN = 0x3E; /* > */
130132
var CHAR_QUESTION = 0x3F; /* ? */
131133
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
@@ -291,8 +293,23 @@ function isPrintable(c) {
291293
|| (0x10000 <= c && c <= 0x10FFFF);
292294
}
293295

296+
// [34] ns-char ::= nb-char - s-white
297+
// [27] nb-char ::= c-printable - b-char - c-byte-order-mark
298+
// [26] b-char ::= b-line-feed | b-carriage-return
299+
// [24] b-line-feed ::= #xA /* LF */
300+
// [25] b-carriage-return ::= #xD /* CR */
301+
// [3] c-byte-order-mark ::= #xFEFF
302+
function isNsChar(c) {
303+
return isPrintable(c) && !isWhitespace(c)
304+
// byte-order-mark
305+
&& c !== 0xFEFF
306+
// b-char
307+
&& c !== CHAR_CARRIAGE_RETURN
308+
&& c !== CHAR_LINE_FEED;
309+
}
310+
294311
// Simplified test for values allowed after the first character in plain style.
295-
function isPlainSafe(c) {
312+
function isPlainSafe(c, prev) {
296313
// Uses a subset of nb-char - c-flow-indicator - ":" - "#"
297314
// where nb-char ::= c-printable - b-char - c-byte-order-mark.
298315
return isPrintable(c) && c !== 0xFEFF
@@ -303,8 +320,9 @@ function isPlainSafe(c) {
303320
&& c !== CHAR_LEFT_CURLY_BRACKET
304321
&& c !== CHAR_RIGHT_CURLY_BRACKET
305322
// - ":" - "#"
323+
// /* An ns-char preceding */ "#"
306324
&& c !== CHAR_COLON
307-
&& c !== CHAR_SHARP;
325+
&& ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
308326
}
309327

310328
// Simplified test for values allowed as the first character in plain style.
@@ -323,12 +341,13 @@ function isPlainSafeFirst(c) {
323341
&& c !== CHAR_RIGHT_SQUARE_BRACKET
324342
&& c !== CHAR_LEFT_CURLY_BRACKET
325343
&& c !== CHAR_RIGHT_CURLY_BRACKET
326-
// | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
344+
// | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
327345
&& c !== CHAR_SHARP
328346
&& c !== CHAR_AMPERSAND
329347
&& c !== CHAR_ASTERISK
330348
&& c !== CHAR_EXCLAMATION
331349
&& c !== CHAR_VERTICAL_LINE
350+
&& c !== CHAR_EQUALS
332351
&& c !== CHAR_GREATER_THAN
333352
&& c !== CHAR_SINGLE_QUOTE
334353
&& c !== CHAR_DOUBLE_QUOTE
@@ -359,7 +378,7 @@ var STYLE_PLAIN = 1,
359378
// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
360379
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
361380
var i;
362-
var char;
381+
var char, prev_char;
363382
var hasLineBreak = false;
364383
var hasFoldableLine = false; // only checked if shouldTrackWidth
365384
var shouldTrackWidth = lineWidth !== -1;
@@ -375,7 +394,8 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
375394
if (!isPrintable(char)) {
376395
return STYLE_DOUBLE;
377396
}
378-
plain = plain && isPlainSafe(char);
397+
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
398+
plain = plain && isPlainSafe(char, prev_char);
379399
}
380400
} else {
381401
// Case: block styles permitted.
@@ -394,7 +414,8 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, te
394414
} else if (!isPrintable(char)) {
395415
return STYLE_DOUBLE;
396416
}
397-
plain = plain && isPlainSafe(char);
417+
prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
418+
plain = plain && isPlainSafe(char, prev_char);
398419
}
399420
// in case the end is missing a \n
400421
hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
@@ -651,10 +672,12 @@ function writeFlowMapping(state, level, object) {
651672
pairBuffer;
652673

653674
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
654-
pairBuffer = state.condenseFlow ? '"' : '';
655675

676+
pairBuffer = '';
656677
if (index !== 0) pairBuffer += ', ';
657678

679+
if (state.condenseFlow) pairBuffer += '"';
680+
658681
objectKey = objectKeyList[index];
659682
objectValue = object[objectKey];
660683

@@ -2370,13 +2393,19 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
23702393

23712394
if (state.tag !== null && state.tag !== '!') {
23722395
if (state.tag === '?') {
2396+
// Implicit resolving is not allowed for non-scalar types, and '?'
2397+
// non-specific tag is only automatically assigned to plain scalars.
2398+
//
2399+
// We only need to check kind conformity in case user explicitly assigns '?'
2400+
// tag, for example like this: "!<?> [0]"
2401+
//
2402+
if (state.result !== null && state.kind !== 'scalar') {
2403+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
2404+
}
2405+
23732406
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
23742407
type = state.implicitTypes[typeIndex];
23752408

2376-
// Implicit resolving is not allowed for non-scalar types, and '?'
2377-
// non-specific tag is only assigned to plain scalars. So, it isn't
2378-
// needed to check for 'kind' conformity.
2379-
23802409
if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
23812410
state.result = type.construct(state.result);
23822411
state.tag = type.tag;
@@ -2540,6 +2569,13 @@ function loadDocuments(input, options) {
25402569

25412570
var state = new State(input, options);
25422571

2572+
var nullpos = input.indexOf('\0');
2573+
2574+
if (nullpos !== -1) {
2575+
state.position = nullpos;
2576+
throwError(state, 'null byte is not allowed in input');
2577+
}
2578+
25432579
// Use 0 as string terminator. That significantly simplifies bounds check.
25442580
state.input += '\0';
25452581

@@ -2557,13 +2593,18 @@ function loadDocuments(input, options) {
25572593

25582594

25592595
function loadAll(input, iterator, options) {
2560-
var documents = loadDocuments(input, options), index, length;
2596+
if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
2597+
options = iterator;
2598+
iterator = null;
2599+
}
2600+
2601+
var documents = loadDocuments(input, options);
25612602

25622603
if (typeof iterator !== 'function') {
25632604
return documents;
25642605
}
25652606

2566-
for (index = 0, length = documents.length; index < length; index += 1) {
2607+
for (var index = 0, length = documents.length; index < length; index += 1) {
25672608
iterator(documents[index]);
25682609
}
25692610
}
@@ -2582,12 +2623,13 @@ function load(input, options) {
25822623
}
25832624

25842625

2585-
function safeLoadAll(input, output, options) {
2586-
if (typeof output === 'function') {
2587-
loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2588-
} else {
2589-
return loadAll(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2626+
function safeLoadAll(input, iterator, options) {
2627+
if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
2628+
options = iterator;
2629+
iterator = null;
25902630
}
2631+
2632+
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
25912633
}
25922634

25932635

@@ -3462,7 +3504,8 @@ try {
34623504
var _require = require;
34633505
esprima = _require('esprima');
34643506
} catch (_) {
3465-
/*global window */
3507+
/* eslint-disable no-redeclare */
3508+
/* global window */
34663509
if (typeof window !== 'undefined') esprima = window.esprima;
34673510
}
34683511

0 commit comments

Comments
 (0)