{"id":19055,"library":"babel-plugin-extensible-destructuring","title":"babel-plugin-extensible-destructuring","description":"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.","status":"active","version":"4.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/vacuumlabs/babel-plugin-extensible-destructuring","tags":["javascript","babel-plugin","destructuring"],"install":[{"cmd":"npm install babel-plugin-extensible-destructuring","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-extensible-destructuring","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-extensible-destructuring","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the runtime `__extensible_get__` function used by the transformed code.","package":"extensible-runtime","optional":false}],"imports":[{"note":"For Babel 6, use short name 'extensible-destructuring'. For Babel 7, use full name 'babel-plugin-extensible-destructuring'.","wrong":"// Wrong: using 'babel-plugin-extensible-destructuring' with Babel 6 (works but not short name)\n{\n  \"plugins\": [\"babel-plugin-extensible-destructuring\"]\n}","symbol":"plugin","correct":"// .babelrc\n{\n  \"plugins\": [\"extensible-destructuring\"]\n}"},{"note":"Options must be passed as an array inside the plugins array: [ [pluginName, options] ].","wrong":"// Wrong: omitting double array brackets\n{\n  \"plugins\": [\"extensible-destructuring\", { \"mode\": \"optin\" }]\n}","symbol":"plugin with options","correct":"// .babelrc\n{\n  \"plugins\": [[\"extensible-destructuring\", { \"mode\": \"optin\", \"impl\": \"safe\" }]]\n}"},{"note":"In opt-in mode, you must add 'use extensible' at the top of each file to enable transformation.","wrong":"// Wrong: misspelling\n'use extansible';\nvar {a} = obj;","symbol":"use extensible directive","correct":"// top of file\n'use extensible';\n\nvar {a} = obj;"}],"quickstart":{"code":"// Install dependencies\n// npm install --save-dev babel-plugin-extensible-destructuring\n// npm install --save extensible-runtime\n\n// .babelrc\n{\n  \"presets\": [\"@babel/preset-env\"],\n  \"plugins\": [\"babel-plugin-extensible-destructuring\"]\n}\n\n// src/index.js (opt-in mode by default)\n'use extensible';\nimport { fromJS } from 'immutable';\nconst map = fromJS({ author: { name: { first: \"John\", last: \"Doe\" }, birthdate: \"10-10-2010\" } });\nconst { author: { name: { first, last }, birthdate } } = map;\nconsole.log(first, last, birthdate); // John Doe 10-10-2010","lang":"javascript","description":"Demonstrates setup with Babel 7 and immutable mode destructuring of an Immutable.js Map."},"warnings":[{"fix":"Use 'babel-plugin-extensible-destructuring' in plugins array for Babel 7.","message":"Babel 7 requires full plugin name 'babel-plugin-extensible-destructuring' instead of 'extensible-destructuring'.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Run npm install --save extensible-runtime.","message":"You must install both the plugin and runtime package: 'extensible-runtime' is required at runtime.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add 'use extensible'; at the beginning of each file, or set mode to 'optout' in options.","message":"Opt-in mode is default; destructuring will not be transformed unless 'use extensible' directive is at top of file.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'/opt-out':74 '4.3.1':30 '6':34 '7':36,43 'access':26 'adopt':81 'assign':11 'avoid':27 'babel':2,6,33,42,84 'babel-plugin':83 'babel-plugin-extensible-destructur':1 'behavior':20 'call':13 'compat':59 'custom':19 'default':66 'destructur':5,10,86 'enabl':18 'es6':58 'extens':4,51 'extensible-runtim':50 'file':77 'full':38 'function':17 'gradual':80 'immut':60 'immutable.js':22,62 'implement':56 'javascript':82 'like':21 'maps/lists':63 'mode':78 'name':40 'normal':57 'offer':54 'opt':72 'opt-in':71 'packag':49 'per':76 'per-fil':75 'plugin':3,7,39,85 'prevent':67 'provid':70 'requir':45 'return':69 'runtim':16,48,52 'safe':25,65 'separ':47 'support':23 'three':55 'transform':9 'undefin':28,68 'use':37 'version':29 'work':31","created_at":"2026-04-25T11:15:48.275672+00:00","updated_at":"2026-04-25T11:15:48.275672+00:00","problems":[{"fix":"npm install --save extensible-runtime","cause":"Runtime package not installed.","error":"Error: Cannot find module 'extensible-runtime'"},{"fix":"Ensure both plugin and runtime are installed and Babel is configured correctly.","cause":"Missing runtime import or Babel not transforming correctly.","error":"ReferenceError: __extensible_get__ is not defined"},{"fix":"Safe mode only prevents undefined; for null, use a default value or check beforehand.","cause":"Using safe mode but the value is null, not undefined.","error":"TypeError: Cannot destructure property 'x' of 'undefined' or 'null'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/vacuumlabs/babel-plugin-extensible-destructuring","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/babel-plugin-extensible-destructuring","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}