Debian Codegraph @

tests/plugins/plugins.js

raw
1
2 (function () {
3
4 function parse(name) {
5 var parts = name.split('?'),
6 index = parseInt(parts[0], 10),
7 choices = parts[1].split(':'),
8 choice = choices[index];
9
10 return {
11 index: index,
12 choices: choices,
13 choice: choice
14 };
15 }
16
17 define('index',{
18 pluginBuilder: './indexBuilder',
19 normalize: function (name, normalize) {
20 var parsed = parse(name),
21 choices = parsed.choices;
22
23 //Normalize each path choice.
24 for (i = 0; i < choices.length; i++) {
25 choices[i] = normalize(choices[i]);
26 }
27
28 return parsed.index + '?' + choices.join(':');
29 },
30
31 load: function (name, req, load, config) {
32 req([parse(name).choice], function (value) {
33 load(value);
34 });
35 }
36 });
37
38 }());
39
40 define('a',{
41 name: 'a'
42 });
43
44 define('c',{
45 name: "c"
46 });
47
48 define('b',[],function () {
49 return {
50 name: "b"
51 };
52 });
53
54 define('earth',['require','./index!0?./a:./b:./c','./index!2?./a:./b:./c','./index!1?./a:./b:./c'],function (require) {
55 return {
56 getA: function () {
57 return require("./index!0?./a:./b:./c");
58 },
59 getC: function () {
60 return require("./index!2?./a:./b:./c");
61 },
62 getB: function () {
63 return require("./index!1?./a:./b:./c");
64 }
65 };
66 });
67
68 define('prime/a',{
69 name: 'aPrime'
70 });
71
72 define('prime/c',{
73 name: "cPrime"
74 });
75
76 define('prime/b',[],function () {
77 return {
78 name: "bPrime"
79 };
80 });
81
82 define('prime/earth',['require','../index!0?./a:./b:./c','../index!2?./a:./b:./c','../index!1?./a:./b:./c'],function (require) {
83 return {
84 getA: function () {
85 return require("../index!0?./a:./b:./c");
86 },
87 getC: function () {
88 return require("../index!2?./a:./b:./c");
89 },
90 getB: function () {
91 return require("../index!1?./a:./b:./c");
92 }
93 };
94 });