silgi 0.20.29 → 0.20.31
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.
- package/dist/_chunks/index.mjs +1 -1
- package/dist/cli/common.mjs +57 -92
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/common.mjs
CHANGED
|
@@ -923,10 +923,6 @@ async function prepareServerFiles(silgi) {
|
|
|
923
923
|
defu$1(scanned.modulesURIs, silgi.modulesURIs);
|
|
924
924
|
}
|
|
925
925
|
await silgi.callHook("prepare:scan.ts", scanned);
|
|
926
|
-
scanned.services = [...new Set(scanned.services)];
|
|
927
|
-
scanned.shareds = [...new Set(scanned.shareds)];
|
|
928
|
-
scanned.schemas = [...new Set(scanned.schemas)];
|
|
929
|
-
scanned.customImports = [...new Set(scanned.customImports)];
|
|
930
926
|
if (importItems["#silgi/vfs"].import.length === 0) {
|
|
931
927
|
delete importItems["#silgi/vfs"];
|
|
932
928
|
}
|
|
@@ -1243,136 +1239,109 @@ async function scanFiles$1(silgi, watchFiles) {
|
|
|
1243
1239
|
if (hasError("Parser", silgi)) {
|
|
1244
1240
|
return;
|
|
1245
1241
|
}
|
|
1242
|
+
const scanTS = [];
|
|
1243
|
+
const schemaTS = [];
|
|
1246
1244
|
if (createServices.length > 0) {
|
|
1247
|
-
|
|
1248
|
-
const { exportName, path } = createService;
|
|
1245
|
+
scanTS.push(...createServices.map(({ exportName, path }) => {
|
|
1249
1246
|
silgi.options.devServer.watch.push(path);
|
|
1250
1247
|
const randomString = hash(basename(path) + exportName);
|
|
1251
1248
|
const _name = `_v${randomString}`;
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
});
|
|
1255
|
-
silgi.hook("prepare:scan.ts", (options) => {
|
|
1256
|
-
options.importItems[path] ??= {
|
|
1257
|
-
import: [],
|
|
1258
|
-
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1259
|
-
};
|
|
1260
|
-
options.importItems[path].import.push({
|
|
1261
|
-
name: `${exportName} as ${_name}`,
|
|
1262
|
-
key: _name
|
|
1263
|
-
});
|
|
1264
|
-
});
|
|
1265
|
-
}
|
|
1249
|
+
return { exportName, path, _name, type: "service" };
|
|
1250
|
+
}));
|
|
1266
1251
|
}
|
|
1267
1252
|
const createSchemas = exportVariables("createSchema", filePath);
|
|
1268
1253
|
if (hasError("Parser", silgi)) {
|
|
1269
1254
|
return;
|
|
1270
1255
|
}
|
|
1271
1256
|
if (createSchemas.length > 0) {
|
|
1272
|
-
|
|
1273
|
-
const { exportName, path } = createSchema;
|
|
1257
|
+
scanTS.push(...createSchemas.map(({ exportName, path }) => {
|
|
1274
1258
|
silgi.options.devServer.watch.push(path);
|
|
1275
1259
|
const randomString = hash(basename(path) + exportName);
|
|
1276
1260
|
const _name = `_v${randomString}`;
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
});
|
|
1280
|
-
silgi.hook("prepare:scan.ts", (options) => {
|
|
1281
|
-
options.importItems[path] ??= {
|
|
1282
|
-
import: [],
|
|
1283
|
-
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1284
|
-
};
|
|
1285
|
-
options.importItems[path].import.push({
|
|
1286
|
-
name: `${exportName} as ${_name}`,
|
|
1287
|
-
key: _name
|
|
1288
|
-
});
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1261
|
+
return { exportName, path, _name, type: "schema" };
|
|
1262
|
+
}));
|
|
1291
1263
|
}
|
|
1292
1264
|
const createShareds = exportVariables("createShared", filePath);
|
|
1293
1265
|
if (hasError("Parser", silgi)) {
|
|
1294
1266
|
return;
|
|
1295
1267
|
}
|
|
1296
1268
|
if (createShareds.length > 0) {
|
|
1297
|
-
|
|
1298
|
-
const { exportName, path } = createShared;
|
|
1269
|
+
scanTS.push(...createShareds.map(({ exportName, path }) => {
|
|
1299
1270
|
silgi.options.devServer.watch.push(path);
|
|
1300
1271
|
const randomString = hash(basename(path) + exportName);
|
|
1301
1272
|
const _name = `_v${randomString}`;
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
});
|
|
1305
|
-
silgi.hook("prepare:scan.ts", (options) => {
|
|
1306
|
-
options.importItems[path] ??= {
|
|
1307
|
-
import: [],
|
|
1308
|
-
// Relative path kaldirmamiz gerekiyor bunlar hooklarin bittigi yerde karar verilmeli.
|
|
1309
|
-
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1310
|
-
};
|
|
1311
|
-
options.importItems[path].import.push({
|
|
1312
|
-
name: `${exportName} as ${_name}`,
|
|
1313
|
-
key: _name
|
|
1314
|
-
});
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1273
|
+
return { exportName, path, _name, type: "shared" };
|
|
1274
|
+
}));
|
|
1317
1275
|
}
|
|
1318
1276
|
const sharedsTypes = parseInterfaceDeclarations("ExtendShared", filePath);
|
|
1319
1277
|
if (hasError("Parser", silgi)) {
|
|
1320
1278
|
return;
|
|
1321
1279
|
}
|
|
1322
1280
|
if (sharedsTypes.length > 0) {
|
|
1323
|
-
|
|
1324
|
-
const { exportName, path } = sharedType;
|
|
1281
|
+
schemaTS.push(...sharedsTypes.map(({ exportName, path }) => {
|
|
1325
1282
|
silgi.options.devServer.watch.push(path);
|
|
1326
1283
|
const randomString = hash(basename(path) + exportName);
|
|
1327
1284
|
const _name = `_v${randomString}`;
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
key: _name,
|
|
1331
|
-
value: _name
|
|
1332
|
-
});
|
|
1333
|
-
});
|
|
1334
|
-
silgi.hook("prepare:schema.ts", (options) => {
|
|
1335
|
-
options.importItems[path] ??= {
|
|
1336
|
-
import: [],
|
|
1337
|
-
from: path
|
|
1338
|
-
};
|
|
1339
|
-
options.importItems[path].import.push({
|
|
1340
|
-
name: `${exportName} as ${_name}`,
|
|
1341
|
-
type: true,
|
|
1342
|
-
key: _name
|
|
1343
|
-
});
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1285
|
+
return { exportName, path, _name, type: "shared" };
|
|
1286
|
+
}));
|
|
1346
1287
|
}
|
|
1347
1288
|
const contextTypes = parseInterfaceDeclarations("ExtendContext", filePath);
|
|
1348
1289
|
if (hasError("Parser", silgi)) {
|
|
1349
1290
|
return;
|
|
1350
1291
|
}
|
|
1351
1292
|
if (contextTypes.length > 0) {
|
|
1352
|
-
|
|
1353
|
-
const { exportName, path } = contextType;
|
|
1293
|
+
schemaTS.push(...contextTypes.map(({ exportName, path }) => {
|
|
1354
1294
|
silgi.options.devServer.watch.push(path);
|
|
1355
1295
|
const randomString = hash(basename(path) + exportName);
|
|
1356
1296
|
const _name = `_v${randomString}`;
|
|
1357
|
-
|
|
1358
|
-
|
|
1297
|
+
return { exportName, path, _name, type: "context" };
|
|
1298
|
+
}));
|
|
1299
|
+
}
|
|
1300
|
+
silgi.hook("prepare:scan.ts", (options) => {
|
|
1301
|
+
for (const { exportName, path, _name, type } of scanTS) {
|
|
1302
|
+
if (type === "service") {
|
|
1303
|
+
options.services.push(_name);
|
|
1304
|
+
}
|
|
1305
|
+
if (type === "shared") {
|
|
1306
|
+
options.shareds.push(_name);
|
|
1307
|
+
}
|
|
1308
|
+
if (type === "schema") {
|
|
1309
|
+
options.schemas.push(_name);
|
|
1310
|
+
}
|
|
1311
|
+
options.importItems[path] ??= {
|
|
1312
|
+
import: [],
|
|
1313
|
+
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1314
|
+
};
|
|
1315
|
+
options.importItems[path].import.push({
|
|
1316
|
+
name: `${exportName} as ${_name}`,
|
|
1317
|
+
key: _name
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
});
|
|
1321
|
+
silgi.hook("prepare:schema.ts", (options) => {
|
|
1322
|
+
for (const { exportName, path, _name, type } of schemaTS) {
|
|
1323
|
+
if (type === "shared") {
|
|
1324
|
+
options.shareds.push({
|
|
1359
1325
|
key: _name,
|
|
1360
1326
|
value: _name
|
|
1361
1327
|
});
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
options.
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
};
|
|
1368
|
-
options.importItems[path].import.push({
|
|
1369
|
-
name: `${exportName} as ${_name}`,
|
|
1370
|
-
type: true,
|
|
1371
|
-
key: _name
|
|
1328
|
+
}
|
|
1329
|
+
if (type === "context") {
|
|
1330
|
+
options.contexts.push({
|
|
1331
|
+
key: _name,
|
|
1332
|
+
value: _name
|
|
1372
1333
|
});
|
|
1334
|
+
}
|
|
1335
|
+
options.importItems[path] ??= {
|
|
1336
|
+
import: [],
|
|
1337
|
+
from: relativeWithDot(silgi.options.silgi.serverDir, path)
|
|
1338
|
+
};
|
|
1339
|
+
options.importItems[path].import.push({
|
|
1340
|
+
name: `${exportName} as ${_name}`,
|
|
1341
|
+
key: _name
|
|
1373
1342
|
});
|
|
1374
1343
|
}
|
|
1375
|
-
}
|
|
1344
|
+
});
|
|
1376
1345
|
}
|
|
1377
1346
|
}
|
|
1378
1347
|
}
|
|
@@ -1611,10 +1580,6 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1611
1580
|
},
|
|
1612
1581
|
routeRules: void 0
|
|
1613
1582
|
};
|
|
1614
|
-
silgi.hook("prepare:scan.ts", (options2) => {
|
|
1615
|
-
options2.services = [];
|
|
1616
|
-
options2.importItems = options2.importItems || {};
|
|
1617
|
-
});
|
|
1618
1583
|
const routeRules = createRouteRules();
|
|
1619
1584
|
routeRules.importRules(options.routeRules ?? {});
|
|
1620
1585
|
silgi.routeRules = routeRules;
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED