Socket
Socket
Sign inDemoInstall

babel-plugin-htmlbars-inline-precompile

Package Overview
Dependencies
Maintainers
3
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.0.5 to 0.1.0

22

index.js

@@ -1,3 +0,5 @@

module.exports = function(precompile) {
return function(babel) {
module.exports = function(precompile, _options) {
var options = _options || {};
function htmlbarsInlineCompilerPlugin(babel) {
var t = babel.types;

@@ -76,2 +78,18 @@

}
// used by broccoli-babel-transpiler to use this packages
// files and deps as part of the cache key (when deps or
// implementation changes it will bust the cache for already
// transpiled files)
htmlbarsInlineCompilerPlugin.baseDir = function() {
return __dirname;
};
// used by broccoli-babel-transpiler to bust the cache when
// the template compiler being used changes
htmlbarsInlineCompilerPlugin.cacheKey = function() {
return options.cacheKey;
};
return htmlbarsInlineCompilerPlugin;
};

2

package.json
{
"name": "babel-plugin-htmlbars-inline-precompile",
"version": "0.0.5",
"version": "0.1.0",
"description": "Babel plugin to replace tagged template strings with precompiled HTMLBars templates",

@@ -5,0 +5,0 @@ "scripts": {

@@ -69,3 +69,5 @@ # babel-plugin-htmlbars-inline-precompile [![Build Status](https://travis-ci.org/pangratz/babel-plugin-htmlbars-inline-precompile.svg?branch=master)](https://travis-ci.org/pangratz/babel-plugin-htmlbars-inline-precompile)

var pluginConfiguredWithCompiler = HTMLBarsInlinePrecompile(HTMLBarsCompiler.precompile);
var pluginConfiguredWithCompiler = HTMLBarsInlinePrecompile(HTMLBarsCompiler.precompile, {
cacheKey: checksumOfTemplateCompilerContents
});

@@ -76,1 +78,3 @@ require('babel').transform("code", {

```
The provided `cacheKey` option is used to invalidate the broccoli-babel-transpiler cache.
var assert = require('assert');
var path = require('path');

@@ -62,2 +63,16 @@ var babel = require('babel-core');

describe('caching', function() {
it('passes through second argument as `cacheKey`', function() {
var plugin = HTMLBarsInlinePrecompile(function() {}, { cacheKey: 'asdfasdf' });
assert.equal(plugin.cacheKey(), 'asdfasdf');
});
it('include `baseDir` function for caching', function() {
var plugin = HTMLBarsInlinePrecompile(function() {}, 'asdfasdf');
assert.equal(plugin.baseDir(), path.resolve(__dirname, '..'));
});
});
describe('single string argument', function() {

@@ -64,0 +79,0 @@ it("works with a plain string as parameter hbs('string')", function() {

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc