silgi 0.17.2 → 0.17.3

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.17.2";
1
+ const version = "0.17.3";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -102,7 +102,8 @@ const SilgiCLIDefaults = {
102
102
  tsconfigPath: ".silgi/types/silgi.tsconfig.json",
103
103
  tsConfig: {},
104
104
  customConditions: [],
105
- generateRuntimeConfigTypes: true
105
+ generateRuntimeConfigTypes: true,
106
+ removeFileExtension: false
106
107
  },
107
108
  conditions: [],
108
109
  nodeModulesDirs: [],
@@ -756,6 +756,9 @@ async function prepareServerFiles(silgi) {
756
756
  scanned.shareds = deduplicateArray(scanned.shareds);
757
757
  const importsContent = [
758
758
  ...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
759
+ if (silgi.options.typescript.removeFileExtension) {
760
+ from = from.replace(/\.\w+$/, "");
761
+ }
759
762
  return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${from}'`;
760
763
  }),
761
764
  "",
@@ -1694,6 +1697,9 @@ async function prepareCoreFile(data, frameworkContext, silgi) {
1694
1697
  }
1695
1698
  const importsContent = [
1696
1699
  ...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
1700
+ if (silgi.options.typescript.removeFileExtension) {
1701
+ from = from.replace(/\.\w+$/, "");
1702
+ }
1697
1703
  return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${from}'`;
1698
1704
  }),
1699
1705
  "",
@@ -1796,6 +1802,9 @@ async function createDTSFramework(silgi) {
1796
1802
  const content = [
1797
1803
  ...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
1798
1804
  const path = isAbsolute(from) ? relativeWithDot(silgi.options.build.typesDir, from) : from;
1805
+ if (silgi.options.typescript.removeFileExtension) {
1806
+ from = from.replace(/\.\w+$/, "");
1807
+ }
1799
1808
  return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${path}'`;
1800
1809
  }),
1801
1810
  "",
@@ -1960,6 +1969,9 @@ async function prepareSchema(silgi) {
1960
1969
  const importsContent = [
1961
1970
  ...Object.entries(importItems).map(([_name, { from, import: imports }]) => {
1962
1971
  const path = isAbsolute(from) ? relativeWithDot(silgi.options.build.typesDir, from) : from;
1972
+ if (silgi.options.typescript.removeFileExtension) {
1973
+ from = from.replace(/\.\w+$/, "");
1974
+ }
1963
1975
  return `import { ${imports.map(({ type, name }) => type ? `type ${name}` : name).join(", ")} } from '${path}'`;
1964
1976
  }),
1965
1977
  "",
@@ -1,4 +1,4 @@
1
- const version = "0.17.2";
1
+ const version = "0.17.3";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,4 +1,4 @@
1
- const version = "0.17.2";
1
+ const version = "0.17.3";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -9,7 +9,10 @@ const npmPackage = defineSilgiPreset(
9
9
  silgi: {
10
10
  serverDir: "{{ serverDir }}/silgi"
11
11
  },
12
- modules: ["./src"]
12
+ modules: ["./src"],
13
+ typescript: {
14
+ removeFileExtension: true
15
+ }
13
16
  },
14
17
  {
15
18
  name: "npm-package",
@@ -759,6 +759,11 @@ interface SilgiCLIOptions extends PresetOptions {
759
759
  * @default true
760
760
  */
761
761
  generateRuntimeConfigTypes: boolean;
762
+ /**
763
+ * @default false
764
+ * Behavior of import paths in auto-generated silgi files
765
+ */
766
+ removeFileExtension: boolean;
762
767
  };
763
768
  alias: Record<string, string>;
764
769
  /**
@@ -759,6 +759,11 @@ interface SilgiCLIOptions extends PresetOptions {
759
759
  * @default true
760
760
  */
761
761
  generateRuntimeConfigTypes: boolean;
762
+ /**
763
+ * @default false
764
+ * Behavior of import paths in auto-generated silgi files
765
+ */
766
+ removeFileExtension: boolean;
762
767
  };
763
768
  alias: Record<string, string>;
764
769
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.17.2",
4
+ "version": "0.17.3",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {