Registry / devops / polymer-rename

polymer-rename

JSON →
library4.3.2jsnpmunverified

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.

npm install polymer-rename
INSTALL
IMPORT
SIG · POLYMER-RENAME
P
polymer-rename
devopsjavascriptv4.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import polymerRename from 'polymer-rename'
const polymerRename = require('polymer-rename')
Package has no named exports; default import is correct.
rename
import { rename } from 'polymer-rename'
const rename = require('polymer-rename').rename
rename is a named export but the package only exports a default function. This named export does not exist; use default import.
polymerRename
import polymerRename from 'polymer-rename'
import * as polymerRename from 'polymer-rename'
Wildcard import works but unnecessary; use default import.

Demonstrates importing polymer-rename, parsing a Polymer HTML file, and extracting synthetic JavaScript for Closure Compiler.

const polymerRename = require('polymer-rename'); const fs = require('fs'); // Read a Polymer HTML file const html = fs.readFileSync('my-element.html', 'utf8'); // Generate synthetic JS from the template bindings const result = polymerRename(html); console.log(result.js); // synthetic JS for Closure Compiler console.log(result.warnings); // any warnings // Write the synthetic JS to a file for compilation fs.writeFileSync('element-bindings.js', result.js);
Debug
Known issues
deprecatedThis package has not been updated since Polymer 2 and may not work with Polymer 3+ style imports or LitElement.
fix
Consider migrating to LitElement or using alternative tooling that supports modern Polymer patterns.
affects: >=4.0.0
gotchaThe package expects HTML files that are valid Polymer templates. Non-standard or malformed HTML can cause parse errors.
fix
Ensure your HTML templates follow Polymer 2 conventions and are well-formed.
affects: >=0.0.0
breakingVersion 1.x used a different API (object with .rename method). 4.x uses a default function export.
fix
Upgrade to 4.x and use default import: `import polymerRename from 'polymer-rename'`.
affects: <4.0.0
gotchaThe synthetic JS output is not meant to be executed; including it in the final bundle will cause runtime errors.
fix
Only pass the synthetic JS to Closure Compiler during compilation, then exclude from final output.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'polymer-rename'
Package not installed or incorrect import path.
fix
Run `npm install polymer-rename` and ensure import uses the correct name.
TypeError: polymerRename is not a function
Attempted to call a non-function default export, possibly because the default import was not used.
fix
Use `import polymerRename from 'polymer-rename'` or `const polymerRename = require('polymer-rename')`.
Unexpected token: {
The input HTML contains JavaScript or template literals that are not valid HTML for the parser.
fix
Ensure the input is a pure HTML template without script tags containing complex JS inside template strings.
Upgrade
Version history
4.3.2latest on npm
Audit
Dependencies
parse5requiredUsed to parse HTML template strings
closure-compileroptionalRequired for the actual renaming compilation step (external tool)
Agent activity
2 hits · last 30 days
node
2
Resources
polymer-rename — npm install polymer-rename · libregistry