babel-plugin-mettle 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Babel-plugin-
|
|
1
|
+
# Babel-plugin-mettle
|
|
2
2
|
|
|
3
|
-
A Babel plugin that compiles the template string in
|
|
3
|
+
A Babel plugin that compiles the template string in mettle.js into a normal object.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ In your Babel configuration (`.babelrc`, `babel.config.js`, `"babel"` field in p
|
|
|
9
9
|
```js
|
|
10
10
|
{
|
|
11
11
|
"plugins": [
|
|
12
|
-
["babel-plugin-
|
|
12
|
+
["babel-plugin-mettle"]
|
|
13
13
|
]
|
|
14
14
|
}
|
|
15
15
|
```
|
|
@@ -18,11 +18,11 @@ In your Babel configuration (`.babelrc`, `babel.config.js`, `"babel"` field in p
|
|
|
18
18
|
|
|
19
19
|
#### `tag=html`
|
|
20
20
|
|
|
21
|
-
By default, `
|
|
21
|
+
By default, `babelPluginMettle` will process all Tagged Templates with a tag function named `html`. To use a different name, use the `tag` option in your Babel configuration:
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
{"plugins":[
|
|
25
|
-
["babel-plugin-
|
|
25
|
+
["babel-plugin-mettle", {
|
|
26
26
|
"tag": "html"
|
|
27
27
|
}]
|
|
28
28
|
]}
|
|
@@ -148,7 +148,7 @@ const build = function (statics) {
|
|
|
148
148
|
* @param {string} [options.tag=html] The tagged template "tag" function name to process.
|
|
149
149
|
*/
|
|
150
150
|
|
|
151
|
-
function
|
|
151
|
+
function mettleBabelPlugin({
|
|
152
152
|
types: t
|
|
153
153
|
}, options = {}) {
|
|
154
154
|
function patternStringToRegExp(str) {
|
|
@@ -245,7 +245,7 @@ function amazedBabelPlugin({
|
|
|
245
245
|
}
|
|
246
246
|
const tagName = options.tag || 'html';
|
|
247
247
|
return {
|
|
248
|
-
name: '
|
|
248
|
+
name: 'mettle',
|
|
249
249
|
visitor: {
|
|
250
250
|
TaggedTemplateExpression(path, state) {
|
|
251
251
|
const tag = path.node.tag.name;
|
|
@@ -281,4 +281,4 @@ function amazedBabelPlugin({
|
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
module.exports =
|
|
284
|
+
module.exports = mettleBabelPlugin;
|
|
@@ -148,7 +148,7 @@ const build = function (statics) {
|
|
|
148
148
|
* @param {string} [options.tag=html] The tagged template "tag" function name to process.
|
|
149
149
|
*/
|
|
150
150
|
|
|
151
|
-
function
|
|
151
|
+
function mettleBabelPlugin({
|
|
152
152
|
types: t
|
|
153
153
|
}, options = {}) {
|
|
154
154
|
function patternStringToRegExp(str) {
|
|
@@ -245,7 +245,7 @@ function amazedBabelPlugin({
|
|
|
245
245
|
}
|
|
246
246
|
const tagName = options.tag || 'html';
|
|
247
247
|
return {
|
|
248
|
-
name: '
|
|
248
|
+
name: 'mettle',
|
|
249
249
|
visitor: {
|
|
250
250
|
TaggedTemplateExpression(path, state) {
|
|
251
251
|
const tag = path.node.tag.name;
|
|
@@ -281,4 +281,4 @@ function amazedBabelPlugin({
|
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
export {
|
|
284
|
+
export { mettleBabelPlugin as default };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-mettle",
|
|
3
|
-
"description": "A Babel plugin that compiles the template string in
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"main": "dist/babel-plugin-
|
|
6
|
-
"module": "dist/babel-plugin-
|
|
3
|
+
"description": "A Babel plugin that compiles the template string in mettle.js into a normal object.",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"main": "dist/babel-plugin-mettle.js",
|
|
6
|
+
"module": "dist/babel-plugin-mettle.mjs",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "microbundle src/index.js -f es,cjs --target node --no-compress --no-sourcemap"
|
|
9
9
|
},
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
],
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/maomincoding/babel-plugin-
|
|
15
|
+
"url": "https://github.com/maomincoding/babel-plugin-mettle"
|
|
16
16
|
},
|
|
17
17
|
"bugs": {
|
|
18
|
-
"url": "https://github.com/maomincoding/babel-plugin-
|
|
18
|
+
"url": "https://github.com/maomincoding/babel-plugin-mettle/issues"
|
|
19
19
|
},
|
|
20
|
-
"homepage": "https://github.com/maomincoding/babel-plugin-
|
|
20
|
+
"homepage": "https://github.com/maomincoding/babel-plugin-mettle#readme",
|
|
21
21
|
"keywords": [
|
|
22
22
|
"Hyperscript Tagged Markup",
|
|
23
23
|
"tagged template",
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
"babel",
|
|
28
28
|
"babel plugin",
|
|
29
29
|
"babel-plugin",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"mettle",
|
|
31
|
+
"mettle-js",
|
|
32
|
+
"babel-plugin-mettle"
|
|
32
33
|
],
|
|
33
34
|
"author": "maomincoding",
|
|
34
35
|
"license": "MIT",
|