@reddoorla/maintenance 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as Site, a as AuditResult, A as AuditName, b as RecipeResult, R as RecipeName, I as InventoryProvider } from './sync-configs-CW3nKS_N.js';
2
- export { C as ConfigName, c as SyncConfigsOptions, s as syncConfigs } from './sync-configs-CW3nKS_N.js';
1
+ import { S as Site, a as AuditResult, A as AuditName, b as RecipeResult, R as RecipeName, I as InventoryProvider } from './sync-configs-DRmSAnfV.js';
2
+ export { C as ConfigName, c as SyncConfigsOptions, s as syncConfigs } from './sync-configs-DRmSAnfV.js';
3
3
 
4
4
  type SpawnResult = {
5
5
  code: number;
package/dist/index.js CHANGED
@@ -1242,23 +1242,41 @@ function removeDollarRestProps(source) {
1242
1242
  return next;
1243
1243
  }
1244
1244
 
1245
+ // src/recipes/svelte-5/codemods/state-effect-sync.ts
1246
+ var PATTERN = /let\s+(\w+)\s*=\s*\$state\(\s*([^)]+?)\s*\)\s*;[ \t\r\n]*\$effect\(\s*\(\s*\)\s*=>\s*\{\s*\w+\s*;\s*\1\s*=\s*([^;}]+?)\s*\}\s*\)\s*;?/g;
1247
+ function stateEffectSyncToDerived(source) {
1248
+ return source.replace(PATTERN, (full, name, initExpr, effectExpr) => {
1249
+ if (initExpr.trim() !== effectExpr.trim()) return full;
1250
+ return `let ${name} = $derived(${initExpr.trim()});`;
1251
+ });
1252
+ }
1253
+
1245
1254
  // src/recipes/svelte-5/step-gotchas.ts
1246
1255
  var SVELTE_GLOBS = ["src/**/*.svelte"];
1247
1256
  var IGNORE2 = ["node_modules/**", ".svelte-kit/**", "build/**"];
1248
- var CODEMODS = [onEventToHandler, exportLetToProps, removeDollarRestProps];
1249
- async function applyGotchaCodemods(cwd) {
1250
- let filesChanged = 0;
1257
+ var CODEMODS = [
1258
+ onEventToHandler,
1259
+ exportLetToProps,
1260
+ removeDollarRestProps,
1261
+ stateEffectSyncToDerived
1262
+ ];
1263
+ async function planGotchaCodemods(cwd) {
1264
+ const changes = [];
1251
1265
  const relPaths = await glob2(SVELTE_GLOBS, { cwd, ignore: IGNORE2, absolute: false });
1252
1266
  for (const rel of relPaths) {
1253
1267
  const path = join9(cwd, rel);
1254
1268
  const before = await readFile8(path, "utf-8");
1255
1269
  const after = CODEMODS.reduce((s, fn) => fn(s), before);
1256
- if (after !== before) {
1257
- await writeFile6(path, after, "utf-8");
1258
- filesChanged += 1;
1259
- }
1270
+ if (after !== before) changes.push({ rel, after });
1271
+ }
1272
+ return changes;
1273
+ }
1274
+ async function applyGotchaCodemods(cwd) {
1275
+ const changes = await planGotchaCodemods(cwd);
1276
+ for (const c of changes) {
1277
+ await writeFile6(join9(cwd, c.rel), c.after, "utf-8");
1260
1278
  }
1261
- return { filesChanged };
1279
+ return { filesChanged: changes.length };
1262
1280
  }
1263
1281
 
1264
1282
  // src/recipes/svelte-5/step-verify.ts