houdini 1.5.3 → 1.5.5
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 +420 -546
- package/build/cmd-esm/index.js +270 -396
- package/build/codegen/generators/runtime/index.d.ts +2 -7
- package/build/codegen/generators/runtime/pluginRuntime.d.ts +8 -1
- package/build/codegen-cjs/index.js +389 -389
- package/build/codegen-esm/index.js +239 -239
- package/build/lib/router/conventions.d.ts +1 -1
- package/build/lib/router/manifest.d.ts +1 -1
- package/build/lib/typescript.d.ts +1 -1
- package/build/lib-cjs/index.js +666 -664
- package/build/lib-esm/index.js +666 -664
- package/build/test-cjs/index.js +398 -398
- package/build/test-esm/index.js +248 -248
- package/build/vite/imports.d.ts +2 -2
- package/build/vite-cjs/index.js +588 -587
- package/build/vite-esm/index.js +463 -462
- package/package.json +1 -1
|
@@ -52331,7 +52331,7 @@ async function runPipeline(config, pipeline, target) {
|
|
|
52331
52331
|
|
|
52332
52332
|
// src/lib/config.ts
|
|
52333
52333
|
var import_minimatch8 = __toESM(require_minimatch(), 1);
|
|
52334
|
-
import * as
|
|
52334
|
+
import * as graphql5 from "graphql";
|
|
52335
52335
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
52336
52336
|
|
|
52337
52337
|
// src/runtime/imports/config.ts
|
|
@@ -58235,10 +58235,219 @@ import * as graphql from "graphql";
|
|
|
58235
58235
|
|
|
58236
58236
|
// src/lib/router/manifest.ts
|
|
58237
58237
|
var t = __toESM(require_lib5(), 1);
|
|
58238
|
+
import * as graphql3 from "graphql";
|
|
58239
|
+
|
|
58240
|
+
// src/lib/graphql.ts
|
|
58238
58241
|
import * as graphql2 from "graphql";
|
|
58242
|
+
import crypto2 from "node:crypto";
|
|
58243
|
+
function getRootType(type) {
|
|
58244
|
+
if (graphql2.isNonNullType(type)) {
|
|
58245
|
+
return getRootType(type.ofType);
|
|
58246
|
+
}
|
|
58247
|
+
if (graphql2.isListType(type)) {
|
|
58248
|
+
return getRootType(type.ofType);
|
|
58249
|
+
}
|
|
58250
|
+
return type;
|
|
58251
|
+
}
|
|
58252
|
+
function hashOriginal({ document }) {
|
|
58253
|
+
return hashDocument(document.originalString);
|
|
58254
|
+
}
|
|
58255
|
+
function hashRaw({ document }) {
|
|
58256
|
+
return hashDocument(document.artifact?.raw);
|
|
58257
|
+
}
|
|
58258
|
+
function hashDocument(str) {
|
|
58259
|
+
return crypto2.createHash("sha256").update(str || "").digest("hex");
|
|
58260
|
+
}
|
|
58261
|
+
function parentField(ancestors) {
|
|
58262
|
+
return walkParentField([...ancestors].sort(() => -1));
|
|
58263
|
+
}
|
|
58264
|
+
function walkParentField(ancestors) {
|
|
58265
|
+
let head = ancestors.shift();
|
|
58266
|
+
if (Array.isArray(head) || head.kind === "SelectionSet") {
|
|
58267
|
+
return walkParentField(ancestors);
|
|
58268
|
+
}
|
|
58269
|
+
return head;
|
|
58270
|
+
}
|
|
58271
|
+
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
58272
|
+
const parents = [...ancestors];
|
|
58273
|
+
parents.reverse();
|
|
58274
|
+
return walkAncestors(schema, filepath, parents);
|
|
58275
|
+
}
|
|
58276
|
+
function walkAncestors(schema, filepath, ancestors) {
|
|
58277
|
+
let head = ancestors.shift();
|
|
58278
|
+
if (Array.isArray(head)) {
|
|
58279
|
+
return walkAncestors(schema, filepath, ancestors);
|
|
58280
|
+
}
|
|
58281
|
+
if (!head) {
|
|
58282
|
+
throw new HoudiniError({ filepath, message: "Could not figure out type of field" });
|
|
58283
|
+
}
|
|
58284
|
+
if (head.kind === "OperationDefinition") {
|
|
58285
|
+
const operationType = {
|
|
58286
|
+
query: schema.getQueryType(),
|
|
58287
|
+
mutation: schema.getMutationType(),
|
|
58288
|
+
subscription: schema.getSubscriptionType()
|
|
58289
|
+
}[head.operation];
|
|
58290
|
+
if (!operationType) {
|
|
58291
|
+
throw new HoudiniError({ filepath, message: "Could not find operation type" });
|
|
58292
|
+
}
|
|
58293
|
+
return operationType;
|
|
58294
|
+
}
|
|
58295
|
+
if (head.kind === "FragmentDefinition") {
|
|
58296
|
+
const result = schema.getType(head.typeCondition.name.value);
|
|
58297
|
+
if (!result) {
|
|
58298
|
+
throw new HoudiniError({
|
|
58299
|
+
filepath,
|
|
58300
|
+
message: `Could not find definition for ${head.typeCondition.name.value} in the schema`
|
|
58301
|
+
});
|
|
58302
|
+
}
|
|
58303
|
+
return result;
|
|
58304
|
+
}
|
|
58305
|
+
if (head.kind === "FragmentSpread") {
|
|
58306
|
+
throw new Error("How the hell did this happen?");
|
|
58307
|
+
}
|
|
58308
|
+
const parent2 = walkAncestors(schema, filepath, ancestors);
|
|
58309
|
+
if (head.kind === "InlineFragment") {
|
|
58310
|
+
if (!head.typeCondition) {
|
|
58311
|
+
return parent2;
|
|
58312
|
+
}
|
|
58313
|
+
const wrapper = schema.getType(head.typeCondition.name.value);
|
|
58314
|
+
if (!wrapper) {
|
|
58315
|
+
throw new HoudiniError({
|
|
58316
|
+
filepath,
|
|
58317
|
+
message: "Could not find type with name: " + head.typeCondition.name.value
|
|
58318
|
+
});
|
|
58319
|
+
}
|
|
58320
|
+
return wrapper;
|
|
58321
|
+
}
|
|
58322
|
+
if (head.kind === "SelectionSet") {
|
|
58323
|
+
return parent2;
|
|
58324
|
+
}
|
|
58325
|
+
const field = parent2.getFields()[head.name.value];
|
|
58326
|
+
if (!field) {
|
|
58327
|
+
throw new HoudiniError({
|
|
58328
|
+
filepath,
|
|
58329
|
+
message: `Could not find definition of ${head.name.value} in ${parent2.toString()}`
|
|
58330
|
+
});
|
|
58331
|
+
}
|
|
58332
|
+
return getRootType(field.type);
|
|
58333
|
+
}
|
|
58334
|
+
function definitionFromAncestors(ancestors) {
|
|
58335
|
+
let parents = [...ancestors];
|
|
58336
|
+
parents.shift();
|
|
58337
|
+
let definition = parents.shift();
|
|
58338
|
+
while (Array.isArray(definition) && definition) {
|
|
58339
|
+
definition = parents.shift();
|
|
58340
|
+
}
|
|
58341
|
+
return { parents, definition };
|
|
58342
|
+
}
|
|
58343
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
58344
|
+
if (type.kind === "NonNullType") {
|
|
58345
|
+
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
58346
|
+
}
|
|
58347
|
+
if (type instanceof graphql2.GraphQLNonNull) {
|
|
58348
|
+
return unwrapType(config, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
58349
|
+
}
|
|
58350
|
+
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
58351
|
+
wrappers.unshift(TypeWrapper.Nullable);
|
|
58352
|
+
}
|
|
58353
|
+
if (type.kind === "ListType") {
|
|
58354
|
+
return unwrapType(config, type.type, [TypeWrapper.List, ...wrappers]);
|
|
58355
|
+
}
|
|
58356
|
+
if (type instanceof graphql2.GraphQLList) {
|
|
58357
|
+
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
58358
|
+
}
|
|
58359
|
+
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
58360
|
+
type = config.schema.getType(
|
|
58361
|
+
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
58362
|
+
);
|
|
58363
|
+
}
|
|
58364
|
+
const namedType = config.schema.getType(type.name.value || type.name);
|
|
58365
|
+
if (!namedType) {
|
|
58366
|
+
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
58367
|
+
}
|
|
58368
|
+
return { type: namedType, wrappers };
|
|
58369
|
+
}
|
|
58370
|
+
function wrapType({
|
|
58371
|
+
type,
|
|
58372
|
+
wrappers
|
|
58373
|
+
}) {
|
|
58374
|
+
const head = wrappers[0];
|
|
58375
|
+
const tail = wrappers.slice(1);
|
|
58376
|
+
let kind = graphql2.Kind.NAMED_TYPE;
|
|
58377
|
+
if (head === TypeWrapper.List) {
|
|
58378
|
+
kind = graphql2.Kind.LIST_TYPE;
|
|
58379
|
+
} else if (head === TypeWrapper.NonNull) {
|
|
58380
|
+
kind = graphql2.Kind.NON_NULL_TYPE;
|
|
58381
|
+
}
|
|
58382
|
+
if (kind === "NamedType") {
|
|
58383
|
+
return {
|
|
58384
|
+
kind,
|
|
58385
|
+
name: {
|
|
58386
|
+
kind: graphql2.Kind.NAME,
|
|
58387
|
+
value: type.name
|
|
58388
|
+
}
|
|
58389
|
+
};
|
|
58390
|
+
}
|
|
58391
|
+
return {
|
|
58392
|
+
kind,
|
|
58393
|
+
type: wrapType({ type, wrappers: tail })
|
|
58394
|
+
};
|
|
58395
|
+
}
|
|
58396
|
+
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
58397
|
+
TypeWrapper2["Nullable"] = "Nullable";
|
|
58398
|
+
TypeWrapper2["List"] = "List";
|
|
58399
|
+
TypeWrapper2["NonNull"] = "NonNull";
|
|
58400
|
+
return TypeWrapper2;
|
|
58401
|
+
})(TypeWrapper || {});
|
|
58402
|
+
|
|
58403
|
+
// src/lib/parse.ts
|
|
58404
|
+
var import_parser = __toESM(require_lib6(), 1);
|
|
58405
|
+
var import_recast = __toESM(require_main2(), 1);
|
|
58406
|
+
|
|
58407
|
+
// src/lib/deepMerge.ts
|
|
58408
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
58409
|
+
function deepMerge2(filepath, ...targets) {
|
|
58410
|
+
try {
|
|
58411
|
+
if (targets.length === 1) {
|
|
58412
|
+
return targets[0];
|
|
58413
|
+
} else if (targets.length === 2) {
|
|
58414
|
+
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
58415
|
+
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
58416
|
+
});
|
|
58417
|
+
}
|
|
58418
|
+
return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
|
|
58419
|
+
} catch (e) {
|
|
58420
|
+
throw new HoudiniError({
|
|
58421
|
+
filepath,
|
|
58422
|
+
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
58423
|
+
description: e.message
|
|
58424
|
+
});
|
|
58425
|
+
}
|
|
58426
|
+
}
|
|
58427
|
+
|
|
58428
|
+
// src/lib/parse.ts
|
|
58429
|
+
function parseJS(str, config) {
|
|
58430
|
+
const defaultConfig = {
|
|
58431
|
+
plugins: [
|
|
58432
|
+
"typescript",
|
|
58433
|
+
"importAssertions",
|
|
58434
|
+
"decorators-legacy",
|
|
58435
|
+
"explicitResourceManagement"
|
|
58436
|
+
],
|
|
58437
|
+
sourceType: "module"
|
|
58438
|
+
};
|
|
58439
|
+
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
58440
|
+
}
|
|
58441
|
+
async function printJS(script, options) {
|
|
58442
|
+
if (options?.pretty) {
|
|
58443
|
+
return (0, import_recast.prettyPrint)(script, options);
|
|
58444
|
+
} else {
|
|
58445
|
+
return (0, import_recast.print)(script, options);
|
|
58446
|
+
}
|
|
58447
|
+
}
|
|
58239
58448
|
|
|
58240
58449
|
// src/lib/router/server.ts
|
|
58241
|
-
import * as
|
|
58450
|
+
import * as graphql4 from "graphql";
|
|
58242
58451
|
|
|
58243
58452
|
// src/runtime/lib/flatten.ts
|
|
58244
58453
|
function flatten(source) {
|
|
@@ -60582,218 +60791,9 @@ var LogLevel = {
|
|
|
60582
60791
|
// src/lib/config.ts
|
|
60583
60792
|
var currentDir = dirname(fileURLToPath3(import.meta.url));
|
|
60584
60793
|
var DEFAULT_CONFIG_PATH = join(process.cwd(), "houdini.config.js");
|
|
60585
|
-
var emptySchema =
|
|
60794
|
+
var emptySchema = graphql5.buildSchema("type Query { hello: String }");
|
|
60586
60795
|
var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
|
|
60587
60796
|
|
|
60588
|
-
// src/lib/graphql.ts
|
|
60589
|
-
import * as graphql5 from "graphql";
|
|
60590
|
-
import crypto2 from "node:crypto";
|
|
60591
|
-
function getRootType(type) {
|
|
60592
|
-
if (graphql5.isNonNullType(type)) {
|
|
60593
|
-
return getRootType(type.ofType);
|
|
60594
|
-
}
|
|
60595
|
-
if (graphql5.isListType(type)) {
|
|
60596
|
-
return getRootType(type.ofType);
|
|
60597
|
-
}
|
|
60598
|
-
return type;
|
|
60599
|
-
}
|
|
60600
|
-
function hashOriginal({ document }) {
|
|
60601
|
-
return hashDocument(document.originalString);
|
|
60602
|
-
}
|
|
60603
|
-
function hashRaw({ document }) {
|
|
60604
|
-
return hashDocument(document.artifact?.raw);
|
|
60605
|
-
}
|
|
60606
|
-
function hashDocument(str) {
|
|
60607
|
-
return crypto2.createHash("sha256").update(str || "").digest("hex");
|
|
60608
|
-
}
|
|
60609
|
-
function parentField(ancestors) {
|
|
60610
|
-
return walkParentField([...ancestors].sort(() => -1));
|
|
60611
|
-
}
|
|
60612
|
-
function walkParentField(ancestors) {
|
|
60613
|
-
let head = ancestors.shift();
|
|
60614
|
-
if (Array.isArray(head) || head.kind === "SelectionSet") {
|
|
60615
|
-
return walkParentField(ancestors);
|
|
60616
|
-
}
|
|
60617
|
-
return head;
|
|
60618
|
-
}
|
|
60619
|
-
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
60620
|
-
const parents = [...ancestors];
|
|
60621
|
-
parents.reverse();
|
|
60622
|
-
return walkAncestors(schema, filepath, parents);
|
|
60623
|
-
}
|
|
60624
|
-
function walkAncestors(schema, filepath, ancestors) {
|
|
60625
|
-
let head = ancestors.shift();
|
|
60626
|
-
if (Array.isArray(head)) {
|
|
60627
|
-
return walkAncestors(schema, filepath, ancestors);
|
|
60628
|
-
}
|
|
60629
|
-
if (!head) {
|
|
60630
|
-
throw new HoudiniError({ filepath, message: "Could not figure out type of field" });
|
|
60631
|
-
}
|
|
60632
|
-
if (head.kind === "OperationDefinition") {
|
|
60633
|
-
const operationType = {
|
|
60634
|
-
query: schema.getQueryType(),
|
|
60635
|
-
mutation: schema.getMutationType(),
|
|
60636
|
-
subscription: schema.getSubscriptionType()
|
|
60637
|
-
}[head.operation];
|
|
60638
|
-
if (!operationType) {
|
|
60639
|
-
throw new HoudiniError({ filepath, message: "Could not find operation type" });
|
|
60640
|
-
}
|
|
60641
|
-
return operationType;
|
|
60642
|
-
}
|
|
60643
|
-
if (head.kind === "FragmentDefinition") {
|
|
60644
|
-
const result = schema.getType(head.typeCondition.name.value);
|
|
60645
|
-
if (!result) {
|
|
60646
|
-
throw new HoudiniError({
|
|
60647
|
-
filepath,
|
|
60648
|
-
message: `Could not find definition for ${head.typeCondition.name.value} in the schema`
|
|
60649
|
-
});
|
|
60650
|
-
}
|
|
60651
|
-
return result;
|
|
60652
|
-
}
|
|
60653
|
-
if (head.kind === "FragmentSpread") {
|
|
60654
|
-
throw new Error("How the hell did this happen?");
|
|
60655
|
-
}
|
|
60656
|
-
const parent2 = walkAncestors(schema, filepath, ancestors);
|
|
60657
|
-
if (head.kind === "InlineFragment") {
|
|
60658
|
-
if (!head.typeCondition) {
|
|
60659
|
-
return parent2;
|
|
60660
|
-
}
|
|
60661
|
-
const wrapper = schema.getType(head.typeCondition.name.value);
|
|
60662
|
-
if (!wrapper) {
|
|
60663
|
-
throw new HoudiniError({
|
|
60664
|
-
filepath,
|
|
60665
|
-
message: "Could not find type with name: " + head.typeCondition.name.value
|
|
60666
|
-
});
|
|
60667
|
-
}
|
|
60668
|
-
return wrapper;
|
|
60669
|
-
}
|
|
60670
|
-
if (head.kind === "SelectionSet") {
|
|
60671
|
-
return parent2;
|
|
60672
|
-
}
|
|
60673
|
-
const field = parent2.getFields()[head.name.value];
|
|
60674
|
-
if (!field) {
|
|
60675
|
-
throw new HoudiniError({
|
|
60676
|
-
filepath,
|
|
60677
|
-
message: `Could not find definition of ${head.name.value} in ${parent2.toString()}`
|
|
60678
|
-
});
|
|
60679
|
-
}
|
|
60680
|
-
return getRootType(field.type);
|
|
60681
|
-
}
|
|
60682
|
-
function definitionFromAncestors(ancestors) {
|
|
60683
|
-
let parents = [...ancestors];
|
|
60684
|
-
parents.shift();
|
|
60685
|
-
let definition = parents.shift();
|
|
60686
|
-
while (Array.isArray(definition) && definition) {
|
|
60687
|
-
definition = parents.shift();
|
|
60688
|
-
}
|
|
60689
|
-
return { parents, definition };
|
|
60690
|
-
}
|
|
60691
|
-
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
60692
|
-
if (type.kind === "NonNullType") {
|
|
60693
|
-
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
60694
|
-
}
|
|
60695
|
-
if (type instanceof graphql5.GraphQLNonNull) {
|
|
60696
|
-
return unwrapType(config, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
60697
|
-
}
|
|
60698
|
-
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
60699
|
-
wrappers.unshift(TypeWrapper.Nullable);
|
|
60700
|
-
}
|
|
60701
|
-
if (type.kind === "ListType") {
|
|
60702
|
-
return unwrapType(config, type.type, [TypeWrapper.List, ...wrappers]);
|
|
60703
|
-
}
|
|
60704
|
-
if (type instanceof graphql5.GraphQLList) {
|
|
60705
|
-
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
60706
|
-
}
|
|
60707
|
-
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
60708
|
-
type = config.schema.getType(
|
|
60709
|
-
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
60710
|
-
);
|
|
60711
|
-
}
|
|
60712
|
-
const namedType = config.schema.getType(type.name.value || type.name);
|
|
60713
|
-
if (!namedType) {
|
|
60714
|
-
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
60715
|
-
}
|
|
60716
|
-
return { type: namedType, wrappers };
|
|
60717
|
-
}
|
|
60718
|
-
function wrapType({
|
|
60719
|
-
type,
|
|
60720
|
-
wrappers
|
|
60721
|
-
}) {
|
|
60722
|
-
const head = wrappers[0];
|
|
60723
|
-
const tail = wrappers.slice(1);
|
|
60724
|
-
let kind = graphql5.Kind.NAMED_TYPE;
|
|
60725
|
-
if (head === TypeWrapper.List) {
|
|
60726
|
-
kind = graphql5.Kind.LIST_TYPE;
|
|
60727
|
-
} else if (head === TypeWrapper.NonNull) {
|
|
60728
|
-
kind = graphql5.Kind.NON_NULL_TYPE;
|
|
60729
|
-
}
|
|
60730
|
-
if (kind === "NamedType") {
|
|
60731
|
-
return {
|
|
60732
|
-
kind,
|
|
60733
|
-
name: {
|
|
60734
|
-
kind: graphql5.Kind.NAME,
|
|
60735
|
-
value: type.name
|
|
60736
|
-
}
|
|
60737
|
-
};
|
|
60738
|
-
}
|
|
60739
|
-
return {
|
|
60740
|
-
kind,
|
|
60741
|
-
type: wrapType({ type, wrappers: tail })
|
|
60742
|
-
};
|
|
60743
|
-
}
|
|
60744
|
-
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
60745
|
-
TypeWrapper2["Nullable"] = "Nullable";
|
|
60746
|
-
TypeWrapper2["List"] = "List";
|
|
60747
|
-
TypeWrapper2["NonNull"] = "NonNull";
|
|
60748
|
-
return TypeWrapper2;
|
|
60749
|
-
})(TypeWrapper || {});
|
|
60750
|
-
|
|
60751
|
-
// src/lib/parse.ts
|
|
60752
|
-
var import_parser = __toESM(require_lib6(), 1);
|
|
60753
|
-
var import_recast = __toESM(require_main2(), 1);
|
|
60754
|
-
|
|
60755
|
-
// src/lib/deepMerge.ts
|
|
60756
|
-
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
60757
|
-
function deepMerge2(filepath, ...targets) {
|
|
60758
|
-
try {
|
|
60759
|
-
if (targets.length === 1) {
|
|
60760
|
-
return targets[0];
|
|
60761
|
-
} else if (targets.length === 2) {
|
|
60762
|
-
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
60763
|
-
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
60764
|
-
});
|
|
60765
|
-
}
|
|
60766
|
-
return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
|
|
60767
|
-
} catch (e) {
|
|
60768
|
-
throw new HoudiniError({
|
|
60769
|
-
filepath,
|
|
60770
|
-
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
60771
|
-
description: e.message
|
|
60772
|
-
});
|
|
60773
|
-
}
|
|
60774
|
-
}
|
|
60775
|
-
|
|
60776
|
-
// src/lib/parse.ts
|
|
60777
|
-
function parseJS(str, config) {
|
|
60778
|
-
const defaultConfig = {
|
|
60779
|
-
plugins: [
|
|
60780
|
-
"typescript",
|
|
60781
|
-
"importAssertions",
|
|
60782
|
-
"decorators-legacy",
|
|
60783
|
-
"explicitResourceManagement"
|
|
60784
|
-
],
|
|
60785
|
-
sourceType: "module"
|
|
60786
|
-
};
|
|
60787
|
-
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
60788
|
-
}
|
|
60789
|
-
async function printJS(script, options) {
|
|
60790
|
-
if (options?.pretty) {
|
|
60791
|
-
return (0, import_recast.prettyPrint)(script, options);
|
|
60792
|
-
} else {
|
|
60793
|
-
return (0, import_recast.print)(script, options);
|
|
60794
|
-
}
|
|
60795
|
-
}
|
|
60796
|
-
|
|
60797
60797
|
// src/lib/imports.ts
|
|
60798
60798
|
var recast = __toESM(require_main2(), 1);
|
|
60799
60799
|
var AST2 = recast.types.builders;
|
|
@@ -60922,18 +60922,18 @@ function scalarPropertyValue(config, filepath, missingScalars, target, body, fie
|
|
|
60922
60922
|
return AST3.tsNeverKeyword();
|
|
60923
60923
|
}
|
|
60924
60924
|
const component = config.componentFields[field.parent][field.field];
|
|
60925
|
-
const sourcePathRelative =
|
|
60926
|
-
|
|
60925
|
+
const sourcePathRelative = relative(
|
|
60926
|
+
join(config.projectRoot, "src"),
|
|
60927
60927
|
component.filepath
|
|
60928
60928
|
);
|
|
60929
|
-
let sourcePathParsed =
|
|
60930
|
-
let sourcePath =
|
|
60929
|
+
let sourcePathParsed = parse(sourcePathRelative);
|
|
60930
|
+
let sourcePath = join(sourcePathParsed.dir, sourcePathParsed.name);
|
|
60931
60931
|
const localImport = ensureImports({
|
|
60932
60932
|
config,
|
|
60933
60933
|
body,
|
|
60934
60934
|
import: "__component__" + component.fragment,
|
|
60935
|
-
sourceModule:
|
|
60936
|
-
|
|
60935
|
+
sourceModule: join(
|
|
60936
|
+
relative(dirname(filepath), config.projectRoot),
|
|
60937
60937
|
"src",
|
|
60938
60938
|
sourcePath
|
|
60939
60939
|
)
|
|
@@ -63848,6 +63848,16 @@ async function generatePluginIndex({
|
|
|
63848
63848
|
}
|
|
63849
63849
|
|
|
63850
63850
|
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
63851
|
+
function moduleStatments(config) {
|
|
63852
|
+
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
63853
|
+
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
63854
|
+
const exportStarStatement = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
63855
|
+
return {
|
|
63856
|
+
importStatement,
|
|
63857
|
+
exportDefaultStatement,
|
|
63858
|
+
exportStarStatement
|
|
63859
|
+
};
|
|
63860
|
+
}
|
|
63851
63861
|
async function generatePluginRuntimes({
|
|
63852
63862
|
config,
|
|
63853
63863
|
docs
|
|
@@ -63863,7 +63873,7 @@ async function generatePluginRuntimes({
|
|
|
63863
63873
|
return;
|
|
63864
63874
|
}
|
|
63865
63875
|
try {
|
|
63866
|
-
await
|
|
63876
|
+
await stat(runtime_path);
|
|
63867
63877
|
} catch {
|
|
63868
63878
|
throw new HoudiniError({
|
|
63869
63879
|
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
@@ -63875,13 +63885,13 @@ async function generatePluginRuntimes({
|
|
|
63875
63885
|
if (transformMap && typeof transformMap === "function") {
|
|
63876
63886
|
transformMap = transformMap(docs, { config });
|
|
63877
63887
|
}
|
|
63878
|
-
await
|
|
63879
|
-
await
|
|
63888
|
+
await mkdirp(pluginDir);
|
|
63889
|
+
await recursiveCopy(
|
|
63880
63890
|
runtime_path,
|
|
63881
63891
|
pluginDir,
|
|
63882
63892
|
Object.fromEntries(
|
|
63883
63893
|
Object.entries(transformMap).map(([key, value]) => [
|
|
63884
|
-
|
|
63894
|
+
join(runtime_path, key),
|
|
63885
63895
|
(content) => value({
|
|
63886
63896
|
config,
|
|
63887
63897
|
content,
|
|
@@ -63928,21 +63938,21 @@ async function runtimeGenerator(config, docs) {
|
|
|
63928
63938
|
exportStarStatement: exportStar
|
|
63929
63939
|
} = moduleStatments(config);
|
|
63930
63940
|
await Promise.all([
|
|
63931
|
-
|
|
63932
|
-
[
|
|
63941
|
+
recursiveCopy(config.runtimeSource, config.runtimeDirectory, {
|
|
63942
|
+
[join(config.runtimeSource, "lib", "constants.js")]: (content) => {
|
|
63933
63943
|
return content.replace("SITE_URL", siteURL);
|
|
63934
63944
|
},
|
|
63935
|
-
[
|
|
63945
|
+
[join(config.runtimeSource, "imports", "pluginConfig.js")]: (content) => {
|
|
63936
63946
|
return injectConfig({ config, importStatement, exportStatement, content });
|
|
63937
63947
|
},
|
|
63938
|
-
[
|
|
63939
|
-
const configFilePath =
|
|
63940
|
-
const relativePath =
|
|
63948
|
+
[join(config.runtimeSource, "imports", "config.js")]: (content) => {
|
|
63949
|
+
const configFilePath = join(config.runtimeDirectory, "imports", "config.js");
|
|
63950
|
+
const relativePath = relative(dirname(configFilePath), config.filepath);
|
|
63941
63951
|
return `${importStatement(relativePath, "config")}
|
|
63942
63952
|
${exportStatement("config")}
|
|
63943
63953
|
`;
|
|
63944
63954
|
},
|
|
63945
|
-
[
|
|
63955
|
+
[join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
63946
63956
|
}),
|
|
63947
63957
|
generatePluginRuntimes({
|
|
63948
63958
|
config,
|
|
@@ -63952,16 +63962,6 @@ ${exportStatement("config")}
|
|
|
63952
63962
|
]);
|
|
63953
63963
|
await generateGraphqlReturnTypes(config, docs);
|
|
63954
63964
|
}
|
|
63955
|
-
function moduleStatments(config) {
|
|
63956
|
-
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
63957
|
-
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
63958
|
-
const exportStarStatement = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
|
|
63959
|
-
return {
|
|
63960
|
-
importStatement,
|
|
63961
|
-
exportDefaultStatement,
|
|
63962
|
-
exportStarStatement
|
|
63963
|
-
};
|
|
63964
|
-
}
|
|
63965
63965
|
|
|
63966
63966
|
// src/codegen/generators/typescript/documentTypes.ts
|
|
63967
63967
|
var recast11 = __toESM(require_main2(), 1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Config } from '..';
|
|
2
1
|
import type { ProjectManifest, PageManifest, QueryManifest } from '../../runtime/lib/types';
|
|
2
|
+
import type { Config } from '../config';
|
|
3
3
|
export type { ProjectManifest, PageManifest, QueryManifest };
|
|
4
4
|
/**
|
|
5
5
|
* Walk down the routes directory and build a normalized description of the project's
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StatementKind, TSTypeKind } from 'ast-types/lib/gen/kinds';
|
|
2
2
|
import * as graphql from 'graphql';
|
|
3
3
|
import * as recast from 'recast';
|
|
4
|
-
import {
|
|
4
|
+
import type { Config } from './config';
|
|
5
5
|
import { TypeWrapper } from './graphql';
|
|
6
6
|
export declare function unwrappedTsTypeReference(config: Config, filepath: string, missingScalars: Set<string>, { type, wrappers, }: {
|
|
7
7
|
type: graphql.GraphQLNamedType;
|