yaml 1.8.2 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/browser/dist/Anchors.js +10 -13
  2. package/browser/dist/Document.js +72 -67
  3. package/browser/dist/addComment.js +1 -1
  4. package/browser/dist/cst/Alias.js +12 -8
  5. package/browser/dist/cst/BlankLine.js +16 -20
  6. package/browser/dist/cst/BlockValue.js +14 -10
  7. package/browser/dist/cst/Collection.js +17 -13
  8. package/browser/dist/cst/CollectionItem.js +15 -11
  9. package/browser/dist/cst/Comment.js +13 -9
  10. package/browser/dist/cst/Directive.js +13 -9
  11. package/browser/dist/cst/Document.js +17 -13
  12. package/browser/dist/cst/FlowCollection.js +17 -13
  13. package/browser/dist/cst/Node.js +3 -5
  14. package/browser/dist/cst/ParseContext.js +12 -14
  15. package/browser/dist/cst/PlainValue.js +12 -8
  16. package/browser/dist/cst/QuoteDouble.js +13 -9
  17. package/browser/dist/cst/QuoteSingle.js +13 -9
  18. package/browser/dist/cst/Range.js +2 -5
  19. package/browser/dist/cst/parse.js +3 -3
  20. package/browser/dist/errors.js +23 -8
  21. package/browser/dist/foldFlowLines.js +1 -1
  22. package/browser/dist/index.js +71 -21
  23. package/browser/dist/listTagNames.js +5 -5
  24. package/browser/dist/schema/Alias.js +30 -34
  25. package/browser/dist/schema/Collection.js +40 -47
  26. package/browser/dist/schema/Map.js +39 -56
  27. package/browser/dist/schema/Merge.js +37 -46
  28. package/browser/dist/schema/Node.js +2 -5
  29. package/browser/dist/schema/Pair.js +36 -13
  30. package/browser/dist/schema/Scalar.js +13 -9
  31. package/browser/dist/schema/Seq.js +27 -25
  32. package/browser/dist/schema/index.js +25 -39
  33. package/browser/dist/schema/parseMap.js +8 -8
  34. package/browser/dist/schema/parseSeq.js +5 -5
  35. package/browser/dist/schema/parseUtils.js +11 -15
  36. package/browser/dist/stringify.js +2 -1
  37. package/browser/dist/tags/core.js +39 -23
  38. package/browser/dist/tags/failsafe/index.js +4 -4
  39. package/browser/dist/tags/failsafe/map.js +15 -18
  40. package/browser/dist/tags/failsafe/seq.js +14 -18
  41. package/browser/dist/tags/failsafe/string.js +1 -1
  42. package/browser/dist/tags/index.js +10 -10
  43. package/browser/dist/tags/json.js +27 -26
  44. package/browser/dist/tags/options.js +3 -0
  45. package/browser/dist/tags/yaml-1.1/binary.js +10 -8
  46. package/browser/dist/tags/yaml-1.1/index.js +75 -43
  47. package/browser/dist/tags/yaml-1.1/omap.js +34 -39
  48. package/browser/dist/tags/yaml-1.1/pairs.js +17 -20
  49. package/browser/dist/tags/yaml-1.1/set.js +27 -23
  50. package/browser/dist/test-events.js +4 -4
  51. package/browser/dist/toJSON.js +3 -4
  52. package/browser/dist/warnings.js +29 -18
  53. package/browser/index.js +1 -1
  54. package/browser/map.js +4 -2
  55. package/browser/pair.js +4 -2
  56. package/browser/parse-cst.js +1 -1
  57. package/browser/scalar.js +4 -2
  58. package/browser/schema.js +11 -6
  59. package/browser/seq.js +4 -2
  60. package/browser/types/binary.js +5 -6
  61. package/browser/types/omap.js +4 -2
  62. package/browser/types/pairs.js +4 -2
  63. package/browser/types/set.js +4 -2
  64. package/browser/types/timestamp.js +5 -9
  65. package/browser/types.js +12 -10
  66. package/browser/util.js +16 -13
  67. package/dist/Anchors.js +13 -18
  68. package/dist/Document.js +52 -48
  69. package/dist/addComment.js +1 -4
  70. package/dist/constants.js +0 -3
  71. package/dist/cst/Alias.js +8 -13
  72. package/dist/cst/BlankLine.js +8 -24
  73. package/dist/cst/BlockValue.js +12 -17
  74. package/dist/cst/Collection.js +22 -27
  75. package/dist/cst/CollectionItem.js +16 -21
  76. package/dist/cst/Comment.js +6 -11
  77. package/dist/cst/Directive.js +7 -12
  78. package/dist/cst/Document.js +23 -28
  79. package/dist/cst/FlowCollection.js +21 -26
  80. package/dist/cst/Node.js +4 -9
  81. package/dist/cst/ParseContext.js +38 -43
  82. package/dist/cst/PlainValue.js +10 -15
  83. package/dist/cst/QuoteDouble.js +9 -14
  84. package/dist/cst/QuoteSingle.js +9 -14
  85. package/dist/cst/Range.js +2 -5
  86. package/dist/cst/parse.js +5 -10
  87. package/dist/cst/source-utils.js +0 -3
  88. package/dist/errors.js +4 -9
  89. package/dist/foldFlowLines.js +1 -4
  90. package/dist/index.js +59 -17
  91. package/dist/listTagNames.js +9 -14
  92. package/dist/schema/Alias.js +12 -17
  93. package/dist/schema/Collection.js +16 -20
  94. package/dist/schema/Map.js +12 -17
  95. package/dist/schema/Merge.js +13 -18
  96. package/dist/schema/Node.js +2 -5
  97. package/dist/schema/Pair.js +44 -31
  98. package/dist/schema/Scalar.js +6 -11
  99. package/dist/schema/Seq.js +9 -14
  100. package/dist/schema/index.js +22 -27
  101. package/dist/schema/parseMap.js +19 -28
  102. package/dist/schema/parseSeq.js +10 -15
  103. package/dist/schema/parseUtils.js +0 -3
  104. package/dist/stringify.js +6 -12
  105. package/dist/tags/core.js +34 -26
  106. package/dist/tags/failsafe/index.js +6 -11
  107. package/dist/tags/failsafe/map.js +8 -13
  108. package/dist/tags/failsafe/seq.js +8 -13
  109. package/dist/tags/failsafe/string.js +3 -6
  110. package/dist/tags/index.js +20 -29
  111. package/dist/tags/json.js +26 -22
  112. package/dist/tags/options.js +5 -4
  113. package/dist/tags/yaml-1.1/binary.js +11 -11
  114. package/dist/tags/yaml-1.1/index.js +69 -38
  115. package/dist/tags/yaml-1.1/omap.js +19 -24
  116. package/dist/tags/yaml-1.1/pairs.js +12 -17
  117. package/dist/tags/yaml-1.1/set.js +12 -21
  118. package/dist/tags/yaml-1.1/timestamp.js +0 -3
  119. package/dist/test-events.js +4 -9
  120. package/dist/toJSON.js +3 -5
  121. package/dist/warnings.js +31 -22
  122. package/index.d.ts +358 -0
  123. package/index.js +1 -1
  124. package/map.js +1 -1
  125. package/package.json +29 -23
  126. package/pair.js +1 -1
  127. package/parse-cst.d.ts +187 -0
  128. package/parse-cst.js +1 -1
  129. package/scalar.js +1 -1
  130. package/schema.js +2 -2
  131. package/seq.js +1 -1
  132. package/types/binary.js +1 -1
  133. package/types/omap.js +1 -1
  134. package/types/pairs.js +1 -1
  135. package/types/set.js +1 -1
  136. package/types/timestamp.js +1 -1
  137. package/types.d.ts +393 -0
  138. package/types.js +7 -6
  139. package/types.mjs +6 -5
  140. package/util.d.ts +86 -0
  141. package/util.js +6 -5
  142. package/util.mjs +4 -3
