Skip to content

Commit f841d43

Browse files
author
craig
committed
2.0.0 / 2022-03-23
================== * Initial esm support - @craigparra
1 parent f29e6bd commit f841d43

File tree

6 files changed

+15
-30
lines changed

6 files changed

+15
-30
lines changed

ApplicationContext.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ export default class ApplicationContext {
135135
for (let i = 0; i < this.contexts.length; i++) {
136136
if (this.contexts[i]) {
137137
if (this.contexts[i]?.constructor?.name === 'Context') {
138+
// eslint-disable-next-line no-await-in-loop
138139
await this.parseContextComponents(this.contexts[i]);
139140
} else {
141+
// eslint-disable-next-line no-await-in-loop
140142
await this.parseContextComponents(new Context(this.contexts[i]));
141143
}
142144
} else {
@@ -158,6 +160,7 @@ export default class ApplicationContext {
158160
const name = contextKeys[i];
159161
const component = contextComponent[name];
160162
component.name = name;
163+
// eslint-disable-next-line no-await-in-loop
161164
await this.parseContextComponent(component);
162165
}
163166
}
@@ -168,6 +171,7 @@ export default class ApplicationContext {
168171
if (context.components) {
169172
if (Array.isArray(context.components)) {
170173
for (let i = 0; i < context.components.length; i++) {
174+
// eslint-disable-next-line no-await-in-loop
171175
await this.deriveContextComponent(context.components[i]);
172176
}
173177
}
@@ -202,17 +206,16 @@ export default class ApplicationContext {
202206
$component.wireFactory = component.wireFactory;
203207
// TODO - dynamic import (async)
204208
if (component.require) {
205-
try{
209+
try {
206210
// eslint-disable-next-line
207211
let module = await import(component.require);
208212
$component.Reference = module.default;
209213
$component.isClass = ($component?.Reference?.prototype?.constructor !== undefined);
210214
} catch (err) {
211-
this.logger.error(err);
215+
this.logger.error(err);
212216
}
213217
}
214218

215-
216219
$component.properties = component.properties || constructr?.properties;
217220
$component.profiles = component.profiles || constructr?.profiles;
218221
if (!$component.profiles) {

server.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/ApplicationContext.spec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ describe('ApplicationContext Specification', () => {
113113
assert.exists(simpleClass, 'simpleClass exists');
114114
});
115115

116-
it('ApplicationContext accepts plain old object, with require', async() => {
117-
const context = { name: 'SimpleClass',
116+
it('ApplicationContext accepts plain old object, with require', async () => {
117+
const context = {
118+
name: 'SimpleClass',
118119
require: './test/service/SimpleClass.js',
119120
};
120121

@@ -126,7 +127,7 @@ describe('ApplicationContext Specification', () => {
126127
assert.exists(simpleClass.uuid, 'simpleClass.uuid exists');
127128
});
128129

129-
it('ApplicationContext accepts config context', async() => {
130+
it('ApplicationContext accepts config context', async () => {
130131
const ephemeralConfig = new EphemeralConfig(
131132
{
132133
context: {

test/Prototype.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('Prototypes Specification', () => {
163163
assert.equal(funcy.attr, 'value', 'funcy.attr == value');
164164
});
165165

166-
it('Simple Prototype using singleton factory function', async() => {
166+
it('Simple Prototype using singleton factory function', async () => {
167167
const context = new Context([
168168
{
169169
name: 'singletonFactory',

test/Singleton.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ beforeEach(async () => {
3434
});
3535

3636
describe('Singleton Specification', () => {
37-
it('Simple Component is a singleton', async() => {
37+
it('Simple Component is a singleton', async () => {
3838
const context = new Context([new Component(SimpleClass)]);
3939

4040
const applicationContext = new ApplicationContext([context]);

test/Wiring.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ beforeEach(async () => {
3939
});
4040

4141
describe('Wiring Specification', () => {
42-
it('Classes A & B exist and are autowired by default', async() => {
42+
it('Classes A & B exist and are autowired by default', async () => {
4343
const context = new Context([
4444
new Component(ClassA),
4545
new Component(ClassB),
@@ -60,7 +60,7 @@ describe('Wiring Specification', () => {
6060
assert.isNull(classC.attribute, 'classC.attribute is null');
6161
});
6262

63-
it('SimpleConfigProperty is autowired from config', async() => {
63+
it('SimpleConfigProperty is autowired from config', async () => {
6464
const ephemeralConfig = new EphemeralConfig(
6565
{
6666
pathtovalue: 1,
@@ -138,7 +138,7 @@ describe('Wiring Specification', () => {
138138
assert.equal(simpleConfigProperty.attribute, 3, 'simpleClass.attribute == 3');
139139
});
140140

141-
it('SimpleConfigProperty is wired from context property object', async() => {
141+
it('SimpleConfigProperty is wired from context property object', async () => {
142142
const context = new Context([new Component({
143143
Reference: SimpleConfigProperty,
144144
properties: [{ name: 'attribute', value: 3 }],

0 commit comments

Comments
 (0)