@zhin.js/console 1.0.51 → 1.0.52

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 (65) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +22 -0
  3. package/browser.tsconfig.json +19 -0
  4. package/client/src/components/PageHeader.tsx +26 -0
  5. package/client/src/components/ui/accordion.tsx +2 -1
  6. package/client/src/components/ui/badge.tsx +1 -3
  7. package/client/src/components/ui/scroll-area.tsx +5 -2
  8. package/client/src/components/ui/select.tsx +7 -3
  9. package/client/src/components/ui/separator.tsx +5 -2
  10. package/client/src/components/ui/tabs.tsx +4 -2
  11. package/client/src/layouts/dashboard.tsx +223 -121
  12. package/client/src/main.tsx +34 -34
  13. package/client/src/pages/bot-detail/MessageBody.tsx +110 -0
  14. package/client/src/pages/bot-detail/date-utils.ts +8 -0
  15. package/client/src/pages/bot-detail/index.tsx +798 -0
  16. package/client/src/pages/bot-detail/types.ts +92 -0
  17. package/client/src/pages/bot-detail/useBotConsole.tsx +600 -0
  18. package/client/src/pages/bots.tsx +111 -73
  19. package/client/src/pages/database/constants.ts +16 -0
  20. package/client/src/pages/database/database-page.tsx +170 -0
  21. package/client/src/pages/database/document-collection-view.tsx +155 -0
  22. package/client/src/pages/database/index.tsx +1 -0
  23. package/client/src/pages/database/json-field.tsx +11 -0
  24. package/client/src/pages/database/kv-bucket-view.tsx +169 -0
  25. package/client/src/pages/database/related-table-view.tsx +221 -0
  26. package/client/src/pages/env.tsx +38 -28
  27. package/client/src/pages/files/code-editor.tsx +85 -0
  28. package/client/src/pages/files/editor-constants.ts +9 -0
  29. package/client/src/pages/files/file-editor.tsx +133 -0
  30. package/client/src/pages/files/file-icons.tsx +25 -0
  31. package/client/src/pages/files/files-page.tsx +92 -0
  32. package/client/src/pages/files/hljs-global.d.ts +10 -0
  33. package/client/src/pages/files/index.tsx +1 -0
  34. package/client/src/pages/files/language.ts +18 -0
  35. package/client/src/pages/files/tree-node.tsx +69 -0
  36. package/client/src/pages/files/use-hljs-theme.ts +23 -0
  37. package/client/src/pages/logs.tsx +77 -22
  38. package/client/src/style.css +144 -0
  39. package/client/src/utils/parseComposerContent.ts +57 -0
  40. package/client/tailwind.config.js +1 -0
  41. package/client/tsconfig.json +3 -1
  42. package/dist/assets/index-COKXlFo2.js +124 -0
  43. package/dist/assets/style-kkLO-vsa.css +3 -0
  44. package/dist/client.js +482 -464
  45. package/dist/index.html +2 -2
  46. package/dist/style.css +1 -1
  47. package/lib/index.js +1010 -81
  48. package/lib/transform.js +16 -2
  49. package/lib/websocket.js +845 -28
  50. package/node.tsconfig.json +18 -0
  51. package/package.json +13 -15
  52. package/src/bin.ts +24 -0
  53. package/src/bot-db-models.ts +74 -0
  54. package/src/bot-hub.ts +240 -0
  55. package/src/bot-persistence.ts +270 -0
  56. package/src/build.ts +90 -0
  57. package/src/dev.ts +107 -0
  58. package/src/index.ts +337 -0
  59. package/src/transform.ts +199 -0
  60. package/src/websocket.ts +1369 -0
  61. package/client/src/pages/database.tsx +0 -708
  62. package/client/src/pages/files.tsx +0 -470
  63. package/client/src/pages/login-assist.tsx +0 -225
  64. package/dist/assets/index-DS4RbHWX.js +0 -124
  65. package/dist/assets/style-DS-m6WEr.css +0 -3
package/lib/transform.js CHANGED
@@ -19,9 +19,24 @@ function hasExtension(specifier) {
19
19
  const base = path.basename(specifier);
20
20
  return base.includes(".") && !base.startsWith(".");
21
21
  }
22
+ function resolveJsSpecifierToSource(specifier, fromFile) {
23
+ if (!isRelative(specifier) || !specifier.endsWith(".js")) return specifier;
24
+ const dir = path.dirname(fromFile);
25
+ const jsPath = path.resolve(dir, specifier);
26
+ if (fs.existsSync(jsPath)) return specifier;
27
+ const base = specifier.slice(0, -3);
28
+ for (const ext of [".tsx", ".ts", ".jsx"]) {
29
+ if (fs.existsSync(path.resolve(dir, base + ext))) {
30
+ return base + ext;
31
+ }
32
+ }
33
+ return specifier;
34
+ }
22
35
  function resolveRelativeImport(specifier, fromFile) {
23
36
  if (!isRelative(specifier)) return specifier;
24
- if (hasExtension(specifier)) return specifier;
37
+ if (hasExtension(specifier)) {
38
+ return resolveJsSpecifierToSource(specifier, fromFile);
39
+ }
25
40
  const dir = path.dirname(fromFile);
26
41
  const target = path.resolve(dir, specifier);
27
42
  for (const ext of RESOLVE_EXTS) {
@@ -43,7 +58,6 @@ function rewriteImports(code, fromFile) {
43
58
  code = code.replace(IMPORT_RE, (match, fromSpecifier, dynamicSpecifier) => {
44
59
  const specifier = fromSpecifier || dynamicSpecifier;
45
60
  if (!specifier || !isRelative(specifier)) return match;
46
- if (hasExtension(specifier)) return match;
47
61
  const resolved = resolveRelativeImport(specifier, fromFile);
48
62
  if (resolved === specifier) return match;
49
63
  return match.replace(specifier, resolved);