babel-plugin-glimmer-inline-precompile
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -15,3 +15,4 @@ 'use strict'; | ||
if (t.isLiteral(node.source, { value: 'glimmer-inline-precompile' })) { | ||
let matchingImportPath = state.opts.importPath || 'glimmer-inline-precompile'; | ||
if (t.isLiteral(node.source, { value: matchingImportPath })) { | ||
let first = node.specifiers && node.specifiers[0]; | ||
@@ -18,0 +19,0 @@ |
{ | ||
"name": "babel-plugin-glimmer-inline-precompile", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Use tagged template strings to precompile glimmer templates inside your JS files.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
18
test.js
@@ -22,7 +22,9 @@ 'use strict'; | ||
function transform(source) { | ||
function transform(source, _plugins) { | ||
let plugins = _plugins || [ | ||
[GlimmerInlinePrecompile, { precompile: input => JSON.stringify(input.toUpperCase()) }], | ||
]; | ||
let result = babel.transform(source, { | ||
plugins: [ | ||
[GlimmerInlinePrecompile, { precompile: input => JSON.stringify(input.toUpperCase()) }], | ||
], | ||
plugins, | ||
}); | ||
@@ -65,2 +67,10 @@ | ||
}); | ||
QUnit.test('allows configuring import path to replace', assert => { | ||
let actual = transform(`import hbs from 'herpy/derpy/doo'; let template = hbs\`{{hello}}\`;`, [ | ||
[GlimmerInlinePrecompile, { importPath: 'herpy/derpy/doo', precompile: input => JSON.stringify(input.toUpperCase()) }], | ||
]); | ||
assert.equal(actual, `let template = "{{HELLO}}";`); | ||
}); | ||
}); | ||
@@ -67,0 +77,0 @@ |
11284
276