Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-codegen

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-codegen - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

5

dist/index.js

@@ -177,4 +177,5 @@ 'use strict';

eslint
import/no-unassigned-import:0
import/no-dynamic-require:0
complexity: ["error", 8],
import/no-unassigned-import: "off",
import/no-dynamic-require: "off",
*/

8

dist/macro.js
'use strict';
// const printAST = require('ast-pretty-print')
var _require = require('babel-macros'),
var _require = require('babel-plugin-macros'),
createMacro = _require.createMacro;

@@ -25,6 +25,6 @@

}, state);
} else {
// TODO: throw a helpful error message
}
});
}
// TODO: throw a helpful error message
);
}

@@ -31,0 +31,0 @@

{
"name": "babel-plugin-codegen",
"version": "1.2.0",
"version": "1.2.1",
"description": "Generate code at build-time",

@@ -24,3 +24,3 @@ "main": "dist/index.js",

"keywords": [
"babel-macros",
"babel-plugin-macros",
"babel-plugin",

@@ -34,11 +34,11 @@ "babel",

"babel-core": "^6.26.0",
"babel-macros": "^1.0.0",
"babel-plugin-macros": "^2.0.0",
"babel-register": "^6.26.0",
"babel-template": "^6.26.0",
"require-from-string": "^1.2.1"
"require-from-string": "^2.0.1"
},
"devDependencies": {
"ast-pretty-print": "^2.0.0",
"babel-plugin-tester": "^4.0.0",
"kcd-scripts": "^0.4.0"
"ast-pretty-print": "^2.0.1",
"babel-plugin-tester": "^5.0.0",
"kcd-scripts": "^0.30.4"
},

@@ -45,0 +45,0 @@ "eslintConfig": {

@@ -13,3 +13,3 @@ <div align="center">

[![downloads][downloads-badge]][npmcharts]
[![MIT License][license-badge]][LICENSE]
[![MIT License][license-badge]][license]

@@ -19,3 +19,3 @@ [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)

[![Code of Conduct][coc-badge]][coc]
[![Babel Macro](https://img.shields.io/badge/babel--macro-%F0%9F%8E%A3-f5da55.svg?style=flat-square)](https://github.com/kentcdodds/babel-macros)
[![Babel Macro](https://img.shields.io/badge/babel--macro-%F0%9F%8E%A3-f5da55.svg?style=flat-square)](https://github.com/kentcdodds/babel-plugin-macros)

@@ -26,4 +26,2 @@ [![Watch on GitHub][github-watch-badge]][github-watch]

<a href="https://app.codesponsor.io/link/PKGFLnhDiFvsUA5P4kAXfiPs/kentcdodds/babel-plugin-codegen" rel="nofollow"><img src="https://app.codesponsor.io/embed/PKGFLnhDiFvsUA5P4kAXfiPs/kentcdodds/babel-plugin-codegen.svg" style="width: 888px; height: 68px;" alt="Sponsor" /></a>
## The problem

@@ -38,2 +36,4 @@

> Read ["Make maintainable workarounds with codegen 💥"](https://blog.kentcdodds.com/make-maintainable-workarounds-with-codegen-d34163a09c13) for more inspiration
## This solution

@@ -50,2 +50,27 @@

## Table of Contents
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
* [Installation](#installation)
* [Usage](#usage)
* [Template Tag](#template-tag)
* [import comment](#import-comment)
* [codegen.require](#codegenrequire)
* [codegen file comment (`// @codegen`)](#codegen-file-comment--codegen)
* [Configure with Babel](#configure-with-babel)
* [Via `.babelrc` (Recommended)](#via-babelrc-recommended)
* [Via CLI](#via-cli)
* [Via Node API](#via-node-api)
* [Use with [`babel-plugin-macros`][babel-plugin-macros]](#use-with-babel-plugin-macrosbabel-plugin-macros)
* [Caveats](#caveats)
* [Inspiration](#inspiration)
* [Other Solutions](#other-solutions)
* [Contributors](#contributors)
* [LICENSE](#license)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Installation

@@ -68,2 +93,3 @@

Important notes:
1. All code run by `codegen` is _not_ run in a sandboxed environment

@@ -79,4 +105,2 @@ 2. All code _must_ run synchronously.

TODO...
### Template Tag

@@ -96,3 +120,3 @@

```javascript
var x = 'Hello world!';
var x = 'Hello world!'
```

@@ -127,3 +151,3 @@

```javascript
var x = 1;
var x = 1
```

@@ -143,3 +167,3 @@

```javascript
var x = 3;
var x = 3
```

@@ -158,3 +182,3 @@

```javascript
const x = 3;
const x = 3
```

@@ -181,5 +205,5 @@

```javascript
export const apple = 'apple';
export const orange = 'orange';
export const pear = 'pear';
export const apple = 'apple'
export const orange = 'orange'
export const pear = 'pear'
```

@@ -213,5 +237,5 @@

## Use with [`babel-macros`][babel-macros]
## Use with [`babel-plugin-macros`][babel-plugin-macros]
Once you've [configured `babel-macros`](https://github.com/kentcdodds/babel-macros/blob/master/other/docs/user.md)
Once you've [configured `babel-plugin-macros`](https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/user.md)
you can import/require the codegen macro at `babel-plugin-codegen/macro`.

@@ -258,4 +282,7 @@ For example:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/babel-plugin-codegen/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/babel-plugin-codegen/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/babel-plugin-codegen/commits?author=kentcdodds) |
<!-- prettier-ignore -->
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/babel-plugin-codegen/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/babel-plugin-codegen/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/babel-plugin-codegen/commits?author=kentcdodds "Tests") |
| :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

@@ -298,2 +325,2 @@

[codegen.macro]: https://www.npmjs.com/package/codegen.macro
[babel-macros]: https://github.com/babel-macros
[babel-plugin-macros]: https://github.com/kentcdodds/babel-plugin-macros
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc