diff --git a/deno.jsonc b/deno.jsonc index 6a21bc8..ab5b645 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -2,11 +2,11 @@ "name": "@nfnitloop/deno-embedder", "version": "1.4.7", "exports": { - ".": "./mod.ts", - "./plugins/plugins": "./plugins/plugins.ts", - "./plugins/esbuild": "./plugins/esbuild.ts", - "./helpers/oak": "./helpers/oak.ts", - "./helpers/hono": "./helpers/hono.ts", + ".": "./src/mod.ts", + "./plugins/plugins": "./src/plugins/plugins.ts", + "./plugins/esbuild": "./src/plugins/esbuild.ts", + "./helpers/oak": "./src/helpers/oak.ts", + "./helpers/hono": "./src/helpers/hono.ts", // Allows easily running the example server: "./examples/with-embedder": "./examples/with-embedder/server.ts", @@ -18,20 +18,12 @@ "./examples/hono": "./examples/hono/server.ts", // Needs to be exposed so that embedded files can import w/ JSR syntax. You shouldn't use this directly. - "./embed.ts": "./embed.ts" + "./embed.ts": "./src/embed.ts" }, "publish": { "include": [ "README.md", - - "mod.ts", - "embed.ts", - - // TODO: Move stuff into a src/ dir now that we have JSR exports. (<3) - "_src/**/*.ts", - "deps/**/*.ts", - "plugins/**/*.ts", - "helpers/**/*.ts", + "src/**/*.ts", "examples/with-embedder/**/*.ts", "examples/hono/**/*.ts" ] @@ -41,7 +33,7 @@ "test": "deno task check && deno test --doc -A && deno task examples:test && deno task lints", "check": "deno task check:main && deno task check:without-embedder && deno task examples:build && deno task examples:check && deno task check:publish", - "check:main": "deno check mod.ts embed.ts helpers/oak.ts helpers/hono.ts plugins/esbuild.ts", + "check:main": "deno check src/mod.ts src/embed.ts src/helpers/oak.ts src/helpers/hono.ts src/plugins/esbuild.ts", "check:publish": "deno publish --dry-run --allow-dirty", "check:without-embedder": "cd examples/without-embedder; deno task check", @@ -79,7 +71,7 @@ // Has example code that references theoretical modules: "README.md", // Pseudocode doc block example: - "helpers/hono.ts" + "src/helpers/hono.ts" ] } } \ No newline at end of file diff --git a/deno.lock b/deno.lock index a2c4bc2..04c7b6a 100644 --- a/deno.lock +++ b/deno.lock @@ -8,6 +8,7 @@ "jsr:@david/dax": "jsr:@david/dax@0.41.0", "jsr:@david/dax@0.41": "jsr:@david/dax@0.41.0", "jsr:@david/which@^0.4.1": "jsr:@david/which@0.4.1", + "jsr:@hono/hono@^4.0": "jsr:@hono/hono@4.4.8", "jsr:@hono/hono@^4.0.0": "jsr:@hono/hono@4.4.8", "jsr:@luca/esbuild-deno-loader@^0.10.3": "jsr:@luca/esbuild-deno-loader@0.10.3", "jsr:@oak/commons@0.10": "jsr:@oak/commons@0.10.1", diff --git a/examples/hono/deno.lock b/examples/hono/deno.lock index b902f4d..c8b45c4 100644 --- a/examples/hono/deno.lock +++ b/examples/hono/deno.lock @@ -6,6 +6,7 @@ "jsr:@cliffy/flags@1.0.0-rc.4": "jsr:@cliffy/flags@1.0.0-rc.4", "jsr:@cliffy/table@1.0.0-rc.4": "jsr:@cliffy/table@1.0.0-rc.4", "jsr:@cross/runtime@1.0.0": "jsr:@cross/runtime@1.0.0", + "jsr:@hono/hono@^4.0": "jsr:@hono/hono@4.4.8", "jsr:@hono/hono@^4.0.0": "jsr:@hono/hono@4.4.8", "jsr:@luca/esbuild-deno-loader@^0.10.3": "jsr:@luca/esbuild-deno-loader@0.10.3", "jsr:@std/assert@^0.196.0": "jsr:@std/assert@0.196.0", diff --git a/examples/hono/embed/code/_app.js.ts b/examples/hono/embed/code/_app.js.ts index 75f3ed4..8fe1432 100644 --- a/examples/hono/embed/code/_app.js.ts +++ b/examples/hono/embed/code/_app.js.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../embed.ts" +import {F} from "../../../../src/embed.ts" export default F({ size: 32685, compression: "gzip", diff --git a/examples/hono/embed/code/dir.ts b/examples/hono/embed/code/dir.ts index 9581874..a6d9944 100644 --- a/examples/hono/embed/code/dir.ts +++ b/examples/hono/embed/code/dir.ts @@ -1,4 +1,4 @@ -import {E} from "../../../../embed.ts" +import {E} from "../../../../src/embed.ts" export default E({ "app.js": () => import("./_app.js.ts"), diff --git a/examples/hono/embed/static/_Smiley.svg.ts b/examples/hono/embed/static/_Smiley.svg.ts index 2000965..fe96005 100644 --- a/examples/hono/embed/static/_Smiley.svg.ts +++ b/examples/hono/embed/static/_Smiley.svg.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../embed.ts" +import {F} from "../../../../src/embed.ts" export default F({ size: 1120, compression: "gzip", diff --git a/examples/hono/embed/static/_index.html.ts b/examples/hono/embed/static/_index.html.ts index e297cfe..59a8046 100644 --- a/examples/hono/embed/static/_index.html.ts +++ b/examples/hono/embed/static/_index.html.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../embed.ts" +import {F} from "../../../../src/embed.ts" export default F({ size: 245, encoded: ` diff --git a/examples/hono/embed/static/dir.ts b/examples/hono/embed/static/dir.ts index 87e0ee7..5381a6b 100644 --- a/examples/hono/embed/static/dir.ts +++ b/examples/hono/embed/static/dir.ts @@ -1,4 +1,4 @@ -import {E} from "../../../../embed.ts" +import {E} from "../../../../src/embed.ts" export default E({ "Smiley.svg": () => import("./_Smiley.svg.ts"), diff --git a/examples/hono/embedder.ts b/examples/hono/embedder.ts index 7f4f6fc..040355d 100644 --- a/examples/hono/embedder.ts +++ b/examples/hono/embedder.ts @@ -2,8 +2,8 @@ // lives in the same repository as this example. You should import these from // `jsr:@nfnitloop/deno-embedder@version` // -import * as embedder from "../../mod.ts" -import { ESBuild } from "../../plugins/esbuild.ts" +import * as embedder from "../../src/mod.ts" +import { ESBuild } from "../../src/plugins/esbuild.ts" export const options = { diff --git a/examples/hono/server.ts b/examples/hono/server.ts index 83cae97..d631cb9 100644 --- a/examples/hono/server.ts +++ b/examples/hono/server.ts @@ -1,5 +1,5 @@ -import { Hono } from "../../deps/hono.ts"; -import { serveDir, serveStatic } from "../../helpers/hono.ts"; +import { Hono } from "../../src/deps/hono.ts"; +import { serveDir, serveStatic } from "../../src/helpers/hono.ts"; import staticFiles from "./embed/static/dir.ts"; import bundledJs from "./embed/code/dir.ts"; diff --git a/examples/with-embedder/embed/code/_app.js.ts b/examples/with-embedder/embed/code/_app.js.ts index 75f3ed4..8fe1432 100644 --- a/examples/with-embedder/embed/code/_app.js.ts +++ b/examples/with-embedder/embed/code/_app.js.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../embed.ts" +import {F} from "../../../../src/embed.ts" export default F({ size: 32685, compression: "gzip", diff --git a/examples/with-embedder/embed/code/dir.ts b/examples/with-embedder/embed/code/dir.ts index 9581874..a6d9944 100644 --- a/examples/with-embedder/embed/code/dir.ts +++ b/examples/with-embedder/embed/code/dir.ts @@ -1,4 +1,4 @@ -import {E} from "../../../../embed.ts" +import {E} from "../../../../src/embed.ts" export default E({ "app.js": () => import("./_app.js.ts"), diff --git a/examples/with-embedder/embed/static/_Smiley.svg.ts b/examples/with-embedder/embed/static/_Smiley.svg.ts index 2000965..fe96005 100644 --- a/examples/with-embedder/embed/static/_Smiley.svg.ts +++ b/examples/with-embedder/embed/static/_Smiley.svg.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../embed.ts" +import {F} from "../../../../src/embed.ts" export default F({ size: 1120, compression: "gzip", diff --git a/examples/with-embedder/embed/static/_index.html.ts b/examples/with-embedder/embed/static/_index.html.ts index e297cfe..59a8046 100644 --- a/examples/with-embedder/embed/static/_index.html.ts +++ b/examples/with-embedder/embed/static/_index.html.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../embed.ts" +import {F} from "../../../../src/embed.ts" export default F({ size: 245, encoded: ` diff --git a/examples/with-embedder/embed/static/dir.ts b/examples/with-embedder/embed/static/dir.ts index 87e0ee7..5381a6b 100644 --- a/examples/with-embedder/embed/static/dir.ts +++ b/examples/with-embedder/embed/static/dir.ts @@ -1,4 +1,4 @@ -import {E} from "../../../../embed.ts" +import {E} from "../../../../src/embed.ts" export default E({ "Smiley.svg": () => import("./_Smiley.svg.ts"), diff --git a/examples/with-embedder/embedder.ts b/examples/with-embedder/embedder.ts index 7f4f6fc..040355d 100644 --- a/examples/with-embedder/embedder.ts +++ b/examples/with-embedder/embedder.ts @@ -2,8 +2,8 @@ // lives in the same repository as this example. You should import these from // `jsr:@nfnitloop/deno-embedder@version` // -import * as embedder from "../../mod.ts" -import { ESBuild } from "../../plugins/esbuild.ts" +import * as embedder from "../../src/mod.ts" +import { ESBuild } from "../../src/plugins/esbuild.ts" export const options = { diff --git a/examples/with-embedder/server.ts b/examples/with-embedder/server.ts index f5a8283..d0b77bd 100644 --- a/examples/with-embedder/server.ts +++ b/examples/with-embedder/server.ts @@ -1,4 +1,4 @@ -import { serveDir, oak } from "../../helpers/oak.ts" +import { serveDir, oak } from "../../src/helpers/oak.ts" import staticFiles from "./embed/static/dir.ts" import bundledJs from "./embed/code/dir.ts" import sarcasm from "./browserCode/sarcasm.ts"; diff --git a/examples/without-embedder/server.ts b/examples/without-embedder/server.ts index 44a8fd4..b47dfe3 100644 --- a/examples/without-embedder/server.ts +++ b/examples/without-embedder/server.ts @@ -1,4 +1,4 @@ -import { Application } from "../../deps/oak.ts"; +import { Application } from "../../src/deps/oak.ts"; const app = new Application(); diff --git a/deps/cliffy/command.ts b/src/deps/cliffy/command.ts similarity index 100% rename from deps/cliffy/command.ts rename to src/deps/cliffy/command.ts diff --git a/deps/hono.ts b/src/deps/hono.ts similarity index 100% rename from deps/hono.ts rename to src/deps/hono.ts diff --git a/deps/oak.ts b/src/deps/oak.ts similarity index 100% rename from deps/oak.ts rename to src/deps/oak.ts diff --git a/deps/std/async.ts b/src/deps/std/async.ts similarity index 100% rename from deps/std/async.ts rename to src/deps/std/async.ts diff --git a/deps/std/encoding/base64.ts b/src/deps/std/encoding/base64.ts similarity index 100% rename from deps/std/encoding/base64.ts rename to src/deps/std/encoding/base64.ts diff --git a/deps/std/fs.ts b/src/deps/std/fs.ts similarity index 100% rename from deps/std/fs.ts rename to src/deps/std/fs.ts diff --git a/deps/std/media_types.ts b/src/deps/std/media_types.ts similarity index 100% rename from deps/std/media_types.ts rename to src/deps/std/media_types.ts diff --git a/deps/std/path.ts b/src/deps/std/path.ts similarity index 100% rename from deps/std/path.ts rename to src/deps/std/path.ts diff --git a/embed.ts b/src/embed.ts similarity index 100% rename from embed.ts rename to src/embed.ts diff --git a/helpers/hono.ts b/src/helpers/hono.ts similarity index 100% rename from helpers/hono.ts rename to src/helpers/hono.ts diff --git a/helpers/oak.ts b/src/helpers/oak.ts similarity index 100% rename from helpers/oak.ts rename to src/helpers/oak.ts diff --git a/_src/jsr_fix.ts b/src/jsr_fix.ts similarity index 100% rename from _src/jsr_fix.ts rename to src/jsr_fix.ts diff --git a/_src/jsr_fix_test.ts b/src/jsr_fix_test.ts similarity index 100% rename from _src/jsr_fix_test.ts rename to src/jsr_fix_test.ts diff --git a/mod.ts b/src/mod.ts similarity index 99% rename from mod.ts rename to src/mod.ts index ba168e1..7d3f631 100644 --- a/mod.ts +++ b/src/mod.ts @@ -22,8 +22,8 @@ import { Command } from "./deps/cliffy/command.ts"; import * as embed from "./embed.ts" import type { FileEmitter, Plugin } from "./plugins/plugins.ts" -import { recursiveReadDir } from "./_src/util.ts"; -import { toJsr } from "./_src/jsr_fix.ts"; +import { recursiveReadDir } from "./util.ts"; +import { toJsr } from "./jsr_fix.ts"; const VERSION = "1.0.0" const DIR_FILENAME = "dir.ts" diff --git a/plugins/esbuild.ts b/src/plugins/esbuild.ts similarity index 100% rename from plugins/esbuild.ts rename to src/plugins/esbuild.ts diff --git a/plugins/plugins.ts b/src/plugins/plugins.ts similarity index 100% rename from plugins/plugins.ts rename to src/plugins/plugins.ts diff --git a/_src/util.ts b/src/util.ts similarity index 92% rename from _src/util.ts rename to src/util.ts index 8c07871..e997484 100644 --- a/_src/util.ts +++ b/src/util.ts @@ -3,7 +3,7 @@ * @module */ -import { join as pathJoin } from "../deps/std/path.ts"; +import { join as pathJoin } from "./deps/std/path.ts"; /** Read all files from a directory tree, recursively. */ export async function * recursiveReadDir(dir: string): AsyncGenerator { diff --git a/tests/jsr_paths/sample/embedder.ts b/tests/jsr_paths/sample/embedder.ts index c60312a..f8252ac 100644 --- a/tests/jsr_paths/sample/embedder.ts +++ b/tests/jsr_paths/sample/embedder.ts @@ -1,4 +1,4 @@ -import * as embedder from "../../../mod.ts" +import * as embedder from "../../../src/mod.ts" export const options = { importMeta: import.meta, diff --git a/tests/jsr_paths/sample/src/embedded/_foo_bar.ts.ts b/tests/jsr_paths/sample/src/embedded/_foo_bar.ts.ts index 1aaff0c..6ccb570 100644 --- a/tests/jsr_paths/sample/src/embedded/_foo_bar.ts.ts +++ b/tests/jsr_paths/sample/src/embedded/_foo_bar.ts.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../../embed.ts" +import {F} from "../../../../../src/embed.ts" export default F({ size: 68, encoded: ` diff --git a/tests/jsr_paths/sample/src/embedded/_foobar_.d_ts_.ts.ts b/tests/jsr_paths/sample/src/embedded/_foobar_.d_ts_.ts.ts index 1aaff0c..6ccb570 100644 --- a/tests/jsr_paths/sample/src/embedded/_foobar_.d_ts_.ts.ts +++ b/tests/jsr_paths/sample/src/embedded/_foobar_.d_ts_.ts.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../../embed.ts" +import {F} from "../../../../../src/embed.ts" export default F({ size: 68, encoded: ` diff --git a/tests/jsr_paths/sample/src/embedded/dir.ts b/tests/jsr_paths/sample/src/embedded/dir.ts index ca808b0..1f01ef5 100644 --- a/tests/jsr_paths/sample/src/embedded/dir.ts +++ b/tests/jsr_paths/sample/src/embedded/dir.ts @@ -1,4 +1,4 @@ -import {E} from "../../../../../embed.ts" +import {E} from "../../../../../src/embed.ts" export default E({ "foo bar.ts": () => import("./_foo_bar.ts.ts"), diff --git a/tests/jsr_paths/sample/src/embedded/foo_bar/_baz.txt.ts b/tests/jsr_paths/sample/src/embedded/foo_bar/_baz.txt.ts index ddd6ac4..d453ad0 100644 --- a/tests/jsr_paths/sample/src/embedded/foo_bar/_baz.txt.ts +++ b/tests/jsr_paths/sample/src/embedded/foo_bar/_baz.txt.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../../../embed.ts" +import {F} from "../../../../../../src/embed.ts" export default F({ size: 9, encoded: ` diff --git a/tests/jsr_paths/sample/src/embedded/foo_bar/_baz_etc.md.ts b/tests/jsr_paths/sample/src/embedded/foo_bar/_baz_etc.md.ts index 389267b..38f8cc1 100644 --- a/tests/jsr_paths/sample/src/embedded/foo_bar/_baz_etc.md.ts +++ b/tests/jsr_paths/sample/src/embedded/foo_bar/_baz_etc.md.ts @@ -1,4 +1,4 @@ -import {F} from "../../../../../../embed.ts" +import {F} from "../../../../../../src/embed.ts" export default F({ size: 19, encoded: `