Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {protocol,metadata} from 'aurelia-metadata';
import {AggregateError} from 'aurelia-pal';
/**
* Decorator: Indicates that the decorated class/object is a custom resolver.
*/
export const resolver: Function & { decorates?: any } = protocol.create('aurelia:resolver', function(target): string | boolean {
if (!(typeof target.get === 'function')) {
return 'Resolvers must implement: get(container: Container, key: any): any';
}
return true;
});
/**
* Used to allow functions/classes to specify custom dependency resolution logic.
*/
export interface Resolver {
/**
* Called by the container to allow custom resolution of dependencies for a function/class.
* @param container The container to resolve from.
* @param key The key that the resolver was registered as.
* @return Returns the resolved object.
if (rest.length === 1) {
target.inject[descriptor] = rest[0];
}
return;
}
if (descriptor) {
var fn = descriptor.value;
fn.inject = rest;
}
else {
target.inject = rest;
}
};
}
var resolver = protocol.create('aurelia:resolver', function (target) {
if (!(typeof target.get === 'function')) {
return 'Resolvers must implement: get(container: Container, key: any): any';
}
return true;
});
var Strategy;
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(Strategy || (Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
this.expressions = null;
this.behaviorInstructions = null;
this.providers = null;
this.viewFactory = null;
this.anchorIsContainer = false;
this.elementInstruction = null;
this.lifting = false;
this.values = null;
}
}, _class.noExpressions = Object.freeze([]), _temp);
export const viewStrategy = protocol.create('aurelia:view-strategy', {
validate(target) {
if (!(typeof target.loadViewFactory === 'function')) {
return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise';
}
return true;
},
compose(target) {
if (!(typeof target.makeRelativeTo === 'function')) {
target.makeRelativeTo = PLATFORM.noop;
}
}
});
export let RelativeViewStrategy = (_dec = viewStrategy(), _dec(_class2 = class RelativeViewStrategy {
constructor(path) {
target.inject[descriptor] = rest[0];
}
return;
}
if (descriptor) {
const fn = descriptor.value;
fn.inject = rest;
}
else {
target.inject = rest;
}
};
}
var Lazy_1, All_1, Optional_1, Parent_1, Factory_1, NewInstance_1;
const resolver = protocol.create('aurelia:resolver', (target) => {
if (!(typeof target.get === 'function')) {
return 'Resolvers must implement: get(container: Container, key: any): any';
}
return true;
});
var Strategy;
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(Strategy || (Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
import {protocol} from 'aurelia-metadata';
import {Container} from './container';
import {autoinject} from './injection';
/**
* Decorator: Indicates that the decorated class/object is a custom resolver.
*/
export const resolver: Function & { decorates?: any } = protocol.create('aurelia:resolver', function(target): string | boolean {
if (!(typeof target.get === 'function')) {
return 'Resolvers must implement: get(container: Container, key: any): any';
}
return true;
});
/**
* Used to allow functions/classes to specify custom dependency resolution logic.
*/
export interface Resolver {
/**
* Called by the container to allow custom resolution of dependencies for a function/class.
* @param container The container to resolve from.
* @param key The key that the resolver was registered as.
* @return Returns the resolved object.
import {protocol, metadata} from 'aurelia-metadata';
import {Container} from './container';
/**
* Decorator: Indicates that the decorated class/object is a custom resolver.
*/
export const resolver: Function & { decorates?: any } = protocol.create('aurelia:resolver', function(target): string | boolean {
if (!(typeof target.get === 'function')) {
return 'Resolvers must implement: get(container: Container, key: any): any';
}
return true;
});
/**
* Used to allow functions/classes to specify custom dependency resolution logic.
*/
export interface Resolver {
/**
* Called by the container to allow custom resolution of dependencies for a function/class.
* @param container The container to resolve from.
* @param key The key that the resolver was registered as.
* @return Returns the resolved object.
interface ViewStrategy {
/**
* Loads a view factory.
* @param viewEngine The view engine to use during the load process.
* @param compileInstruction Additional instructions to use during compilation of the view.
* @param loadContext The loading context used for loading all resources and dependencies.
* @param target A class from which to extract metadata of additional resources to load.
* @return A promise for the view factory that is produced by this strategy.
*/
loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise;
}
/**
* Decorator: Indicates that the decorated class/object is a view strategy.
*/
export const viewStrategy: Function = protocol.create('aurelia:view-strategy', {
validate(target) {
if (!(typeof target.loadViewFactory === 'function')) {
return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise';
}
return true;
},
compose(target) {
if (!(typeof target.makeRelativeTo === 'function')) {
target.makeRelativeTo = PLATFORM.noop;
}
}
});
/**
* A view strategy that loads a view relative to its associated view-model.
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { protocol, Origin } from 'aurelia-metadata';
import { PLATFORM } from 'aurelia-pal';
import { StyleLocator } from './style-locator';
import { relativeToFile } from 'aurelia-path';
import { StyleCompiler } from './style-compiler';
import { Loader } from 'aurelia-loader';
import { AureliaUX } from '../aurelia-ux';
/**
* Decorator: Indicates that the decorated class/object is a style strategy.
*/
export const styleStrategy = protocol.create('aurelia:style-strategy', {
validate(target) {
if (!(typeof target.loadStyleFactory === 'function')) {
return 'Style strategies must implement: loadStyleFactory(): Promise';
}
return true;
},
compose(target) {
if (!(typeof target.makeRelativeTo === 'function')) {
target.makeRelativeTo = PLATFORM.noop;
}
}
});
const cssUrlMatcher = /url\((?!['"]data)([^)]+)\)/gi;
function fixupCSSUrls(address, css) {
if (typeof css !== 'string') {
throw new Error(`Failed loading required CSS file: ${address}`);
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { protocol, Origin } from 'aurelia-metadata';
import { PLATFORM } from 'aurelia-pal';
import { StyleLocator } from './style-locator';
import { relativeToFile } from 'aurelia-path';
import { StyleCompiler } from './style-compiler';
import { Loader } from 'aurelia-loader';
import { AureliaUX } from '../aurelia-ux';
/**
* Decorator: Indicates that the decorated class/object is a style strategy.
*/
export var styleStrategy = protocol.create('aurelia:style-strategy', {
validate: function (target) {
if (!(typeof target.loadStyleFactory === 'function')) {
return 'Style strategies must implement: loadStyleStrateg(): Promise';
}
return true;
},
compose: function (target) {
if (!(typeof target.makeRelativeTo === 'function')) {
target.makeRelativeTo = PLATFORM.noop;
}
}
});
var cssUrlMatcher = /url\((?!['"]data)([^)]+)\)/gi;
function fixupCSSUrls(address, css) {
if (typeof css !== 'string') {
throw new Error("Failed loading required CSS file: " + address);