Skip to content

Commit cdc1153

Browse files
deps: Bump js-yaml from 4.3.1 to 5.4.2 (#1558)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.3.1 to 5.4.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md">js-yaml's changelog</a>.</em></p> <blockquote> <h2>[5.4.1] - 2026-08-26</h2> <h3>Changed</h3> <ul> <li>Hard-limit merge sequence size to 100.</li> </ul> <h3>Security</h3> <ul> <li>Count empty mappings in merge sequences toward <code>maxTotalMergeKeys</code> to limit CPU usage, <a href="https://redirect.github.com/nodeca/js-yaml/issues/797">#797</a>.</li> </ul> <h2>[5.4.0] - 2026-08-25</h2> <h3>Added</h3> <ul> <li>Added the <code>scalarStyleRules</code> dumper option to customize string formatting. See <a href="https://github.com/nodeca/js-yaml/blob/master/docs/scalar_styling.md">Scalar styling</a> for details.</li> </ul> <h3>Changed</h3> <ul> <li>[breaking] Flattened the low-level AST node style representation. Scalar and collection nodes now use <code>SCALAR_STYLE</code> and <code>COLLECTION_STYLE</code> values; explicit tags use the separate <code>tagged</code> property. Alias nodes now contain only <code>kind</code> and <code>anchor</code>. This only affects code that directly constructs or edits AST nodes.</li> <li>[breaking] The <code>sortKeys</code> option was rewritten using AST mutation to avoid side effects.</li> <li>Reworked scalar style selection. This can change formatting without changing loaded values; in particular, whitespace-only strings are now double-quoted.</li> </ul> <h3>Fixed</h3> <ul> <li>Accept a byte order mark at the start of each document in a stream, <a href="https://redirect.github.com/nodeca/js-yaml/issues/791">#791</a>.</li> <li>Produce valid flow mappings with <code>quoteFlowKeys</code> and <code>flowSkipColonSpace</code>, including alias and property-only keys, <a href="https://redirect.github.com/nodeca/js-yaml/issues/786">#786</a>.</li> <li>Preserve empty scalar items when converting block sequences to flow style.</li> <li>Do not apply the 1024-character simple-key limit to flow mapping keys.</li> <li>Count Unicode code points, rather than UTF-16 code units, for the 1024-character simple-key limit.</li> <li>Add an explicit document-end marker after keep-chomped block scalars when needed to preserve trailing newlines.</li> </ul> <h2>[5.3.0] - 2026-08-14</h2> <p>This release focuses on reworking the documentation and making small architectural improvements before moving forward.</p> <h3>Added</h3> <ul> <li>Added completely new documentation.</li> <li>Exported <code>DUMP_SCHEMA</code>, the default schema used by the dumper.</li> <li>Added <code>YAMLException.throwAt()</code> for throwing an error at a source position.</li> </ul> <h3>Changed</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/nodeca/js-yaml/commit/e5a3ba0efee53629b979f784cd53736f89ea61b6"><code>e5a3ba0</code></a> 5.4.1 released</li> <li><a href="https://github.com/nodeca/js-yaml/commit/e54dea33166d429220f7754e8c7ec548e3574ac3"><code>e54dea3</code></a> Hard-limit merge sequence size to 100</li> <li><a href="https://github.com/nodeca/js-yaml/commit/dfd3a2933c69959fc16fce1a775f36c9a5c89063"><code>dfd3a29</code></a> Cleanup 6a8e05f, <a href="https://redirect.github.com/nodeca/js-yaml/issues/797">#797</a></li> <li><a href="https://github.com/nodeca/js-yaml/commit/6a8e05f9a485188ed730ac81e81ae221352ef480"><code>6a8e05f</code></a> fix: count empty merge sources against maxTotalMergeKeys (<a href="https://redirect.github.com/nodeca/js-yaml/issues/797">#797</a>)</li> <li><a href="https://github.com/nodeca/js-yaml/commit/6b4ff5e92474186b0c0381021ba4120f883c1995"><code>6b4ff5e</code></a> 5.4.0 released</li> <li><a href="https://github.com/nodeca/js-yaml/commit/3b3625eb8398d5f6275603e6d22eea87e37fbf4f"><code>3b3625e</code></a> Update changelog</li> <li><a href="https://github.com/nodeca/js-yaml/commit/4f25a74a4347240cb93cad698538ac9e645e5488"><code>4f25a74</code></a> Fix file name</li> <li><a href="https://github.com/nodeca/js-yaml/commit/3bd003bdd6e1fd4864310cbfcf9aec7ce75176df"><code>3bd003b</code></a> Expose new scalar styling API</li> <li><a href="https://github.com/nodeca/js-yaml/commit/fbb3e9d6a0ac540c69562638287e586ef0e65290"><code>fbb3e9d</code></a> Remove regex lookbehind for ES2015 compatibility</li> <li><a href="https://github.com/nodeca/js-yaml/commit/d43c185985e3c5906e331c034aa28833c8a15e14"><code>d43c185</code></a> Fix <code>flowSkipColonSpace</code> by forcing <code>quoteFlowKeys</code></li> <li>Additional commits viewable in <a href="https://github.com/nodeca/js-yaml/compare/4.3.1...5.4.1">compare view</a></li> </ul> </details> <br /> > **Note** > Automatic rebases have been disabled on this pull request as it has been open for over 30 days. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: d3xter666 <yavor.ivanov@sap.com>
1 parent 7c809cf commit cdc1153

15 files changed

Lines changed: 180 additions & 22 deletions

File tree

‎internal/benchmark/lib/ConfigurationLoader.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import yaml from "js-yaml";
1+
import {load as yamlLoad} from "js-yaml";
22
import Configuration from "./benchmark/Configuration.js";
33

44
/**
@@ -37,7 +37,7 @@ export default class ConfigurationLoader {
3737

3838
let parsedYaml;
3939
try {
40-
parsedYaml = yaml.load(fileContents);
40+
parsedYaml = yamlLoad(fileContents);
4141
} catch (error) {
4242
throw new Error(`Failed to parse YAML configuration: ${error.message}`);
4343
}

‎internal/benchmark/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
},
2020
"devDependencies": {
2121
"eslint": "^10.11.0",
22-
"js-yaml": "^4.3.1"
22+
"js-yaml": "^5.4.2"
2323
}
2424
}

‎package-lock.json‎

Lines changed: 71 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/cli/lib/cli/commands/init.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ initCommand.handler = async function() {
1212
const {default: init} = await import("../../init/init.js");
1313
const {default: path} = await import("node:path");
1414
const {writeFile} = await import("node:fs/promises");
15-
const {default: jsYaml} = await import("js-yaml");
15+
const {dump: jsYamlDump} = await import("js-yaml");
1616

1717
const yamlPath = path.resolve("./ui5.yaml");
1818
if (await exists(yamlPath)) {
1919
throw new Error("Initialization not possible: ui5.yaml already exists");
2020
}
2121

2222
const projectConfig = await init();
23-
const yaml = jsYaml.dump(projectConfig, {quotingType: `"`});
23+
const yaml = jsYamlDump(projectConfig, {quoteStyle: "double"});
2424

2525
await writeFile(yamlPath, yaml);
2626
process.stdout.write(`Wrote ui5.yaml to ${yamlPath}:`);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {CORE_SCHEMA, mergeTag, timestampTag} from "js-yaml";
2+
3+
// js-yaml v5 defaults to CORE_SCHEMA (YAML 1.2), which drops merge key ("<<:")
4+
// and implicit timestamp support that were present in v4's DEFAULT_SCHEMA.
5+
// Restore both by extending CORE_SCHEMA with the two tags.
6+
// YAML11_SCHEMA is deliberately avoided: it additionally changes scalar resolution
7+
// (yes/no/on/off → boolean, 0-prefixed numbers → octal).
8+
export default CORE_SCHEMA.withTags([mergeTag, timestampTag]);

‎packages/cli/lib/framework/updateYaml.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import path from "node:path";
22
import {readFile, writeFile} from "node:fs/promises";
33
import {loadAll, dump} from "js-yaml";
4+
import ui5YamlSchema from "./ui5YamlSchema.js";
45
import {fromYaml, getPosition, getValue, getKind} from "data-with-position";
56
import {getLogger} from "@ui5/logger";
67

78
const log = getLogger("cli:framework:updateYaml");
89

910
function getProjectYamlDocument({project, configFile, configPath}) {
1011
const configs = loadAll(configFile, undefined, {
11-
filename: configPath
12+
filename: configPath,
13+
schema: ui5YamlSchema
1214
});
1315

1416
const projectDocumentIndex = configs.findIndex((config) => {
@@ -277,7 +279,7 @@ export default async function({project, configPathOverride, data}) {
277279

278280
// Validate content before writing
279281
try {
280-
loadAll(adoptedYaml);
282+
loadAll(adoptedYaml, undefined, {schema: ui5YamlSchema});
281283
} catch (err) {
282284
const error = new Error("Failed to update YAML file: " + err.message);
283285
error.name = "FrameworkUpdateYamlFailed";

‎packages/cli/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"chalk": "^6.0.0",
5959
"data-with-position": "^0.5.0",
6060
"import-local": "^3.2.0",
61-
"js-yaml": "^4.3.1",
61+
"js-yaml": "^5.4.2",
6262
"open": "^11.0.4",
6363
"pretty-hrtime": "^1.0.3",
6464
"semver": "^7.8.5",

‎packages/cli/test/lib/cli/commands/init.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ test.serial("Writes ui5.yaml to fs", async (t) => {
4444

4545
t.is(fsWriteFileStub.getCall(0).args[0], ui5YamlPath, "Passes yaml path to write the yaml file to");
4646
t.is(fsWriteFileStub.getCall(0).args[1], ui5Yaml, "Passes yaml content to write to fs");
47-
t.deepEqual(jsyamlDumpStub.getCall(0).args[1], {quotingType: `"`}, "Enforce usage of double quotes in yaml files");
47+
t.deepEqual(jsyamlDumpStub.getCall(0).args[1],
48+
{quoteStyle: "double"}, "Enforce usage of double quotes in yaml files");
4849
});
4950

5051
test.serial("Error: throws if ui5.yaml already exists", async (t) => {

‎packages/project/lib/graph/Module.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import fs from "graceful-fs";
22
import path from "node:path";
33
import {promisify} from "node:util";
44
const readFile = promisify(fs.readFile);
5-
import jsyaml from "js-yaml";
5+
import {loadAll as jsyamlLoadAll} from "js-yaml";
6+
import ui5YamlSchema from "./helpers/ui5YamlSchema.js";
67
import {createReader} from "@ui5/fs/resourceFactory";
78
import Specification from "../specifications/Specification.js";
89
import {validate} from "../validation/validator.js";
@@ -318,12 +319,11 @@ class Module {
318319
let configs;
319320

320321
try {
321-
// Using loadAll with DEFAULT_SAFE_SCHEMA instead of safeLoadAll to pass "filename".
322-
// safeLoadAll doesn't handle its parameters properly.
323-
// See https://github.com/nodeca/js-yaml/issues/456 and https://github.com/nodeca/js-yaml/pull/381
324-
configs = jsyaml.loadAll(configFile, undefined, {
322+
// Use ui5YamlSchema (CORE_SCHEMA + mergeTag) to preserve v4 DEFAULT_SCHEMA
323+
// behaviour.
324+
configs = jsyamlLoadAll(configFile, undefined, {
325325
filename: configPath,
326-
schema: jsyaml.DEFAULT_SAFE_SCHEMA
326+
schema: ui5YamlSchema
327327
});
328328
} catch (err) {
329329
if (err.name === "YAMLException") {

‎packages/project/lib/graph/graph.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,16 @@ const utils = {
199199
const {promisify} = await import("util");
200200
const readFile = promisify(fs.readFile);
201201
const parseYaml =(await import("js-yaml")).load;
202+
const {default: ui5YamlSchema} = await import("./helpers/ui5YamlSchema.js");
202203

203204
filePath = utils.resolveConfigPath(cwd, filePath);
204205

205206
let dependencyTree;
206207
try {
207208
const contents = await readFile(filePath, {encoding: "utf-8"});
208209
dependencyTree = parseYaml(contents, {
209-
filename: filePath
210+
filename: filePath,
211+
schema: ui5YamlSchema
210212
});
211213
utils.resolveProjectPaths(cwd, dependencyTree);
212214
} catch (err) {

0 commit comments

Comments
 (0)