{"id":19768336,"url":"https://github.com/roxiness/tossr","last_synced_at":"2025-04-30T16:34:11.560Z","repository":{"id":54164268,"uuid":"236830441","full_name":"roxiness/tossr","owner":"roxiness","description":"Universal SSR renderer powered by JSDOM","archived":false,"fork":false,"pushed_at":"2021-12-20T15:48:06.000Z","size":203,"stargazers_count":41,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-22T05:19:18.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roxiness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-28T20:08:35.000Z","updated_at":"2023-11-15T05:45:41.000Z","dependencies_parsed_at":"2022-08-13T08:01:10.047Z","dependency_job_id":null,"html_url":"https://github.com/roxiness/tossr","commit_stats":null,"previous_names":["sveltech/ssr"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Ftossr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Ftossr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Ftossr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roxiness%2Ftossr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roxiness","download_url":"https://codeload.github.com/roxiness/tossr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251742828,"owners_count":21636517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T04:37:23.701Z","updated_at":"2025-04-30T16:34:11.096Z","avatar_url":"https://github.com/roxiness.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"tossr_logo.svg\" alt=\"tossr\" width=\"300\" /\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### Universal SPA to SSR\n\nRender HTML from any SPA.\n\n### Install\n\n`npm i tossr`\n\n### Usage example\n\n```javascript\nconst { tossr } = require('tossr')\n\nconst template = 'dist/index.html'\nconst script = 'dist/app.js'\nconst url = '/blog/ssr-is-fun'\n\nconst html = await tossr(template, script, url)\n```\n\n### Related libraries\n\n-   [Spassr](https://github.com/roxiness/spassr) Small Express server with built in SSR\n-   [Spank](https://github.com/roxiness/spank) Generate a static site from any SPA\n\n* * *\n\n### API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n##### Table of Contents\n\n-   [tossr](#tossr)\n    -   [Parameters](#parameters)\n-   [Config](#config)\n    -   [Properties](#properties)\n-   [Eval](#eval)\n    -   [Parameters](#parameters-1)\n\n#### tossr\n\nRenders an HTML page from a HTML template, an app bundle and a path\n\n##### Parameters\n\n-   `template` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Html template (or path to a HTML template).\n-   `script` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Bundled JS app (or path to bundled bundle JS app).\n-   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Path to render. Ie. /blog/breathing-oxygen-linked-to-staying-alive\n-   `options` **Partial\u0026lt;[Config](#config)\u003e?** Options\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\u0026lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e** \n\n#### Config\n\nType: [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n##### Properties\n\n-   `host` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** hostname to use while rendering. Defaults to \u003chttp://jsdom.ssr\u003e\n-   `eventName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** event to wait for before rendering app. Defaults to 'app-loaded'\n-   `beforeEval` **[Eval](#eval)** Executed before script is evaluated.\n-   `afterEval` **[Eval](#eval)** Executed after script is evaluated.\n-   `silent` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Don't print timestamps\n-   `inlineDynamicImports` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** required for apps with dynamic imports\n-   `timeout` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** required for apps with dynamic imports\n-   `dev` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** disables caching of inlinedDynamicImports bundle\n-   `errorHandler` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** \n\n#### Eval\n\nCalled before/after the app script is evaluated\n\nType: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)\n\n##### Parameters\n\n-   `dom` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The DOM object\n    \\*\n\n\n---\n\n\u003ca href=\"https://www.freepik.com/vectors/party\"\u003eParty vector created by gstudioimagen - www.freepik.com\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxiness%2Ftossr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froxiness%2Ftossr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froxiness%2Ftossr/lists"}