@warlock.js/core 5.32.0 → 5.33.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/esm/application/application-config-types.d.mts +8 -0
  3. package/esm/application/application-config-types.d.mts.map +1 -1
  4. package/esm/application/boot-signal.d.mts +8 -8
  5. package/esm/application/boot-signal.d.mts.map +1 -1
  6. package/esm/application/boot-signal.mjs +15 -9
  7. package/esm/application/boot-signal.mjs.map +1 -1
  8. package/esm/cli/commands/ai/ai-command.action.mjs +140 -0
  9. package/esm/cli/commands/ai/ai-command.action.mjs.map +1 -0
  10. package/esm/cli/commands/ai.command.mjs +50 -0
  11. package/esm/cli/commands/ai.command.mjs.map +1 -0
  12. package/esm/cli/commands/check/check-command.action.mjs +3 -0
  13. package/esm/cli/commands/check/check-command.action.mjs.map +1 -1
  14. package/esm/cli/commands/check.command.mjs +6 -1
  15. package/esm/cli/commands/check.command.mjs.map +1 -1
  16. package/esm/cli/commands/pm2/pm2-command.action.mjs +91 -0
  17. package/esm/cli/commands/pm2/pm2-command.action.mjs.map +1 -0
  18. package/esm/cli/commands/pm2/pm2-config.mjs +115 -0
  19. package/esm/cli/commands/pm2/pm2-config.mjs.map +1 -0
  20. package/esm/cli/commands/pm2.command.mjs +53 -0
  21. package/esm/cli/commands/pm2.command.mjs.map +1 -0
  22. package/esm/cli/framework-cli-commands.mjs +4 -0
  23. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  24. package/esm/connectors/connectors-manager.d.mts.map +1 -1
  25. package/esm/connectors/connectors-manager.mjs +1 -4
  26. package/esm/connectors/connectors-manager.mjs.map +1 -1
  27. package/esm/connectors/shutdown-timeout.mjs +7 -0
  28. package/esm/connectors/shutdown-timeout.mjs.map +1 -0
  29. package/esm/connectors/socket-connector.d.mts.map +1 -1
  30. package/esm/connectors/socket-connector.mjs +8 -1
  31. package/esm/connectors/socket-connector.mjs.map +1 -1
  32. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +6 -8
  33. package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
  34. package/esm/dev-server/health-checker/default-health-checkers.mjs +6 -15
  35. package/esm/dev-server/health-checker/default-health-checkers.mjs.map +1 -1
  36. package/esm/dev-server/health-checker/eslint-support.mjs +27 -0
  37. package/esm/dev-server/health-checker/eslint-support.mjs.map +1 -0
  38. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +2 -1
  39. package/esm/dev-server/health-checker/file-health-checker.contract.d.mts.map +1 -1
  40. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs +2 -11
  41. package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs.map +1 -1
  42. package/esm/generations/features/index.mjs +2 -0
  43. package/esm/generations/features/index.mjs.map +1 -1
  44. package/esm/generations/features/process.feature.mjs +65 -0
  45. package/esm/generations/features/process.feature.mjs.map +1 -0
  46. package/esm/http/port-preflight.d.mts.map +1 -1
  47. package/esm/http/port-preflight.mjs +2 -0
  48. package/esm/http/port-preflight.mjs.map +1 -1
  49. package/esm/index.d.mts +7 -2
  50. package/esm/index.mjs +7 -2
  51. package/esm/secrets/errors.d.mts +9 -0
  52. package/esm/secrets/errors.d.mts.map +1 -0
  53. package/esm/secrets/errors.mjs +22 -0
  54. package/esm/secrets/errors.mjs.map +1 -0
  55. package/esm/secrets/file-backend.mjs +167 -0
  56. package/esm/secrets/file-backend.mjs.map +1 -0
  57. package/esm/secrets/index.d.mts +6 -0
  58. package/esm/secrets/index.mjs +6 -0
  59. package/esm/secrets/keyring-backend.mjs +50 -0
  60. package/esm/secrets/keyring-backend.mjs.map +1 -0
  61. package/esm/secrets/memory-backend.d.mts +12 -0
  62. package/esm/secrets/memory-backend.d.mts.map +1 -0
  63. package/esm/secrets/memory-backend.mjs +28 -0
  64. package/esm/secrets/memory-backend.mjs.map +1 -0
  65. package/esm/secrets/secret-store.d.mts +25 -0
  66. package/esm/secrets/secret-store.d.mts.map +1 -0
  67. package/esm/secrets/secret-store.mjs +117 -0
  68. package/esm/secrets/secret-store.mjs.map +1 -0
  69. package/esm/secrets/secrets.d.mts +11 -0
  70. package/esm/secrets/secrets.d.mts.map +1 -0
  71. package/esm/secrets/secrets.mjs +63 -0
  72. package/esm/secrets/secrets.mjs.map +1 -0
  73. package/esm/secrets/types.d.mts +22 -0
  74. package/esm/secrets/types.d.mts.map +1 -0
  75. package/esm/socket/index.d.mts +2 -2
  76. package/esm/socket/index.mjs +2 -2
  77. package/esm/socket/utils.d.mts +7 -0
  78. package/esm/socket/utils.d.mts.map +1 -1
  79. package/esm/socket/utils.mjs +12 -1
  80. package/esm/socket/utils.mjs.map +1 -1
  81. package/esm/tests/fakes/index.d.mts +2 -1
  82. package/esm/tests/fakes/index.mjs +2 -1
  83. package/esm/tests/fakes/secrets-fake.d.mts +13 -0
  84. package/esm/tests/fakes/secrets-fake.d.mts.map +1 -0
  85. package/esm/tests/fakes/secrets-fake.mjs +50 -0
  86. package/esm/tests/fakes/secrets-fake.mjs.map +1 -0
  87. package/esm/tests/fakes/test-fakes.d.mts +2 -2
  88. package/esm/tests/fakes/test-fakes.d.mts.map +1 -1
  89. package/esm/tests/fakes/test-fakes.mjs +5 -2
  90. package/esm/tests/fakes/test-fakes.mjs.map +1 -1
  91. package/esm/tests/index.d.mts +2 -1
  92. package/esm/tests/index.mjs +2 -1
  93. package/esm/tests/vitest-setup.d.mts +1 -1
  94. package/esm/tests/vitest-setup.mjs.map +1 -1
  95. package/esm/tooling/check/lint-step.d.mts +2 -8
  96. package/esm/tooling/check/lint-step.d.mts.map +1 -1
  97. package/esm/tooling/check/lint-step.mjs +14 -11
  98. package/esm/tooling/check/lint-step.mjs.map +1 -1
  99. package/esm/tooling/check/run-check.d.mts +2 -0
  100. package/esm/tooling/check/run-check.d.mts.map +1 -1
  101. package/esm/tooling/check/run-check.mjs +2 -2
  102. package/esm/tooling/check/run-check.mjs.map +1 -1
  103. package/esm/upgrade/codemods/index.mjs +2 -0
  104. package/esm/upgrade/codemods/index.mjs.map +1 -1
  105. package/esm/upgrade/codemods/oxc-toolchain.mjs +142 -0
  106. package/esm/upgrade/codemods/oxc-toolchain.mjs.map +1 -0
  107. package/esm/upgrade/codemods/toolchain-templates.mjs +244 -0
  108. package/esm/upgrade/codemods/toolchain-templates.mjs.map +1 -0
  109. package/esm/upgrade/run-upgrade.mjs +25 -6
  110. package/esm/upgrade/run-upgrade.mjs.map +1 -1
  111. package/esm/warlock-config/types.d.mts +2 -1
  112. package/esm/warlock-config/types.d.mts.map +1 -1
  113. package/llms-full.txt +326 -19
  114. package/llms.txt +3 -2
  115. package/package.json +23 -13
  116. package/skills/README.md +2 -1
  117. package/skills/index.md +1 -1
  118. package/skills/run-app/SKILL.md +114 -5
  119. package/skills/store-secrets/SKILL.md +102 -0
  120. package/skills/test-fakes/SKILL.md +13 -11
  121. package/skills/upgrade-from-5-29/SKILL.md +39 -2
  122. package/skills/warlock-check/SKILL.md +5 -1
  123. package/skills/warlock-doctor/SKILL.md +9 -0
  124. package/skills/wire-socket/SKILL.md +19 -0
  125. package/skills/write-cli-command/SKILL.md +21 -0
@@ -2,6 +2,7 @@ import { importedLocalNames, importsFrom, manualAt, objectProperty, objectProper
2
2
  import { headViewport } from "./head-viewport.mjs";
3
3
  import { loggerSyncCalls } from "./logger-sync-calls.mjs";
4
4
  import { node2215, warlockVersions } from "./package-json.mjs";
5
+ import { oxcToolchain } from "./oxc-toolchain.mjs";
5
6
  import { requestLogSnapshot } from "./request-log-snapshot.mjs";
6
7
  import { aiAnthropicBody, aiCompactionOptIn, aiFinishReason, aiToolDispatch, rateLimitDefaults, sealContainerCatch, sealRefineOutput, sealUnionOutput, sealValidateResult } from "./review-sites.mjs";
7
8
 
@@ -26,6 +27,7 @@ const CODEMODS = [
26
27
  sealContainerCatch,
27
28
  sealUnionOutput,
28
29
  aiCompactionOptIn,
30
+ oxcToolchain,
29
31
  warlockVersions
30
32
  ];
31
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/upgrade/codemods/index.ts"],"sourcesContent":["import type { Codemod } from \"../types\";\nimport { headViewport } from \"./head-viewport\";\nimport { loggerSyncCalls } from \"./logger-sync-calls\";\nimport { node2215, warlockVersions } from \"./package-json\";\nimport { requestLogSnapshot } from \"./request-log-snapshot\";\nimport {\n aiAnthropicBody,\n aiCompactionOptIn,\n aiFinishReason,\n aiToolDispatch,\n rateLimitDefaults,\n sealContainerCatch,\n sealRefineOutput,\n sealUnionOutput,\n sealValidateResult,\n} from \"./review-sites\";\n\n/**\n * Every codemod, oldest release first. A codemod runs when the app upgrades\n * across its `version` (`from < version <= to`); `\"target\"` ones run on every\n * upgrade. Add one here for each breaking change, and name its id next to the\n * `**BREAKING**` entry in the package changelog.\n */\nexport const CODEMODS: readonly Codemod[] = [\n loggerSyncCalls,\n requestLogSnapshot,\n headViewport,\n sealValidateResult,\n aiToolDispatch,\n aiAnthropicBody,\n aiFinishReason,\n node2215,\n rateLimitDefaults,\n sealRefineOutput,\n sealContainerCatch,\n sealUnionOutput,\n aiCompactionOptIn,\n warlockVersions,\n];\n\nexport * from \"./helpers\";\n"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAa,WAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/upgrade/codemods/index.ts"],"sourcesContent":["import type { Codemod } from \"../types\";\nimport { headViewport } from \"./head-viewport\";\nimport { loggerSyncCalls } from \"./logger-sync-calls\";\nimport { node2215, warlockVersions } from \"./package-json\";\nimport { oxcToolchain } from \"./oxc-toolchain\";\nimport { requestLogSnapshot } from \"./request-log-snapshot\";\nimport {\n aiAnthropicBody,\n aiCompactionOptIn,\n aiFinishReason,\n aiToolDispatch,\n rateLimitDefaults,\n sealContainerCatch,\n sealRefineOutput,\n sealUnionOutput,\n sealValidateResult,\n} from \"./review-sites\";\n\n/**\n * Every codemod, oldest release first. A codemod runs when the app upgrades\n * across its `version` (`from < version <= to`); `\"target\"` ones run on every\n * upgrade. Add one here for each breaking change, and name its id next to the\n * `**BREAKING**` entry in the package changelog.\n */\nexport const CODEMODS: readonly Codemod[] = [\n loggerSyncCalls,\n requestLogSnapshot,\n headViewport,\n sealValidateResult,\n aiToolDispatch,\n aiAnthropicBody,\n aiFinishReason,\n node2215,\n rateLimitDefaults,\n sealRefineOutput,\n sealContainerCatch,\n sealUnionOutput,\n aiCompactionOptIn,\n oxcToolchain,\n warlockVersions,\n];\n\nexport * from \"./helpers\";\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAa,WAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,142 @@
1
+ import { TOOLCHAIN_TEMPLATES } from "./toolchain-templates.mjs";
2
+
3
+ //#region ../../packages/core/src/upgrade/codemods/oxc-toolchain.ts
4
+ /** Snapshots ship with core; parity specs keep them aligned with create-warlock. */
5
+ function asset(name) {
6
+ const content = TOOLCHAIN_TEMPLATES[name];
7
+ if (content === void 0) throw new Error(`Unknown toolchain template: ${name}`);
8
+ return content;
9
+ }
10
+ const OXC_VERSIONS = {
11
+ oxlint: "1.88.0",
12
+ oxfmt: "0.73.0",
13
+ typescript: "7.0.2"
14
+ };
15
+ const OXC_SCRIPTS = {
16
+ lint: "oxlint --fix ./src --max-warnings=0",
17
+ "lint:check": "oxlint ./src --max-warnings=0",
18
+ format: "oxfmt --ignore-path .gitignore --ignore-path .oxfmtignore --write ./src",
19
+ "format:check": "oxfmt --ignore-path .gitignore --ignore-path .oxfmtignore --check ./src"
20
+ };
21
+ function legacyDependency(name) {
22
+ return /^(eslint|prettier|@types\/prettier|eslint-config-prettier)$/.test(name) || name.startsWith("@typescript-eslint/") || /(?:^|\/)eslint-plugin-/.test(name) || /(?:^|\/)prettier-plugin-/.test(name) || name.startsWith("@prettier/plugin-");
23
+ }
24
+ function sameGenerated(source, expected) {
25
+ try {
26
+ return JSON.stringify(JSON.parse(source)) === JSON.stringify(JSON.parse(expected));
27
+ } catch {
28
+ return source.replace(/\r\n/g, "\n").trim() === expected.replace(/\r\n/g, "\n").trim();
29
+ }
30
+ }
31
+ function review(output, file, hint, line = 1) {
32
+ output.manual.push({
33
+ file,
34
+ line,
35
+ hint
36
+ });
37
+ }
38
+ function migrateHealthSwitches(context, output) {
39
+ const file = "warlock.config.ts";
40
+ const source = context.text.read(file);
41
+ if (source === void 0) return;
42
+ const config = new context.tsMorph.Project({ useInMemoryFileSystem: true }).createSourceFile(file, source);
43
+ const switches = config.getDescendantsOfKind(context.tsMorph.SyntaxKind.PropertyAssignment).filter((property) => property.getName() === "healthCheckers");
44
+ let changed = false;
45
+ for (const property of switches) {
46
+ const value = property.getInitializer();
47
+ if (!value || !context.tsMorph.Node.isObjectLiteralExpression(value)) {
48
+ if (value?.getText() !== "false") review(output, file, "Review custom healthCheckers; remove ESLint checkers and enable Oxlint. ESLint support is removed in 5.34.0.", property.getStartLineNumber());
49
+ continue;
50
+ }
51
+ for (const spread of value.getProperties().filter(context.tsMorph.Node.isSpreadAssignment)) review(output, file, "Review spread healthCheckers options; set eslint: false and oxlint: true explicitly after the spread.", spread.getStartLineNumber());
52
+ for (const [name, next] of [["eslint", "false"], ["oxlint", "true"]]) {
53
+ const option = value.getProperty(name);
54
+ if (!option) continue;
55
+ if (!context.tsMorph.Node.isPropertyAssignment(option) || !["true", "false"].includes(option.getInitializer()?.getText() ?? "")) {
56
+ review(output, file, `Set healthCheckers.${name} to ${next} after reviewing this computed option.`, option.getStartLineNumber());
57
+ continue;
58
+ }
59
+ if (option.getInitializer()?.getText() !== next) {
60
+ option.setInitializer(next);
61
+ changed = true;
62
+ }
63
+ }
64
+ }
65
+ if (changed) context.text.write(file, config.getFullText(), {
66
+ line: 1,
67
+ description: "Select Oxlint instead of ESLint for background health checks"
68
+ });
69
+ }
70
+ const oxcToolchain = {
71
+ id: "oxc-toolchain",
72
+ version: "5.33.0",
73
+ package: "@warlock.js/core",
74
+ title: "Migrate ESLint and Prettier to Oxlint and Oxfmt",
75
+ skill: "upgrade-from-5-29",
76
+ run(context) {
77
+ const output = {
78
+ edits: [],
79
+ manual: []
80
+ };
81
+ const source = context.text.read("package.json");
82
+ if (source === void 0) return output;
83
+ const pkg = JSON.parse(source);
84
+ const legacyFiles = context.text.list().filter((file) => /^(eslint\.config\..+|\.eslintrc(?:\..+)?|\.prettierrc(?:\..+)?|prettier\.config\..+|\.prettierignore)$/.test(file));
85
+ const dependencies = [pkg.dependencies, pkg.devDependencies];
86
+ const legacyScripts = Object.values(pkg.scripts ?? {}).some((script) => /\b(?:eslint|prettier)\b/.test(script));
87
+ if (!legacyFiles.length && !legacyScripts && !dependencies.some((deps) => Object.keys(deps ?? {}).some(legacyDependency))) return output;
88
+ const change = {
89
+ line: 1,
90
+ description: "Replace ESLint/Prettier with the default Oxlint/Oxfmt toolchain"
91
+ };
92
+ for (const deps of dependencies) for (const name of Object.keys(deps ?? {})) if (deps && (legacyDependency(name) || name in OXC_VERSIONS)) delete deps[name];
93
+ pkg.devDependencies = {
94
+ ...pkg.devDependencies,
95
+ ...OXC_VERSIONS
96
+ };
97
+ pkg.scripts = {
98
+ ...pkg.scripts,
99
+ ...OXC_SCRIPTS
100
+ };
101
+ if (/\beslint\b/.test(pkg.scripts.fix ?? "")) pkg.scripts.fix = OXC_SCRIPTS.lint;
102
+ for (const [name, command] of Object.entries(pkg.scripts)) if (/\b(?:eslint|prettier)\b/.test(command)) review(output, "package.json", `Replace the custom ${name} script (${command}) with oxlint or oxfmt; the legacy tools have been removed from dependencies.`);
103
+ context.text.write("package.json", `${JSON.stringify(pkg, null, 2)}\n`, change);
104
+ for (const file of [".oxlintrc.json", ".oxfmtrc.json"]) if (context.text.read(file) === void 0) context.text.write(file, asset(file.slice(1)), change);
105
+ for (const file of legacyFiles) {
106
+ const content = context.text.read(file);
107
+ const known = [
108
+ "eslint.config.js",
109
+ ".prettierrc.json",
110
+ ".prettierignore"
111
+ ].includes(file);
112
+ if (content === void 0) continue;
113
+ if (!known || !sameGenerated(content, asset(`legacy-${file.replace(/^\./, "")}`))) {
114
+ review(output, file, "Customized legacy config retained. Port its rules, plugins, formatting or ignore patterns to .oxlintrc.json / .oxfmtrc.json / .oxfmtignore, then remove this file. Legacy support is removed in 5.34.0.");
115
+ continue;
116
+ }
117
+ if (file === ".prettierignore") {
118
+ const existing = context.text.read(".oxfmtignore");
119
+ if (existing === void 0) context.text.write(".oxfmtignore", content, change);
120
+ else if (existing.trim() !== content.trim()) {
121
+ review(output, file, "Merge these ignore patterns into the existing .oxfmtignore, then remove .prettierignore.");
122
+ continue;
123
+ }
124
+ }
125
+ context.text.remove(file, change);
126
+ }
127
+ if (context.text.read(".oxfmtignore") === void 0) context.text.write(".oxfmtignore", "node_modules\ndist\n", change);
128
+ for (const name of ["settings.json", "extensions.json"]) {
129
+ const file = `.vscode/${name}`;
130
+ const content = context.text.read(file);
131
+ if (content === void 0) continue;
132
+ if (name === "settings.json" && sameGenerated(content, asset(`legacy-vscode-${name}`))) context.text.write(file, asset(`oxc-vscode-${name}`), change);
133
+ else review(output, file, "Review editor settings: select oxc.oxc-vscode as the formatter, enable source.fixAll.oxc and remove ESLint/Prettier extension recommendations.");
134
+ }
135
+ migrateHealthSwitches(context, output);
136
+ return output;
137
+ }
138
+ };
139
+
140
+ //#endregion
141
+ export { OXC_SCRIPTS, OXC_VERSIONS, oxcToolchain };
142
+ //# sourceMappingURL=oxc-toolchain.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxc-toolchain.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/upgrade/codemods/oxc-toolchain.ts"],"sourcesContent":["import type { Codemod, CodemodContext, CodemodOutput } from \"../types\";\nimport { TOOLCHAIN_TEMPLATES } from \"./toolchain-templates\";\n\n/** Snapshots ship with core; parity specs keep them aligned with create-warlock. */\nfunction asset(name: string): string {\n const content = TOOLCHAIN_TEMPLATES[name];\n if (content === undefined) throw new Error(`Unknown toolchain template: ${name}`);\n return content;\n}\n\nexport const OXC_VERSIONS = { oxlint: \"1.88.0\", oxfmt: \"0.73.0\", typescript: \"7.0.2\" };\nexport const OXC_SCRIPTS = {\n lint: \"oxlint --fix ./src --max-warnings=0\",\n \"lint:check\": \"oxlint ./src --max-warnings=0\",\n format: \"oxfmt --ignore-path .gitignore --ignore-path .oxfmtignore --write ./src\",\n \"format:check\": \"oxfmt --ignore-path .gitignore --ignore-path .oxfmtignore --check ./src\",\n};\n\nfunction legacyDependency(name: string): boolean {\n return (\n /^(eslint|prettier|@types\\/prettier|eslint-config-prettier)$/.test(name) ||\n name.startsWith(\"@typescript-eslint/\") ||\n /(?:^|\\/)eslint-plugin-/.test(name) ||\n /(?:^|\\/)prettier-plugin-/.test(name) ||\n name.startsWith(\"@prettier/plugin-\")\n );\n}\n\nfunction sameGenerated(source: string, expected: string): boolean {\n // JSON may have been reformatted by the app; compare its data. Executable\n // configs are deliberately exact (apart from line endings/trailing space).\n try {\n return JSON.stringify(JSON.parse(source)) === JSON.stringify(JSON.parse(expected));\n } catch {\n return source.replace(/\\r\\n/g, \"\\n\").trim() === expected.replace(/\\r\\n/g, \"\\n\").trim();\n }\n}\n\nfunction review(output: CodemodOutput, file: string, hint: string, line = 1): void {\n output.manual.push({ file, line, hint });\n}\n\nfunction migrateHealthSwitches(context: CodemodContext, output: CodemodOutput): void {\n const file = \"warlock.config.ts\";\n const source = context.text.read(file);\n if (source === undefined) return;\n const project = new context.tsMorph.Project({ useInMemoryFileSystem: true });\n const config = project.createSourceFile(file, source);\n const switches = config\n .getDescendantsOfKind(context.tsMorph.SyntaxKind.PropertyAssignment)\n .filter((property) => property.getName() === \"healthCheckers\");\n let changed = false;\n for (const property of switches) {\n const value = property.getInitializer();\n if (!value || !context.tsMorph.Node.isObjectLiteralExpression(value)) {\n if (value?.getText() !== \"false\")\n review(\n output,\n file,\n \"Review custom healthCheckers; remove ESLint checkers and enable Oxlint. ESLint support is removed in 5.34.0.\",\n property.getStartLineNumber(),\n );\n continue;\n }\n for (const spread of value.getProperties().filter(context.tsMorph.Node.isSpreadAssignment)) {\n review(\n output,\n file,\n \"Review spread healthCheckers options; set eslint: false and oxlint: true explicitly after the spread.\",\n spread.getStartLineNumber(),\n );\n }\n for (const [name, next] of [\n [\"eslint\", \"false\"],\n [\"oxlint\", \"true\"],\n ] as const) {\n const option = value.getProperty(name);\n if (!option) continue;\n if (\n !context.tsMorph.Node.isPropertyAssignment(option) ||\n ![\"true\", \"false\"].includes(option.getInitializer()?.getText() ?? \"\")\n ) {\n review(\n output,\n file,\n `Set healthCheckers.${name} to ${next} after reviewing this computed option.`,\n option.getStartLineNumber(),\n );\n continue;\n }\n if (option.getInitializer()?.getText() !== next) {\n option.setInitializer(next);\n changed = true;\n }\n }\n }\n if (changed)\n context.text.write(file, config.getFullText(), {\n line: 1,\n description: \"Select Oxlint instead of ESLint for background health checks\",\n });\n}\n\nexport const oxcToolchain: Codemod = {\n id: \"oxc-toolchain\",\n version: \"5.33.0\",\n package: \"@warlock.js/core\",\n title: \"Migrate ESLint and Prettier to Oxlint and Oxfmt\",\n skill: \"upgrade-from-5-29\",\n run(context) {\n const output: CodemodOutput = { edits: [], manual: [] };\n const source = context.text.read(\"package.json\");\n if (source === undefined) return output;\n const pkg = JSON.parse(source) as {\n scripts?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n const legacyFiles = context.text\n .list()\n .filter((file) =>\n /^(eslint\\.config\\..+|\\.eslintrc(?:\\..+)?|\\.prettierrc(?:\\..+)?|prettier\\.config\\..+|\\.prettierignore)$/.test(\n file,\n ),\n );\n const dependencies = [pkg.dependencies, pkg.devDependencies];\n const legacyScripts = Object.values(pkg.scripts ?? {}).some((script) =>\n /\\b(?:eslint|prettier)\\b/.test(script),\n );\n if (\n !legacyFiles.length &&\n !legacyScripts &&\n !dependencies.some((deps) => Object.keys(deps ?? {}).some(legacyDependency))\n )\n return output;\n\n const change = {\n line: 1,\n description: \"Replace ESLint/Prettier with the default Oxlint/Oxfmt toolchain\",\n };\n for (const deps of dependencies) {\n for (const name of Object.keys(deps ?? {})) {\n if (deps && (legacyDependency(name) || name in OXC_VERSIONS)) delete deps[name];\n }\n }\n pkg.devDependencies = { ...pkg.devDependencies, ...OXC_VERSIONS };\n pkg.scripts = { ...pkg.scripts, ...OXC_SCRIPTS };\n if (/\\beslint\\b/.test(pkg.scripts.fix ?? \"\")) pkg.scripts.fix = OXC_SCRIPTS.lint;\n for (const [name, command] of Object.entries(pkg.scripts)) {\n if (/\\b(?:eslint|prettier)\\b/.test(command))\n review(\n output,\n \"package.json\",\n `Replace the custom ${name} script (${command}) with oxlint or oxfmt; the legacy tools have been removed from dependencies.`,\n );\n }\n context.text.write(\"package.json\", `${JSON.stringify(pkg, null, 2)}\\n`, change);\n\n for (const file of [\".oxlintrc.json\", \".oxfmtrc.json\"]) {\n if (context.text.read(file) === undefined)\n context.text.write(file, asset(file.slice(1)), change);\n }\n for (const file of legacyFiles) {\n const content = context.text.read(file);\n const known = [\"eslint.config.js\", \".prettierrc.json\", \".prettierignore\"].includes(file);\n if (content === undefined) continue;\n if (!known || !sameGenerated(content, asset(`legacy-${file.replace(/^\\./, \"\")}`))) {\n review(\n output,\n file,\n \"Customized legacy config retained. Port its rules, plugins, formatting or ignore patterns to .oxlintrc.json / .oxfmtrc.json / .oxfmtignore, then remove this file. Legacy support is removed in 5.34.0.\",\n );\n continue;\n }\n if (file === \".prettierignore\") {\n const existing = context.text.read(\".oxfmtignore\");\n if (existing === undefined) context.text.write(\".oxfmtignore\", content, change);\n else if (existing.trim() !== content.trim()) {\n review(\n output,\n file,\n \"Merge these ignore patterns into the existing .oxfmtignore, then remove .prettierignore.\",\n );\n continue;\n }\n }\n context.text.remove(file, change);\n }\n // Oxfmt 0.73 uses .prettierignore by default (verified with --help).\n // Explicit script ignore paths make the migrated .oxfmtignore effective.\n if (context.text.read(\".oxfmtignore\") === undefined) {\n context.text.write(\".oxfmtignore\", \"node_modules\\ndist\\n\", change);\n }\n for (const name of [\"settings.json\", \"extensions.json\"]) {\n const file = `.vscode/${name}`;\n const content = context.text.read(file);\n if (content === undefined) continue;\n if (name === \"settings.json\" && sameGenerated(content, asset(`legacy-vscode-${name}`)))\n context.text.write(file, asset(`oxc-vscode-${name}`), change);\n else\n review(\n output,\n file,\n \"Review editor settings: select oxc.oxc-vscode as the formatter, enable source.fixAll.oxc and remove ESLint/Prettier extension recommendations.\",\n );\n }\n migrateHealthSwitches(context, output);\n return output;\n },\n};\n"],"mappings":";;;;AAIA,SAAS,MAAM,MAAsB;CACnC,MAAM,UAAU,oBAAoB;CACpC,IAAI,YAAY,QAAW,MAAM,IAAI,MAAM,+BAA+B,MAAM;CAChF,OAAO;AACT;AAEA,MAAa,eAAe;CAAE,QAAQ;CAAU,OAAO;CAAU,YAAY;AAAQ;AACrF,MAAa,cAAc;CACzB,MAAM;CACN,cAAc;CACd,QAAQ;CACR,gBAAgB;AAClB;AAEA,SAAS,iBAAiB,MAAuB;CAC/C,OACE,8DAA8D,KAAK,IAAI,KACvE,KAAK,WAAW,qBAAqB,KACrC,yBAAyB,KAAK,IAAI,KAClC,2BAA2B,KAAK,IAAI,KACpC,KAAK,WAAW,mBAAmB;AAEvC;AAEA,SAAS,cAAc,QAAgB,UAA2B;CAGhE,IAAI;EACF,OAAO,KAAK,UAAU,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK,UAAU,KAAK,MAAM,QAAQ,CAAC;CACnF,QAAQ;EACN,OAAO,OAAO,QAAQ,SAAS,IAAI,CAAC,CAAC,KAAK,MAAM,SAAS,QAAQ,SAAS,IAAI,CAAC,CAAC,KAAK;CACvF;AACF;AAEA,SAAS,OAAO,QAAuB,MAAc,MAAc,OAAO,GAAS;CACjF,OAAO,OAAO,KAAK;EAAE;EAAM;EAAM;CAAK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D,OACE,QACA,MACA,gJACF;EACJ;EACA,sBAAsB,SAAS,MAAM;EACrC,OAAO;CACT;AACF"}
@@ -0,0 +1,244 @@
1
+ //#region ../../packages/core/src/upgrade/codemods/toolchain-templates.ts
2
+ /** Bundled create-warlock snapshots. oxc-toolchain.spec.ts checks template parity. */
3
+ const TOOLCHAIN_TEMPLATES = {
4
+ "legacy-eslint.config.js": `import tsPlugin from "@typescript-eslint/eslint-plugin";
5
+ import tsParser from "@typescript-eslint/parser";
6
+ import prettierConfig from "eslint-config-prettier";
7
+ import prettierPlugin from "eslint-plugin-prettier";
8
+ import unusedImports from "eslint-plugin-unused-imports";
9
+
10
+ export default [
11
+ // Global configuration
12
+ {
13
+ languageOptions: {
14
+ ecmaVersion: "latest",
15
+ sourceType: "module",
16
+ globals: {
17
+ // Node.js globals
18
+ console: "readonly",
19
+ process: "readonly",
20
+ Buffer: "readonly",
21
+ __dirname: "readonly",
22
+ __filename: "readonly",
23
+ global: "readonly",
24
+ module: "readonly",
25
+ require: "readonly",
26
+ exports: "readonly",
27
+ // ES2021 globals
28
+ Promise: "readonly",
29
+ // Jest globals
30
+ describe: "readonly",
31
+ it: "readonly",
32
+ test: "readonly",
33
+ expect: "readonly",
34
+ beforeEach: "readonly",
35
+ afterEach: "readonly",
36
+ beforeAll: "readonly",
37
+ afterAll: "readonly",
38
+ jest: "readonly",
39
+ },
40
+ },
41
+ },
42
+
43
+ // TypeScript files configuration
44
+ {
45
+ files: ["**/*.ts", "**/*.tsx"],
46
+ languageOptions: {
47
+ parser: tsParser,
48
+ parserOptions: {
49
+ ecmaVersion: "latest",
50
+ sourceType: "module",
51
+ },
52
+ },
53
+ plugins: {
54
+ "@typescript-eslint": tsPlugin,
55
+ prettier: prettierPlugin,
56
+ "unused-imports": unusedImports,
57
+ },
58
+ rules: {
59
+ // Prettier integration
60
+ ...prettierConfig.rules,
61
+ "prettier/prettier": "error",
62
+
63
+ // TypeScript rules
64
+ "@typescript-eslint/no-explicit-any": "off",
65
+ "@typescript-eslint/no-unused-vars": "off",
66
+ "no-unused-vars": "off",
67
+ "unused-imports/no-unused-vars": [
68
+ "warn",
69
+ {
70
+ vars: "all",
71
+ varsIgnorePattern: "^_",
72
+ args: "after-used",
73
+ argsIgnorePattern: "^_",
74
+ },
75
+ ],
76
+ "unused-imports/no-unused-imports": "error",
77
+ "@typescript-eslint/explicit-member-accessibility": [
78
+ "error",
79
+ { accessibility: "explicit" },
80
+ ],
81
+ "@typescript-eslint/consistent-type-imports": [
82
+ "error",
83
+ {
84
+ prefer: "type-imports",
85
+ disallowTypeAnnotations: false,
86
+ },
87
+ ],
88
+ },
89
+ },
90
+
91
+ // Ignore patterns
92
+ {
93
+ ignores: [
94
+ "dist/",
95
+ "node_modules/",
96
+ "**/*.js",
97
+ "!**/*.config.js",
98
+ "!eslint.config.js",
99
+ ],
100
+ },
101
+ ];
102
+ `,
103
+ "legacy-prettierignore": `node_modules
104
+ dist
105
+
106
+
107
+ `,
108
+ "legacy-prettierrc.json": `{
109
+ "semi": true,
110
+ "tabWidth": 2,
111
+ "printWidth": 100,
112
+ "singleQuote": false,
113
+ "arrowParens": "always",
114
+ "trailingComma": "all",
115
+ "endOfLine": "lf",
116
+ "plugins": ["@ianvs/prettier-plugin-sort-imports"],
117
+ "importOrder": ["<BUILTIN_MODULES>", "<THIRD_PARTY_MODULES>", "^(app|web|@shared)/", "^[.]"],
118
+ "importOrderParserPlugins": ["typescript", "jsx", "decorators"]
119
+ }
120
+ `,
121
+ "legacy-vscode-settings.json": `{
122
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
123
+ "editor.formatOnSave": true,
124
+ "editor.codeActionsOnSave": {
125
+ "source.fixAll.eslint": "explicit",
126
+ "source.organizeImports": "never"
127
+ },
128
+ "[typescript]": {
129
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
130
+ "editor.formatOnSave": true
131
+ },
132
+ "[typescriptreact]": {
133
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
134
+ "editor.formatOnSave": true
135
+ },
136
+ "[javascript]": {
137
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
138
+ "editor.formatOnSave": true
139
+ },
140
+ "[javascriptreact]": {
141
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
142
+ "editor.formatOnSave": true
143
+ },
144
+ "[json]": {
145
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
146
+ "editor.formatOnSave": true
147
+ },
148
+ "[css]": {
149
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
150
+ "editor.formatOnSave": true
151
+ },
152
+ "prettier.configPath": ".prettierrc.json",
153
+ "prettier.requireConfig": true,
154
+ "prettier.ignorePath": ".prettierignore",
155
+ "prettier.documentSelectors": ["**/*.{ts,tsx,js,jsx,json,css,md}"],
156
+ "prettier.enable": true,
157
+ "prettier.useEditorConfig": false,
158
+ "prettier.resolveGlobalModules": false,
159
+ "eslint.format.enable": false,
160
+ "eslint.codeActionsOnSave.mode": "all"
161
+ }
162
+ `,
163
+ "oxc-vscode-settings.json": `{
164
+ "editor.defaultFormatter": "oxc.oxc-vscode",
165
+ "editor.formatOnSave": true,
166
+ "editor.codeActionsOnSave": {
167
+ "source.fixAll.oxc": "explicit",
168
+ "source.organizeImports": "never"
169
+ },
170
+ "[typescript]": {
171
+ "editor.defaultFormatter": "oxc.oxc-vscode",
172
+ "editor.formatOnSave": true
173
+ },
174
+ "[typescriptreact]": {
175
+ "editor.defaultFormatter": "oxc.oxc-vscode",
176
+ "editor.formatOnSave": true
177
+ },
178
+ "[javascript]": {
179
+ "editor.defaultFormatter": "oxc.oxc-vscode",
180
+ "editor.formatOnSave": true
181
+ },
182
+ "[javascriptreact]": {
183
+ "editor.defaultFormatter": "oxc.oxc-vscode",
184
+ "editor.formatOnSave": true
185
+ },
186
+ "[json]": {
187
+ "editor.defaultFormatter": "oxc.oxc-vscode",
188
+ "editor.formatOnSave": true
189
+ },
190
+ "[css]": {
191
+ "editor.defaultFormatter": "oxc.oxc-vscode",
192
+ "editor.formatOnSave": true
193
+ },
194
+ "oxc.enable.oxlint": true,
195
+ "oxc.enable.oxfmt": true,
196
+ "oxc.requireConfig": true
197
+ }
198
+ `,
199
+ "oxfmtrc.json": `{
200
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
201
+ "semi": true,
202
+ "tabWidth": 2,
203
+ "printWidth": 100,
204
+ "singleQuote": false,
205
+ "arrowParens": "always",
206
+ "trailingComma": "all",
207
+ "endOfLine": "lf",
208
+ "sortImports": {
209
+ "newlinesBetween": false,
210
+ "internalPattern": ["app/", "web/", "@shared/"]
211
+ },
212
+ "ignorePatterns": ["node_modules/", "dist/"]
213
+ }
214
+ `,
215
+ "oxlintrc.json": `{
216
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
217
+ "plugins": ["typescript", "import", "react"],
218
+ "env": { "node": true, "es2021": true },
219
+ "categories": { "correctness": "off" },
220
+ "rules": {
221
+ "typescript/no-explicit-any": "off",
222
+ "no-unused-vars": [
223
+ "warn",
224
+ {
225
+ "vars": "all",
226
+ "varsIgnorePattern": "^_",
227
+ "args": "after-used",
228
+ "argsIgnorePattern": "^_"
229
+ }
230
+ ],
231
+ "typescript/explicit-member-accessibility": ["error", { "accessibility": "explicit" }],
232
+ "typescript/consistent-type-imports": [
233
+ "error",
234
+ { "prefer": "type-imports", "disallowTypeAnnotations": false }
235
+ ]
236
+ },
237
+ "ignorePatterns": ["node_modules/", "dist/"]
238
+ }
239
+ `
240
+ };
241
+
242
+ //#endregion
243
+ export { TOOLCHAIN_TEMPLATES };
244
+ //# sourceMappingURL=toolchain-templates.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolchain-templates.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/upgrade/codemods/toolchain-templates.ts"],"sourcesContent":["/** Bundled create-warlock snapshots. oxc-toolchain.spec.ts checks template parity. */\nexport const TOOLCHAIN_TEMPLATES: Readonly<Record<string, string>> = {\n \"legacy-eslint.config.js\": `import tsPlugin from \"@typescript-eslint/eslint-plugin\";\nimport tsParser from \"@typescript-eslint/parser\";\nimport prettierConfig from \"eslint-config-prettier\";\nimport prettierPlugin from \"eslint-plugin-prettier\";\nimport unusedImports from \"eslint-plugin-unused-imports\";\n\nexport default [\n // Global configuration\n {\n languageOptions: {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n globals: {\n // Node.js globals\n console: \"readonly\",\n process: \"readonly\",\n Buffer: \"readonly\",\n __dirname: \"readonly\",\n __filename: \"readonly\",\n global: \"readonly\",\n module: \"readonly\",\n require: \"readonly\",\n exports: \"readonly\",\n // ES2021 globals\n Promise: \"readonly\",\n // Jest globals\n describe: \"readonly\",\n it: \"readonly\",\n test: \"readonly\",\n expect: \"readonly\",\n beforeEach: \"readonly\",\n afterEach: \"readonly\",\n beforeAll: \"readonly\",\n afterAll: \"readonly\",\n jest: \"readonly\",\n },\n },\n },\n\n // TypeScript files configuration\n {\n files: [\"**/*.ts\", \"**/*.tsx\"],\n languageOptions: {\n parser: tsParser,\n parserOptions: {\n ecmaVersion: \"latest\",\n sourceType: \"module\",\n },\n },\n plugins: {\n \"@typescript-eslint\": tsPlugin,\n prettier: prettierPlugin,\n \"unused-imports\": unusedImports,\n },\n rules: {\n // Prettier integration\n ...prettierConfig.rules,\n \"prettier/prettier\": \"error\",\n\n // TypeScript rules\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-unused-vars\": \"off\",\n \"no-unused-vars\": \"off\",\n \"unused-imports/no-unused-vars\": [\n \"warn\",\n {\n vars: \"all\",\n varsIgnorePattern: \"^_\",\n args: \"after-used\",\n argsIgnorePattern: \"^_\",\n },\n ],\n \"unused-imports/no-unused-imports\": \"error\",\n \"@typescript-eslint/explicit-member-accessibility\": [\n \"error\",\n { accessibility: \"explicit\" },\n ],\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n {\n prefer: \"type-imports\",\n disallowTypeAnnotations: false,\n },\n ],\n },\n },\n\n // Ignore patterns\n {\n ignores: [\n \"dist/\",\n \"node_modules/\",\n \"**/*.js\",\n \"!**/*.config.js\",\n \"!eslint.config.js\",\n ],\n },\n];\n`,\n \"legacy-prettierignore\": `node_modules\ndist\n\n\n`,\n \"legacy-prettierrc.json\": `{\n \"semi\": true,\n \"tabWidth\": 2,\n \"printWidth\": 100,\n \"singleQuote\": false,\n \"arrowParens\": \"always\",\n \"trailingComma\": \"all\",\n \"endOfLine\": \"lf\",\n \"plugins\": [\"@ianvs/prettier-plugin-sort-imports\"],\n \"importOrder\": [\"<BUILTIN_MODULES>\", \"<THIRD_PARTY_MODULES>\", \"^(app|web|@shared)/\", \"^[.]\"],\n \"importOrderParserPlugins\": [\"typescript\", \"jsx\", \"decorators\"]\n}\n`,\n \"legacy-vscode-settings.json\": `{\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true,\n \"editor.codeActionsOnSave\": {\n \"source.fixAll.eslint\": \"explicit\",\n \"source.organizeImports\": \"never\"\n },\n \"[typescript]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[typescriptreact]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[javascript]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[javascriptreact]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[json]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[css]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.formatOnSave\": true\n },\n \"prettier.configPath\": \".prettierrc.json\",\n \"prettier.requireConfig\": true,\n \"prettier.ignorePath\": \".prettierignore\",\n \"prettier.documentSelectors\": [\"**/*.{ts,tsx,js,jsx,json,css,md}\"],\n \"prettier.enable\": true,\n \"prettier.useEditorConfig\": false,\n \"prettier.resolveGlobalModules\": false,\n \"eslint.format.enable\": false,\n \"eslint.codeActionsOnSave.mode\": \"all\"\n}\n`,\n \"oxc-vscode-settings.json\": `{\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true,\n \"editor.codeActionsOnSave\": {\n \"source.fixAll.oxc\": \"explicit\",\n \"source.organizeImports\": \"never\"\n },\n \"[typescript]\": {\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[typescriptreact]\": {\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[javascript]\": {\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[javascriptreact]\": {\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[json]\": {\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true\n },\n \"[css]\": {\n \"editor.defaultFormatter\": \"oxc.oxc-vscode\",\n \"editor.formatOnSave\": true\n },\n \"oxc.enable.oxlint\": true,\n \"oxc.enable.oxfmt\": true,\n \"oxc.requireConfig\": true\n}\n`,\n \"oxfmtrc.json\": `{\n \"$schema\": \"./node_modules/oxfmt/configuration_schema.json\",\n \"semi\": true,\n \"tabWidth\": 2,\n \"printWidth\": 100,\n \"singleQuote\": false,\n \"arrowParens\": \"always\",\n \"trailingComma\": \"all\",\n \"endOfLine\": \"lf\",\n \"sortImports\": {\n \"newlinesBetween\": false,\n \"internalPattern\": [\"app/\", \"web/\", \"@shared/\"]\n },\n \"ignorePatterns\": [\"node_modules/\", \"dist/\"]\n}\n`,\n \"oxlintrc.json\": `{\n \"$schema\": \"./node_modules/oxlint/configuration_schema.json\",\n \"plugins\": [\"typescript\", \"import\", \"react\"],\n \"env\": { \"node\": true, \"es2021\": true },\n \"categories\": { \"correctness\": \"off\" },\n \"rules\": {\n \"typescript/no-explicit-any\": \"off\",\n \"no-unused-vars\": [\n \"warn\",\n {\n \"vars\": \"all\",\n \"varsIgnorePattern\": \"^_\",\n \"args\": \"after-used\",\n \"argsIgnorePattern\": \"^_\"\n }\n ],\n \"typescript/explicit-member-accessibility\": [\"error\", { \"accessibility\": \"explicit\" }],\n \"typescript/consistent-type-imports\": [\n \"error\",\n { \"prefer\": \"type-imports\", \"disallowTypeAnnotations\": false }\n ]\n },\n \"ignorePatterns\": [\"node_modules/\", \"dist/\"]\n}\n`,\n};\n"],"mappings":";;AACA,MAAa,sBAAwD;CACnE,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmG3B,yBAAyB;;;;;CAKzB,0BAA0B;;;;;;;;;;;;;CAa1B,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C/B,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC5B,gBAAgB;;;;;;;;;;;;;;;;CAgBhB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;AAyBnB"}
@@ -5,7 +5,7 @@ import { CODEMODS } from "./codemods/index.mjs";
5
5
  import { unifiedDiff } from "./diff.mjs";
6
6
  import { UPGRADE_NOTES } from "./notes.mjs";
7
7
  import path from "node:path";
8
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
8
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
9
9
  import glob from "fast-glob";
10
10
 
11
11
  //#region ../../packages/core/src/upgrade/run-upgrade.ts
@@ -64,6 +64,15 @@ async function runUpgrade(options) {
64
64
  relativePath: (sourceFile) => relativeOf.get(sourceFile) ?? path.relative(root, sourceFile.getFilePath()).split(path.sep).join("/"),
65
65
  text: {
66
66
  read: (file) => textFiles.read(file),
67
+ list: () => readdirSync(root),
68
+ remove: (file, change) => {
69
+ textFiles.remove(file);
70
+ if (activeCodemod) applied.push({
71
+ codemod: activeCodemod.id,
72
+ file,
73
+ ...change
74
+ });
75
+ },
67
76
  write: (file, content, change) => {
68
77
  textFiles.write(file, content);
69
78
  if (activeCodemod) applied.push({
@@ -143,8 +152,15 @@ async function runUpgrade(options) {
143
152
  });
144
153
  for (const change of textFiles.changes()) changes.push(change);
145
154
  changes.sort((left, right) => left.file.localeCompare(right.file));
146
- if (!options.dryRun) for (const change of changes) writeFileSync(path.join(root, change.file), change.after);
147
- const packageJsonChanged = changes.some((change) => change.file === "package.json" && applied.some((item) => item.codemod === "warlock-versions" && item.file === "package.json"));
155
+ if (!options.dryRun) for (const change of changes) {
156
+ const target = path.join(root, change.file);
157
+ if (change.after === void 0) rmSync(target, { force: true });
158
+ else {
159
+ mkdirSync(path.dirname(target), { recursive: true });
160
+ writeFileSync(target, change.after);
161
+ }
162
+ }
163
+ const packageJsonChanged = changes.some((change) => change.file === "package.json");
148
164
  return {
149
165
  from,
150
166
  to,
@@ -154,7 +170,7 @@ async function runUpgrade(options) {
154
170
  manual,
155
171
  notes: UPGRADE_NOTES.filter((note) => compareVersions(note.version, from) > 0 && compareVersions(note.version, to) <= 0),
156
172
  changedFiles: changes.map((change) => change.file),
157
- diff: changes.map((change) => unifiedDiff(change.file, change.before, change.after)).join(""),
173
+ diff: changes.map((change) => unifiedDiff(change.file, change.before, change.after ?? "")).join(""),
158
174
  ...packageJsonChanged && { installHint: getInstallCommand(await detectPackageManager(root)) }
159
175
  };
160
176
  }
@@ -233,10 +249,13 @@ function createTextFiles(root) {
233
249
  write: (file, content) => {
234
250
  entry(file).current = content;
235
251
  },
236
- changes: () => [...files.entries()].filter(([, value]) => value.current !== void 0 && value.current !== value.before).map(([file, value]) => ({
252
+ remove: (file) => {
253
+ entry(file).current = void 0;
254
+ },
255
+ changes: () => [...files.entries()].filter(([, value]) => value.current !== value.before).map(([file, value]) => ({
237
256
  file,
238
257
  before: value.before ?? "",
239
- after: value.current ?? ""
258
+ after: value.current
240
259
  }))
241
260
  };
242
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run-upgrade.mjs","names":[],"sources":["../../../../../../../../packages/core/src/upgrade/run-upgrade.ts"],"sourcesContent":["import glob from \"fast-glob\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { detectPackageManager, getInstallCommand } from \"../updater/package-manager\";\nimport { CODEMODS } from \"./codemods\";\nimport { unifiedDiff } from \"./diff\";\nimport { loadTsMorph } from \"./load-ts-morph\";\nimport { UPGRADE_NOTES } from \"./notes\";\nimport type {\n AppliedChange,\n Codemod,\n CodemodContext,\n ManualItem,\n SourceEdit,\n SourceFile,\n TextFiles,\n TsMorphModule,\n UpgradeResult,\n} from \"./types\";\nimport { compareVersions, normalizeVersion, parseVersion } from \"./version\";\n\nexport type RunUpgradeOptions = {\n /** App root. Defaults to the current directory. */\n root?: string;\n /** Target version, e.g. `5.31` or `5.31.0`. */\n to: string;\n /** Version upgrading from; detected from the installed `@warlock.js/core` when omitted. */\n from?: string;\n /** Compute and report everything, write nothing. */\n dryRun?: boolean;\n /** Override the codemod list (tests). */\n codemods?: readonly Codemod[];\n /** Override how ts-morph is loaded (tests). */\n loadTsMorph?: (root: string) => Promise<TsMorphModule>;\n};\n\n/** Thrown for a request the command cannot act on (bad versions, nothing to detect). */\nexport class UpgradeUsageError extends Error {\n public override readonly name = \"UpgradeUsageError\";\n}\n\n/**\n * Apply the mechanical edits for every breaking change between two releases\n * and list what needs a decision. Writes nothing with `dryRun`.\n */\nexport async function runUpgrade(options: RunUpgradeOptions): Promise<UpgradeResult> {\n const root = path.resolve(options.root ?? process.cwd());\n const to = toVersion(options.to);\n const from = options.from ? toVersion(options.from) : detectInstalledVersion(root);\n\n if (compareVersions(from, to) >= 0) {\n throw new UpgradeUsageError(notNewerMessage(from, to, options.from !== undefined));\n }\n\n const selected = (options.codemods ?? CODEMODS).filter(\n (codemod) =>\n codemod.version === \"target\" ||\n (compareVersions(codemod.version, from) > 0 && compareVersions(codemod.version, to) <= 0),\n );\n\n const tsMorph = await (options.loadTsMorph ?? loadTsMorph)(root);\n const project = new tsMorph.Project({\n skipAddingFilesFromTsConfig: true,\n skipFileDependencyResolution: true,\n compilerOptions: { jsx: tsMorph.ts.JsxEmit.Preserve, allowJs: false },\n });\n\n const relativePaths = await glob(\"src/**/*.{ts,tsx}\", {\n cwd: root,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.warlock/**\", \"**/*.d.ts\"],\n dot: false,\n });\n relativePaths.sort();\n\n const originals = new Map<string, string>();\n const sourceFiles: SourceFile[] = [];\n for (const relative of relativePaths) {\n const content = readFileSync(path.join(root, relative), \"utf8\");\n originals.set(relative, content);\n sourceFiles.push(\n project.createSourceFile(path.join(root, relative), content, { overwrite: true }),\n );\n }\n\n const relativeOf = new Map<SourceFile, string>(\n sourceFiles.map((sourceFile, index) => [sourceFile, relativePaths[index] ?? \"\"]),\n );\n\n const applied: AppliedChange[] = [];\n const manual: ManualItem[] = [];\n const textFiles = createTextFiles(root);\n let activeCodemod: Codemod | undefined;\n\n const text: TextFiles = {\n read: (file) => textFiles.read(file),\n write: (file, content, change) => {\n textFiles.write(file, content);\n if (activeCodemod) {\n applied.push({ codemod: activeCodemod.id, file, ...change });\n }\n },\n };\n\n const context: CodemodContext = {\n tsMorph,\n sourceFiles,\n relativePath: (sourceFile) =>\n relativeOf.get(sourceFile) ??\n path.relative(root, sourceFile.getFilePath()).split(path.sep).join(\"/\"),\n text,\n targetVersion: to,\n };\n\n const summary: UpgradeResult[\"codemods\"] = [];\n\n for (const codemod of selected) {\n activeCodemod = codemod;\n const appliedBefore = applied.length;\n const output = codemod.run(context);\n\n for (const finding of output.manual) {\n manual.push({ ...finding, codemod: codemod.id, skill: codemod.skill });\n }\n\n const byFile = new Map<string, SourceEdit[]>();\n for (const edit of output.edits) {\n const list = byFile.get(edit.file) ?? [];\n list.push(edit);\n byFile.set(edit.file, list);\n }\n\n for (const [file, edits] of byFile) {\n const sourceFile = sourceFiles[relativePaths.indexOf(file)];\n if (!sourceFile) continue;\n\n let content = sourceFile.getFullText();\n let lowestStart = Number.POSITIVE_INFINITY;\n for (const edit of [...edits].sort((left, right) => right.start - left.start)) {\n // Overlapping edits (one inside another) would corrupt the file: keep the outer one.\n if (edit.end > lowestStart) {\n manual.push({\n codemod: codemod.id,\n skill: codemod.skill,\n file,\n line: edit.line,\n hint: `Not edited automatically (overlaps another change): ${edit.description}. Run the upgrade again after reviewing.`,\n });\n continue;\n }\n content = content.slice(0, edit.start) + edit.text + content.slice(edit.end);\n lowestStart = edit.start;\n applied.push({ codemod: codemod.id, file, line: edit.line, description: edit.description });\n }\n\n sourceFile.replaceWithText(content);\n }\n\n summary.push({\n id: codemod.id,\n version: codemod.version === \"target\" ? to : codemod.version,\n title: codemod.title,\n applied: applied.length - appliedBefore,\n manual: manual.filter((item) => item.codemod === codemod.id).length,\n });\n }\n activeCodemod = undefined;\n\n applied.sort(byFileAndLine);\n manual.sort(byFileAndLine);\n\n const changes: { file: string; before: string; after: string }[] = [];\n sourceFiles.forEach((sourceFile, index) => {\n const file = relativePaths[index];\n if (file === undefined) return;\n const before = originals.get(file) ?? \"\";\n const after = sourceFile.getFullText();\n if (before !== after) changes.push({ file, before, after });\n });\n for (const change of textFiles.changes()) changes.push(change);\n changes.sort((left, right) => left.file.localeCompare(right.file));\n\n if (!options.dryRun) {\n for (const change of changes) writeFileSync(path.join(root, change.file), change.after);\n }\n\n const packageJsonChanged = changes.some(\n (change) =>\n change.file === \"package.json\" &&\n applied.some((item) => item.codemod === \"warlock-versions\" && item.file === \"package.json\"),\n );\n\n return {\n from,\n to,\n dryRun: options.dryRun === true,\n codemods: summary,\n applied,\n manual,\n notes: UPGRADE_NOTES.filter(\n (note) => compareVersions(note.version, from) > 0 && compareVersions(note.version, to) <= 0,\n ),\n changedFiles: changes.map((change) => change.file),\n diff: changes.map((change) => unifiedDiff(change.file, change.before, change.after)).join(\"\"),\n ...(packageJsonChanged && {\n installHint: getInstallCommand(await detectPackageManager(root)),\n }),\n };\n}\n\n/**\n * Explain why `--to` is not newer than the starting version. The usual cause\n * is running the command after installing the new release: the starting\n * version is read from the installed `@warlock.js/core`, which is then already\n * the target, so the command needs `--from`.\n */\nfunction notNewerMessage(from: string, to: string, fromWasPassed: boolean): string {\n if (fromWasPassed) {\n return `--from ${from} is not older than --to ${to}. Pass the version this app is upgrading from.`;\n }\n\n const example = `warlock upgrade --from ${previousMinor(to)} --to ${to}`;\n\n if (compareVersions(from, to) === 0) {\n return `The installed @warlock.js/core is already ${from}, the --to version, so the version this app is upgrading from cannot be detected. Pass it with --from <previous version>, e.g. ${example}.`;\n }\n\n return `This app is already on ${from}; --to ${to} is not newer. If the detected version is wrong, pass --from <previous version>, e.g. ${example}.`;\n}\n\n/** `5.31.0` → `5.30`. A major's first release has no minor to step back to, so it gets a placeholder. */\nfunction previousMinor(version: string): string {\n const [major, minor] = parseVersion(version) ?? [0, 0, 0];\n\n return minor > 0 ? `${major}.${minor - 1}` : \"<previous version>\";\n}\n\nfunction toVersion(value: string): string {\n try {\n return normalizeVersion(value);\n } catch (error) {\n throw new UpgradeUsageError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/** The installed `@warlock.js/core`, or the version its package.json range names. */\nexport function detectInstalledVersion(root: string): string {\n const installed = path.join(root, \"node_modules\", \"@warlock.js\", \"core\", \"package.json\");\n if (existsSync(installed)) {\n const version = (JSON.parse(readFileSync(installed, \"utf8\")) as { version?: unknown }).version;\n if (typeof version === \"string\" && parseVersion(version))\n return normalizeVersion(stripRange(version));\n }\n\n const manifest = path.join(root, \"package.json\");\n if (existsSync(manifest)) {\n const pkg = JSON.parse(readFileSync(manifest, \"utf8\")) as {\n dependencies?: Record<string, unknown>;\n devDependencies?: Record<string, unknown>;\n };\n const spec =\n pkg.dependencies?.[\"@warlock.js/core\"] ?? pkg.devDependencies?.[\"@warlock.js/core\"];\n const parsed = typeof spec === \"string\" ? parseVersion(spec) : undefined;\n if (parsed) return parsed.join(\".\");\n }\n\n throw new UpgradeUsageError(\n \"Could not tell which Warlock version this app is on (no installed @warlock.js/core). Pass it with --from, e.g. --from 5.29.\",\n );\n}\n\nfunction stripRange(version: string): string {\n return (parseVersion(version) ?? [0, 0, 0]).join(\".\");\n}\n\nfunction byFileAndLine(\n left: { file: string; line: number },\n right: { file: string; line: number },\n) {\n return left.file.localeCompare(right.file) || left.line - right.line;\n}\n\n/** Non-TypeScript files a codemod reads and rewrites, buffered until the end. */\nfunction createTextFiles(root: string) {\n const files = new Map<string, { before: string | undefined; current: string | undefined }>();\n\n const entry = (file: string) => {\n let existing = files.get(file);\n if (!existing) {\n const absolute = path.join(root, file);\n const content = existsSync(absolute) ? readFileSync(absolute, \"utf8\") : undefined;\n existing = { before: content, current: content };\n files.set(file, existing);\n }\n return existing;\n };\n\n return {\n read: (file: string) => entry(file).current,\n write: (file: string, content: string) => {\n entry(file).current = content;\n },\n changes: () =>\n [...files.entries()]\n .filter(([, value]) => value.current !== undefined && value.current !== value.before)\n .map(([file, value]) => ({ file, before: value.before ?? \"\", after: value.current ?? \"\" })),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAa,oBAAb,cAAuC,MAAM;;;cACX;;AAClC;;;;;AAMA,eAAsB,WAAW,SAAoD;CACnF,MAAM,OAAO,KAAK,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CACvD,MAAM,KAAK,UAAU,QAAQ,EAAE;CAC/B,MAAM,OAAO,QAAQ,OAAO,UAAU,QAAQ,IAAI,IAAI,uBAAuB,IAAI;CAEjF,IAAI,gBAAgB,MAAM,EAAE,KAAK,GAC/B,MAAM,IAAI,kBAAkB,gBAAgB,MAAM,IAAI,QAAQ,SAAS,MAAS,CAAC;CAGnF,MAAM,YAAY,QAAQ,YAAY,SAAQ,CAAE,QAC7C,YACC,QAAQ,YAAY,YACnB,gBAAgB,QAAQ,SAAS,IAAI,IAAI,KAAK,gBAAg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AO,KAAK;EAAC;EAAG;EAAG;CAAC,EAAC,CAAE,KAAK,GAAG;AACtD;AAEA,SAAS,cACP,MACA,OACA;CACA,OAAO,KAAK,KAAK,cAAc,MAAM,IAAI,KAAK,KAAK,OAAO,MAAM;AAClE;;AAGA,SAAS,gBAAgB,MAAc;CACrC,MAAM,wBAAQ,IAAI,IAAyE;CAE3F,MAAM,SAAS,SAAiB;EAC9B,IAAI,WAAW,MAAM,IAAI,IAAI;EAC7B,IAAI,CAAC,UAAU;GACb,MAAM,WAAW,KAAK,KAAK,MAAM,IAAI;GACrC,MAAM,UAAU,WAAW,QAAQ,IAAI,aAAa,UAAU,MAAM,IAAI;GACxE,WAAW;IAAE,QAAQ;IAAS,SAAS;GAAQ;GAC/C,MAAM,IAAI,MAAM,QAAQ;EAC1B;EACA,OAAO;CACT;CAEA,OAAO;EACL,OAAO,SAAiB,MAAM,IAAI,CAAC,CAAC;EACpC,QAAQ,MAAc,YAAoB;GACxC,MAAM,IAAI,CAAC,CAAC,UAAU;EACxB;EACA,eACE,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,CACjB,QAAQ,GAAG,WAAW,MAAM,YAAY,UAAa,MAAM,YAAY,MAAM,MAAM,CAAC,CACpF,KAAK,CAAC,MAAM,YAAY;GAAE;GAAM,QAAQ,MAAM,UAAU;GAAI,OAAO,MAAM,WAAW;EAAG,EAAE;CAChG;AACF"}
1
+ {"version":3,"file":"run-upgrade.mjs","names":[],"sources":["../../../../../../../../packages/core/src/upgrade/run-upgrade.ts"],"sourcesContent":["import glob from \"fast-glob\";\nimport { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { detectPackageManager, getInstallCommand } from \"../updater/package-manager\";\nimport { CODEMODS } from \"./codemods\";\nimport { unifiedDiff } from \"./diff\";\nimport { loadTsMorph } from \"./load-ts-morph\";\nimport { UPGRADE_NOTES } from \"./notes\";\nimport type {\n AppliedChange,\n Codemod,\n CodemodContext,\n ManualItem,\n SourceEdit,\n SourceFile,\n TextFiles,\n TsMorphModule,\n UpgradeResult,\n} from \"./types\";\nimport { compareVersions, normalizeVersion, parseVersion } from \"./version\";\n\nexport type RunUpgradeOptions = {\n /** App root. Defaults to the current directory. */\n root?: string;\n /** Target version, e.g. `5.31` or `5.31.0`. */\n to: string;\n /** Version upgrading from; detected from the installed `@warlock.js/core` when omitted. */\n from?: string;\n /** Compute and report everything, write nothing. */\n dryRun?: boolean;\n /** Override the codemod list (tests). */\n codemods?: readonly Codemod[];\n /** Override how ts-morph is loaded (tests). */\n loadTsMorph?: (root: string) => Promise<TsMorphModule>;\n};\n\n/** Thrown for a request the command cannot act on (bad versions, nothing to detect). */\nexport class UpgradeUsageError extends Error {\n public override readonly name = \"UpgradeUsageError\";\n}\n\n/**\n * Apply the mechanical edits for every breaking change between two releases\n * and list what needs a decision. Writes nothing with `dryRun`.\n */\nexport async function runUpgrade(options: RunUpgradeOptions): Promise<UpgradeResult> {\n const root = path.resolve(options.root ?? process.cwd());\n const to = toVersion(options.to);\n const from = options.from ? toVersion(options.from) : detectInstalledVersion(root);\n\n if (compareVersions(from, to) >= 0) {\n throw new UpgradeUsageError(notNewerMessage(from, to, options.from !== undefined));\n }\n\n const selected = (options.codemods ?? CODEMODS).filter(\n (codemod) =>\n codemod.version === \"target\" ||\n (compareVersions(codemod.version, from) > 0 && compareVersions(codemod.version, to) <= 0),\n );\n\n const tsMorph = await (options.loadTsMorph ?? loadTsMorph)(root);\n const project = new tsMorph.Project({\n skipAddingFilesFromTsConfig: true,\n skipFileDependencyResolution: true,\n compilerOptions: { jsx: tsMorph.ts.JsxEmit.Preserve, allowJs: false },\n });\n\n const relativePaths = await glob(\"src/**/*.{ts,tsx}\", {\n cwd: root,\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.warlock/**\", \"**/*.d.ts\"],\n dot: false,\n });\n relativePaths.sort();\n\n const originals = new Map<string, string>();\n const sourceFiles: SourceFile[] = [];\n for (const relative of relativePaths) {\n const content = readFileSync(path.join(root, relative), \"utf8\");\n originals.set(relative, content);\n sourceFiles.push(\n project.createSourceFile(path.join(root, relative), content, { overwrite: true }),\n );\n }\n\n const relativeOf = new Map<SourceFile, string>(\n sourceFiles.map((sourceFile, index) => [sourceFile, relativePaths[index] ?? \"\"]),\n );\n\n const applied: AppliedChange[] = [];\n const manual: ManualItem[] = [];\n const textFiles = createTextFiles(root);\n let activeCodemod: Codemod | undefined;\n\n const text: TextFiles = {\n read: (file) => textFiles.read(file),\n list: () => readdirSync(root),\n remove: (file, change) => {\n textFiles.remove(file);\n if (activeCodemod) applied.push({ codemod: activeCodemod.id, file, ...change });\n },\n write: (file, content, change) => {\n textFiles.write(file, content);\n if (activeCodemod) {\n applied.push({ codemod: activeCodemod.id, file, ...change });\n }\n },\n };\n\n const context: CodemodContext = {\n tsMorph,\n sourceFiles,\n relativePath: (sourceFile) =>\n relativeOf.get(sourceFile) ??\n path.relative(root, sourceFile.getFilePath()).split(path.sep).join(\"/\"),\n text,\n targetVersion: to,\n };\n\n const summary: UpgradeResult[\"codemods\"] = [];\n\n for (const codemod of selected) {\n activeCodemod = codemod;\n const appliedBefore = applied.length;\n const output = codemod.run(context);\n\n for (const finding of output.manual) {\n manual.push({ ...finding, codemod: codemod.id, skill: codemod.skill });\n }\n\n const byFile = new Map<string, SourceEdit[]>();\n for (const edit of output.edits) {\n const list = byFile.get(edit.file) ?? [];\n list.push(edit);\n byFile.set(edit.file, list);\n }\n\n for (const [file, edits] of byFile) {\n const sourceFile = sourceFiles[relativePaths.indexOf(file)];\n if (!sourceFile) continue;\n\n let content = sourceFile.getFullText();\n let lowestStart = Number.POSITIVE_INFINITY;\n for (const edit of [...edits].sort((left, right) => right.start - left.start)) {\n // Overlapping edits (one inside another) would corrupt the file: keep the outer one.\n if (edit.end > lowestStart) {\n manual.push({\n codemod: codemod.id,\n skill: codemod.skill,\n file,\n line: edit.line,\n hint: `Not edited automatically (overlaps another change): ${edit.description}. Run the upgrade again after reviewing.`,\n });\n continue;\n }\n content = content.slice(0, edit.start) + edit.text + content.slice(edit.end);\n lowestStart = edit.start;\n applied.push({ codemod: codemod.id, file, line: edit.line, description: edit.description });\n }\n\n sourceFile.replaceWithText(content);\n }\n\n summary.push({\n id: codemod.id,\n version: codemod.version === \"target\" ? to : codemod.version,\n title: codemod.title,\n applied: applied.length - appliedBefore,\n manual: manual.filter((item) => item.codemod === codemod.id).length,\n });\n }\n activeCodemod = undefined;\n\n applied.sort(byFileAndLine);\n manual.sort(byFileAndLine);\n\n const changes: { file: string; before: string; after: string | undefined }[] = [];\n sourceFiles.forEach((sourceFile, index) => {\n const file = relativePaths[index];\n if (file === undefined) return;\n const before = originals.get(file) ?? \"\";\n const after = sourceFile.getFullText();\n if (before !== after) changes.push({ file, before, after });\n });\n for (const change of textFiles.changes()) changes.push(change);\n changes.sort((left, right) => left.file.localeCompare(right.file));\n\n if (!options.dryRun) {\n for (const change of changes) {\n const target = path.join(root, change.file);\n if (change.after === undefined) rmSync(target, { force: true });\n else {\n mkdirSync(path.dirname(target), { recursive: true });\n writeFileSync(target, change.after);\n }\n }\n }\n\n const packageJsonChanged = changes.some((change) => change.file === \"package.json\");\n\n return {\n from,\n to,\n dryRun: options.dryRun === true,\n codemods: summary,\n applied,\n manual,\n notes: UPGRADE_NOTES.filter(\n (note) => compareVersions(note.version, from) > 0 && compareVersions(note.version, to) <= 0,\n ),\n changedFiles: changes.map((change) => change.file),\n diff: changes\n .map((change) => unifiedDiff(change.file, change.before, change.after ?? \"\"))\n .join(\"\"),\n ...(packageJsonChanged && {\n installHint: getInstallCommand(await detectPackageManager(root)),\n }),\n };\n}\n\n/**\n * Explain why `--to` is not newer than the starting version. The usual cause\n * is running the command after installing the new release: the starting\n * version is read from the installed `@warlock.js/core`, which is then already\n * the target, so the command needs `--from`.\n */\nfunction notNewerMessage(from: string, to: string, fromWasPassed: boolean): string {\n if (fromWasPassed) {\n return `--from ${from} is not older than --to ${to}. Pass the version this app is upgrading from.`;\n }\n\n const example = `warlock upgrade --from ${previousMinor(to)} --to ${to}`;\n\n if (compareVersions(from, to) === 0) {\n return `The installed @warlock.js/core is already ${from}, the --to version, so the version this app is upgrading from cannot be detected. Pass it with --from <previous version>, e.g. ${example}.`;\n }\n\n return `This app is already on ${from}; --to ${to} is not newer. If the detected version is wrong, pass --from <previous version>, e.g. ${example}.`;\n}\n\n/** `5.31.0` → `5.30`. A major's first release has no minor to step back to, so it gets a placeholder. */\nfunction previousMinor(version: string): string {\n const [major, minor] = parseVersion(version) ?? [0, 0, 0];\n\n return minor > 0 ? `${major}.${minor - 1}` : \"<previous version>\";\n}\n\nfunction toVersion(value: string): string {\n try {\n return normalizeVersion(value);\n } catch (error) {\n throw new UpgradeUsageError(error instanceof Error ? error.message : String(error));\n }\n}\n\n/** The installed `@warlock.js/core`, or the version its package.json range names. */\nexport function detectInstalledVersion(root: string): string {\n const installed = path.join(root, \"node_modules\", \"@warlock.js\", \"core\", \"package.json\");\n if (existsSync(installed)) {\n const version = (JSON.parse(readFileSync(installed, \"utf8\")) as { version?: unknown }).version;\n if (typeof version === \"string\" && parseVersion(version))\n return normalizeVersion(stripRange(version));\n }\n\n const manifest = path.join(root, \"package.json\");\n if (existsSync(manifest)) {\n const pkg = JSON.parse(readFileSync(manifest, \"utf8\")) as {\n dependencies?: Record<string, unknown>;\n devDependencies?: Record<string, unknown>;\n };\n const spec =\n pkg.dependencies?.[\"@warlock.js/core\"] ?? pkg.devDependencies?.[\"@warlock.js/core\"];\n const parsed = typeof spec === \"string\" ? parseVersion(spec) : undefined;\n if (parsed) return parsed.join(\".\");\n }\n\n throw new UpgradeUsageError(\n \"Could not tell which Warlock version this app is on (no installed @warlock.js/core). Pass it with --from, e.g. --from 5.29.\",\n );\n}\n\nfunction stripRange(version: string): string {\n return (parseVersion(version) ?? [0, 0, 0]).join(\".\");\n}\n\nfunction byFileAndLine(\n left: { file: string; line: number },\n right: { file: string; line: number },\n) {\n return left.file.localeCompare(right.file) || left.line - right.line;\n}\n\n/** Non-TypeScript files a codemod reads and rewrites, buffered until the end. */\nfunction createTextFiles(root: string) {\n const files = new Map<string, { before: string | undefined; current: string | undefined }>();\n\n const entry = (file: string) => {\n let existing = files.get(file);\n if (!existing) {\n const absolute = path.join(root, file);\n const content = existsSync(absolute) ? readFileSync(absolute, \"utf8\") : undefined;\n existing = { before: content, current: content };\n files.set(file, existing);\n }\n return existing;\n };\n\n return {\n read: (file: string) => entry(file).current,\n write: (file: string, content: string) => {\n entry(file).current = content;\n },\n remove: (file: string) => {\n entry(file).current = undefined;\n },\n changes: () =>\n [...files.entries()]\n .filter(([, value]) => value.current !== value.before)\n .map(([file, value]) => ({ file, before: value.before ?? \"\", after: value.current })),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAa,oBAAb,cAAuC,MAAM;;;cACX;;AAClC;;;;;AAMA,eAAsB,WAAW,SAAoD;CACnF,MAAM,OAAO,KAAK,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CACvD,MAAM,KAAK,UAAU,QAAQ,EAAE;CAC/B,MAAM,OAAO,QAAQ,OAAO,UAAU,QAAQ,IAAI,IAAI,uBAAuB,IAAI;CAEjF,IAAI,gBAAgB,MAAM,EAAE,KAAK,GAC/B,MAAM,IAAI,kBAAkB,gBAAgB,MAAM,IAAI,QAAQ,SAAS,MAAS,CAAC;CAGnF,MAAM,YAAY,QAAQ,YAAY,SAAQ,CAAE,QAC7C,YACC,QAAQ,YAAY,YACnB,gBAAgB,QAAQ,SAAS,IAAI,IAAI,KAAK,gBAAgB,QAAQ,SAAS,EAAE,KAAK,CAC3F;CAEA,MAAM,UAAU,OAAO,QAAQ,eAAe,YAAW,CAAE,IAAI;CAC/D,MAAM,UAAU,IAAI,QAAQ,QAAQ;EAClC,6BAA6B;EAC7B,8BAA8B;EAC9B,iBAAiB;GAAE,KAAK,QAAQ,GAAG,QAAQ;GAAU,SAAS;EAAM;CACtE,CAAC;CAED,MAAM,gBAAgB,M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aAAa,OAAO,KAAK;EAAC;EAAG;EAAG;CAAC,EAAC,CAAE,KAAK,GAAG;AACtD;AAEA,SAAS,cACP,MACA,OACA;CACA,OAAO,KAAK,KAAK,cAAc,MAAM,IAAI,KAAK,KAAK,OAAO,MAAM;AAClE;;AAGA,SAAS,gBAAgB,MAAc;CACrC,MAAM,wBAAQ,IAAI,IAAyE;CAE3F,MAAM,SAAS,SAAiB;EAC9B,IAAI,WAAW,MAAM,IAAI,IAAI;EAC7B,IAAI,CAAC,UAAU;GACb,MAAM,WAAW,KAAK,KAAK,MAAM,IAAI;GACrC,MAAM,UAAU,WAAW,QAAQ,IAAI,aAAa,UAAU,MAAM,IAAI;GACxE,WAAW;IAAE,QAAQ;IAAS,SAAS;GAAQ;GAC/C,MAAM,IAAI,MAAM,QAAQ;EAC1B;EACA,OAAO;CACT;CAEA,OAAO;EACL,OAAO,SAAiB,MAAM,IAAI,CAAC,CAAC;EACpC,QAAQ,MAAc,YAAoB;GACxC,MAAM,IAAI,CAAC,CAAC,UAAU;EACxB;EACA,SAAS,SAAiB;GACxB,MAAM,IAAI,CAAC,CAAC,UAAU;EACxB;EACA,eACE,CAAC,GAAG,MAAM,QAAQ,CAAC,CAAC,CACjB,QAAQ,GAAG,WAAW,MAAM,YAAY,MAAM,MAAM,CAAC,CACrD,KAAK,CAAC,MAAM,YAAY;GAAE;GAAM,QAAQ,MAAM,UAAU;GAAI,OAAO,MAAM;EAAQ,EAAE;CAC1F;AACF"}
@@ -169,7 +169,8 @@ export type WarlockConfig = {
169
169
  };
170
170
  /**
171
171
  * Built-in checker switches, custom checker array, or false to disable.
172
- * Installed/configured ESLint and Oxlint both run by default.
172
+ * TypeScript and installed/configured Oxlint run by default.
173
+ * ESLint requires `{ eslint: true }` and is deprecated (removed in 5.34.0).
173
174
  */
174
175
  healthCheckers?: FileHealthCheckerContract[] | BuiltInHealthCheckerOptions | false;
175
176
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/warlock-config/types.ts"],"mappings":";;;;;;;;;;;YAcY;;;;EAIV;;;;IAIE;;;;IAIA;;;;IAIA;;;;;;;;;;;;;EAcF,QAAQ,KAAK;;;;;;IAMX;;;;;;;;;;;IAWA;;;;;;IAMA;;;;;;;IAOA;;;;;;;;;;;;;;;;;IAiBA;;;;;;;;;;;;;;;;IAgBA;;;;;;IAMA;;;;;;IAMA;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BF,aAAa;;;;EAKb;IACE,WAAW;;;;;EAMb;;;;IAIE;;;;;;MAME;;;;;;MAMA;;;;;;IAMF,iBAAiB,8BAA8B;;;;;IAK/C;;;;;;;;;IASA;;;;;;;;;IASA;;;;;;;;;;IAUA;;;;;;;;;;;;IAYA;;;;;;;;;;IAUA;;;;;;;;;IASA;;MAIM;;MAEA;;MAEA;;;;;;EAOR;;;;;;;;;;;;;;;;;;IAkBE,aAAa,MAAM;;;;;;;;EASrB;;;;;;;;;IASE;;;;;;;;IASA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/warlock-config/types.ts"],"mappings":";;;;;;;;;;;YAcY;;;;EAIV;;;;IAIE;;;;IAIA;;;;IAIA;;;;;;;;;;;;;EAcF,QAAQ,KAAK;;;;;;IAMX;;;;;;;;;;;IAWA;;;;;;IAMA;;;;;;;IAOA;;;;;;;;;;;;;;;;;IAiBA;;;;;;;;;;;;;;;;IAgBA;;;;;;IAMA;;;;;;IAMA;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BF,aAAa;;;;EAKb;IACE,WAAW;;;;;EAMb;;;;IAIE;;;;;;MAME;;;;;;MAMA;;;;;;;IAOF,iBAAiB,8BAA8B;;;;;IAK/C;;;;;;;;;IASA;;;;;;;;;IASA;;;;;;;;;;IAUA;;;;;;;;;;;;IAYA;;;;;;;;;;IAUA;;;;;;;;;IASA;;MAIM;;MAEA;;MAEA;;;;;;EAOR;;;;;;;;;;;;;;;;;;IAkBE,aAAa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