|
@@ -59,9 +59,25 @@ function always_resolve(callback) {
|
|
function createConcatenator () {
|
|
function createConcatenator () {
|
|
var defineAmdDefine = function () {
|
|
var defineAmdDefine = function () {
|
|
var path = require('path');
|
|
var path = require('path');
|
|
- return ($SRC$)(module);
|
|
|
|
|
|
+ return ($AMDEFINE_SRC$)(module);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // The createAmdefineString is hack to help injecting amdefine into the concatenated output.
|
|
|
|
+ //
|
|
|
|
+ // Usually, the line 'var define = require('amdefine')(module), requirejs = define.require;'
|
|
|
|
+ // is needed when using amdefine with node and npm installed.
|
|
|
|
+ // var f = require('amdefine') itself returns one big self-sufficient function which must be called
|
|
|
|
+ // as f(module) to get the define you can use.
|
|
|
|
+ //
|
|
|
|
+ // However, amdefine needs the definition of the 'path' variable (node's internal 'path' module).
|
|
|
|
+ // To create this dependency the defineAmdDefine() function is used which defines
|
|
|
|
+ // the path variable first and adds a placeholder for the amdefine function/sourcecode.
|
|
|
|
+ // The defineAmdDefine() function is then converted to its string representation
|
|
|
|
+ // and the placeholder is replaced with the actual sourcecode of the amdefine function.
|
|
|
|
+ var createAmdefineString = function() {
|
|
|
|
+ return ('' + defineAmdDefine).replace('$AMDEFINE_SRC$', '' + require('amdefine'));
|
|
|
|
+ }
|
|
|
|
+
|
|
return {
|
|
return {
|
|
elements: [],
|
|
elements: [],
|
|
ids: [],
|
|
ids: [],
|
|
@@ -76,7 +92,7 @@ function createConcatenator () {
|
|
},
|
|
},
|
|
start: function () {
|
|
start: function () {
|
|
this.add(
|
|
this.add(
|
|
- 'var define = (' + ('' + defineAmdDefine).replace('$SRC$', '' + require('amdefine')) + ')(), requirejs = define.require;',
|
|
|
|
|
|
+ 'var define = (' + createAmdefineString() + ')(), requirejs = define.require;',
|
|
'define("amber_vm/browser-compatibility", [], {});'
|
|
'define("amber_vm/browser-compatibility", [], {});'
|
|
);
|
|
);
|
|
},
|
|
},
|