{"id":26085,"library":"polymer-rename","title":"polymer-rename","description":"polymer-rename v4.3.2 is a build tool that preprocesses Polymer HTML templates so that Closure Compiler's ADVANCED optimizations can safely rename data-binding expressions and event handlers. It parses Polymer templates, extracts bindings like [[prop]] and on-event handlers, and emits synthetic JavaScript for Closure Compiler to analyze, enabling property renaming without breaking template references. This avoids the need to quote or export every property used in bindings, resulting in smaller output and better type checking. Unlike manual exports, polymer-rename automates the integration of Polymer with Closure Compiler. The library last updated for Polymer 2; no active releases since 2020 indicate maintenance status.","status":"maintenance","version":"4.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/Banno/polymer-rename","tags":["javascript","Polymer","google-closure-compiler"],"install":[{"cmd":"npm install polymer-rename","lang":"bash","label":"npm"},{"cmd":"yarn add polymer-rename","lang":"bash","label":"yarn"},{"cmd":"pnpm add polymer-rename","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to parse HTML template strings","package":"parse5","optional":false},{"reason":"Required for the actual renaming compilation step (external tool)","package":"closure-compiler","optional":true}],"imports":[{"note":"Package has no named exports; default import is correct.","wrong":"const polymerRename = require('polymer-rename')","symbol":"default","correct":"import polymerRename from 'polymer-rename'"},{"note":"rename is a named export but the package only exports a default function. This named export does not exist; use default import.","wrong":"const rename = require('polymer-rename').rename","symbol":"rename","correct":"import { rename } from 'polymer-rename'"},{"note":"Wildcard import works but unnecessary; use default import.","wrong":"import * as polymerRename from 'polymer-rename'","symbol":"polymerRename","correct":"import polymerRename from 'polymer-rename'"}],"quickstart":{"code":"const polymerRename = require('polymer-rename');\nconst fs = require('fs');\n\n// Read a Polymer HTML file\nconst html = fs.readFileSync('my-element.html', 'utf8');\n\n// Generate synthetic JS from the template bindings\nconst result = polymerRename(html);\nconsole.log(result.js); // synthetic JS for Closure Compiler\nconsole.log(result.warnings); // any warnings\n\n// Write the synthetic JS to a file for compilation\nfs.writeFileSync('element-bindings.js', result.js);","lang":"javascript","description":"Demonstrates importing polymer-rename, parsing a Polymer HTML file, and extracting synthetic JavaScript for Closure Compiler."},"warnings":[{"fix":"Consider migrating to LitElement or using alternative tooling that supports modern Polymer patterns.","message":"This package has not been updated since Polymer 2 and may not work with Polymer 3+ style imports or LitElement.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Ensure your HTML templates follow Polymer 2 conventions and are well-formed.","message":"The package expects HTML files that are valid Polymer templates. Non-standard or malformed HTML can cause parse errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade to 4.x and use default import: `import polymerRename from 'polymer-rename'`.","message":"Version 1.x used a different API (object with .rename method). 4.x uses a default function export.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Only pass the synthetic JS to Closure Compiler during compilation, then exclude from final output.","message":"The synthetic JS output is not meant to be executed; including it in the final bundle will cause runtime errors.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install polymer-rename` and ensure import uses the correct name.","cause":"Package not installed or incorrect import path.","error":"Cannot find module 'polymer-rename'"},{"fix":"Use `import polymerRename from 'polymer-rename'` or `const polymerRename = require('polymer-rename')`.","cause":"Attempted to call a non-function default export, possibly because the default import was not used.","error":"TypeError: polymerRename is not a function"},{"fix":"Ensure the input is a pure HTML template without script tags containing complex JS inside template strings.","cause":"The input HTML contains JavaScript or template literals that are not valid HTML for the parser.","error":"Unexpected token: {"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}