infuse
Advanced tools
Comparing version 0.0.17 to 0.0.18
var FS = require("fs"), | ||
Path = require("path"), | ||
existsSync = FS.existsSync || Path.existsSync, | ||
resolve = require("resolve"), | ||
infuse = require("./infuse"), | ||
@@ -87,3 +89,3 @@ isArray = Array.isArray, | ||
else { | ||
outExists = Path.existsSync(outFile); | ||
outExists = existsSync(outFile); | ||
outIsDir = outExists && FS.statSync(outFile).isDirectory(); | ||
@@ -93,3 +95,3 @@ } | ||
if (inFile) { | ||
if (!Path.existsSync(inFile)) { | ||
if (!existsSync(inFile)) { | ||
throw new Error("Can not read from '" + inFile + "'. Path does not exist."); | ||
@@ -132,7 +134,3 @@ } | ||
modules.forEach(function (name) { | ||
var mod; | ||
name = name.indexOf(".") === 0 ? | ||
Path.join(process.cwd(), name) : | ||
name; | ||
mod = require(name); | ||
var mod = require(resolve.sync(name, { basedir: process.cwd() })); | ||
Object.keys(mod).forEach(function (k) { | ||
@@ -139,0 +137,0 @@ definitions[k] = mod[k]; |
@@ -7,2 +7,3 @@ | ||
Path = require("path"), | ||
existsSync = FS.existsSync || Path.existsSync, | ||
Iterator = require("./iterator"), | ||
@@ -52,3 +53,3 @@ Infusions = require("./infusions"), | ||
if (!isSrc && Path.existsSync(path)) { | ||
if (!isSrc && existsSync(path)) { | ||
this.filepath = Path.resolve(path); | ||
@@ -55,0 +56,0 @@ src = this.source = FS.readFileSync(this.filepath, "utf8"); |
@@ -67,3 +67,3 @@ | ||
string: "-d, --define-module NAME", | ||
help: "Will load the NAMEd module (as per require()) and 'define' all exported properties. NOTE: if you are requiring a path relative to the current working directory, be sure to start your path with a './', just as you would for a node require statement. Can be specified multiple times.", | ||
help: "Will load the NAMEd module (as per require()) and 'define' all exported properties. Can be specified multiple times.", | ||
list: true | ||
@@ -70,0 +70,0 @@ }, |
{ | ||
"name": "infuse", | ||
"description": "Mainline your node JavaScript for universal consumption.", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "javascript", |
@@ -31,3 +31,3 @@ Infuse | ||
usage: infuse INPUT_PATH OUTPUT_PATH [options] | ||
Usage: infuse INPUT_PATH OUTPUT_PATH [options] | ||
@@ -37,3 +37,3 @@ INPUT_PATH File or directory to read. | ||
options: | ||
Options: | ||
-N, --no-minify Do not minify the output. Essentially, set `beautify` for | ||
@@ -46,6 +46,3 @@ the UglifyJS output. | ||
-d, --define-module NAME Will load the NAMEd module (as per require()) and 'define' | ||
all exported properties. NOTE: if you are requiring a path | ||
relative to the current working directory, be sure to start | ||
your path with a './', just as you would for a node require | ||
statement. Can be specified multiple times. | ||
all exported properties. Can be specified multiple times. | ||
-E, --embed Embed the infused modules as strings in the final output, | ||
@@ -72,2 +69,3 @@ and lazy-evaluate them when required. | ||
will be infused and combined into OUTPUT_PATH (as '-i, --infuse'). | ||
~~~ | ||
@@ -74,0 +72,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
54661
1106
290