# babel-plugin-export-window-declarations

> export variables defined as window object.

Latest version **0.1.3** (published 2022-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-export-window-declarations
pnpm add babel-plugin-export-window-declarations
yarn add babel-plugin-export-window-declarations
bun add babel-plugin-export-window-declarations
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2022-05-09 |
| First published | 2022-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | benibana2001 |
| Maintainers | whasse |
| Keywords | babel-plugin |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-export-window-declarations
- Repository: https://github.com/benibana2001/babel-plugin-export-window-declarations
- Homepage: https://github.com/benibana2001/babel-plugin-export-window-declarations#readme
- Issues: https://github.com/benibana2001/babel-plugin-export-window-declarations/issues
- npm.io page: https://npm.io/package/babel-plugin-export-window-declarations

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2022-05-09
- 0.1.2 — 2022-05-08
- 0.1.1 — 2022-05-01
- 0.1.0 — 2022-05-01

## README

# babel-plugin-export-window-declarations
this plugin exports top-level variables.

### The problem 🤨
Legacy browser source code is written as script, making it difficult to test, bundle, etc.

### This solution ✅
To solve this problem, this plugin exports top-level variables.

### installation 
```bash
npm i -D babel-plugin-export-window-declarations
```

## example
```javascript
function a() {
  console.log("a");
}

function b() {
  console.log("b");
}

var c = function () {
  console.log("c");
};

var d = function (name) {
  this._name = name;
};

d.prototype = {
  _call: function () {
    console.log(this._name);
  },
};

// Insert the following code
export { a, b, c, d };
```

## Usage

```javascript
const { transform } = require("@babel/core");
const fs = require("fs");
const files = ["./sources/declarations.js", "./sources/functions.js"];

files
  .map((file) => fs.readFileSync(file, { encoding: "utf8" }))
  .forEach((src) => {
    const { code } = transform(src, {
      plugins: [require("babel-plugin-export-window-declarations")],
    });
    console.log(code);
  });

```

---
_Source: https://npm.io/package/babel-plugin-export-window-declarations · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
