{"id":13798944,"url":"https://github.com/koa-modules/swig","last_synced_at":"2026-04-04T12:58:57.292Z","repository":{"id":15025814,"uuid":"17751571","full_name":"koa-modules/swig","owner":"koa-modules","description":"Koa view render based on Swig, support tags, filters, and extensions","archived":false,"fork":false,"pushed_at":"2017-04-17T12:34:08.000Z","size":60,"stargazers_count":30,"open_issues_count":3,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-04T12:58:46.429Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koa-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-14T15:57:59.000Z","updated_at":"2022-08-15T17:41:41.000Z","dependencies_parsed_at":"2022-09-19T07:51:35.512Z","dependency_job_id":null,"html_url":"https://github.com/koa-modules/swig","commit_stats":null,"previous_names":["koa-modules/koa-swig"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/koa-modules/swig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koa-modules%2Fswig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koa-modules%2Fswig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koa-modules%2Fswig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koa-modules%2Fswig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koa-modules","download_url":"https://codeload.github.com/koa-modules/swig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koa-modules%2Fswig/sbom","scorecard":{"id":565075,"data":{"date":"2025-08-11","repo":{"name":"github.com/koa-modules/swig","commit":"bcc02c5ef84210d8fc5fbc8ae809579fcecca4cb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":1,"reason":"Found 5/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T14:45:32.037Z","repository_id":15025814,"created_at":"2025-08-20T14:45:32.038Z","updated_at":"2025-08-20T14:45:32.038Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31400460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-08-04T00:00:56.980Z","updated_at":"2026-04-04T12:58:57.269Z","avatar_url":"https://github.com/koa-modules.png","language":"JavaScript","readme":"# koa-swig\n\n[![NPM version][npm-img]][npm-url]\n[![Build status][travis-img]][travis-url]\n[![Test coverage][coveralls-img]][coveralls-url]\n[![License][license-img]][license-url]\n[![Dependency status][david-img]][david-url]\n\n[Koa][] view render based on [Swig][], support tags, filters, and extensions.\n\n[![NPM](https://nodei.co/npm/koa-swig.png?downloads=true)](https://nodei.co/npm/koa-swig/)\n\n### Usage\n\n* **v2.x**\n\n    ```js\n    app.context.render = render(settings);\n    ```\n\n* **v1.x**\n\n    ```js\n    render(app, settings);\n    ```\n\n#### Install\n\n```\nnpm install koa-swig\n```\n\n#### Features\n\n* First, automatically merge `ctx.state` from koa 0.14.\n* Second, automatically merge `ctx.flash`.\n* Finally, merge custom locals.\n\n#### Example\n\n```js\nvar koa = require('koa');\nvar render = require('koa-swig');\nvar app = koa();\n\napp.context.render = render({\n  root: path.join(__dirname, 'views'),\n  autoescape: true,\n  cache: 'memory', // disable, set to false\n  ext: 'html',\n  locals: locals,\n  filters: filters,\n  tags: tags,\n  extensions: extensions\n});\n\napp.use(function *() {\n  yield this.render('index');\n});\n\napp.listen(2333);\n```\n\n```js\n// koa v2.x\nvar co = require('co');\n\napp.context.render = co.wrap(render({\n  // ...your setting\n  writeBody: false\n}));\n\napp.use(async ctx =\u003e ctx.body = await ctx.render('index'));\n```\n\n#### Settings\n\n* [swig options](http://paularmstrong.github.io/swig/docs/api/#SwigOpts)\n  - autoescape\n  - cache\n  - locals\n  - varControls\n  - tagControls\n  - cmtControls\n\n* filters: swig custom [filters](http://paularmstrong.github.io/swig/docs/extending/#filters)\n\n* tags: swig custom [tags](http://paularmstrong.github.io/swig/docs/extending/#tags)\n\n* extensions: add extensions for custom tags\n\n* ext: default view extname\n\n* root: view root directory\n\n* writeBody: default(true) auto write body and response\n\n#### Methods\n\n* render.swig.setLocals\n\n* render.swig.getLocals\n\n\n#### Others\n\n* [swig-extras](https://github.com/paularmstrong/swig-extras) A collection of handy tags, filters, and extensions for Swig.\n\n### Licences\n\nMIT\n\n[koa]: http://koajs.com\n[swig]: http://paularmstrong.github.io/swig/\n\n[npm-img]: https://img.shields.io/npm/v/koa-swig.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/koa-swig\n[travis-img]: https://img.shields.io/travis/koa-modules/swig.svg?style=flat-square\n[travis-url]: https://travis-ci.org/koa-modules/swig\n[coveralls-img]: https://img.shields.io/coveralls/koa-modules/swig.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/koa-modules/swig?branch=master\n[license-img]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square\n[license-url]: LICENSE\n[david-img]: https://img.shields.io/david/koa-modules/swig.svg?style=flat-square\n[david-url]: https://david-dm.org/koa-modules/swig\n","funding_links":[],"categories":["仓库"],"sub_categories":["中间件"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoa-modules%2Fswig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoa-modules%2Fswig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoa-modules%2Fswig/lists"}