silgi 0.20.31 → 0.20.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.
- package/dist/_chunks/index.mjs +1 -1
- package/dist/cli/common.mjs +49 -24
- 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
|
@@ -1201,6 +1201,8 @@ class SchemaParser {
|
|
|
1201
1201
|
// }
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
|
+
const processedScanItems = /* @__PURE__ */ new Map();
|
|
1205
|
+
const processedSchemaItems = /* @__PURE__ */ new Map();
|
|
1204
1206
|
async function scanFiles$1(silgi, watchFiles) {
|
|
1205
1207
|
const isWatch = watchFiles && watchFiles.length > 0;
|
|
1206
1208
|
const filePaths = /* @__PURE__ */ new Set();
|
|
@@ -1220,6 +1222,13 @@ async function scanFiles$1(silgi, watchFiles) {
|
|
|
1220
1222
|
}
|
|
1221
1223
|
}
|
|
1222
1224
|
}
|
|
1225
|
+
if (isWatch && watchFiles) {
|
|
1226
|
+
for (const file of watchFiles) {
|
|
1227
|
+
const filePath = resolve(dir, file);
|
|
1228
|
+
processedScanItems.delete(filePath);
|
|
1229
|
+
processedSchemaItems.delete(filePath);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1223
1232
|
for (const _file of files) {
|
|
1224
1233
|
const filePath = resolve(dir, _file);
|
|
1225
1234
|
if (scannedPaths.find((d) => filePath.startsWith(withTrailingSlash(d))) || isIgnored(filePath, silgi)) {
|
|
@@ -1299,52 +1308,68 @@ async function scanFiles$1(silgi, watchFiles) {
|
|
|
1299
1308
|
}
|
|
1300
1309
|
silgi.hook("prepare:scan.ts", (options) => {
|
|
1301
1310
|
for (const { exportName, path, _name, type } of scanTS) {
|
|
1302
|
-
|
|
1303
|
-
|
|
1311
|
+
const itemKey = `${path}:${exportName}`;
|
|
1312
|
+
if (!processedScanItems.has(path)) {
|
|
1313
|
+
processedScanItems.set(path, /* @__PURE__ */ new Set());
|
|
1304
1314
|
}
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
1315
|
+
if (processedScanItems.get(path).has(itemKey)) {
|
|
1316
|
+
continue;
|
|
1307
1317
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1318
|
+
processedScanItems.get(path).add(itemKey);
|
|
1319
|
+
switch (type) {
|
|
1320
|
+
case "service":
|
|
1321
|
+
options.services.push(_name);
|
|
1322
|
+
break;
|
|
1323
|
+
case "shared":
|
|
1324
|
+
options.shareds.push(_name);
|
|
1325
|
+
break;
|
|
1326
|
+
case "schema":
|
|
1327
|
+
options.schemas.push(_name);
|
|
1328
|
+
break;
|
|
1310
1329
|
}
|
|
1311
|
-
options
|
|
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
|
-
});
|
|
1330
|
+
addImport(options, path, exportName, _name, silgi.options.silgi.serverDir);
|
|
1319
1331
|
}
|
|
1320
1332
|
});
|
|
1321
1333
|
silgi.hook("prepare:schema.ts", (options) => {
|
|
1322
1334
|
for (const { exportName, path, _name, type } of schemaTS) {
|
|
1335
|
+
const itemKey = `${path}:${exportName}`;
|
|
1336
|
+
if (!processedSchemaItems.has(path)) {
|
|
1337
|
+
processedSchemaItems.set(path, /* @__PURE__ */ new Set());
|
|
1338
|
+
}
|
|
1339
|
+
if (processedSchemaItems.get(path).has(itemKey)) {
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
processedSchemaItems.get(path).add(itemKey);
|
|
1323
1343
|
if (type === "shared") {
|
|
1324
1344
|
options.shareds.push({
|
|
1325
1345
|
key: _name,
|
|
1326
1346
|
value: _name
|
|
1327
1347
|
});
|
|
1328
|
-
}
|
|
1329
|
-
if (type === "context") {
|
|
1348
|
+
} else if (type === "context") {
|
|
1330
1349
|
options.contexts.push({
|
|
1331
1350
|
key: _name,
|
|
1332
1351
|
value: _name
|
|
1333
1352
|
});
|
|
1334
1353
|
}
|
|
1335
|
-
options
|
|
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
|
|
1342
|
-
});
|
|
1354
|
+
addImport(options, path, exportName, _name, silgi.options.silgi.serverDir);
|
|
1343
1355
|
}
|
|
1344
1356
|
});
|
|
1345
1357
|
}
|
|
1346
1358
|
}
|
|
1347
1359
|
}
|
|
1360
|
+
function addImport(options, path, exportName, _name, serverDir) {
|
|
1361
|
+
const existingItem = options.importItems[path]?.import.find((item) => item.key === _name);
|
|
1362
|
+
if (existingItem)
|
|
1363
|
+
return;
|
|
1364
|
+
options.importItems[path] ??= {
|
|
1365
|
+
import: [],
|
|
1366
|
+
from: relativeWithDot(serverDir, path)
|
|
1367
|
+
};
|
|
1368
|
+
options.importItems[path].import.push({
|
|
1369
|
+
name: `${exportName} as ${_name}`,
|
|
1370
|
+
key: _name
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1348
1373
|
|
|
1349
1374
|
async function createStorageCLI(silgi) {
|
|
1350
1375
|
const storage = createStorage();
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED