Reduce size of bundled js-yaml (#15819)

This commit is contained in:
fisker Cheung authored and GitHub committed 2023-12-18 08:19:26 +08:00
1 parent 0ff9efd015
commit 8c7ea9c7ed
2 files changed
+4 -3

No files matched your search

+2 -1
View File
@@ -603,7 +603,8 @@ const nodejsFiles = [
},
{
module: getPackageFile("js-yaml/dist/js-yaml.mjs"),
path: getPackageFile("js-yaml/lib/loader.js"),
find: "var dump = dumper.dump;",
replacement: "var dump;",
},
// `parse-json` use another copy of `@babel/code-frame`
{
@@ -1,7 +1,7 @@
import { pathToFileURL } from "node:url";
import parseToml from "@iarna/toml/parse-async.js";
import jsYaml from "js-yaml";
import { load as parseYaml } from "js-yaml";
import json5 from "json5";
import parseJson from "parse-json";
@@ -30,7 +30,7 @@ async function loadConfigFromPackageJson(file) {
async function loadYaml(file) {
const content = await readFile(file);
try {
return jsYaml.load(content);
return parseYaml(content);
} catch (/** @type {any} */ error) {
error.message = `YAML Error in ${file}:\n${error.message}`;
throw error;