houdini-svelte 2.2.0-next.4 → 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
|
@@ -2368,7 +2368,7 @@ var require_path_visitor2 = __commonJS({
|
|
|
2368
2368
|
}
|
|
2369
2369
|
return target;
|
|
2370
2370
|
}
|
|
2371
|
-
PathVisitor.visit = function
|
|
2371
|
+
PathVisitor.visit = function visit23(node, methods) {
|
|
2372
2372
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
2373
2373
|
};
|
|
2374
2374
|
var PVp = PathVisitor.prototype;
|
|
@@ -2559,7 +2559,7 @@ var require_path_visitor2 = __commonJS({
|
|
|
2559
2559
|
this.needToCallTraverse = false;
|
|
2560
2560
|
return visitChildren(path5, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
2561
2561
|
};
|
|
2562
|
-
sharedContextProtoMethods.visit = function
|
|
2562
|
+
sharedContextProtoMethods.visit = function visit23(path5, newVisitor) {
|
|
2563
2563
|
if (!(this instanceof this.Context)) {
|
|
2564
2564
|
throw new Error("");
|
|
2565
2565
|
}
|
|
@@ -4001,7 +4001,7 @@ var require_main3 = __commonJS({
|
|
|
4001
4001
|
var someField = _a.someField;
|
|
4002
4002
|
var Type = _a.Type;
|
|
4003
4003
|
var use = _a.use;
|
|
4004
|
-
var
|
|
4004
|
+
var visit23 = _a.visit;
|
|
4005
4005
|
exports2.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
4006
4006
|
exports2.builders = builders;
|
|
4007
4007
|
exports2.builtInTypes = builtInTypes;
|
|
@@ -4018,7 +4018,7 @@ var require_main3 = __commonJS({
|
|
|
4018
4018
|
exports2.someField = someField;
|
|
4019
4019
|
exports2.Type = Type;
|
|
4020
4020
|
exports2.use = use;
|
|
4021
|
-
exports2.visit =
|
|
4021
|
+
exports2.visit = visit23;
|
|
4022
4022
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
4023
4023
|
}
|
|
4024
4024
|
});
|
|
@@ -6097,7 +6097,7 @@ var require_esprima5 = __commonJS({
|
|
|
6097
6097
|
var jsx_parser_1 = __webpack_require__(3);
|
|
6098
6098
|
var parser_1 = __webpack_require__(8);
|
|
6099
6099
|
var tokenizer_1 = __webpack_require__(15);
|
|
6100
|
-
function
|
|
6100
|
+
function parse13(code, options, delegate) {
|
|
6101
6101
|
var commentHandler = null;
|
|
6102
6102
|
var proxyDelegate = function(node, metadata) {
|
|
6103
6103
|
if (delegate) {
|
|
@@ -6142,17 +6142,17 @@ var require_esprima5 = __commonJS({
|
|
|
6142
6142
|
}
|
|
6143
6143
|
return ast;
|
|
6144
6144
|
}
|
|
6145
|
-
exports3.parse =
|
|
6145
|
+
exports3.parse = parse13;
|
|
6146
6146
|
function parseModule(code, options, delegate) {
|
|
6147
6147
|
var parsingOptions = options || {};
|
|
6148
6148
|
parsingOptions.sourceType = "module";
|
|
6149
|
-
return
|
|
6149
|
+
return parse13(code, parsingOptions, delegate);
|
|
6150
6150
|
}
|
|
6151
6151
|
exports3.parseModule = parseModule;
|
|
6152
6152
|
function parseScript(code, options, delegate) {
|
|
6153
6153
|
var parsingOptions = options || {};
|
|
6154
6154
|
parsingOptions.sourceType = "script";
|
|
6155
|
-
return
|
|
6155
|
+
return parse13(code, parsingOptions, delegate);
|
|
6156
6156
|
}
|
|
6157
6157
|
exports3.parseScript = parseScript;
|
|
6158
6158
|
function tokenize(code, options, delegate) {
|
|
@@ -12292,7 +12292,7 @@ var require_esprima6 = __commonJS({
|
|
|
12292
12292
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12293
12293
|
exports2.parse = void 0;
|
|
12294
12294
|
var util_1 = require_util4();
|
|
12295
|
-
function
|
|
12295
|
+
function parse13(source, options) {
|
|
12296
12296
|
var comments = [];
|
|
12297
12297
|
var ast = require_esprima5().parse(source, {
|
|
12298
12298
|
loc: true,
|
|
@@ -12310,7 +12310,7 @@ var require_esprima6 = __commonJS({
|
|
|
12310
12310
|
}
|
|
12311
12311
|
return ast;
|
|
12312
12312
|
}
|
|
12313
|
-
exports2.parse =
|
|
12313
|
+
exports2.parse = parse13;
|
|
12314
12314
|
}
|
|
12315
12315
|
});
|
|
12316
12316
|
|
|
@@ -13448,7 +13448,7 @@ var require_parser2 = __commonJS({
|
|
|
13448
13448
|
var lines_1 = require_lines2();
|
|
13449
13449
|
var comments_1 = require_comments2();
|
|
13450
13450
|
var util = tslib_1.__importStar(require_util4());
|
|
13451
|
-
function
|
|
13451
|
+
function parse13(source, options) {
|
|
13452
13452
|
options = (0, options_1.normalize)(options);
|
|
13453
13453
|
var lines = (0, lines_1.fromString)(source, options);
|
|
13454
13454
|
var sourceWithoutTabs = lines.toString({
|
|
@@ -13520,7 +13520,7 @@ var require_parser2 = __commonJS({
|
|
|
13520
13520
|
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
|
|
13521
13521
|
return new TreeCopier(lines, tokens).copy(file);
|
|
13522
13522
|
}
|
|
13523
|
-
exports2.parse =
|
|
13523
|
+
exports2.parse = parse13;
|
|
13524
13524
|
var TreeCopier = function TreeCopier2(lines, tokens) {
|
|
13525
13525
|
assert_1.default.ok(this instanceof TreeCopier2);
|
|
13526
13526
|
this.lines = lines;
|
|
@@ -19602,7 +19602,7 @@ var require_jsonfile = __commonJS2({
|
|
|
19602
19602
|
}
|
|
19603
19603
|
var universalify = require_universalify();
|
|
19604
19604
|
var { stringify, stripBom } = require_utils2();
|
|
19605
|
-
async function
|
|
19605
|
+
async function _readFile(file, options = {}) {
|
|
19606
19606
|
if (typeof options === "string") {
|
|
19607
19607
|
options = { encoding: options };
|
|
19608
19608
|
}
|
|
@@ -19623,7 +19623,7 @@ var require_jsonfile = __commonJS2({
|
|
|
19623
19623
|
}
|
|
19624
19624
|
return obj;
|
|
19625
19625
|
}
|
|
19626
|
-
var readFile22 = universalify.fromPromise(
|
|
19626
|
+
var readFile22 = universalify.fromPromise(_readFile);
|
|
19627
19627
|
function readFileSync22(file, options = {}) {
|
|
19628
19628
|
if (typeof options === "string") {
|
|
19629
19629
|
options = { encoding: options };
|
|
@@ -20377,49 +20377,49 @@ var require_Dirent = __commonJS2({
|
|
|
20377
20377
|
var S_IFLNK = constants_1.constants.S_IFLNK;
|
|
20378
20378
|
var S_IFIFO = constants_1.constants.S_IFIFO;
|
|
20379
20379
|
var S_IFSOCK = constants_1.constants.S_IFSOCK;
|
|
20380
|
-
var
|
|
20380
|
+
var Dirent = (
|
|
20381
20381
|
/** @class */
|
|
20382
20382
|
function() {
|
|
20383
|
-
function
|
|
20383
|
+
function Dirent2() {
|
|
20384
20384
|
this.name = "";
|
|
20385
20385
|
this.mode = 0;
|
|
20386
20386
|
}
|
|
20387
|
-
|
|
20388
|
-
var dirent = new
|
|
20387
|
+
Dirent2.build = function(link, encoding) {
|
|
20388
|
+
var dirent = new Dirent2();
|
|
20389
20389
|
var mode = link.getNode().mode;
|
|
20390
20390
|
dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding);
|
|
20391
20391
|
dirent.mode = mode;
|
|
20392
20392
|
return dirent;
|
|
20393
20393
|
};
|
|
20394
|
-
|
|
20394
|
+
Dirent2.prototype._checkModeProperty = function(property) {
|
|
20395
20395
|
return (this.mode & S_IFMT) === property;
|
|
20396
20396
|
};
|
|
20397
|
-
|
|
20397
|
+
Dirent2.prototype.isDirectory = function() {
|
|
20398
20398
|
return this._checkModeProperty(S_IFDIR);
|
|
20399
20399
|
};
|
|
20400
|
-
|
|
20400
|
+
Dirent2.prototype.isFile = function() {
|
|
20401
20401
|
return this._checkModeProperty(S_IFREG);
|
|
20402
20402
|
};
|
|
20403
|
-
|
|
20403
|
+
Dirent2.prototype.isBlockDevice = function() {
|
|
20404
20404
|
return this._checkModeProperty(S_IFBLK);
|
|
20405
20405
|
};
|
|
20406
|
-
|
|
20406
|
+
Dirent2.prototype.isCharacterDevice = function() {
|
|
20407
20407
|
return this._checkModeProperty(S_IFCHR);
|
|
20408
20408
|
};
|
|
20409
|
-
|
|
20409
|
+
Dirent2.prototype.isSymbolicLink = function() {
|
|
20410
20410
|
return this._checkModeProperty(S_IFLNK);
|
|
20411
20411
|
};
|
|
20412
|
-
|
|
20412
|
+
Dirent2.prototype.isFIFO = function() {
|
|
20413
20413
|
return this._checkModeProperty(S_IFIFO);
|
|
20414
20414
|
};
|
|
20415
|
-
|
|
20415
|
+
Dirent2.prototype.isSocket = function() {
|
|
20416
20416
|
return this._checkModeProperty(S_IFSOCK);
|
|
20417
20417
|
};
|
|
20418
|
-
return
|
|
20418
|
+
return Dirent2;
|
|
20419
20419
|
}()
|
|
20420
20420
|
);
|
|
20421
|
-
exports2.Dirent =
|
|
20422
|
-
exports2.default =
|
|
20421
|
+
exports2.Dirent = Dirent;
|
|
20422
|
+
exports2.default = Dirent;
|
|
20423
20423
|
}
|
|
20424
20424
|
});
|
|
20425
20425
|
var require_setImmediate = __commonJS2({
|
|
@@ -85298,15 +85298,6 @@ function serialized_manifest_path(config, base = base_dir(config)) {
|
|
|
85298
85298
|
return join2(base, "manifest.json");
|
|
85299
85299
|
}
|
|
85300
85300
|
var t2 = __toESM2(require_lib5(), 1);
|
|
85301
|
-
function definitionFromAncestors(ancestors) {
|
|
85302
|
-
let parents = [...ancestors];
|
|
85303
|
-
parents.shift();
|
|
85304
|
-
let definition = parents.shift();
|
|
85305
|
-
while (Array.isArray(definition) && definition) {
|
|
85306
|
-
definition = parents.shift();
|
|
85307
|
-
}
|
|
85308
|
-
return { parents, definition };
|
|
85309
|
-
}
|
|
85310
85301
|
function formatErrors(e22, afterError) {
|
|
85311
85302
|
const errors = Array.isArray(e22) ? e22 : [e22];
|
|
85312
85303
|
for (const error of errors) {
|
|
@@ -88517,8 +88508,6 @@ function plugin_config(config) {
|
|
|
88517
88508
|
return {
|
|
88518
88509
|
client: "./src/client",
|
|
88519
88510
|
defaultRouteBlocking: false,
|
|
88520
|
-
pageQueryFilename: "+page.gql",
|
|
88521
|
-
layoutQueryFilename: "+layout.gql",
|
|
88522
88511
|
static: false,
|
|
88523
88512
|
forceRunesMode: false,
|
|
88524
88513
|
...cfg,
|
|
@@ -88536,9 +88525,6 @@ function plugin_config(config) {
|
|
|
88536
88525
|
};
|
|
88537
88526
|
}
|
|
88538
88527
|
|
|
88539
|
-
// src/plugin/kit.ts
|
|
88540
|
-
var graphql37 = __toESM(require("graphql"), 1);
|
|
88541
|
-
|
|
88542
88528
|
// ../houdini/build/vite-esm/index.js
|
|
88543
88529
|
var import_module2 = require("module");
|
|
88544
88530
|
var import_node_fs2 = require("node:fs");
|
|
@@ -91533,7 +91519,7 @@ var require_jsonfile3 = __commonJS3({
|
|
|
91533
91519
|
}
|
|
91534
91520
|
var universalify = require_universalify2();
|
|
91535
91521
|
var { stringify, stripBom } = require_utils22();
|
|
91536
|
-
async function
|
|
91522
|
+
async function _readFile(file, options = {}) {
|
|
91537
91523
|
if (typeof options === "string") {
|
|
91538
91524
|
options = { encoding: options };
|
|
91539
91525
|
}
|
|
@@ -91554,7 +91540,7 @@ var require_jsonfile3 = __commonJS3({
|
|
|
91554
91540
|
}
|
|
91555
91541
|
return obj;
|
|
91556
91542
|
}
|
|
91557
|
-
var readFile22 = universalify.fromPromise(
|
|
91543
|
+
var readFile22 = universalify.fromPromise(_readFile);
|
|
91558
91544
|
function readFileSync22(file, options = {}) {
|
|
91559
91545
|
if (typeof options === "string") {
|
|
91560
91546
|
options = { encoding: options };
|
|
@@ -92308,49 +92294,49 @@ var require_Dirent2 = __commonJS3({
|
|
|
92308
92294
|
var S_IFLNK = constants_1.constants.S_IFLNK;
|
|
92309
92295
|
var S_IFIFO = constants_1.constants.S_IFIFO;
|
|
92310
92296
|
var S_IFSOCK = constants_1.constants.S_IFSOCK;
|
|
92311
|
-
var
|
|
92297
|
+
var Dirent = (
|
|
92312
92298
|
/** @class */
|
|
92313
92299
|
function() {
|
|
92314
|
-
function
|
|
92300
|
+
function Dirent2() {
|
|
92315
92301
|
this.name = "";
|
|
92316
92302
|
this.mode = 0;
|
|
92317
92303
|
}
|
|
92318
|
-
|
|
92319
|
-
var dirent = new
|
|
92304
|
+
Dirent2.build = function(link, encoding) {
|
|
92305
|
+
var dirent = new Dirent2();
|
|
92320
92306
|
var mode = link.getNode().mode;
|
|
92321
92307
|
dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding);
|
|
92322
92308
|
dirent.mode = mode;
|
|
92323
92309
|
return dirent;
|
|
92324
92310
|
};
|
|
92325
|
-
|
|
92311
|
+
Dirent2.prototype._checkModeProperty = function(property) {
|
|
92326
92312
|
return (this.mode & S_IFMT) === property;
|
|
92327
92313
|
};
|
|
92328
|
-
|
|
92314
|
+
Dirent2.prototype.isDirectory = function() {
|
|
92329
92315
|
return this._checkModeProperty(S_IFDIR);
|
|
92330
92316
|
};
|
|
92331
|
-
|
|
92317
|
+
Dirent2.prototype.isFile = function() {
|
|
92332
92318
|
return this._checkModeProperty(S_IFREG);
|
|
92333
92319
|
};
|
|
92334
|
-
|
|
92320
|
+
Dirent2.prototype.isBlockDevice = function() {
|
|
92335
92321
|
return this._checkModeProperty(S_IFBLK);
|
|
92336
92322
|
};
|
|
92337
|
-
|
|
92323
|
+
Dirent2.prototype.isCharacterDevice = function() {
|
|
92338
92324
|
return this._checkModeProperty(S_IFCHR);
|
|
92339
92325
|
};
|
|
92340
|
-
|
|
92326
|
+
Dirent2.prototype.isSymbolicLink = function() {
|
|
92341
92327
|
return this._checkModeProperty(S_IFLNK);
|
|
92342
92328
|
};
|
|
92343
|
-
|
|
92329
|
+
Dirent2.prototype.isFIFO = function() {
|
|
92344
92330
|
return this._checkModeProperty(S_IFIFO);
|
|
92345
92331
|
};
|
|
92346
|
-
|
|
92332
|
+
Dirent2.prototype.isSocket = function() {
|
|
92347
92333
|
return this._checkModeProperty(S_IFSOCK);
|
|
92348
92334
|
};
|
|
92349
|
-
return
|
|
92335
|
+
return Dirent2;
|
|
92350
92336
|
}()
|
|
92351
92337
|
);
|
|
92352
|
-
exports2.Dirent =
|
|
92353
|
-
exports2.default =
|
|
92338
|
+
exports2.Dirent = Dirent;
|
|
92339
|
+
exports2.default = Dirent;
|
|
92354
92340
|
}
|
|
92355
92341
|
});
|
|
92356
92342
|
var require_setImmediate2 = __commonJS3({
|
|
@@ -120731,14 +120717,14 @@ var require_lib62 = __commonJS3({
|
|
|
120731
120717
|
super.checkParams(node, false, true);
|
|
120732
120718
|
this.scope.exit();
|
|
120733
120719
|
}
|
|
120734
|
-
forwardNoArrowParamsConversionAt(node,
|
|
120720
|
+
forwardNoArrowParamsConversionAt(node, parse13) {
|
|
120735
120721
|
let result;
|
|
120736
120722
|
if (this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) {
|
|
120737
120723
|
this.state.noArrowParamsConversionAt.push(this.state.start);
|
|
120738
|
-
result =
|
|
120724
|
+
result = parse13();
|
|
120739
120725
|
this.state.noArrowParamsConversionAt.pop();
|
|
120740
120726
|
} else {
|
|
120741
|
-
result =
|
|
120727
|
+
result = parse13();
|
|
120742
120728
|
}
|
|
120743
120729
|
return result;
|
|
120744
120730
|
}
|
|
@@ -160568,7 +160554,9 @@ filepath: ${filepath}`
|
|
|
160568
160554
|
load.push(element.quasi.quasis[0].value.raw);
|
|
160569
160555
|
} else if (element.type === "CallExpression") {
|
|
160570
160556
|
if (element.callee.type !== "Identifier" || element.callee.name !== "graphql" || element.arguments.length !== 1) {
|
|
160571
|
-
throw new Error(
|
|
160557
|
+
throw new Error(
|
|
160558
|
+
`only graphql function can be passed to ${houdini_load_fn}. Filepath: ${filepath}`
|
|
160559
|
+
);
|
|
160572
160560
|
}
|
|
160573
160561
|
let documentString;
|
|
160574
160562
|
const argument = element.arguments[0];
|
|
@@ -160676,18 +160664,6 @@ function is_layout3(framework2, filename) {
|
|
|
160676
160664
|
function is_component(config, framework2, filename) {
|
|
160677
160665
|
return framework2 === "svelte" || filename.endsWith(".svelte") && !is_route_script(framework2, filename) && !is_route(config, framework2, filename);
|
|
160678
160666
|
}
|
|
160679
|
-
function page_query_path(config, filename) {
|
|
160680
|
-
return path_exports.join(
|
|
160681
|
-
path_exports.dirname(resolve_relative(config, filename)),
|
|
160682
|
-
plugin_config(config).pageQueryFilename
|
|
160683
|
-
);
|
|
160684
|
-
}
|
|
160685
|
-
function layout_query_path(config, filename) {
|
|
160686
|
-
return path_exports.join(
|
|
160687
|
-
path_exports.dirname(resolve_relative(config, filename)),
|
|
160688
|
-
plugin_config(config).layoutQueryFilename
|
|
160689
|
-
);
|
|
160690
|
-
}
|
|
160691
160667
|
function resolve_relative(config, filename) {
|
|
160692
160668
|
const match3 = filename.match("^((../)+)src/routes");
|
|
160693
160669
|
if (match3) {
|
|
@@ -160797,32 +160773,6 @@ async function walk_routes(config, framework2, visitor, dirpath = config.routesD
|
|
|
160797
160773
|
componentQueries.push({ query: definition, componentPath: childPath });
|
|
160798
160774
|
}
|
|
160799
160775
|
});
|
|
160800
|
-
} else if (child === plugin_config(config).layoutQueryFilename) {
|
|
160801
|
-
validRoute = true;
|
|
160802
|
-
const contents = await fs_exports.readFile(childPath);
|
|
160803
|
-
if (!contents) {
|
|
160804
|
-
continue;
|
|
160805
|
-
}
|
|
160806
|
-
try {
|
|
160807
|
-
const query = config.extractQueryDefinition(graphql37.parse(contents));
|
|
160808
|
-
await visitor.routeLayoutQuery?.(query, childPath);
|
|
160809
|
-
layoutQueries.push(query);
|
|
160810
|
-
} catch (e3) {
|
|
160811
|
-
throw routeQueryError(childPath);
|
|
160812
|
-
}
|
|
160813
|
-
} else if (child === plugin_config(config).pageQueryFilename) {
|
|
160814
|
-
validRoute = true;
|
|
160815
|
-
const contents = await fs_exports.readFile(childPath);
|
|
160816
|
-
if (!contents) {
|
|
160817
|
-
continue;
|
|
160818
|
-
}
|
|
160819
|
-
try {
|
|
160820
|
-
const query = config.extractQueryDefinition(graphql37.parse(contents));
|
|
160821
|
-
await visitor.routePageQuery?.(query, childPath);
|
|
160822
|
-
pageQueries.push(query);
|
|
160823
|
-
} catch (e3) {
|
|
160824
|
-
throw routeQueryError(childPath);
|
|
160825
|
-
}
|
|
160826
160776
|
} else {
|
|
160827
160777
|
continue;
|
|
160828
160778
|
}
|
|
@@ -160854,10 +160804,6 @@ async function walk_routes(config, framework2, visitor, dirpath = config.routesD
|
|
|
160854
160804
|
);
|
|
160855
160805
|
}
|
|
160856
160806
|
}
|
|
160857
|
-
var routeQueryError = (filepath) => ({
|
|
160858
|
-
filepath,
|
|
160859
|
-
message: "route query error"
|
|
160860
|
-
});
|
|
160861
160807
|
function route_page_path(config, filename) {
|
|
160862
160808
|
return resolve_relative(config, filename).replace(".js", ".svelte").replace(".ts", ".svelte");
|
|
160863
160809
|
}
|
|
@@ -161549,180 +161495,12 @@ async function codegen_default(input) {
|
|
|
161549
161495
|
]);
|
|
161550
161496
|
}
|
|
161551
161497
|
|
|
161552
|
-
// src/plugin/fsPatch.ts
|
|
161553
|
-
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
|
161554
|
-
var import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
161555
|
-
|
|
161556
161498
|
// src/plugin/state.ts
|
|
161557
161499
|
var _config;
|
|
161558
161500
|
function setConfig(config) {
|
|
161559
161501
|
_config = config;
|
|
161560
161502
|
}
|
|
161561
161503
|
|
|
161562
|
-
// src/plugin/fsPatch.ts
|
|
161563
|
-
var fsPatch_default = (getFramework) => ({
|
|
161564
|
-
async resolveId(filepath, _, { config, isEntry }) {
|
|
161565
|
-
if (!isEntry) {
|
|
161566
|
-
const match3 = filepath.match("^((../)+)src/routes");
|
|
161567
|
-
if (match3) {
|
|
161568
|
-
return path_exports.join(config.projectRoot, filepath.substring(match3[1].length));
|
|
161569
|
-
}
|
|
161570
|
-
return filepath.startsWith("/src") ? { id: path_exports.join(config.projectRoot, filepath) } : null;
|
|
161571
|
-
}
|
|
161572
|
-
filepath = path_exports.posixify(filepath.toString());
|
|
161573
|
-
if (is_route_script(getFramework(), filepath) || is_root_layout(config, filepath) || is_root_layout_server(config, filepath)) {
|
|
161574
|
-
return {
|
|
161575
|
-
id: resolve_relative(config, filepath)
|
|
161576
|
-
};
|
|
161577
|
-
}
|
|
161578
|
-
},
|
|
161579
|
-
load: async (filepath, { config }) => {
|
|
161580
|
-
filepath = path_exports.posixify(filepath.toString());
|
|
161581
|
-
if (is_route_script(getFramework(), filepath) || is_root_layout_server(config, filepath)) {
|
|
161582
|
-
filepath = resolve_relative(config, filepath);
|
|
161583
|
-
return {
|
|
161584
|
-
code: await fs_exports.readFile(filepath) || await fs_exports.readFile(path_exports.join(config.projectRoot, filepath)) || ""
|
|
161585
|
-
};
|
|
161586
|
-
}
|
|
161587
|
-
if (is_root_layout(config, filepath)) {
|
|
161588
|
-
filepath = resolve_relative(config, filepath);
|
|
161589
|
-
return {
|
|
161590
|
-
code: await fs_exports.readFile(filepath) || await fs_exports.readFile(path_exports.join(config.projectRoot, filepath)) || empty_layout
|
|
161591
|
-
};
|
|
161592
|
-
}
|
|
161593
|
-
}
|
|
161594
|
-
});
|
|
161595
|
-
var _readDirSync = import_node_fs3.default.readdirSync;
|
|
161596
|
-
var _statSync = import_node_fs3.default.statSync;
|
|
161597
|
-
var _readFileSync = import_node_fs3.default.readFileSync;
|
|
161598
|
-
var _unlinkSync = import_node_fs3.default.unlinkSync;
|
|
161599
|
-
function getStringFilepath(fp) {
|
|
161600
|
-
if (fp instanceof URL) {
|
|
161601
|
-
return fp.pathname;
|
|
161602
|
-
}
|
|
161603
|
-
return fp.toString();
|
|
161604
|
-
}
|
|
161605
|
-
import_node_fs3.default.readFileSync = function(fp, options) {
|
|
161606
|
-
const filepath = getStringFilepath(fp);
|
|
161607
|
-
if (filepath.endsWith("+page.js") || filepath.endsWith("+layout.js") || filepath.replace(".ts", ".js").endsWith("+layout.server.js")) {
|
|
161608
|
-
try {
|
|
161609
|
-
return _readFileSync(fp, options);
|
|
161610
|
-
} catch {
|
|
161611
|
-
return typeof options === "string" || options?.encoding ? "" : Buffer.from("");
|
|
161612
|
-
}
|
|
161613
|
-
}
|
|
161614
|
-
if (filepath.endsWith(path_exports.join("src", "routes", "+layout.svelte"))) {
|
|
161615
|
-
try {
|
|
161616
|
-
return _readFileSync(fp, options);
|
|
161617
|
-
} catch {
|
|
161618
|
-
return typeof options === "string" || options?.encoding ? empty_layout : Buffer.from(empty_layout);
|
|
161619
|
-
}
|
|
161620
|
-
}
|
|
161621
|
-
return _readFileSync(fp, options);
|
|
161622
|
-
};
|
|
161623
|
-
import_node_fs3.default.statSync = function(fp, options) {
|
|
161624
|
-
let filepath = getStringFilepath(fp);
|
|
161625
|
-
if (!filepath.includes("routes") || !path_exports.basename(filepath).startsWith("+")) {
|
|
161626
|
-
return _statSync(fp, options);
|
|
161627
|
-
}
|
|
161628
|
-
try {
|
|
161629
|
-
const result = _statSync(fp, options);
|
|
161630
|
-
return result;
|
|
161631
|
-
} catch (error) {
|
|
161632
|
-
filepath = path_exports.posixify(filepath);
|
|
161633
|
-
const mock3 = virtual_file(path_exports.basename(filepath), { withFileTypes: true });
|
|
161634
|
-
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"))) {
|
|
161635
|
-
return mock3;
|
|
161636
|
-
} else if (filepath.endsWith("+layout.js")) {
|
|
161637
|
-
return mock3;
|
|
161638
|
-
} else if (filepath.endsWith("+page.js")) {
|
|
161639
|
-
return mock3;
|
|
161640
|
-
}
|
|
161641
|
-
throw error;
|
|
161642
|
-
}
|
|
161643
|
-
};
|
|
161644
|
-
import_node_fs3.default.unlinkSync = function(filepath) {
|
|
161645
|
-
try {
|
|
161646
|
-
_unlinkSync(filepath);
|
|
161647
|
-
} catch {
|
|
161648
|
-
}
|
|
161649
|
-
};
|
|
161650
|
-
import_node_fs3.default.readdirSync = function(fp, options) {
|
|
161651
|
-
const filepath = getStringFilepath(fp);
|
|
161652
|
-
if (!filepath.includes("routes")) return _readDirSync(fp, options);
|
|
161653
|
-
const result = _readDirSync(fp, options);
|
|
161654
|
-
const file_names = result.map((file) => {
|
|
161655
|
-
if (file instanceof import_node_fs3.Dirent) {
|
|
161656
|
-
return file.name;
|
|
161657
|
-
} else if (typeof file === "string") {
|
|
161658
|
-
return file;
|
|
161659
|
-
} else {
|
|
161660
|
-
return "";
|
|
161661
|
-
}
|
|
161662
|
-
});
|
|
161663
|
-
function contains(...names) {
|
|
161664
|
-
return names.some((name) => file_names.includes(name));
|
|
161665
|
-
}
|
|
161666
|
-
if (contains("+page.svelte", "+page.gql") && !contains("+page.js", "+page.ts")) {
|
|
161667
|
-
result.push(virtual_file("+page.js", options));
|
|
161668
|
-
}
|
|
161669
|
-
const posix_filepath = path_exports.posixify(filepath);
|
|
161670
|
-
if ((is_root_route(posix_filepath) || contains("+layout.svelte", "+layout.gql")) && !contains("+layout.ts", "+layout.js")) {
|
|
161671
|
-
result.push(virtual_file("+layout.js", options));
|
|
161672
|
-
}
|
|
161673
|
-
if (is_root_route(posix_filepath) && !contains("+layout.svelte")) {
|
|
161674
|
-
result.push(virtual_file("+layout.svelte", options));
|
|
161675
|
-
}
|
|
161676
|
-
if (is_root_route(posix_filepath) && !contains("+layout.server.js", "+layout.server.ts") && !plugin_config(_config).static) {
|
|
161677
|
-
result.push(virtual_file("+layout.server.js", options));
|
|
161678
|
-
}
|
|
161679
|
-
return result;
|
|
161680
|
-
};
|
|
161681
|
-
Object.defineProperty(globalThis, "fs", {
|
|
161682
|
-
configurable: true,
|
|
161683
|
-
enumerable: true,
|
|
161684
|
-
value: import_node_fs3.default
|
|
161685
|
-
});
|
|
161686
|
-
var _readFile = import_promises5.default.readFile;
|
|
161687
|
-
import_promises5.default.readFile = async (path5, options) => {
|
|
161688
|
-
if (path5.toString().endsWith("+layout.svelte")) {
|
|
161689
|
-
try {
|
|
161690
|
-
return await _readFile(path5, options);
|
|
161691
|
-
} catch {
|
|
161692
|
-
return typeof options === "string" || options?.encoding ? empty_layout : Buffer.from(empty_layout);
|
|
161693
|
-
}
|
|
161694
|
-
}
|
|
161695
|
-
return _readFile(path5, options);
|
|
161696
|
-
};
|
|
161697
|
-
Object.defineProperty(globalThis, "fs/promises", {
|
|
161698
|
-
configurable: true,
|
|
161699
|
-
enumerable: true,
|
|
161700
|
-
value: import_promises5.default
|
|
161701
|
-
});
|
|
161702
|
-
function virtual_file(name, options) {
|
|
161703
|
-
return !options?.withFileTypes ? name : {
|
|
161704
|
-
name,
|
|
161705
|
-
isFile: () => true,
|
|
161706
|
-
isDirectory: () => false,
|
|
161707
|
-
isBlockDevice: () => false,
|
|
161708
|
-
isFIFO: () => false,
|
|
161709
|
-
isCharacterDevice: () => false,
|
|
161710
|
-
isSocket: () => false,
|
|
161711
|
-
isSymbolicLink: () => false
|
|
161712
|
-
};
|
|
161713
|
-
}
|
|
161714
|
-
function is_root_route(filepath) {
|
|
161715
|
-
filepath = filepath.toString();
|
|
161716
|
-
if (filepath.toString().endsWith("/")) {
|
|
161717
|
-
filepath = filepath.slice(0, -1);
|
|
161718
|
-
}
|
|
161719
|
-
return filepath.endsWith(path_exports.join("src", "routes")) && // ignore the src/routes that exists in the type roots
|
|
161720
|
-
!filepath.includes(".svelte-kit") && // ! Hey! This second value always needs to correspond to the default value for the runtimeDir
|
|
161721
|
-
// if you're changing this here, please also update it in `/packages/houdini/src/lib/config.ts`
|
|
161722
|
-
!filepath.includes(_config.runtimeDir ?? "$houdini");
|
|
161723
|
-
}
|
|
161724
|
-
var empty_layout = "<slot />";
|
|
161725
|
-
|
|
161726
161504
|
// src/plugin/transforms/index.ts
|
|
161727
161505
|
var recast21 = __toESM(require_main4(), 1);
|
|
161728
161506
|
|
|
@@ -162033,7 +161811,6 @@ async function kit_init(page) {
|
|
|
162033
161811
|
}
|
|
162034
161812
|
|
|
162035
161813
|
// src/plugin/transforms/kit/load.ts
|
|
162036
|
-
var graphql38 = __toESM(require("graphql"), 1);
|
|
162037
161814
|
var recast18 = __toESM(require_main4(), 1);
|
|
162038
161815
|
var AST19 = recast18.types.builders;
|
|
162039
161816
|
async function kit_load_generator(page) {
|
|
@@ -162048,9 +161825,7 @@ async function kit_load_generator(page) {
|
|
|
162048
161825
|
page,
|
|
162049
161826
|
artifact: { name }
|
|
162050
161827
|
}).id;
|
|
162051
|
-
const [
|
|
162052
|
-
find_special_query("Page", page),
|
|
162053
|
-
find_special_query("Layout", page),
|
|
161828
|
+
const [inline_queries, page_info] = await Promise.all([
|
|
162054
161829
|
find_inline_queries(
|
|
162055
161830
|
page,
|
|
162056
161831
|
// if we are currently on the route file, there's nothing to parse
|
|
@@ -162069,12 +161844,6 @@ async function kit_load_generator(page) {
|
|
|
162069
161844
|
if (script) {
|
|
162070
161845
|
const queries_that_needs_a_load = [...houdini_load_queries, ...inline_queries];
|
|
162071
161846
|
const isLayout = is_layout3(page.framework, page.filepath);
|
|
162072
|
-
if (isLayout && layout_query) {
|
|
162073
|
-
queries_that_needs_a_load.push(layout_query);
|
|
162074
|
-
}
|
|
162075
|
-
if (!isLayout && page_query) {
|
|
162076
|
-
queries_that_needs_a_load.push(page_query);
|
|
162077
|
-
}
|
|
162078
161847
|
add_load({
|
|
162079
161848
|
page,
|
|
162080
161849
|
queries: queries_that_needs_a_load,
|
|
@@ -162321,22 +162090,6 @@ function add_load({
|
|
|
162321
162090
|
);
|
|
162322
162091
|
}
|
|
162323
162092
|
}
|
|
162324
|
-
async function find_special_query(type, page) {
|
|
162325
|
-
const query_path = type === "Page" ? page_query_path(page.config, page.filepath) : layout_query_path(page.config, page.filepath);
|
|
162326
|
-
const contents = await fs_exports.readFile(query_path);
|
|
162327
|
-
if (!contents) {
|
|
162328
|
-
return null;
|
|
162329
|
-
}
|
|
162330
|
-
const parsed = graphql38.parse(contents);
|
|
162331
|
-
const definition = parsed.definitions.find(
|
|
162332
|
-
(defn) => defn.kind === "OperationDefinition" && defn.operation === "query"
|
|
162333
|
-
);
|
|
162334
|
-
if (!definition) {
|
|
162335
|
-
formatErrors({ message: "gql file must contain a query.", filepath: query_path });
|
|
162336
|
-
return null;
|
|
162337
|
-
}
|
|
162338
|
-
return definition;
|
|
162339
|
-
}
|
|
162340
162093
|
function load_hook_statements(name, request_context, input_id, result_id) {
|
|
162341
162094
|
return AST19.expressionStatement(
|
|
162342
162095
|
AST19.awaitExpression(
|
|
@@ -162697,7 +162450,6 @@ function replace_tag_content(source, start, end, insert) {
|
|
|
162697
162450
|
var replace_between = (origin, startIndex, endIndex, insertion) => origin.substring(0, startIndex) + insertion + origin.substring(endIndex);
|
|
162698
162451
|
|
|
162699
162452
|
// src/plugin/validate.ts
|
|
162700
|
-
var graphql39 = __toESM(require("graphql"), 1);
|
|
162701
162453
|
async function validate2({
|
|
162702
162454
|
config,
|
|
162703
162455
|
documents
|
|
@@ -162724,28 +162476,6 @@ async function validate2({
|
|
|
162724
162476
|
})
|
|
162725
162477
|
);
|
|
162726
162478
|
}
|
|
162727
|
-
graphql39.visit(doc.document, {
|
|
162728
|
-
Directive(node, _, __, ___, ancestors) {
|
|
162729
|
-
const blockingDirectives = [
|
|
162730
|
-
config.blockingDirective,
|
|
162731
|
-
config.blockingDisableDirective
|
|
162732
|
-
];
|
|
162733
|
-
if (!blockingDirectives.includes(node.name.value)) {
|
|
162734
|
-
return;
|
|
162735
|
-
}
|
|
162736
|
-
const { definition } = definitionFromAncestors(ancestors);
|
|
162737
|
-
const listDirective = definition.directives?.map((c) => c.name.value) ?? [];
|
|
162738
|
-
if (listDirective.includes(config.blockingDirective) && listDirective.includes(config.blockingDisableDirective)) {
|
|
162739
|
-
errors.push(
|
|
162740
|
-
new HoudiniError({
|
|
162741
|
-
filepath: doc.filename,
|
|
162742
|
-
message: `You can't apply both @${config.blockingDirective} and @${config.blockingDisableDirective} at the same time`
|
|
162743
|
-
})
|
|
162744
|
-
);
|
|
162745
|
-
}
|
|
162746
|
-
return;
|
|
162747
|
-
}
|
|
162748
|
-
});
|
|
162749
162479
|
}
|
|
162750
162480
|
if (errors.length > 0) {
|
|
162751
162481
|
throw errors;
|
|
@@ -162804,24 +162534,6 @@ export const redirect = svelteKitRedirect
|
|
|
162804
162534
|
artifactData,
|
|
162805
162535
|
// custom logic to pull a graphql document out of a svelte file
|
|
162806
162536
|
extractDocuments: extract_default,
|
|
162807
|
-
schema({ config }) {
|
|
162808
|
-
return `
|
|
162809
|
-
"""
|
|
162810
|
-
@${config.loadDirective} is used to enable automatic fetch on inline queries.
|
|
162811
|
-
"""
|
|
162812
|
-
directive @${config.loadDirective} on QUERY
|
|
162813
|
-
|
|
162814
|
-
"""
|
|
162815
|
-
@${config.blockingDirective} is used to always await the fetch.
|
|
162816
|
-
"""
|
|
162817
|
-
directive @${config.blockingDirective} on QUERY
|
|
162818
|
-
|
|
162819
|
-
"""
|
|
162820
|
-
@${config.blockingDisableDirective} is used to not always await the fetch (in CSR for example). Note that "throwOnError" will not throw in this case.
|
|
162821
|
-
"""
|
|
162822
|
-
directive @${config.blockingDisableDirective} on QUERY
|
|
162823
|
-
`;
|
|
162824
|
-
},
|
|
162825
162537
|
// we have some custom document validation logic
|
|
162826
162538
|
validate: validate2,
|
|
162827
162539
|
// we need to write the svelte specific runtime
|
|
@@ -162859,10 +162571,6 @@ directive @${config.blockingDisableDirective} on QUERY
|
|
|
162859
162571
|
include({ config, filepath }) {
|
|
162860
162572
|
return config.includeFile(resolve_relative(config, filepath), { ignore_plugins: true });
|
|
162861
162573
|
},
|
|
162862
|
-
// add custom vite config
|
|
162863
|
-
vite: {
|
|
162864
|
-
...fsPatch_default(() => framework)
|
|
162865
|
-
},
|
|
162866
162574
|
/**
|
|
162867
162575
|
* Setup
|
|
162868
162576
|
*/
|