{"_id":"beidou-view","_rev":"31-c1a2246585367167a3b9be58703a7a62","name":"beidou-view","dist-tags":{"latest":"2.3.0","next":"2.0.0-beta.0"},"versions":{"0.0.1":{"name":"beidou-view","version":"0.0.1","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","ci":"npm run cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"autod":"2","egg":"^2.2.0","egg-bin":"^4.0.0","egg-mock":"^3.7.1","should":"8","supertest":"1"},"files":["app","lib","config"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@0.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.3","_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"dist":{"integrity":"sha512-PqCr9DIAIklChmnk39mznix54m8/7i84xnacm1EgUkFvaT+vFM747CETWJHF3AdFYm3VgHBqgf6gAWX4J4UQ9A==","shasum":"ef6bc70cc4197526e28e9eb145598bee5ceed214","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-0.0.1.tgz","fileCount":11,"unpackedSize":7811,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5UlhB24Ug1iPRSNs6ANqNwcDTcUOWF/sZu/4snEBPwAiBWY9CMs07QAqlz2rFOGhy0ReD76VQGt6lSpesyq7tqAA=="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_0.0.1_1518141303681_0.2779240805946901"},"_hasShrinkwrap":false},"1.0.0-alpha.1":{"name":"beidou-view","version":"1.0.0-alpha.1","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","ci":"npm run cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"autod":"2","egg":"^2.2.0","egg-bin":"^4.0.0","egg-mock":"^3.7.1","should":"8","supertest":"1"},"files":["app","lib","config"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readme":"<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\n**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_\n\n* [Beidou react view](#beidou-view-react)\n  * [Configuration](#configuration)\n  * [Usage](#usage)\n  * [API](#api)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_id":"beidou-view@1.0.0-alpha.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"dist":{"integrity":"sha512-lllA4EFKwPh52k0OWOVO2nHcKw0ntypsGIxmZ42D8E7+AS7WW7Gi1AzR2aB+oPP2QIK3eI0Bkqk7L0YWo5ayXQ==","shasum":"8ae9bb2641d5ba2fa1f2c39b101645edb963978a","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-alpha.1.tgz","fileCount":11,"unpackedSize":7819,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDxUKzJB9JEfoUpGecxSh03ZEwfnkhuRPiyEeGgHF1/YAiEA9w1f74vQ7t3cSojrBRNcG5/esBVtu5vRfOXXg/erERU="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-alpha.1_1518142141817_0.7710288356642301"},"_hasShrinkwrap":false},"1.0.0-alpha.2":{"name":"beidou-view","version":"1.0.0-alpha.2","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","ci":"npm run cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"autod":"2","egg":"^2.2.0","egg-bin":"^4.0.0","egg-mock":"^3.7.1","should":"8","supertest":"1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@1.0.0-alpha.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"dist":{"integrity":"sha512-AQTAywiqdhd9a5tBocJnkScIIjjnsI0u0CXwWNYUVWkDrBoMhoCFw6YMNHurZar3aEq55VI6tTtogv6KLfYU9w==","shasum":"bd6647887d6212e96226037834558026d301f0fe","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-alpha.2.tgz","fileCount":11,"unpackedSize":7847,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHbHQzzYRD/W/9GX0RNmaIBZxTGbkTaO1ZiaLMKvBjMZAiAH22SY5lIwWg+VxGepGY8n/vzzKKQWjRxonl0Tl28x7Q=="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-alpha.2_1518145428857_0.5884203281912481"},"_hasShrinkwrap":false},"1.0.0-alpha.3":{"name":"beidou-view","version":"1.0.0-alpha.3","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","ci":"npm run cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readme":"<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\n**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_\n\n* [Beidou react view](#beidou-view-react)\n  * [Configuration](#configuration)\n  * [Usage](#usage)\n  * [API](#api)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_id":"beidou-view@1.0.0-alpha.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"dist":{"integrity":"sha512-Lu7kchMN5gfcENqEmc/HmQMbMKhQZubMkO2zraNiGy99+CeQJQMZUk+O8SFn+1dSxIz0pGuRpBxA7Kjdzjx++Q==","shasum":"d95f4936fcf839386e0f90da3961c66948edc76c","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-alpha.3.tgz","fileCount":11,"unpackedSize":7813,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDW4zf1vcwAV/afKi/O2C7UdY1W1dognHT5YPsg/SRXewIgK1aLEHizU9LKQHFd78YDr+qpTQABI3ZrKaqDsRN2hyo="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-alpha.3_1518432719862_0.6579973165379049"},"_hasShrinkwrap":false},"1.0.0-alpha.4":{"name":"beidou-view","version":"1.0.0-alpha.4","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readme":"<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\n**Table of Contents** _generated with [DocToc](https://github.com/thlorenz/doctoc)_\n\n* [Beidou react view](#beidou-view-react)\n  * [Configuration](#configuration)\n  * [Usage](#usage)\n  * [API](#api)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_id":"beidou-view@1.0.0-alpha.4","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"dist":{"integrity":"sha512-n44px1AESSvf4yETaTZujzD9Q10mzTPgkfcptlCcQxuNcK84v8u+HO9sCh3F+JtLcP8ITLd6LoOfQo5ReVeNMQ==","shasum":"2441b7422e1fc2d4186aea98c1639a713c0e9007","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-alpha.4.tgz","fileCount":11,"unpackedSize":7931,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEfZGsBfLhd2ehXbsnWAX1/nDaZgEqancL/lGkEZM97VAiBV4cEUNt22Hs/hH6jOKi3kfUGiqzhkdFbmhR35RNucdQ=="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-alpha.4_1519471494595_0.3386448876455206"},"_hasShrinkwrap":false},"1.0.0-alpha.5":{"name":"beidou-view","version":"1.0.0-alpha.5","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_id":"beidou-view@1.0.0-alpha.5","_npmVersion":"5.6.0","_nodeVersion":"8.9.3","_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"dist":{"integrity":"sha512-lvI2r+xZu7fOmeBllBNkOzLyGGNewIz5GdhWnmh8l4piAmWVStoNeAa6L22piLoDIbIB6t9IuwCuIzYQ6Uf9yQ==","shasum":"a9095fc247f9812b8d6ef6e8ff9d34831682313d","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-alpha.5.tgz","fileCount":11,"unpackedSize":7500,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAZdXuU9bcrGYZLpdJeWNA0QT9B+PjovuKN4Lm9+Bsg3AiEA16FvNEBNrriz4Ea8r0YAXe5CwWpOO8t0hdF491w4LNU="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-alpha.5_1519896570189_0.6281727279747211"},"_hasShrinkwrap":false},"1.0.0-beta.0":{"name":"beidou-view","version":"1.0.0-beta.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readmeFilename":"README.md","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","_id":"beidou-view@1.0.0-beta.0","dist":{"shasum":"8947966b93f0575010b0de6b78ea3ee4df7540d7","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-beta.0.tgz","fileCount":25,"unpackedSize":12040,"integrity":"sha512-n9pWnp/QqpJ1Qn7vO2tL5f+XePqHnb188jQjpgU5M5flcLS5LIeAJSjiXXC/NNif0OsjZturNRg5CyZMK8pNXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDHoayb2OoUv6c9Zo+oGCdD7+/VEo+iez/lPEagB5EYgIgIUXuUnB2wjlW8+8FLnqbIKtM2ckMG4ZHHGMRvXtKRK0="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-beta.0_1520595358847_0.8769773374050178"},"_hasShrinkwrap":false},"1.0.0-beta.1":{"name":"beidou-view","version":"1.0.0-beta.1","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readmeFilename":"README.md","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","_id":"beidou-view@1.0.0-beta.1","dist":{"shasum":"5475f6a66a0269f067e748336e47c3f0073ce905","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-beta.1.tgz","fileCount":25,"unpackedSize":12040,"integrity":"sha512-V9+p5HJqcpiWjGccrYOrEPsL5VskkbPA9XxydO61ugqRO8+QzbVPIgQ6NLxH1Fk+x5mD3BTq+VtliMlfK2eKkA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDb2Syer45suMS3RH8/7wsk8vOduxYDSFuvWijgTYkDoAiEAiovly1KLWKRv9z5mg5YRtT0g92TnOsvu1Ufq1VKvsAg="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-beta.1_1520597525156_0.5936467509494827"},"_hasShrinkwrap":false},"1.0.0-beta.2":{"name":"beidou-view","version":"1.0.0-beta.2","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readmeFilename":"README.md","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","_id":"beidou-view@1.0.0-beta.2","dist":{"shasum":"f108bee3fafe399ef615dda48c2225b451c0b03c","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-beta.2.tgz","fileCount":25,"unpackedSize":12040,"integrity":"sha512-k3HHQJelFcPyCHXglOulyaRyjfAtwFkyLfMK1GZj23P5IPlG3wRMFuvlZSL6FwQfr276rNFgTyxatp9Itd5T8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBK8T6Bd+PNDt2+1IP33p/Hl5yL61N8HIKKZLABysA8wIgAe7c+CkELqnz/b8njbAQK4Ku3tIDQTmOPhKNNI3sWzU="}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-beta.2_1521081299074_0.26365075184630204"},"_hasShrinkwrap":false},"1.0.0-beta.3":{"name":"beidou-view","version":"1.0.0-beta.3","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"readmeFilename":"README.md","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","_id":"beidou-view@1.0.0-beta.3","dist":{"shasum":"7d1fe97377656b056acd22222530b0d14e1119d2","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0-beta.3.tgz","fileCount":25,"unpackedSize":12040,"integrity":"sha512-6zQTTarBRTAQdZYSRVvz+DreByfLLbfcFx9JrAB8dHKbZ9d8EJ9paT01hbvsSgqL+gvGS2H2Fq2kcTiiFzwQLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8jyNfphpRKvVUKQ1aUZu/pVz9oy9WIxRfvJh0u6ArjgIhAJcY3y9Y9jccjPnteo5eOgldCdGN6No1ovG3Y2TVG1i9"}]},"maintainers":[{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0-beta.3_1521633114809_0.7415630064172678"},"_hasShrinkwrap":false},"1.0.0":{"name":"beidou-view","version":"1.0.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@1.0.0","dist":{"shasum":"f9c39dcc67b1482b47e22d90f71d08ccd835760f","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.0.tgz","fileCount":25,"unpackedSize":12033,"integrity":"sha512-qZ0KIGUcV2hbdjrF+bbCUmC2M+gQVjf5akLuoDfS3jEjFY9kY3kHWpO5z5W+AasYO7kl8XOymu3taoh90zSWzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICMpBcpiX/6VK9FkOGPweSk9E6zMvK/3trjaoiu2dum8AiEA/KmGHnXRduj29cfvio2zse4h8tICyLrJpUow0crKnk0="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"devrsi0n","email":"devrsi0n@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.0_1521787379631_0.6390418398072173"},"_hasShrinkwrap":false},"1.0.3":{"name":"beidou-view","version":"1.0.3","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@1.0.3","dist":{"shasum":"68b585c5b59ce8951acb4a71012b41cc8885ad75","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.3.tgz","fileCount":21,"unpackedSize":13203,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa3rQzCRA9TVsSAnZWagAAzowQAKAtDgbNGHv87G54kqjb\nfFU30FpNWtrHhRm6B5Vttf7ldd/P7e6bZit5ayc7UmpM/LweOabNNT2mO4jE\n3UCldZlfK8By8VJBwYbvPFCFZyrmcy1l9muoEn8bUg/TwesqZ9wDvT/ts3Vn\n37QOpwwjVYvUCljIquQuf+Ig/yWAIDOetjfeeWt6UyLguQz8FfP1uW5CTENW\nByyvoPRzcBhilPoP1Z6TP8qH9OdFwIUs8LbHQEWhX31HcaXuALlbk3GbDjuA\nuM3ftZvLRZdslg78v3GW1RlpR21dNkF2yfkaesmPE5f6Av08RAAPXxk+hxr9\niLKEpq/0KkLpUG/M2d/GRrs9I69Avj/CjaBI1Yanr0O8/Wx52Q98YmJSpZat\noYYjxVr3S6XTdiAmVpcrUFsHWVsgvKp4v3j92vCPqe89QP/1TU1/jLynIhYE\nuimcIKXtr1F8mYK7rsdoEFLZ/7pqTjVKTQRqWtu77Dt/gm5LUu/02NHuf37D\n37BJYIXxLIz5mBSRExzdcBAylz6FJLvV0eWheIuRLhGCciHyFxcX6d+42t1k\nGSDdBRAqgx4HH4xtPifgF8SIEM6lZPsdANDN3whTNDygQEnL2qhaHBEvH0lk\n1Kx/kswXCnTOfBMNTVKUG021xRKEpgVvWoyYi+V3u2V6OR4HhNAzj32BQnXR\nJLJv\r\n=6o9S\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-MEp0UpaCLjrP/TefEvJ4Ed6oFPZq75Ib7qKujh1viYsGthKxlyYwIdFtylAU/MjMr+i4ep6nAw5/2A6zrIRHng==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID14571Pdn7k5a9GUtj9cXwisvIrNBFxuDEGgmpav7l0AiB+SbS2Y1BRkaVYiHPAwHmyHLhgydYUU+fjeegpgUzp7A=="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.3_1524544562838_0.12407270676565219"},"_hasShrinkwrap":false},"1.0.8":{"name":"beidou-view","version":"1.0.8","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"files":["app","lib","config","index.js"],"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@1.0.8","dist":{"shasum":"f827a84a55daf4e159448091aa45293f8f96ef85","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.8.tgz","integrity":"sha512-3NjrgnICbAoaNqp+0VvJzVIruGPx/FirKR6KVqY5EKGBahAiNlNPRxdC7Ixy2VCN1CP4AIO/e8vpjwmn7rwcwQ==","fileCount":21,"unpackedSize":13423,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbrIkCRA9TVsSAnZWagAA6SUP/0OShmrhQZYIaEgPjI34\no1PLOixwjWOhpv5W5HHiYlc+aFWIlCoFeAvOaKtggbpQzSIl8P4qarld7ZIn\nrpkj57tqXO618MMn9KHHF6R/6lvU/HGbLL1ZSJQVC88soNmgdITXjRw6YLeo\nIl7bBViU1Vw+uXQ3z4C+de4fyJ8bXq87e0M4oeMCgylkp+okeuGoJjg+sF1u\nlf/LsT1Nio6SfKuqgo7SjR2JNGMP2VYclvCESXygrqHpBSo4BQ2OGsS4+vuC\npZi8kDtzXNcuNiOsu2PJ342jNkUdSrfojGPN3fVR4qHjL5EuQTcWSCKAvLFo\nalMrhVnEXAFbbBoRHuYD3WopCKICivzrtnO+lHSZPLbsQQndkedphd3opFKM\nNAAMfbjrXa9Cm/teBdcqHwRFqKQnTgF1am4ae3lMbPe/dTcpvDieLq6PGsP8\nOb55HJaTwFPTtH63NHHo9n9uVpP0EI3YQKcIMxYEH2NmSs7FFO0ZWx8y9Y/e\n6MYzcXh3Iga2l3wJMKjAeQxfCB3AVwuisCgoDCTYLRVPWrJNLmY6ywyPH6QK\nZbyQ+MA7Kb3BWuq9VRurD0fnpEnYd/j9JZjFfevdF6pSwJEZA2HJm30XTHWt\nZkOVxnWpvGAquE4A3CzrpO8ZqKukrH/NFHzNESIVdaY9r57VK9guhXd8GXQR\nzjba\r\n=vj76\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnofkhyCOFnpxb+tuvdQpwzkeMMyJcfAyvfQTArT5nygIgBvLQ2SVz3nXIthEGdjGmpDKAPZcddp3L7Zj8BeMbyZU="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.8_1533981220288_0.09105149968263504"},"_hasShrinkwrap":false},"1.0.9":{"name":"beidou-view","version":"1.0.9","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@1.0.9","dist":{"shasum":"123af5dc68d1bf369cbc8aa7e306ee6c6565e758","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.9.tgz","integrity":"sha512-djRQLcba9orjLBD+i5/Gp4jbmtbYJxrNPRklg2kzDkTfITDyCLdoat6dDhVIeRgujwqD26vJnejf3t6Ttper0A==","fileCount":26,"unpackedSize":13751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbn0+BCRA9TVsSAnZWagAAcZEP/3ze+SWea+P1TwGsyoGC\nPOX5MzLqI6Iek3N8CsS5iqNkqMLyo4nW5D4mWrkY6lLjhrvmXOiJwMBBzGeR\nDIelCiY16g6b1v0CuF0h6IrfNqaYxOppGT/e6W8xK+UGZuOQTfe7sHElpQsu\n0bLRuKbc5KJZWFJDPiQFo8tDWFLFIpOsHVioAO3oEeuycZGqOT3u9eTHi724\nlGHkJNnG+J387q4OdssvsWZIPawIC2xn2RuwyN/FT0wez/FFX6N/0EvNOjZL\ndeWr9njvb2PntYherovYiziSo3TUDA41ss7yrIXy3tz+zKqWefLFeUf2MksU\nFaky4/wYk5mCy3TdDcnrHNidJ2LKAJ5vmVWSfwA9vGpN15eYkBQ/9qMOEgU1\nWYFbKGwrvSbYgD8P90dZ6RHTIYKv45F66/rDZafoBVwHlztIKRlQcLmkduBO\nHIeWi6GgeL+B5fYp98ACB5PFLox6Fi6afNh2l1o667vc+XAjEPJr018yJgcO\nPYrUU8x6F0YNd7t1RgZn8+YY/5FcVaSocw63hBjADkDLHMzXq4mH9wcRXXry\npwXY3SfDcSxGEgQyIo8a7U8bXCrHPX0DiZkLdyIUlc2tB476wwS/ejVioKJI\nFXJfWxXauzJ2A/T5QZSPdt8rvPYI12eUoTgdY17c0Tpi/YR2AUMhO1BS3nRf\n/az8\r\n=FvzH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmiIEpKzkhFVjJ5qw8KLd7ZBsiufmx6DSvaAFcn+LC+gIhAOLYBNKbC/8yiC5nx8ELYQ6VtpgSvfMtyuhiwitF/IJp"}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.9_1537167232878_0.7367579967910884"},"_hasShrinkwrap":false},"1.0.10":{"name":"beidou-view","version":"1.0.10","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"95b69959800e13d95e4ef0a3e9849f7b377aab7e","_id":"beidou-view@1.0.10","dist":{"shasum":"ae310dd9e1911563e3aa9af3e5c765aa2b0f0623","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.0.10.tgz","integrity":"sha512-VVex9G35F1XTKaxHNBwMMR8ZUHseYSgkpQgjmR+egbQrQPJRONSByrBRPQhVCCuTefxNPEFG3adqv+ct9FhpMw==","fileCount":13,"unpackedSize":14929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9MmxCRA9TVsSAnZWagAAe/wP/1HVXh3F3I64U/God5FC\nCIINTJKU+ychZ7Zteg2Iuk8yMQLMC5baDZFguS/71QtjBkJ4tejmW52r27JI\nSTfInyIYUrlD0OPrZZyYRXzapPw59jbrDx5ry1rEUiMZ89Br5H0zMJm9FHoA\nRNeM8ZWrhvbKLwayCZ0o1vNJteD31MdyluUqI5SkFgEnFb92S5U+xuszc2qA\n+uTQVLFssP6KcEyYh7vXreQwu8NlOHrD/8XZaBo/DMXWtbnVLmrjYArpidQh\nylkM+Jnyga03O8SYkvijdKJEbJ406LSoqhOXMOfJiByubBgBSW5fNSGH/E4O\nJ7YXvDKD8JOU3Fv8IUzY9SAz4wCAFpQcpG2qDRS9nSfONTPWEbMKu0K4AoXO\nVWAw6HXiHRh2TTBdTpUsPZNQwH3BseWPI+657wu2ZgccgTHVlmT6o6V5a2P4\nlNqmsTQbmWRa4Eww6jHbNbwMLzeiiExjndgo5vJWxyP+A/g0qs4ky8FWk2G/\n90UqSHy2GkSY+pu1ZdW+9zBqwF8pOBTsQigJirzd97xqihX5xPV84Isr/SDj\nBoBTqYX3gHYf1MWNy1ViK+DZcOBEqF8e47bW7KJb1nekHIb7F3s5KOaW/gNy\nzr/Z+UY2RtP3BReAQPew4JL9oPk3/hWfTPjRUXGm6uy+n+ox2xDi+a4T7hdN\nN41U\r\n=p8Az\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC8whkhaI0psF1OFh/8vJ2AWWaa8M4xmtdLnMEuHWV2rAiEA8+zkNR63P0Ignf5f+4OzP14pRTcAyZh/9/UDRrY09/k="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.0.10_1542769072473_0.9184755753605329"},"_hasShrinkwrap":false},"1.1.0":{"name":"beidou-view","version":"1.1.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"_id":"beidou-view@1.1.0","dist":{"shasum":"774b64e64c955d02afb00b3ba7f42db31300502e","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-1.1.0.tgz","integrity":"sha512-BB1ooWDqVF6MyF11bh20KYMAjDAuTUrlWwjm7H8kXMSLFDNnk2pApON6252a58bWELVMinM8Iz/xAtSbCqrARg==","fileCount":21,"unpackedSize":14476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGH2TCRA9TVsSAnZWagAAtBsP/0kYO9NNuJtnhJBC/ZJO\nQIMBC4q4SNV+tYV1asQlS8eFsdJOSeSsv52+dfA3Sbza+7LcC9bNkJ2fuE1J\nWRJj0+QUHtra9RQfdDIJvN5h02mCEEgoZlerB1D44mid0NGJcpEA5W5Go8LA\nv0UqboJQEmtpXz3sj5W+MRaidDkY94ljlfc/Qxd8vV5VpHxVZi7UzJS8p8Os\nyodjRNnZyMS5SLIc+hxKsstzouEncuBS/4ZbDidEbZ2/IumAmPcM+N1HktS/\nDWd3s9eavNSPkOwhtHlfeEgSN871ftL3gTkGY/W1lhTvuKIVgwCrUK6agQoZ\nN2SVkQqmK1Aqnv3yumaCsJ8SER9miR26DBDv0EJR5fkCwKeGO/W5dYF1By73\nDt5UGksKuu+hWdDueJJYAJDXyqogaLhATlnHR0Zd/t2lZL75mD/ox8vnhZ1/\np8hBF/bbZdC/IJHd/MoL9Q7DjFEisHKOcS57eE2QF6x82aiEClOQsCEpLl/M\nl/ruaEv28UDgi0xLwapDYQkI4wGEV/+O0ilblQLruQH73UJobUnah6cGPaPN\nj+Os3SSJq/9k6iJMuz6twzMfjUo5TAgm6/IC52J94Kn1z1usRax95WumkI42\nuajIDFv5IysAdTfIqyNbjtO8Vmz0M7aaGT7S6CgneeqttotpZyPqjVAyTNs9\nDw2K\r\n=qJc/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbYkQPVRt3i1A9a7WE+YI0di0EIlRulTpTWgda+O/09wIhALf5NMAQR/hEjNMT1bsKlzIKdG3kILIF0qCPopToe+vt"}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_1.1.0_1545108882873_0.359521145333042"},"_hasShrinkwrap":false},"2.0.0-alpha.0":{"name":"beidou-view","version":"2.0.0-alpha.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"d50bc91db479f2a693ef4e34d392d123aaf1738d","readmeFilename":"README.md","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## initialprops\n\nInject props into Component before render.\n\n|      File      |         Field          |      Type      |   Default   | Description                 |\n| :------------: | :--------------------: | :------------: | :---------: | :-------------------------- |\n| View Component | `View.getInitialProps` | Function/Async | `undefined` | Inject props into Component |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","_id":"beidou-view@2.0.0-alpha.0","dist":{"shasum":"7cbbb3e968ce3749c0061581aadbfbb8154d0a83","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.0.0-alpha.0.tgz","integrity":"sha512-mHMhroKzEIp33apd8OuXgTR4AvMsntwXj82Jmf1E0JTJ9mUn8Yt9H6P7HVkDUQ2XlNH9AyTLzRC6zkVznBRFOQ==","fileCount":13,"unpackedSize":15647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcI2vzCRA9TVsSAnZWagAA5gsP/3dzWX+XuWQ7fVVY3afE\ne3fDrn+lmlRcYSf8bo+hX2h8pv17MP9rqeSIPElj6HRVhL598ptuMntSqnpF\nRIJ9lm5ThT0vfaYnCsvcjrcpkoWfEL/lOAeMzgsxxvQ7fscSFx/7bkCC54Km\n0/FM5hJLJBKLeTzGUcUjSQN5ZaId94GLblwcG5finYWVcDri2srkpxVGGybM\nYncR7XFhqN+keGzWRZLeBUoA9OaaE3yYRLbrJFAWvMQauAen5s48+kvsqqKK\nJA3HWMGAp/8MK5ZTxkZizJG2/v1rLoWmuAyE0r4oyfM5xahdiXFlST5qXy10\nzIafycyjANetENx0wbFM+un8j5sYkErD2xkGUxE4lWlQ3i36vV8wfmjLLrSR\nyBPZ+IOkgxzJRM0zBvAs4VLNzqTqafVtyjAxfFt7skIskxzHpSaK8sHN9vuH\ngyM0Bpmd36szeKepzobbSAFJ1aQecs30yhjdiT/tOhvblxuURPT45J4YTLIU\naNvACYmbOhNN1tC4Taxkq9jIbkvqcs9aJYZIdFDVz2mtWHS8/PCJQCe0VeGU\ncvMMdyB2eHtu7hrsTmCmpK8+Z+k9BlRCjGrxSX4t8zCvkknewVYoVYaZCQdu\naccBKymAwAwB3PeLB35DPajHupGYBMbO7fAVulE+uXNfwF+f4YE6srivbnWs\nkt8v\r\n=iet2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICBOzbRHG6ZsWVWNK76n8xPrl1ymwvVjABGtNg84MXSSAiAIsZpnwG5HMpje7jXpVGJ6xyvXO9DeItdZzAG2gSZmMA=="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.0.0-alpha.0_1545825267193_0.03167765012590662"},"_hasShrinkwrap":false},"2.0.0-alpha.1":{"name":"beidou-view","version":"2.0.0-alpha.1","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"0f281a0562e768556e4b68483801c80254ecca8f","readmeFilename":"README.md","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## initialprops\n\nInject props into Component before render.\n\n|      File      |         Field          |      Type      |   Default   | Description                 |\n| :------------: | :--------------------: | :------------: | :---------: | :-------------------------- |\n| View Component | `View.getInitialProps` | Function/Async | `undefined` | Inject props into Component |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","_id":"beidou-view@2.0.0-alpha.1","dist":{"shasum":"68fdcb184c53efe46e31e446d58eec35ee4e3a16","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.0.0-alpha.1.tgz","integrity":"sha512-SXAyIbhwrLckizn6Lw8LIComBY7vgHQaPkl4wC6vNbWV/ca+wO0bvAd5G9SMFIdb9tOwsQ5d9Uwk8oXTi4pyKA==","fileCount":13,"unpackedSize":15647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcNGYSCRA9TVsSAnZWagAAgoAQAI2LwM2fxEWbmZQDLrHq\nLnxEOHZe0PFyAYYixHR7oI08XxYcCLBUOMuuaHLTNXpf+M82zfDcsH++xQsl\nzAIN2u+qHahtUtAIeKjABQ6jSubNX5sFvDwhRthAfuy94Zz0AeEc2fcuWsTQ\nm56dJ/YKHkdFOOWK21+OBVmNXtHyR2RWRjHCXx3A4XCUa/u1o2Gb1XP6a3LE\nt7QPa/zj1QsLHge+wQxBittqQmlkhA5PGYxAdQNonmsyZEE9nOocADv9ja48\nQy9Ccv50jkTQJgvvOP0qlFpuNMp8qieNE3ZgqRgtuHTTd09jorDPLOy0lsT2\nQatfT6jtzoTpp7VZY8RgQpDQ1P4Gr4rR5mFma1BLAsjfN6AGxT1bRVIQUTZr\nCZBngAnRrqyl7oxnopSn5FzwyENaUVkf7MVEs1nCZ4rL2U5QO33PkSG/PI5+\nkMt3cbcPcl3A46yhmSpZUH4/S9zVbLVMBlDK8NvQLl9MdHwJS3tHCkbNf0TK\nr9BYDDjsVdImXoDnEntmQcM4f5c7uWrSFIcvbISbONhUvyK2oAqwiNgGezav\nVMMcGcUDBARcxyc5c2p8wgQKLzIob0GUvLrtK3oc5xVtNw7DHt7IcjxJLp/j\nmx2MJNBTjRPpCVy7rahb7UeMLJSojCPy3yhVE9t6ImnTCUjZYTnJsFtwIwqc\nePRd\r\n=kR7C\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHMvJT8bxFjYBYxWXEunzdQOv68e+jVMLqel5l0g18cMAiEApl84bN/VH4N4aiQOpzEcodvLfYtZneVJ/LgsowqM2QA="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.0.0-alpha.1_1546937874303_0.9927010839974146"},"_hasShrinkwrap":false},"2.0.0-beta.0":{"name":"beidou-view","version":"2.0.0-beta.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"b601b857e2d005cdad7cb7b73462a7e02f23f8e9","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## initialprops\n\nInject props into Component before render.\n\n|      File      |         Field          |      Type      |   Default   | Description                 |\n| :------------: | :--------------------: | :------------: | :---------: | :-------------------------- |\n| View Component | `View.getInitialProps` | Function/Async | `undefined` | Inject props into Component |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md","_id":"beidou-view@2.0.0-beta.0","_nodeVersion":"10.14.2","_npmVersion":"lerna/3.10.5/node@v10.14.2+x64 (darwin)","dist":{"integrity":"sha512-TWvQu2B5HL5AR8q/v6hbVe9fVwkmODs5p0XDD2ff2Oo81jTSMEpuRgbDDnSwOmGq4iDpQ5NonQ6PmNuXf9gSRw==","shasum":"9aa7ed2aa647bcebc4de8674502eb21b105e272b","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.0.0-beta.0.tgz","fileCount":13,"unpackedSize":15646,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcOFQLCRA9TVsSAnZWagAA0fsQAJDw6oZtVAs5P4f/Q3J4\nUdd60N9MnpJkj3MlYxIuY5ES902IzBO49HDWsA3K6gAruUKl+ojh9uEnYNeK\n2gWi1/iCNDbMzOpjBdbx/eH7PGv+2CXksSMhKXgpfu8GiUIitCE1TxZk/9aQ\nkXGObpE0kr06e9n7aTVOyaSfdsgJ/hv98LXT8tTGaCnLS0ud3Lp4smjoRjPV\ncEmOUogVz0Zon3yjyMM3pLA1O13uIu9LZS1bCtOwNi3sdbqSEWkDGiXA1Rxw\n1qxWxmk0K8p0Ccq6LpLAfEm5UDSgPy9aMTD3bmRgkvN9fx1nedSDjxcrzln6\n7nxQp3rJVWfsgecoPv//RcqSKVDl4j3vqfbuJ+onoacj3FXIRC4gM6pV/b5x\n0apAwk1C4UcktkZF9g00iki3BUivpi2xorGMivoflGJ7MgcjrD6s7HuKnL5R\nfhNTUozwXxr0/h9zywJ5ljS+G2LjghlnDA38Cd8fd4O3sfjUgR9YYB/7Snrr\nSqOa8zRCYjRMCmyKcDX53lqLzgn6b0js4SFhRXzBmKc9Zmqjfla0KvGBRnfj\nHlAlyROyHiCspz+1dqkvvq44RBU9IA8ECqbviHnXZu6PO1FiFSMHj1mwxuD+\nuCP3pxy+kWqJrjGxMuB8KS6WZxoDI6k+sKGP6jahYZ1+xqpUjf6zkXXl+cAh\n0Ypb\r\n=HrEd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCb30oE2iniYGuYBzc/EpHp1fR5bwbmnL7RFnziZV49+gIgSG83P8Z80acQkjh4Vy9LAXjLzibTF700WhFPtRakCd0="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.0.0-beta.0_1547195402486_0.06061417319967011"},"_hasShrinkwrap":false},"2.0.0":{"name":"beidou-view","version":"2.0.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"9dff20044847ec621877f1105de0f61368f4284b","_id":"beidou-view@2.0.0","_nodeVersion":"10.14.2","_npmVersion":"lerna/3.10.5/node@v10.14.2+x64 (darwin)","dist":{"integrity":"sha512-1sOSTahGlrBd+FOZgIzWj+4hcGzT990fv3mrmklI/E2ueVDCLYBsJpa6wmAPwrcsb3x60W+Z2FLDJx7pmmS7DA==","shasum":"d224c55235d47790dd3e7ae5c5d41ac0a01ea408","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.0.0.tgz","fileCount":13,"unpackedSize":15808,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPx+VCRA9TVsSAnZWagAAa7QP/37BEv5IMUEbLnLPrW/a\n3FqhMuHVDr5W8QCKiXrnu0GeO1WjmdZNDf0FiCKWii4ZaCpXKRGqDDAOb957\nR05mln286APoKVw++8EnQMCSS8WpVB6d420NpEn7BLqJ/vCBXDSPfZwnhm1B\n+3HxkK8Vm5cW0CBub5yuFmYOMBRTMCgtu0y2DYIvd+zgmxb8qqlt1o3BZrho\nUAzsR/KCCNyLE5PmFbqRUBgAqgbkkeU+/Dbv/AfxZAZKT+0gzaPDVYAbam9s\nra7zdemhdetHqg4BwSGyIEVPR+8VN/BK16xIPuNcaezmpLlQo9JyLplLyUnk\nGAXi+YAZu72BMs483pikA8yJOiymLTJhg/7VAbnVqWFBO7rJQlo6wDlvWI66\n6pmKIB+QEHOZfEd06mF+mqh1o6TrodMfBKmRfs87PDVnefcB2c4dBM9P08H4\nj0LTZLmhzaTdsWdDz/iJ73/Ra1Ew7EGDzrWPvSPNDH7Ba+ojJhfbDxaHj4gk\nrzq2velAu50b1zKhYn3xuOhMUCzqfqLFdXSK7DV1h3MpDUJhm6dBFj1yRRMW\nutm+uHILLRsS60aBdN6oMuGgPcl3EdxUxlXzbYql/FRgTfwm0m00U+DPS3Rd\n7gjf4FlJDgzj2RM/W6rTzndPKxKmeYA1MTeaCZE9cuW1LZZ/yxwhuCMli6vx\nw2vo\r\n=gcbH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEhz+AFCbyO+jvy29RsQO6Ib81KquXG4Udynsf6NoOEYAiBIwUtqBrnAPLQuIkkzdbIj5As+jbUYt9FTS/zuiu3gPQ=="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.0.0_1547640724840_0.17881532272110046"},"_hasShrinkwrap":false},"2.0.1":{"name":"beidou-view","version":"2.0.1","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"c5704dce53d214be324134454773ad2d7ba7e191","_id":"beidou-view@2.0.1","_nodeVersion":"10.15.0","_npmVersion":"lerna/3.10.7/node@v10.15.0+x64 (darwin)","dist":{"integrity":"sha512-IXlTjr1tbh/IIlM95f97+UqZLk7F9TewKbcEnfH2TmR5bF6Flz4YDre0G7gZOK7qJvhetyp4uSQO9aHX4pm29w==","shasum":"003fa0819afabe21948179e4f3a5670ee8261f48","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.0.1.tgz","fileCount":13,"unpackedSize":15920,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcUFLyCRA9TVsSAnZWagAAq6YQAIh3ScNyCbCuMrZwYo/R\nSojOKMyyxRyY1vpovAFx6CkSMGznHuLm3+2cItoXLeJiVibdZnyVo5wUOEfR\nPtRycKtOVgSGM9Bx9CjMSsavKO7YxWAYE5nRCDBmhXSweLCLuDabFlKZtixx\nkho8HbiFXeHHxYflVpT1poOftYYIFaT1GSaE9a7W2z+Vc18THHvwXi21noKq\nvbhz6zS6/SjguW9IqWZgT8hUWB6eRQPLoGxe+RVK66QnL6howXllocQYM8vZ\nyPLtVR7UQZ4aUyprBAXVyuZha+N5+0Z5eS7hoH2NAgM++7DdPDLqEh1DtntT\ngBI3Vl8vLjBz0xqMmG8OmgmlZEv/7zF1Iz4jWd4NLvdv35A5g+8yYb+4OF73\n9SFMm23lfa8kFVSctwrlf0An2hpZ+oh2iSYI2hRWH7QcE/1R1EriDwvNJ1GA\n+M7+yTeS1/+/iDwbLpyC6CI03bmuWTi5wWsz8rwnaNEZfClYQTISYid4uTxU\nMthHze2AEmscy7NphbHh7o8IXm7Uiwqibqm5F5M+m65fxU/948WYRqhR9Ebn\nBgBrqz2syaY0edv63kJkScSzRQU2kz6P9JzgaO/m88D92mYN0fAFJVKvUVkx\nTys4Xunq1dGUFwNr4AawRkRd30xQBb6ZlhimYqQVj/o2VUMe4EFlE9Bobu7A\nrBgh\r\n=6pUY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDM0XpPPbqViUncglOnFjbiBntIZTnG66m8pzoKfHU3rAiEAm78vprUlFvyKc6DmzX/UNvtP1RCpx6O1JynjQxOLh5U="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.0.1_1548767986180_0.7151783653696246"},"_hasShrinkwrap":false},"2.1.0":{"name":"beidou-view","version":"2.1.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"283fef24abb0ffb63d2bfbede20e379e3458fa7f","_id":"beidou-view@2.1.0","_nodeVersion":"10.15.0","_npmVersion":"lerna/3.10.7/node@v10.15.0+x64 (darwin)","dist":{"integrity":"sha512-kkKm8v6Iy2+vGKj4gC5rzXPBArbhw3U4eNsG5+tJudc0WUrIg1dPEGVlWYu39h/WDvIWFXlUx5VIraiXs4OhoQ==","shasum":"a5a1a5b7df7dfbd9f55b7aad0f2fc2a13c5d4bc8","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.1.0.tgz","fileCount":14,"unpackedSize":17356,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcwuAECRA9TVsSAnZWagAAUgUQAIMHfEzNxOTYu4suword\nE2n7RxGfB27tTN6F6omxKH2k/SPLIRDGYzyo2yKuD4eiMCbkHAZ9klxAIfLv\nqMF488O5p7r2OSsDj7VH0pU8875gtQnmlBUkE3vRLgyZ1Oq2r5eIzW4IQEjH\nBs2AiPcVTU8cJGK0hiLoKv6yeovV0gPNI9AB63IkS8LGNygh1dgo/H+JGaSY\nsMFjADmEVONK/kcb/KwHgB7gXbccnKnknzXbY2zAVxPLvZL352yPqr1O6bSg\nI8yCVRu3cH/K6d/07SjyrpNF/58ffAV3OdFPutWZb8gEAYQUrZYZ8YJi/zSu\neV327lWO+wjkdqyyKxarYRd9eoH/PLMSqF7EELGWiARx6wDHLWQdAmzyhm86\nGLQvnhBf9U3237Nheec74dQ5nX14Rd2jk1kfUwLilYh3NMttiRy7QPGJ58Oo\nlHZAHp8EcmESZzgMX4I9j/no2Jw4kGkjqMQMDiCH+fdD1ofet13Sxb8NHnnm\nLvMp3VDOlPFU02abbpLmq4m8Ksy9KGCvVZ6493MPDMCEgPDjCF5btAhl2uZ/\nFKCLrxFOZORTZ+doIuLs5mwZSRJzUDq2Vwjw5mA1ZQHpcvEnmtsi8GQWEXcx\nHHeaCS2rWUVNWJHIb4zaCnTaczc/gMgb8Wv2klL9+bvZrYnVWSTJmnpDwuE1\njy9A\r\n=QhKi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID0Mq5JtoeEVVWEFA780RW/EG94FeSsSMDtwtleqCsIrAiA4Anw+/ecveUrkDC0raxRkwycs1FCAiEwx5/UHGRkzDw=="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.1.0_1556275203872_0.46825668470976245"},"_hasShrinkwrap":false},"2.1.1":{"name":"beidou-view","version":"2.1.1","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"8068627513a7b82197de93d86daf98def6594dab","_id":"beidou-view@2.1.1","_nodeVersion":"10.15.0","_npmVersion":"lerna/3.10.7/node@v10.15.0+x64 (darwin)","dist":{"integrity":"sha512-nU3sMtcS5c8WXjsQd0iYvo1qXa8aLbOrCZBY/Hq6oNf848JBeAsIL6tSeewyTzlPXLcqfNHG9RZNj3ql1kPnrg==","shasum":"714c9aef8b493cc44442f6a90c0a78e971e963cf","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.1.1.tgz","fileCount":15,"unpackedSize":18117,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcz9BsCRA9TVsSAnZWagAAe5IP/iCAFlQGIFKkf86Sp8sU\n7B8/Fx7xR6nA5Chl/T72Fo7DnUOyK69J+sVFlieiTm0U7IOuRpGMljq3h7Fz\nYSynG31O/HGboETJqQQlvUOUa5Re2aJwziZhD6aGTFEhrZf49llGZXzA58QV\niyXDnUOwChIYtndsHF++4aB5J51jooIEWvfY06gGsClnNXbCLZbRzNRDpn+Y\nu/EkGzNfgDC7V7X/BMgeQ+SlgxL+XIXTEXQYSolksO9ShxOjj91/n3oYxTnl\n8jRSSpHbFIOUNmKlEVGWuhFA9tUnx1yy8iB0VhBWwAmkj/kG8DsUUxahsueI\n6zHDGfM/a2BdjnvZwIe2Wir8ZQsJ+aBwunv6KzbndOIfXNBNReR01rKiStDz\nmKB/U4/wZAB2FcbiXZpPPeMWwIOPsrypIqixACFFYhW3tRrmyzPfrvZKJYzG\nB7fE0O3gHiVJYENnMYoFS8WyJ1nwczt0UQcRRlzopqu+vmYtEnwYO1X1qUV3\naW4pXbRvSte4PUAqxk9WoIbsa+f9weu2dWNfoEnMOWjyfwdslyHZpUvF8x94\neb7avNw2bRXXuXtd1lNc0wRY1TWtPeR2xDbjHefbMkTTXJTLrKccYFV4MYw4\nbMcG02YdeCMcQCKZ1JV6TqcahhbeDBjVwqCUoMOHfRsizi5BuaDnF5SdwlNt\ntSEt\r\n=fCTb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFcsmsEc5Jcgl+fFMw9Q2WH6K4tzmnz2zHwIRt7IjZ0cAiEAmLWxJZhBxOdzE+vqDdh0DXeHipKCJftM8SO2gPBWq0g="}]},"maintainers":[{"email":"devrsi0n@gmail.com","name":"devrsi0n"},{"email":"njugray@gmail.com","name":"njugray"}],"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.1.1_1557123180149_0.6219347230238306"},"_hasShrinkwrap":false},"2.3.0":{"name":"beidou-view","version":"2.3.0","description":"beidou base view plugin","eggPlugin":{"name":"beidouView"},"main":"index.js","scripts":{"test":"TEST_REPORTER=spec egg-bin test","cov":"TEST_REPORTER=spec egg-bin cov","history":"egg-bin history CHANGELOG.md"},"license":"MIT","dependencies":{"escape-string-regexp":"^1.0.5","is-type-of":"^1.2.0","js-beautify":"^1.6.2","koa-compose":"^4.0.0","lodash.escaperegexp":"^4.1.2","normalizeurl":"^1.0.0","serialize-javascript":"^1.3.0"},"devDependencies":{"egg-bin":"^4.0.0","egg-core":"^4.9.1","egg-mock":"^3.7.1"},"engines":{"node":">= 8.0.0"},"repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"gitHead":"218112eb300d7b82add9bc03b637e0fc5b482c1b","_id":"beidou-view@2.3.0","_nodeVersion":"14.7.0","_npmVersion":"lerna/3.22.0/node@v14.7.0+x64 (darwin)","dist":{"integrity":"sha512-IKfM7sqQ+9+mVud1eATP5jYrTbOZQlILKebsXwIRzhl+4gF8G5Wszu7zrVYxA/oIJ1IJLy73Ma8uSLxZFlYogw==","shasum":"5851e5f0ccc99193014cd3dbe4e385cad018043c","tarball":"https://registry.npmjs.org/beidou-view/-/beidou-view-2.3.0.tgz","fileCount":15,"unpackedSize":18117,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHhisACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqD4w//f+bgNwtdYVpJaKpY6F6sRyKqAicd0r5ZZfmVXDE6Z3aimfM8\r\nZWt/cEICtYTffNL7yQcDijPRi965SzYI+Z+QF+jNvz6YChDtRK9ibpBmhjwx\r\nk1RU/8pII4l3tMjOR5AgoetXmaNXQjLP/9w23zTRc1CtFfvEnp07fB4ESqs1\r\nHj0Zq4w9pyGvx4dRu6ytj/C7UtnFTSqj4tBIedlPphWfL8+NhRVPF9sCBr1B\r\nELTJhjOnN2ADgZ6r06TILWUfrsY7wOAZGJ1vIq7Yy43MdzOIINuEE1lQI7wZ\r\nYz2cniUlecaDiRWy0KxDJSB+1Bc2XtdHQZ9BG4x9/uiafns0wklLU9v+tnhD\r\ngjU8UqW1myforLiX8NIRXFthAR/9ZURrXz15XyQ+gPOFdtWn5Xm4Os7MrGfp\r\nb+qaSxWQzDuHEWHuDWrXiV0wkJQLTMZCslVePaAi5C1nr3GGgL1jtYlID3U9\r\nDuY/Rbz7KrNWI7jvmgbnNvEJ1zLhRu9aKyx7oZbOsVHLvKTB0uvQCL0K1HXM\r\nneCCCJege3gYAFUzNWjjsP1CLmrm1nEtyb0sk7tTCOTFNFvu0JZUiePsclIR\r\noAZeo7XupnFO3Om2bxKe9liepcRs40sy+tQal7Ev4Am2z7/6FROmnvDRqQqe\r\nwQFkxVe0FlYg4rijKGmPkPG7TEYNwAZqv38=\r\n=akAt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAYzNXD4hTcxbrjn2kKBt0gK4pDtb0cP3YNixSP6DpAwIgfhItu8mScBTAtMy8RARgxLYwo40Ha9TnYaYXL5JEEmk="}]},"_npmUser":{"name":"njugray","email":"njugray@gmail.com"},"directories":{},"maintainers":[{"name":"njugray","email":"njugray@gmail.com"},{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/beidou-view_2.3.0_1646139564072_0.2628382619619496"},"_hasShrinkwrap":false}},"time":{"created":"2018-02-09T01:55:03.681Z","0.0.1":"2018-02-09T01:55:03.745Z","modified":"2022-06-13T04:30:17.988Z","1.0.0-alpha.1":"2018-02-09T02:09:01.909Z","1.0.0-alpha.2":"2018-02-09T03:03:48.959Z","1.0.0-alpha.3":"2018-02-12T10:51:59.917Z","1.0.0-alpha.4":"2018-02-24T11:24:54.669Z","1.0.0-alpha.5":"2018-03-01T09:29:30.291Z","1.0.0-beta.0":"2018-03-09T11:35:58.922Z","1.0.0-beta.1":"2018-03-09T12:12:05.203Z","1.0.0-beta.2":"2018-03-15T02:34:59.157Z","1.0.0-beta.3":"2018-03-21T11:51:54.859Z","1.0.0":"2018-03-23T06:42:59.679Z","1.0.3":"2018-04-24T04:36:02.926Z","1.0.8":"2018-08-11T09:53:40.370Z","1.0.9":"2018-09-17T06:53:53.003Z","1.0.10":"2018-11-21T02:57:52.627Z","1.1.0":"2018-12-18T04:54:42.965Z","2.0.0-alpha.0":"2018-12-26T11:54:27.396Z","2.0.0-alpha.1":"2019-01-08T08:57:54.413Z","2.0.0-beta.0":"2019-01-11T08:30:02.641Z","2.0.0":"2019-01-16T12:12:04.977Z","2.0.1":"2019-01-29T13:19:46.262Z","2.1.0":"2019-04-26T10:40:04.035Z","2.1.1":"2019-05-06T06:13:00.311Z","2.3.0":"2022-03-01T12:59:24.238Z"},"maintainers":[{"name":"njugray","email":"njugray@gmail.com"},{"name":"devrsi0n","email":"devrsi0n@gmail.com"}],"description":"beidou base view plugin","repository":{"type":"git","url":"https://github.com/alibaba/beidou/tree/master/packages/beidou-view"},"license":"MIT","readme":"# Beidou base view\n\n> React view\n\nUsed by internal react and rax plugins.\n\n# Config\n\nIf `config.view.useHashAsset` is set true, beidou will use hashed assets on the page if not local env with the help of `webpack build`. You can set CDN path in `publicPath`, which will be included.\nRemember that, you should run `beidou build` first before use this feature.\n\nYou can define the assets mapping file with `config.view.hashAssetPath`, the default value of which is `path.join(appInfo.baseDir, '.manifest.json')`.\n\n# Middlewares\n\nWe introduced **View Middlewares** mechanism since `v1.0.0`. The rendering process is fully defined by a combination of middlewares, which means you can redefined them or add custom ones if needed.\n\n## How is works\n\n> The `${viewType}` below means a specific view implemented from `beidou-view`, such as `react` `rax` and so on.\n\nFirstly, a rendering process accepts a **context object**, we call it `View Context`. And the context will be passed in many middlewares in sequence which defined in `config.${viewType}.middlewares`. For example, in `beidou-view-react`:\n\n```js\n// config/config.default.js\nmodule.exports = {\n  react: {\n    middlewares: ['cache', 'redux', 'partial', 'render', 'doctype', 'beautify'],\n  },\n};\n```\n\nThe array in field `react.middlewares` contains names of view middlewares which correspond to the file located in all `app/view-middlewares`, both project and plugin directories.\n\nFiles in `app/view-middlewares` are automaticly loaded from all available pathes, so custom middlewares could be placed at your project directory of a custom plugin you write.\n\nSo, how is a view middleware like? Take `doctype` middleware for example:\n\n```js\nmodule.exports = async function(viewCtx, next) {\n  await next();\n\n  const defaultDoctype = viewCtx.options.doctype;\n  const { html, Component } = viewCtx;\n  const doctype = Component.doctype || defaultDoctype;\n  if (doctype && typeof doctype === 'string') {\n    viewCtx.html = doctype + html;\n  }\n};\n```\n\n**doctype** interplolates **html doctype** after view component rendering finished when `viewCtx.html` produced.\n\nThe `viewCtx.html` is final context sended to browser.\n\n# List of Middlewares\n\n## cache\n\n**cache** cleans **require cache** everytime a rendering begin when `config.${viewType}.cache` is `true`.\n\n### Configuration\n\n|        File        |           Field            |  Type   | Default | Description                 |\n| :----------------: | :------------------------: | :-----: | :-----: | :-------------------------- |\n| `config.${env}.js` | `config.${viewType}.cache` | Boolean | `true`  | Don't clean cache if `true` |\n\n## initialprops\n\nInject props into Component before render.\n\n|      File      |         Field          |      Type      |   Default   | Description                 |\n| :------------: | :--------------------: | :------------: | :---------: | :-------------------------- |\n| View Component | `View.getInitialProps` | Function/Async | `undefined` | Inject props into Component |\n\n## redux\n\nProvide store **constructing** and **serialization** of redux.\n\n|      File      |      Field      |      Type      |   Default   | Description                       |\n| :------------: | :-------------: | :------------: | :---------: | :-------------------------------- |\n| View Component | `View.getStore` | Function/Async | `undefined` | function(viewCtx.props): StoreMap |\n\nSee [Redux Example](https://github.com/alibaba/beidou/tree/master/examples/redux) for usage.\n\n### Why need serialization\n\nUsually, we use JSON object wrapped in `<script>` tag to pass data from server to client. `JSON.stringify` is not safe because of XSS.\n\nFor example:\n\n```js\n{\n  foo: `</script>`;\n}\n```\n\nString `</script>` close script tag in accident, data broken and page messed up.\n\nWe use [serialize-javascript](https://github.com/yahoo/serialize-javascript) to serialize JavaScript to a superset of JSON that includes regular expressions and functions.\n\n## partial\n\nRender react component into string Dymaticlly.\n\n|      File      |       Field       |      Type      |   Default   | Description                                |\n| :------------: | :---------------: | :------------: | :---------: | :----------------------------------------- |\n| View Component | `View.getPartial` | Function/Async | `undefined` | function(viewCtx.props): ReactComponentMap |\n\n## doctype\n\nDefine html doctype.\n\n|        File        |            Field             |  Type  |       Default       | Description           |\n| :----------------: | :--------------------------: | :----: | :-----------------: | :-------------------- |\n| `config.${env}.js` | `config.${viewType}.doctype` | String | `'<!DOCTYPE html>'` | Global doctype config |\n|   View Component   |        `View.doctype`        | String |     `undefined`     | View doctype config   |\n\n## beautify\n\nBeautify html ouput.\n\n|        File        |             Field             |  Type  | Default | Description             |\n| :----------------: | :---------------------------: | :----: | :-----: | :---------------------- |\n| `config.${env}.js` | `config.${viewType}.beautify` | String | `false` | enable/disable beautify |\n\n> This may cause a React warning tells DOM element unmatch between server side and client side result. We recommend to use this in development, to get a friendly html format.\n\n## License\n\n[MIT](LICENSE)\n","readmeFilename":"README.md"}