@velastack/patterns 0.0.35 → 0.0.37
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-DRN-8nW0.js → collections-DQbbH7sz.js} +73 -5
- package/dist/chunks/collections-DQbbH7sz.js.map +1 -0
- package/dist/chunks/env-CU-NtvJ7.js +67 -0
- package/dist/chunks/env-CU-NtvJ7.js.map +1 -0
- package/dist/chunks/{env.preview-BZwjhgoi.js → env.preview-7Cc9KCgc.js} +1 -1
- package/dist/chunks/{env.preview-BZwjhgoi.js.map → env.preview-7Cc9KCgc.js.map} +1 -1
- package/dist/chunks/{env.runtime-BEdollKV.js → env.runtime-l1ssTZog.js} +1 -1
- package/dist/chunks/{env.runtime-BEdollKV.js.map → env.runtime-l1ssTZog.js.map} +1 -1
- package/dist/chunks/generate.runtime-B3ygXsYo.js +116 -0
- package/dist/chunks/generate.runtime-B3ygXsYo.js.map +1 -0
- package/dist/chunks/generate.runtime-BK3U_cCw.js +65 -0
- package/dist/chunks/generate.runtime-BK3U_cCw.js.map +1 -0
- package/dist/chunks/{generate.runtime-D7ksYerH.js → generate.runtime-CN5PiWOK.js} +7 -6
- package/dist/chunks/{generate.runtime-D7ksYerH.js.map → generate.runtime-CN5PiWOK.js.map} +1 -1
- package/dist/chunks/generate.runtime-Ci13Xrz_.js +107 -0
- package/dist/chunks/generate.runtime-Ci13Xrz_.js.map +1 -0
- package/dist/chunks/generate.runtime-D5I9Pe1O.js +93 -0
- package/dist/chunks/generate.runtime-D5I9Pe1O.js.map +1 -0
- package/dist/chunks/generate.runtime-D5ZkXanM.js +60 -0
- package/dist/chunks/generate.runtime-D5ZkXanM.js.map +1 -0
- package/dist/chunks/{generate.runtime-Caqa5ndO.js → generate.runtime-DFW9vKsO.js} +4 -3
- package/dist/chunks/{generate.runtime-Caqa5ndO.js.map → generate.runtime-DFW9vKsO.js.map} +1 -1
- package/dist/chunks/generate.runtime-DG7GcbJr.js +210 -0
- package/dist/chunks/generate.runtime-DG7GcbJr.js.map +1 -0
- package/dist/chunks/{generate.runtime-Cbq2649r.js → generate.runtime-DRx_VMuc.js} +29 -28
- package/dist/chunks/{generate.runtime-Cbq2649r.js.map → generate.runtime-DRx_VMuc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CZKIdbEC.js → generate.runtime-DedHJlsZ.js} +54 -53
- package/dist/chunks/{generate.runtime-CZKIdbEC.js.map → generate.runtime-DedHJlsZ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BVss5za4.js → generate.runtime-Df6qRZMP.js} +166 -135
- package/dist/chunks/generate.runtime-Df6qRZMP.js.map +1 -0
- package/dist/chunks/generate.runtime-GmszNklA.js +56 -0
- package/dist/chunks/generate.runtime-GmszNklA.js.map +1 -0
- package/dist/chunks/{generate.runtime-DTZ1PeDS.js → generate.runtime-GoC73zRO.js} +27 -26
- package/dist/chunks/{generate.runtime-DTZ1PeDS.js.map → generate.runtime-GoC73zRO.js.map} +1 -1
- package/dist/chunks/generate.runtime-Vvjaa4sc.js +224 -0
- package/dist/chunks/generate.runtime-Vvjaa4sc.js.map +1 -0
- package/dist/chunks/generate.runtime-fifS2KJv.js +135 -0
- package/dist/chunks/generate.runtime-fifS2KJv.js.map +1 -0
- package/dist/chunks/{modify-file-DT_1_kvI.js → modify-file-Bi-4GRwL.js} +2 -2
- package/dist/chunks/{modify-file-DT_1_kvI.js.map → modify-file-Bi-4GRwL.js.map} +1 -1
- package/dist/chunks/{modify-svelte-config-remote-CFsA9Mom.js → modify-svelte-config-remote-BcZVx_jI.js} +1 -1
- package/dist/chunks/{modify-svelte-config-remote-CFsA9Mom.js.map → modify-svelte-config-remote-BcZVx_jI.js.map} +1 -1
- package/dist/chunks/{pocketbase-iFJBbNJu.js → pocketbase-4_89gk_J.js} +1 -1
- package/dist/chunks/{pocketbase-iFJBbNJu.js.map → pocketbase-4_89gk_J.js.map} +1 -1
- package/dist/chunks/shared--goBUhsB.js +27 -0
- package/dist/chunks/shared--goBUhsB.js.map +1 -0
- package/dist/chunks/{ts-morph-helpers-C0HeJDjR.js → ts-morph-helpers-B0oxeDUU.js} +47 -3
- package/dist/chunks/ts-morph-helpers-B0oxeDUU.js.map +1 -0
- package/dist/chunks/{util-C064WO8o.js → util-CLl3VxaE.js} +4 -3
- package/dist/chunks/util-CLl3VxaE.js.map +1 -0
- package/dist/chunks/{write-result-CqSY1Bww.js → write-result-BuZpAeOf.js} +12 -7
- package/dist/chunks/{write-result-CqSY1Bww.js.map → write-result-BuZpAeOf.js.map} +1 -1
- package/dist/index.d.ts +912 -209
- package/dist/index.js +1946 -872
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/collections-DRN-8nW0.js.map +0 -1
- package/dist/chunks/generate.runtime--31y_UK2.js +0 -214
- package/dist/chunks/generate.runtime--31y_UK2.js.map +0 -1
- package/dist/chunks/generate.runtime-BVss5za4.js.map +0 -1
- package/dist/chunks/ts-morph-helpers-C0HeJDjR.js.map +0 -1
- package/dist/chunks/util-C064WO8o.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./errors-Co77I4oK.js";
|
|
2
|
-
import { n as t } from "./util-
|
|
2
|
+
import { n as t } from "./util-CLl3VxaE.js";
|
|
3
3
|
import { n, t as r } from "./logger-BpgCb-ZG.js";
|
|
4
|
-
import { getMigrationFile as i, migrationDelay as a, withPocketbase as o } from "./pocketbase-
|
|
4
|
+
import { getMigrationFile as i, migrationDelay as a, withPocketbase as o } from "./pocketbase-4_89gk_J.js";
|
|
5
5
|
import { readFileSync as s } from "node:fs";
|
|
6
6
|
//#region src/runtime/collections.ts
|
|
7
7
|
function c(e) {
|
|
@@ -83,7 +83,75 @@ async function p(e, n, o, c = r) {
|
|
|
83
83
|
}
|
|
84
84
|
return l;
|
|
85
85
|
}
|
|
86
|
-
async function m(e, r) {
|
|
86
|
+
async function m(e, t, n = r) {
|
|
87
|
+
try {
|
|
88
|
+
await e.collections.getOne(t);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
if (e.status === 404) return n.info(`Collection "${t}" does not exist, skipping drop`), {
|
|
91
|
+
dropped: !1,
|
|
92
|
+
existed: !1
|
|
93
|
+
};
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
96
|
+
return await e.collections.delete(t), {
|
|
97
|
+
dropped: !0,
|
|
98
|
+
existed: !0
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
async function h(e, t) {
|
|
102
|
+
try {
|
|
103
|
+
await e.collections.getOne(t);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
if (e.status === 404) return {
|
|
106
|
+
exists: !1,
|
|
107
|
+
rowCount: 0
|
|
108
|
+
};
|
|
109
|
+
throw e;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
return {
|
|
113
|
+
exists: !0,
|
|
114
|
+
rowCount: (await e.collection(t).getList(1, 1, { skipTotal: !1 })).totalItems
|
|
115
|
+
};
|
|
116
|
+
} catch {
|
|
117
|
+
return {
|
|
118
|
+
exists: !0,
|
|
119
|
+
rowCount: 0
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function g(e, t) {
|
|
124
|
+
let n = [];
|
|
125
|
+
for (let r of t) {
|
|
126
|
+
let t = await h(e, r);
|
|
127
|
+
n.push({
|
|
128
|
+
name: r,
|
|
129
|
+
exists: t.exists,
|
|
130
|
+
rowCount: t.rowCount
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return n;
|
|
134
|
+
}
|
|
135
|
+
async function _(e, r) {
|
|
136
|
+
if (e.length === 0) return [];
|
|
137
|
+
let c = [], l = n(r);
|
|
138
|
+
return await o(r.root, async (n) => {
|
|
139
|
+
for (let o of e) {
|
|
140
|
+
l.info(`Dropping collection "${o.name}"`);
|
|
141
|
+
let { dropped: e } = await m(n, o.name, l);
|
|
142
|
+
if (!e) continue;
|
|
143
|
+
await a();
|
|
144
|
+
let u = i(o.name, "deleted", r);
|
|
145
|
+
u && c.push({
|
|
146
|
+
path: u,
|
|
147
|
+
language: t(u),
|
|
148
|
+
content: s(u, "utf8"),
|
|
149
|
+
status: "success"
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}), c;
|
|
153
|
+
}
|
|
154
|
+
async function v(e, r) {
|
|
87
155
|
if (e.length === 0) return [];
|
|
88
156
|
let c = [], u = n(r);
|
|
89
157
|
return await o(r.root, async (n) => {
|
|
@@ -103,6 +171,6 @@ async function m(e, r) {
|
|
|
103
171
|
}), c;
|
|
104
172
|
}
|
|
105
173
|
//#endregion
|
|
106
|
-
export { p as applyCollectionFieldsPatches, d as applyCollectionRulePatches, l as createCollectionIdempotent,
|
|
174
|
+
export { p as applyCollectionFieldsPatches, d as applyCollectionRulePatches, l as createCollectionIdempotent, v as createCollections, _ as dropCollections, g as planCollectionDrops };
|
|
107
175
|
|
|
108
|
-
//# sourceMappingURL=collections-
|
|
176
|
+
//# sourceMappingURL=collections-DQbbH7sz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections-DQbbH7sz.js","names":[],"sources":["../../src/runtime/collections.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type PocketBase from \"pocketbase\";\nimport type { CollectionModel } from \"pocketbase\";\nimport type {\n CollectionDropSpec,\n CollectionFieldSpec,\n CollectionFieldsPatch,\n CollectionRulesPatch,\n CollectionSpec,\n File,\n Options,\n} from \"../core/types\";\nimport { InvalidArgumentError } from \"../core/errors\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\nimport { languageFromPath } from \"../core/util\";\nimport { getMigrationFile, migrationDelay, withPocketbase } from \"./pocketbase\";\n\ninterface PocketBaseCollectionCreateError {\n response?: {\n data?: {\n name?: {\n code?: string;\n };\n };\n };\n message?: string;\n}\n\nfunction isCollectionAlreadyExistsError(\n error: PocketBaseCollectionCreateError,\n): boolean {\n if (\n error.response?.data?.name?.code === \"validation_collection_name_exists\"\n ) {\n return true;\n }\n\n const message = error.message?.toLowerCase() ?? \"\";\n return (\n message.includes(\"already exists\") || message.includes(\"must be unique\")\n );\n}\n\ntype CollectionCreateInput = Parameters<PocketBase[\"collections\"][\"create\"]>[0];\n\nexport interface CreateCollectionResult {\n collection: CollectionModel;\n created: boolean;\n}\n\n/**\n * Idempotent wrapper around `pb.collections.create`. If the collection already\n * exists, logs and returns the existing model with `created: false` so callers\n * can skip work tied to a fresh create (e.g. appending a newly-generated\n * migration file to the result).\n */\nexport async function createCollectionIdempotent(\n pb: PocketBase,\n spec: CollectionCreateInput,\n logger: Logger = NOOP_LOGGER,\n): Promise<CreateCollectionResult> {\n const name = (spec as { name: string }).name;\n try {\n const collection = await pb.collections.create(spec);\n return { collection, created: true };\n } catch (error) {\n if (\n !isCollectionAlreadyExistsError(error as PocketBaseCollectionCreateError)\n ) {\n throw error;\n }\n logger.info(`Collection \"${name}\" already exists, skipping`);\n const collection = await pb.collections.getOne(name);\n return { collection, created: false };\n }\n}\n\nfunction rulePayloadFromPatch(\n patch: CollectionRulesPatch,\n): Record<string, unknown> {\n const payload: Record<string, unknown> = {};\n if (patch.listRule !== undefined) payload.listRule = patch.listRule;\n if (patch.viewRule !== undefined) payload.viewRule = patch.viewRule;\n if (patch.createRule !== undefined) payload.createRule = patch.createRule;\n if (patch.updateRule !== undefined) payload.updateRule = patch.updateRule;\n if (patch.deleteRule !== undefined) payload.deleteRule = patch.deleteRule;\n return payload;\n}\n\n/**\n * Applies API rule updates in array order. Call after all referenced collections exist.\n * Collects migration files produced by each update when `options` is provided.\n */\nexport async function applyCollectionRulePatches(\n pb: {\n collections: {\n getFirstListItem: (filter: string) => Promise<{ id: string }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionRulesPatch[],\n options?: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const escaped = patch.collectionName.replace(/'/g, \"''\");\n const col = await pb.collections.getFirstListItem(`name='${escaped}'`);\n logger.info(`Updating rules on collection \"${patch.collectionName}\"`);\n await pb.collections.update(col.id, rulePayloadFromPatch(patch));\n await migrationDelay();\n\n if (options) {\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (migrationFile) {\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n }\n }\n\n return migrations;\n}\n\nfunction applyFieldChanges(\n existing: CollectionFieldSpec[],\n patch: CollectionFieldsPatch,\n): CollectionFieldSpec[] {\n const fields = existing.map((field) => ({ ...field }));\n\n for (const change of patch.changes) {\n if (change.op === \"add\") {\n if (fields.some((f) => f.name === change.field.name)) {\n throw new InvalidArgumentError(\n `Field \"${change.field.name}\" already exists on collection \"${patch.collectionName}\"`,\n );\n }\n fields.push(change.field);\n continue;\n }\n if (change.op === \"remove\") {\n const index = fields.findIndex((f) => f.name === change.fieldName);\n if (index === -1) {\n throw new InvalidArgumentError(\n `Field \"${change.fieldName}\" does not exist on collection \"${patch.collectionName}\"`,\n );\n }\n fields.splice(index, 1);\n continue;\n }\n if (change.op === \"rename\") {\n const field = fields.find((f) => f.name === change.from);\n if (!field) {\n throw new InvalidArgumentError(\n `Field \"${change.from}\" does not exist on collection \"${patch.collectionName}\"`,\n );\n }\n if (fields.some((f) => f.name === change.to)) {\n throw new InvalidArgumentError(\n `Field \"${change.to}\" already exists on collection \"${patch.collectionName}\"`,\n );\n }\n field.name = change.to;\n continue;\n }\n }\n\n return fields;\n}\n\nexport async function applyCollectionFieldsPatches(\n pb: {\n collections: {\n getOne: (\n name: string,\n ) => Promise<{ id: string; fields: CollectionFieldSpec[] }>;\n update: (id: string, body: Record<string, unknown>) => Promise<unknown>;\n };\n },\n patches: CollectionFieldsPatch[],\n options: Options,\n logger: Logger = NOOP_LOGGER,\n): Promise<File[]> {\n const migrations: File[] = [];\n\n for (const patch of patches) {\n const collection = await pb.collections.getOne(patch.collectionName);\n const newFields = applyFieldChanges(collection.fields, patch);\n logger.info(`Updating fields on collection \"${patch.collectionName}\"`);\n await pb.collections.update(collection.id, { fields: newFields });\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n patch.collectionName,\n \"updated\",\n options,\n );\n if (!migrationFile) continue;\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n\n return migrations;\n}\n\nexport interface DropCollectionResult {\n dropped: boolean;\n existed: boolean;\n}\n\n/**\n * Idempotent collection drop. Returns `{ existed: false, dropped: false }` if\n * the collection is already gone, matching the idempotency contract of\n * `createCollectionIdempotent`.\n */\nexport async function dropCollectionIdempotent(\n pb: PocketBase,\n name: string,\n logger: Logger = NOOP_LOGGER,\n): Promise<DropCollectionResult> {\n try {\n await pb.collections.getOne(name);\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (status === 404) {\n logger.info(`Collection \"${name}\" does not exist, skipping drop`);\n return { dropped: false, existed: false };\n }\n throw error;\n }\n await pb.collections.delete(name);\n return { dropped: true, existed: true };\n}\n\nexport interface CollectionStats {\n exists: boolean;\n rowCount: number;\n}\n\nexport async function getCollectionStats(\n pb: PocketBase,\n name: string,\n): Promise<CollectionStats> {\n try {\n await pb.collections.getOne(name);\n } catch (error) {\n const status = (error as { status?: number }).status;\n if (status === 404) {\n return { exists: false, rowCount: 0 };\n }\n throw error;\n }\n\n try {\n const result = await pb.collection(name).getList(1, 1, { skipTotal: false });\n return { exists: true, rowCount: result.totalItems };\n } catch {\n return { exists: true, rowCount: 0 };\n }\n}\n\n/**\n * Resolve the set of collections to drop, with current row counts. Missing\n * collections are included with `exists: false, rowCount: 0` so callers can\n * display the full reversal plan even when some collections were already gone.\n */\nexport async function planCollectionDrops(\n pb: PocketBase,\n names: string[],\n): Promise<CollectionDropSpec[]> {\n const plans: CollectionDropSpec[] = [];\n for (const name of names) {\n const stats = await getCollectionStats(pb, name);\n plans.push({ name, exists: stats.exists, rowCount: stats.rowCount });\n }\n return plans;\n}\n\n/**\n * Drop each of the given collections (skipping those that are already gone)\n * and collect the `_deleted_<name>.js` migration file PocketBase emits for\n * each successful drop. Symmetric to `createCollections`.\n */\nexport async function dropCollections(\n specs: CollectionDropSpec[],\n options: Options,\n): Promise<File[]> {\n if (specs.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n const logger = getLogger(options);\n\n await withPocketbase(options.root, async (pb) => {\n for (const spec of specs) {\n logger.info(`Dropping collection \"${spec.name}\"`);\n const { dropped } = await dropCollectionIdempotent(pb, spec.name, logger);\n if (!dropped) continue;\n await migrationDelay();\n\n const migrationFile = getMigrationFile(spec.name, \"deleted\", options);\n if (!migrationFile) continue;\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n });\n\n return migrations;\n}\n\nexport async function createCollections(\n collections: CollectionSpec[],\n options: Options,\n): Promise<File[]> {\n if (collections.length === 0) {\n return [];\n }\n\n const migrations: File[] = [];\n const logger = getLogger(options);\n\n await withPocketbase(options.root, async (pb) => {\n for (const collection of collections) {\n logger.info(`Creating collection \"${collection.name}\"`);\n const { created } = await createCollectionIdempotent(\n pb,\n collection,\n logger,\n );\n if (!created) continue;\n await migrationDelay();\n\n const migrationFile = getMigrationFile(\n collection.name,\n \"created\",\n options,\n );\n if (!migrationFile) {\n continue;\n }\n\n migrations.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n }\n });\n\n return migrations;\n}\n"],"mappings":";;;;;;AA4BA,SAAS,EACP,GACS;AACT,KACE,EAAM,UAAU,MAAM,MAAM,SAAS,oCAErC,QAAO;CAGT,IAAM,IAAU,EAAM,SAAS,aAAa,IAAI;AAChD,QACE,EAAQ,SAAS,iBAAiB,IAAI,EAAQ,SAAS,iBAAiB;;AAiB5E,eAAsB,EACpB,GACA,G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IAAM,EAAE,eAAY,MAAM,EAAyB,GAAI,EAAK,MAAM,EAAO;AACzE,OAAI,CAAC,EAAS;AACd,SAAM,GAAgB;GAEtB,IAAM,IAAgB,EAAiB,EAAK,MAAM,WAAW,EAAQ;AAChE,QAEL,EAAW,KAAK;IACd,MAAM;IACN,UAAU,EAAiB,EAAc;IACzC,SAAS,EAAa,GAAe,OAAO;IAC5C,QAAQ;IACT,CAAC;;GAEJ,EAEK;;AAGT,eAAsB,EACpB,GACA,GACiB;AACjB,KAAI,EAAY,WAAW,EACzB,QAAO,EAAE;CAGX,IAAM,IAAqB,EAAE,EACvB,IAAS,EAAU,EAAQ;AA+BjC,QA7BA,MAAM,EAAe,EAAQ,MAAM,OAAO,MAAO;AAC/C,OAAK,IAAM,KAAc,GAAa;AACpC,KAAO,KAAK,wBAAwB,EAAW,KAAK,GAAG;GACvD,IAAM,EAAE,eAAY,MAAM,EACxB,GACA,GACA,EACD;AACD,OAAI,CAAC,EAAS;AACd,SAAM,GAAgB;GAEtB,IAAM,IAAgB,EACpB,EAAW,MACX,WACA,EACD;AACI,QAIL,EAAW,KAAK;IACd,MAAM;IACN,UAAU,EAAiB,EAAc;IACzC,SAAS,EAAa,GAAe,OAAO;IAC5C,QAAQ;IACT,CAAC;;GAEJ,EAEK"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import e from "node:fs";
|
|
2
|
+
//#region src/runtime/env.ts
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
return (!e.length || e.endsWith("\n") ? e : e + "\n") + t + "\n";
|
|
5
|
+
}
|
|
6
|
+
function n(e, n) {
|
|
7
|
+
let r = e;
|
|
8
|
+
for (let e of n) {
|
|
9
|
+
if (e.type === "comment") {
|
|
10
|
+
let n = `# ${e.key}`;
|
|
11
|
+
r.includes(n) || (r = t(r, n));
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
r.includes(`${e.key}=`) || (r = t(r, `${e.key}=${e.value ?? ""}`));
|
|
15
|
+
}
|
|
16
|
+
return r;
|
|
17
|
+
}
|
|
18
|
+
function r(t, r) {
|
|
19
|
+
let i = e.existsSync(t) ? e.readFileSync(t, "utf8") : "", a = n(i, r);
|
|
20
|
+
return a === i ? {
|
|
21
|
+
status: "success",
|
|
22
|
+
changed: !1
|
|
23
|
+
} : (e.writeFileSync(t, a, "utf8"), {
|
|
24
|
+
status: "success",
|
|
25
|
+
changed: !0
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function i(e, t) {
|
|
29
|
+
let n = e.split("\n"), r = n.map(() => !0);
|
|
30
|
+
for (let e of t) if (e.type === "var") for (let t = 0; t < n.length; t++) {
|
|
31
|
+
if (!r[t]) continue;
|
|
32
|
+
let i = n[t];
|
|
33
|
+
(i === `${e.key}=${e.value ?? ""}` || i.startsWith(`${e.key}=`)) && (r[t] = !1);
|
|
34
|
+
}
|
|
35
|
+
for (let e of t) {
|
|
36
|
+
if (e.type !== "comment") continue;
|
|
37
|
+
let t = `# ${e.key}`;
|
|
38
|
+
for (let e = 0; e < n.length; e++) {
|
|
39
|
+
if (!r[e] || n[e] !== t) continue;
|
|
40
|
+
let i = e + 1;
|
|
41
|
+
for (; i < n.length && (!r[i] || n[i].trim() === "");) i++;
|
|
42
|
+
(i >= n.length || n[i].startsWith("#")) && (r[e] = !1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
let i = [], a = !1;
|
|
46
|
+
for (let e = 0; e < n.length; e++) {
|
|
47
|
+
if (!r[e]) continue;
|
|
48
|
+
let t = n[e].trim() === "";
|
|
49
|
+
t && a || (i.push(n[e]), a = t);
|
|
50
|
+
}
|
|
51
|
+
for (; i.length > 0 && i[i.length - 1].trim() === "";) i.pop();
|
|
52
|
+
return i.length === 0 ? "" : i.join("\n") + "\n";
|
|
53
|
+
}
|
|
54
|
+
function a(t, n) {
|
|
55
|
+
let r = e.existsSync(t) ? e.readFileSync(t, "utf8") : "", a = i(r, n);
|
|
56
|
+
return a === r ? {
|
|
57
|
+
status: "success",
|
|
58
|
+
changed: !1
|
|
59
|
+
} : (e.writeFileSync(t, a, "utf8"), {
|
|
60
|
+
status: "success",
|
|
61
|
+
changed: !0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { a as n, r as t };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=env-CU-NtvJ7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-CU-NtvJ7.js","names":[],"sources":["../../src/runtime/env.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../core/types\";\n\nexport interface EnvEdit {\n type: \"comment\" | \"var\";\n /** For \"comment\": the text after `# `. For \"var\": the KEY. */\n key: string;\n /** Only for \"var\" entries. */\n value?: string;\n}\n\nfunction appendEnvContent(existing: string, content: string): string {\n const withNewLine =\n !existing.length || existing.endsWith(\"\\n\") ? existing : existing + \"\\n\";\n return withNewLine + content + \"\\n\";\n}\n\nexport function applyEnvEdits(source: string, edits: EnvEdit[]): string {\n let next = source;\n for (const edit of edits) {\n if (edit.type === \"comment\") {\n const commented = `# ${edit.key}`;\n if (!next.includes(commented)) {\n next = appendEnvContent(next, commented);\n }\n continue;\n }\n if (!next.includes(`${edit.key}=`)) {\n next = appendEnvContent(next, `${edit.key}=${edit.value ?? \"\"}`);\n }\n }\n return next;\n}\n\nexport function modifyEnv(envPath: string, edits: EnvEdit[]): ModifyOutcome {\n const existing = fs.existsSync(envPath)\n ? fs.readFileSync(envPath, \"utf8\")\n : \"\";\n const next = applyEnvEdits(existing, edits);\n if (next === existing) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(envPath, next, \"utf8\");\n return { status: \"success\", changed: true };\n}\n\n/**\n * Remove lines matching the given edits from env source. Var edits remove the\n * exact `KEY=...` line (anchored, so `FOO` does not match `FOO_BAR`). Comment\n * edits remove the `# key` line only when it has become orphaned — i.e. the\n * next non-blank line is another comment, another orphaned block, or EOF.\n */\nexport function removeEnvEdits(source: string, edits: EnvEdit[]): string {\n const lines = source.split(\"\\n\");\n const keep: boolean[] = lines.map(() => true);\n\n for (const edit of edits) {\n if (edit.type !== \"var\") continue;\n for (let i = 0; i < lines.length; i++) {\n if (!keep[i]) continue;\n const line = lines[i];\n if (line === `${edit.key}=${edit.value ?? \"\"}` || line.startsWith(`${edit.key}=`)) {\n keep[i] = false;\n }\n }\n }\n\n for (const edit of edits) {\n if (edit.type !== \"comment\") continue;\n const target = `# ${edit.key}`;\n for (let i = 0; i < lines.length; i++) {\n if (!keep[i] || lines[i] !== target) continue;\n let j = i + 1;\n while (j < lines.length && (!keep[j] || lines[j].trim() === \"\")) j++;\n const nextIsComment = j >= lines.length || lines[j].startsWith(\"#\");\n if (nextIsComment) {\n keep[i] = false;\n }\n }\n }\n\n const result: string[] = [];\n let lastWasBlank = false;\n for (let i = 0; i < lines.length; i++) {\n if (!keep[i]) continue;\n const isBlank = lines[i].trim() === \"\";\n if (isBlank && lastWasBlank) continue;\n result.push(lines[i]);\n lastWasBlank = isBlank;\n }\n\n while (result.length > 0 && result[result.length - 1].trim() === \"\") {\n result.pop();\n }\n\n return result.length === 0 ? \"\" : result.join(\"\\n\") + \"\\n\";\n}\n\nexport function modifyEnvRemove(\n envPath: string,\n edits: EnvEdit[],\n): ModifyOutcome {\n const existing = fs.existsSync(envPath)\n ? fs.readFileSync(envPath, \"utf8\")\n : \"\";\n const next = removeEnvEdits(existing, edits);\n if (next === existing) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(envPath, next, \"utf8\");\n return { status: \"success\", changed: true };\n}\n"],"mappings":";;AAWA,SAAS,EAAiB,GAAkB,GAAyB;AAGnE,SADE,CAAC,EAAS,UAAU,EAAS,SAAS,KAAK,GAAG,IAAW,IAAW,QACjD,IAAU;;AAGjC,SAAgB,EAAc,GAAgB,GAA0B;CACtE,IAAI,IAAO;AACX,MAAK,IAAM,KAAQ,GAAO;AACxB,MAAI,EAAK,SAAS,WAAW;GAC3B,I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,EAAK,KAAK;;;CAKhB,IAAM,IAAmB,EAAE,EACvB,IAAe;AACnB,MAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,KAAK;AACrC,MAAI,CAAC,EAAK,GAAI;EACd,IAAM,IAAU,EAAM,GAAG,MAAM,KAAK;AAChC,OAAW,MACf,EAAO,KAAK,EAAM,GAAG,EACrB,IAAe;;AAGjB,QAAO,EAAO,SAAS,KAAK,EAAO,EAAO,SAAS,GAAG,MAAM,KAAK,IAC/D,GAAO,KAAK;AAGd,QAAO,EAAO,WAAW,IAAI,KAAK,EAAO,KAAK,KAAK,GAAG;;AAGxD,SAAgB,EACd,GACA,GACe;CACf,IAAM,IAAW,EAAG,WAAW,EAAQ,GACnC,EAAG,aAAa,GAAS,OAAO,GAChC,IACE,IAAO,EAAe,GAAU,EAAM;AAK5C,QAJI,MAAS,IACJ;EAAE,QAAQ;EAAW,SAAS;EAAO,IAE9C,EAAG,cAAc,GAAS,GAAM,OAAO,EAChC;EAAE,QAAQ;EAAW,SAAS;EAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.preview-
|
|
1
|
+
{"version":3,"file":"env.preview-7Cc9KCgc.js","names":[],"sources":["../../src/parse/env.preview.ts"],"sourcesContent":["import type { Options } from \"../core/types\";\nimport type { Collection } from \"./types\";\n\nexport function getPreviewCollections(\n options: Pick<Options, \"features\">,\n): Collection[] {\n if (options.features.auth) {\n return [\n {\n id: \"users_preview\",\n name: \"users\",\n type: \"auth\",\n fields: [\n { name: \"email\", type: \"email\" },\n { name: \"name\", type: \"text\" },\n ],\n },\n ];\n }\n return [];\n}\n"],"mappings":";AAGA,SAAgB,EACd,GACc;AAcd,QAbI,EAAQ,SAAS,OACZ,CACL;EACE,IAAI;EACJ,MAAM;EACN,MAAM;EACN,QAAQ,CACN;GAAE,MAAM;GAAS,MAAM;GAAS,EAChC;GAAE,MAAM;GAAQ,MAAM;GAAQ,CAC/B;EACF,CACF,GAEI,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.runtime-
|
|
1
|
+
{"version":3,"file":"env.runtime-l1ssTZog.js","names":[],"sources":["../../src/parse/env.runtime.ts"],"sourcesContent":["import { getCollections as getCollectionsFromPB } from \"@velastack/pocketbase/internal\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport { DATA_DIR } from \"../core/constants\";\nimport type { Collection } from \"./types\";\n\nfunction hasProjectMarkers(dir: string): boolean {\n return (\n fs.existsSync(path.join(dir, \"package.json\")) &&\n fs.existsSync(path.join(dir, DATA_DIR))\n );\n}\n\nexport function resolveProjectRoot(startDir = process.cwd()): string {\n let current = path.resolve(startDir);\n\n while (true) {\n if (hasProjectMarkers(current)) {\n return current;\n }\n\n const parent = path.dirname(current);\n if (parent === current) {\n break;\n }\n current = parent;\n }\n\n throw new Error(\n `Could not resolve project root from \"${startDir}\". Expected package.json, and ${DATA_DIR}.`,\n );\n}\n\nexport async function getCollections(): Promise<Collection[]> {\n const root = resolveProjectRoot();\n\n return getCollectionsFromPB({\n pocketbaseUrl: \"\",\n superuserEmail: process.env.POCKETBASE_SUPERUSER_EMAIL!,\n superuserPassword: process.env.POCKETBASE_SUPERUSER_PASSWORD!,\n root,\n }) as Promise<Collection[]>;\n}\n"],"mappings":";;;;;;AAOA,SAAS,EAAkB,GAAsB;AAC/C,QACE,EAAG,WAAW,EAAK,KAAK,GAAK,eAAe,CAAC,IAC7C,EAAG,WAAW,EAAK,KAAK,GAAA,OAAc,CAAC;;AAI3C,SAAgB,EAAmB,IAAW,EAAQ,KAAK,EAAU;CACnE,IAAI,IAAU,EAAK,QAAQ,EAAS;AAEpC,UAAa;AACX,MAAI,EAAkB,EAAQ,CAC5B,QAAO;EAGT,IAAM,IAAS,EAAK,QAAQ,EAAQ;AACpC,MAAI,MAAW,EACb;AAEF,MAAU;;AAGZ,OAAU,MACR,wCAAwC,EAAS,gCAAgC,EAAS,GAC3F;;AAGH,eAAsB,IAAwC;CAC5D,IAAM,IAAO,GAAoB;AAEjC,QAAO,EAAqB;EAC1B,eAAe;EACf,gBAAgB,EAAQ,IAAI;EAC5B,mBAAmB,EAAQ,IAAI;EAC/B;EACD,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { n as e } from "./logger-BpgCb-ZG.js";
|
|
2
|
+
import { t } from "./shared--goBUhsB.js";
|
|
3
|
+
import { modifyOutcomeToFile as n } from "./modify-file-Bi-4GRwL.js";
|
|
4
|
+
import { i as r, o as i } from "./ts-morph-helpers-B0oxeDUU.js";
|
|
5
|
+
import { n as a } from "./env-CU-NtvJ7.js";
|
|
6
|
+
import o from "node:fs";
|
|
7
|
+
import s from "node:path";
|
|
8
|
+
import { Project as c, QuoteKind as l, SyntaxKind as u } from "ts-morph";
|
|
9
|
+
//#region src/patterns/disable/payments/modifies/modify-nav-user.ts
|
|
10
|
+
function d(e) {
|
|
11
|
+
if (!o.existsSync(e)) return {
|
|
12
|
+
status: "success",
|
|
13
|
+
changed: !1
|
|
14
|
+
};
|
|
15
|
+
let t = o.readFileSync(e, "utf8");
|
|
16
|
+
if (!t.includes("/billing")) return {
|
|
17
|
+
status: "success",
|
|
18
|
+
changed: !1
|
|
19
|
+
};
|
|
20
|
+
let n = new i(t), a = !1, s = (e) => {
|
|
21
|
+
a || e((e) => {
|
|
22
|
+
let t = r(e, "Billing", "@lucide/svelte/icons/credit-card");
|
|
23
|
+
return t.wasRemoved && (a = !0), t.source;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
return s((e) => n.modifyModuleScript(e)), a || s((e) => n.modifyScript(e)), a ? (o.writeFileSync(e, n.toString(), "utf8"), {
|
|
27
|
+
status: "success",
|
|
28
|
+
changed: !0
|
|
29
|
+
}) : {
|
|
30
|
+
status: "success",
|
|
31
|
+
changed: !1
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/patterns/disable/payments/modifies/modify-user-signup.ts
|
|
36
|
+
function f(e) {
|
|
37
|
+
if (!o.existsSync(e)) return {
|
|
38
|
+
status: "success",
|
|
39
|
+
changed: !1
|
|
40
|
+
};
|
|
41
|
+
let t = o.readFileSync(e, "utf8");
|
|
42
|
+
if (!t.includes("linkStripeCustomer")) return {
|
|
43
|
+
status: "success",
|
|
44
|
+
changed: !1
|
|
45
|
+
};
|
|
46
|
+
let n = new c({ manipulationSettings: { quoteKind: l.Single } }).addSourceFileAtPath(e), r = n.getImportDeclarations().find((e) => e.getModuleSpecifierValue() === "$lib/stripe");
|
|
47
|
+
r && r.remove();
|
|
48
|
+
let i = n.getVariableStatement((e) => e.getDeclarations().some((e) => e.getName() === "linkStripeCustomer"));
|
|
49
|
+
i && i.remove();
|
|
50
|
+
let a = n.getDescendantsOfKind(u.CallExpression).filter((e) => e.getExpression().getText() === "linkStripeCustomer");
|
|
51
|
+
for (let e of a) {
|
|
52
|
+
let t = e.getFirstAncestorByKind(u.ExpressionStatement);
|
|
53
|
+
t && t.remove();
|
|
54
|
+
}
|
|
55
|
+
return n.formatText(), n.saveSync(), {
|
|
56
|
+
status: "success",
|
|
57
|
+
changed: n.getFullText() !== t
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/patterns/disable/payments/generate.runtime.ts
|
|
62
|
+
async function p(r) {
|
|
63
|
+
let i = r.features.auth, o = e(r), c = [], l = (e) => {
|
|
64
|
+
e && c.push(e);
|
|
65
|
+
};
|
|
66
|
+
o.info("Stripping Stripe credentials from .env");
|
|
67
|
+
let u = [
|
|
68
|
+
{
|
|
69
|
+
type: "comment",
|
|
70
|
+
key: "Stripe credentials"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: "var",
|
|
74
|
+
key: "STRIPE_SECRET_KEY"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "var",
|
|
78
|
+
key: "PUBLIC_STRIPE_PUBLISHABLE_KEY"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "var",
|
|
82
|
+
key: "STRIPE_WEBHOOK_SECRET"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: "var",
|
|
86
|
+
key: "INTERNAL_JOB_SECRET"
|
|
87
|
+
}
|
|
88
|
+
], p = s.join(r.root, ".env");
|
|
89
|
+
if (l(n(p, a(p, u))), i) {
|
|
90
|
+
o.info("Reverting nav-user.svelte");
|
|
91
|
+
let e = s.join(r.root, "src", "lib", "components", "nav-user.svelte");
|
|
92
|
+
l(n(e, d(e))), o.info("Reverting signup +page.server.ts");
|
|
93
|
+
let t = s.join(r.root, "src", "routes", "(public)", "signup", "+page.server.ts");
|
|
94
|
+
l(n(t, f(t)));
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
creates: [],
|
|
98
|
+
modifies: c,
|
|
99
|
+
deletes: [],
|
|
100
|
+
components: [],
|
|
101
|
+
packages: [],
|
|
102
|
+
collections: [],
|
|
103
|
+
collectionPatches: [],
|
|
104
|
+
collectionDrops: await t(i ? [
|
|
105
|
+
"transactions",
|
|
106
|
+
"stripe_customers",
|
|
107
|
+
"stripe_payment_methods",
|
|
108
|
+
"stripe_prices",
|
|
109
|
+
"stripe_products"
|
|
110
|
+
] : ["stripe_prices", "stripe_products"], r)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { p as generate };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=generate.runtime-B3ygXsYo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-B3ygXsYo.js","names":[],"sources":["../../src/patterns/disable/payments/modifies/modify-nav-user.ts","../../src/patterns/disable/payments/modifies/modify-user-signup.ts","../../src/patterns/disable/payments/generate.runtime.ts"],"sourcesContent":["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(\"/billing\")) {\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 \"Billing\",\n \"@lucide/svelte/icons/credit-card\",\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 fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n if (!originalSource.includes(\"linkStripeCustomer\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n const stripeImport = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"$lib/stripe\");\n if (stripeImport) stripeImport.remove();\n\n const linkFn = sourceFile.getVariableStatement((s) =>\n s.getDeclarations().some((d) => d.getName() === \"linkStripeCustomer\"),\n );\n if (linkFn) linkFn.remove();\n\n const callStatements = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((ce) => ce.getExpression().getText() === \"linkStripeCustomer\");\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n if (stmt) stmt.remove();\n }\n\n sourceFile.formatText();\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 { modifyEnvRemove, type EnvEdit } from \"../../../runtime/env\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const isAppMode = options.features.auth;\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(\"Stripping Stripe credentials from .env\");\n const envEdits: EnvEdit[] = [\n { type: \"comment\", key: \"Stripe credentials\" },\n { type: \"var\", key: \"STRIPE_SECRET_KEY\" },\n { type: \"var\", key: \"PUBLIC_STRIPE_PUBLISHABLE_KEY\" },\n { type: \"var\", key: \"STRIPE_WEBHOOK_SECRET\" },\n { type: \"var\", key: \"INTERNAL_JOB_SECRET\" },\n ];\n const envPath = path.join(options.root, \".env\");\n pushResult(modifyOutcomeToFile(envPath, modifyEnvRemove(envPath, envEdits)));\n\n if (isAppMode) {\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 logger.info(\"Reverting signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, unmodifyUserSignup(userSignupPath)),\n );\n }\n\n const collectionNames = [\n \"transactions\",\n \"stripe_customers\",\n \"stripe_payment_methods\",\n \"stripe_prices\",\n \"stripe_products\",\n ];\n const collectionDrops = await planDropsForCollections(\n isAppMode ? collectionNames : [\"stripe_prices\", \"stripe_products\"],\n options,\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;AAKA,SAAgB,EAAgB,GAAoC;AAClE,KAAI,CAAC,EAAG,WAAW,EAAY,CAC7B,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAG9C,IAAM,IAAS,EAAG,aAAa,GAAa,OAAO;AACnD,KAAI,CAAC,EAAO,SAAS,WAAW,CAC9B,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAG9C,IAAM,IAAO,IAAI,EAAW,EAAO,EAC/B,IAAa,IAEX,KAAa,MAAgD;AAC7D,OACJ,GAAK,MAAQ;GACX,IAAM,IAAS,EACb,GACA,WACA,mCACD;AAED,UADI,EAAO,eAAY,IAAa,KAC7B,EAAO;IACd;;AAWJ,QARA,GAAW,MAAO,EAAK,mBAAmB,EAAG,CAAC,EACzC,KAAY,GAAW,MAAO,EAAK,aAAa,EAAG,CAAC,EAEpD,KAIL,EAAG,cAAc,GAAa,EAAK,UAAU,EAAE,OAAO,EAC/C;EAAE,QAAQ;EAAW,SAAS;EAAM,IAJlC;EAAE,QAAQ;EAAW,SAAS;EAAO;;;;AC/BhD,SAAgB,EAAmB,GAAuC;AACxE,KAAI,CAAC,EAAG,WAAW,EAAe,CAChC,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAG9C,IAAM,IAAiB,EAAG,aAAa,GAAgB,OAAO;AAC9D,KAAI,CAAC,EAAe,SAAS,qBAAqB,CAChD,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAM9C,IAAM,IAHU,IAAI,EAAQ,EAC1B,sBAAsB,EAAE,WAAW,EAAU,QAAQ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Aa,EAAgB,EAAY,CAAC,CAAC,EAE1E,EAAO,KAAK,mCAAmC;EAC/C,IAAM,IAAiB,EAAK,KAC1B,EAAQ,MACR,OACA,UACA,YACA,UACA,kBACD;AACD,IACE,EAAoB,GAAgB,EAAmB,EAAe,CAAC,CACxE;;AAeH,QAAO;EACL,SAAS,EAAE;EACX;EACA,SAAS,EAAE;EACX,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,aAAa,EAAE;EACf,mBAAmB,EAAE;EACrB,iBAbsB,MAAM,EAC5B,IARsB;GACtB;GACA;GACA;GACA;GACA;GACD,GAE+B,CAAC,iBAAiB,kBAAkB,EAClE,EACD;EAWA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { n as e } from "./logger-BpgCb-ZG.js";
|
|
2
|
+
import { modifyOutcomeToFile as t } from "./modify-file-Bi-4GRwL.js";
|
|
3
|
+
import n from "node:fs";
|
|
4
|
+
import r from "node:path";
|
|
5
|
+
//#region src/patterns/disable/i18n/modifies/gitignore.ts
|
|
6
|
+
function i(e) {
|
|
7
|
+
if (!n.existsSync(e)) return {
|
|
8
|
+
status: "success",
|
|
9
|
+
changed: !1
|
|
10
|
+
};
|
|
11
|
+
let t = n.readFileSync(e, "utf8");
|
|
12
|
+
if (!t.includes("src/locales/.wuchale")) return {
|
|
13
|
+
status: "success",
|
|
14
|
+
changed: !1
|
|
15
|
+
};
|
|
16
|
+
let r = t.split("\n"), i = [];
|
|
17
|
+
for (let e = 0; e < r.length; e++) {
|
|
18
|
+
let t = r[e];
|
|
19
|
+
if (t === "# Wuchale") {
|
|
20
|
+
let t = e + 1, n = !1;
|
|
21
|
+
for (; t < r.length && r[t].trim() !== "";) r[t] === "src/locales/.wuchale" && (n = !0), t++;
|
|
22
|
+
if (n) {
|
|
23
|
+
e = t;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
t !== "src/locales/.wuchale" && i.push(t);
|
|
28
|
+
}
|
|
29
|
+
let a = i.join("\n");
|
|
30
|
+
return a = a.replace(/\n{3,}/g, "\n\n"), a === t ? {
|
|
31
|
+
status: "success",
|
|
32
|
+
changed: !1
|
|
33
|
+
} : (n.writeFileSync(e, a), {
|
|
34
|
+
status: "success",
|
|
35
|
+
changed: !0
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/patterns/disable/i18n/generate.runtime.ts
|
|
40
|
+
var a = [
|
|
41
|
+
"vite.config, svelte.config, hooks.server, app.html, and +layout.ts must be reverted manually.",
|
|
42
|
+
"The i18n integration touches these files in ways that are not safely reversible by tooling.",
|
|
43
|
+
"See the enable-i18n modifies for the blocks to remove."
|
|
44
|
+
].join(" ");
|
|
45
|
+
async function o(n) {
|
|
46
|
+
let o = e(n), s = [], c = (e) => {
|
|
47
|
+
e && s.push(e);
|
|
48
|
+
};
|
|
49
|
+
o.info("Reverting .gitignore");
|
|
50
|
+
let l = r.join(n.root, ".gitignore");
|
|
51
|
+
return c(t(l, i(l))), o.info(a), {
|
|
52
|
+
creates: [],
|
|
53
|
+
modifies: s,
|
|
54
|
+
deletes: [],
|
|
55
|
+
components: [],
|
|
56
|
+
packages: [],
|
|
57
|
+
collections: [],
|
|
58
|
+
collectionPatches: [],
|
|
59
|
+
collectionDrops: []
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { o as generate };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=generate.runtime-BK3U_cCw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-BK3U_cCw.js","names":[],"sources":["../../src/patterns/disable/i18n/modifies/gitignore.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 path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyGitignore } from \"./modifies/gitignore\";\n\nconst MANUAL_REMEDIATION = [\n \"vite.config, svelte.config, hooks.server, app.html, and +layout.ts must be reverted manually.\",\n \"The i18n integration touches these files in ways that are not safely reversible by tooling.\",\n \"See the enable-i18n modifies for the blocks to remove.\",\n].join(\" \");\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 .gitignore\");\n const gitignorePath = path.join(options.root, \".gitignore\");\n pushResult(modifyOutcomeToFile(gitignorePath, unmodifyGitignore(gitignorePath)));\n\n logger.info(MANUAL_REMEDIATION);\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,SAAgB,EAAkB,GAAsC;AACtE,KAAI,CAAC,EAAG,WAAW,EAA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AiB,EAAE;EACpB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./dedent-C4qKBQXh.js";
|
|
2
2
|
import { n as t } from "./logger-BpgCb-ZG.js";
|
|
3
|
-
import { modifyOutcomeToFile as n } from "./modify-file-
|
|
4
|
-
import {
|
|
3
|
+
import { modifyOutcomeToFile as n } from "./modify-file-Bi-4GRwL.js";
|
|
4
|
+
import { a as r, n as i, o as a } from "./ts-morph-helpers-B0oxeDUU.js";
|
|
5
5
|
import o from "node:fs";
|
|
6
6
|
import s from "node:path";
|
|
7
7
|
import { Project as c, QuoteKind as l, SyntaxKind as u } from "ts-morph";
|
|
@@ -412,12 +412,12 @@ function F(e) {
|
|
|
412
412
|
status: "not-found",
|
|
413
413
|
message: P
|
|
414
414
|
};
|
|
415
|
-
let t =
|
|
415
|
+
let t = a.fromPath(e);
|
|
416
416
|
return t.hasElement("Navbar.List") ? t.hasElement("LanguageSelect") ? {
|
|
417
417
|
status: "success",
|
|
418
418
|
changed: !1
|
|
419
419
|
} : (t.modifyScript((e) => {
|
|
420
|
-
let { source: t } =
|
|
420
|
+
let { source: t } = r(e, (e) => {
|
|
421
421
|
i(e, [{
|
|
422
422
|
defaultImport: "LanguageSelect",
|
|
423
423
|
moduleSpecifier: "$lib/components/language-select.svelte"
|
|
@@ -481,10 +481,11 @@ async function L(e) {
|
|
|
481
481
|
components: [],
|
|
482
482
|
packages: [],
|
|
483
483
|
collections: [],
|
|
484
|
-
collectionPatches: []
|
|
484
|
+
collectionPatches: [],
|
|
485
|
+
collectionDrops: []
|
|
485
486
|
};
|
|
486
487
|
}
|
|
487
488
|
//#endregion
|
|
488
489
|
export { L as generate };
|
|
489
490
|
|
|
490
|
-
//# sourceMappingURL=generate.runtime-
|
|
491
|
+
//# sourceMappingURL=generate.runtime-CN5PiWOK.js.map
|