{"id":18303577,"url":"https://github.com/kingvid-chan/vm-loader","last_synced_at":"2026-04-30T10:05:07.672Z","repository":{"id":57393511,"uuid":"78131887","full_name":"kingvid-chan/vm-loader","owner":"kingvid-chan","description":"Exports .vm file as HTML String, also supports Separation between Data and Code.","archived":false,"fork":false,"pushed_at":"2017-03-23T14:38:30.000Z","size":336,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-17T05:45:18.553Z","etag":null,"topics":["loader","velocity","vm-migration","webpack"],"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/kingvid-chan.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":"2017-01-05T17:02:01.000Z","updated_at":"2018-02-26T11:34:29.000Z","dependencies_parsed_at":"2022-09-26T16:51:07.292Z","dependency_job_id":null,"html_url":"https://github.com/kingvid-chan/vm-loader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kingvid-chan/vm-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingvid-chan%2Fvm-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingvid-chan%2Fvm-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingvid-chan%2Fvm-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingvid-chan%2Fvm-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingvid-chan","download_url":"https://codeload.github.com/kingvid-chan/vm-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingvid-chan%2Fvm-loader/sbom","scorecard":{"id":560882,"data":{"date":"2025-08-11","repo":{"name":"github.com/kingvid-chan/vm-loader","commit":"ea40302c45e2a036410158ed64b9a177524920ec"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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"}}]},"last_synced_at":"2025-08-20T13:38:19.625Z","repository_id":57393511,"created_at":"2025-08-20T13:38:19.625Z","updated_at":"2025-08-20T13:38:19.625Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["loader","velocity","vm-migration","webpack"],"created_at":"2024-11-05T15:26:07.036Z","updated_at":"2026-04-30T10:05:07.652Z","avatar_url":"https://github.com/kingvid-chan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"200\" height=\"200\"\n    src=\"https://worldvectorlogo.com/logos/html5.svg\"\u003e\n  \u003ca href=\"https://github.com/webpack/webpack\"\u003e\n    \u003cimg width=\"200\" height=\"200\" vspace=\"\" hspace=\"25\"\n      src=\"https://worldvectorlogo.com/logos/webpack.svg\"\u003e\n  \u003c/a\u003e\n  \u003ch1\u003eVM Loader\u003c/h1\u003e\n  \u003cp\u003eExports .vm file as HTML String, also supports Separation between Data and Code.\u003cp\u003e\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003e安装\u003c/h2\u003e\n\n```bash\nnpm i -D vm-loader\n```\n\n\u003ch2 align=\"center\"\u003e用法\u003c/h2\u003e\n\nvm-loader能够解析velocity语法，转换成HTML并输出字符串给下一个loader。  \n支持本地模拟后台数据开发，数据文件会默认加入webpack dependency依赖树，当数据文件发生变动时，webpack-dev-server能监听到文件变动并自动刷新。  \n基于模块化规范，模块与数据是一对一的关系，即一个模块对应一份数据文件，数据文件划分为常规数据类型（number、string、array、object等）和函数数据类型两种，划分依据是函数数据一般是稳定不变的，而常规数据类型由于测试需要经常得做随机生成文本数字等操作（本地mock数据推荐使用[mockjs](http://mockjs.com/)），划分为两部分可以加快webpack编译速度，另一个考虑是数据文件以.json为格式存储的，而json是不能容下函数的，所以必须以.js文件格式来存放函数数据类型。 \n\n可配置options详情如下：\n```\ndataPath：模块的数据文件路径，可以是相对路径也可以是绝对路径，文件存放格式必须是json\nfunPath：模块的函数文件路径，可以是相对路径也可以是绝对路径，文件存放格式必须是js\n```\ne.g.\n```js\n{\n  test: /\\.vm$/,\n  use: [\n\t{\n\t  loader: \"html-loader\"\n\t},\n\t{\n\t  loader: 'vm-loader',\n\t  options: {\n\t    dataPath: './src/module1-data.json',\n\t    funPath: './src/common.js' // 函数数据文件最好整理到一份公共的js文件中\n\t  }\n\t}\n  ]\n}\n```\n通过动态配置webpack将json数据文件hook到相应的模块中去\n```js\n// 默认所有的模块都在同一个目录下\n// 默认json数据文件的命名和模块文件夹一致\n// 假设所有模块数据都放在./src/mock/直接目录下\n// eg：模块名称数组是：var modulesArr = ['header', 'body', 'footer'];\nconst webpack = require('webpack');\nconst webpack_config = require('./webpack.config');\nconst webpackDevServer = require('webpack-dev-server');\nmodulesArr.forEach((module) =\u003e {\n  webpack_config.module.rules.unshift({\n    test: eval(\"/\\.vm$/i\"),\n    include: eval(module),\n    use: [\n      {\n        loader: \"html-loader\"\n      },\n      {\n        loader: 'vm-loader',\n        options: {\n          dataPath: './src/mock/'+module+'.json',\n          funPath: './src/common.js' // 函数数据文件最好整理到一份公共的js文件中\n        }\n      }\n    ]\n  });\n});\n//webpack dev server\nconst compiler = webpack(webpack_config);\nnew webpackDevServer(compiler, {\n  stats: {\n    colors: true,\n    chunks: false\n  },\n  noInfo: false,\n  proxy: {\n    '*': {\n      target: 'http://localhost:3000',\n    }\n  }\n}).listen(8080, function(){console.log('App (dev) is now running on port 8080!');});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingvid-chan%2Fvm-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingvid-chan%2Fvm-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingvid-chan%2Fvm-loader/lists"}