From 55149353d44f5e67757d358e2fe8af6c655d4efb Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 14 May 2013 13:55:06 +0200 Subject: [PATCH] fixed little bug --- lib/NodeStuffPlugin.js | 2 +- lib/NodeStuffRealPathsPlugin.js | 31 ------------------------------- package.json | 2 +- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 lib/NodeStuffRealPathsPlugin.js diff --git a/lib/NodeStuffPlugin.js b/lib/NodeStuffPlugin.js index 5208bed4b..6bd446bd6 100644 --- a/lib/NodeStuffPlugin.js +++ b/lib/NodeStuffPlugin.js @@ -16,7 +16,7 @@ module.exports = NodeStuffPlugin; NodeStuffPlugin.prototype.apply = function(compiler) { function ignore() { return true; } var context = this.context; - if(this.options.__filename) { + if(this.options.__filename == "mock") { compiler.parser.plugin("expression __filename", function(expr) { this.state.current.addVariable("__filename", JSON.stringify("/index.js")); return true; diff --git a/lib/NodeStuffRealPathsPlugin.js b/lib/NodeStuffRealPathsPlugin.js deleted file mode 100644 index 9303d23d6..000000000 --- a/lib/NodeStuffRealPathsPlugin.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var path = require("path"); - -function NodeStuffRealPathsPlugin(context, onlyIfInContext) { - this.context = context; - this.onlyIfInContext = onlyIfInContext; -} -module.exports = NodeStuffRealPathsPlugin; -NodeStuffRealPathsPlugin.prototype.apply = function(compiler) { - var context = this.context; - var onlyIfInContext = this.onlyIfInContext; - compiler.parser.plugin("expression __filename", function(expr) { - if(!this.state.module) return; - if(onlyIfInContext && this.state.module.resource.indexOf(context) != 0) return; - this.state.current.addVariable("__filename", JSON.stringify( - context ? path.relative(context, this.state.module.resource) : this.state.module.resource - )); - return true; - }); - compiler.parser.plugin("expression __dirname", function(expr) { - if(!this.state.module) return; - if(onlyIfInContext && this.state.module.context.indexOf(context) != 0) return; - this.state.current.addVariable("__dirname", JSON.stringify( - context ? path.relative(context, this.state.module.context) : this.state.module.context - )); - return true; - }); -}; \ No newline at end of file diff --git a/package.json b/package.json index bfd550734..24d59a80f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "0.10.0-beta13", + "version": "0.10.0-beta14", "author": "Tobias Koppers @sokra", "description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.", "dependencies": {