{"id":27120889,"url":"https://github.com/yst138451/async-string-replacer","last_synced_at":"2026-05-04T21:31:50.275Z","repository":{"id":124552506,"uuid":"176986598","full_name":"yst138451/async-string-replacer","owner":"yst138451","description":"Regex string-replacer for Webpack loader","archived":false,"fork":false,"pushed_at":"2020-01-29T19:12:48.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-03T01:34:51.465Z","etag":null,"topics":["javascript","regex-replace","regexp","replace-text","vuejs","webpack","webpack-loader"],"latest_commit_sha":null,"homepage":null,"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/yst138451.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-21T16:43:34.000Z","updated_at":"2020-01-29T19:12:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"544e8586-0b7c-4aed-b65f-a9ecd0136d3d","html_url":"https://github.com/yst138451/async-string-replacer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yst138451/async-string-replacer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yst138451%2Fasync-string-replacer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yst138451%2Fasync-string-replacer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yst138451%2Fasync-string-replacer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yst138451%2Fasync-string-replacer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yst138451","download_url":"https://codeload.github.com/yst138451/async-string-replacer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yst138451%2Fasync-string-replacer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32625935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"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":["javascript","regex-replace","regexp","replace-text","vuejs","webpack","webpack-loader"],"created_at":"2025-04-07T10:40:07.974Z","updated_at":"2026-05-04T21:31:50.259Z","avatar_url":"https://github.com/yst138451.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RegExp string-replacer for Webpack\n\nQuoting the doc on [Asynchronous Loaders](https://webpack.js.org/api/loaders/#asynchronous-loaders):\n\u003e Loaders were originally designed to work in synchronous loader pipelines, like Node.js (using [`enhanced-require`](https://github.com/webpack/enhanced-require)), and asynchronous pipelines, like in Webpack. However, since expensive synchronous computations are a bad idea in a single-threaded environment like Node.js, we advise making your loader asynchronous if possible. Synchronous loaders are ok if the amount of computation is trivial.\n\n## Install\n```bash\n$ npm i -D yst138451/async-string-replacer\n```\n\n## Usage\nIn `webpack.config.js` add it up right before the last loader in the chain (e.g. `babel-loader`):\n\n```js\nmodule: {\n  rules: [\n    {\n      test: /\\.js$/,\n      exclude: /(node_modules|bower_components)/,\n      use: [\n        'babel-loader',\n        {\n          loader: 'async-string-replacer',\n          options: {\n            configFile: path.resolve(__dirname, './src/your.config.js')\n          }\n        }\n      ]\n    },\n    //...\n  ]\n}\n```\n\nWhere `your.config.js` is your dedicated config file containing all the RegExp rules for the string replacements. For example the following pattern allows you to [`md5`][npm-md5] hash all [Vue.js Custom Event][vue_ce] names (for whatever reason that is):\n\n```js\nmodule.exports = [\n  {\n    pattern: /(?\u003c=\\$(emit|on|once|off)\\(')\\S+(?=')/ig,\n    replacement: require('md5')\n  },\n  \n  // More rules here\n]\n```\n\n| Raw | Hashed |\n|-----|--------|\n| `vm.$emit('routes:changed');` | `vm.$emit('fe288a6cad4b10b92fdff65256df6713');` |\n\nOnce configured and run, all files ending in `.js` (including `.vue` files, since they ultimately compile down to `.js`) will be processed by the loader, seaching up for these custom event names to hash.  \n\n⚠ This is not meant for JS obfuscation of some sort, in which case you should instead use [Javascript obfuscator][npm-js-obfuscator] or [UglifyJS Webpack Plugin][npm-uglifyjs].\n\n## License\n[MIT](http://en.wikipedia.org/wiki/MIT_License)\n\n[vue_ce]: https://vuejs.org/v2/guide/components-custom-events\n[npm-uglifyjs]: https://www.npmjs.com/package/uglifyjs-webpack-plugin\n[npm-js-obfuscator]: https://www.npmjs.com/package/javascript-obfuscator\n[npm-md5]: https://www.npmjs.com/package/md5 \"Message Digest 5 (one-way hash)\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyst138451%2Fasync-string-replacer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyst138451%2Fasync-string-replacer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyst138451%2Fasync-string-replacer/lists"}