babel-plugin-htmlbars-inline-precompile
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -69,2 +69,76 @@ 'use strict'; | ||
it('passes through isProduction option when used as a call expression', function () { | ||
let source = 'hello'; | ||
plugins = [ | ||
[ | ||
HTMLBarsInlinePrecompile, | ||
{ | ||
precompile() { | ||
return precompile.apply(this, arguments); | ||
}, | ||
isProduction: true, | ||
}, | ||
], | ||
]; | ||
transform(`import hbs from 'htmlbars-inline-precompile';\nvar compiled = hbs('${source}');`); | ||
expect(optionsReceived).toEqual({ | ||
contents: source, | ||
isProduction: true, | ||
}); | ||
}); | ||
it('uses the user provided isProduction option if present', function () { | ||
let source = 'hello'; | ||
plugins = [ | ||
[ | ||
HTMLBarsInlinePrecompile, | ||
{ | ||
precompile() { | ||
return precompile.apply(this, arguments); | ||
}, | ||
isProduction: false, | ||
}, | ||
], | ||
]; | ||
transform( | ||
`import hbs from 'htmlbars-inline-precompile';\nvar compiled = hbs('${source}', { isProduction: true });` | ||
); | ||
expect(optionsReceived).toEqual({ | ||
contents: source, | ||
isProduction: true, | ||
}); | ||
}); | ||
it('passes through isProduction option when used as a TaggedTemplateExpression', function () { | ||
let source = 'hello'; | ||
plugins = [ | ||
[ | ||
HTMLBarsInlinePrecompile, | ||
{ | ||
precompile() { | ||
return precompile.apply(this, arguments); | ||
}, | ||
isProduction: true, | ||
}, | ||
], | ||
]; | ||
transform(`import hbs from 'htmlbars-inline-precompile';\nvar compiled = hbs\`${source}\`;`); | ||
expect(optionsReceived).toEqual({ | ||
contents: source, | ||
isProduction: true, | ||
}); | ||
}); | ||
it('allows a template string literal when used as a call expression', function () { | ||
@@ -71,0 +145,0 @@ let source = 'hello'; |
@@ -0,1 +1,11 @@ | ||
## v4.2.0 (2020-08-10) | ||
#### :rocket: Enhancement | ||
* [#251](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/251) [FEAT] Adds isProduction flag ([@pzuraq](https://github.com/pzuraq)) | ||
#### Committers: 2 | ||
- Chris Garrett ([@pzuraq](https://github.com/pzuraq)) | ||
- Robert Jackson ([@rwjblue](https://github.com/rwjblue)) | ||
## v4.1.0 (2020-05-07) | ||
@@ -2,0 +12,0 @@ |
12
index.js
@@ -156,3 +156,5 @@ 'use strict'; | ||
path.replaceWith(compileTemplate(state.opts.precompile, template)); | ||
let { precompile, isProduction } = state.opts; | ||
path.replaceWith(compileTemplate(precompile, template, { isProduction })); | ||
}, | ||
@@ -199,2 +201,3 @@ | ||
case 1: | ||
options = {}; | ||
break; | ||
@@ -218,4 +221,9 @@ case 2: { | ||
let { precompile } = state.opts; | ||
let { precompile, isProduction } = state.opts; | ||
// allow the user specified value to "win" over ours | ||
if (!('isProduction' in options)) { | ||
options.isProduction = isProduction; | ||
} | ||
path.replaceWith(compileTemplate(precompile, template, options)); | ||
@@ -222,0 +230,0 @@ }, |
{ | ||
"name": "babel-plugin-htmlbars-inline-precompile", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Babel plugin to replace tagged template strings with precompiled HTMLBars templates", | ||
@@ -13,14 +13,14 @@ "repository": "https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.6", | ||
"@babel/plugin-transform-modules-amd": "^7.9.6", | ||
"@babel/plugin-transform-template-literals": "^7.8.3", | ||
"@babel/core": "^7.11.1", | ||
"@babel/plugin-transform-modules-amd": "^7.10.5", | ||
"@babel/plugin-transform-template-literals": "^7.10.5", | ||
"common-tags": "^1.8.0", | ||
"ember-source": "^3.18.1", | ||
"ember-source": "^3.20.3", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"jest": "^26.0.1", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.2.2", | ||
"prettier": "^2.0.5", | ||
"release-it": "^13.5.7", | ||
"release-it": "^13.6.6", | ||
"release-it-lerna-changelog": "^2.3.0" | ||
@@ -27,0 +27,0 @@ }, |
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
43069
593