Socket
Socket
Sign inDemoInstall

babel-plugin-htmlbars-inline-precompile

Package Overview
Dependencies
Maintainers
5
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-htmlbars-inline-precompile - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

.eslintrc.js

39

CHANGELOG.md
# Change Log
## [v0.2.5](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/tree/v0.2.5) (2018-06-02)
[Full Changelog](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/compare/v0.2.4...v0.2.5)
**Implemented enhancements:**
- Pass through `content` to `precompile`. [\#37](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/37) ([rwjblue](https://github.com/rwjblue))
**Merged pull requests:**
- Update jest-runner-eslint to the latest version 🚀 [\#35](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/35) ([greenkeeper[bot]](https://github.com/apps/greenkeeper))
- Update jest-runner-eslint to the latest version 🚀 [\#34](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/34) ([greenkeeper[bot]](https://github.com/apps/greenkeeper))
- Use Jest to run ESLint checks [\#32](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/32) ([Turbo87](https://github.com/Turbo87))
- Cleanup TravisCI config [\#31](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/31) ([Turbo87](https://github.com/Turbo87))
## [v0.2.4](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/tree/v0.2.4) (2018-03-22)
[Full Changelog](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/compare/v0.1.1...v0.2.4)
**Implemented enhancements:**
- Allow `modulePaths` configuration [\#30](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/30) ([Turbo87](https://github.com/Turbo87))
**Merged pull requests:**
- Replace `mocha` with `jest` [\#29](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/29) ([Turbo87](https://github.com/Turbo87))
- Update `yarn.lock` file [\#28](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/28) ([Turbo87](https://github.com/Turbo87))
- Update mocha to the latest version 🚀 [\#27](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/27) ([greenkeeper[bot]](https://github.com/apps/greenkeeper))
- Update mocha to the latest version 🚀 [\#26](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/26) ([greenkeeper[bot]](https://github.com/apps/greenkeeper))
## [v0.1.1](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/tree/v0.1.1) (2017-07-21)
[Full Changelog](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/compare/v0.2.3...v0.1.1)
**Implemented enhancements:**
- CI: Use "auto-dist-tag" for deployment [\#24](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/24) ([Turbo87](https://github.com/Turbo87))
**Merged pull requests:**
- md5 cacheKey in v0.1.x [\#25](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/pull/25) ([hjdivad](https://github.com/hjdivad))
## [v0.2.3](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/tree/v0.2.3) (2017-03-13)

@@ -4,0 +43,0 @@ [Full Changelog](https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile/compare/v0.2.2...v0.2.3)

17

index.js

@@ -6,2 +6,12 @@ 'use strict';

function compileTemplate(precompile, template) {
let options = {
contents: template
}
let compiledTemplateString = `Ember.HTMLBars.template(${precompile(template, options)})`;
return compiledTemplateString;
}
return {

@@ -43,5 +53,4 @@ visitor: {

let template = path.node.quasi.quasis.map(quasi => quasi.value.cooked).join('');
let compiledTemplateString = `Ember.HTMLBars.template(${state.opts.precompile(template)})`;
path.replaceWithSourceString(compiledTemplateString);
path.replaceWithSourceString(compileTemplate(state.opts.precompile, template, state.file.opts.filename));
},

@@ -67,5 +76,3 @@

let compiledTemplateString = `Ember.HTMLBars.template(${state.opts.precompile(template)})`;
path.replaceWithSourceString(compiledTemplateString);
path.replaceWithSourceString(compileTemplate(state.opts.precompile, template, state.file.opts.filename));
},

@@ -72,0 +79,0 @@ }

{
"name": "babel-plugin-htmlbars-inline-precompile",
"version": "0.2.4",
"version": "0.2.5",
"description": "Babel plugin to replace tagged template strings with precompiled HTMLBars templates",

@@ -18,9 +18,12 @@ "scripts": {

"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"jest": "^21.0.0"
"eslint-plugin-node": "^6.0.1",
"jest": "^21.0.0",
"jest-runner-eslint": "^0.6.0"
},
"jest": {
"testMatch": [
"<rootDir>/tests/**/*.js"
"projects": [
"<rootDir>/jest-test.config.js",
"<rootDir>/jest-eslint.config.js"
]
}
}

@@ -11,6 +11,7 @@ 'use strict';

describe("htmlbars-inline-precompile", function() {
let plugins;
let plugins, optionsReceived;
function transform(code) {
return babel.transform(code, {
filename: 'foo-bar.js',
plugins

@@ -21,5 +22,7 @@ }).code.trim();

beforeEach(function() {
optionsReceived = undefined;
plugins = [
[HTMLBarsInlinePrecompile, {
precompile(template) {
precompile(template, options) {
optionsReceived = options;
return `precompiled(${template})`;

@@ -31,2 +34,20 @@ }

it('passes options when used as a call expression', function() {
let source = 'hello';
transform(`import hbs from 'htmlbars-inline-precompile';\nvar compiled = hbs('${source}');`);
expect(optionsReceived).toEqual({
contents: source,
});
});
it('passes options when used as a tagged template string', function() {
let source = 'hello';
transform(`import hbs from 'htmlbars-inline-precompile';\nvar compiled = hbs\`${source}\`;`);
expect(optionsReceived).toEqual({
contents: source,
});
});
it("strips import statement for 'htmlbars-inline-precompile' module", function() {

@@ -33,0 +54,0 @@ let transformed = transform("import hbs from 'htmlbars-inline-precompile';\nimport Ember from 'ember';");

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc