@velastack/patterns 0.15.1 → 0.15.3
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/dist/chunks/_page-CFeYIl2d.js +5 -0
- package/dist/chunks/_page-CFeYIl2d.js.map +1 -0
- package/dist/chunks/_page-DkCd_o3E.js +5 -0
- package/dist/chunks/{_page-Cg7LjaOE.js.map → _page-DkCd_o3E.js.map} +1 -1
- package/dist/chunks/{auth-pages-DSBqKjO0.js → auth-pages-mZeR1WIj.js} +2 -2
- package/dist/chunks/{auth-pages-DSBqKjO0.js.map → auth-pages-mZeR1WIj.js.map} +1 -1
- package/dist/chunks/{collections-D2_2cxWD.js → collections-Daxlnbm0.js} +2 -2
- package/dist/chunks/{collections-D2_2cxWD.js.map → collections-Daxlnbm0.js.map} +1 -1
- package/dist/chunks/{constants-DbpctM1D.js → constants-E1I-__KI.js} +18 -18
- package/dist/chunks/{constants-DbpctM1D.js.map → constants-E1I-__KI.js.map} +1 -1
- package/dist/chunks/{currency.server-CFrwmYra.js → currency.server-CHzEhyTx.js} +74 -74
- package/dist/chunks/currency.server-CHzEhyTx.js.map +1 -0
- package/dist/chunks/dispatch-DSkRrJFe.js +5 -0
- package/dist/chunks/{dispatch-BxlKS_5v.js.map → dispatch-DSkRrJFe.js.map} +1 -1
- package/dist/chunks/{env-vars-Dm3Xy4rl.js → env-vars-C3TSZc4f.js} +3 -3
- package/dist/chunks/{env-vars-Dm3Xy4rl.js.map → env-vars-C3TSZc4f.js.map} +1 -1
- package/dist/chunks/{generate-BMWoD9E2.js → generate-CAYM7OUF.js} +2 -2
- package/dist/chunks/{generate-BMWoD9E2.js.map → generate-CAYM7OUF.js.map} +1 -1
- package/dist/chunks/{generate-DZ9kT3iC.js → generate-CL7wG0ZC.js} +3 -3
- package/dist/chunks/{generate-DZ9kT3iC.js.map → generate-CL7wG0ZC.js.map} +1 -1
- package/dist/chunks/{generate-BRTIGlqT.js → generate-CbchamhA.js} +3 -3
- package/dist/chunks/{generate-BRTIGlqT.js.map → generate-CbchamhA.js.map} +1 -1
- package/dist/chunks/{generate-BvQ6VwYH.js → generate-DR2wkVPY.js} +2 -2
- package/dist/chunks/{generate-BvQ6VwYH.js.map → generate-DR2wkVPY.js.map} +1 -1
- package/dist/chunks/{generate-Cs_fdfD7.js → generate-DZ2S8KDR.js} +3 -3
- package/dist/chunks/{generate-Cs_fdfD7.js.map → generate-DZ2S8KDR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Cd742Yqf.js → generate.runtime-373mTxeo.js} +113 -104
- package/dist/chunks/generate.runtime-373mTxeo.js.map +1 -0
- package/dist/chunks/{generate.runtime-1eTnPFmA.js → generate.runtime-B11mOr45.js} +2 -2
- package/dist/chunks/{generate.runtime-1eTnPFmA.js.map → generate.runtime-B11mOr45.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CnNtG_x5.js → generate.runtime-B7VubPTW.js} +3 -3
- package/dist/chunks/{generate.runtime-CnNtG_x5.js.map → generate.runtime-B7VubPTW.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BvHK8IN-.js → generate.runtime-BCv4F1Wm.js} +5 -5
- package/dist/chunks/{generate.runtime-BvHK8IN-.js.map → generate.runtime-BCv4F1Wm.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D8G8cwCr.js → generate.runtime-BEWp57Y7.js} +2 -2
- package/dist/chunks/{generate.runtime-D8G8cwCr.js.map → generate.runtime-BEWp57Y7.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CfCDLJ6Y.js → generate.runtime-BL6DpWFI.js} +3 -3
- package/dist/chunks/{generate.runtime-CfCDLJ6Y.js.map → generate.runtime-BL6DpWFI.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BJwSyslL.js → generate.runtime-BRV9hIl5.js} +2 -2
- package/dist/chunks/{generate.runtime-BJwSyslL.js.map → generate.runtime-BRV9hIl5.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B9nVU5iO.js → generate.runtime-BRcP6sFt.js} +2 -2
- package/dist/chunks/{generate.runtime-B9nVU5iO.js.map → generate.runtime-BRcP6sFt.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BC1GJUXE.js → generate.runtime-Bhs7ttZS.js} +2 -2
- package/dist/chunks/{generate.runtime-BC1GJUXE.js.map → generate.runtime-Bhs7ttZS.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B4mQEW54.js → generate.runtime-BjTZ2Ls-.js} +76 -76
- package/dist/chunks/generate.runtime-BjTZ2Ls-.js.map +1 -0
- package/dist/chunks/{generate.runtime-Bda2_WK7.js → generate.runtime-BjrtdoYE.js} +2 -2
- package/dist/chunks/{generate.runtime-Bda2_WK7.js.map → generate.runtime-BjrtdoYE.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CjLath7N.js → generate.runtime-Bn17HK_S.js} +100 -98
- package/dist/chunks/generate.runtime-Bn17HK_S.js.map +1 -0
- package/dist/chunks/{generate.runtime-DBQvnQmR.js → generate.runtime-Bo_s7gYB.js} +2 -2
- package/dist/chunks/{generate.runtime-DBQvnQmR.js.map → generate.runtime-Bo_s7gYB.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B-H2F-sH.js → generate.runtime-C90_2L-8.js} +3 -3
- package/dist/chunks/{generate.runtime-B-H2F-sH.js.map → generate.runtime-C90_2L-8.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B4rG6gSK.js → generate.runtime-CDY0Ot_t.js} +6 -6
- package/dist/chunks/{generate.runtime-B4rG6gSK.js.map → generate.runtime-CDY0Ot_t.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Doumu0TL.js → generate.runtime-CZMVPVjS.js} +6 -6
- package/dist/chunks/{generate.runtime-Doumu0TL.js.map → generate.runtime-CZMVPVjS.js.map} +1 -1
- package/dist/chunks/{generate.runtime-liAz2TOE.js → generate.runtime-C_hrLPD4.js} +3 -3
- package/dist/chunks/{generate.runtime-liAz2TOE.js.map → generate.runtime-C_hrLPD4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BkQPchHe.js → generate.runtime-ChSVP7cD.js} +6 -6
- package/dist/chunks/{generate.runtime-BkQPchHe.js.map → generate.runtime-ChSVP7cD.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C1HlZnLC.js → generate.runtime-Cs73i6Zf.js} +2 -2
- package/dist/chunks/{generate.runtime-C1HlZnLC.js.map → generate.runtime-Cs73i6Zf.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DFSsgOmB.js → generate.runtime-DG9LRwbt.js} +3 -3
- package/dist/chunks/{generate.runtime-DFSsgOmB.js.map → generate.runtime-DG9LRwbt.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CZA46Ghe.js → generate.runtime-DIIeK2w9.js} +5 -5
- package/dist/chunks/{generate.runtime-CZA46Ghe.js.map → generate.runtime-DIIeK2w9.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CIOi-XSm.js → generate.runtime-DKL7VAAd.js} +6 -6
- package/dist/chunks/{generate.runtime-CIOi-XSm.js.map → generate.runtime-DKL7VAAd.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CQ_U4YTJ.js → generate.runtime-DP63Wwea.js} +4 -4
- package/dist/chunks/{generate.runtime-CQ_U4YTJ.js.map → generate.runtime-DP63Wwea.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C62ChKGg.js → generate.runtime-DRPxOLnB.js} +4 -4
- package/dist/chunks/{generate.runtime-C62ChKGg.js.map → generate.runtime-DRPxOLnB.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DE-vPcn4.js → generate.runtime-DVZUNxtv.js} +6 -6
- package/dist/chunks/{generate.runtime-DE-vPcn4.js.map → generate.runtime-DVZUNxtv.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DQI69jkX.js → generate.runtime-DW9bqOtC.js} +2 -2
- package/dist/chunks/{generate.runtime-DQI69jkX.js.map → generate.runtime-DW9bqOtC.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Dtum580c.js → generate.runtime-DXqBku2y.js} +6 -6
- package/dist/chunks/{generate.runtime-Dtum580c.js.map → generate.runtime-DXqBku2y.js.map} +1 -1
- package/dist/chunks/{generate.runtime-GmsldrGj.js → generate.runtime-DgKiFemb.js} +4 -4
- package/dist/chunks/{generate.runtime-GmsldrGj.js.map → generate.runtime-DgKiFemb.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DQUZRJH8.js → generate.runtime-DmbDEjMA.js} +4 -4
- package/dist/chunks/{generate.runtime-DQUZRJH8.js.map → generate.runtime-DmbDEjMA.js.map} +1 -1
- package/dist/chunks/{generate.runtime-rxzMCECc.js → generate.runtime-VZIxJWlr.js} +72 -64
- package/dist/chunks/generate.runtime-VZIxJWlr.js.map +1 -0
- package/dist/chunks/{generate.runtime-DNjyaFml.js → generate.runtime-_426A1Ij.js} +3 -3
- package/dist/chunks/{generate.runtime-DNjyaFml.js.map → generate.runtime-_426A1Ij.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DR8z6DyZ.js → generate.runtime-fs6GEMx-.js} +5 -5
- package/dist/chunks/{generate.runtime-DR8z6DyZ.js.map → generate.runtime-fs6GEMx-.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Diix70x4.js → generate.runtime-jIlQ2GMh.js} +2 -2
- package/dist/chunks/{generate.runtime-Diix70x4.js.map → generate.runtime-jIlQ2GMh.js.map} +1 -1
- package/dist/chunks/{generate.runtime-ufoTIUXA.js → generate.runtime-sey-wxXB.js} +7 -7
- package/dist/chunks/{generate.runtime-ufoTIUXA.js.map → generate.runtime-sey-wxXB.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BuQASx9Y.js → generate.runtime-v3KCv1B6.js} +2 -2
- package/dist/chunks/{generate.runtime-BuQASx9Y.js.map → generate.runtime-v3KCv1B6.js.map} +1 -1
- package/dist/chunks/{generate.runtime-lP4eoera.js → generate.runtime-xrxAElb3.js} +3 -3
- package/dist/chunks/{generate.runtime-lP4eoera.js.map → generate.runtime-xrxAElb3.js.map} +1 -1
- package/dist/chunks/{gitignore-2XpeEFmr.js → gitignore-CBiWFRif.js} +3 -3
- package/dist/chunks/{gitignore-2XpeEFmr.js.map → gitignore-CBiWFRif.js.map} +1 -1
- package/dist/chunks/{i18n-CxT1kz8Y.js → i18n-Ho8H91Ze.js} +2 -2
- package/dist/chunks/{i18n-CxT1kz8Y.js.map → i18n-Ho8H91Ze.js.map} +1 -1
- package/dist/chunks/{modify-file-BX9-aZD1.js → modify-file-BOEKlIDw.js} +2 -2
- package/dist/chunks/{modify-file-BX9-aZD1.js.map → modify-file-BOEKlIDw.js.map} +1 -1
- package/dist/chunks/{pocketbase-Dq9UdK_j.js → pocketbase-B2ksFrvH.js} +2 -2
- package/dist/chunks/{pocketbase-Dq9UdK_j.js.map → pocketbase-B2ksFrvH.js.map} +1 -1
- package/dist/chunks/{providers-2UgxXRJW.js → providers-BEjDonyG.js} +2 -2
- package/dist/chunks/{providers-2UgxXRJW.js.map → providers-BEjDonyG.js.map} +1 -1
- package/dist/chunks/{route-BDhlro0V.js → route-9ZVJZkYu.js} +23 -19
- package/dist/chunks/route-9ZVJZkYu.js.map +1 -0
- package/dist/chunks/{schema-2frI_BS2.js → schema-DnMqw2Hn.js} +3 -3
- package/dist/chunks/{schema-2frI_BS2.js.map → schema-DnMqw2Hn.js.map} +1 -1
- package/dist/chunks/{shared-BOFCKWJs.js → shared-CSwGWMcN.js} +2 -2
- package/dist/chunks/{shared-BOFCKWJs.js.map → shared-CSwGWMcN.js.map} +1 -1
- package/dist/chunks/{shared-DJ4KvhTb.js → shared-Cdwm_-Nl.js} +40 -40
- package/dist/chunks/{shared-DJ4KvhTb.js.map → shared-Cdwm_-Nl.js.map} +1 -1
- package/dist/chunks/{site-qASrdyUt.js → site-B5zrFba9.js} +2 -2
- package/dist/chunks/{site-qASrdyUt.js.map → site-B5zrFba9.js.map} +1 -1
- package/dist/chunks/{table-core-s2xjYgRD.js → table-core-ux1xEJxN.js} +2 -2
- package/dist/chunks/{table-core-s2xjYgRD.js.map → table-core-ux1xEJxN.js.map} +1 -1
- package/dist/chunks/{ui-DZuwcswv.js → ui-CpjUq_lm.js} +3 -3
- package/dist/chunks/{ui-DZuwcswv.js.map → ui-CpjUq_lm.js.map} +1 -1
- package/dist/chunks/{unmodify-load-CdWXJ_Ac.js → unmodify-load-DWixBz7y.js} +17 -4
- package/dist/chunks/unmodify-load-DWixBz7y.js.map +1 -0
- package/dist/chunks/{whatsapp-BytvTPlS.js → whatsapp-DOSZ_zwn.js} +2 -2
- package/dist/chunks/{whatsapp-BytvTPlS.js.map → whatsapp-DOSZ_zwn.js.map} +1 -1
- package/dist/chunks/{write-result-BhfLWAXf.js → write-result-DlB-id5k.js} +50 -26
- package/dist/chunks/write-result-DlB-id5k.js.map +1 -0
- package/dist/index.js +1997 -1965
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_page-Bt37d4uo.js +0 -5
- package/dist/chunks/_page-Bt37d4uo.js.map +0 -1
- package/dist/chunks/_page-Cg7LjaOE.js +0 -5
- package/dist/chunks/currency.server-CFrwmYra.js.map +0 -1
- package/dist/chunks/dispatch-BxlKS_5v.js +0 -5
- package/dist/chunks/generate.runtime-B4mQEW54.js.map +0 -1
- package/dist/chunks/generate.runtime-Cd742Yqf.js.map +0 -1
- package/dist/chunks/generate.runtime-CjLath7N.js.map +0 -1
- package/dist/chunks/generate.runtime-rxzMCECc.js.map +0 -1
- package/dist/chunks/route-BDhlro0V.js.map +0 -1
- package/dist/chunks/unmodify-load-CdWXJ_Ac.js.map +0 -1
- package/dist/chunks/write-result-BhfLWAXf.js.map +0 -1
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { a as t, r as n, t as r } from "./collections-
|
|
3
|
-
import { i, n as a, t as o } from "./pocketbase-
|
|
4
|
-
import { r as s } from "./modify-file-
|
|
2
|
+
import { a as t, r as n, t as r } from "./collections-Daxlnbm0.js";
|
|
3
|
+
import { i, n as a, t as o } from "./pocketbase-B2ksFrvH.js";
|
|
4
|
+
import { r as s } from "./modify-file-BOEKlIDw.js";
|
|
5
5
|
import { t as c } from "./modify-utils--zro3IGe.js";
|
|
6
6
|
import { t as l } from "./dedent-CCUOcPFW.js";
|
|
7
7
|
import { t as u } from "./svelte-file-DfplF3BU.js";
|
|
8
|
-
import { _ as d,
|
|
9
|
-
import { t as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { Project as
|
|
8
|
+
import { _ as d, i as f, o as p, r as m } from "./ts-morph-helpers-B4KZXP44.js";
|
|
9
|
+
import { t as h } from "./pocketbase-YG9yht8R.js";
|
|
10
|
+
import g from "node:fs";
|
|
11
|
+
import _ from "node:path";
|
|
12
|
+
import { Project as v, SyntaxKind as y } from "ts-morph";
|
|
13
13
|
// src/patterns/enable/notifications/modifies/modify-app-layout.ts
|
|
14
|
-
var
|
|
14
|
+
var b = "\n <div class=\"ml-auto px-4\">\n <NotificationsBell />\n </div>\n ", x = l`
|
|
15
15
|
import NotificationsBell from '#lib/components/notifications-bell.svelte';
|
|
16
|
-
`,
|
|
16
|
+
`, S = [
|
|
17
17
|
"Add the notifications bell inside the (app) layout's <header>.",
|
|
18
18
|
"",
|
|
19
19
|
"Imports to add to the <script> tag:",
|
|
20
20
|
"",
|
|
21
|
-
|
|
21
|
+
x,
|
|
22
22
|
"",
|
|
23
23
|
"Markup to add inside <header>:",
|
|
24
|
-
|
|
25
|
-
].join("\n"),
|
|
24
|
+
b
|
|
25
|
+
].join("\n"), C = [
|
|
26
26
|
"Create src/routes/(app)/+layout.svelte with a <header> that includes the bell.",
|
|
27
27
|
"",
|
|
28
28
|
"Imports for the <script> tag:",
|
|
29
29
|
"",
|
|
30
|
-
|
|
30
|
+
x,
|
|
31
31
|
"",
|
|
32
32
|
"Markup inside <header>:",
|
|
33
|
-
|
|
33
|
+
b
|
|
34
34
|
].join("\n");
|
|
35
|
-
function
|
|
36
|
-
if (!
|
|
35
|
+
function w(e) {
|
|
36
|
+
if (!g.existsSync(e)) return {
|
|
37
37
|
status: "not-found",
|
|
38
|
-
message:
|
|
38
|
+
message: C
|
|
39
39
|
};
|
|
40
40
|
let t = u.fromPath(e);
|
|
41
41
|
return t.hasElement("header") ? t.hasElement("NotificationsBell") ? {
|
|
@@ -43,60 +43,65 @@ function C(e) {
|
|
|
43
43
|
changed: !1
|
|
44
44
|
} : (t.modifyScript((e) => {
|
|
45
45
|
let { source: t } = d(e, (e) => {
|
|
46
|
-
|
|
46
|
+
m(e, [{
|
|
47
47
|
defaultImport: "NotificationsBell",
|
|
48
48
|
moduleSpecifier: "#lib/components/notifications-bell.svelte"
|
|
49
49
|
}]);
|
|
50
50
|
});
|
|
51
51
|
return t;
|
|
52
|
-
}), t.insertBeforeClosingTag("header",
|
|
52
|
+
}), t.insertBeforeClosingTag("header", b), t.writeTo(e), {
|
|
53
53
|
status: "success",
|
|
54
54
|
changed: t.hasChanged()
|
|
55
55
|
}) : {
|
|
56
56
|
status: "failed",
|
|
57
|
-
message:
|
|
57
|
+
message: S
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
// src/patterns/enable/notifications/modifies/+layout.server.ts
|
|
61
|
-
var
|
|
61
|
+
var T = "@velastack/pocketbase/auth", E = "const user = requireUser();", D = l`
|
|
62
62
|
const notificationsList = await locals.pb
|
|
63
63
|
.collection("notifications")
|
|
64
64
|
.getList(1, 5, {
|
|
65
|
-
filter:
|
|
65
|
+
filter: locals.pb.filter("user = {:user} && read = false", {
|
|
66
|
+
user: user.id,
|
|
67
|
+
}),
|
|
66
68
|
sort: "-created",
|
|
67
69
|
});
|
|
68
|
-
`,
|
|
69
|
-
function
|
|
70
|
-
if (!
|
|
70
|
+
`, O = "const notifications = { count: notificationsList.totalItems, items: notificationsList.items };", k = "depends(\"app:notifications\");";
|
|
71
|
+
function A(e) {
|
|
72
|
+
if (!g.existsSync(e)) {
|
|
71
73
|
let t = l`
|
|
74
|
+
import { requireUser } from "${T}";
|
|
75
|
+
|
|
72
76
|
export const load = async ({ locals, depends }) => {
|
|
73
|
-
${w}
|
|
74
|
-
${T}
|
|
75
77
|
${E}
|
|
78
|
+
${D}
|
|
79
|
+
${O}
|
|
80
|
+
${k}
|
|
76
81
|
return { notifications };
|
|
77
82
|
};
|
|
78
83
|
`;
|
|
79
|
-
return
|
|
84
|
+
return g.writeFileSync(e, t), {
|
|
80
85
|
status: "success",
|
|
81
86
|
changed: !0
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
|
-
let t =
|
|
89
|
+
let t = g.readFileSync(e, "utf8"), n = new v().addSourceFileAtPath(e), r = (e, t, n) => {
|
|
85
90
|
e.getProperty(t) || (t === n ? e.addShorthandPropertyAssignment({ name: t }) : e.addPropertyAssignment({
|
|
86
91
|
name: t,
|
|
87
92
|
initializer: n
|
|
88
93
|
}));
|
|
89
94
|
}, i, a, o = n.getVariableDeclaration("load");
|
|
90
|
-
if (o && o.getFirstAncestorByKind(
|
|
91
|
-
let e = o.getInitializerIfKind(
|
|
95
|
+
if (o && o.getFirstAncestorByKind(y.VariableStatement)?.hasExportKeyword()) {
|
|
96
|
+
let e = o.getInitializerIfKind(y.ArrowFunction);
|
|
92
97
|
if (e) i = e;
|
|
93
98
|
else {
|
|
94
99
|
let e = o.getInitializer();
|
|
95
100
|
if (e) {
|
|
96
|
-
let t = e.getFirstDescendantByKind(
|
|
101
|
+
let t = e.getFirstDescendantByKind(y.ArrowFunction);
|
|
97
102
|
if (t) i = t;
|
|
98
103
|
else {
|
|
99
|
-
let t = e.getFirstDescendantByKind(
|
|
104
|
+
let t = e.getFirstDescendantByKind(y.FunctionExpression);
|
|
100
105
|
t && (a = t);
|
|
101
106
|
}
|
|
102
107
|
}
|
|
@@ -112,12 +117,13 @@ function D(e) {
|
|
|
112
117
|
name: "load",
|
|
113
118
|
parameters: [{ name: "{ locals, depends }" }],
|
|
114
119
|
statements: [
|
|
115
|
-
w,
|
|
116
|
-
T,
|
|
117
120
|
E,
|
|
121
|
+
D,
|
|
122
|
+
O,
|
|
123
|
+
k,
|
|
118
124
|
"return { notifications };"
|
|
119
125
|
]
|
|
120
|
-
}), f(n), n.saveSync(), {
|
|
126
|
+
}), f(n, T, "requireUser"), p(n), n.saveSync(), {
|
|
121
127
|
status: "success",
|
|
122
128
|
changed: !0
|
|
123
129
|
};
|
|
@@ -125,7 +131,7 @@ function D(e) {
|
|
|
125
131
|
if (c.length === 0) s.insertParameter(0, { name: "{ locals, depends }" });
|
|
126
132
|
else {
|
|
127
133
|
let e = c[0], t = e.getStructure(), n = e.getNameNode();
|
|
128
|
-
if (n.getKind() ===
|
|
134
|
+
if (n.getKind() === y.ObjectBindingPattern) {
|
|
129
135
|
let r = n, i = r.getElements().map((e) => e.getName()), a = i.includes("depends"), o = i.includes("locals");
|
|
130
136
|
if (!a || !o) {
|
|
131
137
|
let n = r.getElements().map((e) => e.getText()).filter(Boolean), i = o ? [] : ["locals"];
|
|
@@ -150,55 +156,57 @@ function D(e) {
|
|
|
150
156
|
}
|
|
151
157
|
i && !i.isAsync() ? i.setIsAsync(!0) : a && !a.isAsync() && a.setIsAsync(!0);
|
|
152
158
|
let u = s.getBody();
|
|
153
|
-
if (u && u.getKind() ===
|
|
154
|
-
let e = u, t = e.getStatements(),
|
|
159
|
+
if (u && u.getKind() === y.Block) {
|
|
160
|
+
let e = u, t = e.getStatements(), r = (e) => t.some((t) => t.getKind() === y.VariableStatement && t.getDeclarations().some((t) => t.getName() === e)), i = t.some((e) => e.getKind() === y.ExpressionStatement && e.getDescendantsOfKind(y.CallExpression).some((e) => {
|
|
155
161
|
if (e.getExpression().getText() !== "depends") return !1;
|
|
156
162
|
let t = e.getArguments(), n = t[0]?.getText() ?? "";
|
|
157
163
|
return t.length === 1 && (n === "'app:notifications'" || n === "\"app:notifications\"");
|
|
158
|
-
})),
|
|
159
|
-
|
|
164
|
+
})), a = r("notificationsList"), o = r("notifications");
|
|
165
|
+
!a && !r("user") && (e.insertStatements(0, E), f(n, T, "requireUser"));
|
|
166
|
+
let s = e.getStatements(), c = s.findIndex((e) => e.getKind() === y.ReturnStatement), l = c >= 0 ? c : s.length;
|
|
167
|
+
a || (e.insertStatements(l, D), l++), o || (e.insertStatements(l, O), l++), i || e.insertStatements(l, k);
|
|
160
168
|
}
|
|
161
169
|
let d = (e) => {
|
|
162
170
|
r(e, "notifications", "notifications");
|
|
163
|
-
},
|
|
164
|
-
e.getDescendantsOfKind(
|
|
171
|
+
}, m = (e) => {
|
|
172
|
+
e.getDescendantsOfKind(y.ReturnStatement).forEach((e) => {
|
|
165
173
|
let t = e.getExpression();
|
|
166
174
|
if (t) {
|
|
167
|
-
if (t.getKind() ===
|
|
168
|
-
else if (t.getKind() ===
|
|
175
|
+
if (t.getKind() === y.ObjectLiteralExpression) d(t);
|
|
176
|
+
else if (t.getKind() === y.ParenthesizedExpression) {
|
|
169
177
|
let e = t.getExpression();
|
|
170
|
-
e.getKind() ===
|
|
178
|
+
e.getKind() === y.ObjectLiteralExpression && d(e);
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
181
|
});
|
|
174
182
|
};
|
|
175
183
|
if (i) {
|
|
176
184
|
let e = i.getBody();
|
|
177
|
-
if (e.getKind() ===
|
|
185
|
+
if (e.getKind() === y.Block) m(e);
|
|
178
186
|
else {
|
|
179
187
|
let t = e;
|
|
180
|
-
if (t.getKind() ===
|
|
188
|
+
if (t.getKind() === y.ParenthesizedExpression) {
|
|
181
189
|
let e = t.getExpression();
|
|
182
|
-
e.getKind() ===
|
|
183
|
-
} else t.getKind() ===
|
|
190
|
+
e.getKind() === y.ObjectLiteralExpression && d(e);
|
|
191
|
+
} else t.getKind() === y.ObjectLiteralExpression && d(t);
|
|
184
192
|
}
|
|
185
193
|
} else if (a) {
|
|
186
194
|
let e = a.getBody();
|
|
187
|
-
e &&
|
|
195
|
+
e && m(e);
|
|
188
196
|
}
|
|
189
|
-
return
|
|
197
|
+
return p(n), n.saveSync(), {
|
|
190
198
|
status: "success",
|
|
191
199
|
changed: n.getFullText() !== t
|
|
192
200
|
};
|
|
193
201
|
}
|
|
194
202
|
// src/patterns/enable/notifications/generate.runtime.ts
|
|
195
|
-
async function
|
|
203
|
+
async function j(e, n, r, i = !0) {
|
|
196
204
|
if (!i) return;
|
|
197
205
|
await a();
|
|
198
206
|
let s = o(n, "created", r);
|
|
199
207
|
s && e.push(await t(s, r));
|
|
200
208
|
}
|
|
201
|
-
async function
|
|
209
|
+
async function M(t) {
|
|
202
210
|
let a = e(t), o = [];
|
|
203
211
|
await i(t.root, async (e) => {
|
|
204
212
|
let i = await e.collections.getOne("users"), s = (t) => n(e, t, a);
|
|
@@ -254,19 +262,19 @@ async function k(t) {
|
|
|
254
262
|
],
|
|
255
263
|
indexes: ["CREATE INDEX `idx_notifications_user_read_created` ON `notifications` (`user`, `read`, `created` DESC)"]
|
|
256
264
|
});
|
|
257
|
-
await
|
|
258
|
-
let l = await r(e,
|
|
265
|
+
await j(o, "notifications", t, c.created), a.info("Applying notifications rule patches");
|
|
266
|
+
let l = await r(e, h, t, a);
|
|
259
267
|
o.push(...l);
|
|
260
268
|
});
|
|
261
269
|
let l = [], u = (e) => {
|
|
262
270
|
e && l.push(e);
|
|
263
271
|
};
|
|
264
272
|
a.info("Modifying (app) +layout.svelte");
|
|
265
|
-
let d =
|
|
266
|
-
u(s(d,
|
|
267
|
-
let f =
|
|
268
|
-
u(s(f,
|
|
269
|
-
let p =
|
|
273
|
+
let d = _.join(t.root, "src", "routes", "(app)", "+layout.svelte");
|
|
274
|
+
u(s(d, w(d))), a.info("Modifying (app) +layout.server.ts");
|
|
275
|
+
let f = _.join(t.root, "src", "routes", "(app)", "+layout.server.ts");
|
|
276
|
+
u(s(f, A(f))), a.info("Modifying utils.ts");
|
|
277
|
+
let p = _.join(t.root, "src", "lib", "utils.ts");
|
|
270
278
|
return u(s(p, c(p))), {
|
|
271
279
|
creates: o,
|
|
272
280
|
modifies: l,
|
|
@@ -278,6 +286,6 @@ async function k(t) {
|
|
|
278
286
|
collectionDrops: []
|
|
279
287
|
};
|
|
280
288
|
}
|
|
281
|
-
export {
|
|
289
|
+
export { M as generate };
|
|
282
290
|
|
|
283
|
-
//# sourceMappingURL=generate.runtime-
|
|
291
|
+
//# sourceMappingURL=generate.runtime-VZIxJWlr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-VZIxJWlr.js","names":["getLogger","readMigration","createCollectionIdempotent","applyCollectionRulePatches","migrationDelay","getMigrationFile","modifyOutcomeToFile","modifyUtils","dedent","SvelteFile","withInMemoryScript","ensureNamedImport","formatLikeSource","ensureImports","NOTIFICATION_RULE_PATCHES","fs","path","BELL_SNIPPET","IMPORT_SNIPPET","FAILURE_HINT","NOT_FOUND_HINT","modifyAppLayout","layoutPath","file","out","source","sf","AUTH_MODULE","USER_STATEMENT","FETCH_STATEMENT","NOTIFICATIONS_STATEMENT","DEPENDS_STATEMENT","modifyLayoutServer","layoutServerPath","snippet","originalSource","sourceFile","Project","addProperty","obj","name","initializer","loadArrow","loadFn","varDecl","SyntaxKind","directArrow","init","innerArrow","innerFnExpr","maybeFn","fnLike","params","first","original","nameNode","obp","elementNames","el","hasDepends","hasLocals","existingParts","parts","currentName","body","blockBody","statements","declaresVar","stmt","d","hasDependsCall","ce","args","argText","hasNotificationsList","hasNotifications","current","returnIdx","s","insertAt","augmentReturnObject","augmentReturns","expr","ret","inner","arrowBody","bodyExpr","fnBody","pushMigrationCreates","created","migrationFile","collectionName","options","creates","generate","logger","withPocketbase","userCollection","pb","create","spec","result","ruleMigrations","modifies","pushResult","appLayoutPath","appLayoutServerPath","utilsPath"],"sources":["../../src/patterns/enable/notifications/modifies/modify-app-layout.ts","../../src/patterns/enable/notifications/modifies/+layout.server.ts","../../src/patterns/enable/notifications/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst BELL_SNIPPET = `\n\t\t<div class=\"ml-auto px-4\">\n\t\t\t<NotificationsBell />\n\t\t</div>\n\t`;\n\nconst IMPORT_SNIPPET = dedent`\n import NotificationsBell from '#lib/components/notifications-bell.svelte';\n`;\n\nconst FAILURE_HINT = [\n \"Add the notifications bell inside the (app) layout's <header>.\",\n \"\",\n \"Imports to add to the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add inside <header>:\",\n BELL_SNIPPET,\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(app)/+layout.svelte with a <header> that includes the bell.\",\n \"\",\n \"Imports for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup inside <header>:\",\n BELL_SNIPPET,\n].join(\"\\n\");\n\nexport function modifyAppLayout(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (!file.hasElement(\"header\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (file.hasElement(\"NotificationsBell\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n defaultImport: \"NotificationsBell\",\n moduleSpecifier: \"#lib/components/notifications-bell.svelte\",\n },\n ]);\n });\n return out;\n });\n\n file.insertBeforeClosingTag(\"header\", BELL_SNIPPET);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureNamedImport,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst AUTH_MODULE = \"@velastack/pocketbase/auth\";\n\n/** For a load that has no `user` yet: the stock (app) layout declares one. */\nconst USER_STATEMENT = \"const user = requireUser();\";\n\nconst FETCH_STATEMENT = dedent`\n const notificationsList = await locals.pb\n .collection(\"notifications\")\n .getList(1, 5, {\n filter: locals.pb.filter(\"user = {:user} && read = false\", {\n user: user.id,\n }),\n sort: \"-created\",\n });\n`;\n\nconst NOTIFICATIONS_STATEMENT =\n \"const notifications = { count: notificationsList.totalItems, items: notificationsList.items };\";\n\nconst DEPENDS_STATEMENT = 'depends(\"app:notifications\");';\n\nexport function modifyLayoutServer(layoutServerPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n const snippet = dedent`\n import { requireUser } from \"${AUTH_MODULE}\";\n\n export const load = async ({ locals, depends }) => {\n ${USER_STATEMENT}\n ${FETCH_STATEMENT}\n ${NOTIFICATIONS_STATEMENT}\n ${DEPENDS_STATEMENT}\n return { notifications };\n };\n `;\n fs.writeFileSync(layoutServerPath, snippet);\n return { status: \"success\", changed: true };\n }\n\n const originalSource = fs.readFileSync(layoutServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(layoutServerPath);\n\n const addProperty = (\n obj: import(\"ts-morph\").ObjectLiteralExpression,\n name: string,\n initializer: string,\n ) => {\n if (obj.getProperty(name)) return;\n if (name === initializer) {\n obj.addShorthandPropertyAssignment({ name });\n } else {\n obj.addPropertyAssignment({ name, initializer });\n }\n };\n\n let loadArrow: import(\"ts-morph\").ArrowFunction | undefined;\n let loadFn:\n | import(\"ts-morph\").FunctionDeclaration\n | import(\"ts-morph\").FunctionExpression\n | undefined;\n\n const varDecl = sourceFile.getVariableDeclaration(\"load\");\n if (varDecl) {\n const vs = varDecl.getFirstAncestorByKind(SyntaxKind.VariableStatement);\n if (vs?.hasExportKeyword()) {\n const directArrow = varDecl.getInitializerIfKind(\n SyntaxKind.ArrowFunction,\n );\n if (directArrow) {\n loadArrow = directArrow;\n } else {\n const init = varDecl.getInitializer();\n if (init) {\n const innerArrow = init.getFirstDescendantByKind(\n SyntaxKind.ArrowFunction,\n );\n if (innerArrow) {\n loadArrow = innerArrow;\n } else {\n const innerFnExpr = init.getFirstDescendantByKind(\n SyntaxKind.FunctionExpression,\n );\n if (innerFnExpr) loadFn = innerFnExpr;\n }\n }\n }\n }\n }\n\n if (!loadArrow && !loadFn) {\n const maybeFn = sourceFile.getFunction(\"load\");\n if (maybeFn && maybeFn.isExported()) loadFn = maybeFn;\n }\n\n if (!loadArrow && !loadFn) {\n sourceFile.addFunction({\n isExported: true,\n isAsync: true,\n name: \"load\",\n parameters: [{ name: \"{ locals, depends }\" }],\n statements: [\n USER_STATEMENT,\n FETCH_STATEMENT,\n NOTIFICATIONS_STATEMENT,\n DEPENDS_STATEMENT,\n \"return { notifications };\",\n ],\n });\n ensureNamedImport(sourceFile, AUTH_MODULE, \"requireUser\");\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const fnLike = (loadArrow ?? loadFn!) as\n | import(\"ts-morph\").ArrowFunction\n | import(\"ts-morph\").FunctionDeclaration\n | import(\"ts-morph\").FunctionExpression;\n\n // Ensure first param destructures { locals, depends }\n const params = fnLike.getParameters();\n if (params.length === 0) {\n fnLike.insertParameter(0, { name: \"{ locals, depends }\" });\n } else {\n const first = params[0];\n const original = first.getStructure();\n const nameNode = first.getNameNode();\n if (nameNode.getKind() === SyntaxKind.ObjectBindingPattern) {\n const obp = nameNode as import(\"ts-morph\").ObjectBindingPattern;\n const elementNames = obp.getElements().map((el) => el.getName());\n const hasDepends = elementNames.includes(\"depends\");\n const hasLocals = elementNames.includes(\"locals\");\n\n if (!hasDepends || !hasLocals) {\n const existingParts = obp\n .getElements()\n .map((el) => el.getText())\n .filter(Boolean);\n const parts: string[] = hasLocals ? [] : [\"locals\"];\n parts.push(...existingParts);\n if (!hasDepends) parts.push(\"depends\");\n first.set({\n name: `{ ${parts.join(\", \")} }`,\n type: original.type,\n initializer: (original as { initializer?: string }).initializer,\n });\n }\n } else {\n const currentName = first.getName();\n if (currentName !== \"locals\") {\n first.set({\n name: `{ locals, depends, ...${currentName} }`,\n type: original.type,\n initializer: (original as { initializer?: string }).initializer,\n });\n } else {\n first.set({\n name: `{ locals, depends }`,\n type: original.type,\n initializer: (original as { initializer?: string }).initializer,\n });\n }\n }\n }\n\n if (loadArrow && !loadArrow.isAsync()) loadArrow.setIsAsync(true);\n else if (loadFn && !loadFn.isAsync()) loadFn.setIsAsync(true);\n\n const body = fnLike.getBody();\n if (body && body.getKind() === SyntaxKind.Block) {\n const blockBody = body as import(\"ts-morph\").Block;\n const statements = blockBody.getStatements();\n\n const declaresVar = (name: string) =>\n statements.some((stmt) => {\n if (stmt.getKind() !== SyntaxKind.VariableStatement) return false;\n return (stmt as import(\"ts-morph\").VariableStatement)\n .getDeclarations()\n .some((d) => d.getName() === name);\n });\n\n const hasDependsCall = statements.some(\n (stmt) =>\n stmt.getKind() === SyntaxKind.ExpressionStatement &&\n stmt.getDescendantsOfKind(SyntaxKind.CallExpression).some((ce) => {\n if (ce.getExpression().getText() !== \"depends\") return false;\n const args = ce.getArguments();\n const argText = args[0]?.getText() ?? \"\";\n return (\n args.length === 1 &&\n (argText === \"'app:notifications'\" ||\n argText === '\"app:notifications\"')\n );\n }),\n );\n\n const hasNotificationsList = declaresVar(\"notificationsList\");\n const hasNotifications = declaresVar(\"notifications\");\n\n // The query filters on `user.id`. A load written by enable-auth has the\n // user already, by either name for it (`requireUser()` now,\n // `locals.pb.authStore.record!` before); any other gets it first.\n if (!hasNotificationsList && !declaresVar(\"user\")) {\n blockBody.insertStatements(0, USER_STATEMENT);\n ensureNamedImport(sourceFile, AUTH_MODULE, \"requireUser\");\n }\n\n const current = blockBody.getStatements();\n const returnIdx = current.findIndex(\n (s) => s.getKind() === SyntaxKind.ReturnStatement,\n );\n let insertAt = returnIdx >= 0 ? returnIdx : current.length;\n\n if (!hasNotificationsList) {\n blockBody.insertStatements(insertAt, FETCH_STATEMENT);\n insertAt++;\n }\n if (!hasNotifications) {\n blockBody.insertStatements(insertAt, NOTIFICATIONS_STATEMENT);\n insertAt++;\n }\n if (!hasDependsCall) {\n blockBody.insertStatements(insertAt, DEPENDS_STATEMENT);\n }\n }\n\n const augmentReturnObject = (\n obj: import(\"ts-morph\").ObjectLiteralExpression,\n ) => {\n addProperty(obj, \"notifications\", \"notifications\");\n };\n\n const augmentReturns = (target: import(\"ts-morph\").Node) => {\n const returns = target.getDescendantsOfKind(SyntaxKind.ReturnStatement);\n returns.forEach((ret) => {\n const expr = ret.getExpression();\n if (!expr) return;\n if (expr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(expr as import(\"ts-morph\").ObjectLiteralExpression);\n } else if (expr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n expr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(\n inner as import(\"ts-morph\").ObjectLiteralExpression,\n );\n }\n }\n });\n };\n\n if (loadArrow) {\n const arrowBody = loadArrow.getBody();\n if (arrowBody.getKind() === SyntaxKind.Block) {\n augmentReturns(arrowBody);\n } else {\n const bodyExpr = arrowBody as import(\"ts-morph\").Expression;\n if (bodyExpr.getKind() === SyntaxKind.ParenthesizedExpression) {\n const inner = (\n bodyExpr as import(\"ts-morph\").ParenthesizedExpression\n ).getExpression();\n if (inner.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(\n inner as import(\"ts-morph\").ObjectLiteralExpression,\n );\n }\n } else if (bodyExpr.getKind() === SyntaxKind.ObjectLiteralExpression) {\n augmentReturnObject(\n bodyExpr as import(\"ts-morph\").ObjectLiteralExpression,\n );\n }\n }\n } else if (loadFn) {\n const fnBody = loadFn.getBody();\n if (fnBody) augmentReturns(fnBody);\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n applyCollectionRulePatches,\n createCollectionIdempotent,\n readMigration,\n} from \"../../../runtime/collections\";\nimport {\n getMigrationFile,\n migrationDelay,\n withPocketbase,\n} from \"../../../runtime/pocketbase\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyUtils } from \"../../../runtime/modify-utils\";\nimport { modifyAppLayout } from \"./modifies/modify-app-layout\";\nimport { modifyLayoutServer } from \"./modifies/+layout.server\";\nimport { NOTIFICATION_RULE_PATCHES } from \"./runtime/pocketbase\";\n\nasync function pushMigrationCreates(\n creates: File[],\n collectionName: string,\n options: Options,\n created = true,\n) {\n if (!created) return;\n await migrationDelay();\n const migrationFile = getMigrationFile(collectionName, \"created\", options);\n if (!migrationFile) return;\n creates.push(await readMigration(migrationFile, options));\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n\n await withPocketbase(options.root, async (pb) => {\n const userCollection = await pb.collections.getOne(\"users\");\n const create = (spec: Parameters<typeof createCollectionIdempotent>[1]) =>\n createCollectionIdempotent(pb, spec, logger);\n\n logger.info(\"Creating notifications collection\");\n const result = await create({\n name: \"notifications\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"user\",\n type: \"relation\",\n cascadeDelete: true,\n collectionId: userCollection.id,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"title\",\n type: \"text\",\n required: true,\n },\n {\n name: \"body\",\n type: \"text\",\n },\n {\n name: \"read\",\n type: \"bool\",\n },\n {\n name: \"created\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: false,\n },\n {\n name: \"updated\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: true,\n },\n ],\n indexes: [\n \"CREATE INDEX `idx_notifications_user_read_created` ON `notifications` (`user`, `read`, `created` DESC)\",\n ],\n });\n await pushMigrationCreates(\n creates,\n \"notifications\",\n options,\n result.created,\n );\n\n logger.info(\"Applying notifications rule patches\");\n const ruleMigrations = await applyCollectionRulePatches(\n pb,\n NOTIFICATION_RULE_PATCHES,\n options,\n logger,\n );\n creates.push(...ruleMigrations);\n });\n\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying (app) +layout.svelte\");\n const appLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appLayoutPath, modifyAppLayout(appLayoutPath)),\n );\n\n logger.info(\"Modifying (app) +layout.server.ts\");\n const appLayoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutServerPath,\n modifyLayoutServer(appLayoutServerPath),\n ),\n );\n\n logger.info(\"Modifying utils.ts\");\n const utilsPath = path.join(options.root, \"src\", \"lib\", \"utils.ts\");\n pushResult(modifyOutcomeToFile(utilsPath, modifyUtils(utilsPath)));\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;;;AASA,IAAMiB,IAAe,2EAMfC,IAAiB,CAAM;;GAIvBC,IAAe;CACnB;CACA;CACA;CACA;CACAD;CACA;CACA;CACAD;AACF,CAAC,CAAC,KAAK,IAAI,GAELG,IAAiB;CACrB;CACA;CACA;CACA;CACAF;CACA;CACA;CACAD;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,SAAgBI,EAAgB,GAAmC;CACjE,IAAI,CAACN,EAAG,WAAWO,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAa,SAASF;CAAe;CAGxD,IAAMG,IAAOd,EAAW,SAASa,CAAU;CAsB3C,OAr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U;KACV,UAAU;IACZ;GACF;GACA,SAAS,CACP,wGACF;EACF,CAAC;EAQD,AAPA,MAAMT,EACJK,GACA,iBACAD,GACAS,EAAO,OACT,GAEAN,EAAO,KAAK,qCAAqC;EACjD,IAAMO,IAAiB,MAAMnG,EAC3B+F,GACApF,GACA8E,GACAG,CACF;EACA,EAAQ,KAAK,GAAGO,CAAc;CAChC,CAAC;CAED,IAAMC,IAAmB,CAAC,GACpBC,KAAc,MAAsB;EACxC,AAAIjF,KAAMgF,EAAS,KAAKhF,CAAI;CAC9B;CAEA,EAAO,KAAK,gCAAgC;CAC5C,IAAMkF,IAAgBzF,EAAK,KACzB4E,EAAQ,MACR,OACA,UACA,SACA,gBACF;CAKA,AAJAY,EACElG,EAAoBmG,GAAepF,EAAgBoF,CAAa,CAAC,CACnE,GAEAV,EAAO,KAAK,mCAAmC;CAC/C,IAAMW,IAAsB1F,EAAK,KAC/B4E,EAAQ,MACR,OACA,UACA,SACA,mBACF;CAQA,AAPAY,EACElG,EACEoG,GACA1E,EAAmB0E,CAAmB,CACxC,CACF,GAEAX,EAAO,KAAK,oBAAoB;CAChC,IAAMY,IAAY3F,EAAK,KAAK4E,EAAQ,MAAM,OAAO,OAAO,UAAU;CAGlE,OAFAY,EAAWlG,EAAoBqG,GAAWpG,EAAYoG,CAAS,CAAC,CAAC,GAE1D;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-BOEKlIDw.js";
|
|
3
3
|
import { _ as n, g as r, n as i, o as a, p as o, u as s } from "./ts-morph-helpers-B4KZXP44.js";
|
|
4
4
|
import { t as c } from "./svelte-file-DfplF3BU.js";
|
|
5
5
|
import { r as l } from "./lib-specifier-C3M0WTev.js";
|
|
6
|
-
import { t as u } from "./shared-
|
|
6
|
+
import { t as u } from "./shared-CSwGWMcN.js";
|
|
7
7
|
import d from "node:fs";
|
|
8
8
|
import f from "node:path";
|
|
9
9
|
import { Project as p, SyntaxKind as m } from "ts-morph";
|
|
@@ -105,4 +105,4 @@ async function v(n) {
|
|
|
105
105
|
}
|
|
106
106
|
export { v as generate };
|
|
107
107
|
|
|
108
|
-
//# sourceMappingURL=generate.runtime-
|
|
108
|
+
//# sourceMappingURL=generate.runtime-_426A1Ij.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-DNjyaFml.js","names":["getLogger","modifyOutcomeToFile","withInMemoryScript","removeUnusedBindingElement","ensureBlankLineAfterImports","formatLikeSource","removePropsBindingIfUnused","removeImportByModuleSpecifier","SvelteFile","libModule","planDropsForCollections","fs","path","unmodifyLayoutServer","layoutPath","originalSource","sourceFile","Project","literals","SyntaxKind","obj","userProp","unmodifyRootLayoutSvelte","source","file","markup","out","content","sf","unmodifyHooksServer","hooksServerPath","callExpr","ce","firstArg","optionsObj","authProp","generate","logger","options","modifies","pushResult","layoutServerFile","layoutCandidates","layoutFile","p","hooksServerFile"],"sources":["../../src/patterns/disable/auth/modifies/+layout.server.ts","../../src/patterns/disable/auth/modifies/root-layout.svelte.ts","../../src/patterns/disable/auth/modifies/hooks.server.ts","../../src/patterns/disable/auth/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n removeUnusedBindingElement,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyLayoutServer(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(layoutPath, \"utf8\");\n if (!originalSource.includes(\"locals.pb.authStore.record\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(layoutPath);\n\n const literals = sourceFile.getDescendantsOfKind(\n SyntaxKind.ObjectLiteralExpression,\n );\n for (const obj of literals) {\n const userProp = obj.getProperty(\"user\");\n if (!userProp || userProp.getKind() !== SyntaxKind.PropertyAssignment) {\n continue;\n }\n const value = (userProp as import(\"ts-morph\").PropertyAssignment)\n .getInitializer()\n ?.getText();\n if (value === \"locals.pb.authStore.record\") {\n userProp.remove();\n }\n }\n // `user` was often the layout's only use of `locals`, which enable-auth\n // destructured for it.\n removeUnusedBindingElement(sourceFile, \"locals\");\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n removePropsBindingIfUnused,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\nexport function unmodifyRootLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(layoutPath, \"utf8\");\n const file = new SvelteFile(source);\n if (!file.hasElement(\"AuthMenu.Root\")) {\n return { status: \"success\", changed: false };\n }\n\n // The whole navbar item enable-auth added goes, not just the menu inside\n // it; a layout that placed the menu without one loses only the menu.\n if (!file.removeElementContaining(\"Navbar.Item\", \"AuthMenu.Root\")) {\n file.removeElement(\"AuthMenu.Root\");\n }\n const markup = file.toString().replace(/<script[\\s\\S]*?<\\/script>/g, \"\");\n\n file.modifyScript((content) => {\n const { source: out } = withInMemoryScript(content, (sf) => {\n removeImportByModuleSpecifier(sf, libModule(\"components/ui/auth-menu\"));\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/user-avatar.svelte\"),\n );\n // Layouts from before UserAvatar import the avatar parts directly.\n removeImportByModuleSpecifier(sf, libModule(\"components/ui/avatar\"));\n // enable-auth added `data` for the menu's `data.user`.\n removePropsBindingIfUnused(sf, \"data\", markup);\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyHooksServer(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n if (!callExpr) return { status: \"success\", changed: false };\n\n const [firstArg] = callExpr.getArguments();\n if (!firstArg || firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n const authProp = optionsObj.getProperty(\"auth\");\n if (!authProp) {\n return { status: \"success\", changed: false };\n }\n\n authProp.remove();\n\n if (optionsObj.getProperties().length === 0) {\n callExpr.removeArgument(0);\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyLayoutServer } from \"./modifies/+layout.server\";\nimport { unmodifyRootLayoutSvelte } from \"./modifies/root-layout.svelte\";\nimport { unmodifyHooksServer } from \"./modifies/hooks.server\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting +layout.server.ts\");\n const layoutServerFile = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutServerFile,\n unmodifyLayoutServer(layoutServerFile),\n ),\n );\n\n logger.info(\"Reverting root layout\");\n const layoutCandidates = [\n path.join(options.root, \"src\", \"routes\", \"(public)\", \"root-layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"root-layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"(public)\", \"+layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"+layout.svelte\"),\n ];\n const layoutFile =\n layoutCandidates.find((p) => fs.existsSync(p)) ?? layoutCandidates[0];\n pushResult(\n modifyOutcomeToFile(layoutFile, unmodifyRootLayoutSvelte(layoutFile)),\n );\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerFile = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(hooksServerFile, unmodifyHooksServer(hooksServerFile)),\n );\n\n const collectionDrops = await planDropsForCollections(\n [\"oauth_accounts\"],\n options,\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgBa,EAAqB,GAAmC;CACtE,IAAI,CAACF,EAAG,WAAWG,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBJ,EAAG,aAAaG,GAAY,MAAM;CACzD,IAAI,CAACC,EAAe,SAAS,4BAA4B,GACvD,OAAO;EAAE,QAAQ;EAAW,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MK,IAAmB;EACvB9B,EAAK,KAAK0B,EAAQ,MAAM,OAAO,UAAU,YAAY,oBAAoB;EACzE1B,EAAK,KAAK0B,EAAQ,MAAM,OAAO,UAAU,oBAAoB;EAC7D1B,EAAK,KAAK0B,EAAQ,MAAM,OAAO,UAAU,YAAY,gBAAgB;EACrE1B,EAAK,KAAK0B,EAAQ,MAAM,OAAO,UAAU,gBAAgB;CAC3D,GACMK,IACJD,EAAiB,MAAM,MAAM/B,EAAG,WAAWiC,CAAC,CAAC,KAAKF,EAAiB;CAKrE,AAJAF,EACEvC,EAAoB0C,GAAYrB,EAAyBqB,CAAU,CAAC,CACtE,GAEAN,EAAO,KAAK,2BAA2B;CACvC,IAAMQ,IAAkBjC,EAAK,KAAK0B,EAAQ,MAAM,OAAO,iBAAiB;CAUxE,OATAE,EACEvC,EAAoB4C,GAAiBhB,EAAoBgB,CAAe,CAAC,CAC3E,GAOO;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAA,MAb4BnC,EAC5B,CAAC,gBAAgB,GACjB4B,CACF;CAWA;AACF"}
|
|
1
|
+
{"version":3,"file":"generate.runtime-_426A1Ij.js","names":["getLogger","modifyOutcomeToFile","withInMemoryScript","removeUnusedBindingElement","ensureBlankLineAfterImports","formatLikeSource","removePropsBindingIfUnused","removeImportByModuleSpecifier","SvelteFile","libModule","planDropsForCollections","fs","path","unmodifyLayoutServer","layoutPath","originalSource","sourceFile","Project","literals","SyntaxKind","obj","userProp","unmodifyRootLayoutSvelte","source","file","markup","out","content","sf","unmodifyHooksServer","hooksServerPath","callExpr","ce","firstArg","optionsObj","authProp","generate","logger","options","modifies","pushResult","layoutServerFile","layoutCandidates","layoutFile","p","hooksServerFile"],"sources":["../../src/patterns/disable/auth/modifies/+layout.server.ts","../../src/patterns/disable/auth/modifies/root-layout.svelte.ts","../../src/patterns/disable/auth/modifies/hooks.server.ts","../../src/patterns/disable/auth/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n removeUnusedBindingElement,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyLayoutServer(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(layoutPath, \"utf8\");\n if (!originalSource.includes(\"locals.pb.authStore.record\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(layoutPath);\n\n const literals = sourceFile.getDescendantsOfKind(\n SyntaxKind.ObjectLiteralExpression,\n );\n for (const obj of literals) {\n const userProp = obj.getProperty(\"user\");\n if (!userProp || userProp.getKind() !== SyntaxKind.PropertyAssignment) {\n continue;\n }\n const value = (userProp as import(\"ts-morph\").PropertyAssignment)\n .getInitializer()\n ?.getText();\n if (value === \"locals.pb.authStore.record\") {\n userProp.remove();\n }\n }\n // `user` was often the layout's only use of `locals`, which enable-auth\n // destructured for it.\n removeUnusedBindingElement(sourceFile, \"locals\");\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n removePropsBindingIfUnused,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\nexport function unmodifyRootLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(layoutPath, \"utf8\");\n const file = new SvelteFile(source);\n if (!file.hasElement(\"AuthMenu.Root\")) {\n return { status: \"success\", changed: false };\n }\n\n // The whole navbar item enable-auth added goes, not just the menu inside\n // it; a layout that placed the menu without one loses only the menu.\n if (!file.removeElementContaining(\"Navbar.Item\", \"AuthMenu.Root\")) {\n file.removeElement(\"AuthMenu.Root\");\n }\n const markup = file.toString().replace(/<script[\\s\\S]*?<\\/script>/g, \"\");\n\n file.modifyScript((content) => {\n const { source: out } = withInMemoryScript(content, (sf) => {\n removeImportByModuleSpecifier(sf, libModule(\"components/ui/auth-menu\"));\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/user-avatar.svelte\"),\n );\n // Layouts from before UserAvatar import the avatar parts directly.\n removeImportByModuleSpecifier(sf, libModule(\"components/ui/avatar\"));\n // enable-auth added `data` for the menu's `data.user`.\n removePropsBindingIfUnused(sf, \"data\", markup);\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyHooksServer(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n if (!callExpr) return { status: \"success\", changed: false };\n\n const [firstArg] = callExpr.getArguments();\n if (!firstArg || firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n const authProp = optionsObj.getProperty(\"auth\");\n if (!authProp) {\n return { status: \"success\", changed: false };\n }\n\n authProp.remove();\n\n if (optionsObj.getProperties().length === 0) {\n callExpr.removeArgument(0);\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyLayoutServer } from \"./modifies/+layout.server\";\nimport { unmodifyRootLayoutSvelte } from \"./modifies/root-layout.svelte\";\nimport { unmodifyHooksServer } from \"./modifies/hooks.server\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting +layout.server.ts\");\n const layoutServerFile = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutServerFile,\n unmodifyLayoutServer(layoutServerFile),\n ),\n );\n\n logger.info(\"Reverting root layout\");\n const layoutCandidates = [\n path.join(options.root, \"src\", \"routes\", \"(public)\", \"root-layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"root-layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"(public)\", \"+layout.svelte\"),\n path.join(options.root, \"src\", \"routes\", \"+layout.svelte\"),\n ];\n const layoutFile =\n layoutCandidates.find((p) => fs.existsSync(p)) ?? layoutCandidates[0];\n pushResult(\n modifyOutcomeToFile(layoutFile, unmodifyRootLayoutSvelte(layoutFile)),\n );\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerFile = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(hooksServerFile, unmodifyHooksServer(hooksServerFile)),\n );\n\n const collectionDrops = await planDropsForCollections(\n [\"oauth_accounts\"],\n options,\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgBa,EAAqB,GAAmC;CACtE,IAAI,CAACF,EAAG,WAAWG,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBJ,EAAG,aAAaG,GAAY,MAAM;CACzD,IAAI,CAACC,EAAe,SAAS,4BAA4B,GACvD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAI7C,IAAMC,IAAa,IADCC,EACD,CAAA,CAAQ,oBAAoBH,CAAU,GAEnDI,IAAWF,EAAW,qBAC1BG,EAAW,uBACb;CACA,KAAK,IAAMC,KAAOF,GAAU;EAC1B,IAAMG,IAAWD,EAAI,YAAY,MAAM;EACvC,AAAKC,KAAYA,EAAS,QAAQ,MAAMF,EAAW,sBAGpCE,EACZ,eAAe,CAAC,EACf,QAAQ,MACE,gCACZA,EAAS,OAAO;CAEpB;CAQA,OALAlB,EAA2Ba,GAAY,QAAQ,GAE/CX,EAAiBW,CAAU,GAC3BA,EAAW,SAAS,GAEb;EACL,QAAQ;EACR,SAASA,EAAW,YAAY,MAAMD;CACxC;AACF;;ACpCA,SAAgBO,EAAyB,GAAmC;CAC1E,IAAI,CAACX,EAAG,WAAWG,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMS,IAASZ,EAAG,aAAaG,GAAY,MAAM,GAC3CU,IAAO,IAAIhB,EAAWe,CAAM;CAClC,IAAI,CAACC,EAAK,WAAW,eAAe,GAClC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAK7C,AAAKA,EAAK,wBAAwB,eAAe,eAAe,KAC9DA,EAAK,cAAc,eAAe;CAEpC,IAAMC,IAASD,EAAK,SAAS,CAAC,CAAC,QAAQ,8BAA8B,EAAE;CAmBvE,OAjB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r } from "./gitignore-
|
|
4
|
-
import { d as i } from "./constants-
|
|
2
|
+
import { r as t } from "./modify-file-BOEKlIDw.js";
|
|
3
|
+
import { r as n, t as r } from "./gitignore-CBiWFRif.js";
|
|
4
|
+
import { d as i } from "./constants-E1I-__KI.js";
|
|
5
5
|
import { a } from "./util-mXrQ89nG.js";
|
|
6
6
|
import { a as o, i as s, n as c, t as l } from "./test-setup-jqVMmL83.js";
|
|
7
7
|
import { t as u } from "./dedent-CCUOcPFW.js";
|
|
8
8
|
import { r as d } from "./compose-handle-Da7m6lV_.js";
|
|
9
9
|
import { c as f, i as p, n as m, o as h } from "./ts-morph-helpers-B4KZXP44.js";
|
|
10
|
-
import { modifyEnvVarsFiles as g } from "./env-vars-
|
|
10
|
+
import { modifyEnvVarsFiles as g } from "./env-vars-C3TSZc4f.js";
|
|
11
11
|
import { t as _ } from "./env-vars-CUh4mLM_.js";
|
|
12
12
|
import v from "node:fs";
|
|
13
13
|
import y from "node:path";
|
|
@@ -166,4 +166,4 @@ async function k(i) {
|
|
|
166
166
|
}
|
|
167
167
|
export { k as generate };
|
|
168
168
|
|
|
169
|
-
//# sourceMappingURL=generate.runtime-
|
|
169
|
+
//# sourceMappingURL=generate.runtime-fs6GEMx-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-DR8z6DyZ.js","names":["getLogger","modifyOutcomeToFile","modifySvelteConfig","modifyGitignore","POCKETBASE_TYPES","modifyTestSetup","hasVitestConfig","WITH_BACKEND","VITEST_CONFIG","dedent","replaceHandle","pruneUnusedImports","ensureNamedImport","ensureBlankLineAfterImports","formatLikeSource","BACKEND_ENV_VARS","fs","path","VITEST_CONFIGS","ext","modifyTsconfigBackend","filePath","root","original","vitestConfig","name","wanted","config","entry","include","normalize","isCurrentTypes","hasCurrentTypes","next","prefix","has","existing","insertAfter","index","after","i","indent","POCKETBASE_ENV_NAMES","POCKETBASE_HANDLE","FAILURE_HINT","modifyHooksServerBackend","hooksServerPath","sourceFile","Project","QuoteKind","composed","statement","Node","doc","generate","logger","options","modifies","creates","create","languageFromPath","adapter","svelteConfigFile","hooksServerFile","envVars","modifyEnvVarsFiles","gitignorePath","gitignoreFile","testSetupPath","testSetupFile","tsconfigPath","tsconfigFile"],"sources":["../../src/patterns/enable/backend/modifies/tsconfig.ts","../../src/patterns/enable/backend/modifies/hooks.server.ts","../../src/patterns/enable/backend/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nimport {\n LEGACY_POCKETBASE_TYPES,\n POCKETBASE_TYPES,\n} from \"../../../../core/constants\";\n\nexport { LEGACY_POCKETBASE_TYPES, POCKETBASE_TYPES };\n\nconst VITEST_CONFIGS = [\"ts\", \"mts\", \"js\", \"mjs\"].map(\n (ext) => `vitest.config.${ext}`,\n);\n\n/**\n * SvelteKit 3's `$app/tsconfig` lists no files: the project's own `include`\n * decides what is type-checked, and `sv create` writes `[\"src\",\n * \"vite.config.ts\"]`. A backend adds three things that have to be in it, as\n * they are in vela's minimal template: `test` (the server-test context that\n * every `server.test.ts` reads), the vitest config, and PocketBase's generated\n * types, without which `Schemas` is missing from `@velastack/pocketbase`.\n *\n * Entries already there stay, in their order, but for one: the entry for\n * where the PocketBase types used to be (`LEGACY_POCKETBASE_TYPES`) becomes\n * the current one where it stands, keeping a leading `./` if it had one, and\n * is dropped when the current one is there as well. A tsconfig with no\n * `include` checks everything already; one that is not plain JSON (comments)\n * is left alone with the entries to add.\n */\nexport function modifyTsconfigBackend(root: string): ModifyOutcome {\n const filePath = path.join(root, \"tsconfig.json\");\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n const vitestConfig =\n VITEST_CONFIGS.find((name) => fs.existsSync(path.join(root, name))) ??\n \"vitest.config.ts\";\n const wanted = [\"test\", vitestConfig, POCKETBASE_TYPES];\n\n let config: Record<string, unknown>;\n try {\n config = JSON.parse(original) as Record<string, unknown>;\n } catch {\n return {\n status: \"failed\",\n message: `Add these to the \"include\" array of tsconfig.json: ${wanted\n .map((entry) => JSON.stringify(entry))\n .join(\", \")}`,\n };\n }\n const include = config.include;\n if (include === undefined) {\n return { status: \"success\", changed: false };\n }\n if (!Array.isArray(include)) {\n return {\n status: \"failed\",\n message: `tsconfig.json \"include\" is not an array; it needs ${wanted.join(\", \")}`,\n };\n }\n\n const normalize = (entry: unknown) =>\n typeof entry === \"string\" ? entry.replace(/^\\.\\//, \"\") : entry;\n const isCurrentTypes = (entry: unknown) =>\n normalize(entry) === POCKETBASE_TYPES;\n const hasCurrentTypes = include.some(isCurrentTypes);\n const next: unknown[] = [];\n for (const entry of include as unknown[]) {\n if (normalize(entry) !== LEGACY_POCKETBASE_TYPES) {\n next.push(entry);\n } else if (!hasCurrentTypes && !next.some(isCurrentTypes)) {\n // The first old entry turns into the new one; any other goes.\n const prefix = String(entry).startsWith(\"./\") ? \"./\" : \"\";\n next.push(`${prefix}${POCKETBASE_TYPES}`);\n }\n }\n const has = (entry: string) =>\n next.some((existing) => normalize(existing) === entry);\n const insertAfter = (entry: string, after: (e: unknown) => boolean) => {\n if (has(entry)) return;\n let index = -1;\n next.forEach((e, i) => {\n if (after(e)) index = i;\n });\n next.splice(index === -1 ? next.length : index + 1, 0, entry);\n };\n insertAfter(\"test\", (e) => normalize(e) === \"src\");\n insertAfter(vitestConfig, (e) =>\n /^vite\\.config\\.[cm]?[jt]s$/.test(String(normalize(e))),\n );\n insertAfter(POCKETBASE_TYPES, () => false);\n\n if (\n next.length === include.length &&\n next.every((entry, index) => entry === include[index])\n ) {\n return { status: \"success\", changed: false };\n }\n config.include = next;\n const indent = original.match(/^\\{\\s*\\n([\\t ]+)/)?.[1] ?? \"\\t\";\n fs.writeFileSync(filePath, `${JSON.stringify(config, null, indent)}\\n`);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Node, Project, QuoteKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { replaceHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n ensureNamedImport,\n pruneUnusedImports,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\n/** The variables the handle reads, imported from `$app/env/private`. */\nexport const POCKETBASE_ENV_NAMES = [\n \"POCKETBASE_URL\",\n \"POCKETBASE_SUPERUSER_EMAIL\",\n \"POCKETBASE_SUPERUSER_PASSWORD\",\n] as const;\n\n/** The handle `creates/src/hooks.server.ts` exports, for a file that already exists. */\nexport const POCKETBASE_HANDLE = dedent`\n handlePocketbase({\n \tpocketbaseUrl: POCKETBASE_URL,\n \tsuperuserEmail: POCKETBASE_SUPERUSER_EMAIL,\n \tsuperuserPassword: POCKETBASE_SUPERUSER_PASSWORD\n })\n`;\n\nconst FAILURE_HINT = dedent`\n Add the PocketBase handle to the exported handle in src/hooks.server.ts:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import {\n \tPOCKETBASE_URL,\n \tPOCKETBASE_SUPERUSER_EMAIL,\n \tPOCKETBASE_SUPERUSER_PASSWORD\n } from '$app/env/private';\n import { handlePocketbase } from '@velastack/pocketbase';\n\n export const handle = sequence(\n \t/* your existing handle */,\n \t${POCKETBASE_HANDLE.replace(/\\n/g, \"\\n\\t\")}\n );\n`;\n\n/**\n * Compose the PocketBase handle into a `hooks.server.ts` the project already\n * has, instead of the create overwriting it: a static site's, or one i18n or\n * content negotiation wrote. It takes `handleStatic()`'s place, since\n * `handlePocketbase` does what that did and more; otherwise it goes last, so\n * the handles already there keep running first.\n */\nexport function modifyHooksServerBackend(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // The create writes it.\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const composed = replaceHandle(sourceFile, \"handleStatic\", {\n expression: POCKETBASE_HANDLE,\n name: \"handlePocketbase\",\n position: \"last\",\n });\n if (composed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (composed.status === \"unchanged\") {\n return { status: \"success\", changed: false };\n }\n\n // The static template's comment explains handleStatic(). Where that was the\n // whole handle, replaceHandle already dropped it; in a sequence (i18n or\n // negotiation composed in since) it is still there, describing a handle\n // that is gone.\n const statement = composed.statement;\n if (statement && Node.isJSDocable(statement)) {\n for (const doc of statement.getJsDocs()) {\n if (doc.getText().includes(\"vela legal\")) doc.remove();\n }\n }\n\n pruneUnusedImports(sourceFile, [\"@velastack/kit\"]);\n for (const name of POCKETBASE_ENV_NAMES) {\n ensureNamedImport(sourceFile, \"$app/env/private\", name);\n }\n ensureNamedImport(sourceFile, \"@velastack/pocketbase\", \"handlePocketbase\");\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifySvelteConfig } from \"./modifies/svelte-config\";\nimport { modifyGitignore } from \"./modifies/gitignore\";\nimport { modifyTsconfigBackend } from \"./modifies/tsconfig\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n hasVitestConfig,\n modifyTestSetup,\n VITEST_CONFIG,\n WITH_BACKEND,\n} from \"./modifies/test-setup\";\nimport { modifyHooksServerBackend } from \"./modifies/hooks.server\";\nimport { modifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { BACKEND_ENV_VARS } from \"./env-vars\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const creates: File[] = [];\n const create = (filePath: string, content: string) =>\n creates.push({\n path: filePath,\n language: languageFromPath(filePath),\n content,\n status: \"success\",\n });\n\n logger.info(\"Modifying adapter config\");\n const adapter = modifySvelteConfig(options.root);\n const svelteConfigFile = modifyOutcomeToFile(\n adapter.filePath,\n adapter.outcome,\n );\n if (svelteConfigFile) modifies.push(svelteConfigFile);\n\n // A hooks.server.ts the project already has keeps its handles; the create\n // only writes the file where there is none (see `keepMissing` in index.ts).\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const hooksServerFile = modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerBackend(hooksServerPath),\n );\n if (hooksServerFile) {\n logger.info(\"Modifying hooks.server.ts\");\n modifies.push(hooksServerFile);\n }\n\n // SvelteKit 3 exposes only declared variables: the handle above reads\n // these three from `$app/env/private`.\n logger.info(\"Declaring the PocketBase variables in src/env.ts\");\n const envVars = modifyEnvVarsFiles(options.root, BACKEND_ENV_VARS);\n if (envVars.create) creates.push(envVars.create);\n if (envVars.modify) modifies.push(envVars.modify);\n\n logger.info(\"Modifying .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n const gitignoreFile = modifyOutcomeToFile(\n gitignorePath,\n modifyGitignore(gitignorePath),\n );\n if (gitignoreFile) modifies.push(gitignoreFile);\n\n // A backend brings server tests with it. The static template and a project\n // vela did not create have no harness at all, so what is missing is created:\n // the setup file, and the vitest config that loads it.\n const testSetupPath = path.join(options.root, \"test\", \"setup.ts\");\n if (fs.existsSync(testSetupPath)) {\n logger.info(\"Modifying test/setup.ts\");\n const testSetupFile = modifyOutcomeToFile(\n testSetupPath,\n modifyTestSetup(testSetupPath),\n );\n if (testSetupFile) modifies.push(testSetupFile);\n } else {\n logger.info(\"Creating test/setup.ts\");\n create(\"test/setup.ts\", WITH_BACKEND);\n }\n\n if (!hasVitestConfig(options.root)) {\n logger.info(\"Creating vitest.config.ts\");\n create(\"vitest.config.ts\", VITEST_CONFIG);\n }\n\n // Kit 3's tsconfig lists no files, so the test harness and PocketBase's\n // generated types are type-checked only when the project's include names them.\n const tsconfigPath = path.join(options.root, \"tsconfig.json\");\n const tsconfigFile = modifyOutcomeToFile(\n tsconfigPath,\n modifyTsconfigBackend(options.root),\n );\n if (tsconfigFile) {\n logger.info(\"Modifying tsconfig.json\");\n modifies.push(tsconfigFile);\n }\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAWA,IAAMkB,IAAiB;CAAC;CAAM;CAAO;CAAM;AAAK,CAAC,CAAC,KAC/C,MAAQ,iBAAiBC,GAC5B;AAiBA,SAAgBC,EAAsB,GAA6B;CACjE,IAAMC,IAAWJ,EAAK,KAAKK,GAAM,eAAe;CAChD,IAAI,CAACN,EAAG,WAAWK,CAAQ,GACzB,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE7C,IAAME,IAAWP,EAAG,aAAaK,GAAU,MAAM,GAC3CG,IACJN,EAAe,MAAM,MAASF,EAAG,WAAWC,EAAK,KAAKK,GAAMG,CAAI,CAAC,CAAC,KAClE,oBACIC,IAAS;EAAC;EAAQF;EAAcpB;CAAgB,GAElDuB;CACJ,IAAI;EACF,IAAS,KAAK,MAAMJ,CAAQ;CAC9B,QAAQ;EACN,OAAO;GACL,QAAQ;GACR,SAAS,sDAAsDG,EAC5D,KAAK,MAAU,KAAK,UAAUE,CAAK,CAAC,CAAC,CACrC,KAAK,IAAI;EACd;CACF;CACA,IAAMC,IAAUF,EAAO;CACvB,IAAIE,MAAY,KAAA,GACd,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE7C,IAAI,CAAC,MAAM,QAAQA,CAAO,GACxB,OAAO;EACL,QAAQ;EACR,SAAS,qDAAqDH,EAAO,KAAK,IAAI;CAChF;CAGF,IAAMI,KAAa,MACjB,OAAOF,KAAU,WAAWA,EAAM,QAAQ,SAAS,EAAE,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AAQ,MAAM,eAAe,GACtDe,IAAetE,EACnBqE,GACAlD,EAAsBoC,EAAQ,IAAI,CACpC;CAMA,OALIe,MACFhB,EAAO,KAAK,yBAAyB,GACrCE,EAAS,KAAKc,CAAY,IAGrB;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
1
|
+
{"version":3,"file":"generate.runtime-fs6GEMx-.js","names":["getLogger","modifyOutcomeToFile","modifySvelteConfig","modifyGitignore","POCKETBASE_TYPES","modifyTestSetup","hasVitestConfig","WITH_BACKEND","VITEST_CONFIG","dedent","replaceHandle","pruneUnusedImports","ensureNamedImport","ensureBlankLineAfterImports","formatLikeSource","BACKEND_ENV_VARS","fs","path","VITEST_CONFIGS","ext","modifyTsconfigBackend","filePath","root","original","vitestConfig","name","wanted","config","entry","include","normalize","isCurrentTypes","hasCurrentTypes","next","prefix","has","existing","insertAfter","index","after","i","indent","POCKETBASE_ENV_NAMES","POCKETBASE_HANDLE","FAILURE_HINT","modifyHooksServerBackend","hooksServerPath","sourceFile","Project","QuoteKind","composed","statement","Node","doc","generate","logger","options","modifies","creates","create","languageFromPath","adapter","svelteConfigFile","hooksServerFile","envVars","modifyEnvVarsFiles","gitignorePath","gitignoreFile","testSetupPath","testSetupFile","tsconfigPath","tsconfigFile"],"sources":["../../src/patterns/enable/backend/modifies/tsconfig.ts","../../src/patterns/enable/backend/modifies/hooks.server.ts","../../src/patterns/enable/backend/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nimport {\n LEGACY_POCKETBASE_TYPES,\n POCKETBASE_TYPES,\n} from \"../../../../core/constants\";\n\nexport { LEGACY_POCKETBASE_TYPES, POCKETBASE_TYPES };\n\nconst VITEST_CONFIGS = [\"ts\", \"mts\", \"js\", \"mjs\"].map(\n (ext) => `vitest.config.${ext}`,\n);\n\n/**\n * SvelteKit 3's `$app/tsconfig` lists no files: the project's own `include`\n * decides what is type-checked, and `sv create` writes `[\"src\",\n * \"vite.config.ts\"]`. A backend adds three things that have to be in it, as\n * they are in vela's minimal template: `test` (the server-test context that\n * every `server.test.ts` reads), the vitest config, and PocketBase's generated\n * types, without which `Schemas` is missing from `@velastack/pocketbase`.\n *\n * Entries already there stay, in their order, but for one: the entry for\n * where the PocketBase types used to be (`LEGACY_POCKETBASE_TYPES`) becomes\n * the current one where it stands, keeping a leading `./` if it had one, and\n * is dropped when the current one is there as well. A tsconfig with no\n * `include` checks everything already; one that is not plain JSON (comments)\n * is left alone with the entries to add.\n */\nexport function modifyTsconfigBackend(root: string): ModifyOutcome {\n const filePath = path.join(root, \"tsconfig.json\");\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n const vitestConfig =\n VITEST_CONFIGS.find((name) => fs.existsSync(path.join(root, name))) ??\n \"vitest.config.ts\";\n const wanted = [\"test\", vitestConfig, POCKETBASE_TYPES];\n\n let config: Record<string, unknown>;\n try {\n config = JSON.parse(original) as Record<string, unknown>;\n } catch {\n return {\n status: \"failed\",\n message: `Add these to the \"include\" array of tsconfig.json: ${wanted\n .map((entry) => JSON.stringify(entry))\n .join(\", \")}`,\n };\n }\n const include = config.include;\n if (include === undefined) {\n return { status: \"success\", changed: false };\n }\n if (!Array.isArray(include)) {\n return {\n status: \"failed\",\n message: `tsconfig.json \"include\" is not an array; it needs ${wanted.join(\", \")}`,\n };\n }\n\n const normalize = (entry: unknown) =>\n typeof entry === \"string\" ? entry.replace(/^\\.\\//, \"\") : entry;\n const isCurrentTypes = (entry: unknown) =>\n normalize(entry) === POCKETBASE_TYPES;\n const hasCurrentTypes = include.some(isCurrentTypes);\n const next: unknown[] = [];\n for (const entry of include as unknown[]) {\n if (normalize(entry) !== LEGACY_POCKETBASE_TYPES) {\n next.push(entry);\n } else if (!hasCurrentTypes && !next.some(isCurrentTypes)) {\n // The first old entry turns into the new one; any other goes.\n const prefix = String(entry).startsWith(\"./\") ? \"./\" : \"\";\n next.push(`${prefix}${POCKETBASE_TYPES}`);\n }\n }\n const has = (entry: string) =>\n next.some((existing) => normalize(existing) === entry);\n const insertAfter = (entry: string, after: (e: unknown) => boolean) => {\n if (has(entry)) return;\n let index = -1;\n next.forEach((e, i) => {\n if (after(e)) index = i;\n });\n next.splice(index === -1 ? next.length : index + 1, 0, entry);\n };\n insertAfter(\"test\", (e) => normalize(e) === \"src\");\n insertAfter(vitestConfig, (e) =>\n /^vite\\.config\\.[cm]?[jt]s$/.test(String(normalize(e))),\n );\n insertAfter(POCKETBASE_TYPES, () => false);\n\n if (\n next.length === include.length &&\n next.every((entry, index) => entry === include[index])\n ) {\n return { status: \"success\", changed: false };\n }\n config.include = next;\n const indent = original.match(/^\\{\\s*\\n([\\t ]+)/)?.[1] ?? \"\\t\";\n fs.writeFileSync(filePath, `${JSON.stringify(config, null, indent)}\\n`);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Node, Project, QuoteKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { replaceHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n ensureNamedImport,\n pruneUnusedImports,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\n/** The variables the handle reads, imported from `$app/env/private`. */\nexport const POCKETBASE_ENV_NAMES = [\n \"POCKETBASE_URL\",\n \"POCKETBASE_SUPERUSER_EMAIL\",\n \"POCKETBASE_SUPERUSER_PASSWORD\",\n] as const;\n\n/** The handle `creates/src/hooks.server.ts` exports, for a file that already exists. */\nexport const POCKETBASE_HANDLE = dedent`\n handlePocketbase({\n \tpocketbaseUrl: POCKETBASE_URL,\n \tsuperuserEmail: POCKETBASE_SUPERUSER_EMAIL,\n \tsuperuserPassword: POCKETBASE_SUPERUSER_PASSWORD\n })\n`;\n\nconst FAILURE_HINT = dedent`\n Add the PocketBase handle to the exported handle in src/hooks.server.ts:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import {\n \tPOCKETBASE_URL,\n \tPOCKETBASE_SUPERUSER_EMAIL,\n \tPOCKETBASE_SUPERUSER_PASSWORD\n } from '$app/env/private';\n import { handlePocketbase } from '@velastack/pocketbase';\n\n export const handle = sequence(\n \t/* your existing handle */,\n \t${POCKETBASE_HANDLE.replace(/\\n/g, \"\\n\\t\")}\n );\n`;\n\n/**\n * Compose the PocketBase handle into a `hooks.server.ts` the project already\n * has, instead of the create overwriting it: a static site's, or one i18n or\n * content negotiation wrote. It takes `handleStatic()`'s place, since\n * `handlePocketbase` does what that did and more; otherwise it goes last, so\n * the handles already there keep running first.\n */\nexport function modifyHooksServerBackend(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // The create writes it.\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const composed = replaceHandle(sourceFile, \"handleStatic\", {\n expression: POCKETBASE_HANDLE,\n name: \"handlePocketbase\",\n position: \"last\",\n });\n if (composed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (composed.status === \"unchanged\") {\n return { status: \"success\", changed: false };\n }\n\n // The static template's comment explains handleStatic(). Where that was the\n // whole handle, replaceHandle already dropped it; in a sequence (i18n or\n // negotiation composed in since) it is still there, describing a handle\n // that is gone.\n const statement = composed.statement;\n if (statement && Node.isJSDocable(statement)) {\n for (const doc of statement.getJsDocs()) {\n if (doc.getText().includes(\"vela legal\")) doc.remove();\n }\n }\n\n pruneUnusedImports(sourceFile, [\"@velastack/kit\"]);\n for (const name of POCKETBASE_ENV_NAMES) {\n ensureNamedImport(sourceFile, \"$app/env/private\", name);\n }\n ensureNamedImport(sourceFile, \"@velastack/pocketbase\", \"handlePocketbase\");\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifySvelteConfig } from \"./modifies/svelte-config\";\nimport { modifyGitignore } from \"./modifies/gitignore\";\nimport { modifyTsconfigBackend } from \"./modifies/tsconfig\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n hasVitestConfig,\n modifyTestSetup,\n VITEST_CONFIG,\n WITH_BACKEND,\n} from \"./modifies/test-setup\";\nimport { modifyHooksServerBackend } from \"./modifies/hooks.server\";\nimport { modifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { BACKEND_ENV_VARS } from \"./env-vars\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const creates: File[] = [];\n const create = (filePath: string, content: string) =>\n creates.push({\n path: filePath,\n language: languageFromPath(filePath),\n content,\n status: \"success\",\n });\n\n logger.info(\"Modifying adapter config\");\n const adapter = modifySvelteConfig(options.root);\n const svelteConfigFile = modifyOutcomeToFile(\n adapter.filePath,\n adapter.outcome,\n );\n if (svelteConfigFile) modifies.push(svelteConfigFile);\n\n // A hooks.server.ts the project already has keeps its handles; the create\n // only writes the file where there is none (see `keepMissing` in index.ts).\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const hooksServerFile = modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerBackend(hooksServerPath),\n );\n if (hooksServerFile) {\n logger.info(\"Modifying hooks.server.ts\");\n modifies.push(hooksServerFile);\n }\n\n // SvelteKit 3 exposes only declared variables: the handle above reads\n // these three from `$app/env/private`.\n logger.info(\"Declaring the PocketBase variables in src/env.ts\");\n const envVars = modifyEnvVarsFiles(options.root, BACKEND_ENV_VARS);\n if (envVars.create) creates.push(envVars.create);\n if (envVars.modify) modifies.push(envVars.modify);\n\n logger.info(\"Modifying .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n const gitignoreFile = modifyOutcomeToFile(\n gitignorePath,\n modifyGitignore(gitignorePath),\n );\n if (gitignoreFile) modifies.push(gitignoreFile);\n\n // A backend brings server tests with it. The static template and a project\n // vela did not create have no harness at all, so what is missing is created:\n // the setup file, and the vitest config that loads it.\n const testSetupPath = path.join(options.root, \"test\", \"setup.ts\");\n if (fs.existsSync(testSetupPath)) {\n logger.info(\"Modifying test/setup.ts\");\n const testSetupFile = modifyOutcomeToFile(\n testSetupPath,\n modifyTestSetup(testSetupPath),\n );\n if (testSetupFile) modifies.push(testSetupFile);\n } else {\n logger.info(\"Creating test/setup.ts\");\n create(\"test/setup.ts\", WITH_BACKEND);\n }\n\n if (!hasVitestConfig(options.root)) {\n logger.info(\"Creating vitest.config.ts\");\n create(\"vitest.config.ts\", VITEST_CONFIG);\n }\n\n // Kit 3's tsconfig lists no files, so the test harness and PocketBase's\n // generated types are type-checked only when the project's include names them.\n const tsconfigPath = path.join(options.root, \"tsconfig.json\");\n const tsconfigFile = modifyOutcomeToFile(\n tsconfigPath,\n modifyTsconfigBackend(options.root),\n );\n if (tsconfigFile) {\n logger.info(\"Modifying tsconfig.json\");\n modifies.push(tsconfigFile);\n }\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAWA,IAAMkB,IAAiB;CAAC;CAAM;CAAO;CAAM;AAAK,CAAC,CAAC,KAC/C,MAAQ,iBAAiBC,GAC5B;AAiBA,SAAgBC,EAAsB,GAA6B;CACjE,IAAMC,IAAWJ,EAAK,KAAKK,GAAM,eAAe;CACh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AAHIiD,EAAQ,UAAQN,EAAQ,KAAKM,EAAQ,MAAM,GAC3CA,EAAQ,UAAQP,EAAS,KAAKO,EAAQ,MAAM,GAEhDT,EAAO,KAAK,sBAAsB;CAClC,IAAMW,IAAgBjD,EAAK,KAAKuC,EAAQ,MAAM,YAAY,GACpDW,IAAgBlE,EACpBiE,GACA/D,EAAgB+D,CAAa,CAC/B;CACA,AAAIC,KAAeV,EAAS,KAAKU,CAAa;CAK9C,IAAMC,IAAgBnD,EAAK,KAAKuC,EAAQ,MAAM,QAAQ,UAAU;CAChE,IAAIxC,EAAG,WAAWoD,CAAa,GAAG;EAChC,EAAO,KAAK,yBAAyB;EACrC,IAAMC,IAAgBpE,EACpBmE,GACA/D,EAAgB+D,CAAa,CAC/B;EACA,AAAIC,KAAeZ,EAAS,KAAKY,CAAa;CAChD,OAEE,AADAd,EAAO,KAAK,wBAAwB,GACpCI,EAAO,iBAAiBpD,CAAY;CAGtC,AAAKD,EAAgBkD,EAAQ,IAAI,MAC/BD,EAAO,KAAK,2BAA2B,GACvCI,EAAO,oBAAoBnD,CAAa;CAK1C,IAAM8D,IAAerD,EAAK,KAAKuC,EAAQ,MAAM,eAAe,GACtDe,IAAetE,EACnBqE,GACAlD,EAAsBoC,EAAQ,IAAI,CACpC;CAMA,OALIe,MACFhB,EAAO,KAAK,yBAAyB,GACrCE,EAAS,KAAKc,CAAY,IAGrB;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
2
|
import { a as t } from "./util-mXrQ89nG.js";
|
|
3
|
-
import { r as n } from "./modify-file-
|
|
3
|
+
import { r as n } from "./modify-file-BOEKlIDw.js";
|
|
4
4
|
import { t as r } from "./dedent-CCUOcPFW.js";
|
|
5
5
|
import { _ as i, o as a, r as o, u as s } from "./ts-morph-helpers-B4KZXP44.js";
|
|
6
6
|
import { t as c } from "./modify-nav-user-D42kWyU6.js";
|
|
@@ -157,4 +157,4 @@ async function E(r) {
|
|
|
157
157
|
}
|
|
158
158
|
export { w as SUCCESS_PAGE, E as generate, C as t };
|
|
159
159
|
|
|
160
|
-
//# sourceMappingURL=generate.runtime-
|
|
160
|
+
//# sourceMappingURL=generate.runtime-jIlQ2GMh.js.map
|