{"id":15395742,"url":"https://github.com/salvatorepreviti/spglsl","last_synced_at":"2025-08-21T05:32:22.864Z","repository":{"id":47793181,"uuid":"289772614","full_name":"SalvatorePreviti/spglsl","owner":"SalvatorePreviti","description":"A webgl GLSL minifier based on Angle compiler","archived":false,"fork":false,"pushed_at":"2025-04-22T22:42:11.000Z","size":1275,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-14T14:54:22.264Z","etag":null,"topics":["compiler","glsl","javascript","minifier","node","nodejs","webassembly","webgl","webgl2"],"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/SalvatorePreviti.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-23T21:54:12.000Z","updated_at":"2025-04-22T22:42:15.000Z","dependencies_parsed_at":"2024-10-19T03:27:43.131Z","dependency_job_id":null,"html_url":"https://github.com/SalvatorePreviti/spglsl","commit_stats":{"total_commits":134,"total_committers":3,"mean_commits":"44.666666666666664","dds":"0.23134328358208955","last_synced_commit":"392bdc162550c30f1ac2e4e10a7a77594cfcb5f3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SalvatorePreviti/spglsl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalvatorePreviti%2Fspglsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalvatorePreviti%2Fspglsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalvatorePreviti%2Fspglsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalvatorePreviti%2Fspglsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SalvatorePreviti","download_url":"https://codeload.github.com/SalvatorePreviti/spglsl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalvatorePreviti%2Fspglsl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271430787,"owners_count":24758373,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"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":["compiler","glsl","javascript","minifier","node","nodejs","webassembly","webgl","webgl2"],"created_at":"2024-10-01T15:29:24.830Z","updated_at":"2025-08-21T05:32:22.452Z","avatar_url":"https://github.com/SalvatorePreviti.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spglsl - a webgl glsl minifier based on Google Angle, written for JS13K\n\nExecutes preprocessor directives, removes whitespaces, applies constant folding, mangle non exported functions and variable names.\nUsed in \"Island Not Found\" https://github.com/SalvatorePreviti/js13k-2020 and \"Dante\" https://github.com/SalvatorePreviti/js13k-2022 (first place on JS13K 2022)\n\n## Installation\n\nPackage is precompiled at https://www.npmjs.com/package/spglsl\n\nIt includes a rollup plugin.\n\nFor an esbuild plugin, see https://github.com/rottencandy/esbuild-plugin-spglsl\n\n```sh\nnpm i spglsl --save\n```\n\n## Usage\n\n```js\nimport { spglslAngleCompile } from \"spglsl\";\n\nasync function compileFile() {\n  const result = await spglslAngleCompile({\n    mainFilePath: \"myfile.frag\",\n    mainSourceCode: fs.readFileSync(\"myfile.frag\", \"utf8\"),\n\n    minify: true,\n\n    // Mangle everything, except uniforms and globals, \"main\" and function starting with \"main\"\n    mangle: true,\n\n    // Map of global variables to rename\n    mangle_global_map: {\n      my_uniform_to_rename: \"x\",\n      my_fragment_input_to_rename: \"y\",\n    },\n  });\n\n  if (!result.valid) {\n    console.log(result.infoLog);\n    throw new Error(\"compilation failed\");\n  }\n\n  // Prints all the uniform used, key is the original uniform name and value is the renamed uniform, if it was defined in mangle_global_map\n  console.log(result.uniforms);\n\n  // Prints all the globals used, key is the original variable name and value is the renamed uniform, if it was defined in mangle_global_map\n  // Globals are varying, vertex and fragment input, outputs and buffers ...\n  // Globals do not include uniforms.\n  console.log(result.globals);\n\n  return result.output;\n}\n```\n\nThere is also an handy rollup and vite plugin:\n\n```js\nimport { rollupPluginSpglsl } from \"spglsl\";\n\nconst pluginToPassToRollupOrVite = rollupPluginSpglsl({ ...options });\n```\n\n## License\n\nMIT license\nSalvatore Previti Copyright 2020-2022\n\nAngle Copyright 2018 The ANGLE Project Authors.\n\n## Development\n\nThe project is mostly C++, compiled to WASM with Emscripten and runnable in NodeJS.\nLook at project/scripts folder on how to install dependencies and build.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalvatorepreviti%2Fspglsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalvatorepreviti%2Fspglsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalvatorepreviti%2Fspglsl/lists"}