@travetto/registry
Advanced tools
Comparing version 0.0.35 to 0.0.36
@@ -18,3 +18,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.35" | ||
"version": "0.0.36" | ||
} |
@@ -56,3 +56,3 @@ import { deepAssign } from '@travetto/base'; | ||
createPendingMethod(cls: Class, method: Function): Partial<M> { | ||
return {} | ||
return {}; | ||
} | ||
@@ -59,0 +59,0 @@ |
@@ -26,13 +26,2 @@ import { Class } from '../model/types'; | ||
initialInstall(): any { | ||
return; | ||
} | ||
async init(): Promise<any> { | ||
if (!this.initialized) { | ||
this.initialized = this._init(); | ||
} | ||
return this.initialized; | ||
} | ||
protected async _init(): Promise<any> { | ||
@@ -63,2 +52,13 @@ try { | ||
initialInstall(): any { | ||
return; | ||
} | ||
async init(): Promise<any> { | ||
if (!this.initialized) { | ||
this.initialized = this._init(); | ||
} | ||
return this.initialized; | ||
} | ||
onInstall(cls: Class, e: ChangeEvent<Class>): void { | ||
@@ -65,0 +65,0 @@ |
@@ -18,3 +18,3 @@ import { Registry } from './registry'; | ||
for (const parent of this.parents) { | ||
parent!.reset() | ||
parent!.reset(); | ||
} | ||
@@ -21,0 +21,0 @@ } |
@@ -19,30 +19,2 @@ import { EventEmitter } from 'events'; | ||
emit(e: ChangeEvent<Class>) { | ||
this.events.emit('change', e); | ||
} | ||
reset() { | ||
this.classes.clear(); | ||
} | ||
async init() { | ||
const entries = await findAppFilesByExt('.ts') | ||
.filter(x => x.file.includes(`/src/`)); | ||
const files = entries | ||
.filter(x => Compiler.presenceManager.validFile(x.file)) | ||
.map(x => x.file) | ||
for (const f of files) { // Load all files, class scanning | ||
require(f); | ||
} | ||
this.flush(); | ||
Compiler.on('changed', this.watch); | ||
Compiler.on('removed', this.watch); | ||
Compiler.on('added', this.watch); | ||
Compiler.on('required-after', f => this.flush()); | ||
} | ||
private flush() { | ||
@@ -61,6 +33,2 @@ for (const [file, classes] of PendingRegister.flush()) { | ||
on(callback: (e: ChangeEvent<Class>) => void): void { | ||
this.events.on('change', callback); | ||
} | ||
protected async handleFileChanges(file: string, classes: Class<any>[]) { | ||
@@ -101,2 +69,34 @@ const next = new Map(classes.map(cls => [cls.__id, cls] as [string, Class])); | ||
} | ||
emit(e: ChangeEvent<Class>) { | ||
this.events.emit('change', e); | ||
} | ||
reset() { | ||
this.classes.clear(); | ||
} | ||
async init() { | ||
const entries = await findAppFilesByExt('.ts') | ||
.filter(x => x.file.includes(`/src/`)); | ||
const files = entries | ||
.filter(x => Compiler.presenceManager.validFile(x.file)) | ||
.map(x => x.file); | ||
for (const f of files) { // Load all files, class scanning | ||
require(f); | ||
} | ||
this.flush(); | ||
Compiler.on('changed', this.watch); | ||
Compiler.on('removed', this.watch); | ||
Compiler.on('added', this.watch); | ||
Compiler.on('required-after', f => this.flush()); | ||
} | ||
on(callback: (e: ChangeEvent<Class>) => void): void { | ||
this.events.on('change', callback); | ||
} | ||
} |
@@ -16,3 +16,3 @@ import { ChangeSource, ChangeEvent } from './types'; | ||
emit(ev: ChangeEvent<[Class, Function]>) { | ||
this.events.emit('change', ev) | ||
this.events.emit('change', ev); | ||
} | ||
@@ -19,0 +19,0 @@ |
@@ -5,4 +5,4 @@ | ||
prev?: T; | ||
curr?: T | ||
}; | ||
curr?: T; | ||
} | ||
@@ -9,0 +9,0 @@ export interface ChangeSource<T> { |
@@ -27,3 +27,3 @@ import * as ts from 'typescript'; | ||
const registerPath = require.resolve('../src/decorator/register') | ||
const registerPath = require.resolve('../src/decorator/register'); | ||
@@ -104,2 +104,2 @@ function visitNode<T extends ts.Node>(context: ts.TransformationContext, node: T, state: IState): T { | ||
priority: 0 | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17332
24