silgi 0.20.20 → 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 +63 -62
- 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,50 +872,50 @@ ${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
|
-
|
|
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"
|
|
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) {
|
|
919
919
|
if (silgi.uris) {
|
|
920
920
|
defu$1(scanned.uris, silgi.uris);
|
|
921
921
|
}
|
|
@@ -935,12 +935,6 @@ async function prepareServerFiles(silgi) {
|
|
|
935
935
|
if (scanned.schemas.length > 0) {
|
|
936
936
|
importItems.silgi.import.push({ name: "mergeSchemas", key: "mergeSchemas" });
|
|
937
937
|
}
|
|
938
|
-
for (const key in importItems) {
|
|
939
|
-
importItems[key].import = deduplicateImportsByKey(importItems[key].import);
|
|
940
|
-
}
|
|
941
|
-
scanned.services = deduplicateArray(scanned.services);
|
|
942
|
-
scanned.schemas = deduplicateArray(scanned.schemas);
|
|
943
|
-
scanned.shareds = deduplicateArray(scanned.shareds);
|
|
944
938
|
const importsContent = [
|
|
945
939
|
...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
|
|
946
940
|
if (silgi.options.typescript.removeFileExtension) {
|
|
@@ -980,19 +974,6 @@ async function prepareServerFiles(silgi) {
|
|
|
980
974
|
importData.unshift(...importsContent);
|
|
981
975
|
return importData;
|
|
982
976
|
}
|
|
983
|
-
function deduplicateImportsByKey(imports) {
|
|
984
|
-
const seenKeys = /* @__PURE__ */ new Map();
|
|
985
|
-
return imports.filter((item) => {
|
|
986
|
-
if (seenKeys.has(item.key)) {
|
|
987
|
-
return false;
|
|
988
|
-
}
|
|
989
|
-
seenKeys.set(item.key, true);
|
|
990
|
-
return true;
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
function deduplicateArray(array) {
|
|
994
|
-
return [...new Set(array)];
|
|
995
|
-
}
|
|
996
977
|
|
|
997
978
|
async function writeScanFiles(silgi) {
|
|
998
979
|
const data = await prepareServerFiles(silgi);
|
|
@@ -2156,6 +2137,26 @@ async function prepareSchema(silgi) {
|
|
|
2156
2137
|
routeRules: [],
|
|
2157
2138
|
routeRulesConfig: []
|
|
2158
2139
|
};
|
|
2140
|
+
function reset() {
|
|
2141
|
+
data.options = [];
|
|
2142
|
+
data.contexts = [];
|
|
2143
|
+
data.actions = [];
|
|
2144
|
+
data.shareds = [
|
|
2145
|
+
{
|
|
2146
|
+
key: "modulesURIs",
|
|
2147
|
+
value: "{ modulesURIs: typeof modulesURIs }"
|
|
2148
|
+
}
|
|
2149
|
+
];
|
|
2150
|
+
data.events = [];
|
|
2151
|
+
data.storeBase = [];
|
|
2152
|
+
data.hooks = [];
|
|
2153
|
+
data.runtimeHooks = [];
|
|
2154
|
+
data.runtimeOptions = [];
|
|
2155
|
+
data.methods = [];
|
|
2156
|
+
data.routeRules = [];
|
|
2157
|
+
data.routeRulesConfig = [];
|
|
2158
|
+
}
|
|
2159
|
+
reset();
|
|
2159
2160
|
await silgi.callHook("prepare:schema.ts", data);
|
|
2160
2161
|
relativeWithDot(silgi.options.build.typesDir, `${silgi.options.silgi.serverDir}/core.ts`);
|
|
2161
2162
|
const silgiScanTS = relativeWithDot(silgi.options.build.typesDir, `${silgi.options.silgi.serverDir}/scan.ts`);
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED