1tube 0.1.53 → 0.2.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 (90) hide show
  1. package/.env.example +27 -27
  2. package/LICENSE +21 -21
  3. package/README.md +6 -6
  4. package/dist/edge.js +10 -3
  5. package/drizzle/20260610161429_init_logs/migration.sql +29 -29
  6. package/drizzle/20260610161429_init_logs/snapshot.json +305 -305
  7. package/drizzle/20260610161430_logs_fts/migration.sql +25 -25
  8. package/drizzle/20260610161430_logs_fts/snapshot.json +305 -305
  9. package/eslint-plugin.js +275 -275
  10. package/package.json +80 -70
  11. package/scripts/npm-cli.js +151 -150
  12. package/src/backends/bun/dep-graph.ts +310 -0
  13. package/src/backends/bun/function-host.ts +1190 -0
  14. package/src/backends/bun/hot-reloader.ts +385 -0
  15. package/src/backends/bun/shared-runtime.ts +176 -0
  16. package/src/backends/env-hot-reloader.ts +171 -170
  17. package/src/backends/vercel/bundle-profile.ts +162 -159
  18. package/src/backends/vercel/capture-config.ts +212 -122
  19. package/src/backends/vercel/wrapper.ts +361 -332
  20. package/src/backends/workerd/backend.ts +2148 -2112
  21. package/src/backends/workerd/bundle-profile.ts +246 -246
  22. package/src/backends/workerd/capnp.ts +413 -413
  23. package/src/backends/workerd/hot-reloader.ts +347 -347
  24. package/src/backends/workerd/prebuilt.ts +206 -206
  25. package/src/backends/workerd/proc-stats.ts +159 -147
  26. package/src/backends/workerd/process.ts +584 -570
  27. package/src/backends/workerd/runtime-overrides.ts +767 -756
  28. package/src/backends/workerd/shared-runtime.ts +147 -104
  29. package/src/backends/workerd/watchdog.ts +282 -282
  30. package/src/boot-progress.ts +234 -230
  31. package/src/bundler/core.ts +968 -867
  32. package/src/bundler/profile.ts +77 -77
  33. package/src/cli/build.ts +755 -792
  34. package/src/cli/deno-config.ts +74 -83
  35. package/src/cli/envelope.ts +283 -283
  36. package/src/cli/package.ts +729 -719
  37. package/src/cli/vercel-build.ts +808 -692
  38. package/src/cli.ts +12 -12
  39. package/src/compat/deno-shim.ts +540 -0
  40. package/src/compat/deps.ts +359 -0
  41. package/src/compat/environment.ts +65 -0
  42. package/src/compat/esbuild-plugin.ts +109 -0
  43. package/src/compat/globals.ts +158 -0
  44. package/src/compat/import-map.ts +183 -0
  45. package/src/compat/plugin.ts +416 -0
  46. package/src/compat/remote.ts +145 -0
  47. package/src/compat/shared-deps.ts +178 -0
  48. package/src/compat/specifiers.ts +103 -0
  49. package/src/discovery.ts +216 -217
  50. package/src/edge-caller.ts +141 -141
  51. package/src/edge.ts +985 -976
  52. package/src/env-file.ts +266 -254
  53. package/src/firmware-content-hash.ts +193 -192
  54. package/src/fs-watch.ts +78 -0
  55. package/src/gateway/auth.ts +291 -291
  56. package/src/gateway/body-watchdog.ts +153 -153
  57. package/src/gateway/cors.ts +249 -245
  58. package/src/gateway/logging.ts +396 -396
  59. package/src/gateway/rate-limit.ts +189 -189
  60. package/src/gateway/route-prefix.ts +83 -83
  61. package/src/health.ts +156 -156
  62. package/src/launch.ts +369 -685
  63. package/src/log-buffer.ts +159 -158
  64. package/src/logs/api.ts +137 -137
  65. package/src/logs/console-marker.ts +54 -54
  66. package/src/logs/db.ts +85 -85
  67. package/src/logs/id.ts +33 -33
  68. package/src/logs/query.ts +398 -398
  69. package/src/logs/schema.ts +90 -90
  70. package/src/logs/writer.ts +390 -390
  71. package/src/manifest.ts +225 -226
  72. package/src/registry.ts +404 -367
  73. package/src/server.ts +2650 -2756
  74. package/src/stdio.ts +37 -0
  75. package/src/supervisor.ts +184 -184
  76. package/src/types/bun-module-graph.d.ts +26 -0
  77. package/src/version.ts +15 -16
  78. package/src/warmup-client.ts +159 -159
  79. package/tsconfig.json +17 -0
  80. package/deno.json +0 -38
  81. package/deno.lock +0 -572
  82. package/src/backends/deno/dep-graph.ts +0 -404
  83. package/src/backends/deno/hot-reloader.ts +0 -471
  84. package/src/backends/deno/shared-runtime.ts +0 -218
  85. package/src/backends/deno/source-rewriter.ts +0 -637
  86. package/src/backends/deno/worker-entry-colocated.ts +0 -406
  87. package/src/backends/deno/worker-entry.ts +0 -375
  88. package/src/backends/deno/worker-host.ts +0 -2166
  89. package/src/cli/dep-pin.ts +0 -126
  90. package/src/env-scope.ts +0 -124
package/.env.example CHANGED
@@ -1,27 +1,27 @@
1
- # Supabase connection (required)
2
- SUPABASE_URL=http://127.0.0.1:54321
3
- SUPABASE_SERVICE_ROLE_KEY=
4
-
5
- # JWT secret -- must match the Supabase JWT secret for RLS compatibility
6
- JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
7
-
8
- # ScioBot / priprava backend
9
- SCIOBOT_URL=http://localhost:44298
10
- SCIOBOT_KEY=
11
-
12
- # AI providers
13
- GOOGLE_API_KEY=
14
- OPENAI_API_KEY=
15
- ELEVENLABS_API_KEY=
16
- TAVILY_API_KEY=
17
-
18
- # Gateway config
19
- PORT=3100
20
- FUNCTIONS_PATH=../sciobot-next/supabase/functions
21
- # INTERNAL_KEY=00000000-0000-0000-0000-000000000000 # optional, random GUID is fine
22
-
23
- # Optional: Sentry error tracking
24
- # SENTRY_DSN=
25
-
26
- # Optional: log function invocations to Supabase table
27
- # LOG_TO_DB=true
1
+ # Supabase connection (required)
2
+ SUPABASE_URL=http://127.0.0.1:54321
3
+ SUPABASE_SERVICE_ROLE_KEY=
4
+
5
+ # JWT secret -- must match the Supabase JWT secret for RLS compatibility
6
+ JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
7
+
8
+ # ScioBot / priprava backend
9
+ SCIOBOT_URL=http://localhost:44298
10
+ SCIOBOT_KEY=
11
+
12
+ # AI providers
13
+ GOOGLE_API_KEY=
14
+ OPENAI_API_KEY=
15
+ ELEVENLABS_API_KEY=
16
+ TAVILY_API_KEY=
17
+
18
+ # Gateway config
19
+ PORT=3100
20
+ FUNCTIONS_PATH=../sciobot-next/supabase/functions
21
+ # INTERNAL_KEY=00000000-0000-0000-0000-000000000000 # optional, random GUID is fine
22
+
23
+ # Optional: Sentry error tracking
24
+ # SENTRY_DSN=
25
+
26
+ # Optional: log function invocations to Supabase table
27
+ # LOG_TO_DB=true
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Matěj Štágl
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matěj Štágl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- ![NPM Version](https://img.shields.io/npm/v/1tube)
2
- ![NuGet Version](https://img.shields.io/nuget/v/OneTube?v=2&icon=nuget)
3
-
4
- # 1tube
5
-
6
- 🕯☽ Black magic. ☾🕯
1
+ ![NPM Version](https://img.shields.io/npm/v/1tube)
2
+ ![NuGet Version](https://img.shields.io/nuget/v/OneTube?v=2&icon=nuget)
3
+
4
+ # 1tube
5
+
6
+ 🕯☽ Black magic. ☾🕯
package/dist/edge.js CHANGED
@@ -152,9 +152,16 @@ export function normalizeRateLimit(rl) {
152
152
  export function getStandaloneServe() {
153
153
  const runtime = globalThis;
154
154
  const standaloneServe = runtime.Deno?.serve;
155
- return typeof standaloneServe === "function"
156
- ? standaloneServe.bind(runtime.Deno)
157
- : null;
155
+ if (typeof standaloneServe === "function")
156
+ return standaloneServe.bind(runtime.Deno);
157
+ // `bun supabase/functions/<name>/index.ts` outside the gateway.
158
+ const bunServe = runtime.Bun?.serve;
159
+ if (typeof bunServe === "function") {
160
+ return (handler) => {
161
+ bunServe.call(runtime.Bun, { fetch: handler });
162
+ };
163
+ }
164
+ return null;
158
165
  }
159
166
  export function normalizeRoutePath(path) {
160
167
  const trimmed = path.trim();
@@ -1,30 +1,30 @@
1
- CREATE TABLE `invocations` (
2
- `id` text PRIMARY KEY,
3
- `ts_ms` integer NOT NULL,
4
- `function_name` text NOT NULL,
5
- `method` text NOT NULL,
6
- `path` text NOT NULL,
7
- `status` integer NOT NULL,
8
- `duration_ms` integer NOT NULL,
9
- `user_id` text,
10
- `backend` text NOT NULL,
11
- `error_kind` text,
12
- `error_message` text,
13
- `error_stack` text
14
- );
15
- --> statement-breakpoint
16
- CREATE TABLE `logs` (
17
- `id` integer PRIMARY KEY AUTOINCREMENT,
18
- `invocation_id` text,
19
- `ts_ms` integer NOT NULL,
20
- `level` text NOT NULL,
21
- `function_name` text,
22
- `source` text DEFAULT 'function' NOT NULL,
23
- `message` text NOT NULL
24
- );
25
- --> statement-breakpoint
26
- CREATE INDEX `idx_invocations_ts` ON `invocations` (`ts_ms`);--> statement-breakpoint
27
- CREATE INDEX `idx_invocations_fn_ts` ON `invocations` (`function_name`,`ts_ms`);--> statement-breakpoint
28
- CREATE INDEX `idx_invocations_status_ts` ON `invocations` (`status`,`ts_ms`);--> statement-breakpoint
29
- CREATE INDEX `idx_logs_invocation` ON `logs` (`invocation_id`);--> statement-breakpoint
1
+ CREATE TABLE `invocations` (
2
+ `id` text PRIMARY KEY,
3
+ `ts_ms` integer NOT NULL,
4
+ `function_name` text NOT NULL,
5
+ `method` text NOT NULL,
6
+ `path` text NOT NULL,
7
+ `status` integer NOT NULL,
8
+ `duration_ms` integer NOT NULL,
9
+ `user_id` text,
10
+ `backend` text NOT NULL,
11
+ `error_kind` text,
12
+ `error_message` text,
13
+ `error_stack` text
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE TABLE `logs` (
17
+ `id` integer PRIMARY KEY AUTOINCREMENT,
18
+ `invocation_id` text,
19
+ `ts_ms` integer NOT NULL,
20
+ `level` text NOT NULL,
21
+ `function_name` text,
22
+ `source` text DEFAULT 'function' NOT NULL,
23
+ `message` text NOT NULL
24
+ );
25
+ --> statement-breakpoint
26
+ CREATE INDEX `idx_invocations_ts` ON `invocations` (`ts_ms`);--> statement-breakpoint
27
+ CREATE INDEX `idx_invocations_fn_ts` ON `invocations` (`function_name`,`ts_ms`);--> statement-breakpoint
28
+ CREATE INDEX `idx_invocations_status_ts` ON `invocations` (`status`,`ts_ms`);--> statement-breakpoint
29
+ CREATE INDEX `idx_logs_invocation` ON `logs` (`invocation_id`);--> statement-breakpoint
30
30
  CREATE INDEX `idx_logs_ts` ON `logs` (`ts_ms`);