├── tests ├── builder-babel │ ├── src │ │ ├── .browserslistrc │ │ ├── .babelrc.js │ │ └── main.js │ ├── lib │ │ └── server.js │ ├── babel.config.js │ ├── plugin-hi.js │ └── plugin-hey.js ├── postcss │ ├── src │ │ ├── .browserslistrc │ │ ├── main.css │ │ └── main.js │ ├── lib │ │ └── server.js │ ├── postcss.config.js │ └── gourmet_config.js ├── builder-deps │ ├── src │ │ ├── data.json │ │ └── files │ │ │ ├── 1.js │ │ │ └── 2.js │ ├── lib │ │ └── server.js │ └── gourmet_config.js ├── news │ ├── lib │ │ └── server.js │ └── src │ │ └── NewsApp.css ├── builder-ltc │ ├── lib │ │ └── server.js │ ├── gourmet_config.js │ └── src │ │ └── main.js ├── fake-github │ ├── lib │ │ └── server.js │ ├── src │ │ ├── images │ │ │ └── john_doe_profile.jpeg │ │ ├── containers │ │ │ └── themeVars.js │ │ └── components │ │ │ ├── Container.jsx │ │ │ └── FormHeader.jsx │ └── gourmet_config.js ├── global-css │ ├── lib │ │ └── server.js │ ├── src │ │ ├── admin.js │ │ ├── hello.js │ │ └── hello.css │ └── gourmet_config.js ├── i80-basic │ ├── lib │ │ └── server.js │ ├── src │ │ ├── HomeView.jsx │ │ ├── ProfileView.jsx │ │ ├── MessagesView.jsx │ │ └── PageBase.jsx │ └── gourmet_config.js ├── i80-misc │ ├── lib │ │ └── server.js │ ├── gourmet_config.js │ └── src │ │ └── DateView.jsx ├── loadable │ ├── lib │ │ └── server.js │ ├── src │ │ ├── LoadableB.jsx │ │ ├── LoadableA.jsx │ │ ├── PanelA.jsx │ │ └── PanelB.jsx │ └── gourmet_config.js ├── multi-pages │ ├── lib │ │ └── server.js │ ├── src │ │ ├── renderProps.js │ │ └── MainPage.js │ └── gourmet_config.js ├── multi-views │ ├── lib │ │ └── server.js │ ├── gourmet_config.js │ └── src │ │ ├── renderProps.js │ │ ├── DashboardView.js │ │ └── IndexView.js ├── todo-apollo │ ├── lib │ │ ├── server.js │ │ ├── schema.js │ │ ├── resolvers.js │ │ └── TodoData.js │ ├── src │ │ ├── TodoLoadable.js │ │ └── TodoApp.js │ └── gourmet_config.js ├── todo-redux │ ├── lib │ │ └── server.js │ ├── src │ │ ├── reducers │ │ │ ├── index.js │ │ │ └── visibilityFilter.js │ │ ├── components │ │ │ ├── App.js │ │ │ ├── Todo.js │ │ │ ├── Link.js │ │ │ ├── Footer.js │ │ │ └── TodoList.js │ │ ├── actions │ │ │ └── index.js │ │ └── containers │ │ │ ├── FilterLink.js │ │ │ └── AddTodo.js │ └── gourmet_config.js ├── builder-basic │ ├── lib │ │ └── server.js │ ├── src │ │ ├── concat.js │ │ ├── client.js │ │ ├── print.mjs │ │ ├── server.mjs │ │ ├── renderer.js │ │ └── admin.js │ └── config │ │ └── gourmet_cfg.js ├── i80-loadable │ ├── lib │ │ └── server.js │ ├── src │ │ ├── HomePanel.jsx │ │ ├── ProfilePanel.jsx │ │ ├── MessagesPanel.jsx │ │ ├── HomeView.jsx │ │ ├── MessagesView.jsx │ │ ├── ProfileView.jsx │ │ └── PageBase.jsx │ └── gourmet_config.js ├── render-error │ ├── lib │ │ └── server.js │ ├── src │ │ ├── ServerError.js │ │ ├── ClientError.js │ │ └── InitError.js │ └── gourmet_config.js ├── builder-src │ ├── test │ │ └── fixture │ │ │ ├── module-a │ │ │ ├── index.js │ │ │ └── package.json │ │ │ └── module-b │ │ │ ├── gourmet-source │ │ │ └── main.js │ │ │ └── package.json │ ├── src │ │ └── main.js │ └── gourmet_config.js ├── i80-loadable-nested │ ├── lib │ │ └── server.js │ ├── src │ │ ├── initAdmin.js │ │ ├── images │ │ │ └── earth.png │ │ ├── HomePanel.jsx │ │ ├── MessagesPanel.jsx │ │ ├── PhotoLoadable.js │ │ ├── ProfilePanel.jsx │ │ ├── AdminPage.jsx │ │ ├── HomeView.jsx │ │ ├── CustomLoading.jsx │ │ ├── MessagesView.jsx │ │ ├── PageBase.jsx │ │ ├── PhotoPanel.jsx │ │ ├── ProfileView.jsx │ │ └── MultiLoadables.js │ └── gourmet_config.js ├── babel-polyfill │ ├── src │ │ └── main.js │ ├── gourmet_config.js │ └── package.json ├── react-hello │ ├── lib │ │ ├── local.js │ │ ├── http.js │ │ └── lambda.js │ └── gourmet_config.js ├── news-view │ ├── gmsrc │ │ ├── NewsDataClient.js │ │ ├── components │ │ │ └── Articles.jsx │ │ └── NewsDataServer.js │ ├── README.md │ └── package.json ├── cli-test-plugin │ ├── README.md │ ├── package.json │ └── lib │ │ └── GourmetPluginCliTest.js └── cli-basic │ ├── package.json │ ├── lib │ └── MyPlugin.js │ └── gourmet_config.js ├── utils ├── variables │ ├── test │ │ └── fixture │ │ │ ├── spaced file.json │ │ │ ├── config.json │ │ │ └── config.js │ ├── gmsrc │ │ ├── VarNode.js │ │ ├── sources │ │ │ ├── Self.js │ │ │ ├── Opt.js │ │ │ └── Env.js │ │ ├── VarValue.js │ │ └── VarGetter.js │ └── README.md ├── console │ ├── Console.js │ ├── README.md │ ├── index.js │ └── package.json ├── is-stream │ ├── gmsrc │ │ └── isStream.js │ ├── README.md │ └── package.json ├── error │ ├── HandledError.js │ ├── NOT_IMPLEMENTED.js │ ├── NOT_FOUND.js │ ├── TIMEOUT_ERROR.js │ ├── INVALID_METHOD.js │ ├── INVALID_PARAM.js │ ├── README.md │ ├── package.json │ └── gmsrc │ │ ├── HandledError.js │ │ └── error.js ├── prefix-lines │ ├── gmsrc │ │ └── prefixLines.js │ ├── README.md │ └── package.json ├── promise-tape │ ├── gmsrc │ │ └── promiseTape.js │ ├── README.md │ └── package.json ├── get-exported │ ├── gmsrc │ │ └── getExported.js │ ├── README.md │ └── package.json ├── base-x │ ├── README.md │ └── package.json ├── colors │ ├── README.md │ ├── package.json │ └── example │ │ └── demo.js ├── is-promise │ ├── gmsrc │ │ └── isPromise.js │ ├── README.md │ └── package.json ├── web-proxy │ ├── README.md │ ├── gmsrc │ │ └── index.js │ └── package.json ├── hash-names │ ├── README.md │ └── package.json ├── http-headers │ ├── README.md │ └── package.json ├── module-dir │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── moduleDir.js ├── parse-href │ ├── README.md │ └── package.json ├── send-content │ ├── README.md │ └── package.json ├── inspect-error │ ├── README.md │ └── package.json ├── promise-queue │ ├── README.md │ └── package.json ├── proxy-headers │ ├── README.md │ └── package.json ├── unprefix-path │ ├── README.md │ ├── package.json │ ├── test │ │ └── unprefix_path_test.js │ └── gmsrc │ │ └── unprefixPath.js ├── error-to-string │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── errorToString.js ├── is-plain-object │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── isPlainObject.js ├── promise-read-file │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── promiseReadFile.js ├── resolve-template │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── resolveTemplate.js ├── serialize-error │ ├── README.md │ └── package.json ├── stream-to-string │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── streamToString.js ├── plugin-sort │ ├── gmsrc │ │ └── index.js │ ├── README.md │ └── package.json ├── promise-write-file │ ├── README.md │ ├── gmsrc │ │ └── promiseWriteFile.js │ └── package.json ├── serialize-request-error │ ├── README-SRC.md │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── serializeRequestError.js ├── handle-request-error │ ├── README.md │ ├── gmsrc │ │ └── errorTemplate.js │ └── package.json ├── promise-protect │ ├── README-SRC.md │ ├── README.md │ ├── gmsrc │ │ └── promiseProtect.js │ └── package.json ├── promise-wrap │ ├── gmsrc │ │ └── promiseWrap.js │ ├── README.md │ └── package.json ├── storage-s3 │ ├── README.md │ └── package.json ├── deep-clone │ ├── README.md │ └── package.json ├── resolve-dirs │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── resolveDirs.js ├── storage-fs │ ├── README.md │ └── package.json ├── escape-script │ ├── README.md │ ├── gmsrc │ │ └── escapeScript.js │ └── package.json ├── merge │ ├── README.md │ └── package.json ├── promise-sync │ ├── README.md │ ├── gmsrc │ │ └── promiseSync.js │ └── package.json ├── plain-merge │ ├── README.md │ └── package.json ├── promise-deep-prop │ ├── README.md │ └── package.json ├── get-aws-service │ ├── README.md │ └── package.json ├── http-module │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── httpModule.js ├── omit │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── omit.js ├── promise-deep-clone │ ├── README.md │ └── package.json ├── promise-main │ ├── package.json │ ├── gmsrc │ │ └── promiseMain.js │ ├── README.md │ └── README-SRC.md ├── get-req-opts │ ├── README.md │ └── package.json ├── multi-stream │ ├── README.md │ └── package.json ├── relative-path │ ├── README.md │ ├── package.json │ └── gmsrc │ │ └── relativePath.js ├── promise-repeat │ └── package.json ├── promise-map │ ├── package.json │ ├── README-SRC.md │ ├── README.md │ └── gmsrc │ │ └── promiseMap.js ├── promise-create-write-stream │ └── package.json └── promise-each │ ├── package.json │ └── gmsrc │ └── promiseEach.js ├── runtime ├── renderer-sandbox │ ├── lib │ │ └── XMLHttpRequest │ │ │ └── package.json │ ├── README.md │ └── package.json ├── html-renderer │ ├── server.js │ ├── README.md │ ├── gmsrc │ │ └── pageTemplate.js │ └── package.json ├── middleware │ ├── lib │ │ ├── watch.js │ │ └── proxy.js │ ├── README.md │ └── package.json ├── cli-args │ ├── README.md │ └── package.json ├── client-http │ ├── README.md │ └── package.json ├── client-lib │ ├── README.md │ └── package.json ├── server-args │ ├── README.md │ └── package.json ├── client-lambda │ ├── README.md │ └── package.json ├── get-req-args │ ├── README.md │ ├── package.json │ └── lib │ │ └── getReqArgs.js ├── watch-middleware │ ├── README.md │ └── package.json ├── loadable-registrar │ ├── README.md │ └── package.json ├── http-server │ ├── README.md │ └── package.json ├── self-url │ ├── README.md │ └── package.json └── lambda-adapter │ ├── README.md │ └── package.json ├── .gitignore ├── docs ├── assets │ ├── hello-react.png │ ├── hello-source.png │ ├── tutorial-app.png │ ├── tutorial-login.png │ ├── guide-apollo-todo.png │ ├── guide-redux-todo.png │ ├── tutorial-header.png │ ├── tutorial-mock-ui.png │ ├── tutorial-signup.png │ └── tutorial-news-json.png ├── ref │ ├── react-loadable │ │ └── index.md │ ├── react-i80 │ │ └── index.md │ └── group-react-apollo │ │ └── index.md ├── reference.md └── guides │ └── index.md ├── examples ├── hello │ ├── gourmet_config.js │ ├── src │ │ └── hello.js │ ├── lib │ │ └── server.js │ └── package.json ├── redux │ ├── gourmet_config.js │ ├── README.md │ ├── src │ │ ├── reducers │ │ │ ├── index.js │ │ │ └── visibilityFilter.js │ │ ├── components │ │ │ ├── App.js │ │ │ ├── Todo.js │ │ │ ├── Link.js │ │ │ ├── Footer.js │ │ │ └── TodoList.js │ │ ├── actions │ │ │ └── index.js │ │ └── containers │ │ │ ├── FilterLink.js │ │ │ └── AddTodo.js │ ├── lib │ │ └── server.js │ └── package.json ├── redux-i80 │ ├── gourmet_config.js │ ├── README.md │ ├── src │ │ ├── reducers │ │ │ ├── index.js │ │ │ └── visibilityFilter.js │ │ ├── components │ │ │ ├── Settings.js │ │ │ ├── App.js │ │ │ ├── Todo.js │ │ │ ├── Link.js │ │ │ ├── Footer.js │ │ │ └── TodoList.js │ │ ├── actions │ │ │ └── index.js │ │ └── containers │ │ │ ├── FilterLink.js │ │ │ └── AddTodo.js │ ├── lib │ │ └── server.js │ └── package.json ├── redux-init │ ├── gourmet_config.js │ ├── src │ │ ├── reducers │ │ │ ├── index.js │ │ │ └── visibilityFilter.js │ │ ├── components │ │ │ ├── App.js │ │ │ ├── Todo.js │ │ │ ├── Link.js │ │ │ ├── Footer.js │ │ │ └── TodoList.js │ │ ├── containers │ │ │ ├── Root.js │ │ │ ├── FilterLink.js │ │ │ └── AddTodo.js │ │ └── actions │ │ │ └── index.js │ ├── README.md │ └── package.json ├── apollo │ ├── README.md │ ├── lib │ │ ├── schema.js │ │ ├── resolvers.js │ │ └── TodoData.js │ ├── src │ │ └── TodoApp.js │ └── gourmet_config.js └── apollo-manual │ ├── lib │ ├── schema.js │ ├── resolvers.js │ └── TodoData.js │ ├── README.md │ └── gourmet_config.js ├── website ├── static │ ├── img │ │ └── favicon.png │ └── css │ │ └── code-block-buttons.css ├── package.json └── sidebars.json ├── contrib ├── react-i80 │ ├── renderer.client.js │ ├── renderer.server.js │ ├── README.md │ ├── gmsrc │ │ ├── ActiveRoute.js │ │ └── index.server.js │ └── package.json ├── emotion-renderer │ ├── server.js │ ├── README.md │ └── package.json ├── react-renderer │ ├── server.js │ ├── README.md │ └── package.json ├── react-apollo-renderer │ ├── server.js │ ├── README.md │ ├── gmsrc │ │ └── handleLinkError.js │ └── package.json ├── react-context-gmctx │ ├── gmsrc │ │ └── GourmetContext.js │ ├── README.md │ └── package.json ├── plugin-react-i80 │ ├── README.md │ ├── package.json │ └── lib │ │ └── GourmetPluginReactI80.js ├── plugin-react-apollo │ ├── README.md │ └── package.json ├── plugin-react-emotion │ ├── README.md │ └── package.json ├── plugin-react-loadable │ ├── README.md │ └── package.json ├── react-loadable │ ├── README.md │ └── package.json └── plugin-react │ ├── README.md │ └── package.json ├── .eslintrc.json ├── cli ├── gourmet-cli │ ├── bin │ │ └── gourmet-cli.js │ ├── README.md │ └── package.json ├── gourmet-cli-impl │ ├── README.md │ ├── lib │ │ └── ContextSource.js │ └── package.json └── cli-base │ └── README.md ├── presets ├── core │ ├── lib │ │ └── GourmetPresetCore.js │ ├── README.md │ └── package.json └── react │ ├── lib │ └── GourmetPresetReact.js │ ├── README.md │ └── package.json ├── scripts ├── update-package │ └── package.json └── standalone-runner │ └── package.json ├── groups ├── core │ └── README.md ├── react │ └── README.md ├── react-emotion │ └── README.md ├── react-i80 │ ├── README.md │ ├── package.json │ └── lib │ │ └── GourmetGroupReactI80.js └── react-apollo │ ├── README.md │ └── package.json └── lerna.json /tests/builder-babel/src/.browserslistrc: -------------------------------------------------------------------------------- 1 | chrome 48 -------------------------------------------------------------------------------- /tests/postcss/src/.browserslistrc: -------------------------------------------------------------------------------- 1 | chrome 10 2 | ie 10 3 | -------------------------------------------------------------------------------- /tests/builder-deps/src/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "a": 1, 3 | "b": 2 4 | } -------------------------------------------------------------------------------- /tests/builder-deps/src/files/1.js: -------------------------------------------------------------------------------- 1 | module.exports = "module 1"; 2 | -------------------------------------------------------------------------------- /tests/builder-deps/src/files/2.js: -------------------------------------------------------------------------------- 1 | module.exports = "module 2"; 2 | -------------------------------------------------------------------------------- /tests/news/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/builder-ltc/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/fake-github/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/global-css/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/i80-basic/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/i80-misc/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/loadable/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/multi-pages/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/multi-views/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/postcss/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/todo-apollo/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/todo-redux/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /utils/variables/test/fixture/spaced file.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "good!" 3 | } -------------------------------------------------------------------------------- /tests/builder-babel/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/builder-basic/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/builder-deps/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/i80-loadable/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/render-error/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /tests/builder-src/test/fixture/module-a/index.js: -------------------------------------------------------------------------------- 1 | module.exports = class ModuleA {}; 2 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./app")(); 4 | -------------------------------------------------------------------------------- /runtime/renderer-sandbox/lib/XMLHttpRequest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "XMLHttpRequest.js" 3 | } -------------------------------------------------------------------------------- /tests/builder-src/test/fixture/module-b/gourmet-source/main.js: -------------------------------------------------------------------------------- 1 | module.exports = class ModuleB {}; 2 | -------------------------------------------------------------------------------- /tests/news/src/NewsApp.css: -------------------------------------------------------------------------------- 1 | .news-container { 2 | max-width: 50em; 3 | padding: 2em 0; 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .gourmet 3 | .test 4 | .local-chromium 5 | *.log 6 | node_modules 7 | website/build -------------------------------------------------------------------------------- /docs/assets/hello-react.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/hello-react.png -------------------------------------------------------------------------------- /docs/assets/hello-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/hello-source.png -------------------------------------------------------------------------------- /docs/assets/tutorial-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/tutorial-app.png -------------------------------------------------------------------------------- /tests/postcss/src/main.css: -------------------------------------------------------------------------------- 1 | /* comment */ 2 | ::placeholder { 3 | color: rgba(153, 211, 153, 0.8); 4 | } 5 | -------------------------------------------------------------------------------- /docs/assets/tutorial-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/tutorial-login.png -------------------------------------------------------------------------------- /examples/hello/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/hello.js" 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /tests/builder-basic/src/concat.js: -------------------------------------------------------------------------------- 1 | export default function concat(...args) { 2 | return args.join("\n"); 3 | } 4 | -------------------------------------------------------------------------------- /website/static/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/website/static/img/favicon.png -------------------------------------------------------------------------------- /docs/assets/guide-apollo-todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/guide-apollo-todo.png -------------------------------------------------------------------------------- /docs/assets/guide-redux-todo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/guide-redux-todo.png -------------------------------------------------------------------------------- /docs/assets/tutorial-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/tutorial-header.png -------------------------------------------------------------------------------- /docs/assets/tutorial-mock-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/tutorial-mock-ui.png -------------------------------------------------------------------------------- /docs/assets/tutorial-signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/tutorial-signup.png -------------------------------------------------------------------------------- /tests/global-css/src/admin.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | return '
This is admin
'; 3 | }; 4 | -------------------------------------------------------------------------------- /contrib/react-i80/renderer.client.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./gmsrc/getI80ClientRenderer"); // eslint-disable-line strict 2 | -------------------------------------------------------------------------------- /contrib/react-i80/renderer.server.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./gmsrc/getI80ServerRenderer"); // eslint-disable-line strict 2 | -------------------------------------------------------------------------------- /docs/assets/tutorial-news-json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/docs/assets/tutorial-news-json.png -------------------------------------------------------------------------------- /examples/redux/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/containers/Root.js" 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /runtime/html-renderer/server.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./gmsrc/getHtmlServerRenderer.js"); // eslint-disable-line strict 2 | -------------------------------------------------------------------------------- /tests/postcss/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | "postcss-color-rgba-fallback": {} 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /contrib/emotion-renderer/server.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./gmsrc/getEmotionServerRenderer.js"); // eslint-disable-line strict 2 | -------------------------------------------------------------------------------- /contrib/react-renderer/server.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./gmsrc/getReactServerRenderer.js"); // eslint-disable-line strict 2 | -------------------------------------------------------------------------------- /examples/redux-i80/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/containers/Root.js" 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /examples/redux-init/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/containers/Root.js" 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /contrib/react-apollo-renderer/server.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./gmsrc/getReactApolloServerRenderer.js"); // eslint-disable-line strict 2 | -------------------------------------------------------------------------------- /tests/builder-babel/babel.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | plugins: [require.resolve("./plugin-hey.js")] 5 | }; 6 | -------------------------------------------------------------------------------- /tests/builder-babel/src/.babelrc.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | plugins: [require.resolve("../plugin-hi.js")] 5 | }; 6 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/initAdmin.js: -------------------------------------------------------------------------------- 1 | // This module gets executed before main module of `admin` page 2 | console.log("ADMIN INIT"); 3 | -------------------------------------------------------------------------------- /utils/console/Console.js: -------------------------------------------------------------------------------- 1 | // Simple wrapper to provide a directory structure independent API 2 | module.exports = require("./gmsrc/Console"); 3 | -------------------------------------------------------------------------------- /examples/hello/src/hello.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function Hello({greeting}) { 4 | return
{greeting}
; 5 | } 6 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/images/earth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/tests/i80-loadable-nested/src/images/earth.png -------------------------------------------------------------------------------- /tests/fake-github/src/images/john_doe_profile.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gourmetjs/gourmet-ssr/HEAD/tests/fake-github/src/images/john_doe_profile.jpeg -------------------------------------------------------------------------------- /contrib/react-context-gmctx/gmsrc/GourmetContext.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const React = require("react"); 4 | 5 | module.exports = React.createContext(); 6 | -------------------------------------------------------------------------------- /tests/babel-polyfill/src/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function main() { 4 | return Promise.resolve("
Hello, world!
"); 5 | }; 6 | -------------------------------------------------------------------------------- /tests/i80-basic/src/HomeView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function HomeView(props) { 4 | return

{props.label} Home

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/i80-loadable/src/HomePanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function HomePanel(props) { 4 | return

{props.label} Home

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/react-hello/lib/local.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const gourmet = require("@gourmet/client-lib"); 4 | const run = require("./app"); 5 | 6 | run({}, gourmet); 7 | -------------------------------------------------------------------------------- /tests/fake-github/src/containers/themeVars.js: -------------------------------------------------------------------------------- 1 | export default { 2 | dark: "#343a40", 3 | light: "#f8f9fa", 4 | primary: "#007bff", 5 | secondary: "#6c757d" 6 | }; 7 | -------------------------------------------------------------------------------- /tests/i80-basic/src/ProfileView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function ProfileView(props) { 4 | return

{props.label} Profile

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/postcss/src/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./main.css"); 4 | 5 | module.exports = () => { 6 | return '
Hello, world!
'; 7 | }; 8 | -------------------------------------------------------------------------------- /docs/ref/react-loadable/index.md: -------------------------------------------------------------------------------- 1 | Inspiration and code from: 2 | 3 | - https://github.com/jamiebuilds/react-loadable 4 | - https://github.com/smooth-code/loadable-components 5 | -------------------------------------------------------------------------------- /tests/builder-basic/src/client.js: -------------------------------------------------------------------------------- 1 | import print from "./print"; 2 | import concat from "./concat"; 3 | 4 | print(concat( 5 | "** CLIENT **", 6 | "Hello, world!" 7 | )); 8 | -------------------------------------------------------------------------------- /tests/global-css/src/hello.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | require("./hello.css"); 4 | 5 | module.exports = () => { 6 | return '
Hello, world!
'; 7 | }; 8 | -------------------------------------------------------------------------------- /tests/i80-basic/src/MessagesView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function MessagesView(props) { 4 | return

{props.label} Messages

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/HomePanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function HomePanel(props) { 4 | return

{props.label} Home

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/i80-loadable/src/ProfilePanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function ProfilePanel(props) { 4 | return

{props.label} Profile

; 5 | } 6 | -------------------------------------------------------------------------------- /utils/variables/test/fixture/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "a": { 3 | "b": { 4 | "c": "Hello", 5 | "d": "world" 6 | } 7 | }, 8 | "a=b": "OK" 9 | } 10 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "gourmet/gourmet_app", 3 | "root": true, 4 | "settings": { 5 | "react": { 6 | "version": "16" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /docs/ref/react-i80/index.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | # How it looks 4 | 5 | # Route parameters 6 | 7 | # Nested routes 8 | 9 | # Props to `ActiveRoute` 10 | 11 | # Query -------------------------------------------------------------------------------- /tests/i80-loadable/src/MessagesPanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function MessagesPanel(props) { 4 | return

{props.label} Messages

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/builder-basic/src/print.mjs: -------------------------------------------------------------------------------- 1 | export default function print(text) { 2 | const output = document.getElementById("client_output"); 3 | output.innerHTML += text + "
"; 4 | } 5 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/MessagesPanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function MessagesPanel(props) { 4 | return

{props.label} Messages

; 5 | } 6 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/PhotoLoadable.js: -------------------------------------------------------------------------------- 1 | import loadable from "@gourmet/react-loadable"; 2 | 3 | export default loadable({ 4 | loader: () => import("./PhotoPanel") 5 | }); 6 | -------------------------------------------------------------------------------- /tests/loadable/src/LoadableB.jsx: -------------------------------------------------------------------------------- 1 | import loadable from "@gourmet/react-loadable"; 2 | 3 | export default loadable({ 4 | loader() { 5 | return import("./PanelB"); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /utils/is-stream/gmsrc/isStream.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function isStream(obj) { 4 | return obj && typeof obj === "object" && typeof obj.pipe === "function"; 5 | }; 6 | -------------------------------------------------------------------------------- /utils/variables/test/fixture/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = userCtx => { 4 | return Promise.resolve({ 5 | minify: userCtx.stage === "prod" 6 | }); 7 | }; 8 | -------------------------------------------------------------------------------- /docs/reference.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: reference 3 | title: Reference 4 | --- 5 | 6 | ## Title level 2 7 | 8 | ### Title level 3 9 | 10 | ## Title level 2 11 | 12 | ### Title level 3 13 | -------------------------------------------------------------------------------- /tests/global-css/src/hello.css: -------------------------------------------------------------------------------- 1 | .hello { 2 | font-size: 150%; 3 | font-weight: bold; 4 | border: 10px solid #eee; 5 | padding: 1em; 6 | margin: 5em; 7 | max-width: 20em; 8 | } 9 | -------------------------------------------------------------------------------- /tests/loadable/src/LoadableA.jsx: -------------------------------------------------------------------------------- 1 | import loadable from "@gourmet/react-loadable"; 2 | 3 | export default loadable({ 4 | loader: () => { 5 | return import("./PanelA"); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /utils/error/HandledError.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // Include the real source file from `gmsrc` directory to enable the transpilation. 4 | module.exports = require("./gmsrc/HandledError"); 5 | -------------------------------------------------------------------------------- /utils/variables/gmsrc/VarNode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // Base class for determining a variable node by a single `instanceof`. 4 | class VarNode { 5 | } 6 | 7 | module.exports = VarNode; 8 | -------------------------------------------------------------------------------- /tests/todo-apollo/src/TodoLoadable.js: -------------------------------------------------------------------------------- 1 | import loadable from "@gourmet/react-loadable"; 2 | 3 | export default loadable({ 4 | loader() { 5 | return import("./TodoMain"); 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /utils/error/NOT_IMPLEMENTED.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const NOT_IMPLEMENTED = { 4 | message: "Not implemented", 5 | code: "NOT_IMPLEMENTED" 6 | }; 7 | 8 | module.exports = NOT_IMPLEMENTED; 9 | -------------------------------------------------------------------------------- /utils/prefix-lines/gmsrc/prefixLines.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function prefixLines(prefix, text) { 4 | return text.split("\n").map(line => prefix + line).join("\n"); 5 | }; 6 | -------------------------------------------------------------------------------- /utils/promise-tape/gmsrc/promiseTape.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function promiseTape(fn) { 4 | return function(t) { 5 | fn(t).then(() => t.end(), t.end); 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /utils/get-exported/gmsrc/getExported.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function getExported(obj, name) { 4 | return name ? obj[name] : (obj && obj.__esModule ? obj.default : obj); 5 | }; 6 | -------------------------------------------------------------------------------- /tests/react-hello/lib/http.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const gourmet = require("@gourmet/client-http"); 4 | const run = require("./app"); 5 | 6 | run({ 7 | serverUrl: "http://localhost:3939/" 8 | }, gourmet); 9 | -------------------------------------------------------------------------------- /utils/error/NOT_FOUND.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const NOT_FOUND = { 4 | message: "Not found: ${path}", 5 | code: "NOT_FOUND", 6 | statusCode: 404 7 | }; 8 | 9 | module.exports = NOT_FOUND; 10 | -------------------------------------------------------------------------------- /tests/news-view/gmsrc/NewsDataClient.js: -------------------------------------------------------------------------------- 1 | import NewsData from "./NewsData"; 2 | 3 | export default class NewsDataClient extends NewsData { 4 | getCached() { 5 | return this.gmctx.data.newsData; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /utils/error/TIMEOUT_ERROR.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const TIMEOUT_ERROR = { 4 | message: "Operation timed out", 5 | code: "ETIMEDOUT", 6 | statusCode: 408 7 | }; 8 | 9 | module.exports = TIMEOUT_ERROR; 10 | -------------------------------------------------------------------------------- /utils/variables/gmsrc/sources/Self.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class Self { 4 | resolve(vars, info, options) { 5 | return vars.getNode(info.path, options); 6 | } 7 | } 8 | 9 | module.exports = Self; 10 | -------------------------------------------------------------------------------- /cli/gourmet-cli/bin/gourmet-cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | "use strict"; 3 | 4 | const GourmetCli = require("@gourmet/gourmet-cli-impl"); 5 | const cli = new GourmetCli(); 6 | cli.main(cli.parseArgs(process.argv.slice(2))); 7 | -------------------------------------------------------------------------------- /examples/redux/README.md: -------------------------------------------------------------------------------- 1 | # Using Redux with Gourmet SSR 2 | 3 | This example shows you how to use Redux in a Gourmet SSR project. 4 | 5 | See the [documentation](https://ssr.gourmetjs.org/docs/guides/using-redux) for more details. 6 | -------------------------------------------------------------------------------- /presets/core/lib/GourmetPresetCore.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class PresetCore { 4 | } 5 | 6 | PresetCore.meta = { 7 | subplugins: [ 8 | "@gourmet/group-core" 9 | ] 10 | }; 11 | 12 | module.exports = PresetCore; 13 | -------------------------------------------------------------------------------- /runtime/middleware/lib/watch.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const GourmetWatchMiddleware = require("@gourmet/watch-middleware"); 4 | 5 | module.exports = function(gourmet) { 6 | return GourmetWatchMiddleware.middleware(gourmet); 7 | }; 8 | -------------------------------------------------------------------------------- /tests/builder-src/test/fixture/module-a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-builder-src-module-a", 3 | "description": "A simple module containing ES6 class syntax for testing of Gourmet SSR", 4 | "version": "0.1.0" 5 | } 6 | -------------------------------------------------------------------------------- /utils/base-x/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/base-x 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/colors/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/colors 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /examples/redux-i80/README.md: -------------------------------------------------------------------------------- 1 | # Using Redux with React I80 2 | 3 | This example shows you how to use Redux with the React I80 router. 4 | 5 | See the [documentation](https://ssr.gourmetjs.org/docs/guides/using-redux) for more details. 6 | -------------------------------------------------------------------------------- /runtime/cli-args/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/cli-args 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/error/INVALID_METHOD.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const INVALID_METHOD = { 4 | message: "Method not allowed: ${method}", 5 | code: "INVALID_METHOD", 6 | statusCode: 405 7 | }; 8 | 9 | module.exports = INVALID_METHOD; 10 | -------------------------------------------------------------------------------- /utils/is-promise/gmsrc/isPromise.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // Returns true if the object is a promise. 4 | module.exports = function isPromise(obj) { 5 | return obj && typeof obj === "object" && typeof obj.then === "function"; 6 | }; 7 | -------------------------------------------------------------------------------- /utils/is-stream/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/is-stream 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/web-proxy/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/web-proxy 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/client-http/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/client-http 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/client-lib/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/client-lib 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/middleware/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/middleware 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/server-args/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/server-args 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/news-view/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/test-news-view 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/error/INVALID_PARAM.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const INVALID_PARAM = { 4 | message: "Invalid '${param}' parameter: ${value}", 5 | code: "INVALID_PARAM", 6 | statusCode: 400 7 | }; 8 | 9 | module.exports = INVALID_PARAM; 10 | -------------------------------------------------------------------------------- /utils/get-exported/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/get-exported 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/hash-names/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/hash-names 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/http-headers/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/http-headers 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/module-dir/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/module-dir 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/parse-href/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/parse-href 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/send-content/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/send-content 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /examples/redux/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | import {combineReducers} from "redux"; 2 | import todos from "./todos"; 3 | import visibilityFilter from "./visibilityFilter"; 4 | 5 | export default combineReducers({ 6 | todos, 7 | visibilityFilter 8 | }); 9 | -------------------------------------------------------------------------------- /runtime/client-lambda/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/client-lambda 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/get-req-args/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/get-req-args 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/html-renderer/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/html-renderer 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/inspect-error/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/inspect-error 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/is-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/is-stream", 3 | "version": "0.3.3", 4 | "main": "gmsrc/isStream.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/is-stream" 7 | } 8 | -------------------------------------------------------------------------------- /utils/promise-queue/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-queue 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/proxy-headers/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/proxy-headers 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/unprefix-path/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/unprefix-path 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/emotion-renderer/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/emotion-renderer 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/plugin-react-i80/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plugin-react-i80 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/react-renderer/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/react-renderer 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /examples/apollo/README.md: -------------------------------------------------------------------------------- 1 | # Using Apollo GraphQL with Gourmet SSR 2 | 3 | This example shows you how to use Apollo GraphQL in a Gourmet SSR project. 4 | 5 | See the [documentation](https://ssr.gourmetjs.org/docs/guides/using-apollo) for more details. 6 | -------------------------------------------------------------------------------- /examples/redux-i80/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | import {combineReducers} from "redux"; 2 | import todos from "./todos"; 3 | import visibilityFilter from "./visibilityFilter"; 4 | 5 | export default combineReducers({ 6 | todos, 7 | visibilityFilter 8 | }); 9 | -------------------------------------------------------------------------------- /examples/redux-init/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | import {combineReducers} from "redux"; 2 | import todos from "./todos"; 3 | import visibilityFilter from "./visibilityFilter"; 4 | 5 | export default combineReducers({ 6 | todos, 7 | visibilityFilter 8 | }); 9 | -------------------------------------------------------------------------------- /runtime/renderer-sandbox/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/renderer-sandbox 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/watch-middleware/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/watch-middleware 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/todo-redux/src/reducers/index.js: -------------------------------------------------------------------------------- 1 | import {combineReducers} from "redux"; 2 | import todos from "./todos"; 3 | import visibilityFilter from "./visibilityFilter"; 4 | 5 | export default combineReducers({ 6 | todos, 7 | visibilityFilter 8 | }); 9 | -------------------------------------------------------------------------------- /utils/error-to-string/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/error-to-string 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/is-plain-object/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/is-plain-object 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/promise-read-file/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-read-file 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/resolve-template/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/resolve-template 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/serialize-error/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/serialize-error 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/stream-to-string/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/stream-to-string 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/react-i80/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/react-i80 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org/docs/ref/react-i80) for more information. 6 | -------------------------------------------------------------------------------- /runtime/loadable-registrar/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/loadable-registrar 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/cli-test-plugin/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/test-cli-test-plugin 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/error/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/error 2 | Simple error object creator. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/plugin-sort/gmsrc/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const PluginSorter = require("./PluginSorter"); 4 | 5 | module.exports = function sortPlugins(items, options) { 6 | const sorter = new PluginSorter(options); 7 | return sorter.run(items); 8 | }; 9 | -------------------------------------------------------------------------------- /utils/promise-write-file/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-write-file 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/serialize-request-error/README-SRC.md: -------------------------------------------------------------------------------- 1 | # {{pkg.name}} 2 | 3 | {{desc}} 4 | 5 | ## Introduction 6 | 7 | Serializes an error into a JSON object with the request information in the `req` property 8 | to show details of the request that caused the error. 9 | -------------------------------------------------------------------------------- /contrib/plugin-react-apollo/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plugin-react-apollo 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/plugin-react-emotion/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plugin-react-emotion 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/plugin-react-loadable/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plugin-react-loadable 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/react-apollo-renderer/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/react-apollo-renderer 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/get-exported/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/get-exported", 3 | "version": "0.4.3", 4 | "main": "gmsrc/getExported.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/get-exported" 7 | } 8 | -------------------------------------------------------------------------------- /utils/handle-request-error/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/handle-request-error 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/http-headers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/http-headers", 3 | "version": "0.3.3", 4 | "main": "gmsrc/HttpHeaders.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/http-headers" 7 | } 8 | -------------------------------------------------------------------------------- /examples/apollo/lib/schema.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {gql} = require("apollo-server-express"); 4 | 5 | module.exports = gql` 6 | type Query { 7 | todos: [String]! 8 | } 9 | 10 | type Mutation { 11 | addTodo(text: String!): String! 12 | } 13 | `; 14 | -------------------------------------------------------------------------------- /presets/react/lib/GourmetPresetReact.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class PresetReact { 4 | } 5 | 6 | PresetReact.meta = { 7 | subplugins: [ 8 | "@gourmet/group-core", 9 | "@gourmet/group-react" 10 | ] 11 | }; 12 | 13 | module.exports = PresetReact; 14 | -------------------------------------------------------------------------------- /utils/promise-protect/README-SRC.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-protect 2 | 3 | Protects a function from exceptions and wraps the return value with a promise 4 | 5 | # Why? 6 | 7 | This is syntactically explicit and slightly more efficient than `Promise.resolve().then(...)`. 8 | -------------------------------------------------------------------------------- /utils/promise-protect/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-protect 2 | 3 | Protects a function from exceptions and wraps the return value with a promise 4 | 5 | # Why? 6 | 7 | This is syntactically explicit and slightly more efficient than `Promise.resolve().then(...)`. 8 | -------------------------------------------------------------------------------- /cli/gourmet-cli/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/gourmet-cli 2 | Gourmet command line interface. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/react-loadable/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/react-loadable 2 | 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org/docs/ref/react-loadable) for more information. 6 | -------------------------------------------------------------------------------- /examples/apollo-manual/lib/schema.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {gql} = require("apollo-server-express"); 4 | 5 | module.exports = gql` 6 | type Query { 7 | todos: [String]! 8 | } 9 | 10 | type Mutation { 11 | addTodo(text: String!): String! 12 | } 13 | `; 14 | -------------------------------------------------------------------------------- /scripts/update-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-update-package", 3 | "version": "0.1.5", 4 | "private": true, 5 | "devDependencies": { 6 | "@gourmet/relative-path": "^0.4.3", 7 | "@gourmet/resolve-template": "^0.3.3" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/builder-src/test/fixture/module-b/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-builder-src-module-b", 3 | "description": "A simple module containing ES6 class syntax for testing of Gourmet SSR", 4 | "version": "0.1.1", 5 | "module": "gourmet-source/main.js" 6 | } 7 | -------------------------------------------------------------------------------- /utils/error-to-string/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/error-to-string", 3 | "version": "0.3.3", 4 | "main": "gmsrc/errorToString.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/error-to-string" 7 | } 8 | -------------------------------------------------------------------------------- /utils/is-plain-object/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/is-plain-object", 3 | "version": "0.3.5", 4 | "main": "gmsrc/isPlainObject.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/is-plain-object" 7 | } 8 | -------------------------------------------------------------------------------- /utils/promise-wrap/gmsrc/promiseWrap.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const isPromise = require("@gourmet/is-promise"); 4 | 5 | module.exports = function promiseWrap(value) { 6 | if (isPromise(value)) 7 | return value; 8 | return Promise.resolve(value); 9 | }; 10 | -------------------------------------------------------------------------------- /utils/serialize-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/serialize-error", 3 | "version": "0.3.3", 4 | "main": "gmsrc/serializeError.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/serialize-error" 7 | } 8 | -------------------------------------------------------------------------------- /utils/storage-s3/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/storage-s3 2 | File storage interface for AWS S3. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/variables/gmsrc/sources/Opt.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class Opt { 4 | constructor(options) { 5 | this._options = options; 6 | } 7 | 8 | resolve(vars, info) { 9 | return this._options[info.path]; 10 | } 11 | } 12 | 13 | module.exports = Opt; 14 | -------------------------------------------------------------------------------- /utils/deep-clone/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/deep-clone 2 | Recursively clones a JavaScript value. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/promise-read-file/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-read-file", 3 | "version": "0.3.3", 4 | "main": "gmsrc/promiseReadFile.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-read-file" 7 | } 8 | -------------------------------------------------------------------------------- /utils/variables/gmsrc/sources/Env.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class Env { 4 | constructor(env) { 5 | this._env = env; 6 | } 7 | 8 | resolve(vars, info) { 9 | return (this._env || process.env)[info.path]; 10 | } 11 | } 12 | 13 | module.exports = Env; 14 | -------------------------------------------------------------------------------- /examples/apollo-manual/README.md: -------------------------------------------------------------------------------- 1 | # Using Apollo GraphQL with Gourmet SSR 2 | 3 | This example shows you how to use Apollo GraphQL manually without `@gourmet/group-react-apollo`. 4 | 5 | See the [documentation](https://ssr.gourmetjs.org/docs/guides/using-apollo) for more details. 6 | -------------------------------------------------------------------------------- /runtime/loadable-registrar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/loadable-registrar", 3 | "version": "0.3.4", 4 | "main": "gmsrc/registrar.js", 5 | "license": "MIT", 6 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/loadable-registrar" 7 | } 8 | -------------------------------------------------------------------------------- /utils/is-promise/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/is-promise 2 | Returns true if the object is a promise. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/web-proxy/gmsrc/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const WebProxy = require("./WebProxy"); 4 | 5 | module.exports = function webProxy(req, res, target, options) { 6 | const proxy = new WebProxy(options); 7 | proxy.handle(req, res, target); 8 | return proxy; 9 | }; 10 | -------------------------------------------------------------------------------- /tests/fake-github/src/components/Container.jsx: -------------------------------------------------------------------------------- 1 | import styled from "react-emotion"; 2 | 3 | const Container = styled.div` 4 | box-sizing: border-box; 5 | width: ${props => props.width}px; 6 | padding: 0 10px; 7 | margin: 0 auto; 8 | `; 9 | 10 | export default Container; 11 | -------------------------------------------------------------------------------- /examples/redux-init/README.md: -------------------------------------------------------------------------------- 1 | # Supplying the initial state from Node server 2 | 3 | This example shows you how to provide the Redux initial state from your server via `res.serve()` function. 4 | 5 | See the [documentation](https://ssr.gourmetjs.org/docs/guides/using-redux) for more details. 6 | -------------------------------------------------------------------------------- /utils/prefix-lines/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/prefix-lines 2 | Inserts a prefix at each line of a text string. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/resolve-dirs/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/resolve-dirs 2 | Resolves runtime directories from options object. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/storage-fs/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/storage-fs 2 | File storage interface for 'fs' compatible filesystem. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /cli/gourmet-cli-impl/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/gourmet-cli-impl 2 | Gourmet command line interface implementation. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/console/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/console 2 | A console abstraction for generating text output and debug logs. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/error-to-string/gmsrc/errorToString.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function errorToString(err) { 4 | if (!err) 5 | return "No error"; 6 | 7 | if (typeof err === "string") 8 | return err; 9 | 10 | return err.stack || err.message || err.toString(); 11 | }; 12 | -------------------------------------------------------------------------------- /utils/escape-script/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/escape-script 2 | Escape JavaScript content to be embedded in HTML. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/merge/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/merge 2 | Merges objects with special handling of arrays and non-plain objects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/todo-apollo/lib/schema.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {gql} = require("apollo-server-express"); 4 | 5 | const schema = gql` 6 | type Query { 7 | todos: [String]! 8 | } 9 | 10 | type Mutation { 11 | addTodo(text: String!): String! 12 | } 13 | `; 14 | 15 | module.exports = schema; 16 | -------------------------------------------------------------------------------- /utils/plugin-sort/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plugin-sort 2 | A general purpose library for human friendly plugin ordering. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/promise-protect/gmsrc/promiseProtect.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function promiseProtect(handler) { 4 | return new Promise(function(resolve, reject) { 5 | try { 6 | resolve(handler()); 7 | } catch (err) { 8 | reject(err); 9 | } 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /utils/promise-sync/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-sync 2 | Synchronously runs a handler if the value is not a promise. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /groups/core/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/group-core 2 | A group of core packages for building and running Gourmet SSR projects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /groups/react/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/group-react 2 | A group of sub-packages for the React support in Gourmet SSR projects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /presets/react/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/preset-react 2 | Gourmet Preset containing a whole set of packages for React projects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/fake-github/src/components/FormHeader.jsx: -------------------------------------------------------------------------------- 1 | import styled from "react-emotion"; 2 | 3 | const FormHeader = styled.div` 4 | font-size: 1.5rem; 5 | font-weight: bold; 6 | padding: 8px 0; 7 | margin: 1em 0; 8 | border-bottom: 1px solid #ccc; 9 | `; 10 | 11 | export default FormHeader; 12 | -------------------------------------------------------------------------------- /utils/escape-script/gmsrc/escapeScript.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function escapeScript(content, isInline=false) { 4 | if (isInline) 5 | return content.replace("&", "\\u0026").replace("\"", "\\u0022"); 6 | else 7 | return content.replace("", "\\u003c/script>"); 8 | }; 9 | -------------------------------------------------------------------------------- /utils/plain-merge/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plain-merge 2 | Merges plain objects. Kind of deep version of `Object.assign()`. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/promise-deep-prop/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-deep-prop 2 | Gets a deep property value while resolving promises. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/serialize-request-error/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/serialize-request-error 2 | 3 | Serializes an error into a JSON object. 4 | 5 | ## Introduction 6 | 7 | Serializes an error into a JSON object with the request information in the `req` property 8 | to show details of the request that caused the error. 9 | -------------------------------------------------------------------------------- /runtime/http-server/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/http-server 2 | Gourmet rendering service implemented as a standalone HTTP server. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /runtime/self-url/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/self-url 2 | Converts a relative URL to absolute URL only when `gmctx.isServer` is true. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/base-x/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/base-x", 3 | "version": "0.3.3", 4 | "main": "gmsrc/getBaseX.js", 5 | "dependencies": { 6 | "base-x": "^3.0.4" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/base-x" 10 | } 11 | -------------------------------------------------------------------------------- /utils/get-aws-service/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/get-aws-service 2 | Provides a standard way of acquiring AWS SDK's service objects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /cli/cli-base/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/cli-base 2 | Base class for the command line interface apps with flexible plugin architecture. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/ProfilePanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PhotoLoadable from "./PhotoLoadable"; 3 | 4 | export default function ProfilePanel(props) { 5 | return ( 6 |
7 |

{props.label} Profile

8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /utils/colors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/colors", 3 | "version": "1.1.3", 4 | "main": "gmsrc/colors.js", 5 | "scripts": { 6 | "demo": "node example/demo.js" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/colors" 10 | } 11 | -------------------------------------------------------------------------------- /utils/http-module/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/http-module 2 | Selects between 'http' and 'https' module based on value of protocol string. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/is-promise/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/is-promise", 3 | "version": "0.3.3", 4 | "description": "Returns true if the object is a promise", 5 | "main": "gmsrc/isPromise.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/is-promise" 8 | } 9 | -------------------------------------------------------------------------------- /utils/omit/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/omit 2 | Creates a copy of a plain object with own properties excluding the specified properties. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/promise-deep-clone/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-deep-clone 2 | Recursively clones a JavaScript value while resolving promises. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/promise-sync/gmsrc/promiseSync.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const isPromise = require("@gourmet/is-promise"); 4 | 5 | module.exports = function promiseSync(value, handler) { 6 | if (isPromise(value)) 7 | return value.then(value => handler(value)); 8 | else 9 | return handler(value); 10 | }; 11 | -------------------------------------------------------------------------------- /utils/promise-wrap/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-wrap 2 | Conditionally wraps a value with a promise only if it is not a promise. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /presets/core/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/preset-core 2 | Gourmet Preset containing core packages for building and running a Gourmet SSR project. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/render-error/src/ServerError.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default class ServerError extends React.Component { 4 | render() { 5 | if (SERVER) 6 | throw Error("server error"); 7 | return ( 8 |
9 | Hello, world! 10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /utils/module-dir/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/module-dir", 3 | "version": "0.3.3", 4 | "main": "gmsrc/moduleDir.js", 5 | "dependencies": { 6 | "resolve": "^1.6.0" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/module-dir" 10 | } 11 | -------------------------------------------------------------------------------- /contrib/plugin-react/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/plugin-react 2 | Gourmet Webpack Builder plugin for adding `@babel/preset-react` to build JSX files. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /examples/redux-i80/src/components/Settings.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Footer from "./Footer"; 3 | 4 | const Settings = () => ( 5 |
6 |
12 | ); 13 | 14 | export default Settings; 15 | -------------------------------------------------------------------------------- /utils/parse-href/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/parse-href", 3 | "version": "1.1.3", 4 | "main": "gmsrc/parseHref.js", 5 | "scripts": { 6 | "test": "tape test/*_test.js" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/parse-href" 10 | } 11 | -------------------------------------------------------------------------------- /utils/promise-tape/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-tape 2 | A simple wrapper converting a promise returning function to test handler for 'tape'. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/variables/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/variables 2 | Flexible variable resolution engine that can be extended by pluggable variable sources. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /docs/ref/group-react-apollo/index.md: -------------------------------------------------------------------------------- 1 | # @gourmet/group-react-apollo 2 | 3 | A group of sub-packages enabling the Apollo GraphQL support in Gourmet SSR React projects. 4 | 5 | ## About 6 | 7 | This is a member package of the Gourmet SSR Open Source Project. See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 8 | -------------------------------------------------------------------------------- /runtime/lambda-adapter/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/lambda-adapter 2 | Creates a tiny adapter that converts Lambda invocations to Gourmet Renderer calls. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /tests/builder-babel/plugin-hi.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function babelPlugin({types: t}) { 4 | return { 5 | visitor: { 6 | Literal(path) { 7 | if (path.node.value === "Hello, world!") 8 | path.replaceWith(t.stringLiteral("Hi, world!")); 9 | } 10 | } 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /tests/render-error/src/ClientError.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default class ClientError extends React.Component { 4 | render() { 5 | if (CLIENT) 6 | throw Error("render client error"); 7 | return ( 8 |
9 | Hello, world! 10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /utils/prefix-lines/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/prefix-lines", 3 | "version": "0.3.3", 4 | "description": "Inserts a prefix at each line of a text string", 5 | "main": "gmsrc/prefixLines.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/prefix-lines" 8 | } 9 | -------------------------------------------------------------------------------- /utils/promise-main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-main", 3 | "version": "0.3.3", 4 | "description": "Handles the top main promise of a console app", 5 | "main": "gmsrc/promiseMain.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-main" 8 | } 9 | -------------------------------------------------------------------------------- /utils/resolve-dirs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/resolve-dirs", 3 | "version": "1.1.3", 4 | "description": "Resolves runtime directories from options object", 5 | "main": "gmsrc/resolveDirs.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/resolve-dirs" 8 | } 9 | -------------------------------------------------------------------------------- /tests/builder-babel/plugin-hey.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function babelPlugin({types: t}) { 4 | return { 5 | visitor: { 6 | Literal(path) { 7 | if (path.node.value === "Hello, world!") 8 | path.replaceWith(t.stringLiteral("Hey, world!")); 9 | } 10 | } 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /utils/escape-script/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/escape-script", 3 | "version": "0.3.3", 4 | "description": "Escape JavaScript content to be embedded in HTML", 5 | "main": "gmsrc/escapeScript.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/escape-script" 8 | } 9 | -------------------------------------------------------------------------------- /utils/get-req-opts/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/get-req-opts 2 | Gets an `options` object that you can give to `http.request` from a string or a plain object. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /contrib/emotion-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/emotion-renderer", 3 | "version": "1.0.3", 4 | "dependencies": { 5 | "emotion-server": "^9.2.12", 6 | "pump": "^3.0.0" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/emotion-renderer" 10 | } 11 | -------------------------------------------------------------------------------- /contrib/react-context-gmctx/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/react-context-gmctx 2 | Simple module to share a React 16.x context object to provide and consume `gmctx`. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/multi-stream/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/multi-stream 2 | Modified version of `https://github.com/feross/multistream` that uses Node built-in modules only. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/relative-path/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/relative-path 2 | Converts a platform filesystem path to a portable path relative to a specified base directory. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /utils/unprefix-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/unprefix-path", 3 | "version": "0.3.3", 4 | "main": "gmsrc/unprefixPath.js", 5 | "scripts": { 6 | "test": "tape test/*_test.js" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/unprefix-path" 10 | } 11 | -------------------------------------------------------------------------------- /groups/react-emotion/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/group-react-emotion 2 | A group of sub-packages enabling the CSS-in-JS support using Emotion in Gourmet SSR projects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /groups/react-i80/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/group-react-i80 2 | A group of sub-packages enabling the isomorphic routing support using React I80 in Gourmet SSR projects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org) for more information. 6 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "3.4.0", 3 | "npmClient": "npm", 4 | "packages": [ 5 | "utils/*", 6 | "cli/*", 7 | "builder/*", 8 | "runtime/*", 9 | "contrib/*", 10 | "groups/*", 11 | "presets/*", 12 | "tests/*", 13 | "scripts/*" 14 | ], 15 | "hoist": true, 16 | "version": "independent" 17 | } 18 | -------------------------------------------------------------------------------- /runtime/get-req-args/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/get-req-args", 3 | "version": "0.4.3", 4 | "main": "lib/getReqArgs.js", 5 | "dependencies": { 6 | "@gourmet/proxy-headers": "^0.3.3" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/get-req-args" 10 | } 11 | -------------------------------------------------------------------------------- /tests/cli-test-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-cli-test-plugin", 3 | "version": "0.3.4", 4 | "keywords": [ 5 | "gourmet-plugin" 6 | ], 7 | "main": "lib/GourmetPluginCliTest.js", 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/tests/cli-test-plugin" 10 | } 11 | -------------------------------------------------------------------------------- /tests/todo-redux/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/containers/Root.js" 4 | }, 5 | 6 | builder: { 7 | stageTypes: { 8 | "production": ["prod", "ltc"] 9 | }, 10 | outputDir: "../../.gourmet/todo-redux", 11 | contentHash: context => context.stage === "ltc" 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /utils/handle-request-error/gmsrc/errorTemplate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = 4 | ` 5 | 6 | 7 | Error ({{statusCode}}): {{message}} 8 | {{head}} 9 | 10 | 11 |

{{message}}

12 |
{{detail}}
13 | 14 | `; 15 | -------------------------------------------------------------------------------- /utils/module-dir/gmsrc/moduleDir.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const npath = require("path"); 4 | const resolve = require("resolve"); 5 | 6 | module.exports = function moduleDir(basedir) { 7 | return function(name) { 8 | const path = resolve.sync(name + "/package.json", {basedir}); 9 | return npath.dirname(path); 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /utils/promise-queue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-queue", 3 | "version": "0.3.3", 4 | "main": "gmsrc/promiseQueue.js", 5 | "dependencies": { 6 | "@gourmet/is-promise": "^0.3.3" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-queue" 10 | } 11 | -------------------------------------------------------------------------------- /runtime/renderer-sandbox/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/renderer-sandbox", 3 | "version": "0.5.3", 4 | "main": "lib/RendererSandbox.js", 5 | "dependencies": { 6 | "node-fetch": "^2.1.2" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/renderer-sandbox" 10 | } 11 | -------------------------------------------------------------------------------- /utils/inspect-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/inspect-error", 3 | "version": "0.3.3", 4 | "main": "gmsrc/inspectError.js", 5 | "dependencies": { 6 | "@gourmet/serialize-error": "^0.3.3" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/inspect-error" 10 | } 11 | -------------------------------------------------------------------------------- /utils/proxy-headers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/proxy-headers", 3 | "version": "0.3.3", 4 | "main": "gmsrc/ProxyHeaders.js", 5 | "dependencies": { 6 | "@gourmet/http-headers": "^0.3.3" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/proxy-headers" 10 | } 11 | -------------------------------------------------------------------------------- /examples/apollo/lib/resolvers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | Query: { 5 | todos(_, __, {dataSources}) { 6 | return dataSources.todoData.getAll(); 7 | } 8 | }, 9 | 10 | Mutation: { 11 | addTodo(_, {text}, {dataSources}) { 12 | return dataSources.todoData.addTodo(text); 13 | } 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /runtime/cli-args/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/cli-args", 3 | "version": "0.2.3", 4 | "main": "lib/cliArgs.js", 5 | "dependencies": { 6 | "camelcase-keys": "^4.2.0", 7 | "minimist": "^1.2.0" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/cli-args" 11 | } 12 | -------------------------------------------------------------------------------- /tests/todo-apollo/lib/resolvers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | Query: { 5 | todos(_, __, {dataSources}) { 6 | return dataSources.todoData.getAll(); 7 | } 8 | }, 9 | 10 | Mutation: { 11 | addTodo(_, {text}, {dataSources}) { 12 | return dataSources.todoData.addTodo(text); 13 | } 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /utils/http-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/http-module", 3 | "version": "0.3.3", 4 | "description": "Selects between 'http' and 'https' module based on value of protocol string", 5 | "main": "gmsrc/httpModule.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/http-module" 8 | } 9 | -------------------------------------------------------------------------------- /utils/resolve-template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/resolve-template", 3 | "version": "0.3.3", 4 | "main": "gmsrc/resolveTemplate.js", 5 | "dependencies": { 6 | "lodash.template": "^4.4.0" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/resolve-template" 10 | } 11 | -------------------------------------------------------------------------------- /examples/apollo-manual/lib/resolvers.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | Query: { 5 | todos(_, __, {dataSources}) { 6 | return dataSources.todoData.getAll(); 7 | } 8 | }, 9 | 10 | Mutation: { 11 | addTodo(_, {text}, {dataSources}) { 12 | return dataSources.todoData.addTodo(text); 13 | } 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /examples/apollo/src/TodoApp.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import TodoMain from "./TodoMain"; 3 | 4 | export default class TodoApp extends Component { 5 | render() { 6 | return ( 7 |
8 | 9 |
10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/babel-polyfill/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | outputDir: "../../.gourmet/babel-polyfill", 6 | granularity: 0 7 | }, 8 | 9 | babel: { 10 | polyfill: context => context.stage === "entry" ? "entry" : "usage" 11 | }, 12 | 13 | pages: { 14 | main: "./src/main" 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /tests/i80-misc/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/i80-misc", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainPage.jsx" 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /tests/loadable/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/loadable", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainApp.jsx" 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /tests/react-hello/lib/lambda.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const serverArgs = require("@gourmet/server-args"); 4 | const Server = require("@gourmet/server-impl-lambda"); 5 | 6 | const args = serverArgs(process.argv.slice(2)); 7 | 8 | new Server({ 9 | functionName: `react-hello-ui-${args.stage}-render`, 10 | enableStatic: true 11 | }, args).start(); 12 | -------------------------------------------------------------------------------- /utils/http-module/gmsrc/httpModule.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const http = require("http"); 4 | const https = require("https"); 5 | 6 | module.exports = function httpModule(protocol, defVal) { 7 | if (typeof protocol === "string") 8 | return /^https|wss/.test(protocol) ? https : http; 9 | return /^https|wss/.test(defVal) ? https : http; 10 | }; 11 | -------------------------------------------------------------------------------- /groups/react-apollo/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/group-react-apollo 2 | A group of sub-packages enabling the GraphQL support using Apollo in Gourmet SSR projects. 3 | ## About 4 | This is a member package of Gourmet SSR, an open source project for server-side rendering. 5 | See [Gourmet SSR website](https://ssr.gourmetjs.org/docs/ref/group-react-apollo) for more information. 6 | -------------------------------------------------------------------------------- /tests/multi-views/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/multi-views", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainPage.js" 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /utils/error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/error", 3 | "version": "0.3.4", 4 | "description": "Simple error object creator", 5 | "main": "gmsrc/error.js", 6 | "dependencies": { 7 | "lodash.template": "^4.4.0" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/error" 11 | } 12 | -------------------------------------------------------------------------------- /utils/promise-tape/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-tape", 3 | "version": "0.4.3", 4 | "description": "A simple wrapper converting a promise returning function to test handler for 'tape'", 5 | "main": "gmsrc/promiseTape.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-tape" 8 | } 9 | -------------------------------------------------------------------------------- /utils/promise-write-file/gmsrc/promiseWriteFile.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const promiseCreateWriteStream = require("@gourmet/promise-create-write-stream"); 4 | 5 | module.exports = function promiseWriteFile(path, data, options) { 6 | return promiseCreateWriteStream(path, function(ws) { 7 | ws.write(data); 8 | ws.end(); 9 | }, options); 10 | }; 11 | -------------------------------------------------------------------------------- /tests/builder-src/src/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const ModuleA = require("@gourmet/test-builder-src-module-a"); 4 | const ModuleB = require("@gourmet/test-builder-src-module-b"); 5 | 6 | module.exports = () => { 7 | return [ 8 | "
",
 9 |     `  a: ${ModuleA.name}`,
10 |     `  b: ${ModuleB.name}`,
11 |     "
" 12 | ].join("\n"); 13 | }; 14 | -------------------------------------------------------------------------------- /utils/promise-protect/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-protect", 3 | "version": "0.3.3", 4 | "description": "Protects a function from exceptions and wraps the return value with a promise", 5 | "main": "gmsrc/promiseProtect.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-protect" 8 | } 9 | -------------------------------------------------------------------------------- /runtime/get-req-args/lib/getReqArgs.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const ProxyHeaders = require("@gourmet/proxy-headers"); 4 | 5 | module.exports = function getReqArgs(req) { 6 | return { 7 | url: req.originalUrl || req.url, 8 | method: req.method, 9 | headers: new ProxyHeaders(req).getHeaders(), 10 | encrypted: req.socket.encrypted 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /utils/promise-main/gmsrc/promiseMain.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function promiseMain(promise, gracefulExit) { 4 | return promise.catch(err => { 5 | if (gracefulExit) { 6 | console.error(err); 7 | process.exitCode = 1; 8 | } else { 9 | setImmediate(() => { 10 | throw err; 11 | }); 12 | } 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /examples/redux/src/components/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Footer from "./Footer"; 3 | import AddTodo from "../containers/AddTodo"; 4 | import VisibleTodoList from "../containers/VisibleTodoList"; 5 | 6 | const App = () => ( 7 |
8 | 9 | 10 |
12 | ); 13 | 14 | export default App; 15 | -------------------------------------------------------------------------------- /tests/todo-redux/src/components/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Footer from "./Footer"; 3 | import AddTodo from "../containers/AddTodo"; 4 | import VisibleTodoList from "../containers/VisibleTodoList"; 5 | 6 | const App = () => ( 7 |
8 | 9 | 10 |
12 | ); 13 | 14 | export default App; 15 | -------------------------------------------------------------------------------- /utils/multi-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/multi-stream", 3 | "version": "0.3.3", 4 | "main": "gmsrc/MultiStream.js", 5 | "description": "Modified version of `https://github.com/feross/multistream` that uses Node built-in modules only", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/multi-stream" 8 | } 9 | -------------------------------------------------------------------------------- /utils/promise-read-file/gmsrc/promiseReadFile.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const fs = require("fs"); 4 | 5 | module.exports = function promiseReadFile(path, options) { 6 | return new Promise((resolve, reject) => { 7 | fs.readFile(path, options, (err, data) => { 8 | if (err) 9 | return reject(err); 10 | resolve(data); 11 | }); 12 | }); 13 | }; 14 | -------------------------------------------------------------------------------- /utils/promise-write-file/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-write-file", 3 | "version": "0.3.3", 4 | "main": "gmsrc/promiseWriteFile.js", 5 | "dependencies": { 6 | "@gourmet/promise-create-write-stream": "^0.3.3" 7 | }, 8 | "license": "MIT", 9 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-write-file" 10 | } 11 | -------------------------------------------------------------------------------- /utils/relative-path/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/relative-path", 3 | "version": "0.4.3", 4 | "description": "Converts a platform filesystem path to a portable path relative to a specified base directory", 5 | "main": "gmsrc/relativePath.js", 6 | "license": "MIT", 7 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/relative-path" 8 | } 9 | -------------------------------------------------------------------------------- /utils/stream-to-string/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/stream-to-string", 3 | "version": "0.3.3", 4 | "main": "gmsrc/streamToString.js", 5 | "dependencies": { 6 | "destroy": "^1.0.4", 7 | "end-of-stream": "^1.4.1" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/stream-to-string" 11 | } 12 | -------------------------------------------------------------------------------- /examples/redux-init/src/components/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Footer from "./Footer"; 3 | import AddTodo from "../containers/AddTodo"; 4 | import VisibleTodoList from "../containers/VisibleTodoList"; 5 | 6 | const App = () => ( 7 |
8 | 9 | 10 |
12 | ); 13 | 14 | export default App; 15 | -------------------------------------------------------------------------------- /examples/redux/src/reducers/visibilityFilter.js: -------------------------------------------------------------------------------- 1 | import {VisibilityFilters} from "../actions"; 2 | 3 | const visibilityFilter = (state = VisibilityFilters.SHOW_ALL, action) => { 4 | switch (action.type) { 5 | case "SET_VISIBILITY_FILTER": 6 | return action.filter; 7 | default: 8 | return state; 9 | } 10 | }; 11 | 12 | export default visibilityFilter; 13 | -------------------------------------------------------------------------------- /tests/todo-redux/src/reducers/visibilityFilter.js: -------------------------------------------------------------------------------- 1 | import {VisibilityFilters} from "../actions"; 2 | 3 | const visibilityFilter = (state = VisibilityFilters.SHOW_ALL, action) => { 4 | switch (action.type) { 5 | case "SET_VISIBILITY_FILTER": 6 | return action.filter; 7 | default: 8 | return state; 9 | } 10 | }; 11 | 12 | export default visibilityFilter; 13 | -------------------------------------------------------------------------------- /utils/console/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const Console = require("./Console"); 4 | 5 | // singleton object 6 | let con; 7 | 8 | function getConsole(props) { 9 | if (!con) 10 | con = new Console(); 11 | return props ? con.create(props) : con; 12 | } 13 | 14 | getConsole.install = function(_con) { 15 | con = _con; 16 | }; 17 | 18 | module.exports = getConsole; 19 | -------------------------------------------------------------------------------- /examples/redux-i80/src/reducers/visibilityFilter.js: -------------------------------------------------------------------------------- 1 | import {VisibilityFilters} from "../actions"; 2 | 3 | const visibilityFilter = (state = VisibilityFilters.SHOW_ALL, action) => { 4 | switch (action.type) { 5 | case "SET_VISIBILITY_FILTER": 6 | return action.filter; 7 | default: 8 | return state; 9 | } 10 | }; 11 | 12 | export default visibilityFilter; 13 | -------------------------------------------------------------------------------- /examples/redux-init/src/reducers/visibilityFilter.js: -------------------------------------------------------------------------------- 1 | import {VisibilityFilters} from "../actions"; 2 | 3 | const visibilityFilter = (state = VisibilityFilters.SHOW_ALL, action) => { 4 | switch (action.type) { 5 | case "SET_VISIBILITY_FILTER": 6 | return action.filter; 7 | default: 8 | return state; 9 | } 10 | }; 11 | 12 | export default visibilityFilter; 13 | -------------------------------------------------------------------------------- /tests/global-css/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/global-css", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/hello.js", 14 | admin: "./src/admin.js" 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/AdminPage.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import PageBase from "./PageBase"; 3 | 4 | export default class AdminPage extends Component { 5 | render() { 6 | return ( 7 | 8 |
9 |

Admin page

10 |
11 |
12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/hello/lib/server.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const gourmet = require("@gourmet/client-lib"); 3 | 4 | const app = express(); 5 | 6 | app.use(gourmet.middleware()); 7 | 8 | app.get("/", (req, res) => { 9 | res.serve("main", {greeting: "Hello, world!"}); 10 | }); 11 | 12 | app.listen(3000, () => { 13 | console.log("Server is listening on port 3000"); 14 | }); 15 | -------------------------------------------------------------------------------- /utils/deep-clone/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/deep-clone", 3 | "version": "0.3.3", 4 | "description": "Recursively clones a JavaScript value", 5 | "main": "gmsrc/deepClone.js", 6 | "dependencies": { 7 | "@gourmet/is-plain-object": "^0.3.5" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/deep-clone" 11 | } 12 | -------------------------------------------------------------------------------- /cli/gourmet-cli-impl/lib/ContextSource.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const promiseDeepProp = require("@gourmet/promise-deep-prop"); 4 | 5 | class ContextSource { 6 | constructor(context) { 7 | this._context = context; 8 | } 9 | 10 | resolve(vars, info) { 11 | return promiseDeepProp(this._context, info.path, value => value); 12 | } 13 | } 14 | 15 | module.exports = ContextSource; 16 | -------------------------------------------------------------------------------- /tests/builder-ltc/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/builder-ltc", 9 | granularity: 2, 10 | sourceMap: false, 11 | contentHash: context => context.stage === "ltc" 12 | }, 13 | pages: { 14 | main: "./src/main.js" 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /utils/variables/gmsrc/VarValue.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const promiseWrap = require("@gourmet/promise-wrap"); 4 | const VarNode = require("./VarNode"); 5 | 6 | class VarValue extends VarNode { 7 | constructor(value) { 8 | super(); 9 | this._value = value; 10 | } 11 | 12 | resolve() { 13 | return promiseWrap(this._value); 14 | } 15 | } 16 | 17 | module.exports = VarValue; 18 | -------------------------------------------------------------------------------- /runtime/html-renderer/gmsrc/pageTemplate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = 4 | ` 5 | 6 | 7 | {{headTop}} 8 | {{headMain}} 9 | {{headBottom}} 10 | 11 | 12 | {{bodyTop}} 13 |
{{[__bodyMain__]}}
14 | {{[__bodyTail__]}} 15 | {{bodyBottom}} 16 | 17 | `; 18 | -------------------------------------------------------------------------------- /tests/i80-loadable/src/HomeView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import loadable from "@gourmet/react-loadable"; 3 | 4 | export default class HomeView extends React.Component { 5 | static routeLoadable = loadable({ 6 | loader: () => import(/* webpackChunkName: "home" */ "./HomePanel") 7 | }); 8 | 9 | render() { 10 | return ; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /utils/promise-repeat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-repeat", 3 | "version": "0.3.3", 4 | "description": "Runs an asynchronous loop in series", 5 | "main": "gmsrc/promiseRepeat.js", 6 | "dependencies": { 7 | "@gourmet/is-promise": "^0.3.3" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-repeat" 11 | } 12 | -------------------------------------------------------------------------------- /docs/guides/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: index 3 | title: Guides: Index 4 | --- 5 | 6 | These documents explain various topics that you need to know to build a real app using Gourmet SSR. They assume you understand the key concepts described in [Getting Started](/docs/getting-started) and [Tutorial](/docs/tutorial-1). 7 | 8 | - [Using Redux](using-redux) 9 | - [Using Apollo GraphQL](using-apollo-graphql) 10 | 11 | -------------------------------------------------------------------------------- /tests/builder-ltc/src/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = () => { 4 | return import("../../../.gourmet/builder-ltc/src/message.js").then(mod => { 5 | return [ 6 | "
",
 7 |       mod.default,
 8 |       "
" 9 | ].join("\n"); 10 | }).catch(err => { 11 | return [ 12 | "
",
13 |       err.message,
14 |       "
" 15 | ].join("\n"); 16 | }); 17 | }; 18 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/HomeView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import loadable from "@gourmet/react-loadable"; 3 | 4 | export default class HomeView extends React.Component { 5 | static routeLoadable = loadable({ 6 | loader: () => import(/* webpackChunkName: "home" */ "./HomePanel") 7 | }); 8 | 9 | render() { 10 | return ; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /contrib/plugin-react-i80/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plugin-react-i80", 3 | "version": "0.4.3", 4 | "main": "lib/GourmetPluginReactI80.js", 5 | "keywords": [ 6 | "gourmet-plugin" 7 | ], 8 | "peerDependencies": { 9 | "@gourmet/react-i80": "*" 10 | }, 11 | "license": "MIT", 12 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/plugin-react-i80" 13 | } 14 | -------------------------------------------------------------------------------- /runtime/server-args/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/server-args", 3 | "version": "1.2.4", 4 | "main": "lib/serverArgs.js", 5 | "dependencies": { 6 | "@gourmet/cli-args": "^0.2.3", 7 | "@gourmet/merge": "^0.8.3", 8 | "@gourmet/resolve-dirs": "^1.1.3" 9 | }, 10 | "license": "MIT", 11 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/server-args" 12 | } 13 | -------------------------------------------------------------------------------- /utils/is-plain-object/gmsrc/isPlainObject.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const toString = Object.prototype.toString; 4 | const objProto = Object.getPrototypeOf({}); 5 | 6 | module.exports = function isPlainObject(obj) { 7 | if (toString.call(obj) === "[object Object]") { 8 | const proto = Object.getPrototypeOf(obj); 9 | return proto === null || proto === objProto; 10 | } 11 | return false; 12 | }; 13 | -------------------------------------------------------------------------------- /cli/gourmet-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/gourmet-cli", 3 | "version": "1.1.4", 4 | "description": "Gourmet command line interface", 5 | "bin": { 6 | "gourmet": "bin/gourmet-cli.js" 7 | }, 8 | "dependencies": { 9 | "@gourmet/gourmet-cli-impl": "^1.1.4" 10 | }, 11 | "license": "MIT", 12 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/cli/gourmet-cli" 13 | } 14 | -------------------------------------------------------------------------------- /utils/promise-sync/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-sync", 3 | "version": "0.3.3", 4 | "description": "Synchronously runs a handler if the value is not a promise", 5 | "main": "gmsrc/promiseSync.js", 6 | "dependencies": { 7 | "@gourmet/is-promise": "^0.3.3" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-sync" 11 | } 12 | -------------------------------------------------------------------------------- /utils/unprefix-path/test/unprefix_path_test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const test = require("tape"); 4 | const unprefixPath = require(".."); 5 | 6 | test("unprefixPath", t => { 7 | t.equal(unprefixPath("/abc/def", "/abc"), "/def"); 8 | t.equal(unprefixPath("/abc/def", "/abc/"), "/def"); 9 | t.equal(unprefixPath("/abc", "/abc"), "/"); 10 | t.equal(unprefixPath("/abc", "/def"), null); 11 | t.end(); 12 | }); 13 | -------------------------------------------------------------------------------- /examples/redux-i80/src/components/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import AddTodo from "../containers/AddTodo"; 3 | import VisibleTodoList from "../containers/VisibleTodoList"; 4 | 5 | const App = () => ( 6 |
7 | 8 | 9 |
10 |
11 | » Settings 12 |
13 |
14 | ); 15 | 16 | export default App; 17 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/CustomLoading.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function CustomLoading(props) { 4 | if (props.error) { 5 | return
{props.error.stack}
; 6 | } else if (props.timedOut) { 7 | return
Timeout error!!!
; 8 | } else if (props.pastDelay) { 9 | return
Be patient, loading...
; 10 | } else { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /utils/get-aws-service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/get-aws-service", 3 | "version": "0.3.3", 4 | "description": "Provides a standard way of acquiring AWS SDK's service objects", 5 | "main": "gmsrc/getAwsService.js", 6 | "dependencies": { 7 | "aws-sdk": "^2.224.1" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/get-aws-service" 11 | } 12 | -------------------------------------------------------------------------------- /utils/omit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/omit", 3 | "version": "0.3.3", 4 | "description": "Creates a copy of a plain object with own properties excluding the specified properties", 5 | "main": "gmsrc/omit.js", 6 | "dependencies": { 7 | "@gourmet/is-plain-object": "^0.3.5" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/omit" 11 | } 12 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/MessagesView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import loadable from "@gourmet/react-loadable"; 3 | 4 | export default class MessagesView extends React.Component { 5 | static routeLoadable = loadable({ 6 | loader: () => import(/* webpackChunkName: "messages" */ "./MessagesPanel") 7 | }); 8 | 9 | render() { 10 | return ; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /utils/plain-merge/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plain-merge", 3 | "version": "0.4.3", 4 | "description": "Merges plain objects. Kind of deep version of `Object.assign()`.", 5 | "main": "gmsrc/plainMerge.js", 6 | "dependencies": { 7 | "@gourmet/is-plain-object": "^0.3.5" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/plain-merge" 11 | } 12 | -------------------------------------------------------------------------------- /examples/apollo/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/TodoApp.js" 4 | }, 5 | 6 | config: { 7 | html: { 8 | headTop: [ 9 | '' 10 | ] 11 | } 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /utils/error/gmsrc/HandledError.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // This type of error is used when you need to move back through call stack 4 | // but don't necessarily want to show the scary and verbose unhandled exception 5 | // screen to users. Note that throwing this error doesn't make any difference 6 | // unless you have a catching side as well. 7 | class HandledError extends Error { 8 | } 9 | 10 | module.exports = HandledError; 11 | -------------------------------------------------------------------------------- /utils/promise-wrap/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-wrap", 3 | "version": "0.3.3", 4 | "description": "Conditionally wraps a value with a promise only if it is not a promise", 5 | "main": "gmsrc/promiseWrap.js", 6 | "dependencies": { 7 | "@gourmet/is-promise": "^0.3.3" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-wrap" 11 | } 12 | -------------------------------------------------------------------------------- /contrib/plugin-react-apollo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plugin-react-apollo", 3 | "version": "1.0.4", 4 | "main": "lib/GourmetPluginReactApollo.js", 5 | "keywords": [ 6 | "gourmet-plugin" 7 | ], 8 | "peerDependencies": { 9 | "@gourmet/react-apollo-renderer": "*" 10 | }, 11 | "license": "MIT", 12 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/plugin-react-apollo" 13 | } 14 | -------------------------------------------------------------------------------- /examples/apollo-manual/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/TodoApp.js" 4 | }, 5 | 6 | config: { 7 | html: { 8 | headTop: [ 9 | '' 10 | ] 11 | } 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /examples/apollo/lib/TodoData.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {DataSource} = require("apollo-datasource"); 4 | 5 | const _todos = [ 6 | "Buy a pack of milk", 7 | "Finish the documentation" 8 | ]; 9 | 10 | module.exports = class TodoData extends DataSource { 11 | getAll() { 12 | return _todos.slice(); // make a shallow copy 13 | } 14 | 15 | addTodo(text) { 16 | _todos.push(text); 17 | return text; 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /examples/redux-init/src/containers/Root.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {createStore} from "redux"; 3 | import {Provider} from "react-redux"; 4 | import App from "../components/App"; 5 | import rootReducer from "../reducers"; 6 | 7 | const Root = ({reduxState}) => { 8 | return ( 9 | 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default Root; 16 | -------------------------------------------------------------------------------- /examples/apollo-manual/lib/TodoData.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {DataSource} = require("apollo-datasource"); 4 | 5 | const _todos = [ 6 | "Buy a pack of milk", 7 | "Finish the documentation" 8 | ]; 9 | 10 | module.exports = class TodoData extends DataSource { 11 | getAll() { 12 | return _todos.slice(); // make a shallow copy 13 | } 14 | 15 | addTodo(text) { 16 | _todos.push(text); 17 | return text; 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /examples/hello/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "gourmet build", 5 | "start": "node lib/server.js" 6 | }, 7 | "dependencies": { 8 | "@gourmet/client-lib": "^1.1.4", 9 | "express": "^4.16.4" 10 | }, 11 | "devDependencies": { 12 | "@gourmet/gourmet-cli": "^1.1.4", 13 | "@gourmet/preset-react": "^1.5.0", 14 | "react": "^16.8.5", 15 | "react-dom": "^16.8.5" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/i80-loadable/src/MessagesView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import loadable from "@gourmet/react-loadable"; 3 | 4 | export default class MessagesView extends React.Component { 5 | static routeLoadable = loadable({ 6 | loader() { 7 | return import(/* webpackChunkName: "messages" */ "./MessagesPanel"); 8 | } 9 | }); 10 | 11 | render() { 12 | return ; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /utils/serialize-request-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/serialize-request-error", 3 | "version": "0.3.3", 4 | "description": "Serializes an error into a JSON object", 5 | "main": "gmsrc/serializeRequestError.js", 6 | "dependencies": { 7 | "@gourmet/serialize-error": "^0.3.3" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/serialize-request-error" 11 | } 12 | -------------------------------------------------------------------------------- /tests/i80-loadable/src/ProfileView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import loadable from "@gourmet/react-loadable"; 3 | 4 | export default class ProfileView extends React.Component { 5 | static routeLoadable = loadable({ 6 | loader: function() { 7 | return import(/* webpackChunkName: "profile" */ "./ProfilePanel"); 8 | } 9 | }); 10 | 11 | render() { 12 | return ; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contrib/react-context-gmctx/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/react-context-gmctx", 3 | "version": "0.4.4", 4 | "description": "Simple module to share a React 16.x context object to provide and consume `gmctx`", 5 | "main": "gmsrc/GourmetContext.js", 6 | "peerDependencies": { 7 | "react": "16" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/react-context-gmctx" 11 | } 12 | -------------------------------------------------------------------------------- /tests/i80-basic/src/PageBase.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import cx from "classnames"; 3 | import {css} from "emotion"; 4 | 5 | const cssPageBase = css` 6 | max-width: 60em; 7 | padding: 2em 0; 8 | `; 9 | 10 | export default class PageBase extends Component { 11 | render() { 12 | return ( 13 |
14 | {this.props.children} 15 |
16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /utils/colors/example/demo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const colors = require(".."); 4 | const {code, off} = colors; 5 | 6 | Object.keys(code).forEach(name => { 7 | console.log(colors[name](name)); 8 | }); 9 | 10 | console.log([ 11 | code.bgBrightYellow + code.red, 12 | "This is red on bright yellow.\n", 13 | code.black, 14 | "Now, black on the same background.\n", 15 | off.reset, 16 | "Now everything is back to normal!" 17 | ].join("")); 18 | -------------------------------------------------------------------------------- /utils/get-req-opts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/get-req-opts", 3 | "version": "0.2.3", 4 | "description": "Gets an `options` object that you can give to `http.request` from a string or a plain object.", 5 | "main": "gmsrc/getReqOpts.js", 6 | "dependencies": { 7 | "@gourmet/is-plain-object": "^0.3.5" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/get-req-opts" 11 | } 12 | -------------------------------------------------------------------------------- /utils/hash-names/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/hash-names", 3 | "version": "0.4.3", 4 | "main": "gmsrc/HashNames.js", 5 | "scripts": { 6 | "test": "tape test/*_test.js" 7 | }, 8 | "dependencies": { 9 | "@gourmet/base-x": "^0.3.3" 10 | }, 11 | "devDependencies": { 12 | "tape": "^4.9.0" 13 | }, 14 | "license": "MIT", 15 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/hash-names" 16 | } 17 | -------------------------------------------------------------------------------- /contrib/react-loadable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/react-loadable", 3 | "version": "0.5.4", 4 | "main": "gmsrc/loadable.js", 5 | "dependencies": { 6 | "@gourmet/loadable-registrar": "^0.3.4", 7 | "@gourmet/react-context-gmctx": "^0.4.4" 8 | }, 9 | "peerDependencies": { 10 | "react": "16" 11 | }, 12 | "license": "MIT", 13 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/react-loadable" 14 | } 15 | -------------------------------------------------------------------------------- /runtime/self-url/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/self-url", 3 | "version": "1.1.3", 4 | "description": "Converts a relative URL to absolute URL only when `gmctx.isServer` is true", 5 | "main": "gmsrc/selfUrl.js", 6 | "dependencies": { 7 | "@gourmet/parse-href": "^1.1.3", 8 | "is-absolute-url": "^2.1.0" 9 | }, 10 | "license": "MIT", 11 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/self-url" 12 | } 13 | -------------------------------------------------------------------------------- /tests/i80-loadable/src/PageBase.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import cx from "classnames"; 3 | import {css} from "emotion"; 4 | 5 | const cssPageBase = css` 6 | max-width: 60em; 7 | padding: 2em 0; 8 | `; 9 | 10 | export default class PageBase extends Component { 11 | render() { 12 | return ( 13 |
14 | {this.props.children} 15 |
16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /utils/promise-map/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-map", 3 | "version": "0.3.3", 4 | "description": "Promise aware version of JavaScript's `Array.prototype.map`", 5 | "main": "gmsrc/promiseMap.js", 6 | "dependencies": { 7 | "@gourmet/promise-repeat": "^0.3.3", 8 | "@gourmet/promise-sync": "^0.3.3" 9 | }, 10 | "license": "MIT", 11 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-map" 12 | } 13 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "examples": "docusaurus-examples", 4 | "dev": "docusaurus-start --port 3080", 5 | "build": "docusaurus-build", 6 | "publish-gh-pages": "docusaurus-publish", 7 | "write-translations": "docusaurus-write-translations", 8 | "version": "docusaurus-version", 9 | "rename-version": "docusaurus-rename-version" 10 | }, 11 | "devDependencies": { 12 | "docusaurus": "^1.7.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/PageBase.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import cx from "classnames"; 3 | import {css} from "emotion"; 4 | 5 | const cssPageBase = css` 6 | max-width: 60em; 7 | padding: 2em 0; 8 | `; 9 | 10 | export default class PageBase extends Component { 11 | render() { 12 | return ( 13 |
14 | {this.props.children} 15 |
16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/render-error/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/render-error", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | "client_error": "./src/ClientError.js", 14 | "server_error": "./src/ServerError.js", 15 | "init_error": "./src/InitError.js" 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /utils/omit/gmsrc/omit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const isPlainObject = require("@gourmet/is-plain-object"); 4 | 5 | module.exports = function omit(src, props) { 6 | if (isPlainObject(src)) { 7 | if (typeof props === "string") 8 | props = [props]; 9 | return Object.keys(src).reduce((obj, name) => { 10 | if (props.indexOf(name) === -1) 11 | obj[name] = src[name]; 12 | return obj; 13 | }, {}); 14 | } 15 | return src; 16 | }; 17 | -------------------------------------------------------------------------------- /tests/cli-basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-cli-basic", 3 | "private": true, 4 | "scripts": { 5 | "test": "tape test/*_test.js", 6 | "debug": "node --inspect-brk test/command_test.js" 7 | }, 8 | "dependencies": { 9 | "@gourmet/gourmet-cli": "^1.1.4", 10 | "@gourmet/test-cli-test-plugin": "^0.3.4" 11 | }, 12 | "devDependencies": { 13 | "pshell": "^1.1.0", 14 | "tape": "^4.9.0" 15 | }, 16 | "version": "1.1.4" 17 | } 18 | -------------------------------------------------------------------------------- /tests/loadable/src/PanelA.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import {css} from "emotion"; 3 | 4 | const panelStyle = css` 5 | margin: 1em; 6 | padding: 1em; 7 | border: 1px solid #ddd; 8 | `; 9 | 10 | class PanelA extends Component { 11 | render() { 12 | return ( 13 |
14 | This is the content of Panel A 15 |
16 | ); 17 | } 18 | } 19 | 20 | export default PanelA; 21 | -------------------------------------------------------------------------------- /tests/loadable/src/PanelB.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import {css} from "emotion"; 3 | 4 | const panelStyle = css` 5 | margin: 1em; 6 | padding: 1em; 7 | border: 1px solid #ddd; 8 | `; 9 | 10 | class PanelB extends Component { 11 | render() { 12 | return ( 13 |
14 | This is the content of Panel B 15 |
16 | ); 17 | } 18 | } 19 | 20 | export default PanelB; 21 | -------------------------------------------------------------------------------- /examples/redux/src/actions/index.js: -------------------------------------------------------------------------------- 1 | export const addTodo = text => ({ 2 | type: "ADD_TODO", 3 | text 4 | }); 5 | 6 | export const setVisibilityFilter = filter => ({ 7 | type: "SET_VISIBILITY_FILTER", 8 | filter 9 | }); 10 | 11 | export const toggleTodo = id => ({ 12 | type: "TOGGLE_TODO", 13 | id 14 | }); 15 | 16 | export const VisibilityFilters = { 17 | SHOW_ALL: "SHOW_ALL", 18 | SHOW_COMPLETED: "SHOW_COMPLETED", 19 | SHOW_ACTIVE: "SHOW_ACTIVE" 20 | }; 21 | -------------------------------------------------------------------------------- /tests/news-view/gmsrc/components/Articles.jsx: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import Article from "./Article"; 3 | 4 | export default class Articles extends Component { 5 | render() { 6 | const articles = this.props.articles; 7 | return ( 8 |
9 | {articles.map(article =>
)} 10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /contrib/plugin-react-i80/lib/GourmetPluginReactI80.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class PluginReactI80 { 4 | onRenderer({target}) { 5 | return [`@gourmet/react-i80/renderer.${target}.js`]; 6 | } 7 | } 8 | 9 | PluginReactI80.meta = { 10 | schema: { 11 | after: ["@gourmet/plugin-react", "@gourmet/plugin-react-emotion"] 12 | }, 13 | hooks: { 14 | "build:page_renderer": PluginReactI80.prototype.onRenderer 15 | } 16 | }; 17 | 18 | module.exports = PluginReactI80; 19 | -------------------------------------------------------------------------------- /contrib/react-i80/gmsrc/ActiveRoute.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const React = require("react"); 4 | const GourmetContext = require("@gourmet/react-context-gmctx"); 5 | const Router = require("./Router"); 6 | 7 | module.exports = class ActiveRoute extends React.Component { 8 | render() { 9 | return ( 10 | 11 | {gmctx => Router.get().renderActiveRoute(gmctx, this.props)} 12 | 13 | ); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /examples/redux-i80/src/actions/index.js: -------------------------------------------------------------------------------- 1 | export const addTodo = text => ({ 2 | type: "ADD_TODO", 3 | text 4 | }); 5 | 6 | export const setVisibilityFilter = filter => ({ 7 | type: "SET_VISIBILITY_FILTER", 8 | filter 9 | }); 10 | 11 | export const toggleTodo = id => ({ 12 | type: "TOGGLE_TODO", 13 | id 14 | }); 15 | 16 | export const VisibilityFilters = { 17 | SHOW_ALL: "SHOW_ALL", 18 | SHOW_COMPLETED: "SHOW_COMPLETED", 19 | SHOW_ACTIVE: "SHOW_ACTIVE" 20 | }; 21 | -------------------------------------------------------------------------------- /examples/redux-init/src/actions/index.js: -------------------------------------------------------------------------------- 1 | export const addTodo = text => ({ 2 | type: "ADD_TODO", 3 | text 4 | }); 5 | 6 | export const setVisibilityFilter = filter => ({ 7 | type: "SET_VISIBILITY_FILTER", 8 | filter 9 | }); 10 | 11 | export const toggleTodo = id => ({ 12 | type: "TOGGLE_TODO", 13 | id 14 | }); 15 | 16 | export const VisibilityFilters = { 17 | SHOW_ALL: "SHOW_ALL", 18 | SHOW_COMPLETED: "SHOW_COMPLETED", 19 | SHOW_ACTIVE: "SHOW_ACTIVE" 20 | }; 21 | -------------------------------------------------------------------------------- /tests/multi-pages/src/renderProps.js: -------------------------------------------------------------------------------- 1 | export default function renderProps(props) { 2 | const json = {}; 3 | return Object.keys(props).sort().map(name => { 4 | let value = props[name]; 5 | if (name === "gmctx") { 6 | json[name] = value = "{...}"; 7 | } else { 8 | json[name] = value; 9 | value = JSON.stringify(value); 10 | } 11 | return ` ${name}: ${value}\n`; 12 | }).concat([` JSON_BEGIN_[${JSON.stringify(json)}]_END_JSON\n`]); 13 | } 14 | -------------------------------------------------------------------------------- /tests/todo-redux/src/actions/index.js: -------------------------------------------------------------------------------- 1 | export const addTodo = text => ({ 2 | type: "ADD_TODO", 3 | text 4 | }); 5 | 6 | export const setVisibilityFilter = filter => ({ 7 | type: "SET_VISIBILITY_FILTER", 8 | filter 9 | }); 10 | 11 | export const toggleTodo = id => ({ 12 | type: "TOGGLE_TODO", 13 | id 14 | }); 15 | 16 | export const VisibilityFilters = { 17 | SHOW_ALL: "SHOW_ALL", 18 | SHOW_COMPLETED: "SHOW_COMPLETED", 19 | SHOW_ACTIVE: "SHOW_ACTIVE" 20 | }; 21 | -------------------------------------------------------------------------------- /contrib/react-apollo-renderer/gmsrc/handleLinkError.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = function handleLinkError({graphQLErrors, networkError}) { 4 | if (graphQLErrors) { 5 | graphQLErrors.map(({message, locations, path}) => 6 | console.error( 7 | `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}` 8 | ), 9 | ); 10 | } 11 | if (networkError) { 12 | console.error(`[Network error]: ${networkError}`); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/PhotoPanel.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {ComponentA, ComponentB} from "./MultiLoadables"; 3 | import earth from "./images/earth.png"; 4 | 5 | export default function PhotoPanel() { 6 | 7 | return ( 8 |
9 | 10 | 11 | 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /tests/babel-polyfill/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-babel-polyfill", 3 | "version": "1.5.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "gourmet build", 7 | "test": "gourmet build --verbosity 1 && gourmet --stage entry build --verbosity 1 && tape test/*_test.js" 8 | }, 9 | "devDependencies": { 10 | "@gourmet/gourmet-cli": "^1.1.4", 11 | "@gourmet/preset-core": "^1.4.0", 12 | "core-js": "^3.0.0", 13 | "tape": "^4.9.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/render-error/src/InitError.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | // Currently, it appears that Puppeteer doesn't support a method to get 4 | // a browser's JS uncaught exception. For this reason, we test the server 5 | // init error only. 6 | if (SERVER) 7 | throw Error("init server error"); 8 | 9 | export default class InitClientError extends React.Component { 10 | render() { 11 | return ( 12 |
13 | Hello, world! 14 |
15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /runtime/client-http/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/client-http", 3 | "version": "1.2.4", 4 | "main": "lib/clientHttp.js", 5 | "dependencies": { 6 | "@gourmet/get-req-opts": "^0.2.3", 7 | "@gourmet/http-module": "^0.3.3", 8 | "@gourmet/merge": "^0.8.3", 9 | "@gourmet/middleware": "^1.2.4", 10 | "@gourmet/proxy-headers": "^0.3.3" 11 | }, 12 | "license": "MIT", 13 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/client-http" 14 | } 15 | -------------------------------------------------------------------------------- /contrib/plugin-react-emotion/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plugin-react-emotion", 3 | "version": "1.0.3", 4 | "main": "lib/GourmetPluginReactEmotion.js", 5 | "keywords": [ 6 | "gourmet-plugin" 7 | ], 8 | "dependencies": { 9 | "babel-plugin-emotion": "^9.2.11" 10 | }, 11 | "peerDependencies": { 12 | "@gourmet/emotion-renderer": "*" 13 | }, 14 | "license": "MIT", 15 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/plugin-react-emotion" 16 | } 17 | -------------------------------------------------------------------------------- /tests/builder-basic/src/server.mjs: -------------------------------------------------------------------------------- 1 | import renderer from "./renderer"; 2 | 3 | export default ({page, manifest}) => { 4 | const render = renderer({page, manifest}); 5 | return ({reqArgs, clientProps}) => { 6 | return render( 7 | "** SERVER **", 8 | `page: ${page}`, 9 | `stage: ${manifest.stage}`, 10 | `staticPrefix: ${manifest.client.staticPrefix}`, 11 | `reqArgs.url: ${reqArgs.url}`, 12 | `clientProps: ${JSON.stringify(clientProps)}` 13 | ); 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /tests/cli-basic/lib/MyPlugin.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class MyPlugin { 4 | _onSay({argv, command}) { 5 | console.log("command:", command); 6 | console.log("argv:", JSON.stringify(argv)); 7 | } 8 | } 9 | 10 | MyPlugin.meta = { 11 | commands: { 12 | say: { 13 | options: { 14 | decorate: { 15 | alias: "e" 16 | } 17 | } 18 | } 19 | }, 20 | hooks: { 21 | "command:say": MyPlugin.prototype._onSay 22 | } 23 | }; 24 | 25 | module.exports = MyPlugin; 26 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/ProfileView.jsx: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const React = require("react"); 4 | const loadable = require("@gourmet/react-loadable"); 5 | const CustomLoading = require("./CustomLoading").default; 6 | 7 | module.exports = class ProfileView extends React.Component { 8 | static routeLoadable = loadable({ 9 | loader: () => import("./ProfilePanel"), 10 | loading: CustomLoading 11 | }); 12 | 13 | render() { 14 | return ; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /utils/console/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/console", 3 | "version": "1.1.4", 4 | "description": "A console abstraction for generating text output and debug logs", 5 | "dependencies": { 6 | "@gourmet/colors": "^1.1.3", 7 | "@gourmet/is-plain-object": "^0.3.5", 8 | "@gourmet/prefix-lines": "^0.3.3", 9 | "minimist": "^1.2.0", 10 | "strip-ansi": "^5.0.0" 11 | }, 12 | "license": "MIT", 13 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/console" 14 | } 15 | -------------------------------------------------------------------------------- /utils/promise-map/README-SRC.md: -------------------------------------------------------------------------------- 1 | # {{pkg.name}} 2 | 3 | {{desc}} 4 | 5 | # Basic usage 6 | 7 | ```js 8 | const map = require("@gourmet/promise-map"); 9 | 10 | function checkUrl(url) { 11 | return somehowGetTheHttpStatusCodeFromTheUrl(url).then(status => { 12 | return status === 200 ? "OK" : "Down"; 13 | }); 14 | } 15 | 16 | map(["https://www.google.com", "https://github.com"], url => { 17 | return checkUrl(url); 18 | }).then(results => { 19 | console.log(results); // ["OK", "OK"] 20 | }); 21 | ``` 22 | -------------------------------------------------------------------------------- /utils/resolve-template/gmsrc/resolveTemplate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const template = require("lodash.template"); 4 | 5 | const INTERPOLATE_RE = /{{(\w[\w.]*)}}/g; 6 | 7 | module.exports = function resolveTemplate(value, defaultTemplate) { 8 | if (typeof value === "function") { 9 | return value; 10 | } else if (typeof value === "string") { 11 | return template(value, {interpolate: INTERPOLATE_RE}); 12 | } else { 13 | return template(defaultTemplate, {interpolate: INTERPOLATE_RE}); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /contrib/plugin-react-loadable/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plugin-react-loadable", 3 | "version": "0.7.4", 4 | "main": "lib/GourmetPluginReactLoadable.js", 5 | "keywords": [ 6 | "gourmet-plugin" 7 | ], 8 | "dependencies": { 9 | "@gourmet/babel-plugin-gourmet-loadable": "^1.0.4", 10 | "@gourmet/relative-path": "^0.4.3", 11 | "resolve": "^1.6.0" 12 | }, 13 | "license": "MIT", 14 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/plugin-react-loadable" 15 | } 16 | -------------------------------------------------------------------------------- /tests/todo-apollo/lib/TodoData.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {DataSource} = require("apollo-datasource"); 4 | 5 | const _todos = [ 6 | "Buy a pack of milk", 7 | "Finish the documentation" 8 | ]; 9 | 10 | module.exports = class TodoData extends DataSource { 11 | initialize(config) { 12 | this.context = config.context; 13 | } 14 | 15 | getAll() { 16 | return _todos.slice(); // make a shallow copy 17 | } 18 | 19 | addTodo(text) { 20 | _todos.push(text); 21 | return text; 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /utils/promise-create-write-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-create-write-stream", 3 | "version": "0.3.3", 4 | "description": "Creates a writable file stream and returns a promise that is fulfilled when the writing is finished and the file is closed.", 5 | "main": "gmsrc/promiseCreateWriteStream.js", 6 | "dependencies": { 7 | "mkdirp": "^0.5.1" 8 | }, 9 | "license": "MIT", 10 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-create-write-stream" 11 | } 12 | -------------------------------------------------------------------------------- /utils/send-content/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/send-content", 3 | "version": "1.1.4", 4 | "main": "gmsrc/sendContent.js", 5 | "dependencies": { 6 | "@gourmet/console": "^1.1.4", 7 | "@gourmet/inspect-error": "^0.3.3", 8 | "@gourmet/is-plain-object": "^0.3.5", 9 | "@gourmet/is-stream": "^0.3.3", 10 | "end-of-stream": "^1.4.1", 11 | "pump": "^3.0.0" 12 | }, 13 | "license": "MIT", 14 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/send-content" 15 | } 16 | -------------------------------------------------------------------------------- /utils/web-proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/web-proxy", 3 | "version": "1.1.4", 4 | "main": "gmsrc/index.js", 5 | "dependencies": { 6 | "@gourmet/error": "^0.3.4", 7 | "@gourmet/get-req-opts": "^0.2.3", 8 | "@gourmet/handle-request-error": "^1.1.4", 9 | "@gourmet/http-module": "^0.3.3", 10 | "@gourmet/proxy-headers": "^0.3.3", 11 | "pump": "^3.0.0" 12 | }, 13 | "license": "MIT", 14 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/web-proxy" 15 | } 16 | -------------------------------------------------------------------------------- /examples/redux/src/components/Todo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Todo = ({onClick, completed, text}) => ( 5 |
  • 11 | {text} 12 |
  • 13 | ); 14 | 15 | Todo.propTypes = { 16 | onClick: PropTypes.func.isRequired, 17 | completed: PropTypes.bool.isRequired, 18 | text: PropTypes.string.isRequired 19 | }; 20 | 21 | export default Todo; 22 | -------------------------------------------------------------------------------- /tests/news-view/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-news-view", 3 | "version": "1.1.3", 4 | "module": "gmsrc/NewsView.jsx", 5 | "dependencies": { 6 | "@gourmet/promise-repeat": "^0.3.3", 7 | "@gourmet/self-url": "^1.1.3", 8 | "classnames": "^2.2.6", 9 | "timeago.js": "^3.0.2" 10 | }, 11 | "peerDependencies": { 12 | "react": "16", 13 | "react-dom": "16" 14 | }, 15 | "license": "MIT", 16 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/tests/news-view" 17 | } 18 | -------------------------------------------------------------------------------- /tests/postcss/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | outputDir: "../../.gourmet/postcss", 6 | runtime: { 7 | client: ["chrome 67", "ie 11"] 8 | } 9 | }, 10 | 11 | postcss: { 12 | useConfigFile: context => { 13 | return context.stage === "config"; 14 | }, 15 | 16 | browserslist: context => { 17 | return context.stage === "file" ? "file" : "gourmet"; 18 | } 19 | }, 20 | 21 | pages: { 22 | main: "./src/main.js" 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /tests/todo-redux/src/components/Todo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Todo = ({onClick, completed, text}) => ( 5 |
  • 11 | {text} 12 |
  • 13 | ); 14 | 15 | Todo.propTypes = { 16 | onClick: PropTypes.func.isRequired, 17 | completed: PropTypes.bool.isRequired, 18 | text: PropTypes.string.isRequired 19 | }; 20 | 21 | export default Todo; 22 | -------------------------------------------------------------------------------- /examples/redux-i80/src/components/Todo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Todo = ({onClick, completed, text}) => ( 5 |
  • 11 | {text} 12 |
  • 13 | ); 14 | 15 | Todo.propTypes = { 16 | onClick: PropTypes.func.isRequired, 17 | completed: PropTypes.bool.isRequired, 18 | text: PropTypes.string.isRequired 19 | }; 20 | 21 | export default Todo; 22 | -------------------------------------------------------------------------------- /examples/redux-init/src/components/Todo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Todo = ({onClick, completed, text}) => ( 5 |
  • 11 | {text} 12 |
  • 13 | ); 14 | 15 | Todo.propTypes = { 16 | onClick: PropTypes.func.isRequired, 17 | completed: PropTypes.bool.isRequired, 18 | text: PropTypes.string.isRequired 19 | }; 20 | 21 | export default Todo; 22 | -------------------------------------------------------------------------------- /examples/redux/src/components/Link.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Link = ({active, children, onClick}) => ( 5 | 14 | ); 15 | 16 | Link.propTypes = { 17 | active: PropTypes.bool.isRequired, 18 | children: PropTypes.node.isRequired, 19 | onClick: PropTypes.func.isRequired 20 | }; 21 | 22 | export default Link; 23 | -------------------------------------------------------------------------------- /examples/redux/src/containers/FilterLink.js: -------------------------------------------------------------------------------- 1 | import {connect} from "react-redux"; 2 | import {setVisibilityFilter} from "../actions"; 3 | import Link from "../components/Link"; 4 | 5 | const mapStateToProps = (state, ownProps) => ({ 6 | active: ownProps.filter === state.visibilityFilter 7 | }); 8 | 9 | const mapDispatchToProps = (dispatch, ownProps) => ({ 10 | onClick: () => dispatch(setVisibilityFilter(ownProps.filter)) 11 | }); 12 | 13 | export default connect( 14 | mapStateToProps, 15 | mapDispatchToProps 16 | )(Link); 17 | -------------------------------------------------------------------------------- /runtime/lambda-adapter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/lambda-adapter", 3 | "version": "1.2.4", 4 | "main": "lib/getHandler.js", 5 | "description": "Creates a tiny adapter that converts Lambda invocations to Gourmet Renderer calls", 6 | "dependencies": { 7 | "@gourmet/client-lib": "^1.2.4", 8 | "@gourmet/is-stream": "^0.3.3", 9 | "@gourmet/stream-to-string": "^0.3.3" 10 | }, 11 | "license": "MIT", 12 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/lambda-adapter" 13 | } 14 | -------------------------------------------------------------------------------- /scripts/standalone-runner/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/test-standalone-runner", 3 | "version": "0.2.6", 4 | "private": true, 5 | "scripts": { 6 | "copy-all": "node copy-all.js", 7 | "install-all": "node install-all.js", 8 | "test-all": "node test-all.js" 9 | }, 10 | "devDependencies": { 11 | "@gourmet/promise-each": "^0.3.3", 12 | "@gourmet/promise-main": "^0.3.3", 13 | "mkdirp": "^0.5.1", 14 | "ncp": "^2.0.0", 15 | "pshell": "^1.1.0", 16 | "rimraf": "^2.6.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/builder-basic/config/gourmet_cfg.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/builder-basic", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: { 14 | client: "./src/client.js", 15 | server: "./src/server.mjs" 16 | }, 17 | admin: { 18 | client: "./src/admin.js", 19 | server: "./src/admin.js" 20 | } 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /tests/todo-redux/src/components/Link.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Link = ({active, children, onClick}) => ( 5 | 14 | ); 15 | 16 | Link.propTypes = { 17 | active: PropTypes.bool.isRequired, 18 | children: PropTypes.node.isRequired, 19 | onClick: PropTypes.func.isRequired 20 | }; 21 | 22 | export default Link; 23 | -------------------------------------------------------------------------------- /tests/todo-redux/src/containers/FilterLink.js: -------------------------------------------------------------------------------- 1 | import {connect} from "react-redux"; 2 | import {setVisibilityFilter} from "../actions"; 3 | import Link from "../components/Link"; 4 | 5 | const mapStateToProps = (state, ownProps) => ({ 6 | active: ownProps.filter === state.visibilityFilter 7 | }); 8 | 9 | const mapDispatchToProps = (dispatch, ownProps) => ({ 10 | onClick: () => dispatch(setVisibilityFilter(ownProps.filter)) 11 | }); 12 | 13 | export default connect( 14 | mapStateToProps, 15 | mapDispatchToProps 16 | )(Link); 17 | -------------------------------------------------------------------------------- /utils/merge/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/merge", 3 | "version": "0.8.3", 4 | "description": "Merges objects with special handling of arrays and non-plain objects", 5 | "main": "gmsrc/merge.js", 6 | "scripts": { 7 | "test": "tape test/*_test.js" 8 | }, 9 | "devDependencies": { 10 | "tape": "^4.9.0" 11 | }, 12 | "dependencies": { 13 | "@gourmet/is-plain-object": "^0.3.5" 14 | }, 15 | "license": "MIT", 16 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/merge" 17 | } 18 | -------------------------------------------------------------------------------- /examples/redux-i80/src/components/Link.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Link = ({active, children, onClick}) => ( 5 | 14 | ); 15 | 16 | Link.propTypes = { 17 | active: PropTypes.bool.isRequired, 18 | children: PropTypes.node.isRequired, 19 | onClick: PropTypes.func.isRequired 20 | }; 21 | 22 | export default Link; 23 | -------------------------------------------------------------------------------- /examples/redux-i80/src/containers/FilterLink.js: -------------------------------------------------------------------------------- 1 | import {connect} from "react-redux"; 2 | import {setVisibilityFilter} from "../actions"; 3 | import Link from "../components/Link"; 4 | 5 | const mapStateToProps = (state, ownProps) => ({ 6 | active: ownProps.filter === state.visibilityFilter 7 | }); 8 | 9 | const mapDispatchToProps = (dispatch, ownProps) => ({ 10 | onClick: () => dispatch(setVisibilityFilter(ownProps.filter)) 11 | }); 12 | 13 | export default connect( 14 | mapStateToProps, 15 | mapDispatchToProps 16 | )(Link); 17 | -------------------------------------------------------------------------------- /examples/redux-init/src/components/Link.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | const Link = ({active, children, onClick}) => ( 5 | 14 | ); 15 | 16 | Link.propTypes = { 17 | active: PropTypes.bool.isRequired, 18 | children: PropTypes.node.isRequired, 19 | onClick: PropTypes.func.isRequired 20 | }; 21 | 22 | export default Link; 23 | -------------------------------------------------------------------------------- /examples/redux-init/src/containers/FilterLink.js: -------------------------------------------------------------------------------- 1 | import {connect} from "react-redux"; 2 | import {setVisibilityFilter} from "../actions"; 3 | import Link from "../components/Link"; 4 | 5 | const mapStateToProps = (state, ownProps) => ({ 6 | active: ownProps.filter === state.visibilityFilter 7 | }); 8 | 9 | const mapDispatchToProps = (dispatch, ownProps) => ({ 10 | onClick: () => dispatch(setVisibilityFilter(ownProps.filter)) 11 | }); 12 | 13 | export default connect( 14 | mapStateToProps, 15 | mapDispatchToProps 16 | )(Link); 17 | -------------------------------------------------------------------------------- /runtime/client-lambda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/client-lambda", 3 | "version": "1.1.4", 4 | "main": "lib/clientLambda.js", 5 | "dependencies": { 6 | "@gourmet/error": "^0.3.4", 7 | "@gourmet/get-aws-service": "^0.3.3", 8 | "@gourmet/get-req-args": "^0.4.3", 9 | "@gourmet/merge": "^0.8.3", 10 | "@gourmet/omit": "^0.3.3", 11 | "@gourmet/send-content": "^1.1.4" 12 | }, 13 | "license": "MIT", 14 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/client-lambda" 15 | } 16 | -------------------------------------------------------------------------------- /contrib/react-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/react-renderer", 3 | "version": "1.3.0", 4 | "main": "gmsrc/getReactClientRenderer.js", 5 | "dependencies": { 6 | "@gourmet/loadable-registrar": "^0.3.4", 7 | "@gourmet/promise-protect": "^0.3.3" 8 | }, 9 | "peerDependencies": { 10 | "@gourmet/react-context-gmctx": "*", 11 | "react": "16", 12 | "react-dom": "16" 13 | }, 14 | "license": "MIT", 15 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/react-renderer" 16 | } 17 | -------------------------------------------------------------------------------- /runtime/middleware/lib/proxy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const webProxy = require("@gourmet/web-proxy"); 4 | 5 | module.exports = function(gourmet, options) { 6 | const {staticPrefix} = options; 7 | return function(req, res, next) { 8 | if (req.url.indexOf(staticPrefix) === 0) { 9 | const reqOpts = gourmet.getReqOpts(options); 10 | reqOpts.path = req.originalUrl || req.url; 11 | webProxy(req, res, reqOpts, { 12 | handleError: next 13 | }); 14 | } else { 15 | next(); 16 | } 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /utils/promise-each/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-each", 3 | "version": "0.3.3", 4 | "description": "Iterates through an array asynchronously in series - the handler will not be called until the promise returned by the previous call is resolved.", 5 | "main": "gmsrc/promiseEach.js", 6 | "dependencies": { 7 | "@gourmet/promise-repeat": "^0.3.3", 8 | "@gourmet/promise-sync": "^0.3.3" 9 | }, 10 | "license": "MIT", 11 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-each" 12 | } 13 | -------------------------------------------------------------------------------- /presets/core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/preset-core", 3 | "description": "Gourmet Preset containing core packages for building and running a Gourmet SSR project", 4 | "version": "1.4.0", 5 | "main": "lib/GourmetPresetCore.js", 6 | "keywords": [ 7 | "gourmet-plugin" 8 | ], 9 | "dependencies": { 10 | "@babel/core": "^7.4.0", 11 | "@gourmet/group-core": "^1.4.0", 12 | "webpack": "^4.26.6" 13 | }, 14 | "license": "MIT", 15 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/presets/core" 16 | } 17 | -------------------------------------------------------------------------------- /tests/multi-views/src/renderProps.js: -------------------------------------------------------------------------------- 1 | export default function renderProps(title, props) { 2 | const json = {}; 3 | return [`** ${title} **\n`].concat(Object.keys(props).sort().map(name => { 4 | let value = props[name]; 5 | if (name === "gmctx" || name === "route") { 6 | json[name] = value = "{...}"; 7 | } else { 8 | json[name] = value; 9 | value = JSON.stringify(value); 10 | } 11 | return ` ${name}: ${value}\n`; 12 | }).concat([` JSON(${title})_BEGIN_[${JSON.stringify(json)}]_END_JSON(${title})\n`])); 13 | } 14 | -------------------------------------------------------------------------------- /utils/promise-deep-prop/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-deep-prop", 3 | "version": "0.4.3", 4 | "description": "Gets a deep property value while resolving promises", 5 | "main": "gmsrc/promiseDeepProp.js", 6 | "dependencies": { 7 | "@gourmet/error": "^0.3.4", 8 | "@gourmet/is-plain-object": "^0.3.5", 9 | "@gourmet/promise-each": "^0.3.3", 10 | "@gourmet/promise-sync": "^0.3.3" 11 | }, 12 | "license": "MIT", 13 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-deep-prop" 14 | } 15 | -------------------------------------------------------------------------------- /utils/resolve-dirs/gmsrc/resolveDirs.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const npath = require("path"); 4 | 5 | module.exports = function resolveDirs(args, obj={}) { 6 | obj.stage = args.stage || "local"; 7 | obj.workDir = npath.resolve(process.cwd(), args.workDir || ""); 8 | obj.outputDir = npath.resolve(obj.workDir, args.outputDir || ".gourmet"); 9 | obj.serverDir = npath.resolve(obj.outputDir, args.serverDir || `${obj.stage}/server`); 10 | obj.clientDir = npath.resolve(obj.outputDir, args.clientDir || `${obj.stage}/client`); 11 | return obj; 12 | }; 13 | -------------------------------------------------------------------------------- /utils/stream-to-string/gmsrc/streamToString.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const eos = require("end-of-stream"); 4 | const destroy = require("destroy"); 5 | 6 | module.exports = function(stream) { 7 | return new Promise((resolve, reject) => { 8 | const chunks = []; 9 | 10 | stream.on("data", chunk => { 11 | chunks.push(chunk.toString()); 12 | }); 13 | 14 | eos(stream, err => { 15 | if (err) 16 | reject(err); 17 | else 18 | resolve(chunks.join("")); 19 | destroy(stream); 20 | }); 21 | }); 22 | }; 23 | -------------------------------------------------------------------------------- /tests/react-hello/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/react-hello", 9 | contentHash: context => context.stage === "ltc", 10 | 11 | initOptions: { 12 | dataPropertyName: "__INIT_DATA__" 13 | }, 14 | 15 | moduleLinks: { 16 | "react": "client:external", 17 | "react-dom/server": "external" 18 | } 19 | }, 20 | 21 | pages: { 22 | main: "./src/HelloApp.jsx" 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /website/sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "Introduction": [ 4 | "getting-started" 5 | ], 6 | "Tutorial": [ 7 | "tutorial-1", 8 | "tutorial-2", 9 | "tutorial-3", 10 | "tutorial-4", 11 | "tutorial-5", 12 | "tutorial-6" 13 | ], 14 | "Guides": [ 15 | "guides/index", 16 | "guides/using-redux", 17 | "guides/using-apollo-graphql" 18 | ], 19 | "Reference": [ 20 | "reference" 21 | ] 22 | }, 23 | "docs-other": { 24 | "First Category": ["doc4", "doc5"] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/redux-i80/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const express = require("express"); 4 | const serverArgs = require("@gourmet/server-args"); 5 | const gourmet = require("@gourmet/client-lib"); 6 | 7 | const args = serverArgs({workDir: __dirname + "/.."}); 8 | const app = express(); 9 | 10 | app.use(gourmet.middleware(args)); 11 | 12 | app.get("*", (req, res) => { 13 | res.serve("main"); 14 | }); 15 | 16 | app.use(gourmet.errorMiddleware()); 17 | 18 | app.listen(args.port, () => { 19 | console.log(`Server is listening on port ${args.port}...`); 20 | }); 21 | -------------------------------------------------------------------------------- /examples/redux/lib/server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const express = require("express"); 4 | const serverArgs = require("@gourmet/server-args"); 5 | const gourmet = require("@gourmet/client-lib"); 6 | 7 | const args = serverArgs({workDir: __dirname + "/.."}); 8 | const app = express(); 9 | 10 | app.use(gourmet.middleware(args)); 11 | 12 | app.get("/", (req, res) => { 13 | res.serve("main"); 14 | }); 15 | 16 | app.use(gourmet.errorMiddleware()); 17 | 18 | app.listen(args.port, () => { 19 | console.log(`Server is listening on port ${args.port}...`); 20 | }); 21 | -------------------------------------------------------------------------------- /groups/react-i80/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/group-react-i80", 3 | "description": "A group of sub-packages enabling the isomorphic routing support using React I80 in Gourmet SSR projects", 4 | "version": "1.3.0", 5 | "main": "lib/GourmetGroupReactI80.js", 6 | "keywords": [ 7 | "gourmet-plugin" 8 | ], 9 | "dependencies": { 10 | "@gourmet/plugin-react-i80": "^0.4.3", 11 | "@gourmet/react-i80": "^1.3.0" 12 | }, 13 | "license": "MIT", 14 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/groups/react-i80" 15 | } 16 | -------------------------------------------------------------------------------- /tests/builder-babel/src/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class A {} 4 | 5 | function fn() { 6 | const val = 10; 7 | return val; 8 | } 9 | 10 | module.exports = () => { 11 | const info = JSON.stringify({ 12 | message: "Hello, world!", 13 | "class A": A.toString(), 14 | "fn": fn.toString() 15 | }, null, 2); 16 | 17 | if (CLIENT) { 18 | const parent = document.getElementById("client_output"); 19 | parent.innerText = info; 20 | } else { 21 | return `
    ${info}
    `;
    22 |   }
    23 | };
    24 | 
    
    
    --------------------------------------------------------------------------------
    /tests/fake-github/gourmet_config.js:
    --------------------------------------------------------------------------------
     1 | "use strict";
     2 | 
     3 | module.exports = {
     4 |   builder: {
     5 |     stageTypes: {
     6 |       "production": ["prod", "ltc"]
     7 |     },
     8 |     outputDir: "../../.gourmet/fake-github",
     9 |     granularity: 2,
    10 |     sourceMap: false,
    11 |     contentHash: context => context.stage === "ltc",
    12 |     bundles: {
    13 |       react: ["react", "react-dom"],
    14 |       components: "./src/components",
    15 |       containers: "./src/containers"
    16 |     }
    17 |   },
    18 | 
    19 |   pages: {
    20 |     main: "./src/containers/HelloApp"
    21 |   }
    22 | };
    23 | 
    
    
    --------------------------------------------------------------------------------
    /utils/promise-map/README.md:
    --------------------------------------------------------------------------------
     1 | # @gourmet/promise-map
     2 | 
     3 | Promise aware version of JavaScript's `Array.prototype.map`.
     4 | 
     5 | # Basic usage
     6 | 
     7 | ```js
     8 | const map = require("@gourmet/promise-map");
     9 | 
    10 | function checkUrl(url) {
    11 |   return somehowGetTheHttpStatusCodeFromTheUrl(url).then(status => {
    12 |     return status === 200 ? "OK" : "Down";
    13 |   });
    14 | }
    15 | 
    16 | map(["https://www.google.com", "https://github.com"], url => {
    17 |   return checkUrl(url);
    18 | }).then(results => {
    19 |   console.log(results);   // ["OK", "OK"]
    20 | });
    21 | ```
    22 | 
    
    
    --------------------------------------------------------------------------------
    /utils/variables/gmsrc/VarGetter.js:
    --------------------------------------------------------------------------------
     1 | "use strict";
     2 | 
     3 | const promiseWrap = require("@gourmet/promise-wrap");
     4 | const VarNode = require("./VarNode");
     5 | 
     6 | class VarGetter extends VarNode {
     7 |   constructor(handler) {
     8 |     super();
     9 |     this._handler = handler;
    10 |   }
    11 | 
    12 |   resolve(vars) {
    13 |     const handler = this._handler;
    14 | 
    15 |     if (typeof handler !== "function")
    16 |       throw Error("Getter must be a function");
    17 | 
    18 |     return promiseWrap(handler(vars.handlerContext));
    19 |   }
    20 | }
    21 | 
    22 | module.exports = VarGetter;
    23 | 
    
    
    --------------------------------------------------------------------------------
    /runtime/http-server/package.json:
    --------------------------------------------------------------------------------
     1 | {
     2 |   "name": "@gourmet/http-server",
     3 |   "version": "1.2.4",
     4 |   "description": "Gourmet rendering service implemented as a standalone HTTP server",
     5 |   "bin": {
     6 |     "gourmet-http-server": "bin/gourmet-http-server.js"
     7 |   },
     8 |   "main": "lib/GourmetHttpServer.js",
     9 |   "dependencies": {
    10 |     "@gourmet/client-lib": "^1.2.4",
    11 |     "@gourmet/console": "^1.1.4",
    12 |     "connect": "^3.6.6"
    13 |   },
    14 |   "license": "MIT",
    15 |   "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/http-server"
    16 | }
    17 | 
    
    
    --------------------------------------------------------------------------------
    /runtime/client-lib/package.json:
    --------------------------------------------------------------------------------
     1 | {
     2 |   "name": "@gourmet/client-lib",
     3 |   "version": "1.2.4",
     4 |   "main": "lib/clientLib.js",
     5 |   "dependencies": {
     6 |     "@gourmet/get-exported": "^0.4.3",
     7 |     "@gourmet/merge": "^0.8.3",
     8 |     "@gourmet/middleware": "^1.2.4",
     9 |     "@gourmet/promise-protect": "^0.3.3",
    10 |     "@gourmet/renderer-sandbox": "^0.5.3",
    11 |     "@gourmet/resolve-dirs": "^1.1.3",
    12 |     "@gourmet/storage-fs": "^0.4.3"
    13 |   },
    14 |   "license": "MIT",
    15 |   "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/client-lib"
    16 | }
    17 | 
    
    
    --------------------------------------------------------------------------------
    /utils/promise-map/gmsrc/promiseMap.js:
    --------------------------------------------------------------------------------
     1 | "use strict";
     2 | 
     3 | const promiseRepeat = require("@gourmet/promise-repeat");
     4 | const promiseSync = require("@gourmet/promise-sync");
     5 | 
     6 | module.exports = function promiseMap(arr, handler) {
     7 |   const items = new Array(arr.length);
     8 |   let idx = 0;
     9 | 
    10 |   return promiseRepeat(() => {
    11 |     if (idx >= arr.length)
    12 |       return items;
    13 | 
    14 |     const pos = idx++;
    15 |     const value = handler(arr[pos], pos);
    16 | 
    17 |     return promiseSync(value, value => {
    18 |       items[pos] = value;
    19 |     });
    20 |   });
    21 | };
    22 | 
    
    
    --------------------------------------------------------------------------------
    /examples/redux/src/components/Footer.js:
    --------------------------------------------------------------------------------
     1 | import React from "react";
     2 | import FilterLink from "../containers/FilterLink";
     3 | import {VisibilityFilters} from "../actions";
     4 | 
     5 | const Footer = () => (
     6 |   
    7 | Show: 8 | 9 | All 10 | 11 | 12 | Active 13 | 14 | 15 | Completed 16 | 17 |
    18 | ); 19 | 20 | export default Footer; 21 | -------------------------------------------------------------------------------- /runtime/middleware/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/middleware", 3 | "version": "1.2.4", 4 | "main": "lib/gourmetMiddleware.js", 5 | "dependencies": { 6 | "@gourmet/get-req-args": "^0.4.3", 7 | "@gourmet/handle-request-error": "^1.1.4", 8 | "@gourmet/merge": "^0.8.3", 9 | "@gourmet/resolve-dirs": "^1.1.3", 10 | "@gourmet/send-content": "^1.1.4", 11 | "@gourmet/watch-middleware": "^1.1.4", 12 | "@gourmet/web-proxy": "^1.1.4" 13 | }, 14 | "license": "MIT", 15 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/middleware" 16 | } 17 | -------------------------------------------------------------------------------- /tests/builder-deps/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/builder-deps", 9 | contentHash: context => context.stage === "ltc", 10 | 11 | installSourceMapSupport: false, 12 | moduleLinks: { 13 | "domready": "client", 14 | "rimraf": "server", 15 | "classnames": "client:external", 16 | "mkdirp": "external", 17 | "none": false 18 | } 19 | }, 20 | 21 | pages: { 22 | main: "./src/main" 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/src/MultiLoadables.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import loadable from "@gourmet/react-loadable"; 3 | 4 | export const ComponentA = loadable({ 5 | loader: () => import("./MessageBox"), 6 | render(loaded, props) { 7 | return ; 8 | }, 9 | signature: "a" 10 | }); 11 | 12 | export const ComponentB = loadable({ 13 | loader: () => import("./MessageBox"), 14 | render(loaded, props) { 15 | return ; 16 | }, 17 | signature: "b" 18 | }); 19 | -------------------------------------------------------------------------------- /examples/redux-i80/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import FilterLink from "../containers/FilterLink"; 3 | import {VisibilityFilters} from "../actions"; 4 | 5 | const Footer = () => ( 6 |
    7 | Show: 8 | 9 | All 10 | 11 | 12 | Active 13 | 14 | 15 | Completed 16 | 17 |
    18 | ); 19 | 20 | export default Footer; 21 | -------------------------------------------------------------------------------- /examples/redux-init/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import FilterLink from "../containers/FilterLink"; 3 | import {VisibilityFilters} from "../actions"; 4 | 5 | const Footer = () => ( 6 |
    7 | Show: 8 | 9 | All 10 | 11 | 12 | Active 13 | 14 | 15 | Completed 16 | 17 |
    18 | ); 19 | 20 | export default Footer; 21 | -------------------------------------------------------------------------------- /tests/builder-basic/src/renderer.js: -------------------------------------------------------------------------------- 1 | import concat from "./concat"; 2 | 3 | export default function renderer({page, manifest}) { 4 | const staticPrefix = manifest.client.staticPrefix; 5 | const scripts = manifest.client.pages[page].map(filename => { 6 | return ``; 7 | }).join("\n"); 8 | 9 | return (...lines) => { 10 | return { 11 | content: concat( 12 | scripts, 13 | `
    ${concat(...lines)}
    `, 14 | '
    '
    15 |       )
    16 |     };
    17 |   };
    18 | }
    19 | 
    
    
    --------------------------------------------------------------------------------
    /tests/multi-pages/src/MainPage.js:
    --------------------------------------------------------------------------------
     1 | import React from "react";
     2 | import renderProps from "./renderProps";
     3 | 
     4 | export default class MainPage extends React.Component {
     5 |   static getInitialProps() {
     6 |     return {MainPage_getInitialProps: true};
     7 |   }
     8 | 
     9 |   static getStockProps() {
    10 |     return {MainPage_getStockProps: true};
    11 |   }
    12 | 
    13 |   render() {
    14 |     return (
    15 |       
    16 |

    Index

    17 |

    {this.props.greeting}

    18 |
    19 |           {renderProps(this.props)}
    20 |         
    21 |
    22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/todo-redux/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import FilterLink from "../containers/FilterLink"; 3 | import {VisibilityFilters} from "../actions"; 4 | 5 | const Footer = () => ( 6 |
    7 | Show: 8 | 9 | All 10 | 11 | 12 | Active 13 | 14 | 15 | Completed 16 | 17 |
    18 | ); 19 | 20 | export default Footer; 21 | -------------------------------------------------------------------------------- /groups/react-i80/lib/GourmetGroupReactI80.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class GroupReactI80 { 4 | onUserConfig(context) { 5 | const moduleDir = context.builder.moduleDir(__dirname); 6 | return { 7 | builder: { 8 | alias: { 9 | "@gourmet/react-i80": moduleDir("@gourmet/react-i80") 10 | } 11 | } 12 | }; 13 | } 14 | } 15 | 16 | GroupReactI80.meta = { 17 | subplugins: [ 18 | "@gourmet/plugin-react-i80" 19 | ], 20 | hooks: { 21 | "build:user_config": GroupReactI80.prototype.onUserConfig 22 | } 23 | }; 24 | 25 | module.exports = GroupReactI80; 26 | -------------------------------------------------------------------------------- /utils/storage-s3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/storage-s3", 3 | "version": "0.3.3", 4 | "description": "File storage interface for AWS S3", 5 | "main": "gmsrc/StorageS3.js", 6 | "scripts": { 7 | "test": "tape test/*_test.js" 8 | }, 9 | "dependencies": { 10 | "@gourmet/get-aws-service": "^0.3.3", 11 | "@gourmet/promise-queue": "^0.3.3", 12 | "@gourmet/promise-repeat": "^0.3.3" 13 | }, 14 | "devDependencies": { 15 | "tape": "^4.9.0" 16 | }, 17 | "license": "MIT", 18 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/storage-s3" 19 | } 20 | -------------------------------------------------------------------------------- /tests/multi-views/src/DashboardView.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderProps from "./renderProps"; 3 | 4 | export default class DashboardView extends React.Component { 5 | static getInitialProps(gmctx) { 6 | gmctx.setHead(DashboardView); 7 | return new Promise(resolve => { 8 | setTimeout(() => { 9 | resolve({DashboardView_getInitialProps: true}); 10 | }, 10); 11 | }); 12 | } 13 | 14 | render() { 15 | return ( 16 |
    17 |         {renderProps("Route props", this.props)}
    18 |       
    19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/todo-apollo/src/TodoApp.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from "react"; 2 | import TodoLoadable from "./TodoLoadable"; 3 | 4 | export default class TodoApp extends Component { 5 | static createApolloClient(gmctx, options) { 6 | options.linkHttp.fetch = (url, options) => { 7 | options.headers["x-gourmet-test-name"] = "@gourmet/test-todo-apollo"; 8 | return fetch(url, options); 9 | }; 10 | } 11 | 12 | render() { 13 | return ( 14 |
    15 | 16 |
    17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/builder-src/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | outputDir: "../../.gourmet/builder-src", 6 | installSourceMapSupport: false, 7 | vendorSourceDirs: context => { 8 | return context.stage === "test" ? ["@gourmet/test-builder-src-module-a"] : ["gourmet-source"]; 9 | }, 10 | granularity: 0, 11 | runtime: { 12 | client: "IE 10", 13 | server: context => context.stage === "test" ? "node 4" : "node 8" 14 | } 15 | }, 16 | babel: { 17 | loose: false 18 | }, 19 | pages: { 20 | main: "./src/main.js" 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /utils/plugin-sort/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plugin-sort", 3 | "description": "A general purpose library for human friendly plugin ordering", 4 | "version": "0.8.3", 5 | "main": "gmsrc/index.js", 6 | "scripts": { 7 | "test": "tape test/*_test.js" 8 | }, 9 | "dependencies": { 10 | "@gourmet/is-plain-object": "^0.3.5", 11 | "@gourmet/merge": "^0.8.3", 12 | "@gourmet/omit": "^0.3.3" 13 | }, 14 | "devDependencies": { 15 | "tape": "^4.9.0" 16 | }, 17 | "license": "MIT", 18 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/plugin-sort" 19 | } 20 | -------------------------------------------------------------------------------- /utils/promise-deep-clone/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/promise-deep-clone", 3 | "version": "0.3.3", 4 | "description": "Recursively clones a JavaScript value while resolving promises", 5 | "main": "gmsrc/promiseDeepClone.js", 6 | "dependencies": { 7 | "@gourmet/is-plain-object": "^0.3.5", 8 | "@gourmet/promise-each": "^0.3.3", 9 | "@gourmet/promise-map": "^0.3.3", 10 | "@gourmet/promise-sync": "^0.3.3", 11 | "@gourmet/promise-wrap": "^0.3.3" 12 | }, 13 | "license": "MIT", 14 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/promise-deep-clone" 15 | } 16 | -------------------------------------------------------------------------------- /utils/serialize-request-error/gmsrc/serializeRequestError.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const serializeError = require("@gourmet/serialize-error"); 4 | 5 | module.exports = function serializeRequestError(req, err, options={}) { 6 | const obj = serializeError(err); 7 | const props = options.requestProps || ["url", "method", "headers"]; 8 | const copied = {}; 9 | 10 | for (let idx = 0; idx < props.length; idx++) { 11 | const name = props[idx]; 12 | const value = req[name]; 13 | if (value !== undefined) 14 | copied[name] = value; 15 | } 16 | 17 | obj.req = copied; 18 | 19 | return obj; 20 | }; 21 | -------------------------------------------------------------------------------- /tests/multi-views/src/IndexView.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderProps from "./renderProps"; 3 | 4 | export default class IndexView extends React.Component { 5 | static getInitialProps(gmctx) { 6 | gmctx.setHead(IndexView); 7 | return {IndexView_getInitialProps: true}; 8 | } 9 | 10 | static getStockProps() { 11 | return {MainPage_getStockProps: "overridden_by_view", IndexView_getStockProps: true}; 12 | } 13 | 14 | render() { 15 | return ( 16 |
    17 |         {renderProps("Route props", this.props)}
    18 |       
    19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /utils/relative-path/gmsrc/relativePath.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const npath = require("path"); 4 | 5 | module.exports = function relativePath(path, baseDir, {dot=true, cut=true}={}) { 6 | let check, idx; 7 | 8 | if (cut && (idx = path.indexOf("?")) !== -1) 9 | path = path.substr(0, idx); 10 | 11 | if (baseDir) 12 | path = npath.relative(baseDir, path); 13 | 14 | if (dot && !npath.isAbsolute(path)) 15 | check = true; 16 | 17 | path = path.replace(/\\/g, "/"); 18 | 19 | if (check && !path.startsWith("./") && !path.startsWith("../")) 20 | path = "./" + path; 21 | 22 | return path; 23 | }; 24 | -------------------------------------------------------------------------------- /utils/storage-fs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/storage-fs", 3 | "version": "0.4.3", 4 | "description": "File storage interface for 'fs' compatible filesystem", 5 | "main": "gmsrc/StorageFs.js", 6 | "scripts": { 7 | "test": "tape test/*_test.js" 8 | }, 9 | "dependencies": { 10 | "@gourmet/is-stream": "^0.3.3", 11 | "@gourmet/promise-queue": "^0.3.3", 12 | "mkdirp": "^0.5.1" 13 | }, 14 | "devDependencies": { 15 | "rimraf": "^2.6.2", 16 | "tape": "^4.9.0" 17 | }, 18 | "license": "MIT", 19 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/storage-fs" 20 | } 21 | -------------------------------------------------------------------------------- /cli/gourmet-cli-impl/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/gourmet-cli-impl", 3 | "version": "1.1.4", 4 | "description": "Gourmet command line interface implementation", 5 | "main": "lib/GourmetCli.js", 6 | "dependencies": { 7 | "@gourmet/cli-base": "^1.1.4", 8 | "@gourmet/error": "^0.3.4", 9 | "@gourmet/plain-merge": "^0.4.3", 10 | "@gourmet/promise-deep-prop": "^0.4.3", 11 | "@gourmet/promise-protect": "^0.3.3", 12 | "@gourmet/variables": "^0.5.3", 13 | "resolve": "^1.6.0" 14 | }, 15 | "license": "MIT", 16 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/cli/gourmet-cli-impl" 17 | } 18 | -------------------------------------------------------------------------------- /tests/cli-basic/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | // Three user plugins will be loaded: 5 | // 1. "@gourmet/test-cli-test-plugin" - auto loaded 6 | // 2. "@gourmet/test-cli-test-plugin" - manually by `plugins: [...]` 7 | // (located here because of `before: ".../my-plugin"` in `meta.schema`) 8 | // 3. "@gourmet/test-cli-basic/my-plugin" - manually by `plugins: [...]` 9 | plugins: [{ 10 | name: "@gourmet/test-cli-basic/my-plugin", 11 | plugin: require.resolve("./lib/MyPlugin") 12 | }, { 13 | name: "@gourmet/test-cli-test-plugin", 14 | options: {message: "Greetings!"} 15 | }] 16 | }; 17 | -------------------------------------------------------------------------------- /runtime/watch-middleware/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/watch-middleware", 3 | "version": "1.1.4", 4 | "main": "lib/GourmetWatchMiddleware.js", 5 | "dependencies": { 6 | "@gourmet/error-to-string": "^0.3.3", 7 | "@gourmet/escape-script": "^0.3.3", 8 | "@gourmet/gourmet-cli-impl": "^1.1.4", 9 | "@gourmet/merge": "^0.8.3", 10 | "@gourmet/omit": "^0.3.3", 11 | "@gourmet/promise-protect": "^0.3.3", 12 | "escape-html": "^1.0.3", 13 | "strip-ansi": "^5.0.0", 14 | "ws": "^6.0.0" 15 | }, 16 | "license": "MIT", 17 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/watch-middleware" 18 | } 19 | -------------------------------------------------------------------------------- /utils/promise-main/README.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-main 2 | 3 | Handles the top main promise of a console app. 4 | 5 | # Why? 6 | 7 | Because all errors should be propagated properly to the top main promise and 8 | there must be only one error handler in a console app. 9 | 10 | # Basic usage 11 | 12 | ```js 13 | const promiseMain = require("@gourmet/promise-main"); 14 | 15 | function main() { 16 | // ... main function of a console app that returns a promise ... 17 | } 18 | 19 | // Instead of this 20 | /* 21 | main().catch(err => { 22 | console.error(err); 23 | process.exit(1); 24 | }); 25 | */ 26 | 27 | // Do this 28 | promiseMain(main()); 29 | ``` 30 | -------------------------------------------------------------------------------- /tests/i80-basic/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/i80-basic", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainPage.jsx" 14 | }, 15 | 16 | config: { 17 | html: { 18 | headTop: [ 19 | '' 20 | ] 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /utils/error/gmsrc/error.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const template = require("lodash.template"); 4 | 5 | function error(def, ...args) { 6 | const props = Object.assign({}, def, ...args); 7 | const message = template(props.message || "Error")(props); 8 | let ErrorClass; 9 | 10 | if (props.ErrorClass) { 11 | ErrorClass = props.ErrorClass; 12 | delete props.ErrorClass; 13 | } else { 14 | ErrorClass = Error; 15 | } 16 | 17 | const err = new ErrorClass(message); 18 | 19 | for (const name in props) { 20 | if (name !== "message") 21 | err[name] = props[name]; 22 | } 23 | 24 | return err; 25 | } 26 | 27 | module.exports = error; 28 | -------------------------------------------------------------------------------- /utils/promise-main/README-SRC.md: -------------------------------------------------------------------------------- 1 | # @gourmet/promise-main 2 | 3 | Handles the top main promise of a console app. 4 | 5 | # Why? 6 | 7 | Because all errors should be propagated properly to the top main promise and 8 | there must be only one error handler in a console app. 9 | 10 | # Basic usage 11 | 12 | ```js 13 | const promiseMain = require("@gourmet/promise-main"); 14 | 15 | function main() { 16 | // ... main function of a console app that returns a promise ... 17 | } 18 | 19 | // Instead of this 20 | /* 21 | main().catch(err => { 22 | console.error(err); 23 | process.exit(1); 24 | }); 25 | */ 26 | 27 | // Do this 28 | promiseMain(main()); 29 | ``` 30 | -------------------------------------------------------------------------------- /contrib/react-apollo-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/react-apollo-renderer", 3 | "version": "1.1.0", 4 | "main": "gmsrc/getReactApolloClientRenderer.js", 5 | "dependencies": { 6 | "@gourmet/merge": "^0.8.3", 7 | "@gourmet/self-url": "^1.1.3", 8 | "apollo-cache-inmemory": "^1.5.1", 9 | "apollo-client": "^2.5.1", 10 | "apollo-link": "^1.2.9", 11 | "apollo-link-error": "^1.1.8", 12 | "apollo-link-http": "^1.5.12" 13 | }, 14 | "peerDependencies": { 15 | "react-apollo": "*" 16 | }, 17 | "license": "MIT", 18 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/react-apollo-renderer" 19 | } 20 | -------------------------------------------------------------------------------- /presets/react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/preset-react", 3 | "description": "Gourmet Preset containing a whole set of packages for React projects", 4 | "version": "1.5.0", 5 | "main": "lib/GourmetPresetReact.js", 6 | "keywords": [ 7 | "gourmet-plugin" 8 | ], 9 | "dependencies": { 10 | "@babel/core": "^7.4.0", 11 | "@gourmet/group-core": "^1.4.0", 12 | "@gourmet/group-react": "^1.3.0", 13 | "webpack": "^4.26.6" 14 | }, 15 | "peerDependencies": { 16 | "react": "16", 17 | "react-dom": "16" 18 | }, 19 | "license": "MIT", 20 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/presets/react" 21 | } 22 | -------------------------------------------------------------------------------- /tests/i80-loadable/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/i80-loadable", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainPage.jsx" 14 | }, 15 | 16 | config: { 17 | html: { 18 | headTop: [ 19 | '' 20 | ] 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /contrib/react-i80/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/react-i80", 3 | "version": "1.3.0", 4 | "browser": "gmsrc/index.client.js", 5 | "main": "gmsrc/index.server.js", 6 | "dependencies": { 7 | "@gourmet/parse-href": "^1.1.3", 8 | "@gourmet/unprefix-path": "^0.3.3", 9 | "classnames": "^2.2.6", 10 | "encodeurl": "^1.0.2", 11 | "escape-html": "^1.0.3", 12 | "path-to-regexp": "^2.4.0" 13 | }, 14 | "devDependencies": { 15 | "tape": "^4.9.0" 16 | }, 17 | "peerDependencies": { 18 | "react": "16" 19 | }, 20 | "license": "MIT", 21 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/react-i80" 22 | } 23 | -------------------------------------------------------------------------------- /examples/redux/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "gourmet build", 5 | "start": "node lib/server.js", 6 | "dev": "nodemon --ignore src lib/server.js -- --watch" 7 | }, 8 | "dependencies": { 9 | "@gourmet/client-lib": "^1.2.4", 10 | "@gourmet/server-args": "^1.2.4", 11 | "express": "^4.16.4" 12 | }, 13 | "devDependencies": { 14 | "@gourmet/gourmet-cli": "^1.1.4", 15 | "@gourmet/preset-react": "^1.5.0", 16 | "react": "^16.8.5", 17 | "react-dom": "^16.8.5", 18 | "prop-types": "^15.7.2", 19 | "redux": "^4.0.1", 20 | "react-redux": "^6.0.1", 21 | "nodemon": "^1.18.10" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/redux-init/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "gourmet build", 5 | "start": "node lib/server.js", 6 | "dev": "nodemon --ignore src lib/server.js -- --watch" 7 | }, 8 | "dependencies": { 9 | "@gourmet/client-lib": "^1.2.4", 10 | "@gourmet/server-args": "^1.2.4", 11 | "express": "^4.16.4" 12 | }, 13 | "devDependencies": { 14 | "@gourmet/gourmet-cli": "^1.1.4", 15 | "@gourmet/preset-react": "^1.5.0", 16 | "react": "^16.8.5", 17 | "react-dom": "^16.8.5", 18 | "prop-types": "^15.7.2", 19 | "redux": "^4.0.1", 20 | "react-redux": "^6.0.1", 21 | "nodemon": "^1.18.10" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/multi-pages/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/multi-pages", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainPage.js", 14 | dashboard: "./src/DashboardPage.js" 15 | }, 16 | 17 | config: { 18 | html: { 19 | headTop: [ 20 | "" 21 | ] 22 | }, 23 | "html:main": { 24 | headTop: [ 25 | "" 26 | ] 27 | } 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /utils/promise-each/gmsrc/promiseEach.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const promiseRepeat = require("@gourmet/promise-repeat"); 4 | const promiseSync = require("@gourmet/promise-sync"); 5 | 6 | function promiseEach(arr, handler) { 7 | let idx = 0; 8 | 9 | return promiseRepeat(() => { 10 | if (idx >= arr.length) 11 | return promiseRepeat.UNDEFINED; 12 | 13 | const pos = idx++; 14 | const value = handler(arr[pos], pos); 15 | 16 | return promiseSync(value, value => { 17 | if (value !== undefined) 18 | return value; 19 | }); 20 | }); 21 | } 22 | 23 | promiseEach.UNDEFINED = promiseRepeat.UNDEFINED; 24 | 25 | module.exports = promiseEach; 26 | -------------------------------------------------------------------------------- /contrib/react-i80/gmsrc/index.server.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const Router = require("./Router"); 4 | const ActiveRoute = require("./ActiveRoute"); 5 | const Link = require("./Link"); 6 | 7 | class ServerRouter extends Router { 8 | getTargetHref(gmctx) { 9 | return gmctx.reqArgs.url; 10 | } 11 | } 12 | 13 | // - basePath: Default is `"/"`. 14 | // - caseSensitive: Default is `true`. 15 | // - strictSlash: Default is `false`. 16 | function i80(routes, options) { 17 | return ServerRouter.create(routes, options); 18 | } 19 | 20 | i80.ActiveRoute = ActiveRoute; 21 | i80.Link = Link; 22 | i80.getUrl = (...args) => Router.get().getUrl(...args); 23 | 24 | module.exports = i80; 25 | -------------------------------------------------------------------------------- /utils/handle-request-error/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/handle-request-error", 3 | "version": "1.1.4", 4 | "main": "gmsrc/handleRequestError.js", 5 | "dependencies": { 6 | "@gourmet/console": "^1.1.4", 7 | "@gourmet/inspect-error": "^0.3.3", 8 | "@gourmet/merge": "^0.8.3", 9 | "@gourmet/resolve-template": "^0.3.3", 10 | "@gourmet/send-content": "^1.1.4", 11 | "@gourmet/serialize-request-error": "^0.3.3", 12 | "escape-html": "^1.0.3", 13 | "http-status": "^1.0.1", 14 | "strip-ansi": "^5.0.0" 15 | }, 16 | "license": "MIT", 17 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/utils/handle-request-error" 18 | } 19 | -------------------------------------------------------------------------------- /tests/news-view/gmsrc/NewsDataServer.js: -------------------------------------------------------------------------------- 1 | import NewsData from "./NewsData"; 2 | 3 | const CACHE_EXPIRE = 30 * 1000; 4 | 5 | let _cachedData; 6 | let _cachedTime; 7 | 8 | export default class NewsDataServer extends NewsData { 9 | prepare() { 10 | if (!_cachedData || _cachedTime + CACHE_EXPIRE < Date.now()) { 11 | return this.fetch().then(data => { 12 | _cachedData = data; 13 | _cachedTime = Date.now(); 14 | this.gmctx.data.newsData = _cachedData; 15 | return data; 16 | }); 17 | } 18 | this.gmctx.data.newsData = _cachedData; 19 | return Promise.resolve(); 20 | } 21 | 22 | getCached() { 23 | return _cachedData; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /contrib/plugin-react/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/plugin-react", 3 | "version": "0.6.3", 4 | "description": "Gourmet Webpack Builder plugin for adding `@babel/preset-react` to build JSX files", 5 | "keywords": [ 6 | "gourmet-plugin" 7 | ], 8 | "main": "lib/GourmetPluginReact.js", 9 | "dependencies": { 10 | "@babel/preset-react": "^7.0.0", 11 | "babel-plugin-transform-react-remove-prop-types": "^0.4.20" 12 | }, 13 | "peerDependencies": { 14 | "@gourmet/react-renderer": "*", 15 | "react": "16", 16 | "react-dom": "16" 17 | }, 18 | "license": "MIT", 19 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/contrib/plugin-react" 20 | } 21 | -------------------------------------------------------------------------------- /tests/builder-basic/src/admin.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const print = require("./print").default; 4 | const renderer = require("./renderer").default; 5 | 6 | if (SERVER) { 7 | module.exports = ({page, manifest}) => { 8 | const render = renderer({page, manifest}); 9 | return ({reqArgs, clientProps}) => { 10 | return render( 11 | "** SERVER **", 12 | `page: ${page}`, 13 | `stage: ${manifest.stage}`, 14 | `staticPrefix: ${manifest.client.staticPrefix}`, 15 | `reqArgs.url: ${reqArgs.url}`, 16 | `clientProps: ${JSON.stringify(clientProps)}` 17 | ); 18 | }; 19 | }; 20 | } else { 21 | print("ADMIN: This is admin page..."); 22 | } 23 | -------------------------------------------------------------------------------- /tests/cli-test-plugin/lib/GourmetPluginCliTest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class GourmetPluginCliTest { 4 | constructor({message}) { 5 | this.message = message; 6 | } 7 | 8 | _onSay({argv}) { 9 | const message = (argv.decorate || argv.e) ? `** ${this.message} **` : this.message; 10 | console.log(message); 11 | return false; // pass through 12 | } 13 | } 14 | 15 | GourmetPluginCliTest.meta = { 16 | hooks: { 17 | "command:say": GourmetPluginCliTest.prototype._onSay 18 | }, 19 | schema: { 20 | before: "@gourmet/test-cli-basic/my-plugin", 21 | options: { 22 | message: "Hello, world!" 23 | } 24 | } 25 | }; 26 | 27 | module.exports = GourmetPluginCliTest; 28 | -------------------------------------------------------------------------------- /utils/unprefix-path/gmsrc/unprefixPath.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // unprefixPath("/abc/def", "/abc") ==> "/def" 4 | // unprefixPath("/abc/def", "/abc/") ==> "/def" 5 | // unprefixPath("/abc", "/abc") ==> "/" 6 | // unprefixPath("/abc", "/def") ==> null 7 | module.exports = function unprefixPath(path, prefix) { 8 | const len = prefix.length; 9 | 10 | if (len && prefix !== "/") { 11 | if (path.indexOf(prefix) !== 0) 12 | return null; 13 | if (len >= path.length) 14 | return "/"; 15 | if (path[len] === "/") 16 | return path.substr(len); 17 | if (path[len - 1] === "/") 18 | return path.substr(len - 1); 19 | return null; 20 | } 21 | 22 | return path; 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /examples/redux-i80/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "build": "gourmet build", 5 | "start": "node lib/server.js", 6 | "dev": "nodemon --ignore src lib/server.js -- --watch" 7 | }, 8 | "dependencies": { 9 | "@gourmet/client-lib": "^1.2.4", 10 | "@gourmet/server-args": "^1.2.4", 11 | "express": "^4.16.4" 12 | }, 13 | "devDependencies": { 14 | "@gourmet/gourmet-cli": "^1.1.4", 15 | "@gourmet/preset-react": "^1.5.0", 16 | "@gourmet/group-react-i80": "^1.3.0", 17 | "react": "^16.8.5", 18 | "react-dom": "^16.8.5", 19 | "prop-types": "^15.7.2", 20 | "redux": "^4.0.1", 21 | "react-redux": "^6.0.1", 22 | "nodemon": "^1.18.10" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/redux/src/containers/AddTodo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {connect} from "react-redux"; 3 | import {addTodo} from "../actions"; 4 | 5 | const AddTodo = ({dispatch}) => { 6 | let input; 7 | 8 | return ( 9 |
    10 |
    { 11 | e.preventDefault() 12 | if (!input.value.trim()) { 13 | return; 14 | } 15 | dispatch(addTodo(input.value)); 16 | input.value = ""; 17 | }}> 18 | input = node}/> 19 | 22 |
    23 |
    24 | ); 25 | }; 26 | 27 | export default connect()(AddTodo); 28 | -------------------------------------------------------------------------------- /runtime/html-renderer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/html-renderer", 3 | "version": "1.2.0", 4 | "main": "gmsrc/getHtmlClientRenderer.js", 5 | "scripts": { 6 | "test": "tape test/*_test.js" 7 | }, 8 | "dependencies": { 9 | "@gourmet/escape-script": "^0.3.3", 10 | "@gourmet/is-stream": "^0.3.3", 11 | "@gourmet/merge": "^0.8.3", 12 | "@gourmet/multi-stream": "^0.3.3", 13 | "@gourmet/promise-protect": "^0.3.3", 14 | "@gourmet/resolve-template": "^0.3.3", 15 | "domready": "^1.0.8" 16 | }, 17 | "devDependencies": { 18 | "tape": "^4.9.0" 19 | }, 20 | "license": "MIT", 21 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/runtime/html-renderer" 22 | } 23 | -------------------------------------------------------------------------------- /examples/redux-i80/src/containers/AddTodo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {connect} from "react-redux"; 3 | import {addTodo} from "../actions"; 4 | 5 | const AddTodo = ({dispatch}) => { 6 | let input; 7 | 8 | return ( 9 |
    10 |
    { 11 | e.preventDefault() 12 | if (!input.value.trim()) { 13 | return; 14 | } 15 | dispatch(addTodo(input.value)); 16 | input.value = ""; 17 | }}> 18 | input = node}/> 19 | 22 |
    23 |
    24 | ); 25 | }; 26 | 27 | export default connect()(AddTodo); 28 | -------------------------------------------------------------------------------- /examples/redux-init/src/containers/AddTodo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {connect} from "react-redux"; 3 | import {addTodo} from "../actions"; 4 | 5 | const AddTodo = ({dispatch}) => { 6 | let input; 7 | 8 | return ( 9 |
    10 |
    { 11 | e.preventDefault() 12 | if (!input.value.trim()) { 13 | return; 14 | } 15 | dispatch(addTodo(input.value)); 16 | input.value = ""; 17 | }}> 18 | input = node}/> 19 | 22 |
    23 |
    24 | ); 25 | }; 26 | 27 | export default connect()(AddTodo); 28 | -------------------------------------------------------------------------------- /examples/redux/src/components/TodoList.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import Todo from "./Todo"; 4 | 5 | const TodoList = ({todos, toggleTodo}) => ( 6 |
      7 | {todos.map(todo => 8 | toggleTodo(todo.id)} 12 | /> 13 | )} 14 |
    15 | ); 16 | 17 | TodoList.propTypes = { 18 | todos: PropTypes.arrayOf(PropTypes.shape({ 19 | id: PropTypes.number.isRequired, 20 | completed: PropTypes.bool.isRequired, 21 | text: PropTypes.string.isRequired 22 | }).isRequired).isRequired, 23 | toggleTodo: PropTypes.func.isRequired 24 | }; 25 | 26 | export default TodoList; 27 | -------------------------------------------------------------------------------- /tests/i80-misc/src/DateView.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {Link} from "@gourmet/react-i80"; 3 | 4 | export default function DateView(props) { 5 | const {params, search} = props; 6 | return ( 7 | <> 8 |
    9 | Year: {params[1]} 10 |
    11 |
    12 | Month: {params[2]} 13 |
    14 |
    15 | Day: {params[3]} 16 |
    17 |
    18 | 19 | Back to main 20 | 21 |
    22 |
    23 | 24 | Logout 25 | 26 |
    27 | 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /tests/todo-redux/src/components/TodoList.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import Todo from "./Todo"; 4 | 5 | const TodoList = ({todos, toggleTodo}) => ( 6 |
      7 | {todos.map(todo => 8 | toggleTodo(todo.id)} 12 | /> 13 | )} 14 |
    15 | ); 16 | 17 | TodoList.propTypes = { 18 | todos: PropTypes.arrayOf(PropTypes.shape({ 19 | id: PropTypes.number.isRequired, 20 | completed: PropTypes.bool.isRequired, 21 | text: PropTypes.string.isRequired 22 | }).isRequired).isRequired, 23 | toggleTodo: PropTypes.func.isRequired 24 | }; 25 | 26 | export default TodoList; 27 | -------------------------------------------------------------------------------- /tests/todo-redux/src/containers/AddTodo.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import {connect} from "react-redux"; 3 | import {addTodo} from "../actions"; 4 | 5 | const AddTodo = ({dispatch}) => { 6 | let input; 7 | 8 | return ( 9 |
    10 |
    { 11 | e.preventDefault() 12 | if (!input.value.trim()) { 13 | return; 14 | } 15 | dispatch(addTodo(input.value)); 16 | input.value = ""; 17 | }}> 18 | input = node}/> 19 | 22 |
    23 |
    24 | ); 25 | }; 26 | 27 | export default connect()(AddTodo); 28 | -------------------------------------------------------------------------------- /examples/redux-i80/src/components/TodoList.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import Todo from "./Todo"; 4 | 5 | const TodoList = ({todos, toggleTodo}) => ( 6 |
      7 | {todos.map(todo => 8 | toggleTodo(todo.id)} 12 | /> 13 | )} 14 |
    15 | ); 16 | 17 | TodoList.propTypes = { 18 | todos: PropTypes.arrayOf(PropTypes.shape({ 19 | id: PropTypes.number.isRequired, 20 | completed: PropTypes.bool.isRequired, 21 | text: PropTypes.string.isRequired 22 | }).isRequired).isRequired, 23 | toggleTodo: PropTypes.func.isRequired 24 | }; 25 | 26 | export default TodoList; 27 | -------------------------------------------------------------------------------- /examples/redux-init/src/components/TodoList.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import Todo from "./Todo"; 4 | 5 | const TodoList = ({todos, toggleTodo}) => ( 6 |
      7 | {todos.map(todo => 8 | toggleTodo(todo.id)} 12 | /> 13 | )} 14 |
    15 | ); 16 | 17 | TodoList.propTypes = { 18 | todos: PropTypes.arrayOf(PropTypes.shape({ 19 | id: PropTypes.number.isRequired, 20 | completed: PropTypes.bool.isRequired, 21 | text: PropTypes.string.isRequired 22 | }).isRequired).isRequired, 23 | toggleTodo: PropTypes.func.isRequired 24 | }; 25 | 26 | export default TodoList; 27 | -------------------------------------------------------------------------------- /groups/react-apollo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gourmet/group-react-apollo", 3 | "description": "A group of sub-packages enabling the GraphQL support using Apollo in Gourmet SSR projects", 4 | "version": "1.1.0", 5 | "main": "lib/GourmetGroupReactApollo.js", 6 | "keywords": [ 7 | "gourmet-plugin" 8 | ], 9 | "dependencies": { 10 | "@gourmet/plugin-react-apollo": "^1.0.4", 11 | "@gourmet/react-apollo-renderer": "^1.1.0", 12 | "graphql-tag": "^2.10.1", 13 | "react-apollo": "^2.5.2" 14 | }, 15 | "peerDependencies": { 16 | "react": "16", 17 | "react-dom": "16" 18 | }, 19 | "license": "MIT", 20 | "repository": "https://github.com/gourmetjs/gourmet-ssr/tree/master/groups/react-apollo" 21 | } 22 | -------------------------------------------------------------------------------- /tests/i80-loadable-nested/gourmet_config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | builder: { 5 | stageTypes: { 6 | "production": ["prod", "ltc"] 7 | }, 8 | outputDir: "../../.gourmet/i80-loadable-nested", 9 | contentHash: context => context.stage === "ltc" 10 | }, 11 | 12 | pages: { 13 | main: "./src/MainPage.jsx", 14 | admin: ["./src/initAdmin.js", "./src/AdminPage.jsx"] 15 | }, 16 | 17 | config: { 18 | html: { 19 | headTop: [ 20 | '' 21 | ] 22 | } 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /tests/todo-apollo/gourmet_config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | main: "./src/TodoApp.js" 4 | }, 5 | 6 | builder: { 7 | stageTypes: { 8 | "production": ["prod", "ltc"] 9 | }, 10 | outputDir: "../../.gourmet/todo-apollo", 11 | contentHash: context => context.stage === "ltc" 12 | }, 13 | 14 | apollo: { 15 | linkHttp: { 16 | uri: "/custom-graphql" 17 | } 18 | }, 19 | 20 | config: { 21 | html: { 22 | headTop: [ 23 | '' 24 | ] 25 | } 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /website/static/css/code-block-buttons.css: -------------------------------------------------------------------------------- 1 | /* "Copy" code block button */ 2 | pre { 3 | position: relative; 4 | } 5 | 6 | pre .btnIcon { 7 | position: absolute; 8 | top: 4px; 9 | z-index: 2; 10 | cursor: pointer; 11 | border: 1px solid transparent; 12 | padding: 0; 13 | color: #fff; 14 | background-color: transparent; 15 | height: 30px; 16 | transition: all .25s ease-out; 17 | } 18 | 19 | pre .btnIcon:hover { 20 | text-decoration: none; 21 | } 22 | 23 | .btnIcon__body { 24 | align-items: center; 25 | display: flex; 26 | } 27 | 28 | .btnIcon svg { 29 | fill: currentColor; 30 | margin-right: .4em; 31 | } 32 | 33 | .btnIcon__label { 34 | font-size: 11px; 35 | } 36 | 37 | .btnClipboard { 38 | right: 10px; 39 | } --------------------------------------------------------------------------------