3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -0,0 +1,82 @@
define('c1',{
name: 'c1'
});
define('c1/sub',{
name: 'c1/sub'
});
define('a',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
define('c',{
name: 'c'
});
define('c/sub',{
name: 'c/sub'
});
define('b',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
define('c2',{
name: 'c2'
});
define('c2/sub',{
name: 'c2/sub'
});
define('a/sub/one',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
require({
baseUrl: './',
paths: {
a: 'a1'
},
map: {
'a': {
c: 'c1'
},
'a/sub/one': {
'c': 'c2'
}
}
},
['a', 'b', 'c', 'a/sub/one'],
function(a, b, c, one) {
doh.register(
'mapConfig',
[
function mapConfig(t){
t.is('c1', a.c.name);
t.is('c1/sub', a.csub.name);
t.is('c2', one.c.name);
t.is('c2/sub', one.csub.name);
t.is('c', b.c.name);
t.is('c/sub', b.csub.name);
t.is('c', c.name);
}
]
);
doh.run();
}
);
define("mapConfig-tests", function(){});

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: Map Config Built Test</title>
<script type="text/javascript" src="../../../require.js"></script>
<script type="text/javascript" src="../../doh/runner.js"></script>
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
<script type="text/javascript" src="mapConfig-tests.js"></script>
</head>
<body>
<h1>require.js: Map Config Built Test</h1>
<p>Test using the map config after a build.</p>
<p>Check console for messages</p>
</body>
</html>

View File

@@ -0,0 +1,91 @@
define('plug',{
load: function (name, require, load, config) {
if (!name) {
name = 'main';
} else if (name.charAt(0) === '/') {
name = 'main' + name;
}
//Only grab the first segment of the name.
//This is just to be different, nothing
//that is required behavior.
name = name.split('/').shift();
name = 'plug/' + name;
require([name], load);
}
});
define('plug/c1',{
name: 'plug!c1'
});
define('a',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
define('plug/main',{
name: 'plug!main'
});
define('b',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
define('plug/c2',{
name: 'plug!c2'
});
define('a/sub/one',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
require({
baseUrl: './',
paths: {
a: 'a1'
},
map: {
'*': {
c: 'plug!'
},
'a': {
c: 'plug!c1'
},
'a/sub/one': {
'c': 'plug!c2'
}
}
},
['a', 'b', 'c', 'a/sub/one'],
function(a, b, c, one) {
doh.register(
'mapConfigPlugin',
[
function mapConfigPlugin(t){
t.is('plug!c1', a.c.name);
t.is('plug!c1', a.csub.name);
t.is('plug!c2', one.c.name);
t.is('plug!c2', one.csub.name);
t.is('plug!main', b.c.name);
t.is('plug!main', b.csub.name);
t.is('plug!main', c.name);
}
]
);
doh.run();
}
);
define("mapConfigPlugin-tests", function(){});

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: Map Config Plugin Built Test</title>
<script type="text/javascript" src="../../../require.js"></script>
<script type="text/javascript" src="../../doh/runner.js"></script>
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
<script type="text/javascript" src="mapConfigPlugin-tests.js"></script>
</head>
<body>
<h1>require.js: Map Config Plugin Built Test</h1>
<p>Test using the map config with plugin value after a build.</p>
<p>Check console for messages</p>
</body>
</html>

View File

@@ -0,0 +1,100 @@
define('c1',{
name: 'c1'
});
define('c1/sub',{
name: 'c1/sub'
});
define('a',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
define('another/minor',{
name: 'another/minor'
});
define('another/c',['./minor'], function (minor) {
return {
name: 'another/c',
minorName: minor.name
};
});
define('another/c/dim',{
name: 'another/c/dim'
});
define('another/c/sub',['./dim'], function (dim) {
return {
name: 'another/c/sub',
dimName: dim.name
};
});
define('b',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
define('c2',{
name: 'c2'
});
define('a/sub/one',['c', 'c/sub'], function (c, csub) {
return {
c: c,
csub: csub
};
});
require({
baseUrl: './',
paths: {
a: 'a1'
},
map: {
'*': {
'c': 'another/c'
},
'a': {
c: 'c1'
},
'a/sub/one': {
'c': 'c2',
'c/sub': 'another/c/sub'
}
}
},
['a', 'b', 'c', 'a/sub/one'],
function(a, b, c, one) {
doh.register(
'mapConfigStar',
[
function mapConfigStar(t){
t.is('c1', a.c.name);
t.is('c1/sub', a.csub.name);
t.is('c2', one.c.name);
t.is('another/c/sub', one.csub.name);
t.is('another/c/dim', one.csub.dimName);
t.is('another/c', b.c.name);
t.is('another/minor', b.c.minorName);
t.is('another/c/sub', b.csub.name);
t.is('another/c', c.name);
t.is('another/minor', c.minorName);
}
]
);
doh.run();
}
);
define("mapConfigStar-tests", function(){});

View File

@@ -0,0 +1,49 @@
define('d',{
name: 'd'
});
define('adapter/d',['d'], function(d) {
d.adapted = true;
return d;
});
define('e',['d'], function (d) {
return {
name: 'e',
d: d
};
});
/*global doh */
require({
baseUrl: './',
map: {
'*': {
'd': 'adapter/d'
},
'adapter/d': {
d: 'd'
}
}
},
['e', 'adapter/d'],
function(e, adapterD) {
doh.register(
'mapConfigStarAdapter',
[
function mapConfigStarAdapter(t){
t.is('e', e.name);
t.is('d', e.d.name);
t.is(true, e.d.adapted);
t.is(true, adapterD.adapted);
t.is('d', adapterD.name);
}
]
);
doh.run();
}
);
define("mapConfigStarAdapter-tests", function(){});

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: Map Config Star Adapter Built Test</title>
<script type="text/javascript" src="../../../require.js"></script>
<script type="text/javascript" src="../../doh/runner.js"></script>
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
<script type="text/javascript" src="mapConfigStarAdapter-tests.js"></script>
</head>
<body>
<h1>require.js: Map Config Star Adapter Built Test</h1>
<p>Test using '*' with an adapter in the built map config.</p>
<p>Check console for messages</p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: Map Config Star Built Test</title>
<script type="text/javascript" src="../../../require.js"></script>
<script type="text/javascript" src="../../doh/runner.js"></script>
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
<script type="text/javascript" src="mapConfigStar-tests.js"></script>
</head>
<body>
<h1>require.js: Map Config Star Built Test</h1>
<p>Test using '*' in the built map config.</p>
<p>Check console for messages</p>
</body>
</html>