houdini 0.18.3 → 0.19.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.
- package/build/cmd-cjs/index.js +961 -534
- package/build/cmd-esm/index.js +961 -534
- package/build/codegen/generators/artifacts/utils.d.ts +2 -1
- package/build/codegen/generators/runtime/index.d.ts +2 -2
- package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
- package/build/codegen/generators/typescript/imperativeCache.d.ts +2 -0
- package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
- package/build/codegen-cjs/index.js +861 -483
- package/build/codegen-esm/index.js +861 -483
- package/build/lib/config.d.ts +27 -10
- package/build/lib-cjs/index.js +172 -64
- package/build/lib-esm/index.js +171 -64
- package/build/runtime/cache/cache.d.ts +5 -2
- package/build/runtime/cache/schema.d.ts +21 -0
- package/build/runtime/generated.d.ts +4 -0
- package/build/runtime/index.d.ts +6 -3
- package/build/runtime/lib/config.d.ts +7 -3
- package/build/runtime/lib/network.d.ts +2 -2
- package/build/runtime/lib/types.d.ts +2 -2
- package/build/runtime/public/cache.d.ts +19 -0
- package/build/runtime/public/index.d.ts +1 -0
- package/build/runtime/public/list.d.ts +18 -0
- package/build/runtime/public/record.d.ts +31 -0
- package/build/runtime/public/tests/test.d.ts +114 -0
- package/build/runtime/public/types.d.ts +36 -0
- package/build/runtime-cjs/cache/cache.d.ts +5 -2
- package/build/runtime-cjs/cache/cache.js +16 -5
- package/build/runtime-cjs/cache/schema.d.ts +21 -0
- package/build/runtime-cjs/cache/schema.js +66 -0
- package/build/runtime-cjs/generated.d.ts +4 -0
- package/build/runtime-cjs/generated.js +16 -0
- package/build/runtime-cjs/index.d.ts +6 -3
- package/build/runtime-cjs/index.js +4 -0
- package/build/runtime-cjs/lib/config.d.ts +7 -3
- package/build/runtime-cjs/lib/network.d.ts +2 -2
- package/build/runtime-cjs/lib/network.js +2 -2
- package/build/runtime-cjs/lib/types.d.ts +2 -2
- package/build/runtime-cjs/public/cache.d.ts +19 -0
- package/build/runtime-cjs/public/cache.js +97 -0
- package/build/runtime-cjs/public/index.d.ts +1 -0
- package/build/runtime-cjs/public/index.js +28 -0
- package/build/runtime-cjs/public/list.d.ts +18 -0
- package/build/runtime-cjs/public/list.js +163 -0
- package/build/runtime-cjs/public/record.d.ts +31 -0
- package/build/runtime-cjs/public/record.js +249 -0
- package/build/runtime-cjs/public/tests/test.d.ts +114 -0
- package/build/runtime-cjs/public/tests/test.js +31 -0
- package/build/runtime-cjs/public/types.d.ts +36 -0
- package/build/runtime-cjs/public/types.js +16 -0
- package/build/runtime-esm/cache/cache.d.ts +5 -2
- package/build/runtime-esm/cache/cache.js +16 -5
- package/build/runtime-esm/cache/schema.d.ts +21 -0
- package/build/runtime-esm/cache/schema.js +42 -0
- package/build/runtime-esm/generated.d.ts +4 -0
- package/build/runtime-esm/generated.js +0 -0
- package/build/runtime-esm/index.d.ts +6 -3
- package/build/runtime-esm/index.js +5 -2
- package/build/runtime-esm/lib/config.d.ts +7 -3
- package/build/runtime-esm/lib/network.d.ts +2 -2
- package/build/runtime-esm/lib/network.js +2 -2
- package/build/runtime-esm/lib/types.d.ts +2 -2
- package/build/runtime-esm/public/cache.d.ts +19 -0
- package/build/runtime-esm/public/cache.js +72 -0
- package/build/runtime-esm/public/index.d.ts +1 -0
- package/build/runtime-esm/public/index.js +4 -0
- package/build/runtime-esm/public/list.d.ts +18 -0
- package/build/runtime-esm/public/list.js +139 -0
- package/build/runtime-esm/public/record.d.ts +31 -0
- package/build/runtime-esm/public/record.js +222 -0
- package/build/runtime-esm/public/tests/test.d.ts +114 -0
- package/build/runtime-esm/public/tests/test.js +7 -0
- package/build/runtime-esm/public/types.d.ts +36 -0
- package/build/runtime-esm/public/types.js +0 -0
- package/build/test-cjs/index.js +857 -466
- package/build/test-esm/index.js +857 -466
- package/build/vite-cjs/index.js +939 -527
- package/build/vite-esm/index.js +939 -527
- package/package.json +2 -2
package/build/lib/config.d.ts
CHANGED
|
@@ -3,12 +3,17 @@ import type { CustomPluginOptions, LoadResult, ObjectHook, PluginContext, Resolv
|
|
|
3
3
|
import { ConfigFile, CachePolicy } from '../runtime/lib';
|
|
4
4
|
import { TransformPage } from '../vite/houdini';
|
|
5
5
|
import { CollectedGraphQLDocument } from './types';
|
|
6
|
+
export type PluginMeta = Plugin & {
|
|
7
|
+
name: string;
|
|
8
|
+
include_runtime: boolean;
|
|
9
|
+
version: string;
|
|
10
|
+
directory: string;
|
|
11
|
+
};
|
|
6
12
|
export declare class Config {
|
|
7
13
|
filepath: string;
|
|
8
14
|
rootDir: string;
|
|
9
15
|
projectRoot: string;
|
|
10
16
|
schema: graphql.GraphQLSchema;
|
|
11
|
-
apiUrl?: string;
|
|
12
17
|
schemaPath?: string;
|
|
13
18
|
persistedQueryPath?: string;
|
|
14
19
|
exclude: string[];
|
|
@@ -30,21 +35,19 @@ export declare class Config {
|
|
|
30
35
|
configIsRoute: ((filepath: string) => boolean) | null;
|
|
31
36
|
routesDir: string;
|
|
32
37
|
schemaPollInterval: number | null;
|
|
33
|
-
schemaPollHeaders: Record<string, string | ((env: any) => string)>;
|
|
38
|
+
schemaPollHeaders: ((env: any) => Record<string, string>) | Record<string, string | ((env: any) => string)>;
|
|
34
39
|
pluginMode: boolean;
|
|
35
|
-
plugins:
|
|
36
|
-
name: string;
|
|
37
|
-
include_runtime: boolean;
|
|
38
|
-
version: string;
|
|
39
|
-
directory: string;
|
|
40
|
-
})[];
|
|
40
|
+
plugins: PluginMeta[];
|
|
41
41
|
constructor({ filepath, loadFrameworkConfig, ...configFile }: ConfigFile & {
|
|
42
42
|
filepath: string;
|
|
43
43
|
loadFrameworkConfig?: boolean;
|
|
44
44
|
});
|
|
45
|
+
apiURL(): Promise<string | undefined>;
|
|
45
46
|
get include(): string[];
|
|
46
47
|
pluginConfig<ConfigType extends {}>(name: string): ConfigType;
|
|
47
|
-
|
|
48
|
+
getEnv(): Promise<Record<string, string | undefined>>;
|
|
49
|
+
processEnvValues(env: Record<string, string | undefined>, value: string | ((env: any) => string)): string | undefined;
|
|
50
|
+
pullHeaders(): Promise<any>;
|
|
48
51
|
sourceFiles(): Promise<string[]>;
|
|
49
52
|
get artifactDirectory(): string;
|
|
50
53
|
get artifactDirectoryName(): string;
|
|
@@ -135,14 +138,16 @@ export declare enum LogLevel {
|
|
|
135
138
|
Quiet = "quiet"
|
|
136
139
|
}
|
|
137
140
|
export type PluginFactory = (args?: PluginConfig) => Promise<Plugin>;
|
|
141
|
+
export declare const orderedPlugins: (plugins: PluginMeta[]) => PluginMeta[];
|
|
138
142
|
export type Plugin = {
|
|
143
|
+
order?: 'before' | 'after' | 'core';
|
|
139
144
|
extensions?: string[];
|
|
140
145
|
transform_runtime?: Record<string, (args: {
|
|
141
146
|
config: Config;
|
|
142
147
|
content: string;
|
|
143
148
|
}) => string>;
|
|
144
149
|
after_load?: (config: Config) => Promise<void> | void;
|
|
145
|
-
extract_documents?: (filepath: string, content: string) => Promise<string[]> | string[];
|
|
150
|
+
extract_documents?: (config: Config, filepath: string, content: string) => Promise<string[]> | string[];
|
|
146
151
|
generate?: GenerateHook;
|
|
147
152
|
transform_file?: (page: TransformPage) => Promise<{
|
|
148
153
|
code: string;
|
|
@@ -150,6 +155,18 @@ export type Plugin = {
|
|
|
150
155
|
code: string;
|
|
151
156
|
};
|
|
152
157
|
index_file?: ModuleIndexTransform;
|
|
158
|
+
graphql_tag_return?: (args: {
|
|
159
|
+
config: Config;
|
|
160
|
+
doc: CollectedGraphQLDocument;
|
|
161
|
+
ensure_import: (import_args: {
|
|
162
|
+
identifier: string;
|
|
163
|
+
module: string;
|
|
164
|
+
}) => void;
|
|
165
|
+
}) => string | undefined;
|
|
166
|
+
env?: (args: {
|
|
167
|
+
env: any;
|
|
168
|
+
config: Config;
|
|
169
|
+
}) => Promise<Record<string, string>>;
|
|
153
170
|
validate?: (args: {
|
|
154
171
|
config: Config;
|
|
155
172
|
documents: CollectedGraphQLDocument[];
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -58299,6 +58299,7 @@ __export(lib_exports, {
|
|
|
58299
58299
|
houdini_mode: () => houdini_mode,
|
|
58300
58300
|
keyFieldsForType: () => keyFieldsForType,
|
|
58301
58301
|
operation_requires_variables: () => operation_requires_variables,
|
|
58302
|
+
orderedPlugins: () => orderedPlugins,
|
|
58302
58303
|
parentTypeFromAncestors: () => parentTypeFromAncestors,
|
|
58303
58304
|
parseJS: () => parseJS,
|
|
58304
58305
|
parseJSON: () => parseJSON,
|
|
@@ -61970,6 +61971,46 @@ var ListCollection = class {
|
|
|
61970
61971
|
}
|
|
61971
61972
|
};
|
|
61972
61973
|
|
|
61974
|
+
// src/runtime/cache/schema.ts
|
|
61975
|
+
var SchemaManager = class {
|
|
61976
|
+
cache;
|
|
61977
|
+
fieldTypes = {};
|
|
61978
|
+
constructor(cache) {
|
|
61979
|
+
this.cache = cache;
|
|
61980
|
+
}
|
|
61981
|
+
setFieldType({
|
|
61982
|
+
parent,
|
|
61983
|
+
key,
|
|
61984
|
+
type,
|
|
61985
|
+
nullable = false,
|
|
61986
|
+
link
|
|
61987
|
+
}) {
|
|
61988
|
+
let parensIndex = key.indexOf("(");
|
|
61989
|
+
if (parensIndex !== -1) {
|
|
61990
|
+
key = key.substring(0, parensIndex);
|
|
61991
|
+
}
|
|
61992
|
+
if (parent === rootID) {
|
|
61993
|
+
parent = "Query";
|
|
61994
|
+
} else if (parent.includes(":")) {
|
|
61995
|
+
parent = parent.substring(0, parent.indexOf(":"));
|
|
61996
|
+
}
|
|
61997
|
+
if (!this.fieldTypes[parent]) {
|
|
61998
|
+
this.fieldTypes[parent] = {};
|
|
61999
|
+
}
|
|
62000
|
+
this.fieldTypes[parent][key] = {
|
|
62001
|
+
type,
|
|
62002
|
+
nullable,
|
|
62003
|
+
link: !!link
|
|
62004
|
+
};
|
|
62005
|
+
}
|
|
62006
|
+
fieldType(type, field) {
|
|
62007
|
+
return this.fieldTypes[type]?.[field] || null;
|
|
62008
|
+
}
|
|
62009
|
+
get config() {
|
|
62010
|
+
return this.cache._internal_unstable.config;
|
|
62011
|
+
}
|
|
62012
|
+
};
|
|
62013
|
+
|
|
61973
62014
|
// src/runtime/cache/storage.ts
|
|
61974
62015
|
var InMemoryStorage = class {
|
|
61975
62016
|
data;
|
|
@@ -62537,7 +62578,7 @@ var InMemorySubscriptions = class {
|
|
|
62537
62578
|
};
|
|
62538
62579
|
|
|
62539
62580
|
// src/runtime/cache/cache.ts
|
|
62540
|
-
var
|
|
62581
|
+
var Cache3 = class {
|
|
62541
62582
|
_internal_unstable;
|
|
62542
62583
|
constructor(config) {
|
|
62543
62584
|
this._internal_unstable = new CacheInternal({
|
|
@@ -62545,7 +62586,8 @@ var Cache2 = class {
|
|
|
62545
62586
|
storage: new InMemoryStorage(),
|
|
62546
62587
|
subscriptions: new InMemorySubscriptions(this),
|
|
62547
62588
|
lists: new ListManager(this, rootID),
|
|
62548
|
-
lifetimes: new GarbageCollector(this)
|
|
62589
|
+
lifetimes: new GarbageCollector(this),
|
|
62590
|
+
schema: new SchemaManager(this)
|
|
62549
62591
|
});
|
|
62550
62592
|
if (config) {
|
|
62551
62593
|
this.setConfig(defaultConfigValues(config));
|
|
@@ -62631,18 +62673,21 @@ var CacheInternal = class {
|
|
|
62631
62673
|
lists;
|
|
62632
62674
|
cache;
|
|
62633
62675
|
lifetimes;
|
|
62676
|
+
schema;
|
|
62634
62677
|
constructor({
|
|
62635
62678
|
storage,
|
|
62636
62679
|
subscriptions,
|
|
62637
62680
|
lists,
|
|
62638
62681
|
cache,
|
|
62639
|
-
lifetimes
|
|
62682
|
+
lifetimes,
|
|
62683
|
+
schema
|
|
62640
62684
|
}) {
|
|
62641
62685
|
this.storage = storage;
|
|
62642
62686
|
this.subscriptions = subscriptions;
|
|
62643
62687
|
this.lists = lists;
|
|
62644
62688
|
this.cache = cache;
|
|
62645
62689
|
this.lifetimes = lifetimes;
|
|
62690
|
+
this.schema = schema;
|
|
62646
62691
|
this._disabled = typeof globalThis.window === "undefined";
|
|
62647
62692
|
try {
|
|
62648
62693
|
if (process.env.HOUDINI_TEST === "true") {
|
|
@@ -62658,7 +62703,6 @@ var CacheInternal = class {
|
|
|
62658
62703
|
data,
|
|
62659
62704
|
selection,
|
|
62660
62705
|
variables = {},
|
|
62661
|
-
root = rootID,
|
|
62662
62706
|
parent = rootID,
|
|
62663
62707
|
applyUpdates = false,
|
|
62664
62708
|
layer,
|
|
@@ -62681,9 +62725,17 @@ var CacheInternal = class {
|
|
|
62681
62725
|
selection: fieldSelection,
|
|
62682
62726
|
operations,
|
|
62683
62727
|
abstract: isAbstract,
|
|
62684
|
-
update
|
|
62728
|
+
update,
|
|
62729
|
+
nullable
|
|
62685
62730
|
} = targetSelection[field];
|
|
62686
62731
|
const key = evaluateKey(keyRaw, variables);
|
|
62732
|
+
this.schema.setFieldType({
|
|
62733
|
+
parent,
|
|
62734
|
+
key: keyRaw,
|
|
62735
|
+
type: linkedType,
|
|
62736
|
+
nullable,
|
|
62737
|
+
link: !!fieldSelection
|
|
62738
|
+
});
|
|
62687
62739
|
const currentSubscribers = this.subscriptions.get(parent, key);
|
|
62688
62740
|
const { value: previousValue, displayLayers } = this.storage.get(parent, key);
|
|
62689
62741
|
const displayLayer = layer.isDisplayLayer(displayLayers);
|
|
@@ -62752,7 +62804,6 @@ var CacheInternal = class {
|
|
|
62752
62804
|
}
|
|
62753
62805
|
if (linkedID) {
|
|
62754
62806
|
this.writeSelection({
|
|
62755
|
-
root,
|
|
62756
62807
|
selection: fieldSelection,
|
|
62757
62808
|
parent: linkedID,
|
|
62758
62809
|
data: value,
|
|
@@ -63143,7 +63194,7 @@ var CacheInternal = class {
|
|
|
63143
63194
|
var rootID = "_ROOT_";
|
|
63144
63195
|
|
|
63145
63196
|
// src/runtime/cache/index.ts
|
|
63146
|
-
var cache_default = new
|
|
63197
|
+
var cache_default = new Cache3();
|
|
63147
63198
|
|
|
63148
63199
|
// src/runtime/lib/types.ts
|
|
63149
63200
|
var CachePolicy = /* @__PURE__ */ ((CachePolicy2) => {
|
|
@@ -63361,6 +63412,7 @@ async function writeFile(filepath, data) {
|
|
|
63361
63412
|
return;
|
|
63362
63413
|
}
|
|
63363
63414
|
if (houdini_mode.is_testing) {
|
|
63415
|
+
import_memfs.fs.mkdirpSync(dirname(filepath));
|
|
63364
63416
|
return import_memfs.fs.writeFileSync(filepath, data);
|
|
63365
63417
|
}
|
|
63366
63418
|
return await import_promises.default.writeFile(filepath, data, "utf8");
|
|
@@ -64728,7 +64780,6 @@ var Config = class {
|
|
|
64728
64780
|
rootDir;
|
|
64729
64781
|
projectRoot;
|
|
64730
64782
|
schema;
|
|
64731
|
-
apiUrl;
|
|
64732
64783
|
schemaPath;
|
|
64733
64784
|
persistedQueryPath;
|
|
64734
64785
|
exclude;
|
|
@@ -64768,7 +64819,6 @@ var Config = class {
|
|
|
64768
64819
|
schema,
|
|
64769
64820
|
schemaPath = "./schema.graphql",
|
|
64770
64821
|
exclude = [],
|
|
64771
|
-
apiUrl,
|
|
64772
64822
|
module: module2 = "esm",
|
|
64773
64823
|
scalars,
|
|
64774
64824
|
cacheBufferSize,
|
|
@@ -64799,11 +64849,6 @@ var Config = class {
|
|
|
64799
64849
|
logLevel = LogLevel.Summary;
|
|
64800
64850
|
}
|
|
64801
64851
|
this.schemaPath = schemaPath;
|
|
64802
|
-
if (apiUrl && apiUrl.startsWith("env:")) {
|
|
64803
|
-
this.apiUrl = process.env[apiUrl.slice("env:".length)];
|
|
64804
|
-
} else {
|
|
64805
|
-
this.apiUrl = apiUrl;
|
|
64806
|
-
}
|
|
64807
64852
|
this.filepath = filepath;
|
|
64808
64853
|
this.exclude = Array.isArray(exclude) ? exclude : [exclude];
|
|
64809
64854
|
this.module = module2;
|
|
@@ -64833,6 +64878,13 @@ var Config = class {
|
|
|
64833
64878
|
};
|
|
64834
64879
|
}
|
|
64835
64880
|
}
|
|
64881
|
+
async apiURL() {
|
|
64882
|
+
if (!this.configFile.apiUrl) {
|
|
64883
|
+
return "";
|
|
64884
|
+
}
|
|
64885
|
+
const env = await this.getEnv();
|
|
64886
|
+
return this.processEnvValues(env, this.configFile.apiUrl);
|
|
64887
|
+
}
|
|
64836
64888
|
get include() {
|
|
64837
64889
|
if (this.configFile.include) {
|
|
64838
64890
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
@@ -64845,23 +64897,43 @@ var Config = class {
|
|
|
64845
64897
|
pluginConfig(name) {
|
|
64846
64898
|
return this.configFile.plugins?.[name] ?? {};
|
|
64847
64899
|
}
|
|
64848
|
-
|
|
64849
|
-
|
|
64900
|
+
async getEnv() {
|
|
64901
|
+
let env = process.env;
|
|
64902
|
+
for (const plugin of this.plugins) {
|
|
64903
|
+
if (plugin.env) {
|
|
64904
|
+
env = {
|
|
64905
|
+
...await plugin.env({ config: this, env })
|
|
64906
|
+
};
|
|
64907
|
+
}
|
|
64908
|
+
}
|
|
64909
|
+
return env;
|
|
64910
|
+
}
|
|
64911
|
+
processEnvValues(env, value) {
|
|
64912
|
+
let headerValue;
|
|
64913
|
+
if (typeof value === "function") {
|
|
64914
|
+
headerValue = value(env);
|
|
64915
|
+
} else if (value.startsWith("env:")) {
|
|
64916
|
+
headerValue = env[value.slice("env:".length)];
|
|
64917
|
+
} else {
|
|
64918
|
+
headerValue = value;
|
|
64919
|
+
}
|
|
64920
|
+
return headerValue;
|
|
64921
|
+
}
|
|
64922
|
+
async pullHeaders() {
|
|
64923
|
+
const env = await this.getEnv();
|
|
64924
|
+
if (typeof this.schemaPollHeaders === "function") {
|
|
64925
|
+
return this.schemaPollHeaders(env);
|
|
64926
|
+
}
|
|
64927
|
+
const headers = Object.fromEntries(
|
|
64850
64928
|
Object.entries(this.schemaPollHeaders || {}).map(([key, value]) => {
|
|
64851
|
-
|
|
64852
|
-
if (typeof value === "function") {
|
|
64853
|
-
headerValue = value(process.env);
|
|
64854
|
-
} else if (value.startsWith("env:")) {
|
|
64855
|
-
headerValue = process.env[value.slice("env:".length)];
|
|
64856
|
-
} else {
|
|
64857
|
-
headerValue = value;
|
|
64858
|
-
}
|
|
64929
|
+
const headerValue = this.processEnvValues(env, value);
|
|
64859
64930
|
if (!headerValue) {
|
|
64860
64931
|
return [];
|
|
64861
64932
|
}
|
|
64862
64933
|
return [key, headerValue];
|
|
64863
|
-
})
|
|
64934
|
+
}).filter(([key]) => key)
|
|
64864
64935
|
);
|
|
64936
|
+
return headers;
|
|
64865
64937
|
}
|
|
64866
64938
|
async sourceFiles() {
|
|
64867
64939
|
return [
|
|
@@ -65267,9 +65339,10 @@ async function getConfig({
|
|
|
65267
65339
|
...extraConfig,
|
|
65268
65340
|
filepath: configPath
|
|
65269
65341
|
});
|
|
65342
|
+
const apiURL = await _config.apiURL();
|
|
65270
65343
|
if (_config.schemaPath && !_config.schema) {
|
|
65271
65344
|
let schemaOk = true;
|
|
65272
|
-
if (
|
|
65345
|
+
if (apiURL) {
|
|
65273
65346
|
if (glob.hasMagic(_config.schemaPath)) {
|
|
65274
65347
|
console.log(
|
|
65275
65348
|
`\u26A0\uFE0F Your houdini configuration contains an apiUrl and a path pointing to multiple files.
|
|
@@ -65277,7 +65350,7 @@ This will prevent your schema from being pulled.`
|
|
|
65277
65350
|
);
|
|
65278
65351
|
} else if (!await readFile(_config.schemaPath)) {
|
|
65279
65352
|
console.log("\u231B Pulling schema from api");
|
|
65280
|
-
schemaOk = await pullSchema(
|
|
65353
|
+
schemaOk = await pullSchema(apiURL, _config.schemaPath);
|
|
65281
65354
|
}
|
|
65282
65355
|
}
|
|
65283
65356
|
if (schemaOk && !noSchema) {
|
|
@@ -65288,10 +65361,11 @@ This will prevent your schema from being pulled.`
|
|
|
65288
65361
|
reject(e2);
|
|
65289
65362
|
throw e2;
|
|
65290
65363
|
}
|
|
65364
|
+
const plugins = [];
|
|
65291
65365
|
for (const [pluginName, plugin_config] of Object.entries(_config.configFile.plugins ?? {})) {
|
|
65292
65366
|
try {
|
|
65293
65367
|
const pluginDirectory = _config.findModule(pluginName);
|
|
65294
|
-
const { default:
|
|
65368
|
+
const { default: pluginFactory } = await import((0, import_url.pathToFileURL)(pluginDirectory).toString() + "/build/plugin-esm/index.js");
|
|
65295
65369
|
let include_runtime = false;
|
|
65296
65370
|
try {
|
|
65297
65371
|
await stat(join2(pluginDirectory, "build", "runtime-esm"));
|
|
@@ -65308,8 +65382,8 @@ This will prevent your schema from being pulled.`
|
|
|
65308
65382
|
version = packageJSON.version;
|
|
65309
65383
|
} catch {
|
|
65310
65384
|
}
|
|
65311
|
-
|
|
65312
|
-
...await
|
|
65385
|
+
plugins.push({
|
|
65386
|
+
...await pluginFactory(plugin_config),
|
|
65313
65387
|
name: pluginName,
|
|
65314
65388
|
include_runtime,
|
|
65315
65389
|
version,
|
|
@@ -65321,6 +65395,7 @@ This will prevent your schema from being pulled.`
|
|
|
65321
65395
|
);
|
|
65322
65396
|
}
|
|
65323
65397
|
}
|
|
65398
|
+
_config.plugins = orderedPlugins(plugins);
|
|
65324
65399
|
await Promise.all(_config.plugins.map((plugin) => plugin.after_load?.(_config)));
|
|
65325
65400
|
resolve2(_config);
|
|
65326
65401
|
return _config;
|
|
@@ -65332,6 +65407,16 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
|
65332
65407
|
LogLevel2["Quiet"] = "quiet";
|
|
65333
65408
|
return LogLevel2;
|
|
65334
65409
|
})(LogLevel || {});
|
|
65410
|
+
var orderedPlugins = (plugins) => {
|
|
65411
|
+
const ordered = plugins.filter(
|
|
65412
|
+
(plugin) => plugin.order === "before" || plugin.order === void 0
|
|
65413
|
+
);
|
|
65414
|
+
ordered.push(
|
|
65415
|
+
...plugins.filter((plugin) => plugin.order === "core"),
|
|
65416
|
+
...plugins.filter((plugin) => plugin.order === "after")
|
|
65417
|
+
);
|
|
65418
|
+
return ordered;
|
|
65419
|
+
};
|
|
65335
65420
|
|
|
65336
65421
|
// src/lib/graphql.ts
|
|
65337
65422
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
@@ -65640,47 +65725,69 @@ var graphql4 = __toESM(require_graphql2(), 1);
|
|
|
65640
65725
|
async function find_graphql(config, parsedScript, walker) {
|
|
65641
65726
|
await asyncWalk(parsedScript, {
|
|
65642
65727
|
async enter(node, parent) {
|
|
65643
|
-
if (node.type
|
|
65728
|
+
if (node.type !== "TaggedTemplateExpression" && node.type !== "CallExpression") {
|
|
65729
|
+
return;
|
|
65730
|
+
}
|
|
65731
|
+
let documentString;
|
|
65732
|
+
if (node.type === "TaggedTemplateExpression") {
|
|
65644
65733
|
const expr = node;
|
|
65645
|
-
|
|
65646
|
-
const parsedTag = graphql4.parse(tagContent);
|
|
65647
|
-
if (walker.where && !walker.where(parsedTag)) {
|
|
65734
|
+
if (expr.tag.type !== "Identifier" || expr.tag.name !== "graphql") {
|
|
65648
65735
|
return;
|
|
65649
65736
|
}
|
|
65650
|
-
|
|
65651
|
-
|
|
65652
|
-
|
|
65653
|
-
|
|
65737
|
+
documentString = expr.quasi.quasis[0].value.raw;
|
|
65738
|
+
} else if (node.type === "CallExpression") {
|
|
65739
|
+
const expr = node;
|
|
65740
|
+
if (expr.callee.type !== "Identifier" || expr.callee.name !== "graphql" || expr.arguments.length !== 1) {
|
|
65741
|
+
return;
|
|
65654
65742
|
}
|
|
65655
|
-
|
|
65656
|
-
if (
|
|
65657
|
-
|
|
65743
|
+
const argument = expr.arguments[0];
|
|
65744
|
+
if (argument.type === "TemplateLiteral") {
|
|
65745
|
+
documentString = argument.quasis[0].value.raw;
|
|
65746
|
+
} else if (argument.type === "StringLiteral") {
|
|
65747
|
+
documentString = argument.value;
|
|
65658
65748
|
} else {
|
|
65659
|
-
|
|
65660
|
-
kind = CompiledQueryKind;
|
|
65661
|
-
} else if (definition.operation === "mutation") {
|
|
65662
|
-
kind = CompiledMutationKind;
|
|
65663
|
-
} else {
|
|
65664
|
-
kind = CompiledSubscriptionKind;
|
|
65665
|
-
}
|
|
65749
|
+
return;
|
|
65666
65750
|
}
|
|
65667
|
-
|
|
65668
|
-
|
|
65669
|
-
parsedDocument: parsedTag,
|
|
65670
|
-
node: {
|
|
65671
|
-
...node,
|
|
65672
|
-
...this,
|
|
65673
|
-
remove: this.remove,
|
|
65674
|
-
replaceWith: this.replace
|
|
65675
|
-
},
|
|
65676
|
-
artifact: {
|
|
65677
|
-
name,
|
|
65678
|
-
kind
|
|
65679
|
-
},
|
|
65680
|
-
parent,
|
|
65681
|
-
tagContent
|
|
65682
|
-
});
|
|
65751
|
+
} else {
|
|
65752
|
+
return;
|
|
65683
65753
|
}
|
|
65754
|
+
const parsedTag = graphql4.parse(documentString);
|
|
65755
|
+
if (walker.where && !walker.where(parsedTag)) {
|
|
65756
|
+
return;
|
|
65757
|
+
}
|
|
65758
|
+
const definition = config.extractDefinition(parsedTag);
|
|
65759
|
+
const name = definition.name?.value;
|
|
65760
|
+
if (!name) {
|
|
65761
|
+
throw new Error("Could not find definition name");
|
|
65762
|
+
}
|
|
65763
|
+
let kind;
|
|
65764
|
+
if (definition.kind === "FragmentDefinition") {
|
|
65765
|
+
kind = CompiledFragmentKind;
|
|
65766
|
+
} else {
|
|
65767
|
+
if (definition.operation === "query") {
|
|
65768
|
+
kind = CompiledQueryKind;
|
|
65769
|
+
} else if (definition.operation === "mutation") {
|
|
65770
|
+
kind = CompiledMutationKind;
|
|
65771
|
+
} else {
|
|
65772
|
+
kind = CompiledSubscriptionKind;
|
|
65773
|
+
}
|
|
65774
|
+
}
|
|
65775
|
+
walker.dependency?.(config.artifactPath(parsedTag));
|
|
65776
|
+
await walker.tag({
|
|
65777
|
+
parsedDocument: parsedTag,
|
|
65778
|
+
node: {
|
|
65779
|
+
...node,
|
|
65780
|
+
...this,
|
|
65781
|
+
remove: this.remove,
|
|
65782
|
+
replaceWith: this.replace
|
|
65783
|
+
},
|
|
65784
|
+
artifact: {
|
|
65785
|
+
name,
|
|
65786
|
+
kind
|
|
65787
|
+
},
|
|
65788
|
+
parent,
|
|
65789
|
+
tagContent: documentString
|
|
65790
|
+
});
|
|
65684
65791
|
}
|
|
65685
65792
|
});
|
|
65686
65793
|
}
|
|
@@ -65714,6 +65821,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
65714
65821
|
houdini_mode,
|
|
65715
65822
|
keyFieldsForType,
|
|
65716
65823
|
operation_requires_variables,
|
|
65824
|
+
orderedPlugins,
|
|
65717
65825
|
parentTypeFromAncestors,
|
|
65718
65826
|
parseJS,
|
|
65719
65827
|
parseJSON,
|