Comparing version 0.5.8 to 0.5.10
@@ -27,8 +27,19 @@ /* | ||
// try to load all loaders | ||
// TODO this doesn't reload the loader if it has changed | ||
// TODO to support watch mode better, fix that | ||
loaderFunctions = []; | ||
try { | ||
loaders.forEach(function(name) { | ||
var loader = require(name); | ||
var loaderFilename = require.resolve(name); | ||
options.events.emit("loader", loaderFilename); | ||
// require loader in fresh context | ||
var oldCache = {}; | ||
for(var entry in require.cache) { | ||
oldCache[entry] = require.cache[entry]; | ||
delete require.cache[entry]; | ||
} | ||
var loader = require(loaderFilename); | ||
for(var entry in oldCache) { | ||
require.cache[entry] = oldCache[entry]; | ||
} | ||
loaderFunctions.push(loader); | ||
@@ -35,0 +46,0 @@ }); |
@@ -57,3 +57,3 @@ /* | ||
case "async context": | ||
buf.push(" "+c("\033[35ma")+"sync context from " + compressFilename(reason.filename) + c("\033[39m")); | ||
buf.push(" "+c("\033[35ma")+"async context from " + compressFilename(reason.filename) + c("\033[39m")); | ||
break; | ||
@@ -60,0 +60,0 @@ default: |
@@ -206,2 +206,15 @@ /* | ||
// on before a loader is read | ||
options.events.on("loader", function(filename) { | ||
if(!filename) return; | ||
watchers.push(fs.watch(filename, function() { | ||
change(); | ||
})); | ||
}); | ||
// on user defines the bundle as invalid | ||
options.events.on("invalid", function() { | ||
change(); | ||
}); | ||
// on bundle finished compiling | ||
@@ -208,0 +221,0 @@ options.events.on("bundle", function(stats) { |
{ | ||
"name": "webpack", | ||
"version": "0.5.8", | ||
"version": "0.5.10", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -32,3 +32,6 @@ "description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.", | ||
"mocha": "*", | ||
"should": "*" | ||
"should": "*", | ||
"vm-browserify": "*", | ||
"express": "*", | ||
"webpack-dev-middleware": "0.5.x" | ||
}, | ||
@@ -35,0 +38,0 @@ "engines": { |
@@ -26,31 +26,19 @@ /* | ||
try { | ||
require("vm-browserify"); | ||
compile(); | ||
} catch(e) { | ||
console.log("install vm-browserify..."); | ||
cp.exec("npm install vm-browserify", function (error, stdout, stderr) { | ||
console.log(stdout); | ||
compile(); | ||
}); | ||
} | ||
function compile() { | ||
console.log("compile scripts..."); | ||
console.log("compile scripts..."); | ||
var extraArgsNoWatch = extraArgs.slice(0); | ||
var watchIndex = extraArgsNoWatch.indexOf("--watch"); | ||
if(watchIndex != -1) extraArgsNoWatch.splice(watchIndex, 1); | ||
var libary1 = cp.spawn("node", join(["../../bin/webpack.js", "--colors", "--single", "--libary", "libary1", | ||
"node_modules/libary1", "js/libary1.js"], extraArgsNoWatch)); | ||
bindOutput(libary1); | ||
libary1.on("exit", function(code) { | ||
if(code === 0) { | ||
var main = cp.spawn("node", join(["../../bin/webpack.js", "--colors", "--alias", "vm=vm-browserify", | ||
"--public-prefix", "js/", "lib/index", "js/web.js"], extraArgs)); | ||
bindOutput(main); | ||
} | ||
}); | ||
var libary2 = cp.spawn("node", join(["../../bin/webpack.js", "--colors", "--libary", "libary2", | ||
"--script-src-prefix", "js/", "--options", "libary2config.js", "node_modules/libary2", "js/libary2.js"], extraArgs)); | ||
bindOutput(libary2); | ||
} | ||
var extraArgsNoWatch = extraArgs.slice(0); | ||
var watchIndex = extraArgsNoWatch.indexOf("--watch"); | ||
if(watchIndex != -1) extraArgsNoWatch.splice(watchIndex, 1); | ||
var libary1 = cp.spawn("node", join(["../../bin/webpack.js", "--colors", "--single", "--libary", "libary1", | ||
"node_modules/libary1", "js/libary1.js"], extraArgsNoWatch)); | ||
bindOutput(libary1); | ||
libary1.on("exit", function(code) { | ||
if(code === 0) { | ||
var main = cp.spawn("node", join(["../../bin/webpack.js", "--colors", "--alias", "vm=vm-browserify", | ||
"--public-prefix", "js/", "lib/index", "js/web.js"], extraArgs)); | ||
bindOutput(main); | ||
} | ||
}); | ||
var libary2 = cp.spawn("node", join(["../../bin/webpack.js", "--colors", "--libary", "libary2", | ||
"--script-src-prefix", "js/", "--options", "libary2config.js", "node_modules/libary2", "js/libary2.js"], extraArgs)); | ||
bindOutput(libary2); |
@@ -140,3 +140,3 @@ // Should not break it... should not include complete directory... | ||
// file loader | ||
window.test(require("file/png!../img/image.png").indexOf("js/") === 0, "Buildin 'file' loader, png"); | ||
window.test(require("file/png!../img/image.png").indexOf("js/") >= 0, "Buildin 'file' loader, png"); | ||
setTimeout(function() { | ||
@@ -143,0 +143,0 @@ document.getElementById("image").src = require("file/png!../img/image.png"); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
0
58
334638
5
112
9082