Registry / serialization / constructuring

constructuring

JSON →
library0.0.3jsnpmunverified

Constructuring is an ES6-to-ES3 transpiler specifically for the destructuring feature. It transforms JavaScript code using ES6 destructuring (arrays and objects) into ES3-compatible code that runs in older browsers. Current version 0.0.3, with no recent updates indicating it is no longer maintained. It operates on source strings or esprima ASTs, making it suitable for integration into build pipelines that already use esprima and escodegen. Compared to broader transpilers like Babel, Constructuring focuses only on destructuring, which may be useful for targeted transformations but lacks active development and broader language feature support.

npm install constructuring
INSTALL
IMPORT
SIG · CONSTRUCTURING
C
constructuring
serializationjavascriptv0.0.3
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.

transformSource
✓ const { transformSource } = require('constructuring');
✗ import { transformSource } from 'constructuring';
Package is CommonJS-only; no ESM exports available.
transform
✓ const { transform } = require('constructuring');
✗ const transform = require('constructuring').transform;
Alternative correct import for AST-based usage.
default
✓ const constructuring = require('constructuring');
✗ import constructuring from 'constructuring';
Default export is the module itself, but named exports are preferred.

Shows both source transformation and AST-based transformation using constructuring.

const { transformSource } = require('constructuring'); const fs = require('fs'); const source = fs.readFileSync('module.js', 'utf8'); const result = transformSource(source); console.log(result); // Also AST-based: const esprima = require('esprima'); const escodegen = require('escodegen'); const ast = esprima.parse(source); const { transform } = require('constructuring'); transform(ast); console.log(escodegen.generate(ast));
constructuring --version
Debug
Known issues
deprecatedPackage is abandoned; last version 0.0.3 released years ago. No support for modern JavaScript or ES6 beyond destructuring.
fix
Use a modern transpiler like Babel or SWC for full ES6+ support.
affects: >=0.0.0
gotchaPackage is CommonJS-only; will not work with ESM imports without a bundler or wrapper.
fix
Use require() or wrap in a bundler that supports CJS.
affects: >=0.0.0
gotchaTransform functions mutate the AST if provided; ensure you have a copy if needed.
fix
Clone the AST before passing if you need the original for other purposes.
affects: >=0.0.0
breakingNo official TypeScript definitions; any type safety must be manually added.
fix
Create your own .d.ts or use @ts-ignore.
affects: >=0.0.0
deprecatedNo security patches or updates; known vulnerabilities in dependencies (esprima, escodegen) may be present.
fix
Do not use in production; fork and update dependencies if necessary.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: transformSource is not a function
Incorrect import: using default import instead of named import in CommonJS.
fix
Use const { transformSource } = require('constructuring');
SyntaxError: Unexpected token =
Source code contains ES6 syntax beyond destructuring (e.g., arrow functions) which constructuring cannot handle.
fix
First transpile with a broader tool like Babel, or ensure input only uses destructuring.
Module not found: Can't resolve 'constructuring'
Package is not installed or name is misspelled.
fix
Run npm install constructuring --save or check spelling: 'constructuring' (note: not 'constructuring').
Error: Cannot find module 'esprima'
When using AST mode, esprima and escodegen must be installed separately.
fix
npm install esprima escodegen
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies
esprimaoptionalAST parsing for JavaScript source code
escodegenoptionalGenerating JavaScript from AST after transformation
Agent activity
9 hits · last 30 days
node
8
Resources
constructuring — npm install constructuring · libregistry