silgi 0.7.20 → 0.7.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/prepare.mjs +76 -75
- package/dist/kit/index.mjs +1 -1
- 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/prepare.mjs
CHANGED
|
@@ -825,6 +825,9 @@ const commonArgs = {
|
|
|
825
825
|
async function registerModuleExportScan(silgi) {
|
|
826
826
|
silgi.hook("prepare:schema.ts", async (options) => {
|
|
827
827
|
for (const module of silgi.scanModules) {
|
|
828
|
+
if (module.meta._packageName || silgi.options.preset === "npm-package") {
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
828
831
|
const exports = module.meta.exports;
|
|
829
832
|
if (!exports?.length)
|
|
830
833
|
continue;
|
|
@@ -835,79 +838,77 @@ async function registerModuleExportScan(silgi) {
|
|
|
835
838
|
from: module.meta._packageName ? moduleName : relativeWithDot(silgi.options.build.typesDir, module.entryPath)
|
|
836
839
|
};
|
|
837
840
|
const exportedTypes = exports.filter((exp) => exp.type).map((exp) => exp.name);
|
|
838
|
-
if (
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
options.methods.push({ key: configKey, value: importName });
|
|
910
|
-
}
|
|
841
|
+
if (exportedTypes.includes("ModuleOptions")) {
|
|
842
|
+
const importName = pascalCase(`${configKey}Config`);
|
|
843
|
+
options.importItems[configKey].import.push({
|
|
844
|
+
name: `ModuleOptions as ${importName}`,
|
|
845
|
+
type: true
|
|
846
|
+
});
|
|
847
|
+
options.options.push({ key: configKey, value: importName });
|
|
848
|
+
}
|
|
849
|
+
if (exportedTypes.includes("SilgiRuntimeOptions")) {
|
|
850
|
+
const importName = pascalCase(`${configKey}RuntimeConfig`);
|
|
851
|
+
options.importItems[configKey].import.push({
|
|
852
|
+
name: `SilgiRuntimeOptions as ${importName}`,
|
|
853
|
+
type: true
|
|
854
|
+
});
|
|
855
|
+
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
856
|
+
}
|
|
857
|
+
if (exportedTypes.includes("ModuleRuntimeContext")) {
|
|
858
|
+
const importName = pascalCase(`${configKey}RuntimeContext`);
|
|
859
|
+
options.importItems[configKey].import.push({
|
|
860
|
+
name: `ModuleRuntimeContext as ${importName}`,
|
|
861
|
+
type: true
|
|
862
|
+
});
|
|
863
|
+
options.contexts.push({ key: configKey, value: importName });
|
|
864
|
+
}
|
|
865
|
+
if (exportedTypes.includes("ModuleRuntimeAction")) {
|
|
866
|
+
const importName = pascalCase(`${configKey}Action`);
|
|
867
|
+
options.importItems[configKey].import.push({
|
|
868
|
+
name: `ModuleRuntimeAction as ${importName}`,
|
|
869
|
+
type: true
|
|
870
|
+
});
|
|
871
|
+
options.actions.push({ key: configKey, value: importName });
|
|
872
|
+
}
|
|
873
|
+
if (exportedTypes.includes("ModuleRuntimeShared")) {
|
|
874
|
+
const importName = pascalCase(`${configKey}Shared`);
|
|
875
|
+
options.importItems[configKey].import.push({
|
|
876
|
+
name: `ModuleRuntimeShared as ${importName}`,
|
|
877
|
+
type: true
|
|
878
|
+
});
|
|
879
|
+
options.shareds.push({ key: configKey, value: importName });
|
|
880
|
+
}
|
|
881
|
+
if (exportedTypes.includes("ModuleHooks")) {
|
|
882
|
+
const importName = pascalCase(`${configKey}Hooks`);
|
|
883
|
+
options.importItems[configKey].import.push({
|
|
884
|
+
name: `ModuleHooks as ${importName}`,
|
|
885
|
+
type: true
|
|
886
|
+
});
|
|
887
|
+
options.hooks.push({ key: configKey, value: importName });
|
|
888
|
+
}
|
|
889
|
+
if (exportedTypes.includes("ModuleRuntimeHooks")) {
|
|
890
|
+
const importName = pascalCase(`${configKey}RuntimeHooks`);
|
|
891
|
+
options.importItems[configKey].import.push({
|
|
892
|
+
name: `ModuleRuntimeHooks as ${importName}`,
|
|
893
|
+
type: true
|
|
894
|
+
});
|
|
895
|
+
options.runtimeHooks.push({ key: configKey, value: importName });
|
|
896
|
+
}
|
|
897
|
+
if (exportedTypes.includes("ModuleRuntimeOptions")) {
|
|
898
|
+
const importName = pascalCase(`${configKey}RuntimeOptions`);
|
|
899
|
+
options.importItems[configKey].import.push({
|
|
900
|
+
name: `ModuleRuntimeOptions as ${importName}`,
|
|
901
|
+
type: true
|
|
902
|
+
});
|
|
903
|
+
options.runtimeOptions.push({ key: configKey, value: importName });
|
|
904
|
+
}
|
|
905
|
+
if (exportedTypes.includes("SilgiRuntimeMethods")) {
|
|
906
|
+
const importName = pascalCase(`${configKey}RuntimeMethods`);
|
|
907
|
+
options.importItems[configKey].import.push({
|
|
908
|
+
name: `SilgiRuntimeMethods as ${importName}`,
|
|
909
|
+
type: true
|
|
910
|
+
});
|
|
911
|
+
options.methods.push({ key: configKey, value: importName });
|
|
911
912
|
}
|
|
912
913
|
}
|
|
913
914
|
});
|
|
@@ -1458,7 +1459,7 @@ async function generateApp(app, options = {}) {
|
|
|
1458
1459
|
app.templates = Object.values(defaultTemplates).concat(app.options.build.templates);
|
|
1459
1460
|
await app.callHook("app:templates", app);
|
|
1460
1461
|
app.templates = app.templates.map((tmpl) => {
|
|
1461
|
-
const dir =
|
|
1462
|
+
const dir = tmpl.where === ".silgi" ? app.options.build.dir : tmpl.where === "server" ? app.options.silgi.serverDir : tmpl.where === "client" ? app.options.silgi.clientDir : app.options.silgi.vfsDir;
|
|
1462
1463
|
return normalizeTemplate(tmpl, dir);
|
|
1463
1464
|
});
|
|
1464
1465
|
const filteredTemplates = {
|
|
@@ -1477,7 +1478,7 @@ async function generateApp(app, options = {}) {
|
|
|
1477
1478
|
const dirs = /* @__PURE__ */ new Set();
|
|
1478
1479
|
const changedTemplates = [];
|
|
1479
1480
|
async function processTemplate(template) {
|
|
1480
|
-
const dir =
|
|
1481
|
+
const dir = template.where === ".silgi" ? app.options.build.dir : template.where === "server" ? app.options.silgi.serverDir : template.where === "client" ? app.options.silgi.clientDir : app.options.silgi.vfsDir;
|
|
1481
1482
|
const fullPath = template.dst || resolve(dir, template.filename);
|
|
1482
1483
|
const start = performance.now();
|
|
1483
1484
|
const contents = await compileTemplate(template, templateContext).catch((e) => {
|
package/dist/kit/index.mjs
CHANGED
|
@@ -292,7 +292,7 @@ function normalizeTemplate(template, buildDir) {
|
|
|
292
292
|
}
|
|
293
293
|
if (!template.dst) {
|
|
294
294
|
const silgi = useSilgiCLI();
|
|
295
|
-
const dir = template.where === ".silgi" ? silgi.options.build.dir : template.where === "server" ? silgi.options.silgi.serverDir : silgi.options.silgi.clientDir;
|
|
295
|
+
const dir = template.where === ".silgi" ? silgi.options.build.dir : template.where === "server" ? silgi.options.silgi.serverDir : template.where === "client" ? silgi.options.silgi.clientDir : silgi.options.silgi.serverDir;
|
|
296
296
|
template.dst = resolve(buildDir ?? dir, template.filename);
|
|
297
297
|
}
|
|
298
298
|
return template;
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED