babel-plugin-htmlbars-inline-precompile
Advanced tools
Comparing version 4.4.6 to 5.0.0
@@ -67,2 +67,20 @@ 'use strict'; | ||
it('supports compilation with templateCompilerPath', function () { | ||
plugins[0][1].templateCompilerPath = require.resolve('./mock-precompile'); | ||
let transpiled = transform( | ||
"import hbs from 'htmlbars-inline-precompile';\nvar compiled = hbs`hello`;" | ||
); | ||
expect(transpiled).toMatchInlineSnapshot(` | ||
"import { createTemplateFactory as _createTemplateFactory } from \\"@ember/template-factory\\"; | ||
var compiled = _createTemplateFactory( | ||
/* | ||
hello | ||
*/ | ||
precompiledFromPath(hello));" | ||
`); | ||
}); | ||
it('does not error when transpiling multiple modules with a single plugin config', function () { | ||
@@ -826,3 +844,3 @@ let transpiled = transform( | ||
contents: source, | ||
scope: ['foo', 'bar'], | ||
locals: ['foo', 'bar'], | ||
}); | ||
@@ -829,0 +847,0 @@ }); |
@@ -0,1 +1,13 @@ | ||
## v5.0.0 (2021-03-17) | ||
#### :boom: Breaking Change | ||
* [#358](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/358) Rename `scope` to `locals` for strict mode transpilation ([@pzuraq](https://github.com/pzuraq)) | ||
#### :rocket: Enhancement | ||
* [#358](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/358) Adds a `templateCompilerPath` option ([@pzuraq](https://github.com/pzuraq)) | ||
#### Committers: 1 | ||
- Chris Garrett ([@pzuraq](https://github.com/pzuraq)) | ||
## v4.4.6 (2021-03-17) | ||
@@ -2,0 +14,0 @@ |
22
index.js
@@ -69,11 +69,7 @@ 'use strict'; | ||
let value; | ||
if (shouldParseScope && propertyName === 'scope') { | ||
value = parseScopeObject(buildError, name, property.value); | ||
result.locals = parseScopeObject(buildError, name, property.value); | ||
} else { | ||
value = parseExpression(buildError, name, property.value); | ||
result[propertyName] = parseExpression(buildError, name, property.value); | ||
} | ||
result[propertyName] = value; | ||
}); | ||
@@ -173,2 +169,4 @@ | ||
let precompile; | ||
let visitor = { | ||
@@ -179,2 +177,10 @@ Program(path, state) { | ||
if (state.opts.templateCompilerPath) { | ||
let templateCompiler = require(state.opts.templateCompilerPath); | ||
precompile = templateCompiler.precompile; | ||
} else { | ||
precompile = state.opts.precompile; | ||
} | ||
if (state.opts.ensureModuleApiPolyfill) { | ||
@@ -382,3 +388,3 @@ // Setup state for the module API polyfill | ||
let { precompile, isProduction } = state.opts; | ||
let { isProduction } = state.opts; | ||
let scope = shouldUseAutomaticScope(options) ? getScope(path.scope) : null; | ||
@@ -466,3 +472,3 @@ let strictMode = shouldUseStrictMode(options); | ||
let { precompile, isProduction } = state.opts; | ||
let { isProduction } = state.opts; | ||
@@ -469,0 +475,0 @@ // allow the user specified value to "win" over ours |
{ | ||
"name": "babel-plugin-htmlbars-inline-precompile", | ||
"version": "4.4.6", | ||
"version": "5.0.0", | ||
"description": "Babel plugin to replace tagged template strings with precompiled HTMLBars templates", | ||
@@ -12,2 +12,7 @@ "repository": "https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile", | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
"mock-precompile" | ||
] | ||
}, | ||
"dependencies": { | ||
@@ -14,0 +19,0 @@ "babel-plugin-ember-modules-api-polyfill": "^3.4.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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
105393
15
2282
2