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

broccoli-ember-preparse

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-ember-preparse - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

10

index.js
var DefineRewriter = require('./lib/define-rewriter/src/index');
var merge = require('broccoli-merge-trees');
var removeFile = require('broccoli-file-remover');
module.exports = function(distNode, loaderNode, options) {
var input = merge([distNode, loaderNode])
var node = new DefineRewriter(input, options);
return removeFile(node, {
path: 'loader'
});
module.exports = function(input, options) {
return new DefineRewriter(input, options);
}
module.exports.DefineRewriter = DefineRewriter;

16

lib/define-rewriter/src/index.js

@@ -16,2 +16,3 @@ 'use strict';

var DEFAULT_GLIMMER_EAGER = [
'glimmer-reference/index',
'ember-glimmer/components/checkbox',

@@ -58,3 +59,8 @@ 'ember-glimmer/components/link-to',

function isEmptyModule(node) {
return node.functionExpression.body.body.length === 0;
if (node.functionExpression.body.body.length === 0 &&
node.deps.length === 1 &&
node.deps[0] === 'exports') {
return true
}
return false;
}

@@ -101,3 +107,2 @@

}
this.loaderDeferred = RSVP.defer();
Filter.call(this, Array.isArray(inputNode) ? inputNode : [ inputNode ], options);

@@ -117,8 +122,3 @@ }

// If given
return this.loaderDeferred.promise.then(function(loader) {
return processEmber(string, relativePath, this.eagerLoad, loader, this.moduleFilter);
}.bind(this));
} else if (relativePath.indexOf('loader') > -1) {
// If given file is the loader, read and save in deferred for use by preparse
this.loaderDeferred.resolve(string);
return processEmber(string, relativePath, this.eagerLoad, this.moduleFilter);
}

@@ -125,0 +125,0 @@ return string;

var graphlib = require('graphlib');
var amdNameResolver = require('amd-name-resolver');
var amdNameResolver = require('amd-name-resolver').moduleResolve;
var NameSet = require('./name_set');

@@ -4,0 +4,0 @@ var ModuleNode = require('./module_node');

@@ -8,3 +8,3 @@ var babylon = require('babylon');

module.exports = function processEmber(string, relativePath, eagerLoadList, loader, moduleFilter) {
module.exports = function processEmber(string, relativePath, eagerLoadList, moduleFilter) {
var ast = babylon.parse(string);

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

buffer.push('Em._eager = ' + JSON.stringify(graph.eagerSet.names) + ';');
buffer.push(generateLoader(loader));
buffer.push(generateLoader());

@@ -83,0 +83,0 @@ function pushLines(lines) {

@@ -26,2 +26,5 @@ (function() {

_define: function define(name, deps, callback) {
if (this.registry[name]) {
return;
}
this.registry[name] = {

@@ -35,4 +38,4 @@ deps: deps,

},
_require: function require(name, referrerName) {
var exports = this.seen[name];
_require: function require(_name, referrerName) {
var exports = this.seen[_name];
if (exports !== undefined) {

@@ -42,8 +45,10 @@ return exports;

exports = this.seen[name] = { default: undefined };
var mod = this.registry[name];
var name = _name;
var mod = this.registry[_name];
if (!mod) {
name = name + '/index';
name = _name + '/index';
exports = this.seen[name];
if (exports !== undefined) {
return exports;
}
mod = registry[name];

@@ -54,8 +59,12 @@ }

if (referrerName) {
throw new Error('Could not find module ' + name + ' required by: ' + referrerName);
throw new Error('Could not find module ' + _name + ' required by: ' + referrerName);
} else {
throw new Error('Could not find module ' + name);
throw new Error('Could not find module ' + _name);
}
}
console.log(name);
this.seen[name] = exports = { default: undefined };
var deps = mod.deps;

@@ -81,3 +90,4 @@ var reified = new Array(deps.length);

loader.require.has = function(name) {
return !!loader.registry[name];
var registry = loader.registry;
return !!registry[name] || !!registry[name + '/index'];
};

@@ -84,0 +94,0 @@

{
"name": "broccoli-ember-preparse",
"version": "0.0.3",
"version": "0.0.4",
"description": "Broccoli plugin that applies some compile time performance optimizations to an ember build. ",

@@ -25,12 +25,9 @@ "main": "index.js",

"dependencies": {
"amd-name-resolver": "0.0.2",
"amd-name-resolver": "0.0.5",
"babel-traverse": "^6.5.0",
"babylon": "^6.5.0",
"broccoli-caching-writer": "^2.2.1",
"broccoli-file-remover": "^0.3.1",
"broccoli-merge-trees": "^1.1.1",
"falafel": "^1.2.0",
"broccoli-caching-writer": "^3.0.0",
"graphlib": "^2.0.0",
"rsvp": "^3.2.0",
"walk-sync": "^0.2.6"
"walk-sync": "^0.3.0"
},

@@ -37,0 +34,0 @@ "devDependencies": {

@@ -11,7 +11,10 @@ # broccoli-ember-preparse

``` javascript
var emberPreparse = require('broccoli-ember-preparse');
var preparse = require('broccoli-ember-preparse');
var Funnel = require('broccoli-funnel');
// distTree must include the ember.debug.js and ember.prod.js files
// loaderPackageTree must include ember's loader package
var newDistTree = emberPreparse(distTree, loaderPackageTree);
var bowerDist = new Funnel('bower_components/ember', {
exclude: ['.bower.json']
});
var options = {};
var newDist = preparse(bowerDist, options);
```
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