@velastack/patterns 0.4.3 → 0.5.0
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/README.md +22 -2
- package/dist/chunks/{_page-e_I-fdSR.js → _page-DoPdZgZv.js} +2 -2
- package/dist/chunks/_page-DoPdZgZv.js.map +1 -0
- package/dist/chunks/collections-Cpjo2OiQ.js +203 -0
- package/dist/chunks/collections-Cpjo2OiQ.js.map +1 -0
- package/dist/chunks/dispatch-BIvOwbKN.js +6 -0
- package/dist/chunks/dispatch-BIvOwbKN.js.map +1 -0
- package/dist/chunks/{env-vars-CcE6ODqC.js → env-vars-Bj41Nccm.js} +32 -20
- package/dist/chunks/env-vars-Bj41Nccm.js.map +1 -0
- package/dist/chunks/generate-BClgUH4J.js +137 -0
- package/dist/chunks/generate-BClgUH4J.js.map +1 -0
- package/dist/chunks/{generate-CZGHByV3.js → generate-DjBMRzsB.js} +6 -6
- package/dist/chunks/{generate-CZGHByV3.js.map → generate-DjBMRzsB.js.map} +1 -1
- package/dist/chunks/{generate-DetW_gbr.js → generate-DyV5R8NP.js} +7 -7
- package/dist/chunks/{generate-DetW_gbr.js.map → generate-DyV5R8NP.js.map} +1 -1
- package/dist/chunks/generate-ZIOVLH6Q.js +72 -0
- package/dist/chunks/generate-ZIOVLH6Q.js.map +1 -0
- package/dist/chunks/{generate-Bg0E3eWm.js → generate-dNlBII84.js} +4 -4
- package/dist/chunks/{generate-Bg0E3eWm.js.map → generate-dNlBII84.js.map} +1 -1
- package/dist/chunks/{generate-CFqpRi9D.js → generate-yi8AP3xH.js} +4 -4
- package/dist/chunks/{generate-CFqpRi9D.js.map → generate-yi8AP3xH.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CpMKXBkn.js → generate.runtime-B4QoBn5v.js} +6 -6
- package/dist/chunks/{generate.runtime-CpMKXBkn.js.map → generate.runtime-B4QoBn5v.js.map} +1 -1
- package/dist/chunks/{generate.runtime-aQnBmH8D.js → generate.runtime-BKINIJ2c.js} +3 -3
- package/dist/chunks/{generate.runtime-aQnBmH8D.js.map → generate.runtime-BKINIJ2c.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Dl6OQ7pe.js → generate.runtime-BKTkVCEm.js} +4 -4
- package/dist/chunks/{generate.runtime-Dl6OQ7pe.js.map → generate.runtime-BKTkVCEm.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CAn1qIQ_.js → generate.runtime-BXZDKLbA.js} +3 -3
- package/dist/chunks/{generate.runtime-CAn1qIQ_.js.map → generate.runtime-BXZDKLbA.js.map} +1 -1
- package/dist/chunks/{generate.runtime-hTKzxH2M.js → generate.runtime-BYfyZHhs.js} +7 -7
- package/dist/chunks/{generate.runtime-hTKzxH2M.js.map → generate.runtime-BYfyZHhs.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DoZJHtZh.js → generate.runtime-BavEh01F.js} +6 -6
- package/dist/chunks/{generate.runtime-DoZJHtZh.js.map → generate.runtime-BavEh01F.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DJ9MVVPC.js → generate.runtime-BcgjZJug.js} +123 -110
- package/dist/chunks/generate.runtime-BcgjZJug.js.map +1 -0
- package/dist/chunks/generate.runtime-BdHv7Jp1.js +82 -0
- package/dist/chunks/generate.runtime-BdHv7Jp1.js.map +1 -0
- package/dist/chunks/{generate.runtime-CqncBFNg.js → generate.runtime-BdmoAVJK.js} +4 -4
- package/dist/chunks/{generate.runtime-CqncBFNg.js.map → generate.runtime-BdmoAVJK.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BpMN5Uq-.js → generate.runtime-Bdpu4rX0.js} +3 -3
- package/dist/chunks/{generate.runtime-BpMN5Uq-.js.map → generate.runtime-Bdpu4rX0.js.map} +1 -1
- package/dist/chunks/{generate.runtime-uLUiPgqx.js → generate.runtime-C7s1Mx5L.js} +6 -6
- package/dist/chunks/{generate.runtime-uLUiPgqx.js.map → generate.runtime-C7s1Mx5L.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CEqLgLT9.js → generate.runtime-CCV4O6_I.js} +3 -3
- package/dist/chunks/{generate.runtime-CEqLgLT9.js.map → generate.runtime-CCV4O6_I.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CK10Mum5.js → generate.runtime-CSUnP0l-.js} +10 -10
- package/dist/chunks/{generate.runtime-CK10Mum5.js.map → generate.runtime-CSUnP0l-.js.map} +1 -1
- package/dist/chunks/{generate.runtime-koQxLywh.js → generate.runtime-CV4soy2n.js} +6 -6
- package/dist/chunks/{generate.runtime-koQxLywh.js.map → generate.runtime-CV4soy2n.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Db0HZyj3.js → generate.runtime-CWgZhxQt.js} +2 -2
- package/dist/chunks/{generate.runtime-Db0HZyj3.js.map → generate.runtime-CWgZhxQt.js.map} +1 -1
- package/dist/chunks/{generate.runtime-IWEhGhWY.js → generate.runtime-CcPCAEV0.js} +6 -6
- package/dist/chunks/{generate.runtime-IWEhGhWY.js.map → generate.runtime-CcPCAEV0.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DJHUBL4Z.js → generate.runtime-D-qtaVdq.js} +2 -2
- package/dist/chunks/{generate.runtime-DJHUBL4Z.js.map → generate.runtime-D-qtaVdq.js.map} +1 -1
- package/dist/chunks/{generate.runtime-E-zoeSKW.js → generate.runtime-DBBtYTAa.js} +7 -7
- package/dist/chunks/{generate.runtime-E-zoeSKW.js.map → generate.runtime-DBBtYTAa.js.map} +1 -1
- package/dist/chunks/{generate.runtime-5rIc-RNL.js → generate.runtime-DRRyPa-e.js} +6 -6
- package/dist/chunks/{generate.runtime-5rIc-RNL.js.map → generate.runtime-DRRyPa-e.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BK3mR0Rj.js → generate.runtime-DaRVyiSg.js} +148 -127
- package/dist/chunks/generate.runtime-DaRVyiSg.js.map +1 -0
- package/dist/chunks/{generate.runtime-DVB7uuht.js → generate.runtime-DetYynf4.js} +3 -3
- package/dist/chunks/{generate.runtime-DVB7uuht.js.map → generate.runtime-DetYynf4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-a3R4hqFy.js → generate.runtime-DjCzW3zU.js} +12 -12
- package/dist/chunks/{generate.runtime-a3R4hqFy.js.map → generate.runtime-DjCzW3zU.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Djas9UNy.js → generate.runtime-DlbG-8Xm.js} +4 -4
- package/dist/chunks/{generate.runtime-Djas9UNy.js.map → generate.runtime-DlbG-8Xm.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CbE9RHcf.js → generate.runtime-DmsOEsJV.js} +5 -5
- package/dist/chunks/generate.runtime-DmsOEsJV.js.map +1 -0
- package/dist/chunks/{generate.runtime-axm9wcQv.js → generate.runtime-MjWwR2Bd.js} +3 -3
- package/dist/chunks/{generate.runtime-axm9wcQv.js.map → generate.runtime-MjWwR2Bd.js.map} +1 -1
- package/dist/chunks/generate.runtime-NaSIZlP5.js +48 -0
- package/dist/chunks/generate.runtime-NaSIZlP5.js.map +1 -0
- package/dist/chunks/{generate.runtime-CZ46nkSL.js → generate.runtime-OEgsdWRP.js} +2 -2
- package/dist/chunks/{generate.runtime-CZ46nkSL.js.map → generate.runtime-OEgsdWRP.js.map} +1 -1
- package/dist/chunks/{generate.runtime-rs1ZOIET.js → generate.runtime-QbmCPT42.js} +3 -3
- package/dist/chunks/{generate.runtime-rs1ZOIET.js.map → generate.runtime-QbmCPT42.js.map} +1 -1
- package/dist/chunks/generate.runtime-azOvp6tl.js +106 -0
- package/dist/chunks/generate.runtime-azOvp6tl.js.map +1 -0
- package/dist/chunks/{generate.runtime-kciwaXxh.js → generate.runtime-b2RtuPy4.js} +4 -4
- package/dist/chunks/{generate.runtime-kciwaXxh.js.map → generate.runtime-b2RtuPy4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bcrht4M9.js → generate.runtime-pMpn0Pbf.js} +2 -2
- package/dist/chunks/{generate.runtime-Bcrht4M9.js.map → generate.runtime-pMpn0Pbf.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DHHlYfTD.js → generate.runtime-utFLS6Jz.js} +3 -3
- package/dist/chunks/{generate.runtime-DHHlYfTD.js.map → generate.runtime-utFLS6Jz.js.map} +1 -1
- package/dist/chunks/modify-file-Bbhyfiy_.js +53 -0
- package/dist/chunks/modify-file-Bbhyfiy_.js.map +1 -0
- package/dist/chunks/{modify-nav-user-BLyrW2sK.js → modify-nav-user-B8h8WTrM.js} +2 -2
- package/dist/chunks/{modify-nav-user-BLyrW2sK.js.map → modify-nav-user-B8h8WTrM.js.map} +1 -1
- package/dist/chunks/providers-CL9kQ4hp.js +98 -0
- package/dist/chunks/providers-CL9kQ4hp.js.map +1 -0
- package/dist/chunks/providers-DwbwccSW.js +38 -0
- package/dist/chunks/providers-DwbwccSW.js.map +1 -0
- package/dist/chunks/{shared-Cc_ns5-y.js → shared-D5GOS97l.js} +2 -2
- package/dist/chunks/{shared-Cc_ns5-y.js.map → shared-D5GOS97l.js.map} +1 -1
- package/dist/chunks/shopify-page-D-VFwGxI.js +11 -0
- package/dist/chunks/shopify-page-D-VFwGxI.js.map +1 -0
- package/dist/chunks/stripe-customer-B3tP8gtD.js +6 -0
- package/dist/chunks/stripe-customer-B3tP8gtD.js.map +1 -0
- package/dist/chunks/{svelte-file-B3RfgVdt.js → svelte-file-Dv5-bl79.js} +37 -2
- package/dist/chunks/svelte-file-Dv5-bl79.js.map +1 -0
- package/dist/chunks/{test-setup-B9fQ5L_-.js → test-setup-DZoyF8Ak.js} +2 -2
- package/dist/chunks/{test-setup-B9fQ5L_-.js.map → test-setup-DZoyF8Ak.js.map} +1 -1
- package/dist/chunks/{ui-CuCsupFq.js → ui-BuocThuh.js} +2 -2
- package/dist/chunks/{ui-CuCsupFq.js.map → ui-BuocThuh.js.map} +1 -1
- package/dist/chunks/{write-result-DiZsCS_y.js → write-result-Cq-9A7Zy.js} +2 -2
- package/dist/chunks/write-result-Cq-9A7Zy.js.map +1 -0
- package/dist/index.d.ts +283 -22
- package/dist/index.js +2199 -2035
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_page-e_I-fdSR.js.map +0 -1
- package/dist/chunks/collections-zzZ_HQxB.js +0 -192
- package/dist/chunks/collections-zzZ_HQxB.js.map +0 -1
- package/dist/chunks/dispatch-D4TN9pdW.js +0 -6
- package/dist/chunks/dispatch-D4TN9pdW.js.map +0 -1
- package/dist/chunks/env-vars-CcE6ODqC.js.map +0 -1
- package/dist/chunks/env-vars-De0Xs0L2.js +0 -20
- package/dist/chunks/env-vars-De0Xs0L2.js.map +0 -1
- package/dist/chunks/generate.runtime-BK3mR0Rj.js.map +0 -1
- package/dist/chunks/generate.runtime-CbE9RHcf.js.map +0 -1
- package/dist/chunks/generate.runtime-DJ9MVVPC.js.map +0 -1
- package/dist/chunks/generate.runtime-EQnytCFL.js +0 -122
- package/dist/chunks/generate.runtime-EQnytCFL.js.map +0 -1
- package/dist/chunks/modify-file-DK-tCH9k.js +0 -46
- package/dist/chunks/modify-file-DK-tCH9k.js.map +0 -1
- package/dist/chunks/providers-BHR6-XZ7.js +0 -76
- package/dist/chunks/providers-BHR6-XZ7.js.map +0 -1
- package/dist/chunks/svelte-file-B3RfgVdt.js.map +0 -1
- package/dist/chunks/write-result-DiZsCS_y.js.map +0 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { t as e } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import { t as e } from "./errors-DR3gF_7a.js";
|
|
2
|
+
import { t } from "./dedent-Gq6Krl4n.js";
|
|
3
|
+
import { n } from "./logger-CQONztPm.js";
|
|
4
|
+
import { t as r } from "./stripe-customer-B3tP8gtD.js";
|
|
5
|
+
import { a as i, i as a, n as o, o as s, r as c, s as l, t as u } from "./dispatch-BIvOwbKN.js";
|
|
6
|
+
import { _ as d, o as f, r as p } from "./ts-morph-helpers-Bepc-Es2.js";
|
|
7
|
+
import { n as m, r as h } from "./modify-file-Bbhyfiy_.js";
|
|
8
|
+
import { t as g } from "./svelte-file-Dv5-bl79.js";
|
|
9
|
+
import { n as _ } from "./modify-nav-user-B8h8WTrM.js";
|
|
10
|
+
import v from "node:fs";
|
|
11
|
+
import y from "node:path";
|
|
12
|
+
import { Project as b, QuoteKind as x, SyntaxKind as S } from "ts-morph";
|
|
11
13
|
//#region src/patterns/enable/subscriptions/modifies/modify-webhook-server.ts
|
|
12
|
-
var
|
|
14
|
+
var C = t`
|
|
13
15
|
Wire the subscription event handlers into src/routes/webhooks/stripe/handlers/dispatch.ts:
|
|
14
16
|
|
|
15
17
|
Add imports:
|
|
@@ -27,7 +29,7 @@ var S = e`
|
|
|
27
29
|
case "customer.subscription.deleted":
|
|
28
30
|
await handleSubscriptionDeleted(event.data.object, locals);
|
|
29
31
|
break;
|
|
30
|
-
`,
|
|
32
|
+
`, w = "Enable payments first — src/routes/webhooks/stripe/handlers/dispatch.ts is created by enable-payments.", T = t`
|
|
31
33
|
case "customer.subscription.created":
|
|
32
34
|
await handleSubscriptionCreated(event.data.object, locals);
|
|
33
35
|
break;
|
|
@@ -40,18 +42,18 @@ var S = e`
|
|
|
40
42
|
await handleSubscriptionDeleted(event.data.object, locals);
|
|
41
43
|
break;
|
|
42
44
|
`;
|
|
43
|
-
function
|
|
44
|
-
if (!
|
|
45
|
+
function E(e) {
|
|
46
|
+
if (!v.existsSync(e)) return {
|
|
45
47
|
status: "not-found",
|
|
46
|
-
message:
|
|
48
|
+
message: w
|
|
47
49
|
};
|
|
48
|
-
let t =
|
|
50
|
+
let t = v.readFileSync(e, "utf8");
|
|
49
51
|
if (t.includes("handleSubscriptionCreated")) return {
|
|
50
52
|
status: "success",
|
|
51
53
|
changed: !1
|
|
52
54
|
};
|
|
53
|
-
let n = !1, { source: r } =
|
|
54
|
-
|
|
55
|
+
let n = !1, { source: r } = d(t, (e) => {
|
|
56
|
+
p(e, [
|
|
55
57
|
{
|
|
56
58
|
namedImports: ["handleSubscriptionCreated"],
|
|
57
59
|
moduleSpecifier: "./subscription/created"
|
|
@@ -65,46 +67,46 @@ function T(e) {
|
|
|
65
67
|
moduleSpecifier: "./subscription/deleted"
|
|
66
68
|
}
|
|
67
69
|
]);
|
|
68
|
-
let t = e.getDescendantsOfKind(
|
|
70
|
+
let t = e.getDescendantsOfKind(S.SwitchStatement).find((e) => e.getExpression().getText().includes("event.type"));
|
|
69
71
|
if (!t) return;
|
|
70
|
-
let r = t.getCaseBlock().getClauses(), i = r.find((e) => e.getKind() ===
|
|
72
|
+
let r = t.getCaseBlock().getClauses(), i = r.find((e) => e.getKind() === S.DefaultClause), a = `${T}\n\n`;
|
|
71
73
|
if (i) i.replaceWithText(a + i.getText());
|
|
72
74
|
else if (r.length > 0) {
|
|
73
75
|
let e = r[r.length - 1];
|
|
74
|
-
e.replaceWithText(e.getText() + `\n\n${
|
|
76
|
+
e.replaceWithText(e.getText() + `\n\n${T}`);
|
|
75
77
|
} else return;
|
|
76
|
-
|
|
78
|
+
f(e), n = !0;
|
|
77
79
|
});
|
|
78
|
-
return n ? (
|
|
80
|
+
return n ? (v.writeFileSync(e, r, "utf8"), {
|
|
79
81
|
status: "success",
|
|
80
82
|
changed: !0
|
|
81
83
|
}) : {
|
|
82
84
|
status: "failed",
|
|
83
|
-
message:
|
|
85
|
+
message: C
|
|
84
86
|
};
|
|
85
87
|
}
|
|
86
88
|
//#endregion
|
|
87
89
|
//#region src/patterns/enable/subscriptions/modifies/modify-app-layout-server.ts
|
|
88
|
-
var
|
|
90
|
+
var D = "const subscription = await loadActiveSubscription(locals, user.id);", O = ["Create src/routes/(app)/+layout.server.ts before enabling subscriptions.", "Enable auth first — the (app) layout is provided by the velastack-auth baseline."].join("\n"), k = (e) => [
|
|
89
91
|
"Could not find the user and the returned object in the (app) layout load.",
|
|
90
92
|
"Add the active subscription to it by hand:",
|
|
91
93
|
"",
|
|
92
94
|
e,
|
|
93
95
|
"",
|
|
94
96
|
"// In load, once `user` is set:",
|
|
95
|
-
|
|
97
|
+
D,
|
|
96
98
|
"// ...and return it with the rest:",
|
|
97
99
|
"return { ..., subscription };"
|
|
98
100
|
].join("\n");
|
|
99
|
-
function
|
|
101
|
+
function A(e) {
|
|
100
102
|
let t = e.replace(/^[ \t]*\/\/[ \t]*\[!code highlight:\d+\][ \t]*\r?\n/gm, ""), n = t.indexOf("async function loadActiveSubscription"), r = t.indexOf("\n}\n", n);
|
|
101
103
|
if (n === -1 || r === -1) throw Error("No loadActiveSubscription in the layout template");
|
|
102
104
|
return t.slice(n, r + 2);
|
|
103
105
|
}
|
|
104
|
-
function
|
|
106
|
+
function j(e) {
|
|
105
107
|
let t = e.getVariableDeclaration("load");
|
|
106
108
|
if (t?.getVariableStatement()?.hasExportKeyword()) {
|
|
107
|
-
let e = t.getInitializer(), n = t.getInitializerIfKind(
|
|
109
|
+
let e = t.getInitializer(), n = t.getInitializerIfKind(S.ArrowFunction) ?? e?.getFirstDescendantByKind(S.ArrowFunction) ?? e?.getFirstDescendantByKind(S.FunctionExpression);
|
|
108
110
|
if (n) return {
|
|
109
111
|
fn: n,
|
|
110
112
|
statement: t.getVariableStatement()
|
|
@@ -116,48 +118,48 @@ function A(e) {
|
|
|
116
118
|
statement: n
|
|
117
119
|
} : void 0;
|
|
118
120
|
}
|
|
119
|
-
function
|
|
120
|
-
if (!
|
|
121
|
+
function M(e, t) {
|
|
122
|
+
if (!v.existsSync(e)) return {
|
|
121
123
|
status: "not-found",
|
|
122
|
-
message:
|
|
124
|
+
message: O
|
|
123
125
|
};
|
|
124
|
-
let n =
|
|
126
|
+
let n = v.readFileSync(e, "utf8");
|
|
125
127
|
if (n.includes("loadActiveSubscription")) return {
|
|
126
128
|
status: "success",
|
|
127
129
|
changed: !1
|
|
128
130
|
};
|
|
129
|
-
let r =
|
|
130
|
-
if (!a || !o || o.getKind() !==
|
|
131
|
+
let r = A(t), i = new b({ manipulationSettings: { quoteKind: x.Single } }).addSourceFileAtPath(e), a = j(i), o = a?.fn.getBody();
|
|
132
|
+
if (!a || !o || o.getKind() !== S.Block) return {
|
|
131
133
|
status: "failed",
|
|
132
|
-
message:
|
|
134
|
+
message: k(r)
|
|
133
135
|
};
|
|
134
|
-
let s = o.asKindOrThrow(
|
|
136
|
+
let s = o.asKindOrThrow(S.Block), c = a.fn.getParameters()[0]?.getNameNode(), l = c?.getKind() === S.ObjectBindingPattern && c.asKindOrThrow(S.ObjectBindingPattern).getElements().some((e) => e.getName() === "locals"), u = s.getStatements().findIndex((e) => e.getKind() === S.VariableStatement && e.asKindOrThrow(S.VariableStatement).getDeclarations().some((e) => e.getName() === "user")), d = s.getStatements(), p = [...d].reverse().find((e) => e.getKind() === S.ReturnStatement)?.asKind(S.ReturnStatement), m = p?.getExpression()?.asKind(S.ObjectLiteralExpression);
|
|
135
137
|
if (!l || u === -1 || !p || !m) return {
|
|
136
138
|
status: "failed",
|
|
137
|
-
message:
|
|
139
|
+
message: k(r)
|
|
138
140
|
};
|
|
139
|
-
if (s.insertStatements(
|
|
141
|
+
if (s.insertStatements(d.indexOf(p), D), !m.getProperty("subscription")) {
|
|
140
142
|
let e = m.getText();
|
|
141
143
|
e.includes("\n") ? m.addShorthandPropertyAssignment({ name: "subscription" }) : m.replaceWithText(e.replace(/\s*\}$/, ", subscription }"));
|
|
142
144
|
}
|
|
143
|
-
return a.fn.isAsync() || a.fn.setIsAsync(!0), i.insertStatements(i.getStatements().indexOf(a.statement), (e) => e.write(r).blankLine()),
|
|
145
|
+
return a.fn.isAsync() || a.fn.setIsAsync(!0), i.insertStatements(i.getStatements().indexOf(a.statement), (e) => e.write(r).blankLine()), f(i), i.saveSync(), {
|
|
144
146
|
status: "success",
|
|
145
147
|
changed: i.getFullText() !== n
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
//#endregion
|
|
149
151
|
//#region src/patterns/enable/subscriptions/modifies/modify-app-layout-svelte.ts
|
|
150
|
-
var
|
|
152
|
+
var N = [
|
|
151
153
|
"Pass the subscription prop to <AppSidebar> in src/routes/(app)/+layout.svelte:",
|
|
152
154
|
"",
|
|
153
155
|
"<AppSidebar user={data.user} subscription={data.subscription} />"
|
|
154
|
-
].join("\n"),
|
|
155
|
-
function
|
|
156
|
-
if (!
|
|
156
|
+
].join("\n"), P = ["Create src/routes/(app)/+layout.svelte with an <AppSidebar /> that receives the subscription prop."].join("\n");
|
|
157
|
+
function F(e) {
|
|
158
|
+
if (!v.existsSync(e)) return {
|
|
157
159
|
status: "not-found",
|
|
158
|
-
message:
|
|
160
|
+
message: P
|
|
159
161
|
};
|
|
160
|
-
let t =
|
|
162
|
+
let t = g.fromPath(e);
|
|
161
163
|
return t.hasElement("AppSidebar") ? t.hasAttribute("AppSidebar", "subscription") ? {
|
|
162
164
|
status: "success",
|
|
163
165
|
changed: !1
|
|
@@ -166,38 +168,38 @@ function P(e) {
|
|
|
166
168
|
changed: t.hasChanged()
|
|
167
169
|
}) : {
|
|
168
170
|
status: "failed",
|
|
169
|
-
message:
|
|
171
|
+
message: N
|
|
170
172
|
} : {
|
|
171
173
|
status: "failed",
|
|
172
|
-
message:
|
|
174
|
+
message: N
|
|
173
175
|
};
|
|
174
176
|
}
|
|
175
177
|
//#endregion
|
|
176
178
|
//#region src/patterns/enable/subscriptions/modifies/modify-app-sidebar.ts
|
|
177
|
-
var
|
|
179
|
+
var I = "{ id: string; productName: string | null } | null", L = [
|
|
178
180
|
"Update src/lib/components/app-sidebar.svelte to forward a subscription prop:",
|
|
179
181
|
"",
|
|
180
182
|
"1. Add `subscription = null` to the destructured $props() call.",
|
|
181
|
-
`2. Add \`subscription?: ${
|
|
183
|
+
`2. Add \`subscription?: ${I}\` to the props type.`,
|
|
182
184
|
"3. Pass `{subscription}` to <NavUser>."
|
|
183
|
-
].join("\n"),
|
|
184
|
-
function
|
|
185
|
-
let t = !1, { source: n } =
|
|
185
|
+
].join("\n"), R = ["Create src/lib/components/app-sidebar.svelte before enabling subscriptions."].join("\n");
|
|
186
|
+
function z(e) {
|
|
187
|
+
let t = !1, { source: n } = d(e, (e) => {
|
|
186
188
|
for (let n of e.getVariableDeclarations()) {
|
|
187
189
|
let e = n.getInitializer();
|
|
188
190
|
if (!e || e.getText() !== "$props()") continue;
|
|
189
191
|
let r = n.getNameNode();
|
|
190
|
-
if (r.getKind() !==
|
|
191
|
-
let i = r.asKindOrThrow(
|
|
192
|
+
if (r.getKind() !== S.ObjectBindingPattern) continue;
|
|
193
|
+
let i = r.asKindOrThrow(S.ObjectBindingPattern), a = i.getElements();
|
|
192
194
|
if (a.some((e) => e.getName() === "subscription")) return;
|
|
193
195
|
let o = n.getTypeNode();
|
|
194
|
-
if (o?.getKind() ===
|
|
195
|
-
let e = o.asKindOrThrow(
|
|
196
|
+
if (o?.getKind() === S.IntersectionType) {
|
|
197
|
+
let e = o.asKindOrThrow(S.IntersectionType);
|
|
196
198
|
for (let t of e.getTypeNodes()) {
|
|
197
|
-
if (t.getKind() !==
|
|
198
|
-
let e = t.asKindOrThrow(
|
|
199
|
+
if (t.getKind() !== S.TypeLiteral) continue;
|
|
200
|
+
let e = t.asKindOrThrow(S.TypeLiteral), n = e.getProperties().map((e) => e.getText().replace(/[;,]\s*$/, ""));
|
|
199
201
|
if (!n.some((e) => /^\s*subscription\??\s*:/.test(e))) {
|
|
200
|
-
n.push(`subscription?: ${
|
|
202
|
+
n.push(`subscription?: ${I}`), e.replaceWithText(`{ ${n.join("; ")}; }`);
|
|
201
203
|
break;
|
|
202
204
|
}
|
|
203
205
|
}
|
|
@@ -205,32 +207,32 @@ function R(e) {
|
|
|
205
207
|
let s = a.map((e) => e.getText()), c = a.findIndex((e) => e.getDotDotDotToken() || e.getInitializer());
|
|
206
208
|
c === -1 && (c = s.length), s.splice(c, 0, "subscription = null"), i.replaceWithText(`{ ${s.join(", ")} }`), t = !0;
|
|
207
209
|
}
|
|
208
|
-
|
|
210
|
+
f(e);
|
|
209
211
|
});
|
|
210
212
|
return {
|
|
211
213
|
source: n,
|
|
212
214
|
wasAdded: t
|
|
213
215
|
};
|
|
214
216
|
}
|
|
215
|
-
function
|
|
216
|
-
if (!
|
|
217
|
+
function B(e) {
|
|
218
|
+
if (!v.existsSync(e)) return {
|
|
217
219
|
status: "not-found",
|
|
218
|
-
message:
|
|
220
|
+
message: R
|
|
219
221
|
};
|
|
220
|
-
let t =
|
|
222
|
+
let t = v.readFileSync(e, "utf8");
|
|
221
223
|
if (t.includes("subscription?: {") || t.includes("subscription={subscription}") || t.includes("{subscription}")) return {
|
|
222
224
|
status: "success",
|
|
223
225
|
changed: !1
|
|
224
226
|
};
|
|
225
|
-
let n = new
|
|
227
|
+
let n = new g(t);
|
|
226
228
|
if (!n.hasElement("NavUser")) return {
|
|
227
229
|
status: "failed",
|
|
228
|
-
message:
|
|
230
|
+
message: L
|
|
229
231
|
};
|
|
230
|
-
let r = n.modifyScript((e) =>
|
|
232
|
+
let r = n.modifyScript((e) => z(e).source), i = !n.hasAttribute("NavUser", "subscription") && n.appendToAttributes("NavUser", " {subscription}");
|
|
231
233
|
return !r && !i ? {
|
|
232
234
|
status: "failed",
|
|
233
|
-
message:
|
|
235
|
+
message: L
|
|
234
236
|
} : (n.writeTo(e), {
|
|
235
237
|
status: "success",
|
|
236
238
|
changed: n.hasChanged()
|
|
@@ -238,12 +240,12 @@ function z(e) {
|
|
|
238
240
|
}
|
|
239
241
|
//#endregion
|
|
240
242
|
//#region src/patterns/enable/subscriptions/modifies/modify-by-template.ts
|
|
241
|
-
function
|
|
242
|
-
if (!
|
|
243
|
+
function V(e, t, n, r) {
|
|
244
|
+
if (!v.existsSync(e)) return {
|
|
243
245
|
status: "not-found",
|
|
244
246
|
message: r
|
|
245
247
|
};
|
|
246
|
-
let i =
|
|
248
|
+
let i = v.readFileSync(e, "utf8");
|
|
247
249
|
if (i.includes(n)) return {
|
|
248
250
|
status: "success",
|
|
249
251
|
changed: !1
|
|
@@ -252,60 +254,71 @@ function B(e, t, n, r) {
|
|
|
252
254
|
return i === a ? {
|
|
253
255
|
status: "success",
|
|
254
256
|
changed: !1
|
|
255
|
-
} : (
|
|
257
|
+
} : (v.writeFileSync(e, a, "utf8"), {
|
|
256
258
|
status: "success",
|
|
257
259
|
changed: !0
|
|
258
260
|
});
|
|
259
261
|
}
|
|
260
262
|
//#endregion
|
|
261
263
|
//#region src/patterns/enable/subscriptions/modifies/modify-billing-page-server.ts
|
|
262
|
-
var
|
|
263
|
-
function
|
|
264
|
-
return
|
|
264
|
+
var H = ["src/routes/(app)/billing/+page.server.ts is missing.", "Enable payments first — subscriptions extends the billing page with plan management."].join("\n");
|
|
265
|
+
function U(e, t) {
|
|
266
|
+
return V(e, t, "selectPlan", H);
|
|
265
267
|
}
|
|
266
268
|
//#endregion
|
|
267
269
|
//#region src/patterns/enable/subscriptions/modifies/modify-billing-page-svelte.ts
|
|
268
|
-
var
|
|
269
|
-
function
|
|
270
|
-
return
|
|
270
|
+
var W = ["src/routes/(app)/billing/+page.svelte is missing.", "Enable payments first — subscriptions extends the billing page with plan management."].join("\n");
|
|
271
|
+
function G(e, t) {
|
|
272
|
+
return V(e, t, "availablePlans", W);
|
|
271
273
|
}
|
|
272
274
|
//#endregion
|
|
273
275
|
//#region src/patterns/enable/subscriptions/generate.runtime.ts
|
|
274
|
-
var
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
var K = "src/lib/server/stripe-customer.ts", q = "src/routes/(app)/billing/+page.server.ts";
|
|
277
|
+
function J(t) {
|
|
278
|
+
if (!v.existsSync(y.join(t, q))) throw new e([
|
|
279
|
+
"Subscriptions need payments set up with auth on: they add plans to the billing page",
|
|
280
|
+
`(${q}) and link to the stripe_customers collection, which enable-payments`,
|
|
281
|
+
"creates only when auth is already enabled. This project enabled payments before auth.",
|
|
282
|
+
"",
|
|
283
|
+
"Re-enable payments now that auth is on: `vela disable payments`, then `vela enable payments`.",
|
|
284
|
+
"disable-payments drops the catalog collections, which the sync workflow refills from Stripe."
|
|
285
|
+
].join("\n"));
|
|
286
|
+
}
|
|
287
|
+
var Y = /* #__PURE__ */ Object.assign({
|
|
288
|
+
"./preview-modifies/src/lib/components/app-sidebar.svelte": l,
|
|
289
|
+
"./preview-modifies/src/lib/components/nav-user.svelte": s,
|
|
290
|
+
"./preview-modifies/src/routes/(app)/+layout.server.ts": i,
|
|
291
|
+
"./preview-modifies/src/routes/(app)/+layout.svelte": a,
|
|
292
|
+
"./preview-modifies/src/routes/(app)/billing/+page.server.ts": c,
|
|
293
|
+
"./preview-modifies/src/routes/(app)/billing/+page.svelte": o,
|
|
294
|
+
"./preview-modifies/src/routes/webhooks/stripe/handlers/dispatch.ts": u
|
|
282
295
|
});
|
|
283
|
-
function
|
|
284
|
-
let t =
|
|
296
|
+
function X(e) {
|
|
297
|
+
let t = Y[`./preview-modifies/${e}`];
|
|
285
298
|
if (t === void 0) throw Error(`Missing template for ${e} in subscriptions preview-modifies`);
|
|
286
299
|
return t;
|
|
287
300
|
}
|
|
288
|
-
async function
|
|
289
|
-
let
|
|
301
|
+
async function Z(e) {
|
|
302
|
+
let t = n(e), i = [], a = (e) => {
|
|
290
303
|
e && i.push(e);
|
|
291
304
|
};
|
|
292
|
-
|
|
293
|
-
let o =
|
|
294
|
-
a(
|
|
295
|
-
let s =
|
|
296
|
-
a(
|
|
297
|
-
let c =
|
|
298
|
-
a(
|
|
299
|
-
let l =
|
|
300
|
-
a(
|
|
301
|
-
let u =
|
|
302
|
-
a(
|
|
303
|
-
let d =
|
|
304
|
-
a(
|
|
305
|
-
let f =
|
|
306
|
-
return a(
|
|
307
|
-
creates:
|
|
308
|
-
path:
|
|
305
|
+
t.info("Modifying webhooks/stripe/handlers/dispatch.ts");
|
|
306
|
+
let o = y.join(e.root, "src", "routes", "webhooks", "stripe", "handlers", "dispatch.ts");
|
|
307
|
+
a(h(o, E(o))), t.info("Modifying (app)/+layout.server.ts");
|
|
308
|
+
let s = y.join(e.root, "src", "routes", "(app)", "+layout.server.ts");
|
|
309
|
+
a(h(s, M(s, X("src/routes/(app)/+layout.server.ts")))), t.info("Modifying (app)/+layout.svelte");
|
|
310
|
+
let c = y.join(e.root, "src", "routes", "(app)", "+layout.svelte");
|
|
311
|
+
a(h(c, F(c))), t.info("Modifying app-sidebar.svelte");
|
|
312
|
+
let l = y.join(e.root, "src", "lib", "components", "app-sidebar.svelte");
|
|
313
|
+
a(h(l, B(l))), t.info("Modifying nav-user.svelte");
|
|
314
|
+
let u = y.join(e.root, "src", "lib", "components", "nav-user.svelte");
|
|
315
|
+
a(h(u, _(u))), t.info("Modifying billing/+page.server.ts");
|
|
316
|
+
let d = y.join(e.root, "src", "routes", "(app)", "billing", "+page.server.ts");
|
|
317
|
+
a(h(d, U(d, X("src/routes/(app)/billing/+page.server.ts")))), t.info("Modifying billing/+page.svelte");
|
|
318
|
+
let f = y.join(e.root, "src", "routes", "(app)", "billing", "+page.svelte");
|
|
319
|
+
return a(h(f, G(f, X("src/routes/(app)/billing/+page.svelte")))), {
|
|
320
|
+
creates: m([{
|
|
321
|
+
path: K,
|
|
309
322
|
language: "ts",
|
|
310
323
|
content: r,
|
|
311
324
|
status: "success"
|
|
@@ -320,6 +333,6 @@ async function J(e) {
|
|
|
320
333
|
};
|
|
321
334
|
}
|
|
322
335
|
//#endregion
|
|
323
|
-
export { J as generate };
|
|
336
|
+
export { J as assertPaymentsAppMode, Z as generate };
|
|
324
337
|
|
|
325
|
-
//# sourceMappingURL=generate.runtime-
|
|
338
|
+
//# sourceMappingURL=generate.runtime-BcgjZJug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-BcgjZJug.js","names":["FAILURE_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","FAILURE_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","stripeCustomerHelper","InvalidArgumentError","stripe_customer_default","_layout_server_default","_layout_default","_page_default","nav_user_default","_page_server_default","app_sidebar_default","dispatch_default","withInMemoryScript","formatLikeSource","ensureImports","keepMissing","modifyOutcomeToFile","SvelteFile","modifyNavUser","fs","path","FAILURE_HINT$2","NOT_FOUND_HINT$5","SUBSCRIPTION_CASES_SNIPPET","modifyWebhookServer","filePath","original","addedCases","sf","switchStmt","SyntaxKind","stmt","clauses","defaultClause","c","prefix","last","source","LOAD_LINE","NOT_FOUND_HINT$4","failureHint","helper","helperFrom","clean","template","start","end","findLoad","varDecl","init","fn","modifyAppLayoutServer","Project","QuoteKind","load","body","block","binding","hasLocals","el","userIndex","s","d","statements","ret","returned","text","writer","FAILURE_HINT$1","NOT_FOUND_HINT$3","modifyAppLayoutSvelte","file","SUBSCRIPTION_TYPE","FAILURE_HINT","NOT_FOUND_HINT$2","updateScript","wasAdded","out","decl","nameNode","pattern","elements","typeNode","intersection","member","lit","propTexts","p","t","elementTexts","insertIdx","modifyAppSidebar","scriptChanged","src","templateChanged","modifyByTemplate","notFoundHint","current","idempotencyMarker","stripped","NOT_FOUND_HINT$1","modifyBillingPageServer","NOT_FOUND_HINT","modifyBillingPageSvelte","STRIPE_CUSTOMER_HELPER","BILLING_PAGE","assertPaymentsAppMode","root","previewRaw","content","relativePath","generate","logger","getLogger","options","modifies","pushResult","webhookServerPath","appLayoutServerPath","appLayoutSveltePath","appSidebarPath","navUserPath","billingPageServerPath","billingPageSveltePath"],"sources":["../../src/patterns/enable/subscriptions/modifies/modify-webhook-server.ts","../../src/patterns/enable/subscriptions/modifies/modify-app-layout-server.ts","../../src/patterns/enable/subscriptions/modifies/modify-app-layout-svelte.ts","../../src/patterns/enable/subscriptions/modifies/modify-app-sidebar.ts","../../src/patterns/enable/subscriptions/modifies/modify-by-template.ts","../../src/patterns/enable/subscriptions/modifies/modify-billing-page-server.ts","../../src/patterns/enable/subscriptions/modifies/modify-billing-page-svelte.ts","../../src/patterns/enable/subscriptions/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureImports,\n withInMemoryScript,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Wire the subscription event handlers into src/routes/webhooks/stripe/handlers/dispatch.ts:\n\n Add imports:\n import { handleSubscriptionCreated } from \"./subscription/created\";\n import { handleSubscriptionUpdated } from \"./subscription/updated\";\n import { handleSubscriptionDeleted } from \"./subscription/deleted\";\n\n Add switch cases inside the event.type switch:\n case \"customer.subscription.created\":\n await handleSubscriptionCreated(event.data.object, locals);\n break;\n case \"customer.subscription.updated\":\n await handleSubscriptionUpdated(event.data.object, locals);\n break;\n case \"customer.subscription.deleted\":\n await handleSubscriptionDeleted(event.data.object, locals);\n break;\n`;\n\nconst NOT_FOUND_HINT =\n \"Enable payments first — src/routes/webhooks/stripe/handlers/dispatch.ts is created by enable-payments.\";\n\nconst SUBSCRIPTION_CASES_SNIPPET = dedent`\n case \"customer.subscription.created\":\n await handleSubscriptionCreated(event.data.object, locals);\n break;\n\n case \"customer.subscription.updated\":\n await handleSubscriptionUpdated(event.data.object, locals);\n break;\n\n case \"customer.subscription.deleted\":\n await handleSubscriptionDeleted(event.data.object, locals);\n break;\n`;\n\nexport function modifyWebhookServer(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(filePath, \"utf8\");\n if (original.includes(\"handleSubscriptionCreated\")) {\n return { status: \"success\", changed: false };\n }\n\n let addedCases = false;\n const { source } = withInMemoryScript(original, (sf) => {\n ensureImports(sf, [\n {\n namedImports: [\"handleSubscriptionCreated\"],\n moduleSpecifier: \"./subscription/created\",\n },\n {\n namedImports: [\"handleSubscriptionUpdated\"],\n moduleSpecifier: \"./subscription/updated\",\n },\n {\n namedImports: [\"handleSubscriptionDeleted\"],\n moduleSpecifier: \"./subscription/deleted\",\n },\n ]);\n\n const switchStmt = sf\n .getDescendantsOfKind(SyntaxKind.SwitchStatement)\n .find((stmt) => stmt.getExpression().getText().includes(\"event.type\"));\n if (!switchStmt) return;\n\n const caseBlock = switchStmt.getCaseBlock();\n const clauses = caseBlock.getClauses();\n const defaultClause = clauses.find(\n (c) => c.getKind() === SyntaxKind.DefaultClause,\n );\n\n // Prepend subscription cases in front of the default clause, or append\n // before the closing brace of the case block if there's no default.\n const prefix = `${SUBSCRIPTION_CASES_SNIPPET}\\n\\n`;\n if (defaultClause) {\n defaultClause.replaceWithText(prefix + defaultClause.getText());\n } else if (clauses.length > 0) {\n const last = clauses[clauses.length - 1];\n last.replaceWithText(\n last.getText() + `\\n\\n${SUBSCRIPTION_CASES_SNIPPET}`,\n );\n } else {\n return;\n }\n\n formatLikeSource(sf);\n addedCases = true;\n });\n\n if (!addedCases) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n fs.writeFileSync(filePath, source, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst LOAD_LINE =\n \"const subscription = await loadActiveSubscription(locals, user.id);\";\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(app)/+layout.server.ts before enabling subscriptions.\",\n \"Enable auth first — the (app) layout is provided by the velastack-auth baseline.\",\n].join(\"\\n\");\n\nconst failureHint = (helper: string) =>\n [\n \"Could not find the user and the returned object in the (app) layout load.\",\n \"Add the active subscription to it by hand:\",\n \"\",\n helper,\n \"\",\n \"// In load, once `user` is set:\",\n LOAD_LINE,\n \"// ...and return it with the rest:\",\n \"return { ..., subscription };\",\n ].join(\"\\n\");\n\n/**\n * The `loadActiveSubscription` helper, taken from the preview template so the\n * docs and what gets written stay the same.\n */\nfunction helperFrom(template: string): string {\n const clean = template.replace(\n /^[ \\t]*\\/\\/[ \\t]*\\[!code highlight:\\d+\\][ \\t]*\\r?\\n/gm,\n \"\",\n );\n const start = clean.indexOf(\"async function loadActiveSubscription\");\n const end = clean.indexOf(\"\\n}\\n\", start);\n if (start === -1 || end === -1) {\n throw new Error(\"No loadActiveSubscription in the layout template\");\n }\n return clean.slice(start, end + 2);\n}\n\nfunction findLoad(sf: SourceFile) {\n const varDecl = sf.getVariableDeclaration(\"load\");\n if (varDecl?.getVariableStatement()?.hasExportKeyword()) {\n const init = varDecl.getInitializer();\n const fn =\n varDecl.getInitializerIfKind(SyntaxKind.ArrowFunction) ??\n init?.getFirstDescendantByKind(SyntaxKind.ArrowFunction) ??\n init?.getFirstDescendantByKind(SyntaxKind.FunctionExpression);\n if (fn) return { fn, statement: varDecl.getVariableStatement()! };\n }\n const fn = sf.getFunction(\"load\");\n return fn?.isExported() ? { fn, statement: fn } : undefined;\n}\n\n/**\n * Adds the active subscription to the (app) layout's data: the\n * `loadActiveSubscription` helper, a call to it in `load`, and `subscription`\n * in what `load` returns. Edits the file rather than replacing it, so what\n * other patterns put in the load (teams' `team`/`teams`, say) stays.\n */\nexport function modifyAppLayoutServer(\n filePath: string,\n template: string,\n): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n if (original.includes(\"loadActiveSubscription\")) {\n return { status: \"success\", changed: false };\n }\n\n const helper = helperFrom(template);\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sf = project.addSourceFileAtPath(filePath);\n const load = findLoad(sf);\n const body = load?.fn.getBody();\n if (!load || !body || body.getKind() !== SyntaxKind.Block) {\n return { status: \"failed\", message: failureHint(helper) };\n }\n const block = body.asKindOrThrow(SyntaxKind.Block);\n\n // The call needs `locals` and `user`, and goes before the return.\n const params = load.fn.getParameters();\n const binding = params[0]?.getNameNode();\n const hasLocals =\n binding?.getKind() === SyntaxKind.ObjectBindingPattern &&\n binding\n .asKindOrThrow(SyntaxKind.ObjectBindingPattern)\n .getElements()\n .some((el) => el.getName() === \"locals\");\n const userIndex = block.getStatements().findIndex(\n (s) =>\n s.getKind() === SyntaxKind.VariableStatement &&\n s\n .asKindOrThrow(SyntaxKind.VariableStatement)\n .getDeclarations()\n .some((d) => d.getName() === \"user\"),\n );\n const statements = block.getStatements();\n const ret = [...statements]\n .reverse()\n .find((s) => s.getKind() === SyntaxKind.ReturnStatement)\n ?.asKind(SyntaxKind.ReturnStatement);\n const returned = ret\n ?.getExpression()\n ?.asKind(SyntaxKind.ObjectLiteralExpression);\n if (!hasLocals || userIndex === -1 || !ret || !returned) {\n return { status: \"failed\", message: failureHint(helper) };\n }\n\n block.insertStatements(statements.indexOf(ret), LOAD_LINE);\n if (!returned.getProperty(\"subscription\")) {\n const text = returned.getText();\n if (text.includes(\"\\n\")) {\n returned.addShorthandPropertyAssignment({ name: \"subscription\" });\n } else {\n // Kept on one line, as written.\n returned.replaceWithText(text.replace(/\\s*\\}$/, \", subscription }\"));\n }\n }\n if (!load.fn.isAsync()) load.fn.setIsAsync(true);\n sf.insertStatements(sf.getStatements().indexOf(load.statement), (writer) =>\n writer.write(helper).blankLine(),\n );\n\n formatLikeSource(sf);\n sf.saveSync();\n return { status: \"success\", changed: sf.getFullText() !== original };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst FAILURE_HINT = [\n \"Pass the subscription prop to <AppSidebar> in src/routes/(app)/+layout.svelte:\",\n \"\",\n \"<AppSidebar user={data.user} subscription={data.subscription} />\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(app)/+layout.svelte with an <AppSidebar /> that receives the subscription prop.\",\n].join(\"\\n\");\n\nexport function modifyAppLayoutSvelte(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(filePath);\n if (!file.hasElement(\"AppSidebar\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (file.hasAttribute(\"AppSidebar\", \"subscription\")) {\n return { status: \"success\", changed: false };\n }\n\n const appended = file.appendToAttributes(\n \"AppSidebar\",\n \" subscription={data.subscription}\",\n );\n if (!appended) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.writeTo(filePath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n withInMemoryScript,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst SUBSCRIPTION_TYPE = \"{ id: string; productName: string | null } | null\";\n\nconst FAILURE_HINT = [\n \"Update src/lib/components/app-sidebar.svelte to forward a subscription prop:\",\n \"\",\n \"1. Add `subscription = null` to the destructured $props() call.\",\n `2. Add \\`subscription?: ${SUBSCRIPTION_TYPE}\\` to the props type.`,\n \"3. Pass `{subscription}` to <NavUser>.\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/lib/components/app-sidebar.svelte before enabling subscriptions.\",\n].join(\"\\n\");\n\nfunction updateScript(source: string): {\n source: string;\n wasAdded: boolean;\n} {\n let wasAdded = false;\n const { source: out } = withInMemoryScript(source, (sf) => {\n for (const decl of sf.getVariableDeclarations()) {\n const init = decl.getInitializer();\n if (!init || init.getText() !== \"$props()\") continue;\n\n const nameNode = decl.getNameNode();\n if (nameNode.getKind() !== SyntaxKind.ObjectBindingPattern) continue;\n const pattern = nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern);\n const elements = pattern.getElements();\n if (elements.some((e) => e.getName() === \"subscription\")) {\n // Already has subscription prop — no-op.\n return;\n }\n\n // Insert subscription?: ... into the props type literal if present.\n const typeNode = decl.getTypeNode();\n if (typeNode?.getKind() === SyntaxKind.IntersectionType) {\n const intersection = typeNode.asKindOrThrow(\n SyntaxKind.IntersectionType,\n );\n for (const member of intersection.getTypeNodes()) {\n if (member.getKind() !== SyntaxKind.TypeLiteral) continue;\n const lit = member.asKindOrThrow(SyntaxKind.TypeLiteral);\n const propTexts = lit\n .getProperties()\n .map((p) => p.getText().replace(/[;,]\\s*$/, \"\"));\n if (propTexts.some((t) => /^\\s*subscription\\??\\s*:/.test(t))) {\n continue;\n }\n propTexts.push(`subscription?: ${SUBSCRIPTION_TYPE}`);\n lit.replaceWithText(`{ ${propTexts.join(\"; \")}; }`);\n break;\n }\n }\n\n // Insert `subscription = null` before the first rest/default-only element.\n const elementTexts = elements.map((e) => e.getText());\n let insertIdx = elements.findIndex(\n (e) => e.getDotDotDotToken() || e.getInitializer(),\n );\n if (insertIdx === -1) insertIdx = elementTexts.length;\n elementTexts.splice(insertIdx, 0, \"subscription = null\");\n pattern.replaceWithText(`{ ${elementTexts.join(\", \")} }`);\n wasAdded = true;\n }\n formatLikeSource(sf);\n });\n return { source: out, wasAdded };\n}\n\nexport function modifyAppSidebar(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(filePath, \"utf8\");\n if (\n original.includes(\"subscription?: {\") ||\n original.includes(\"subscription={subscription}\") ||\n original.includes(\"{subscription}\")\n ) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(original);\n if (!file.hasElement(\"NavUser\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const scriptChanged = file.modifyScript((src) => updateScript(src).source);\n\n const templateChanged = !file.hasAttribute(\"NavUser\", \"subscription\")\n ? file.appendToAttributes(\"NavUser\", \" {subscription}\")\n : false;\n\n if (!scriptChanged && !templateChanged) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.writeTo(filePath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * Overwrites a file with the given template content, guarded by an idempotency\n * marker: if the current file already contains the marker, the modify is a\n * no-op. Used for complex rewrites where surgical AST changes aren't worth it\n * (e.g. pages that are largely replaced).\n *\n * Strips leading `// [!code highlight:N]` and `<!-- [!code highlight:N] -->`\n * lines so the same content can be shared with preview-modifies, which uses\n * those comments for documentation highlighting.\n */\nexport function modifyByTemplate(\n filePath: string,\n template: string,\n idempotencyMarker: string,\n notFoundHint: string,\n): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: notFoundHint };\n }\n const current = fs.readFileSync(filePath, \"utf8\");\n if (current.includes(idempotencyMarker)) {\n return { status: \"success\", changed: false };\n }\n const stripped = template\n .replace(/^[ \\t]*\\/\\/[ \\t]*\\[!code highlight:\\d+\\][ \\t]*\\r?\\n/gm, \"\")\n .replace(\n /^[ \\t]*<!--[ \\t]*\\[!code highlight:\\d+\\][ \\t]*-->[ \\t]*\\r?\\n/gm,\n \"\",\n );\n if (current === stripped) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(filePath, stripped, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import { modifyByTemplate } from \"./modify-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst NOT_FOUND_HINT = [\n \"src/routes/(app)/billing/+page.server.ts is missing.\",\n \"Enable payments first — subscriptions extends the billing page with plan management.\",\n].join(\"\\n\");\n\nexport function modifyBillingPageServer(\n filePath: string,\n template: string,\n): ModifyOutcome {\n return modifyByTemplate(filePath, template, \"selectPlan\", NOT_FOUND_HINT);\n}\n","import { modifyByTemplate } from \"./modify-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst NOT_FOUND_HINT = [\n \"src/routes/(app)/billing/+page.svelte is missing.\",\n \"Enable payments first — subscriptions extends the billing page with plan management.\",\n].join(\"\\n\");\n\nexport function modifyBillingPageSvelte(\n filePath: string,\n template: string,\n): ModifyOutcome {\n return modifyByTemplate(filePath, template, \"availablePlans\", NOT_FOUND_HINT);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { keepMissing, modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyWebhookServer } from \"./modifies/modify-webhook-server\";\nimport { modifyAppLayoutServer } from \"./modifies/modify-app-layout-server\";\nimport { modifyAppLayoutSvelte } from \"./modifies/modify-app-layout-svelte\";\nimport { modifyAppSidebar } from \"./modifies/modify-app-sidebar\";\nimport { modifyNavUser } from \"./modifies/modify-nav-user\";\nimport { modifyBillingPageServer } from \"./modifies/modify-billing-page-server\";\nimport { modifyBillingPageSvelte } from \"./modifies/modify-billing-page-svelte\";\nimport stripeCustomerHelper from \"../payments/providers-app-mode/stripe/src/lib/server/stripe-customer.ts?raw\";\n\n// The billing page imports this payments helper, which apps that enabled\n// payments before it existed do not have yet.\nconst STRIPE_CUSTOMER_HELPER = \"src/lib/server/stripe-customer.ts\";\n\n// enable-payments writes the billing page (and the stripe_customers collection\n// subscriptions relate to) only when auth is already on.\nconst BILLING_PAGE = \"src/routes/(app)/billing/+page.server.ts\";\n\n/**\n * Refuses a project whose payments were enabled before auth. Every `requires`\n * flag passes there (auth and payments are both on), yet the billing page and\n * `stripe_customers` don't exist, so this runs before any collection is made.\n */\nexport function assertPaymentsAppMode(root: string): void {\n if (fs.existsSync(path.join(root, BILLING_PAGE))) return;\n throw new InvalidArgumentError(\n [\n \"Subscriptions need payments set up with auth on: they add plans to the billing page\",\n `(${BILLING_PAGE}) and link to the stripe_customers collection, which enable-payments`,\n \"creates only when auth is already enabled. This project enabled payments before auth.\",\n \"\",\n \"Re-enable payments now that auth is on: `vela disable payments`, then `vela enable payments`.\",\n \"disable-payments drops the catalog collections, which the sync workflow refills from Stripe.\",\n ].join(\"\\n\"),\n );\n}\n\n// Share the final-state files between preview (rendered as-is) and runtime\n// (used as overwrite templates for modifies that amount to full rewrites).\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nfunction template(relativePath: string): string {\n const key = `./preview-modifies/${relativePath}`;\n const content = previewRaw[key];\n if (content === undefined) {\n throw new Error(\n `Missing template for ${relativePath} in subscriptions preview-modifies`,\n );\n }\n return content;\n}\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(\"Modifying webhooks/stripe/handlers/dispatch.ts\");\n const webhookServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"webhooks\",\n \"stripe\",\n \"handlers\",\n \"dispatch.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n webhookServerPath,\n modifyWebhookServer(webhookServerPath),\n ),\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 modifyAppLayoutServer(\n appLayoutServerPath,\n template(\"src/routes/(app)/+layout.server.ts\"),\n ),\n ),\n );\n\n logger.info(\"Modifying (app)/+layout.svelte\");\n const appLayoutSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutSveltePath,\n modifyAppLayoutSvelte(appLayoutSveltePath),\n ),\n );\n\n logger.info(\"Modifying app-sidebar.svelte\");\n const appSidebarPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"app-sidebar.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appSidebarPath, modifyAppSidebar(appSidebarPath)),\n );\n\n logger.info(\"Modifying nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, modifyNavUser(navUserPath)));\n\n logger.info(\"Modifying billing/+page.server.ts\");\n const billingPageServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"billing\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n billingPageServerPath,\n modifyBillingPageServer(\n billingPageServerPath,\n template(\"src/routes/(app)/billing/+page.server.ts\"),\n ),\n ),\n );\n\n logger.info(\"Modifying billing/+page.svelte\");\n const billingPageSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"billing\",\n \"+page.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n billingPageSveltePath,\n modifyBillingPageSvelte(\n billingPageSveltePath,\n template(\"src/routes/(app)/billing/+page.svelte\"),\n ),\n ),\n );\n\n const creates = keepMissing(\n [\n {\n path: STRIPE_CUSTOMER_HELPER,\n language: \"ts\",\n content: stripeCustomerHelper,\n status: \"success\",\n },\n ],\n options.root,\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":";;;;;;;;;;;;;AAUA,IAAMA,IAAe,CAAM;;;;;;;;;;;;;;;;;;GAoBrBC,IACJ,0GAEIkC,IAA6B,CAAM;;;;;;;;;;;;;AAczC,SAAgBC,EAAoB,GAAiC;CACnE,IAAI,CAACL,EAAG,WAAWM,CAAQ,GACzB,OAAO;EAAE,QAAQ;EAAa,SAASpC;CAAe;CAGxD,IAAMqC,IAAWP,EAAG,aAAaM,GAAU,MAAM;CACjD,IAAIC,EAAS,SAAS,2BAA2B,GAC/C,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAIC,IAAa,IACX,EAAE,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,IAAMQ,IAAiBpG,EAAK,KAC1B8F,EAAQ,MACR,OACA,OACA,cACA,oBACF;CAKA,AAJAE,EACEpG,EAAoBwG,GAAgB7B,EAAiB6B,CAAc,CAAC,CACtE,GAEAR,EAAO,KAAK,2BAA2B;CACvC,IAAMS,IAAcrG,EAAK,KACvB8F,EAAQ,MACR,OACA,OACA,cACA,iBACF;CAGA,AAFAE,EAAWpG,EAAoByG,GAAavG,EAAcuG,CAAW,CAAC,CAAC,GAEvET,EAAO,KAAK,mCAAmC;CAC/C,IAAMU,IAAwBtG,EAAK,KACjC8F,EAAQ,MACR,OACA,UACA,SACA,WACA,iBACF;CAWA,AAVAE,EACEpG,EACE0G,GACArB,EACEqB,GACA9E,EAAS,0CAA0C,CACrD,CACF,CACF,GAEAoE,EAAO,KAAK,gCAAgC;CAC5C,IAAMW,IAAwBvG,EAAK,KACjC8F,EAAQ,MACR,OACA,UACA,SACA,WACA,cACF;CAuBA,OAtBAE,EACEpG,EACE2G,GACApB,EACEoB,GACA/E,EAAS,uCAAuC,CAClD,CACF,CACF,GAcO;EACL,SAbc7B,EACd,CACE;GACE,MAAMyF;GACN,UAAU;GACV,SAAStG;GACT,QAAQ;EACV,CACF,GACAgH,EAAQ,IAIR;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { t as e } from "./dedent-Gq6Krl4n.js";
|
|
2
|
+
import { n as t } from "./logger-CQONztPm.js";
|
|
3
|
+
import { _ as n, r } from "./ts-morph-helpers-Bepc-Es2.js";
|
|
4
|
+
import { r as i } from "./modify-file-Bbhyfiy_.js";
|
|
5
|
+
import { t as a } from "./svelte-file-Dv5-bl79.js";
|
|
6
|
+
import o from "node:fs";
|
|
7
|
+
import s from "node:path";
|
|
8
|
+
//#region src/patterns/enable/ecommerce/modifies/root-layout.svelte.ts
|
|
9
|
+
var c = "#lib/components/cart/cart-button.svelte", l = "<Navbar.Item>\n <CartButton />\n</Navbar.Item>", u = `import CartButton from '${c}';`, d = e`
|
|
10
|
+
Add the cart button inside your <Navbar.List> in the root layout.
|
|
11
|
+
|
|
12
|
+
Import to add to the <script> tag:
|
|
13
|
+
|
|
14
|
+
${u}
|
|
15
|
+
|
|
16
|
+
Markup to add inside <Navbar.List>:
|
|
17
|
+
|
|
18
|
+
${l}
|
|
19
|
+
`, f = e`
|
|
20
|
+
Add the cart button to the layout your public pages share.
|
|
21
|
+
|
|
22
|
+
Import for the <script> tag:
|
|
23
|
+
|
|
24
|
+
${u}
|
|
25
|
+
|
|
26
|
+
Markup, wherever your navigation is:
|
|
27
|
+
|
|
28
|
+
<CartButton />
|
|
29
|
+
`;
|
|
30
|
+
function p(e) {
|
|
31
|
+
if (!o.existsSync(e)) return {
|
|
32
|
+
status: "not-found",
|
|
33
|
+
message: f
|
|
34
|
+
};
|
|
35
|
+
let t = a.fromPath(e);
|
|
36
|
+
if (!t.hasElement("Navbar.List")) return {
|
|
37
|
+
status: "failed",
|
|
38
|
+
message: d
|
|
39
|
+
};
|
|
40
|
+
if (t.hasElement("CartButton")) return {
|
|
41
|
+
status: "success",
|
|
42
|
+
changed: !1
|
|
43
|
+
};
|
|
44
|
+
t.modifyScript((e) => {
|
|
45
|
+
let { source: t } = n(e, (e) => {
|
|
46
|
+
r(e, [{
|
|
47
|
+
defaultImport: "CartButton",
|
|
48
|
+
moduleSpecifier: c
|
|
49
|
+
}]);
|
|
50
|
+
});
|
|
51
|
+
return t;
|
|
52
|
+
});
|
|
53
|
+
let i = t.findElementContaining("Navbar.Item", "AuthMenu.Root"), s = t.childElements("Navbar.List", "Navbar.Item"), u = s[s.length - 1];
|
|
54
|
+
return i ? t.insertBeforeElement(i, l) : u ? t.insertAfterElement(u, l) : t.insertBeforeClosingTag("Navbar.List", `\n\t\t${l.replace(/\n/g, "\n ")}\n\t`), t.writeTo(e), {
|
|
55
|
+
status: "success",
|
|
56
|
+
changed: t.hasChanged()
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/patterns/enable/ecommerce/generate.runtime.ts
|
|
61
|
+
function m(e) {
|
|
62
|
+
return o.existsSync(s.join(e, "src", "lib", "server", "stripe-customer.ts"));
|
|
63
|
+
}
|
|
64
|
+
async function h(e) {
|
|
65
|
+
let n = t(e), r = [];
|
|
66
|
+
n.info("Adding the cart to the navbar");
|
|
67
|
+
let a = s.join(e.root, "src", "routes", "(public)", "root-layout.svelte"), o = i(a, p(a));
|
|
68
|
+
return o && r.push(o), {
|
|
69
|
+
creates: [],
|
|
70
|
+
modifies: r,
|
|
71
|
+
deletes: [],
|
|
72
|
+
components: [],
|
|
73
|
+
packages: [],
|
|
74
|
+
collections: [],
|
|
75
|
+
collectionPatches: [],
|
|
76
|
+
collectionDrops: []
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { h as generate, m as hasStripeCustomer };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=generate.runtime-BdHv7Jp1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-BdHv7Jp1.js","names":["dedent","getLogger","withInMemoryScript","modifyOutcomeToFile","SvelteFile","fs","path","CART_BUTTON_MODULE","CART_NAVBAR_ITEM","IMPORT_SNIPPET","FAILURE_HINT","NOT_FOUND_HINT","modifyRootLayoutSvelte","layoutPath","file","out","source","sf","authItem","items","lastItem","hasStripeCustomer","root","generate","logger","options","modifies"],"sources":["../../src/patterns/enable/ecommerce/modifies/root-layout.svelte.ts","../../src/patterns/enable/ecommerce/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\nexport const CART_BUTTON_MODULE = \"#lib/components/cart/cart-button.svelte\";\n\nconst CART_NAVBAR_ITEM = \"<Navbar.Item>\\n\\t<CartButton />\\n</Navbar.Item>\";\n\nconst IMPORT_SNIPPET = `import CartButton from '${CART_BUTTON_MODULE}';`;\n\nconst FAILURE_HINT = dedent`\n Add the cart button inside your <Navbar.List> in the root layout.\n\n Import to add to the <script> tag:\n\n ${IMPORT_SNIPPET}\n\n Markup to add inside <Navbar.List>:\n\n ${CART_NAVBAR_ITEM}\n`;\n\nconst NOT_FOUND_HINT = dedent`\n Add the cart button to the layout your public pages share.\n\n Import for the <script> tag:\n\n ${IMPORT_SNIPPET}\n\n Markup, wherever your navigation is:\n\n <CartButton />\n`;\n\n/**\n * Puts the cart button in the navbar: left of the account menu when auth\n * added one, else after the last item.\n */\nexport function modifyRootLayoutSvelte(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(\"Navbar.List\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (file.hasElement(\"CartButton\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n { defaultImport: \"CartButton\", moduleSpecifier: CART_BUTTON_MODULE },\n ]);\n });\n return out;\n });\n\n const authItem = file.findElementContaining(\"Navbar.Item\", \"AuthMenu.Root\");\n const items = file.childElements(\"Navbar.List\", \"Navbar.Item\");\n const lastItem = items[items.length - 1];\n if (authItem) {\n file.insertBeforeElement(authItem, CART_NAVBAR_ITEM);\n } else if (lastItem) {\n file.insertAfterElement(lastItem, CART_NAVBAR_ITEM);\n } else {\n file.insertBeforeClosingTag(\n \"Navbar.List\",\n `\\n\\t\\t${CART_NAVBAR_ITEM.replace(/\\n/g, \"\\n\\t\\t\")}\\n\\t`,\n );\n }\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\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 { modifyRootLayoutSvelte } from \"./modifies/root-layout.svelte\";\n\n/** Created by enable-payments for Stripe when auth was already on. */\nexport function hasStripeCustomer(root: string): boolean {\n return fs.existsSync(\n path.join(root, \"src\", \"lib\", \"server\", \"stripe-customer.ts\"),\n );\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Adding the cart to the navbar\");\n const layoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n const file = modifyOutcomeToFile(\n layoutPath,\n modifyRootLayoutSvelte(layoutPath),\n );\n if (file) modifies.push(file);\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,IAAaO,IAAqB,2CAE5BC,IAAmB,kDAEnBC,IAAiB,2BAA2BF,EAAmB,KAE/DG,IAAe,CAAM;;;;;IAKvBD,EAAe;;;;IAIfD,EAAiB;GAGfG,IAAiB,CAAM;;;;;IAKzBF,EAAe;;;;;;AAWnB,SAAgBG,EAAuB,GAAmC;CACxE,IAAI,CAACP,EAAG,WAAWQ,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAa,SAASF;CAAe;CAGxD,IAAMG,IAAOV,EAAW,SAASS,CAAU;CAC3C,IAAI,CAACC,EAAK,WAAW,aAAa,GAChC,OAAO;EAAE,QAAQ;EAAU,SAASJ;CAAa;CAEnD,IAAII,EAAK,WAAW,YAAY,GAC9B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,EAAK,cAAc,MAAW;EAC5B,IAAM,EAAE,QAAQC,MAAQb,EAAmBc,IAAS,MAAO;GACzD,EAAcC,GAAI,CAChB;IAAE,eAAe;IAAc,iBAAiBV;GAAmB,CACrE,CAAC;EACH,CAAC;EACD,OAAOQ;CACT,CAAC;CAED,IAAMG,IAAWJ,EAAK,sBAAsB,eAAe,eAAe,GACpEK,IAAQL,EAAK,cAAc,eAAe,aAAa,GACvDM,IAAWD,EAAMA,EAAM,SAAS;CAatC,OAZID,IACFJ,EAAK,oBAAoBI,GAAUV,CAAgB,IAC1CY,IACTN,EAAK,mBAAmBM,GAAUZ,CAAgB,IAElDM,EAAK,uBACH,eACA,SAASN,EAAiB,QAAQ,OAAO,MAAQ,EAAE,KACrD,GAGFM,EAAK,QAAQD,CAAU,GAChB;EAAE,QAAQ;EAAW,SAASC,EAAK,WAAW;CAAE;AACzD;;;ACzEA,SAAgBO,EAAkB,GAAuB;CACvD,OAAOhB,EAAG,WACRC,EAAK,KAAKgB,GAAM,OAAO,OAAO,UAAU,oBAAoB,CAC9D;AACF;AAEA,eAAsBC,EAAS,GAAkB;CAC/C,IAAMC,IAASvB,EAAUwB,CAAO,GAC1BC,IAAmB,CAAC;CAE1B,EAAO,KAAK,+BAA+B;CAC3C,IAAMb,IAAaP,EAAK,KACtBmB,EAAQ,MACR,OACA,UACA,YACA,oBACF,GACMX,IAAOX,EACXU,GACAD,EAAuBC,CAAU,CACnC;CAGA,OAFIC,KAAMY,EAAS,KAAKZ,CAAI,GAErB;EACL,SAAS,CAAC;EACV;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 { r as e } from "./lib-specifier-Cngo1zF_.js";
|
|
2
2
|
import { n as t } from "./logger-CQONztPm.js";
|
|
3
|
-
import { t as n } from "./shared-
|
|
3
|
+
import { t as n } from "./shared-D5GOS97l.js";
|
|
4
4
|
import { _ as r, n as i, u as a } from "./ts-morph-helpers-Bepc-Es2.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as s } from "./svelte-file-
|
|
5
|
+
import { r as o } from "./modify-file-Bbhyfiy_.js";
|
|
6
|
+
import { t as s } from "./svelte-file-Dv5-bl79.js";
|
|
7
7
|
import { t as c } from "./unmodify-load-Bl5vXQiL.js";
|
|
8
8
|
import l from "node:fs";
|
|
9
9
|
import u from "node:path";
|
|
@@ -64,4 +64,4 @@ async function p(e) {
|
|
|
64
64
|
//#endregion
|
|
65
65
|
export { p as generate };
|
|
66
66
|
|
|
67
|
-
//# sourceMappingURL=generate.runtime-
|
|
67
|
+
//# sourceMappingURL=generate.runtime-BdmoAVJK.js.map
|