Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
var childContainer = router.container.createChild();
var viewModel = void 0;
if (config.moduleId === null) {
viewModel = EmptyClass;
} else if (/\.html/i.test(config.moduleId)) {
viewModel = createDynamicClass(config.moduleId);
} else {
viewModel = relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId);
}
var instruction = {
viewModel: viewModel,
childContainer: childContainer,
view: config.view || config.viewStrategy,
router: router
};
childContainer.registerSingleton(RouterViewLocator);
childContainer.getChildRouter = function () {
var childRouter = void 0;
childContainer.registerHandler(Router, function (c) {
return childRouter || (childRouter = router.createChild(childContainer));
makeRelativeTo(file) {
if (this.absolutePath === null) {
this.absolutePath = relativeToFile(this.path, file);
}
}
};
return css.replace(cssUrlMatcher, function (match, p1) {
var quote = p1.charAt(0);
if (quote === '\'' || quote === '"') {
p1 = p1.substr(1, p1.length - 2);
}
return 'url(\'' + relativeToFile(p1, address) + '\')';
});
}
Aurelia.prototype.globalizeResources = function (resources) {
var toAdd = Array.isArray(resources) ? resources : arguments, i, ii, resource, pluginPath = this.currentPluginId || '', path, internalPlugin = pluginPath.startsWith('./');
for (i = 0, ii = toAdd.length; i < ii; ++i) {
resource = toAdd[i];
if (typeof resource != 'string') {
throw new Error("Invalid resource path [" + resource + "]. Resources must be specified as relative module IDs.");
}
path = internalPlugin
? aurelia_path_1.relativeToFile(resource, pluginPath)
: aurelia_path_1.join(pluginPath, resource);
this.resourcesToLoad[path] = this.resourcesToLoad[path];
}
return this;
};
/**
return css.replace(cssUrlMatcher, (_, p1) => {
const quote = p1.charAt(0);
if (quote === '\'' || quote === '"') {
p1 = p1.substr(1, p1.length - 2);
}
return 'url(\'' + relativeToFile(p1, address) + '\')';
});
}
if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
return Promise.resolve(resources);
}
importIds = dependencies.map(x => x.src);
names = dependencies.map(x => x.name);
logger.debug(`importing resources for ${registryEntry.address}`, importIds);
if (target) {
let viewModelRequires = metadata.get(ViewEngine.viewModelRequireMetadataKey, target);
if (viewModelRequires) {
let templateImportCount = importIds.length;
for (let i = 0, ii = viewModelRequires.length; i < ii; ++i) {
let req = viewModelRequires[i];
let importId = typeof req === 'function' ? Origin.get(req).moduleId : relativeToFile(req.src || req, registryEntry.address);
if (importIds.indexOf(importId) === -1) {
importIds.push(importId);
names.push(req.as);
}
}
logger.debug(`importing ViewModel resources for ${compileInstruction.associatedModuleId}`, importIds.slice(templateImportCount));
}
}
return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
}
loadViewFactory(viewEngine, options){
if(!this.absolutePath && this.moduleId){
this.absolutePath = relativeToFile(this.path, this.moduleId);
}
return viewEngine.loadViewFactory(this.absolutePath || this.path, options, this.moduleId);
}
return css.replace(cssUrlMatcher, function (_, p1) {
var quote = p1.charAt(0);
if (quote === '\'' || quote === '"') {
p1 = p1.substr(1, p1.length - 2);
}
return 'url(\'' + relativeToFile(p1, address) + '\')';
});
}
return css.replace(cssUrlMatcher, (match, p1) => {
let quote = p1.charAt(0);
if (quote === '\'' || quote === '"') {
p1 = p1.substr(1, p1.length - 2);
}
return 'url(\'' + relativeToFile(p1, address) + '\')';
});
}
return css.replace(cssUrlMatcher, function (_, p1) {
var quote = p1.charAt(0);
if (quote === '\'' || quote === '"') {
p1 = p1.substr(1, p1.length - 2);
}
return 'url(\'' + aurelia_path_1.relativeToFile(p1, address) + '\')';
});
}