summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core')
-rw-r--r--packages/gitbook-core/package.json96
-rw-r--r--packages/gitbook-core/src/lib/bootstrap.js7
-rw-r--r--packages/gitbook-core/src/lib/renderWithContext.js12
3 files changed, 59 insertions, 56 deletions
diff --git a/packages/gitbook-core/package.json b/packages/gitbook-core/package.json
index 4e3974e..0c444b7 100644
--- a/packages/gitbook-core/package.json
+++ b/packages/gitbook-core/package.json
@@ -1,49 +1,49 @@
{
- "name": "gitbook-core",
- "version": "0.0.0",
- "description": "Core for GitBook plugins API",
- "main": "./lib/index.js",
- "dependencies": {
- "bluebird": "^3.4.6",
- "classnames": "^2.2.5",
- "entities": "^1.1.1",
- "history": "^4.3.0",
- "html-tags": "^1.1.1",
- "immutable": "^3.8.1",
- "react": "^15.3.1",
- "react-dom": "^15.3.1",
- "react-helmet": "^3.1.0",
- "react-immutable-proptypes": "^2.1.0",
- "react-intl": "^2.1.5",
- "react-redux": "^4.4.5",
- "react-safe-html": "^0.3.0",
- "redux": "^3.5.2",
- "redux-thunk": "^2.1.0",
- "reflexbox": "^2.2.2",
- "whatwg-fetch": "^1.0.0"
- },
- "devDependencies": {
- "babel-cli": "^6.14.0",
- "babel-preset-es2015": "^6.14.0",
- "babel-preset-react": "^6.11.1",
- "babel-preset-stage-2": "^6.13.0",
- "browserify": "^13.1.0",
- "envify": "^3.4.1",
- "uglify-js": "^2.7.3"
- },
- "scripts": {
- "dist-lib": "rm -rf lib/ && babel -d lib/ src/",
- "dist-standalone": "mkdir -p dist && browserify -r ./lib/index.js:gitbook-core -r react -r react-dom ./lib/index.js | uglifyjs -c > ./dist/gitbook.core.min.js",
- "dist": "npm run dist-lib && npm run dist-standalone",
- "prepublish": "npm run dist"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/GitbookIO/gitbook.git"
- },
- "author": "GitBook Inc. <contact@gitbook.com>",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/GitbookIO/gitbook/issues"
- }
-}
+ "name": "gitbook-core",
+ "version": "4.0.0",
+ "description": "Core for GitBook plugins API",
+ "main": "./lib/index.js",
+ "dependencies": {
+ "bluebird": "^3.4.6",
+ "classnames": "^2.2.5",
+ "entities": "^1.1.1",
+ "history": "^4.3.0",
+ "html-tags": "^1.1.1",
+ "immutable": "^3.8.1",
+ "react": "^15.3.1",
+ "react-dom": "^15.3.1",
+ "react-helmet": "^3.1.0",
+ "react-immutable-proptypes": "^2.1.0",
+ "react-intl": "^2.1.5",
+ "react-redux": "^4.4.5",
+ "react-safe-html": "^0.3.0",
+ "redux": "^3.5.2",
+ "redux-thunk": "^2.1.0",
+ "reflexbox": "^2.2.2",
+ "whatwg-fetch": "^1.0.0"
+ },
+ "devDependencies": {
+ "babel-cli": "^6.14.0",
+ "babel-preset-es2015": "^6.14.0",
+ "babel-preset-react": "^6.11.1",
+ "babel-preset-stage-2": "^6.13.0",
+ "browserify": "^13.1.0",
+ "envify": "^3.4.1",
+ "uglify-js": "^2.7.3"
+ },
+ "scripts": {
+ "dist-lib": "rm -rf lib/ && babel -d lib/ src/",
+ "dist-standalone": "mkdir -p dist && browserify -r ./lib/index.js:gitbook-core -r react -r react-dom ./lib/index.js | uglifyjs -c > ./dist/gitbook.core.min.js",
+ "dist": "npm run dist-lib && npm run dist-standalone",
+ "prepublish": "npm run dist"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/GitbookIO/gitbook.git"
+ },
+ "author": "GitBook Inc. <contact@gitbook.com>",
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/GitbookIO/gitbook/issues"
+ }
+} \ No newline at end of file
diff --git a/packages/gitbook-core/src/lib/bootstrap.js b/packages/gitbook-core/src/lib/bootstrap.js
index f5183d1..f3c99b7 100644
--- a/packages/gitbook-core/src/lib/bootstrap.js
+++ b/packages/gitbook-core/src/lib/bootstrap.js
@@ -5,9 +5,10 @@ const createContext = require('./createContext');
const renderWithContext = require('./renderWithContext');
/**
- * Bootstrap GitBook on the browser (this function should not be called on the server side)
+ * Bootstrap GitBook on the browser (this function should not be called on the server side).
+ * @param {Object} matching
*/
-function bootstrap() {
+function bootstrap(matching) {
const initialState = getPayload(window.document);
const plugins = window.gitbookPlugins;
@@ -19,7 +20,7 @@ function bootstrap() {
window.gitbookContext = context;
// Render with the store
- const el = renderWithContext(context);
+ const el = renderWithContext(context, matching);
ReactDOM.render(el, mountNode);
}
diff --git a/packages/gitbook-core/src/lib/renderWithContext.js b/packages/gitbook-core/src/lib/renderWithContext.js
index 44f8ba4..f9a093c 100644
--- a/packages/gitbook-core/src/lib/renderWithContext.js
+++ b/packages/gitbook-core/src/lib/renderWithContext.js
@@ -9,7 +9,8 @@ const contextShape = require('../shapes/context');
const GitBookApplication = React.createClass({
propTypes: {
- context: contextShape
+ context: contextShape,
+ matching: React.PropTypes.object
},
componentDidMount() {
@@ -23,13 +24,13 @@ const GitBookApplication = React.createClass({
},
render() {
- const { context } = this.props;
+ const { context, matching } = this.props;
return (
<ContextProvider context={context}>
<PJAXWrapper>
<I18nProvider>
- <InjectedComponent matching={{ role: 'Body' }} />
+ <InjectedComponent matching={matching} />
</I18nProvider>
</PJAXWrapper>
</ContextProvider>
@@ -42,11 +43,12 @@ const GitBookApplication = React.createClass({
* Render the application for a GitBook context.
*
* @param {GitBookContext} context
+ * @param {Object} matching
* @return {React.Element} element
*/
-function renderWithContext(context) {
+function renderWithContext(context, matching) {
return (
- <GitBookApplication context={context} />
+ <GitBookApplication context={context} matching={matching} />
);
}