Unverified Commit 8e88a18a authored by Hong Minhee's avatar Hong Minhee
Browse files

Let npm package include x/hono

parent f20756a8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@
    "./vocab": "./vocab/mod.ts",
    "./webfinger": "./webfinger/mod.ts",
    "./x/denokv": "./x/denokv.ts",
    "./x/fresh": "./x/fresh.ts"
    "./x/fresh": "./x/fresh.ts",
    "./x/hono": "./x/hono.ts"
  },
  "imports": {
    "@cfworker/json-schema": "npm:@cfworker/json-schema@^1.12.8",
@@ -23,7 +24,9 @@
    "@fedify/fedify/runtime": "./runtime/mod.ts",
    "@fedify/fedify/vocab": "./vocab/mod.ts",
    "@fedify/fedify/webfinger": "./webfinger/mod.ts",
    "@fedify/fedify/x/denokv": "./x/denokv.ts",
    "@fedify/fedify/x/fresh": "./x/fresh.ts",
    "@fedify/fedify/x/hono": "./x/hono.ts",
    "@hongminhee/aitertools": "jsr:@hongminhee/aitertools@^0.6.0",
    "@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.4.4",
    "@phensley/language-tag": "npm:@phensley/language-tag@^1.8.0",
+11 −5
Original line number Diff line number Diff line
@@ -3,12 +3,20 @@ import { copy } from "@std/fs";
import { join } from "@std/path";

await emptyDir("./npm");
await emptyDir("./npm/esm/codegen");

const denoJson = join(import.meta.dirname!, "deno.json");
const metadata = JSON.parse(await Deno.readTextFile(denoJson));

const excludedExports = ["./x/denokv", "./x/fresh"];

const entryPoints = Object.entries(metadata.exports as Record<string, string>)
  .map(([name, path]) => ({ name, path }))
  .filter(({ name }) => !excludedExports.includes(name));

const testExports = [];
for (const exportName in metadata.exports) {
  const match = exportName.match(/^\.\/([^/]+)/);
for (const { name } of entryPoints) {
  const match = name.match(/^\.\/([^/]+)/);
  if (match && match[1] != "x") testExports.push(match[1]);
}

@@ -35,9 +43,7 @@ await build({
    },
  },
  outDir: "./npm",
  entryPoints: Object.entries(metadata.exports as Record<string, string>)
    .map(([name, path]) => ({ name, path }))
    .filter(({ name }) => !name.startsWith("./x/")),
  entryPoints,
  importMap: denoJson,
  scriptModule: false,
  shims: {