@velastack/patterns 0.14.1 → 0.14.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/{collections-DMdTP6H_.js → collections-B_-NTtLW.js} +2 -2
- package/dist/chunks/{collections-DMdTP6H_.js.map → collections-B_-NTtLW.js.map} +1 -1
- package/dist/chunks/{constants-Bo85Ke0C.js → constants-CTp-0HKk.js} +18 -28
- package/dist/chunks/{constants-Bo85Ke0C.js.map → constants-CTp-0HKk.js.map} +1 -1
- package/dist/chunks/{currency.server-CNc9ASqB.js → currency.server-DOX4Rzyb.js} +2 -2
- package/dist/chunks/{currency.server-CNc9ASqB.js.map → currency.server-DOX4Rzyb.js.map} +1 -1
- package/dist/chunks/{env-vars-ZzWTCtYk.js → env-vars-BbS_mWyP.js} +3 -3
- package/dist/chunks/{env-vars-ZzWTCtYk.js.map → env-vars-BbS_mWyP.js.map} +1 -1
- package/dist/chunks/{generate-DiKYcuxK.js → generate-4iujJNAW.js} +3 -3
- package/dist/chunks/{generate-DiKYcuxK.js.map → generate-4iujJNAW.js.map} +1 -1
- package/dist/chunks/{generate-CpWYpXme.js → generate-B4uDCW5D.js} +2 -2
- package/dist/chunks/{generate-CpWYpXme.js.map → generate-B4uDCW5D.js.map} +1 -1
- package/dist/chunks/{generate-vSMSfoEL.js → generate-BJY8AtAp.js} +2 -2
- package/dist/chunks/{generate-vSMSfoEL.js.map → generate-BJY8AtAp.js.map} +1 -1
- package/dist/chunks/{generate-DPR1uuZM.js → generate-Bwkx_usZ.js} +2 -2
- package/dist/chunks/{generate-DPR1uuZM.js.map → generate-Bwkx_usZ.js.map} +1 -1
- package/dist/chunks/{generate-JcPcxodU.js → generate-JkvSNTy-.js} +2 -2
- package/dist/chunks/{generate-JcPcxodU.js.map → generate-JkvSNTy-.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DMhsz52A.js → generate.runtime-27KTIg_o.js} +3 -3
- package/dist/chunks/{generate.runtime-DMhsz52A.js.map → generate.runtime-27KTIg_o.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Czu9sahf.js → generate.runtime-B7XOa9_A.js} +3 -3
- package/dist/chunks/{generate.runtime-Czu9sahf.js.map → generate.runtime-B7XOa9_A.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CTAAJJr6.js → generate.runtime-B8-ORwxT.js} +6 -6
- package/dist/chunks/{generate.runtime-CTAAJJr6.js.map → generate.runtime-B8-ORwxT.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CZaJ7Uud.js → generate.runtime-BFX_8erf.js} +6 -6
- package/dist/chunks/{generate.runtime-CZaJ7Uud.js.map → generate.runtime-BFX_8erf.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BbyC1DMB.js → generate.runtime-BROXlbeJ.js} +3 -3
- package/dist/chunks/{generate.runtime-BbyC1DMB.js.map → generate.runtime-BROXlbeJ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BBjaUxGz.js → generate.runtime-BU-4sjyu.js} +4 -4
- package/dist/chunks/{generate.runtime-BBjaUxGz.js.map → generate.runtime-BU-4sjyu.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Dw6umCTf.js → generate.runtime-BXNBWGYr.js} +2 -2
- package/dist/chunks/{generate.runtime-Dw6umCTf.js.map → generate.runtime-BXNBWGYr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DD3OVUB5.js → generate.runtime-BlEy2fFF.js} +3 -3
- package/dist/chunks/{generate.runtime-DD3OVUB5.js.map → generate.runtime-BlEy2fFF.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Jzkg3tWq.js → generate.runtime-CBVcsole.js} +2 -2
- package/dist/chunks/{generate.runtime-Jzkg3tWq.js.map → generate.runtime-CBVcsole.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bna36DjV.js → generate.runtime-CCaCaXNu.js} +2 -2
- package/dist/chunks/{generate.runtime-Bna36DjV.js.map → generate.runtime-CCaCaXNu.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CkqBNJmH.js → generate.runtime-Cm75waRD.js} +2 -2
- package/dist/chunks/{generate.runtime-CkqBNJmH.js.map → generate.runtime-Cm75waRD.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D7SysNQ9.js → generate.runtime-CuvdtjKc.js} +2 -2
- package/dist/chunks/{generate.runtime-D7SysNQ9.js.map → generate.runtime-CuvdtjKc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-VXM0eG6V.js → generate.runtime-D0lI3Gt8.js} +4 -4
- package/dist/chunks/{generate.runtime-VXM0eG6V.js.map → generate.runtime-D0lI3Gt8.js.map} +1 -1
- package/dist/chunks/{generate.runtime-TPgoAXWD.js → generate.runtime-D6l6uLiY.js} +2 -2
- package/dist/chunks/{generate.runtime-TPgoAXWD.js.map → generate.runtime-D6l6uLiY.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CsfHtEy3.js → generate.runtime-D77ueFKY.js} +5 -5
- package/dist/chunks/{generate.runtime-CsfHtEy3.js.map → generate.runtime-D77ueFKY.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BufPbKvb.js → generate.runtime-D9OC1RXu.js} +2 -2
- package/dist/chunks/{generate.runtime-BufPbKvb.js.map → generate.runtime-D9OC1RXu.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CU1Gec33.js → generate.runtime-DLoYscQO.js} +3 -3
- package/dist/chunks/{generate.runtime-CU1Gec33.js.map → generate.runtime-DLoYscQO.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D50A0Jkc.js → generate.runtime-DhSH1o8H.js} +3 -3
- package/dist/chunks/{generate.runtime-D50A0Jkc.js.map → generate.runtime-DhSH1o8H.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BSKontB4.js → generate.runtime-DiEiFoxR.js} +3 -3
- package/dist/chunks/{generate.runtime-BSKontB4.js.map → generate.runtime-DiEiFoxR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DHFjipkv.js → generate.runtime-Dm7IEo2h.js} +3 -3
- package/dist/chunks/{generate.runtime-DHFjipkv.js.map → generate.runtime-Dm7IEo2h.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B-FbahJY.js → generate.runtime-Dn0_y2iV.js} +4 -4
- package/dist/chunks/{generate.runtime-B-FbahJY.js.map → generate.runtime-Dn0_y2iV.js.map} +1 -1
- package/dist/chunks/{generate.runtime-vr8Tp4dr.js → generate.runtime-DuAYqKxl.js} +2 -2
- package/dist/chunks/{generate.runtime-vr8Tp4dr.js.map → generate.runtime-DuAYqKxl.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C8vGwunw.js → generate.runtime-Duw_JI_b.js} +2 -2
- package/dist/chunks/{generate.runtime-C8vGwunw.js.map → generate.runtime-Duw_JI_b.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B2TQboJB.js → generate.runtime-DxyQqNpu.js} +4 -4
- package/dist/chunks/{generate.runtime-B2TQboJB.js.map → generate.runtime-DxyQqNpu.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CDQ3bnRi.js → generate.runtime-PDnSxiek.js} +6 -6
- package/dist/chunks/{generate.runtime-CDQ3bnRi.js.map → generate.runtime-PDnSxiek.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DL16fW78.js → generate.runtime-RTGpwxcS.js} +5 -5
- package/dist/chunks/{generate.runtime-DL16fW78.js.map → generate.runtime-RTGpwxcS.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CSusmHj9.js → generate.runtime-TQmspB4Z.js} +4 -4
- package/dist/chunks/{generate.runtime-CSusmHj9.js.map → generate.runtime-TQmspB4Z.js.map} +1 -1
- package/dist/chunks/{generate.runtime-opwafU4k.js → generate.runtime-UtkANHk1.js} +3 -3
- package/dist/chunks/{generate.runtime-opwafU4k.js.map → generate.runtime-UtkANHk1.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BL78nWra.js → generate.runtime-VMTLHWLk.js} +7 -7
- package/dist/chunks/{generate.runtime-BL78nWra.js.map → generate.runtime-VMTLHWLk.js.map} +1 -1
- package/dist/chunks/{generate.runtime-pjRWIwSm.js → generate.runtime-XT_JQlTk.js} +2 -2
- package/dist/chunks/{generate.runtime-pjRWIwSm.js.map → generate.runtime-XT_JQlTk.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BB2GGj4d.js → generate.runtime-XpYi9SlM.js} +2 -2
- package/dist/chunks/{generate.runtime-BB2GGj4d.js.map → generate.runtime-XpYi9SlM.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DStnhncj.js → generate.runtime-ZgLxGWuy.js} +3 -3
- package/dist/chunks/{generate.runtime-DStnhncj.js.map → generate.runtime-ZgLxGWuy.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D50lIHIY.js → generate.runtime-bsuqrKOm.js} +2 -2
- package/dist/chunks/{generate.runtime-D50lIHIY.js.map → generate.runtime-bsuqrKOm.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CPWxn8rh.js → generate.runtime-nXjFqHyb.js} +4 -4
- package/dist/chunks/{generate.runtime-CPWxn8rh.js.map → generate.runtime-nXjFqHyb.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BPnFkMKl.js → generate.runtime-sjFAWbZc.js} +6 -6
- package/dist/chunks/{generate.runtime-BPnFkMKl.js.map → generate.runtime-sjFAWbZc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-7QPUM9c3.js → generate.runtime-wiWdXXPi.js} +4 -4
- package/dist/chunks/{generate.runtime-7QPUM9c3.js.map → generate.runtime-wiWdXXPi.js.map} +1 -1
- package/dist/chunks/{i18n-D8hsUX_P.js → i18n-mnzzcYhz.js} +2 -2
- package/dist/chunks/{i18n-D8hsUX_P.js.map → i18n-mnzzcYhz.js.map} +1 -1
- package/dist/chunks/{modify-file-CoFH_Y5n.js → modify-file-CgJIza72.js} +2 -2
- package/dist/chunks/{modify-file-CoFH_Y5n.js.map → modify-file-CgJIza72.js.map} +1 -1
- package/dist/chunks/{pocketbase-BTLraFEp.js → pocketbase-S8lUt0nI.js} +2 -2
- package/dist/chunks/{pocketbase-BTLraFEp.js.map → pocketbase-S8lUt0nI.js.map} +1 -1
- package/dist/chunks/{providers-cp9IJLRl.js → providers-CDUFaOeQ.js} +2 -2
- package/dist/chunks/{providers-cp9IJLRl.js.map → providers-CDUFaOeQ.js.map} +1 -1
- package/dist/chunks/{shared-Be8NptJO.js → shared-BjTRQ5QH.js} +2 -2
- package/dist/chunks/{shared-Be8NptJO.js.map → shared-BjTRQ5QH.js.map} +1 -1
- package/dist/chunks/{site-BHCX2hbj.js → site-C8Wcg6LT.js} +2 -2
- package/dist/chunks/{site-BHCX2hbj.js.map → site-C8Wcg6LT.js.map} +1 -1
- package/dist/chunks/{table-core-JdtTKQKA.js → table-core-RvMjoXpT.js} +2 -2
- package/dist/chunks/{table-core-JdtTKQKA.js.map → table-core-RvMjoXpT.js.map} +1 -1
- package/dist/chunks/{test-setup-SleehT05.js → test-setup-CpjhQSl-.js} +3 -3
- package/dist/chunks/{test-setup-SleehT05.js.map → test-setup-CpjhQSl-.js.map} +1 -1
- package/dist/chunks/{ui-smOXuMsQ.js → ui-CE-8llQS.js} +3 -3
- package/dist/chunks/{ui-smOXuMsQ.js.map → ui-CE-8llQS.js.map} +1 -1
- package/dist/chunks/{whatsapp-qMxxv6e0.js → whatsapp-DT10x76l.js} +2 -2
- package/dist/chunks/{whatsapp-qMxxv6e0.js.map → whatsapp-DT10x76l.js.map} +1 -1
- package/dist/chunks/{write-result-DPM26sZ_.js → write-result-BguSfKV-.js} +4 -4
- package/dist/chunks/{write-result-DPM26sZ_.js.map → write-result-BguSfKV-.js.map} +1 -1
- package/dist/index.js +98 -98
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-Dw6umCTf.js","names":["FAILURE_HINT","I18N_MODULES","FAILURE_HINT","FAILURE_HINT","normalize","getLogger","revertOutcomeToFile","modifyOutcomeToFile","probeFirstExisting","resolveConfigTarget","saveTarget","VITE_CONFIG_CANDIDATES","LAYOUT_SERVER_SNIPPET","LOCALES_IMPORTS","LOCALS_MEMBER","LEGACY_LOAD_STATEMENT","LOAD_STATEMENT","LOCALS_COMMENT","withInMemoryScript","pruneUnusedImports","removeNamedImportIfUnused","removeTopLevelStatementByIdentifier","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","isEffectivelyEmpty","removeImportByModuleSpecifier","removePackageImports","dedent","removeHandle","libModule","SvelteFile","findLoadFunction","APP_LAYOUT_PATH","APP_LANGUAGE_SELECT","fs","path","unmodifyGitignore","gitignorePath","original","lines","out","i","line","j","hasWuchale","updated","unmodifyPrettierignore","filePath","at","index","unmodifyViteConfig","viteConfigPath","sourceFile","Project","QuoteKind","removed","arr","SyntaxKind","el","HINTS","unmodifyLocalesAlias","res","root","aliasProp","target","aliasObj","locales","p","localesModule","escaped","name","pattern","specifier","I18N_HANDLE","FAILURE_HINT$3","I18N_MODULES$1","unmodifyHooksServerI18n","hooksServerPath","stmt","s","moduleSpecifier","DELOCALIZE_HELPER","FAILURE_HINT$2","I18N_MODULES","I18N_ONLY_REROUTE","COMPOSED_REROUTE","unmodifyHooksI18n","hooksPath","helperStatement","rerouteDecl","initText","composed","rerouteStatement","unmodifyAppHtml","appHtmlPath","FAILURE_HINT$1","SIDE_EFFECT_MODULES","BINDING_MODULES","WRITTEN_LOADS","normalize$1","source","unmodifyRootLayoutI18n","layoutPath","loadStatement","d","load","written","unmodifyRootLayoutLanguageSelect","file","sf","normalize","LOCALE_COMMENT","FAILURE_HINT","unmodifyLayoutServerLocale","layoutServerPath","properties","property","object","Node","escape","text","MEMBER","EMPTY_LOCALS","unmodifyAppDts","appDtsPath","unmodifyAppLayoutLanguageSelect","generate","logger","options","modifies","deletes","pushResult","imports","alias","hooksServerRevert","hooksRevert","layoutRevert","layoutServerRevert","appLayoutPath","rootLayoutCandidates","candidate","prettierignorePath","localesDir","entry"],"sources":["../../src/patterns/disable/i18n/modifies/gitignore.ts","../../src/patterns/disable/i18n/modifies/prettierignore.ts","../../src/patterns/disable/i18n/modifies/vite-config.ts","../../src/patterns/disable/i18n/modifies/locales-alias.ts","../../src/patterns/disable/i18n/modifies/locales-module.ts","../../src/patterns/disable/i18n/modifies/hooks.server.ts","../../src/patterns/disable/i18n/modifies/hooks.ts","../../src/patterns/disable/i18n/modifies/app-html.ts","../../src/patterns/disable/i18n/modifies/+layout.ts","../../src/patterns/disable/i18n/modifies/root-layout.svelte.ts","../../src/patterns/disable/i18n/modifies/layout.server.ts","../../src/patterns/disable/i18n/modifies/app-d-ts.ts","../../src/patterns/disable/i18n/modifies/app-layout.svelte.ts","../../src/patterns/disable/i18n/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyGitignore(gitignorePath: string): ModifyOutcome {\n if (!fs.existsSync(gitignorePath)) {\n return { status: \"success\", changed: false };\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 lines = original.split(\"\\n\");\n const out: string[] = [];\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === \"# Wuchale\") {\n let j = i + 1;\n let hasWuchale = false;\n while (j < lines.length && lines[j].trim() !== \"\") {\n if (lines[j] === \"src/locales/.wuchale\") {\n hasWuchale = true;\n }\n j++;\n }\n if (hasWuchale) {\n i = j;\n continue;\n }\n }\n if (line === \"src/locales/.wuchale\") continue;\n out.push(line);\n }\n\n let updated = out.join(\"\\n\");\n updated = updated.replace(/\\n{3,}/g, \"\\n\\n\");\n\n if (updated === original) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(gitignorePath, updated);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n LOCALES_ENTRY,\n PRETTIERIGNORE_HEADER,\n} from \"../../../enable/i18n/modifies/prettierignore\";\n\n/** Removes the block enable-i18n appended; an entry the project wrote itself stays. */\nexport function unmodifyPrettierignore(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(filePath, \"utf8\");\n const lines = original.split(\"\\n\");\n const at = lines.findIndex(\n (line, index) =>\n line === PRETTIERIGNORE_HEADER && lines[index + 1] === LOCALES_ENTRY,\n );\n if (at === -1) {\n return { status: \"success\", changed: false };\n }\n\n lines.splice(at, 2);\n // The blank line that set the block apart goes with it.\n if (at > 0 && lines[at - 1] === \"\" && (lines[at] ?? \"\") === \"\") {\n lines.splice(at - 1, 1);\n }\n fs.writeFileSync(filePath, lines.join(\"\\n\"));\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n removeImportByModuleSpecifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\n/** Remove `wuchale()` from the Vite plugins and its import. */\nexport function unmodifyViteConfig(viteConfigPath: string): ModifyOutcome {\n if (!fs.existsSync(viteConfigPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(viteConfigPath, \"utf8\");\n if (!original.includes(\"wuchale\")) {\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(viteConfigPath);\n\n // One removal at a time: manipulating the tree invalidates sibling nodes.\n for (;;) {\n let removed = false;\n for (const arr of sourceFile.getDescendantsOfKind(\n SyntaxKind.ArrayLiteralExpression,\n )) {\n const index = arr\n .getElements()\n .findIndex((el) => el.getText().replace(/\\s/g, \"\") === \"wuchale()\");\n if (index >= 0) {\n arr.removeElement(index);\n removed = true;\n break;\n }\n }\n if (!removed) break;\n }\n\n removeImportByModuleSpecifier(sourceFile, \"wuchale/vite\");\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import { SyntaxKind } from \"ts-morph\";\nimport {\n resolveConfigTarget,\n saveTarget,\n type ConfigModifyResult,\n} from \"../../../../runtime/config-target\";\n\nconst HINTS = {\n notFound: \"No SvelteKit config to revert.\",\n failed:\n \"Remove the $locales alias from the sveltekit() arg in vite.config by hand.\",\n};\n\n/**\n * Remove the `$locales` alias enable-i18n wrote before SvelteKit 3, which\n * `sv migrate sveltekit-3` moves into the inline `sveltekit({...})` arg;\n * `alias` goes too once it is empty. Projects enabled since then map\n * `#locales/*` in package.json `imports` instead.\n */\nexport function unmodifyLocalesAlias(root: string): ConfigModifyResult {\n const res = resolveConfigTarget(root, HINTS);\n // Nothing to revert in a project without a config.\n if (res.status === \"not-found\") {\n return {\n filePath: res.filePath,\n outcome: { status: \"success\", changed: false },\n };\n }\n if (res.status === \"failed\") {\n return {\n filePath: res.filePath,\n outcome: { status: \"failed\", message: res.message },\n };\n }\n\n const { target } = res;\n const aliasProp = target.configObject\n .getProperty(\"alias\")\n ?.asKind(SyntaxKind.PropertyAssignment);\n const aliasObj = aliasProp\n ?.getInitializer()\n ?.asKind(SyntaxKind.ObjectLiteralExpression);\n const locales = aliasObj\n ?.getProperties()\n .find((p) => p.getText().replace(/['\"]/g, \"\").startsWith(\"$locales\"));\n if (aliasProp && aliasObj && locales) {\n locales.remove();\n if (aliasObj.getProperties().length === 0) aliasProp.remove();\n }\n return { filePath: target.filePath, outcome: saveTarget(target) };\n}\n","/**\n * Matches an import of wuchale's `src/locales/<name>.js` the way enable-i18n\n * writes it (`#locales/main.url.js`), and the `$locales/main.url` alias form\n * it wrote before SvelteKit 3, so disabling works on either.\n */\nexport function localesModule(name: string): (specifier: string) => boolean {\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const pattern = new RegExp(`^[$#]locales/${escaped}(\\\\.js)?$`);\n return (specifier) => pattern.test(specifier);\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n removeNamedImportIfUnused,\n removeTopLevelStatementByIdentifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\nimport { localesModule } from \"./locales-module\";\n\nconst I18N_HANDLE = \"handleWuchale\";\nconst FAILURE_HINT = dedent`\n Take handleWuchale out of the exported handle in src/hooks.server.ts, then\n remove its declaration, the loadLocales(...) calls and the wuchale and\n #locales imports.\n`;\n\nconst I18N_MODULES = [\n \"wuchale/load-utils/server\",\n // Since the handle follows the visitor's preference on pages without a\n // language in their URL; a project enabled before has none of the three.\n \"wuchale/url\",\n libModule(\"url.ts\"),\n libModule(\"locale.ts\"),\n localesModule(\"main.url\"),\n localesModule(\"data\"),\n localesModule(\"main.loader.server.svelte\"),\n localesModule(\"js.loader.server\"),\n];\n\n/**\n * Undo `modifyHooksServerI18n`: drop the locale bootstrap, the wuchale handle\n * and its imports, and unwrap `sequence(handleWuchale, ...)`. A file that\n * enable-i18n created comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerI18n(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (!original.includes(I18N_HANDLE) && !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 // loadLocales(...) bootstrap calls, one at a time (removal invalidates siblings).\n for (;;) {\n const stmt = sourceFile\n .getStatements()\n .find(\n (s) =>\n s.getKind() === SyntaxKind.ExpressionStatement &&\n /^loadLocales\\s*\\(/.test(s.getText()),\n );\n if (!stmt) break;\n stmt.remove();\n }\n\n // `export const handle = handleWuchale` goes altogether; a sequence loses\n // the argument, or unwraps to the handle it composed with.\n const removed = removeHandle(sourceFile, I18N_HANDLE);\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n removeTopLevelStatementByIdentifier(sourceFile, I18N_HANDLE);\n for (const moduleSpecifier of I18N_MODULES) {\n removeImportByModuleSpecifier(sourceFile, moduleSpecifier);\n }\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"sequence\");\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"Handle\");\n // A project from before SvelteKit 3 imports it from the package root.\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit\", \"Handle\");\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureBlankLineAfterImports,\n isEffectivelyEmpty,\n pruneUnusedImports,\n removeTopLevelStatementByIdentifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst DELOCALIZE_HELPER = \"rerouteDeLocalize\";\n\nconst FAILURE_HINT = dedent`\n Take rerouteDeLocalize out of the exported reroute in src/hooks.ts, then\n remove its declaration and the wuchale and #locales imports.\n`;\n\nconst I18N_MODULES = [\n \"wuchale/url\",\n localesModule(\"main.url\"),\n localesModule(\"data\"),\n];\n\n/** The two reroutes `modifyHooksI18n` writes: on its own, and composed. */\nconst I18N_ONLY_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*rerouteDeLocalize\\(\\s*url\\.pathname\\s*\\)$/;\nconst COMPOSED_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*rerouteDeLocalize\\(\\s*negotiateReroute\\(\\s*url\\.pathname\\s*\\)\\s*\\)$/;\n\n/**\n * Undo `modifyHooksI18n`: drop the de-localizer and its imports, leaving the\n * negotiation reroute it may have been composed with. A file that enable-i18n\n * created comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksI18n(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (!original.includes(DELOCALIZE_HELPER)) {\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(hooksPath);\n\n const helperStatement = sourceFile\n .getVariableDeclaration(DELOCALIZE_HELPER)\n ?.getFirstAncestorByKind(SyntaxKind.VariableStatement);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n const initText = rerouteDecl?.getInitializer()?.getText() ?? \"\";\n const composed = COMPOSED_REROUTE.test(initText);\n const rerouteStatement =\n composed || I18N_ONLY_REROUTE.test(initText)\n ? rerouteDecl?.getFirstAncestorByKind(SyntaxKind.VariableStatement)\n : undefined;\n\n // Anything else reading the de-localizer is code enable-i18n did not write,\n // so undoing it is the developer's call.\n const otherReaders = sourceFile\n .getStatements()\n .filter(\n (s) =>\n s !== helperStatement &&\n s !== rerouteStatement &&\n s.getText().includes(DELOCALIZE_HELPER),\n );\n if (otherReaders.length > 0) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n if (composed) {\n // content-negotiation's reroute is underneath; it stays.\n rerouteDecl?.setInitializer(\"({ url }) => negotiateReroute(url.pathname)\");\n } else if (rerouteStatement) {\n removeTopLevelStatementByIdentifier(sourceFile, \"reroute\");\n }\n\n removeTopLevelStatementByIdentifier(sourceFile, DELOCALIZE_HELPER);\n pruneUnusedImports(sourceFile, I18N_MODULES);\n\n if (isEffectivelyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty hooks.ts into a\n // delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(hooksPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * Put a real language back. `%sveltekit.lang%` is not a SvelteKit\n * placeholder; only the wuchale hook replaced it, so without that hook it\n * would be served literally.\n */\nexport function unmodifyAppHtml(appHtmlPath: string): ModifyOutcome {\n if (!fs.existsSync(appHtmlPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(appHtmlPath, \"utf8\");\n const updated = original.replace(\n /lang\\s*=\\s*(?:\"%sveltekit\\.lang%\"|'%sveltekit\\.lang%')/g,\n 'lang=\"en\"',\n );\n if (updated === original) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(appHtmlPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type Statement } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n LEGACY_LOAD_STATEMENT,\n LOAD_STATEMENT,\n} from \"../../../enable/i18n/modifies/+layout\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\nimport {\n ensureBlankLineAfterImports,\n isEffectivelyEmpty,\n pruneUnusedImports,\n removeImportByModuleSpecifier,\n removeStatementWithComments,\n formatLikeSource,\n type ModuleMatch,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst FAILURE_HINT = dedent`\n src/routes/+layout.ts still loads wuchale locales. Remove these from it:\n\n import { browser } from '$app/env';\n import { loadLocale } from 'wuchale/load-utils';\n import { getLocale } from '#locales/main.url.js';\n import { hasLocalizedUrl } from '#lib/url.js';\n import '#locales/main.loader.svelte.js';\n import '#locales/js.loader.js';\n\n and the loadLocale(...) call inside load().\n`;\n\nconst SIDE_EFFECT_MODULES = [\n localesModule(\"main.loader.svelte\"),\n localesModule(\"js.loader\"),\n];\nconst BINDING_MODULES: ModuleMatch[] = [\n // `$app/env`, or the module it replaced before SvelteKit 3.\n (specifier) => /^\\$app\\/env(ironment)?$/.test(specifier),\n \"wuchale/load-utils\",\n localesModule(\"main.url\"),\n libModule(\"url.ts\"),\n];\n\n/** The loads enable-i18n has written: today's, and the URL-only one before it. */\nconst WRITTEN_LOADS = [LOAD_STATEMENT, LEGACY_LOAD_STATEMENT];\n\nfunction normalize(source: string): string {\n return source.replace(/[\"']/g, \"'\").replace(/\\s+/g, \"\");\n}\n\n/**\n * Undo `ensureRootLayoutI18n`: drop the wuchale load and its imports, leaving\n * whatever else the file holds. A file enable-i18n wrote whole comes out\n * empty, for the caller to delete.\n */\nexport function unmodifyRootLayoutI18n(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"loadLocale\") && !/[$#]locales\\//.test(original)) {\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(layoutPath);\n\n const loadStatement: Statement | undefined =\n sourceFile\n .getVariableStatements()\n .find((s) => s.getDeclarations().some((d) => d.getName() === \"load\")) ??\n sourceFile.getFunction(\"load\");\n\n if (loadStatement) {\n // A load that grew code of its own needs a hand; only the one enable-i18n\n // wrote is safe to take out wholesale.\n const load = normalize(loadStatement.getText());\n if (!WRITTEN_LOADS.some((written) => normalize(written) === load)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n removeStatementWithComments(sourceFile, loadStatement);\n }\n\n for (const moduleSpecifier of SIDE_EFFECT_MODULES) {\n removeImportByModuleSpecifier(sourceFile, moduleSpecifier);\n }\n pruneUnusedImports(sourceFile, BINDING_MODULES);\n\n if (isEffectivelyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty +layout.ts into\n // a delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(layoutPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\n/** Take the language select (and the nav item enable-i18n wrapped it in) back out. */\nexport function unmodifyRootLayoutLanguageSelect(\n layoutPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"LanguageSelect\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/language-select.svelte\"),\n );\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n let updated = file.toString();\n updated = updated.replace(\n /[ \\t]*<Navbar\\.Item>\\s*<LanguageSelect\\s*\\/>\\s*<\\/Navbar\\.Item>[ \\t]*\\r?\\n?/g,\n \"\",\n );\n updated = updated.replace(/[ \\t]*<LanguageSelect\\s*\\/>[ \\t]*\\r?\\n?/g, \"\");\n\n fs.writeFileSync(layoutPath, updated, \"utf8\");\n return { status: \"success\", changed: updated !== original };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { LAYOUT_SERVER_SNIPPET } from \"../../../enable/i18n/modifies/layout.server\";\nimport { Node, SyntaxKind } from \"ts-morph\";\nimport { findLoadFunction } from \"../../../../runtime/load-function\";\nimport {\n removeUnusedBindingElement,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst normalize = (source: string) =>\n source.replace(/[\"']/g, \"'\").replace(/\\s+/g, \"\");\n\n/** The comment enable-i18n put above the property, on its own lines. */\nconst LOCALE_COMMENT =\n /^[ \\t]*\\/\\/ Decided on the server \\(src\\/hooks\\.server\\.ts\\), because pages without a\\r?\\n[ \\t]*\\/\\/ language in their URL follow the visitor's preference\\.\\r?\\n/m;\n\nconst FAILURE_HINT =\n \"src/routes/+layout.server.ts still returns `locale: locals.locale`. Remove it from the load.\";\n\n/**\n * Undo `modifyLayoutServerLocale`: the root layout's server load stops\n * returning `locale`. A file enable-i18n wrote whole comes out empty, for the\n * caller to delete.\n */\nexport function unmodifyLayoutServerLocale(\n layoutServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutServerPath, \"utf8\");\n if (!original.includes(\"locals.locale\")) {\n return { status: \"success\", changed: false };\n }\n\n if (normalize(original) === normalize(LAYOUT_SERVER_SNIPPET)) {\n fs.writeFileSync(layoutServerPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n // The comment first: left above a removed property it would attach itself\n // to whatever follows.\n const { source } = withInMemoryScript(\n original.replace(LOCALE_COMMENT, \"\"),\n (sf) => {\n const load = findLoadFunction(sf);\n const properties = (load ?? sf)\n .getDescendantsOfKind(SyntaxKind.PropertyAssignment)\n .filter(\n (property) =>\n property.getName() === \"locale\" &&\n /(^|\\.)locals\\.locale$/.test(\n property.getInitializer()?.getText() ?? \"\",\n ),\n );\n for (const property of properties) {\n const object = property.getParent();\n property.remove();\n // `return {}` reads worse on three lines than on one.\n if (\n Node.isObjectLiteralExpression(object) &&\n object.getProperties().length === 0\n ) {\n object.replaceWithText(\"{}\");\n }\n }\n removeUnusedBindingElement(sf, \"locals\");\n },\n );\n if (source === original) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.writeFileSync(layoutServerPath, source, \"utf8\");\n return { status: \"success\", changed: source !== original };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n LOCALS_COMMENT,\n LOCALS_MEMBER,\n} from \"../../../enable/i18n/modifies/app-d-ts\";\n\nconst escape = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\nconst MEMBER = new RegExp(\n `(?:^[ \\\\t]*${escape(LOCALS_COMMENT)}[ \\\\t]*\\\\r?\\\\n)?^[ \\\\t]*${escape(LOCALS_MEMBER)}[ \\\\t]*\\\\r?\\\\n`,\n \"m\",\n);\n\n/** An `interface Locals` left with nothing in it. */\nconst EMPTY_LOCALS = /^([ \\t]*)interface Locals\\s*\\{\\s*\\}/m;\n\n/**\n * Undo `modifyAppDts`: `App.Locals` loses `locale`, and an interface left\n * empty goes back to the comment `sv create` writes.\n */\nexport function unmodifyAppDts(appDtsPath: string): ModifyOutcome {\n if (!fs.existsSync(appDtsPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(appDtsPath, \"utf8\");\n if (!MEMBER.test(original)) {\n return { status: \"success\", changed: false };\n }\n\n const updated = original\n .replace(MEMBER, \"\")\n .replace(EMPTY_LOCALS, \"$1// interface Locals {}\");\n fs.writeFileSync(appDtsPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\nimport { APP_LANGUAGE_SELECT } from \"../../../enable/i18n/modifies/app-layout.svelte\";\n\n/** Take the language select back out of the signed-in layout's header. */\nexport function unmodifyAppLayoutLanguageSelect(\n layoutPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"LanguageSelect\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/language-select.svelte\"),\n );\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n const updated = file\n .toString()\n .replace(APP_LANGUAGE_SELECT, \"\")\n // Moved out of the wrapper by hand: the component alone still goes.\n .replace(/[ \\t]*<LanguageSelect\\s*\\/>[ \\t]*\\r?\\n?/g, \"\");\n\n fs.writeFileSync(layoutPath, updated, \"utf8\");\n return { status: \"success\", changed: updated !== original };\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 {\n modifyOutcomeToFile,\n revertOutcomeToFile,\n} from \"../../../runtime/modify-file\";\nimport {\n probeFirstExisting,\n VITE_CONFIG_CANDIDATES,\n} from \"../../../runtime/config-target\";\nimport { unmodifyGitignore } from \"./modifies/gitignore\";\nimport { unmodifyPrettierignore } from \"./modifies/prettierignore\";\nimport { unmodifyViteConfig } from \"./modifies/vite-config\";\nimport { unmodifyLocalesAlias } from \"./modifies/locales-alias\";\nimport { removePackageImports } from \"../../../runtime/package-imports\";\nimport { LOCALES_IMPORTS } from \"../../enable/i18n/modifies/package-imports\";\nimport { unmodifyHooksServerI18n } from \"./modifies/hooks.server\";\nimport { unmodifyHooksI18n } from \"./modifies/hooks\";\nimport { unmodifyAppHtml } from \"./modifies/app-html\";\nimport { unmodifyRootLayoutI18n } from \"./modifies/+layout\";\nimport { unmodifyRootLayoutLanguageSelect } from \"./modifies/root-layout.svelte\";\nimport { unmodifyLayoutServerLocale } from \"./modifies/layout.server\";\nimport { unmodifyAppDts } from \"./modifies/app-d-ts\";\nimport { unmodifyAppLayoutLanguageSelect } from \"./modifies/app-layout.svelte\";\nimport { APP_LAYOUT_PATH } from \"../../enable/i18n/modifies/app-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting 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, unmodifyViteConfig(viteConfigPath)),\n );\n\n logger.info(\"Removing #locales from package.json imports\");\n // Only while it still maps where enable-i18n pointed it.\n const imports = removePackageImports(\n options.root,\n Object.keys(LOCALES_IMPORTS),\n LOCALES_IMPORTS,\n );\n pushResult(modifyOutcomeToFile(imports.filePath, imports.outcome));\n\n // A project enabled before SvelteKit 3 has the `$locales` alias instead,\n // moved into the sveltekit() arg by `vela migrate sveltekit-3`.\n logger.info(\"Reverting the legacy $locales alias\");\n const alias = unmodifyLocalesAlias(options.root);\n pushResult(modifyOutcomeToFile(alias.filePath, alias.outcome));\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n // enable-i18n may have created it; emptied, it goes.\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerI18n(hooksServerPath),\n );\n pushResult(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n logger.info(\"Reverting hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n // The de-localizing reroute may be all it holds; emptied, it goes.\n const hooksRevert = revertOutcomeToFile(\n hooksPath,\n unmodifyHooksI18n(hooksPath),\n );\n pushResult(hooksRevert.modify);\n if (hooksRevert.delete) deletes.push(hooksRevert.delete);\n\n logger.info(\"Reverting app.html\");\n const appHtmlPath = path.join(options.root, \"src\", \"app.html\");\n pushResult(modifyOutcomeToFile(appHtmlPath, unmodifyAppHtml(appHtmlPath)));\n\n logger.info(\"Reverting root +layout.ts\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.ts\");\n // enable-i18n may have written the whole file; emptied, it goes.\n const layoutRevert = revertOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutI18n(layoutPath),\n );\n pushResult(layoutRevert.modify);\n if (layoutRevert.delete) deletes.push(layoutRevert.delete);\n\n logger.info(\"Reverting root +layout.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n // enable-i18n may have written the whole file; emptied, it goes.\n const layoutServerRevert = revertOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerLocale(layoutServerPath),\n );\n pushResult(layoutServerRevert.modify);\n if (layoutServerRevert.delete) deletes.push(layoutServerRevert.delete);\n\n logger.info(\"Reverting app.d.ts\");\n const appDtsPath = path.join(options.root, \"src\", \"app.d.ts\");\n pushResult(modifyOutcomeToFile(appDtsPath, unmodifyAppDts(appDtsPath)));\n\n logger.info(\"Reverting the signed-in layout language select\");\n const appLayoutPath = path.join(options.root, APP_LAYOUT_PATH);\n pushResult(\n modifyOutcomeToFile(\n appLayoutPath,\n unmodifyAppLayoutLanguageSelect(appLayoutPath),\n ),\n );\n\n logger.info(\"Reverting 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 for (const candidate of rootLayoutCandidates) {\n if (!fs.existsSync(candidate)) continue;\n pushResult(\n modifyOutcomeToFile(\n candidate,\n unmodifyRootLayoutLanguageSelect(candidate),\n ),\n );\n }\n\n logger.info(\"Reverting .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n pushResult(\n modifyOutcomeToFile(gitignorePath, unmodifyGitignore(gitignorePath)),\n );\n\n logger.info(\"Reverting .prettierignore\");\n const prettierignorePath = path.join(options.root, \".prettierignore\");\n pushResult(\n modifyOutcomeToFile(\n prettierignorePath,\n unmodifyPrettierignore(prettierignorePath),\n ),\n );\n\n // wuchale's loaders import the packages this uninstalls, and without the\n // .prettierignore block they would fail the project's lint. The catalogs\n // (.po) beside them are the translations, and stay.\n logger.info(\"Removing wuchale's loaders from src/locales\");\n const localesDir = path.join(options.root, \"src\", \"locales\");\n if (fs.existsSync(localesDir)) {\n for (const entry of fs.readdirSync(localesDir, { withFileTypes: true })) {\n if (!entry.isFile() || !entry.name.endsWith(\".js\")) continue;\n deletes.push({\n path: path.join(localesDir, entry.name),\n language: \"js\",\n content: \"\",\n status: \"success\",\n });\n }\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":";;;;;;;;;;;;;;;;AAGA,SAAgBqC,EAAkB,GAAsC;CACtE,IAAI,CAACF,EAAG,WAAWG,CAAa,GAC9B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAWJ,EAAG,aAAaG,GAAe,MAAM;CACtD,IAAI,CAACC,EAAS,SAAS,sBAAsB,GAC3C,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAQD,EAAS,MAAM,IAAI,GAC3BE,IAAgB,CAAC;CACvB,KAAK,IAAIC,IAAI,GAAGA,IA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S,KAAK,KACjDb,EAAQ,KAAK;EACX,MAAM/F,EAAK,KAAK2G,GAAYC,EAAM,IAAI;EACtC,UAAU;EACV,SAAS;EACT,QAAQ;CACV,CAAC;CAIL,OAAO;EACL,SAAS,CAAC;EACV;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
1
|
+
{"version":3,"file":"generate.runtime-BXNBWGYr.js","names":["FAILURE_HINT","I18N_MODULES","FAILURE_HINT","FAILURE_HINT","normalize","getLogger","revertOutcomeToFile","modifyOutcomeToFile","probeFirstExisting","resolveConfigTarget","saveTarget","VITE_CONFIG_CANDIDATES","LAYOUT_SERVER_SNIPPET","LOCALES_IMPORTS","LOCALS_MEMBER","LEGACY_LOAD_STATEMENT","LOAD_STATEMENT","LOCALS_COMMENT","withInMemoryScript","pruneUnusedImports","removeNamedImportIfUnused","removeTopLevelStatementByIdentifier","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","isEffectivelyEmpty","removeImportByModuleSpecifier","removePackageImports","dedent","removeHandle","libModule","SvelteFile","findLoadFunction","APP_LAYOUT_PATH","APP_LANGUAGE_SELECT","fs","path","unmodifyGitignore","gitignorePath","original","lines","out","i","line","j","hasWuchale","updated","unmodifyPrettierignore","filePath","at","index","unmodifyViteConfig","viteConfigPath","sourceFile","Project","QuoteKind","removed","arr","SyntaxKind","el","HINTS","unmodifyLocalesAlias","res","root","aliasProp","target","aliasObj","locales","p","localesModule","escaped","name","pattern","specifier","I18N_HANDLE","FAILURE_HINT$3","I18N_MODULES$1","unmodifyHooksServerI18n","hooksServerPath","stmt","s","moduleSpecifier","DELOCALIZE_HELPER","FAILURE_HINT$2","I18N_MODULES","I18N_ONLY_REROUTE","COMPOSED_REROUTE","unmodifyHooksI18n","hooksPath","helperStatement","rerouteDecl","initText","composed","rerouteStatement","unmodifyAppHtml","appHtmlPath","FAILURE_HINT$1","SIDE_EFFECT_MODULES","BINDING_MODULES","WRITTEN_LOADS","normalize$1","source","unmodifyRootLayoutI18n","layoutPath","loadStatement","d","load","written","unmodifyRootLayoutLanguageSelect","file","sf","normalize","LOCALE_COMMENT","FAILURE_HINT","unmodifyLayoutServerLocale","layoutServerPath","properties","property","object","Node","escape","text","MEMBER","EMPTY_LOCALS","unmodifyAppDts","appDtsPath","unmodifyAppLayoutLanguageSelect","generate","logger","options","modifies","deletes","pushResult","imports","alias","hooksServerRevert","hooksRevert","layoutRevert","layoutServerRevert","appLayoutPath","rootLayoutCandidates","candidate","prettierignorePath","localesDir","entry"],"sources":["../../src/patterns/disable/i18n/modifies/gitignore.ts","../../src/patterns/disable/i18n/modifies/prettierignore.ts","../../src/patterns/disable/i18n/modifies/vite-config.ts","../../src/patterns/disable/i18n/modifies/locales-alias.ts","../../src/patterns/disable/i18n/modifies/locales-module.ts","../../src/patterns/disable/i18n/modifies/hooks.server.ts","../../src/patterns/disable/i18n/modifies/hooks.ts","../../src/patterns/disable/i18n/modifies/app-html.ts","../../src/patterns/disable/i18n/modifies/+layout.ts","../../src/patterns/disable/i18n/modifies/root-layout.svelte.ts","../../src/patterns/disable/i18n/modifies/layout.server.ts","../../src/patterns/disable/i18n/modifies/app-d-ts.ts","../../src/patterns/disable/i18n/modifies/app-layout.svelte.ts","../../src/patterns/disable/i18n/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyGitignore(gitignorePath: string): ModifyOutcome {\n if (!fs.existsSync(gitignorePath)) {\n return { status: \"success\", changed: false };\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 lines = original.split(\"\\n\");\n const out: string[] = [];\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n if (line === \"# Wuchale\") {\n let j = i + 1;\n let hasWuchale = false;\n while (j < lines.length && lines[j].trim() !== \"\") {\n if (lines[j] === \"src/locales/.wuchale\") {\n hasWuchale = true;\n }\n j++;\n }\n if (hasWuchale) {\n i = j;\n continue;\n }\n }\n if (line === \"src/locales/.wuchale\") continue;\n out.push(line);\n }\n\n let updated = out.join(\"\\n\");\n updated = updated.replace(/\\n{3,}/g, \"\\n\\n\");\n\n if (updated === original) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(gitignorePath, updated);\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n LOCALES_ENTRY,\n PRETTIERIGNORE_HEADER,\n} from \"../../../enable/i18n/modifies/prettierignore\";\n\n/** Removes the block enable-i18n appended; an entry the project wrote itself stays. */\nexport function unmodifyPrettierignore(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(filePath, \"utf8\");\n const lines = original.split(\"\\n\");\n const at = lines.findIndex(\n (line, index) =>\n line === PRETTIERIGNORE_HEADER && lines[index + 1] === LOCALES_ENTRY,\n );\n if (at === -1) {\n return { status: \"success\", changed: false };\n }\n\n lines.splice(at, 2);\n // The blank line that set the block apart goes with it.\n if (at > 0 && lines[at - 1] === \"\" && (lines[at] ?? \"\") === \"\") {\n lines.splice(at - 1, 1);\n }\n fs.writeFileSync(filePath, lines.join(\"\\n\"));\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n removeImportByModuleSpecifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\n/** Remove `wuchale()` from the Vite plugins and its import. */\nexport function unmodifyViteConfig(viteConfigPath: string): ModifyOutcome {\n if (!fs.existsSync(viteConfigPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(viteConfigPath, \"utf8\");\n if (!original.includes(\"wuchale\")) {\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(viteConfigPath);\n\n // One removal at a time: manipulating the tree invalidates sibling nodes.\n for (;;) {\n let removed = false;\n for (const arr of sourceFile.getDescendantsOfKind(\n SyntaxKind.ArrayLiteralExpression,\n )) {\n const index = arr\n .getElements()\n .findIndex((el) => el.getText().replace(/\\s/g, \"\") === \"wuchale()\");\n if (index >= 0) {\n arr.removeElement(index);\n removed = true;\n break;\n }\n }\n if (!removed) break;\n }\n\n removeImportByModuleSpecifier(sourceFile, \"wuchale/vite\");\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import { SyntaxKind } from \"ts-morph\";\nimport {\n resolveConfigTarget,\n saveTarget,\n type ConfigModifyResult,\n} from \"../../../../runtime/config-target\";\n\nconst HINTS = {\n notFound: \"No SvelteKit config to revert.\",\n failed:\n \"Remove the $locales alias from the sveltekit() arg in vite.config by hand.\",\n};\n\n/**\n * Remove the `$locales` alias enable-i18n wrote before SvelteKit 3, which\n * `sv migrate sveltekit-3` moves into the inline `sveltekit({...})` arg;\n * `alias` goes too once it is empty. Projects enabled since then map\n * `#locales/*` in package.json `imports` instead.\n */\nexport function unmodifyLocalesAlias(root: string): ConfigModifyResult {\n const res = resolveConfigTarget(root, HINTS);\n // Nothing to revert in a project without a config.\n if (res.status === \"not-found\") {\n return {\n filePath: res.filePath,\n outcome: { status: \"success\", changed: false },\n };\n }\n if (res.status === \"failed\") {\n return {\n filePath: res.filePath,\n outcome: { status: \"failed\", message: res.message },\n };\n }\n\n const { target } = res;\n const aliasProp = target.configObject\n .getProperty(\"alias\")\n ?.asKind(SyntaxKind.PropertyAssignment);\n const aliasObj = aliasProp\n ?.getInitializer()\n ?.asKind(SyntaxKind.ObjectLiteralExpression);\n const locales = aliasObj\n ?.getProperties()\n .find((p) => p.getText().replace(/['\"]/g, \"\").startsWith(\"$locales\"));\n if (aliasProp && aliasObj && locales) {\n locales.remove();\n if (aliasObj.getProperties().length === 0) aliasProp.remove();\n }\n return { filePath: target.filePath, outcome: saveTarget(target) };\n}\n","/**\n * Matches an import of wuchale's `src/locales/<name>.js` the way enable-i18n\n * writes it (`#locales/main.url.js`), and the `$locales/main.url` alias form\n * it wrote before SvelteKit 3, so disabling works on either.\n */\nexport function localesModule(name: string): (specifier: string) => boolean {\n const escaped = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const pattern = new RegExp(`^[$#]locales/${escaped}(\\\\.js)?$`);\n return (specifier) => pattern.test(specifier);\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n removeNamedImportIfUnused,\n removeTopLevelStatementByIdentifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\nimport { localesModule } from \"./locales-module\";\n\nconst I18N_HANDLE = \"handleWuchale\";\nconst FAILURE_HINT = dedent`\n Take handleWuchale out of the exported handle in src/hooks.server.ts, then\n remove its declaration, the loadLocales(...) calls and the wuchale and\n #locales imports.\n`;\n\nconst I18N_MODULES = [\n \"wuchale/load-utils/server\",\n // Since the handle follows the visitor's preference on pages without a\n // language in their URL; a project enabled before has none of the three.\n \"wuchale/url\",\n libModule(\"url.ts\"),\n libModule(\"locale.ts\"),\n localesModule(\"main.url\"),\n localesModule(\"data\"),\n localesModule(\"main.loader.server.svelte\"),\n localesModule(\"js.loader.server\"),\n];\n\n/**\n * Undo `modifyHooksServerI18n`: drop the locale bootstrap, the wuchale handle\n * and its imports, and unwrap `sequence(handleWuchale, ...)`. A file that\n * enable-i18n created comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerI18n(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (!original.includes(I18N_HANDLE) && !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 // loadLocales(...) bootstrap calls, one at a time (removal invalidates siblings).\n for (;;) {\n const stmt = sourceFile\n .getStatements()\n .find(\n (s) =>\n s.getKind() === SyntaxKind.ExpressionStatement &&\n /^loadLocales\\s*\\(/.test(s.getText()),\n );\n if (!stmt) break;\n stmt.remove();\n }\n\n // `export const handle = handleWuchale` goes altogether; a sequence loses\n // the argument, or unwraps to the handle it composed with.\n const removed = removeHandle(sourceFile, I18N_HANDLE);\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n removeTopLevelStatementByIdentifier(sourceFile, I18N_HANDLE);\n for (const moduleSpecifier of I18N_MODULES) {\n removeImportByModuleSpecifier(sourceFile, moduleSpecifier);\n }\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"sequence\");\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"Handle\");\n // A project from before SvelteKit 3 imports it from the package root.\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit\", \"Handle\");\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureBlankLineAfterImports,\n isEffectivelyEmpty,\n pruneUnusedImports,\n removeTopLevelStatementByIdentifier,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst DELOCALIZE_HELPER = \"rerouteDeLocalize\";\n\nconst FAILURE_HINT = dedent`\n Take rerouteDeLocalize out of the exported reroute in src/hooks.ts, then\n remove its declaration and the wuchale and #locales imports.\n`;\n\nconst I18N_MODULES = [\n \"wuchale/url\",\n localesModule(\"main.url\"),\n localesModule(\"data\"),\n];\n\n/** The two reroutes `modifyHooksI18n` writes: on its own, and composed. */\nconst I18N_ONLY_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*rerouteDeLocalize\\(\\s*url\\.pathname\\s*\\)$/;\nconst COMPOSED_REROUTE =\n /^\\(\\s*\\{\\s*url\\s*\\}\\s*\\)\\s*=>\\s*rerouteDeLocalize\\(\\s*negotiateReroute\\(\\s*url\\.pathname\\s*\\)\\s*\\)$/;\n\n/**\n * Undo `modifyHooksI18n`: drop the de-localizer and its imports, leaving the\n * negotiation reroute it may have been composed with. A file that enable-i18n\n * created comes out empty, for the caller to delete.\n */\nexport function unmodifyHooksI18n(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (!original.includes(DELOCALIZE_HELPER)) {\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(hooksPath);\n\n const helperStatement = sourceFile\n .getVariableDeclaration(DELOCALIZE_HELPER)\n ?.getFirstAncestorByKind(SyntaxKind.VariableStatement);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n const initText = rerouteDecl?.getInitializer()?.getText() ?? \"\";\n const composed = COMPOSED_REROUTE.test(initText);\n const rerouteStatement =\n composed || I18N_ONLY_REROUTE.test(initText)\n ? rerouteDecl?.getFirstAncestorByKind(SyntaxKind.VariableStatement)\n : undefined;\n\n // Anything else reading the de-localizer is code enable-i18n did not write,\n // so undoing it is the developer's call.\n const otherReaders = sourceFile\n .getStatements()\n .filter(\n (s) =>\n s !== helperStatement &&\n s !== rerouteStatement &&\n s.getText().includes(DELOCALIZE_HELPER),\n );\n if (otherReaders.length > 0) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n if (composed) {\n // content-negotiation's reroute is underneath; it stays.\n rerouteDecl?.setInitializer(\"({ url }) => negotiateReroute(url.pathname)\");\n } else if (rerouteStatement) {\n removeTopLevelStatementByIdentifier(sourceFile, \"reroute\");\n }\n\n removeTopLevelStatementByIdentifier(sourceFile, DELOCALIZE_HELPER);\n pruneUnusedImports(sourceFile, I18N_MODULES);\n\n if (isEffectivelyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty hooks.ts into a\n // delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(hooksPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * Put a real language back. `%sveltekit.lang%` is not a SvelteKit\n * placeholder; only the wuchale hook replaced it, so without that hook it\n * would be served literally.\n */\nexport function unmodifyAppHtml(appHtmlPath: string): ModifyOutcome {\n if (!fs.existsSync(appHtmlPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(appHtmlPath, \"utf8\");\n const updated = original.replace(\n /lang\\s*=\\s*(?:\"%sveltekit\\.lang%\"|'%sveltekit\\.lang%')/g,\n 'lang=\"en\"',\n );\n if (updated === original) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(appHtmlPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type Statement } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n LEGACY_LOAD_STATEMENT,\n LOAD_STATEMENT,\n} from \"../../../enable/i18n/modifies/+layout\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\nimport {\n ensureBlankLineAfterImports,\n isEffectivelyEmpty,\n pruneUnusedImports,\n removeImportByModuleSpecifier,\n removeStatementWithComments,\n formatLikeSource,\n type ModuleMatch,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { localesModule } from \"./locales-module\";\n\nconst FAILURE_HINT = dedent`\n src/routes/+layout.ts still loads wuchale locales. Remove these from it:\n\n import { browser } from '$app/env';\n import { loadLocale } from 'wuchale/load-utils';\n import { getLocale } from '#locales/main.url.js';\n import { hasLocalizedUrl } from '#lib/url.js';\n import '#locales/main.loader.svelte.js';\n import '#locales/js.loader.js';\n\n and the loadLocale(...) call inside load().\n`;\n\nconst SIDE_EFFECT_MODULES = [\n localesModule(\"main.loader.svelte\"),\n localesModule(\"js.loader\"),\n];\nconst BINDING_MODULES: ModuleMatch[] = [\n // `$app/env`, or the module it replaced before SvelteKit 3.\n (specifier) => /^\\$app\\/env(ironment)?$/.test(specifier),\n \"wuchale/load-utils\",\n localesModule(\"main.url\"),\n libModule(\"url.ts\"),\n];\n\n/** The loads enable-i18n has written: today's, and the URL-only one before it. */\nconst WRITTEN_LOADS = [LOAD_STATEMENT, LEGACY_LOAD_STATEMENT];\n\nfunction normalize(source: string): string {\n return source.replace(/[\"']/g, \"'\").replace(/\\s+/g, \"\");\n}\n\n/**\n * Undo `ensureRootLayoutI18n`: drop the wuchale load and its imports, leaving\n * whatever else the file holds. A file enable-i18n wrote whole comes out\n * empty, for the caller to delete.\n */\nexport function unmodifyRootLayoutI18n(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"loadLocale\") && !/[$#]locales\\//.test(original)) {\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(layoutPath);\n\n const loadStatement: Statement | undefined =\n sourceFile\n .getVariableStatements()\n .find((s) => s.getDeclarations().some((d) => d.getName() === \"load\")) ??\n sourceFile.getFunction(\"load\");\n\n if (loadStatement) {\n // A load that grew code of its own needs a hand; only the one enable-i18n\n // wrote is safe to take out wholesale.\n const load = normalize(loadStatement.getText());\n if (!WRITTEN_LOADS.some((written) => normalize(written) === load)) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n removeStatementWithComments(sourceFile, loadStatement);\n }\n\n for (const moduleSpecifier of SIDE_EFFECT_MODULES) {\n removeImportByModuleSpecifier(sourceFile, moduleSpecifier);\n }\n pruneUnusedImports(sourceFile, BINDING_MODULES);\n\n if (isEffectivelyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty +layout.ts into\n // a delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(layoutPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\n/** Take the language select (and the nav item enable-i18n wrapped it in) back out. */\nexport function unmodifyRootLayoutLanguageSelect(\n layoutPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"LanguageSelect\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/language-select.svelte\"),\n );\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n let updated = file.toString();\n updated = updated.replace(\n /[ \\t]*<Navbar\\.Item>\\s*<LanguageSelect\\s*\\/>\\s*<\\/Navbar\\.Item>[ \\t]*\\r?\\n?/g,\n \"\",\n );\n updated = updated.replace(/[ \\t]*<LanguageSelect\\s*\\/>[ \\t]*\\r?\\n?/g, \"\");\n\n fs.writeFileSync(layoutPath, updated, \"utf8\");\n return { status: \"success\", changed: updated !== original };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { LAYOUT_SERVER_SNIPPET } from \"../../../enable/i18n/modifies/layout.server\";\nimport { Node, SyntaxKind } from \"ts-morph\";\nimport { findLoadFunction } from \"../../../../runtime/load-function\";\nimport {\n removeUnusedBindingElement,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst normalize = (source: string) =>\n source.replace(/[\"']/g, \"'\").replace(/\\s+/g, \"\");\n\n/** The comment enable-i18n put above the property, on its own lines. */\nconst LOCALE_COMMENT =\n /^[ \\t]*\\/\\/ Decided on the server \\(src\\/hooks\\.server\\.ts\\), because pages without a\\r?\\n[ \\t]*\\/\\/ language in their URL follow the visitor's preference\\.\\r?\\n/m;\n\nconst FAILURE_HINT =\n \"src/routes/+layout.server.ts still returns `locale: locals.locale`. Remove it from the load.\";\n\n/**\n * Undo `modifyLayoutServerLocale`: the root layout's server load stops\n * returning `locale`. A file enable-i18n wrote whole comes out empty, for the\n * caller to delete.\n */\nexport function unmodifyLayoutServerLocale(\n layoutServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutServerPath, \"utf8\");\n if (!original.includes(\"locals.locale\")) {\n return { status: \"success\", changed: false };\n }\n\n if (normalize(original) === normalize(LAYOUT_SERVER_SNIPPET)) {\n fs.writeFileSync(layoutServerPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n // The comment first: left above a removed property it would attach itself\n // to whatever follows.\n const { source } = withInMemoryScript(\n original.replace(LOCALE_COMMENT, \"\"),\n (sf) => {\n const load = findLoadFunction(sf);\n const properties = (load ?? sf)\n .getDescendantsOfKind(SyntaxKind.PropertyAssignment)\n .filter(\n (property) =>\n property.getName() === \"locale\" &&\n /(^|\\.)locals\\.locale$/.test(\n property.getInitializer()?.getText() ?? \"\",\n ),\n );\n for (const property of properties) {\n const object = property.getParent();\n property.remove();\n // `return {}` reads worse on three lines than on one.\n if (\n Node.isObjectLiteralExpression(object) &&\n object.getProperties().length === 0\n ) {\n object.replaceWithText(\"{}\");\n }\n }\n removeUnusedBindingElement(sf, \"locals\");\n },\n );\n if (source === original) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.writeFileSync(layoutServerPath, source, \"utf8\");\n return { status: \"success\", changed: source !== original };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n LOCALS_COMMENT,\n LOCALS_MEMBER,\n} from \"../../../enable/i18n/modifies/app-d-ts\";\n\nconst escape = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\nconst MEMBER = new RegExp(\n `(?:^[ \\\\t]*${escape(LOCALS_COMMENT)}[ \\\\t]*\\\\r?\\\\n)?^[ \\\\t]*${escape(LOCALS_MEMBER)}[ \\\\t]*\\\\r?\\\\n`,\n \"m\",\n);\n\n/** An `interface Locals` left with nothing in it. */\nconst EMPTY_LOCALS = /^([ \\t]*)interface Locals\\s*\\{\\s*\\}/m;\n\n/**\n * Undo `modifyAppDts`: `App.Locals` loses `locale`, and an interface left\n * empty goes back to the comment `sv create` writes.\n */\nexport function unmodifyAppDts(appDtsPath: string): ModifyOutcome {\n if (!fs.existsSync(appDtsPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(appDtsPath, \"utf8\");\n if (!MEMBER.test(original)) {\n return { status: \"success\", changed: false };\n }\n\n const updated = original\n .replace(MEMBER, \"\")\n .replace(EMPTY_LOCALS, \"$1// interface Locals {}\");\n fs.writeFileSync(appDtsPath, updated, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\nimport { APP_LANGUAGE_SELECT } from \"../../../enable/i18n/modifies/app-layout.svelte\";\n\n/** Take the language select back out of the signed-in layout's header. */\nexport function unmodifyAppLayoutLanguageSelect(\n layoutPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(layoutPath, \"utf8\");\n if (!original.includes(\"LanguageSelect\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/language-select.svelte\"),\n );\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n const updated = file\n .toString()\n .replace(APP_LANGUAGE_SELECT, \"\")\n // Moved out of the wrapper by hand: the component alone still goes.\n .replace(/[ \\t]*<LanguageSelect\\s*\\/>[ \\t]*\\r?\\n?/g, \"\");\n\n fs.writeFileSync(layoutPath, updated, \"utf8\");\n return { status: \"success\", changed: updated !== original };\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 {\n modifyOutcomeToFile,\n revertOutcomeToFile,\n} from \"../../../runtime/modify-file\";\nimport {\n probeFirstExisting,\n VITE_CONFIG_CANDIDATES,\n} from \"../../../runtime/config-target\";\nimport { unmodifyGitignore } from \"./modifies/gitignore\";\nimport { unmodifyPrettierignore } from \"./modifies/prettierignore\";\nimport { unmodifyViteConfig } from \"./modifies/vite-config\";\nimport { unmodifyLocalesAlias } from \"./modifies/locales-alias\";\nimport { removePackageImports } from \"../../../runtime/package-imports\";\nimport { LOCALES_IMPORTS } from \"../../enable/i18n/modifies/package-imports\";\nimport { unmodifyHooksServerI18n } from \"./modifies/hooks.server\";\nimport { unmodifyHooksI18n } from \"./modifies/hooks\";\nimport { unmodifyAppHtml } from \"./modifies/app-html\";\nimport { unmodifyRootLayoutI18n } from \"./modifies/+layout\";\nimport { unmodifyRootLayoutLanguageSelect } from \"./modifies/root-layout.svelte\";\nimport { unmodifyLayoutServerLocale } from \"./modifies/layout.server\";\nimport { unmodifyAppDts } from \"./modifies/app-d-ts\";\nimport { unmodifyAppLayoutLanguageSelect } from \"./modifies/app-layout.svelte\";\nimport { APP_LAYOUT_PATH } from \"../../enable/i18n/modifies/app-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting 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, unmodifyViteConfig(viteConfigPath)),\n );\n\n logger.info(\"Removing #locales from package.json imports\");\n // Only while it still maps where enable-i18n pointed it.\n const imports = removePackageImports(\n options.root,\n Object.keys(LOCALES_IMPORTS),\n LOCALES_IMPORTS,\n );\n pushResult(modifyOutcomeToFile(imports.filePath, imports.outcome));\n\n // A project enabled before SvelteKit 3 has the `$locales` alias instead,\n // moved into the sveltekit() arg by `vela migrate sveltekit-3`.\n logger.info(\"Reverting the legacy $locales alias\");\n const alias = unmodifyLocalesAlias(options.root);\n pushResult(modifyOutcomeToFile(alias.filePath, alias.outcome));\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n // enable-i18n may have created it; emptied, it goes.\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerI18n(hooksServerPath),\n );\n pushResult(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n logger.info(\"Reverting hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n // The de-localizing reroute may be all it holds; emptied, it goes.\n const hooksRevert = revertOutcomeToFile(\n hooksPath,\n unmodifyHooksI18n(hooksPath),\n );\n pushResult(hooksRevert.modify);\n if (hooksRevert.delete) deletes.push(hooksRevert.delete);\n\n logger.info(\"Reverting app.html\");\n const appHtmlPath = path.join(options.root, \"src\", \"app.html\");\n pushResult(modifyOutcomeToFile(appHtmlPath, unmodifyAppHtml(appHtmlPath)));\n\n logger.info(\"Reverting root +layout.ts\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.ts\");\n // enable-i18n may have written the whole file; emptied, it goes.\n const layoutRevert = revertOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutI18n(layoutPath),\n );\n pushResult(layoutRevert.modify);\n if (layoutRevert.delete) deletes.push(layoutRevert.delete);\n\n logger.info(\"Reverting root +layout.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n // enable-i18n may have written the whole file; emptied, it goes.\n const layoutServerRevert = revertOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerLocale(layoutServerPath),\n );\n pushResult(layoutServerRevert.modify);\n if (layoutServerRevert.delete) deletes.push(layoutServerRevert.delete);\n\n logger.info(\"Reverting app.d.ts\");\n const appDtsPath = path.join(options.root, \"src\", \"app.d.ts\");\n pushResult(modifyOutcomeToFile(appDtsPath, unmodifyAppDts(appDtsPath)));\n\n logger.info(\"Reverting the signed-in layout language select\");\n const appLayoutPath = path.join(options.root, APP_LAYOUT_PATH);\n pushResult(\n modifyOutcomeToFile(\n appLayoutPath,\n unmodifyAppLayoutLanguageSelect(appLayoutPath),\n ),\n );\n\n logger.info(\"Reverting 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 for (const candidate of rootLayoutCandidates) {\n if (!fs.existsSync(candidate)) continue;\n pushResult(\n modifyOutcomeToFile(\n candidate,\n unmodifyRootLayoutLanguageSelect(candidate),\n ),\n );\n }\n\n logger.info(\"Reverting .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n pushResult(\n modifyOutcomeToFile(gitignorePath, unmodifyGitignore(gitignorePath)),\n );\n\n logger.info(\"Reverting .prettierignore\");\n const prettierignorePath = path.join(options.root, \".prettierignore\");\n pushResult(\n modifyOutcomeToFile(\n prettierignorePath,\n unmodifyPrettierignore(prettierignorePath),\n ),\n );\n\n // wuchale's loaders import the packages this uninstalls, and without the\n // .prettierignore block they would fail the project's lint. The catalogs\n // (.po) beside them are the translations, and stay.\n logger.info(\"Removing wuchale's loaders from src/locales\");\n const localesDir = path.join(options.root, \"src\", \"locales\");\n if (fs.existsSync(localesDir)) {\n for (const entry of fs.readdirSync(localesDir, { withFileTypes: true })) {\n if (!entry.isFile() || !entry.name.endsWith(\".js\")) continue;\n deletes.push({\n path: path.join(localesDir, entry.name),\n language: \"js\",\n content: \"\",\n status: \"success\",\n });\n }\n }\n\n return {\n creates: [],\n modifies,\n deletes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+B,GAAeD,EAAkBC,CAAa,CAAC,CACrE,GAEA0F,EAAO,KAAK,2BAA2B;CACvC,IAAMc,IAAqB1G,EAAK,KAAK6F,EAAQ,MAAM,iBAAiB;CAWpE,AAVAG,EACE7H,EACEuI,GACA/F,EAAuB+F,CAAkB,CAC3C,CACF,GAKAd,EAAO,KAAK,6CAA6C;CACzD,IAAMe,IAAa3G,EAAK,KAAK6F,EAAQ,MAAM,OAAO,SAAS;CAC3D,IAAI9F,EAAG,WAAW4G,CAAU,GAC1B,KAAK,IAAMC,KAAS7G,EAAG,YAAY4G,GAAY,EAAE,eAAe,GAAK,CAAC,GACpE,AAAKC,EAAM,OAAO,KAAMA,EAAM,KAAK,SAAS,KAAK,KACjDb,EAAQ,KAAK;EACX,MAAM/F,EAAK,KAAK2G,GAAYC,EAAM,IAAI;EACtC,UAAU;EACV,SAAS;EACT,QAAQ;CACV,CAAC;CAIL,OAAO;EACL,SAAS,CAAC;EACV;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-CgJIza72.js";
|
|
3
3
|
import { f as n, o as r } from "./ts-morph-helpers-B4KZXP44.js";
|
|
4
4
|
import { t as i } from "./svelte-file-DfplF3BU.js";
|
|
5
|
-
import { t as a } from "./shared-
|
|
5
|
+
import { t as a } from "./shared-BjTRQ5QH.js";
|
|
6
6
|
import o from "node:fs";
|
|
7
7
|
import s from "node:path";
|
|
8
8
|
import { Project as c, SyntaxKind as l } from "ts-morph";
|
|
@@ -88,4 +88,4 @@ async function f(n) {
|
|
|
88
88
|
}
|
|
89
89
|
export { f as generate };
|
|
90
90
|
|
|
91
|
-
//# sourceMappingURL=generate.runtime-
|
|
91
|
+
//# sourceMappingURL=generate.runtime-BlEy2fFF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-BlEy2fFF.js","names":["apiObj","getLogger","modifyOutcomeToFile","removeNavItemFromScript","formatLikeSource","SvelteFile","planDropsForCollections","fs","path","unmodifyHooksServer","hooksServerPath","originalSource","sourceFile","Project","callExpr","SyntaxKind","ce","firstArg","apiProp","apiInit","apiKeysProp","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","generate","logger","options","modifies","pushResult"],"sources":["../../src/patterns/disable/api-keys/modifies/hooks.server.ts","../../src/patterns/disable/api-keys/modifies/nav-user.svelte.ts","../../src/patterns/disable/api-keys/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyHooksServer(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n if (!callExpr) return { status: \"success\", changed: false };\n\n const [firstArg] = callExpr.getArguments();\n if (!firstArg || firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n const apiProp = optionsObj.getProperty(\"api\");\n if (!apiProp || apiProp.getKind() !== SyntaxKind.PropertyAssignment) {\n return { status: \"success\", changed: false };\n }\n\n const apiInit = (\n apiProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n if (!apiInit || apiInit.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const apiObj = apiInit as import(\"ts-morph\").ObjectLiteralExpression;\n const apiKeysProp = apiObj.getProperty(\"apiKeys\");\n if (!apiKeysProp) {\n return { status: \"success\", changed: false };\n }\n\n apiKeysProp.remove();\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/api-keys\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"API Keys\",\n \"@lucide/svelte/icons/key-round\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyHooksServer } from \"./modifies/hooks.server\";\nimport { unmodifyNavUser } from \"./modifies/nav-user.svelte\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(hooksServerPath, unmodifyHooksServer(hooksServerPath)),\n );\n\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n const collectionDrops = await planDropsForCollections([\"api_keys\"], options);\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":";;;;;;;;;AAKA,SAAgBS,EAAoB,GAAwC;CAC1E,IAAI,CAACF,EAAG,WAAWG,CAAe,GAChC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBJ,EAAG,aAAaG,GAAiB,MAAM,GAExDE,IAAa,IADCC,EACD,CAAA,CAAQ,oBAAoBH,CAAe,GAExDI,IAAWF,EACd,qBAAqBG,EAAW,cAAc,CAAC,CAC/C,MAAM,MAAOC,EAAG,cAAc,CAAC,CAAC,QAAQ,MAAM,kBAAkB;CACnE,IAAI,CAACF,GAAU,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE1D,IAAM,CAACG,KAAYH,EAAS,aAAa;CACzC,IAAI,CAACG,KAAYA,EAAS,QAAQ,MAAMF,EAAW,yBACjD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAI7C,IAAMG,IADaD,EAAS,cAAcF,EAAW,uBACrC,CAAA,CAAW,YAAY,KAAK;CAC5C,IAAI,CAACG,KAAWA,EAAQ,QAAQ,MAAMH,EAAW,oBAC/C,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMI,IACJD,EACA,eAA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KyB,EAAQ,MAAM,OAAO,iBAAiB;CAKxE,AAJAE,EACEjC,EAAoBQ,GAAiBD,EAAoBC,CAAe,CAAC,CAC3E,GAEAsB,EAAO,KAAK,2BAA2B;CACvC,IAAMV,IAAcd,EAAK,KACvByB,EAAQ,MACR,OACA,OACA,cACA,iBACF;CAKA,OAJAE,EAAWjC,EAAoBoB,GAAaD,EAAgBC,CAAW,CAAC,CAAC,GAIlE;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAA,MAV4BhB,EAAwB,CAAC,UAAU,GAAG2B,CAAO;CAW3E;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-CgJIza72.js";
|
|
3
3
|
import { t as n } from "./svelte-file-DfplF3BU.js";
|
|
4
4
|
import { _ as r, n as i, u as a } from "./ts-morph-helpers-B4KZXP44.js";
|
|
5
5
|
import { r as o } from "./lib-specifier-C3M0WTev.js";
|
|
@@ -43,4 +43,4 @@ async function u(n) {
|
|
|
43
43
|
}
|
|
44
44
|
export { u as generate };
|
|
45
45
|
|
|
46
|
-
//# sourceMappingURL=generate.runtime-
|
|
46
|
+
//# sourceMappingURL=generate.runtime-CBVcsole.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-CBVcsole.js","names":["getLogger","modifyOutcomeToFile","SvelteFile","withInMemoryScript","ensureBlankLineAfterImports","removeImportByModuleSpecifier","libModule","fs","path","unmodifyRootLayoutSvelte","layoutPath","file","out","content","sf","generate","logger","options","modifies"],"sources":["../../src/patterns/disable/ecommerce/modifies/root-layout.svelte.ts","../../src/patterns/disable/ecommerce/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\n/** Takes out the navbar item enable-ecommerce added, and its import. */\nexport function unmodifyRootLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (!file.hasElement(\"CartButton\")) {\n return { status: \"success\", changed: false };\n }\n\n if (!file.removeElementContaining(\"Navbar.Item\", \"CartButton\")) {\n file.removeElement(\"CartButton\");\n }\n file.modifyScript((content) => {\n const { source: out } = withInMemoryScript(content, (sf) => {\n removeImportByModuleSpecifier(\n sf,\n libModule(\"components/cart/cart-button.svelte\"),\n );\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyRootLayoutSvelte } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Taking the cart out of the navbar\");\n const layoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n const file = modifyOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutSvelte(layoutPath),\n );\n if (file) modifies.push(file);\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;AAWA,SAAgBS,EAAyB,GAAmC;CAC1E,IAAI,CAACF,EAAG,WAAWG,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAOT,EAAW,SAASQ,CAAU;CAoB3C,OAnBKC,EAAK,WAAW,YAAY,KAI5BA,EAAK,wBAAwB,eAAe,YAAY,KAC3DA,EAAK,cAAc,YAAY,GAEjCA,EAAK,cAAc,MAAY;EAC7B,IAAM,EAAE,QAAQC,MAAQT,EAAmBU,IAAU,MAAO;GAK1D,AAJAR,EACES,GACAR,EAAU,oCAAoC,CAChD,GACAF,EAA4BU,CAAE;EAChC,CAAC;EACD,OAAOF;CACT,CAAC,GAEDD,EAAK,QAAQD,CAAU,GAChB;EAAE,QAAQ;EAAW,SAASC,EAAK,WAAW;CAAE,KAlB9C;EAAE,QAAQ;EAAW,SAAS;CAAM;AAmB/C;;AC/BA,eAAsBI,EAAS,GAAkB;CAC/C,IAAMC,IAAShB,EAAUiB,CAAO,GAC1BC,IAAmB,CAAC;CAE1B,EAAO,KAAK,mCAAmC;CAC/C,IAAMR,IAAaF,EAAK,KACtBS,EAAQ,MACR,OACA,UACA,YACA,oBACF,GACMN,IAAOV,EACXS,GACAD,EAAyBC,CAAU,CACrC;CAGA,OAFIC,KAAMO,EAAS,KAAKP,CAAI,GAErB;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-CgJIza72.js";
|
|
3
3
|
import { r as n } from "./layout.svelte-B6wOQ7SM.js";
|
|
4
4
|
import r from "node:path";
|
|
5
5
|
// src/patterns/enable/og/generate.runtime.ts
|
|
@@ -20,4 +20,4 @@ async function i(i) {
|
|
|
20
20
|
}
|
|
21
21
|
export { i as generate };
|
|
22
22
|
|
|
23
|
-
//# sourceMappingURL=generate.runtime-
|
|
23
|
+
//# sourceMappingURL=generate.runtime-CCaCaXNu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-CCaCaXNu.js","names":["getLogger","modifyOutcomeToFile","modifyLayoutSvelte","path","generate","logger","options","modifies","layoutPath","file"],"sources":["../../src/patterns/enable/og/generate.runtime.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyLayoutSvelte } from \"./modifies/layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.svelte\");\n const file = modifyOutcomeToFile(layoutPath, modifyLayoutSvelte(layoutPath));\n if (file) modifies.push(file);\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;AAMA,eAAsBI,EAAS,GAAkB;CAC/C,IAAMC,IAASL,EAAUM,CAAO,GAC1BC,IAAmB,CAAC;CAE1B,EAAO,KAAK,qCAAqC;CACjD,IAAMC,IAAaL,EAAK,KAAKG,EAAQ,MAAM,OAAO,UAAU,gBAAgB,GACtEG,IAAOR,EAAoBO,GAAYN,EAAmBM,CAAU,CAAC;CAG3E,OAFIC,KAAMF,EAAS,KAAKE,CAAI,GAErB;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-CgJIza72.js";
|
|
3
3
|
import { o as n } from "./ts-morph-helpers-B4KZXP44.js";
|
|
4
4
|
import r from "node:fs";
|
|
5
5
|
import i from "node:path";
|
|
@@ -52,4 +52,4 @@ async function c(n) {
|
|
|
52
52
|
}
|
|
53
53
|
export { c as generate };
|
|
54
54
|
|
|
55
|
-
//# sourceMappingURL=generate.runtime-
|
|
55
|
+
//# sourceMappingURL=generate.runtime-Cm75waRD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-Cm75waRD.js","names":["getLogger","modifyOutcomeToFile","formatLikeSource","fs","path","unmodifyHooksServer","hooksServerPath","originalSource","sourceFile","Project","callExpr","SyntaxKind","ce","args","firstArg","optionsObj","apiProp","generate","logger","options","modifies","file"],"sources":["../../src/patterns/disable/api/modifies/hooks.server.ts","../../src/patterns/disable/api/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyHooksServer(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n\n if (!callExpr) {\n return { status: \"success\", changed: false };\n }\n\n const args = callExpr.getArguments();\n if (args.length === 0) {\n return { status: \"success\", changed: false };\n }\n\n const firstArg = args[0];\n if (firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n const apiProp = optionsObj.getProperty(\"api\");\n if (!apiProp) {\n return { status: \"success\", changed: false };\n }\n\n apiProp.remove();\n\n if (optionsObj.getProperties().length === 0) {\n callExpr.removeArgument(0);\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyHooksServer } from \"./modifies/hooks.server\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const file = modifyOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServer(hooksServerPath),\n );\n if (file) modifies.push(file);\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;AAKA,SAAgBK,EAAoB,GAAwC;CAC1E,IAAI,CAACF,EAAG,WAAWG,CAAe,GAChC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBJ,EAAG,aAAaG,GAAiB,MAAM,GAExDE,IAAa,IADCC,EACD,CAAA,CAAQ,oBAAoBH,CAAe,GAExDI,IAAWF,EACd,qBAAqBG,EAAW,cAAc,CAAC,CAC/C,MAAM,MAAOC,EAAG,cAAc,CAAC,CAAC,QAAQ,MAAM,kBAAkB;CAEnE,IAAI,CAACF,GACH,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMG,IAAOH,EAAS,aAAa;CACnC,IAAIG,EAAK,WAAW,GAClB,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAWD,EAAK;CACtB,IAAIC,EAAS,QAAQ,MAAMH,EAAW,yBACpC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMI,IAAaD,EAAS,cAAcH,EAAW,uBAAuB,GACtEK,IAAUD,EAAW,YAAY,KAAK;CAc5C,OAbKC,KAILA,EAAQ,OAAO,GAEXD,EAAW,cAAc,CAAC,CAAC,WAAW,KACxCL,EAAS,eAAe,CAAC,GAG3BR,EAAiBM,CAAU,GAC3BA,EAAW,SAAS,GAEb;EACL,QAAQ;EACR,SAASA,EAAW,YAAY,MAAMD;CACxC,KAfS;EAAE,QAAQ;EAAW,SAAS;CAAM;AAgB/C;;AC7CA,eAAsBU,EAAS,GAAkB;CAC/C,IAAMC,IAASlB,EAAUmB,CAAO,GAC1BC,IAAmB,CAAC;CAE1B,EAAO,KAAK,2BAA2B;CACvC,IAAMd,IAAkBF,EAAK,KAAKe,EAAQ,MAAM,OAAO,iBAAiB,GAClEE,IAAOpB,EACXK,GACAD,EAAoBC,CAAe,CACrC;CAGA,OAFIe,KAAMD,EAAS,KAAKC,CAAI,GAErB;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-CgJIza72.js";
|
|
3
3
|
import { t as n } from "./svelte-file-DfplF3BU.js";
|
|
4
4
|
import { _ as r, n as i, u as a } from "./ts-morph-helpers-B4KZXP44.js";
|
|
5
5
|
import { n as o, t as s } from "./layout.svelte-B6wOQ7SM.js";
|
|
@@ -45,4 +45,4 @@ async function f(n) {
|
|
|
45
45
|
}
|
|
46
46
|
export { f as generate };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=generate.runtime-
|
|
48
|
+
//# sourceMappingURL=generate.runtime-CuvdtjKc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-CuvdtjKc.js","names":["getLogger","modifyOutcomeToFile","SvelteFile","withInMemoryScript","ensureBlankLineAfterImports","removeImportByModuleSpecifier","findMetaTagsDerived","MODULE_SPECIFIER","fs","path","unmodifyLayoutSvelte","layoutPath","file","out","source","call","sf","Node","generate","logger","options","modifies"],"sources":["../../src/patterns/disable/og/modifies/layout.svelte.ts","../../src/patterns/disable/og/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Node } from \"ts-morph\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureBlankLineAfterImports,\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n findMetaTagsDerived,\n MODULE_SPECIFIER,\n} from \"../../../enable/og/modifies/layout.svelte\";\n\n/**\n * Takes `withCard(..., page.url)` back off the root layout's `metaTags`, and\n * its import with it. `page` stays imported: the layout used it before.\n */\nexport function unmodifyLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (!file.getScript()?.content.includes(\"withCard\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n const call = findMetaTagsDerived(sf)?.getArguments()[0];\n if (\n call &&\n Node.isCallExpression(call) &&\n call.getExpression().getText() === \"withCard\"\n ) {\n call.replaceWithText(call.getArguments()[0].getText());\n }\n removeImportByModuleSpecifier(sf, MODULE_SPECIFIER);\n ensureBlankLineAfterImports(sf);\n });\n return out;\n });\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyLayoutSvelte } from \"./modifies/layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n\n logger.info(\"Reverting src/routes/+layout.svelte\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.svelte\");\n const file = modifyOutcomeToFile(\n layoutPath,\n unmodifyLayoutSvelte(layoutPath),\n );\n if (file) modifies.push(file);\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgBU,EAAqB,GAAmC;CACtE,IAAI,CAACF,EAAG,WAAWG,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAOV,EAAW,SAASS,CAAU;CAsB3C,OArBKC,EAAK,UAAU,CAAC,EAAE,QAAQ,SAAS,UAAU,KAIlDA,EAAK,cAAc,MAAW;EAC5B,IAAM,EAAE,QAAQC,MAAQV,EAAmBW,IAAS,MAAO;GACzD,IAAMC,IAAOT,EAAoBU,CAAE,CAAC,EAAE,aAAa,CAAC,CAAC;GASrD,AAPED,KACAE,EAAK,iBAAiBF,CAAI,KAC1BA,EAAK,cAAc,CAAC,CAAC,QAAQ,MAAM,cAEnCA,EAAK,gBAAgBA,EAAK,aAAa,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAEvDV,EAA8BW,GAAIT,CAAgB,GAClDH,EAA4BY,CAAE;EAChC,CAAC;EACD,OAAOH;CACT,CAAC,GAEDD,EAAK,QAAQD,CAAU,GAChB;EAAE,QAAQ;EAAW,SAASC,EAAK,WAAW;CAAE,KApB9C;EAAE,QAAQ;EAAW,SAAS;CAAM;AAqB/C;;ACxCA,eAAsBM,EAAS,GAAkB;CAC/C,IAAMC,IAASnB,EAAUoB,CAAO,GAC1BC,IAAmB,CAAC;CAE1B,EAAO,KAAK,qCAAqC;CACjD,IAAMV,IAAaF,EAAK,KAAKW,EAAQ,MAAM,OAAO,UAAU,gBAAgB,GACtER,IAAOX,EACXU,GACAD,EAAqBC,CAAU,CACjC;CAGA,OAFIC,KAAMS,EAAS,KAAKT,CAAI,GAErB;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { i as t, n } from "./pocketbase-
|
|
3
|
-
import { r } from "./modify-file-
|
|
4
|
-
import { i, n as a, o } from "./whatsapp-
|
|
2
|
+
import { i as t, n } from "./pocketbase-S8lUt0nI.js";
|
|
3
|
+
import { r } from "./modify-file-CgJIza72.js";
|
|
4
|
+
import { i, n as a, o } from "./whatsapp-DT10x76l.js";
|
|
5
5
|
import { swapAuthPages as s } from "./auth-pages-BW3_yluN.js";
|
|
6
6
|
import c from "node:fs";
|
|
7
7
|
import l from "node:path";
|
|
@@ -38,4 +38,4 @@ async function d(d) {
|
|
|
38
38
|
}
|
|
39
39
|
export { d as generate };
|
|
40
40
|
|
|
41
|
-
//# sourceMappingURL=generate.runtime-
|
|
41
|
+
//# sourceMappingURL=generate.runtime-D0lI3Gt8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-D0lI3Gt8.js","names":["getLogger","withPocketbase","disableWhatsAppAuth","fs","path","DOCS_URL","generate","logger","options","creates","hasWhatsAppPlugin","pb","migrationDelay","file","writeWhatsAppConfigMigration","modifies","outcomes","swapAuthPages","filePath","outcome","modifyOutcomeToFile"],"sources":["../../src/patterns/disable/whatsapp/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { migrationDelay, withPocketbase } from \"../../../runtime/pocketbase\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport {\n disableWhatsAppAuth,\n hasWhatsAppPlugin,\n writeWhatsAppConfigMigration,\n} from \"../../enable/whatsapp/runtime/whatsapp\";\nimport { swapAuthPages } from \"../../enable/whatsapp/modifies/auth-pages\";\n\nconst DOCS_URL = \"https://velastack.dev/docs/disable/whatsapp\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n\n await withPocketbase(options.root, async (pb) => {\n // Without the plugin there is no WhatsApp sign-in to turn off.\n if (!(await hasWhatsAppPlugin(pb))) return;\n\n logger.info(\"Turning off WhatsApp sign-in for users\");\n await disableWhatsAppAuth(pb);\n await migrationDelay();\n const file = writeWhatsAppConfigMigration(options, false);\n if (!file) return;\n creates.push({\n path: file,\n language: \"js\",\n content: fs.readFileSync(file, \"utf8\"),\n status: \"success\",\n });\n });\n logger.info(\n \"Keeping the phone fields on users, and email optional: they hold your users' data\",\n );\n\n logger.info(\"Taking WhatsApp off the login and signup pages\");\n const modifies: File[] = [];\n const outcomes = await swapAuthPages(\n options.root,\n \"disable\",\n (filePath) =>\n `${path.relative(options.root, filePath)} is not the page enable-whatsapp wrote, so it was left as it is. Take the WhatsApp option out of it by hand: ${DOCS_URL}`,\n );\n for (const [filePath, outcome] of outcomes) {\n const file = modifyOutcomeToFile(filePath, outcome);\n if (file) modifies.push(file);\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":";;;;;;;;AAaA,IAAMK,IAAW;AAEjB,eAAsBC,EAAS,GAAkB;CAC/C,IAAMC,IAASP,EAAUQ,CAAO,GAC1BC,IAAkB,CAAC;CAsBzB,AApBA,MAAMR,EAAeO,EAAQ,MAAM,OAAO,MAAO;EAE/C,IAAI,CAAE,MAAME,EAAkBC,CAAE,GAAI;EAIpC,AAFAJ,EAAO,KAAK,wCAAwC,GACpD,MAAML,EAAoBS,CAAE,GAC5B,MAAMC,EAAe;EACrB,IAAMC,IAAOC,EAA6BN,GAAS,EAAK;EACxD,AAAKK,KACLJ,EAAQ,KAAK;GACX,MAAMI;GACN,UAAU;GACV,SAASV,EAAG,aAAaU,GAAM,MAAM;GACrC,QAAQ;EACV,CAAC;CACH,CAAC,GACDN,EAAO,KACL,mFACF,GAEAA,EAAO,KAAK,gDAAgD;CAC5D,IAAMQ,IAAmB,CAAC,GACpBC,IAAW,MAAMC,EACrBT,EAAQ,MACR,YACC,MACC,GAAGJ,EAAK,SAASI,EAAQ,MAAMU,CAAQ,EAAE,+GAA+Gb,GAC5J;CACA,KAAK,IAAM,CAACa,GAAUC,MAAYH,GAAU;EAC1C,IAAMH,IAAOO,EAAoBF,GAAUC,CAAO;EAClD,AAAIN,KAAME,EAAS,KAAKF,CAAI;CAC9B;CAEA,OAAO;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
-
import { r as t } from "./modify-file-
|
|
2
|
+
import { r as t } from "./modify-file-CgJIza72.js";
|
|
3
3
|
import { t as n } from "./dedent-CCUOcPFW.js";
|
|
4
4
|
import { t as r } from "./compose-handle-Da7m6lV_.js";
|
|
5
5
|
import { _ as i, o as a, r as o } from "./ts-morph-helpers-B4KZXP44.js";
|
|
@@ -177,4 +177,4 @@ async function T(n) {
|
|
|
177
177
|
}
|
|
178
178
|
export { T as generate };
|
|
179
179
|
|
|
180
|
-
//# sourceMappingURL=generate.runtime-
|
|
180
|
+
//# sourceMappingURL=generate.runtime-D6l6uLiY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-TPgoAXWD.js","names":["FAILURE_HINT","getLogger","modifyOutcomeToFile","dedent","addHandle","withInMemoryScript","formatLikeSource","ensureImports","SvelteFile","fs","path","FAILURE_HINT$1","HOOKS_SERVER_SNIPPET","ensureNegotiateHandleImport","existing","sourceFile","d","ni","modifyHooksServerNegotiate","hooksServerPath","original","Project","QuoteKind","NEGOTIATE_ONLY_SNIPPET","FAILURE_HINT","ensureNegotiateImport","modifyHooksNegotiate","hooksPath","rerouteDecl","SyntaxKind","init","hasI18nHelper","initText","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","modifyRootLayoutNegotiate","layoutPath","file","out","source","sf","generate","logger","options","modifies","pushResult","rootLayoutPath"],"sources":["../../src/patterns/enable/content-negotiation/modifies/hooks.server.ts","../../src/patterns/enable/content-negotiation/modifies/hooks.ts","../../src/patterns/enable/content-negotiation/modifies/root-layout.svelte.ts","../../src/patterns/enable/content-negotiation/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { addHandle } from \"../../../../runtime/compose-handle\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Wrap your exported handle with the negotiation handler:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = sequence(handleNegotiate, /* your existing handle */);\n`;\n\nconst HOOKS_SERVER_SNIPPET = dedent`\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = handleNegotiate;\n`;\n\nfunction ensureNegotiateHandleImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"handle\" &&\n ni.getAliasNode()?.getText() === \"handleNegotiate\"\n );\n });\n if (!has)\n existing.addNamedImport({ name: \"handle\", alias: \"handleNegotiate\" });\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"handle\", alias: \"handleNegotiate\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksServerNegotiate(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // SvelteKit loads the first `hooks.server.*` it finds, and `.js` sorts\n // first, so a new `.ts` beside it would never run.\n if (fs.existsSync(hooksServerPath.replace(/\\.ts$/, \".js\"))) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.mkdirSync(path.dirname(hooksServerPath), { recursive: true });\n fs.writeFileSync(hooksServerPath, HOOKS_SERVER_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"handleNegotiate\")) {\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 composed = addHandle(sourceFile, { expression: \"handleNegotiate\" });\n if (composed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureNegotiateHandleImport(sourceFile);\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst NEGOTIATE_ONLY_SNIPPET = dedent`\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => negotiateReroute(url.pathname);\n`;\n\nconst FAILURE_HINT = dedent`\n Compose your existing reroute in src/hooks.ts with the negotiation reroute:\n\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => existingReroute(negotiateReroute(url.pathname));\n`;\n\nfunction ensureNegotiateImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"reroute\" &&\n ni.getAliasNode()?.getText() === \"negotiateReroute\"\n );\n });\n if (!has) {\n existing.addNamedImport({ name: \"reroute\", alias: \"negotiateReroute\" });\n }\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"reroute\", alias: \"negotiateReroute\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksNegotiate(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n fs.mkdirSync(path.dirname(hooksPath), { recursive: true });\n fs.writeFileSync(hooksPath, NEGOTIATE_ONLY_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (original.includes(\"negotiateReroute\")) {\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(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n\n if (!rerouteDecl) {\n ensureNegotiateImport(sourceFile);\n sourceFile.addStatements(\n `\\nexport const reroute = ({ url }) => negotiateReroute(url.pathname);\\n`,\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const rerouteStmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n if (!rerouteStmt?.hasExportKeyword()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const init = rerouteDecl.getInitializer();\n if (!init) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const hasI18nHelper = sourceFile\n .getVariableDeclarations()\n .some((d) => d.getName() === \"rerouteDeLocalize\");\n const initText = init.getText();\n\n if (hasI18nHelper && initText.includes(\"rerouteDeLocalize\")) {\n ensureNegotiateImport(sourceFile);\n rerouteDecl.setInitializer(\n \"({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))\",\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n return { status: \"failed\", message: FAILURE_HINT };\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 { Negotiate } from '#lib/negotiate.js';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<Negotiate />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root +layout.svelte and mount <Negotiate /> 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:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nexport function modifyRootLayoutNegotiate(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(\"Negotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n namedImports: [\"Negotiate\"],\n moduleSpecifier: \"#lib/negotiate.js\",\n },\n ]);\n });\n return out;\n });\n\n file.appendMarkup(MARKUP_SNIPPET);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyHooksServerNegotiate } from \"./modifies/hooks.server\";\nimport { modifyHooksNegotiate } from \"./modifies/hooks\";\nimport { modifyRootLayoutNegotiate } 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 hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerNegotiate(hooksServerPath),\n ),\n );\n\n logger.info(\"Modifying hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n pushResult(modifyOutcomeToFile(hooksPath, modifyHooksNegotiate(hooksPath)));\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n modifyRootLayoutNegotiate(rootLayoutPath),\n ),\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAQA,IAAMA,IAAe,CAAM;;;;;;;GASrBY,IAAuB,CAAM;;;;;AAMnC,SAASC,EAA4B,GAAwB;CAC3D,IAAMC,IAAWC,EACd,sBAAsB,CAAC,CACvB,MAAM,MAAMC,EAAE,wBAAwB,MAAM,mBAAmB;CAClE,AAAI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,EAAQ,MAAM,OAAO,iBAAiB;CAQxE,AAPAE,EACE5C,EACEiB,GACAD,EAA2BC,CAAe,CAC5C,CACF,GAEAwB,EAAO,KAAK,oBAAoB;CAChC,IAAMhB,IAAYjB,EAAK,KAAKkC,EAAQ,MAAM,OAAO,UAAU;CAG3D,AAFAE,EAAW5C,EAAoByB,GAAWD,EAAqBC,CAAS,CAAC,CAAC,GAE1EgB,EAAO,KAAK,qCAAqC;CACjD,IAAMI,IAAiBrC,EAAK,KAC1BkC,EAAQ,MACR,OACA,UACA,gBACF;CAQA,OAPAE,EACE5C,EACE6C,GACAX,EAA0BW,CAAc,CAC1C,CACF,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
|
+
{"version":3,"file":"generate.runtime-D6l6uLiY.js","names":["FAILURE_HINT","getLogger","modifyOutcomeToFile","dedent","addHandle","withInMemoryScript","formatLikeSource","ensureImports","SvelteFile","fs","path","FAILURE_HINT$1","HOOKS_SERVER_SNIPPET","ensureNegotiateHandleImport","existing","sourceFile","d","ni","modifyHooksServerNegotiate","hooksServerPath","original","Project","QuoteKind","NEGOTIATE_ONLY_SNIPPET","FAILURE_HINT","ensureNegotiateImport","modifyHooksNegotiate","hooksPath","rerouteDecl","SyntaxKind","init","hasI18nHelper","initText","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","modifyRootLayoutNegotiate","layoutPath","file","out","source","sf","generate","logger","options","modifies","pushResult","rootLayoutPath"],"sources":["../../src/patterns/enable/content-negotiation/modifies/hooks.server.ts","../../src/patterns/enable/content-negotiation/modifies/hooks.ts","../../src/patterns/enable/content-negotiation/modifies/root-layout.svelte.ts","../../src/patterns/enable/content-negotiation/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { addHandle } from \"../../../../runtime/compose-handle\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Wrap your exported handle with the negotiation handler:\n\n import { sequence } from '@sveltejs/kit/hooks';\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = sequence(handleNegotiate, /* your existing handle */);\n`;\n\nconst HOOKS_SERVER_SNIPPET = dedent`\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n\n export const handle = handleNegotiate;\n`;\n\nfunction ensureNegotiateHandleImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"handle\" &&\n ni.getAliasNode()?.getText() === \"handleNegotiate\"\n );\n });\n if (!has)\n existing.addNamedImport({ name: \"handle\", alias: \"handleNegotiate\" });\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"handle\", alias: \"handleNegotiate\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksServerNegotiate(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n // SvelteKit loads the first `hooks.server.*` it finds, and `.js` sorts\n // first, so a new `.ts` beside it would never run.\n if (fs.existsSync(hooksServerPath.replace(/\\.ts$/, \".js\"))) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n fs.mkdirSync(path.dirname(hooksServerPath), { recursive: true });\n fs.writeFileSync(hooksServerPath, HOOKS_SERVER_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (original.includes(\"handleNegotiate\")) {\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 composed = addHandle(sourceFile, { expression: \"handleNegotiate\" });\n if (composed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n ensureNegotiateHandleImport(sourceFile);\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst NEGOTIATE_ONLY_SNIPPET = dedent`\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => negotiateReroute(url.pathname);\n`;\n\nconst FAILURE_HINT = dedent`\n Compose your existing reroute in src/hooks.ts with the negotiation reroute:\n\n import { reroute as negotiateReroute } from '#lib/negotiate.js';\n\n export const reroute = ({ url }) => existingReroute(negotiateReroute(url.pathname));\n`;\n\nfunction ensureNegotiateImport(sourceFile: SourceFile) {\n const existing = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"#lib/negotiate.js\");\n if (existing) {\n const has = existing.getNamedImports().some((ni) => {\n return (\n ni.getName() === \"reroute\" &&\n ni.getAliasNode()?.getText() === \"negotiateReroute\"\n );\n });\n if (!has) {\n existing.addNamedImport({ name: \"reroute\", alias: \"negotiateReroute\" });\n }\n return;\n }\n sourceFile.addImportDeclaration({\n namedImports: [{ name: \"reroute\", alias: \"negotiateReroute\" }],\n moduleSpecifier: \"#lib/negotiate.js\",\n });\n}\n\nexport function modifyHooksNegotiate(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n fs.mkdirSync(path.dirname(hooksPath), { recursive: true });\n fs.writeFileSync(hooksPath, NEGOTIATE_ONLY_SNIPPET + \"\\n\");\n return { status: \"success\", changed: true };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (original.includes(\"negotiateReroute\")) {\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(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n\n if (!rerouteDecl) {\n ensureNegotiateImport(sourceFile);\n sourceFile.addStatements(\n `\\nexport const reroute = ({ url }) => negotiateReroute(url.pathname);\\n`,\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n const rerouteStmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n if (!rerouteStmt?.hasExportKeyword()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const init = rerouteDecl.getInitializer();\n if (!init) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const hasI18nHelper = sourceFile\n .getVariableDeclarations()\n .some((d) => d.getName() === \"rerouteDeLocalize\");\n const initText = init.getText();\n\n if (hasI18nHelper && initText.includes(\"rerouteDeLocalize\")) {\n ensureNegotiateImport(sourceFile);\n rerouteDecl.setInitializer(\n \"({ url }) => rerouteDeLocalize(negotiateReroute(url.pathname))\",\n );\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return { status: \"success\", changed: true };\n }\n\n return { status: \"failed\", message: FAILURE_HINT };\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 { Negotiate } from '#lib/negotiate.js';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<Negotiate />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root +layout.svelte and mount <Negotiate /> 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:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nexport function modifyRootLayoutNegotiate(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(\"Negotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n {\n namedImports: [\"Negotiate\"],\n moduleSpecifier: \"#lib/negotiate.js\",\n },\n ]);\n });\n return out;\n });\n\n file.appendMarkup(MARKUP_SNIPPET);\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyHooksServerNegotiate } from \"./modifies/hooks.server\";\nimport { modifyHooksNegotiate } from \"./modifies/hooks\";\nimport { modifyRootLayoutNegotiate } 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 hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n modifyHooksServerNegotiate(hooksServerPath),\n ),\n );\n\n logger.info(\"Modifying hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n pushResult(modifyOutcomeToFile(hooksPath, modifyHooksNegotiate(hooksPath)));\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n modifyRootLayoutNegotiate(rootLayoutPath),\n ),\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAQA,IAAMA,IAAe,CAAM;;;;;;;GASrBY,IAAuB,CAAM;;;;;AAMnC,SAASC,EAA4B,GAAwB;CAC3D,IAAMC,IAAWC,EACd,sBAAsB,CAAC,CACvB,MAAM,MAAMC,EAAE,wBAAwB,MAAM,mBAAmB;CAClE,AAAIF,IACUA,EAAS,gBAAgB,CAAC,CAAC,MAAM,MAEzCG,EAAG,QAAQ,MAAM,YACjBA,EAAG,aAAa,CAAC,EAAE,QAAQ,MAAM,iBAGhC,KACHH,EAAS,eAAe;EAAE,MAAM;EAAU,OAAO;CAAkB,CAAC,IAGxEC,EAAW,qBAAqB;EAC9B,cAAc,CAAC;GAAE,MAAM;GAAU,OAAO;EAAkB,CAAC;EAC3D,iBAAiB;CACnB,CAAC;AACH;AAEA,SAAgBG,EACd,GACe;CACf,IAAI,CAACT,EAAG,WAAWU,CAAe,GAQhC,OALIV,EAAG,WAAWU,EAAgB,QAAQ,SAAS,KAAK,CAAC,IAChD;EAAE,QAAQ;EAAU,SAASnB;CAAa,KAEnDS,EAAG,UAAUC,EAAK,QAAQS,CAAe,GAAG,EAAE,WAAW,GAAK,CAAC,GAC/DV,EAAG,cAAcU,GAAiBP,IAAuB,IAAI,GACtD;EAAE,QAAQ;EAAW,SAAS;CAAK;CAG5C,IAAMQ,IAAWX,EAAG,aAAaU,GAAiB,MAAM;CACxD,IAAIC,EAAS,SAAS,iBAAiB,GACrC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAO7C,IAAML,IAAa,IAJCM,EAAQ;EAC1B,iBAAiB,EAAE,SAAS,GAAK;EACjC,sB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