Skip to content

Commit 65d75cd

Browse files
Update js-yaml to 4.0.5 (opensearch-project#3659)
Co-authored-by: Sergey Myssak <sergey.myssak@gmail.com> Signed-off-by: Andrey Myssak <andreymyssak@gmail.com>
1 parent eb49f7f commit 65d75cd

File tree

12 files changed

+25
-25
lines changed

12 files changed

+25
-25
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
"inline-style": "^2.0.0",
184184
"ip-cidr": "^2.1.0",
185185
"joi": "^13.5.2",
186-
"js-yaml": "^3.14.0",
186+
"js-yaml": "^4.1.0",
187187
"json-stable-stringify": "^1.0.1",
188188
"json-stringify-safe": "5.0.1",
189189
"lodash": "^4.17.21",
@@ -287,7 +287,7 @@
287287
"@types/jest": "^27.4.0",
288288
"@types/joi": "^13.4.2",
289289
"@types/jquery": "^3.3.31",
290-
"@types/js-yaml": "^3.11.1",
290+
"@types/js-yaml": "^4.0.5",
291291
"@types/json-stable-stringify": "^1.0.32",
292292
"@types/json5": "^0.0.30",
293293
"@types/license-checker": "15.0.0",

packages/osd-apm-config-loader/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"@elastic/safer-lodash-set": "0.0.0",
1515
"@osd/utils": "1.0.0",
16-
"js-yaml": "^3.14.0",
16+
"js-yaml": "^4.1.0",
1717
"lodash": "^4.17.21"
1818
},
1919
"devDependencies": {

packages/osd-apm-config-loader/src/utils/read_config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
*/
3030

3131
import { readFileSync } from 'fs';
32-
import { safeLoad } from 'js-yaml';
32+
import { load } from 'js-yaml';
3333

3434
import { set } from '@elastic/safer-lodash-set';
3535
import { isPlainObject } from 'lodash';
3636
import { ensureDeepObject } from './ensure_deep_object';
3737

38-
const readYaml = (path: string) => safeLoad(readFileSync(path, 'utf8'));
38+
const readYaml = (path: string) => load(readFileSync(path, 'utf8'));
3939

4040
function replaceEnvVarRefs(val: string) {
4141
return val.replace(/\$\{(\w+)\}/g, (match, envVarName) => {

packages/osd-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@osd/config-schema": "1.0.0",
1515
"@osd/logging": "1.0.0",
1616
"@osd/std": "1.0.0",
17-
"js-yaml": "^3.14.0",
17+
"js-yaml": "^4.1.0",
1818
"load-json-file": "^6.2.0",
1919
"lodash": "^4.17.21",
2020
"moment": "^2.24.0",

packages/osd-config/src/raw/read_config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
*/
3030

3131
import { readFileSync } from 'fs';
32-
import { safeLoad } from 'js-yaml';
32+
import { load } from 'js-yaml';
3333

3434
import { set } from '@elastic/safer-lodash-set';
3535
import { isPlainObject } from 'lodash';
3636
import { ensureDeepObject } from './ensure_deep_object';
3737

38-
const readYaml = (path: string) => safeLoad(readFileSync(path, 'utf8'));
38+
const readYaml = (path: string) => load(readFileSync(path, 'utf8'));
3939

4040
function replaceEnvVarRefs(val: string) {
4141
return val.replace(/\$\{(\w+)\}/g, (match, envVarName) => {

packages/osd-optimizer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"execa": "^4.0.2",
2828
"fibers": "^5.0.3",
2929
"jest-diff": "^27.5.1",
30-
"js-yaml": "^3.14.0",
30+
"js-yaml": "^4.1.0",
3131
"json-stable-stringify": "^1.0.1",
3232
"lmdb-store": "^1.6.11",
3333
"normalize-path": "^3.0.0",

packages/osd-optimizer/src/limits.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function readLimits(): Limits {
5151
}
5252
}
5353

54-
return yaml ? (Yaml.safeLoad(yaml) as any) : {};
54+
return yaml ? (Yaml.load(yaml) as any) : {};
5555
}
5656

5757
export function validateLimitsForAllBundles(log: ToolingLog, config: OptimizerConfig) {
@@ -109,6 +109,6 @@ export function updateBundleLimits(log: ToolingLog, config: OptimizerConfig) {
109109
pageLoadAssetSize,
110110
};
111111

112-
Fs.writeFileSync(LIMITS_PATH, Yaml.safeDump(newLimits));
112+
Fs.writeFileSync(LIMITS_PATH, Yaml.dump(newLimits));
113113
log.success(`wrote updated limits to ${LIMITS_PATH}`);
114114
}

src/cli/serve/integration_tests/reload_logging_config.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import Del from 'del';
3636

3737
import * as Rx from 'rxjs';
3838
import { map, filter, take } from 'rxjs/operators';
39-
import { safeDump } from 'js-yaml';
39+
import { dump } from 'js-yaml';
4040
import { getConfigFromFiles } from '@osd/config';
4141

4242
const legacyConfig = follow('__fixtures__/reload_logging_config/opensearch_dashboards.test.yml');
@@ -89,7 +89,7 @@ function createConfigManager(configPath: string) {
8989
return {
9090
modify(fn: (input: Record<string, any>) => Record<string, any>) {
9191
const oldContent = getConfigFromFiles([configPath]);
92-
const yaml = safeDump(fn(oldContent));
92+
const yaml = dump(fn(oldContent));
9393
Fs.writeFileSync(configPath, yaml);
9494
},
9595
};

src/dev/stylelint/lint_files.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
import stylelint from 'stylelint';
3232
import path from 'path';
33-
import { safeLoad } from 'js-yaml';
33+
import { load } from 'js-yaml';
3434
import fs from 'fs';
3535
import { createFailError } from '@osd/dev-utils';
3636

3737
// load the include globs from .stylelintrc.yml and convert them to regular expressions for filtering files
3838
const stylelintPath = path.resolve(__dirname, '..', '..', '..', '.stylelintrc.yml');
39-
const styleLintConfig = safeLoad(fs.readFileSync(stylelintPath));
39+
const styleLintConfig = load(fs.readFileSync(stylelintPath));
4040

4141
/**
4242
* Lints a list of files with eslint. eslint reports are written to the log

src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030

3131
import { accessSync, constants, readFileSync, statSync } from 'fs';
32-
import { safeLoad } from 'js-yaml';
32+
import { load } from 'js-yaml';
3333
import { dirname, join } from 'path';
3434
import { Observable } from 'rxjs';
3535

@@ -78,7 +78,7 @@ export async function readTelemetryFile<T extends object>(
7878
try {
7979
if (isFileReadable(configPath)) {
8080
const yaml = readFileSync(configPath);
81-
const data = safeLoad(yaml.toString());
81+
const data = load(yaml.toString());
8282

8383
// don't bother returning empty objects
8484
if (Object.keys(data).length) {

tasks/function_test_groups.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ import { resolve } from 'path';
3333

3434
import execa from 'execa';
3535
import grunt from 'grunt';
36-
import { safeLoad } from 'js-yaml';
36+
import { load } from 'js-yaml';
3737

3838
const JOBS_YAML = readFileSync(resolve(__dirname, '../.ci/jobs.yml'), 'utf8');
39-
const TEST_TAGS = safeLoad(JOBS_YAML)
39+
const TEST_TAGS = load(JOBS_YAML)
4040
.JOB.filter((id) => id.startsWith('opensearch-dashboards-ciGroup'))
4141
.map((id) => id.replace(/^opensearch-dashboards-/, ''));
4242

yarn.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -3126,10 +3126,10 @@
31263126
resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.5.tgz#38dfaacae8623b37cc0b0d27398e574e3fc28b1e"
31273127
integrity sha512-cpmwBRcHJmmZx0OGU7aPVwGWGbs4iKwVYchk9iuMtxNCA2zorwdaTz4GkLgs2WGxiRZRFKnV1k6tRUHX7tBMxg==
31283128

3129-
"@types/js-yaml@^3.11.1":
3130-
version "3.12.7"
3131-
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-3.12.7.tgz#330c5d97a3500e9c903210d6e49f02964af04a0e"
3132-
integrity sha512-S6+8JAYTE1qdsc9HMVsfY7+SgSuUU/Tp6TYTmITW0PZxiyIMvol3Gy//y69Wkhs0ti4py5qgR3uZH6uz/DNzJQ==
3129+
"@types/js-yaml@^4.0.5":
3130+
version "4.0.5"
3131+
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138"
3132+
integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==
31333133

31343134
"@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9":
31353135
version "7.0.11"
@@ -11234,14 +11234,14 @@ js-yaml-js-types@1.0.0:
1123411234
dependencies:
1123511235
esprima "^4.0.1"
1123611236

11237-
js-yaml@4.1.0:
11237+
js-yaml@4.1.0, js-yaml@^4.1.0:
1123811238
version "4.1.0"
1123911239
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
1124011240
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
1124111241
dependencies:
1124211242
argparse "^2.0.1"
1124311243

11244-
js-yaml@^3.13.1, js-yaml@^3.14.0, js-yaml@~3.14.0:
11244+
js-yaml@^3.13.1, js-yaml@~3.14.0:
1124511245
version "3.14.1"
1124611246
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
1124711247
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==

0 commit comments

Comments
 (0)