silgi 0.20.27 → 0.20.28

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.
@@ -1,4 +1,4 @@
1
- const version = "0.20.27";
1
+ const version = "0.20.28";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -342,125 +342,147 @@ async function nuxtFramework(silgi, skip = false) {
342
342
  const frameworkSetup = [emptyFramework, h3Framework, nitroFramework, nuxtFramework];
343
343
 
344
344
  async function registerModuleExportScan(silgi) {
345
- silgi.hook("prepare:schema.ts", async (options) => {
346
- for (const module of silgi.scanModules) {
347
- const moduleReExports = [];
348
- const moduleTypes = await promises.readFile(module.entryPath.replace(/\.mjs$/, "Types.d.ts"), "utf8").catch(() => "");
349
- const normalisedModuleTypes = moduleTypes.replace(/export\s*\{.*?\}/gs, (match) => match.replace(/\b(type|interface)\b/g, ""));
350
- for (const e of findTypeExports(normalisedModuleTypes)) {
351
- moduleReExports.push(e);
352
- }
353
- for (const e of findExports(normalisedModuleTypes)) {
354
- moduleReExports.push(e);
355
- }
356
- const hasTypeExport = (name) => moduleReExports.find((exp) => exp.names?.includes(name));
357
- const configKey = module.meta.configKey;
358
- const moduleName = module.meta.name || module.meta._packageName;
345
+ for (const module of silgi.scanModules) {
346
+ const moduleReExports = [];
347
+ const moduleTypes = await promises.readFile(module.entryPath.replace(/\.mjs$/, "Types.d.ts"), "utf8").catch(() => "");
348
+ const normalisedModuleTypes = moduleTypes.replace(/export\s*\{.*?\}/gs, (match) => match.replace(/\b(type|interface)\b/g, ""));
349
+ for (const e of findTypeExports(normalisedModuleTypes)) {
350
+ moduleReExports.push(e);
351
+ }
352
+ for (const e of findExports(normalisedModuleTypes)) {
353
+ moduleReExports.push(e);
354
+ }
355
+ const hasTypeExport = (name) => moduleReExports.find((exp) => exp.names?.includes(name));
356
+ const configKey = module.meta.configKey;
357
+ const moduleName = module.meta.name || module.meta._packageName;
358
+ silgi.hook("prepare:schema.ts", async (options) => {
359
359
  options.importItems[configKey] = {
360
360
  import: [],
361
361
  from: module.meta._packageName ? moduleName : relativeWithDot(silgi.options.build.typesDir, module.entryPath)
362
362
  };
363
- if (hasTypeExport("ModuleOptions")) {
364
- const importName = `_${hash(`${configKey}ModuleOptions`)}`;
363
+ });
364
+ if (hasTypeExport("ModuleOptions")) {
365
+ const importName = `_${hash(`${configKey}ModuleOptions`)}`;
366
+ silgi.hook("prepare:schema.ts", async (options) => {
365
367
  options.importItems[configKey].import.push({
366
368
  name: `ModuleOptions as ${importName}`,
367
369
  type: true,
368
370
  key: importName
369
371
  });
370
372
  options.options.push({ key: configKey, value: importName });
371
- }
372
- if (hasTypeExport("ModuleRuntimeOptions")) {
373
- const importName = `_${hash(`${configKey}ModuleRuntimeOptions`)}`;
373
+ });
374
+ }
375
+ if (hasTypeExport("ModuleRuntimeOptions")) {
376
+ const importName = `_${hash(`${configKey}ModuleRuntimeOptions`)}`;
377
+ silgi.hook("prepare:schema.ts", async (options) => {
374
378
  options.importItems[configKey].import.push({
375
379
  name: `ModuleRuntimeOptions as ${importName}`,
376
380
  type: true,
377
381
  key: importName
378
382
  });
379
383
  options.runtimeOptions.push({ key: configKey, value: importName });
380
- }
381
- if (hasTypeExport("ModuleRuntimeShareds")) {
382
- const importName = `_${hash(`${configKey}ModuleRuntimeShareds`)}`;
384
+ });
385
+ }
386
+ if (hasTypeExport("ModuleRuntimeShareds")) {
387
+ const importName = `_${hash(`${configKey}ModuleRuntimeShareds`)}`;
388
+ silgi.hook("prepare:schema.ts", async (options) => {
383
389
  options.importItems[configKey].import.push({
384
390
  name: `ModuleRuntimeShareds as ${importName}`,
385
391
  type: true,
386
392
  key: importName
387
393
  });
388
394
  options.shareds.push({ key: configKey, value: importName });
389
- }
390
- if (hasTypeExport("ModuleEvents")) {
391
- const importName = `_${hash(`${configKey}ModuleEvents`)}`;
395
+ });
396
+ }
397
+ if (hasTypeExport("ModuleEvents")) {
398
+ const importName = `_${hash(`${configKey}ModuleEvents`)}`;
399
+ silgi.hook("prepare:schema.ts", async (options) => {
392
400
  options.importItems[configKey].import.push({
393
401
  name: `ModuleEvents as ${importName}`,
394
402
  type: true,
395
403
  key: importName
396
404
  });
397
405
  options.events.push({ key: configKey, value: importName });
398
- }
399
- if (hasTypeExport("ModuleRuntimeContexts")) {
400
- const importName = `_${hash(`${configKey}ModuleRuntimeContexts`)}`;
406
+ });
407
+ }
408
+ if (hasTypeExport("ModuleRuntimeContexts")) {
409
+ const importName = `_${hash(`${configKey}ModuleRuntimeContexts`)}`;
410
+ silgi.hook("prepare:schema.ts", async (options) => {
401
411
  options.importItems[configKey].import.push({
402
412
  name: `ModuleRuntimeContexts as ${importName}`,
403
413
  type: true,
404
414
  key: importName
405
415
  });
406
416
  options.contexts.push({ key: configKey, value: importName });
407
- }
408
- if (hasTypeExport("ModuleHooks")) {
409
- const importName = `_${hash(`${configKey}ModuleHooks`)}`;
417
+ });
418
+ }
419
+ if (hasTypeExport("ModuleHooks")) {
420
+ const importName = `_${hash(`${configKey}ModuleHooks`)}`;
421
+ silgi.hook("prepare:schema.ts", async (options) => {
410
422
  options.importItems[configKey].import.push({
411
423
  name: `ModuleHooks as ${importName}`,
412
424
  type: true,
413
425
  key: importName
414
426
  });
415
427
  options.hooks.push({ key: configKey, value: importName });
416
- }
417
- if (hasTypeExport("ModuleRuntimeHooks")) {
418
- const importName = `_${hash(`${configKey}RuntimeHooks`)}`;
428
+ });
429
+ }
430
+ if (hasTypeExport("ModuleRuntimeHooks")) {
431
+ const importName = `_${hash(`${configKey}RuntimeHooks`)}`;
432
+ silgi.hook("prepare:schema.ts", async (options) => {
419
433
  options.importItems[configKey].import.push({
420
434
  name: `ModuleRuntimeHooks as ${importName}`,
421
435
  type: true,
422
436
  key: importName
423
437
  });
424
438
  options.runtimeHooks.push({ key: configKey, value: importName });
425
- }
426
- if (hasTypeExport("ModuleRuntimeActions")) {
427
- const importName = `_${hash(`${configKey}ModuleRuntimeActions`)}`;
439
+ });
440
+ }
441
+ if (hasTypeExport("ModuleRuntimeActions")) {
442
+ const importName = `_${hash(`${configKey}ModuleRuntimeActions`)}`;
443
+ silgi.hook("prepare:schema.ts", async (options) => {
428
444
  options.importItems[configKey].import.push({
429
445
  name: `ModuleRuntimeActions as ${importName}`,
430
446
  type: true,
431
447
  key: importName
432
448
  });
433
449
  options.actions.push({ key: configKey, value: importName });
434
- }
435
- if (hasTypeExport("ModuleRuntimeMethods")) {
436
- const importName = `_${hash(`${configKey}ModuleRuntimeMethods`)}`;
450
+ });
451
+ }
452
+ if (hasTypeExport("ModuleRuntimeMethods")) {
453
+ const importName = `_${hash(`${configKey}ModuleRuntimeMethods`)}`;
454
+ silgi.hook("prepare:schema.ts", async (options) => {
437
455
  options.importItems[configKey].import.push({
438
456
  name: `ModuleRuntimeMethods as ${importName}`,
439
457
  type: true,
440
458
  key: importName
441
459
  });
442
460
  options.methods.push({ key: configKey, value: importName });
443
- }
444
- if (hasTypeExport("ModuleRuntimeRouteRules")) {
445
- const importName = `_${hash(`${configKey}ModuleRuntimeRouteRules`)}`;
461
+ });
462
+ }
463
+ if (hasTypeExport("ModuleRuntimeRouteRules")) {
464
+ const importName = `_${hash(`${configKey}ModuleRuntimeRouteRules`)}`;
465
+ silgi.hook("prepare:schema.ts", async (options) => {
446
466
  options.importItems[configKey].import.push({
447
467
  name: `ModuleRuntimeRouteRules as ${importName}`,
448
468
  type: true,
449
469
  key: importName
450
470
  });
451
471
  options.routeRules.push({ key: configKey, value: importName });
452
- }
453
- if (hasTypeExport("ModuleRuntimeRouteRulesConfig")) {
454
- const importName = `_${hash(`${configKey}ModuleRuntimeRouteRulesConfig`)}`;
472
+ });
473
+ }
474
+ if (hasTypeExport("ModuleRuntimeRouteRulesConfig")) {
475
+ const importName = `_${hash(`${configKey}ModuleRuntimeRouteRulesConfig`)}`;
476
+ silgi.hook("prepare:schema.ts", async (options) => {
455
477
  options.importItems[configKey].import.push({
456
478
  name: `ModuleRuntimeRouteRulesConfig as ${importName}`,
457
479
  type: true,
458
480
  key: importName
459
481
  });
460
482
  options.routeRulesConfig.push({ key: configKey, value: importName });
461
- }
483
+ });
462
484
  }
463
- });
485
+ }
464
486
  }
465
487
 
466
488
  async function loadSilgiModuleInstance(silgiModule) {
@@ -1,4 +1,4 @@
1
- const version = "0.20.27";
1
+ const version = "0.20.28";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,4 +1,4 @@
1
- const version = "0.20.27";
1
+ const version = "0.20.28";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^3.0.0",
4
4
  "@nuxt/kit": "^3.15.3",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.20.27",
4
+ "version": "0.20.28",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {