5htp 0.6.2-8 → 0.6.2-95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -290,7 +290,7 @@ function Plugin(babel, { app, side, debug }: TOptions) {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
// Differenciate back / front
|
|
293
|
-
if (relativeFileName.startsWith('/client/pages') || relativeFileName.startsWith('/client/components')) {
|
|
293
|
+
if (relativeFileName.startsWith('/client/pages') || relativeFileName.startsWith('/client/components') || relativeFileName.startsWith('/client/hooks')) {
|
|
294
294
|
file.side = 'front';
|
|
295
295
|
} else if (relativeFileName.startsWith('/server/routes')) {
|
|
296
296
|
file.side = 'back';
|
package/compiler/index.ts
CHANGED
|
@@ -34,7 +34,7 @@ type TRegisteredService = {
|
|
|
34
34
|
id?: string,
|
|
35
35
|
name: string,
|
|
36
36
|
className: string,
|
|
37
|
-
instanciation: (parentRef
|
|
37
|
+
instanciation: (parentRef?: string) => string,
|
|
38
38
|
priority: number,
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -198,7 +198,7 @@ export default class Compiler {
|
|
|
198
198
|
const refTo = serviceConfig.refTo;
|
|
199
199
|
return {
|
|
200
200
|
name: serviceName,
|
|
201
|
-
instanciation: (
|
|
201
|
+
instanciation: () => `this.${refTo}`,
|
|
202
202
|
priority: 0
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -228,7 +228,7 @@ export default class Compiler {
|
|
|
228
228
|
|
|
229
229
|
// Reference to a service
|
|
230
230
|
else if (value.type === 'service.setup' || value.type === 'service.ref') // TODO: more reliable way to detect a service reference
|
|
231
|
-
propsStr += `${key}:`+ refService(key, value, level + 1).instanciation(
|
|
231
|
+
propsStr += `${key}:`+ refService(key, value, level + 1).instanciation() + ',\n'
|
|
232
232
|
|
|
233
233
|
// Recursion
|
|
234
234
|
else if (level <= 4 && !Array.isArray(value))
|
|
@@ -244,10 +244,10 @@ export default class Compiler {
|
|
|
244
244
|
const config = processConfig(serviceConfig.config || {});
|
|
245
245
|
|
|
246
246
|
// Generate the service instance
|
|
247
|
-
const instanciation = (parentRef
|
|
247
|
+
const instanciation = (parentRef?: string) =>
|
|
248
248
|
`new ${serviceMetas.name}(
|
|
249
|
-
${parentRef}
|
|
250
|
-
|
|
249
|
+
${parentRef ? `${parentRef},` : ''}
|
|
250
|
+
${config},
|
|
251
251
|
this
|
|
252
252
|
)`
|
|
253
253
|
|
|
@@ -353,7 +353,7 @@ export default class ${appClassIdentifier} extends Application {
|
|
|
353
353
|
|
|
354
354
|
// Makke sure the services typigs are reflecting the config and referring to the app
|
|
355
355
|
${sortedServices.map(service =>
|
|
356
|
-
`public ${service.name}!: ReturnType
|
|
356
|
+
`public ${service.name}!: ReturnType<${appClassIdentifier}["registered"]["${service.id}"]["start"]>;`
|
|
357
357
|
).join('\n')}
|
|
358
358
|
|
|
359
359
|
protected registered = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5htp",
|
|
3
3
|
"description": "Convenient TypeScript framework designed for Performance and Productivity.",
|
|
4
|
-
"version": "0.6.2-
|
|
4
|
+
"version": "0.6.2-95",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp.git",
|
|
7
7
|
"license": "MIT",
|