@velastack/patterns 0.13.2 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/app-d-ts-h33RrYIv.js +198 -0
- package/dist/chunks/app-d-ts-h33RrYIv.js.map +1 -0
- package/dist/chunks/app-layout.svelte-CZ0hw-pi.js +51 -0
- package/dist/chunks/app-layout.svelte-CZ0hw-pi.js.map +1 -0
- package/dist/chunks/{generate.runtime-Dfl-07VS.js → generate.runtime-CZKIKP3B.js} +214 -178
- package/dist/chunks/generate.runtime-CZKIKP3B.js.map +1 -0
- package/dist/chunks/{generate.runtime-B6FeCL5I.js → generate.runtime-CsP4c8GY.js} +78 -77
- package/dist/chunks/generate.runtime-CsP4c8GY.js.map +1 -0
- package/dist/chunks/generate.runtime-DZUPtJVF.js +429 -0
- package/dist/chunks/generate.runtime-DZUPtJVF.js.map +1 -0
- package/dist/chunks/{generate.runtime-i3tMIA1A.js → generate.runtime-pbIrEsa7.js} +45 -45
- package/dist/chunks/generate.runtime-pbIrEsa7.js.map +1 -0
- package/dist/chunks/i18n-BHCytiiO.js +28 -0
- package/dist/chunks/i18n-BHCytiiO.js.map +1 -0
- package/dist/chunks/translations-CiJnl574.js +189 -0
- package/dist/chunks/translations-CiJnl574.js.map +1 -0
- package/dist/index.js +677 -664
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_layout-xBzFhszN.js +0 -78
- package/dist/chunks/_layout-xBzFhszN.js.map +0 -1
- package/dist/chunks/generate.runtime-B6FeCL5I.js.map +0 -1
- package/dist/chunks/generate.runtime-DLg2CKxQ.js +0 -341
- package/dist/chunks/generate.runtime-DLg2CKxQ.js.map +0 -1
- package/dist/chunks/generate.runtime-Dfl-07VS.js.map +0 -1
- package/dist/chunks/generate.runtime-i3tMIA1A.js.map +0 -1
|
@@ -59,14 +59,14 @@ function O(e, t = "") {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
// src/patterns/enable/cms/modifies/layout.server.ts
|
|
62
|
-
var k = { expression: () => "'en'" }, A = {
|
|
62
|
+
var k = { expression: () => "'en'" }, A = { expression: (e) => `${e}.locals.locale` }, j = {
|
|
63
63
|
expression: (e) => `getLocale(${e}.url)`,
|
|
64
64
|
imports: [{
|
|
65
65
|
namedImports: ["getLocale"],
|
|
66
66
|
moduleSpecifier: "#locales/main.url.js"
|
|
67
67
|
}]
|
|
68
68
|
};
|
|
69
|
-
function
|
|
69
|
+
function M(e, t) {
|
|
70
70
|
return c`
|
|
71
71
|
const { cms, notFound, gone, redirectTo } = await loadCms(${e}, { locale: ${t} });
|
|
72
72
|
if (redirectTo) redirect(308, redirectTo);
|
|
@@ -74,17 +74,17 @@ function j(e, t) {
|
|
|
74
74
|
if (notFound) error(404, 'Not found');
|
|
75
75
|
`;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function N(e) {
|
|
78
78
|
let t = [];
|
|
79
79
|
return e.defaultImport && t.push(e.defaultImport), e.namespaceImport && t.push(`* as ${e.namespaceImport}`), e.namedImports?.length && t.push(`{ ${e.namedImports.join(", ")} }`), `import ${t.join(", ")} from '${e.moduleSpecifier}';`;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function P(e) {
|
|
82
82
|
let t = [
|
|
83
83
|
"import { error, redirect } from '@sveltejs/kit';",
|
|
84
84
|
"import { loadCms } from '#lib/cms.js';",
|
|
85
|
-
...(e.imports ?? []).map(
|
|
85
|
+
...(e.imports ?? []).map(N),
|
|
86
86
|
"import type { LayoutServerLoad } from './$types';"
|
|
87
|
-
].join("\n"), n =
|
|
87
|
+
].join("\n"), n = M("event", e.expression("event")).split("\n").join("\n ");
|
|
88
88
|
return c`
|
|
89
89
|
${t}
|
|
90
90
|
|
|
@@ -95,16 +95,16 @@ function N(e) {
|
|
|
95
95
|
};
|
|
96
96
|
`.concat("\n");
|
|
97
97
|
}
|
|
98
|
-
var
|
|
98
|
+
var F = [
|
|
99
99
|
"Call loadCms from the root +layout.server.ts load and return `cms`:",
|
|
100
100
|
"",
|
|
101
|
-
|
|
101
|
+
P(k).trimEnd(),
|
|
102
102
|
"",
|
|
103
103
|
"loadCms needs the whole event, so a destructured parameter has to become",
|
|
104
104
|
"`event` with the destructuring moved into the body."
|
|
105
105
|
].join("\n");
|
|
106
|
-
function
|
|
107
|
-
if (!y.existsSync(e)) return y.mkdirSync(b.dirname(e), { recursive: !0 }), y.writeFileSync(e,
|
|
106
|
+
function I(e, t = k) {
|
|
107
|
+
if (!y.existsSync(e)) return y.mkdirSync(b.dirname(e), { recursive: !0 }), y.writeFileSync(e, P(t)), {
|
|
108
108
|
status: "success",
|
|
109
109
|
changed: !0
|
|
110
110
|
};
|
|
@@ -115,22 +115,22 @@ function F(e, t = k) {
|
|
|
115
115
|
let n = u().addSourceFileAtPath(e), r = d(n);
|
|
116
116
|
if (!r) return {
|
|
117
117
|
status: "failed",
|
|
118
|
-
message:
|
|
118
|
+
message: F
|
|
119
119
|
};
|
|
120
120
|
let i = r.getBody();
|
|
121
121
|
if (!i || !x.isBlock(i)) return {
|
|
122
122
|
status: "failed",
|
|
123
|
-
message:
|
|
123
|
+
message: F
|
|
124
124
|
};
|
|
125
125
|
let a = g(r);
|
|
126
126
|
if (a.kind === "unsupported") return {
|
|
127
127
|
status: "failed",
|
|
128
|
-
message:
|
|
128
|
+
message: F
|
|
129
129
|
};
|
|
130
130
|
let s = h(r, i), c = s && f(s);
|
|
131
131
|
if (!s || !c) return {
|
|
132
132
|
status: "failed",
|
|
133
|
-
message:
|
|
133
|
+
message: F
|
|
134
134
|
};
|
|
135
135
|
let m = a.kind === "identifier" ? a.name : "event";
|
|
136
136
|
if (!l(c, "cms")) {
|
|
@@ -138,7 +138,7 @@ function F(e, t = k) {
|
|
|
138
138
|
e === -1 ? c.addShorthandPropertyAssignment({ name: "cms" }) : c.insertShorthandPropertyAssignment(e, { name: "cms" });
|
|
139
139
|
}
|
|
140
140
|
let v = i.getStatementsWithComments().indexOf(s);
|
|
141
|
-
if (i.insertStatements(v, `\n${
|
|
141
|
+
if (i.insertStatements(v, `\n${M(m, t.expression(m))}\n`), a.kind === "binding") {
|
|
142
142
|
let e = a.pattern.getText();
|
|
143
143
|
i.insertStatements(0, `const ${e} = ${m};`);
|
|
144
144
|
let t = a.param.getTypeNode()?.getText();
|
|
@@ -152,7 +152,7 @@ function F(e, t = k) {
|
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
154
|
// src/patterns/enable/cms/modifies/layout.ts
|
|
155
|
-
var
|
|
155
|
+
var L = c`
|
|
156
156
|
Forward the server load's data through the root +layout.ts, so \`cms\` reaches
|
|
157
157
|
the page:
|
|
158
158
|
|
|
@@ -161,7 +161,7 @@ var I = c`
|
|
|
161
161
|
return { ...data, /* existing keys */ };
|
|
162
162
|
};
|
|
163
163
|
`;
|
|
164
|
-
function
|
|
164
|
+
function R(e) {
|
|
165
165
|
if (!y.existsSync(e)) return {
|
|
166
166
|
status: "success",
|
|
167
167
|
changed: !1
|
|
@@ -174,17 +174,17 @@ function L(e) {
|
|
|
174
174
|
let r = n.getBody();
|
|
175
175
|
if (!r || !x.isBlock(r)) return {
|
|
176
176
|
status: "failed",
|
|
177
|
-
message:
|
|
177
|
+
message: L
|
|
178
178
|
};
|
|
179
179
|
let i = g(n);
|
|
180
180
|
if (i.kind === "unsupported") return {
|
|
181
181
|
status: "failed",
|
|
182
|
-
message:
|
|
182
|
+
message: L
|
|
183
183
|
};
|
|
184
184
|
let a = h(n, r);
|
|
185
185
|
if (!a) return {
|
|
186
186
|
status: "failed",
|
|
187
|
-
message:
|
|
187
|
+
message: L
|
|
188
188
|
};
|
|
189
189
|
let s = i.kind === "identifier" ? `${i.name}.data` : "data", c = a.getExpression();
|
|
190
190
|
if (c && c.getText() === s) return {
|
|
@@ -194,7 +194,7 @@ function L(e) {
|
|
|
194
194
|
let l = f(a);
|
|
195
195
|
if (!l) return {
|
|
196
196
|
status: "failed",
|
|
197
|
-
message:
|
|
197
|
+
message: L
|
|
198
198
|
};
|
|
199
199
|
if (m(l, s)) return {
|
|
200
200
|
status: "success",
|
|
@@ -212,31 +212,31 @@ function L(e) {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
// src/patterns/enable/cms/modifies/layout.svelte.ts
|
|
215
|
-
var
|
|
215
|
+
var z = c`
|
|
216
216
|
import { AdminBar } from '@velastack/cms';
|
|
217
|
-
`,
|
|
217
|
+
`, B = "\n<AdminBar />\n", V = [
|
|
218
218
|
"Create the root src/routes/+layout.svelte and mount <AdminBar /> inside it.",
|
|
219
219
|
"",
|
|
220
220
|
"Import for the <script> tag:",
|
|
221
221
|
"",
|
|
222
|
-
|
|
222
|
+
z,
|
|
223
223
|
"",
|
|
224
224
|
"Markup to add at the top level of the layout, above {@render children()}:",
|
|
225
|
-
|
|
226
|
-
].join("\n"),
|
|
225
|
+
B.trim()
|
|
226
|
+
].join("\n"), H = [
|
|
227
227
|
"Mount <AdminBar /> in the root src/routes/+layout.svelte.",
|
|
228
228
|
"",
|
|
229
229
|
"Import for a <script lang=\"ts\"> tag:",
|
|
230
230
|
"",
|
|
231
|
-
|
|
231
|
+
z,
|
|
232
232
|
"",
|
|
233
233
|
"Markup to add at the top level of the layout, above {@render children()}:",
|
|
234
|
-
|
|
234
|
+
B.trim()
|
|
235
235
|
].join("\n");
|
|
236
|
-
function
|
|
236
|
+
function U(e) {
|
|
237
237
|
if (!y.existsSync(e)) return {
|
|
238
238
|
status: "not-found",
|
|
239
|
-
message:
|
|
239
|
+
message: V
|
|
240
240
|
};
|
|
241
241
|
let t = v.fromPath(e);
|
|
242
242
|
return t.hasElement("AdminBar") ? {
|
|
@@ -250,16 +250,16 @@ function H(e) {
|
|
|
250
250
|
}]);
|
|
251
251
|
});
|
|
252
252
|
return t;
|
|
253
|
-
}), t.insertBeforeChildren(
|
|
253
|
+
}), t.insertBeforeChildren(B) || t.appendMarkup(B), t.writeTo(e), {
|
|
254
254
|
status: "success",
|
|
255
255
|
changed: t.hasChanged()
|
|
256
256
|
}) : {
|
|
257
257
|
status: "failed",
|
|
258
|
-
message:
|
|
258
|
+
message: H
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
261
|
// src/patterns/enable/cms/generate.runtime.ts
|
|
262
|
-
function
|
|
262
|
+
function W(e) {
|
|
263
263
|
let t = b.join(e, "wuchale.config.js");
|
|
264
264
|
if (!y.existsSync(t)) return null;
|
|
265
265
|
let n = y.readFileSync(t, "utf8").match(/locales:\s*\[([^\]]*)\]/);
|
|
@@ -267,24 +267,24 @@ function U(e) {
|
|
|
267
267
|
let r = [...n[1].matchAll(/['"]([^'"]+)['"]/g)].map((e) => e[1]);
|
|
268
268
|
return r.length > 0 ? r : null;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function G(e, t) {
|
|
271
271
|
if (e.local) return "";
|
|
272
272
|
let n = t.map((e) => `'${e}'`).join(", ");
|
|
273
273
|
return `{ endpoint: '${e.endpoint}', locales: [${n}] }`;
|
|
274
274
|
}
|
|
275
|
-
async function
|
|
275
|
+
async function K(a) {
|
|
276
276
|
let o = e(a), s = [], c = i(a), l = a.features.i18n, u = (e) => {
|
|
277
277
|
e && s.push(e);
|
|
278
278
|
};
|
|
279
279
|
o.info("Modifying vite.config");
|
|
280
|
-
let d = n(a.root, r) ?? b.join(a.root, r[0]), f = l &&
|
|
281
|
-
u(t(d, O(d,
|
|
282
|
-
let p = b.join(a.root, "src", "routes", "+layout.server.ts");
|
|
283
|
-
u(t(p,
|
|
284
|
-
let
|
|
285
|
-
u(t(
|
|
286
|
-
let
|
|
287
|
-
return u(t(
|
|
280
|
+
let d = n(a.root, r) ?? b.join(a.root, r[0]), f = l && W(a.root) || ["en"];
|
|
281
|
+
u(t(d, O(d, G(c, f)))), o.info("Modifying src/routes/+layout.server.ts");
|
|
282
|
+
let p = b.join(a.root, "src", "routes", "+layout.server.ts"), m = y.existsSync(b.join(a.root, "src", "lib", "locale.ts"));
|
|
283
|
+
u(t(p, I(p, l ? m ? A : j : k))), o.info("Modifying src/routes/+layout.ts");
|
|
284
|
+
let h = b.join(a.root, "src", "routes", "+layout.ts");
|
|
285
|
+
u(t(h, R(h))), o.info("Modifying src/routes/+layout.svelte");
|
|
286
|
+
let g = b.join(a.root, "src", "routes", "+layout.svelte");
|
|
287
|
+
return u(t(g, U(g))), {
|
|
288
288
|
creates: [],
|
|
289
289
|
modifies: s,
|
|
290
290
|
deletes: [],
|
|
@@ -295,6 +295,6 @@ async function G(a) {
|
|
|
295
295
|
collectionDrops: []
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
-
export {
|
|
298
|
+
export { K as generate };
|
|
299
299
|
|
|
300
|
-
//# sourceMappingURL=generate.runtime-
|
|
300
|
+
//# sourceMappingURL=generate.runtime-pbIrEsa7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-pbIrEsa7.js","names":["FAILURE_HINT","NOT_FOUND_HINT","FAILURE_HINT","FAILURE_HINT","getLogger","modifyOutcomeToFile","probeFirstExisting","VITE_CONFIG_CANDIDATES","resolveMode","withInMemoryScript","ensureImports","dedent","hasProperty","newProject","findLoadFunction","returnedObject","ensureNamedImports","hasSpreadOf","findFinalReturn","inspectEventParameter","ensureImportSpec","SvelteFile","fs","path","FAILURE_HINT$3","NOT_FOUND_HINT$1","elementName","text","modifyViteConfig","call","pluginArgs","viteConfigPath","sourceFile","Project","QuoteKind","changed","failed","d","configArg","SyntaxKind","ce","configObj","pluginsProp","pluginsInit","arr","elements","el","sveltekitIndex","formatLikeSource","DEFAULT_LOCALE","REQUEST_LOCALE","eventName","WUCHALE_LOCALE","cmsSnippet","locale","importLine","parts","spec","createdLayoutServer","imports","snippet","FAILURE_HINT$2","modifyLayoutServer","layoutServerPath","fn","body","Node","event","returned","object","spreadIndex","property","returnIndex","destructuring","typeText","FAILURE_HINT$1","modifyLayoutUniversal","layoutPath","dataExpression","expression","element","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","FAILURE_HINT","modifyLayoutSvelte","file","out","source","sf","readWuchaleLocales","configPath","root","match","locales","m","vitePluginArgs","mode","list","generate","logger","options","modifies","i18n","pushResult","requestLocale","layoutUniversalPath","layoutSveltePath"],"sources":["../../src/patterns/enable/cms/modifies/vite-config.ts","../../src/patterns/enable/cms/modifies/layout.server.ts","../../src/patterns/enable/cms/modifies/layout.ts","../../src/patterns/enable/cms/modifies/layout.svelte.ts","../../src/patterns/enable/cms/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport {\n Project,\n QuoteKind,\n SyntaxKind,\n type ArrayLiteralExpression,\n type ObjectLiteralExpression,\n type PropertyAssignment,\n} from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = [\n \"Add the CMS plugin to your Vite config, ahead of sveltekit():\",\n \"\",\n \"import { cms } from '@velastack/cms/vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [cms(), sveltekit(), /* ...existing plugins */],\",\n \"});\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create a Vite config with the CMS plugin ahead of sveltekit():\",\n \"\",\n \"import { defineConfig } from 'vite';\",\n \"import { sveltekit } from '@sveltejs/kit/vite';\",\n \"import { cms } from '@velastack/cms/vite';\",\n \"\",\n \"export default defineConfig({\",\n \" plugins: [cms(), sveltekit()],\",\n \"});\",\n].join(\"\\n\");\n\nfunction elementName(text: string): string {\n return text.replace(/\\s/g, \"\");\n}\n\n/**\n * Registers `cms(...)` from `@velastack/cms/vite` in the Vite plugin list, just\n * ahead of `sveltekit()`. Only the plugin array is touched, so the inline\n * `sveltekit({ ... })` shape the templates use is left alone.\n */\nexport function modifyViteConfig(\n viteConfigPath: string,\n pluginArgs = \"\",\n): ModifyOutcome {\n const call = `cms(${pluginArgs})`;\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() === \"@velastack/cms/vite\");\n\n if (!hasImport) {\n sourceFile.insertImportDeclaration(0, {\n namedImports: [\"cms\"],\n moduleSpecifier: \"@velastack/cms/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 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: `[${call}]`,\n });\n changed = true;\n } else if (pluginsProp.getKind() !== SyntaxKind.PropertyAssignment) {\n failed = true;\n } else {\n const pluginsInit = (pluginsProp as PropertyAssignment).getInitializer();\n\n if (!pluginsInit) {\n (pluginsProp as PropertyAssignment).setInitializer(`[${call}]`);\n changed = true;\n } else if (pluginsInit.getKind() !== SyntaxKind.ArrayLiteralExpression) {\n failed = true;\n } else {\n const arr = pluginsInit as ArrayLiteralExpression;\n const elements = arr.getElements();\n const hasCms = elements.some((el) =>\n elementName(el.getText()).startsWith(\"cms(\"),\n );\n\n if (!hasCms) {\n const sveltekitIndex = elements.findIndex((el) =>\n elementName(el.getText()).startsWith(\"sveltekit(\"),\n );\n arr.insertElement(sveltekitIndex === -1 ? 0 : sveltekitIndex, call);\n changed = true;\n }\n }\n }\n }\n\n if (changed) {\n formatLikeSource(sourceFile);\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 fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Node } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport type { ImportSpec } from \"../../../../runtime/ts-morph-helpers\";\nimport {\n ensureImportSpec,\n ensureNamedImports,\n findFinalReturn,\n findLoadFunction,\n hasProperty,\n inspectEventParameter,\n newProject,\n returnedObject,\n} from \"../../../../runtime/load-function\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport interface LayoutServerLocale {\n /**\n * Expression passed as `locale` to `loadCms`, given the name of the load's\n * event parameter: `() => \"'en'\"` or `(event) => \\`getLocale(${event}.url)\\``.\n */\n expression: (eventName: string) => string;\n /** Imports the expression depends on. */\n imports?: ImportSpec[];\n}\n\n/** A single-locale site: the literal default locale. */\nexport const DEFAULT_LOCALE: LayoutServerLocale = {\n expression: () => \"'en'\",\n};\n\n/**\n * A wuchale site: the language enable-i18n's handle chose for the request,\n * from the URL on a public page and the visitor's preference elsewhere, so\n * the content is in the language the rest of the page is in.\n */\nexport const REQUEST_LOCALE: LayoutServerLocale = {\n expression: (eventName) => `${eventName}.locals.locale`,\n};\n\n/**\n * A wuchale site enabled before the handle set `locals.locale`: the locale\n * its reroute resolved from the URL.\n */\nexport const WUCHALE_LOCALE: LayoutServerLocale = {\n expression: (eventName) => `getLocale(${eventName}.url)`,\n imports: [\n { namedImports: [\"getLocale\"], moduleSpecifier: \"#locales/main.url.js\" },\n ],\n};\n\nfunction cmsSnippet(eventName: string, locale: string): string {\n return dedent`\n const { cms, notFound, gone, redirectTo } = await loadCms(${eventName}, { locale: ${locale} });\n if (redirectTo) redirect(308, redirectTo);\n if (gone) error(410, 'Gone');\n if (notFound) error(404, 'Not found');\n `;\n}\n\nfunction importLine(spec: ImportSpec): string {\n const parts: string[] = [];\n if (spec.defaultImport) parts.push(spec.defaultImport);\n if (spec.namespaceImport) parts.push(`* as ${spec.namespaceImport}`);\n if (spec.namedImports?.length)\n parts.push(`{ ${spec.namedImports.join(\", \")} }`);\n return `import ${parts.join(\", \")} from '${spec.moduleSpecifier}';`;\n}\n\n/**\n * A root `+layout.server.ts` written from scratch, for a project that has\n * none — the static template keeps its layout load universal.\n */\nexport function createdLayoutServer(locale: LayoutServerLocale): string {\n const imports = [\n \"import { error, redirect } from '@sveltejs/kit';\",\n \"import { loadCms } from '#lib/cms.js';\",\n ...(locale.imports ?? []).map(importLine),\n \"import type { LayoutServerLoad } from './$types';\",\n ].join(\"\\n\");\n const snippet = cmsSnippet(\"event\", locale.expression(\"event\"))\n .split(\"\\n\")\n .join(\"\\n\\t\");\n\n return dedent`\n ${imports}\n\n export const load: LayoutServerLoad = async (event) => {\n \t${snippet}\n\n \treturn { cms };\n };\n `.concat(\"\\n\");\n}\n\nconst FAILURE_HINT = [\n \"Call loadCms from the root +layout.server.ts load and return `cms`:\",\n \"\",\n createdLayoutServer(DEFAULT_LOCALE).trimEnd(),\n \"\",\n \"loadCms needs the whole event, so a destructured parameter has to become\",\n \"`event` with the destructuring moved into the body.\",\n].join(\"\\n\");\n\n/**\n * Wires `loadCms` into the root `+layout.server.ts`, creating the file when\n * the project has none:\n *\n * - `loadCms` needs the whole request event, so a destructured parameter is\n * renamed to `event` and the destructuring becomes the first statement.\n * - The tombstone triple (`redirectTo`, `gone`, `notFound`) is handled just\n * before the return.\n * - `cms` is added to the returned object, ahead of any spread so nothing\n * later can shadow it.\n *\n * Anything else — no exported `load`, an expression-bodied arrow, several\n * returns, a non-literal return — is reported as `failed` with the snippet to\n * paste, and the file is left exactly as it was.\n */\nexport function modifyLayoutServer(\n layoutServerPath: string,\n locale: LayoutServerLocale = DEFAULT_LOCALE,\n): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n fs.mkdirSync(path.dirname(layoutServerPath), { recursive: true });\n fs.writeFileSync(layoutServerPath, createdLayoutServer(locale));\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(layoutServerPath, \"utf8\");\n if (original.includes(\"loadCms(\")) {\n return { status: \"success\", changed: false };\n }\n\n const sourceFile = newProject().addSourceFileAtPath(layoutServerPath);\n\n // --- Inspect everything before touching anything. ---\n const fn = findLoadFunction(sourceFile);\n if (!fn) return { status: \"failed\", message: FAILURE_HINT };\n\n const body = fn.getBody();\n if (!body || !Node.isBlock(body)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const event = inspectEventParameter(fn);\n if (event.kind === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const returned = findFinalReturn(fn, body);\n const object = returned && returnedObject(returned);\n if (!returned || !object) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const eventName = event.kind === \"identifier\" ? event.name : \"event\";\n\n // --- Mutate bottom-up so earlier node references stay valid. ---\n if (!hasProperty(object, \"cms\")) {\n const spreadIndex = object\n .getProperties()\n .findIndex((property) => Node.isSpreadAssignment(property));\n if (spreadIndex === -1) {\n object.addShorthandPropertyAssignment({ name: \"cms\" });\n } else {\n object.insertShorthandPropertyAssignment(spreadIndex, { name: \"cms\" });\n }\n }\n\n // insertStatements counts comment lines, which getStatements() skips.\n const returnIndex = body.getStatementsWithComments().indexOf(returned);\n body.insertStatements(\n returnIndex,\n `\\n${cmsSnippet(eventName, locale.expression(eventName))}\\n`,\n );\n\n if (event.kind === \"binding\") {\n const destructuring = event.pattern.getText();\n body.insertStatements(0, `const ${destructuring} = ${eventName};`);\n const typeText = event.param.getTypeNode()?.getText();\n event.param.replaceWithText(\n typeText ? `${eventName}: ${typeText}` : eventName,\n );\n } else if (event.kind === \"none\") {\n fn.addParameter({ name: eventName });\n }\n\n if (!fn.isAsync()) fn.setIsAsync(true);\n\n ensureNamedImports(sourceFile, \"@sveltejs/kit\", [\"error\", \"redirect\"]);\n ensureNamedImports(sourceFile, \"#lib/cms.js\", [\"loadCms\"]);\n for (const spec of locale.imports ?? []) {\n ensureImportSpec(sourceFile, spec);\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Node } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n findFinalReturn,\n findLoadFunction,\n hasSpreadOf,\n inspectEventParameter,\n newProject,\n returnedObject,\n} from \"../../../../runtime/load-function\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Forward the server load's data through the root +layout.ts, so \\`cms\\` reaches\n the page:\n\n export const load = async ({ url, data }) => {\n // ...existing code...\n return { ...data, /* existing keys */ };\n };\n`;\n\n/**\n * Make a universal root \\`+layout.ts\\` forward its server load's data.\n *\n * SvelteKit hands a universal load the server load's result as \\`data\\`, and\n * only what the universal load returns reaches the page. A layout that\n * returns its own object without spreading \\`data\\` — the static template\n * does — would drop \\`cms\\` on the floor once \\`+layout.server.ts\\` exists.\n *\n * No file, or a file without a \\`load\\`, needs nothing: server data flows\n * through on its own.\n */\nexport function modifyLayoutUniversal(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const sourceFile = newProject().addSourceFileAtPath(layoutPath);\n\n const fn = findLoadFunction(sourceFile);\n if (!fn) return { status: \"success\", changed: false };\n\n const body = fn.getBody();\n if (!body || !Node.isBlock(body)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const event = inspectEventParameter(fn);\n if (event.kind === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const returned = findFinalReturn(fn, body);\n if (!returned) return { status: \"failed\", message: FAILURE_HINT };\n\n const dataExpression =\n event.kind === \"identifier\" ? `${event.name}.data` : \"data\";\n\n // `return data;` already forwards everything.\n const expression = returned.getExpression();\n if (expression && expression.getText() === dataExpression) {\n return { status: \"success\", changed: false };\n }\n\n const object = returnedObject(returned);\n if (!object) return { status: \"failed\", message: FAILURE_HINT };\n if (hasSpreadOf(object, dataExpression)) {\n return { status: \"success\", changed: false };\n }\n\n // --- Mutate bottom-up so earlier node references stay valid. ---\n // First, so the layout's own keys still win over anything the server sent.\n object.insertSpreadAssignment(0, { expression: dataExpression });\n\n if (event.kind === \"binding\") {\n const hasData = event.pattern\n .getElements()\n .some((element) => element.getName() === \"data\");\n if (!hasData) {\n const text = event.pattern.getText();\n event.pattern.replaceWithText(text.replace(/^\\{\\s*/, \"{ data, \"));\n }\n } else if (event.kind === \"none\") {\n fn.addParameter({ name: \"{ data }\" });\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\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 IMPORT_SNIPPET = dedent`\n import { AdminBar } from '@velastack/cms';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<AdminBar />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root src/routes/+layout.svelte and mount <AdminBar /> inside it.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout, above {@render children()}:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nconst FAILURE_HINT = [\n \"Mount <AdminBar /> in the root src/routes/+layout.svelte.\",\n \"\",\n 'Import for a <script lang=\"ts\"> tag:',\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout, above {@render children()}:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\n/**\n * Mounts `<AdminBar />` at the top level of the root layout, ahead of\n * `{@render children()}` so the bar is in the DOM before the page content.\n * Falls back to appending when the layout has no render tag or slot.\n */\nexport function modifyLayoutSvelte(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(\"AdminBar\")) {\n return { status: \"success\", changed: false };\n }\n if (!file.getScript()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n { namedImports: [\"AdminBar\"], moduleSpecifier: \"@velastack/cms\" },\n ]);\n });\n return out;\n });\n\n if (!file.insertBeforeChildren(MARKUP_SNIPPET)) {\n file.appendMarkup(MARKUP_SNIPPET);\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 {\n probeFirstExisting,\n VITE_CONFIG_CANDIDATES,\n} from \"../../../runtime/config-target\";\nimport { resolveMode, type CmsMode } from \"./generate\";\nimport { modifyViteConfig } from \"./modifies/vite-config\";\nimport {\n DEFAULT_LOCALE,\n REQUEST_LOCALE,\n WUCHALE_LOCALE,\n modifyLayoutServer,\n} from \"./modifies/layout.server\";\nimport { modifyLayoutUniversal } from \"./modifies/layout\";\nimport { modifyLayoutSvelte } from \"./modifies/layout.svelte\";\n\n/** The locale list from `wuchale.config.js`, or null when it cannot be read. */\nexport function readWuchaleLocales(root: string): string[] | null {\n const configPath = path.join(root, \"wuchale.config.js\");\n if (!fs.existsSync(configPath)) return null;\n const match = fs\n .readFileSync(configPath, \"utf8\")\n .match(/locales:\\s*\\[([^\\]]*)\\]/);\n if (!match) return null;\n const locales = [...match[1].matchAll(/['\"]([^'\"]+)['\"]/g)].map((m) => m[1]);\n return locales.length > 0 ? locales : null;\n}\n\n/**\n * Arguments for the `cms()` Vite plugin.\n *\n * A hosted CMS needs the endpoint and locales at build time so media can be\n * downloaded into the prerendered site. An app hosting the backend itself\n * needs nothing: the media steps are no-ops without an endpoint.\n */\nexport function vitePluginArgs(mode: CmsMode, locales: string[]): string {\n if (mode.local) return \"\";\n const list = locales.map((locale) => `'${locale}'`).join(\", \");\n return `{ endpoint: '${mode.endpoint}', locales: [${list}] }`;\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const mode = resolveMode(options);\n const i18n = options.features.i18n;\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 const locales = (i18n && readWuchaleLocales(options.root)) || [\"en\"];\n pushResult(\n modifyOutcomeToFile(\n viteConfigPath,\n modifyViteConfig(viteConfigPath, vitePluginArgs(mode, locales)),\n ),\n );\n\n logger.info(\"Modifying src/routes/+layout.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n // `src/lib/locale.ts` came with the handle that sets `locals.locale`.\n const requestLocale = fs.existsSync(\n path.join(options.root, \"src\", \"lib\", \"locale.ts\"),\n );\n const locale = !i18n\n ? DEFAULT_LOCALE\n : requestLocale\n ? REQUEST_LOCALE\n : WUCHALE_LOCALE;\n pushResult(\n modifyOutcomeToFile(\n layoutServerPath,\n modifyLayoutServer(layoutServerPath, locale),\n ),\n );\n\n // A universal root layout has to pass the server load's data along, or\n // `cms` never reaches the page. The static template has one.\n logger.info(\"Modifying src/routes/+layout.ts\");\n const layoutUniversalPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutUniversalPath,\n modifyLayoutUniversal(layoutUniversalPath),\n ),\n );\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const layoutSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(layoutSveltePath, modifyLayoutSvelte(layoutSveltePath)),\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":";;;;;;;;;;;;AAYA,IAAMA,IAAe,kNAUfC,IAAiB;AAYvB,SAASyB,EAAY,GAAsB;CACzC,OAAOC,EAAK,QAAQ,OAAO,EAAE;AAC/B;AAOA,SAAgBC,EACd,GACA,IAAa,IACE;CACf,IAAMC,IAAO,OAAOC,EAAW;CAC/B,IAAI,CAACR,EAAG,WAAWS,CAAc,GAC/B,OAAO;EAAE,QAAQ;EAAa,SAAS9B;CAAe;CAOxD,IAAM+B,IAAa,IAJCC,EAAQ;EAC1B,iBAAiB,EAAE,SAAS,GAAK;EACjC,sBAAsB,EAAE,WAAWC,EAAU,OAAO;CACtD,CACmB,CAAA,CAAQ,oBAAoBH,CAAc,GAEzDI,IAAU,IACVC,IAAS;CAMb,AAJkBJ,EACf,sBAAsB,CAAC,CACvB,MAAM,MAAMK,EAAE,wBAAwB,MAAM,qBAE1C,MACHL,EAAW,wBAAwB,GAAG;EACpC,cAAc,CAAC,KAAK;EACpB,iBAAiB;CACnB,CAAC,GACD,IAAU;CAOZ,IAAMM,IAJmBN,EACtB,qBAAqBO,EAAW,cAAc,CAAC,CAC/C,MAAM,MAAOC,EAAG,cAAc,CAAC,CAAC,QAAQ,MAAM,cAE/B,CAAA,EAAkB,aAAa,CAAC,GAAG,IAC/CC,IACJH,GAAW,QAAQ,MAAMC,EAAW,0BAC/BD,IACD;CAEN,IAAI,CAACG,GACH,IAAS;MACJ;EACL,IAAMC,IAAcD,EAAU,YAAY,SAAS;EACnD,IAAI,CAACC,GAKH,AAJAD,EAAU,sBAAsB;GAC9B,MAAM;GACN,aAAa,IAAIZ,EAAK;EACxB,CAAC,GACD,IAAU;OACL,IAAIa,EAAY,QAAQ,MAAMH,EAAW,oBAC9C,IAAS;OACJ;GACL,IAAMI,I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EAAmBC,GARPwC,IAEZE,IACEvD,IACAE,IAHFH,CAO2C,CAC7C,CACF,GAIAmD,EAAO,KAAK,iCAAiC;CAC7C,IAAMM,IAAsBnF,EAAK,KAC/B8E,EAAQ,MACR,OACA,UACA,YACF;CAQA,AAPAG,EACEnG,EACEqG,GACA9B,EAAsB8B,CAAmB,CAC3C,CACF,GAEAN,EAAO,KAAK,qCAAqC;CACjD,IAAMO,IAAmBpF,EAAK,KAC5B8E,EAAQ,MACR,OACA,UACA,gBACF;CAKA,OAJAG,EACEnG,EAAoBsG,GAAkBtB,EAAmBsB,CAAgB,CAAC,CAC5E,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { r as t } from "./modify-file-CRZ_gMg0.js";
|
|
3
|
+
import { i as n, n as r, r as i, t as a } from "./translations-CiJnl574.js";
|
|
4
|
+
import { n as o, r as s } from "./app-layout.svelte-CZ0hw-pi.js";
|
|
5
|
+
import c from "node:fs";
|
|
6
|
+
import l from "node:path";
|
|
7
|
+
// src/patterns/enable/auth/i18n.ts
|
|
8
|
+
function u(u) {
|
|
9
|
+
let d = e(u), f = [], p = [];
|
|
10
|
+
if (!c.existsSync(l.join(u.root, "wuchale.config.js"))) return {
|
|
11
|
+
creates: f,
|
|
12
|
+
modifies: p
|
|
13
|
+
};
|
|
14
|
+
d.info("Adding the language select to the signed-in layout");
|
|
15
|
+
let m = l.join(u.root, o), h = t(m, s(m));
|
|
16
|
+
if (h && p.push(h), i(u.root)) {
|
|
17
|
+
d.info("Translating the sign-in pages into Spanish");
|
|
18
|
+
let e = n(u.root, r(u.root, a));
|
|
19
|
+
e.create && f.push(e.create), e.modify && p.push(e.modify);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
creates: f,
|
|
23
|
+
modifies: p
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export { u as localizeAuthPages };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=i18n-BHCytiiO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n-BHCytiiO.js","names":["getLogger","modifyOutcomeToFile","translateCatalog","entriesInProject","hasSpanish","AUTH_TRANSLATIONS","APP_LAYOUT_PATH","modifyAppLayoutLanguageSelect","fs","path","localizeAuthPages","logger","options","creates","modifies","appLayoutFile","select","translated"],"sources":["../../src/patterns/enable/auth/i18n.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport {\n entriesInProject,\n hasSpanish,\n translateCatalog,\n} from \"../../../runtime/wuchale-catalog\";\nimport {\n APP_LAYOUT_PATH,\n modifyAppLayoutLanguageSelect,\n} from \"../i18n/modifies/app-layout.svelte\";\nimport { AUTH_TRANSLATIONS } from \"./translations\";\n\n/**\n * What enable-i18n would have done to the auth pages had they been in the\n * project when it ran: the language select in the signed-in layout, and the\n * pages' Spanish in the catalog. For enable-auth and enable-auth-remote, in a\n * project that already has i18n; nothing happens in one that does not.\n *\n * Reads the pages from disk, so it runs after the pattern's creates are\n * written. Detected by the files enable-i18n wrote rather than\n * `features.i18n`, so a project that dropped Spanish keeps its catalog as it\n * is.\n */\nexport function localizeAuthPages(options: Options): {\n creates: File[];\n modifies: File[];\n} {\n const logger = getLogger(options);\n const creates: File[] = [];\n const modifies: File[] = [];\n if (!fs.existsSync(path.join(options.root, \"wuchale.config.js\"))) {\n return { creates, modifies };\n }\n\n logger.info(\"Adding the language select to the signed-in layout\");\n const appLayoutFile = path.join(options.root, APP_LAYOUT_PATH);\n const select = modifyOutcomeToFile(\n appLayoutFile,\n modifyAppLayoutLanguageSelect(appLayoutFile),\n );\n if (select) modifies.push(select);\n\n if (hasSpanish(options.root)) {\n logger.info(\"Translating the sign-in pages into Spanish\");\n const translated = translateCatalog(\n options.root,\n entriesInProject(options.root, AUTH_TRANSLATIONS),\n );\n if (translated.create) creates.push(translated.create);\n if (translated.modify) modifies.push(translated.modify);\n }\n\n return { creates, modifies };\n}\n"],"mappings":";;;;;;;AA2BA,SAAgBU,EAAkB,GAGhC;CACA,IAAMC,IAASX,EAAUY,CAAO,GAC1BC,IAAkB,CAAC,GACnBC,IAAmB,CAAC;CAC1B,IAAI,CAACN,EAAG,WAAWC,EAAK,KAAKG,EAAQ,MAAM,mBAAmB,CAAC,GAC7D,OAAO;EAAE;EAAS;CAAS;CAG7B,EAAO,KAAK,oDAAoD;CAChE,IAAMG,IAAgBN,EAAK,KAAKG,EAAQ,MAAMN,CAAe,GACvDU,IAASf,EACbc,GACAR,EAA8BQ,CAAa,CAC7C;CAGA,IAFIC,KAAQF,EAAS,KAAKE,CAAM,GAE5BZ,EAAWQ,EAAQ,IAAI,GAAG;EAC5B,EAAO,KAAK,4CAA4C;EACxD,IAAMK,IAAaf,EACjBU,EAAQ,MACRT,EAAiBS,EAAQ,MAAMP,CAAiB,CAClD;EAEA,AADIY,EAAW,UAAQJ,EAAQ,KAAKI,EAAW,MAAM,GACjDA,EAAW,UAAQH,EAAS,KAAKG,EAAW,MAAM;CACxD;CAEA,OAAO;EAAE;EAAS;CAAS;AAC7B"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import e from "node:fs";
|
|
2
|
+
import t from "node:path";
|
|
3
|
+
// src/runtime/wuchale-catalog.ts
|
|
4
|
+
var n = "src/locales/es.po", r = "msgid \"\"\nmsgstr \"\"\n\"Source-Language: en\\n\"\n\"Language: es\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Plural-Forms: nplurals=3\\n\"\n\"X-Plurals-Order: one, many, other\\n\"", i = (e) => `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n")}"`, a = (e) => e.replace(/\\(.)/g, (e, t) => t === "n" ? "\n" : t);
|
|
5
|
+
function o(e, t) {
|
|
6
|
+
let n = e.split("\n"), r = n.findIndex((e) => e.startsWith(`${t} "`));
|
|
7
|
+
if (r === -1) return null;
|
|
8
|
+
let i = [n[r].slice(t.length + 1)];
|
|
9
|
+
for (let e = r + 1; e < n.length && n[e].startsWith("\""); e++) i.push(n[e]);
|
|
10
|
+
return i.map((e) => a(e.trim().slice(1, -1))).join("");
|
|
11
|
+
}
|
|
12
|
+
function s(e) {
|
|
13
|
+
return [
|
|
14
|
+
`#: ${e.reference}`,
|
|
15
|
+
`msgid ${i(e.msgid)}`,
|
|
16
|
+
`msgstr ${i(e.msgstr)}`
|
|
17
|
+
].join("\n");
|
|
18
|
+
}
|
|
19
|
+
function c(e, t) {
|
|
20
|
+
let n = (e ?? r).replace(/\s+$/, "").split(/\n{2,}/), a = /* @__PURE__ */ new Map();
|
|
21
|
+
n.forEach((e, t) => {
|
|
22
|
+
if (e.includes("\nmsgctxt ") || e.startsWith("msgctxt ") || e.includes("\nmsgid_plural ")) return;
|
|
23
|
+
let n = o(e, "msgid");
|
|
24
|
+
n && a.set(n, t);
|
|
25
|
+
});
|
|
26
|
+
let c = e === null;
|
|
27
|
+
for (let e of t) {
|
|
28
|
+
let t = a.get(e.msgid);
|
|
29
|
+
t === void 0 ? (a.set(e.msgid, n.length), n.push(s(e)), c = !0) : o(n[t], "msgstr") === "" && (n[t] = n[t].replace(/^msgstr ""$/m, `msgstr ${i(e.msgstr)}`), c = !0);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
source: c ? n.join("\n\n") + "\n" : e ?? "",
|
|
33
|
+
changed: c
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function l(n, r) {
|
|
37
|
+
let i = /* @__PURE__ */ new Map();
|
|
38
|
+
return r.filter((r) => (i.has(r.reference) || i.set(r.reference, e.existsSync(t.join(n, r.reference))), i.get(r.reference)));
|
|
39
|
+
}
|
|
40
|
+
function u(n) {
|
|
41
|
+
let r = t.join(n, "wuchale.config.js");
|
|
42
|
+
if (!e.existsSync(r)) return !1;
|
|
43
|
+
let i = /\blocales\s*:\s*\[([^\]]*)\]/.exec(e.readFileSync(r, "utf8"));
|
|
44
|
+
return i !== null && /["']es["']/.test(i[1]);
|
|
45
|
+
}
|
|
46
|
+
function d(r, i) {
|
|
47
|
+
let a = {
|
|
48
|
+
create: null,
|
|
49
|
+
modify: null
|
|
50
|
+
};
|
|
51
|
+
if (i.length === 0) return a;
|
|
52
|
+
let o = t.join(r, n);
|
|
53
|
+
if (!e.existsSync(o)) return {
|
|
54
|
+
create: {
|
|
55
|
+
path: n,
|
|
56
|
+
language: "text",
|
|
57
|
+
content: c(null, i).source,
|
|
58
|
+
status: "success"
|
|
59
|
+
},
|
|
60
|
+
modify: null
|
|
61
|
+
};
|
|
62
|
+
let s = c(e.readFileSync(o, "utf8"), i);
|
|
63
|
+
return s.changed ? (e.writeFileSync(o, s.source), {
|
|
64
|
+
create: null,
|
|
65
|
+
modify: {
|
|
66
|
+
path: o,
|
|
67
|
+
language: "text",
|
|
68
|
+
content: s.source,
|
|
69
|
+
status: "success"
|
|
70
|
+
}
|
|
71
|
+
}) : a;
|
|
72
|
+
}
|
|
73
|
+
// src/patterns/enable/auth/translations.ts
|
|
74
|
+
var f = "src/routes/(public)/(auth)", p = "src/routes/(app)", m = `${f}/login/+page.svelte`, h = `${f}/signup/+page.svelte`, g = `${p}/settings/+page.svelte`, _ = (e, t) => Object.entries(t).map(([t, n]) => ({
|
|
75
|
+
reference: e,
|
|
76
|
+
msgid: t,
|
|
77
|
+
msgstr: n
|
|
78
|
+
})), v = [
|
|
79
|
+
..._(m, {
|
|
80
|
+
Login: "Iniciar sesión",
|
|
81
|
+
Logout: "Cerrar sesión",
|
|
82
|
+
Settings: "Configuración",
|
|
83
|
+
Dashboard: "Panel",
|
|
84
|
+
"Choose a login method": "Elige cómo iniciar sesión",
|
|
85
|
+
"Use your email to login": "Usa tu correo para iniciar sesión",
|
|
86
|
+
"Welcome back": "Qué gusto verte de nuevo",
|
|
87
|
+
"Login is disabled": "El inicio de sesión está desactivado",
|
|
88
|
+
"Check back later for login options": "Vuelve más tarde para ver las opciones de inicio de sesión",
|
|
89
|
+
"<0/> Login with {0}": "<0/> Iniciar sesión con {0}",
|
|
90
|
+
"Or continue with": "O continúa con",
|
|
91
|
+
Email: "Correo electrónico",
|
|
92
|
+
Password: "Contraseña",
|
|
93
|
+
"Forgot your password?": "¿Olvidaste tu contraseña?",
|
|
94
|
+
"Use one-time code instead": "Usar un código de un solo uso",
|
|
95
|
+
"Continue with password": "Continuar con contraseña",
|
|
96
|
+
"Send one-time code": "Enviar código de un solo uso",
|
|
97
|
+
"Don't have an account? <0>Sign up</0>": "¿No tienes una cuenta? <0>Regístrate</0>",
|
|
98
|
+
"By clicking continue, you agree to our <0>Terms of Service</0> and <1>Privacy Policy</1>.": "Al continuar, aceptas nuestros <0>Términos del servicio</0> y nuestra <1>Política de privacidad</1>."
|
|
99
|
+
}),
|
|
100
|
+
..._(`${f}/login/+page.ts`, { "Log in": "Iniciar sesión" }),
|
|
101
|
+
..._(h, {
|
|
102
|
+
"Choose a sign up method": "Elige cómo registrarte",
|
|
103
|
+
"Use your email to sign up": "Usa tu correo para registrarte",
|
|
104
|
+
"Create an account": "Crea una cuenta",
|
|
105
|
+
"Signups are disabled": "El registro está desactivado",
|
|
106
|
+
"Check back later for signup options": "Vuelve más tarde para ver las opciones de registro",
|
|
107
|
+
"<0/> Sign up with {0}": "<0/> Registrarte con {0}",
|
|
108
|
+
"Confirm Password": "Confirmar contraseña",
|
|
109
|
+
"Create account": "Crear cuenta",
|
|
110
|
+
"Already have an account? <0>Log in</0>": "¿Ya tienes una cuenta? <0>Inicia sesión</0>"
|
|
111
|
+
}),
|
|
112
|
+
..._(`${f}/signup/+page.ts`, { "Sign up": "Crear cuenta" }),
|
|
113
|
+
..._(`${f}/signup/+page.server.ts`, {
|
|
114
|
+
"Failed to send the code.": "No pudimos enviar el código.",
|
|
115
|
+
"We sent a confirmation link to your email.": "Te enviamos un enlace de confirmación a tu correo."
|
|
116
|
+
}),
|
|
117
|
+
..._(`${f}/reset/+page.svelte`, {
|
|
118
|
+
"Reset your password": "Restablece tu contraseña",
|
|
119
|
+
"Enter your email to reset your password": "Escribe tu correo para restablecer tu contraseña",
|
|
120
|
+
"Send reset link": "Enviar enlace",
|
|
121
|
+
"Remembered your password? <0>Log in</0>": "¿Recordaste tu contraseña? <0>Inicia sesión</0>"
|
|
122
|
+
}),
|
|
123
|
+
..._(`${f}/reset/+page.ts`, { "Reset password": "Restablecer contraseña" }),
|
|
124
|
+
..._(`${f}/reset/+page.server.ts`, { "We sent a password reset link to your email.": "Te enviamos un enlace a tu correo para restablecer tu contraseña." }),
|
|
125
|
+
..._(`${f}/confirm-reset/[token]/+page.svelte`, { "Enter your new password": "Escribe tu nueva contraseña" }),
|
|
126
|
+
..._(`${f}/confirm-reset/[token]/+page.ts`, { "Confirm password reset": "Confirmar restablecimiento de contraseña" }),
|
|
127
|
+
..._(`${f}/confirm-reset/[token]/+page.server.ts`, { "Password reset successfully.": "Tu contraseña se restableció correctamente." }),
|
|
128
|
+
..._(`${f}/confirm-email-change/[token]/+page.svelte`, {
|
|
129
|
+
"Confirm email change": "Confirmar cambio de correo",
|
|
130
|
+
"Confirm your email change": "Confirma el cambio de correo",
|
|
131
|
+
"Enter your password to confirm your email change": "Escribe tu contraseña para confirmar el cambio de correo"
|
|
132
|
+
}),
|
|
133
|
+
..._(`${f}/confirm-email-change/[token]/+page.server.ts`, { "Email changed successfully.": "Tu correo se cambió correctamente." }),
|
|
134
|
+
..._(`${f}/otp/[token]/+page.svelte`, {
|
|
135
|
+
"Verify code": "Verificar código",
|
|
136
|
+
"Enter your OTP code": "Escribe tu código",
|
|
137
|
+
"Enter the code sent to your email": "Escribe el código que enviamos a tu correo",
|
|
138
|
+
"OTP code": "Código de un solo uso"
|
|
139
|
+
}),
|
|
140
|
+
..._(`${f}/welcome/+page.svelte`, {
|
|
141
|
+
"Welcome!": "¡Te damos la bienvenida!",
|
|
142
|
+
"What should we call you?": "¿Cómo quieres que te llamemos?",
|
|
143
|
+
Name: "Nombre",
|
|
144
|
+
Continue: "Continuar",
|
|
145
|
+
"Skip for now": "Omitir por ahora"
|
|
146
|
+
}),
|
|
147
|
+
..._(`${f}/welcome/+page.ts`, { Welcome: "Bienvenida" }),
|
|
148
|
+
..._(`${p}/+layout.server.ts`, { Home: "Inicio" }),
|
|
149
|
+
..._("src/lib/components/nav-user.svelte", {
|
|
150
|
+
"<0/> Light mode": "<0/> Modo claro",
|
|
151
|
+
"<0/> Dark mode": "<0/> Modo oscuro",
|
|
152
|
+
"<0/> Log out": "<0/> Cerrar sesión"
|
|
153
|
+
}),
|
|
154
|
+
..._(g, {
|
|
155
|
+
Profile: "Perfil",
|
|
156
|
+
"Your profile information.": "La información de tu perfil.",
|
|
157
|
+
Avatar: "Avatar",
|
|
158
|
+
"Upload a new avatar for your profile.": "Sube un nuevo avatar para tu perfil.",
|
|
159
|
+
"Remove avatar": "Quitar avatar",
|
|
160
|
+
"Upload new picture": "Subir nueva foto",
|
|
161
|
+
"Display email publicly": "Mostrar mi correo públicamente",
|
|
162
|
+
"By clicking this checkbox, your email will be displayed publicly.": "Al marcar esta casilla, tu correo se mostrará públicamente.",
|
|
163
|
+
"Save changes": "Guardar cambios",
|
|
164
|
+
"The email address associated with your account.": "El correo electrónico asociado a tu cuenta.",
|
|
165
|
+
Verified: "Verificado",
|
|
166
|
+
Unverified: "Sin verificar",
|
|
167
|
+
"Resend verification email": "Reenviar correo de verificación",
|
|
168
|
+
"Change email": "Cambiar correo",
|
|
169
|
+
"Enter your new email address. You will receive a verification email.": "Escribe tu nuevo correo electrónico. Recibirás un correo de verificación.",
|
|
170
|
+
"Your password is used to log in to your account.": "Tu contraseña se usa para iniciar sesión en tu cuenta.",
|
|
171
|
+
"New password": "Nueva contraseña",
|
|
172
|
+
"Confirm new password": "Confirmar nueva contraseña",
|
|
173
|
+
"Update password": "Actualizar contraseña"
|
|
174
|
+
}),
|
|
175
|
+
..._(`${p}/settings/+page.server.ts`, {
|
|
176
|
+
"Profile updated successfully.": "Tu perfil se actualizó correctamente.",
|
|
177
|
+
"We sent a confirmation link to your new email.": "Te enviamos un enlace de confirmación a tu nuevo correo.",
|
|
178
|
+
"Password updated successfully.": "Tu contraseña se actualizó correctamente.",
|
|
179
|
+
"Your account has no email.": "Tu cuenta no tiene correo.",
|
|
180
|
+
"We sent a verification email to your email.": "Te enviamos un correo de verificación."
|
|
181
|
+
}),
|
|
182
|
+
..._(`${f}/login/form.remote.ts`, { "Failed to authenticate.": "No pudimos iniciar tu sesión." }),
|
|
183
|
+
..._(`${f}/signup/form.remote.ts`, { "Failed to create account.": "No pudimos crear tu cuenta." }),
|
|
184
|
+
..._(`${f}/otp/[token]/form.remote.ts`, { "Failed to verify code.": "No pudimos verificar el código." }),
|
|
185
|
+
..._(`${p}/settings/form.remote.ts`, { "Upload new picture <0/>": "Subir nueva foto <0/>" })
|
|
186
|
+
];
|
|
187
|
+
export { c as a, d as i, l as n, u as r, v as t };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=translations-CiJnl574.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations-CiJnl574.js","names":["fs","path","SPANISH_CATALOG","HEADER","quote","text","unquote","char","field","lines","block","at","line","keyword","parts","i","part","entryBlock","entry","withTranslations","blocks","source","byMsgid","msgid","index","changed","entries","entriesInProject","present","root","hasSpanish","configPath","locales","translateCatalog","none","catalogPath","result","AUTH","APP","LOGIN","SIGNUP","SETTINGS","messages","translations","msgstr","AUTH_TRANSLATIONS"],"sources":["../../src/runtime/wuchale-catalog.ts","../../src/patterns/enable/auth/translations.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File } from \"../core/types\";\n\n/**\n * `src/locales/es.po`: the Spanish a pattern ships for the pages it writes.\n *\n * enable-i18n sets a project up with English and Spanish, and wuchale leaves\n * a message it has no translation for in English without saying so. A pattern\n * whose pages a visitor reads keeps the Spanish for them as a list of\n * entries; whichever of the two patterns is enabled second merges that list\n * into the catalog: enable-i18n for the pages already in the project, the\n * other pattern for its own pages when the project already has i18n.\n *\n * Only what is missing is filled in. A translation the developer wrote, or\n * changed, is never replaced.\n */\nexport const SPANISH_CATALOG = \"src/locales/es.po\";\n\nexport interface CatalogEntry {\n /** The message as wuchale extracts it (`Don't have an account? <0>Sign up</0>`). */\n msgid: string;\n msgstr: string;\n /** A file the message is in, relative to the project root. */\n reference: string;\n}\n\n// What wuchale writes for `es`. It rewrites the file on the next extraction,\n// keeping the translations and adding the source locale's catalog.\nconst HEADER = [\n 'msgid \"\"',\n 'msgstr \"\"',\n '\"Source-Language: en\\\\n\"',\n '\"Language: es\\\\n\"',\n '\"MIME-Version: 1.0\\\\n\"',\n '\"Content-Type: text/plain; charset=utf-8\\\\n\"',\n '\"Content-Transfer-Encoding: 8bit\\\\n\"',\n '\"Plural-Forms: nplurals=3\\\\n\"',\n '\"X-Plurals-Order: one, many, other\\\\n\"',\n].join(\"\\n\");\n\nconst quote = (text: string) =>\n `\"${text.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"').replace(/\\n/g, \"\\\\n\")}\"`;\n\nconst unquote = (text: string) =>\n text.replace(/\\\\(.)/g, (_, char: string) => (char === \"n\" ? \"\\n\" : char));\n\n/** A `msgid` or `msgstr` value: the quoted string, and any continuation lines. */\nfunction field(block: string, keyword: \"msgid\" | \"msgstr\"): string | null {\n const lines = block.split(\"\\n\");\n const at = lines.findIndex((line) => line.startsWith(`${keyword} \"`));\n if (at === -1) return null;\n const parts = [lines[at].slice(keyword.length + 1)];\n for (let i = at + 1; i < lines.length && lines[i].startsWith('\"'); i++) {\n parts.push(lines[i]);\n }\n return parts.map((part) => unquote(part.trim().slice(1, -1))).join(\"\");\n}\n\nfunction entryBlock(entry: CatalogEntry): string {\n return [\n `#: ${entry.reference}`,\n `msgid ${quote(entry.msgid)}`,\n `msgstr ${quote(entry.msgstr)}`,\n ].join(\"\\n\");\n}\n\n/**\n * `source` (a `.po` catalog, or null for a project that has none yet) with\n * `entries` filled in: an entry the catalog lacks is added, one it holds\n * untranslated gets its translation, and one that is translated is left as\n * it is. Plural and context entries are not touched.\n */\nexport function withTranslations(\n source: string | null,\n entries: CatalogEntry[],\n): { source: string; changed: boolean } {\n const blocks = (source ?? HEADER).replace(/\\s+$/, \"\").split(/\\n{2,}/);\n const byMsgid = new Map<string, number>();\n blocks.forEach((block, index) => {\n if (block.includes(\"\\nmsgctxt \") || block.startsWith(\"msgctxt \")) return;\n if (block.includes(\"\\nmsgid_plural \")) return;\n const msgid = field(block, \"msgid\");\n if (msgid) byMsgid.set(msgid, index);\n });\n\n let changed = source === null;\n for (const entry of entries) {\n const index = byMsgid.get(entry.msgid);\n if (index === undefined) {\n byMsgid.set(entry.msgid, blocks.length);\n blocks.push(entryBlock(entry));\n changed = true;\n continue;\n }\n if (field(blocks[index], \"msgstr\") !== \"\") continue;\n // The untranslated `msgstr \"\"` is the last field of its block.\n blocks[index] = blocks[index].replace(\n /^msgstr \"\"$/m,\n `msgstr ${quote(entry.msgstr)}`,\n );\n changed = true;\n }\n\n return {\n source: changed ? blocks.join(\"\\n\\n\") + \"\\n\" : (source ?? \"\"),\n changed,\n };\n}\n\n/** The entries whose file is in the project. */\nexport function entriesInProject(\n root: string,\n entries: CatalogEntry[],\n): CatalogEntry[] {\n const present = new Map<string, boolean>();\n return entries.filter((entry) => {\n if (!present.has(entry.reference)) {\n present.set(\n entry.reference,\n fs.existsSync(path.join(root, entry.reference)),\n );\n }\n return present.get(entry.reference);\n });\n}\n\n/**\n * Whether the project's wuchale config still lists Spanish: `locales` is the\n * developer's to change, and a pattern does not bring a language back.\n */\nexport function hasSpanish(root: string): boolean {\n const configPath = path.join(root, \"wuchale.config.js\");\n if (!fs.existsSync(configPath)) return false;\n const locales = /\\blocales\\s*:\\s*\\[([^\\]]*)\\]/.exec(\n fs.readFileSync(configPath, \"utf8\"),\n );\n return locales !== null && /[\"']es[\"']/.test(locales[1]);\n}\n\n/**\n * Merge `entries` into the project's Spanish catalog. An existing catalog is\n * edited in place and returned as a modify; a project without one gets it as\n * a create, for the pattern's result to write. Both are empty when there is\n * nothing to add.\n */\nexport function translateCatalog(\n root: string,\n entries: CatalogEntry[],\n): { create: File | null; modify: File | null } {\n const none = { create: null, modify: null };\n if (entries.length === 0) return none;\n\n const catalogPath = path.join(root, SPANISH_CATALOG);\n if (!fs.existsSync(catalogPath)) {\n return {\n create: {\n path: SPANISH_CATALOG,\n language: \"text\",\n content: withTranslations(null, entries).source,\n status: \"success\",\n },\n modify: null,\n };\n }\n\n const result = withTranslations(\n fs.readFileSync(catalogPath, \"utf8\"),\n entries,\n );\n if (!result.changed) return none;\n fs.writeFileSync(catalogPath, result.source);\n return {\n create: null,\n modify: {\n path: catalogPath,\n language: \"text\",\n content: result.source,\n status: \"success\",\n },\n };\n}\n","import type { CatalogEntry } from \"../../../runtime/wuchale-catalog\";\n\nconst AUTH = \"src/routes/(public)/(auth)\";\nconst APP = \"src/routes/(app)\";\nconst LOGIN = `${AUTH}/login/+page.svelte`;\nconst SIGNUP = `${AUTH}/signup/+page.svelte`;\nconst SETTINGS = `${APP}/settings/+page.svelte`;\n\n/** The messages of one file, keyed by the text wuchale extracts. */\nconst messages = (\n reference: string,\n translations: Record<string, string>,\n): CatalogEntry[] =>\n Object.entries(translations).map(([msgid, msgstr]) => ({\n reference,\n msgid,\n msgstr,\n }));\n\n/**\n * Spanish for what enable-auth and enable-auth-remote write: the sign-in\n * pages, the signed-in shell and settings page, and the links they add to the\n * public navbar. Merged into `src/locales/es.po` by whichever of the auth\n * pattern and enable-i18n runs second (see `runtime/wuchale-catalog`).\n *\n * The keys are the messages as wuchale extracts them from the templates in\n * each pattern's `creates/`, so a template whose text changes needs its key\n * changed here: a\n * key that matches nothing is carried in the catalog and never shown. A\n * message used by several files is listed once, under the first.\n */\nexport const AUTH_TRANSLATIONS: CatalogEntry[] = [\n // The navbar links are in the root layout, which a project has with or\n // without auth, so they are filed under the page they lead to.\n ...messages(LOGIN, {\n Login: \"Iniciar sesión\",\n Logout: \"Cerrar sesión\",\n Settings: \"Configuración\",\n Dashboard: \"Panel\",\n\n \"Choose a login method\": \"Elige cómo iniciar sesión\",\n \"Use your email to login\": \"Usa tu correo para iniciar sesión\",\n \"Welcome back\": \"Qué gusto verte de nuevo\",\n \"Login is disabled\": \"El inicio de sesión está desactivado\",\n \"Check back later for login options\":\n \"Vuelve más tarde para ver las opciones de inicio de sesión\",\n \"<0/> Login with {0}\": \"<0/> Iniciar sesión con {0}\",\n \"Or continue with\": \"O continúa con\",\n Email: \"Correo electrónico\",\n Password: \"Contraseña\",\n \"Forgot your password?\": \"¿Olvidaste tu contraseña?\",\n \"Use one-time code instead\": \"Usar un código de un solo uso\",\n \"Continue with password\": \"Continuar con contraseña\",\n \"Send one-time code\": \"Enviar código de un solo uso\",\n \"Don't have an account? <0>Sign up</0>\":\n \"¿No tienes una cuenta? <0>Regístrate</0>\",\n \"By clicking continue, you agree to our <0>Terms of Service</0> and <1>Privacy Policy</1>.\":\n \"Al continuar, aceptas nuestros <0>Términos del servicio</0> y nuestra <1>Política de privacidad</1>.\",\n }),\n ...messages(`${AUTH}/login/+page.ts`, {\n \"Log in\": \"Iniciar sesión\",\n }),\n\n ...messages(SIGNUP, {\n \"Choose a sign up method\": \"Elige cómo registrarte\",\n \"Use your email to sign up\": \"Usa tu correo para registrarte\",\n \"Create an account\": \"Crea una cuenta\",\n \"Signups are disabled\": \"El registro está desactivado\",\n \"Check back later for signup options\":\n \"Vuelve más tarde para ver las opciones de registro\",\n \"<0/> Sign up with {0}\": \"<0/> Registrarte con {0}\",\n \"Confirm Password\": \"Confirmar contraseña\",\n \"Create account\": \"Crear cuenta\",\n \"Already have an account? <0>Log in</0>\":\n \"¿Ya tienes una cuenta? <0>Inicia sesión</0>\",\n }),\n ...messages(`${AUTH}/signup/+page.ts`, {\n \"Sign up\": \"Crear cuenta\",\n }),\n ...messages(`${AUTH}/signup/+page.server.ts`, {\n \"Failed to send the code.\": \"No pudimos enviar el código.\",\n \"We sent a confirmation link to your email.\":\n \"Te enviamos un enlace de confirmación a tu correo.\",\n }),\n\n ...messages(`${AUTH}/reset/+page.svelte`, {\n \"Reset your password\": \"Restablece tu contraseña\",\n \"Enter your email to reset your password\":\n \"Escribe tu correo para restablecer tu contraseña\",\n \"Send reset link\": \"Enviar enlace\",\n \"Remembered your password? <0>Log in</0>\":\n \"¿Recordaste tu contraseña? <0>Inicia sesión</0>\",\n }),\n ...messages(`${AUTH}/reset/+page.ts`, {\n \"Reset password\": \"Restablecer contraseña\",\n }),\n ...messages(`${AUTH}/reset/+page.server.ts`, {\n \"We sent a password reset link to your email.\":\n \"Te enviamos un enlace a tu correo para restablecer tu contraseña.\",\n }),\n\n ...messages(`${AUTH}/confirm-reset/[token]/+page.svelte`, {\n \"Enter your new password\": \"Escribe tu nueva contraseña\",\n }),\n ...messages(`${AUTH}/confirm-reset/[token]/+page.ts`, {\n \"Confirm password reset\": \"Confirmar restablecimiento de contraseña\",\n }),\n ...messages(`${AUTH}/confirm-reset/[token]/+page.server.ts`, {\n \"Password reset successfully.\":\n \"Tu contraseña se restableció correctamente.\",\n }),\n\n ...messages(`${AUTH}/confirm-email-change/[token]/+page.svelte`, {\n \"Confirm email change\": \"Confirmar cambio de correo\",\n \"Confirm your email change\": \"Confirma el cambio de correo\",\n \"Enter your password to confirm your email change\":\n \"Escribe tu contraseña para confirmar el cambio de correo\",\n }),\n ...messages(`${AUTH}/confirm-email-change/[token]/+page.server.ts`, {\n \"Email changed successfully.\": \"Tu correo se cambió correctamente.\",\n }),\n\n ...messages(`${AUTH}/otp/[token]/+page.svelte`, {\n \"Verify code\": \"Verificar código\",\n \"Enter your OTP code\": \"Escribe tu código\",\n \"Enter the code sent to your email\":\n \"Escribe el código que enviamos a tu correo\",\n \"OTP code\": \"Código de un solo uso\",\n }),\n\n ...messages(`${AUTH}/welcome/+page.svelte`, {\n \"Welcome!\": \"¡Te damos la bienvenida!\",\n \"What should we call you?\": \"¿Cómo quieres que te llamemos?\",\n Name: \"Nombre\",\n Continue: \"Continuar\",\n \"Skip for now\": \"Omitir por ahora\",\n }),\n ...messages(`${AUTH}/welcome/+page.ts`, {\n Welcome: \"Bienvenida\",\n }),\n\n ...messages(`${APP}/+layout.server.ts`, {\n Home: \"Inicio\",\n }),\n ...messages(\"src/lib/components/nav-user.svelte\", {\n \"<0/> Light mode\": \"<0/> Modo claro\",\n \"<0/> Dark mode\": \"<0/> Modo oscuro\",\n \"<0/> Log out\": \"<0/> Cerrar sesión\",\n }),\n\n ...messages(SETTINGS, {\n Profile: \"Perfil\",\n \"Your profile information.\": \"La información de tu perfil.\",\n Avatar: \"Avatar\",\n \"Upload a new avatar for your profile.\":\n \"Sube un nuevo avatar para tu perfil.\",\n \"Remove avatar\": \"Quitar avatar\",\n \"Upload new picture\": \"Subir nueva foto\",\n \"Display email publicly\": \"Mostrar mi correo públicamente\",\n \"By clicking this checkbox, your email will be displayed publicly.\":\n \"Al marcar esta casilla, tu correo se mostrará públicamente.\",\n \"Save changes\": \"Guardar cambios\",\n \"The email address associated with your account.\":\n \"El correo electrónico asociado a tu cuenta.\",\n Verified: \"Verificado\",\n Unverified: \"Sin verificar\",\n \"Resend verification email\": \"Reenviar correo de verificación\",\n \"Change email\": \"Cambiar correo\",\n \"Enter your new email address. You will receive a verification email.\":\n \"Escribe tu nuevo correo electrónico. Recibirás un correo de verificación.\",\n \"Your password is used to log in to your account.\":\n \"Tu contraseña se usa para iniciar sesión en tu cuenta.\",\n \"New password\": \"Nueva contraseña\",\n \"Confirm new password\": \"Confirmar nueva contraseña\",\n \"Update password\": \"Actualizar contraseña\",\n }),\n ...messages(`${APP}/settings/+page.server.ts`, {\n \"Profile updated successfully.\": \"Tu perfil se actualizó correctamente.\",\n \"We sent a confirmation link to your new email.\":\n \"Te enviamos un enlace de confirmación a tu nuevo correo.\",\n \"Password updated successfully.\":\n \"Tu contraseña se actualizó correctamente.\",\n \"Your account has no email.\": \"Tu cuenta no tiene correo.\",\n \"We sent a verification email to your email.\":\n \"Te enviamos un correo de verificación.\",\n }),\n\n // enable-auth-remote writes the same pages at the same paths, so everything\n // above covers it. These are the messages only it has, filed under its\n // remote functions so a project with the form-action pages is not handed\n // them.\n ...messages(`${AUTH}/login/form.remote.ts`, {\n \"Failed to authenticate.\": \"No pudimos iniciar tu sesión.\",\n }),\n ...messages(`${AUTH}/signup/form.remote.ts`, {\n \"Failed to create account.\": \"No pudimos crear tu cuenta.\",\n }),\n ...messages(`${AUTH}/otp/[token]/form.remote.ts`, {\n \"Failed to verify code.\": \"No pudimos verificar el código.\",\n }),\n ...messages(`${APP}/settings/form.remote.ts`, {\n \"Upload new picture <0/>\": \"Subir nueva foto <0/>\",\n }),\n];\n"],"mappings":";;;AAiBA,IAAaE,IAAkB,qBAYzBC,IAAS,yQAYTC,KAAS,MACb,IAAIC,EAAK,QAAQ,OAAO,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAK,CAAC,CAAC,QAAQ,OAAO,KAAK,EAAE,IAEvEC,KAAW,MACfD,EAAK,QAAQ,WAAW,GAAG,MAAkBE,MAAS,MAAM,OAAOA,CAAK;AAG1E,SAASC,EAAM,GAAe,GAA4C;CACxE,IAAMC,IAAQC,EAAM,MAAM,IAAI,GACxBC,IAAKF,EAAM,WAAW,MAASG,EAAK,WAAW,GAAGC,EAAQ,GAAG,CAAC;CACpE,IAAIF,MAAO,IAAI,OAAO;CACtB,IAAMG,IAAQ,CAACL,EAAME,EAAG,CAAC,MAAME,EAAQ,SAAS,CAAC,CAAC;CAClD,KAAK,IAAIE,IAAIJ,IAAK,GAAGI,IAAIN,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