[I18n] Remove JSON5 dependency from kbn-i18n (#26634) (#26681)

This commit is contained in:
Leanid Shutau 2018-12-05 12:01:52 +03:00 committed by GitHub
parent b4bb8f6e49
commit 3550fe0648
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 20 deletions

View file

@ -21,7 +21,6 @@
"@babel/preset-typescript": "^7.1.0",
"@kbn/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
"@types/json5": "^0.0.30",
"@types/react-intl": "^2.3.11",
"del": "^3.0.0",
"getopts": "^2.2.3",
@ -32,7 +31,6 @@
"intl-format-cache": "^2.1.0",
"intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.1.0",
"json5": "^2.0.1",
"prop-types": "^15.6.2",
"react": "^16.3.0",
"react-intl": "^2.7.0"

View file

@ -1,5 +1,5 @@
{
messages: {
test: 'test' // JSON5 test
"messages": {
"test": "test"
}
}

View file

@ -166,7 +166,7 @@ describe('I18n loader', () => {
});
});
test('should return translation messages from JSON5 file', async () => {
test('should return translation messages from JSON file', async () => {
i18nLoader.registerTranslationFile(
join(__dirname, './__fixtures__/test_plugin_2/translations/fr.json')
);

View file

@ -18,7 +18,6 @@
*/
import { readFile } from 'fs';
import * as JSON5 from 'json5';
import * as path from 'path';
import { promisify } from 'util';
@ -65,12 +64,12 @@ function getLocaleFromFileName(fullFileName: string) {
}
/**
* Loads file and parses it as JSON5
* Loads file and parses it as JSON
* @param pathToFile
* @returns
*/
async function loadFile(pathToFile: string): Promise<Translation> {
return JSON5.parse(await asyncReadFile(pathToFile, 'utf8'));
return JSON.parse(await asyncReadFile(pathToFile, 'utf8'));
}
/**

View file

@ -1306,11 +1306,6 @@
resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.32.tgz#121f6917c4389db3923640b2e68de5fa64dda88e"
integrity sha512-q9Q6+eUEGwQkv4Sbst3J4PNgDOvpuVuKj79Hl/qnmBMEIPzB5QoFRUtjcgcg2xNUZyYUGXBk5wYIBKHt0A+Mxw==
"@types/json5@^0.0.30":
version "0.0.30"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.30.tgz#44cb52f32a809734ca562e685c6473b5754a7818"
integrity sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==
"@types/jsonwebtoken@^7.2.7":
version "7.2.8"
resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-7.2.8.tgz#8d199dab4ddb5bba3234f8311b804d2027af2b3a"
@ -12463,13 +12458,6 @@ json5@^1.0.1:
dependencies:
minimist "^1.2.0"
json5@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.0.1.tgz#3d6d0d1066039eb50984e66a7840e4f4b7a2c660"
integrity sha512-t6N/86QDIRYvOL259jR5c5TbtMnekl2Ib314mGeMh37zAwjgbWHieqijPH7pWaogmJq1F2I4Sphg19U1s+ZnXQ==
dependencies:
minimist "^1.2.0"
jsonfile@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"