silgi 0.3.0 → 0.3.1

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.
@@ -575,21 +575,30 @@ async function generateRouterDTS(silgi) {
575
575
  params: ${params}
576
576
  }`;
577
577
  }).join(",\n");
578
- return ` '${path}': {
578
+ return ` '/${path}': {
579
579
  ${methodEntries}
580
580
  }`;
581
581
  });
582
+ const nitro = [
583
+ "declare module 'nitropack/types' {",
584
+ " interface InternalApi extends RouterTypes {}",
585
+ "}"
586
+ ];
582
587
  const context = [
583
588
  "import type { ExtractInputFromURI, ExtractOutputFromURI, ExtractRouterParamsFromURI } from 'silgi'",
584
589
  "",
585
- "export type RouterTypes = {",
590
+ "export interface RouterTypes {",
586
591
  routerTypes.join(",\n"),
587
592
  "}",
588
593
  "",
589
594
  "declare module 'silgi' {",
590
595
  " interface SilgiRouterTypes extends RouterTypes {",
591
596
  " }",
592
- "}"
597
+ "}",
598
+ "",
599
+ silgi.options.environment === "h3" || silgi.options.environment === "nitrojs" ? nitro.join("\n") : "",
600
+ "",
601
+ "export {}"
593
602
  ].join("\n");
594
603
  const outputPath = resolve(silgi.options.buildDir, "silgi-routes.d.ts");
595
604
  await promises.writeFile(outputPath, context);
@@ -1213,9 +1222,9 @@ async function generate$1(mergeConfig) {
1213
1222
  };
1214
1223
  silgi._ignore = ignore(silgi.options.ignoreOptions);
1215
1224
  silgi.hook("prepare:types", (opts) => {
1216
- opts.references.push({ path: resolve(silgi.options.buildDir, "schema.d.ts") });
1217
- opts.references.push({ path: resolve(silgi.options.buildDir, "h3.d.ts") });
1218
- opts.references.push({ path: resolve(silgi.options.buildDir, "silgi-routes.d.ts") });
1225
+ opts.references.push({ path: resolve(silgi.options.buildDir, "./schema.d.ts") });
1226
+ opts.references.push({ path: resolve(silgi.options.buildDir, "./h3.d.ts") });
1227
+ opts.references.push({ path: resolve(silgi.options.buildDir, "./silgi-routes.d.ts") });
1219
1228
  });
1220
1229
  await generateUris(silgi);
1221
1230
  await generateSilgiStorageBaseType(silgi);
@@ -3,7 +3,7 @@ import consola from 'consola';
3
3
 
4
4
  const name = "silgi";
5
5
  const type = "module";
6
- const version = "0.3.0";
6
+ const version = "0.3.1";
7
7
  const packageManager = "pnpm@9.15.1";
8
8
  const sideEffects = false;
9
9
  const exports = {
@@ -1,5 +1,11 @@
1
1
  import { defineNuxtModule } from '@nuxt/kit';
2
2
  import { resolvePath } from 'mlly';
3
+ import { join } from 'pathe';
4
+ import { l as loadSilgiConfig } from '../../shared/silgi.2D3gmgW0.mjs';
5
+ import { r as relativeWithDot } from '../../shared/silgi.BNEdIEZH.mjs';
6
+ import 'c12';
7
+ import 'untyped';
8
+ import 'std-env';
3
9
 
4
10
  const module = defineNuxtModule({
5
11
  meta: {
@@ -11,9 +17,13 @@ const module = defineNuxtModule({
11
17
  },
12
18
  defaults: {},
13
19
  async setup(options, nuxt) {
20
+ const silgi = await loadSilgiConfig({});
14
21
  nuxt.options.build.transpile.push("silgi");
15
22
  nuxt.options.nitro.modules ||= [];
16
23
  nuxt.options.nitro.modules.push(await resolvePath("silgi/ecosystem/nitro"));
24
+ nuxt.hook("prepare:types", ({ references }) => {
25
+ references.push({ path: relativeWithDot(nuxt.options.buildDir, join(silgi.options.buildDir, "silgi.d.ts")) });
26
+ });
17
27
  }
18
28
  });
19
29
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "sideEffects": false,
6
6
  "exports": {
7
7
  ".": {