@reliverse/dler 1.7.7 → 1.7.9

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.
Files changed (109) hide show
  1. package/LICENSES +1 -0
  2. package/README.md +1 -1
  3. package/bin/app/agg/impl.js +9 -25
  4. package/bin/app/agg/run.js +1 -6
  5. package/bin/app/build/impl.js +3 -17
  6. package/bin/app/check/cmd.js +3 -12
  7. package/bin/app/conv/cmd.js +7 -25
  8. package/bin/app/copy/cmd.js +2 -7
  9. package/bin/app/init/cmd.js +1 -5
  10. package/bin/app/init/init-const.js +2 -11
  11. package/bin/app/init/init-impl.js +9 -30
  12. package/bin/app/init/{templates/t-readme.d.ts → init-tmpl.d.ts} +2 -0
  13. package/bin/app/init/{templates/t-readme.js → init-tmpl.js} +27 -0
  14. package/bin/app/inject/impl.js +4 -7
  15. package/bin/app/libs/cmd.js +4 -13
  16. package/bin/app/merge/cmd.js +8 -28
  17. package/bin/app/migrate/cmd.js +11 -44
  18. package/bin/app/migrate/codemods/anything-bun.js +13 -34
  19. package/bin/app/migrate/codemods/commander-rempts.js +4 -12
  20. package/bin/app/migrate/codemods/console-relinka.js +12 -27
  21. package/bin/app/migrate/codemods/fs-relifso.js +20 -43
  22. package/bin/app/migrate/codemods/nodenext-bundler.js +6 -14
  23. package/bin/app/migrate/codemods/path-pathkit.js +16 -42
  24. package/bin/app/migrate/codemods/readdir-glob.js +11 -22
  25. package/bin/app/mkdist/cmd.d.ts +83 -0
  26. package/bin/app/mkdist/cmd.js +121 -0
  27. package/bin/app/rempts/cmd.js +13 -35
  28. package/bin/app/rename/cmd.js +6 -15
  29. package/bin/app/spell/cmd.js +1 -3
  30. package/bin/app/split/cmd.js +1 -5
  31. package/bin/app/split/impl.js +1 -6
  32. package/bin/libs/sdk/sdk-impl/build/build-library.js +36 -123
  33. package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +2 -2
  34. package/bin/libs/sdk/sdk-impl/build/build-regular.js +28 -66
  35. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +4 -16
  36. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.d.ts +1 -1
  37. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +97 -89
  38. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/{copy.js → copy-mod.js} +4 -18
  39. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loader.d.ts +4 -0
  40. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loader.js +26 -0
  41. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/js.d.ts +2 -0
  42. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/js.js +49 -0
  43. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/loaders-mod.d.ts +12 -0
  44. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/loaders-mod.js +30 -0
  45. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/postcss.d.ts +3 -0
  46. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/postcss.js +28 -0
  47. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/sass.d.ts +2 -0
  48. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/sass.js +31 -0
  49. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.d.ts +17 -0
  50. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.js +145 -0
  51. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.d.ts +8 -0
  52. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.js +133 -0
  53. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/dts.d.ts +11 -0
  54. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/dts.js +94 -0
  55. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/fs.d.ts +1 -0
  56. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/fs.js +15 -0
  57. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/vue-dts.d.ts +3 -0
  58. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/vue-dts.js +175 -0
  59. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/{mkdist.js → mkdist-mod.js} +5 -19
  60. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.js +2 -7
  61. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.js +2 -9
  62. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.js +8 -26
  63. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/utils.js +1 -4
  64. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.js +1 -4
  65. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/{index.js → untyped-mod.js} +8 -22
  66. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.js +3 -11
  67. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.js +4 -15
  68. package/bin/libs/sdk/sdk-impl/cfg/default.js +1 -9
  69. package/bin/libs/sdk/sdk-impl/cfg/info.js +1 -1
  70. package/bin/libs/sdk/sdk-impl/cfg/init.js +4 -16
  71. package/bin/libs/sdk/sdk-impl/cfg/load.js +1 -4
  72. package/bin/libs/sdk/sdk-impl/library-flow.js +3 -11
  73. package/bin/libs/sdk/sdk-impl/pub/pub-library.js +5 -22
  74. package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +2 -2
  75. package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +3 -6
  76. package/bin/libs/sdk/sdk-impl/regular-flow.js +8 -26
  77. package/bin/libs/sdk/sdk-impl/rules/reliverse/file-extensions/file-extensions.js +1 -5
  78. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/analyzer.js +2 -9
  79. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/formatter.js +8 -20
  80. package/bin/libs/sdk/sdk-impl/rules/reliverse/package-json-health/package-json-health.js +1 -7
  81. package/bin/libs/sdk/sdk-impl/rules/reliverse/path-extensions/path-extensions.js +2 -5
  82. package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js +3 -8
  83. package/bin/libs/sdk/sdk-impl/rules/rules-mod.js +4 -14
  84. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +4 -8
  85. package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +1 -3
  86. package/bin/libs/sdk/sdk-impl/utils/finalize.js +3 -14
  87. package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.js +5 -16
  88. package/bin/libs/sdk/sdk-impl/utils/utils-build.js +3 -11
  89. package/bin/libs/sdk/sdk-impl/utils/utils-clean.js +2 -5
  90. package/bin/libs/sdk/sdk-impl/utils/utils-consts.js +1 -8
  91. package/bin/libs/sdk/sdk-impl/utils/utils-cwd.js +1 -4
  92. package/bin/libs/sdk/sdk-impl/utils/utils-deps.js +14 -25
  93. package/bin/libs/sdk/sdk-impl/utils/utils-error.js +1 -5
  94. package/bin/libs/sdk/sdk-impl/utils/utils-fs.d.ts +14 -0
  95. package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +145 -37
  96. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +2 -7
  97. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-libraries.js +32 -86
  98. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-regular.js +13 -61
  99. package/bin/libs/sdk/sdk-mod.d.ts +3 -3
  100. package/bin/libs/sdk/sdk-mod.js +3 -3
  101. package/bin/libs/sdk/sdk-types.d.ts +76 -12
  102. package/package.json +8 -3
  103. package/bin/app/init/templates/t-gitignore.d.ts +0 -1
  104. package/bin/app/init/templates/t-gitignore.js +0 -9
  105. package/bin/app/init/templates/t-license.d.ts +0 -1
  106. package/bin/app/init/templates/t-license.js +0 -18
  107. /package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/{copy.d.ts → copy-mod.d.ts} +0 -0
  108. /package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/{mkdist.d.ts → mkdist-mod.d.ts} +0 -0
  109. /package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/{index.d.ts → untyped-mod.d.ts} +0 -0
@@ -78,33 +78,18 @@ Are you sure you want to migrate files in ${args.project}?`,
78
78
  relinka("log", "Next steps:");
79
79
  relinka("log", "1. Run 'bun install' to install dependencies with Bun");
80
80
  relinka("log", "2. Test your application thoroughly");
81
- relinka(
82
- "log",
83
- "3. Review async/await usage in converted file operations"
84
- );
85
- relinka(
86
- "log",
87
- "4. Update any custom database queries to use Bun.sql syntax"
88
- );
89
- relinka(
90
- "log",
91
- "5. Review and update any custom middleware in Express apps"
92
- );
81
+ relinka("log", "3. Review async/await usage in converted file operations");
82
+ relinka("log", "4. Update any custom database queries to use Bun.sql syntax");
83
+ relinka("log", "5. Review and update any custom middleware in Express apps");
93
84
  }
94
85
  return;
95
86
  }
96
87
  let results = [];
97
88
  if (args.codemod === "path-pathkit") {
98
- relinka(
99
- "log",
100
- "Migrating from node:path and/or pathe to @reliverse/pathkit..."
101
- );
89
+ relinka("log", "Migrating from node:path and/or pathe to @reliverse/pathkit...");
102
90
  results = await migratePathToPathkit(args.dryRun);
103
91
  } else if (args.codemod === "fs-relifso") {
104
- relinka(
105
- "log",
106
- "Migrating from node:fs and/or fs-extra to @reliverse/relifso..."
107
- );
92
+ relinka("log", "Migrating from node:fs and/or fs-extra to @reliverse/relifso...");
108
93
  results = await migrateFsToRelifso(args.dryRun);
109
94
  } else if (args.codemod === "nodenext-bundler") {
110
95
  if (!["nodenext", "bundler"].includes(args.mrTarget)) {
@@ -115,10 +100,7 @@ Are you sure you want to migrate files in ${args.project}?`,
115
100
  return;
116
101
  }
117
102
  relinka("log", `Migrating to ${args.mrTarget} module resolution...`);
118
- results = await migrateModuleResolution(
119
- args.mrTarget,
120
- args.dryRun
121
- );
103
+ results = await migrateModuleResolution(args.mrTarget, args.dryRun);
122
104
  } else if (args.codemod === "readdir-glob") {
123
105
  relinka("log", "Migrating from fs.readdir to globby...");
124
106
  results = await migrateReaddirToGlob(args.dryRun);
@@ -175,43 +157,28 @@ Summary: ${successCount} files updated, ${errorCount} errors, ${warningCount} wa
175
157
  relinka("log", "Next steps:");
176
158
  relinka("log", "1. Run 'bun install' to install @reliverse/pathkit");
177
159
  relinka("log", "2. Test your application");
178
- relinka(
179
- "log",
180
- "3. Tip: Consider using advanced pathkit features like alias resolution"
181
- );
160
+ relinka("log", "3. Tip: Consider using advanced pathkit features like alias resolution");
182
161
  } else if (args.codemod === "fs-relifso") {
183
162
  relinka("log", "Next steps:");
184
163
  relinka("log", "1. Run 'bun install' to install @reliverse/relifso");
185
164
  relinka("log", "2. Test your application");
186
- relinka(
187
- "log",
188
- "3. Review any file system operations that might need manual updates"
189
- );
165
+ relinka("log", "3. Review any file system operations that might need manual updates");
190
166
  } else if (args.codemod === "nodenext-bundler") {
191
167
  relinka("log", "Next steps:");
192
168
  relinka("log", "1. Test your application");
193
169
  if (args.mrTarget === "nodenext") {
194
- relinka(
195
- "log",
196
- "2. Ensure your build tools support .js extensions in imports"
197
- );
170
+ relinka("log", "2. Ensure your build tools support .js extensions in imports");
198
171
  } else if (args.mrTarget === "bundler") {
199
172
  relinka("log", "2. Ensure your bundler is configured correctly");
200
173
  }
201
174
  if (warningCount > 0) {
202
- relinka(
203
- "warn",
204
- "3. \u26A0\uFE0F Review files with warnings - they may need manual updates"
205
- );
175
+ relinka("warn", "3. \u26A0\uFE0F Review files with warnings - they may need manual updates");
206
176
  }
207
177
  } else if (args.codemod === "readdir-glob") {
208
178
  relinka("log", "Next steps:");
209
179
  relinka("log", "1. Run 'bun install' to install globby");
210
180
  relinka("log", "2. Test your application");
211
- relinka(
212
- "log",
213
- "3. Review any file system operations that might need manual updates"
214
- );
181
+ relinka("log", "3. Review any file system operations that might need manual updates");
215
182
  }
216
183
  }
217
184
  }
@@ -91,12 +91,9 @@ const analyzeProject = async (projectRoot) => {
91
91
  cwd: projectRoot,
92
92
  ignore: ["node_modules/**"]
93
93
  });
94
- const configFiles = await glob(
95
- "{*.config.{js,ts,json},.*rc*,tsconfig.json}",
96
- {
97
- cwd: projectRoot
98
- }
99
- );
94
+ const configFiles = await glob("{*.config.{js,ts,json},.*rc*,tsconfig.json}", {
95
+ cwd: projectRoot
96
+ });
100
97
  return {
101
98
  packageJson,
102
99
  hasTypeScript: allDeps.includes("typescript") || sourceFiles.some((f) => f.endsWith(".ts") || f.endsWith(".tsx")),
@@ -190,9 +187,7 @@ const transformPackageJson = (analysis) => {
190
187
  }
191
188
  if (newDevDependencies[oldDep]) {
192
189
  delete newDevDependencies[oldDep];
193
- changes.push(
194
- `Removed dev dependency: ${oldDep} (replaced by Bun built-in)`
195
- );
190
+ changes.push(`Removed dev dependency: ${oldDep} (replaced by Bun built-in)`);
196
191
  }
197
192
  }
198
193
  const newPackageJson = {
@@ -239,11 +234,8 @@ const transformSourceFile = (filePath, content) => {
239
234
  "g"
240
235
  );
241
236
  if (importPattern.test(transformedContent)) {
242
- transformedContent = transformedContent.replace(
243
- importPattern,
244
- `${newImport}
245
- `
246
- );
237
+ transformedContent = transformedContent.replace(importPattern, `${newImport}
238
+ `);
247
239
  changes.push(`Replaced ${oldModule} import with Bun alternative`);
248
240
  }
249
241
  }
@@ -279,10 +271,7 @@ const transformSourceFile = (filePath, content) => {
279
271
  /glob\.sync\((.*?)\)/g,
280
272
  "new Glob($1).scanSync('.')"
281
273
  );
282
- transformedContent = transformedContent.replace(
283
- /glob\((.*?)\)/g,
284
- "new Glob($1).scan('.')"
285
- );
274
+ transformedContent = transformedContent.replace(/glob\((.*?)\)/g, "new Glob($1).scan('.')");
286
275
  changes.push("Converted glob operations to Bun.Glob");
287
276
  }
288
277
  if (content.includes("semver.")) {
@@ -301,10 +290,7 @@ const transformSourceFile = (filePath, content) => {
301
290
  /redis\.createClient\((.*?)\)/g,
302
291
  "Bun.redis($1)"
303
292
  );
304
- transformedContent = transformedContent.replace(
305
- /new Redis\((.*?)\)/g,
306
- "Bun.redis($1)"
307
- );
293
+ transformedContent = transformedContent.replace(/new Redis\((.*?)\)/g, "Bun.redis($1)");
308
294
  changes.push("Converted Redis client to Bun.redis");
309
295
  }
310
296
  if (content.includes("ffi.Library") || content.includes("dlopen")) {
@@ -335,16 +321,11 @@ relinka("log", \`Server running on localhost:\${server.port}\`);
335
321
  /const app = express\(\);[\s\S]*?app\.listen\(.*?\);?/,
336
322
  expressReplacement
337
323
  );
338
- changes.push(
339
- "Converted Express app to Bun.serve (manual route migration needed)"
340
- );
324
+ changes.push("Converted Express app to Bun.serve (manual route migration needed)");
341
325
  }
342
326
  }
343
327
  if (content.includes("exec") || content.includes("spawn")) {
344
- transformedContent = transformedContent.replace(
345
- /exec\((.*?)\)/g,
346
- "await Bun.$`$1`"
347
- );
328
+ transformedContent = transformedContent.replace(/exec\((.*?)\)/g, "await Bun.$`$1`");
348
329
  transformedContent = transformedContent.replace(
349
330
  /spawn\((.*?),\s*(.*?)\)/g,
350
331
  "await Bun.$`$1 ${$2.join(' ')}`"
@@ -485,7 +466,7 @@ const migrateProject = async (config) => {
485
466
  for (const sourceFile of analysis.sourceFiles.slice(0, 50)) {
486
467
  try {
487
468
  const fullPath = join(projectRoot, sourceFile);
488
- const content = await readFile(fullPath, "utf-8");
469
+ const content = await readFile(fullPath, "utf8");
489
470
  const result = transformSourceFile(sourceFile, content);
490
471
  if (result.changes.length > 0) {
491
472
  transformResults.push(result);
@@ -500,7 +481,7 @@ const migrateProject = async (config) => {
500
481
  for (const testFile of analysis.testFiles.slice(0, 20)) {
501
482
  try {
502
483
  const fullPath = join(projectRoot, testFile);
503
- const content = await readFile(fullPath, "utf-8");
484
+ const content = await readFile(fullPath, "utf8");
504
485
  const result = transformTestFile(testFile, content);
505
486
  if (result.changes.length > 0) {
506
487
  transformResults.push(result);
@@ -519,9 +500,7 @@ const migrateProject = async (config) => {
519
500
  await writeFile(join(projectRoot, "Dockerfile.bun"), dockerfile);
520
501
  }
521
502
  manualSteps.push("Run 'bun install' to install dependencies with Bun");
522
- manualSteps.push(
523
- "Update your CI/CD scripts to use 'bun' instead of npm/yarn"
524
- );
503
+ manualSteps.push("Update your CI/CD scripts to use 'bun' instead of npm/yarn");
525
504
  manualSteps.push("Test your application thoroughly after migration");
526
505
  manualSteps.push("Review async/await usage in converted file operations");
527
506
  if (analysis.framework === "express") {
@@ -39,9 +39,7 @@ function getDefaultValueText(node) {
39
39
  if (Node.isPrefixUnaryExpression(node)) {
40
40
  return node.getText();
41
41
  }
42
- console.warn(
43
- `Unhandled default value type: ${node.getKindName()}, text: ${node.getText()}`
44
- );
42
+ console.warn(`Unhandled default value type: ${node.getKindName()}, text: ${node.getText()}`);
45
43
  return node.getText();
46
44
  }
47
45
  async function transformCommand(varDecl, info, sourceFile) {
@@ -61,9 +59,7 @@ async function transformCommand(varDecl, info, sourceFile) {
61
59
  }
62
60
  }
63
61
  } else {
64
- console.warn(
65
- `Unhandled action function type: ${info.actionFunction.getKindName()}`
66
- );
62
+ console.warn(`Unhandled action function type: ${info.actionFunction.getKindName()}`);
67
63
  }
68
64
  }
69
65
  info.options.reverse();
@@ -167,9 +163,7 @@ function handleActionMethod(node, info, sourceFile) {
167
163
  function handleOptionMethod(node, info) {
168
164
  const [flagsArg, descArg, defaultValueArg] = node.getArguments();
169
165
  if (flagsArg && Node.isStringLiteral(flagsArg)) {
170
- const { longName, shortName, takesValue } = parseCommanderFlags(
171
- flagsArg.getLiteralText()
172
- );
166
+ const { longName, shortName, takesValue } = parseCommanderFlags(flagsArg.getLiteralText());
173
167
  info.options.push({
174
168
  name: longName,
175
169
  shortFlag: shortName,
@@ -244,9 +238,7 @@ async function transformFile(filePath, project) {
244
238
  namedImports: neededRemptsImports
245
239
  });
246
240
  }
247
- const variableDeclarations = sourceFile.getDescendantsOfKind(
248
- SyntaxKind.VariableDeclaration
249
- );
241
+ const variableDeclarations = sourceFile.getDescendantsOfKind(SyntaxKind.VariableDeclaration);
250
242
  for (const varDecl of variableDeclarations) {
251
243
  const initializer = varDecl.getInitializer();
252
244
  if (!initializer) continue;
@@ -29,17 +29,14 @@ export async function consoleToRelinka(input, from, to) {
29
29
  ]
30
30
  });
31
31
  if (!finalInput || !finalFrom || !finalTo) {
32
- relinka(
33
- "error",
34
- "Missing required arguments for console-relinka migration"
35
- );
32
+ relinka("error", "Missing required arguments for console-relinka migration");
36
33
  return;
37
34
  }
38
35
  if (!await fs.pathExists(finalInput)) {
39
36
  relinka("error", `\u274C Input path does not exist: ${finalInput}`);
40
37
  return;
41
38
  }
42
- let content = await fs.readFile(finalInput, "utf-8");
39
+ let content = await fs.readFile(finalInput, "utf8");
43
40
  let changes = false;
44
41
  const levels = [
45
42
  "log",
@@ -69,10 +66,7 @@ export async function consoleToRelinka(input, from, to) {
69
66
  "g"
70
67
  );
71
68
  case "relinkaFunction":
72
- return new RegExp(
73
- `relinka\\("${level}",\\s*(.*?)(?:,\\s*(.*))?\\)`,
74
- "g"
75
- );
69
+ return new RegExp(`relinka\\("${level}",\\s*(.*?)(?:,\\s*(.*))?\\)`, "g");
76
70
  case "relinkaMethod":
77
71
  return new RegExp(`relinka\\.${level}\\((.*?)(?:,\\s*(.*))?\\)`, "g");
78
72
  case "relinkaObject":
@@ -127,31 +121,22 @@ export async function consoleToRelinka(input, from, to) {
127
121
  };
128
122
  for (const level of levels) {
129
123
  const pattern = getSourcePattern(level, finalFrom);
130
- const newContent = content.replace(
131
- pattern,
132
- (_, message, titleOrArgs, args) => {
133
- changes = true;
134
- if ((finalFrom === "consolaMethod" || finalFrom === "relinkaMethod") && level === "box") {
135
- return createReplacement(level, message, titleOrArgs, args);
136
- }
137
- return createReplacement(level, message, void 0, titleOrArgs);
124
+ const newContent = content.replace(pattern, (_, message, titleOrArgs, args) => {
125
+ changes = true;
126
+ if ((finalFrom === "consolaMethod" || finalFrom === "relinkaMethod") && level === "box") {
127
+ return createReplacement(level, message, titleOrArgs, args);
138
128
  }
139
- );
129
+ return createReplacement(level, message, void 0, titleOrArgs);
130
+ });
140
131
  if (newContent !== content) {
141
132
  content = newContent;
142
- relinka(
143
- "log",
144
- `\u2705 Converted ${level} calls from ${finalFrom} to ${finalTo} format`
145
- );
133
+ relinka("log", `\u2705 Converted ${level} calls from ${finalFrom} to ${finalTo} format`);
146
134
  }
147
135
  }
148
136
  if (!changes) {
149
137
  relinka("warn", "\u26A0\uFE0F No matching calls found to convert");
150
138
  } else {
151
- await fs.writeFile(finalInput, content, "utf-8");
152
- relinka(
153
- "success",
154
- "\u2728 Successfully converted all logging calls to the target format"
155
- );
139
+ await fs.writeFile(finalInput, content, "utf8");
140
+ relinka("success", "\u2728 Successfully converted all logging calls to the target format");
156
141
  }
157
142
  }
@@ -27,27 +27,24 @@ export async function migrateFsToRelifso(dryRun = false) {
27
27
  const files = await getAllTsFiles(".");
28
28
  for (const file of files) {
29
29
  try {
30
- const content = await readFile(file, "utf-8");
30
+ const content = await readFile(file, "utf8");
31
31
  let modified = content;
32
32
  const changes = [];
33
33
  const nodeFsImportRegex = /import\s+(?:(\{[^}]*\})|(\w+))\s+from\s+["']node:fs["']/g;
34
34
  if (nodeFsImportRegex.test(content)) {
35
- modified = modified.replace(
36
- nodeFsImportRegex,
37
- (match, namedExports, defaultExport) => {
38
- if (namedExports) {
39
- return `import ${namedExports} from "@reliverse/relifso"`;
40
- }
41
- return `import ${defaultExport} from "@reliverse/relifso"`;
35
+ modified = modified.replace(nodeFsImportRegex, (_match, namedExports, defaultExport) => {
36
+ if (namedExports) {
37
+ return `import ${namedExports} from "@reliverse/relifso"`;
42
38
  }
43
- );
39
+ return `import ${defaultExport} from "@reliverse/relifso"`;
40
+ });
44
41
  changes.push("Updated node:fs imports to @reliverse/relifso");
45
42
  }
46
43
  const nodeFsPromisesImportRegex = /import\s+(?:(\{[^}]*\})|(\w+))\s+from\s+["']node:fs\/promises["']/g;
47
44
  if (nodeFsPromisesImportRegex.test(content)) {
48
45
  modified = modified.replace(
49
46
  nodeFsPromisesImportRegex,
50
- (match, namedExports, defaultExport) => {
47
+ (_match, namedExports, defaultExport) => {
51
48
  if (namedExports) {
52
49
  return `import ${namedExports} from "@reliverse/relifso"`;
53
50
  }
@@ -58,44 +55,32 @@ export async function migrateFsToRelifso(dryRun = false) {
58
55
  }
59
56
  const fsExtraImportRegex = /import\s+(?:(\{[^}]*\})|(\w+))\s+from\s+["']fs-extra["']/g;
60
57
  if (fsExtraImportRegex.test(content)) {
61
- modified = modified.replace(
62
- fsExtraImportRegex,
63
- (match, namedExports, defaultExport) => {
64
- if (namedExports) {
65
- return `import ${namedExports} from "@reliverse/relifso"`;
66
- }
67
- return `import ${defaultExport} from "@reliverse/relifso"`;
58
+ modified = modified.replace(fsExtraImportRegex, (_match, namedExports, defaultExport) => {
59
+ if (namedExports) {
60
+ return `import ${namedExports} from "@reliverse/relifso"`;
68
61
  }
69
- );
62
+ return `import ${defaultExport} from "@reliverse/relifso"`;
63
+ });
70
64
  changes.push("Updated fs-extra imports to @reliverse/relifso");
71
65
  }
72
66
  const nodeFsRequireRegex = /require\s*\(\s*["']node:fs["']\s*\)/g;
73
67
  if (nodeFsRequireRegex.test(content)) {
74
- modified = modified.replace(
75
- nodeFsRequireRegex,
76
- 'require("@reliverse/relifso")'
77
- );
68
+ modified = modified.replace(nodeFsRequireRegex, 'require("@reliverse/relifso")');
78
69
  changes.push("Updated node:fs require to @reliverse/relifso");
79
70
  }
80
71
  const nodeFsPromisesRequireRegex = /require\s*\(\s*["']node:fs\/promises["']\s*\)/g;
81
72
  if (nodeFsPromisesRequireRegex.test(content)) {
82
- modified = modified.replace(
83
- nodeFsPromisesRequireRegex,
84
- 'require("@reliverse/relifso")'
85
- );
73
+ modified = modified.replace(nodeFsPromisesRequireRegex, 'require("@reliverse/relifso")');
86
74
  changes.push("Updated node:fs/promises require to @reliverse/relifso");
87
75
  }
88
76
  const fsExtraRequireRegex = /require\s*\(\s*["']fs-extra["']\s*\)/g;
89
77
  if (fsExtraRequireRegex.test(content)) {
90
- modified = modified.replace(
91
- fsExtraRequireRegex,
92
- 'require("@reliverse/relifso")'
93
- );
78
+ modified = modified.replace(fsExtraRequireRegex, 'require("@reliverse/relifso")');
94
79
  changes.push("Updated fs-extra require to @reliverse/relifso");
95
80
  }
96
81
  if (changes.length > 0) {
97
82
  if (!dryRun) {
98
- await writeFile(file, modified, "utf-8");
83
+ await writeFile(file, modified, "utf8");
99
84
  }
100
85
  results.push({
101
86
  file,
@@ -122,25 +107,21 @@ async function updatePackageJson(results, dryRun, config) {
122
107
  try {
123
108
  const packageJsonPath = "./package.json";
124
109
  if (existsSync(packageJsonPath)) {
125
- const packageContent = await readFile(packageJsonPath, "utf-8");
110
+ const packageContent = await readFile(packageJsonPath, "utf8");
126
111
  const packageJson = JSON.parse(packageContent);
127
112
  let packageChanged = false;
128
113
  const packageChanges = [];
129
114
  for (const pkg of config.remove) {
130
115
  if (packageJson.dependencies?.[pkg]) {
131
116
  packageJson.dependencies = Object.fromEntries(
132
- Object.entries(packageJson.dependencies).filter(
133
- ([key]) => key !== pkg
134
- )
117
+ Object.entries(packageJson.dependencies).filter(([key]) => key !== pkg)
135
118
  );
136
119
  packageChanged = true;
137
120
  packageChanges.push(`Removed ${pkg} from dependencies`);
138
121
  }
139
122
  if (packageJson.devDependencies?.[pkg]) {
140
123
  packageJson.devDependencies = Object.fromEntries(
141
- Object.entries(packageJson.devDependencies).filter(
142
- ([key]) => key !== pkg
143
- )
124
+ Object.entries(packageJson.devDependencies).filter(([key]) => key !== pkg)
144
125
  );
145
126
  packageChanged = true;
146
127
  packageChanges.push(`Removed ${pkg} from devDependencies`);
@@ -155,11 +136,7 @@ async function updatePackageJson(results, dryRun, config) {
155
136
  }
156
137
  if (packageChanged) {
157
138
  if (!dryRun) {
158
- await writeFile(
159
- packageJsonPath,
160
- JSON.stringify(packageJson, null, 2) + "\n",
161
- "utf-8"
162
- );
139
+ await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf8");
163
140
  }
164
141
  results.push({
165
142
  file: packageJsonPath,
@@ -35,7 +35,7 @@ async function updateTsConfig(targetResolution, dryRun = false) {
35
35
  return results;
36
36
  }
37
37
  try {
38
- const content = await readFile(tsConfigPath, "utf-8");
38
+ const content = await readFile(tsConfigPath, "utf8");
39
39
  const tsConfig = JSON.parse(content);
40
40
  const changes = [];
41
41
  if (!tsConfig.compilerOptions) {
@@ -66,11 +66,7 @@ async function updateTsConfig(targetResolution, dryRun = false) {
66
66
  }
67
67
  if (changes.length > 0) {
68
68
  if (!dryRun) {
69
- await writeFile(
70
- tsConfigPath,
71
- JSON.stringify(tsConfig, null, 2) + "\n",
72
- "utf-8"
73
- );
69
+ await writeFile(tsConfigPath, JSON.stringify(tsConfig, null, 2) + "\n", "utf8");
74
70
  }
75
71
  results.push({
76
72
  file: tsConfigPath,
@@ -106,7 +102,7 @@ async function updatePackageJson(dryRun = false) {
106
102
  return results;
107
103
  }
108
104
  try {
109
- const content = await readFile(packageJsonPath, "utf-8");
105
+ const content = await readFile(packageJsonPath, "utf8");
110
106
  const packageJson = JSON.parse(content);
111
107
  const changes = [];
112
108
  if (packageJson.type !== "module") {
@@ -115,11 +111,7 @@ async function updatePackageJson(dryRun = false) {
115
111
  }
116
112
  if (changes.length > 0) {
117
113
  if (!dryRun) {
118
- await writeFile(
119
- packageJsonPath,
120
- JSON.stringify(packageJson, null, 2) + "\n",
121
- "utf-8"
122
- );
114
+ await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf8");
123
115
  }
124
116
  results.push({
125
117
  file: packageJsonPath,
@@ -148,7 +140,7 @@ async function updateImportExtensions(targetResolution, dryRun = false) {
148
140
  const files = await getAllTsFiles(".");
149
141
  for (const file of files) {
150
142
  try {
151
- const content = await readFile(file, "utf-8");
143
+ const content = await readFile(file, "utf8");
152
144
  const analysis = getFileImportsExports(content, {
153
145
  kind: "import",
154
146
  pathTypes: ["relative", "absolute", "alias"]
@@ -184,7 +176,7 @@ async function updateImportExtensions(targetResolution, dryRun = false) {
184
176
  }
185
177
  if (hasChanges) {
186
178
  if (!dryRun) {
187
- await writeFile(file, modified, "utf-8");
179
+ await writeFile(file, modified, "utf8");
188
180
  }
189
181
  results.push({
190
182
  file,
@@ -27,65 +27,47 @@ export async function migratePathToPathkit(dryRun = false) {
27
27
  const files = await getAllTsFiles(".");
28
28
  for (const file of files) {
29
29
  try {
30
- const content = await readFile(file, "utf-8");
30
+ const content = await readFile(file, "utf8");
31
31
  let modified = content;
32
32
  const changes = [];
33
33
  const patheImportRegex = /from\s+["']pathe["']/g;
34
34
  if (patheImportRegex.test(content)) {
35
- modified = modified.replace(
36
- patheImportRegex,
37
- 'from "@reliverse/pathkit"'
38
- );
35
+ modified = modified.replace(patheImportRegex, 'from "@reliverse/pathkit"');
39
36
  changes.push("Updated pathe imports to @reliverse/pathkit");
40
37
  }
41
38
  const patheUtilsRegex = /from\s+["']pathe\/utils["']/g;
42
39
  if (patheUtilsRegex.test(content)) {
43
- modified = modified.replace(
44
- patheUtilsRegex,
45
- 'from "@reliverse/pathkit"'
46
- );
40
+ modified = modified.replace(patheUtilsRegex, 'from "@reliverse/pathkit"');
47
41
  changes.push("Updated pathe/utils imports to @reliverse/pathkit");
48
42
  }
49
43
  const nodePathImportRegex = /import\s+(?:(\{[^}]*\})|(\w+))\s+from\s+["']node:path["']/g;
50
44
  if (nodePathImportRegex.test(content)) {
51
- modified = modified.replace(
52
- nodePathImportRegex,
53
- (match, namedExports, defaultExport) => {
54
- if (namedExports) {
55
- return `import ${namedExports} from "@reliverse/pathkit"`;
56
- }
57
- return `import ${defaultExport} from "@reliverse/pathkit"`;
45
+ modified = modified.replace(nodePathImportRegex, (_match, namedExports, defaultExport) => {
46
+ if (namedExports) {
47
+ return `import ${namedExports} from "@reliverse/pathkit"`;
58
48
  }
59
- );
49
+ return `import ${defaultExport} from "@reliverse/pathkit"`;
50
+ });
60
51
  changes.push("Updated node:path imports to @reliverse/pathkit");
61
52
  }
62
53
  const patheRequireRegex = /require\s*\(\s*["']pathe["']\s*\)/g;
63
54
  if (patheRequireRegex.test(content)) {
64
- modified = modified.replace(
65
- patheRequireRegex,
66
- 'require("@reliverse/pathkit")'
67
- );
55
+ modified = modified.replace(patheRequireRegex, 'require("@reliverse/pathkit")');
68
56
  changes.push("Updated pathe require to @reliverse/pathkit");
69
57
  }
70
58
  const patheUtilsRequireRegex = /require\s*\(\s*["']pathe\/utils["']\s*\)/g;
71
59
  if (patheUtilsRequireRegex.test(content)) {
72
- modified = modified.replace(
73
- patheUtilsRequireRegex,
74
- 'require("@reliverse/pathkit")'
75
- );
60
+ modified = modified.replace(patheUtilsRequireRegex, 'require("@reliverse/pathkit")');
76
61
  changes.push("Updated pathe/utils require to @reliverse/pathkit");
77
62
  }
78
63
  const nodePathRequireRegex = /require\s*\(\s*["']node:path["']\s*\)/g;
79
64
  if (nodePathRequireRegex.test(content)) {
80
- modified = modified.replace(
81
- nodePathRequireRegex,
82
- 'require("@reliverse/pathkit")'
83
- );
65
+ modified = modified.replace(nodePathRequireRegex, 'require("@reliverse/pathkit")');
84
66
  changes.push("Updated node:path require to @reliverse/pathkit");
85
67
  }
86
68
  if (changes.length > 0) {
87
69
  if (!dryRun) {
88
- await writeFile(file, modified, "utf-8");
70
+ await writeFile(file, modified, "utf8");
89
71
  }
90
72
  results.push({
91
73
  file,
@@ -112,25 +94,21 @@ async function updatePackageJson(results, dryRun, config) {
112
94
  try {
113
95
  const packageJsonPath = "./package.json";
114
96
  if (existsSync(packageJsonPath)) {
115
- const packageContent = await readFile(packageJsonPath, "utf-8");
97
+ const packageContent = await readFile(packageJsonPath, "utf8");
116
98
  const packageJson = JSON.parse(packageContent);
117
99
  let packageChanged = false;
118
100
  const packageChanges = [];
119
101
  for (const pkg of config.remove) {
120
102
  if (packageJson.dependencies?.[pkg]) {
121
103
  packageJson.dependencies = Object.fromEntries(
122
- Object.entries(packageJson.dependencies).filter(
123
- ([key]) => key !== pkg
124
- )
104
+ Object.entries(packageJson.dependencies).filter(([key]) => key !== pkg)
125
105
  );
126
106
  packageChanged = true;
127
107
  packageChanges.push(`Removed ${pkg} from dependencies`);
128
108
  }
129
109
  if (packageJson.devDependencies?.[pkg]) {
130
110
  packageJson.devDependencies = Object.fromEntries(
131
- Object.entries(packageJson.devDependencies).filter(
132
- ([key]) => key !== pkg
133
- )
111
+ Object.entries(packageJson.devDependencies).filter(([key]) => key !== pkg)
134
112
  );
135
113
  packageChanged = true;
136
114
  packageChanges.push(`Removed ${pkg} from devDependencies`);
@@ -145,11 +123,7 @@ async function updatePackageJson(results, dryRun, config) {
145
123
  }
146
124
  if (packageChanged) {
147
125
  if (!dryRun) {
148
- await writeFile(
149
- packageJsonPath,
150
- JSON.stringify(packageJson, null, 2) + "\n",
151
- "utf-8"
152
- );
126
+ await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf8");
153
127
  }
154
128
  results.push({
155
129
  file: packageJsonPath,