# node-retrieve-globals Execute a string of JavaScript using Node.js and return the global variable values and functions. * Supported on Node.js 16 and newer. * Uses `var`, `let`, `const`, `function`, Array and Object [destructuring assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment). * Async-only as of v5.0. * Can return any valid JS data type (including functions). * Can provide an external data object as context to the local execution scope * Transforms ESM import statements to work with current CommonJS limitations in Node’s `vm`. * Uses [Node’s `vm` module to execute JavaScript](https://nodejs.org/api/vm.html#vmruninthiscontextcode-options) * ⚠️ The `node:vm` module is not a security mechanism. Do not use it to run untrusted code. * `codeGeneration` (e.g. `eval`) is disabled by default; use `setCreateContextOptions({codeGeneration: { strings: true, wasm: true } })` to re-enable. * Works _with or without_ `--experimental-vm-modules` flag (for `vm.Module` support). _(v5.0.0 and newer)_ * Future-friendly feature tests for when `vm.Module` is stable and `--experimental-vm-modules` is no longer necessary. _(v5.0.0 and newer)_ * In use on: * [JavaScript in Eleventy Front Matter](https://www.11ty.dev/docs/data-frontmatter-customize/#example-use-javascript-in-your-front-matter) (and [Demo](https://github.com/11ty/demo-eleventy-js-front-matter)) * [WebC’s `