소스 검색

housekeeping: bundle size reductions (#4713)

* set new bundlesize goal
* preserve `GeneratorFunction` instead of all function names
* use js-yaml fork that doesn't require esprima
* set HTML content directly, instead of using React-Markdown
* use remarkable for all Markdown rendering
* add babel-plugin-transform-react-remove-prop-types
* remove SplitPaneMode plugin
* remove react-collapse
* remove AST plugin, and yaml-js
* trim Markdown HTML string output before rendering
* disable obsolete function name preservation
* add `getComponent` to propTypes
bubble
kyle 6 년 전
committed by GitHub
부모
커밋
0359f9c364
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
19개의 변경된 파일206개의 추가작업 그리고 644개의 파일을 삭제
  1. +3
    -0
      .babelrc
  2. +5
    -2
      make-webpack-config.js
  3. +154
    -189
      package-lock.json
  4. +3
    -7
      package.json
  5. +1
    -1
      src/core/components/auth/authorization-popup.jsx
  6. +5
    -3
      src/core/components/debug.jsx
  7. +5
    -3
      src/core/components/errors.jsx
  8. +0
    -0
      src/core/components/jump-to-path.jsx
  9. +3
    -6
      src/core/components/layout-utils.jsx
  10. +0
    -300
      src/core/plugins/ast/ast.js
  11. +0
    -9
      src/core/plugins/ast/index.js
  12. +1
    -1
      src/core/plugins/configs/helpers.js
  13. +12
    -9
      src/core/plugins/oas3/wrap-components/markdown.js
  14. +6
    -4
      src/core/plugins/spec/actions.js
  15. +0
    -85
      src/core/plugins/split-pane-mode/components/split-pane-mode.jsx
  16. +0
    -15
      src/core/plugins/split-pane-mode/index.js
  17. +2
    -4
      src/core/presets/base.js
  18. +4
    -4
      test/components/markdown.js
  19. +2
    -2
      test/xss/markdown-script-sanitization.js

+ 3
- 0
.babelrc 파일 보기

@@ -7,6 +7,9 @@
"plugins": [
"transform-runtime",
"babel-plugin-transform-es2015-constants",
["transform-react-remove-prop-types", {
"additionalLibraries": ["react-immutable-proptypes"]
}],
[
"module-alias",
[


+ 5
- 2
make-webpack-config.js 파일 보기

@@ -72,9 +72,10 @@ module.exports = function(rules, options) {
new UglifyJsPlugin({
uglifyOptions: {
mangle: specialOptions.mangle,
compress: specialOptions.mangle,
beautify: !specialOptions.mangle,
keep_fnames: true
},
sourceMap: true,
}),
new webpack.LoaderOptionsPlugin({
@@ -142,7 +143,9 @@ module.exports = function(rules, options) {
"node_modules"
],
extensions: [".web.js", ".js", ".jsx", ".json", ".less"],
alias: {}
alias: {
"js-yaml": "@kyleshockey/js-yaml"
}
},

devtool: specialOptions.sourcemaps ? "nosource-source-map" : false,


+ 154
- 189
package-lock.json 파일 보기

@@ -9,6 +9,14 @@
"resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-2.1.0.tgz",
"integrity": "sha1-VJqdH5I8m8eVOlhdPpqpQpvo/ig="
},
"@kyleshockey/js-yaml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@kyleshockey/js-yaml/-/js-yaml-1.0.1.tgz",
"integrity": "sha512-coFyIk1LvTscq1cUU4nCCfYwv+cmG4fCP+wgDKgYZjhM4f++YwZy+g0k+1tUqa4GuUpBTEOGH2KUqKFFWdT73g==",
"requires": {
"argparse": "^1.0.7"
}
},
"@kyleshockey/object-assign-deep": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@kyleshockey/object-assign-deep/-/object-assign-deep-0.4.2.tgz",
@@ -1523,6 +1531,12 @@
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-react-remove-prop-types": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.13.tgz",
"integrity": "sha1-Mxz8BQmagII4MR14MZwnRg1IEYk=",
"dev": true
},
"babel-plugin-transform-regenerator": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",
@@ -1960,11 +1974,6 @@
"hoek": "4.x.x"
}
},
"bowser": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.3.tgz",
"integrity": "sha512-/gp96UlcFw5DbV2KQPCqTqi0Mb9gZRyDAHiDsGEH+4B/KOQjeoE5lM1PxlVX8DQDvfEfitmC1rW2Oy8fk/XBDg=="
},
"boxen": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz",
@@ -2919,28 +2928,6 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
"commonmark": {
"version": "0.28.1",
"resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.28.1.tgz",
"integrity": "sha1-Buq41SM4uDn6Gi11rwCF7tGxvq4=",
"requires": {
"entities": "~ 1.1.1",
"mdurl": "~ 1.0.1",
"minimist": "~ 1.2.0",
"string.prototype.repeat": "^0.2.0"
}
},
"commonmark-react-renderer": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/commonmark-react-renderer/-/commonmark-react-renderer-4.3.4.tgz",
"integrity": "sha512-+/Rzo3sI37NR8LaVdkUiqBH3+CEW75hc86shwY4E9eEERg78VCy4rSkaP/p7OG5bTvosUMkvhn5d1ZJ5iyt/ag==",
"requires": {
"lodash.assign": "^4.2.0",
"lodash.isplainobject": "^4.0.6",
"pascalcase": "^0.1.1",
"xss-filters": "^1.2.6"
}
},
"compressible": {
"version": "2.0.13",
"resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.13.tgz",
@@ -3345,15 +3332,6 @@
"integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
"dev": true
},
"css-in-js-utils": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/css-in-js-utils/-/css-in-js-utils-2.0.1.tgz",
"integrity": "sha512-PJF0SpJT+WdbVVt0AOYp9C8GnuruRlL/UFW7932nLWmFLQTaWEzTBQEx7/hn4BuV+WON75iAViSUJLiU3PKbpA==",
"requires": {
"hyphenate-style-name": "^1.0.2",
"isobject": "^3.0.1"
}
},
"css-loader": {
"version": "0.28.11",
"resolved": "https://registry.npmjs.org/css-loader/-/css-loader-0.28.11.tgz",
@@ -4252,7 +4230,8 @@
"entities": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz",
"integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA="
"integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=",
"dev": true
},
"enzyme": {
"version": "2.9.1",
@@ -5438,21 +5417,25 @@
"dependencies": {
"abbrev": {
"version": "1.1.1",
"bundled": true,
"resolved": false,
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"optional": true
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"resolved": false,
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"aproba": {
"version": "1.2.0",
"bundled": true,
"resolved": false,
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
"optional": true
},
"are-we-there-yet": {
"version": "1.1.4",
"bundled": true,
"resolved": false,
"integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=",
"optional": true,
"requires": {
"delegates": "^1.0.0",
@@ -5461,11 +5444,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"resolved": false,
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"resolved": false,
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -5473,29 +5458,35 @@
},
"chownr": {
"version": "1.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=",
"optional": true
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"resolved": false,
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"resolved": false,
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"resolved": false,
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
},
"core-util-is": {
"version": "1.0.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"optional": true
},
"debug": {
"version": "2.6.9",
"bundled": true,
"resolved": false,
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"optional": true,
"requires": {
"ms": "2.0.0"
@@ -5503,22 +5494,26 @@
},
"deep-extend": {
"version": "0.4.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=",
"optional": true
},
"delegates": {
"version": "1.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
"optional": true
},
"detect-libc": {
"version": "1.0.3",
"bundled": true,
"resolved": false,
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
"optional": true
},
"fs-minipass": {
"version": "1.2.5",
"bundled": true,
"resolved": false,
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
"optional": true,
"requires": {
"minipass": "^2.2.1"
@@ -5526,12 +5521,14 @@
},
"fs.realpath": {
"version": "1.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"optional": true
},
"gauge": {
"version": "2.7.4",
"bundled": true,
"resolved": false,
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"optional": true,
"requires": {
"aproba": "^1.0.3",
@@ -5546,7 +5543,8 @@
},
"glob": {
"version": "7.1.2",
"bundled": true,
"resolved": false,
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"optional": true,
"requires": {
"fs.realpath": "^1.0.0",
@@ -5559,12 +5557,14 @@
},
"has-unicode": {
"version": "2.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
"optional": true
},
"iconv-lite": {
"version": "0.4.21",
"bundled": true,
"resolved": false,
"integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==",
"optional": true,
"requires": {
"safer-buffer": "^2.1.0"
@@ -5572,7 +5572,8 @@
},
"ignore-walk": {
"version": "3.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
"optional": true,
"requires": {
"minimatch": "^3.0.4"
@@ -5580,7 +5581,8 @@
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"resolved": false,
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"optional": true,
"requires": {
"once": "^1.3.0",
@@ -5589,39 +5591,46 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true
"resolved": false,
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ini": {
"version": "1.3.5",
"bundled": true,
"resolved": false,
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"optional": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"requires": {
"number-is-nan": "^1.0.0"
}
},
"isarray": {
"version": "1.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"optional": true
},
"minimatch": {
"version": "3.0.4",
"bundled": true,
"resolved": false,
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"resolved": false,
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"resolved": false,
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -5629,7 +5638,8 @@
},
"minizlib": {
"version": "1.1.0",
"bundled": true,
"resolved": false,
"integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==",
"optional": true,
"requires": {
"minipass": "^2.2.1"
@@ -5637,19 +5647,22 @@
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
},
"ms": {
"version": "2.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"optional": true
},
"needle": {
"version": "2.2.0",
"bundled": true,
"resolved": false,
"integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==",
"optional": true,
"requires": {
"debug": "^2.1.2",
@@ -5659,7 +5672,8 @@
},
"node-pre-gyp": {
"version": "0.9.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-8RwHUW3ZL4cZnbx+GDjqt81WyeA=",
"optional": true,
"requires": {
"detect-libc": "^1.0.2",
@@ -5676,7 +5690,8 @@
},
"nopt": {
"version": "4.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
"optional": true,
"requires": {
"abbrev": "1",
@@ -5685,12 +5700,14 @@
},
"npm-bundled": {
"version": "1.0.3",
"bundled": true,
"resolved": false,
"integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==",
"optional": true
},
"npm-packlist": {
"version": "1.1.10",
"bundled": true,
"resolved": false,
"integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==",
"optional": true,
"requires": {
"ignore-walk": "^3.0.1",
@@ -5699,7 +5716,8 @@
},
"npmlog": {
"version": "4.1.2",
"bundled": true,
"resolved": false,
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"optional": true,
"requires": {
"are-we-there-yet": "~1.1.2",
@@ -5710,33 +5728,39 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"resolved": false,
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
},
"object-assign": {
"version": "4.1.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"optional": true
},
"once": {
"version": "1.4.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1"
}
},
"os-homedir": {
"version": "1.0.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"optional": true
},
"os-tmpdir": {
"version": "1.0.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"optional": true
},
"osenv": {
"version": "0.1.5",
"bundled": true,
"resolved": false,
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
"optional": true,
"requires": {
"os-homedir": "^1.0.0",
@@ -5745,17 +5769,20 @@
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"optional": true
},
"process-nextick-args": {
"version": "2.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
"optional": true
},
"rc": {
"version": "1.2.6",
"bundled": true,
"resolved": false,
"integrity": "sha1-6xiYnG1PTxYsOZ953dKfODVWgJI=",
"optional": true,
"requires": {
"deep-extend": "~0.4.0",
@@ -5766,14 +5793,16 @@
"dependencies": {
"minimist": {
"version": "1.2.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"optional": true
}
}
},
"readable-stream": {
"version": "2.3.6",
"bundled": true,
"resolved": false,
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"optional": true,
"requires": {
"core-util-is": "~1.0.0",
@@ -5787,7 +5816,8 @@
},
"rimraf": {
"version": "2.6.2",
"bundled": true,
"resolved": false,
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
"optional": true,
"requires": {
"glob": "^7.0.5"
@@ -5795,36 +5825,43 @@
},
"safe-buffer": {
"version": "5.1.1",
"bundled": true
"resolved": false,
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"safer-buffer": {
"version": "2.1.2",
"bundled": true,
"resolved": false,
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"optional": true
},
"sax": {
"version": "1.2.4",
"bundled": true,
"resolved": false,
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"optional": true
},
"semver": {
"version": "5.5.0",
"bundled": true,
"resolved": false,
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"optional": true
},
"set-blocking": {
"version": "2.0.0",
"bundled": true,
"resolved": false,
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"optional": true
},
"signal-exit": {
"version": "3.0.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"optional": true
},
"string-width": {
"version": "1.0.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -5833,7 +5870,8 @@
},
"string_decoder": {
"version": "1.1.1",
"bundled": true,
"resolved": false,
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"optional": true,
"requires": {
"safe-buffer": "~5.1.0"
@@ -5841,19 +5879,22 @@
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"
}
},
"strip-json-comments": {
"version": "2.0.1",
"bundled": true,
"resolved": false,
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"optional": true
},
"tar": {
"version": "4.4.1",
"bundled": true,
"resolved": false,
"integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==",
"optional": true,
"requires": {
"chownr": "^1.0.1",
@@ -5867,12 +5908,14 @@
},
"util-deprecate": {
"version": "1.0.2",
"bundled": true,
"resolved": false,
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"optional": true
},
"wide-align": {
"version": "1.1.2",
"bundled": true,
"resolved": false,
"integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==",
"optional": true,
"requires": {
"string-width": "^1.0.2"
@@ -5880,11 +5923,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"resolved": false,
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"yallist": {
"version": "3.0.2",
"bundled": true
"resolved": false,
"integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k="
}
}
},
@@ -6744,11 +6789,6 @@
"integrity": "sha1-GZT/rs3+nEQe0r2sdFK3u0yeQaQ=",
"dev": true
},
"hyphenate-style-name": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.2.tgz",
"integrity": "sha1-MRYKNpMK2vH8BMYHT360FGXU7Es="
},
"iconv-lite": {
"version": "0.4.21",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz",
@@ -6848,7 +6888,8 @@
"in-publish": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz",
"integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E="
"integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E=",
"dev": true
},
"indent-string": {
"version": "2.1.0",
@@ -6890,15 +6931,6 @@
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"dev": true
},
"inline-style-prefixer": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/inline-style-prefixer/-/inline-style-prefixer-3.0.8.tgz",
"integrity": "sha1-hVG45bTVcyROZqNLBPfTIHaitTQ=",
"requires": {
"bowser": "^1.7.3",
"css-in-js-utils": "^2.0.0"
}
},
"inquirer": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz",
@@ -8269,7 +8301,8 @@
"lodash.assign": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
"integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc="
"integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=",
"dev": true
},
"lodash.assignin": {
"version": "4.2.0",
@@ -8383,7 +8416,8 @@
"lodash.isplainobject": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
"integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs="
"integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=",
"dev": true
},
"lodash.keys": {
"version": "3.1.2",
@@ -8647,11 +8681,6 @@
"inherits": "^2.0.1"
}
},
"mdurl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -16008,14 +16037,6 @@
"object-assign": "^4.1.0"
}
},
"react-collapse": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-collapse/-/react-collapse-4.0.3.tgz",
"integrity": "sha512-OO4NhtEqFtz+1ma31J1B7+ezdRnzHCZiTGSSd/Pxoks9hxrZYhzFEddeYt05A/1477xTtdrwo7xEa2FLJyWGCQ==",
"requires": {
"prop-types": "^15.5.8"
}
},
"react-debounce-input": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/react-debounce-input/-/react-debounce-input-3.2.0.tgz",
@@ -16055,29 +16076,6 @@
"is-dom": "^1.0.9"
}
},
"react-markdown": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-2.5.0.tgz",
"integrity": "sha1-scYZBP7liViGgDvZ332yPD3DqJ4=",
"requires": {
"commonmark": "^0.24.0",
"commonmark-react-renderer": "^4.2.4",
"in-publish": "^2.0.0",
"prop-types": "^15.5.1"
},
"dependencies": {
"commonmark": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.24.0.tgz",
"integrity": "sha1-uA3gGCxUY1VkOqFdsSv7KCNoJ48=",
"requires": {
"entities": "~ 1.1.1",
"mdurl": "~ 1.0.1",
"string.prototype.repeat": "^0.2.0"
}
}
}
},
"react-motion": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/react-motion/-/react-motion-0.5.2.tgz",
@@ -16101,24 +16099,6 @@
"prop-types": "^15.5.4"
}
},
"react-split-pane": {
"version": "0.1.77",
"resolved": "https://registry.npmjs.org/react-split-pane/-/react-split-pane-0.1.77.tgz",
"integrity": "sha512-xq0PPsbkNI9xEd6yTrGPr7hzf6XfIgnsxuUEdRJELq+kLPHMsO3ymFCjhiYP35wlDPn9W46+rHDsJd7LFYteMw==",
"requires": {
"inline-style-prefixer": "^3.0.6",
"prop-types": "^15.5.10",
"react-style-proptype": "^3.0.0"
}
},
"react-style-proptype": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/react-style-proptype/-/react-style-proptype-3.2.1.tgz",
"integrity": "sha512-Z02QsgmdZ4wYNxJsHhNGGZsIF8+MO93fYmdPaC+ljdqX3rq8tl/fSMXOGBbofGJNzq5W/2LFcONllmV6vzyYHA==",
"requires": {
"prop-types": "^15.5.4"
}
},
"react-test-renderer": {
"version": "15.6.2",
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-15.6.2.tgz",
@@ -18004,11 +17984,6 @@
"function-bind": "^1.0.2"
}
},
"string.prototype.repeat": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-0.2.0.tgz",
"integrity": "sha1-q6Nt4I3O5qWjN9SbLqHaGyj8Ds8="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@@ -19788,11 +19763,6 @@
"integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=",
"dev": true
},
"xss-filters": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/xss-filters/-/xss-filters-1.2.7.tgz",
"integrity": "sha1-Wfod4gHzby80cNysX1jMwoMLCpo="
},
"xtend": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
@@ -19811,11 +19781,6 @@
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true
},
"yaml-js": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/yaml-js/-/yaml-js-0.2.3.tgz",
"integrity": "sha512-6xUQtVKl1qcd0EXtTEzUDVJy9Ji1fYa47LtkDtYKlIjhibPE9knNPmoRyf6SGREFHlOAUyDe9OdYqRP4DuSi5Q=="
},
"yargs": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz",


+ 3
- 7
package.json 파일 보기

@@ -43,9 +43,9 @@
},
"dependencies": {
"@braintree/sanitize-url": "^2.0.2",
"@kyleshockey/js-yaml": "^1.0.1",
"base64-js": "^1.2.0",
"classnames": "^2.2.5",
"commonmark": "^0.28.1",
"core-js": "^2.5.1",
"css.escape": "1.5.1",
"deep-extend": "0.5.1",
@@ -53,22 +53,18 @@
"ieee754": "^1.1.8",
"immutable": "^3.x.x",
"js-file-download": "^0.4.1",
"js-yaml": "^3.5.5",
"lodash": "^4.17.10",
"memoizee": "^0.4.12",
"prop-types": "^15.5.10",
"react": "^15.6.2",
"react-addons-perf": "^15.4.0",
"react-collapse": "^4.0.3",
"react-debounce-input": "^3.2.0",
"react-dom": "^15.6.2",
"react-immutable-proptypes": "2.1.0",
"react-immutable-pure-component": "^1.1.1",
"react-inspector": "^2.3.0",
"react-markdown": "^2.5.0",
"react-motion": "^0.5.2",
"react-redux": "^4.x.x",
"react-split-pane": "^0.1.77",
"redux": "^3.x.x",
"redux-immutable": "3.0.8",
"remarkable": "^1.7.1",
@@ -78,7 +74,6 @@
"url-parse": "^1.1.8",
"xml": "1.0.1",
"xml-but-prettier": "^1.0.1",
"yaml-js": "^0.2.3",
"zenscroll": "^4.0.2"
},
"devDependencies": {
@@ -88,6 +83,7 @@
"babel-loader": "^7.1.0",
"babel-plugin-module-alias": "^1.6.0",
"babel-plugin-transform-es2015-constants": "^6.1.4",
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-es2015-ie": "^6.6.2",
@@ -160,7 +156,7 @@
"bundlesize": [
{
"path": "./dist/swagger-ui-bundle.js",
"maxSize": "1.5 MB",
"maxSize": "1 MB",
"compression": "none"
}
]


+ 1
- 1
src/core/components/auth/authorization-popup.jsx 파일 보기

@@ -9,7 +9,7 @@ export default class AuthorizationPopup extends React.Component {
}

render() {
let { authSelectors, authActions, getComponent, errSelectors, specSelectors, fn: { AST } } = this.props
let { authSelectors, authActions, getComponent, errSelectors, specSelectors, fn: { AST = {} } } = this.props
let definitions = authSelectors.shownDefinitions()
const Auths = getComponent("auths")



+ 5
- 3
src/core/components/debug.jsx 파일 보기

@@ -1,6 +1,5 @@
import React from "react"
import PropTypes from "prop-types"
import { Collapse } from "react-collapse"
import { presets } from "react-motion"
import ObjectInspector from "react-inspector"
import Perf from "react-addons-perf"
@@ -25,10 +24,12 @@ export default class Debug extends React.Component {

render() {

let { getState } = this.props
let { getState, getComponent } = this.props

window.props = this.props

const Collapse = getComponent("Collapse")

return (
<div className="info">
<h3><a onClick={this.toggleJsonDump}> {this.plusOrMinus(this.state.jsonDumpOpen)} App </a></h3>
@@ -47,6 +48,7 @@ export default class Debug extends React.Component {
}

Debug.propTypes = {
getState: PropTypes.func.isRequired
getState: PropTypes.func.isRequired,
getComponent: PropTypes.func.isRequired,
}


+ 5
- 3
src/core/components/errors.jsx 파일 보기

@@ -1,7 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import { List } from "immutable"
import { Collapse } from "react-collapse"

export default class Errors extends React.Component {

@@ -9,11 +8,14 @@ export default class Errors extends React.Component {
editorActions: PropTypes.object,
errSelectors: PropTypes.object.isRequired,
layoutSelectors: PropTypes.object.isRequired,
layoutActions: PropTypes.object.isRequired
layoutActions: PropTypes.object.isRequired,
getComponent: PropTypes.func.isRequired,
}

render() {
let { editorActions, errSelectors, layoutSelectors, layoutActions } = this.props
let { editorActions, errSelectors, layoutSelectors, layoutActions, getComponent } = this.props

const Collapse = getComponent("Collapse")

if(editorActions && editorActions.jumpToLine) {
var jumpToLine = editorActions.jumpToLine


src/core/plugins/ast/jump-to-path.jsx → src/core/components/jump-to-path.jsx 파일 보기


+ 3
- 6
src/core/components/layout-utils.jsx 파일 보기

@@ -1,6 +1,5 @@
import React from "react"
import PropTypes from "prop-types"
import { Collapse as OriCollapse } from "react-collapse"

function xclass(...args) {
return args.filter(a => !!a).join(" ").trim()
@@ -243,11 +242,9 @@ export class Collapse extends React.Component {

children = isOpened ? children : null
return (
<OriCollapse isOpened={isOpened}>
<NoMargin>
{children}
</NoMargin>
</OriCollapse>
<NoMargin>
{children}
</NoMargin>
)
}



+ 0
- 300
src/core/plugins/ast/ast.js 파일 보기

@@ -1,300 +0,0 @@
import YAML from "yaml-js"
import isArray from "lodash/isArray"
import lodashFind from "lodash/find"
import { memoize } from "core/utils"

let cachedCompose = memoize(YAML.compose) // TODO: build a custom cache based on content

var MAP_TAG = "tag:yaml.org,2002:map"
var SEQ_TAG = "tag:yaml.org,2002:seq"

export function getLineNumberForPath(yaml, path) {

// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
}
if (!isArray(path)) {
throw new TypeError("path should be an array of strings")
}

var i = 0

let ast = cachedCompose(yaml)

// simply walks the tree using current path recursively to the point that
// path is empty

return find(ast, path)

function find(current, path, last) {
if(!current) {
// something has gone quite wrong
// return the last start_mark as a best-effort
if(last && last.start_mark)
return last.start_mark.line
return 0
}

if (path.length && current.tag === MAP_TAG) {
for (i = 0; i < current.value.length; i++) {
var pair = current.value[i]
var key = pair[0]
var value = pair[1]

if (key.value === path[0]) {
return find(value, path.slice(1), current)
}

if (key.value === path[0].replace(/\[.*/, "")) {
// access the array at the index in the path (example: grab the 2 in "tags[2]")
var index = parseInt(path[0].match(/\[(.*)\]/)[1])
if(value.value.length === 1 && index !== 0 && !!index) {
var nextVal = lodashFind(value.value[0], { value: index.toString() })
} else { // eslint-disable-next-line no-redeclare
var nextVal = value.value[index]
}
return find(nextVal, path.slice(1), value.value)
}
}
}

if (path.length && current.tag === SEQ_TAG) {
var item = current.value[path[0]]

if (item && item.tag) {
return find(item, path.slice(1), current.value)
}
}

if (current.tag === MAP_TAG && !Array.isArray(last)) {
return current.start_mark.line
} else {
return current.start_mark.line + 1
}
}
}

/**
* Get a position object with given
* @param {string} yaml
* YAML or JSON string
* @param {array} path
* an array of stings that constructs a
* JSON Path similar to JSON Pointers(RFC 6901). The difference is, each
* component of path is an item of the array instead of being separated with
* slash(/) in a string
*/
export function positionRangeForPath(yaml, path) {

// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
}
if (!isArray(path)) {
throw new TypeError("path should be an array of strings")
}

var invalidRange = {
start: {line: -1, column: -1},
end: {line: -1, column: -1}
}
var i = 0

let ast = cachedCompose(yaml)

// simply walks the tree using astValue path recursively to the point that
// path is empty.
return find(ast)

function find(astValue, astKeyValue) {
if (astValue.tag === MAP_TAG) {
for (i = 0; i < astValue.value.length; i++) {
var pair = astValue.value[i]
var key = pair[0]
var value = pair[1]

if (key.value === path[0]) {
path.shift()
return find(value, key)
}
}
}

if (astValue.tag === SEQ_TAG) {
var item = astValue.value[path[0]]

if (item && item.tag) {
path.shift()
return find(item, astKeyValue)
}
}

// if path is still not empty we were not able to find the node
if (path.length) {
return invalidRange
}

const range = {
start: {
line: astValue.start_mark.line,
column: astValue.start_mark.column,
pointer: astValue.start_mark.pointer,
},
end: {
line: astValue.end_mark.line,
column: astValue.end_mark.column,
pointer: astValue.end_mark.pointer,
}
}

if(astKeyValue) {
// eslint-disable-next-line camelcase
range.key_start = {
line: astKeyValue.start_mark.line,
column: astKeyValue.start_mark.column,
pointer: astKeyValue.start_mark.pointer,
}
// eslint-disable-next-line camelcase
range.key_end = {
line: astKeyValue.end_mark.line,
column: astKeyValue.end_mark.column,
pointer: astKeyValue.end_mark.pointer,
}
}

return range
}
}

/**
* Get a JSON Path for position object in the spec
* @param {string} yaml
* YAML or JSON string
* @param {object} position
* position in the YAML or JSON string with `line` and `column` properties.
* `line` and `column` number are zero indexed
*/
export function pathForPosition(yaml, position) {

// Type check
if (typeof yaml !== "string") {
throw new TypeError("yaml should be a string")
}
if (typeof position !== "object" || typeof position.line !== "number" ||
typeof position.column !== "number") {
throw new TypeError("position should be an object with line and column" +
" properties")
}

try {
var ast = cachedCompose(yaml)
} catch (e) {
console.error("Error composing AST", e)
console.error(`Problem area:\n`, yaml.split("\n").slice(position.line - 5, position.line + 5).join("\n"))
return null
}


var path = []

return find(ast)

/**
* recursive find function that finds the node matching the position
* @param {object} current - AST object to serach into
*/
function find(current) {

// algorythm:
// is current a promitive?
// // finish recursion without modifying the path
// is current a hash?
// // find a key or value that position is in their range
// // if key is in range, terminate recursion with exisiting path
// // if a value is in range push the corresponding key to the path
// // andcontinue recursion
// is current an array
// // find the item that position is in it"s range and push the index
// // of the item to the path and continue recursion with that item.

var i = 0

if (!current || [MAP_TAG, SEQ_TAG].indexOf(current.tag) === -1) {
return path
}

if (current.tag === MAP_TAG) {
for (i = 0; i < current.value.length; i++) {
var pair = current.value[i]
var key = pair[0]
var value = pair[1]

if (isInRange(key)) {
return path
} else if (isInRange(value)) {
path.push(key.value)
return find(value)
}
}
}

if (current.tag === SEQ_TAG) {
for (i = 0; i < current.value.length; i++) {
var item = current.value[i]

if (isInRange(item)) {
path.push(i.toString())
return find(item)
}
}
}

return path

/**
* Determines if position is in node"s range
* @param {object} node - AST node
* @return {Boolean} true if position is in node"s range
*/
function isInRange(node) {
/* jshint camelcase: false */

// if node is in a single line
if (node.start_mark.line === node.end_mark.line) {

return (position.line === node.start_mark.line) &&
(node.start_mark.column <= position.column) &&
(node.end_mark.column >= position.column)
}

// if position is in the same line as start_mark
if (position.line === node.start_mark.line) {
return position.column >= node.start_mark.column
}

// if position is in the same line as end_mark
if (position.line === node.end_mark.line) {
return position.column <= node.end_mark.column
}

// if position is between start and end lines return true, otherwise
// return false.
return (node.start_mark.line < position.line) &&
(node.end_mark.line > position.line)
}
}
}

// utility fns


export let pathForPositionAsync = promisifySyncFn(pathForPosition)
export let positionRangeForPathAsync = promisifySyncFn(positionRangeForPath)
export let getLineNumberForPathAsync = promisifySyncFn(getLineNumberForPath)

function promisifySyncFn(fn) {
return function(...args) {
return new Promise((resolve) => resolve(fn(...args)))
}
}

+ 0
- 9
src/core/plugins/ast/index.js 파일 보기

@@ -1,9 +0,0 @@
import * as AST from "./ast"
import JumpToPath from "./jump-to-path"

export default function() {
return {
fn: { AST },
components: { JumpToPath }
}
}

+ 1
- 1
src/core/plugins/configs/helpers.js 파일 보기

@@ -1,4 +1,4 @@
import YAML from "js-yaml"
import YAML from "@kyleshockey/js-yaml"

export const parseYamlConfig = (yaml, system) => {
try {


+ 12
- 9
src/core/plugins/oas3/wrap-components/markdown.js 파일 보기

@@ -1,25 +1,28 @@
import React from "react"
import PropTypes from "prop-types"
import ReactMarkdown from "react-markdown"
import cx from "classnames"
import { Parser, HtmlRenderer } from "commonmark"
import Remarkable from "remarkable"
import { OAS3ComponentWrapFactory } from "../helpers"
import { sanitizer } from "core/components/providers/markdown"

const parser = new Remarkable("commonmark")

export const Markdown = ({ source, className = "" }) => {
if ( source ) {
const parser = new Parser()
const writer = new HtmlRenderer()
const html = writer.render(parser.parse(source || ""))
const html = parser.render(source)
const sanitized = sanitizer(html)

if ( !source || !html || !sanitized ) {
return null
let trimmed

if(typeof sanitized === "string") {
trimmed = sanitized.trim()
}

return (
<ReactMarkdown
source={sanitized}
<div
dangerouslySetInnerHTML={{
__html: trimmed
}}
className={cx(className, "renderedMarkdown")}
/>
)


+ 6
- 4
src/core/plugins/spec/actions.js 파일 보기

@@ -1,4 +1,4 @@
import YAML from "js-yaml"
import YAML from "@kyleshockey/js-yaml"
import { Map } from "immutable"
import parseUrl from "url-parse"
import serializeError from "serialize-error"
@@ -80,7 +80,7 @@ export const parseToJson = (str) => ({specActions, specSelectors, errActions}) =

let hasWarnedAboutResolveSpecDeprecation = false

export const resolveSpec = (json, url) => ({specActions, specSelectors, errActions, fn: { fetch, resolve, AST }, getConfigs}) => {
export const resolveSpec = (json, url) => ({specActions, specSelectors, errActions, fn: { fetch, resolve, AST = {} }, getConfigs}) => {
if(!hasWarnedAboutResolveSpecDeprecation) {
console.warn(`specActions.resolveSpec is deprecated since v3.10.0 and will be removed in v4.0.0; use requestResolvedSubtree instead!`)
hasWarnedAboutResolveSpecDeprecation = true
@@ -100,7 +100,7 @@ export const resolveSpec = (json, url) => ({specActions, specSelectors, errActio
url = specSelectors.url()
}

let { getLineNumberForPath } = AST
let getLineNumberForPath = AST.getLineNumberForPath ? AST.getLineNumberForPath : () => undefined

let specStr = specSelectors.specStr()

@@ -149,7 +149,7 @@ const debResolveSubtrees = debounce(async () => {
errSelectors,
fn: {
resolveSubtree,
AST: { getLineNumberForPath }
AST = {}
},
specSelectors,
specActions,
@@ -160,6 +160,8 @@ const debResolveSubtrees = debounce(async () => {
return
}

let getLineNumberForPath = AST.getLineNumberForPath ? AST.getLineNumberForPath : () => undefined

const specStr = specSelectors.specStr()

const {


+ 0
- 85
src/core/plugins/split-pane-mode/components/split-pane-mode.jsx 파일 보기

@@ -1,85 +0,0 @@
import React from "react"
import PropTypes from "prop-types"
import SplitPane from "react-split-pane"

const MODE_KEY = ["split-pane-mode"]
const MODE_LEFT = "left"
const MODE_RIGHT = "right"
const MODE_BOTH = "both" // or anything other than left/right

export default class SplitPaneMode extends React.Component {

static propTypes = {
threshold: PropTypes.number,

children: PropTypes.array,

layoutSelectors: PropTypes.object.isRequired,
layoutActions: PropTypes.object.isRequired,
};

static defaultProps = {
threshold: 100, // in pixels
children: [],
};

initializeComponent = (c) => {
this.splitPane = c
}

onDragFinished = () => {
let { threshold, layoutActions } = this.props
let { position, draggedSize } = this.splitPane.state
this.draggedSize = draggedSize

let nearLeftEdge = position <= threshold
let nearRightEdge = draggedSize <= threshold

layoutActions
.changeMode(MODE_KEY, (
nearLeftEdge
? MODE_RIGHT : nearRightEdge
? MODE_LEFT : MODE_BOTH
))
}

sizeFromMode = (mode, defaultSize) => {
if(mode === MODE_LEFT) {
this.draggedSize = null
return "0px"
} else if (mode === MODE_RIGHT) {
this.draggedSize = null
return "100%"
}
// mode === "both"
return this.draggedSize || defaultSize
}

render() {
let { children, layoutSelectors } = this.props

const mode = layoutSelectors.whatMode(MODE_KEY)
const left = mode === MODE_RIGHT ? <noscript/> : children[0]
const right = mode === MODE_LEFT ? <noscript/> : children[1]
const size = this.sizeFromMode(mode, "50%")

return (
<SplitPane
disabledClass={""}
ref={this.initializeComponent}
split='vertical'
defaultSize={"50%"}
primary="second"
minSize={0}
size={size}
onDragFinished={this.onDragFinished}
allowResize={mode !== MODE_LEFT && mode !== MODE_RIGHT }
resizerStyle={{"flex": "0 0 auto", "position": "relative"}}
>
{ left }
{ right }
</SplitPane>
)
}

}

+ 0
- 15
src/core/plugins/split-pane-mode/index.js 파일 보기

@@ -1,15 +0,0 @@
import SplitPaneMode from "./components/split-pane-mode"
export default function SplitPaneModePlugin() {
return {
// statePlugins: {
// layout: {
// actions,
// selectors,
// }
// },

components: {
SplitPaneMode
}
}
}

+ 2
- 4
src/core/presets/base.js 파일 보기

@@ -4,11 +4,9 @@ import spec from "core/plugins/spec"
import view from "core/plugins/view"
import samples from "core/plugins/samples"
import logs from "core/plugins/logs"
import ast from "core/plugins/ast"
import swaggerJs from "core/plugins/swagger-js"
import auth from "core/plugins/auth"
import util from "core/plugins/util"
import SplitPaneModePlugin from "core/plugins/split-pane-mode"
import downloadUrlPlugin from "core/plugins/download-url"
import configsPlugin from "core/plugins/configs"
import deepLinkingPlugin from "core/plugins/deep-linking"
@@ -55,6 +53,7 @@ import Info, {
InfoBasePath
} from "core/components/info"
import InfoContainer from "core/containers/info"
import JumpToPath from "core/components/jump-to-path"
import Footer from "core/components/footer"
import FilterContainer from "core/containers/filter"
import ParamBody from "core/components/param-body"
@@ -102,6 +101,7 @@ export default function() {
liveResponse: LiveResponse,
info: Info,
InfoContainer,
JumpToPath,
onlineValidatorBadge: OnlineValidatorBadge,
operations: Operations,
operation: Operation,
@@ -174,8 +174,6 @@ export default function() {
swaggerJs,
jsonSchemaComponents,
auth,
ast,
SplitPaneModePlugin,
downloadUrlPlugin,
deepLinkingPlugin,
filter,


+ 4
- 4
test/components/markdown.js 파일 보기

@@ -60,19 +60,19 @@ describe("Markdown component", function() {
it("allows image elements", function() {
const str = `![Image alt text](http://image.source "Image title")`
const el = render(<OAS3Markdown source={str} />)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><div><p><img title="Image title" alt="Image alt text" src="http://image.source"></p></div></div>`)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><p><img title="Image title" alt="Image alt text" src="http://image.source"></p></div>`)
})

it("allows image elements with https scheme", function() {
const str = `![Image alt text](https://image.source "Image title")`
const el = render(<OAS3Markdown source={str} />)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><div><p><img title="Image title" alt="Image alt text" src="https://image.source"></p></div></div>`)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><p><img title="Image title" alt="Image alt text" src="https://image.source"></p></div>`)
})

it("allows image elements with data scheme", function() {
const str = `<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==">`
const el = render(<OAS3Markdown source={str} />)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><div>` + str + `</div></div>`)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><p>` + str + `</p></div>`)
})

it("allows heading elements", function() {
@@ -84,7 +84,7 @@ describe("Markdown component", function() {
##### h5
###### h6`
const el = render(<OAS3Markdown source={str} />)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><div><h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6></div></div>`)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6></div>`)
})
})
})

+ 2
- 2
test/xss/markdown-script-sanitization.js 파일 보기

@@ -24,13 +24,13 @@ describe("Markdown Script Sanitization", function() {
it("sanitizes <script> elements", function() {
const str = `script <script>alert(1)</script>`
const el = render(<OAS3Markdown source={str} />)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><div><p>script </p></div></div>`)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><p>script </p></div>`)
})

it("sanitizes <img> elements", function() {
const str = `<img src=x onerror="alert('img-in-description')">`
const el = render(<OAS3Markdown source={str} />)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><div><img src="x"></div></div>`)
expect(el.html()).toEqual(`<div class="renderedMarkdown"><p><img src="x"></p></div>`)
})
})
})

불러오는 중...
취소
저장