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

commoner

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commoner - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

lib/relative.js

3

lib/reader.js

@@ -35,3 +35,4 @@ var assert = require("assert");

resolvers = hashCallbacks("resolvers", resolvers, warnMissingModule);
processors = hashCallbacks("processors", processors);
processors = hashCallbacks(
"processors", processors, require("./relative").relativizeP);

@@ -38,0 +39,0 @@ Object.defineProperties(self, {

@@ -17,3 +17,3 @@ {

],
"version": "0.5.3",
"version": "0.5.4",
"homepage": "http://github.com/benjamn/commoner",

@@ -33,2 +33,3 @@ "repository": {

"q": ">= 0.9.1",
"recast": ">= 0.3.3",
"commander": ">= 1.1.1",

@@ -35,0 +36,0 @@ "mkdirp": ">= 0.3.5",

@@ -18,6 +18,13 @@ Commoner

static file server, or bundled together using a tool such as
[Browserify](https://github.com/substack/node-browserify) or
[Browserify](https://github.com/substack/node-browserify),
[WrapUp](https://github.com/kamicane/wrapup), or
[Stitch](https://github.com/sstephenson/stitch) for delivery to a web
browser.
Commoner also takes care to rewrite all `require` calls to use relative
module identifiers, so that the output files can be installed into any
subdirectory of a larger project, and external tools do not have to give
special treatment to top-level modules (or even know which modules are
top-level and which are nested).
Commoner was derived from an earlier, more opinionated tool called

@@ -24,0 +31,0 @@ [Brigade](https://github.com/benjamn/brigade) that provided additional

@@ -44,3 +44,3 @@ var Watcher = require("../lib/watcher").Watcher;

assert.notEqual(home.source.indexOf("exports"), -1);
assert.strictEqual(home.source.indexOf('require("assert");'), 0);
assert.strictEqual(home.source.indexOf('require("./assert");'), 0);
return home;

@@ -149,1 +149,39 @@ }).invoke("getRequiredP").then(function(reqs) {

};
exports.testRelativize = function(t, assert) {
var relativizeP = require("../lib/relative").relativizeP;
function helperP(requiredId, expected) {
return relativizeP(
"some/deeply/nested/module",
"require(" + JSON.stringify(requiredId) + ")"
).then(function(source) {
assert.strictEqual(
source,
"require(" + JSON.stringify(expected) + ")"
);
});
}
Q.all([
helperP("another/nested/module",
"../../../another/nested/module"),
helperP("../../buried/module/./file",
"../../buried/module/file"),
helperP("../../buried/module/../file",
"../../buried/file"),
helperP("./same/level",
"./same/level"),
helperP("./same/./level",
"./same/level"),
helperP("./same/../level",
"./level"),
helperP("some/deeply/buried/treasure",
"../buried/treasure"),
helperP("./file", "./file"),
helperP("./file/../../../module",
"../../module"),
helperP("./file/../../module",
"../module")
]).done(t.finish.bind(t));
};
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