babel-plugin-codegen
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -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", | ||
*/ |
'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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22097
261
312
+ Addedbabel-plugin-macros@^2.0.0
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/runtime@7.26.0(transitive)
+ Added@types/parse-json@4.0.2(transitive)
+ Addedbabel-plugin-macros@2.8.0(transitive)
+ Addedcallsites@3.1.0(transitive)
+ Addedcosmiconfig@6.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedyaml@1.10.2(transitive)
- Removedbabel-macros@^1.0.0
- Removedargparse@1.0.10(transitive)
- Removedbabel-macros@1.2.0(transitive)
- Removedcosmiconfig@3.1.0(transitive)
- Removedesprima@4.0.1(transitive)
- Removedis-directory@0.3.1(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedparse-json@3.0.0(transitive)
- Removedrequire-from-string@1.2.1(transitive)
- Removedsprintf-js@1.0.3(transitive)
Updatedrequire-from-string@^2.0.1