Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Change dependency-resolving code so that modules work sensibly when c…

…oncatenated with jsbuild.
  • Loading branch information...
commit d41c91362c9f9c51c3a2a76cbe4a619640bb59d0 1 parent 5c2be15
James Coglan authored January 05, 2013

Showing 55 changed files with 131 additions and 115 deletions. Show diff stats Hide diff stats

  1. 2  bin/jsbuild
  2. 6  index.js
  3. 5  source/benchmark.js
  4. 6  source/command.js
  5. 2  source/comparable.js
  6. 4  source/console/_head.js
  7. 2  source/constant_scope.js
  8. 11  source/core/_head.js
  9. 5  source/core/method.js
  10. 2  source/decorator.js
  11. 2  source/deferrable.js
  12. 2  source/dom/_head.js
  13. 2  source/enumerable.js
  14. 2  source/forwardable.js
  15. 6  source/hash.js
  16. 5  source/linked_list.js
  17. 2  source/method_chain.js
  18. 2  source/observable.js
  19. 7  source/package/_head.js
  20. 4  source/package/config.js
  21. 2  source/proxy.js
  22. 6  source/range.js
  23. 6  source/set.js
  24. 8  source/stack_trace.js
  25. 2  source/state.js
  26. 18  source/test/_head.js
  27. 5  source/tsort.js
  28. 2  test/console.js
  29. 2  test/examples/async.js
  30. 2  test/examples/benchmarks.js
  31. 2  test/examples/reformat.js
  32. 2  test/examples/tracing.js
  33. 4  test/phantom.js
  34. 18  test/runner.js
  35. 2  test/specs/command_spec.js
  36. 2  test/specs/comparable_spec.js
  37. 2  test/specs/console_spec.js
  38. 2  test/specs/constant_scope_spec.js
  39. 2  test/specs/decorator_spec.js
  40. 2  test/specs/deferrable_spec.js
  41. 2  test/specs/enumerable_spec.js
  42. 2  test/specs/forwardable_spec.js
  43. 2  test/specs/hash_spec.js
  44. 2  test/specs/linked_list_spec.js
  45. 2  test/specs/method_chain_spec.js
  46. 2  test/specs/observable_spec.js
  47. 48  test/specs/package_spec.js
  48. 2  test/specs/proxy_spec.js
  49. 2  test/specs/range_spec.js
  50. 2  test/specs/set_spec.js
  51. 2  test/specs/state_spec.js
  52. 2  test/specs/test/context_spec.js
  53. 2  test/specs/test/mocking_spec.js
  54. 2  test/specs/test/unit_spec.js
  55. 2  test/specs/tsort_spec.js
2  bin/jsbuild
@@ -33,6 +33,8 @@ var fs      = require('fs'),
33 33
     include = params.argv.remain.slice(),
34 34
     dir     = new RegExp('^' + path.resolve(params.directory || '.') + '/')
35 35
 
  36
+JSCLASS_PATH = path.dirname(__filename) + '/../src';
  37
+
36 38
 var C = require('../src/console').Console,
37 39
     P = require('../index')
38 40
 
6  index.js
... ...
@@ -1,4 +1,8 @@
1  
-var path = require('path');
  1
+var path    = require('path'),
  2
+    cleanup = (typeof JSCLASS_PATH === 'undefined');
  3
+
2 4
 JSCLASS_PATH = path.dirname(__filename) + '/src';
3 5
 module.exports = require(JSCLASS_PATH + '/loader');
4 6
 
  7
+if (cleanup) delete JSCLASS_PATH;
  8
+
5  source/benchmark.js
... ...
@@ -1,7 +1,8 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
4  
-      Console = (E ? require('./console') : JS).Console;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
  4
+
  5
+      Console = js.Console || require('./console').Console;
5 6
 
6 7
   if (E) exports.JS = exports;
7 8
   factory(js, Console, E ? exports : js);
