1tube 0.1.6 → 0.1.7
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/package.json +1 -1
- package/src/discovery.ts +8 -2
- package/src/manifest.ts +3 -1
- package/src/server.ts +4 -1
- package/src/version.ts +5 -2
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/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
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
import { Hono } from "hono";
|
|
15
15
|
import { bodyLimit } from "hono/body-limit";
|
|
16
|
-
|
|
16
|
+
// Use node: specifiers (not "@std/path") so this entry point also works when
|
|
17
|
+
// 1tube is launched from a host project's node_modules — bare specifiers
|
|
18
|
+
// would otherwise require the host's deno.json to mirror our import map.
|
|
19
|
+
import { relative, sep as SEPARATOR } from "node:path";
|
|
17
20
|
import { currentRequestStorage, FunctionRegistry } from "./registry.ts";
|
|
18
21
|
import { discoverAndLoad, type DiscoveryProgress } from "./discovery.ts";
|
|
19
22
|
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 {
|