@zhin.js/console 1.0.50 → 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.
- package/CHANGELOG.md +19 -0
- package/README.md +22 -0
- package/browser.tsconfig.json +19 -0
- package/client/src/components/PageHeader.tsx +26 -0
- package/client/src/components/ui/accordion.tsx +2 -1
- package/client/src/components/ui/badge.tsx +1 -3
- package/client/src/components/ui/scroll-area.tsx +5 -2
- package/client/src/components/ui/select.tsx +7 -3
- package/client/src/components/ui/separator.tsx +5 -2
- package/client/src/components/ui/tabs.tsx +4 -2
- package/client/src/layouts/dashboard.tsx +223 -121
- package/client/src/main.tsx +34 -34
- package/client/src/pages/bot-detail/MessageBody.tsx +110 -0
- package/client/src/pages/bot-detail/date-utils.ts +8 -0
- package/client/src/pages/bot-detail/index.tsx +798 -0
- package/client/src/pages/bot-detail/types.ts +92 -0
- package/client/src/pages/bot-detail/useBotConsole.tsx +600 -0
- package/client/src/pages/bots.tsx +111 -73
- package/client/src/pages/database/constants.ts +16 -0
- package/client/src/pages/database/database-page.tsx +170 -0
- package/client/src/pages/database/document-collection-view.tsx +155 -0
- package/client/src/pages/database/index.tsx +1 -0
- package/client/src/pages/database/json-field.tsx +11 -0
- package/client/src/pages/database/kv-bucket-view.tsx +169 -0
- package/client/src/pages/database/related-table-view.tsx +221 -0
- package/client/src/pages/env.tsx +38 -28
- package/client/src/pages/files/code-editor.tsx +85 -0
- package/client/src/pages/files/editor-constants.ts +9 -0
- package/client/src/pages/files/file-editor.tsx +133 -0
- package/client/src/pages/files/file-icons.tsx +25 -0
- package/client/src/pages/files/files-page.tsx +92 -0
- package/client/src/pages/files/hljs-global.d.ts +10 -0
- package/client/src/pages/files/index.tsx +1 -0
- package/client/src/pages/files/language.ts +18 -0
- package/client/src/pages/files/tree-node.tsx +69 -0
- package/client/src/pages/files/use-hljs-theme.ts +23 -0
- package/client/src/pages/logs.tsx +77 -22
- package/client/src/style.css +144 -0
- package/client/src/utils/parseComposerContent.ts +57 -0
- package/client/tailwind.config.js +1 -0
- package/client/tsconfig.json +3 -1
- package/dist/assets/index-COKXlFo2.js +124 -0
- package/dist/assets/style-kkLO-vsa.css +3 -0
- package/dist/client.js +4262 -1
- package/dist/index.html +2 -2
- package/dist/radix-ui.js +1261 -1262
- package/dist/react-dom-client.js +2243 -2240
- package/dist/react-dom.js +15 -15
- package/dist/style.css +1 -3
- package/lib/index.js +1010 -81
- package/lib/transform.js +16 -2
- package/lib/websocket.js +845 -28
- package/node.tsconfig.json +18 -0
- package/package.json +15 -16
- package/src/bin.ts +24 -0
- package/src/bot-db-models.ts +74 -0
- package/src/bot-hub.ts +240 -0
- package/src/bot-persistence.ts +270 -0
- package/src/build.ts +90 -0
- package/src/dev.ts +107 -0
- package/src/index.ts +337 -0
- package/src/transform.ts +199 -0
- package/src/websocket.ts +1369 -0
- package/client/src/pages/database.tsx +0 -708
- package/client/src/pages/files.tsx +0 -470
- package/client/src/pages/login-assist.tsx +0 -225
- package/dist/index.js +0 -124
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))
|
|
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);
|