6  source/command.js
... ...
@@ -1,9 +1,9 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable,
6  
-      Observable = (E ? require('./observable') : js).Observable;
  5
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable,
  6
+      Observable = js.Observable || require('./observable').Observable;
7 7
 
8 8
   if (E) exports.JS = exports;
9 9
   factory(js, Enumerable, Observable, E ? exports : js);
2  source/comparable.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
4  source/console/_head.js
... ...
@@ -1,8 +1,8 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable;
  5
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable;
6 6
 
7 7
   if (E) exports.JS = exports;
8 8
   factory(js, Enumerable, E ? exports : js);
2  source/constant_scope.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
11  source/core/_head.js
... ...
@@ -1,15 +1,16 @@
1 1
 <%= license %>
2 2
 
  3
+var JS = (typeof JS === 'undefined') ? {} : JS;
  4
+
3 5
 (function(factory) {
4 6
   var $ = (typeof this.global === 'object') ? this.global : this,
5 7
       E = (typeof exports === 'object');
6 8
   
7  
-  if (E)
  9
+  if (E) {
8 10
     exports.JS = exports;
9  
-  else
10  
-    $.JS = $.JS || {};
11  
-
12  
-  factory($, E ? exports : $.JS);
  11
+    JS = exports;
  12
+  }
  13
+  factory($, JS);
13 14
 
14 15
 })(function(global, exports) {
15 16
 
5  source/core/method.js
@@ -81,7 +81,7 @@ JS.extend(JS.Method.prototype, {
81 81
       return returnValue;
82 82
     };
83 83
 
84  
-    var StackTrace = ((typeof require === 'function') ? require('./stack_trace') : global.JS).StackTrace;
  84
+    var StackTrace = trace && (exports.StackTrace || require('./stack_trace').StackTrace);
85 85
     if (trace) return StackTrace.wrap(compiled, method, environment);
86 86
     return compiled;
87 87
   },
@@ -134,7 +134,8 @@ JS.Method.keyword = function(name, filter) {
134 134
 };
135 135
 
136 136
 JS.Method.tracing = function(classes, block, context) {
137  
-  global.JS.require('JS.StackTrace', function(StackTrace) {
  137
+  var pkg = exports.require ? exports : require('./loader');
  138
+  pkg.require('JS.StackTrace', function(StackTrace) {
138 139
     var logger = StackTrace.logger,
139 140
         active = logger.active;
140 141
 
2  source/decorator.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
2  source/deferrable.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
2  source/dom/_head.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
2  source/enumerable.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
2  source/forwardable.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
6  source/hash.js
... ...
@@ -1,9 +1,9 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable,
6  
-      Comparable = (E ? require('./comparable') : js).Comparable;
  5
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable,
  6
+      Comparable = js.Comparable || require('./comparable').Comparable;
7 7
 
8 8
   if (E) exports.JS = exports;
9 9
   factory(js, Enumerable, Comparable, E ? exports : js);
5  source/linked_list.js
... ...
@@ -1,7 +1,8 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
4  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
  4
+
  5
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable;
5 6
 
6 7
   if (E) exports.JS = exports;
7 8
   factory(js, Enumerable, E ? exports : js);
2  source/method_chain.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
2  source/observable.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
7  source/package/_head.js
@@ -6,8 +6,11 @@ var JS = (typeof JS === 'undefined') ? {} : JS;
6 6
   var $ = (typeof this.global === 'object') ? this.global : this,
7 7
       E = (typeof exports === 'object');
8 8
 
9  
-  if (E) exports.JS = exports;
10  
-  factory($, E ? exports : JS);
  9
+  if (E) {
  10
+    exports.JS = exports;
  11
+    JS = exports;
  12
+  }
  13
+  factory($, JS);
11 14
 
12 15
 })(function(global, exports) {
13 16
 
4  source/package/config.js
@@ -97,8 +97,8 @@ P.packages(function() { with(this) {
97 97
                                       'JS.OrderedSet',
98 98
                                       'JS.SortedSet')
99 99
                             .requires('JS.Class',
100  
-                                      'JS.Enumerable')
101  
-                            .uses(    'JS.Hash');
  100
+                                      'JS.Enumerable',
  101
+                                      'JS.Hash');
102 102
 
103 103
     module('linked_list')   .provides('JS.LinkedList',
104 104
                                       'JS.LinkedList.Doubly',
2  source/proxy.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
6  source/range.js
... ...
@@ -1,9 +1,9 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable,
6  
-      Hash = (E ? require('./hash') : js).Hash;
  5
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable,
  6
+      Hash = js.Hash || require('./hash').Hash;
7 7
 
8 8
   if (E) exports.JS = exports;
9 9
   factory(js, Enumerable, Hash, E ? exports : js);
6  source/set.js
... ...
@@ -1,9 +1,9 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable,
6  
-      hash = (E ? require('./hash') : js);
  5
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable,
  6
+      hash = js.Hash ? js : require('./hash');
7 7
 
8 8
   if (E) exports.JS = exports;
9 9
   factory(js, Enumerable, hash, E ? exports : js);
8  source/stack_trace.js
... ...
@@ -1,10 +1,10 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Observable = (E ? require('./observable') : js).Observable,
6  
-      Enumerable = (E ? require('./enumerable') : js).Enumerable,
7  
-      Console = (E ? require('./console') : js).Console;
  5
+      Observable = js.Observable || require('./observable').Observable,
  6
+      Enumerable = js.Enumerable || require('./enumerable').Enumerable,
  7
+      Console    = js.Console    || require('./console').Console;
8 8
 
9 9
   if (E) exports.JS = exports;
10 10
   factory(js, Observable, Enumerable, Console, E ? exports : js);
2  source/state.js
... ...
@@ -1,6 +1,6 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS;
4 4
 
5 5
   if (E) exports.JS = exports;
6 6
   factory(js, E ? exports : js);
18  source/test/_head.js
... ...
@@ -1,15 +1,15 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
4 4
 
5  
-      Console     = (E ? require('./console') : js).Console,
6  
-      DOM         = (E ? require('./dom') : js).DOM,
7  
-      Enumerable  = (E ? require('./enumerable') : js).Enumerable,
8  
-      SortedSet   = (E ? require('./set') : js).SortedSet,
9  
-      Range       = (E ? require('./range') : js).Range,
10  
-      MethodChain = (E ? require('./method_chain') : js).MethodChain,
11  
-      Comparable  = (E ? require('./comparable') : js).Comparable,
12  
-      StackTrace  = (E ? require('./stack_trace') : js).StackTrace;
  5
+      Console     = js.Console     || require('./console').Console,
  6
+      DOM         = js.DOM         || require('./dom').DOM,
  7
+      Enumerable  = js.Enumerable  || require('./enumerable').Enumerable,
  8
+      SortedSet   = js.SortedSet   || require('./set').SortedSet,
  9
+      Range       = js.Range       || require('./range').Range,
  10
+      MethodChain = js.MethodChain || require('./method_chain').MethodChain,
  11
+      Comparable  = js.Comparable  || require('./comparable').Comparable,
  12
+      StackTrace  = js.StackTrace  || require('./stack_trace').StackTrace;
13 13
 
14 14
   if (E) exports.JS = exports;
15 15
   factory(js, Console, DOM, Enumerable, SortedSet, Range, MethodChain, Comparable, StackTrace, E ? exports : js);
5  source/tsort.js
... ...
@@ -1,7 +1,8 @@
1 1
 (function(factory) {
2 2
   var E  = (typeof exports === 'object'),
3  
-      js = E ? require('./core') : JS,
4  
-      Hash = (E ? require('./hash') : js).Hash;
  3
+      js = (typeof JS === 'undefined') ? require('./core') : JS,
  4
+
  5
+      Hash = js.Hash || require('./hash').Hash;
5 6
 
6 7
   if (E) exports.JS = exports;
7 8
   factory(js, Hash, E ? exports : js);
2  test/console.js
@@ -19,7 +19,7 @@ if (this.ActiveXObject) load = function(path) {
19 19
   }
20 20
 
21 21
   if (typeof require === 'function') {
22  
-    $.JS = require('../' + path + 'loader');
  22
+    $.PKG = require('../' + path + 'loader');
23 23
     require('./runner');
24 24
   } else {
25 25
     load(path + 'loader.js');
2  test/examples/async.js
... ...
@@ -1,5 +1,5 @@
1 1
 JSCLASS_PATH = "build/min/"
2  
-require("../../" + JSCLASS_PATH + "loader")
  2
+var JS = require("../../" + JSCLASS_PATH + "loader")
3 3
 
4 4
 JS.require("JS.Test", "JS.MethodChain", function(Test, MC) {
5 5
 
2  test/examples/benchmarks.js
@@ -4,7 +4,7 @@
4 4
 })()
5 5
 
6 6
 if (typeof require === 'function')
7  
-  require('../../' + JSCLASS_PATH + 'loader')
  7
+  var JS = require('../../' + JSCLASS_PATH + 'loader')
8 8
 else
9 9
   load(JSCLASS_PATH + 'loader.js')
10 10
 
2  test/examples/reformat.js
@@ -6,7 +6,7 @@
6 6
 //     $ node test/console -f json | node test/examples/reformat -f tap
7 7
 
8 8
 JSCLASS_PATH = 'build/src'
9  
-require('../../' + JSCLASS_PATH + '/loader')
  9
+var JS = require('../../' + JSCLASS_PATH + '/loader')
10 10
 
11 11
 JS.require('JS.Test', function(Test) {
12 12
   var options  = require('nopt')({format: String}),
2  test/examples/tracing.js
@@ -15,7 +15,7 @@ if (this.ActiveXObject) load = function(path) {
15 15
 })()
16 16
 
17 17
 if (typeof require === 'function') {
18  
-  require('../../' + JSCLASS_PATH + 'loader')
  18
+  var JS = require('../../' + JSCLASS_PATH + 'loader')
19 19
 } else {
20 20
   load(JSCLASS_PATH + 'loader.js')
21 21
 }
4  test/phantom.js
... ...
@@ -1,7 +1,7 @@
1 1
 JSCLASS_PATH = '../build/src'
2  
-require(JSCLASS_PATH + '/loader')
  2
+var pkg = require(JSCLASS_PATH + '/loader')
3 3
 
4  
-JS.require('JS.Test', function(Test) {
  4
+pkg.require('JS.Test', function(Test) {
5 5
   var page     = new WebPage(),
6 6
       reporter = new Test.Reporters.PhantomJS({}, page)
7 7
 
18  test/runner.js
... ...
@@ -1,9 +1,10 @@
1  
-JS.ENV.CWD = (typeof CWD === 'undefined') ? '.' : CWD
  1
+PKG = (typeof PKG === 'object') ? PKG : JS
  2
+PKG.ENV.CWD = (typeof CWD === 'undefined') ? '.' : CWD
2 3
 
3  
-JS.cacheBust = true
4  
-if (JS.ENV.JS_DEBUG) JS.debug = true
  4
+PKG.cacheBust = true
  5
+if (PKG.ENV.JS_DEBUG) PKG.debug = true
5 6
 
6  
-JS.packages(function() { with(this) {
  7
+PKG.packages(function() { with(this) {
7 8
   autoload(/^(.*)Spec$/, {from: CWD + '/test/specs', require: 'JS.$1'})
8 9
 
9 10
   pkg('Test.UnitSpec').requires('JS.Set', 'JS.Observable')
@@ -15,9 +16,10 @@ JS.packages(function() { with(this) {
15 16
   pkg('Test.MockingSpec').requires('TestSpecHelpers')
16 17
 }})
17 18
 
18  
-JS.require('JS', 'JS.Test', function(js, Test) {
19  
-  js.extend(JS, js)
20  
-  JS.Test = Test
  19
+PKG.require('JS', 'JS.Test', function(JS, Test) {
  20
+  PKG.ENV.JS = JS
  21
+  JS.Package = PKG.Package
  22
+  JS.Test    = Test
21 23
 
22 24
   var specs = [ 'Test.UnitSpec',
23 25
                 'Test.ContextSpec',
@@ -51,6 +53,6 @@ JS.require('JS', 'JS.Test', function(js, Test) {
51 53
 
52 54
   specs = Test.filter(specs, 'Spec')
53 55
   specs.push(function() { Test.autorun() })
54  
-  JS.require.apply(JS, specs)
  56
+  PKG.require.apply(PKG, specs)
55 57
 })
56 58
 
2  test/specs/command_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Command', function(Command) {
  1
+PKG.require('JS.Command', function(Command) {
2 2
 
3 3
 JS.ENV.CommandSpec = JS.Test.describe(Command, function() { with(this) {
4 4
   before(function() { this.counter = 0 })
2  test/specs/comparable_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Comparable', function(Comparable) {
  1
+PKG.require('JS.Comparable', function(Comparable) {
2 2
 
3 3
 JS.ENV.ComparableSpec = JS.Test.describe(Comparable, function() { with(this) {
4 4
   include(JS.Test.Helpers)
2  test/specs/console_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Console', function(Console) {
  1
+PKG.require('JS.Console', function(Console) {
2 2
 
3 3
 JS.ENV.ConsoleSpec = JS.Test.describe(Console, function() { with(this) {
4 4
   describe("convert", function() { with(this) {
2  test/specs/constant_scope_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.ConstantScope', function(ConstantScope) {
  1
+PKG.require('JS.ConstantScope', function(ConstantScope) {
2 2
 
3 3
 JS.ENV.ConstantScopeSpec = JS.Test.describe(ConstantScope, function() { with(this) {
4 4
   include(JS.Test.Helpers)
2  test/specs/decorator_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Decorator', function(Decorator) {
  1
+PKG.require('JS.Decorator', function(Decorator) {
2 2
 
3 3
 JS.ENV.DecoratorSpec = JS.Test.describe(Decorator, function() { with(this) {
4 4
   var Bicycle = new JS.Class({
2  test/specs/deferrable_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Deferrable', function(Deferrable) {
  1
+PKG.require('JS.Deferrable', function(Deferrable) {
2 2
 
3 3
 JS.ENV.DeferrableSpec = JS.Test.describe(Deferrable, function() { with(this) {
4 4
   include(JS.Test.FakeClock)
2  test/specs/enumerable_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Comparable', 'JS.Enumerable', 'JS.Hash', 'JS.Range',
  1
+PKG.require('JS.Comparable', 'JS.Enumerable', 'JS.Hash', 'JS.Range',
2 2
 function(Comparable, Enumerable, Hash, Range) {
3 3
 
4 4
 JS.ENV.EnumerableSpec = JS.Test.describe(Enumerable, function() { with(this) {
2  test/specs/forwardable_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Forwardable', function(Forwardable) {
  1
+PKG.require('JS.Forwardable', function(Forwardable) {
2 2
 
3 3
 JS.ENV.ForwardableSpec = JS.Test.describe(Forwardable, function() { with(this) {
4 4
   define("Subject", new JS.Class({
2  test/specs/hash_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Hash', 'JS.OrderedHash', function(Hash, OrderedHash) {
  1
+PKG.require('JS.Hash', 'JS.OrderedHash', function(Hash, OrderedHash) {
2 2
 
3 3
 JS.ENV.HashSpec = JS.Test.describe(Hash, function() { with(this) {
4 4
   include(JS.Test.Helpers)
2  test/specs/linked_list_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Enumerable', 'JS.LinkedList', function(Enumerable, LinkedList) {
  1
+PKG.require('JS.Enumerable', 'JS.LinkedList', function(Enumerable, LinkedList) {
2 2
 
3 3
 JS.ENV.LinkedListSpec = JS.Test.describe(LinkedList, function() { with(this) {
4 4
   describe(LinkedList.Doubly.Circular, function() { with(this) {
2  test/specs/method_chain_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.MethodChain', function(MethodChain) {
  1
+PKG.require('JS.MethodChain', function(MethodChain) {
2 2
 
3 3
 JS.ENV.MethodChainSpec = JS.Test.describe(MethodChain, function() { with(this) {
4 4
   include(JS.Test.Helpers)
2  test/specs/observable_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Observable', function(Observable) {
  1
+PKG.require('JS.Observable', function(Observable) {
2 2
 
3 3
 JS.ENV.ObservableSpec = JS.Test.describe(Observable, function() { with(this) {
4 4
   before(function() { with(this) {
48  test/specs/package_spec.js
@@ -9,7 +9,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
9 9
     store: function(name) {
10 10
       this._objectNames.push(name);
11 11
 
12  
-      var env   = JS.Package.ENV,
  12
+      var env   = PKG.ENV,
13 13
           parts = name.split('.'),
14 14
           used  = [],
15 15
           part;
@@ -25,7 +25,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
25 25
       this.store(name);
26 26
 
27 27
       var defineObject = function() {
28  
-        var env   = JS.Package.ENV,
  28
+        var env   = PKG.ENV,
29 29
             parts = name.split('.'),
30 30
             part;
31 31
 
@@ -35,7 +35,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
35 35
 
36 36
       var loaded = this._loaded;
37 37
 
38  
-      JS.Packages(function() { with(this) {
  38
+      PKG.packages(function() { with(this) {
39 39
         var block = function(callback) {
40 40
           JS.ENV.setTimeout(function() {
41 41
             defineObject(name);
@@ -67,7 +67,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
67 67
   after(function() { with(this) {
68 68
     forEach(_objectNames, JS.Package.remove, JS.Package)
69 69
     forEach(_undefined, function(name) {
70  
-      var env   = JS.Package.ENV,
  70
+      var env   = PKG.ENV,
71 71
           parts = name.split('.'),
72 72
           last  = parts.pop(),
73 73
           part;
@@ -79,7 +79,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
79 79
 
80 80
   describe("loading a CommonJS module", function() { with(this) {
81 81
     before(function() { with(this) {
82  
-      JS.Packages(function() { with(this) {
  82
+      PKG.packages(function() { with(this) {
83 83
         file(CWD + "/test/fixtures/common.js").provides("Common", "HTTP")
84 84
       }})
85 85
     }})
@@ -90,7 +90,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
90 90
     }})
91 91
 
92 92
     it("yields the required objects to the callback", function(resume) { with(this) {
93  
-      JS.require("Common", "HTTP", function(Common, HTTP) {
  93
+      PKG.require("Common", "HTTP", function(Common, HTTP) {
94 94
         resume(function() {
95 95
           assertEqual( "CommonJS module", Common.name )
96 96
           assertEqual( "CommonJS HTTP lib", HTTP.name )
@@ -106,7 +106,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
106 106
     }})
107 107
 
108 108
     it("loads the object", function() { with(this) {
109  
-      JS.require("Standalone")
  109
+      PKG.require("Standalone")
110 110
       clock.tick(500)
111 111
       assertKindOf( Object, Standalone )
112 112
       assertEqual( "Standalone", Standalone.name )
@@ -115,11 +115,11 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
115 115
     it("loads the object once and runs every waiting block", function() { with(this) {
116 116
       var done1 = false, done2 = false, doneAsync = false
117 117
 
118  
-      JS.require("Standalone", function() { done1 = true })
119  
-      JS.require("Standalone", function() { done2 = true })
  118
+      PKG.require("Standalone", function() { done1 = true })
  119
+      PKG.require("Standalone", function() { done2 = true })
120 120
 
121 121
       JS.ENV.setTimeout(function() {
122  
-        JS.require("Standalone", function() { doneAsync = true })
  122
+        PKG.require("Standalone", function() { doneAsync = true })
123 123
       }, 300)
124 124
 
125 125
       assertEqual( "undefined", typeof Standalone )
@@ -143,7 +143,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
143 143
       }})
144 144
 
145 145
       it("loads the object", function() { with(this) {
146  
-        JS.require("Object.In.A.Namespace")
  146
+        PKG.require("Object.In.A.Namespace")
147 147
         clock.tick(100)
148 148
         assertKindOf( Object, Object.In.A.Namespace )
149 149
       }})
@@ -162,7 +162,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
162 162
 
163 163
       var bothLoaded = false
164 164
 
165  
-      JS.require("Bar", "Foo", function() {
  165
+      PKG.require("Bar", "Foo", function() {
166 166
         bothLoaded = (typeof Foo === "object") && (typeof Foo === "object")
167 167
       })
168 168
 
@@ -183,7 +183,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
183 183
 
184 184
     it("loads the packages in order when one is required", function() { with(this) {
185 185
       var done = false
186  
-      JS.require("Dependent", function() { done = true })
  186
+      PKG.require("Dependent", function() { done = true })
187 187
 
188 188
       assertEqual( "undefined", typeof Base )
189 189
       assertEqual( "undefined", typeof Dependent )
@@ -218,13 +218,13 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
218 218
 
219 219
     describe("when the dependency is already defined", function() { with(this) {
220 220
       before(function() { with(this) {
221  
-        JS.Package.ENV.Base = {}
  221
+        PKG.ENV.Base = {}
222 222
         assertEqual( "undefined", typeof Dependent )
223 223
       }})
224 224
 
225 225
       it("just loads the dependent object", function() { with(this) {
226 226
         var done = false
227  
-        JS.require("Dependent", function() { done = true })
  227
+        PKG.require("Dependent", function() { done = true })
228 228
 
229 229
         clock.tick(50)
230 230
 
@@ -242,13 +242,13 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
242 242
 
243 243
     describe("when the required object is already defined", function() { with(this) {
244 244
       before(function() { with(this) {
245  
-        JS.Package.ENV.Dependent = {}
  245
+        PKG.ENV.Dependent = {}
246 246
         assertEqual( "undefined", typeof Base )
247 247
       }})
248 248
 
249 249
       it("loads the dependency and waits", function() { with(this) {
250 250
         var done = false
251  
-        JS.require("Dependent", function() { done = true })
  251
+        PKG.require("Dependent", function() { done = true })
252 252
 
253 253
         clock.tick(50)
254 254
 
@@ -281,7 +281,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
281 281
 
282 282
     it("loads all the objects, parallelizing where possible", function() { with(this) {
283 283
       var done = false
284  
-      JS.require("TreeSet", function() { done = true })
  284
+      PKG.require("TreeSet", function() { done = true })
285 285
 
286 286
       clock.tick(50)
287 287
 
@@ -327,7 +327,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
327 327
 
328 328
     it("loads the packages in parallel but waits until both are loaded", function() { with(this) {
329 329
       var done = false
330  
-      JS.require("Application", function() { done = true })
  330
+      PKG.require("Application", function() { done = true })
331 331
 
332 332
       assertEqual( "undefined", typeof Helper )
333 333
       assertEqual( "undefined", typeof Application )
@@ -356,13 +356,13 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
356 356
 
357 357
     describe("when the required object is defined but the dependency is missing", function() { with(this) {
358 358
       before(function() { with(this) {
359  
-        JS.Package.ENV.Application = {}
  359
+        PKG.ENV.Application = {}
360 360
         assertEqual( "undefined", typeof Helper )
361 361
       }})
362 362
 
363 363
       it("loads the dependency and waits", function() { with(this) {
364 364
         var done = false
365  
-        JS.require("Application", function() { done = true })
  365
+        PKG.require("Application", function() { done = true })
366 366
 
367 367
         clock.tick(250)
368 368
 
@@ -380,13 +380,13 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
380 380
 
381 381
     describe("when the dependency is defined but the required is not", function() { with(this) {
382 382
       before(function() { with(this) {
383  
-        JS.Package.ENV.Helper = {}
  383
+        PKG.ENV.Helper = {}
384 384
         assertEqual( "undefined", typeof Application )
385 385
       }})
386 386
 
387 387
       it("loads the required object and waits", function() { with(this) {
388 388
         var done = false
389  
-        JS.require("Application", function() { done = true })
  389
+        PKG.require("Application", function() { done = true })
390 390
 
391 391
         clock.tick(50)
392 392
 
@@ -407,7 +407,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
407 407
     it("runs the block immediately without loading anything", function() { with(this) {
408 408
       var done = false
409 409
       assertKindOf( Object, JS.Test )
410  
-      JS.require("JS.Test", function() { done = true })
  410
+      PKG.require("JS.Test", function() { done = true })
411 411
       assert( done )
412 412
       assertEqual( [], _loaded )
413 413
     }})
2  test/specs/proxy_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Proxy', function(Proxy) {
  1
+PKG.require('JS.Proxy', function(Proxy) {
2 2
 
3 3
 JS.ENV.ProxySpec = JS.Test.describe(Proxy, function() { with(this) {
4 4
   describe(Proxy.Virtual, function() { with(this) {
2  test/specs/range_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Range', function(Range) {
  1
+PKG.require('JS.Range', function(Range) {
2 2
 
3 3
 JS.ENV.RangeSpec = JS.Test.describe(Range, function() { with(this) {
4 4
   include(JS.Test.Helpers)
2  test/specs/set_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Set', 'JS.OrderedSet', 'JS.SortedSet', 'JS.Hash',
  1
+PKG.require('JS.Set', 'JS.OrderedSet', 'JS.SortedSet', 'JS.Hash',
2 2
 function(Set, OrderedSet, SortedSet, Hash) {
3 3
 
4 4
 var sets = {
2  test/specs/state_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.State', function(State) {
  1
+PKG.require('JS.State', function(State) {
2 2
 
3 3
 JS.ENV.StateSpec = JS.Test.describe(State, function() { with(this) {
4 4
   define("Positive", {
2  test/specs/test/context_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Enumerable', function(Enumerable) {
  1
+PKG.require('JS.Enumerable', function(Enumerable) {
2 2
 
3 3
 JS.ENV.Test = JS.ENV.Test || {}
4 4
 
2  test/specs/test/mocking_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Enumerable', 'JS.Comparable', 'JS.Hash', 'JS.Set', 'JS.SortedSet',
  1
+PKG.require('JS.Enumerable', 'JS.Comparable', 'JS.Hash', 'JS.Set', 'JS.SortedSet',
2 2
 function(Enumerable, Comparable, Hash, Set, SortedSet) {
3 3
 
4 4
 JS.ENV.Test = JS.ENV.Test || {}
2  test/specs/test/unit_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.Enumerable', 'JS.Observable', 'JS.Range', 'JS.Set', 'JS.SortedSet',
  1
+PKG.require('JS.Enumerable', 'JS.Observable', 'JS.Range', 'JS.Set', 'JS.SortedSet',
2 2
 function(Enumerable, Observable, Range, Set, SortedSet) {
3 3
 
4 4
 JS.ENV.Test = JS.ENV.Test || {}
2  test/specs/tsort_spec.js
... ...
@@ -1,4 +1,4 @@
1  
-JS.require('JS.TSort', 'JS.Hash', function(TSort, Hash) {
  1
+PKG.require('JS.TSort', 'JS.Hash', function(TSort, Hash) {
2 2
 
3 3
 JS.ENV.TSortSpec = JS.Test.describe(TSort, function() { with(this) {
4 4
   before(function() { with(this) {

0 notes on commit d41c913

Please sign in to comment.
Something went wrong with that request. Please try again.