modulr 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +13 -15
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/assets/modulr.js +1 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -5,7 +5,19 @@ Description
|
|
5
5
|
-----------
|
6
6
|
|
7
7
|
`modulr` is a [CommonJS module implementation](http://commonjs.org/specs/modules/1.0.html)
|
8
|
-
in Ruby for client-side JavaScript.
|
8
|
+
in Ruby for client-side JavaScript. It accepts a singular file as input (the _program_) on
|
9
|
+
which is does static analysis to recursively resolve its dependencies.
|
10
|
+
|
11
|
+
The program, its dependencies and a small, namespaced JavaScript library are
|
12
|
+
concatenated into a single `js` file. This improves load times by
|
13
|
+
[minimizing HTTP requests](http://developer.yahoo.com/performance/rules.html#num_http).
|
14
|
+
Further load time performance improvements are made possible by the built-in
|
15
|
+
[lazy evaluation](http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html)
|
16
|
+
option. Modules are delivered as JavaScript strings--instead of functions--and are
|
17
|
+
evaluated only when required.
|
18
|
+
|
19
|
+
The bundled JavaScript library provides each module with the necessary `require`
|
20
|
+
function and `exports` and `module` free variables.
|
9
21
|
|
10
22
|
* [Github repository](http://github.com/codespeaks/modulr)
|
11
23
|
* [Specification](http://wiki.commonjs.org/wiki/Modules/1.0)
|
@@ -18,20 +30,6 @@ Install
|
|
18
30
|
Usage
|
19
31
|
-----
|
20
32
|
|
21
|
-
`modulr` accepts a singular file as input (the _program_) on which is does static
|
22
|
-
analysis to recursively resolve its dependencies.
|
23
|
-
|
24
|
-
The program, its dependencies and a small, namespaced JavaScript library are
|
25
|
-
concatenated into a single `js` file. This improves load times by
|
26
|
-
[minimizing HTTP requests](http://developer.yahoo.com/performance/rules.html#num_http).
|
27
|
-
Further load time performance improvements are made possible by the built-in
|
28
|
-
[lazy evaluation](http://googlecode.blogspot.com/2009/09/gmail-for-mobile-html5-series-reducing.html)
|
29
|
-
option. Modules are delivered as JavaScript strings--instead of functions--and are
|
30
|
-
evaluated only when required.
|
31
|
-
|
32
|
-
The bundled JavaScript library provides each module with the necessary `require`
|
33
|
-
function and `exports` and `module` free variables.
|
34
|
-
|
35
33
|
`modulr` is available as a Ruby library or as a command-line utility (`modulrize`).
|
36
34
|
|
37
35
|
To process a JavaScript source file, just run:
|
data/Rakefile
CHANGED
@@ -23,7 +23,7 @@ task :spec do
|
|
23
23
|
begin
|
24
24
|
puts File.basename(dir).center(80, "_")
|
25
25
|
File.open(output, 'w') do |f|
|
26
|
-
f << Modulr.ize(spec
|
26
|
+
f << Modulr.ize(spec)
|
27
27
|
end
|
28
28
|
system("js -f #{output}")
|
29
29
|
rescue => e
|
@@ -31,8 +31,8 @@ task :spec do
|
|
31
31
|
puts "ERROR while #{phase} (#{e.class}):"
|
32
32
|
puts e.message
|
33
33
|
ensure
|
34
|
-
|
35
|
-
|
34
|
+
FileUtils.rm(output)
|
35
|
+
FileUtils.rm(system)
|
36
36
|
puts
|
37
37
|
puts
|
38
38
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/assets/modulr.js
CHANGED
@@ -31,7 +31,7 @@ var modulr = (function(global) {
|
|
31
31
|
fn = _modules[id];
|
32
32
|
if (!fn) { throw 'Can\'t find module "' + identifier + '".'; }
|
33
33
|
if (typeof fn === 'string') {
|
34
|
-
fn =
|
34
|
+
fn = new Function('require', 'exports', 'module', fn);
|
35
35
|
}
|
36
36
|
fn(require, expts, modObj);
|
37
37
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modulr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobie Langel
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-10 00:00:00 +01:00
|
13
13
|
default_executable: modulrize
|
14
14
|
dependencies: []
|
15
15
|
|