diff --git a/package-lock.json b/package-lock.json index 16bd0b40a8f..54683c8d4b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "form-data": "^4.0.0", "hpagent": "^1.2.0", "isomorphic-ws": "^5.0.0", - "js-yaml": "^4.1.0", + "js-yaml": "^5.1.0", "jsonpath-plus": "^10.3.0", "openid-client": "^6.1.3", "rfc4648": "^1.3.0", @@ -2283,9 +2283,9 @@ } }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.1.0.tgz", + "integrity": "sha512-s8VA5jkR8f22S3NAXmhKPFqGUduqZGlsufabVOgN14iTdw/RXcym7bKkbwjxLK9Yw2lEvvmJjFp119+KPeo8Kg==", "funding": [ { "type": "github", @@ -2301,7 +2301,7 @@ "argparse": "^2.0.1" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "js-yaml": "bin/js-yaml.mjs" } }, "node_modules/jsep": { diff --git a/package.json b/package.json index a7f9e505a35..1bcb3e1a388 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "form-data": "^4.0.0", "hpagent": "^1.2.0", "isomorphic-ws": "^5.0.0", - "js-yaml": "^4.1.0", + "js-yaml": "^5.1.0", "jsonpath-plus": "^10.3.0", "openid-client": "^6.1.3", "rfc4648": "^1.3.0", diff --git a/src/config.ts b/src/config.ts index 17a437ddb09..ddfef82e460 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,7 +2,7 @@ import fs from 'node:fs'; import https from 'node:https'; import http from 'node:http'; import tls from 'node:tls'; -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; import net from 'node:net'; import path from 'node:path'; diff --git a/src/yaml.ts b/src/yaml.ts index 09468a3e5d2..36e5495205d 100644 --- a/src/yaml.ts +++ b/src/yaml.ts @@ -1,4 +1,4 @@ -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; import { getSerializationType } from './util.js'; import { KubernetesObject } from './types.js'; import { ObjectSerializer } from './serializer.js'; @@ -26,7 +26,7 @@ export function loadYaml(data: string, opts?: yaml.LoadOptions): T { * @returns An array of deserialized Kubernetes objects. */ export function loadAllYaml(data: string, opts?: yaml.LoadOptions): any[] { - const ymls = yaml.loadAll(data, undefined, opts); + const ymls = yaml.loadAll(data, null, opts); return ymls.map((yml) => { const obj = yml as KubernetesObject; const type = getSerializationType(obj.apiVersion, obj.kind);