Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (localStyles.find(x => typeof x !== 'string')) {
// TODO: use reporter
throw new Error('Shadow DOM CSS must be a string.');
}
return new StyleElementStyles(dom, localStyles, sharedStyles);
};
}
let globalStyles;
if (config && config.sharedStyles) {
globalStyles = createStyles(config.sharedStyles, null);
}
else {
globalStyles = noopShadowDOMStyles;
}
container.register(Registration.instance(IShadowDOMGlobalStyles, globalStyles));
container.register(Registration.instance(ext, new ShadowDOMRegistry(globalStyles, createStyles)));
});
}
container.registerResolver(IController, renderableProvider);
container.registerResolver(ITargetedInstruction, instructionProvider);
container.registerResolver(IRenderLocation, renderLocationProvider);
if (dependencies != void 0) {
container.register(...dependencies);
}
// If the element has a view, support Recursive Components by adding self to own view template container.
if (componentType) {
const def = CustomElement.getDefinition(componentType);
def.register(container);
if (componentInstance !== void 0) {
const injectable = def.injectable;
if (injectable !== null) {
// If the element is registered as injectable, support injecting the instance into children
// Note: this provider is never disposed at the moment. Perhaps we need to at some point, but not disposing it here doesn't necessarily need to cause memory leaks. Keep an eye on it though.
Registration.instance(injectable, componentInstance).register(container);
}
}
}
}
get id() {
container = DI.createContainer();
container.register(ILifecycleRegistration);
} else {
container = containerOrLifecycle;
}
const dummyLocator: any = {
handles(): boolean {
return false;
}
};
const dummyScheduler: any = {
};
Registration.instance(IDirtyChecker, null).register(container);
Registration.instance(ITargetObserverLocator, dummyLocator).register(container);
Registration.instance(ITargetAccessorLocator, dummyLocator).register(container);
container.register(IObserverLocatorRegistration);
Registration.instance(IScheduler, dummyScheduler).register(container);
return container.get(IObserverLocator);
}
function createFixture() {
const container = RuntimeConfiguration.createContainer();
const innerLocator = {
handles() { return false; }
};
Registration.instance(ITargetAccessorLocator, innerLocator).register(container);
Registration.instance(ITargetObserverLocator, innerLocator).register(container);
const locator = container.get(IObserverLocator);
const dirtyChecker = container.get(IDirtyChecker);
const lifecycle = container.get(ILifecycle);
const scheduler = container.get(IScheduler);
return { container, locator, dirtyChecker, lifecycle, scheduler };
}
public constructor() {
const container = this.container = DI.createContainer();
container.register(
Registration.instance(ILogConfig, new LogConfig(ColorOptions.noColors, LogLevel.info)),
Registration.instance(ISink, new BufferedFileSink()),
Registration.instance(ISink, new ConsoleSink(console)),
Registration.singleton(IFileSystem, NodeFileSystem),
);
this.fs = container.get(IFileSystem);
this.logger = container.get(ILogger).scopeTo('TestRunner');
}
const lifecycle = container.get(ILifecycle);
let location: IRenderLocation & AuNode = null!;
container.register(AttributeType);
if (AttributeType.description.isTemplateController) {
const loc = AuNode.createRenderLocation();
AuNode.createHost().appendChild(loc.$start!).appendChild(loc);
const createView: (factory: FakeViewFactory) => IController = factory => {
const view = new FakeView(lifecycle, factory);
view.$nodes = new AuNodeSequence(new AuDOM(), AuNode.createTemplate().appendChild(AuNode.createText()));
return view;
};
container.register(
Registration.instance(
IRenderLocation,
location = ((options.target as typeof loc) || loc) as any
),
Registration.instance(IViewFactory, new FakeViewFactory('fake-view', createView, lifecycle))
);
} else {
const hostProvider = new InstanceProvider();
hostProvider.prepare(options.target || AuNode.createHost());
dom.registerElementResolver(container, hostProvider);
}
const attribute = container.get & IViewModel>(
CustomAttributeResource.keyFrom(AttributeType.description.name)
);
attribute.$hydrate(LF.none, container);
export function createObserverLocator(containerOrLifecycle?: IContainer | ILifecycle): IObserverLocator {
let container: IContainer;
if (containerOrLifecycle === undefined || !('get' in containerOrLifecycle)) {
container = DI.createContainer();
container.register(ILifecycleRegistration);
} else {
container = containerOrLifecycle as IContainer;
}
const lifecycle = container.get(ILifecycle);
const dummyLocator: any = {
handles(): boolean {
return false;
}
};
Registration.instance(IDirtyChecker, null).register(container);
Registration.instance(ITargetObserverLocator, dummyLocator).register(container);
Registration.instance(ITargetAccessorLocator, dummyLocator).register(container);
container.register(IObserverLocatorRegistration);
return container.get(IObserverLocator);
}
constructor(container = DI.createContainer()) {
this.container = container;
this.task = LifecycleTask.done;
this._isRunning = false;
this._isStarting = false;
this._isStopping = false;
this._root = void 0;
this.next = (void 0);
Registration.instance(Aurelia, this).register(container);
}
get isRunning() {
public executeEntryFile(dir: string): Promise<$Any> {
const container = this.container.createChild();
container.register(Registration.instance(ISourceFileProvider, new EntrySourceFileProvider(this, dir)));
return this.agent.RunJobs(container);
}
constructor(container: IContainer = DI.createContainer()) {
this.container = container;
this.task = LifecycleTask.done;
this._isRunning = false;
this._isStarting = false;
this._isStopping = false;
this._root = void 0;
this.next = (void 0)!;
Registration.instance(Aurelia, this).register(container);
}