@velastack/patterns 0.0.57 → 0.0.59
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 +0 -12
- package/dist/chunks/{_server-Cv3bTkG0.js → _server-Cie287JZ.js} +1 -1
- package/dist/chunks/_server-Cie287JZ.js.map +1 -0
- package/dist/chunks/{collections-BwO27pJg.js → collections-DZOoJLVj.js} +5 -5
- package/dist/chunks/{collections-BwO27pJg.js.map → collections-DZOoJLVj.js.map} +1 -1
- package/dist/chunks/config-target-Co-ij8p3.js +163 -0
- package/dist/chunks/config-target-Co-ij8p3.js.map +1 -0
- package/dist/chunks/{constants-BMZmCRiI.js → constants-qmioN-7W.js} +1 -1
- package/dist/chunks/{constants-BMZmCRiI.js.map → constants-qmioN-7W.js.map} +1 -1
- package/dist/chunks/{dedent-C4qKBQXh.js → dedent-Gq6Krl4n.js} +1 -1
- package/dist/chunks/{dedent-C4qKBQXh.js.map → dedent-Gq6Krl4n.js.map} +1 -1
- package/dist/chunks/{env-Bk-LRVos.js → env-BPfk1VAw.js} +1 -1
- package/dist/chunks/{env-Bk-LRVos.js.map → env-BPfk1VAw.js.map} +1 -1
- package/dist/chunks/{env.preview-DoY1CJwL.js → env.preview-uMRKT5Pc.js} +1 -1
- package/dist/chunks/{env.preview-DoY1CJwL.js.map → env.preview-uMRKT5Pc.js.map} +1 -1
- package/dist/chunks/{env.runtime-D46GCIKe.js → env.runtime-BVage9Kk.js} +1 -1
- package/dist/chunks/{env.runtime-D46GCIKe.js.map → env.runtime-BVage9Kk.js.map} +1 -1
- package/dist/chunks/{errors-Co77I4oK.js → errors-D3Zy3wCg.js} +1 -1
- package/dist/chunks/{errors-Co77I4oK.js.map → errors-D3Zy3wCg.js.map} +1 -1
- package/dist/chunks/{generate2.runtime-yP14iPwX.js → generate.runtime-6TJoTPg9.js} +21 -15
- package/dist/chunks/generate.runtime-6TJoTPg9.js.map +1 -0
- package/dist/chunks/{generate.runtime-BnkNmF1g.js → generate.runtime-6qpoLA04.js} +10 -8
- package/dist/chunks/{generate.runtime-BnkNmF1g.js.map → generate.runtime-6qpoLA04.js.map} +1 -1
- package/dist/chunks/generate.runtime-AmiNbSR3.js +172 -0
- package/dist/chunks/generate.runtime-AmiNbSR3.js.map +1 -0
- package/dist/chunks/{generate.runtime-DjwRKg8K.js → generate.runtime-BT_bwAtt.js} +124 -198
- package/dist/chunks/generate.runtime-BT_bwAtt.js.map +1 -0
- package/dist/chunks/{generate.runtime-Cb2vYF1l.js → generate.runtime-BnnsaLsg.js} +5 -5
- package/dist/chunks/{generate.runtime-Cb2vYF1l.js.map → generate.runtime-BnnsaLsg.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D6oE0Mmf.js → generate.runtime-CGtKTfYU.js} +6 -6
- package/dist/chunks/{generate.runtime-D6oE0Mmf.js.map → generate.runtime-CGtKTfYU.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BkvtIjgh.js → generate.runtime-CINxHRnJ.js} +5 -5
- package/dist/chunks/{generate.runtime-BkvtIjgh.js.map → generate.runtime-CINxHRnJ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DnymXcvu.js → generate.runtime-CNxgU9v1.js} +6 -6
- package/dist/chunks/{generate.runtime-DnymXcvu.js.map → generate.runtime-CNxgU9v1.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bpx69a8t.js → generate.runtime-CRS9C9xX.js} +18 -16
- package/dist/chunks/{generate.runtime-Bpx69a8t.js.map → generate.runtime-CRS9C9xX.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bbf2YWaA.js → generate.runtime-CYmjlSQp.js} +3 -3
- package/dist/chunks/{generate.runtime-Bbf2YWaA.js.map → generate.runtime-CYmjlSQp.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D1uQBjeg.js → generate.runtime-CtS6qa_1.js} +76 -76
- package/dist/chunks/{generate.runtime-D1uQBjeg.js.map → generate.runtime-CtS6qa_1.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Cudp67b-.js → generate.runtime-CtzHFod-.js} +8 -8
- package/dist/chunks/{generate.runtime-Cudp67b-.js.map → generate.runtime-CtzHFod-.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D1wqmaXU.js → generate.runtime-D9t6eaQd.js} +5 -5
- package/dist/chunks/{generate.runtime-D1wqmaXU.js.map → generate.runtime-D9t6eaQd.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D8RXOVVA.js → generate.runtime-DBG6kEKb.js} +6 -6
- package/dist/chunks/{generate.runtime-D8RXOVVA.js.map → generate.runtime-DBG6kEKb.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DFG2C9gc.js → generate.runtime-DfqzMG8Z.js} +6 -6
- package/dist/chunks/generate.runtime-DfqzMG8Z.js.map +1 -0
- package/dist/chunks/{generate.runtime-CUgleG0U.js → generate.runtime-Di0p-J8l.js} +4 -4
- package/dist/chunks/{generate.runtime-CUgleG0U.js.map → generate.runtime-Di0p-J8l.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CrAHzaEW.js → generate.runtime-DsLlDfIo.js} +8 -8
- package/dist/chunks/{generate.runtime-CrAHzaEW.js.map → generate.runtime-DsLlDfIo.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DFDFxHih.js → generate.runtime-EokncTLy.js} +6 -6
- package/dist/chunks/{generate.runtime-DFDFxHih.js.map → generate.runtime-EokncTLy.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D_JOcL6A.js → generate.runtime-P8IVwJLB.js} +23 -17
- package/dist/chunks/{generate.runtime-D_JOcL6A.js.map → generate.runtime-P8IVwJLB.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CZALdXt6.js → generate.runtime-a5PXS1Kd.js} +3 -3
- package/dist/chunks/{generate.runtime-CZALdXt6.js.map → generate.runtime-a5PXS1Kd.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DPzrDUU7.js → generate.runtime-qZhYdFI1.js} +9 -9
- package/dist/chunks/{generate.runtime-DPzrDUU7.js.map → generate.runtime-qZhYdFI1.js.map} +1 -1
- package/dist/chunks/{logger-BpgCb-ZG.js → logger-CQONztPm.js} +1 -1
- package/dist/chunks/{logger-BpgCb-ZG.js.map → logger-CQONztPm.js.map} +1 -1
- package/dist/chunks/{modify-file-DE7tPADZ.js → modify-file-PVKmDJHk.js} +2 -2
- package/dist/chunks/{modify-file-DE7tPADZ.js.map → modify-file-PVKmDJHk.js.map} +1 -1
- package/dist/chunks/modify-svelte-config-remote-CDKs_Qi0.js +44 -0
- package/dist/chunks/modify-svelte-config-remote-CDKs_Qi0.js.map +1 -0
- package/dist/chunks/{modify-utils-CZ9Auvp9.js → modify-utils-Cw-on_cL.js} +13 -13
- package/dist/chunks/{modify-utils-CZ9Auvp9.js.map → modify-utils-Cw-on_cL.js.map} +1 -1
- package/dist/chunks/{nav-user-_VheJA6n.js → nav-user-CndUO69x.js} +1 -1
- package/dist/chunks/nav-user-CndUO69x.js.map +1 -0
- package/dist/chunks/{pocketbase-D7GjPuNu.js → pocketbase-BbFvZ4HI.js} +2 -2
- package/dist/chunks/{pocketbase-D7GjPuNu.js.map → pocketbase-BbFvZ4HI.js.map} +1 -1
- package/dist/chunks/{pocketbase-Bj-cW2Zl.js → pocketbase-C5GS-Dh5.js} +1 -1
- package/dist/chunks/{pocketbase-Bj-cW2Zl.js.map → pocketbase-C5GS-Dh5.js.map} +1 -1
- package/dist/chunks/{pocketbase-Dm2SF3vM.js → pocketbase-DpudAAmd.js} +1 -1
- package/dist/chunks/{pocketbase-Dm2SF3vM.js.map → pocketbase-DpudAAmd.js.map} +1 -1
- package/dist/chunks/{shared-C4wJ9sb0.js → shared-C4-NNykV.js} +3 -3
- package/dist/chunks/{shared-C4wJ9sb0.js.map → shared-C4-NNykV.js.map} +1 -1
- package/dist/chunks/{taggedTemplateLiteral-Bfbldyfk.js → taggedTemplateLiteral-CPUMuLtk.js} +1 -1
- package/dist/chunks/{test-setup-C3gvjtTY.js → test-setup-CcD8wSRD.js} +87 -65
- package/dist/chunks/test-setup-CcD8wSRD.js.map +1 -0
- package/dist/chunks/{ts-morph-helpers-bR0-x04t.js → ts-morph-helpers-Bk82Z2n7.js} +3 -3
- package/dist/chunks/{ts-morph-helpers-bR0-x04t.js.map → ts-morph-helpers-Bk82Z2n7.js.map} +1 -1
- package/dist/chunks/{util-BNtpm1tP.js → util-Bk7aQQJR.js} +1 -1
- package/dist/chunks/{util-BNtpm1tP.js.map → util-Bk7aQQJR.js.map} +1 -1
- package/dist/chunks/{write-result-CLSL_F-E.js → write-result-DtTqt0Cs.js} +6 -6
- package/dist/chunks/write-result-DtTqt0Cs.js.map +1 -0
- package/dist/index.js +406 -360
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/chunks/_server-Cv3bTkG0.js.map +0 -1
- package/dist/chunks/generate.runtime-DFG2C9gc.js.map +0 -1
- package/dist/chunks/generate.runtime-DjwRKg8K.js.map +0 -1
- package/dist/chunks/generate.runtime-M6LNL7Tq.js +0 -197
- package/dist/chunks/generate.runtime-M6LNL7Tq.js.map +0 -1
- package/dist/chunks/generate2.runtime-yP14iPwX.js.map +0 -1
- package/dist/chunks/modify-svelte-config-remote-C3g7Oi6_.js +0 -128
- package/dist/chunks/modify-svelte-config-remote-C3g7Oi6_.js.map +0 -1
- package/dist/chunks/nav-user-_VheJA6n.js.map +0 -1
- package/dist/chunks/test-setup-C3gvjtTY.js.map +0 -1
- package/dist/chunks/write-result-CLSL_F-E.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { t as e } from "./dedent-
|
|
2
|
-
import { n as t } from "./logger-
|
|
3
|
-
import { modifyOutcomeToFile as n } from "./modify-file-
|
|
4
|
-
import { a as r, n as i, o as a } from "./ts-morph-helpers-
|
|
5
|
-
import o from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { t as e } from "./dedent-Gq6Krl4n.js";
|
|
2
|
+
import { n as t } from "./logger-CQONztPm.js";
|
|
3
|
+
import { modifyOutcomeToFile as n } from "./modify-file-PVKmDJHk.js";
|
|
4
|
+
import { a as r, n as i, o as a } from "./ts-morph-helpers-Bk82Z2n7.js";
|
|
5
|
+
import { a as o, i as s, r as c, t as l } from "./config-target-Co-ij8p3.js";
|
|
6
|
+
import u from "node:fs";
|
|
7
|
+
import d from "node:path";
|
|
8
|
+
import { Project as f, QuoteKind as p, SyntaxKind as m } from "ts-morph";
|
|
8
9
|
//#region src/patterns/enable/i18n/modifies/vite-config.ts
|
|
9
|
-
var
|
|
10
|
+
var h = [
|
|
10
11
|
"Add the wuchale plugin to your Vite config:",
|
|
11
12
|
"",
|
|
12
13
|
"import { wuchale } from 'wuchale/vite';",
|
|
@@ -14,7 +15,7 @@ var d = [
|
|
|
14
15
|
"export default defineConfig({",
|
|
15
16
|
" plugins: [wuchale(), /* ...existing plugins */],",
|
|
16
17
|
"});"
|
|
17
|
-
].join("\n"),
|
|
18
|
+
].join("\n"), g = [
|
|
18
19
|
"Create a Vite config with the wuchale plugin:",
|
|
19
20
|
"",
|
|
20
21
|
"import { defineConfig } from 'vite';",
|
|
@@ -24,20 +25,20 @@ var d = [
|
|
|
24
25
|
" plugins: [wuchale()],",
|
|
25
26
|
"});"
|
|
26
27
|
].join("\n");
|
|
27
|
-
function
|
|
28
|
-
if (!
|
|
28
|
+
function _(e) {
|
|
29
|
+
if (!u.existsSync(e)) return {
|
|
29
30
|
status: "not-found",
|
|
30
|
-
message:
|
|
31
|
+
message: g
|
|
31
32
|
};
|
|
32
|
-
let t = new
|
|
33
|
+
let t = new f({
|
|
33
34
|
compilerOptions: { allowJs: !0 },
|
|
34
|
-
manipulationSettings: { quoteKind:
|
|
35
|
+
manipulationSettings: { quoteKind: p.Single }
|
|
35
36
|
}).addSourceFileAtPath(e), n = !1, r = !1;
|
|
36
37
|
t.getImportDeclarations().some((e) => e.getModuleSpecifierValue() === "wuchale/vite") || (t.insertImportDeclaration(0, {
|
|
37
38
|
namedImports: ["wuchale"],
|
|
38
39
|
moduleSpecifier: "wuchale/vite"
|
|
39
40
|
}), n = !0);
|
|
40
|
-
let i = t.getDescendantsOfKind(
|
|
41
|
+
let i = t.getDescendantsOfKind(m.CallExpression).find((e) => e.getExpression().getText() === "defineConfig")?.getArguments()?.[0], a = i?.getKind() === m.ObjectLiteralExpression ? i : null;
|
|
41
42
|
if (!a) r = !0;
|
|
42
43
|
else {
|
|
43
44
|
let e = a.getProperty("plugins");
|
|
@@ -45,11 +46,11 @@ function p(e) {
|
|
|
45
46
|
name: "plugins",
|
|
46
47
|
initializer: "[wuchale()]"
|
|
47
48
|
}), n = !0;
|
|
48
|
-
else if (e.getKind() !==
|
|
49
|
+
else if (e.getKind() !== m.PropertyAssignment) r = !0;
|
|
49
50
|
else {
|
|
50
51
|
let t = e.getInitializer();
|
|
51
52
|
if (!t) e.setInitializer("[wuchale()]"), n = !0;
|
|
52
|
-
else if (t.getKind() !==
|
|
53
|
+
else if (t.getKind() !== m.ArrayLiteralExpression) r = !0;
|
|
53
54
|
else {
|
|
54
55
|
let e = t;
|
|
55
56
|
e.getElements().some((e) => e.getText().replace(/\s/g, "") === "wuchale()") || (e.insertElement(0, "wuchale()"), n = !0);
|
|
@@ -58,7 +59,7 @@ function p(e) {
|
|
|
58
59
|
}
|
|
59
60
|
return n && (t.formatText(), t.saveSync()), r ? {
|
|
60
61
|
status: "failed",
|
|
61
|
-
message:
|
|
62
|
+
message: h
|
|
62
63
|
} : {
|
|
63
64
|
status: "success",
|
|
64
65
|
changed: n
|
|
@@ -66,99 +67,41 @@ function p(e) {
|
|
|
66
67
|
}
|
|
67
68
|
//#endregion
|
|
68
69
|
//#region src/patterns/enable/i18n/modifies/svelte-config.ts
|
|
69
|
-
var
|
|
70
|
-
"Add the $locales alias to your
|
|
70
|
+
var v = [
|
|
71
|
+
"Add the $locales alias to your config (sveltekit() arg in vite.config, or svelte.config):",
|
|
71
72
|
"",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
" $locales: 'src/locales',",
|
|
75
|
-
" },",
|
|
73
|
+
"alias: {",
|
|
74
|
+
" $locales: 'src/locales',",
|
|
76
75
|
"},"
|
|
77
|
-
].join("\n"),
|
|
78
|
-
"
|
|
76
|
+
].join("\n"), y = [
|
|
77
|
+
"Add the $locales alias by passing config to the sveltekit() plugin in vite.config.ts:",
|
|
79
78
|
"",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
" kit: {",
|
|
83
|
-
" alias: {",
|
|
84
|
-
" $locales: 'src/locales',",
|
|
85
|
-
" },",
|
|
86
|
-
" },",
|
|
87
|
-
"};",
|
|
79
|
+
"import { sveltekit } from '@sveltejs/kit/vite';",
|
|
80
|
+
"import { defineConfig } from 'vite';",
|
|
88
81
|
"",
|
|
89
|
-
"export default
|
|
82
|
+
"export default defineConfig({",
|
|
83
|
+
" plugins: [sveltekit({ alias: { $locales: 'src/locales' } })],",
|
|
84
|
+
"});"
|
|
90
85
|
].join("\n");
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
let
|
|
99
|
-
if (!
|
|
100
|
-
let
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (!i) return null;
|
|
106
|
-
if (i.getKind() !== u.ObjectLiteralExpression) {
|
|
107
|
-
r.setInitializer(n);
|
|
108
|
-
let e = r.getInitializer();
|
|
109
|
-
return e && e.getKind() === u.ObjectLiteralExpression ? e : null;
|
|
110
|
-
}
|
|
111
|
-
return i;
|
|
112
|
-
}
|
|
113
|
-
function _(e) {
|
|
114
|
-
if (!o.existsSync(e)) return {
|
|
115
|
-
status: "not-found",
|
|
116
|
-
message: h
|
|
117
|
-
};
|
|
118
|
-
let t = new c({
|
|
119
|
-
compilerOptions: { allowJs: !0 },
|
|
120
|
-
manipulationSettings: { quoteKind: l.Single }
|
|
121
|
-
}).addSourceFileAtPath(e), n = t.getExportAssignment((e) => !e.isExportEquals())?.getExpression(), r = null;
|
|
122
|
-
if (n?.getKind() === u.ObjectLiteralExpression) r = n;
|
|
123
|
-
else if (n?.getKind() === u.Identifier) {
|
|
124
|
-
let e = n.getText(), i = t.getVariableDeclaration(e)?.getInitializer();
|
|
125
|
-
i?.getKind() === u.ObjectLiteralExpression && (r = i);
|
|
126
|
-
}
|
|
127
|
-
if (!r) return {
|
|
128
|
-
status: "failed",
|
|
129
|
-
message: m
|
|
130
|
-
};
|
|
131
|
-
let i = g(r, "kit", "{}");
|
|
132
|
-
if (!i) return {
|
|
133
|
-
status: "failed",
|
|
134
|
-
message: m
|
|
135
|
-
};
|
|
136
|
-
let a = g(i, "alias", "{}");
|
|
137
|
-
if (!a) return {
|
|
138
|
-
status: "failed",
|
|
139
|
-
message: m
|
|
140
|
-
};
|
|
141
|
-
let s = a.getProperty("$locales");
|
|
142
|
-
return s ? s.getKind() === u.PropertyAssignment ? s.getInitializer()?.getText()?.replace(/['"`]/g, "") === "src/locales" ? {
|
|
143
|
-
status: "success",
|
|
144
|
-
changed: !1
|
|
145
|
-
} : (s.setInitializer("'src/locales'"), t.formatText(), t.saveSync(), {
|
|
146
|
-
status: "success",
|
|
147
|
-
changed: !0
|
|
148
|
-
}) : {
|
|
149
|
-
status: "failed",
|
|
150
|
-
message: m
|
|
151
|
-
} : (a.addPropertyAssignment({
|
|
152
|
-
name: "$locales",
|
|
153
|
-
initializer: "'src/locales'"
|
|
154
|
-
}), t.formatText(), t.saveSync(), {
|
|
155
|
-
status: "success",
|
|
156
|
-
changed: !0
|
|
86
|
+
function b(e) {
|
|
87
|
+
return s(e, {
|
|
88
|
+
notFound: y,
|
|
89
|
+
failed: v
|
|
90
|
+
}, (e) => {
|
|
91
|
+
let t = e.kitContainer();
|
|
92
|
+
if (!t) return !1;
|
|
93
|
+
let n = c(t, "alias", "{}");
|
|
94
|
+
if (!n) return !1;
|
|
95
|
+
let r = n.getProperty("$locales");
|
|
96
|
+
return r ? r.getKind() === m.PropertyAssignment && (r.getInitializer()?.getText()?.replace(/['"`]/g, "") !== "src/locales" && r.setInitializer("'src/locales'"), !0) : (n.addPropertyAssignment({
|
|
97
|
+
name: "$locales",
|
|
98
|
+
initializer: "'src/locales'"
|
|
99
|
+
}), !0);
|
|
157
100
|
});
|
|
158
101
|
}
|
|
159
102
|
//#endregion
|
|
160
103
|
//#region src/patterns/enable/i18n/modifies/hooks.server.ts
|
|
161
|
-
var
|
|
104
|
+
var x = e`
|
|
162
105
|
Wrap your exported handle with the wuchale i18n handler:
|
|
163
106
|
|
|
164
107
|
import { sequence } from '@sveltejs/kit/hooks';
|
|
@@ -182,7 +125,7 @@ var v = e`
|
|
|
182
125
|
};
|
|
183
126
|
|
|
184
127
|
export const handle = sequence(handleWuchale, /* your existing handle */);
|
|
185
|
-
`,
|
|
128
|
+
`, S = e`
|
|
186
129
|
Create src/hooks.server.ts with an i18n handle:
|
|
187
130
|
|
|
188
131
|
import { sequence } from '@sveltejs/kit/hooks';
|
|
@@ -207,7 +150,7 @@ var v = e`
|
|
|
207
150
|
|
|
208
151
|
export const handle = handleWuchale;
|
|
209
152
|
`;
|
|
210
|
-
function
|
|
153
|
+
function C(e, t, n) {
|
|
211
154
|
let r = e.getImportDeclarations().find((e) => e.getModuleSpecifierValue() === t);
|
|
212
155
|
if (r) {
|
|
213
156
|
r.getNamedImports().some((e) => e.getName() === n) || r.addNamedImport(n);
|
|
@@ -218,41 +161,41 @@ function b(e, t, n) {
|
|
|
218
161
|
moduleSpecifier: t
|
|
219
162
|
});
|
|
220
163
|
}
|
|
221
|
-
function
|
|
164
|
+
function w(e, t, n) {
|
|
222
165
|
e.getImportDeclarations().find((e) => e.getModuleSpecifierValue() === t) || e.addImportDeclaration({
|
|
223
166
|
namespaceImport: n,
|
|
224
167
|
moduleSpecifier: t
|
|
225
168
|
});
|
|
226
169
|
}
|
|
227
|
-
function
|
|
228
|
-
if (!
|
|
170
|
+
function T(t) {
|
|
171
|
+
if (!u.existsSync(t)) return {
|
|
229
172
|
status: "not-found",
|
|
230
|
-
message:
|
|
173
|
+
message: S
|
|
231
174
|
};
|
|
232
|
-
let n =
|
|
175
|
+
let n = u.readFileSync(t, "utf8");
|
|
233
176
|
if (n.includes("runWithLocale") || n.includes("loadLocales(")) return {
|
|
234
177
|
status: "success",
|
|
235
178
|
changed: !1
|
|
236
179
|
};
|
|
237
|
-
let r = new
|
|
180
|
+
let r = new f({
|
|
238
181
|
compilerOptions: { allowJs: !0 },
|
|
239
|
-
manipulationSettings: { quoteKind:
|
|
182
|
+
manipulationSettings: { quoteKind: p.Single }
|
|
240
183
|
}).addSourceFileAtPath(t), i = r.getVariableDeclaration("handle");
|
|
241
184
|
if (!i) return {
|
|
242
185
|
status: "failed",
|
|
243
|
-
message:
|
|
186
|
+
message: x
|
|
244
187
|
};
|
|
245
|
-
let a = i.getFirstAncestorByKind(
|
|
188
|
+
let a = i.getFirstAncestorByKind(m.VariableStatement);
|
|
246
189
|
if (!a?.hasExportKeyword()) return {
|
|
247
190
|
status: "failed",
|
|
248
|
-
message:
|
|
191
|
+
message: x
|
|
249
192
|
};
|
|
250
|
-
|
|
251
|
-
let
|
|
193
|
+
C(r, "@sveltejs/kit/hooks", "sequence"), C(r, "wuchale/load-utils/server", "runWithLocale"), C(r, "wuchale/load-utils/server", "loadLocales"), C(r, "$locales/main.url", "getLocale"), C(r, "$locales/data", "locales"), w(r, "$locales/main.loader.server.svelte.js", "main"), w(r, "$locales/js.loader.server.js", "js");
|
|
194
|
+
let o = r.getStatements().findIndex((e) => e === a), s = "handleWuchale", c = e`
|
|
252
195
|
loadLocales(main.key, main.loadIDs, main.loadCatalog, locales);
|
|
253
196
|
loadLocales(js.key, js.loadIDs, js.loadCatalog, locales);
|
|
254
|
-
`,
|
|
255
|
-
const ${
|
|
197
|
+
`, l = e`
|
|
198
|
+
const ${s} = async ({ event, resolve }: any) => {
|
|
256
199
|
const locale = getLocale(event.url);
|
|
257
200
|
return await runWithLocale(locale, () =>
|
|
258
201
|
resolve(event, {
|
|
@@ -262,28 +205,28 @@ function S(t) {
|
|
|
262
205
|
);
|
|
263
206
|
};
|
|
264
207
|
`;
|
|
265
|
-
|
|
266
|
-
let
|
|
267
|
-
if (!
|
|
208
|
+
o >= 0 ? r.insertStatements(o, `\n${c}\n\n${l}\n`) : r.addStatements(`\n${c}\n\n${l}\n`);
|
|
209
|
+
let d = i.getInitializer();
|
|
210
|
+
if (!d) return {
|
|
268
211
|
status: "failed",
|
|
269
|
-
message:
|
|
212
|
+
message: x
|
|
270
213
|
};
|
|
271
|
-
let h =
|
|
272
|
-
return h.includes(
|
|
214
|
+
let h = d.getText();
|
|
215
|
+
return h.includes(s) || h.includes("runWithLocale") ? {
|
|
273
216
|
status: "success",
|
|
274
217
|
changed: !1
|
|
275
|
-
} : (i.setInitializer(`sequence(${
|
|
218
|
+
} : (i.setInitializer(`sequence(${s}, ${h})`), r.formatText(), r.saveSync(), {
|
|
276
219
|
status: "success",
|
|
277
220
|
changed: !0
|
|
278
221
|
});
|
|
279
222
|
}
|
|
280
223
|
//#endregion
|
|
281
224
|
//#region src/patterns/enable/i18n/modifies/app-html.ts
|
|
282
|
-
var
|
|
225
|
+
var E = [
|
|
283
226
|
"Add the sveltekit lang placeholder to the <html> tag:",
|
|
284
227
|
"",
|
|
285
228
|
"<html lang=\"%sveltekit.lang%\">"
|
|
286
|
-
].join("\n"),
|
|
229
|
+
].join("\n"), D = [
|
|
287
230
|
"Create src/app.html with a lang placeholder:",
|
|
288
231
|
"",
|
|
289
232
|
"<!doctype html>",
|
|
@@ -297,12 +240,12 @@ var C = [
|
|
|
297
240
|
" </body>",
|
|
298
241
|
"</html>"
|
|
299
242
|
].join("\n");
|
|
300
|
-
function
|
|
301
|
-
if (!
|
|
243
|
+
function O(e) {
|
|
244
|
+
if (!u.existsSync(e)) return {
|
|
302
245
|
status: "not-found",
|
|
303
|
-
message:
|
|
246
|
+
message: D
|
|
304
247
|
};
|
|
305
|
-
let t =
|
|
248
|
+
let t = u.readFileSync(e, "utf8");
|
|
306
249
|
if (t.includes("lang=\"%sveltekit.lang%\"") || t.includes("lang='%sveltekit.lang%'")) return {
|
|
307
250
|
status: "success",
|
|
308
251
|
changed: !1
|
|
@@ -310,26 +253,26 @@ function T(e) {
|
|
|
310
253
|
let n = t.replace(/<html(\s[^>]*?)?>/i, (e) => /lang\s*=/.test(e) ? e : e.replace(/<html/i, "<html lang=\"%sveltekit.lang%\""));
|
|
311
254
|
return n === t ? {
|
|
312
255
|
status: "failed",
|
|
313
|
-
message:
|
|
314
|
-
} : (
|
|
256
|
+
message: E
|
|
257
|
+
} : (u.writeFileSync(e, n), {
|
|
315
258
|
status: "success",
|
|
316
259
|
changed: !0
|
|
317
260
|
});
|
|
318
261
|
}
|
|
319
262
|
//#endregion
|
|
320
263
|
//#region src/patterns/enable/i18n/modifies/gitignore.ts
|
|
321
|
-
var
|
|
264
|
+
var k = [
|
|
322
265
|
"Create a .gitignore with the wuchale cache ignored:",
|
|
323
266
|
"",
|
|
324
267
|
"# Wuchale",
|
|
325
268
|
"src/locales/.wuchale"
|
|
326
269
|
].join("\n");
|
|
327
|
-
function
|
|
328
|
-
if (!
|
|
270
|
+
function A(t) {
|
|
271
|
+
if (!u.existsSync(t)) return {
|
|
329
272
|
status: "not-found",
|
|
330
|
-
message:
|
|
273
|
+
message: k
|
|
331
274
|
};
|
|
332
|
-
let n =
|
|
275
|
+
let n = u.readFileSync(t, "utf8");
|
|
333
276
|
if (n.includes("src/locales/.wuchale")) return {
|
|
334
277
|
status: "success",
|
|
335
278
|
changed: !1
|
|
@@ -338,14 +281,14 @@ function D(t) {
|
|
|
338
281
|
# Wuchale
|
|
339
282
|
src/locales/.wuchale
|
|
340
283
|
`, i = n + (n.length > 0 && !n.endsWith("\n") ? "\n" : "") + "\n" + r + "\n";
|
|
341
|
-
return
|
|
284
|
+
return u.writeFileSync(t, i), {
|
|
342
285
|
status: "success",
|
|
343
286
|
changed: !0
|
|
344
287
|
};
|
|
345
288
|
}
|
|
346
289
|
//#endregion
|
|
347
290
|
//#region src/patterns/enable/i18n/modifies/+layout.ts
|
|
348
|
-
var
|
|
291
|
+
var j = e`
|
|
349
292
|
import { browser } from '$app/environment';
|
|
350
293
|
import { loadLocale } from 'wuchale/load-utils';
|
|
351
294
|
|
|
@@ -362,55 +305,55 @@ var O = e`
|
|
|
362
305
|
|
|
363
306
|
return data;
|
|
364
307
|
};
|
|
365
|
-
`,
|
|
308
|
+
`, M = [
|
|
366
309
|
"Merge the wuchale loader into your existing load function in +layout.ts:",
|
|
367
310
|
"",
|
|
368
|
-
|
|
311
|
+
j
|
|
369
312
|
].join("\n");
|
|
370
|
-
function
|
|
371
|
-
if (
|
|
372
|
-
let t =
|
|
313
|
+
function N(e) {
|
|
314
|
+
if (u.existsSync(e)) {
|
|
315
|
+
let t = u.readFileSync(e, "utf8");
|
|
373
316
|
if (t.includes("loadLocale") || t.includes("translateUrl")) return {
|
|
374
317
|
status: "success",
|
|
375
318
|
changed: !1
|
|
376
319
|
};
|
|
377
320
|
if (/\bexport\s+(const|function)\s+load\b/.test(t)) return {
|
|
378
321
|
status: "failed",
|
|
379
|
-
message:
|
|
322
|
+
message: M
|
|
380
323
|
};
|
|
381
324
|
}
|
|
382
|
-
return
|
|
325
|
+
return u.mkdirSync(d.dirname(e), { recursive: !0 }), u.writeFileSync(e, j + "\n"), {
|
|
383
326
|
status: "success",
|
|
384
327
|
changed: !0
|
|
385
328
|
};
|
|
386
329
|
}
|
|
387
330
|
//#endregion
|
|
388
331
|
//#region src/patterns/enable/i18n/modifies/root-layout.svelte.ts
|
|
389
|
-
var
|
|
332
|
+
var P = "<Navbar.Item>\n <LanguageSelect />\n </Navbar.Item>\n ", F = e`
|
|
390
333
|
import LanguageSelect from '$lib/components/language-select.svelte';
|
|
391
|
-
`,
|
|
334
|
+
`, I = [
|
|
392
335
|
"Add the language select inside your <Navbar.List> in the root layout.",
|
|
393
336
|
"",
|
|
394
337
|
"Import to add to the <script> tag:",
|
|
395
338
|
"",
|
|
396
|
-
|
|
339
|
+
F,
|
|
397
340
|
"",
|
|
398
341
|
"Markup to add at the end of <Navbar.List>:",
|
|
399
|
-
|
|
400
|
-
].join("\n"),
|
|
342
|
+
P
|
|
343
|
+
].join("\n"), L = [
|
|
401
344
|
"Create a root layout that includes a language select inside <Navbar.List>.",
|
|
402
345
|
"",
|
|
403
346
|
"Import for the <script> tag:",
|
|
404
347
|
"",
|
|
405
|
-
|
|
348
|
+
F,
|
|
406
349
|
"",
|
|
407
350
|
"Markup at the end of <Navbar.List>:",
|
|
408
|
-
|
|
351
|
+
P
|
|
409
352
|
].join("\n");
|
|
410
|
-
function
|
|
411
|
-
if (!
|
|
353
|
+
function R(e) {
|
|
354
|
+
if (!u.existsSync(e)) return {
|
|
412
355
|
status: "not-found",
|
|
413
|
-
message:
|
|
356
|
+
message: L
|
|
414
357
|
};
|
|
415
358
|
let t = a.fromPath(e);
|
|
416
359
|
return t.hasElement("Navbar.List") ? t.hasElement("LanguageSelect") ? {
|
|
@@ -424,57 +367,40 @@ function F(e) {
|
|
|
424
367
|
}]);
|
|
425
368
|
});
|
|
426
369
|
return t;
|
|
427
|
-
}), t.insertBeforeClosingTag("Navbar.List",
|
|
370
|
+
}), t.insertBeforeClosingTag("Navbar.List", P), t.writeTo(e), {
|
|
428
371
|
status: "success",
|
|
429
372
|
changed: t.hasChanged()
|
|
430
373
|
}) : {
|
|
431
374
|
status: "failed",
|
|
432
|
-
message:
|
|
375
|
+
message: I
|
|
433
376
|
};
|
|
434
377
|
}
|
|
435
378
|
//#endregion
|
|
436
379
|
//#region src/patterns/enable/i18n/generate.runtime.ts
|
|
437
|
-
function
|
|
438
|
-
for (let n of t) {
|
|
439
|
-
let t = s.join(e, n);
|
|
440
|
-
if (o.existsSync(t)) return t;
|
|
441
|
-
}
|
|
442
|
-
return s.join(e, t[0]);
|
|
443
|
-
}
|
|
444
|
-
async function L(e) {
|
|
380
|
+
async function z(e) {
|
|
445
381
|
let r = t(e), i = [], a = (e) => {
|
|
446
382
|
e && i.push(e);
|
|
447
383
|
};
|
|
448
384
|
r.info("Modifying vite.config");
|
|
449
|
-
let
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
a(n(f, A(f))), r.info("Modifying root layout language select");
|
|
469
|
-
let m = [
|
|
470
|
-
s.join(e.root, "src", "routes", "(public)", "root-layout.svelte"),
|
|
471
|
-
s.join(e.root, "src", "routes", "root-layout.svelte"),
|
|
472
|
-
s.join(e.root, "src", "routes", "(public)", "+layout.svelte"),
|
|
473
|
-
s.join(e.root, "src", "routes", "+layout.svelte")
|
|
474
|
-
], h = m.find((e) => o.existsSync(e)) ?? m[0];
|
|
475
|
-
a(n(h, F(h))), r.info("Updating .gitignore");
|
|
476
|
-
let g = s.join(e.root, ".gitignore");
|
|
477
|
-
return a(n(g, D(g))), {
|
|
385
|
+
let s = o(e.root, l) ?? d.join(e.root, l[0]);
|
|
386
|
+
a(n(s, _(s))), r.info("Modifying config for i18n alias");
|
|
387
|
+
let c = b(e.root);
|
|
388
|
+
a(n(c.filePath, c.outcome)), r.info("Modifying hooks.server.ts");
|
|
389
|
+
let f = d.join(e.root, "src", "hooks.server.ts");
|
|
390
|
+
a(n(f, T(f))), r.info("Modifying app.html");
|
|
391
|
+
let p = d.join(e.root, "src", "app.html");
|
|
392
|
+
a(n(p, O(p))), r.info("Modifying root +layout.ts");
|
|
393
|
+
let m = d.join(e.root, "src", "routes", "+layout.ts");
|
|
394
|
+
a(n(m, N(m))), r.info("Modifying root layout language select");
|
|
395
|
+
let h = [
|
|
396
|
+
d.join(e.root, "src", "routes", "(public)", "root-layout.svelte"),
|
|
397
|
+
d.join(e.root, "src", "routes", "root-layout.svelte"),
|
|
398
|
+
d.join(e.root, "src", "routes", "(public)", "+layout.svelte"),
|
|
399
|
+
d.join(e.root, "src", "routes", "+layout.svelte")
|
|
400
|
+
], g = h.find((e) => u.existsSync(e)) ?? h[0];
|
|
401
|
+
a(n(g, R(g))), r.info("Updating .gitignore");
|
|
402
|
+
let v = d.join(e.root, ".gitignore");
|
|
403
|
+
return a(n(v, A(v))), {
|
|
478
404
|
creates: [],
|
|
479
405
|
modifies: i,
|
|
480
406
|
deletes: [],
|
|
@@ -486,6 +412,6 @@ async function L(e) {
|
|
|
486
412
|
};
|
|
487
413
|
}
|
|
488
414
|
//#endregion
|
|
489
|
-
export {
|
|
415
|
+
export { z as generate };
|
|
490
416
|
|
|
491
|
-
//# sourceMappingURL=generate.runtime-
|
|
417
|
+
//# sourceMappingURL=generate.runtime-BT_bwAtt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-BT_bwAtt.js","names":[],"sources":["../../src/patterns/enable/i18n/modifies/vite-config.ts","../../src/patterns/enable/i18n/modifies/svelte-config.ts","../../src/patterns/enable/i18n/modifies/hooks.server.ts","../../src/patterns/enable/i18n/modifies/app-html.ts","../../src/patterns/enable/i18n/modifies/gitignore.ts","../../src/patterns/enable/i18n/modifies/+layout.ts","../../src/patterns/enable/i18n/modifies/root-layout.svelte.ts","../../src/patterns/enable/i18n/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst FAILURE_HINT = [\n \"Add the wuchale plugin to your Vite config:\",\n \"\",\n \"import { wuchale } from 'wuchale/vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [wuchale(), /* ...existing plugins */],\",\n \"});\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create a Vite config with the wuchale plugin:\",\n \"\",\n \"import { defineConfig } from 'vite';\",\n \"import { wuchale } from 'wuchale/vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [wuchale()],\",\n \"});\",\n].join(\"\\n\");\n\nexport function modifyViteConfig(viteConfigPath: string): ModifyOutcome {\n if (!fs.existsSync(viteConfigPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(viteConfigPath);\n\n let changed = false;\n let failed = false;\n\n const hasImport = sourceFile\n .getImportDeclarations()\n .some((d) => d.getModuleSpecifierValue() === \"wuchale/vite\");\n\n if (!hasImport) {\n sourceFile.insertImportDeclaration(0, {\n namedImports: [\"wuchale\"],\n moduleSpecifier: \"wuchale/vite\",\n });\n changed = true;\n }\n\n const defineConfigCall = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"defineConfig\");\n\n const configArg = defineConfigCall?.getArguments()?.[0];\n const configObj =\n configArg?.getKind() === SyntaxKind.ObjectLiteralExpression\n ? (configArg as import(\"ts-morph\").ObjectLiteralExpression)\n : null;\n\n if (!configObj) {\n failed = true;\n } else {\n const pluginsProp = configObj.getProperty(\"plugins\");\n if (!pluginsProp) {\n configObj.addPropertyAssignment({\n name: \"plugins\",\n initializer: \"[wuchale()]\",\n });\n changed = true;\n } else if (pluginsProp.getKind() !== SyntaxKind.PropertyAssignment) {\n failed = true;\n } else {\n const pluginsInit = (\n pluginsProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n\n if (!pluginsInit) {\n (pluginsProp as import(\"ts-morph\").PropertyAssignment).setInitializer(\n \"[wuchale()]\",\n );\n changed = true;\n } else if (pluginsInit.getKind() !== SyntaxKind.ArrayLiteralExpression) {\n failed = true;\n } else {\n const arr = pluginsInit as import(\"ts-morph\").ArrayLiteralExpression;\n const hasWuchale = arr\n .getElements()\n .some((el) => el.getText().replace(/\\s/g, \"\") === \"wuchale()\");\n\n if (!hasWuchale) {\n arr.insertElement(0, \"wuchale()\");\n changed = true;\n }\n }\n }\n }\n\n if (changed) {\n sourceFile.formatText();\n sourceFile.saveSync();\n }\n\n if (failed) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n return { status: \"success\", changed };\n}\n","import { SyntaxKind, type PropertyAssignment } from \"ts-morph\";\nimport {\n getOrCreateObjectLiteralProperty,\n modifyConfig,\n type ConfigModifyResult,\n} from \"../../../../runtime/config-target\";\n\nconst FAILURE_HINT = [\n \"Add the $locales alias to your config (sveltekit() arg in vite.config, or svelte.config):\",\n \"\",\n \"alias: {\",\n \" $locales: 'src/locales',\",\n \"},\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Add the $locales alias by passing config to the sveltekit() plugin in vite.config.ts:\",\n \"\",\n \"import { sveltekit } from '@sveltejs/kit/vite';\",\n \"import { defineConfig } from 'vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [sveltekit({ alias: { $locales: 'src/locales' } })],\",\n \"});\",\n].join(\"\\n\");\n\n/** Ensure the `$locales` alias points at `src/locales`. */\nexport function modifySvelteConfig(root: string): ConfigModifyResult {\n return modifyConfig(\n root,\n { notFound: NOT_FOUND_HINT, failed: FAILURE_HINT },\n (target) => {\n const kit = target.kitContainer();\n if (!kit) return false;\n const aliasObj = getOrCreateObjectLiteralProperty(kit, \"alias\", \"{}\");\n if (!aliasObj) return false;\n\n const existing = aliasObj.getProperty(\"$locales\");\n if (!existing) {\n aliasObj.addPropertyAssignment({\n name: \"$locales\",\n initializer: \"'src/locales'\",\n });\n return true;\n }\n if (existing.getKind() !== SyntaxKind.PropertyAssignment) return false;\n\n const init = (existing as PropertyAssignment).getInitializer();\n const current = init?.getText()?.replace(/['\"`]/g, \"\");\n if (current !== \"src/locales\") {\n (existing as PropertyAssignment).setInitializer(\"'src/locales'\");\n }\n return true;\n },\n );\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst FAILURE_HINT = dedent`\n Wrap your exported handle with the wuchale i18n handler:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';\n import { getLocale } from '$locales/main.url';\n import { locales } from '$locales/data';\n import * as main from '$locales/main.loader.server.svelte.js';\n import * as js from '$locales/js.loader.server.js';\n\n loadLocales(main.key, main.loadIDs, main.loadCatalog, locales);\n loadLocales(js.key, js.loadIDs, js.loadCatalog, locales);\n\n const handleWuchale = async ({ event, resolve }: any) => {\n const locale = getLocale(event.url);\n return await runWithLocale(locale, () =>\n resolve(event, {\n transformPageChunk: ({ html }: { html: string }) =>\n html.replace('%sveltekit.lang%', locale),\n }),\n );\n };\n\n export const handle = sequence(handleWuchale, /* your existing handle */);\n`;\n\nconst NOT_FOUND_HINT = dedent`\n Create src/hooks.server.ts with an i18n handle:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';\n import { getLocale } from '$locales/main.url';\n import { locales } from '$locales/data';\n import * as main from '$locales/main.loader.server.svelte.js';\n import * as js from '$locales/js.loader.server.js';\n\n loadLocales(main.key, main.loadIDs, main.loadCatalog, locales);\n loadLocales(js.key, js.loadIDs, js.loadCatalog, locales);\n\n const handleWuchale = async ({ event, resolve }: any) => {\n const locale = getLocale(event.url);\n return await runWithLocale(locale, () =>\n resolve(event, {\n transformPageChunk: ({ html }: { html: string }) =>\n html.replace('%sveltekit.lang%', locale),\n }),\n );\n };\n\n export const handle = handleWuchale;\n`;\n\nfunction ensureNamedImport(\n sourceFile: import(\"ts-morph\").SourceFile,\n moduleSpecifier: string,\n name: string,\n) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === moduleSpecifier);\n if (existing) {\n const has = existing.getNamedImports().some((ni) => ni.getName() === name);\n if (!has) existing.addNamedImport(name);\n return;\n }\n sourceFile.addImportDeclaration({ namedImports: [name], moduleSpecifier });\n}\n\nfunction ensureNamespaceImport(\n sourceFile: import(\"ts-morph\").SourceFile,\n moduleSpecifier: string,\n ns: string,\n) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === moduleSpecifier);\n if (existing) return;\n sourceFile.addImportDeclaration({ namespaceImport: ns, moduleSpecifier });\n}\n\nexport function modifyHooksServerI18n(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"runWithLocale\") || original.includes(\"loadLocales(\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const handleDecl = sourceFile.getVariableDeclaration(\"handle\");\n if (!handleDecl) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const handleStmt = handleDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n if (!handleStmt?.hasExportKeyword()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureNamedImport(sourceFile, \"@sveltejs/kit/hooks\", \"sequence\");\n ensureNamedImport(sourceFile, \"wuchale/load-utils/server\", \"runWithLocale\");\n ensureNamedImport(sourceFile, \"wuchale/load-utils/server\", \"loadLocales\");\n ensureNamedImport(sourceFile, \"$locales/main.url\", \"getLocale\");\n ensureNamedImport(sourceFile, \"$locales/data\", \"locales\");\n ensureNamespaceImport(\n sourceFile,\n \"$locales/main.loader.server.svelte.js\",\n \"main\",\n );\n ensureNamespaceImport(sourceFile, \"$locales/js.loader.server.js\", \"js\");\n\n const statements = sourceFile.getStatements();\n const handleStmtIndex = statements.findIndex((s) => s === handleStmt);\n const i18nHandleName = \"handleWuchale\";\n\n const startupSnippet = dedent`\n loadLocales(main.key, main.loadIDs, main.loadCatalog, locales);\n loadLocales(js.key, js.loadIDs, js.loadCatalog, locales);\n `;\n\n const i18nHandleSnippet = dedent`\n const ${i18nHandleName} = async ({ event, resolve }: any) => {\n const locale = getLocale(event.url);\n return await runWithLocale(locale, () =>\n resolve(event, {\n transformPageChunk: ({ html }: { html: string }) =>\n html.replace('%sveltekit.lang%', locale)\n })\n );\n };\n `;\n\n if (handleStmtIndex >= 0) {\n sourceFile.insertStatements(\n handleStmtIndex,\n `\\n${startupSnippet}\\n\\n${i18nHandleSnippet}\\n`,\n );\n } else {\n sourceFile.addStatements(`\\n${startupSnippet}\\n\\n${i18nHandleSnippet}\\n`);\n }\n\n const init = handleDecl.getInitializer();\n if (!init) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const initText = init.getText();\n if (initText.includes(i18nHandleName) || initText.includes(\"runWithLocale\")) {\n return { status: \"success\", changed: false };\n }\n\n handleDecl.setInitializer(`sequence(${i18nHandleName}, ${initText})`);\n sourceFile.formatText();\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst FAILURE_HINT = [\n \"Add the sveltekit lang placeholder to the <html> tag:\",\n \"\",\n '<html lang=\"%sveltekit.lang%\">',\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/app.html with a lang placeholder:\",\n \"\",\n \"<!doctype html>\",\n '<html lang=\"%sveltekit.lang%\">',\n \" <head>\",\n ' <meta charset=\"utf-8\" />',\n \" %sveltekit.head%\",\n \" </head>\",\n ' <body data-sveltekit-preload-data=\"hover\">',\n ' <div style=\"display: contents\">%sveltekit.body%</div>',\n \" </body>\",\n \"</html>\",\n].join(\"\\n\");\n\nexport function modifyAppHtml(appHtmlPath: string): ModifyOutcome {\n if (!fs.existsSync(appHtmlPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(appHtmlPath, \"utf8\");\n if (\n original.includes('lang=\"%sveltekit.lang%\"') ||\n original.includes(\"lang='%sveltekit.lang%'\")\n ) {\n return { status: \"success\", changed: false };\n }\n\n const updated = original.replace(/<html(\\s[^>]*?)?>/i, (match) => {\n if (/lang\\s*=/.test(match)) {\n return match;\n }\n return match.replace(/<html/i, '<html lang=\"%sveltekit.lang%\"');\n });\n\n if (updated === original) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.writeFileSync(appHtmlPath, updated);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst NOT_FOUND_HINT = [\n \"Create a .gitignore with the wuchale cache ignored:\",\n \"\",\n \"# Wuchale\",\n \"src/locales/.wuchale\",\n].join(\"\\n\");\n\nexport function modifyGitignore(gitignorePath: string): ModifyOutcome {\n if (!fs.existsSync(gitignorePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(gitignorePath, \"utf8\");\n if (original.includes(\"src/locales/.wuchale\")) {\n return { status: \"success\", changed: false };\n }\n\n const block = dedent`\n # Wuchale\n src/locales/.wuchale\n `;\n\n const needsNewline = original.length > 0 && !original.endsWith(\"\\n\");\n const updated = original + (needsNewline ? \"\\n\" : \"\") + \"\\n\" + block + \"\\n\";\n fs.writeFileSync(gitignorePath, updated);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst LOAD_SNIPPET = dedent`\n import { browser } from '$app/environment';\n import { loadLocale } from 'wuchale/load-utils';\n\n import { getLocale } from '$locales/main.url';\n import '$locales/main.loader.svelte';\n import '$locales/js.loader';\n\n export const load = async ({ url, data }) => {\n const locale = getLocale(url);\n\n if (browser) {\n await loadLocale(locale);\n }\n\n return data;\n };\n`;\n\nconst FAILURE_HINT = [\n \"Merge the wuchale loader into your existing load function in +layout.ts:\",\n \"\",\n LOAD_SNIPPET,\n].join(\"\\n\");\n\nexport function ensureRootLayoutI18n(layoutPath: string): ModifyOutcome {\n if (fs.existsSync(layoutPath)) {\n const existing = fs.readFileSync(layoutPath, \"utf8\");\n if (existing.includes(\"loadLocale\") || existing.includes(\"translateUrl\")) {\n return { status: \"success\", changed: false };\n }\n\n if (/\\bexport\\s+(const|function)\\s+load\\b/.test(existing)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n }\n\n fs.mkdirSync(path.dirname(layoutPath), { recursive: true });\n fs.writeFileSync(layoutPath, LOAD_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n}\n","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 LANGUAGE_SELECT_SNIPPET = `<Navbar.Item>\n\t\t\t\t<LanguageSelect />\n\t\t\t</Navbar.Item>\n\t\t\t`;\n\nconst IMPORT_SNIPPET = dedent`\n import LanguageSelect from '$lib/components/language-select.svelte';\n`;\n\nconst FAILURE_HINT = [\n \"Add the language select 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 at the end of <Navbar.List>:\",\n LANGUAGE_SELECT_SNIPPET,\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create a root layout that includes a language select inside <Navbar.List>.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup at the end of <Navbar.List>:\",\n LANGUAGE_SELECT_SNIPPET,\n].join(\"\\n\");\n\nexport function modifyRootLayoutLanguageSelect(\n layoutPath: string,\n): 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(\"LanguageSelect\")) {\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: \"LanguageSelect\",\n moduleSpecifier: \"$lib/components/language-select.svelte\",\n },\n ]);\n });\n return out;\n });\n\n file.insertBeforeClosingTag(\"Navbar.List\", LANGUAGE_SELECT_SNIPPET);\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 {\n probeFirstExisting,\n VITE_CONFIG_CANDIDATES,\n} from \"../../../runtime/config-target\";\nimport { modifyViteConfig } from \"./modifies/vite-config\";\nimport { modifySvelteConfig } from \"./modifies/svelte-config\";\nimport { modifyHooksServerI18n } from \"./modifies/hooks.server\";\nimport { modifyAppHtml } from \"./modifies/app-html\";\nimport { modifyGitignore } from \"./modifies/gitignore\";\nimport { ensureRootLayoutI18n } from \"./modifies/+layout\";\nimport { modifyRootLayoutLanguageSelect } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying vite.config\");\n const viteConfigPath =\n probeFirstExisting(options.root, VITE_CONFIG_CANDIDATES) ??\n path.join(options.root, VITE_CONFIG_CANDIDATES[0]);\n pushResult(\n modifyOutcomeToFile(viteConfigPath, modifyViteConfig(viteConfigPath)),\n );\n\n logger.info(\"Modifying config for i18n alias\");\n const alias = modifySvelteConfig(options.root);\n pushResult(modifyOutcomeToFile(alias.filePath, alias.outcome));\n\n logger.info(\"Modifying hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerI18n(hooksServerPath),\n ),\n );\n\n logger.info(\"Modifying app.html\");\n const appHtmlPath = path.join(options.root, \"src\", \"app.html\");\n pushResult(modifyOutcomeToFile(appHtmlPath, modifyAppHtml(appHtmlPath)));\n\n logger.info(\"Modifying root +layout.ts\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.ts\");\n pushResult(modifyOutcomeToFile(layoutPath, ensureRootLayoutI18n(layoutPath)));\n\n logger.info(\"Modifying root layout language select\");\n const rootLayoutCandidates = [\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 rootLayoutPath =\n rootLayoutCandidates.find((p) => fs.existsSync(p)) ??\n rootLayoutCandidates[0];\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n modifyRootLayoutLanguageSelect(rootLayoutPath),\n ),\n );\n\n logger.info(\"Updating .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n pushResult(\n modifyOutcomeToFile(gitignorePath, modifyGitignore(gitignorePath)),\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":";;;;;;;;;AAIA,IAAM,IAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI,GAEL,IAAiB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,SAAgB,EAAiB,GAAuC;CACtE,IAAI,CAAC,EAAG,WAAW,CAAc,GAC/B,OAAO;EAAE,QAAQ;EAAa,SAAS;CAAe;CAOx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,OAAO,UAAU,oBAAoB;EAC7D,EAAK,KAAK,EAAQ,MAAM,OAAO,UAAU,YAAY,gBAAgB;EACrE,EAAK,KAAK,EAAQ,MAAM,OAAO,UAAU,gBAAgB;CAC3D,GACM,IACJ,EAAqB,MAAM,MAAM,EAAG,WAAW,CAAC,CAAC,KACjD,EAAqB;CAQvB,AAPA,EACE,EACE,GACA,EAA+B,CAAc,CAC/C,CACF,GAEA,EAAO,KAAK,qBAAqB;CACjC,IAAM,IAAgB,EAAK,KAAK,EAAQ,MAAM,YAAY;CAK1D,OAJA,EACE,EAAoB,GAAe,EAAgB,CAAa,CAAC,CACnE,GAEO;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,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "./dedent-
|
|
2
|
-
import { n as t } from "./logger-
|
|
3
|
-
import { modifyOutcomeToFile as n } from "./modify-file-
|
|
4
|
-
import { a as r, n as i, o as a } from "./ts-morph-helpers-
|
|
1
|
+
import { t as e } from "./dedent-Gq6Krl4n.js";
|
|
2
|
+
import { n as t } from "./logger-CQONztPm.js";
|
|
3
|
+
import { modifyOutcomeToFile as n } from "./modify-file-PVKmDJHk.js";
|
|
4
|
+
import { a as r, n as i, o as a } from "./ts-morph-helpers-Bk82Z2n7.js";
|
|
5
5
|
import o from "node:fs";
|
|
6
6
|
import s from "node:path";
|
|
7
7
|
import { Project as c, QuoteKind as l, SyntaxKind as u } from "ts-morph";
|
|
@@ -207,4 +207,4 @@ async function w(e) {
|
|
|
207
207
|
//#endregion
|
|
208
208
|
export { w as generate };
|
|
209
209
|
|
|
210
|
-
//# sourceMappingURL=generate.runtime-
|
|
210
|
+
//# sourceMappingURL=generate.runtime-BnnsaLsg.js.map
|