@@ -1,25 +1,38 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
4
  import _get from "@babel/runtime/helpers/get";
7
5
  import _inherits from "@babel/runtime/helpers/inherits";
6
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+
10
+ function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11
+
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
+
16
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
17
+
18
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
19
+
9
20
  import { YAMLSemanticError } from '../../errors';
10
- import YAMLMap, { findPair } from '../../schema/Map';
11
- import Pair from '../../schema/Pair';
12
- import parseMap from '../../schema/parseMap';
13
- import Scalar from '../../schema/Scalar';
21
+ import { YAMLMap, findPair } from '../../schema/Map';
22
+ import { Pair } from '../../schema/Pair';
23
+ import { parseMap } from '../../schema/parseMap';
24
+ import { Scalar } from '../../schema/Scalar';
14
25
  export var YAMLSet = /*#__PURE__*/function (_YAMLMap) {
15
26
  _inherits(YAMLSet, _YAMLMap);
16
27
 
28
+ var _super = _createSuper(YAMLSet);
29
+
17
30
  function YAMLSet() {
18
31
  var _this;
19
32
 
20
33
  _classCallCheck(this, YAMLSet);
21
34
 
22
- _this = _possibleConstructorReturn(this, _getPrototypeOf(YAMLSet).call(this));
35
+ _this = _super.call(this);
23
36
  _this.tag = YAMLSet.tag;
24
37
  return _this;
25
38
  }
@@ -75,34 +88,25 @@ function parseSet(doc, cst) {
75
88
 
76
89
  function createSet(schema, iterable, ctx) {
77
90
  var set = new YAMLSet();
78
- var _iteratorNormalCompletion = true;
79
- var _didIteratorError = false;
80
- var _iteratorError = undefined;
91
+
92
+ var _iterator = _createForOfIteratorHelper(iterable),
93
+ _step;
81
94
 
82
95
  try {
83
- for (var _iterator = iterable[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
96
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
84
97
  var value = _step.value;
85
98
  set.items.push(schema.createPair(value, null, ctx));
86
99
  }
87
100
  } catch (err) {
88
- _didIteratorError = true;
89
- _iteratorError = err;
101
+ _iterator.e(err);
90
102
  } finally {
91
- try {
92
- if (!_iteratorNormalCompletion && _iterator.return != null) {
93
- _iterator.return();
94
- }
95
- } finally {
96
- if (_didIteratorError) {
97
- throw _iteratorError;
98
- }
99
- }
103
+ _iterator.f();
100
104
  }
101
105
 
102
106
  return set;
103
107
  }
104
108
 
105
- export default {
109
+ export var set = {
106
110
  identify: function identify(value) {
107
111
  return value instanceof Set;
108
112
  },
@@ -1,14 +1,14 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import parseCST from './cst/parse';
3
- import Document from './Document'; // test harness for yaml-test-suite event tests
2
+ import { parse } from './cst/parse';
3
+ import { Document } from './Document'; // test harness for yaml-test-suite event tests
4
4
 
5
- export default function testEvents(src, options) {
5
+ export function testEvents(src, options) {
6
6
  var opt = Object.assign({
7
7
  keepCstNodes: true,
8
8
  keepNodeTypes: true,
9
9
  version: '1.2'
10
10
  }, options);
11
- var docs = parseCST(src).map(function (cstDoc) {
11
+ var docs = parse(src).map(function (cstDoc) {
12
12
  return new Document(opt).parse(cstDoc);
13
13
  });
14
14
  var errDoc = docs.find(function (doc) {
@@ -1,12 +1,10 @@
1
- export default function toJSON(value, arg, ctx) {
1
+ export function toJSON(value, arg, ctx) {
2
2
  if (Array.isArray(value)) return value.map(function (v, i) {
3
3
  return toJSON(v, String(i), ctx);
4
4
  });
5
5
 
6
6
  if (value && typeof value.toJSON === 'function') {
7
- var anchor = ctx && ctx.anchors && ctx.anchors.find(function (a) {
8
- return a.node === value;
9
- });
7
+ var anchor = ctx && ctx.anchors && ctx.anchors.get(value);
10
8
  if (anchor) ctx.onCreate = function (res) {
11
9
  anchor.res = res;
12
10
  delete ctx.onCreate;
@@ -16,5 +14,6 @@ export default function toJSON(value, arg, ctx) {
16
14
  return res;
17
15
  }
18
16
 
17
+ if ((!ctx || !ctx.keep) && typeof value === 'bigint') return Number(value);
19
18
  return value;
20
19
  }
@@ -1,28 +1,39 @@
1
- /* global global, console */
2
- export function warn(warning, type) {
3
- if (global && global._YAML_SILENCE_WARNINGS) return;
1
+ /* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */
2
+ function shouldWarn(deprecation) {
3
+ var env = typeof process !== 'undefined' && process.env || {};
4
4
 
5
- var _ref = global && global.process,
6
- emitWarning = _ref.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
7
- // https://github.com/facebook/jest/issues/2549
5
+ if (deprecation) {
6
+ if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS;
7
+ return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
8
+ }
8
9
 
10
+ if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS;
11
+ return !env.YAML_SILENCE_WARNINGS;
12
+ }
9
13
 
10
- if (emitWarning) emitWarning(warning, type);else {
11
- // eslint-disable-next-line no-console
12
- console.warn(type ? "".concat(type, ": ").concat(warning) : warning);
14
+ export function warn(warning, type) {
15
+ if (shouldWarn(false)) {
16
+ var emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
17
+ // https://github.com/facebook/jest/issues/2549
18
+
19
+ if (emit) emit(warning, type);else {
20
+ // eslint-disable-next-line no-console
21
+ console.warn(type ? "".concat(type, ": ").concat(warning) : warning);
22
+ }
13
23
  }
14
24
  }
15
25
  export function warnFileDeprecation(filename) {
16
- if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
17
- var path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
18
- warn("The endpoint 'yaml/".concat(path, "' will be removed in a future release."), 'DeprecationWarning');
26
+ if (shouldWarn(true)) {
27
+ var path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
28
+ warn("The endpoint 'yaml/".concat(path, "' will be removed in a future release."), 'DeprecationWarning');
29
+ }
19
30
  }
20
31
  var warned = {};
21
32
  export function warnOptionDeprecation(name, alternative) {
22
- if (global && global._YAML_SILENCE_DEPRECATION_WARNINGS) return;
23
- if (warned[name]) return;
24
- warned[name] = true;
25
- var msg = "The option '".concat(name, "' will be removed in a future release");
26
- msg += alternative ? ", use '".concat(alternative, "' instead.") : '.';
27
- warn(msg, 'DeprecationWarning');
33
+ if (!warned[name] && shouldWarn(true)) {
34
+ warned[name] = true;
35
+ var msg = "The option '".concat(name, "' will be removed in a future release");
36
+ msg += alternative ? ", use '".concat(alternative, "' instead.") : '.';
37
+ warn(msg, 'DeprecationWarning');
38
+ }
28
39
  }
package/browser/index.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./dist').default
1
+ export { YAML as default } from './dist'
package/browser/map.js CHANGED
@@ -1,2 +1,4 @@
1
- module.exports = require('./dist/schema/Map').default
2
- require('./dist/warnings').warnFileDeprecation(__filename)
1
+ export { YAMLMap as default } from './dist/schema/Map'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
package/browser/pair.js CHANGED
@@ -1,2 +1,4 @@
1
- module.exports = require('./dist/schema/Pair').default
2
- require('./dist/warnings').warnFileDeprecation(__filename)
1
+ export { Pair as default } from './dist/schema/Pair'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
@@ -1 +1 @@
1
- module.exports = require('./dist/cst/parse').default
1
+ export { parse as default } from './dist/cst/parse'
package/browser/scalar.js CHANGED
@@ -1,2 +1,4 @@
1
- module.exports = require('./dist/schema/Scalar').default
2
- require('./dist/warnings').warnFileDeprecation(__filename)
1
+ export { Scalar as default } from './dist/schema/Scalar'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
package/browser/schema.js CHANGED
@@ -1,7 +1,12 @@
1
- module.exports = require('./dist/schema').default
2
- var opt = require('./dist/tags/options')
3
- module.exports.nullOptions = opt.nullOptions
4
- module.exports.strOptions = opt.strOptions
5
- module.exports.stringify = require('./dist/stringify').stringifyString
1
+ import { Schema } from './dist/schema'
2
+ import { nullOptions, strOptions } from './dist/tags/options'
3
+ import { stringifyString } from './dist/stringify'
6
4
 
7
- require('./dist/warnings').warnFileDeprecation(__filename)
5
+ Schema.nullOptions = nullOptions
6
+ Schema.strOptions = strOptions
7
+ Schema.stringify = stringifyString
8
+ export { Schema as default }
9
+ export { nullOptions, strOptions, stringifyString as stringify }
10
+
11
+ import { warnFileDeprecation } from './dist/warnings'
12
+ warnFileDeprecation(__filename)
package/browser/seq.js CHANGED
@@ -1,2 +1,4 @@
1
- module.exports = require('./dist/schema/Seq').default
2
- require('./dist/warnings').warnFileDeprecation(__filename)
1
+ export { YAMLSeq as default } from './dist/schema/Seq'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
@@ -1,7 +1,6 @@
1
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', { value: true })
1
+ import { binary } from '../dist/tags/yaml-1.1/binary'
2
+ export { binary }
3
+ export default [binary]
3
4
 
4
- exports.binary = require('../dist/tags/yaml-1.1/binary').default
5
- exports.default = [exports.binary]
6
-
7
- require('../dist/warnings').warnFileDeprecation(__filename)
5
+ import { warnFileDeprecation } from './dist/warnings'
6
+ warnFileDeprecation(__filename)
@@ -1,2 +1,4 @@
1
- module.exports = require('../dist/tags/yaml-1.1/omap').default
2
- require('../dist/warnings').warnFileDeprecation(__filename)
1
+ export { omap as default } from '../dist/tags/yaml-1.1/omap'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
@@ -1,2 +1,4 @@
1
- module.exports = require('../dist/tags/yaml-1.1/pairs').default
2
- require('../dist/warnings').warnFileDeprecation(__filename)
1
+ export { pairs as default } from '../dist/tags/yaml-1.1/pairs'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
@@ -1,2 +1,4 @@
1
- module.exports = require('../dist/tags/yaml-1.1/set').default
2
- require('../dist/warnings').warnFileDeprecation(__filename)
1
+ export { set as default } from '../dist/tags/yaml-1.1/set'
2
+
3
+ import { warnFileDeprecation } from './dist/warnings'
4
+ warnFileDeprecation(__filename)
@@ -1,10 +1,6 @@
1
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', { value: true })
1
+ import { floatTime, intTime, timestamp } from '../dist/tags/yaml-1.1/timestamp'
2
+ export { floatTime, intTime, timestamp }
3
+ export default [intTime, floatTime, timestamp]
3
4
 
4
- var ts = require('../dist/tags/yaml-1.1/timestamp')
5
- exports.default = [ts.intTime, ts.floatTime, ts.timestamp]
6
- exports.floatTime = ts.floatTime
7
- exports.intTime = ts.intTime
8
- exports.timestamp = ts.timestamp
9
-
10
- require('../dist/warnings').warnFileDeprecation(__filename)
5
+ import { warnFileDeprecation } from './dist/warnings'
6
+ warnFileDeprecation(__filename)
package/browser/types.js CHANGED
@@ -1,11 +1,13 @@
1
- var opt = require('./dist/tags/options')
2
- exports.binaryOptions = opt.binaryOptions
3
- exports.boolOptions = opt.boolOptions
4
- exports.nullOptions = opt.nullOptions
5
- exports.strOptions = opt.strOptions
1
+ export {
2
+ binaryOptions,
3
+ boolOptions,
4
+ intOptions,
5
+ nullOptions,
6
+ strOptions
7
+ } from './dist/tags/options'
6
8
 
7
- exports.Schema = require('./dist/schema').default
8
- exports.YAMLMap = require('./dist/schema/Map').default
9
- exports.YAMLSeq = require('./dist/schema/Seq').default
10
- exports.Pair = require('./dist/schema/Pair').default
11
- exports.Scalar = require('./dist/schema/Scalar').default
9
+ export { Schema } from './dist/schema'
10
+ export { YAMLMap } from './dist/schema/Map'
11
+ export { YAMLSeq } from './dist/schema/Seq'
12
+ export { Pair } from './dist/schema/Pair'
13
+ export { Scalar } from './dist/schema/Scalar'
package/browser/util.js CHANGED
@@ -1,15 +1,18 @@
1
- exports.findPair = require('./dist/schema/Map').findPair
2
- exports.parseMap = require('./dist/schema/parseMap').default
3
- exports.parseSeq = require('./dist/schema/parseSeq').default
1
+ export { findPair } from './dist/schema/Map'
2
+ export { parseMap } from './dist/schema/parseMap'
3
+ export { parseSeq } from './dist/schema/parseSeq'
4
4
 
5
- var str = require('./dist/stringify')
6
- exports.stringifyNumber = str.stringifyNumber
7
- exports.stringifyString = str.stringifyString
8
- exports.toJSON = require('./dist/toJSON').default
9
- exports.Type = require('./dist/constants').Type
5
+ export {
6
+ stringifyNumber,
7
+ stringifyString,
8
+ toJSON,
9
+ Type
10
+ } from './dist/stringify'
10
11
 
11
- var err = require('./dist/errors')
12
- exports.YAMLReferenceError = err.YAMLReferenceError
13
- exports.YAMLSemanticError = err.YAMLSemanticError
14
- exports.YAMLSyntaxError = err.YAMLSyntaxError
15
- exports.YAMLWarning = err.YAMLWarning
12
+ export {
13
+ YAMLError,
14
+ YAMLReferenceError,
15
+ YAMLSemanticError,
16
+ YAMLSyntaxError,
17
+ YAMLWarning
18
+ } from './dist/errors'
package/dist/Anchors.js CHANGED
@@ -1,27 +1,22 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
3
+ exports.Anchors = void 0;
7
4
 
8
- var _Alias = _interopRequireDefault(require("./schema/Alias"));
5
+ var _Alias = require("./schema/Alias");
9
6
 
10
- var _Map = _interopRequireDefault(require("./schema/Map"));
7
+ var _Map = require("./schema/Map");
11
8
 
12
- var _Merge = _interopRequireDefault(require("./schema/Merge"));
9
+ var _Merge = require("./schema/Merge");
13
10
 
14
- var _Scalar = _interopRequireDefault(require("./schema/Scalar"));
11
+ var _Scalar = require("./schema/Scalar");
15
12
 
16
- var _Seq = _interopRequireDefault(require("./schema/Seq"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ var _Seq = require("./schema/Seq");
19
14
 
20
15
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
16
 
22
17
  class Anchors {
23
18
  static validAnchorNode(node) {
24
- return node instanceof _Scalar.default || node instanceof _Seq.default || node instanceof _Map.default;
19
+ return node instanceof _Scalar.Scalar || node instanceof _Seq.YAMLSeq || node instanceof _Map.YAMLMap;
25
20
  }
26
21
 
27
22
  constructor(prefix) {
@@ -32,15 +27,15 @@ class Anchors {
32
27
 
33
28
  createAlias(node, name) {
34
29
  this.setAnchor(node, name);
35
- return new _Alias.default(node);
30
+ return new _Alias.Alias(node);
36
31
  }
37
32
 
38
33
  createMergePair(...sources) {
39
- const merge = new _Merge.default();
34
+ const merge = new _Merge.Merge();
40
35
  merge.value.items = sources.map(s => {
41
- if (s instanceof _Alias.default) {
42
- if (s.source instanceof _Map.default) return s;
43
- } else if (s instanceof _Map.default) {
36
+ if (s instanceof _Alias.Alias) {
37
+ if (s.source instanceof _Map.YAMLMap) return s;
38
+ } else if (s instanceof _Map.YAMLMap) {
44
39
  return this.createAlias(s);
45
40
  }
46
41
 
@@ -122,4 +117,4 @@ class Anchors {
122
117
 
123
118
  }
124
119
 
125
- exports.default = Anchors;
120
+ exports.Anchors = Anchors;