@typesol/cli 0.45.0 → 0.46.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 (66) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +64 -17
  3. package/SECURITY.md +9 -7
  4. package/dist/bin.d.ts +2 -0
  5. package/dist/bin.js +9 -0
  6. package/dist/cli.js +33 -15
  7. package/dist/compiler/analyze.js +57 -6
  8. package/dist/compiler/diagnostics.d.ts +4 -3
  9. package/dist/compiler/diagnostics.js +10 -6
  10. package/dist/compiler/emit/base.d.ts +1 -1
  11. package/dist/compiler/emit/calls.js +18 -5
  12. package/dist/compiler/emit/cpi-core.d.ts +3 -1
  13. package/dist/compiler/emit/cpi-core.js +8 -4
  14. package/dist/compiler/emit/expressions.d.ts +14 -0
  15. package/dist/compiler/emit/expressions.js +52 -4
  16. package/dist/compiler/emit/shared.d.ts +8 -1
  17. package/dist/compiler/emit/shared.js +8 -1
  18. package/dist/compiler/emit/statements.d.ts +8 -3
  19. package/dist/compiler/emit/statements.js +68 -3
  20. package/dist/compiler/emit/storage.js +5 -1
  21. package/dist/compiler/hints.d.ts +7 -0
  22. package/dist/compiler/hints.js +58 -9
  23. package/dist/compiler/index.d.ts +5 -0
  24. package/dist/compiler/index.js +10 -1
  25. package/dist/compiler/model.js +3 -2
  26. package/dist/compiler/toolchain.d.ts +50 -2
  27. package/dist/compiler/toolchain.js +96 -11
  28. package/dist/node-version.d.ts +4 -0
  29. package/dist/node-version.js +12 -0
  30. package/dist/tools/doctor.d.ts +41 -0
  31. package/dist/tools/doctor.js +96 -14
  32. package/dist/workspace.d.ts +9 -2
  33. package/dist/workspace.js +13 -3
  34. package/docker/deps/0.46.0.lock.json +1206 -0
  35. package/docs/ai.md +2 -1
  36. package/docs/architecture.md +7 -3
  37. package/docs/audit.md +6 -6
  38. package/docs/case-study-phoenix.md +1 -1
  39. package/docs/case-study-raydium-amm.md +1 -1
  40. package/docs/case-study-spl-stake-pool.md +1 -1
  41. package/docs/cli.md +42 -4
  42. package/docs/errors.md +22 -8
  43. package/docs/glossary.md +210 -0
  44. package/docs/language-accounts.md +499 -0
  45. package/docs/language-basics.md +389 -0
  46. package/docs/language-builtins.md +411 -0
  47. package/docs/language-chain.md +198 -0
  48. package/docs/language-cpi.md +470 -0
  49. package/docs/language-errors-events.md +184 -0
  50. package/docs/language-native.md +493 -0
  51. package/docs/language-pdas.md +198 -0
  52. package/docs/language-statements.md +620 -0
  53. package/docs/language-types.md +601 -0
  54. package/docs/language.md +190 -467
  55. package/docs/mainnet.md +18 -3
  56. package/docs/migrate-from-anchor.md +7 -6
  57. package/docs/security-model.md +3 -3
  58. package/docs/stability.md +3 -1
  59. package/docs/test-your-program.md +52 -15
  60. package/docs/troubleshooting.md +222 -100
  61. package/lib/typesol.d.ts +67 -22
  62. package/llms-full.txt +4915 -634
  63. package/llms.txt +12 -1
  64. package/package.json +2 -2
  65. package/releases/0.45.0.json +732 -0
  66. package/ts-plugin/index.js +16 -5
@@ -111,14 +111,25 @@ function init({ typescript: ts }) {
111
111
  try {
112
112
  hint = compiler.typescriptHint(d);
113
113
  } catch {
114
- return d;
114
+ hint = undefined;
115
115
  }
116
- if (!hint) return d;
116
+ // The compiler's message in place of TypeScript's where TypeScript's advice points the wrong way, with a hint
117
+ // or without one (`window`, `document`), as the CLI prints it (older packages have no typescriptMessage:
118
+ // TypeScript's message stays).
119
+ let own;
120
+ try {
121
+ own = compiler.typescriptMessage && compiler.typescriptMessage(d);
122
+ } catch {
123
+ own = undefined;
124
+ }
125
+ if (!hint && !own) return d;
126
+ const base = own || d.messageText;
127
+ if (!hint) return { ...d, messageText: base };
117
128
  const text = `hint: ${hint}`;
118
129
  const messageText =
119
- typeof d.messageText === "string"
120
- ? `${d.messageText}\n${text}`
121
- : { ...d.messageText, next: [...(d.messageText.next || []), { messageText: text, category: d.category, code: d.code, next: undefined }] };
130
+ typeof base === "string"
131
+ ? `${base}\n${text}`
132
+ : { ...base, next: [...(base.next || []), { messageText: text, category: d.category, code: d.code, next: undefined }] };
122
133
  return { ...d, messageText };
123
134
  });
124
135
  }