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.
@@ -1,4 +1,4 @@
1
- const version = "0.7.20";
1
+ const version = "0.7.22";
2
2
  const packageJson = {
3
3
  version: version};
4
4
 
@@ -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 (!module.meta._packageName) {
839
- if (exportedTypes.includes("ModuleOptions")) {
840
- const importName = pascalCase(`${configKey}Config`);
841
- options.importItems[configKey].import.push({
842
- name: `ModuleOptions as ${importName}`,
843
- type: true
844
- });
845
- options.options.push({ key: configKey, value: importName });
846
- }
847
- if (exportedTypes.includes("SilgiRuntimeOptions")) {
848
- const importName = pascalCase(`${configKey}RuntimeConfig`);
849
- options.importItems[configKey].import.push({
850
- name: `SilgiRuntimeOptions as ${importName}`,
851
- type: true
852
- });
853
- options.runtimeOptions.push({ key: configKey, value: importName });
854
- }
855
- if (exportedTypes.includes("ModuleRuntimeContext")) {
856
- const importName = pascalCase(`${configKey}RuntimeContext`);
857
- options.importItems[configKey].import.push({
858
- name: `ModuleRuntimeContext as ${importName}`,
859
- type: true
860
- });
861
- options.contexts.push({ key: configKey, value: importName });
862
- }
863
- if (exportedTypes.includes("ModuleRuntimeAction")) {
864
- const importName = pascalCase(`${configKey}Action`);
865
- options.importItems[configKey].import.push({
866
- name: `ModuleRuntimeAction as ${importName}`,
867
- type: true
868
- });
869
- options.actions.push({ key: configKey, value: importName });
870
- }
871
- if (exportedTypes.includes("ModuleRuntimeShared")) {
872
- const importName = pascalCase(`${configKey}Shared`);
873
- options.importItems[configKey].import.push({
874
- name: `ModuleRuntimeShared as ${importName}`,
875
- type: true
876
- });
877
- options.shareds.push({ key: configKey, value: importName });
878
- }
879
- if (exportedTypes.includes("ModuleHooks")) {
880
- const importName = pascalCase(`${configKey}Hooks`);
881
- options.importItems[configKey].import.push({
882
- name: `ModuleHooks as ${importName}`,
883
- type: true
884
- });
885
- options.hooks.push({ key: configKey, value: importName });
886
- }
887
- if (exportedTypes.includes("ModuleRuntimeHooks")) {
888
- const importName = pascalCase(`${configKey}RuntimeHooks`);
889
- options.importItems[configKey].import.push({
890
- name: `ModuleRuntimeHooks as ${importName}`,
891
- type: true
892
- });
893
- options.runtimeHooks.push({ key: configKey, value: importName });
894
- }
895
- if (exportedTypes.includes("ModuleRuntimeOptions")) {
896
- const importName = pascalCase(`${configKey}RuntimeOptions`);
897
- options.importItems[configKey].import.push({
898
- name: `ModuleRuntimeOptions as ${importName}`,
899
- type: true
900
- });
901
- options.runtimeOptions.push({ key: configKey, value: importName });
902
- }
903
- if (exportedTypes.includes("SilgiRuntimeMethods")) {
904
- const importName = pascalCase(`${configKey}RuntimeMethods`);
905
- options.importItems[configKey].import.push({
906
- name: `SilgiRuntimeMethods as ${importName}`,
907
- type: true
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 = (tmpl.where === ".silgi" ? app.options.build.dir : tmpl.where === "server" ? app.options.silgi.serverDir : app.options.silgi.clientDir) || app.options.silgi.vfsDir;
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 = (template.where === ".silgi" ? app.options.build.dir : template.where === "server" ? app.options.silgi.serverDir : app.options.silgi.clientDir) || app.options.silgi.vfsDir;
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) => {
@@ -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;
@@ -1,3 +1,3 @@
1
- const version = "0.7.20";
1
+ const version = "0.7.22";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "0.7.20";
1
+ const version = "0.7.22";
2
2
 
3
3
  export { version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.7.20",
4
+ "version": "0.7.22",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {