Socket
Socket
Sign inDemoInstall

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.8.12 to 0.8.13

21

lib/commoner.js

@@ -28,2 +28,3 @@ var assert = require("assert");

customVersion: { value: null, writable: true },
customOptions: { value: [] },
resolvers: { value: [] },

@@ -41,2 +42,8 @@ processors: { value: [] }

// Add custom command line options
Cp.option = function() {
this.customOptions.push(Ap.slice.call(arguments));
return this; // For chaining.
};
// A resolver is a function that takes a module identifier and returns

@@ -66,3 +73,3 @@ // the unmodified source of the corresponding module, either as a string

Cp.buildP = function(config, sourceDir, outputDir, roots) {
Cp.buildP = function(config, options, sourceDir, outputDir, roots) {
var self = this;

@@ -107,3 +114,3 @@ var readFileCache = new ReadFileCache(sourceDir);

var context = new BuildContext(config, readFileCache);
var context = new BuildContext(config, options, readFileCache);

@@ -221,5 +228,10 @@ if (self.preferredFileExtension)

.option("--cache-dir <directory>", "Alternate directory to use for disk cache")
.option("--no-cache-dir", "Disable the disk cache")
.parse(process.argv.slice(0));
.option("--no-cache-dir", "Disable the disk cache");
commoner.customOptions.forEach(function(customOption) {
options.option.apply(options, customOption);
});
options.parse(process.argv.slice(0));
var pfe = new PreferredFileExtension(options.extension || "js");

@@ -306,2 +318,3 @@

}),
options,
sourceDir,

@@ -308,0 +321,0 @@ outputDir,

3

lib/context.js

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

function BuildContext(config, readFileCache) {
function BuildContext(config, options, readFileCache) {
var self = this;

@@ -23,2 +23,3 @@ assert.ok(self instanceof BuildContext);

config: { value: config },
options: { value: options },
configHash: { value: util.deepHash(config) }

@@ -25,0 +26,0 @@ });

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

],
"version": "0.8.12",
"version": "0.8.13",
"license": "MIT",

@@ -20,0 +20,0 @@ "homepage": "http://github.com/benjamn/commoner",

@@ -303,1 +303,20 @@ Commoner [![Build Status](https://travis-ci.org/benjamn/commoner.png?branch=master)](https://travis-ci.org/benjamn/commoner)

have distinct hashes if built using different configuration objects.
Custom Options
---
You can define custom options for your script by using the `option` function.
```js
require("commoner").resolve(function(id) {
return this.readModule(id);
}).option(
'--custom-option',
'This is a custom option.'
).process(function(id, source) {
this.options.customOption // Access the option
return …;
});
```
For more information of the options object available inside the `process` function see [Commander](https://github.com/visionmedia/commander.js).

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

debug: true
}, new ReadFileCache(sourceDir));
}, null, new ReadFileCache(sourceDir));
var releaseContext = new BuildContext({
debug: false
}, new ReadFileCache(sourceDir));
}, null, new ReadFileCache(sourceDir));

@@ -31,0 +31,0 @@ debugContext.setCacheDirectory(path.join(

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