From ee4cb0801f9c65abaa21b3b166a2df3c1aea8472 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Wed, 31 Jul 2019 14:36:26 -0700 Subject: [PATCH 1/2] `@kyleshockey/js-yaml` -> `js-yaml` --- package-lock.json | 9 +++++++++ package.json | 2 +- src/plugins/editor/editor-plugins/json-to-yaml.js | 2 +- src/plugins/json-schema-validator/index.js | 2 +- .../topbar-insert/forms/components/AddForm.jsx | 2 +- .../components/ImportFileMenuItem.jsx | 2 +- src/standalone/topbar/topbar.jsx | 2 +- test/unit/plugins/json-schema-validator/index.js | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95b51d69233..c198f3fbd30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9092,6 +9092,15 @@ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", diff --git a/package.json b/package.json index 826a04abbec..4f676d58fee 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "watch": "webpack --config webpack/core.babel.js --watch --progress" }, "dependencies": { - "@kyleshockey/js-yaml": "^1.0.1", "ajv": "^5.2.2", "ajv-errors": "^1.0.1", "ajv-keywords": "^3.4.0", @@ -61,6 +60,7 @@ "file-dialog": "0.0.7", "immutable": "^3.x.x", "is-json": "^2.0.1", + "js-yaml": "^3.13.1", "json-beautify": "^1.0.1", "json-refs": "^3.0.4", "lodash": "^4.17.15", diff --git a/src/plugins/editor/editor-plugins/json-to-yaml.js b/src/plugins/editor/editor-plugins/json-to-yaml.js index 2f930d7ac13..0219e235835 100644 --- a/src/plugins/editor/editor-plugins/json-to-yaml.js +++ b/src/plugins/editor/editor-plugins/json-to-yaml.js @@ -1,4 +1,4 @@ -import YAML from "@kyleshockey/js-yaml" +import YAML from "js-yaml" export default function(editor) { editor.on("paste", e => { diff --git a/src/plugins/json-schema-validator/index.js b/src/plugins/json-schema-validator/index.js index 448b7132764..93eb2a2cc72 100644 --- a/src/plugins/json-schema-validator/index.js +++ b/src/plugins/json-schema-validator/index.js @@ -1,6 +1,6 @@ // JSON-Schema ( draf04 ) validator import JsonSchemaWebWorker from "./validator.worker.js" -import YAML from "@kyleshockey/js-yaml" +import YAML from "js-yaml" import PromiseWorker from "promise-worker" import debounce from "lodash/debounce" import swagger2SchemaYaml from "./swagger2-schema.yaml" diff --git a/src/standalone/topbar-insert/forms/components/AddForm.jsx b/src/standalone/topbar-insert/forms/components/AddForm.jsx index 06df30c57fd..2370d25536e 100644 --- a/src/standalone/topbar-insert/forms/components/AddForm.jsx +++ b/src/standalone/topbar-insert/forms/components/AddForm.jsx @@ -1,6 +1,6 @@ import React, { Component } from "react" import PropTypes from "prop-types" -import YAML from "@kyleshockey/js-yaml" +import YAML from "js-yaml" import { checkForErrors } from "../helpers/validation-helpers" class AddForm extends Component { diff --git a/src/standalone/topbar-menu-file-import_file/components/ImportFileMenuItem.jsx b/src/standalone/topbar-menu-file-import_file/components/ImportFileMenuItem.jsx index bfe2925b22b..3983f9a0ae1 100644 --- a/src/standalone/topbar-menu-file-import_file/components/ImportFileMenuItem.jsx +++ b/src/standalone/topbar-menu-file-import_file/components/ImportFileMenuItem.jsx @@ -2,7 +2,7 @@ import React, { Component } from "react" import PropTypes from "prop-types" import fileDialog from "file-dialog" -import YAML from "@kyleshockey/js-yaml" +import YAML from "js-yaml" import isJsonObject from "is-json" export default class ImportFileMenuItem extends Component { diff --git a/src/standalone/topbar/topbar.jsx b/src/standalone/topbar/topbar.jsx index 9c56862014d..cb60e412aea 100644 --- a/src/standalone/topbar/topbar.jsx +++ b/src/standalone/topbar/topbar.jsx @@ -5,7 +5,7 @@ import URL from "url" import "whatwg-fetch" import DropdownMenu from "./DropdownMenu" import reactFileDownload from "react-file-download" -import YAML from "@kyleshockey/js-yaml" +import YAML from "js-yaml" import beautifyJson from "json-beautify" import Logo from "./logo_small.svg" diff --git a/test/unit/plugins/json-schema-validator/index.js b/test/unit/plugins/json-schema-validator/index.js index 1d2df851154..4e5fed26651 100644 --- a/test/unit/plugins/json-schema-validator/index.js +++ b/test/unit/plugins/json-schema-validator/index.js @@ -1,4 +1,4 @@ -import YAML from "@kyleshockey/js-yaml" +import YAML from "js-yaml" import JSONSchemaValidator from "src/plugins/json-schema-validator/validator/index.js" import swagger2SchemaYaml from "src/plugins/json-schema-validator/swagger2-schema.yaml" import oas3SchemaYaml from "src/plugins/json-schema-validator/oas3-schema.yaml" From 3d2902d1566e6592c8297586c5490325426b16ea Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Wed, 31 Jul 2019 14:36:34 -0700 Subject: [PATCH 2/2] externalize `esprima` --- webpack/_config-builder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack/_config-builder.js b/webpack/_config-builder.js index afbd46c5f27..45e73036a45 100644 --- a/webpack/_config-builder.js +++ b/webpack/_config-builder.js @@ -150,6 +150,7 @@ export default function buildConfig( ? { // json-react-schema/deeper depends on buffertools, which fails. buffertools: true, + esprima: true, } : (context, request, cb) => { // webpack injects some stuff into the resulting file, @@ -168,8 +169,7 @@ export default function buildConfig( resolve: { extensions: [".js", ".jsx", "json"], alias: { - react: path.resolve(projectBasePath, "node_modules", "react"), - "js-yaml": "@kyleshockey/js-yaml", // TODO: fix?? + react: path.resolve(projectBasePath, "node_modules", "react") }, },