Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
todomvc
Commits
83fef80f
Commit
83fef80f
authored
Nov 20, 2014
by
TasteBot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the build files for gh-pages [ci skip]
parent
7be92e46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
241 additions
and
184 deletions
+241
-184
examples/olives/bower_components/emily/build/Emily.js
examples/olives/bower_components/emily/build/Emily.js
+40
-40
examples/olives/bower_components/requirejs/require.js
examples/olives/bower_components/requirejs/require.js
+201
-144
No files found.
examples/olives/bower_components/emily/build/Emily.js
View file @
83fef80f
...
@@ -26,10 +26,10 @@ function Tools(){
...
@@ -26,10 +26,10 @@ function Tools(){
* @returns {Object} the global object
* @returns {Object} the global object
*/
*/
getGlobal
:
function
getGlobal
()
{
getGlobal
:
function
getGlobal
()
{
var
func
=
function
()
{
var
func
=
function
()
{
return
this
;
return
this
;
};
};
return
func
.
call
(
null
);
return
func
.
call
(
null
);
},
},
/**
/**
...
@@ -822,43 +822,43 @@ function Promise(Observable, StateMachine) {
...
@@ -822,43 +822,43 @@ function Promise(Observable, StateMachine) {
* @returns {Promise} the new promise
* @returns {Promise} the new promise
*/
*/
this
.
then
=
function
then
()
{
this
.
then
=
function
then
()
{
var
promise
=
new
PromiseConstructor
;
var
promise
=
new
PromiseConstructor
;
// If a fulfillment callback is given
// If a fulfillment callback is given
if
(
arguments
[
0
]
instanceof
Function
)
{
if
(
arguments
[
0
]
instanceof
Function
)
{
// If the second argument is also a function, then no scope is given
// If the second argument is also a function, then no scope is given
if
(
arguments
[
1
]
instanceof
Function
)
{
if
(
arguments
[
1
]
instanceof
Function
)
{
_stateMachine
.
event
(
"
toFulfill
"
,
this
.
makeResolver
(
promise
,
arguments
[
0
]));
_stateMachine
.
event
(
"
toFulfill
"
,
this
.
makeResolver
(
promise
,
arguments
[
0
]));
}
else
{
}
else
{
// If the second argument is not a function, it's the scope
// If the second argument is not a function, it's the scope
_stateMachine
.
event
(
"
toFulfill
"
,
this
.
makeResolver
(
promise
,
arguments
[
0
],
arguments
[
1
]));
_stateMachine
.
event
(
"
toFulfill
"
,
this
.
makeResolver
(
promise
,
arguments
[
0
],
arguments
[
1
]));
}
}
}
else
{
}
else
{
// If no fulfillment callback given, give a default one
// If no fulfillment callback given, give a default one
_stateMachine
.
event
(
"
toFulfill
"
,
this
.
makeResolver
(
promise
,
function
()
{
_stateMachine
.
event
(
"
toFulfill
"
,
this
.
makeResolver
(
promise
,
function
()
{
promise
.
fulfill
(
_value
);
promise
.
fulfill
(
_value
);
}));
}));
}
}
// if the second arguments is a callback, it's the rejection one, and the next argument is the scope
// if the second arguments is a callback, it's the rejection one, and the next argument is the scope
if
(
arguments
[
1
]
instanceof
Function
)
{
if
(
arguments
[
1
]
instanceof
Function
)
{
_stateMachine
.
event
(
"
toReject
"
,
this
.
makeResolver
(
promise
,
arguments
[
1
],
arguments
[
2
]));
_stateMachine
.
event
(
"
toReject
"
,
this
.
makeResolver
(
promise
,
arguments
[
1
],
arguments
[
2
]));
}
}
// if the third arguments is a callback, it's the rejection one, and the next arguments is the sopce
// if the third arguments is a callback, it's the rejection one, and the next arguments is the sopce
if
(
arguments
[
2
]
instanceof
Function
)
{
if
(
arguments
[
2
]
instanceof
Function
)
{
_stateMachine
.
event
(
"
toReject
"
,
this
.
makeResolver
(
promise
,
arguments
[
2
],
arguments
[
3
]));
_stateMachine
.
event
(
"
toReject
"
,
this
.
makeResolver
(
promise
,
arguments
[
2
],
arguments
[
3
]));
}
}
// If no rejection callback is given, give a default one
// If no rejection callback is given, give a default one
if
(
!
(
arguments
[
1
]
instanceof
Function
)
&&
if
(
!
(
arguments
[
1
]
instanceof
Function
)
&&
!
(
arguments
[
2
]
instanceof
Function
))
{
!
(
arguments
[
2
]
instanceof
Function
))
{
_stateMachine
.
event
(
"
toReject
"
,
this
.
makeResolver
(
promise
,
function
()
{
_stateMachine
.
event
(
"
toReject
"
,
this
.
makeResolver
(
promise
,
function
()
{
promise
.
reject
(
_reason
);
promise
.
reject
(
_reason
);
}));
}));
}
}
return
promise
;
return
promise
;
};
};
/**
/**
...
@@ -912,7 +912,7 @@ function Promise(Observable, StateMachine) {
...
@@ -912,7 +912,7 @@ function Promise(Observable, StateMachine) {
* @private
* @private
*/
*/
this
.
getReason
=
function
getReason
()
{
this
.
getReason
=
function
getReason
()
{
return
_reason
;
return
_reason
;
};
};
/**
/**
...
@@ -921,7 +921,7 @@ function Promise(Observable, StateMachine) {
...
@@ -921,7 +921,7 @@ function Promise(Observable, StateMachine) {
* @private
* @private
*/
*/
this
.
getValue
=
function
getValue
()
{
this
.
getValue
=
function
getValue
()
{
return
_value
;
return
_value
;
};
};
/**
/**
...
...
examples/olives/bower_components/requirejs/require.js
View file @
83fef80f
/** vim: et:ts=4:sw=4:sts=4
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.
5 Copyright (c) 2010-2012
, The Dojo Foundation All Rights Reserved.
* @license RequireJS 2.1.
15 Copyright (c) 2010-2014
, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
* see: http://github.com/jrburke/requirejs for details
*/
*/
...
@@ -12,7 +12,7 @@ var requirejs, require, define;
...
@@ -12,7 +12,7 @@ var requirejs, require, define;
(
function
(
global
)
{
(
function
(
global
)
{
var
req
,
s
,
head
,
baseElement
,
dataMain
,
src
,
var
req
,
s
,
head
,
baseElement
,
dataMain
,
src
,
interactiveScript
,
currentlyAddingScript
,
mainScript
,
subPath
,
interactiveScript
,
currentlyAddingScript
,
mainScript
,
subPath
,
version
=
'
2.1.5
'
,
version
=
'
2.1.
1
5
'
,
commentRegExp
=
/
(\/\*([\s\S]
*
?)\*\/
|
([^
:
]
|^
)\/\/(
.*
)
$
)
/mg
,
commentRegExp
=
/
(\/\*([\s\S]
*
?)\*\/
|
([^
:
]
|^
)\/\/(
.*
)
$
)
/mg
,
cjsRequireRegExp
=
/
[^
.
]\s
*require
\s
*
\(\s
*
[
"'
]([^
'"
\s]
+
)[
"'
]\s
*
\)
/g
,
cjsRequireRegExp
=
/
[^
.
]\s
*require
\s
*
\(\s
*
[
"'
]([^
'"
\s]
+
)[
"'
]\s
*
\)
/g
,
jsSuffixRegExp
=
/
\.
js$/
,
jsSuffixRegExp
=
/
\.
js$/
,
...
@@ -22,7 +22,7 @@ var requirejs, require, define;
...
@@ -22,7 +22,7 @@ var requirejs, require, define;
hasOwn
=
op
.
hasOwnProperty
,
hasOwn
=
op
.
hasOwnProperty
,
ap
=
Array
.
prototype
,
ap
=
Array
.
prototype
,
apsp
=
ap
.
splice
,
apsp
=
ap
.
splice
,
isBrowser
=
!!
(
typeof
window
!==
'
undefined
'
&&
navigator
&&
document
),
isBrowser
=
!!
(
typeof
window
!==
'
undefined
'
&&
typeof
navigator
!==
'
undefined
'
&&
window
.
document
),
isWebWorker
=
!
isBrowser
&&
typeof
importScripts
!==
'
undefined
'
,
isWebWorker
=
!
isBrowser
&&
typeof
importScripts
!==
'
undefined
'
,
//PS3 indicates loaded and complete, but need to wait for complete
//PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is 'loading', 'loaded', execution,
//specifically. Sequence is 'loading', 'loaded', execution,
...
@@ -108,7 +108,10 @@ var requirejs, require, define;
...
@@ -108,7 +108,10 @@ var requirejs, require, define;
if
(
source
)
{
if
(
source
)
{
eachProp
(
source
,
function
(
value
,
prop
)
{
eachProp
(
source
,
function
(
value
,
prop
)
{
if
(
force
||
!
hasProp
(
target
,
prop
))
{
if
(
force
||
!
hasProp
(
target
,
prop
))
{
if
(
deepStringMixin
&&
typeof
value
!==
'
string
'
)
{
if
(
deepStringMixin
&&
typeof
value
===
'
object
'
&&
value
&&
!
isArray
(
value
)
&&
!
isFunction
(
value
)
&&
!
(
value
instanceof
RegExp
))
{
if
(
!
target
[
prop
])
{
if
(
!
target
[
prop
])
{
target
[
prop
]
=
{};
target
[
prop
]
=
{};
}
}
...
@@ -134,7 +137,11 @@ var requirejs, require, define;
...
@@ -134,7 +137,11 @@ var requirejs, require, define;
return
document
.
getElementsByTagName
(
'
script
'
);
return
document
.
getElementsByTagName
(
'
script
'
);
}
}
//Allow getting a global that expressed in
function
defaultOnError
(
err
)
{
throw
err
;
}
//Allow getting a global that is expressed in
//dot notation, like 'a.b.c'.
//dot notation, like 'a.b.c'.
function
getGlobal
(
value
)
{
function
getGlobal
(
value
)
{
if
(
!
value
)
{
if
(
!
value
)
{
...
@@ -173,7 +180,7 @@ var requirejs, require, define;
...
@@ -173,7 +180,7 @@ var requirejs, require, define;
if
(
typeof
requirejs
!==
'
undefined
'
)
{
if
(
typeof
requirejs
!==
'
undefined
'
)
{
if
(
isFunction
(
requirejs
))
{
if
(
isFunction
(
requirejs
))
{
//Do not overwrite an
d
existing requirejs instance.
//Do not overwrite an existing requirejs instance.
return
;
return
;
}
}
cfg
=
requirejs
;
cfg
=
requirejs
;
...
@@ -197,6 +204,7 @@ var requirejs, require, define;
...
@@ -197,6 +204,7 @@ var requirejs, require, define;
waitSeconds
:
7
,
waitSeconds
:
7
,
baseUrl
:
'
./
'
,
baseUrl
:
'
./
'
,
paths
:
{},
paths
:
{},
bundles
:
{},
pkgs
:
{},
pkgs
:
{},
shim
:
{},
shim
:
{},
config
:
{}
config
:
{}
...
@@ -210,6 +218,7 @@ var requirejs, require, define;
...
@@ -210,6 +218,7 @@ var requirejs, require, define;
defQueue
=
[],
defQueue
=
[],
defined
=
{},
defined
=
{},
urlFetched
=
{},
urlFetched
=
{},
bundlesMap
=
{},
requireCounter
=
1
,
requireCounter
=
1
,
unnormalizedCounter
=
1
;
unnormalizedCounter
=
1
;
...
@@ -224,20 +233,19 @@ var requirejs, require, define;
...
@@ -224,20 +233,19 @@ var requirejs, require, define;
*/
*/
function
trimDots
(
ary
)
{
function
trimDots
(
ary
)
{
var
i
,
part
;
var
i
,
part
;
for
(
i
=
0
;
ary
[
i
];
i
+=
1
)
{
for
(
i
=
0
;
i
<
ary
.
length
;
i
++
)
{
part
=
ary
[
i
];
part
=
ary
[
i
];
if
(
part
===
'
.
'
)
{
if
(
part
===
'
.
'
)
{
ary
.
splice
(
i
,
1
);
ary
.
splice
(
i
,
1
);
i
-=
1
;
i
-=
1
;
}
else
if
(
part
===
'
..
'
)
{
}
else
if
(
part
===
'
..
'
)
{
if
(
i
===
1
&&
(
ary
[
2
]
===
'
..
'
||
ary
[
0
]
===
'
..
'
))
{
// If at the start, or previous value is still ..,
//End of the line. Keep at least one non-dot
// keep them so that when converted to a path it may
//path segment at the front so it can be mapped
// still work when converted to a path, even though
//correctly to disk. Otherwise, there is likely
// as an ID it is less than ideal. In larger point
//no path mapping for a path starting with '..'.
// releases, may be better to just kick out an error.
//This can still fail, but catches the most reasonable
if
(
i
===
0
||
(
i
==
1
&&
ary
[
2
]
===
'
..
'
)
||
ary
[
i
-
1
]
===
'
..
'
)
{
//uses of ..
continue
;
break
;
}
else
if
(
i
>
0
)
{
}
else
if
(
i
>
0
)
{
ary
.
splice
(
i
-
1
,
2
);
ary
.
splice
(
i
-
1
,
2
);
i
-=
2
;
i
-=
2
;
...
@@ -257,54 +265,45 @@ var requirejs, require, define;
...
@@ -257,54 +265,45 @@ var requirejs, require, define;
* @returns {String} normalized name
* @returns {String} normalized name
*/
*/
function
normalize
(
name
,
baseName
,
applyMap
)
{
function
normalize
(
name
,
baseName
,
applyMap
)
{
var
pkgName
,
pkgConfig
,
mapValue
,
nameParts
,
i
,
j
,
nameSegment
,
var
pkgMain
,
mapValue
,
nameParts
,
i
,
j
,
nameSegment
,
lastIndex
,
foundMap
,
foundI
,
foundStarMap
,
starI
,
foundMap
,
foundI
,
foundStarMap
,
starI
,
normalizedBaseParts
,
baseParts
=
baseName
&&
baseName
.
split
(
'
/
'
),
baseParts
=
(
baseName
&&
baseName
.
split
(
'
/
'
)),
normalizedBaseParts
=
baseParts
,
map
=
config
.
map
,
map
=
config
.
map
,
starMap
=
map
&&
map
[
'
*
'
];
starMap
=
map
&&
map
[
'
*
'
];
//Adjust any relative paths.
//Adjust any relative paths.
if
(
name
&&
name
.
charAt
(
0
)
===
'
.
'
)
{
if
(
name
)
{
//If have a base name, try to normalize against it,
name
=
name
.
split
(
'
/
'
);
//otherwise, assume it is a top-level require that will
lastIndex
=
name
.
length
-
1
;
//be relative to baseUrl in the end.
if
(
baseName
)
{
// If wanting node ID compatibility, strip .js from end
if
(
getOwn
(
config
.
pkgs
,
baseName
))
{
// of IDs. Have to do this here, and not in nameToUrl
//If the baseName is a package name, then just treat it as one
// because node allows either .js or non .js to map
//name to concat the name with.
// to same file.
normalizedBaseParts
=
baseParts
=
[
baseName
];
if
(
config
.
nodeIdCompat
&&
jsSuffixRegExp
.
test
(
name
[
lastIndex
]))
{
}
else
{
name
[
lastIndex
]
=
name
[
lastIndex
].
replace
(
jsSuffixRegExp
,
''
);
//Convert baseName to array, and lop off the last part,
}
//so that . matches that 'directory' and not name of the baseName's
//module. For instance, baseName of 'one/two/three', maps to
//'one/two/three.js', but we want the directory, 'one/two' for
//this normalization.
normalizedBaseParts
=
baseParts
.
slice
(
0
,
baseParts
.
length
-
1
);
}
name
=
normalizedBaseParts
.
concat
(
name
.
split
(
'
/
'
));
trimDots
(
name
);
//Some use of packages may use a . path to reference the
// Starts with a '.' so need the baseName
//'main' module name, so normalize for that.
if
(
name
[
0
].
charAt
(
0
)
===
'
.
'
&&
baseParts
)
{
pkgConfig
=
getOwn
(
config
.
pkgs
,
(
pkgName
=
name
[
0
]));
//Convert baseName to array, and lop off the last part,
name
=
name
.
join
(
'
/
'
);
//so that . matches that 'directory' and not name of the baseName's
if
(
pkgConfig
&&
name
===
pkgName
+
'
/
'
+
pkgConfig
.
main
)
{
//module. For instance, baseName of 'one/two/three', maps to
name
=
pkgName
;
//'one/two/three.js', but we want the directory, 'one/two' for
}
//this normalization.
}
else
if
(
name
.
indexOf
(
'
./
'
)
===
0
)
{
normalizedBaseParts
=
baseParts
.
slice
(
0
,
baseParts
.
length
-
1
);
// No baseName, so this is ID is resolved relative
name
=
normalizedBaseParts
.
concat
(
name
);
// to baseUrl, pull off the leading dot.
name
=
name
.
substring
(
2
);
}
}
trimDots
(
name
);
name
=
name
.
join
(
'
/
'
);
}
}
//Apply map config if available.
//Apply map config if available.
if
(
applyMap
&&
map
&&
(
baseParts
||
starMap
))
{
if
(
applyMap
&&
map
&&
(
baseParts
||
starMap
))
{
nameParts
=
name
.
split
(
'
/
'
);
nameParts
=
name
.
split
(
'
/
'
);
for
(
i
=
nameParts
.
length
;
i
>
0
;
i
-=
1
)
{
outerLoop
:
for
(
i
=
nameParts
.
length
;
i
>
0
;
i
-=
1
)
{
nameSegment
=
nameParts
.
slice
(
0
,
i
).
join
(
'
/
'
);
nameSegment
=
nameParts
.
slice
(
0
,
i
).
join
(
'
/
'
);
if
(
baseParts
)
{
if
(
baseParts
)
{
...
@@ -321,16 +320,12 @@ var requirejs, require, define;
...
@@ -321,16 +320,12 @@ var requirejs, require, define;
//Match, update name to the new value.
//Match, update name to the new value.
foundMap
=
mapValue
;
foundMap
=
mapValue
;
foundI
=
i
;
foundI
=
i
;
break
;
break
outerLoop
;
}
}
}
}
}
}
}
}
if
(
foundMap
)
{
break
;
}
//Check for a star map match, but just hold on to it,
//Check for a star map match, but just hold on to it,
//if there is a shorter segment match later in a matching
//if there is a shorter segment match later in a matching
//config, then favor over this star map.
//config, then favor over this star map.
...
@@ -351,7 +346,11 @@ var requirejs, require, define;
...
@@ -351,7 +346,11 @@ var requirejs, require, define;
}
}
}
}
return
name
;
// If the name points to a package's name, use
// the package main instead.
pkgMain
=
getOwn
(
config
.
pkgs
,
name
);
return
pkgMain
?
pkgMain
:
name
;
}
}
function
removeScript
(
name
)
{
function
removeScript
(
name
)
{
...
@@ -369,12 +368,17 @@ var requirejs, require, define;
...
@@ -369,12 +368,17 @@ var requirejs, require, define;
function
hasPathFallback
(
id
)
{
function
hasPathFallback
(
id
)
{
var
pathConfig
=
getOwn
(
config
.
paths
,
id
);
var
pathConfig
=
getOwn
(
config
.
paths
,
id
);
if
(
pathConfig
&&
isArray
(
pathConfig
)
&&
pathConfig
.
length
>
1
)
{
if
(
pathConfig
&&
isArray
(
pathConfig
)
&&
pathConfig
.
length
>
1
)
{
removeScript
(
id
);
//Pop off the first array value, since it failed, and
//Pop off the first array value, since it failed, and
//retry
//retry
pathConfig
.
shift
();
pathConfig
.
shift
();
context
.
require
.
undef
(
id
);
context
.
require
.
undef
(
id
);
context
.
require
([
id
]);
//Custom require that does not do map translation, since
//ID is "absolute", already mapped/resolved.
context
.
makeRequire
(
null
,
{
skipMap
:
true
})([
id
]);
return
true
;
return
true
;
}
}
}
}
...
@@ -440,7 +444,16 @@ var requirejs, require, define;
...
@@ -440,7 +444,16 @@ var requirejs, require, define;
return
normalize
(
name
,
parentName
,
applyMap
);
return
normalize
(
name
,
parentName
,
applyMap
);
});
});
}
else
{
}
else
{
normalizedName
=
normalize
(
name
,
parentName
,
applyMap
);
// If nested plugin references, then do not try to
// normalize, as it will not normalize correctly. This
// places a restriction on resourceIds, and the longer
// term solution is not to normalize until plugins are
// loaded and all normalizations to allow for async
// loading of a loader plugin. But for now, fixes the
// common uses. Details in #1131
normalizedName
=
name
.
indexOf
(
'
!
'
)
===
-
1
?
normalize
(
name
,
parentName
,
applyMap
)
:
name
;
}
}
}
else
{
}
else
{
//A regular module.
//A regular module.
...
@@ -500,7 +513,12 @@ var requirejs, require, define;
...
@@ -500,7 +513,12 @@ var requirejs, require, define;
fn
(
defined
[
id
]);
fn
(
defined
[
id
]);
}
}
}
else
{
}
else
{
getModule
(
depMap
).
on
(
name
,
fn
);
mod
=
getModule
(
depMap
);
if
(
mod
.
error
&&
name
===
'
error
'
)
{
fn
(
mod
.
error
);
}
else
{
mod
.
on
(
name
,
fn
);
}
}
}
}
}
...
@@ -540,7 +558,7 @@ var requirejs, require, define;
...
@@ -540,7 +558,7 @@ var requirejs, require, define;
//local var ref to defQueue, so cannot just reassign the one
//local var ref to defQueue, so cannot just reassign the one
//on context.
//on context.
apsp
.
apply
(
defQueue
,
apsp
.
apply
(
defQueue
,
[
defQueue
.
length
-
1
,
0
].
concat
(
globalDefQueue
));
[
defQueue
.
length
,
0
].
concat
(
globalDefQueue
));
globalDefQueue
=
[];
globalDefQueue
=
[];
}
}
}
}
...
@@ -557,7 +575,7 @@ var requirejs, require, define;
...
@@ -557,7 +575,7 @@ var requirejs, require, define;
mod
.
usingExports
=
true
;
mod
.
usingExports
=
true
;
if
(
mod
.
map
.
isDefine
)
{
if
(
mod
.
map
.
isDefine
)
{
if
(
mod
.
exports
)
{
if
(
mod
.
exports
)
{
return
mod
.
exports
;
return
(
defined
[
mod
.
map
.
id
]
=
mod
.
exports
)
;
}
else
{
}
else
{
return
(
mod
.
exports
=
defined
[
mod
.
map
.
id
]
=
{});
return
(
mod
.
exports
=
defined
[
mod
.
map
.
id
]
=
{});
}
}
...
@@ -571,9 +589,9 @@ var requirejs, require, define;
...
@@ -571,9 +589,9 @@ var requirejs, require, define;
id
:
mod
.
map
.
id
,
id
:
mod
.
map
.
id
,
uri
:
mod
.
map
.
url
,
uri
:
mod
.
map
.
url
,
config
:
function
()
{
config
:
function
()
{
return
(
config
.
config
&&
getOwn
(
config
.
config
,
mod
.
map
.
id
)
)
||
{};
return
getOwn
(
config
.
config
,
mod
.
map
.
id
)
||
{};
},
},
exports
:
defined
[
mod
.
map
.
id
]
exports
:
mod
.
exports
||
(
mod
.
exports
=
{})
});
});
}
}
}
}
...
@@ -614,7 +632,7 @@ var requirejs, require, define;
...
@@ -614,7 +632,7 @@ var requirejs, require, define;
}
}
function
checkLoaded
()
{
function
checkLoaded
()
{
var
map
,
modId
,
err
,
usingPathFallback
,
var
err
,
usingPathFallback
,
waitInterval
=
config
.
waitSeconds
*
1000
,
waitInterval
=
config
.
waitSeconds
*
1000
,
//It is possible to disable the wait interval by using waitSeconds of 0.
//It is possible to disable the wait interval by using waitSeconds of 0.
expired
=
waitInterval
&&
(
context
.
startTime
+
waitInterval
)
<
new
Date
().
getTime
(),
expired
=
waitInterval
&&
(
context
.
startTime
+
waitInterval
)
<
new
Date
().
getTime
(),
...
@@ -632,8 +650,8 @@ var requirejs, require, define;
...
@@ -632,8 +650,8 @@ var requirejs, require, define;
//Figure out the state of all the modules.
//Figure out the state of all the modules.
eachProp
(
enabledRegistry
,
function
(
mod
)
{
eachProp
(
enabledRegistry
,
function
(
mod
)
{
map
=
mod
.
map
;
var
map
=
mod
.
map
,
modId
=
map
.
id
;
modId
=
map
.
id
;
//Skip things that are not enabled or in error state.
//Skip things that are not enabled or in error state.
if
(
!
mod
.
enabled
)
{
if
(
!
mod
.
enabled
)
{
...
@@ -840,8 +858,13 @@ var requirejs, require, define;
...
@@ -840,8 +858,13 @@ var requirejs, require, define;
if
(
this
.
depCount
<
1
&&
!
this
.
defined
)
{
if
(
this
.
depCount
<
1
&&
!
this
.
defined
)
{
if
(
isFunction
(
factory
))
{
if
(
isFunction
(
factory
))
{
//If there is an error listener, favor passing
//If there is an error listener, favor passing
//to that instead of throwing an error.
//to that instead of throwing an error. However,
if
(
this
.
events
.
error
)
{
//only do it for define()'d modules. require
//errbacks should not be called for failures in
//their callbacks (#699). However if a global
//onError is set, use that.
if
((
this
.
events
.
error
&&
this
.
map
.
isDefine
)
||
req
.
onError
!==
defaultOnError
)
{
try
{
try
{
exports
=
context
.
execCb
(
id
,
factory
,
depExports
,
exports
);
exports
=
context
.
execCb
(
id
,
factory
,
depExports
,
exports
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -851,17 +874,14 @@ var requirejs, require, define;
...
@@ -851,17 +874,14 @@ var requirejs, require, define;
exports
=
context
.
execCb
(
id
,
factory
,
depExports
,
exports
);
exports
=
context
.
execCb
(
id
,
factory
,
depExports
,
exports
);
}
}
if
(
this
.
map
.
isDefine
)
{
// Favor return value over exports. If node/cjs in play,
//If setting exports via 'module' is in play,
// then will not have a return value anyway. Favor
//favor that over return value and exports. After that,
// module.exports assignment over exports object.
//favor a non-undefined return value over exports use.
if
(
this
.
map
.
isDefine
&&
exports
===
undefined
)
{
cjsModule
=
this
.
module
;
cjsModule
=
this
.
module
;
if
(
cjsModule
&&
if
(
cjsModule
)
{
cjsModule
.
exports
!==
undefined
&&
//Make sure it is not already the exports value
cjsModule
.
exports
!==
this
.
exports
)
{
exports
=
cjsModule
.
exports
;
exports
=
cjsModule
.
exports
;
}
else
if
(
exports
===
undefined
&&
this
.
usingExports
)
{
}
else
if
(
this
.
usingExports
)
{
//exports already set the defined value.
//exports already set the defined value.
exports
=
this
.
exports
;
exports
=
this
.
exports
;
}
}
...
@@ -869,8 +889,8 @@ var requirejs, require, define;
...
@@ -869,8 +889,8 @@ var requirejs, require, define;
if
(
err
)
{
if
(
err
)
{
err
.
requireMap
=
this
.
map
;
err
.
requireMap
=
this
.
map
;
err
.
requireModules
=
[
this
.
map
.
id
]
;
err
.
requireModules
=
this
.
map
.
isDefine
?
[
this
.
map
.
id
]
:
null
;
err
.
requireType
=
'
defin
e
'
;
err
.
requireType
=
this
.
map
.
isDefine
?
'
define
'
:
'
requir
e
'
;
return
onError
((
this
.
error
=
err
));
return
onError
((
this
.
error
=
err
));
}
}
...
@@ -921,6 +941,7 @@ var requirejs, require, define;
...
@@ -921,6 +941,7 @@ var requirejs, require, define;
on
(
pluginMap
,
'
defined
'
,
bind
(
this
,
function
(
plugin
)
{
on
(
pluginMap
,
'
defined
'
,
bind
(
this
,
function
(
plugin
)
{
var
load
,
normalizedMap
,
normalizedMod
,
var
load
,
normalizedMap
,
normalizedMod
,
bundleId
=
getOwn
(
bundlesMap
,
this
.
map
.
id
),
name
=
this
.
map
.
name
,
name
=
this
.
map
.
name
,
parentName
=
this
.
map
.
parentMap
?
this
.
map
.
parentMap
.
name
:
null
,
parentName
=
this
.
map
.
parentMap
?
this
.
map
.
parentMap
.
name
:
null
,
localRequire
=
context
.
makeRequire
(
map
.
parentMap
,
{
localRequire
=
context
.
makeRequire
(
map
.
parentMap
,
{
...
@@ -966,6 +987,14 @@ var requirejs, require, define;
...
@@ -966,6 +987,14 @@ var requirejs, require, define;
return
;
return
;
}
}
//If a paths config, then just load that file instead to
//resolve the plugin, as it is built into that paths layer.
if
(
bundleId
)
{
this
.
map
.
url
=
context
.
nameToUrl
(
bundleId
);
this
.
load
();
return
;
}
load
=
bind
(
this
,
function
(
value
)
{
load
=
bind
(
this
,
function
(
value
)
{
this
.
init
([],
function
()
{
return
value
;
},
null
,
{
this
.
init
([],
function
()
{
return
value
;
},
null
,
{
enabled
:
true
enabled
:
true
...
@@ -1093,7 +1122,7 @@ var requirejs, require, define;
...
@@ -1093,7 +1122,7 @@ var requirejs, require, define;
}));
}));
if
(
this
.
errback
)
{
if
(
this
.
errback
)
{
on
(
depMap
,
'
error
'
,
this
.
errback
);
on
(
depMap
,
'
error
'
,
bind
(
this
,
this
.
errback
)
);
}
}
}
}
...
@@ -1230,31 +1259,38 @@ var requirejs, require, define;
...
@@ -1230,31 +1259,38 @@ var requirejs, require, define;
}
}
}
}
//Save off the paths
and packages
since they require special processing,
//Save off the paths since they require special processing,
//they are additive.
//they are additive.
var
pkgs
=
config
.
pkgs
,
var
shim
=
config
.
shim
,
shim
=
config
.
shim
,
objs
=
{
objs
=
{
paths
:
true
,
paths
:
true
,
bundles
:
true
,
config
:
true
,
config
:
true
,
map
:
true
map
:
true
};
};
eachProp
(
cfg
,
function
(
value
,
prop
)
{
eachProp
(
cfg
,
function
(
value
,
prop
)
{
if
(
objs
[
prop
])
{
if
(
objs
[
prop
])
{
if
(
prop
===
'
map
'
)
{
if
(
!
config
[
prop
])
{
if
(
!
config
.
map
)
{
config
[
prop
]
=
{};
config
.
map
=
{};
}
mixin
(
config
[
prop
],
value
,
true
,
true
);
}
else
{
mixin
(
config
[
prop
],
value
,
true
);
}
}
mixin
(
config
[
prop
],
value
,
true
,
true
);
}
else
{
}
else
{
config
[
prop
]
=
value
;
config
[
prop
]
=
value
;
}
}
});
});
//Reverse map the bundles
if
(
cfg
.
bundles
)
{
eachProp
(
cfg
.
bundles
,
function
(
value
,
prop
)
{
each
(
value
,
function
(
v
)
{
if
(
v
!==
prop
)
{
bundlesMap
[
v
]
=
prop
;
}
});
});
}
//Merge shim
//Merge shim
if
(
cfg
.
shim
)
{
if
(
cfg
.
shim
)
{
eachProp
(
cfg
.
shim
,
function
(
value
,
id
)
{
eachProp
(
cfg
.
shim
,
function
(
value
,
id
)
{
...
@@ -1275,29 +1311,25 @@ var requirejs, require, define;
...
@@ -1275,29 +1311,25 @@ var requirejs, require, define;
//Adjust packages if necessary.
//Adjust packages if necessary.
if
(
cfg
.
packages
)
{
if
(
cfg
.
packages
)
{
each
(
cfg
.
packages
,
function
(
pkgObj
)
{
each
(
cfg
.
packages
,
function
(
pkgObj
)
{
var
location
;
var
location
,
name
;
pkgObj
=
typeof
pkgObj
===
'
string
'
?
{
name
:
pkgObj
}
:
pkgObj
;
pkgObj
=
typeof
pkgObj
===
'
string
'
?
{
name
:
pkgObj
}
:
pkgObj
;
name
=
pkgObj
.
name
;
location
=
pkgObj
.
location
;
location
=
pkgObj
.
location
;
if
(
location
)
{
config
.
paths
[
name
]
=
pkgObj
.
location
;
}
//Create a brand new object on pkgs, since currentPackages can
//Save pointer to main module ID for pkg name.
//be passed in again, and config.pkgs is the internal transformed
//Remove leading dot in main, so main paths are normalized,
//state for all package configs.
//and remove any trailing .js, since different package
pkgs
[
pkgObj
.
name
]
=
{
//envs have different conventions: some use a module name,
name
:
pkgObj
.
name
,
//some use a file name.
location
:
location
||
pkgObj
.
name
,
config
.
pkgs
[
name
]
=
pkgObj
.
name
+
'
/
'
+
(
pkgObj
.
main
||
'
main
'
)
//Remove leading dot in main, so main paths are normalized,
.
replace
(
currDirRegExp
,
''
)
//and remove any trailing .js, since different package
.
replace
(
jsSuffixRegExp
,
''
);
//envs have different conventions: some use a module name,
//some use a file name.
main
:
(
pkgObj
.
main
||
'
main
'
)
.
replace
(
currDirRegExp
,
''
)
.
replace
(
jsSuffixRegExp
,
''
)
};
});
});
//Done with modifications, assing packages back to context config
config
.
pkgs
=
pkgs
;
}
}
//If there are any "waiting to execute" modules in the registry,
//If there are any "waiting to execute" modules in the registry,
...
@@ -1444,10 +1476,21 @@ var requirejs, require, define;
...
@@ -1444,10 +1476,21 @@ var requirejs, require, define;
var
map
=
makeModuleMap
(
id
,
relMap
,
true
),
var
map
=
makeModuleMap
(
id
,
relMap
,
true
),
mod
=
getOwn
(
registry
,
id
);
mod
=
getOwn
(
registry
,
id
);
removeScript
(
id
);
delete
defined
[
id
];
delete
defined
[
id
];
delete
urlFetched
[
map
.
url
];
delete
urlFetched
[
map
.
url
];
delete
undefEvents
[
id
];
delete
undefEvents
[
id
];
//Clean queued defines too. Go backwards
//in array so that the splices do not
//mess up the iteration.
eachReverse
(
defQueue
,
function
(
args
,
i
)
{
if
(
args
[
0
]
===
id
)
{
defQueue
.
splice
(
i
,
1
);
}
});
if
(
mod
)
{
if
(
mod
)
{
//Hold on to listeners in case the
//Hold on to listeners in case the
//module will be attempted to be reloaded
//module will be attempted to be reloaded
...
@@ -1467,7 +1510,7 @@ var requirejs, require, define;
...
@@ -1467,7 +1510,7 @@ var requirejs, require, define;
/**
/**
* Called to enable a module if it is still in the registry
* Called to enable a module if it is still in the registry
* awaiting enablement. A second arg, parent, the parent module,
* awaiting enablement. A second arg, parent, the parent module,
* is passed in for context, when this method is overriden by
* is passed in for context, when this method is overrid
d
en by
* the optimizer. Not shown here to keep code compact.
* the optimizer. Not shown here to keep code compact.
*/
*/
enable
:
function
(
depMap
)
{
enable
:
function
(
depMap
)
{
...
@@ -1541,8 +1584,19 @@ var requirejs, require, define;
...
@@ -1541,8 +1584,19 @@ var requirejs, require, define;
* internal API, not a public one. Use toUrl for the public API.
* internal API, not a public one. Use toUrl for the public API.
*/
*/
nameToUrl
:
function
(
moduleName
,
ext
,
skipExt
)
{
nameToUrl
:
function
(
moduleName
,
ext
,
skipExt
)
{
var
paths
,
pkgs
,
pkg
,
pkgPath
,
syms
,
i
,
parentModule
,
url
,
var
paths
,
syms
,
i
,
parentModule
,
url
,
parentPath
;
parentPath
,
bundleId
,
pkgMain
=
getOwn
(
config
.
pkgs
,
moduleName
);
if
(
pkgMain
)
{
moduleName
=
pkgMain
;
}
bundleId
=
getOwn
(
bundlesMap
,
moduleName
);
if
(
bundleId
)
{
return
context
.
nameToUrl
(
bundleId
,
ext
,
skipExt
);
}
//If a colon is in the URL, it indicates a protocol is used and it is just
//If a colon is in the URL, it indicates a protocol is used and it is just
//an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
//an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
...
@@ -1556,7 +1610,6 @@ var requirejs, require, define;
...
@@ -1556,7 +1610,6 @@ var requirejs, require, define;
}
else
{
}
else
{
//A module that needs to be converted to a path.
//A module that needs to be converted to a path.
paths
=
config
.
paths
;
paths
=
config
.
paths
;
pkgs
=
config
.
pkgs
;
syms
=
moduleName
.
split
(
'
/
'
);
syms
=
moduleName
.
split
(
'
/
'
);
//For each module name segment, see if there is a path
//For each module name segment, see if there is a path
...
@@ -1564,7 +1617,7 @@ var requirejs, require, define;
...
@@ -1564,7 +1617,7 @@ var requirejs, require, define;
//and work up from it.
//and work up from it.
for
(
i
=
syms
.
length
;
i
>
0
;
i
-=
1
)
{
for
(
i
=
syms
.
length
;
i
>
0
;
i
-=
1
)
{
parentModule
=
syms
.
slice
(
0
,
i
).
join
(
'
/
'
);
parentModule
=
syms
.
slice
(
0
,
i
).
join
(
'
/
'
);
pkg
=
getOwn
(
pkgs
,
parentModule
);
parentPath
=
getOwn
(
paths
,
parentModule
);
parentPath
=
getOwn
(
paths
,
parentModule
);
if
(
parentPath
)
{
if
(
parentPath
)
{
//If an array, it means there are a few choices,
//If an array, it means there are a few choices,
...
@@ -1574,22 +1627,12 @@ var requirejs, require, define;
...
@@ -1574,22 +1627,12 @@ var requirejs, require, define;
}
}
syms
.
splice
(
0
,
i
,
parentPath
);
syms
.
splice
(
0
,
i
,
parentPath
);
break
;
break
;
}
else
if
(
pkg
)
{
//If module name is just the package name, then looking
//for the main module.
if
(
moduleName
===
pkg
.
name
)
{
pkgPath
=
pkg
.
location
+
'
/
'
+
pkg
.
main
;
}
else
{
pkgPath
=
pkg
.
location
;
}
syms
.
splice
(
0
,
i
,
pkgPath
);
break
;
}
}
}
}
//Join the path parts together, then figure out if baseUrl is needed.
//Join the path parts together, then figure out if baseUrl is needed.
url
=
syms
.
join
(
'
/
'
);
url
=
syms
.
join
(
'
/
'
);
url
+=
(
ext
||
(
/
\?
/
.
test
(
url
)
||
skipExt
?
''
:
'
.js
'
));
url
+=
(
ext
||
(
/
^data
\:
|
\?
/
.
test
(
url
)
||
skipExt
?
''
:
'
.js
'
));
url
=
(
url
.
charAt
(
0
)
===
'
/
'
||
url
.
match
(
/^
[\w\+\.\-]
+:/
)
?
''
:
config
.
baseUrl
)
+
url
;
url
=
(
url
.
charAt
(
0
)
===
'
/
'
||
url
.
match
(
/^
[\w\+\.\-]
+:/
)
?
''
:
config
.
baseUrl
)
+
url
;
}
}
...
@@ -1605,7 +1648,7 @@ var requirejs, require, define;
...
@@ -1605,7 +1648,7 @@ var requirejs, require, define;
},
},
/**
/**
* Executes a module callack function. Broken out as a separate function
* Executes a module call
b
ack function. Broken out as a separate function
* solely to allow the build system to sequence the files in the built
* solely to allow the build system to sequence the files in the built
* layer in the right sequence.
* layer in the right sequence.
*
*
...
@@ -1643,7 +1686,7 @@ var requirejs, require, define;
...
@@ -1643,7 +1686,7 @@ var requirejs, require, define;
onScriptError
:
function
(
evt
)
{
onScriptError
:
function
(
evt
)
{
var
data
=
getScriptData
(
evt
);
var
data
=
getScriptData
(
evt
);
if
(
!
hasPathFallback
(
data
.
id
))
{
if
(
!
hasPathFallback
(
data
.
id
))
{
return
onError
(
makeError
(
'
scripterror
'
,
'
Script error
'
,
evt
,
[
data
.
id
]));
return
onError
(
makeError
(
'
scripterror
'
,
'
Script error
for:
'
+
data
.
id
,
evt
,
[
data
.
id
]));
}
}
}
}
};
};
...
@@ -1772,8 +1815,19 @@ var requirejs, require, define;
...
@@ -1772,8 +1815,19 @@ var requirejs, require, define;
* function. Intercept/override it if you want custom error handling.
* function. Intercept/override it if you want custom error handling.
* @param {Error} err the error object.
* @param {Error} err the error object.
*/
*/
req
.
onError
=
function
(
err
)
{
req
.
onError
=
defaultOnError
;
throw
err
;
/**
* Creates the node for the load command. Only used in browser envs.
*/
req
.
createNode
=
function
(
config
,
moduleName
,
url
)
{
var
node
=
config
.
xhtml
?
document
.
createElementNS
(
'
http://www.w3.org/1999/xhtml
'
,
'
html:script
'
)
:
document
.
createElement
(
'
script
'
);
node
.
type
=
config
.
scriptType
||
'
text/javascript
'
;
node
.
charset
=
'
utf-8
'
;
node
.
async
=
true
;
return
node
;
};
};
/**
/**
...
@@ -1790,12 +1844,7 @@ var requirejs, require, define;
...
@@ -1790,12 +1844,7 @@ var requirejs, require, define;
node
;
node
;
if
(
isBrowser
)
{
if
(
isBrowser
)
{
//In the browser so use a script tag
//In the browser so use a script tag
node
=
config
.
xhtml
?
node
=
req
.
createNode
(
config
,
moduleName
,
url
);
document
.
createElementNS
(
'
http://www.w3.org/1999/xhtml
'
,
'
html:script
'
)
:
document
.
createElement
(
'
script
'
);
node
.
type
=
config
.
scriptType
||
'
text/javascript
'
;
node
.
charset
=
'
utf-8
'
;
node
.
async
=
true
;
node
.
setAttribute
(
'
data-requirecontext
'
,
context
.
contextName
);
node
.
setAttribute
(
'
data-requirecontext
'
,
context
.
contextName
);
node
.
setAttribute
(
'
data-requiremodule
'
,
moduleName
);
node
.
setAttribute
(
'
data-requiremodule
'
,
moduleName
);
...
@@ -1892,7 +1941,7 @@ var requirejs, require, define;
...
@@ -1892,7 +1941,7 @@ var requirejs, require, define;
}
}
//Look for a data-main script attribute, which could also adjust the baseUrl.
//Look for a data-main script attribute, which could also adjust the baseUrl.
if
(
isBrowser
)
{
if
(
isBrowser
&&
!
cfg
.
skipDataMain
)
{
//Figure out baseUrl. Get it from the script tag with require.js in it.
//Figure out baseUrl. Get it from the script tag with require.js in it.
eachReverse
(
scripts
(),
function
(
script
)
{
eachReverse
(
scripts
(),
function
(
script
)
{
//Set the 'head' where we can append children by
//Set the 'head' where we can append children by
...
@@ -1906,24 +1955,31 @@ var requirejs, require, define;
...
@@ -1906,24 +1955,31 @@ var requirejs, require, define;
//baseUrl, if it is not already set.
//baseUrl, if it is not already set.
dataMain
=
script
.
getAttribute
(
'
data-main
'
);
dataMain
=
script
.
getAttribute
(
'
data-main
'
);
if
(
dataMain
)
{
if
(
dataMain
)
{
//Preserve dataMain in case it is a path (i.e. contains '?')
mainScript
=
dataMain
;
//Set final baseUrl if there is not already an explicit one.
//Set final baseUrl if there is not already an explicit one.
if
(
!
cfg
.
baseUrl
)
{
if
(
!
cfg
.
baseUrl
)
{
//Pull off the directory of data-main for use as the
//Pull off the directory of data-main for use as the
//baseUrl.
//baseUrl.
src
=
dataMain
.
split
(
'
/
'
);
src
=
mainScript
.
split
(
'
/
'
);
mainScript
=
src
.
pop
();
mainScript
=
src
.
pop
();
subPath
=
src
.
length
?
src
.
join
(
'
/
'
)
+
'
/
'
:
'
./
'
;
subPath
=
src
.
length
?
src
.
join
(
'
/
'
)
+
'
/
'
:
'
./
'
;
cfg
.
baseUrl
=
subPath
;
cfg
.
baseUrl
=
subPath
;
dataMain
=
mainScript
;
}
}
//Strip off any trailing .js since
dataMain
is now
//Strip off any trailing .js since
mainScript
is now
//like a module name.
//like a module name.
dataMain
=
dataMain
.
replace
(
jsSuffixRegExp
,
''
);
mainScript
=
mainScript
.
replace
(
jsSuffixRegExp
,
''
);
//If mainScript is still a path, fall back to dataMain
if
(
req
.
jsExtRegExp
.
test
(
mainScript
))
{
mainScript
=
dataMain
;
}
//Put the data-main script in the files to load.
//Put the data-main script in the files to load.
cfg
.
deps
=
cfg
.
deps
?
cfg
.
deps
.
concat
(
dataMain
)
:
[
dataMain
];
cfg
.
deps
=
cfg
.
deps
?
cfg
.
deps
.
concat
(
mainScript
)
:
[
mainScript
];
return
true
;
return
true
;
}
}
...
@@ -1951,12 +2007,13 @@ var requirejs, require, define;
...
@@ -1951,12 +2007,13 @@ var requirejs, require, define;
//This module may not have dependencies
//This module may not have dependencies
if
(
!
isArray
(
deps
))
{
if
(
!
isArray
(
deps
))
{
callback
=
deps
;
callback
=
deps
;
deps
=
[]
;
deps
=
null
;
}
}
//If no name, and callback is a function, then figure out if it a
//If no name, and callback is a function, then figure out if it a
//CommonJS thing with dependencies.
//CommonJS thing with dependencies.
if
(
!
deps
.
length
&&
isFunction
(
callback
))
{
if
(
!
deps
&&
isFunction
(
callback
))
{
deps
=
[];
//Remove comments from the callback string,
//Remove comments from the callback string,
//look for require calls, and pull them into the dependencies,
//look for require calls, and pull them into the dependencies,
//but only if there are function args.
//but only if there are function args.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment