5htp 0.4.6-5 → 0.5.9

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.
Files changed (41) hide show
  1. package/{src/app → app}/config.ts +7 -7
  2. package/app/index.ts +196 -0
  3. package/{src/commands → commands}/dev.ts +2 -2
  4. package/{src/commands → commands}/init.ts +1 -1
  5. package/{src/compiler → compiler}/client/identite.ts +1 -1
  6. package/{src/compiler → compiler}/client/index.ts +6 -6
  7. package/{src/compiler → compiler}/common/babel/index.ts +1 -1
  8. package/{src/compiler → compiler}/common/babel/plugins/injection-dependances/index.ts +2 -2
  9. package/{src/compiler → compiler}/common/babel/plugins/queries/index.ts +1 -1
  10. package/compiler/common/babel/plugins/services.ts +247 -0
  11. package/{src/compiler → compiler}/common/babel/routes/imports.ts +1 -1
  12. package/{src/compiler → compiler}/common/babel/routes/routes.ts +148 -39
  13. package/{src/compiler → compiler}/common/files/style.ts +3 -3
  14. package/{src/compiler → compiler}/common/plugins/indexage/icones-svg/index.ts +2 -2
  15. package/{src/compiler → compiler}/index.ts +148 -36
  16. package/{src/compiler → compiler}/server/index.ts +13 -11
  17. package/package.json +4 -2
  18. package/{src/paths.ts → paths.ts} +3 -4
  19. package/tsconfig.json +3 -2
  20. package/src/app/index.ts +0 -111
  21. package/src/compiler/common/babel/plugins/services.ts +0 -209
  22. /package/{src/commands → commands}/build.ts +0 -0
  23. /package/{src/commands → commands}/deploy/app.ts +0 -0
  24. /package/{src/commands → commands}/deploy/web.ts +0 -0
  25. /package/{src/compiler → compiler}/common/babel/plugins/form.ts +0 -0
  26. /package/{src/compiler → compiler}/common/babel/plugins/icones-svg.ts +0 -0
  27. /package/{src/compiler → compiler}/common/babel/plugins/index.ts +0 -0
  28. /package/{src/compiler → compiler}/common/babel/plugins/injection-dependances/remplacerFonction.ts +0 -0
  29. /package/{src/compiler → compiler}/common/files/autres.ts +0 -0
  30. /package/{src/compiler → compiler}/common/files/images.ts +0 -0
  31. /package/{src/compiler → compiler}/common/index.ts +0 -0
  32. /package/{src/compiler → compiler}/common/plugins/indexage/_utils/Stringify.ts +0 -0
  33. /package/{src/compiler → compiler}/common/plugins/indexage/_utils/annotations.ts +0 -0
  34. /package/{src/compiler → compiler}/common/plugins/indexage/_utils/iterateur.ts +0 -0
  35. /package/{src/compiler → compiler}/common/plugins/indexage/index.ts +0 -0
  36. /package/{src/compiler → compiler}/common/plugins/indexage/indexeur.ts +0 -0
  37. /package/{src/compiler → compiler}/common/plugins/indexage/injection-dependances/index.ts +0 -0
  38. /package/{src/index.ts → index.ts} +0 -0
  39. /package/{src/print.ts → print.ts} +0 -0
  40. /package/{src/utils → utils}/index.ts +0 -0
  41. /package/{src/utils → utils}/keyboard.ts +0 -0
@@ -39,11 +39,16 @@ module.exports = (options: TOptions) => (
39
39
  [Plugin, options]
40
40
  )
41
41
 
42
+ const clientServices = ['Router'];
43
+ // Others will be called via app.<Service> (backend) or api.post(<path>, <params>) (frontend)
44
+
42
45
  /*----------------------------------
43
46
  - PLUGIN
44
47
  ----------------------------------*/
45
48
  function Plugin(babel, { app, side, debug }: TOptions) {
46
49
 
50
+ debug = true;
51
+
47
52
  const t = babel.types as typeof types;
48
53
 
49
54
  /*
@@ -78,7 +83,8 @@ function Plugin(babel, { app, side, debug }: TOptions) {
78
83
  // Replace by: nothing
79
84
  ImportDeclaration(path) {
80
85
 
81
- if (!this.file.process)
86
+ const shouldTransformImports = this.file.process && this.file.side === 'front';
87
+ if (!shouldTransformImports)
82
88
  return;
83
89
 
84
90
  if (path.node.source.value !== '@app')
@@ -92,7 +98,12 @@ function Plugin(babel, { app, side, debug }: TOptions) {
92
98
  if (specifier.imported.type !== 'Identifier')
93
99
  continue;
94
100
 
95
- this.file.importedServices[ specifier.local.name ] = specifier.imported.name;
101
+ const serviceName = specifier.imported.name;
102
+
103
+ if (clientServices.includes(serviceName))
104
+ this.file.importedServices[ specifier.local.name ] = serviceName;
105
+ else
106
+ this.file.importedServices[ specifier.local.name ] = 'app';
96
107
  }
97
108
 
98
109
  // Remove this import
@@ -100,9 +111,7 @@ function Plugin(babel, { app, side, debug }: TOptions) {
100
111
 
101
112
  },
102
113
 
103
- // Find Router definitions
104
- // Test: Router.xxx()
105
- // Replace by: nothing
114
+ // Transform services service calls
106
115
  CallExpression(path) {
107
116
 
108
117
  if (!this.file.process)
@@ -112,36 +121,121 @@ function Plugin(babel, { app, side, debug }: TOptions) {
112
121
  const callee = path.node.callee
113
122
  if (!(
114
123
  callee.type === 'MemberExpression'
115
- &&
116
- callee.object.type === 'Identifier'
117
- &&
118
- callee.property.type === 'Identifier'
119
- &&
120
- // Should be at the root of the document
121
- path.parent.type === 'ExpressionStatement'
122
- &&
123
- path.parentPath.parent.type === 'Program'
124
- // And make reference to a service
125
- &&
126
- (callee.object.name in this.file.importedServices)
127
124
  ))
128
125
  return;
129
126
 
130
- const routeDef: TRouteDefinition = {
131
- definition: path.node,
132
- dataFetchers: []
133
- }
127
+ // Create full path
128
+ const completePath: string[] = [];
129
+ let currCallee: types.MemberExpression = callee;
130
+ while (1) {
131
+
132
+ if (currCallee.property.type === 'Identifier')
133
+ completePath.unshift(currCallee.property.name);
134
+
135
+ if (currCallee.object.type === 'MemberExpression')
136
+ currCallee = currCallee.object;
137
+ else {
134
138
 
135
- // Adjust
136
- if (this.file.side === 'front') {
137
- transformDataFetchers(path, this, routeDef);
139
+ if (currCallee.object.type === 'Identifier')
140
+ completePath.unshift(currCallee.object.name);
141
+
142
+ break;
143
+ }
138
144
  }
145
+
146
+ // If we actually call a service
147
+ const serviceName = completePath[0];
148
+
149
+ /*
150
+ Router.page: wrap with export const __register = ({ Router }) => Router.page(...)
151
+ */
152
+ if (
153
+ serviceName === 'Router'
154
+ &&
155
+ callee.property.type === 'Identifier'
156
+ &&
157
+ ['page', 'error', 'get', 'post', 'put', 'delete'].includes(callee.property.name)
158
+ ) {
159
+
160
+ // Should be at the root of the document
161
+ if (!(
162
+ path.parent.type === 'ExpressionStatement'
163
+ &&
164
+ path.parentPath.parent.type === 'Program'
165
+ ))
166
+ return;
167
+
168
+ const routeDef: TRouteDefinition = {
169
+ definition: path.node,
170
+ dataFetchers: []
171
+ }
172
+
173
+ // Adjust
174
+ if (this.file.side === 'front') {
175
+ transformDataFetchers(path, this, routeDef);
176
+ }
177
+
178
+ // Add to the list of route definitons to wrap
179
+ this.file.routeDefinitions.push(routeDef);
180
+
181
+ // Delete the route def since it will be replaced by a wrapper
182
+ path.replaceWithMultiple([]);
183
+
184
+ /* [client] Backend Service calls: Transform to api.post( <method path>, <params> )
185
+
186
+ Events.Create( form.data ).then(res => toast.success(res.message))
187
+ =>
188
+ api.post( '/api/events/create', form.data ).then(res => toast.success(res.message))
189
+ */
190
+ } else if (this.file.side === 'front') {
139
191
 
140
- // Add to the list of route definitons to wrap
141
- this.file.routeDefinitions.push(routeDef);
192
+ const isAService = (
193
+ serviceName in this.file.importedServices
194
+ &&
195
+ serviceName[0] === serviceName[0].toUpperCase()
196
+ );
197
+ if(!isAService)
198
+ return;
199
+
200
+ if (side === 'client') {
142
201
 
143
- // Delete the route def since it will be replaced by a wrapper
144
- path.replaceWithMultiple([]);
202
+ // Get complete call path
203
+ const apiPath = '/api/' + completePath.join('/');
204
+
205
+ // Replace by api.post( <method path>, <params> )
206
+ const apiPostArgs: types.CallExpression["arguments"] = [t.stringLiteral(apiPath)];
207
+ if (path.node.arguments.length === 1)
208
+ apiPostArgs.push( path.node.arguments[0] );
209
+
210
+ path.replaceWith(
211
+ t.callExpression(
212
+ t.memberExpression(
213
+ t.identifier('api'), t.identifier('post')
214
+ ), apiPostArgs
215
+ )
216
+ )
217
+ } else {
218
+
219
+ // Rebuild member expression from completePath, adding a api prefix
220
+ let newCallee = t.memberExpression(
221
+ t.identifier('app'),
222
+ t.identifier(completePath[0])
223
+ );
224
+ for (let i = 1; i < completePath.length; i++) {
225
+ newCallee = t.memberExpression(
226
+ newCallee,
227
+ t.identifier(completePath[i])
228
+ );
229
+ }
230
+
231
+ // Replace by app.<service>.<method>(...)
232
+ path.replaceWith(
233
+ t.callExpression(
234
+ newCallee, [...path.node.arguments]
235
+ )
236
+ )
237
+ }
238
+ }
145
239
 
146
240
  },
147
241
  Program: {
@@ -153,7 +247,6 @@ function Plugin(babel, { app, side, debug }: TOptions) {
153
247
  const wrappedrouteDefs = wrapRouteDefs( this.file );
154
248
  if (wrappedrouteDefs)
155
249
  path.pushContainer('body', [wrappedrouteDefs])
156
-
157
250
  }
158
251
  }
159
252
  }
@@ -185,9 +278,9 @@ function Plugin(babel, { app, side, debug }: TOptions) {
185
278
  }
186
279
 
187
280
  // Differenciate back / front
188
- if (relativeFileName.startsWith('/src/client/pages')) {
281
+ if (relativeFileName.startsWith('/client/pages')) {
189
282
  file.side = 'front';
190
- } else if (relativeFileName.startsWith('/src/server/routes')) {
283
+ } else if (relativeFileName.startsWith('/server/routes')) {
191
284
  file.side = 'back';
192
285
  } else
193
286
  file.process = false;
@@ -201,12 +294,13 @@ function Plugin(babel, { app, side, debug }: TOptions) {
201
294
  routeDef: TRouteDefinition
202
295
  ) {
203
296
  path.traverse({
297
+ // api.load => move data fetchers to route.options.data
298
+ // So the router is able to load data before rendering the component
204
299
  CallExpression(path) {
205
300
 
206
301
  const callee = path.node.callee
207
302
 
208
- // api.load => move data fetchers to route.options.data
209
- // So the router is able to load data before rendering the component
303
+ // Detect api.fetch
210
304
  if (!(
211
305
  callee.type === 'MemberExpression'
212
306
  &&
@@ -220,11 +314,23 @@ function Plugin(babel, { app, side, debug }: TOptions) {
220
314
  ))
221
315
  return;
222
316
 
317
+ /* Reference data fetchers
318
+ {
319
+ stats: api.get(...)
320
+ }
321
+ */
223
322
  routeDef.dataFetchers.push(
224
323
  ...path.node.arguments[0].properties
225
324
  );
226
325
 
227
- // Delete routerDefContext node
326
+ /* Replace the:
327
+ const { stats } = api.fetch({
328
+ stats: api.get(...)
329
+ })
330
+
331
+ by:
332
+ const { stats } = context.data.stats;
333
+ */
228
334
  path.replaceWith(
229
335
  t.memberExpression(
230
336
  t.identifier( routeDef.contextName || 'context' ),
@@ -235,7 +341,7 @@ function Plugin(babel, { app, side, debug }: TOptions) {
235
341
  }, routerDefContext);
236
342
  }
237
343
 
238
- function injectOptions(
344
+ function enrichRouteOptions(
239
345
  routeDef: TRouteDefinition,
240
346
  routeArgs: types.CallExpression["arguments"],
241
347
  filename: string
@@ -366,7 +472,9 @@ function Plugin(babel, { app, side, debug }: TOptions) {
366
472
 
367
473
  // Limit to one route def per file
368
474
  const routesDefCount = file.routeDefinitions.length;
369
- if (routesDefCount !== 1)
475
+ if (routesDefCount === 0)
476
+ return;
477
+ else if (routesDefCount > 1)
370
478
  throw new Error(`Frontend route definition files (/client/pages/**/**.ts) can contain only one route definition.
371
479
  ${routesDefCount} were given in ${file.path}.`);
372
480
 
@@ -379,7 +487,7 @@ function Plugin(babel, { app, side, debug }: TOptions) {
379
487
  if (callee.object.name === 'Router') {
380
488
 
381
489
  // Inject chunk id in options (2nd arg)
382
- const newRouteArgs = injectOptions(routeDef, routeArgs, file.path);
490
+ const newRouteArgs = enrichRouteOptions(routeDef, routeArgs, file.path);
383
491
  if (newRouteArgs === 'ALREADY_PROCESSED')
384
492
  return;
385
493
 
@@ -426,9 +534,10 @@ function Plugin(babel, { app, side, debug }: TOptions) {
426
534
  )
427
535
  ])
428
536
  );
537
+
429
538
 
430
- /*(file.side === 'front' && file.path.includes('/headhunter/talents/index.tsx'))
431
- && console.log( file.path, generate(exportDeclaration).code );*/
539
+ (file.side === 'front' && file.path.includes('/server/routes/events.ts'))
540
+ && console.log( file.path, generate(exportDeclaration).code );
432
541
 
433
542
  return exportDeclaration;
434
543
  }
@@ -18,16 +18,16 @@ module.exports = (app: App, dev: Boolean, client: boolean) => {
18
18
 
19
19
  // Process external/third-party styles
20
20
  {
21
- exclude: [/*process.env.framework + '/kernel', */app.paths.src],
21
+ exclude: [app.paths.root],
22
22
  loader: 'css-loader',
23
23
  options: {
24
24
  sourceMap: dev
25
25
  },
26
26
  },
27
27
 
28
- // Process internal/project styles (from src folder)
28
+ // Process internal/project styles (from root folder)
29
29
  {
30
- include: [/*process.env.framework + '/kernel', */app.paths.src],
30
+ include: [app.paths.root],
31
31
  loader: 'css-loader',
32
32
  options: {
33
33
  // CSS Loader https://github.com/webpack/css-loader
@@ -38,10 +38,10 @@ export default class IconesSVG extends Indexeur {
38
38
  super();
39
39
 
40
40
  this.formats = ['woff2'];
41
- this.dossierIcones = cli.paths.core.src + '/client/assets/icons/';
41
+ this.dossierIcones = cli.paths.core.root + '/client/assets/icons/';
42
42
  this.dossierSortie = app.paths.bin + '/public/';
43
43
 
44
- this.cacheTypes = cli.paths.core.src + '/types/icons.d.ts';
44
+ this.cacheTypes = cli.paths.core.root + '/types/icons.d.ts';
45
45
  this.cacheIndex = this.dossierIcones + 'index.json';
46
46
 
47
47
  if (fs.existsSync(this.cacheIndex)) {
@@ -6,6 +6,7 @@
6
6
  import path from 'path';
7
7
  import webpack from 'webpack';
8
8
  import fs from 'fs-extra';
9
+ import serialize from 'serialize-javascript';
9
10
 
10
11
  import SpeedMeasurePlugin from "speed-measure-webpack-plugin";
11
12
  const smp = new SpeedMeasurePlugin({ disable: true });
@@ -137,21 +138,19 @@ export default class Compiler {
137
138
 
138
139
  private indexServices() {
139
140
 
140
- const imported: string[] = []
141
- const exportedType: string[] = []
142
- const exportedMetas: string[] = []
143
141
 
144
142
  // Index services
145
143
  const searchDirs = {
146
144
  // The less priority is the first
147
145
  // The last override the first if there are duplicates
148
- '@server/services/': path.join(cli.paths.core.src, 'server', 'services'),
149
- '@/server/services/': path.join(app.paths.src, 'server', 'services'),
146
+ '@server/services/': path.join(cli.paths.core.root, 'server', 'services'),
147
+ '@/server/services/': path.join(app.paths.root, 'server', 'services'),
150
148
  // Temp disabled because compile issue on vercel
151
149
  //'': path.join(app.paths.root, 'node_modules'),
152
150
  }
153
151
 
154
- const servicesIndex: {[id: string]: TServiceMetas} = {};
152
+ // Generate app class file
153
+ const servicesAvailable: {[id: string]: TServiceMetas} = {};
155
154
  for (const importationPrefix in searchDirs) {
156
155
 
157
156
  const searchDir = searchDirs[ importationPrefix ];
@@ -165,32 +164,88 @@ export default class Compiler {
165
164
 
166
165
  const serviceMetas = require(metasFile);
167
166
 
168
- servicesIndex[ metasFile ] = {
167
+ servicesAvailable[ serviceMetas.id ] = {
169
168
  ...serviceMetas,
170
169
  importationPath
171
170
  };
172
171
  }
173
172
  }
174
173
 
175
- // Create importation directives
176
- for (const serviceId in servicesIndex) {
174
+ // Read app services
175
+ const imported: string[] = []
176
+ const referencedNames: {[serviceId: string]: string} = {} // ID to Name
177
+
178
+ const refService = (serviceName: string, serviceConfig: any, level: number = 0) => {
177
179
 
178
- const { id, name, parent, dependences, importationPath } = servicesIndex[ serviceId ];
180
+ if (serviceConfig.refTo !== undefined) {
181
+ const refTo = serviceConfig.refTo;
182
+ return {
183
+ name: serviceName,
184
+ code: `${serviceName}: this.${refTo},`,
185
+ priority: 0
186
+ }
187
+ }
188
+
189
+ const serviceMetas = servicesAvailable[ serviceConfig.id ];
190
+ if (serviceMetas === undefined)
191
+ throw new Error(`Service ${serviceConfig.id} not found. Referenced services: ${Object.keys(servicesAvailable).join('\n')}`);
192
+
193
+ const referencedName = referencedNames[serviceConfig.id];
194
+ if (referencedName !== undefined)
195
+ throw new Error(`Service ${serviceConfig.id} is already setup as ${referencedName}`);
179
196
 
180
197
  // Generate index & typings
181
- imported.push(`import type ${name} from "${importationPath}";`);
182
- exportedType.push(`'${id}': ${name},`);
183
- // NOTE: only import enabled packages to optimize memory
184
- // TODO: don't index non-setuped packages in the exported metas
185
- exportedMetas.push(`'${id}': {
186
- class: () => require("${importationPath}"),
187
- id: "${id}",
188
- name: "${name}",
189
- parent: "${parent}",
190
- dependences: ${JSON.stringify(dependences)},
191
- },`);
198
+ imported.push(`import ${serviceMetas.name} from "${serviceMetas.importationPath}";`);
199
+
200
+ if (serviceConfig.name !== undefined)
201
+ referencedNames[serviceConfig.id] = serviceConfig.name;
202
+
203
+ // Subservices
204
+ let subservices = '';
205
+ if (serviceConfig.subservices) {
206
+
207
+ const subservicesList = serviceConfig.subservices;
208
+ const subservicesCode = Object.entries(subservicesList).map(([name, service]) =>
209
+ refService(name, service, level + 1)
210
+ );
211
+
212
+ // Sort by priority
213
+ const sortedSubservices = subservicesCode.sort((a, b) => a.priority - b.priority);
214
+
215
+ // Generate code
216
+ subservices = sortedSubservices.map(s => s.code).join('\n');
217
+ }
218
+
219
+ // Generate the service instance
220
+ const instanciation = `new ${serviceMetas.name}(
221
+ this,
222
+ ${serialize(serviceConfig.config || {}) || '{}'},
223
+ () => ({
224
+ ${subservices}
225
+ }),
226
+ this
227
+ )`
228
+
229
+ if (level === 0)
230
+ return {
231
+ name: serviceName,
232
+ code: `public ${serviceName} = ${instanciation};`,
233
+ priority: serviceConfig.config?.priority || 0
234
+ };
235
+ else
236
+ return {
237
+ name: serviceName,
238
+ code: `${serviceName}: ${instanciation},`,
239
+ priority: serviceConfig.config?.priority || 0
240
+ };
192
241
  }
193
242
 
243
+ const servicesCode = Object.values(app.registered).map( s => refService(s.name, s, 0));
244
+ const sortedServices = servicesCode.sort((a, b) => a.priority - b.priority);
245
+
246
+ const services = sortedServices.map(s => s.code).join('\n');
247
+ const servicesNames = sortedServices.map(s => s.name);
248
+
194
249
  // Define the app class identifier
195
250
  const appClassIdentifier = app.identity.identifier;
196
251
  const containerServices = app.containerServices.map( s => "'" + s + "'").join('|');
@@ -200,30 +255,70 @@ dependences: ${JSON.stringify(dependences)},
200
255
  path.join( app.paths.client.generated, 'services.d.ts'),
201
256
  `declare module "@app" {
202
257
 
203
- import { ${appClassIdentifier} } from '@/client/index';
258
+ import { RouenEvents as RouenEventsClient } from "@/client";
259
+ import RouenEventsServer from "@/server/.generated/app";
260
+
261
+ import { ApplicationProperties as ClientApplicationProperties } from "@client/app";
262
+ import { ApplicationProperties as ServerApplicationProperties } from "@server/app";
263
+
264
+ type ClientServices = Omit<RouenEventsClient, ClientApplicationProperties>;
265
+ type ServerServices = Omit<RouenEventsServer, ServerApplicationProperties | keyof ClientServices>;
266
+
267
+ type CombinedServices = ClientServices & ServerServices;
268
+
269
+ const appClass: CombinedServices;
270
+ export = appClass;
271
+ }
204
272
 
205
- const appClass: ${appClassIdentifier};
206
273
 
207
- export = appClass
208
- }`
274
+ // Temporary
275
+ /*declare module '@models' {
276
+ export * from '@/var/prisma/index';
277
+ }*/
278
+
279
+ declare module '@models' {
280
+ import { Prisma, PrismaClient } from '@/var/prisma/index';
281
+
282
+ type ModelNames = Prisma.ModelName;
283
+
284
+ type ModelDelegates = {
285
+ [K in ModelNames]: PrismaClient[Uncapitalize<K>];
286
+ };
287
+
288
+ const models: ModelDelegates;
289
+
290
+ export = models;
291
+ }
292
+ `
209
293
  );
210
294
 
211
295
  fs.outputFileSync(
212
- path.join( app.paths.server.generated, 'services.ts'),
213
- `${imported.join('\n')}
214
- export type Services = {
215
- ${exportedType.join('\n')}
296
+ path.join( app.paths.server.generated, 'app.ts'),
297
+ `import { Application } from '@server/app/index';
298
+
299
+ ${imported.join('\n')}
300
+
301
+ export default class ${appClassIdentifier} extends Application {
302
+
303
+ protected serviceNames = [
304
+ ${Object.values(servicesNames).map(name => `"${name}"`).join(',\n')}
305
+ ] as const;
306
+
307
+ protected servicesIdToName = {
308
+ ${Object.entries(referencedNames).map(([id, name]) => `"${id}": "${name}"`).join(',\n')}
309
+ } as const;
310
+
311
+ ${services}
216
312
  }
217
- export default {
218
- ${exportedMetas.join('\n')}
219
- }`
220
- );
313
+
314
+
315
+ `);
221
316
 
222
317
  fs.outputFileSync(
223
318
  path.join( app.paths.server.generated, 'services.d.ts'),
224
319
  `type InstalledServices = import('./services').Services;
225
320
 
226
- declare type ${appClassIdentifier} = import("@/server").default;
321
+ declare type ${appClassIdentifier} = import("@/server/.generated/app").default;
227
322
 
228
323
  declare module "@app" {
229
324
 
@@ -243,7 +338,8 @@ declare module "@app" {
243
338
 
244
339
  declare module '@server/app' {
245
340
 
246
- import { Application } from "@server/app/index";
341
+ import { Application } from "@server/app";
342
+ import { Environment } from "@server/app";
247
343
  import { ServicesContainer } from "@server/app/service/container";
248
344
 
249
345
  abstract class ApplicationWithServices extends Application<
@@ -252,18 +348,34 @@ declare module '@server/app' {
252
348
 
253
349
  export interface Exported {
254
350
  Application: typeof ApplicationWithServices,
255
- Services: ServicesContainer<InstalledServices>,
351
+ Environment: Environment,
256
352
  }
257
353
 
258
354
  const foo: Exported;
259
355
 
260
356
  export = foo;
357
+ }
358
+
359
+ declare module '@models' {
360
+ import { Prisma, PrismaClient } from '@/var/prisma/index';
361
+
362
+ type ModelNames = Prisma.ModelName;
363
+
364
+ type ModelDelegates = {
365
+ [K in ModelNames]: PrismaClient[Uncapitalize<K>];
366
+ };
367
+
368
+ const models: ModelDelegates;
369
+
370
+ export = models;
261
371
  }`
262
372
  );
263
373
  }
264
374
 
265
375
  public async create() {
266
376
 
377
+ await app.warmup();
378
+
267
379
  this.cleanup();
268
380
 
269
381
  this.fixNpmLinkIssues();
@@ -17,7 +17,7 @@ import createCommonConfig, { TCompileMode, regex } from '../common';
17
17
  // Type
18
18
  import type App from '../../app';
19
19
 
20
- const getCorePluginsList = (app: App,) => {
20
+ /*const getCorePluginsList = (app: App,) => {
21
21
 
22
22
  const corePlugins: string[] = [];
23
23
 
@@ -32,7 +32,7 @@ const getCorePluginsList = (app: App,) => {
32
32
  corePlugins.push(cli.paths.core.root + '/node_modules/' + moduleName + '/src');
33
33
 
34
34
  return corePlugins;
35
- }
35
+ }*/
36
36
 
37
37
  const debug = false;
38
38
 
@@ -63,7 +63,7 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
63
63
  target: 'node',
64
64
  entry: {
65
65
  server: [
66
- cli.paths.coreRoot + '/src/server/index.ts'
66
+ cli.paths.coreRoot + '/server/index.ts'
67
67
  ],
68
68
  },
69
69
 
@@ -106,7 +106,9 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
106
106
  request.startsWith('5htp-')
107
107
  ||
108
108
  // Compile 5HTP modules
109
- request.startsWith('@mantine/')
109
+ request.startsWith('@mantine/') ||
110
+ request.startsWith('react-number-format') ||
111
+ request.startsWith('@floating-ui')
110
112
  )
111
113
 
112
114
  //console.log('isNodeModule', request, isNodeModule);
@@ -128,7 +130,7 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
128
130
 
129
131
  alias: aliases,
130
132
 
131
- extensions: ['.ts', '.tsx', ".json", ".sql"],
133
+ extensions: ['.ts', '.tsx', ".json", ".sql", ".js"],
132
134
  },
133
135
 
134
136
  module: {
@@ -140,15 +142,15 @@ export default function createCompiler( app: App, mode: TCompileMode ): webpack.
140
142
  test: regex.scripts,
141
143
  include: [
142
144
 
143
- app.paths.root + '/src/client',
144
- cli.paths.core.root + '/src/client',
145
+ app.paths.root + '/client',
146
+ cli.paths.core.root + '/client',
145
147
 
146
- app.paths.root + '/src/common',
147
- cli.paths.core.root + '/src/common',
148
+ app.paths.root + '/common',
149
+ cli.paths.core.root + '/common',
148
150
 
149
151
  // Dossiers server uniquement pour le bundle server
150
- app.paths.root + '/src/server',
151
- cli.paths.core.root + '/src/server',
152
+ app.paths.root + '/server',
153
+ cli.paths.core.root + '/server',
152
154
 
153
155
  // Complle 5HTP modules so they can refer to the framework instance and aliases
154
156
  // Temp disabled because compile issue on vercel