Registry / serialization / babel-plugin-extensible-destructuring

babel-plugin-extensible-destructuring

JSON →
library4.3.1jsnpmunverified

Babel plugin that transforms destructuring assignments to calls to a runtime function, enabling custom behavior like Immutable.js support or safe access (avoiding undefined). Version 4.3.1 works with Babel 6 and 7 (using full plugin name for Babel 7). It requires the separate runtime package `extensible-runtime` and offers three implementations: normal (ES6 compatible), immutable (for Immutable.js Maps/Lists), and safe (default, prevents undefined returns). Provides opt-in/opt-out per-file modes for gradual adoption.

npm install babel-plugin-extensible-destructuring
INSTALL
IMPORT
SIG · BABEL-PLUGIN-EXTEN
B
babel-plugin-extensible-destructuring
serializationjavascriptv4.3.1
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.

plugin
// .babelrc { "plugins": ["extensible-destructuring"] }
// Wrong: using 'babel-plugin-extensible-destructuring' with Babel 6 (works but not short name) { "plugins": ["babel-plugin-extensible-destructuring"] }
For Babel 6, use short name 'extensible-destructuring'. For Babel 7, use full name 'babel-plugin-extensible-destructuring'.
plugin with options
// .babelrc { "plugins": [["extensible-destructuring", { "mode": "optin", "impl": "safe" }]] }
// Wrong: omitting double array brackets { "plugins": ["extensible-destructuring", { "mode": "optin" }] }
Options must be passed as an array inside the plugins array: [ [pluginName, options] ].
use extensible directive
// top of file 'use extensible'; var {a} = obj;
// Wrong: misspelling 'use extansible'; var {a} = obj;
In opt-in mode, you must add 'use extensible' at the top of each file to enable transformation.

Demonstrates setup with Babel 7 and immutable mode destructuring of an Immutable.js Map.

// Install dependencies // npm install --save-dev babel-plugin-extensible-destructuring // npm install --save extensible-runtime // .babelrc { "presets": ["@babel/preset-env"], "plugins": ["babel-plugin-extensible-destructuring"] } // src/index.js (opt-in mode by default) 'use extensible'; import { fromJS } from 'immutable'; const map = fromJS({ author: { name: { first: "John", last: "Doe" }, birthdate: "10-10-2010" } }); const { author: { name: { first, last }, birthdate } } = map; console.log(first, last, birthdate); // John Doe 10-10-2010
Debug
Known issues
breakingBabel 7 requires full plugin name 'babel-plugin-extensible-destructuring' instead of 'extensible-destructuring'.
fix
Use 'babel-plugin-extensible-destructuring' in plugins array for Babel 7.
affects: >=4.0.0
gotchaYou must install both the plugin and runtime package: 'extensible-runtime' is required at runtime.
fix
Run npm install --save extensible-runtime.
affects: >=1.0.0
gotchaOpt-in mode is default; destructuring will not be transformed unless 'use extensible' directive is at top of file.
fix
Add 'use extensible'; at the beginning of each file, or set mode to 'optout' in options.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'extensible-runtime'
Runtime package not installed.
fix
npm install --save extensible-runtime
ReferenceError: __extensible_get__ is not defined
Missing runtime import or Babel not transforming correctly.
fix
Ensure both plugin and runtime are installed and Babel is configured correctly.
TypeError: Cannot destructure property 'x' of 'undefined' or 'null'
Using safe mode but the value is null, not undefined.
fix
Safe mode only prevents undefined; for null, use a default value or check beforehand.
Upgrade
Version history
4.3.1latest on npm
Audit
Dependencies
extensible-runtimerequiredProvides the runtime `__extensible_get__` function used by the transformed code.
Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
babel-plugin-extensible-destructuring — npm install babel-plugin-extensible-destructuring · libregistry