| @@ -0,0 +1,17 | |||
|
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
|
|
2 | <projectDescription> | |
|
|
3 | <name>core</name> | |
|
|
4 | <comment>Project implabjs-core created by Buildship.</comment> | |
|
|
5 | <projects> | |
|
|
6 | </projects> | |
|
|
7 | <buildSpec> | |
|
|
8 | <buildCommand> | |
|
|
9 | <name>org.eclipse.buildship.core.gradleprojectbuilder</name> | |
|
|
10 | <arguments> | |
|
|
11 | </arguments> | |
|
|
12 | </buildCommand> | |
|
|
13 | </buildSpec> | |
|
|
14 | <natures> | |
|
|
15 | <nature>org.eclipse.buildship.core.gradleprojectnature</nature> | |
|
|
16 | </natures> | |
|
|
17 | </projectDescription> | |
| @@ -0,0 +1,54 | |||
|
|
1 | import { MockActivationController } from "../mock/MockActivationController"; | |
|
|
2 | import { SimpleActivatable } from "../mock/SimpleActivatable"; | |
|
|
3 | import { test } from "./TestTraits"; | |
|
|
4 | ||
|
|
5 | test("simple activation", async t => { | |
|
|
6 | ||
|
|
7 | const a = new SimpleActivatable(); | |
|
|
8 | t.false(a.isActive()); | |
|
|
9 | ||
|
|
10 | await a.activate(); | |
|
|
11 | t.true(a.isActive()); | |
|
|
12 | ||
|
|
13 | await a.deactivate(); | |
|
|
14 | t.false(a.isActive()); | |
|
|
15 | }); | |
|
|
16 | ||
|
|
17 | test("controller activation", async t => { | |
|
|
18 | ||
|
|
19 | const a = new SimpleActivatable(); | |
|
|
20 | const c = new MockActivationController(); | |
|
|
21 | ||
|
|
22 | t.false(a.isActive(), "the component is not active by default"); | |
|
|
23 | t.assert(c.getActive() == null, "the activation controller doesn't have an active component by default"); | |
|
|
24 | t.assert(a.getActivationController() == null, "the component doesn't have an activation controller by default"); | |
|
|
25 | ||
|
|
26 | t.comment("Active the component through the controller"); | |
|
|
27 | await c.activate(a); | |
|
|
28 | t.true(a.isActive(), "The component should successfully activate"); | |
|
|
29 | t.equal(c.getActive(), a, "The controller should point to the activated component"); | |
|
|
30 | t.equal(a.getActivationController(), c, "The component should point to the controller"); | |
|
|
31 | ||
|
|
32 | t.comment("Deactive the component throug the controller"); | |
|
|
33 | await c.deactivate(); | |
|
|
34 | ||
|
|
35 | t.false(a.isActive(), "The component should successfully deactivate"); | |
|
|
36 | t.equal(c.getActive(), null, "The controller shouldn't point to any component"); | |
|
|
37 | t.equal(a.getActivationController(), c, "The componet should point to it's controller"); | |
|
|
38 | }); | |
|
|
39 | ||
|
|
40 | test("handle error in onActivating", async t => { | |
|
|
41 | const a = new SimpleActivatable(); | |
|
|
42 | ||
|
|
43 | a.onActivating = async () => { | |
|
|
44 | throw new Error("Should fail"); | |
|
|
45 | }; | |
|
|
46 | ||
|
|
47 | try { | |
|
|
48 | await a.activate(); | |
|
|
49 | t.fail("activation should fail"); | |
|
|
50 | } catch { | |
|
|
51 | } | |
|
|
52 | ||
|
|
53 | t.false(a.isActive(), "the component should remain inactive"); | |
|
|
54 | }); | |
| @@ -0,0 +1,88 | |||
|
|
1 | import { Cancellation } from "../Cancellation"; | |
|
|
2 | import { delay } from "../safe"; | |
|
|
3 | import { test } from "./TestTraits"; | |
|
|
4 | ||
|
|
5 | test("standalone cancellation", async t => { | |
|
|
6 | ||
|
|
7 | let doCancel: (e) => void; | |
|
|
8 | ||
|
|
9 | const ct = new Cancellation(cancel => { | |
|
|
10 | doCancel = cancel; | |
|
|
11 | }); | |
|
|
12 | ||
|
|
13 | let counter = 0; | |
|
|
14 | const reason = "BILL"; | |
|
|
15 | ||
|
|
16 | t.true(ct.isSupported(), "Cancellation must be supported"); | |
|
|
17 | t.false(ct.isRequested(), "Cancellation shouldn't be requested"); | |
|
|
18 | ct.throwIfRequested(); | |
|
|
19 | t.pass("The exception shouldn't be thrown unless the cancellation is requested"); | |
|
|
20 | ||
|
|
21 | ct.register(() => counter++); | |
|
|
22 | t.equals(counter, 0, "counter should be zero"); | |
|
|
23 | ||
|
|
24 | ct.register(() => counter++).destroy(); | |
|
|
25 | ||
|
|
26 | doCancel(reason); | |
|
|
27 | ||
|
|
28 | t.true(ct.isRequested(), "Cancellation should be requested"); | |
|
|
29 | t.equals(counter, 1, "The registered callback should be triggered"); | |
|
|
30 | ||
|
|
31 | ct.register(() => counter++); | |
|
|
32 | t.equals(counter, 2, "The callback should be triggered immediately"); | |
|
|
33 | ||
|
|
34 | let msg; | |
|
|
35 | ct.register(e => msg = e); | |
|
|
36 | t.equals(msg, reason, "The cancellation reason should be passed to callback"); | |
|
|
37 | ||
|
|
38 | try { | |
|
|
39 | msg = null; | |
|
|
40 | ct.throwIfRequested(); | |
|
|
41 | t.fail("The exception should be thrown"); | |
|
|
42 | } catch (e) { | |
|
|
43 | msg = e; | |
|
|
44 | } | |
|
|
45 | t.equals(msg, reason, "The cancellation reason should be catched"); | |
|
|
46 | }); | |
|
|
47 | ||
|
|
48 | test("async cancellation", async t => { | |
|
|
49 | ||
|
|
50 | const ct = new Cancellation(cancel => { | |
|
|
51 | cancel("STOP!"); | |
|
|
52 | }); | |
|
|
53 | ||
|
|
54 | try { | |
|
|
55 | await delay(0, ct); | |
|
|
56 | t.fail("Should thow the exception"); | |
|
|
57 | } catch (e) { | |
|
|
58 | t.equals(e, "STOP!", "Should throw the cancellation reason"); | |
|
|
59 | } | |
|
|
60 | }); | |
|
|
61 | ||
|
|
62 | test("cancel with external event", async t => { | |
|
|
63 | const ct = new Cancellation(cancel => { | |
|
|
64 | setTimeout(x => cancel("STOP!"), 0); | |
|
|
65 | }); | |
|
|
66 | ||
|
|
67 | try { | |
|
|
68 | await delay(10000, ct); | |
|
|
69 | t.fail("Should thow the exception"); | |
|
|
70 | } catch (e) { | |
|
|
71 | t.equals(e, "STOP!", "Should throw the cancellation reason"); | |
|
|
72 | } | |
|
|
73 | }); | |
|
|
74 | ||
|
|
75 | test("operation normal flow", async t => { | |
|
|
76 | ||
|
|
77 | let htimeout; | |
|
|
78 | const ct = new Cancellation(cancel => { | |
|
|
79 | htimeout = setTimeout(() => cancel("STOP!"), 1000); | |
|
|
80 | }); | |
|
|
81 | ||
|
|
82 | try { | |
|
|
83 | await delay(0, ct); | |
|
|
84 | t.pass("Should pass"); | |
|
|
85 | } finally { | |
|
|
86 | clearTimeout(htimeout); | |
|
|
87 | } | |
|
|
88 | }); | |
| @@ -0,0 +1,93 | |||
|
|
1 | import { test } from "./TestTraits"; | |
|
|
2 | import { Container } from "../di/Container"; | |
|
|
3 | import { ReferenceDescriptor } from "../di/ReferenceDescriptor"; | |
|
|
4 | import { AggregateDescriptor } from "../di/AggregateDescriptor"; | |
|
|
5 | import { ValueDescriptor } from "../di/ValueDescriptor"; | |
|
|
6 | import { Foo } from "../mock/Foo"; | |
|
|
7 | import { Bar } from "../mock/Bar"; | |
|
|
8 | import { isNull } from "../safe"; | |
|
|
9 | ||
|
|
10 | test("Container register/resolve tests", async t => { | |
|
|
11 | const container = new Container(); | |
|
|
12 | ||
|
|
13 | const connection1 = "db://localhost"; | |
|
|
14 | ||
|
|
15 | t.throws( | |
|
|
16 | () => container.register("bla-bla", "bla-bla"), | |
|
|
17 | "Do not allow to register anything other than descriptors" | |
|
|
18 | ); | |
|
|
19 | ||
|
|
20 | t.doesNotThrow( | |
|
|
21 | () => container.register("connection", new ValueDescriptor(connection1)), | |
|
|
22 | "register ValueDescriptor" | |
|
|
23 | ); | |
|
|
24 | ||
|
|
25 | t.equals(container.resolve("connection"), connection1, "resolve string value"); | |
|
|
26 | ||
|
|
27 | t.doesNotThrow( | |
|
|
28 | () => container.register( | |
|
|
29 | "dbParams", | |
|
|
30 | new AggregateDescriptor({ | |
|
|
31 | timeout: 10, | |
|
|
32 | connection: new ReferenceDescriptor({ name: "connection" }) | |
|
|
33 | }) | |
|
|
34 | ), | |
|
|
35 | "register AggregateDescriptor" | |
|
|
36 | ); | |
|
|
37 | ||
|
|
38 | const dbParams = container.resolve("dbParams"); | |
|
|
39 | t.equals(dbParams.connection, connection1, "should get string value 'dbParams.connection'"); | |
|
|
40 | }); | |
|
|
41 | ||
|
|
42 | test("Container configure/resolve tests", async t => { | |
|
|
43 | ||
|
|
44 | const container = new Container(); | |
|
|
45 | ||
|
|
46 | await container.configure({ | |
|
|
47 | foo: { | |
|
|
48 | $type: Foo | |
|
|
49 | }, | |
|
|
50 | ||
|
|
51 | box: { | |
|
|
52 | $type: Bar, | |
|
|
53 | params: { | |
|
|
54 | $dependency: "foo" | |
|
|
55 | } | |
|
|
56 | }, | |
|
|
57 | ||
|
|
58 | bar: { | |
|
|
59 | $type: Bar, | |
|
|
60 | params: { | |
|
|
61 | db: { | |
|
|
62 | provider: { | |
|
|
63 | $dependency: "db" | |
|
|
64 | } | |
|
|
65 | } | |
|
|
66 | } | |
|
|
67 | } | |
|
|
68 | }); | |
|
|
69 | t.pass("should configure from js object"); | |
|
|
70 | ||
|
|
71 | const f1 = container.resolve("foo"); | |
|
|
72 | ||
|
|
73 | t.assert(!isNull(f1), "foo should be not null"); | |
|
|
74 | ||
|
|
75 | t.throws(() => container.resolve("bar"), "should not resolve dependency 'db'"); | |
|
|
76 | ||
|
|
77 | }); | |
|
|
78 | ||
|
|
79 | test("Load configuration from module", async t => { | |
|
|
80 | const container = new Container(); | |
|
|
81 | ||
|
|
82 | await container.configure("./mock/config1", { contextRequire: require }); | |
|
|
83 | t.pass("The configuration should load"); | |
|
|
84 | ||
|
|
85 | const f1 = container.resolve("foo"); | |
|
|
86 | ||
|
|
87 | t.assert(!isNull(f1), "foo should be not null"); | |
|
|
88 | ||
|
|
89 | const b1 = container.resolve("bar") as Bar; | |
|
|
90 | ||
|
|
91 | t.assert(!isNull(b1), "bar should not be null"); | |
|
|
92 | t.assert(!isNull(b1.foo), "bar.foo should not be null"); | |
|
|
93 | }); | |
| @@ -0,0 +1,69 | |||
|
|
1 | import { TraceSource } from "../log/TraceSource"; | |
|
|
2 | import { Observable } from "../Observable"; | |
|
|
3 | import { IObservable } from "../interfaces"; | |
|
|
4 | import { delay } from "../safe"; | |
|
|
5 | import { test } from "./TestTraits"; | |
|
|
6 | ||
|
|
7 | const trace = TraceSource.get("ObservableTests"); | |
|
|
8 | ||
|
|
9 | test("events sequence example", async t => { | |
|
|
10 | ||
|
|
11 | let events: IObservable<number>; | |
|
|
12 | ||
|
|
13 | const done = new Promise<void>(resolve => { | |
|
|
14 | events = new Observable<number>(async (notify, fail, finish) => { | |
|
|
15 | for (let i = 0; i < 10; i++) { | |
|
|
16 | await delay(0); | |
|
|
17 | notify(i); | |
|
|
18 | } | |
|
|
19 | finish(); | |
|
|
20 | resolve(); | |
|
|
21 | }); | |
|
|
22 | }); | |
|
|
23 | ||
|
|
24 | let count = 0; | |
|
|
25 | let complete = false; | |
|
|
26 | events.on(x => count = count + x, null, () => complete = true); | |
|
|
27 | ||
|
|
28 | const first = await events.next(); | |
|
|
29 | ||
|
|
30 | t.equals(first, 0, "the first event"); | |
|
|
31 | t.false(complete, "the sequence is not complete"); | |
|
|
32 | ||
|
|
33 | await done; | |
|
|
34 | ||
|
|
35 | t.equals(count, 45, "the summ of the evetns"); | |
|
|
36 | t.true(complete, "the sequence is complete"); | |
|
|
37 | }); | |
|
|
38 | ||
|
|
39 | test("event sequence termination", async t => { | |
|
|
40 | let events: IObservable<number>; | |
|
|
41 | ||
|
|
42 | const done = new Promise<void>(resolve => { | |
|
|
43 | events = new Observable<number>(async (notify, fail, complete) => { | |
|
|
44 | await delay(0); | |
|
|
45 | notify(1); | |
|
|
46 | complete(); | |
|
|
47 | notify(2); | |
|
|
48 | complete(); | |
|
|
49 | fail("Sequence terminated"); | |
|
|
50 | resolve(); | |
|
|
51 | }); | |
|
|
52 | }); | |
|
|
53 | ||
|
|
54 | let count = 0; | |
|
|
55 | events.on(() => {}, e => count++, () => count++); | |
|
|
56 | ||
|
|
57 | const first = await events.next(); | |
|
|
58 | t.equals(first, 1, "the first message"); | |
|
|
59 | try { | |
|
|
60 | await events.next(); | |
|
|
61 | t.fail("shoud throw an exception"); | |
|
|
62 | } catch (e) { | |
|
|
63 | t.pass("the sequence is terminated"); | |
|
|
64 | } | |
|
|
65 | ||
|
|
66 | await done; | |
|
|
67 | ||
|
|
68 | t.equals(count, 1, "the sequence must be terminated once"); | |
|
|
69 | }); | |
| @@ -0,0 +1,95 | |||
|
|
1 | import { Cancellation } from "../Cancellation"; | |
|
|
2 | import { first, isPromise, firstWhere, delay, nowait } from "../safe"; | |
|
|
3 | import { test } from "./TestTraits"; | |
|
|
4 | ||
|
|
5 | test("await delay test", async t => { | |
|
|
6 | // schedule delay | |
|
|
7 | let resolved = false; | |
|
|
8 | let res = delay(0).then(() => resolved = true); | |
|
|
9 | ||
|
|
10 | t.false(resolved, "the delay should be async"); | |
|
|
11 | ||
|
|
12 | await res; | |
|
|
13 | t.pass("await delay"); | |
|
|
14 | ||
|
|
15 | // create cancellation token | |
|
|
16 | let cancel: (e?: any) => void; | |
|
|
17 | const ct = new Cancellation(c => cancel = c); | |
|
|
18 | ||
|
|
19 | // schedule delay | |
|
|
20 | resolved = false; | |
|
|
21 | res = delay(0, ct).then(() => resolved = true); | |
|
|
22 | ||
|
|
23 | t.false(resolved, "created delay with ct"); | |
|
|
24 | ||
|
|
25 | // cancel | |
|
|
26 | cancel(); | |
|
|
27 | ||
|
|
28 | try { | |
|
|
29 | await res; | |
|
|
30 | t.fail("the delay should fail when it is cancelled"); | |
|
|
31 | } catch { | |
|
|
32 | t.pass("the delay is cancelled"); | |
|
|
33 | } | |
|
|
34 | ||
|
|
35 | t.throws(() => { | |
|
|
36 | // try schedule delay after the cancellation is requested | |
|
|
37 | nowait(delay(0, ct)); | |
|
|
38 | }, "Should throw if cancelled before start"); | |
|
|
39 | }); | |
|
|
40 | ||
|
|
41 | test("sequemce test", async t => { | |
|
|
42 | const sequence = ["a", "b", "c"]; | |
|
|
43 | const empty = []; | |
|
|
44 | ||
|
|
45 | // synchronous tests | |
|
|
46 | t.equals(first(sequence), "a", "Should return the first element"); | |
|
|
47 | t.equals(firstWhere(sequence, x => x === "b"), "b", "Should get the second element"); | |
|
|
48 | ||
|
|
49 | let v: string; | |
|
|
50 | let e: Error; | |
|
|
51 | first(sequence, x => v = x); | |
|
|
52 | t.equal(v, "a", "The callback should be called for the first element"); | |
|
|
53 | firstWhere(sequence, x => x === "b", x => v = x); | |
|
|
54 | t.equal(v, "b", "The callback should be called for the second element"); | |
|
|
55 | ||
|
|
56 | t.throws(() => { | |
|
|
57 | first(empty); | |
|
|
58 | }, "Should throw when the sequence is empty"); | |
|
|
59 | ||
|
|
60 | t.throws(() => { | |
|
|
61 | firstWhere(empty, x => x === "b"); | |
|
|
62 | }, "Should throw when the sequence is empty"); | |
|
|
63 | ||
|
|
64 | t.throws(() => { | |
|
|
65 | first(empty, x => v = x); | |
|
|
66 | }, "Should throw when the sequence is empty"); | |
|
|
67 | ||
|
|
68 | t.throws(() => { | |
|
|
69 | firstWhere(empty, x => x === "b", x => v = x); | |
|
|
70 | }, "Should throw when the sequence is empty"); | |
|
|
71 | ||
|
|
72 | t.throws(() => { | |
|
|
73 | firstWhere(sequence, x => x === "z"); | |
|
|
74 | }, "Should throw when the element isn't found"); | |
|
|
75 | ||
|
|
76 | t.throws(() => { | |
|
|
77 | firstWhere(sequence, x => x === "z", x => v = x); | |
|
|
78 | }, "Should throw when the element isn't found"); | |
|
|
79 | ||
|
|
80 | first(empty, null, x => e = x); | |
|
|
81 | t.true(e, "The errorback should be called for the empty sequence"); | |
|
|
82 | ||
|
|
83 | // async tests | |
|
|
84 | const asyncSequence = Promise.resolve(sequence); | |
|
|
85 | const asyncEmptySequence = Promise.resolve(empty); | |
|
|
86 | ||
|
|
87 | const promise = first(asyncSequence); | |
|
|
88 | t.true(isPromise(promise), "Should return promise"); | |
|
|
89 | ||
|
|
90 | v = await promise; | |
|
|
91 | t.equal(v, "a", "Should return the first element"); | |
|
|
92 | ||
|
|
93 | v = await new Promise(resolve => first(asyncSequence, resolve)); | |
|
|
94 | t.equal(v, "a", "The callback should be called for the first element"); | |
|
|
95 | }); | |
| @@ -0,0 +1,74 | |||
|
|
1 | import { IObservable, ICancellation, IDestroyable } from "../interfaces"; | |
|
|
2 | import { Cancellation } from "../Cancellation"; | |
|
|
3 | import { TraceEvent, LogLevel, WarnLevel, DebugLevel, TraceSource } from "../log/TraceSource"; | |
|
|
4 | import * as tape from "tape"; | |
|
|
5 | import { argumentNotNull, destroy } from "../safe"; | |
|
|
6 | ||
|
|
7 | export class TapeWriter implements IDestroyable { | |
|
|
8 | private readonly _tape: tape.Test; | |
|
|
9 | ||
|
|
10 | private readonly _subscriptions = new Array<IDestroyable>(); | |
|
|
11 | private _destroyed; | |
|
|
12 | ||
|
|
13 | constructor(t: tape.Test) { | |
|
|
14 | argumentNotNull(t, "tape"); | |
|
|
15 | this._tape = t; | |
|
|
16 | } | |
|
|
17 | ||
|
|
18 | writeEvents(source: IObservable<TraceEvent>, ct: ICancellation = Cancellation.none) { | |
|
|
19 | if (!this._destroyed) { | |
|
|
20 | const subscription = source.on(this.writeEvent.bind(this)); | |
|
|
21 | if (ct.isSupported()) { | |
|
|
22 | ct.register(subscription.destroy.bind(subscription)); | |
|
|
23 | } | |
|
|
24 | this._subscriptions.push(subscription); | |
|
|
25 | } | |
|
|
26 | } | |
|
|
27 | ||
|
|
28 | writeEvent(next: TraceEvent) { | |
|
|
29 | if (next.level >= DebugLevel) { | |
|
|
30 | this._tape.comment(`DEBUG ${next.source.id} ${next}`); | |
|
|
31 | } else if (next.level >= LogLevel) { | |
|
|
32 | this._tape.comment(`LOG ${next.source.id} ${next}`); | |
|
|
33 | } else if (next.level >= WarnLevel) { | |
|
|
34 | this._tape.comment(`WARN ${next.source.id} ${next}`); | |
|
|
35 | } else { | |
|
|
36 | this._tape.comment(`ERROR ${next.source.id} ${next}`); | |
|
|
37 | } | |
|
|
38 | } | |
|
|
39 | ||
|
|
40 | destroy() { | |
|
|
41 | this._subscriptions.forEach(destroy); | |
|
|
42 | } | |
|
|
43 | } | |
|
|
44 | ||
|
|
45 | export function test(name: string, cb: (t: tape.Test, trace: TraceSource) => any) { | |
|
|
46 | tape(name, async t => { | |
|
|
47 | const writer = new TapeWriter(t); | |
|
|
48 | ||
|
|
49 | // this trace is not announced through the TraceSource global registry | |
|
|
50 | const trace = new TraceSource(name); | |
|
|
51 | trace.level = DebugLevel; | |
|
|
52 | writer.writeEvents(trace.events); | |
|
|
53 | ||
|
|
54 | const h = TraceSource.on(ts => { | |
|
|
55 | ts.level = DebugLevel; | |
|
|
56 | writer.writeEvents(ts.events); | |
|
|
57 | }); | |
|
|
58 | ||
|
|
59 | try { | |
|
|
60 | await cb(t, trace); | |
|
|
61 | } catch (e) { | |
|
|
62 | ||
|
|
63 | // verbose error information | |
|
|
64 | // tslint:disable-next-line | |
|
|
65 | console.error(e); | |
|
|
66 | t.fail(e); | |
|
|
67 | ||
|
|
68 | } finally { | |
|
|
69 | t.end(); | |
|
|
70 | destroy(writer); | |
|
|
71 | destroy(h); | |
|
|
72 | } | |
|
|
73 | }); | |
|
|
74 | } | |
| @@ -0,0 +1,86 | |||
|
|
1 | import { StringBuilder } from "../text/StringBuilder"; | |
|
|
2 | import { test } from "./TestTraits"; | |
|
|
3 | import { MockConsole } from "../mock/MockConsole"; | |
|
|
4 | import { ConsoleWriter } from "../log/ConsoleWriter"; | |
|
|
5 | ||
|
|
6 | test("String builder", async t => { | |
|
|
7 | const sb = new StringBuilder(); | |
|
|
8 | ||
|
|
9 | sb.write("hello"); | |
|
|
10 | t.equals(sb.toString(), "hello", "Write simple text"); | |
|
|
11 | ||
|
|
12 | sb.write(", "); | |
|
|
13 | sb.write("world!"); | |
|
|
14 | t.equals(sb.toString(), "hello, world!", "Append text"); | |
|
|
15 | ||
|
|
16 | sb.clear(); | |
|
|
17 | t.equals(sb.toString(), "", "Clear"); | |
|
|
18 | ||
|
|
19 | sb.write(1); | |
|
|
20 | t.equals(sb.toString(), "1", "Write number"); | |
|
|
21 | ||
|
|
22 | sb.clear(); | |
|
|
23 | sb.writeValue(0.123); | |
|
|
24 | t.equals(sb.toString(), "0.123", "Format number"); | |
|
|
25 | ||
|
|
26 | sb.clear(); | |
|
|
27 | sb.writeValue(new Date("2019-01-02T00:00:00.000Z")); | |
|
|
28 | t.equals(sb.toString(), "2019-01-02T00:00:00.000Z", "Format date (ISO)"); | |
|
|
29 | ||
|
|
30 | sb.clear(); | |
|
|
31 | sb.write("{0}", "hello"); | |
|
|
32 | t.equals(sb.toString(), "hello", "Simple format text"); | |
|
|
33 | ||
|
|
34 | sb.write(", {0}!", "world"); | |
|
|
35 | t.equals(sb.toString(), "hello, world!", "Append formatted text"); | |
|
|
36 | ||
|
|
37 | sb.clear(); | |
|
|
38 | sb.write("abc: {0:json}; {0.length}; {0.1} {{olo}}", ["a", "b", "c"]); | |
|
|
39 | t.equals(sb.toString(), 'abc: [\n "a",\n "b",\n "c"\n]; 3; b {olo}', "Format string with spec"); | |
|
|
40 | ||
|
|
41 | sb.clear(); | |
|
|
42 | t.throws(() => sb.write("}", 0), "Should die on bad format: '}'"); | |
|
|
43 | t.throws(() => sb.write("{", 0), "Should die on bad format: '{'"); | |
|
|
44 | t.throws(() => sb.write("{}", 0), "Should die on bad format: '{}'"); | |
|
|
45 | t.throws(() => sb.write("{:}", 0), "Should die on bad format: '{:}'"); | |
|
|
46 | t.throws(() => sb.write("{{0}", 0), "Should die on bad format: '{{0}'"); | |
|
|
47 | ||
|
|
48 | }); | |
|
|
49 | ||
|
|
50 | test("ConsoleWriter", t => { | |
|
|
51 | const mockConsole = new MockConsole(); | |
|
|
52 | const writer = new ConsoleWriter(mockConsole); | |
|
|
53 | ||
|
|
54 | writer.setLogLevel("log"); | |
|
|
55 | ||
|
|
56 | writer.writeLine("Hello, world!"); | |
|
|
57 | ||
|
|
58 | t.equals(mockConsole.getBuffer().length, 1, "One line should be written"); | |
|
|
59 | t.equals(mockConsole.getBuffer()[0].level, "log", "LogLevel should be 'log'"); | |
|
|
60 | t.deepEqual(mockConsole.getBuffer()[0].data, ["Hello, world!"], "The buffer should contain single string"); | |
|
|
61 | ||
|
|
62 | mockConsole.clear(); | |
|
|
63 | writer.setLogLevel("debug"); | |
|
|
64 | writer.write("Bring "); | |
|
|
65 | writer.write("the {0}!", "light"); | |
|
|
66 | t.equals(mockConsole.getBuffer().length, 0, "No line should be written"); | |
|
|
67 | writer.writeLine(); | |
|
|
68 | ||
|
|
69 | t.equals(mockConsole.getBuffer().length, 1, "One line should be written"); | |
|
|
70 | t.equals(mockConsole.getBuffer()[0].level, "debug", "LogLevel should be 'log'"); | |
|
|
71 | t.deepEqual(mockConsole.getBuffer()[0].data, ["Bring the light!"], "Should concatenate string parts together"); | |
|
|
72 | ||
|
|
73 | mockConsole.clear(); | |
|
|
74 | writer.writeLine("It's {0} o'clock, lets have some {1}!", { h: 5}, { title: "tee" }); | |
|
|
75 | ||
|
|
76 | t.deepEqual(mockConsole.getBuffer()[0].data, ["It's ", { h: 5}, " o'clock, lets have some ", { title: "tee" }, "!"], "Non string parts should be psassed as is"); | |
|
|
77 | ||
|
|
78 | mockConsole.clear(); | |
|
|
79 | writer.writeLine("{0} or {1} to {2}", {i: 25}, 6, 4); | |
|
|
80 | t.deepEqual(mockConsole.getBuffer()[0].data, [{i: 25}, " or 6 to 4"], "25 or 6 to 4"); | |
|
|
81 | ||
|
|
82 | mockConsole.clear(); | |
|
|
83 | writer.writeLine("{0} or {1} to {2}! Let's have some {3}", 25, 6, 4, { product: "tee" } ); | |
|
|
84 | t.deepEqual(mockConsole.getBuffer()[0].data, ["25 or 6 to 4! Let's have some ", { product: "tee" }], "Should handle many text chunks and object at the end"); | |
|
|
85 | ||
|
|
86 | }); | |
| @@ -0,0 +1,89 | |||
|
|
1 | import { TraceSource, DebugLevel } from "../log/TraceSource"; | |
|
|
2 | import * as tape from "tape"; | |
|
|
3 | import { TapeWriter, test } from "./TestTraits"; | |
|
|
4 | import { MockConsole } from "../mock/MockConsole"; | |
|
|
5 | import { ConsoleLogger } from "../log/writers/ConsoleLogger"; | |
|
|
6 | import { ConsoleWriter } from "../log/ConsoleWriter"; | |
|
|
7 | ||
|
|
8 | const sourceId = "test/TraceSourceTests"; | |
|
|
9 | ||
|
|
10 | tape("trace message", t => { | |
|
|
11 | const trace = TraceSource.get(sourceId); | |
|
|
12 | ||
|
|
13 | trace.level = DebugLevel; | |
|
|
14 | ||
|
|
15 | const h = trace.events.on(ev => { | |
|
|
16 | t.equal(ev.source, trace, "sender should be the current trace source"); | |
|
|
17 | t.equal(ev.level, DebugLevel, "level should be debug level"); | |
|
|
18 | t.equal(ev.toString(), "Hello, World!", "The message should be a formatted message"); | |
|
|
19 | ||
|
|
20 | t.end(); | |
|
|
21 | }); | |
|
|
22 | ||
|
|
23 | trace.debug("Hello, {0}!", "World"); | |
|
|
24 | ||
|
|
25 | h.destroy(); | |
|
|
26 | }); | |
|
|
27 | ||
|
|
28 | tape("trace event", t => { | |
|
|
29 | const trace = TraceSource.get(sourceId); | |
|
|
30 | ||
|
|
31 | trace.level = DebugLevel; | |
|
|
32 | ||
|
|
33 | const event = { | |
|
|
34 | name: "custom event" | |
|
|
35 | }; | |
|
|
36 | ||
|
|
37 | const h = trace.events.on(ev => { | |
|
|
38 | t.equal(ev.source, trace, "sender should be the current trace source"); | |
|
|
39 | t.equal(ev.level, DebugLevel, "level should be debug level"); | |
|
|
40 | t.equal(ev.message, event, "The message should be the specified object"); | |
|
|
41 | ||
|
|
42 | t.end(); | |
|
|
43 | }); | |
|
|
44 | ||
|
|
45 | trace.traceEvent(DebugLevel, event); | |
|
|
46 | ||
|
|
47 | h.destroy(); | |
|
|
48 | }); | |
|
|
49 | ||
|
|
50 | tape("tape comment writer", async t => { | |
|
|
51 | const writer = new TapeWriter(t); | |
|
|
52 | ||
|
|
53 | TraceSource.on(ts => { | |
|
|
54 | writer.writeEvents(ts.events); | |
|
|
55 | }); | |
|
|
56 | ||
|
|
57 | const trace = TraceSource.get(sourceId); | |
|
|
58 | trace.level = DebugLevel; | |
|
|
59 | ||
|
|
60 | trace.log("Hello, {0}!", "World"); | |
|
|
61 | trace.log("Multi\n line"); | |
|
|
62 | trace.warn("Look at me!"); | |
|
|
63 | trace.error("DIE!"); | |
|
|
64 | ||
|
|
65 | writer.destroy(); | |
|
|
66 | ||
|
|
67 | trace.log("You shouldn't see it!"); | |
|
|
68 | ||
|
|
69 | t.comment("DONE"); | |
|
|
70 | ||
|
|
71 | t.end(); | |
|
|
72 | }); | |
|
|
73 | ||
|
|
74 | test("console writer", (t, trace) => { | |
|
|
75 | ||
|
|
76 | const mockConsole = new MockConsole(); | |
|
|
77 | const writer = new ConsoleWriter(mockConsole); | |
|
|
78 | const consoleLog = new ConsoleLogger(writer); | |
|
|
79 | consoleLog.writeEvents(trace.events); | |
|
|
80 | ||
|
|
81 | trace.log("Hello, world!"); | |
|
|
82 | t.deepEqual(mockConsole.getLine(0), ["console writer: Hello, world!"], "Log one string"); | |
|
|
83 | ||
|
|
84 | trace.log({ foo: "bar" }); | |
|
|
85 | t.deepEqual(mockConsole.getLine(1), ["console writer: ", { foo: "bar" }], "Log an object"); | |
|
|
86 | ||
|
|
87 | trace.log("json: {0:json}", { foo: "bar" }); | |
|
|
88 | t.deepEqual(mockConsole.getLine(2), ['console writer: json: {\n "foo": "bar"\n}'], "should convert to string substitutions with spec"); | |
|
|
89 | }); | |
| @@ -0,0 +1,13 | |||
|
|
1 | import * as tape from "tape"; | |
|
|
2 | import { Uuid } from "../Uuid"; | |
|
|
3 | ||
|
|
4 | tape("simple", t => { | |
|
|
5 | t.pass("sync assert"); | |
|
|
6 | setTimeout(() => { | |
|
|
7 | t.pass("async assert"); | |
|
|
8 | t.comment(Uuid()); | |
|
|
9 | t.ok(Uuid() !== Uuid()); | |
|
|
10 | // end should be called after the last assertion | |
|
|
11 | t.end(); | |
|
|
12 | }, 100); | |
|
|
13 | }); | |
| @@ -1,105 +1,110 | |||
|
|
1 | 1 | plugins { |
|
|
2 | 2 | id "org.implab.gradle-typescript" version "1.0.1-rc1" |
|
|
3 | 3 | } |
|
|
4 | 4 | |
|
|
5 | 5 | // если версия явно не заданы вычисляем ее из тэга ревизии v.{num}*** |
|
|
6 | 6 | // результатом будет версия '{num}.{distance}' где distance - расстояние от |
|
|
7 | 7 | // текущей ревизии до ревизии с тэгом |
|
|
8 | 8 | def tagDistance = 0; |
|
|
9 | def isRelease = false; | |
|
|
10 | 9 | |
|
|
11 | 10 | if (!version) { |
|
|
12 | 11 | |
|
|
13 | 12 | def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim(); |
|
|
14 | 13 | |
|
|
15 | 14 | def tagVersion; |
|
|
16 | 15 | |
|
|
17 | 16 | def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/); |
|
|
18 | 17 | |
|
|
19 | 18 | if (match.size()) { |
|
|
20 | 19 | tagVersion = match[0][1]; |
|
|
21 | 20 | tagDistance = match[0][2].toInteger(); |
|
|
22 | 21 | } else { |
|
|
23 | 22 | throw new Exception("A version must be specied"); |
|
|
24 | 23 | } |
|
|
25 | 24 | |
|
|
26 | 25 | version = tagVersion; |
|
|
27 | 26 | |
|
|
28 | 27 | if (tagDistance > 0) |
|
|
29 | 28 | version++; |
|
|
30 | 29 | } else { |
|
|
31 | 30 | println "explicit version: $version"; |
|
|
32 | 31 | } |
|
|
33 | 32 | |
|
|
34 | 33 | if (hasProperty('versionSuffix') && versionSuffix) { |
|
|
35 | 34 | version += "-$versionSuffix" |
|
|
36 | 35 | } |
|
|
37 | 36 | |
|
|
38 | if(!npmName) | |
|
|
39 | npmName = name; | |
|
|
40 | ||
|
|
41 | if (hasProperty('release')) { | |
|
|
42 | isRelease = (release != 'false') | |
|
|
43 | } else { | |
|
|
44 | isRelease = (tagDistance == 0); | |
|
|
45 | } | |
|
|
46 | ||
|
|
47 | if(!["amd", "commonjs", "system", "umd", "es6", "esnext"].contains(jsmodule)) | |
|
|
37 | if(! jsmodule in ["amd", "commonjs", "system", "umd", "es6", "esnext"]) | |
|
|
48 | 38 | throw new Exception("Invalid jsmodule specified: $jsmodule"); |
|
|
49 |
if(!["es3", "es5", "es6", "es2016", "es2017", "esnext"] |
|
|
|
39 | if(! target in ["es3", "es5", "es6", "es2016", "es2017", "esnext"]) | |
|
|
50 | 40 | throw new Exception("Invalid target specified: $target") |
|
|
51 | 41 | |
|
|
52 | def targetLibs = [ | |
|
|
53 | "es3" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"], | |
|
|
54 | "es5" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"] | |
|
|
55 | ]; | |
|
|
56 | ||
|
|
57 | 42 | ext { |
|
|
58 | 43 | packageName = "@$npmScope/$npmName" |
|
|
59 | 44 | } |
|
|
60 | 45 | |
|
|
61 | 46 | def jstarget = target; |
|
|
62 | 47 | |
|
|
63 | 48 | sources { |
|
|
49 | amd { | |
|
|
64 | 50 | |
|
|
51 | } | |
|
|
52 | ||
|
|
53 | cjs { | |
|
|
54 | ||
|
|
55 | } | |
|
|
65 | 56 | } |
|
|
66 | 57 | |
|
|
67 | 58 | typescript { |
|
|
68 | 59 | compilerOptions { |
|
|
69 |
lib = |
|
|
|
60 | lib = [target, "dom", "scripthost"] | |
|
|
61 | if (jstarget in ["es5", "es3"]) | |
|
|
62 | lib += ["es2015.promise"] | |
|
|
63 | ||
|
|
70 | 64 | target = jstarget |
|
|
71 | 65 | module = jsmodule |
|
|
72 | 66 | types = [] |
|
|
67 | declaration = true | |
|
|
68 | listFiles = true | |
|
|
69 | ||
|
|
73 | 70 | } |
|
|
74 | 71 | tsLintCmd = "tslint" |
|
|
75 | 72 | esLintCmd = "eslint" |
|
|
76 | 73 | npmCmd = "npm" |
|
|
77 | 74 | } |
|
|
78 | 75 | |
|
|
76 | configureTsMain { | |
|
|
77 | compilerOptions { | |
|
|
78 | if (jstarget in ["es5", "es3"]) | |
|
|
79 | lib += ["es2015.symbol", "es2015.iterable"] | |
|
|
80 | } | |
|
|
81 | } | |
|
|
82 | ||
|
|
83 | configureTsTest { | |
|
|
84 | compilerOptions { | |
|
|
85 | types += [ "node" ] | |
|
|
86 | } | |
|
|
87 | } | |
|
|
88 | ||
|
|
79 | 89 | task printVersion { |
|
|
80 | 90 | doLast { |
|
|
81 | 91 | println "version: $version"; |
|
|
82 |
println " |
|
|
|
92 | println "tagDistance: $tagDistance"; | |
|
|
83 | 93 | println "packageName: $packageName"; |
|
|
84 | 94 | println "bundle: ${npmPack.outputs.files.join(',')}"; |
|
|
85 | 95 | println "target: $jstarget"; |
|
|
86 | 96 | println "module: $jsmodule"; |
|
|
87 | 97 | } |
|
|
88 | 98 | } |
|
|
89 | 99 | |
|
|
90 | 100 | task clean { |
|
|
91 | 101 | doLast { |
|
|
92 | 102 | delete buildDir |
|
|
93 | 103 | } |
|
|
94 | 104 | } |
|
|
95 | 105 | |
|
|
96 | 106 | npmPackMeta { |
|
|
97 | 107 | meta { |
|
|
98 |
name = |
|
|
|
108 | name = packageName | |
|
|
99 | 109 | } |
|
|
100 | 110 | } |
|
|
101 | ||
|
|
102 | task markRelease(type: Exec) { | |
|
|
103 | onlyIf { tagDistance > 1 } | |
|
|
104 | commandLine "hg", "tag", "v$version"; | |
|
|
105 | } No newline at end of file | |
| @@ -1,471 +1,471 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "name": "@implab/core", |
|
|
3 | 3 | "version": "0.0.1-dev", |
|
|
4 | 4 | "lockfileVersion": 1, |
|
|
5 | 5 | "requires": true, |
|
|
6 | 6 | "dependencies": { |
|
|
7 | 7 | "@types/node": { |
|
|
8 |
"version": " |
|
|
|
9 |
"resolved": "https://registry.npmjs.org/@types/node/-/node- |
|
|
|
10 | "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==", | |
|
|
8 | "version": "8.10.55", | |
|
|
9 | "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.55.tgz", | |
|
|
10 | "integrity": "sha512-iZeh1EgupfmAAOASk580R1SL5lWF3CsBVgVH0395qyNF8fhO16xy1UwAav2PdGxIIsYRn7RzJgMGjdsvam6YYg==", | |
|
|
11 | 11 | "dev": true |
|
|
12 | 12 | }, |
|
|
13 | 13 | "@types/requirejs": { |
|
|
14 | 14 | "version": "2.1.31", |
|
|
15 | 15 | "resolved": "https://registry.npmjs.org/@types/requirejs/-/requirejs-2.1.31.tgz", |
|
|
16 | 16 | "integrity": "sha512-b2soeyuU76rMbcRJ4e0hEl0tbMhFwZeTC0VZnfuWlfGlk6BwWNsev6kFu/twKABPX29wkX84wU2o+cEJoXsiTw==", |
|
|
17 | 17 | "dev": true |
|
|
18 | 18 | }, |
|
|
19 | 19 | "@types/tape": { |
|
|
20 | 20 | "version": "4.2.33", |
|
|
21 | 21 | "resolved": "https://registry.npmjs.org/@types/tape/-/tape-4.2.33.tgz", |
|
|
22 | 22 | "integrity": "sha512-ltfyuY5BIkYlGuQfwqzTDT8f0q8Z5DGppvUnWGs39oqDmMd6/UWhNpX3ZMh/VYvfxs3rFGHMrLC/eGRdLiDGuw==", |
|
|
23 | 23 | "dev": true, |
|
|
24 | 24 | "requires": { |
|
|
25 | 25 | "@types/node": "*" |
|
|
26 | 26 | } |
|
|
27 | 27 | }, |
|
|
28 | 28 | "balanced-match": { |
|
|
29 | 29 | "version": "1.0.0", |
|
|
30 | 30 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
|
|
31 | 31 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", |
|
|
32 | 32 | "dev": true |
|
|
33 | 33 | }, |
|
|
34 | 34 | "brace-expansion": { |
|
|
35 | 35 | "version": "1.1.11", |
|
|
36 | 36 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", |
|
|
37 | 37 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", |
|
|
38 | 38 | "dev": true, |
|
|
39 | 39 | "requires": { |
|
|
40 | 40 | "balanced-match": "^1.0.0", |
|
|
41 | 41 | "concat-map": "0.0.1" |
|
|
42 | 42 | } |
|
|
43 | 43 | }, |
|
|
44 | 44 | "concat-map": { |
|
|
45 | 45 | "version": "0.0.1", |
|
|
46 | 46 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
|
|
47 | 47 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", |
|
|
48 | 48 | "dev": true |
|
|
49 | 49 | }, |
|
|
50 | 50 | "core-util-is": { |
|
|
51 | 51 | "version": "1.0.2", |
|
|
52 | 52 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", |
|
|
53 | 53 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", |
|
|
54 | 54 | "dev": true |
|
|
55 | 55 | }, |
|
|
56 | 56 | "deep-equal": { |
|
|
57 | 57 | "version": "0.1.2", |
|
|
58 | 58 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.1.2.tgz", |
|
|
59 | 59 | "integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=", |
|
|
60 | 60 | "dev": true |
|
|
61 | 61 | }, |
|
|
62 | 62 | "define-properties": { |
|
|
63 | 63 | "version": "1.1.3", |
|
|
64 | 64 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", |
|
|
65 | 65 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", |
|
|
66 | 66 | "dev": true, |
|
|
67 | 67 | "requires": { |
|
|
68 | 68 | "object-keys": "^1.0.12" |
|
|
69 | 69 | }, |
|
|
70 | 70 | "dependencies": { |
|
|
71 | 71 | "object-keys": { |
|
|
72 | 72 | "version": "1.0.12", |
|
|
73 | 73 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", |
|
|
74 | 74 | "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", |
|
|
75 | 75 | "dev": true |
|
|
76 | 76 | } |
|
|
77 | 77 | } |
|
|
78 | 78 | }, |
|
|
79 | 79 | "defined": { |
|
|
80 | 80 | "version": "0.0.0", |
|
|
81 | 81 | "resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz", |
|
|
82 | 82 | "integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=", |
|
|
83 | 83 | "dev": true |
|
|
84 | 84 | }, |
|
|
85 | 85 | "dojo": { |
|
|
86 | 86 | "version": "1.14.2", |
|
|
87 | 87 | "resolved": "https://registry.npmjs.org/dojo/-/dojo-1.14.2.tgz", |
|
|
88 | 88 | "integrity": "sha512-TI+Ytgfh/VfmHWERp45Jte6NFMdoJTPsvUP/uzJUvAXET8FP2h442LePWWJ/q/xZ4V0V8OtdJhx8It/GB+Zbxg==", |
|
|
89 | 89 | "dev": true |
|
|
90 | 90 | }, |
|
|
91 | 91 | "duplexer": { |
|
|
92 | 92 | "version": "0.1.1", |
|
|
93 | 93 | "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", |
|
|
94 | 94 | "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", |
|
|
95 | 95 | "dev": true |
|
|
96 | 96 | }, |
|
|
97 | 97 | "es-abstract": { |
|
|
98 | 98 | "version": "1.13.0", |
|
|
99 | 99 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.13.0.tgz", |
|
|
100 | 100 | "integrity": "sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg==", |
|
|
101 | 101 | "dev": true, |
|
|
102 | 102 | "requires": { |
|
|
103 | 103 | "es-to-primitive": "^1.2.0", |
|
|
104 | 104 | "function-bind": "^1.1.1", |
|
|
105 | 105 | "has": "^1.0.3", |
|
|
106 | 106 | "is-callable": "^1.1.4", |
|
|
107 | 107 | "is-regex": "^1.0.4", |
|
|
108 | 108 | "object-keys": "^1.0.12" |
|
|
109 | 109 | }, |
|
|
110 | 110 | "dependencies": { |
|
|
111 | 111 | "object-keys": { |
|
|
112 | 112 | "version": "1.0.12", |
|
|
113 | 113 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", |
|
|
114 | 114 | "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", |
|
|
115 | 115 | "dev": true |
|
|
116 | 116 | } |
|
|
117 | 117 | } |
|
|
118 | 118 | }, |
|
|
119 | 119 | "es-to-primitive": { |
|
|
120 | 120 | "version": "1.2.0", |
|
|
121 | 121 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", |
|
|
122 | 122 | "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", |
|
|
123 | 123 | "dev": true, |
|
|
124 | 124 | "requires": { |
|
|
125 | 125 | "is-callable": "^1.1.4", |
|
|
126 | 126 | "is-date-object": "^1.0.1", |
|
|
127 | 127 | "is-symbol": "^1.0.2" |
|
|
128 | 128 | } |
|
|
129 | 129 | }, |
|
|
130 | 130 | "faucet": { |
|
|
131 | 131 | "version": "0.0.1", |
|
|
132 | 132 | "resolved": "https://registry.npmjs.org/faucet/-/faucet-0.0.1.tgz", |
|
|
133 | 133 | "integrity": "sha1-WX3PHSGJosBiMhtZHo8VHtIDnZw=", |
|
|
134 | 134 | "dev": true, |
|
|
135 | 135 | "requires": { |
|
|
136 | 136 | "defined": "0.0.0", |
|
|
137 | 137 | "duplexer": "~0.1.1", |
|
|
138 | 138 | "minimist": "0.0.5", |
|
|
139 | 139 | "sprintf": "~0.1.3", |
|
|
140 | 140 | "tap-parser": "~0.4.0", |
|
|
141 | 141 | "tape": "~2.3.2", |
|
|
142 | 142 | "through2": "~0.2.3" |
|
|
143 | 143 | }, |
|
|
144 | 144 | "dependencies": { |
|
|
145 | 145 | "tape": { |
|
|
146 | 146 | "version": "2.3.3", |
|
|
147 | 147 | "resolved": "http://registry.npmjs.org/tape/-/tape-2.3.3.tgz", |
|
|
148 | 148 | "integrity": "sha1-Lnzgox3wn41oUWZKcYQuDKUFevc=", |
|
|
149 | 149 | "dev": true, |
|
|
150 | 150 | "requires": { |
|
|
151 | 151 | "deep-equal": "~0.1.0", |
|
|
152 | 152 | "defined": "~0.0.0", |
|
|
153 | 153 | "inherits": "~2.0.1", |
|
|
154 | 154 | "jsonify": "~0.0.0", |
|
|
155 | 155 | "resumer": "~0.0.0", |
|
|
156 | 156 | "through": "~2.3.4" |
|
|
157 | 157 | } |
|
|
158 | 158 | } |
|
|
159 | 159 | } |
|
|
160 | 160 | }, |
|
|
161 | 161 | "for-each": { |
|
|
162 | 162 | "version": "0.3.3", |
|
|
163 | 163 | "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", |
|
|
164 | 164 | "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", |
|
|
165 | 165 | "dev": true, |
|
|
166 | 166 | "requires": { |
|
|
167 | 167 | "is-callable": "^1.1.3" |
|
|
168 | 168 | } |
|
|
169 | 169 | }, |
|
|
170 | 170 | "fs.realpath": { |
|
|
171 | 171 | "version": "1.0.0", |
|
|
172 | 172 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
|
|
173 | 173 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", |
|
|
174 | 174 | "dev": true |
|
|
175 | 175 | }, |
|
|
176 | 176 | "function-bind": { |
|
|
177 | 177 | "version": "1.1.1", |
|
|
178 | 178 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", |
|
|
179 | 179 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", |
|
|
180 | 180 | "dev": true |
|
|
181 | 181 | }, |
|
|
182 | 182 | "glob": { |
|
|
183 | 183 | "version": "7.1.3", |
|
|
184 | 184 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", |
|
|
185 | 185 | "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", |
|
|
186 | 186 | "dev": true, |
|
|
187 | 187 | "requires": { |
|
|
188 | 188 | "fs.realpath": "^1.0.0", |
|
|
189 | 189 | "inflight": "^1.0.4", |
|
|
190 | 190 | "inherits": "2", |
|
|
191 | 191 | "minimatch": "^3.0.4", |
|
|
192 | 192 | "once": "^1.3.0", |
|
|
193 | 193 | "path-is-absolute": "^1.0.0" |
|
|
194 | 194 | } |
|
|
195 | 195 | }, |
|
|
196 | 196 | "has": { |
|
|
197 | 197 | "version": "1.0.3", |
|
|
198 | 198 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", |
|
|
199 | 199 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", |
|
|
200 | 200 | "dev": true, |
|
|
201 | 201 | "requires": { |
|
|
202 | 202 | "function-bind": "^1.1.1" |
|
|
203 | 203 | } |
|
|
204 | 204 | }, |
|
|
205 | 205 | "has-symbols": { |
|
|
206 | 206 | "version": "1.0.0", |
|
|
207 | 207 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", |
|
|
208 | 208 | "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", |
|
|
209 | 209 | "dev": true |
|
|
210 | 210 | }, |
|
|
211 | 211 | "inflight": { |
|
|
212 | 212 | "version": "1.0.6", |
|
|
213 | 213 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", |
|
|
214 | 214 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", |
|
|
215 | 215 | "dev": true, |
|
|
216 | 216 | "requires": { |
|
|
217 | 217 | "once": "^1.3.0", |
|
|
218 | 218 | "wrappy": "1" |
|
|
219 | 219 | } |
|
|
220 | 220 | }, |
|
|
221 | 221 | "inherits": { |
|
|
222 | 222 | "version": "2.0.3", |
|
|
223 | 223 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
|
|
224 | 224 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", |
|
|
225 | 225 | "dev": true |
|
|
226 | 226 | }, |
|
|
227 | 227 | "is-callable": { |
|
|
228 | 228 | "version": "1.1.4", |
|
|
229 | 229 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", |
|
|
230 | 230 | "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", |
|
|
231 | 231 | "dev": true |
|
|
232 | 232 | }, |
|
|
233 | 233 | "is-date-object": { |
|
|
234 | 234 | "version": "1.0.1", |
|
|
235 | 235 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", |
|
|
236 | 236 | "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", |
|
|
237 | 237 | "dev": true |
|
|
238 | 238 | }, |
|
|
239 | 239 | "is-regex": { |
|
|
240 | 240 | "version": "1.0.4", |
|
|
241 | 241 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", |
|
|
242 | 242 | "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", |
|
|
243 | 243 | "dev": true, |
|
|
244 | 244 | "requires": { |
|
|
245 | 245 | "has": "^1.0.1" |
|
|
246 | 246 | } |
|
|
247 | 247 | }, |
|
|
248 | 248 | "is-symbol": { |
|
|
249 | 249 | "version": "1.0.2", |
|
|
250 | 250 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", |
|
|
251 | 251 | "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", |
|
|
252 | 252 | "dev": true, |
|
|
253 | 253 | "requires": { |
|
|
254 | 254 | "has-symbols": "^1.0.0" |
|
|
255 | 255 | } |
|
|
256 | 256 | }, |
|
|
257 | 257 | "isarray": { |
|
|
258 | 258 | "version": "0.0.1", |
|
|
259 | 259 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", |
|
|
260 | 260 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", |
|
|
261 | 261 | "dev": true |
|
|
262 | 262 | }, |
|
|
263 | 263 | "jsonify": { |
|
|
264 | 264 | "version": "0.0.0", |
|
|
265 | 265 | "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", |
|
|
266 | 266 | "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", |
|
|
267 | 267 | "dev": true |
|
|
268 | 268 | }, |
|
|
269 | 269 | "minimatch": { |
|
|
270 | 270 | "version": "3.0.4", |
|
|
271 | 271 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", |
|
|
272 | 272 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", |
|
|
273 | 273 | "dev": true, |
|
|
274 | 274 | "requires": { |
|
|
275 | 275 | "brace-expansion": "^1.1.7" |
|
|
276 | 276 | } |
|
|
277 | 277 | }, |
|
|
278 | 278 | "minimist": { |
|
|
279 | 279 | "version": "0.0.5", |
|
|
280 | 280 | "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz", |
|
|
281 | 281 | "integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY=", |
|
|
282 | 282 | "dev": true |
|
|
283 | 283 | }, |
|
|
284 | 284 | "object-inspect": { |
|
|
285 | 285 | "version": "1.6.0", |
|
|
286 | 286 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", |
|
|
287 | 287 | "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", |
|
|
288 | 288 | "dev": true |
|
|
289 | 289 | }, |
|
|
290 | 290 | "object-keys": { |
|
|
291 | 291 | "version": "0.4.0", |
|
|
292 | 292 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", |
|
|
293 | 293 | "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=", |
|
|
294 | 294 | "dev": true |
|
|
295 | 295 | }, |
|
|
296 | 296 | "once": { |
|
|
297 | 297 | "version": "1.4.0", |
|
|
298 | 298 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", |
|
|
299 | 299 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", |
|
|
300 | 300 | "dev": true, |
|
|
301 | 301 | "requires": { |
|
|
302 | 302 | "wrappy": "1" |
|
|
303 | 303 | } |
|
|
304 | 304 | }, |
|
|
305 | 305 | "path-is-absolute": { |
|
|
306 | 306 | "version": "1.0.1", |
|
|
307 | 307 | "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", |
|
|
308 | 308 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", |
|
|
309 | 309 | "dev": true |
|
|
310 | 310 | }, |
|
|
311 | 311 | "path-parse": { |
|
|
312 | 312 | "version": "1.0.6", |
|
|
313 | 313 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", |
|
|
314 | 314 | "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", |
|
|
315 | 315 | "dev": true |
|
|
316 | 316 | }, |
|
|
317 | 317 | "readable-stream": { |
|
|
318 | 318 | "version": "1.1.14", |
|
|
319 | 319 | "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", |
|
|
320 | 320 | "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", |
|
|
321 | 321 | "dev": true, |
|
|
322 | 322 | "requires": { |
|
|
323 | 323 | "core-util-is": "~1.0.0", |
|
|
324 | 324 | "inherits": "~2.0.1", |
|
|
325 | 325 | "isarray": "0.0.1", |
|
|
326 | 326 | "string_decoder": "~0.10.x" |
|
|
327 | 327 | } |
|
|
328 | 328 | }, |
|
|
329 | 329 | "requirejs": { |
|
|
330 | 330 | "version": "2.3.6", |
|
|
331 | 331 | "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", |
|
|
332 | 332 | "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", |
|
|
333 | 333 | "dev": true |
|
|
334 | 334 | }, |
|
|
335 | 335 | "resolve": { |
|
|
336 | 336 | "version": "1.7.1", |
|
|
337 | 337 | "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", |
|
|
338 | 338 | "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", |
|
|
339 | 339 | "dev": true, |
|
|
340 | 340 | "requires": { |
|
|
341 | 341 | "path-parse": "^1.0.5" |
|
|
342 | 342 | } |
|
|
343 | 343 | }, |
|
|
344 | 344 | "resumer": { |
|
|
345 | 345 | "version": "0.0.0", |
|
|
346 | 346 | "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", |
|
|
347 | 347 | "integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=", |
|
|
348 | 348 | "dev": true, |
|
|
349 | 349 | "requires": { |
|
|
350 | 350 | "through": "~2.3.4" |
|
|
351 | 351 | } |
|
|
352 | 352 | }, |
|
|
353 | 353 | "sprintf": { |
|
|
354 | 354 | "version": "0.1.5", |
|
|
355 | 355 | "resolved": "https://registry.npmjs.org/sprintf/-/sprintf-0.1.5.tgz", |
|
|
356 | 356 | "integrity": "sha1-j4PjmpMXwaUCy324BQ5Rxnn27c8=", |
|
|
357 | 357 | "dev": true |
|
|
358 | 358 | }, |
|
|
359 | 359 | "string.prototype.trim": { |
|
|
360 | 360 | "version": "1.1.2", |
|
|
361 | 361 | "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", |
|
|
362 | 362 | "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", |
|
|
363 | 363 | "dev": true, |
|
|
364 | 364 | "requires": { |
|
|
365 | 365 | "define-properties": "^1.1.2", |
|
|
366 | 366 | "es-abstract": "^1.5.0", |
|
|
367 | 367 | "function-bind": "^1.0.2" |
|
|
368 | 368 | } |
|
|
369 | 369 | }, |
|
|
370 | 370 | "string_decoder": { |
|
|
371 | 371 | "version": "0.10.31", |
|
|
372 | 372 | "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", |
|
|
373 | 373 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", |
|
|
374 | 374 | "dev": true |
|
|
375 | 375 | }, |
|
|
376 | 376 | "tap-parser": { |
|
|
377 | 377 | "version": "0.4.3", |
|
|
378 | 378 | "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-0.4.3.tgz", |
|
|
379 | 379 | "integrity": "sha1-pOrhkMENdsehEZIf84u+TVjwnuo=", |
|
|
380 | 380 | "dev": true, |
|
|
381 | 381 | "requires": { |
|
|
382 | 382 | "inherits": "~2.0.1", |
|
|
383 | 383 | "readable-stream": "~1.1.11" |
|
|
384 | 384 | } |
|
|
385 | 385 | }, |
|
|
386 | 386 | "tape": { |
|
|
387 | 387 | "version": "4.9.2", |
|
|
388 | 388 | "resolved": "https://registry.npmjs.org/tape/-/tape-4.9.2.tgz", |
|
|
389 | 389 | "integrity": "sha512-lPXKRKILZ1kZaUy5ynWKs8ATGSUO7HAFHCFnBam6FaGSqPdOwMWbxXHq4EXFLE8WRTleo/YOMXkaUTRmTB1Fiw==", |
|
|
390 | 390 | "dev": true, |
|
|
391 | 391 | "requires": { |
|
|
392 | 392 | "deep-equal": "~1.0.1", |
|
|
393 | 393 | "defined": "~1.0.0", |
|
|
394 | 394 | "for-each": "~0.3.3", |
|
|
395 | 395 | "function-bind": "~1.1.1", |
|
|
396 | 396 | "glob": "~7.1.2", |
|
|
397 | 397 | "has": "~1.0.3", |
|
|
398 | 398 | "inherits": "~2.0.3", |
|
|
399 | 399 | "minimist": "~1.2.0", |
|
|
400 | 400 | "object-inspect": "~1.6.0", |
|
|
401 | 401 | "resolve": "~1.7.1", |
|
|
402 | 402 | "resumer": "~0.0.0", |
|
|
403 | 403 | "string.prototype.trim": "~1.1.2", |
|
|
404 | 404 | "through": "~2.3.8" |
|
|
405 | 405 | }, |
|
|
406 | 406 | "dependencies": { |
|
|
407 | 407 | "deep-equal": { |
|
|
408 | 408 | "version": "1.0.1", |
|
|
409 | 409 | "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", |
|
|
410 | 410 | "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", |
|
|
411 | 411 | "dev": true |
|
|
412 | 412 | }, |
|
|
413 | 413 | "defined": { |
|
|
414 | 414 | "version": "1.0.0", |
|
|
415 | 415 | "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", |
|
|
416 | 416 | "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", |
|
|
417 | 417 | "dev": true |
|
|
418 | 418 | }, |
|
|
419 | 419 | "minimist": { |
|
|
420 | 420 | "version": "1.2.0", |
|
|
421 | 421 | "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", |
|
|
422 | 422 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", |
|
|
423 | 423 | "dev": true |
|
|
424 | 424 | } |
|
|
425 | 425 | } |
|
|
426 | 426 | }, |
|
|
427 | 427 | "through": { |
|
|
428 | 428 | "version": "2.3.8", |
|
|
429 | 429 | "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", |
|
|
430 | 430 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", |
|
|
431 | 431 | "dev": true |
|
|
432 | 432 | }, |
|
|
433 | 433 | "through2": { |
|
|
434 | 434 | "version": "0.2.3", |
|
|
435 | 435 | "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", |
|
|
436 | 436 | "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", |
|
|
437 | 437 | "dev": true, |
|
|
438 | 438 | "requires": { |
|
|
439 | 439 | "readable-stream": "~1.1.9", |
|
|
440 | 440 | "xtend": "~2.1.1" |
|
|
441 | 441 | } |
|
|
442 | 442 | }, |
|
|
443 | 443 | "tslib": { |
|
|
444 | 444 | "version": "1.9.3", |
|
|
445 | 445 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", |
|
|
446 | 446 | "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", |
|
|
447 | 447 | "dev": true |
|
|
448 | 448 | }, |
|
|
449 | 449 | "typescript": { |
|
|
450 | 450 | "version": "3.2.2", |
|
|
451 | 451 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", |
|
|
452 | 452 | "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==", |
|
|
453 | 453 | "dev": true |
|
|
454 | 454 | }, |
|
|
455 | 455 | "wrappy": { |
|
|
456 | 456 | "version": "1.0.2", |
|
|
457 | 457 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
|
|
458 | 458 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", |
|
|
459 | 459 | "dev": true |
|
|
460 | 460 | }, |
|
|
461 | 461 | "xtend": { |
|
|
462 | 462 | "version": "2.1.2", |
|
|
463 | 463 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", |
|
|
464 | 464 | "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", |
|
|
465 | 465 | "dev": true, |
|
|
466 | 466 | "requires": { |
|
|
467 | 467 | "object-keys": "~0.4.0" |
|
|
468 | 468 | } |
|
|
469 | 469 | } |
|
|
470 | 470 | } |
|
|
471 | 471 | } |
| @@ -1,35 +1,35 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "name": "@implab/core", |
|
|
3 | 3 | "version": "0.0.1-dev", |
|
|
4 | 4 | "description": "Dependency injection, logging, simple and fast text template engine", |
|
|
5 | 5 | "main": "main.js", |
|
|
6 | 6 | "keywords": [ |
|
|
7 | 7 | "di", |
|
|
8 | 8 | "ioc", |
|
|
9 | 9 | "logging", |
|
|
10 | 10 | "template engine", |
|
|
11 | 11 | "dependency injection" |
|
|
12 | 12 | ], |
|
|
13 | 13 | "author": "Implab team", |
|
|
14 | 14 | "license": "BSD-2-Clause", |
|
|
15 | 15 | "repository": "https://bitbucket.org/implab/implabjs", |
|
|
16 | 16 | "publishConfig": { |
|
|
17 | 17 | "access": "public" |
|
|
18 | 18 | }, |
|
|
19 | 19 | "peerDependencies": { |
|
|
20 | 20 | "dojo": "^1.10.0", |
|
|
21 | 21 | "tslib": "latest" |
|
|
22 | 22 | }, |
|
|
23 | 23 | "devDependencies": { |
|
|
24 |
"@types/node": " |
|
|
|
24 | "@types/node": "^8.0.0", | |
|
|
25 | 25 | "@types/requirejs": "latest", |
|
|
26 | 26 | "@types/tape": "latest", |
|
|
27 | 27 | "dojo": "^1.10.0", |
|
|
28 | 28 | "faucet": "latest", |
|
|
29 | 29 | "requirejs": "latest", |
|
|
30 | 30 | "tape": "^4.9.2", |
|
|
31 | 31 | "tslib": "latest", |
|
|
32 | 32 | "typescript": "latest" |
|
|
33 | 33 | }, |
|
|
34 | 34 | "types": "main.d.ts" |
|
|
35 | 35 | } |
| @@ -1,43 +1,43 | |||
|
|
1 |
import { IActivatable, ICancellation, IActivationController } from " |
|
|
|
2 |
import { Cancellation } from " |
|
|
|
1 | import { IActivatable, ICancellation, IActivationController } from "../interfaces"; | |
|
|
2 | import { Cancellation } from "../Cancellation"; | |
|
|
3 | 3 | |
|
|
4 | 4 | export class MockActivationController implements IActivationController { |
|
|
5 | 5 | |
|
|
6 | 6 | _active: IActivatable = null; |
|
|
7 | 7 | |
|
|
8 | 8 | getActive(): IActivatable { |
|
|
9 | 9 | return this._active; |
|
|
10 | 10 | } |
|
|
11 | 11 | |
|
|
12 | 12 | async deactivate() { |
|
|
13 | 13 | if (this._active) |
|
|
14 | 14 | await this._active.deactivate(); |
|
|
15 | 15 | this._active = null; |
|
|
16 | 16 | } |
|
|
17 | 17 | |
|
|
18 | 18 | async activate(component: IActivatable) { |
|
|
19 | 19 | if (!component || component.isActive()) |
|
|
20 | 20 | return; |
|
|
21 | 21 | component.setActivationController(this); |
|
|
22 | 22 | |
|
|
23 | 23 | await component.activate(); |
|
|
24 | 24 | } |
|
|
25 | 25 | |
|
|
26 | 26 | async activating(component: IActivatable, ct: ICancellation = Cancellation.none) { |
|
|
27 | 27 | if (component !== this._active) |
|
|
28 | 28 | await this.deactivate(); |
|
|
29 | 29 | } |
|
|
30 | 30 | |
|
|
31 | 31 | async activated(component: IActivatable, ct: ICancellation = Cancellation.none) { |
|
|
32 | 32 | this._active = component; |
|
|
33 | 33 | } |
|
|
34 | 34 | |
|
|
35 | 35 | async deactivating(component: IActivatable, ct: ICancellation = Cancellation.none) { |
|
|
36 | 36 | |
|
|
37 | 37 | } |
|
|
38 | 38 | |
|
|
39 | 39 | async deactivated(component: IActivatable, ct: ICancellation = Cancellation.none) { |
|
|
40 | 40 | if (this._active === component) |
|
|
41 | 41 | this._active = null; |
|
|
42 | 42 | } |
|
|
43 | 43 | } |
| @@ -1,52 +1,52 | |||
|
|
1 |
import {NullConsole} from " |
|
|
|
1 | import {NullConsole} from "../log/NullConsole"; | |
|
|
2 | 2 | |
|
|
3 | 3 | interface ConsoleLineData { |
|
|
4 | 4 | level: string; |
|
|
5 | 5 | data: any[]; |
|
|
6 | 6 | } |
|
|
7 | 7 | |
|
|
8 | 8 | export class MockConsole extends NullConsole { |
|
|
9 | 9 | _buffer: ConsoleLineData[] = []; |
|
|
10 | 10 | |
|
|
11 | 11 | debug(...args: any[]) { |
|
|
12 | 12 | this._buffer.push({ |
|
|
13 | 13 | level: "debug", |
|
|
14 | 14 | data: args |
|
|
15 | 15 | }); |
|
|
16 | 16 | } |
|
|
17 | 17 | |
|
|
18 | 18 | log(...args: any[]) { |
|
|
19 | 19 | this._buffer.push({ |
|
|
20 | 20 | level: "log", |
|
|
21 | 21 | data: args |
|
|
22 | 22 | }); |
|
|
23 | 23 | } |
|
|
24 | 24 | |
|
|
25 | 25 | warn(...args: any[]) { |
|
|
26 | 26 | this._buffer.push({ |
|
|
27 | 27 | level: "warn", |
|
|
28 | 28 | data: args |
|
|
29 | 29 | }); |
|
|
30 | 30 | } |
|
|
31 | 31 | |
|
|
32 | 32 | error(...args: any[]) { |
|
|
33 | 33 | this._buffer.push({ |
|
|
34 | 34 | level: "error", |
|
|
35 | 35 | data: args |
|
|
36 | 36 | }); |
|
|
37 | 37 | } |
|
|
38 | 38 | |
|
|
39 | 39 | getBuffer() { |
|
|
40 | 40 | return this._buffer; |
|
|
41 | 41 | } |
|
|
42 | 42 | |
|
|
43 | 43 | getLine(i: number) { |
|
|
44 | 44 | if (i >= this._buffer.length) |
|
|
45 | 45 | throw new Error(`Line number ${i} is out of range, buffer.length = ${this._buffer.length}`); |
|
|
46 | 46 | return this._buffer[i].data; |
|
|
47 | 47 | } |
|
|
48 | 48 | |
|
|
49 | 49 | clear() { |
|
|
50 | 50 | this._buffer = []; |
|
|
51 | 51 | } |
|
|
52 | 52 | } |
| @@ -1,6 +1,6 | |||
|
|
1 |
import { AsyncComponent } from " |
|
|
|
2 |
import { ActivatableMixin } from " |
|
|
|
1 | import { AsyncComponent } from "../components/AsyncComponent"; | |
|
|
2 | import { ActivatableMixin } from "../components/ActivatableMixin"; | |
|
|
3 | 3 | |
|
|
4 | 4 | export class SimpleActivatable extends ActivatableMixin(AsyncComponent) { |
|
|
5 | 5 | |
|
|
6 | 6 | } |
| @@ -1,15 +1,14 | |||
|
|
1 | 1 | { |
|
|
2 | 2 | "extends": "../tsconfig", |
|
|
3 | 3 | "compilerOptions": { |
|
|
4 | 4 | "rootDir": "ts", |
|
|
5 | 5 | "baseUrl": ".", |
|
|
6 |
" |
|
|
|
7 | "@implab/core/*": [ | |
|
|
8 |
|
|
|
|
9 |
|
|
|
|
10 | } | |
|
|
6 | "rootDirs": [ | |
|
|
7 | "ts", | |
|
|
8 | "../main/ts" | |
|
|
9 | ] | |
|
|
11 | 10 | }, |
|
|
12 | 11 | "include" : [ |
|
|
13 | 12 | "ts/**/*.ts" |
|
|
14 | 13 | ] |
|
|
15 | 14 | } No newline at end of file |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
|
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now
