kopia lustrzana https://github.com/c9/core
add recursive require.undef for sdk
rodzic
a7dc2d7496
commit
e5de2372c3
|
@ -282,7 +282,13 @@ config.packages = Object.create(null);
|
||||||
config.paths = Object.create(null);
|
config.paths = Object.create(null);
|
||||||
config.baseUrl = "";
|
config.baseUrl = "";
|
||||||
|
|
||||||
require.undef = function(module, callback) {
|
require.undef = function(module, recursive) {
|
||||||
|
if (recursive) {
|
||||||
|
var root = (module + "/").replace("//", "/");
|
||||||
|
$undefAll(root, define.errors);
|
||||||
|
$undefAll(root, define.loaded);
|
||||||
|
$undefAll(root, define.modules);
|
||||||
|
}
|
||||||
module = normalizeName("", module);
|
module = normalizeName("", module);
|
||||||
var path = require.toUrl(module, ".js");
|
var path = require.toUrl(module, ".js");
|
||||||
delete define.errors[module];
|
delete define.errors[module];
|
||||||
|
@ -291,6 +297,12 @@ require.undef = function(module, callback) {
|
||||||
delete define.fetchedUrls[path];
|
delete define.fetchedUrls[path];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function $undefAll(module, hash) {
|
||||||
|
for (var i in hash)
|
||||||
|
if (i.lastIndexOf(module, 0) == 0)
|
||||||
|
require.undef(i);
|
||||||
|
}
|
||||||
|
|
||||||
require.MODULE_LOAD_URL = MODULE_LOAD_URL;
|
require.MODULE_LOAD_URL = MODULE_LOAD_URL;
|
||||||
|
|
||||||
require.toUrl = function(moduleName, ext, skipExt) {
|
require.toUrl = function(moduleName, ext, skipExt) {
|
||||||
|
|
|
@ -239,7 +239,7 @@ define(function(require, exports, module) {
|
||||||
paths[config.packagePath] = config.staticPrefix;
|
paths[config.packagePath] = config.staticPrefix;
|
||||||
|
|
||||||
requirejs.config({ paths: paths });
|
requirejs.config({ paths: paths });
|
||||||
requirejs.undef([config.packagePath, "__installed__.js"].join("/"));
|
requirejs.undef(config.packagePath, true);
|
||||||
|
|
||||||
require([[config.packagePath, "__installed__"].join("/")], function(installed) {
|
require([[config.packagePath, "__installed__"].join("/")], function(installed) {
|
||||||
callback(null, installed);
|
callback(null, installed);
|
||||||
|
|
Ładowanie…
Reference in New Issue