@jacebenson/jsn 4.3.11-dev.68 → 4.3.11-dev.69

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "4.3.11-dev.68",
3
+ "version": "4.3.11-dev.69",
4
4
  "description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "@inquirer/core": "^10.1.0",
32
32
  "@inquirer/prompts": "^7.5.1",
33
33
  "better-sqlite3": "^13.0.3",
34
- "js-yaml": "^4.1.1",
34
+ "js-yaml": "^5.5.0",
35
35
  "turndown": "^7.2.4"
36
36
  },
37
37
  "devDependencies": {
@@ -1,4 +1,5 @@
1
- import yaml from 'js-yaml';
1
+ // js-yaml 5 ships ESM-only named exports; there is no default export.
2
+ import { load as loadYaml, dump as dumpYaml } from 'js-yaml';
2
3
 
3
4
  const DEFAULT_DELIMITERS = ['---', '---'];
4
5
 
@@ -27,7 +28,8 @@ export function parseFrontmatter(input, options = {}) {
27
28
 
28
29
  const closeIndex = frontmatter.indexOf(`\n${close}`);
29
30
  const raw = closeIndex === -1 ? frontmatter : frontmatter.slice(0, closeIndex);
30
- const parsed = yaml.load(raw);
31
+ // js-yaml 5 throws on an empty document; an empty block means no metadata.
32
+ const parsed = raw.trim() === '' ? {} : loadYaml(raw);
31
33
  const data = parsed === undefined ? {} : parsed;
32
34
 
33
35
  if (closeIndex === -1) return { data, content: '' };
@@ -41,7 +43,7 @@ export function parseFrontmatter(input, options = {}) {
41
43
  /** Serialize docs metadata and body using gray-matter-compatible YAML framing. */
42
44
  export function stringifyFrontmatter(body, data, options = {}) {
43
45
  const [open, close] = delimiters(options);
44
- const yamlText = yaml.dump(data, options).trim();
46
+ const yamlText = dumpYaml(data, options).trim();
45
47
  const prefix = yamlText === '{}' ? '' : `${open}\n${yamlText}\n${close}\n`;
46
48
  const content = String(body);
47
49
  return prefix + (content.endsWith('\n') ? content : `${content}\n`);