{"id":25081,"library":"closure-dom","title":"closure-dom","description":"Closure DOM provides lightweight, Closure Compiler-compatible DOM manipulation utilities for JavaScript. The package (v1.0.0) includes methods like addClass, getDocumentHeight, insert, setOpacity, and others, designed for simple reuse across projects. It has a stable release cadence with infrequent updates. Its key differentiators are compatibility with Google Closure Compiler's advanced optimizations and minimal overhead, making it suitable for compiled applications. Unlike larger libraries, it offers focused, composable functions without dependencies.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/bramstein/closure-dom","tags":["javascript"],"install":[{"cmd":"npm install closure-dom","lang":"bash","label":"npm"},{"cmd":"yarn add closure-dom","lang":"bash","label":"yarn"},{"cmd":"pnpm add closure-dom","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named import required; package exports multiple named functions, not a default export.","wrong":"import addClass from 'closure-dom';","symbol":"addClass","correct":"import { addClass } from 'closure-dom';"},{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const { getDocumentHeight } = require('closure-dom');","symbol":"getDocumentHeight","correct":"import { getDocumentHeight } from 'closure-dom';"},{"note":"Function named 'insert', not 'insertElement'.","wrong":"import { insertElement } from 'closure-dom';","symbol":"insert","correct":"import { insert } from 'closure-dom';"}],"quickstart":{"code":"import { addClass, getDocumentHeight, insert, setOpacity } from 'closure-dom';\n\nconst element = document.createElement('div');\naddClass(element, 'highlight');\nsetOpacity(element, 0.5);\ndocument.body.appendChild(element);\n\nconst height = getDocumentHeight();\nconsole.log('Document height:', height);","lang":"javascript","description":"Demonstrates importing and using four DOM utility functions: addClass, setOpacity, insert (not shown but imported), and getDocumentHeight."},"warnings":[{"fix":"Use import syntax instead of require().","message":"ESM-only package: does not support CommonJS require(). Use ES module imports.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Import each function by name: import { functionName } from 'closure-dom';","message":"All methods are not available as default export. Must use named imports.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add \"type\": \"module\" to package.json or use .mjs extension","cause":"Package is ESM-only; using import in CommonJS context","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Change to: import { addClass } from 'closure-dom';","cause":"Default import used instead of named import","error":"TypeError: closure_dom_1.addClass is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}