formatting, license

This commit is contained in:
Tobias Koppers 2012-03-11 21:50:55 +01:00
parent 14b42ac18b
commit 911517f375
15 changed files with 78 additions and 16 deletions

View File

@ -218,11 +218,13 @@ However `webpack` has big differences:
`webpack` replaces module names and paths with numbers. `webmake` don't do that and do resolves requires on client-side.
This design of `webmake` was intended to support variables as arguments to require calls.
`webpack` resolves requires in compile time and have no resolve code on client side. This results in smaller bundles.
Variables as argments will be handled different and with more limitations.
Variables as argments will be handled different and with more limitations in `webpack`.
Another limitation in `webmake` which are based on the previous one is that modules must be in the current package scope.
In `webpack` this is not a restriction.
There is no `require.context` in `webmake`. Therefore there is a forced include list in options which allows modules to be required even if the names were not available at compile time.
The design of `webmake` causes all modules with the same name to overlap.
This can be problematic if different submodules rely on specific versions of the same module.
The behaivior also differs from the behaivior of node.js, because node.js installs a module for each instance in submodules and `webmake` cause them the merge into a single module which is only installed once.
@ -232,10 +234,11 @@ But in `webpack` this can (currently) cause duplicate code if a module is used i
I want to face this issue (TODO).
`webmake` do (currently) not support Code Splitting.
But medikoo said he works at some related feature.
## Tests
You can run the unit tests which `node_modules/.bin/vows`.
You can run the unit tests with `npm test`.
You can run the browser tests:
@ -256,4 +259,4 @@ You are also welcome to correct any spelling mistakes or any language issues, be
## License
MIT
MIT (http://www.opensource.org/licenses/mit-license.php)

View File

@ -1,31 +1,35 @@
#!/usr/bin/env node
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var path = require("path");
var fs = require("fs");
var argv = require("optimist")
.usage("Usage: $0 <input> <output>")
.boolean("single")
.describe("single", "Disable Code Splitting")
.default("single", false)
.boolean("min")
.describe("min", "Minimize it with uglifyjs")
.default("min", false)
.boolean("filenames")
.describe("filenames", "Output Filenames Into File")
.default("filenames", false)
.string("options")
.describe("options", "Options JSON File")
.string("script-src-prefix")
.describe("script-src-prefix", "Path Prefix For JavaScript Loading")
.string("libary")
.describe("libary", "Stores the exports into this variable")
.demand(1)
.argv;

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var cp = require('child_process');
var argv = process.argv;

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var cp = require('child_process');
var argv = process.argv;

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var cp = require('child_process');
var argv = process.argv;

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var parse = require("./parse");
var resolve = require("./resolve");
var fs = require("fs");
@ -218,10 +222,10 @@ function addContextModule(depTree, context, contextModuleName, options, callback
extensionsAccess.push(ext.replace(/"/g, "\\\""));
extensionsAccess.push("\"]");
});
contextModule.source = "/***/module.exports = function(name) {\n" +
"/***/\tvar map = " + JSON.stringify(contextModule.requireMap) + ";\n" +
"/***/\treturn require(map[name]" + extensionsAccess.join("") + ");\n" +
contextModule.source = "/***/module.exports = function(name) {\n" +
"/***/\tvar map = " + JSON.stringify(contextModule.requireMap) + ";\n" +
"/***/\treturn require(map[name]" + extensionsAccess.join("") + ");\n" +
"/***/};";
callback(null, contextModule.id);
});

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var esprima = require("esprima");
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var path = require("path");
var fs = require("fs");

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var buildDeps = require("./buildDeps");
var path = require("path");
var writeChunk = require("./writeChunk");
@ -10,11 +14,11 @@ var templateSingle = require("fs").readFileSync(path.join(__dirname, "templateSi
webpack(context, moduleName, callback);
webpack(absoluteModulePath, options, callback);
webpack(absoluteModulePath, callback);
callback: function(err, source / stats)
source if options.output is not set
else stats json
options:
- outputJsonpFunction
JSONP function used to load chunks

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var writeSource = require("./writeSource");
module.exports = function(depTree, chunk, options) {

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function stringify(str) {
return '"' + str.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"") + '"';
}

View File

@ -8,12 +8,19 @@
"optimist": "0.2.x",
"uglify-js": "1.2.5"
},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
],
"devDependencies": {
"vows": "*"
},
"engines": {
"node": ">=0.1.30"
},
"homepage": "http://github.com/sokra/modules-webpack",
"main": "lib/webpack.js",
"bin": "./bin/webpack.js",
"scripts": {

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var cp = require('child_process');
var argv = process.argv;

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var vows = require("vows");
var assert = require("assert");
var path = require("path");

View File

@ -1,3 +1,7 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var vows = require("vows");
var assert = require("assert");
var path = require("path");