houdini-svelte 2.2.0-next.5 → 3.0.0-next.10
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/plugin/config.d.ts +0 -10
- package/build/plugin/kit.d.ts +1 -3
- package/build/plugin-cjs/index.js +53 -345
- package/build/plugin-esm/index.js +53 -345
- package/build/preprocess-cjs/index.js +16 -57
- package/build/preprocess-esm/index.js +16 -57
- package/build/test-cjs/index.js +140 -407
- package/build/test-esm/index.js +140 -407
- package/package.json +2 -2
- package/build/plugin/fsPatch.d.ts +0 -27
|
@@ -2373,7 +2373,7 @@ var require_path_visitor2 = __commonJS({
|
|
|
2373
2373
|
}
|
|
2374
2374
|
return target;
|
|
2375
2375
|
}
|
|
2376
|
-
PathVisitor.visit = function
|
|
2376
|
+
PathVisitor.visit = function visit23(node, methods) {
|
|
2377
2377
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
2378
2378
|
};
|
|
2379
2379
|
var PVp = PathVisitor.prototype;
|
|
@@ -2564,7 +2564,7 @@ var require_path_visitor2 = __commonJS({
|
|
|
2564
2564
|
this.needToCallTraverse = false;
|
|
2565
2565
|
return visitChildren(path5, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
2566
2566
|
};
|
|
2567
|
-
sharedContextProtoMethods.visit = function
|
|
2567
|
+
sharedContextProtoMethods.visit = function visit23(path5, newVisitor) {
|
|
2568
2568
|
if (!(this instanceof this.Context)) {
|
|
2569
2569
|
throw new Error("");
|
|
2570
2570
|
}
|
|
@@ -4006,7 +4006,7 @@ var require_main3 = __commonJS({
|
|
|
4006
4006
|
var someField = _a.someField;
|
|
4007
4007
|
var Type = _a.Type;
|
|
4008
4008
|
var use = _a.use;
|
|
4009
|
-
var
|
|
4009
|
+
var visit23 = _a.visit;
|
|
4010
4010
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
4011
4011
|
exports.builders = builders;
|
|
4012
4012
|
exports.builtInTypes = builtInTypes;
|
|
@@ -4023,7 +4023,7 @@ var require_main3 = __commonJS({
|
|
|
4023
4023
|
exports.someField = someField;
|
|
4024
4024
|
exports.Type = Type;
|
|
4025
4025
|
exports.use = use;
|
|
4026
|
-
exports.visit =
|
|
4026
|
+
exports.visit = visit23;
|
|
4027
4027
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
4028
4028
|
}
|
|
4029
4029
|
});
|
|
@@ -6102,7 +6102,7 @@ var require_esprima5 = __commonJS({
|
|
|
6102
6102
|
var jsx_parser_1 = __webpack_require__(3);
|
|
6103
6103
|
var parser_1 = __webpack_require__(8);
|
|
6104
6104
|
var tokenizer_1 = __webpack_require__(15);
|
|
6105
|
-
function
|
|
6105
|
+
function parse13(code, options, delegate) {
|
|
6106
6106
|
var commentHandler = null;
|
|
6107
6107
|
var proxyDelegate = function(node, metadata) {
|
|
6108
6108
|
if (delegate) {
|
|
@@ -6147,17 +6147,17 @@ var require_esprima5 = __commonJS({
|
|
|
6147
6147
|
}
|
|
6148
6148
|
return ast;
|
|
6149
6149
|
}
|
|
6150
|
-
exports2.parse =
|
|
6150
|
+
exports2.parse = parse13;
|
|
6151
6151
|
function parseModule(code, options, delegate) {
|
|
6152
6152
|
var parsingOptions = options || {};
|
|
6153
6153
|
parsingOptions.sourceType = "module";
|
|
6154
|
-
return
|
|
6154
|
+
return parse13(code, parsingOptions, delegate);
|
|
6155
6155
|
}
|
|
6156
6156
|
exports2.parseModule = parseModule;
|
|
6157
6157
|
function parseScript(code, options, delegate) {
|
|
6158
6158
|
var parsingOptions = options || {};
|
|
6159
6159
|
parsingOptions.sourceType = "script";
|
|
6160
|
-
return
|
|
6160
|
+
return parse13(code, parsingOptions, delegate);
|
|
6161
6161
|
}
|
|
6162
6162
|
exports2.parseScript = parseScript;
|
|
6163
6163
|
function tokenize(code, options, delegate) {
|
|
@@ -12297,7 +12297,7 @@ var require_esprima6 = __commonJS({
|
|
|
12297
12297
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12298
12298
|
exports.parse = void 0;
|
|
12299
12299
|
var util_1 = require_util4();
|
|
12300
|
-
function
|
|
12300
|
+
function parse13(source, options) {
|
|
12301
12301
|
var comments = [];
|
|
12302
12302
|
var ast = require_esprima5().parse(source, {
|
|
12303
12303
|
loc: true,
|
|
@@ -12315,7 +12315,7 @@ var require_esprima6 = __commonJS({
|
|
|
12315
12315
|
}
|
|
12316
12316
|
return ast;
|
|
12317
12317
|
}
|
|
12318
|
-
exports.parse =
|
|
12318
|
+
exports.parse = parse13;
|
|
12319
12319
|
}
|
|
12320
12320
|
});
|
|
12321
12321
|
|
|
@@ -13453,7 +13453,7 @@ var require_parser2 = __commonJS({
|
|
|
13453
13453
|
var lines_1 = require_lines2();
|
|
13454
13454
|
var comments_1 = require_comments2();
|
|
13455
13455
|
var util = tslib_1.__importStar(require_util4());
|
|
13456
|
-
function
|
|
13456
|
+
function parse13(source, options) {
|
|
13457
13457
|
options = (0, options_1.normalize)(options);
|
|
13458
13458
|
var lines = (0, lines_1.fromString)(source, options);
|
|
13459
13459
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -13525,7 +13525,7 @@ var require_parser2 = __commonJS({
|
|
|
13525
13525
|
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
|
|
13526
13526
|
return new TreeCopier(lines, tokens).copy(file);
|
|
13527
13527
|
}
|
|
13528
|
-
exports.parse =
|
|
13528
|
+
exports.parse = parse13;
|
|
13529
13529
|
var TreeCopier = function TreeCopier2(lines, tokens) {
|
|
13530
13530
|
assert_1.default.ok(this instanceof TreeCopier2);
|
|
13531
13531
|
this.lines = lines;
|
|
@@ -19598,7 +19598,7 @@ var require_jsonfile = __commonJS2({
|
|
|
19598
19598
|
}
|
|
19599
19599
|
var universalify = require_universalify();
|
|
19600
19600
|
var { stringify, stripBom } = require_utils2();
|
|
19601
|
-
async function
|
|
19601
|
+
async function _readFile(file, options = {}) {
|
|
19602
19602
|
if (typeof options === "string") {
|
|
19603
19603
|
options = { encoding: options };
|
|
19604
19604
|
}
|
|
@@ -19619,7 +19619,7 @@ var require_jsonfile = __commonJS2({
|
|
|
19619
19619
|
}
|
|
19620
19620
|
return obj;
|
|
19621
19621
|
}
|
|
19622
|
-
var readFile22 = universalify.fromPromise(
|
|
19622
|
+
var readFile22 = universalify.fromPromise(_readFile);
|
|
19623
19623
|
function readFileSync22(file, options = {}) {
|
|
19624
19624
|
if (typeof options === "string") {
|
|
19625
19625
|
options = { encoding: options };
|
|
@@ -20373,49 +20373,49 @@ var require_Dirent = __commonJS2({
|
|
|
20373
20373
|
var S_IFLNK = constants_1.constants.S_IFLNK;
|
|
20374
20374
|
var S_IFIFO = constants_1.constants.S_IFIFO;
|
|
20375
20375
|
var S_IFSOCK = constants_1.constants.S_IFSOCK;
|
|
20376
|
-
var
|
|
20376
|
+
var Dirent = (
|
|
20377
20377
|
/** @class */
|
|
20378
20378
|
function() {
|
|
20379
|
-
function
|
|
20379
|
+
function Dirent2() {
|
|
20380
20380
|
this.name = "";
|
|
20381
20381
|
this.mode = 0;
|
|
20382
20382
|
}
|
|
20383
|
-
|
|
20384
|
-
var dirent = new
|
|
20383
|
+
Dirent2.build = function(link, encoding) {
|
|
20384
|
+
var dirent = new Dirent2();
|
|
20385
20385
|
var mode = link.getNode().mode;
|
|
20386
20386
|
dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding);
|
|
20387
20387
|
dirent.mode = mode;
|
|
20388
20388
|
return dirent;
|
|
20389
20389
|
};
|
|
20390
|
-
|
|
20390
|
+
Dirent2.prototype._checkModeProperty = function(property) {
|
|
20391
20391
|
return (this.mode & S_IFMT) === property;
|
|
20392
20392
|
};
|
|
20393
|
-
|
|
20393
|
+
Dirent2.prototype.isDirectory = function() {
|
|
20394
20394
|
return this._checkModeProperty(S_IFDIR);
|
|
20395
20395
|
};
|
|
20396
|
-
|
|
20396
|
+
Dirent2.prototype.isFile = function() {
|
|
20397
20397
|
return this._checkModeProperty(S_IFREG);
|
|
20398
20398
|
};
|
|
20399
|
-
|
|
20399
|
+
Dirent2.prototype.isBlockDevice = function() {
|
|
20400
20400
|
return this._checkModeProperty(S_IFBLK);
|
|
20401
20401
|
};
|
|
20402
|
-
|
|
20402
|
+
Dirent2.prototype.isCharacterDevice = function() {
|
|
20403
20403
|
return this._checkModeProperty(S_IFCHR);
|
|
20404
20404
|
};
|
|
20405
|
-
|
|
20405
|
+
Dirent2.prototype.isSymbolicLink = function() {
|
|
20406
20406
|
return this._checkModeProperty(S_IFLNK);
|
|
20407
20407
|
};
|
|
20408
|
-
|
|
20408
|
+
Dirent2.prototype.isFIFO = function() {
|
|
20409
20409
|
return this._checkModeProperty(S_IFIFO);
|
|
20410
20410
|
};
|
|
20411
|
-
|
|
20411
|
+
Dirent2.prototype.isSocket = function() {
|
|
20412
20412
|
return this._checkModeProperty(S_IFSOCK);
|
|
20413
20413
|
};
|
|
20414
|
-
return
|
|
20414
|
+
return Dirent2;
|
|
20415
20415
|
}()
|
|
20416
20416
|
);
|
|
20417
|
-
exports.Dirent =
|
|
20418
|
-
exports.default =
|
|
20417
|
+
exports.Dirent = Dirent;
|
|
20418
|
+
exports.default = Dirent;
|
|
20419
20419
|
}
|
|
20420
20420
|
});
|
|
20421
20421
|
var require_setImmediate = __commonJS2({
|
|
@@ -85294,15 +85294,6 @@ function serialized_manifest_path(config, base = base_dir(config)) {
|
|
|
85294
85294
|
return join2(base, "manifest.json");
|
|
85295
85295
|
}
|
|
85296
85296
|
var t2 = __toESM2(require_lib5(), 1);
|
|
85297
|
-
function definitionFromAncestors(ancestors) {
|
|
85298
|
-
let parents = [...ancestors];
|
|
85299
|
-
parents.shift();
|
|
85300
|
-
let definition = parents.shift();
|
|
85301
|
-
while (Array.isArray(definition) && definition) {
|
|
85302
|
-
definition = parents.shift();
|
|
85303
|
-
}
|
|
85304
|
-
return { parents, definition };
|
|
85305
|
-
}
|
|
85306
85297
|
function formatErrors(e22, afterError) {
|
|
85307
85298
|
const errors = Array.isArray(e22) ? e22 : [e22];
|
|
85308
85299
|
for (const error of errors) {
|
|
@@ -88513,8 +88504,6 @@ function plugin_config(config) {
|
|
|
88513
88504
|
return {
|
|
88514
88505
|
client: "./src/client",
|
|
88515
88506
|
defaultRouteBlocking: false,
|
|
88516
|
-
pageQueryFilename: "+page.gql",
|
|
88517
|
-
layoutQueryFilename: "+layout.gql",
|
|
88518
88507
|
static: false,
|
|
88519
88508
|
forceRunesMode: false,
|
|
88520
88509
|
...cfg,
|
|
@@ -88532,9 +88521,6 @@ function plugin_config(config) {
|
|
|
88532
88521
|
};
|
|
88533
88522
|
}
|
|
88534
88523
|
|
|
88535
|
-
// src/plugin/kit.ts
|
|
88536
|
-
import * as graphql37 from "graphql";
|
|
88537
|
-
|
|
88538
88524
|
// ../houdini/build/vite-esm/index.js
|
|
88539
88525
|
import { createRequire as conflict_free2 } from "module";
|
|
88540
88526
|
import { statSync as statSync2, createReadStream as createReadStream2, promises as fs22 } from "node:fs";
|
|
@@ -91528,7 +91514,7 @@ var require_jsonfile3 = __commonJS3({
|
|
|
91528
91514
|
}
|
|
91529
91515
|
var universalify = require_universalify2();
|
|
91530
91516
|
var { stringify, stripBom } = require_utils22();
|
|
91531
|
-
async function
|
|
91517
|
+
async function _readFile(file, options = {}) {
|
|
91532
91518
|
if (typeof options === "string") {
|
|
91533
91519
|
options = { encoding: options };
|
|
91534
91520
|
}
|
|
@@ -91549,7 +91535,7 @@ var require_jsonfile3 = __commonJS3({
|
|
|
91549
91535
|
}
|
|
91550
91536
|
return obj;
|
|
91551
91537
|
}
|
|
91552
|
-
var readFile22 = universalify.fromPromise(
|
|
91538
|
+
var readFile22 = universalify.fromPromise(_readFile);
|
|
91553
91539
|
function readFileSync22(file, options = {}) {
|
|
91554
91540
|
if (typeof options === "string") {
|
|
91555
91541
|
options = { encoding: options };
|
|
@@ -92303,49 +92289,49 @@ var require_Dirent2 = __commonJS3({
|
|
|
92303
92289
|
var S_IFLNK = constants_1.constants.S_IFLNK;
|
|
92304
92290
|
var S_IFIFO = constants_1.constants.S_IFIFO;
|
|
92305
92291
|
var S_IFSOCK = constants_1.constants.S_IFSOCK;
|
|
92306
|
-
var
|
|
92292
|
+
var Dirent = (
|
|
92307
92293
|
/** @class */
|
|
92308
92294
|
function() {
|
|
92309
|
-
function
|
|
92295
|
+
function Dirent2() {
|
|
92310
92296
|
this.name = "";
|
|
92311
92297
|
this.mode = 0;
|
|
92312
92298
|
}
|
|
92313
|
-
|
|
92314
|
-
var dirent = new
|
|
92299
|
+
Dirent2.build = function(link, encoding) {
|
|
92300
|
+
var dirent = new Dirent2();
|
|
92315
92301
|
var mode = link.getNode().mode;
|
|
92316
92302
|
dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding);
|
|
92317
92303
|
dirent.mode = mode;
|
|
92318
92304
|
return dirent;
|
|
92319
92305
|
};
|
|
92320
|
-
|
|
92306
|
+
Dirent2.prototype._checkModeProperty = function(property) {
|
|
92321
92307
|
return (this.mode & S_IFMT) === property;
|
|
92322
92308
|
};
|
|
92323
|
-
|
|
92309
|
+
Dirent2.prototype.isDirectory = function() {
|
|
92324
92310
|
return this._checkModeProperty(S_IFDIR);
|
|
92325
92311
|
};
|
|
92326
|
-
|
|
92312
|
+
Dirent2.prototype.isFile = function() {
|
|
92327
92313
|
return this._checkModeProperty(S_IFREG);
|
|
92328
92314
|
};
|
|
92329
|
-
|
|
92315
|
+
Dirent2.prototype.isBlockDevice = function() {
|
|
92330
92316
|
return this._checkModeProperty(S_IFBLK);
|
|
92331
92317
|
};
|
|
92332
|
-
|
|
92318
|
+
Dirent2.prototype.isCharacterDevice = function() {
|
|
92333
92319
|
return this._checkModeProperty(S_IFCHR);
|
|
92334
92320
|
};
|
|
92335
|
-
|
|
92321
|
+
Dirent2.prototype.isSymbolicLink = function() {
|
|
92336
92322
|
return this._checkModeProperty(S_IFLNK);
|
|
92337
92323
|
};
|
|
92338
|
-
|
|
92324
|
+
Dirent2.prototype.isFIFO = function() {
|
|
92339
92325
|
return this._checkModeProperty(S_IFIFO);
|
|
92340
92326
|
};
|
|
92341
|
-
|
|
92327
|
+
Dirent2.prototype.isSocket = function() {
|
|
92342
92328
|
return this._checkModeProperty(S_IFSOCK);
|
|
92343
92329
|
};
|
|
92344
|
-
return
|
|
92330
|
+
return Dirent2;
|
|
92345
92331
|
}()
|
|
92346
92332
|
);
|
|
92347
|
-
exports.Dirent =
|
|
92348
|
-
exports.default =
|
|
92333
|
+
exports.Dirent = Dirent;
|
|
92334
|
+
exports.default = Dirent;
|
|
92349
92335
|
}
|
|
92350
92336
|
});
|
|
92351
92337
|
var require_setImmediate2 = __commonJS3({
|
|
@@ -120726,14 +120712,14 @@ var require_lib62 = __commonJS3({
|
|
|
120726
120712
|
super.checkParams(node, false, true);
|
|
120727
120713
|
this.scope.exit();
|
|
120728
120714
|
}
|
|
120729
|
-
forwardNoArrowParamsConversionAt(node,
|
|
120715
|
+
forwardNoArrowParamsConversionAt(node, parse13) {
|
|
120730
120716
|
let result;
|
|
120731
120717
|
if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
|
|
120732
120718
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
120733
|
-
result =
|
|
120719
|
+
result = parse13();
|
|
120734
120720
|
this.state.noArrowParamsConversionAt.pop();
|
|
120735
120721
|
} else {
|
|
120736
|
-
result =
|
|
120722
|
+
result = parse13();
|
|
120737
120723
|
}
|
|
120738
120724
|
return result;
|
|
120739
120725
|
}
|
|
@@ -160563,7 +160549,9 @@ filepath: ${filepath}`
|
|
|
160563
160549
|
load.push(element.quasi.quasis[0].value.raw);
|
|
160564
160550
|
} else if (element.type === "CallExpression") {
|
|
160565
160551
|
if (element.callee.type !== "Identifier" || element.callee.name !== "graphql" || element.arguments.length !== 1) {
|
|
160566
|
-
throw new Error(
|
|
160552
|
+
throw new Error(
|
|
160553
|
+
`only graphql function can be passed to ${houdini_load_fn}. Filepath: ${filepath}`
|
|
160554
|
+
);
|
|
160567
160555
|
}
|
|
160568
160556
|
let documentString;
|
|
160569
160557
|
const argument = element.arguments[0];
|
|
@@ -160671,18 +160659,6 @@ function is_layout3(framework2, filename) {
|
|
|
160671
160659
|
function is_component(config, framework2, filename) {
|
|
160672
160660
|
return framework2 === "svelte" || filename.endsWith(".svelte") && !is_route_script(framework2, filename) && !is_route(config, framework2, filename);
|
|
160673
160661
|
}
|
|
160674
|
-
function page_query_path(config, filename) {
|
|
160675
|
-
return path_exports.join(
|
|
160676
|
-
path_exports.dirname(resolve_relative(config, filename)),
|
|
160677
|
-
plugin_config(config).pageQueryFilename
|
|
160678
|
-
);
|
|
160679
|
-
}
|
|
160680
|
-
function layout_query_path(config, filename) {
|
|
160681
|
-
return path_exports.join(
|
|
160682
|
-
path_exports.dirname(resolve_relative(config, filename)),
|
|
160683
|
-
plugin_config(config).layoutQueryFilename
|
|
160684
|
-
);
|
|
160685
|
-
}
|
|
160686
160662
|
function resolve_relative(config, filename) {
|
|
160687
160663
|
const match3 = filename.match("^((../)+)src/routes");
|
|
160688
160664
|
if (match3) {
|
|
@@ -160792,32 +160768,6 @@ async function walk_routes(config, framework2, visitor, dirpath = config.routesD
|
|
|
160792
160768
|
componentQueries.push({ query: definition, componentPath: childPath });
|
|
160793
160769
|
}
|
|
160794
160770
|
});
|
|
160795
|
-
} else if (child === plugin_config(config).layoutQueryFilename) {
|
|
160796
|
-
validRoute = true;
|
|
160797
|
-
const contents = await fs_exports.readFile(childPath);
|
|
160798
|
-
if (!contents) {
|
|
160799
|
-
continue;
|
|
160800
|
-
}
|
|
160801
|
-
try {
|
|
160802
|
-
const query = config.extractQueryDefinition(graphql37.parse(contents));
|
|
160803
|
-
await visitor.routeLayoutQuery?.(query, childPath);
|
|
160804
|
-
layoutQueries.push(query);
|
|
160805
|
-
} catch (e3) {
|
|
160806
|
-
throw routeQueryError(childPath);
|
|
160807
|
-
}
|
|
160808
|
-
} else if (child === plugin_config(config).pageQueryFilename) {
|
|
160809
|
-
validRoute = true;
|
|
160810
|
-
const contents = await fs_exports.readFile(childPath);
|
|
160811
|
-
if (!contents) {
|
|
160812
|
-
continue;
|
|
160813
|
-
}
|
|
160814
|
-
try {
|
|
160815
|
-
const query = config.extractQueryDefinition(graphql37.parse(contents));
|
|
160816
|
-
await visitor.routePageQuery?.(query, childPath);
|
|
160817
|
-
pageQueries.push(query);
|
|
160818
|
-
} catch (e3) {
|
|
160819
|
-
throw routeQueryError(childPath);
|
|
160820
|
-
}
|
|
160821
160771
|
} else {
|
|
160822
160772
|
continue;
|
|
160823
160773
|
}
|
|
@@ -160849,10 +160799,6 @@ async function walk_routes(config, framework2, visitor, dirpath = config.routesD
|
|
|
160849
160799
|
);
|
|
160850
160800
|
}
|
|
160851
160801
|
}
|
|
160852
|
-
var routeQueryError = (filepath) => ({
|
|
160853
|
-
filepath,
|
|
160854
|
-
message: "route query error"
|
|
160855
|
-
});
|
|
160856
160802
|
function route_page_path(config, filename) {
|
|
160857
160803
|
return resolve_relative(config, filename).replace(".js", ".svelte").replace(".ts", ".svelte");
|
|
160858
160804
|
}
|
|
@@ -161544,180 +161490,12 @@ async function codegen_default(input) {
|
|
|
161544
161490
|
]);
|
|
161545
161491
|
}
|
|
161546
161492
|
|
|
161547
|
-
// src/plugin/fsPatch.ts
|
|
161548
|
-
import filesystem, { Dirent } from "node:fs";
|
|
161549
|
-
import filesystemPromises from "node:fs/promises";
|
|
161550
|
-
|
|
161551
161493
|
// src/plugin/state.ts
|
|
161552
161494
|
var _config;
|
|
161553
161495
|
function setConfig(config) {
|
|
161554
161496
|
_config = config;
|
|
161555
161497
|
}
|
|
161556
161498
|
|
|
161557
|
-
// src/plugin/fsPatch.ts
|
|
161558
|
-
var fsPatch_default = (getFramework) => ({
|
|
161559
|
-
async resolveId(filepath, _, { config, isEntry }) {
|
|
161560
|
-
if (!isEntry) {
|
|
161561
|
-
const match3 = filepath.match("^((../)+)src/routes");
|
|
161562
|
-
if (match3) {
|
|
161563
|
-
return path_exports.join(config.projectRoot, filepath.substring(match3[1].length));
|
|
161564
|
-
}
|
|
161565
|
-
return filepath.startsWith("/src") ? { id: path_exports.join(config.projectRoot, filepath) } : null;
|
|
161566
|
-
}
|
|
161567
|
-
filepath = path_exports.posixify(filepath.toString());
|
|
161568
|
-
if (is_route_script(getFramework(), filepath) || is_root_layout(config, filepath) || is_root_layout_server(config, filepath)) {
|
|
161569
|
-
return {
|
|
161570
|
-
id: resolve_relative(config, filepath)
|
|
161571
|
-
};
|
|
161572
|
-
}
|
|
161573
|
-
},
|
|
161574
|
-
load: async (filepath, { config }) => {
|
|
161575
|
-
filepath = path_exports.posixify(filepath.toString());
|
|
161576
|
-
if (is_route_script(getFramework(), filepath) || is_root_layout_server(config, filepath)) {
|
|
161577
|
-
filepath = resolve_relative(config, filepath);
|
|
161578
|
-
return {
|
|
161579
|
-
code: await fs_exports.readFile(filepath) || await fs_exports.readFile(path_exports.join(config.projectRoot, filepath)) || ""
|
|
161580
|
-
};
|
|
161581
|
-
}
|
|
161582
|
-
if (is_root_layout(config, filepath)) {
|
|
161583
|
-
filepath = resolve_relative(config, filepath);
|
|
161584
|
-
return {
|
|
161585
|
-
code: await fs_exports.readFile(filepath) || await fs_exports.readFile(path_exports.join(config.projectRoot, filepath)) || empty_layout
|
|
161586
|
-
};
|
|
161587
|
-
}
|
|
161588
|
-
}
|
|
161589
|
-
});
|
|
161590
|
-
var _readDirSync = filesystem.readdirSync;
|
|
161591
|
-
var _statSync = filesystem.statSync;
|
|
161592
|
-
var _readFileSync = filesystem.readFileSync;
|
|
161593
|
-
var _unlinkSync = filesystem.unlinkSync;
|
|
161594
|
-
function getStringFilepath(fp) {
|
|
161595
|
-
if (fp instanceof URL) {
|
|
161596
|
-
return fp.pathname;
|
|
161597
|
-
}
|
|
161598
|
-
return fp.toString();
|
|
161599
|
-
}
|
|
161600
|
-
filesystem.readFileSync = function(fp, options) {
|
|
161601
|
-
const filepath = getStringFilepath(fp);
|
|
161602
|
-
if (filepath.endsWith("+page.js") || filepath.endsWith("+layout.js") || filepath.replace(".ts", ".js").endsWith("+layout.server.js")) {
|
|
161603
|
-
try {
|
|
161604
|
-
return _readFileSync(fp, options);
|
|
161605
|
-
} catch {
|
|
161606
|
-
return typeof options === "string" || options?.encoding ? "" : Buffer.from("");
|
|
161607
|
-
}
|
|
161608
|
-
}
|
|
161609
|
-
if (filepath.endsWith(path_exports.join("src", "routes", "+layout.svelte"))) {
|
|
161610
|
-
try {
|
|
161611
|
-
return _readFileSync(fp, options);
|
|
161612
|
-
} catch {
|
|
161613
|
-
return typeof options === "string" || options?.encoding ? empty_layout : Buffer.from(empty_layout);
|
|
161614
|
-
}
|
|
161615
|
-
}
|
|
161616
|
-
return _readFileSync(fp, options);
|
|
161617
|
-
};
|
|
161618
|
-
filesystem.statSync = function(fp, options) {
|
|
161619
|
-
let filepath = getStringFilepath(fp);
|
|
161620
|
-
if (!filepath.includes("routes") || !path_exports.basename(filepath).startsWith("+")) {
|
|
161621
|
-
return _statSync(fp, options);
|
|
161622
|
-
}
|
|
161623
|
-
try {
|
|
161624
|
-
const result = _statSync(fp, options);
|
|
161625
|
-
return result;
|
|
161626
|
-
} catch (error) {
|
|
161627
|
-
filepath = path_exports.posixify(filepath);
|
|
161628
|
-
const mock3 = virtual_file(path_exports.basename(filepath), { withFileTypes: true });
|
|
161629
|
-
if (filepath.endsWith(path_exports.join("routes", "+layout.svelte")) || filepath.endsWith(path_exports.join("routes", "+layout.svelte")) || filepath.endsWith(path_exports.join("routes", "+layout.server.js")) || filepath.endsWith(path_exports.join("routes", "+layout.server.js"))) {
|
|
161630
|
-
return mock3;
|
|
161631
|
-
} else if (filepath.endsWith("+layout.js")) {
|
|
161632
|
-
return mock3;
|
|
161633
|
-
} else if (filepath.endsWith("+page.js")) {
|
|
161634
|
-
return mock3;
|
|
161635
|
-
}
|
|
161636
|
-
throw error;
|
|
161637
|
-
}
|
|
161638
|
-
};
|
|
161639
|
-
filesystem.unlinkSync = function(filepath) {
|
|
161640
|
-
try {
|
|
161641
|
-
_unlinkSync(filepath);
|
|
161642
|
-
} catch {
|
|
161643
|
-
}
|
|
161644
|
-
};
|
|
161645
|
-
filesystem.readdirSync = function(fp, options) {
|
|
161646
|
-
const filepath = getStringFilepath(fp);
|
|
161647
|
-
if (!filepath.includes("routes")) return _readDirSync(fp, options);
|
|
161648
|
-
const result = _readDirSync(fp, options);
|
|
161649
|
-
const file_names = result.map((file) => {
|
|
161650
|
-
if (file instanceof Dirent) {
|
|
161651
|
-
return file.name;
|
|
161652
|
-
} else if (typeof file === "string") {
|
|
161653
|
-
return file;
|
|
161654
|
-
} else {
|
|
161655
|
-
return "";
|
|
161656
|
-
}
|
|
161657
|
-
});
|
|
161658
|
-
function contains(...names) {
|
|
161659
|
-
return names.some((name) => file_names.includes(name));
|
|
161660
|
-
}
|
|
161661
|
-
if (contains("+page.svelte", "+page.gql") && !contains("+page.js", "+page.ts")) {
|
|
161662
|
-
result.push(virtual_file("+page.js", options));
|
|
161663
|
-
}
|
|
161664
|
-
const posix_filepath = path_exports.posixify(filepath);
|
|
161665
|
-
if ((is_root_route(posix_filepath) || contains("+layout.svelte", "+layout.gql")) && !contains("+layout.ts", "+layout.js")) {
|
|
161666
|
-
result.push(virtual_file("+layout.js", options));
|
|
161667
|
-
}
|
|
161668
|
-
if (is_root_route(posix_filepath) && !contains("+layout.svelte")) {
|
|
161669
|
-
result.push(virtual_file("+layout.svelte", options));
|
|
161670
|
-
}
|
|
161671
|
-
if (is_root_route(posix_filepath) && !contains("+layout.server.js", "+layout.server.ts") && !plugin_config(_config).static) {
|
|
161672
|
-
result.push(virtual_file("+layout.server.js", options));
|
|
161673
|
-
}
|
|
161674
|
-
return result;
|
|
161675
|
-
};
|
|
161676
|
-
Object.defineProperty(globalThis, "fs", {
|
|
161677
|
-
configurable: true,
|
|
161678
|
-
enumerable: true,
|
|
161679
|
-
value: filesystem
|
|
161680
|
-
});
|
|
161681
|
-
var _readFile = filesystemPromises.readFile;
|
|
161682
|
-
filesystemPromises.readFile = async (path5, options) => {
|
|
161683
|
-
if (path5.toString().endsWith("+layout.svelte")) {
|
|
161684
|
-
try {
|
|
161685
|
-
return await _readFile(path5, options);
|
|
161686
|
-
} catch {
|
|
161687
|
-
return typeof options === "string" || options?.encoding ? empty_layout : Buffer.from(empty_layout);
|
|
161688
|
-
}
|
|
161689
|
-
}
|
|
161690
|
-
return _readFile(path5, options);
|
|
161691
|
-
};
|
|
161692
|
-
Object.defineProperty(globalThis, "fs/promises", {
|
|
161693
|
-
configurable: true,
|
|
161694
|
-
enumerable: true,
|
|
161695
|
-
value: filesystemPromises
|
|
161696
|
-
});
|
|
161697
|
-
function virtual_file(name, options) {
|
|
161698
|
-
return !options?.withFileTypes ? name : {
|
|
161699
|
-
name,
|
|
161700
|
-
isFile: () => true,
|
|
161701
|
-
isDirectory: () => false,
|
|
161702
|
-
isBlockDevice: () => false,
|
|
161703
|
-
isFIFO: () => false,
|
|
161704
|
-
isCharacterDevice: () => false,
|
|
161705
|
-
isSocket: () => false,
|
|
161706
|
-
isSymbolicLink: () => false
|
|
161707
|
-
};
|
|
161708
|
-
}
|
|
161709
|
-
function is_root_route(filepath) {
|
|
161710
|
-
filepath = filepath.toString();
|
|
161711
|
-
if (filepath.toString().endsWith("/")) {
|
|
161712
|
-
filepath = filepath.slice(0, -1);
|
|
161713
|
-
}
|
|
161714
|
-
return filepath.endsWith(path_exports.join("src", "routes")) && // ignore the src/routes that exists in the type roots
|
|
161715
|
-
!filepath.includes(".svelte-kit") && // ! Hey! This second value always needs to correspond to the default value for the runtimeDir
|
|
161716
|
-
// if you're changing this here, please also update it in `/packages/houdini/src/lib/config.ts`
|
|
161717
|
-
!filepath.includes(_config.runtimeDir ?? "$houdini");
|
|
161718
|
-
}
|
|
161719
|
-
var empty_layout = "<slot />";
|
|
161720
|
-
|
|
161721
161499
|
// src/plugin/transforms/index.ts
|
|
161722
161500
|
var recast21 = __toESM(require_main4(), 1);
|
|
161723
161501
|
|
|
@@ -162028,7 +161806,6 @@ async function kit_init(page) {
|
|
|
162028
161806
|
}
|
|
162029
161807
|
|
|
162030
161808
|
// src/plugin/transforms/kit/load.ts
|
|
162031
|
-
import * as graphql38 from "graphql";
|
|
162032
161809
|
var recast18 = __toESM(require_main4(), 1);
|
|
162033
161810
|
var AST19 = recast18.types.builders;
|
|
162034
161811
|
async function kit_load_generator(page) {
|
|
@@ -162043,9 +161820,7 @@ async function kit_load_generator(page) {
|
|
|
162043
161820
|
page,
|
|
162044
161821
|
artifact: { name }
|
|
162045
161822
|
}).id;
|
|
162046
|
-
const [
|
|
162047
|
-
find_special_query("Page", page),
|
|
162048
|
-
find_special_query("Layout", page),
|
|
161823
|
+
const [inline_queries, page_info] = await Promise.all([
|
|
162049
161824
|
find_inline_queries(
|
|
162050
161825
|
page,
|
|
162051
161826
|
// if we are currently on the route file, there's nothing to parse
|
|
@@ -162064,12 +161839,6 @@ async function kit_load_generator(page) {
|
|
|
162064
161839
|
if (script) {
|
|
162065
161840
|
const queries_that_needs_a_load = [...houdini_load_queries, ...inline_queries];
|
|
162066
161841
|
const isLayout = is_layout3(page.framework, page.filepath);
|
|
162067
|
-
if (isLayout && layout_query) {
|
|
162068
|
-
queries_that_needs_a_load.push(layout_query);
|
|
162069
|
-
}
|
|
162070
|
-
if (!isLayout && page_query) {
|
|
162071
|
-
queries_that_needs_a_load.push(page_query);
|
|
162072
|
-
}
|
|
162073
161842
|
add_load({
|
|
162074
161843
|
page,
|
|
162075
161844
|
queries: queries_that_needs_a_load,
|
|
@@ -162316,22 +162085,6 @@ function add_load({
|
|
|
162316
162085
|
);
|
|
162317
162086
|
}
|
|
162318
162087
|
}
|
|
162319
|
-
async function find_special_query(type, page) {
|
|
162320
|
-
const query_path = type === "Page" ? page_query_path(page.config, page.filepath) : layout_query_path(page.config, page.filepath);
|
|
162321
|
-
const contents = await fs_exports.readFile(query_path);
|
|
162322
|
-
if (!contents) {
|
|
162323
|
-
return null;
|
|
162324
|
-
}
|
|
162325
|
-
const parsed = graphql38.parse(contents);
|
|
162326
|
-
const definition = parsed.definitions.find(
|
|
162327
|
-
(defn) => defn.kind === "OperationDefinition" && defn.operation === "query"
|
|
162328
|
-
);
|
|
162329
|
-
if (!definition) {
|
|
162330
|
-
formatErrors({ message: "gql file must contain a query.", filepath: query_path });
|
|
162331
|
-
return null;
|
|
162332
|
-
}
|
|
162333
|
-
return definition;
|
|
162334
|
-
}
|
|
162335
162088
|
function load_hook_statements(name, request_context, input_id, result_id) {
|
|
162336
162089
|
return AST19.expressionStatement(
|
|
162337
162090
|
AST19.awaitExpression(
|
|
@@ -162692,7 +162445,6 @@ function replace_tag_content(source, start, end, insert) {
|
|
|
162692
162445
|
var replace_between = (origin, startIndex, endIndex, insertion) => origin.substring(0, startIndex) + insertion + origin.substring(endIndex);
|
|
162693
162446
|
|
|
162694
162447
|
// src/plugin/validate.ts
|
|
162695
|
-
import * as graphql39 from "graphql";
|
|
162696
162448
|
async function validate2({
|
|
162697
162449
|
config,
|
|
162698
162450
|
documents
|
|
@@ -162719,28 +162471,6 @@ async function validate2({
|
|
|
162719
162471
|
})
|
|
162720
162472
|
);
|
|
162721
162473
|
}
|
|
162722
|
-
graphql39.visit(doc.document, {
|
|
162723
|
-
Directive(node, _, __, ___, ancestors) {
|
|
162724
|
-
const blockingDirectives = [
|
|
162725
|
-
config.blockingDirective,
|
|
162726
|
-
config.blockingDisableDirective
|
|
162727
|
-
];
|
|
162728
|
-
if (!blockingDirectives.includes(node.name.value)) {
|
|
162729
|
-
return;
|
|
162730
|
-
}
|
|
162731
|
-
const { definition } = definitionFromAncestors(ancestors);
|
|
162732
|
-
const listDirective = definition.directives?.map((c) => c.name.value) ?? [];
|
|
162733
|
-
if (listDirective.includes(config.blockingDirective) && listDirective.includes(config.blockingDisableDirective)) {
|
|
162734
|
-
errors.push(
|
|
162735
|
-
new HoudiniError({
|
|
162736
|
-
filepath: doc.filename,
|
|
162737
|
-
message: `You can't apply both @${config.blockingDirective} and @${config.blockingDisableDirective} at the same time`
|
|
162738
|
-
})
|
|
162739
|
-
);
|
|
162740
|
-
}
|
|
162741
|
-
return;
|
|
162742
|
-
}
|
|
162743
|
-
});
|
|
162744
162474
|
}
|
|
162745
162475
|
if (errors.length > 0) {
|
|
162746
162476
|
throw errors;
|
|
@@ -162799,24 +162529,6 @@ export const redirect = svelteKitRedirect
|
|
|
162799
162529
|
artifactData,
|
|
162800
162530
|
// custom logic to pull a graphql document out of a svelte file
|
|
162801
162531
|
extractDocuments: extract_default,
|
|
162802
|
-
schema({ config }) {
|
|
162803
|
-
return `
|
|
162804
|
-
"""
|
|
162805
|
-
@${config.loadDirective} is used to enable automatic fetch on inline queries.
|
|
162806
|
-
"""
|
|
162807
|
-
directive @${config.loadDirective} on QUERY
|
|
162808
|
-
|
|
162809
|
-
"""
|
|
162810
|
-
@${config.blockingDirective} is used to always await the fetch.
|
|
162811
|
-
"""
|
|
162812
|
-
directive @${config.blockingDirective} on QUERY
|
|
162813
|
-
|
|
162814
|
-
"""
|
|
162815
|
-
@${config.blockingDisableDirective} is used to not always await the fetch (in CSR for example). Note that "throwOnError" will not throw in this case.
|
|
162816
|
-
"""
|
|
162817
|
-
directive @${config.blockingDisableDirective} on QUERY
|
|
162818
|
-
`;
|
|
162819
|
-
},
|
|
162820
162532
|
// we have some custom document validation logic
|
|
162821
162533
|
validate: validate2,
|
|
162822
162534
|
// we need to write the svelte specific runtime
|
|
@@ -162854,10 +162566,6 @@ directive @${config.blockingDisableDirective} on QUERY
|
|
|
162854
162566
|
include({ config, filepath }) {
|
|
162855
162567
|
return config.includeFile(resolve_relative(config, filepath), { ignore_plugins: true });
|
|
162856
162568
|
},
|
|
162857
|
-
// add custom vite config
|
|
162858
|
-
vite: {
|
|
162859
|
-
...fsPatch_default(() => framework)
|
|
162860
|
-
},
|
|
162861
162569
|
/**
|
|
162862
162570
|
* Setup
|
|
162863
162571
|
*/
|