Skip to content

Commit be39e20

Browse files
committed
Rename jsx-to-tagged-templates to jsx-to-htm
1 parent 366f6ac commit be39e20

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build:main": "microbundle src/index.mjs -f es,umd --no-sourcemap --target web && microbundle src/cjs.mjs -f iife --no-sourcemap --target web",
1111
"build:preact": "cd src/integrations/preact && npm run build",
1212
"build:babel": "cd packages/babel-plugin-htm && npm run build",
13-
"build:babel-transform-jsx": "cd packages/babel-plugin-transform-jsx-to-tagged-templates && npm run build",
13+
"build:babel-transform-jsx": "cd packages/babel-plugin-transform-jsx-to-htm && npm run build",
1414
"test": "eslint src/**/*.mjs test/**/*.mjs && npm run build && jest test",
1515
"release": "npm t && git commit -am \"$npm_package_version\" && git tag $npm_package_version && git push && git push --tags && npm publish"
1616
},
@@ -40,7 +40,7 @@
4040
"js"
4141
],
4242
"moduleNameMapper": {
43-
"^babel-plugin-transform-jsx-to-tagged-templates$": "<rootDir>/packages/babel-plugin-transform-jsx-to-tagged-templates/src/index.mjs",
43+
"^babel-plugin-transform-jsx-to-htm$": "<rootDir>/packages/babel-plugin-transform-jsx-to-htm/index.mjs",
4444
"^babel-plugin-htm$": "<rootDir>/packages/babel-plugin-htm/index.mjs",
4545
"^htm$": "<rootDir>/src/index.mjs",
4646
"^htm/preact$": "<rootDir>/src/integrations/preact/index.mjs"

packages/babel-plugin-transform-jsx-to-tagged-templates/README.md renamed to packages/babel-plugin-transform-jsx-to-htm/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# babel-plugin-transform-jsx-to-tagged-templates
1+
# babel-plugin-transform-jsx-to-htm
22

33
This plugin converts JSX into Tagged Templates that work with things like [htm] and [lit-html].
44

@@ -15,14 +15,14 @@ const Foo = () => html`<h1>Hello</h1>`
1515
Grab it from npm:
1616

1717
```sh
18-
npm i -D babel-plugin-transform-jsx-to-tagged-templates
18+
npm i -D babel-plugin-transform-jsx-to-htm
1919
```
2020

2121
... then add it to your Babel config (eg: `.babelrc`):
2222

2323
```js
2424
"plugins": [
25-
"babel-plugin-transform-jsx-to-tagged-templates"
25+
"babel-plugin-transform-jsx-to-htm"
2626
]
2727
```
2828

@@ -39,7 +39,7 @@ Options are passed to a Babel plugin using a nested Array:
3939

4040
```js
4141
"plugins": [
42-
["babel-plugin-transform-jsx-to-tagged-templates", {
42+
["babel-plugin-transform-jsx-to-htm", {
4343
"tag": "$$html",
4444
"html": true
4545
}]
@@ -61,7 +61,7 @@ Just use [babel-plugin-jsx-pragmatic]:
6161
// what to call it locally: (should match your "tag" option)
6262
"import": "$$html"
6363
}],
64-
["babel-plugin-transform-jsx-to-tagged-templates", {
64+
["babel-plugin-transform-jsx-to-htm", {
6565
"tag": "$$html"
6666
}]
6767
]

packages/babel-plugin-transform-jsx-to-tagged-templates/src/index.mjs renamed to packages/babel-plugin-transform-jsx-to-htm/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import jsx from '@babel/plugin-syntax-jsx';
66
* @param {string} [options.tag='html'] The tagged template "tag" function name to produce.
77
* @param {string} [options.html=false] If `true`, output HTML-like instead of XML-like (no self-closing tags, etc).
88
*/
9-
export default function jsxToTaggedTemplatesBabelPlugin({ types: t }, options = {}) {
9+
export default function jsxToHtmBabelPlugin({ types: t }, options = {}) {
1010
const tag = dottedIdentifier(options.tag || 'html');
1111
const htmlOutput = !!options.html;
1212

@@ -144,7 +144,7 @@ export default function jsxToTaggedTemplatesBabelPlugin({ types: t }, options =
144144
}
145145

146146
return {
147-
name: 'transform-jsx-to-tagged-templates',
147+
name: 'transform-jsx-to-htm',
148148
inherits: jsx,
149149
visitor: {
150150
JSXElement(path) {

packages/babel-plugin-transform-jsx-to-tagged-templates/package.json renamed to packages/babel-plugin-transform-jsx-to-htm/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
2-
"name": "babel-plugin-transform-jsx-to-tagged-templates",
2+
"name": "babel-plugin-transform-jsx-to-htm",
33
"version": "0.1.0",
44
"description": "Babel plugin to compile JSX to Tagged Templates.",
5-
"main": "dist/babel-plugin-transform-jsx-to-tagged-templates.js",
6-
"module": "dist/babel-plugin-transform-jsx-to-tagged-templates.mjs",
5+
"main": "dist/babel-plugin-transform-jsx-to-htm.js",
6+
"module": "dist/babel-plugin-transform-jsx-to-htm.mjs",
77
"scripts": {
8-
"build": "microbundle src/index.mjs -f es,cjs --target node --no-compress --no-sourcemap",
8+
"build": "microbundle index.mjs -f es,cjs --target node --no-compress --no-sourcemap",
99
"prepare": "npm run build"
1010
},
1111
"files": [
12-
"dist",
13-
"src"
12+
"dist"
1413
],
1514
"repository": "developit/htm",
1615
"keywords": [
@@ -27,7 +26,7 @@
2726
],
2827
"author": "Jason Miller <[email protected]>",
2928
"license": "Apache-2.0",
30-
"homepage": "https://github.com/developit/htm/tree/master/packages/babel-plugin-transform-jsx-to-tagged-templates",
29+
"homepage": "https://github.com/developit/htm/tree/master/packages/babel-plugin-transform-jsx-to-htm",
3130
"devDependencies": {
3231
"microbundle": "^0.8.3"
3332
}

test/babel-transform-jsx.test.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { transform } from '@babel/core';
2-
import transformJsxToTaggedTemplatesPlugin from 'babel-plugin-transform-jsx-to-tagged-templates';
2+
import transformJsxToHtmPlugin from 'babel-plugin-transform-jsx-to-htm';
33

44
function compile(code, { plugins = [], ...options } = {}) {
55
return transform(code, {
@@ -8,12 +8,12 @@ function compile(code, { plugins = [], ...options } = {}) {
88
sourceType: 'script',
99
plugins: [
1010
...plugins,
11-
[transformJsxToTaggedTemplatesPlugin, options]
11+
[transformJsxToHtmPlugin, options]
1212
]
1313
}).code;
1414
}
1515

16-
describe('babel-plugin-transform-jsx-to-tagged-templates', () => {
16+
describe('babel-plugin-transform-jsx-to-htm', () => {
1717
describe('elements and text', () => {
1818
test('single named element', () => {
1919
expect(

0 commit comments

Comments
 (0)