Registry / testing / babel-check-duplicated-nodes

babel-check-duplicated-nodes

JSON →
library1.0.0jsnpmunverified

Babel helper utility (v1.0.0) that checks an AST for duplicated nodes, throwing a descriptive error if any are found. Originally extracted from Babel's test fixture runner, this tool helps Babel transform authors catch subtle bugs caused by node reuse. It is a niche package with a single API call, no active release cadence, and is intended for internal use during transform development rather than general production.

npm install babel-check-duplicated-nodes
INSTALL
IMPORT
SIG · BABEL-CHECK-DUPLIC
B
babel-check-duplicated-nodes
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

checkDuplicatedNodes
import { checkDuplicatedNodes } from 'babel-check-duplicated-nodes'
import checkDuplicatedNodes from 'babel-check-duplicated-nodes'
Package exports a named function, not a default export.

Demonstrates how to use checkDuplicatedNodes with @babel/core to detect duplicated AST nodes.

import { checkDuplicatedNodes } from 'babel-check-duplicated-nodes'; import * as babel from '@babel/core'; const code = 'const x = 1; const y = 2;'; const ast = babel.parseSync(code, { filename: 'test.js' }); // Simulate a duplicated node: reuse the same node twice const duplicateNode = ast.program.body[0]; ast.program.body.push(duplicateNode); try { checkDuplicatedNodes(babel, ast); } catch (e) { console.error(e.message); }
Debug
Known issues
gotchaThe pattern 'require('babel-check-duplicated-nodes').default' is incorrect; the package does not have a default export.
fix
Use 'const { checkDuplicatedNodes } = require('babel-check-duplicated-nodes')'.
affects: >=1.0.0
gotchaThis package is intended for internal use by Babel transform authors, not for general AST manipulation. Incorrect usage may produce false negatives.
fix
Ensure you only call this function on ASTs generated by Babel's parser, not third-party parsers.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: checkDuplicatedNodes is not a function
Default import usage instead of named import.
fix
Use `import { checkDuplicatedNodes } from 'babel-check-duplicated-nodes'` or `const { checkDuplicatedNodes } = require('babel-check-duplicated-nodes')`.
Cannot find module 'babel-check-duplicated-nodes'
Package not installed or missing from node_modules.
fix
Run `npm install babel-check-duplicated-nodes --save-dev`.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
2
Resources
babel-check-duplicated-nodes — npm install babel-check-duplicated-nodes · libregistry