123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718 |
- define("dojo/_base/loader", ["./kernel", "../has", "require", "module", "./json", "./lang", "./array"], function(dojo, has, require, thisModule, json, lang, array) {
-
-
-
-
-
-
- if (!1){
- console.error("cannot load the Dojo v1.x loader with a foreign loader");
- return 0;
- }
- var makeErrorToken = function(id){
- return {src:thisModule.id, id:id};
- },
- slashName = function(name){
- return name.replace(/\./g, "/");
- },
- buildDetectRe = /\/\/>>built/,
- dojoRequireCallbacks = [],
- dojoRequireModuleStack = [],
- dojoRequirePlugin = function(mid, require, loaded){
- dojoRequireCallbacks.push(loaded);
- array.forEach(mid.split(","), function(mid){
- var module = getModule(mid, require.module);
- dojoRequireModuleStack.push(module);
- injectModule(module);
- });
- checkDojoRequirePlugin();
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- touched,
- traverse = function(m){
- touched[m.mid] = 1;
- for(var t, module, deps = m.deps || [], i= 0; i<deps.length; i++){
- module = deps[i];
- if(!(t = touched[module.mid])){
- if(t===0 || !traverse(module)){
- touched[m.mid] = 0;
- return false;
- }
- }
- }
- return true;
- },
- checkDojoRequirePlugin = function(){
-
-
-
-
-
-
-
- var module, mid;
- touched = {};
- for(mid in modules){
- module = modules[mid];
-
- if(module.executed || module.noReqPluginCheck){
- touched[mid] = 1;
- }else{
- if(module.noReqPluginCheck!==0){
-
- module.noReqPluginCheck = /loadInit\!/.test(mid) || /require\!/.test(mid) ? 1 : 0;
- }
- if(module.noReqPluginCheck){
- touched[mid] = 1;
- }else if(module.injected!==arrived){
-
- touched[mid] = 0;
- }
- }
- }
- for(var t, i = 0, end = dojoRequireModuleStack.length; i<end; i++){
- module = dojoRequireModuleStack[i];
- if(!(t = touched[module.mid])){
- if(t===0 || !traverse(module)){
- return;
- }
- }
- }
- loaderVars.holdIdle();
- var oldCallbacks = dojoRequireCallbacks;
- dojoRequireCallbacks = [];
- array.forEach(oldCallbacks, function(cb){cb(1);});
- loaderVars.releaseIdle();
- },
- dojoLoadInitPlugin = function(mid, require, loaded){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- require([mid], function(bundle){
-
- require(bundle.names, function(){
-
- for(var scopeText = "", args= [], i = 0; i<arguments.length; i++){
- scopeText+= "var " + bundle.names[i] + "= arguments[" + i + "]; ";
- args.push(arguments[i]);
- }
- eval(scopeText);
- var callingModule = require.module,
- deps = [],
- hold = {},
- requireList = [],
- p,
- syncLoaderApi = {
- provide:function(moduleName){
-
- moduleName = slashName(moduleName);
- var providedModule = getModule(moduleName, callingModule);
- if(providedModule!==callingModule){
- setArrived(providedModule);
- }
- },
- require:function(moduleName, omitModuleCheck){
- moduleName = slashName(moduleName);
- omitModuleCheck && (getModule(moduleName, callingModule).result = nonmodule);
- requireList.push(moduleName);
- },
- requireLocalization:function(moduleName, bundleName, locale){
-
- deps.length || (deps = ["dojo/i18n"]);
-
- locale = (locale || dojo.locale).toLowerCase();
- moduleName = slashName(moduleName) + "/nls/" + (/root/i.test(locale) ? "" : locale + "/") + slashName(bundleName);
- if(getModule(moduleName, callingModule).isXd){
- deps.push("dojo/i18n!" + moduleName);
- }
- },
- loadInit:function(f){
- f();
- }
- };
-
- try{
- for(p in syncLoaderApi){
- hold[p] = dojo[p];
- dojo[p] = syncLoaderApi[p];
- }
- bundle.def.apply(null, args);
- }catch(e){
- signal("error", [makeErrorToken("failedDojoLoadInit"), e]);
- }finally{
- for(p in syncLoaderApi){
- dojo[p] = hold[p];
- }
- }
-
- requireList.length && deps.push("dojo/require!" + requireList.join(","));
- dojoRequireCallbacks.push(loaded);
- array.forEach(requireList, function(mid){
- var module = getModule(mid, require.module);
- dojoRequireModuleStack.push(module);
- injectModule(module);
- });
- checkDojoRequirePlugin();
- });
- });
- },
- extractApplication = function(
- text, // the text to search
- startSearch, // the position in text to start looking for the closing paren
- startApplication // the position in text where the function application expression starts
- ){
-
-
- var parenRe = /\(|\)/g,
- matchCount = 1,
- match;
- parenRe.lastIndex = startSearch;
- while((match = parenRe.exec(text))){
- if(match[0] == ")"){
- matchCount -= 1;
- }else{
- matchCount += 1;
- }
- if(matchCount == 0){
- break;
- }
- }
- if(matchCount != 0){
- throw "unmatched paren around character " + parenRe.lastIndex + " in: " + text;
- }
-
- return [dojo.trim(text.substring(startApplication, parenRe.lastIndex))+";\n", parenRe.lastIndex];
- },
-
-
-
-
-
-
-
-
-
-
-
-
- removeCommentRe = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
- syncLoaderApiRe = /(^|\s)dojo\.(loadInit|require|provide|requireLocalization|requireIf|requireAfterIf|platformRequire)\s*\(/mg,
- amdLoaderApiRe = /(^|\s)(require|define)\s*\(/m,
- extractLegacyApiApplications = function(text, noCommentText){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var match, startSearch, startApplication, application,
- loadInitApplications = [],
- otherApplications = [],
- allApplications = [];
-
- noCommentText = noCommentText || text.replace(removeCommentRe, function(match){
-
-
- syncLoaderApiRe.lastIndex = amdLoaderApiRe.lastIndex = 0;
- return (syncLoaderApiRe.test(match) || amdLoaderApiRe.test(match)) ? "" : match;
- });
-
- while((match = syncLoaderApiRe.exec(noCommentText))){
- startSearch = syncLoaderApiRe.lastIndex;
- startApplication = startSearch - match[0].length;
- application = extractApplication(noCommentText, startSearch, startApplication);
- if(match[2]=="loadInit"){
- loadInitApplications.push(application[0]);
- }else{
- otherApplications.push(application[0]);
- }
- syncLoaderApiRe.lastIndex = application[1];
- }
- allApplications = loadInitApplications.concat(otherApplications);
- if(allApplications.length || !amdLoaderApiRe.test(noCommentText)){
-
- return [text.replace(/(^|\s)dojo\.loadInit\s*\(/g, "\n0 && dojo.loadInit("), allApplications.join(""), allApplications];
- }else{
-
- return 0;
- }
- },
- transformToAmd = function(module, text){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var extractResult, id, names = [], namesAsStrings = [];
- if(buildDetectRe.test(text) || !(extractResult = extractLegacyApiApplications(text))){
-
-
- return 0;
- }
-
- id = module.mid + "-*loadInit";
-
-
- for(var p in getModule("dojo", module).result.scopeMap){
- names.push(p);
- namesAsStrings.push('"' + p + '"');
- }
-
- return "// xdomain rewrite of " + module.path + "\n" +
- "define('" + id + "',{\n" +
- "\tnames:" + dojo.toJson(names) + ",\n" +
- "\tdef:function(" + names.join(",") + "){" + extractResult[1] + "}" +
- "});\n\n" +
- "define(" + dojo.toJson(names.concat(["dojo/loadInit!"+id])) + ", function(" + names.join(",") + "){\n" + extractResult[0] + "});";
- },
- loaderVars = require.initSyncLoader(dojoRequirePlugin, checkDojoRequirePlugin, transformToAmd),
- sync =
- loaderVars.sync,
- xd =
- loaderVars.xd,
- arrived =
- loaderVars.arrived,
- nonmodule =
- loaderVars.nonmodule,
- executing =
- loaderVars.executing,
- executed =
- loaderVars.executed,
- syncExecStack =
- loaderVars.syncExecStack,
- modules =
- loaderVars.modules,
- execQ =
- loaderVars.execQ,
- getModule =
- loaderVars.getModule,
- injectModule =
- loaderVars.injectModule,
- setArrived =
- loaderVars.setArrived,
- signal =
- loaderVars.signal,
- finishExec =
- loaderVars.finishExec,
- execModule =
- loaderVars.execModule,
- getLegacyMode =
- loaderVars.getLegacyMode;
- dojo.provide = function(mid){
- var executingModule = syncExecStack[0],
- module = lang.mixin(getModule(slashName(mid), require.module), {
- executed:executing,
- result:lang.getObject(mid, true)
- });
- setArrived(module);
- if(executingModule){
- (executingModule.provides || (executingModule.provides = [])).push(function(){
- module.result = lang.getObject(mid);
- delete module.provides;
- module.executed!==executed && finishExec(module);
- });
- }
- return module.result;
- };
- has.add("config-publishRequireResult", 1, 0, 0);
- dojo.require = function(moduleName, omitModuleCheck) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function doRequire(mid, omitModuleCheck){
- var module = getModule(slashName(mid), require.module);
- if(syncExecStack.length && syncExecStack[0].finish){
-
-
- syncExecStack[0].finish.push(mid);
- return undefined;
- }
-
- if(module.executed){
- return module.result;
- }
- omitModuleCheck && (module.result = nonmodule);
- var currentMode = getLegacyMode();
-
-
-
- injectModule(module);
-
- currentMode = getLegacyMode();
-
- if(module.executed!==executed && module.injected===arrived){
-
-
- loaderVars.holdIdle();
- execModule(module);
- loaderVars.releaseIdle();
- }
- if(module.executed){
- return module.result;
- }
- if(currentMode==sync){
-
-
-
- if(module.cjs){
-
- execQ.unshift(module);
- }else{
-
- syncExecStack.length && (syncExecStack[0].finish= [mid]);
- }
- }else{
-
-
- execQ.push(module);
- }
- return undefined;
- }
- var result = doRequire(moduleName, omitModuleCheck);
- if(has("config-publishRequireResult") && !lang.exists(moduleName) && result!==undefined){
- lang.setObject(moduleName, result);
- }
- return result;
- };
- dojo.loadInit = function(f) {
- f();
- };
- dojo.registerModulePath = function(/*String*/moduleName, /*String*/prefix){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var paths = {};
- paths[moduleName.replace(/\./g, "/")] = prefix;
- require({paths:paths});
- };
- dojo.platformRequire = function(/*Object*/modMap){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var result = (modMap.common || []).concat(modMap[dojo._name] || modMap["default"] || []),
- temp;
- while(result.length){
- if(lang.isArray(temp = result.shift())){
- dojo.require.apply(dojo, temp);
- }else{
- dojo.require(temp);
- }
- }
- };
- dojo.requireIf = dojo.requireAfterIf = function(/*Boolean*/ condition, /*String*/ moduleName, /*Boolean?*/omitModuleCheck){
-
-
-
-
-
-
- if(condition){
- dojo.require(moduleName, omitModuleCheck);
- }
- };
- dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale){
- require(["../i18n"], function(i18n){
- i18n.getLocalization(moduleName, bundleName, locale);
- });
- };
- return {
- extractLegacyApiApplications:extractLegacyApiApplications,
- require:loaderVars.dojoRequirePlugin,
- loadInit:dojoLoadInitPlugin
- };
- });
|