@ptdgrp/typedgql 1.0.0-beta.15 → 1.0.0-beta.20
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/README.md +64 -4
- package/README.zh-CN.md +64 -4
- package/dist/cli.cjs +47 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +49 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/{schema-loader-DolAa42F.cjs → config-loader-Bxj44SGD.cjs} +349 -42
- package/dist/{schema-loader-vNpUWFmU.mjs → config-loader-DZ7d_CWR.mjs} +343 -48
- package/dist/config-loader-DZ7d_CWR.mjs.map +1 -0
- package/dist/cyrb53-B2tdX6NT.mjs +921 -0
- package/dist/cyrb53-B2tdX6NT.mjs.map +1 -0
- package/dist/cyrb53-BTzxwvXR.cjs +1010 -0
- package/dist/cyrb53-DWYFRdWZ.d.mts +333 -0
- package/dist/cyrb53-DWYFRdWZ.d.mts.map +1 -0
- package/dist/cyrb53-FbY3n_2r.d.cts +333 -0
- package/dist/cyrb53-FbY3n_2r.d.cts.map +1 -0
- package/dist/index.cjs +18 -935
- package/dist/index.d.cts +2 -333
- package/dist/index.d.mts +2 -333
- package/dist/index.mjs +3 -920
- package/dist/node.cjs +6 -4
- package/dist/node.d.cts +63 -2
- package/dist/node.d.cts.map +1 -1
- package/dist/node.d.mts +63 -2
- package/dist/node.d.mts.map +1 -1
- package/dist/node.mjs +2 -2
- package/dist/{options-CgrZ2der.d.cts → options-B6mcYDIz.d.cts} +10 -1
- package/dist/options-B6mcYDIz.d.cts.map +1 -0
- package/dist/{options-BWcHrC-1.d.mts → options-T07dJfbz.d.mts} +10 -1
- package/dist/options-T07dJfbz.d.mts.map +1 -0
- package/dist/runtime.cjs +18 -0
- package/dist/runtime.d.cts +2 -0
- package/dist/runtime.d.mts +2 -0
- package/dist/runtime.mjs +3 -0
- package/dist/vite.cjs +68 -59
- package/dist/vite.d.cts +11 -17
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +11 -17
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +66 -57
- package/dist/vite.mjs.map +1 -1
- package/package.json +23 -4
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/options-BWcHrC-1.d.mts.map +0 -1
- package/dist/options-CgrZ2der.d.cts.map +0 -1
- package/dist/schema-loader-vNpUWFmU.mjs.map +0 -1
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_config_loader = require('./config-loader-Bxj44SGD.cjs');
|
|
3
3
|
|
|
4
|
-
exports.Generator =
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
4
|
+
exports.Generator = require_config_loader.Generator;
|
|
5
|
+
exports.loadConfig = require_config_loader.loadConfig;
|
|
6
|
+
exports.loadLocalSchema = require_config_loader.loadLocalSchema;
|
|
7
|
+
exports.loadRemoteSchema = require_config_loader.loadRemoteSchema;
|
|
8
|
+
exports.mergeConfig = require_config_loader.mergeConfig;
|
package/dist/node.d.cts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import { t as CodegenOptions } from "./options-
|
|
1
|
+
import { t as CodegenOptions } from "./options-B6mcYDIz.cjs";
|
|
2
2
|
import { GraphQLSchema } from "graphql";
|
|
3
3
|
|
|
4
4
|
//#region src/codegen/generator.d.ts
|
|
5
5
|
declare class Generator {
|
|
6
6
|
protected options: CodegenOptions;
|
|
7
|
+
private usePrettier;
|
|
8
|
+
private isCustomOutputDir;
|
|
9
|
+
private bufferedStreams;
|
|
7
10
|
constructor(options: CodegenOptions);
|
|
8
11
|
/** Resolved output directory (uses default if not configured) */
|
|
9
12
|
private get targetDir();
|
|
13
|
+
/**
|
|
14
|
+
* Check if we should use prettier formatting.
|
|
15
|
+
* Only enabled when using custom outputDir (not in node_modules).
|
|
16
|
+
*/
|
|
17
|
+
private initializePrettier;
|
|
18
|
+
/**
|
|
19
|
+
* Create a stream for writing generated code.
|
|
20
|
+
* Uses BufferedStream when prettier formatting is enabled.
|
|
21
|
+
*/
|
|
22
|
+
private createCodeStream;
|
|
23
|
+
private get rootRuntimeImportSource();
|
|
24
|
+
private get nestedRuntimeImportSource();
|
|
25
|
+
private get usesPackageInternalRuntimeImports();
|
|
26
|
+
private get generatedImportSourceMap();
|
|
27
|
+
/**
|
|
28
|
+
* Flush all buffered streams with prettier formatting.
|
|
29
|
+
*/
|
|
30
|
+
private flushBufferedStreams;
|
|
10
31
|
generate(): Promise<void>;
|
|
11
32
|
private createSelectionWriter;
|
|
12
33
|
private additionalExportedTypeNamesForSelection;
|
|
@@ -41,5 +62,45 @@ declare function loadRemoteSchema(endpoint: string, headers?: {
|
|
|
41
62
|
}): Promise<GraphQLSchema>;
|
|
42
63
|
declare function loadLocalSchema(location: string): Promise<GraphQLSchema>;
|
|
43
64
|
//#endregion
|
|
44
|
-
|
|
65
|
+
//#region src/codegen/config-loader.d.ts
|
|
66
|
+
/**
|
|
67
|
+
* Configuration file format for .typedgqlrc.toml
|
|
68
|
+
* Matches CodegenOptions but with schema-related fields for file-based config.
|
|
69
|
+
*/
|
|
70
|
+
interface TypedGqlConfig extends Omit<CodegenOptions, "schemaLoader"> {
|
|
71
|
+
/**
|
|
72
|
+
* GraphQL schema source.
|
|
73
|
+
* - Local file path: `"./schema.graphql"`
|
|
74
|
+
* - Remote endpoint: `"http://localhost:4000/graphql"`
|
|
75
|
+
*/
|
|
76
|
+
schema?: string;
|
|
77
|
+
/**
|
|
78
|
+
* HTTP headers forwarded when fetching a remote schema.
|
|
79
|
+
* Only used when `schema` is a URL.
|
|
80
|
+
*/
|
|
81
|
+
schemaHeaders?: Record<string, string>;
|
|
82
|
+
/**
|
|
83
|
+
* Output directory for generated files.
|
|
84
|
+
* Alias for `targetDir` for better clarity.
|
|
85
|
+
*/
|
|
86
|
+
outputDir?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Load configuration from .typedgqlrc.toml file.
|
|
90
|
+
*
|
|
91
|
+
* @param configPath - Path to the config file (defaults to .typedgqlrc.toml in cwd)
|
|
92
|
+
* @returns Parsed configuration object or undefined if file doesn't exist
|
|
93
|
+
*/
|
|
94
|
+
declare function loadConfig(configPath?: string): Promise<TypedGqlConfig | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* Merge configuration from file with programmatic options.
|
|
97
|
+
* Programmatic options take precedence over file config.
|
|
98
|
+
*
|
|
99
|
+
* @param fileConfig - Configuration loaded from .typedgqlrc.toml
|
|
100
|
+
* @param programmaticConfig - Configuration passed programmatically
|
|
101
|
+
* @returns Merged configuration
|
|
102
|
+
*/
|
|
103
|
+
declare function mergeConfig(fileConfig: TypedGqlConfig | undefined, programmaticConfig: Partial<TypedGqlConfig>): TypedGqlConfig;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { type CodegenOptions, Generator, type TypedGqlConfig, loadConfig, loadLocalSchema, loadRemoteSchema, mergeConfig };
|
|
45
106
|
//# sourceMappingURL=node.d.cts.map
|
package/dist/node.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.cts","names":[],"sources":["../src/codegen/generator.ts","../src/codegen/schema-loader.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"node.d.cts","names":[],"sources":["../src/codegen/generator.ts","../src/codegen/schema-loader.ts","../src/codegen/config-loader.ts"],"mappings":";;;;cAgEa,SAAA;EAAA,UAKW,OAAA,EAAS,cAAA;EAAA,QAJvB,WAAA;EAAA,QACA,iBAAA;EAAA,QACA,eAAA;cAEc,OAAA,EAAS,cAAA;EAAA;EAAA,YAGnB,SAAA,CAAA;EA4FE;;;;EAAA,QApFA,kBAAA;EAdN;;;;EAAA,QAyCA,gBAAA;EAAA,YAaI,uBAAA,CAAA;EAAA,YAMA,yBAAA,CAAA;EAAA,YAMA,iCAAA,CAAA;EAAA,YAIA,wBAAA,CAAA;EAVA;;;EAAA,QAoBE,oBAAA;EAkBR,QAAA,CAAA,GAAQ,OAAA;EAAA,QAwJN,qBAAA;EAAA,QAeA,uCAAA;EAAA,QAOM,sBAAA;EAAA,QAqEA,kBAAA;EAAA,QAYA,iBAAA;EAAA,QAeA,qBAAA;EAAA,QAgBA,yBAAA;EAAA,QAaA,gBAAA;EAAA,QAeA,oBAAA;EAAA,QAUA,mBAAA;EAAA,QA8BN,qBAAA;EAAA,QAeM,UAAA;EAAA;;;;;EAAA,QAyFA,sBAAA;EAAA,QAcA,sCAAA;EAAA,QAuCN,qBAAA;EAAA,QAgFA,iBAAA;EAAA,QAeA,kBAAA;EAAA,QAiBA,cAAA;EAAA,QAqFA,8BAAA;EAAA,QAWA,cAAA;AAAA;;;iBC/2BY,gBAAA,CACpB,QAAA,UACA,OAAA;EAAA,CAAa,GAAA;AAAA,IACZ,OAAA,CAAQ,aAAA;AAAA,iBAuBW,eAAA,CACpB,QAAA,WACC,OAAA,CAAQ,aAAA;;;;;;ADgCX;UExCiB,cAAA,SACP,IAAA,CAAK,cAAA;;;;;;EAMb,MAAA;EFsCsB;;;;EEjCtB,aAAA,GAAgB,MAAA;;;;;EAKhB,SAAA;AAAA;;;;;;;iBASoB,UAAA,CACpB,UAAA,YACC,OAAA,CAAQ,cAAA;;;;;;;;;iBAqCK,WAAA,CACd,UAAA,EAAY,cAAA,cACZ,kBAAA,EAAoB,OAAA,CAAQ,cAAA,IAC3B,cAAA"}
|
package/dist/node.d.mts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import { t as CodegenOptions } from "./options-
|
|
1
|
+
import { t as CodegenOptions } from "./options-T07dJfbz.mjs";
|
|
2
2
|
import { GraphQLSchema } from "graphql";
|
|
3
3
|
|
|
4
4
|
//#region src/codegen/generator.d.ts
|
|
5
5
|
declare class Generator {
|
|
6
6
|
protected options: CodegenOptions;
|
|
7
|
+
private usePrettier;
|
|
8
|
+
private isCustomOutputDir;
|
|
9
|
+
private bufferedStreams;
|
|
7
10
|
constructor(options: CodegenOptions);
|
|
8
11
|
/** Resolved output directory (uses default if not configured) */
|
|
9
12
|
private get targetDir();
|
|
13
|
+
/**
|
|
14
|
+
* Check if we should use prettier formatting.
|
|
15
|
+
* Only enabled when using custom outputDir (not in node_modules).
|
|
16
|
+
*/
|
|
17
|
+
private initializePrettier;
|
|
18
|
+
/**
|
|
19
|
+
* Create a stream for writing generated code.
|
|
20
|
+
* Uses BufferedStream when prettier formatting is enabled.
|
|
21
|
+
*/
|
|
22
|
+
private createCodeStream;
|
|
23
|
+
private get rootRuntimeImportSource();
|
|
24
|
+
private get nestedRuntimeImportSource();
|
|
25
|
+
private get usesPackageInternalRuntimeImports();
|
|
26
|
+
private get generatedImportSourceMap();
|
|
27
|
+
/**
|
|
28
|
+
* Flush all buffered streams with prettier formatting.
|
|
29
|
+
*/
|
|
30
|
+
private flushBufferedStreams;
|
|
10
31
|
generate(): Promise<void>;
|
|
11
32
|
private createSelectionWriter;
|
|
12
33
|
private additionalExportedTypeNamesForSelection;
|
|
@@ -41,5 +62,45 @@ declare function loadRemoteSchema(endpoint: string, headers?: {
|
|
|
41
62
|
}): Promise<GraphQLSchema>;
|
|
42
63
|
declare function loadLocalSchema(location: string): Promise<GraphQLSchema>;
|
|
43
64
|
//#endregion
|
|
44
|
-
|
|
65
|
+
//#region src/codegen/config-loader.d.ts
|
|
66
|
+
/**
|
|
67
|
+
* Configuration file format for .typedgqlrc.toml
|
|
68
|
+
* Matches CodegenOptions but with schema-related fields for file-based config.
|
|
69
|
+
*/
|
|
70
|
+
interface TypedGqlConfig extends Omit<CodegenOptions, "schemaLoader"> {
|
|
71
|
+
/**
|
|
72
|
+
* GraphQL schema source.
|
|
73
|
+
* - Local file path: `"./schema.graphql"`
|
|
74
|
+
* - Remote endpoint: `"http://localhost:4000/graphql"`
|
|
75
|
+
*/
|
|
76
|
+
schema?: string;
|
|
77
|
+
/**
|
|
78
|
+
* HTTP headers forwarded when fetching a remote schema.
|
|
79
|
+
* Only used when `schema` is a URL.
|
|
80
|
+
*/
|
|
81
|
+
schemaHeaders?: Record<string, string>;
|
|
82
|
+
/**
|
|
83
|
+
* Output directory for generated files.
|
|
84
|
+
* Alias for `targetDir` for better clarity.
|
|
85
|
+
*/
|
|
86
|
+
outputDir?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Load configuration from .typedgqlrc.toml file.
|
|
90
|
+
*
|
|
91
|
+
* @param configPath - Path to the config file (defaults to .typedgqlrc.toml in cwd)
|
|
92
|
+
* @returns Parsed configuration object or undefined if file doesn't exist
|
|
93
|
+
*/
|
|
94
|
+
declare function loadConfig(configPath?: string): Promise<TypedGqlConfig | undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* Merge configuration from file with programmatic options.
|
|
97
|
+
* Programmatic options take precedence over file config.
|
|
98
|
+
*
|
|
99
|
+
* @param fileConfig - Configuration loaded from .typedgqlrc.toml
|
|
100
|
+
* @param programmaticConfig - Configuration passed programmatically
|
|
101
|
+
* @returns Merged configuration
|
|
102
|
+
*/
|
|
103
|
+
declare function mergeConfig(fileConfig: TypedGqlConfig | undefined, programmaticConfig: Partial<TypedGqlConfig>): TypedGqlConfig;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { type CodegenOptions, Generator, type TypedGqlConfig, loadConfig, loadLocalSchema, loadRemoteSchema, mergeConfig };
|
|
45
106
|
//# sourceMappingURL=node.d.mts.map
|
package/dist/node.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.mts","names":[],"sources":["../src/codegen/generator.ts","../src/codegen/schema-loader.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"node.d.mts","names":[],"sources":["../src/codegen/generator.ts","../src/codegen/schema-loader.ts","../src/codegen/config-loader.ts"],"mappings":";;;;cAgEa,SAAA;EAAA,UAKW,OAAA,EAAS,cAAA;EAAA,QAJvB,WAAA;EAAA,QACA,iBAAA;EAAA,QACA,eAAA;cAEc,OAAA,EAAS,cAAA;EAAA;EAAA,YAGnB,SAAA,CAAA;EA4FE;;;;EAAA,QApFA,kBAAA;EAdN;;;;EAAA,QAyCA,gBAAA;EAAA,YAaI,uBAAA,CAAA;EAAA,YAMA,yBAAA,CAAA;EAAA,YAMA,iCAAA,CAAA;EAAA,YAIA,wBAAA,CAAA;EAVA;;;EAAA,QAoBE,oBAAA;EAkBR,QAAA,CAAA,GAAQ,OAAA;EAAA,QAwJN,qBAAA;EAAA,QAeA,uCAAA;EAAA,QAOM,sBAAA;EAAA,QAqEA,kBAAA;EAAA,QAYA,iBAAA;EAAA,QAeA,qBAAA;EAAA,QAgBA,yBAAA;EAAA,QAaA,gBAAA;EAAA,QAeA,oBAAA;EAAA,QAUA,mBAAA;EAAA,QA8BN,qBAAA;EAAA,QAeM,UAAA;EAAA;;;;;EAAA,QAyFA,sBAAA;EAAA,QAcA,sCAAA;EAAA,QAuCN,qBAAA;EAAA,QAgFA,iBAAA;EAAA,QAeA,kBAAA;EAAA,QAiBA,cAAA;EAAA,QAqFA,8BAAA;EAAA,QAWA,cAAA;AAAA;;;iBC/2BY,gBAAA,CACpB,QAAA,UACA,OAAA;EAAA,CAAa,GAAA;AAAA,IACZ,OAAA,CAAQ,aAAA;AAAA,iBAuBW,eAAA,CACpB,QAAA,WACC,OAAA,CAAQ,aAAA;;;;;;ADgCX;UExCiB,cAAA,SACP,IAAA,CAAK,cAAA;;;;;;EAMb,MAAA;EFsCsB;;;;EEjCtB,aAAA,GAAgB,MAAA;;;;;EAKhB,SAAA;AAAA;;;;;;;iBASoB,UAAA,CACpB,UAAA,YACC,OAAA,CAAQ,cAAA;;;;;;;;;iBAqCK,WAAA,CACd,UAAA,EAAY,cAAA,cACZ,kBAAA,EAAoB,OAAA,CAAQ,cAAA,IAC3B,cAAA"}
|
package/dist/node.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Generator, i as loadRemoteSchema, n as mergeConfig, r as loadLocalSchema, t as loadConfig } from "./config-loader-DZ7d_CWR.mjs";
|
|
2
2
|
|
|
3
|
-
export { Generator, loadLocalSchema, loadRemoteSchema };
|
|
3
|
+
export { Generator, loadConfig, loadLocalSchema, loadRemoteSchema, mergeConfig };
|
|
@@ -19,8 +19,17 @@ interface CodegenOptions {
|
|
|
19
19
|
* Output directory for generated files.
|
|
20
20
|
*
|
|
21
21
|
* If omitted, generator default path is used by caller.
|
|
22
|
+
* @alias outputDir - Can also be specified as `outputDir` in config files
|
|
22
23
|
*/
|
|
23
24
|
readonly targetDir?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to format generated files with Prettier.
|
|
27
|
+
*
|
|
28
|
+
* - `undefined`: auto-detect Prettier for custom output directories.
|
|
29
|
+
* - `true`: format when Prettier is available.
|
|
30
|
+
* - `false`: never format generated files.
|
|
31
|
+
*/
|
|
32
|
+
readonly prettier?: boolean;
|
|
24
33
|
/**
|
|
25
34
|
* Indentation string used in generated files.
|
|
26
35
|
*
|
|
@@ -102,4 +111,4 @@ interface CodegenOptions {
|
|
|
102
111
|
}
|
|
103
112
|
//#endregion
|
|
104
113
|
export { CodegenOptions as t };
|
|
105
|
-
//# sourceMappingURL=options-
|
|
114
|
+
//# sourceMappingURL=options-B6mcYDIz.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-B6mcYDIz.d.cts","names":[],"sources":["../src/codegen/options.ts"],"mappings":";;;;;AAQA;;;;UAAiB,cAAA;EAsDU;;;;;;EAAA,SA/ChB,YAAA,QAAoB,OAAA,CAAQ,aAAA;EAe5B;;;;;;EAAA,SARA,SAAA;EAmDA;;;;;;;EAAA,SA3CA,QAAA;EA0EM;;;;;EAAA,SApEN,MAAA;;;;;;;WAOA,cAAA;;;;;;;WAOA,aAAA;;;;;;;;WAQA,eAAA;;;;WAIA,aAAA,GAAgB,aAAA;;;;;;;;;;;WAWhB,aAAA;IAAA,UACG,GAAA;EAAA;;;;;;;;WASH,sBAAA;;;;;;WAMA,UAAA;IAAA,UAAyB,GAAA;EAAA;;;;;;WAMzB,0BAAA;IAAA,UAAyC,GAAA;EAAA;;;;;;;;;WASzC,MAAA;AAAA"}
|
|
@@ -19,8 +19,17 @@ interface CodegenOptions {
|
|
|
19
19
|
* Output directory for generated files.
|
|
20
20
|
*
|
|
21
21
|
* If omitted, generator default path is used by caller.
|
|
22
|
+
* @alias outputDir - Can also be specified as `outputDir` in config files
|
|
22
23
|
*/
|
|
23
24
|
readonly targetDir?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to format generated files with Prettier.
|
|
27
|
+
*
|
|
28
|
+
* - `undefined`: auto-detect Prettier for custom output directories.
|
|
29
|
+
* - `true`: format when Prettier is available.
|
|
30
|
+
* - `false`: never format generated files.
|
|
31
|
+
*/
|
|
32
|
+
readonly prettier?: boolean;
|
|
24
33
|
/**
|
|
25
34
|
* Indentation string used in generated files.
|
|
26
35
|
*
|
|
@@ -102,4 +111,4 @@ interface CodegenOptions {
|
|
|
102
111
|
}
|
|
103
112
|
//#endregion
|
|
104
113
|
export { CodegenOptions as t };
|
|
105
|
-
//# sourceMappingURL=options-
|
|
114
|
+
//# sourceMappingURL=options-T07dJfbz.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-T07dJfbz.d.mts","names":[],"sources":["../src/codegen/options.ts"],"mappings":";;;;;AAQA;;;;UAAiB,cAAA;EAsDU;;;;;;EAAA,SA/ChB,YAAA,QAAoB,OAAA,CAAQ,aAAA;EAe5B;;;;;;EAAA,SARA,SAAA;EAmDA;;;;;;;EAAA,SA3CA,QAAA;EA0EM;;;;;EAAA,SApEN,MAAA;;;;;;;WAOA,cAAA;;;;;;;WAOA,aAAA;;;;;;;;WAQA,eAAA;;;;WAIA,aAAA,GAAgB,aAAA;;;;;;;;;;;WAWhB,aAAA;IAAA,UACG,GAAA;EAAA;;;;;;;;WASH,sBAAA;;;;;;WAMA,UAAA;IAAA,UAAyB,GAAA;EAAA;;;;;;WAMzB,0BAAA;IAAA,UAAyC,GAAA;EAAA;;;;;;;;;WASzC,MAAA;AAAA"}
|
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_cyrb53 = require('./cyrb53-BTzxwvXR.cjs');
|
|
3
|
+
|
|
4
|
+
exports.EnumInputMetadataBuilder = require_cyrb53.EnumInputMetadataBuilder;
|
|
5
|
+
exports.FragmentRef = require_cyrb53.FragmentRef;
|
|
6
|
+
exports.FragmentSpread = require_cyrb53.FragmentSpread;
|
|
7
|
+
exports.ParameterRef = require_cyrb53.ParameterRef;
|
|
8
|
+
exports.SelectionNode = require_cyrb53.SelectionImpl;
|
|
9
|
+
exports.StringValue = require_cyrb53.StringValue;
|
|
10
|
+
exports.TextBuilder = require_cyrb53.TextBuilder;
|
|
11
|
+
exports.__parameterRefMarker = require_cyrb53.__marker;
|
|
12
|
+
exports.createSchemaType = require_cyrb53.createSchemaType;
|
|
13
|
+
exports.createSelection = require_cyrb53.createSelection;
|
|
14
|
+
exports.cyrb53 = require_cyrb53.cyrb53;
|
|
15
|
+
exports.registerSchemaTypeFactory = require_cyrb53.registerSchemaTypeFactory;
|
|
16
|
+
exports.resolveRegisteredSchemaType = require_cyrb53.resolveRegisteredSchemaType;
|
|
17
|
+
exports.runtimeOf = require_cyrb53.runtimeOf;
|
|
18
|
+
exports.withOperationName = require_cyrb53.withOperationName;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as createSchemaType, C as ParameterRef, D as SchemaFieldCategory, E as SchemaField, M as resolveRegisteredSchemaType, O as SchemaType, S as AcceptableVariables, T as __marker, _ as StringValue, a as withOperationName, b as runtimeOf, c as EnumInputMetadataBuilder, d as Expand, f as FieldSelection, g as ShapeOf, h as Selection, i as SelectionImpl, j as registerSchemaTypeFactory, k as SchemaTypeCategory, l as DirectiveArgs, m as FragmentSpread, n as TextBuilder, o as EnumInputMetaType, p as FragmentRef, r as createSelection, s as EnumInputMetadata, t as cyrb53, u as ExecutableSelection, v as ValueOrThunk, w as UnresolvedVariables, x as FieldOptions, y as VariablesOf } from "./cyrb53-FbY3n_2r.cjs";
|
|
2
|
+
export { type AcceptableVariables, type DirectiveArgs, type EnumInputMetaType, type EnumInputMetadata, EnumInputMetadataBuilder, type ExecutableSelection, type Expand, type FieldOptions, type FieldSelection, FragmentRef, FragmentSpread, ParameterRef, type SchemaField, type SchemaFieldCategory, type SchemaType, type SchemaTypeCategory, type Selection, SelectionImpl as SelectionNode, type ShapeOf, StringValue, TextBuilder, type UnresolvedVariables, type ValueOrThunk, type VariablesOf, __marker as __parameterRefMarker, createSchemaType, createSelection, cyrb53, registerSchemaTypeFactory, resolveRegisteredSchemaType, runtimeOf, withOperationName };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as createSchemaType, C as ParameterRef, D as SchemaFieldCategory, E as SchemaField, M as resolveRegisteredSchemaType, O as SchemaType, S as AcceptableVariables, T as __marker, _ as StringValue, a as withOperationName, b as runtimeOf, c as EnumInputMetadataBuilder, d as Expand, f as FieldSelection, g as ShapeOf, h as Selection, i as SelectionImpl, j as registerSchemaTypeFactory, k as SchemaTypeCategory, l as DirectiveArgs, m as FragmentSpread, n as TextBuilder, o as EnumInputMetaType, p as FragmentRef, r as createSelection, s as EnumInputMetadata, t as cyrb53, u as ExecutableSelection, v as ValueOrThunk, w as UnresolvedVariables, x as FieldOptions, y as VariablesOf } from "./cyrb53-DWYFRdWZ.mjs";
|
|
2
|
+
export { type AcceptableVariables, type DirectiveArgs, type EnumInputMetaType, type EnumInputMetadata, EnumInputMetadataBuilder, type ExecutableSelection, type Expand, type FieldOptions, type FieldSelection, FragmentRef, FragmentSpread, ParameterRef, type SchemaField, type SchemaFieldCategory, type SchemaType, type SchemaTypeCategory, type Selection, SelectionImpl as SelectionNode, type ShapeOf, StringValue, TextBuilder, type UnresolvedVariables, type ValueOrThunk, type VariablesOf, __marker as __parameterRefMarker, createSchemaType, createSelection, cyrb53, registerSchemaTypeFactory, resolveRegisteredSchemaType, runtimeOf, withOperationName };
|
package/dist/runtime.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as withOperationName, c as __marker, d as resolveRegisteredSchemaType, f as FragmentRef, h as runtimeOf, i as SelectionImpl, l as createSchemaType, m as StringValue, n as createSelection, o as TextBuilder, p as FragmentSpread, r as EnumInputMetadataBuilder, s as ParameterRef, t as cyrb53, u as registerSchemaTypeFactory } from "./cyrb53-B2tdX6NT.mjs";
|
|
2
|
+
|
|
3
|
+
export { EnumInputMetadataBuilder, FragmentRef, FragmentSpread, ParameterRef, SelectionImpl as SelectionNode, StringValue, TextBuilder, __marker as __parameterRefMarker, createSchemaType, createSelection, cyrb53, registerSchemaTypeFactory, resolveRegisteredSchemaType, runtimeOf, withOperationName };
|
package/dist/vite.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
2
|
+
const require_config_loader = require('./config-loader-Bxj44SGD.cjs');
|
|
3
3
|
let node_fs_promises = require("node:fs/promises");
|
|
4
4
|
let node_crypto = require("node:crypto");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -9,35 +9,31 @@ let vite = require("vite");
|
|
|
9
9
|
/**
|
|
10
10
|
* Vite plugin for @ptdgrp/typedgql — runs codegen automatically.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
const isRemote = (schema) => {
|
|
13
13
|
return /^https?:\/\//.test(schema);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return isRemote(schema) ? () =>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (!option) return void 0;
|
|
20
|
-
if (option === true) return { strategy: "reload" };
|
|
21
|
-
return { strategy: option.strategy ?? "reload" };
|
|
22
|
-
}
|
|
23
|
-
function buildNegatedWatchPattern(packageName) {
|
|
14
|
+
};
|
|
15
|
+
const makeSchemaLoader = (schema, headers) => {
|
|
16
|
+
return isRemote(schema) ? () => require_config_loader.loadRemoteSchema(schema, headers) : () => require_config_loader.loadLocalSchema(schema);
|
|
17
|
+
};
|
|
18
|
+
const buildNegatedWatchPattern = (packageName) => {
|
|
24
19
|
return `!**/node_modules/${packageName}/**`;
|
|
25
|
-
}
|
|
20
|
+
};
|
|
26
21
|
const DEV_DEP_HMR_PACKAGE_NAME = "@ptdgrp/typedgql";
|
|
27
22
|
const DEV_DEP_HMR_WATCH_DIRS = ["dist"];
|
|
28
|
-
async
|
|
23
|
+
const hashFile = async (path) => {
|
|
29
24
|
try {
|
|
30
25
|
const content = await (0, node_fs_promises.readFile)(path);
|
|
31
26
|
return (0, node_crypto.createHash)("sha256").update(content).digest("hex");
|
|
32
27
|
} catch {
|
|
33
28
|
return;
|
|
34
29
|
}
|
|
35
|
-
}
|
|
30
|
+
};
|
|
36
31
|
/**
|
|
37
32
|
* Vite plugin that runs typedgql codegen automatically.
|
|
38
33
|
*
|
|
39
34
|
* - **Local schema** — runs once on startup, then watches for file changes.
|
|
40
35
|
* - **Remote schema** — runs on every `vite dev` / `vite build` invocation.
|
|
36
|
+
* - **Config file** — if no schema is provided, loads from .typedgqlrc.toml
|
|
41
37
|
*
|
|
42
38
|
* @example
|
|
43
39
|
* ```ts
|
|
@@ -50,30 +46,44 @@ async function hashFile(path) {
|
|
|
50
46
|
* typedgql({ schema: "./schema.graphql" }),
|
|
51
47
|
* // or remote endpoint
|
|
52
48
|
* typedgql({ schema: "http://localhost:4000/graphql" }),
|
|
49
|
+
* // or use .typedgqlrc.toml config file
|
|
50
|
+
* typedgql(),
|
|
53
51
|
* ],
|
|
54
52
|
* });
|
|
55
53
|
* ```
|
|
56
54
|
*/
|
|
57
55
|
function typedgql(options) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
schemaLoader: makeSchemaLoader(schema, schemaHeaders)
|
|
64
|
-
};
|
|
56
|
+
let resolvedOptions;
|
|
57
|
+
let schema;
|
|
58
|
+
let remote;
|
|
59
|
+
let codegenOptions;
|
|
60
|
+
let initialized = false;
|
|
65
61
|
let isRunning = false;
|
|
66
62
|
let isDependencyRefreshRunning = false;
|
|
67
63
|
let lastSchemaHash;
|
|
68
64
|
let initSchemaHashPromise;
|
|
69
65
|
let resolvedConfig;
|
|
70
66
|
let logger;
|
|
67
|
+
async function initializeOptions() {
|
|
68
|
+
if (initialized) return;
|
|
69
|
+
resolvedOptions = require_config_loader.mergeConfig(await require_config_loader.loadConfig(), options ?? {});
|
|
70
|
+
if (resolvedOptions.outputDir && !resolvedOptions.targetDir) resolvedOptions.targetDir = resolvedOptions.outputDir;
|
|
71
|
+
if (!resolvedOptions.schema) throw new Error("typedgql: 'schema' option is required. Provide it in plugin options or in .typedgqlrc.toml config file.");
|
|
72
|
+
schema = resolvedOptions.schema;
|
|
73
|
+
remote = isRemote(schema);
|
|
74
|
+
const { schema: _, schemaHeaders, outputDir: __, ...generatorOptions } = resolvedOptions;
|
|
75
|
+
codegenOptions = {
|
|
76
|
+
...generatorOptions,
|
|
77
|
+
schemaLoader: makeSchemaLoader(schema, schemaHeaders)
|
|
78
|
+
};
|
|
79
|
+
initialized = true;
|
|
80
|
+
}
|
|
71
81
|
async function runCodegen(trigger) {
|
|
72
82
|
if (isRunning) return;
|
|
73
83
|
isRunning = true;
|
|
74
84
|
const label = `\x1b[36m[typedgql:${trigger}]\x1b[0m`;
|
|
75
85
|
try {
|
|
76
|
-
await new
|
|
86
|
+
await new require_config_loader.Generator(codegenOptions).generate();
|
|
77
87
|
} catch (err) {
|
|
78
88
|
logger.error(`${label} failed: ${err}`);
|
|
79
89
|
} finally {
|
|
@@ -83,10 +93,9 @@ function typedgql(options) {
|
|
|
83
93
|
return {
|
|
84
94
|
name: "vite-plugin-typedgql",
|
|
85
95
|
config(config) {
|
|
86
|
-
if (!depHmr) return;
|
|
87
|
-
const negatedPattern = buildNegatedWatchPattern(DEV_DEP_HMR_PACKAGE_NAME);
|
|
88
96
|
const exclude = new Set(config.optimizeDeps?.exclude ?? []);
|
|
89
97
|
exclude.add(DEV_DEP_HMR_PACKAGE_NAME);
|
|
98
|
+
const negatedPattern = buildNegatedWatchPattern(DEV_DEP_HMR_PACKAGE_NAME);
|
|
90
99
|
const watchIgnored = config.server?.watch?.ignored;
|
|
91
100
|
const mergedIgnored = Array.isArray(watchIgnored) ? [...watchIgnored, negatedPattern] : watchIgnored === void 0 ? [negatedPattern] : watchIgnored;
|
|
92
101
|
return {
|
|
@@ -99,46 +108,46 @@ function typedgql(options) {
|
|
|
99
108
|
logger = cfg.logger;
|
|
100
109
|
},
|
|
101
110
|
async buildStart() {
|
|
111
|
+
await initializeOptions();
|
|
102
112
|
await runCodegen(resolvedConfig?.command === "build" ? "build" : "start");
|
|
103
113
|
},
|
|
104
114
|
configureServer(server) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
const packageRoot = (0, vite.normalizePath)((0, node_path.resolve)(server.config.root, "node_modules", DEV_DEP_HMR_PACKAGE_NAME));
|
|
116
|
+
const watchedDirs = DEV_DEP_HMR_WATCH_DIRS.map((dir) => (0, vite.normalizePath)((0, node_path.resolve)(packageRoot, dir)));
|
|
117
|
+
for (const dir of watchedDirs) server.watcher.add(dir);
|
|
118
|
+
server.watcher.on("change", async (file) => {
|
|
119
|
+
const changedPath = (0, vite.normalizePath)(file);
|
|
120
|
+
if (!watchedDirs.some((dir) => changedPath.startsWith(dir))) return;
|
|
121
|
+
if (isDependencyRefreshRunning) return;
|
|
122
|
+
isDependencyRefreshRunning = true;
|
|
123
|
+
try {
|
|
124
|
+
await server.restart(true);
|
|
125
|
+
} finally {
|
|
126
|
+
isDependencyRefreshRunning = false;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
initializeOptions().then(() => {
|
|
130
|
+
if (!schema || remote) return;
|
|
131
|
+
const root = server.config.root;
|
|
132
|
+
const schemaPath = (0, vite.normalizePath)((0, node_path.resolve)(root, schema));
|
|
133
|
+
let realSchemaPath = schemaPath;
|
|
134
|
+
(0, node_fs_promises.realpath)(schemaPath).then((actualPath) => {
|
|
135
|
+
realSchemaPath = (0, vite.normalizePath)(actualPath);
|
|
136
|
+
}).catch(() => {});
|
|
137
|
+
server.watcher.add(schemaPath);
|
|
138
|
+
initSchemaHashPromise = hashFile(schemaPath).then((hash) => {
|
|
139
|
+
lastSchemaHash = hash;
|
|
140
|
+
});
|
|
109
141
|
server.watcher.on("change", async (file) => {
|
|
110
142
|
const changedPath = (0, vite.normalizePath)(file);
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
isDependencyRefreshRunning = false;
|
|
119
|
-
}
|
|
143
|
+
if (changedPath !== schemaPath && changedPath !== realSchemaPath) return;
|
|
144
|
+
await initSchemaHashPromise;
|
|
145
|
+
const nextHash = await hashFile(schemaPath);
|
|
146
|
+
if (nextHash && nextHash === lastSchemaHash) return;
|
|
147
|
+
await runCodegen("watch");
|
|
148
|
+
if (nextHash) lastSchemaHash = nextHash;
|
|
149
|
+
await server.restart(true);
|
|
120
150
|
});
|
|
121
|
-
}
|
|
122
|
-
if (remote) return;
|
|
123
|
-
const root = server.config.root;
|
|
124
|
-
const schemaPath = (0, vite.normalizePath)((0, node_path.resolve)(root, schema));
|
|
125
|
-
let realSchemaPath = schemaPath;
|
|
126
|
-
(0, node_fs_promises.realpath)(schemaPath).then((actualPath) => {
|
|
127
|
-
realSchemaPath = (0, vite.normalizePath)(actualPath);
|
|
128
|
-
}).catch(() => {});
|
|
129
|
-
server.watcher.add(schemaPath);
|
|
130
|
-
initSchemaHashPromise = hashFile(schemaPath).then((hash) => {
|
|
131
|
-
lastSchemaHash = hash;
|
|
132
|
-
});
|
|
133
|
-
server.watcher.on("change", async (file) => {
|
|
134
|
-
const changedPath = (0, vite.normalizePath)(file);
|
|
135
|
-
if (changedPath !== schemaPath && changedPath !== realSchemaPath) return;
|
|
136
|
-
await initSchemaHashPromise;
|
|
137
|
-
const nextHash = await hashFile(schemaPath);
|
|
138
|
-
if (nextHash && nextHash === lastSchemaHash) return;
|
|
139
|
-
await runCodegen("watch");
|
|
140
|
-
if (nextHash) lastSchemaHash = nextHash;
|
|
141
|
-
server.ws.send({ type: "full-reload" });
|
|
142
151
|
});
|
|
143
152
|
}
|
|
144
153
|
};
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { t as CodegenOptions } from "./options-
|
|
1
|
+
import { t as CodegenOptions } from "./options-B6mcYDIz.cjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plugin.d.ts
|
|
5
|
-
interface DevDependencyHmrOptions {
|
|
6
|
-
/**
|
|
7
|
-
* How to refresh dev server when watched dependency files change.
|
|
8
|
-
*
|
|
9
|
-
* - "reload": send full page reload
|
|
10
|
-
* - "restart": restart Vite dev server
|
|
11
|
-
*
|
|
12
|
-
* @default "reload"
|
|
13
|
-
*/
|
|
14
|
-
strategy?: "reload" | "restart";
|
|
15
|
-
}
|
|
16
5
|
interface TypedGqlPluginOptions extends Omit<CodegenOptions, "schemaLoader"> {
|
|
17
6
|
/**
|
|
18
7
|
* GraphQL schema source.
|
|
@@ -21,24 +10,27 @@ interface TypedGqlPluginOptions extends Omit<CodegenOptions, "schemaLoader"> {
|
|
|
21
10
|
*
|
|
22
11
|
* Local file → codegen runs on startup, then re-runs on every file change.
|
|
23
12
|
* Remote URL → codegen runs on every `vite dev` / `vite build` invocation.
|
|
13
|
+
*
|
|
14
|
+
* If omitted, will attempt to load from .typedgqlrc.toml config file.
|
|
24
15
|
*/
|
|
25
|
-
schema
|
|
16
|
+
schema?: string;
|
|
26
17
|
/**
|
|
27
18
|
* HTTP headers forwarded when fetching a remote schema.
|
|
28
19
|
* Only used when `schema` is a URL.
|
|
29
20
|
*/
|
|
30
21
|
schemaHeaders?: Record<string, string>;
|
|
31
22
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
23
|
+
* Output directory for generated files.
|
|
24
|
+
* Alias for `targetDir` for better clarity.
|
|
34
25
|
*/
|
|
35
|
-
|
|
26
|
+
outputDir?: string;
|
|
36
27
|
}
|
|
37
28
|
/**
|
|
38
29
|
* Vite plugin that runs typedgql codegen automatically.
|
|
39
30
|
*
|
|
40
31
|
* - **Local schema** — runs once on startup, then watches for file changes.
|
|
41
32
|
* - **Remote schema** — runs on every `vite dev` / `vite build` invocation.
|
|
33
|
+
* - **Config file** — if no schema is provided, loads from .typedgqlrc.toml
|
|
42
34
|
*
|
|
43
35
|
* @example
|
|
44
36
|
* ```ts
|
|
@@ -51,11 +43,13 @@ interface TypedGqlPluginOptions extends Omit<CodegenOptions, "schemaLoader"> {
|
|
|
51
43
|
* typedgql({ schema: "./schema.graphql" }),
|
|
52
44
|
* // or remote endpoint
|
|
53
45
|
* typedgql({ schema: "http://localhost:4000/graphql" }),
|
|
46
|
+
* // or use .typedgqlrc.toml config file
|
|
47
|
+
* typedgql(),
|
|
54
48
|
* ],
|
|
55
49
|
* });
|
|
56
50
|
* ```
|
|
57
51
|
*/
|
|
58
|
-
declare function typedgql(options
|
|
52
|
+
declare function typedgql(options?: TypedGqlPluginOptions): Plugin;
|
|
59
53
|
//#endregion
|
|
60
54
|
export { type TypedGqlPluginOptions, typedgql };
|
|
61
55
|
//# sourceMappingURL=vite.d.cts.map
|
package/dist/vite.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite-plugin.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite-plugin.ts"],"mappings":";;;;UAeiB,qBAAA,SAA8B,IAAA,CAC7C,cAAA;;;;;;;;;;;EAaA,MAAA;EAUA;;;AAwDF;EA7DE,aAAA,GAAgB,MAAA;;;;;EAKhB,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;iBAwDc,QAAA,CAAS,OAAA,GAAU,qBAAA,GAAwB,MAAA"}
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { t as CodegenOptions } from "./options-
|
|
1
|
+
import { t as CodegenOptions } from "./options-T07dJfbz.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plugin.d.ts
|
|
5
|
-
interface DevDependencyHmrOptions {
|
|
6
|
-
/**
|
|
7
|
-
* How to refresh dev server when watched dependency files change.
|
|
8
|
-
*
|
|
9
|
-
* - "reload": send full page reload
|
|
10
|
-
* - "restart": restart Vite dev server
|
|
11
|
-
*
|
|
12
|
-
* @default "reload"
|
|
13
|
-
*/
|
|
14
|
-
strategy?: "reload" | "restart";
|
|
15
|
-
}
|
|
16
5
|
interface TypedGqlPluginOptions extends Omit<CodegenOptions, "schemaLoader"> {
|
|
17
6
|
/**
|
|
18
7
|
* GraphQL schema source.
|
|
@@ -21,24 +10,27 @@ interface TypedGqlPluginOptions extends Omit<CodegenOptions, "schemaLoader"> {
|
|
|
21
10
|
*
|
|
22
11
|
* Local file → codegen runs on startup, then re-runs on every file change.
|
|
23
12
|
* Remote URL → codegen runs on every `vite dev` / `vite build` invocation.
|
|
13
|
+
*
|
|
14
|
+
* If omitted, will attempt to load from .typedgqlrc.toml config file.
|
|
24
15
|
*/
|
|
25
|
-
schema
|
|
16
|
+
schema?: string;
|
|
26
17
|
/**
|
|
27
18
|
* HTTP headers forwarded when fetching a remote schema.
|
|
28
19
|
* Only used when `schema` is a URL.
|
|
29
20
|
*/
|
|
30
21
|
schemaHeaders?: Record<string, string>;
|
|
31
22
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
23
|
+
* Output directory for generated files.
|
|
24
|
+
* Alias for `targetDir` for better clarity.
|
|
34
25
|
*/
|
|
35
|
-
|
|
26
|
+
outputDir?: string;
|
|
36
27
|
}
|
|
37
28
|
/**
|
|
38
29
|
* Vite plugin that runs typedgql codegen automatically.
|
|
39
30
|
*
|
|
40
31
|
* - **Local schema** — runs once on startup, then watches for file changes.
|
|
41
32
|
* - **Remote schema** — runs on every `vite dev` / `vite build` invocation.
|
|
33
|
+
* - **Config file** — if no schema is provided, loads from .typedgqlrc.toml
|
|
42
34
|
*
|
|
43
35
|
* @example
|
|
44
36
|
* ```ts
|
|
@@ -51,11 +43,13 @@ interface TypedGqlPluginOptions extends Omit<CodegenOptions, "schemaLoader"> {
|
|
|
51
43
|
* typedgql({ schema: "./schema.graphql" }),
|
|
52
44
|
* // or remote endpoint
|
|
53
45
|
* typedgql({ schema: "http://localhost:4000/graphql" }),
|
|
46
|
+
* // or use .typedgqlrc.toml config file
|
|
47
|
+
* typedgql(),
|
|
54
48
|
* ],
|
|
55
49
|
* });
|
|
56
50
|
* ```
|
|
57
51
|
*/
|
|
58
|
-
declare function typedgql(options
|
|
52
|
+
declare function typedgql(options?: TypedGqlPluginOptions): Plugin;
|
|
59
53
|
//#endregion
|
|
60
54
|
export { type TypedGqlPluginOptions, typedgql };
|
|
61
55
|
//# sourceMappingURL=vite.d.mts.map
|
package/dist/vite.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite-plugin.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite-plugin.ts"],"mappings":";;;;UAeiB,qBAAA,SAA8B,IAAA,CAC7C,cAAA;;;;;;;;;;;EAaA,MAAA;EAUA;;;AAwDF;EA7DE,aAAA,GAAgB,MAAA;;;;;EAKhB,SAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;iBAwDc,QAAA,CAAS,OAAA,GAAU,qBAAA,GAAwB,MAAA"}
|