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

strider-extension-loader

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strider-extension-loader - npm Package Compare versions

Comparing version 0.0.2 to 0.0.4

22

main.js

@@ -13,5 +13,4 @@ //

//
// Under a specified path **dir** [by default, process.cwd()/node_modules] look
// for directories containing file 'strider.json'. These are considered
// Strider modules.
// Under a specified path **dir** look for directories containing file
// 'strider.json'. These are considered Strider modules.
//

@@ -23,5 +22,2 @@ // **cb** is a function of signature cb(err, extensions) where extensions is an

// XXX May not be sane default when installed globally
var dir = dir || path.join(process.cwd(), "node_modules");
var filename = "strider.json";

@@ -95,10 +91,14 @@

}
// Build require'able path to extension sources
var extension = {
webapp: require(path.resolve(path.join(moduleDir,
extensionConfig.webapp))),
worker: require(path.resolve(path.join(moduleDir,
extensionConfig.worker))),
package: packageConfig
};
if (extensionConfig.webapp) {
var webapp = extensionConfig.webapp;
extension.webapp = require(path.resolve(path.join(moduleDir, webapp)));
}
if (extensionConfig.worker) {
var worker = extensionConfig.worker;
extension.worker = require(path.resolve(path.join(moduleDir, worker)));
}
// Build require'able path to extension sources

@@ -105,0 +105,0 @@ cb(null, extension);

{
"name": "strider-extension-loader",
"version": "0.0.2",
"version": "0.0.4",
"description": "Load Strider extensions",

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

@@ -82,2 +82,4 @@ var exec = require('child_process').exec,

mkpath("./node_modules_ext/foobar-strider");
mkpath("./node_modules_ext/foobar-strider-worker");
mkpath("./node_modules_ext/foobar-strider-webapp");
var strider_json = {

@@ -91,3 +93,15 @@ webapp: "webapp.js",

fs.writeFileSync("./node_modules_ext/foobar-strider/package.json", fs.readFileSync("package.json"));
var strider_json = {
webapp: "webapp.js",
};
fs.writeFileSync("./node_modules_ext/foobar-strider-webapp/webapp.js", "exports.ok = function() { return true; };\n");
fs.writeFileSync("./node_modules_ext/foobar-strider-webapp/strider.json", JSON.stringify(strider_json));
fs.writeFileSync("./node_modules_ext/foobar-strider-webapp/package.json", fs.readFileSync("package.json"));
var strider_json = {
worker: "worker.js",
};
fs.writeFileSync("./node_modules_ext/foobar-strider-worker/worker.js", "exports.ok = function() { return true; };\n");
fs.writeFileSync("./node_modules_ext/foobar-strider-worker/strider.json", JSON.stringify(strider_json));
fs.writeFileSync("./node_modules_ext/foobar-strider-worker/package.json", fs.readFileSync("package.json"));

@@ -125,2 +139,26 @@ });

it("should load worker-only extensions", function(done) {
loader.loadExtension("./node_modules_ext/foobar-strider-worker/", function(err, extension) {
expect(err).not.to.exist;
expect(extension).to.exist;
expect(extension.webapp).not.to.exist;
expect(extension.worker.ok()).to.be.true;
expect(extension.package.name).to.eql("strider-extension-loader");
done();
});
});
it("should load webapp-only extensions", function(done) {
loader.loadExtension("./node_modules_ext/foobar-strider-webapp/", function(err, extension) {
expect(err).not.to.exist;
expect(extension).to.exist;
expect(extension.worker).not.to.exist;
expect(extension.webapp.ok()).to.be.true;
expect(extension.package.name).to.eql("strider-extension-loader");
done();
});
});
after(function(done) {

@@ -127,0 +165,0 @@ exec("rm -rf node_modules_ext", function() {

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