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
This commit is contained in:
kyle
2018-07-19 13:48:39 -07:00
committed by GitHub
parent b9b4ab20af
commit 0359f9c364
19 changed files with 206 additions and 644 deletions

View File

@@ -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>`)
})
})
})