silgi 0.20.21 → 0.20.22
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 +42 -69
- 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
|
@@ -872,64 +872,56 @@ ${injectedResult.code}`;
|
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
874
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
{ name: "createShared", key: "createShared" }
|
|
881
|
-
],
|
|
882
|
-
from: "silgi"
|
|
883
|
-
},
|
|
884
|
-
"silgi/types": {
|
|
885
|
-
import: [
|
|
886
|
-
{ name: "SilgiRuntimeOptions", type: true, key: "SilgiRuntimeOptions" },
|
|
887
|
-
{ name: "FrameworkContext", type: true, key: "FrameworkContext" }
|
|
888
|
-
],
|
|
889
|
-
from: "silgi/types"
|
|
890
|
-
},
|
|
891
|
-
"#silgi/vfs": {
|
|
892
|
-
import: [],
|
|
893
|
-
from: "./vfs"
|
|
894
|
-
},
|
|
895
|
-
"configs.ts": {
|
|
896
|
-
import: [
|
|
897
|
-
{
|
|
898
|
-
name: "cliConfigs",
|
|
899
|
-
type: false,
|
|
900
|
-
key: "cliConfigs"
|
|
901
|
-
}
|
|
902
|
-
],
|
|
903
|
-
from: "./configs.ts"
|
|
904
|
-
}
|
|
905
|
-
};
|
|
906
|
-
const scanned = {
|
|
907
|
-
uris: {},
|
|
908
|
-
services: [],
|
|
909
|
-
shareds: [
|
|
910
|
-
`createShared({
|
|
911
|
-
modulesURIs,
|
|
912
|
-
})`
|
|
875
|
+
const importItems = {
|
|
876
|
+
"silgi": {
|
|
877
|
+
import: [
|
|
878
|
+
{ name: "createSilgi", key: "createSilgi" },
|
|
879
|
+
{ name: "createShared", key: "createShared" }
|
|
913
880
|
],
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
881
|
+
from: "silgi"
|
|
882
|
+
},
|
|
883
|
+
"silgi/types": {
|
|
884
|
+
import: [
|
|
885
|
+
{ name: "SilgiRuntimeOptions", type: true, key: "SilgiRuntimeOptions" },
|
|
886
|
+
{ name: "FrameworkContext", type: true, key: "FrameworkContext" }
|
|
887
|
+
],
|
|
888
|
+
from: "silgi/types"
|
|
889
|
+
},
|
|
890
|
+
"#silgi/vfs": {
|
|
891
|
+
import: [],
|
|
892
|
+
from: "./vfs"
|
|
893
|
+
},
|
|
894
|
+
"configs.ts": {
|
|
895
|
+
import: [
|
|
896
|
+
{
|
|
897
|
+
name: "cliConfigs",
|
|
898
|
+
type: false,
|
|
899
|
+
key: "cliConfigs"
|
|
900
|
+
}
|
|
901
|
+
],
|
|
902
|
+
from: "./configs.ts"
|
|
925
903
|
}
|
|
904
|
+
};
|
|
905
|
+
const scanned = {
|
|
906
|
+
uris: {},
|
|
907
|
+
services: [],
|
|
908
|
+
shareds: [
|
|
909
|
+
`createShared({
|
|
910
|
+
modulesURIs,
|
|
911
|
+
})`
|
|
912
|
+
],
|
|
913
|
+
schemas: [],
|
|
914
|
+
modulesURIs: {},
|
|
915
|
+
customImports: [],
|
|
916
|
+
importItems
|
|
917
|
+
};
|
|
918
|
+
async function prepareServerFiles(silgi) {
|
|
926
919
|
if (silgi.uris) {
|
|
927
920
|
defu$1(scanned.uris, silgi.uris);
|
|
928
921
|
}
|
|
929
922
|
if (silgi.modulesURIs) {
|
|
930
923
|
defu$1(scanned.modulesURIs, silgi.modulesURIs);
|
|
931
924
|
}
|
|
932
|
-
reset();
|
|
933
925
|
await silgi.callHook("prepare:scan.ts", scanned);
|
|
934
926
|
if (importItems["#silgi/vfs"].import.length === 0) {
|
|
935
927
|
delete importItems["#silgi/vfs"];
|
|
@@ -943,12 +935,6 @@ async function prepareServerFiles(silgi) {
|
|
|
943
935
|
if (scanned.schemas.length > 0) {
|
|
944
936
|
importItems.silgi.import.push({ name: "mergeSchemas", key: "mergeSchemas" });
|
|
945
937
|
}
|
|
946
|
-
for (const key in importItems) {
|
|
947
|
-
importItems[key].import = deduplicateImportsByKey(importItems[key].import);
|
|
948
|
-
}
|
|
949
|
-
scanned.services = deduplicateArray(scanned.services);
|
|
950
|
-
scanned.schemas = deduplicateArray(scanned.schemas);
|
|
951
|
-
scanned.shareds = deduplicateArray(scanned.shareds);
|
|
952
938
|
const importsContent = [
|
|
953
939
|
...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
|
|
954
940
|
if (silgi.options.typescript.removeFileExtension) {
|
|
@@ -988,19 +974,6 @@ async function prepareServerFiles(silgi) {
|
|
|
988
974
|
importData.unshift(...importsContent);
|
|
989
975
|
return importData;
|
|
990
976
|
}
|
|
991
|
-
function deduplicateImportsByKey(imports) {
|
|
992
|
-
const seenKeys = /* @__PURE__ */ new Map();
|
|
993
|
-
return imports.filter((item) => {
|
|
994
|
-
if (seenKeys.has(item.key)) {
|
|
995
|
-
return false;
|
|
996
|
-
}
|
|
997
|
-
seenKeys.set(item.key, true);
|
|
998
|
-
return true;
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
function deduplicateArray(array) {
|
|
1002
|
-
return [...new Set(array)];
|
|
1003
|
-
}
|
|
1004
977
|
|
|
1005
978
|
async function writeScanFiles(silgi) {
|
|
1006
979
|
const data = await prepareServerFiles(silgi);
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED