yaml 3.0.0-0 → 3.0.0-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.
@@ -1,6 +1,5 @@
1
- import { h as warn, i as Document } from "./directives-CG6n4xSM.js";
2
- import { c as YAMLParseError, n as Composer, r as Parser, t as LineCounter, u as prettifyError } from "./line-counter-TFl552k_.js";
3
-
1
+ import { i as Document, y as warn } from "./directives-DqP9ea45.js";
2
+ import { c as YAMLParseError, n as Composer, r as Parser, t as LineCounter, u as prettifyError } from "./line-counter-B2FjSv3E.js";
4
3
  //#region src/public-api.ts
5
4
  function parseOptions(options) {
6
5
  const prettyErrors = options.prettyErrors !== false;
@@ -54,8 +53,10 @@ function parse(src, reviver, options) {
54
53
  const doc = parseDocument(src, options);
55
54
  if (!doc) return null;
56
55
  doc.warnings.forEach((warning) => warn(doc.options.logLevel, warning));
57
- if (doc.errors.length > 0) if (doc.options.logLevel !== "silent") throw doc.errors[0];
58
- else doc.errors = [];
56
+ if (doc.errors.length > 0) {
57
+ if (doc.options.logLevel !== "silent") throw doc.errors[0];
58
+ else doc.errors = [];
59
+ }
59
60
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
60
61
  }
61
62
  function stringify(value, replacer, options) {
@@ -74,6 +75,5 @@ function stringify(value, replacer, options) {
74
75
  if (value instanceof Document && !_replacer) return value.toString(options);
75
76
  return new Document(value, _replacer, options).toString(options);
76
77
  }
77
-
78
78
  //#endregion
79
- export { stringify as i, parseAllDocuments as n, parseDocument as r, parse as t };
79
+ export { stringify as i, parseAllDocuments as n, parseDocument as r, parse as t };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
@@ -1,7 +1,5 @@
1
- import { _ as Collection, b as Scalar, f as Alias, g as YAMLSeq, n as visit, p as Pair, u as YAMLMap, x as NodeBase } from "./directives-CG6n4xSM.js";
2
- import "./line-counter-TFl552k_.js";
3
- import { n as parseAllDocuments } from "./public-api-BE74JyVm.js";
4
-
1
+ import { S as Scalar, _ as YAMLMap, f as Pair, g as YAMLSeq, h as YAMLSet, m as isNode, n as visit, u as Alias } from "./directives-DqP9ea45.js";
2
+ import { n as parseAllDocuments } from "./public-api-uicovB0N.js";
5
3
  //#region src/test-events.ts
6
4
  const scalarChar = {
7
5
  BLOCK_FOLDED: ">",
@@ -58,9 +56,9 @@ function addEvents(events, doc, errPos, node) {
58
56
  events.push("=VAL :");
59
57
  return;
60
58
  }
61
- if (errPos !== -1 && node instanceof NodeBase && node.range[0] >= errPos) throw new Error();
59
+ if (errPos !== -1 && isNode(node) && node.range[0] >= errPos) throw new Error();
62
60
  let props = "";
63
- let anchor = node instanceof Scalar || node instanceof Collection ? node.anchor : void 0;
61
+ let anchor = isNode(node) ? node.anchor : void 0;
64
62
  if (anchor) {
65
63
  if (/\d$/.test(anchor)) {
66
64
  const alt = anchor.replace(/\d$/, "");
@@ -68,22 +66,30 @@ function addEvents(events, doc, errPos, node) {
68
66
  }
69
67
  props = ` &${anchor}`;
70
68
  }
71
- if (node instanceof NodeBase && node.tag) props += ` <${node.tag}>`;
69
+ if (isNode(node) && node.tag) props += ` <${node.tag}>`;
72
70
  if (node instanceof YAMLMap) {
73
71
  const ev = node.flow ? "+MAP {}" : "+MAP";
74
72
  events.push(`${ev}${props}`);
75
- node.items.forEach(({ key, value }) => {
73
+ for (const { key, value } of node.values.values()) {
76
74
  addEvents(events, doc, errPos, key);
77
75
  addEvents(events, doc, errPos, value);
78
- });
76
+ }
79
77
  events.push("-MAP");
80
78
  } else if (node instanceof YAMLSeq) {
81
79
  const ev = node.flow ? "+SEQ []" : "+SEQ";
82
80
  events.push(`${ev}${props}`);
83
- node.items.forEach((item) => {
81
+ node.forEach((item) => {
84
82
  addEvents(events, doc, errPos, item);
85
83
  });
86
84
  events.push("-SEQ");
85
+ } else if (node instanceof YAMLSet) {
86
+ const ev = node.flow ? "+MAP {}" : "+MAP";
87
+ events.push(`${ev}${props}`);
88
+ for (const value of node.values.values()) {
89
+ addEvents(events, doc, errPos, value);
90
+ events.push("=VAL :");
91
+ }
92
+ events.push("-MAP");
87
93
  } else if (node instanceof Pair) {
88
94
  events.push(`+MAP${props}`);
89
95
  addEvents(events, doc, errPos, node.key);
@@ -103,6 +109,5 @@ function addEvents(events, doc, errPos, node) {
103
109
  events.push(`=VAL${props} ${scalar}${value}`);
104
110
  } else throw new Error(`Unexpected node ${node}`);
105
111
  }
106
-
107
112
  //#endregion
108
- export { testEvents };
113
+ export { testEvents };
package/dist/util.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as LogLevelId, F as StringifyContext, H as warn, L as ToJSContext, M as findPair, R as toJS, V as debug, a as string, i as foldFlowLines, n as stringifyNumber, o as seq, r as FoldOptions, s as map, t as stringifyString, z as NodeCreator } from "./stringifyString-S_ITVLTO.js";
2
- export { type FoldOptions, type LogLevelId, type NodeCreator, type StringifyContext, type ToJSContext, debug, findPair, foldFlowLines, map as mapTag, seq as seqTag, string as stringTag, stringifyNumber, stringifyString, toJS, warn };
1
+ import { B as debug, I as NodeCreator, L as ToJSContext, R as StringifyContext, V as warn, _ as string, b as map, g as foldFlowLines, h as FoldOptions, m as stringifyNumber, p as stringifyString, v as seq, z as LogLevelId } from "./directives-CGITitH5.js";
2
+ export { type FoldOptions, type LogLevelId, type NodeCreator, type StringifyContext, ToJSContext, debug, foldFlowLines, map as mapTag, seq as seqTag, string as stringTag, stringifyNumber, stringifyString, warn };
package/dist/util.js CHANGED
@@ -1,3 +1,2 @@
1
- import { S as toJS, c as seq, d as findPair, h as warn, l as map, m as debug, o as stringifyNumber, s as string, v as stringifyString, y as foldFlowLines } from "./directives-CG6n4xSM.js";
2
-
3
- export { debug, findPair, foldFlowLines, map as mapTag, seq as seqTag, string as stringTag, stringifyNumber, stringifyString, toJS, warn };
1
+ import { b as stringifyString, c as seq, d as ToJSContext, l as map, o as stringifyNumber, s as string, v as debug, x as foldFlowLines, y as warn } from "./directives-DqP9ea45.js";
2
+ export { ToJSContext, debug, foldFlowLines, map as mapTag, seq as seqTag, string as stringTag, stringifyNumber, stringifyString, warn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "3.0.0-0",
3
+ "version": "3.0.0-2",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "funding": "https://github.com/sponsors/eemeli",
@@ -38,7 +38,7 @@
38
38
  "test": "vitest run",
39
39
  "test:all": "npm test && npm run test:types && npm run test:dist && npm run test:dist:types",
40
40
  "test:dist": "npm run build && vitest run",
41
- "test:dist:types": "tsc --allowJs --moduleResolution node --noEmit --target es5 dist/cli.js dist/index.js dist/test-events.js dist/util.js",
41
+ "test:dist:types": "tsc --ignoreConfig --allowJs --moduleResolution bundler --noEmit --target es2015 dist/cli.js dist/index.js dist/test-events.js dist/util.js",
42
42
  "test:types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
43
43
  "docs:install": "cd docs-slate && bundle install",
44
44
  "predocs:deploy": "node docs/prepare-docs.js",
@@ -55,15 +55,15 @@
55
55
  "trailingComma": "none"
56
56
  },
57
57
  "devDependencies": {
58
- "@eslint/js": "^9.9.1",
58
+ "@eslint/js": "^10.0.1",
59
59
  "@types/node": "^20.11.20",
60
- "eslint": "^9.9.1",
60
+ "eslint": "^10.10.0",
61
61
  "eslint-config-prettier": "^10.1.8",
62
62
  "fast-check": "^2.12.0",
63
63
  "prettier": "^3.0.2",
64
64
  "rolldown": "^1.0.0-beta.54",
65
- "rolldown-plugin-dts": "^0.22.1",
66
- "typescript": "^5.9.3",
65
+ "rolldown-plugin-dts": "^0.27.14",
66
+ "typescript": "^6.0.3",
67
67
  "typescript-eslint": "^8.4.0",
68
68
  "vitest": "^4.0.15"
69
69
  },
@@ -1,18 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) {
6
- __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- }
11
- if (!no_symbols) {
12
- __defProp(target, Symbol.toStringTag, { value: "Module" });
13
- }
14
- return target;
15
- };
16
-
17
- //#endregion
18
- export { __exportAll as t };