shiftapi 0.0.21 → 0.0.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.
@@ -59,13 +59,12 @@ function indent(text, spaces = 2) {
59
59
  const prefix = " ".repeat(spaces);
60
60
  return text.split("\n").map((line) => line ? prefix + line : line).join("\n");
61
61
  }
62
- function dtsTemplate(generatedTypes, openapiImport) {
63
- const src = openapiImport ?? "openapi-fetch";
62
+ function dtsTemplate(generatedTypes) {
64
63
  return `// Auto-generated by shiftapi. Do not edit.
65
64
  declare module "@shiftapi/client" {
66
65
  ${indent(generatedTypes)}
67
66
 
68
- import type createClient from "${src}";
67
+ import type createClient from "openapi-fetch";
69
68
 
70
69
  export const client: ReturnType<typeof createClient<paths>>;
71
70
  export { createClient };
@@ -147,15 +146,11 @@ function writeGeneratedFiles(typesRoot, generatedDts, baseUrl, options) {
147
146
  if (!existsSync(outDir)) {
148
147
  mkdirSync(outDir, { recursive: true });
149
148
  }
150
- const useLocalOpenapi = !!options?.openapiSource;
151
- writeFileSync(resolve(outDir, "client.d.ts"), dtsTemplate(generatedDts, useLocalOpenapi ? "./openapi-fetch.js" : void 0));
149
+ writeFileSync(resolve(outDir, "client.d.ts"), dtsTemplate(generatedDts));
152
150
  writeFileSync(resolve(outDir, "client.js"), options?.clientJsContent ?? clientJsTemplate(baseUrl));
153
151
  if (options?.openapiSource) {
154
152
  writeFileSync(resolve(outDir, "openapi-fetch.js"), options.openapiSource);
155
153
  }
156
- if (options?.openapiDts) {
157
- writeFileSync(resolve(outDir, "openapi-fetch.d.ts"), options.openapiDts);
158
- }
159
154
  writeFileSync(
160
155
  resolve(outDir, "tsconfig.json"),
161
156
  JSON.stringify(
@@ -8,7 +8,6 @@ declare function regenerateTypes(serverEntry: string, goRoot: string, baseUrl: s
8
8
  declare function writeGeneratedFiles(typesRoot: string, generatedDts: string, baseUrl: string, options?: {
9
9
  clientJsContent?: string;
10
10
  openapiSource?: string;
11
- openapiDts?: string;
12
11
  }): void;
13
12
  declare function patchTsConfigPaths(tsconfigDir: string, typesRoot: string): void;
14
13
 
@@ -25,7 +24,7 @@ declare function extractSpec(serverEntry: string, goRoot: string): object;
25
24
  */
26
25
  declare function generateTypes(spec: object): Promise<string>;
27
26
 
28
- declare function dtsTemplate(generatedTypes: string, openapiImport?: string): string;
27
+ declare function dtsTemplate(generatedTypes: string): string;
29
28
  declare function clientJsTemplate(baseUrl: string): string;
30
29
  declare function nextClientJsTemplate(port: number, baseUrl: string, devApiPrefix?: string): string;
31
30
  declare function virtualModuleTemplate(baseUrl: string, devApiPrefix?: string): string;
package/dist/internal.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  regenerateTypes,
12
12
  virtualModuleTemplate,
13
13
  writeGeneratedFiles
14
- } from "./chunk-7OWLTM22.js";
14
+ } from "./chunk-JLLHD7QU.js";
15
15
  import {
16
16
  defineConfig,
17
17
  findConfigDir,
package/dist/prepare.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  generateTypes,
5
5
  patchTsConfigPaths,
6
6
  writeGeneratedFiles
7
- } from "./chunk-7OWLTM22.js";
7
+ } from "./chunk-JLLHD7QU.js";
8
8
  import {
9
9
  loadConfig
10
10
  } from "./chunk-EQN44FQG.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shiftapi",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "CLI and codegen for shiftapi – fully-typed TypeScript clients from Go servers",
5
5
  "author": "Frank Chiarulli Jr. <frank@frankchiarulli.com>",
6
6
  "license": "MIT",