silgi 0.8.30 → 0.8.32

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.8.30";
1
+ const version = "0.8.32";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.2.0",
4
4
  "@fastify/deepmerge": "^2.0.2",
@@ -35,6 +35,14 @@ import 'std-env';
35
35
  import 'consola/utils';
36
36
  import 'escape-string-regexp';
37
37
 
38
+ async function emptyFramework(silgi) {
39
+ if (silgi.options.preset === "npm-package" || !silgi.options.preset) {
40
+ silgi.hook("after:prepare:schema.ts", (data) => {
41
+ data.unshift("type FrameworkContextExtends = {}");
42
+ });
43
+ }
44
+ }
45
+
38
46
  async function h3Framework(silgi, skip = false) {
39
47
  if (silgi.options.preset !== "h3" && skip === false)
40
48
  return;
@@ -128,7 +136,7 @@ async function nuxtFramework(silgi, skip = false) {
128
136
  await nitroFramework(silgi, true);
129
137
  }
130
138
 
131
- const frameworkSetup = [h3Framework, nitroFramework, nuxtFramework];
139
+ const frameworkSetup = [emptyFramework, h3Framework, nitroFramework, nuxtFramework];
132
140
 
133
141
  async function prepare$1(_silgi) {
134
142
  }
@@ -1161,9 +1169,6 @@ function topologicalSort(graphData) {
1161
1169
  logger$1.debug(`Adding initial module: ${node} (no dependencies)`);
1162
1170
  }
1163
1171
  }
1164
- if (queue.length === 0) {
1165
- logger$1.warn("No modules without dependencies found - possible circular reference");
1166
- }
1167
1172
  while (queue.length > 0) {
1168
1173
  const node = queue.shift();
1169
1174
  order.push(node);
@@ -1408,8 +1413,10 @@ async function scanFiles$1(silgi) {
1408
1413
  if (createServices.length > 0) {
1409
1414
  for (const createService of createServices) {
1410
1415
  const { exportName, path } = createService;
1416
+ const randomString = hash(basename(path) + exportName);
1417
+ const _name = `_v${randomString}`;
1411
1418
  silgi.hook("prepare:core.ts", (options) => {
1412
- options.services.push(exportName);
1419
+ options.services.push(_name);
1413
1420
  });
1414
1421
  silgi.hook("prepare:core.ts", (options) => {
1415
1422
  options.importItems[path] ??= {
@@ -1417,7 +1424,7 @@ async function scanFiles$1(silgi) {
1417
1424
  from: relativeWithDot(silgi.options.silgi.serverDir, path)
1418
1425
  };
1419
1426
  options.importItems[path].import.push({
1420
- name: exportName
1427
+ name: `${exportName} as ${_name}`
1421
1428
  });
1422
1429
  });
1423
1430
  }
@@ -1426,8 +1433,10 @@ async function scanFiles$1(silgi) {
1426
1433
  if (createSchemas.length > 0) {
1427
1434
  for (const createSchema of createSchemas) {
1428
1435
  const { exportName, path } = createSchema;
1436
+ const randomString = hash(basename(path) + exportName);
1437
+ const _name = `_v${randomString}`;
1429
1438
  silgi.hook("prepare:core.ts", (options) => {
1430
- options.schemas.push(exportName);
1439
+ options.schemas.push(_name);
1431
1440
  });
1432
1441
  silgi.hook("prepare:core.ts", (options) => {
1433
1442
  options.importItems[path] ??= {
@@ -1435,7 +1444,7 @@ async function scanFiles$1(silgi) {
1435
1444
  from: relativeWithDot(silgi.options.silgi.serverDir, path)
1436
1445
  };
1437
1446
  options.importItems[path].import.push({
1438
- name: exportName
1447
+ name: `${exportName} as ${_name}`
1439
1448
  });
1440
1449
  });
1441
1450
  }
@@ -1444,8 +1453,10 @@ async function scanFiles$1(silgi) {
1444
1453
  if (createShareds.length > 0) {
1445
1454
  for (const createShared of createShareds) {
1446
1455
  const { exportName, path } = createShared;
1456
+ const randomString = hash(basename(path) + exportName);
1457
+ const _name = `_v${randomString}`;
1447
1458
  silgi.hook("prepare:core.ts", (options) => {
1448
- options.shareds.push(exportName);
1459
+ options.shareds.push(_name);
1449
1460
  });
1450
1461
  silgi.hook("prepare:core.ts", (options) => {
1451
1462
  options.importItems[path] ??= {
@@ -1454,7 +1465,7 @@ async function scanFiles$1(silgi) {
1454
1465
  from: relativeWithDot(silgi.options.silgi.serverDir, path)
1455
1466
  };
1456
1467
  options.importItems[path].import.push({
1457
- name: exportName
1468
+ name: `${exportName} as ${_name}`
1458
1469
  });
1459
1470
  });
1460
1471
  }
@@ -1463,10 +1474,12 @@ async function scanFiles$1(silgi) {
1463
1474
  if (sharedsTypes.length > 0) {
1464
1475
  for (const sharedType of sharedsTypes) {
1465
1476
  const { exportName, path } = sharedType;
1477
+ const randomString = hash(basename(path) + exportName);
1478
+ const _name = `_v${randomString}`;
1466
1479
  silgi.hook("prepare:schema.ts", (options) => {
1467
1480
  options.shareds.push({
1468
- key: exportName,
1469
- value: exportName
1481
+ key: _name,
1482
+ value: _name
1470
1483
  });
1471
1484
  });
1472
1485
  silgi.hook("prepare:schema.ts", (options) => {
@@ -1475,7 +1488,7 @@ async function scanFiles$1(silgi) {
1475
1488
  from: path
1476
1489
  };
1477
1490
  options.importItems[path].import.push({
1478
- name: exportName,
1491
+ name: `${exportName} as ${_name}`,
1479
1492
  type: true
1480
1493
  });
1481
1494
  });
@@ -1485,10 +1498,12 @@ async function scanFiles$1(silgi) {
1485
1498
  if (contextTypes.length > 0) {
1486
1499
  for (const contextType of contextTypes) {
1487
1500
  const { exportName, path } = contextType;
1501
+ const randomString = hash(basename(path) + exportName);
1502
+ const _name = `_v${randomString}`;
1488
1503
  silgi.hook("prepare:schema.ts", (options) => {
1489
1504
  options.contexts.push({
1490
- key: exportName,
1491
- value: exportName
1505
+ key: _name,
1506
+ value: _name
1492
1507
  });
1493
1508
  });
1494
1509
  silgi.hook("prepare:schema.ts", (options) => {
@@ -1497,7 +1512,7 @@ async function scanFiles$1(silgi) {
1497
1512
  from: path
1498
1513
  };
1499
1514
  options.importItems[path].import.push({
1500
- name: exportName,
1515
+ name: `${exportName} as ${_name}`,
1501
1516
  type: true
1502
1517
  });
1503
1518
  });
@@ -1,4 +1,4 @@
1
- const version = "0.8.30";
1
+ const version = "0.8.32";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.2.0",
4
4
  "@fastify/deepmerge": "^2.0.2",
@@ -1,4 +1,4 @@
1
- const version = "0.8.30";
1
+ const version = "0.8.32";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.2.0",
4
4
  "@fastify/deepmerge": "^2.0.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.8.30",
4
+ "version": "0.8.32",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {