{"id":15286180,"url":"https://github.com/bleargh45/javascript-minifier-xs","last_synced_at":"2026-02-23T00:32:43.868Z","repository":{"id":26451752,"uuid":"29902876","full_name":"bleargh45/JavaScript-Minifier-XS","owner":"bleargh45","description":"XS based JavaScript minifier","archived":false,"fork":false,"pushed_at":"2025-02-04T00:39:41.000Z","size":157,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T03:07:50.666Z","etag":null,"topics":["javascript-minifier","minification","minifier","minify-javascript","perl","xs"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/JavaScript-Minifier-XS/","language":"XS","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/bleargh45.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"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":"2015-01-27T07:35:01.000Z","updated_at":"2025-02-04T00:39:45.000Z","dependencies_parsed_at":"2024-06-18T19:48:59.177Z","dependency_job_id":"bad800d4-56e5-4159-a7e2-3ddf3a5ccb03","html_url":"https://github.com/bleargh45/JavaScript-Minifier-XS","commit_stats":{"total_commits":145,"total_committers":2,"mean_commits":72.5,"dds":"0.020689655172413834","last_synced_commit":"f66a87d9dd6e17491c30eb33e6f06574b510535a"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FJavaScript-Minifier-XS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FJavaScript-Minifier-XS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FJavaScript-Minifier-XS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleargh45%2FJavaScript-Minifier-XS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bleargh45","download_url":"https://codeload.github.com/bleargh45/JavaScript-Minifier-XS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657918,"owners_count":21140846,"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":["javascript-minifier","minification","minifier","minify-javascript","perl","xs"],"created_at":"2024-09-30T15:10:53.959Z","updated_at":"2026-02-23T00:32:43.809Z","avatar_url":"https://github.com/bleargh45.png","language":"XS","readme":"# NAME\n\nJavaScript::Minifier::XS - XS based JavaScript minifier\n\n# SYNOPSIS\n\n```perl\nuse JavaScript::Minifier::XS qw(minify);\nmy $js       = '...';\nmy $minified = minify($js);\n```\n\n# DESCRIPTION\n\n`JavaScript::Minifier::XS` is a JavaScript \"minifier\"; its designed to remove\nunnecessary whitespace and comments from JavaScript files, which also **not**\nbreaking the JavaScript.\n\n`JavaScript::Minifier::XS` is similar in function to `JavaScript::Minifier`,\nbut is substantially faster as its written in XS and not just pure Perl.\n\n# METHODS\n\n- minify($js)\n\n    Minifies the given `$js`, returning the minified JavaScript back to the\n    caller.\n\n# HOW IT WORKS\n\n`JavaScript::Minifier::XS` minifies the JavaScript by removing unnecessary\nwhitespace from JavaScript documents.  Comments (both block and line) are also\nremoved, _except_ when (a) they contain the word \"copyright\" in them, or (b)\nthey're needed to implement \"IE Conditional Compilation\".\n\nInternally, the minification process is done by taking multiple passes through\nthe JavaScript document:\n\n## Pass 1: Tokenize\n\nFirst, we go through and parse the JavaScript document into a series of tokens\ninternally.  The tokenizing process **does not** check to make sure you've got\nsyntactically valid JavaScript, it just breaks up the text into a stream of\ntokens suitable for processing by the subsequent stages.\n\n## Pass 2: Collapse\n\nWe then march through the token list and collapse certain tokens down to their\nsmallest possible representation.  _If_ they're still included in the final\nresults we only want to include them at their shortest.\n\n- Whitespace\n\n    Runs of multiple whitespace characters are reduced down to a single whitespace\n    character.  If the whitespace contains any \"end of line\" (EOL) characters, then\n    the end result is the _first_ EOL character encountered.  Otherwise, the\n    result is the first whitespace character in the run.\n\n## Pass 3: Pruning\n\nWe then go back through the token list and prune and remove unnecessary\ntokens.\n\n- Whitespace\n\n    Wherever possible, whitespace is removed; before+after comment blocks, and\n    before+after various symbols/sigils.\n\n- Comments\n\n    Comments that are either (a) IE conditional compilation comments, or that (b)\n    contain the word \"copyright\" in them are preserved.  **All** other comments\n    (line and block) are removed.\n\n- Everything else\n\n    We keep everything else; identifiers, quoted literal strings, symbols/sigils,\n    etc.\n\n## Pass 4: Re-assembly\n\nLastly, we go back through the token list and re-assemble it all back into a\nsingle JavaScript string, which is then returned back to the caller.\n\n# AUTHOR\n\nGraham TerMarsch (cpan@howlingfrog.com)\n\n# COPYRIGHT\n\nCopyright (C) 2007-, Graham TerMarsch.  All Rights Reserved.\n\nThis is free software; you can redistribute it and/or modify it under the same\nlicense as Perl itself.\n\n# SEE ALSO\n\n`JavaScript::Minifier`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleargh45%2Fjavascript-minifier-xs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbleargh45%2Fjavascript-minifier-xs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleargh45%2Fjavascript-minifier-xs/lists"}