1tube 0.1.6 → 0.1.8
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/deno.json +7 -0
- package/package.json +1 -1
- package/src/discovery.ts +8 -2
- package/src/gateway/cors.ts +1 -1
- package/src/gateway/logging.ts +1 -1
- package/src/gateway/rate-limit.ts +2 -2
- package/src/health.ts +1 -1
- package/src/manifest.ts +3 -1
- package/src/server.ts +8 -3
- package/src/version.ts +5 -2
package/deno.json
CHANGED
package/package.json
CHANGED
package/src/discovery.ts
CHANGED
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
* registry's async-context binding.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// node: specifiers so this module loads cleanly from node_modules in any
|
|
13
|
+
// host Deno project (no shared import-map entry required).
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { pathToFileURL } from "node:url";
|
|
13
16
|
import type { FunctionRegistry } from "./registry.ts";
|
|
14
17
|
import { loadManifest } from "./manifest.ts";
|
|
15
18
|
|
|
@@ -110,7 +113,10 @@ export async function discoverAndLoad(
|
|
|
110
113
|
|
|
111
114
|
const loadOne = async (name: string): Promise<void> => {
|
|
112
115
|
const indexPath = join(resolvedDir, name, "index.ts");
|
|
113
|
-
|
|
116
|
+
// pathToFileURL is the node:url equivalent of std/path's toFileUrl;
|
|
117
|
+
// both produce a `file://` URL whose searchParams we mutate below for
|
|
118
|
+
// HMR cache-busting.
|
|
119
|
+
const moduleUrl = pathToFileURL(indexPath);
|
|
114
120
|
if (options?.cacheBust) {
|
|
115
121
|
moduleUrl.searchParams.set("v", options.cacheBust);
|
|
116
122
|
}
|
package/src/gateway/cors.ts
CHANGED
package/src/gateway/logging.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* grow it unboundedly with synthetic high-cardinality function names.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { Context, Next } from "hono";
|
|
12
|
+
import type { Context, Next } from "npm:hono@4";
|
|
13
13
|
import { logError, logInfo } from "../log-buffer.ts";
|
|
14
14
|
|
|
15
15
|
export interface FunctionMetrics {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* mint fresh buckets.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { Context, Next } from "hono";
|
|
12
|
-
import { getConnInfo } from "hono/deno";
|
|
11
|
+
import type { Context, Next } from "npm:hono@4";
|
|
12
|
+
import { getConnInfo } from "npm:hono@4/deno";
|
|
13
13
|
import type { FunctionRegistry } from "../registry.ts";
|
|
14
14
|
|
|
15
15
|
interface Bucket {
|
package/src/health.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* strings leak into access logs, browser history, and proxy buffers).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { Context } from "hono";
|
|
11
|
+
import type { Context } from "npm:hono@4";
|
|
12
12
|
import type { FunctionRegistry } from "./registry.ts";
|
|
13
13
|
import type { FunctionSupervisor } from "./supervisor.ts";
|
|
14
14
|
import { getCollectedMetrics, getPrometheusMetrics } from "./gateway/logging.ts";
|
package/src/manifest.ts
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
* out of rotation.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// node:path so this loads from node_modules in any host Deno project
|
|
26
|
+
// without depending on a shared import-map entry.
|
|
27
|
+
import { join } from "node:path";
|
|
26
28
|
|
|
27
29
|
export interface ManifestPermissions {
|
|
28
30
|
/** Hostnames the function may reach (e.g. "api.example.com"). [] = none. */
|
package/src/server.ts
CHANGED
|
@@ -11,9 +11,14 @@
|
|
|
11
11
|
* deno run --allow-all src/server.ts --dev --hmr # local development
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// All third-party imports below use `npm:` / `node:` / `jsr:` specifiers
|
|
15
|
+
// directly (not bare aliases from our deno.json) so this entry point loads
|
|
16
|
+
// cleanly when launched from a host project's node_modules — bare
|
|
17
|
+
// specifiers would otherwise require the host's deno.json to mirror our
|
|
18
|
+
// import map. Same convention applies to every src/ file.
|
|
19
|
+
import { Hono } from "npm:hono@4";
|
|
20
|
+
import { bodyLimit } from "npm:hono@4/body-limit";
|
|
21
|
+
import { relative, sep as SEPARATOR } from "node:path";
|
|
17
22
|
import { currentRequestStorage, FunctionRegistry } from "./registry.ts";
|
|
18
23
|
import { discoverAndLoad, type DiscoveryProgress } from "./discovery.ts";
|
|
19
24
|
import { validateRequest } from "./gateway/auth.ts";
|
package/src/version.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
// node: specifiers (instead of "jsr:@std/path") so this loads from node_modules
|
|
2
|
+
// in any host Deno project without needing a shared import-map entry.
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
2
5
|
|
|
3
6
|
function readVersion(): string {
|
|
4
7
|
try {
|
|
5
|
-
const dir =
|
|
8
|
+
const dir = fileURLToPath(new URL(".", import.meta.url));
|
|
6
9
|
const raw = Deno.readTextFileSync(join(dir, "..", "package.json"));
|
|
7
10
|
return JSON.parse(raw).version ?? "unknown";
|
|
8
11
|
} catch {
|