Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-ractive

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-ractive - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

79

index.js

@@ -63,2 +63,8 @@ var Promise = require( 'es6-promise' ).Promise,

}
this.type = this.type || 'amd';
if ( !builders[ this.type ] ) {
throw new Error( 'Supported options for the "type" option are ' + Object.keys( builders ).join( ', ' ) );
}
};

@@ -80,3 +86,3 @@

cleanup: function () {
quickTemp.remove(this, 'ractive-compiler')
quickTemp.remove( this, 'ractive-compiler' );
},

@@ -124,8 +130,10 @@

return readFile( componentPath ).then( function ( result ) {
var source, parsed, built;
var source, parsed, builder, built;
source = result.toString();
parsed = rcu.parse( source );
built = builders.amd( parsed );
builder = builders[ self.type ];
built = builder( parsed );
return built;

@@ -137,9 +145,4 @@ });

builders.amd = function ( definition, imported ) {
var builtModule = '' +
'define([' +
definition.imports.map( getImportPath ).concat( '"require"', '"ractive"' ).join( ',\n' ) +
'], function(' +
definition.imports.map( getImportName ).concat( 'require', 'Ractive' ).join( ',\n' ) +
'){\n' +
createBody = function ( definition ) {
var body = '' +
'var __options__ = {\n' +

@@ -153,6 +156,7 @@ ' template: ' + tosource( definition.template ) + ',\n' +

'component={},\n' +
'__prop__;';
'__prop__,\n' +
'__export__;';
if ( definition.script ) {
builtModule += '\n' + definition.script + '\n' +
body += '\n' + definition.script + '\n' +
' if ( typeof component.exports === "object" ) {\n ' +

@@ -167,14 +171,5 @@ 'for ( __prop__ in component.exports ) {\n ' +

builtModule += 'return Ractive.extend(__options__);\n});';
return builtModule;
body += '__export__ = Ractive.extend( __options__ );\n';
return body;
function getImportPath ( imported ) {
return '\t"' + imported.href.replace( fileExtension, '' ) + '"';
}
function getImportName ( imported, i ) {
return '\t__import' + i + '__';
}
function getImportKeyValuePair ( imported, i ) {

@@ -193,3 +188,41 @@ return '\t' + stringify( imported.name ) + ': __import' + i + '__';

builders.amd = function ( definition ) {
var builtModule = '' +
'define([' +
definition.imports.map( getImportPath ).concat( '"require"', '"ractive"' ).join( ',\n' ) +
'], function(' +
definition.imports.map( getImportName ).concat( 'require', 'Ractive' ).join( ',\n' ) +
'){\n' +
createBody( definition ) +
'return __export__;';
return builtModule;
function getImportPath ( imported ) {
return '\t"' + imported.href.replace( fileExtension, '' ) + '"';
}
function getImportName ( imported, i ) {
return '\t__import' + i + '__';
}
};
builders.cjs = function ( definition ) {
var requireStatements, builtModule;
requireStatements = definition.imports.map( function ( imported, i ) {
return '__import' + i + '__ = require(\'' + imported.href + '\')';
});
requireStatements.unshift( 'Ractive = require(\'ractive\')' );
builtModule = 'var ' + requireStatements.join( ',\n\t' ) + ';\n\n' +
createBody( definition ) +
'module.exports = __export__;';
return builtModule;
};
module.exports = RactiveCompiler;
{
"name": "broccoli-ractive",
"version": "0.1.2",
"version": "0.1.3",
"author": "Rich-Harris",

@@ -5,0 +5,0 @@ "main": "index.js",

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