From 20fede338ac6b7dd050fa9dc4cccd2d83bb90171 Mon Sep 17 00:00:00 2001 From: Miguel Romero Karam Date: Wed, 26 Jun 2024 14:44:56 +0200 Subject: [PATCH] refactor(deps): move all `npm:`, `jsr:`, `https://deno.land` and `https://esm.sh` imports to `deps/` --- deno.jsonc | 52 +++++++++----------- lib/apis/create-api/mod.test.ts | 2 +- lib/apis/jsonplaceholder.test.ts | 2 +- lib/cli/dev/cli.ts | 2 +- lib/cli/netzo.ts | 2 +- lib/cli/src/args.ts | 2 +- lib/cli/src/subcommands/deploy.ts | 4 +- lib/cli/src/utils/entrypoint.ts | 2 +- lib/cli/src/utils/info.ts | 2 +- lib/cli/src/utils/mod.ts | 2 +- lib/cli/src/utils/netzo.ts | 4 +- lib/cli/src/utils/walk.ts | 2 +- lib/cli/tests/help.test.ts | 2 +- lib/database/mod.test.ts | 2 +- lib/database/mod.ts | 2 +- lib/datastore/mod.test.ts | 2 +- lib/datastore/mod.utils.ts | 2 +- lib/deps/@libsql/client.ts | 1 + lib/deps/@mdx-js/mdx.ts | 1 + lib/deps/{std => @std}/assert.ts | 0 lib/deps/{std => @std}/collections.ts | 0 lib/deps/{std => @std}/datetime.ts | 0 lib/deps/{std => @std}/dotenv.ts | 0 lib/deps/{std => @std}/encoding.ts | 0 lib/deps/{std => @std}/flags.ts | 0 lib/deps/@std/fmt/colors.ts | 1 + lib/deps/{std => @std}/fs.ts | 0 lib/deps/{std => @std}/fs/exists.ts | 0 lib/deps/{std => @std}/http.ts | 0 lib/deps/{std => @std}/path.ts | 0 lib/deps/{std => @std}/ulid.ts | 0 lib/deps/@types/hast.ts | 1 + lib/deps/deep-parse-json.ts | 1 + lib/deps/flat.ts | 1 + lib/deps/istextorbinary.ts | 1 + lib/deps/mdast-util-mdxjs-esm.ts | 1 + lib/deps/mingo.ts | 1 + lib/deps/remark-frontmatter.ts | 1 + lib/deps/remark-gfm.ts | 1 + lib/deps/ts-morph.ts | 1 + lib/deps/unist-util-visit.ts | 1 + lib/plugins/database/plugin.ts | 2 +- lib/plugins/datastore/plugin.ts | 4 +- lib/plugins/environments/mod.ts | 2 +- lib/plugins/mdx/utils.ts | 18 +++---- lib/plugins/unocss/plugin.ts | 2 +- lib/plugins/utils.ts | 2 +- lib/storage/mod.test.ts | 2 +- tests/fixture-plugins-mdx/deno.json | 57 +++++++++++----------- tests/fixture-plugins-mdx/dev.ts | 2 +- tests/fixture-plugins-mdx/main.ts | 2 +- tests/fixture-plugins-unocss/deno.json | 37 +++++++++----- tests/fixture-plugins-unocss/uno.config.ts | 2 +- 53 files changed, 126 insertions(+), 107 deletions(-) create mode 100644 lib/deps/@libsql/client.ts create mode 100644 lib/deps/@mdx-js/mdx.ts rename lib/deps/{std => @std}/assert.ts (100%) rename lib/deps/{std => @std}/collections.ts (100%) rename lib/deps/{std => @std}/datetime.ts (100%) rename lib/deps/{std => @std}/dotenv.ts (100%) rename lib/deps/{std => @std}/encoding.ts (100%) rename lib/deps/{std => @std}/flags.ts (100%) create mode 100644 lib/deps/@std/fmt/colors.ts rename lib/deps/{std => @std}/fs.ts (100%) rename lib/deps/{std => @std}/fs/exists.ts (100%) rename lib/deps/{std => @std}/http.ts (100%) rename lib/deps/{std => @std}/path.ts (100%) rename lib/deps/{std => @std}/ulid.ts (100%) create mode 100644 lib/deps/@types/hast.ts create mode 100644 lib/deps/deep-parse-json.ts create mode 100644 lib/deps/flat.ts create mode 100644 lib/deps/istextorbinary.ts create mode 100644 lib/deps/mdast-util-mdxjs-esm.ts create mode 100644 lib/deps/mingo.ts create mode 100644 lib/deps/remark-frontmatter.ts create mode 100644 lib/deps/remark-gfm.ts create mode 100644 lib/deps/ts-morph.ts create mode 100644 lib/deps/unist-util-visit.ts diff --git a/deno.jsonc b/deno.jsonc index 2ea17403..dfdaf62c 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,8 +1,5 @@ { - "exclude": [ - "_fresh/", - "**/_fresh/*" - ], + "exclude": ["**/_fresh/*"], "lock": false, "tasks": { "cache:deps": "deno cache **/deps/**/*.ts", @@ -14,34 +11,30 @@ "release": "deno run --allow-run --allow-read tasks/release.ts", "cov": "deno coverage ./cov/ --lcov --exclude='test.ts|testdata' > cov.lcov" }, - "unstable": [ - "cron", - "kv" - ], + "unstable": ["cron", "kv", "temporal"], "lint": { - "exclude": [ - "./lib/deps/" - ], - "rules": { - "tags": [ - "fresh", - "recommended" - ] - } - }, - "test": { - "exclude": [ - "./templates" - ] + "exclude": ["./lib/deps/"], + "rules": { "tags": ["fresh", "recommended"] } }, + "test": { "exclude": ["./templates"] }, "fmt": { "lineWidth": 100 }, "compilerOptions": { - "jsx": "react-jsx", - // NOTE: alias "preact" is not being resolved for deno.json(c) of monorepo - // therefore we use react here (this is not needed withing the individual - // projects e.g. under templates/crm/deno.json, since "preact" resolves properly) - // see https://github.com/denoland/deno/issues/20582#issuecomment-1751454928 - "jsxImportSource": "https://esm.sh/react@18.2.0" + "lib": ["dom", "dom.asynciterable", "deno.ns"], + "jsx": "precompile", + "jsxImportSource": "preact", + "jsxImportSourceTypes": "preact/compat", + "jsxPrecompileSkipElements": [ + "a", + "img", + "source", + "body", + "html", + "head", + "title", + "link", + "style", + "meta" + ] }, "imports": { "@/": "./", @@ -51,7 +44,6 @@ "react": "npm:preact@10.22.0/compat", "react-dom": "npm:preact@10.22.0/compat", "@preact/signals": "npm:@preact/signals@1.2.3", - "@preact/signals-core": "npm:@preact/signals-core@1.6.1", - "std/": "https://deno.land/std@0.208.0/" + "@preact/signals-core": "npm:@preact/signals-core@1.6.1" } } diff --git a/lib/apis/create-api/mod.test.ts b/lib/apis/create-api/mod.test.ts index ec0b9c18..b7521096 100644 --- a/lib/apis/create-api/mod.test.ts +++ b/lib/apis/create-api/mod.test.ts @@ -1,5 +1,5 @@ // TODO: implement tests from https://github.com/johannschopplich/unrested/blob/main/test/index.test.ts -import { assertEquals, assertExists } from "../../deps/std/assert.ts"; +import { assertEquals, assertExists } from "../../deps/@std/assert.ts"; import { auth } from "./auth/mod.ts"; import { createApi } from "./mod.ts"; diff --git a/lib/apis/jsonplaceholder.test.ts b/lib/apis/jsonplaceholder.test.ts index 0bc39a47..6a6d66c5 100644 --- a/lib/apis/jsonplaceholder.test.ts +++ b/lib/apis/jsonplaceholder.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists } from "../deps/std/assert.ts"; +import { assertEquals, assertExists } from "../deps/@std/assert.ts"; import { jsonplaceholder } from "./jsonplaceholder.ts"; Deno.test("[apis] jsonplaceholder", async (t) => { diff --git a/lib/cli/dev/cli.ts b/lib/cli/dev/cli.ts index 968e492f..23585c84 100644 --- a/lib/cli/dev/cli.ts +++ b/lib/cli/dev/cli.ts @@ -1,7 +1,7 @@ // adapted from https://github.com/denoland/fresh/blob/main/src/dev/cli.ts import { type FreshConfig } from "fresh/server.ts"; import { manifest } from "fresh/src/dev/mod.ts"; -import { join, toFileUrl } from "../../deps/std/path.ts"; +import { join, toFileUrl } from "../../deps/@std/path.ts"; const [cmd, configURL] = Deno.args; diff --git a/lib/cli/netzo.ts b/lib/cli/netzo.ts index 3c55bf68..8c8be7e9 100644 --- a/lib/cli/netzo.ts +++ b/lib/cli/netzo.ts @@ -1,7 +1,7 @@ #!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run +import { load } from "../deps/@std/dotenv.ts"; import { parse, semverGreaterThanOrEquals } from "../deps/semver/mod.ts"; -import { load } from "../deps/std/dotenv.ts"; import { error } from "../plugins/utils.ts"; import { parseArgs } from "./src/args.ts"; import deploySubcommand from "./src/subcommands/deploy.ts"; diff --git a/lib/cli/src/args.ts b/lib/cli/src/args.ts index 863ffc95..3f94fa5d 100644 --- a/lib/cli/src/args.ts +++ b/lib/cli/src/args.ts @@ -1,4 +1,4 @@ -import { parse } from "../../deps/std/flags.ts"; +import { parse } from "../../deps/@std/flags.ts"; export function parseArgs(args: string[]) { const parsed = parse(args, { diff --git a/lib/cli/src/subcommands/deploy.ts b/lib/cli/src/subcommands/deploy.ts index 59c49449..78255701 100644 --- a/lib/cli/src/subcommands/deploy.ts +++ b/lib/cli/src/subcommands/deploy.ts @@ -5,8 +5,8 @@ import type { Paginated, Project, } from "../../../deps/@netzo/api/mod.ts"; -import { exists } from "../../../deps/std/fs.ts"; -import { fromFileUrl, globToRegExp, isGlob, normalize } from "../../../deps/std/path.ts"; +import { exists } from "../../../deps/@std/fs.ts"; +import { fromFileUrl, globToRegExp, isGlob, normalize } from "../../../deps/@std/path.ts"; import { Spinner, wait } from "../../../deps/wait/mod.ts"; // vendored x/question@0.0.2 to silence deprecated API warnings (Deno>=1.4) import { question } from "../../../deps/question/mod.ts"; diff --git a/lib/cli/src/utils/entrypoint.ts b/lib/cli/src/utils/entrypoint.ts index 7e38c9e7..5cfcc6fd 100644 --- a/lib/cli/src/utils/entrypoint.ts +++ b/lib/cli/src/utils/entrypoint.ts @@ -1,4 +1,4 @@ -import { resolve, toFileUrl } from "../../../deps/std/path.ts"; +import { resolve, toFileUrl } from "../../../deps/@std/path.ts"; /** * Parses the entrypoint to a URL. diff --git a/lib/cli/src/utils/info.ts b/lib/cli/src/utils/info.ts index 29270a2b..43bcf83a 100644 --- a/lib/cli/src/utils/info.ts +++ b/lib/cli/src/utils/info.ts @@ -1,4 +1,4 @@ -import { join } from "../../../deps/std/path.ts"; +import { join } from "../../../deps/@std/path.ts"; import { getVersions } from "../subcommands/upgrade.ts"; export function getConfigPaths() { diff --git a/lib/cli/src/utils/mod.ts b/lib/cli/src/utils/mod.ts index 49c56b11..322256b0 100644 --- a/lib/cli/src/utils/mod.ts +++ b/lib/cli/src/utils/mod.ts @@ -1,4 +1,4 @@ -export { fromFileUrl, resolve } from "../../../deps/std/path.ts"; +export { fromFileUrl, resolve } from "../../../deps/@std/path.ts"; export { APIError } from "./api.ts"; export { parseEntrypoint } from "./entrypoint.ts"; export { walk } from "./walk.ts"; diff --git a/lib/cli/src/utils/netzo.ts b/lib/cli/src/utils/netzo.ts index 95490c5c..c012f26c 100644 --- a/lib/cli/src/utils/netzo.ts +++ b/lib/cli/src/utils/netzo.ts @@ -1,9 +1,9 @@ -import { isBinary } from "npm:istextorbinary@9.4.0"; import { feathers } from "../../../deps/@feathersjs/feathers.ts"; import { socketio } from "../../../deps/@feathersjs/socketio-client.ts"; import { Project, ProjectAssetsFile } from "../../../deps/@netzo/api/mod.ts"; +import { encodeBase64 } from "../../../deps/@std/encoding.ts"; +import { isBinary } from "../../../deps/istextorbinary.ts"; import { io } from "../../../deps/socket.io-client.ts"; -import { encodeBase64 } from "../../../deps/std/encoding.ts"; export const createClient = async ({ apiKey = Deno.env.get("NETZO_API_KEY")!, diff --git a/lib/cli/src/utils/walk.ts b/lib/cli/src/utils/walk.ts index 3cf0df4e..35d0e4eb 100644 --- a/lib/cli/src/utils/walk.ts +++ b/lib/cli/src/utils/walk.ts @@ -1,4 +1,4 @@ -import { join, normalize } from "../../../deps/std/path.ts"; +import { join, normalize } from "../../../deps/@std/path.ts"; import type { ManifestEntry, ManifestEntryDirectory } from "./netzo.ts"; /** Calculate git object hash, like `git hash-object` does. */ diff --git a/lib/cli/tests/help.test.ts b/lib/cli/tests/help.test.ts index c86096f3..81197b63 100644 --- a/lib/cli/tests/help.test.ts +++ b/lib/cli/tests/help.test.ts @@ -1,4 +1,4 @@ -import { assert, assertEquals, assertStringIncludes } from "../../deps/std/assert.ts"; +import { assert, assertEquals, assertStringIncludes } from "../../deps/@std/assert.ts"; import { netzo, output } from "./utils.ts"; Deno.test("help command list", async () => { diff --git a/lib/database/mod.test.ts b/lib/database/mod.test.ts index 22f833be..2803523d 100644 --- a/lib/database/mod.test.ts +++ b/lib/database/mod.test.ts @@ -1,4 +1,4 @@ -import { assertExists } from "../deps/std/assert.ts"; +import { assertExists } from "../deps/@std/assert.ts"; import { database } from "./mod.ts"; const db = database({ url: "http://localhost:8080" }); diff --git a/lib/database/mod.ts b/lib/database/mod.ts index 31f8e1b4..f70fd0fc 100644 --- a/lib/database/mod.ts +++ b/lib/database/mod.ts @@ -1,7 +1,7 @@ // IMPORTANT: requires importing createClient from /web and not from root nor /node // see https://github.com/tursodatabase/libsql-client-ts/issues/138#issuecomment-1921954374 import { IS_BROWSER } from "fresh/runtime.ts"; -import { createClient } from "npm:/@libsql/client@0.6.0"; +import { createClient } from "../deps/@libsql/client.ts"; import { drizzle } from "../deps/drizzle-orm/libsql.ts"; import { drizzle as drizzleSqliteProxy } from "../deps/drizzle-orm/sqlite-proxy.ts"; import type { DrizzleConfig } from "../deps/drizzle-orm/utils.ts"; diff --git a/lib/datastore/mod.test.ts b/lib/datastore/mod.test.ts index 29037afd..b8fdbb79 100644 --- a/lib/datastore/mod.test.ts +++ b/lib/datastore/mod.test.ts @@ -1,4 +1,4 @@ -import { assertExists } from "../deps/std/assert.ts"; +import { assertExists } from "../deps/@std/assert.ts"; import { datastore } from "./mod.ts"; const ds = datastore({ kv: await Deno.openKv(":memory:") }); diff --git a/lib/datastore/mod.utils.ts b/lib/datastore/mod.utils.ts index a2f628a8..f8981e87 100644 --- a/lib/datastore/mod.utils.ts +++ b/lib/datastore/mod.utils.ts @@ -1,4 +1,4 @@ -import mingo from "npm:mingo@6.4.13"; +import { mingo } from "../deps/mingo.ts"; import { monotonicFactory } from "../deps/ulid.ts"; export const ulid = monotonicFactory(); diff --git a/lib/deps/@libsql/client.ts b/lib/deps/@libsql/client.ts new file mode 100644 index 00000000..b88d0670 --- /dev/null +++ b/lib/deps/@libsql/client.ts @@ -0,0 +1 @@ +export * from "npm:/@libsql/client@0.6.0"; diff --git a/lib/deps/@mdx-js/mdx.ts b/lib/deps/@mdx-js/mdx.ts new file mode 100644 index 00000000..866ef47e --- /dev/null +++ b/lib/deps/@mdx-js/mdx.ts @@ -0,0 +1 @@ +export * from "npm:@mdx-js/mdx@3.0.1"; diff --git a/lib/deps/std/assert.ts b/lib/deps/@std/assert.ts similarity index 100% rename from lib/deps/std/assert.ts rename to lib/deps/@std/assert.ts diff --git a/lib/deps/std/collections.ts b/lib/deps/@std/collections.ts similarity index 100% rename from lib/deps/std/collections.ts rename to lib/deps/@std/collections.ts diff --git a/lib/deps/std/datetime.ts b/lib/deps/@std/datetime.ts similarity index 100% rename from lib/deps/std/datetime.ts rename to lib/deps/@std/datetime.ts diff --git a/lib/deps/std/dotenv.ts b/lib/deps/@std/dotenv.ts similarity index 100% rename from lib/deps/std/dotenv.ts rename to lib/deps/@std/dotenv.ts diff --git a/lib/deps/std/encoding.ts b/lib/deps/@std/encoding.ts similarity index 100% rename from lib/deps/std/encoding.ts rename to lib/deps/@std/encoding.ts diff --git a/lib/deps/std/flags.ts b/lib/deps/@std/flags.ts similarity index 100% rename from lib/deps/std/flags.ts rename to lib/deps/@std/flags.ts diff --git a/lib/deps/@std/fmt/colors.ts b/lib/deps/@std/fmt/colors.ts new file mode 100644 index 00000000..3048abdb --- /dev/null +++ b/lib/deps/@std/fmt/colors.ts @@ -0,0 +1 @@ +export * from "jsr:@std/fmt@0.225.4/colors"; diff --git a/lib/deps/std/fs.ts b/lib/deps/@std/fs.ts similarity index 100% rename from lib/deps/std/fs.ts rename to lib/deps/@std/fs.ts diff --git a/lib/deps/std/fs/exists.ts b/lib/deps/@std/fs/exists.ts similarity index 100% rename from lib/deps/std/fs/exists.ts rename to lib/deps/@std/fs/exists.ts diff --git a/lib/deps/std/http.ts b/lib/deps/@std/http.ts similarity index 100% rename from lib/deps/std/http.ts rename to lib/deps/@std/http.ts diff --git a/lib/deps/std/path.ts b/lib/deps/@std/path.ts similarity index 100% rename from lib/deps/std/path.ts rename to lib/deps/@std/path.ts diff --git a/lib/deps/std/ulid.ts b/lib/deps/@std/ulid.ts similarity index 100% rename from lib/deps/std/ulid.ts rename to lib/deps/@std/ulid.ts diff --git a/lib/deps/@types/hast.ts b/lib/deps/@types/hast.ts new file mode 100644 index 00000000..3b1aa844 --- /dev/null +++ b/lib/deps/@types/hast.ts @@ -0,0 +1 @@ +export * from "npm:@types/hast@3.0.3"; diff --git a/lib/deps/deep-parse-json.ts b/lib/deps/deep-parse-json.ts new file mode 100644 index 00000000..d671c37c --- /dev/null +++ b/lib/deps/deep-parse-json.ts @@ -0,0 +1 @@ +export * from "npm:deep-parse-json@2.0.0"; diff --git a/lib/deps/flat.ts b/lib/deps/flat.ts new file mode 100644 index 00000000..c00bce77 --- /dev/null +++ b/lib/deps/flat.ts @@ -0,0 +1 @@ +export * from "npm:flat@6.0.1"; diff --git a/lib/deps/istextorbinary.ts b/lib/deps/istextorbinary.ts new file mode 100644 index 00000000..2e694981 --- /dev/null +++ b/lib/deps/istextorbinary.ts @@ -0,0 +1 @@ +export * from "npm:istextorbinary@9.4.0"; diff --git a/lib/deps/mdast-util-mdxjs-esm.ts b/lib/deps/mdast-util-mdxjs-esm.ts new file mode 100644 index 00000000..962da70b --- /dev/null +++ b/lib/deps/mdast-util-mdxjs-esm.ts @@ -0,0 +1 @@ +export * from "npm:mdast-util-mdxjs-esm@2.0.1"; diff --git a/lib/deps/mingo.ts b/lib/deps/mingo.ts new file mode 100644 index 00000000..c5b473ac --- /dev/null +++ b/lib/deps/mingo.ts @@ -0,0 +1 @@ +export { default as mingo } from "npm:mingo@6.4.13"; diff --git a/lib/deps/remark-frontmatter.ts b/lib/deps/remark-frontmatter.ts new file mode 100644 index 00000000..ecb9a115 --- /dev/null +++ b/lib/deps/remark-frontmatter.ts @@ -0,0 +1 @@ +export { default as remarkFrontmatter } from "npm:remark-frontmatter@5.0.0"; diff --git a/lib/deps/remark-gfm.ts b/lib/deps/remark-gfm.ts new file mode 100644 index 00000000..aeea7123 --- /dev/null +++ b/lib/deps/remark-gfm.ts @@ -0,0 +1 @@ +export { default as remarkGfm } from "npm:remark-gfm@4.0.0"; diff --git a/lib/deps/ts-morph.ts b/lib/deps/ts-morph.ts new file mode 100644 index 00000000..42d090d3 --- /dev/null +++ b/lib/deps/ts-morph.ts @@ -0,0 +1 @@ +export * from "npm:ts-morph@21.0.1"; diff --git a/lib/deps/unist-util-visit.ts b/lib/deps/unist-util-visit.ts new file mode 100644 index 00000000..3829a839 --- /dev/null +++ b/lib/deps/unist-util-visit.ts @@ -0,0 +1 @@ +export * from "npm:unist-util-visit@4.1.2"; diff --git a/lib/plugins/database/plugin.ts b/lib/plugins/database/plugin.ts index 95fd7edd..a9d769e7 100644 --- a/lib/plugins/database/plugin.ts +++ b/lib/plugins/database/plugin.ts @@ -1,7 +1,7 @@ // deno-lint-ignore-file no-explicit-any import type { Plugin, PluginRoute } from "fresh/server.ts"; -import { createClient } from "npm:@libsql/client@0.6.0"; import { database as createDatabase } from "../../database/mod.ts"; +import { createClient } from "../../deps/@libsql/client.ts"; import { eq, getTableColumns, SQL, sql } from "../../deps/drizzle-orm/mod.ts"; import { SQLiteTable } from "../../deps/drizzle-orm/sqlite-core.ts"; import { DrizzleConfig } from "../../deps/drizzle-orm/utils.ts"; diff --git a/lib/plugins/datastore/plugin.ts b/lib/plugins/datastore/plugin.ts index 272d5e4e..8ccff1d3 100644 --- a/lib/plugins/datastore/plugin.ts +++ b/lib/plugins/datastore/plugin.ts @@ -1,7 +1,7 @@ import type { Plugin, PluginRoute } from "fresh/server.ts"; -import { deepParseJson } from "npm:deep-parse-json@2.0.0"; -import { unflatten } from "npm:flat@6.0.1"; import { datastore as createDatastore } from "../../datastore/mod.ts"; +import { deepParseJson } from "../../deps/deep-parse-json.ts"; +import { unflatten } from "../../deps/flat.ts"; import { apiKeyAuthentication, cors } from "../middleware.ts"; import { parseRequestBody, RESPONSES } from "../utils.ts"; diff --git a/lib/plugins/environments/mod.ts b/lib/plugins/environments/mod.ts index dd822082..2636a395 100644 --- a/lib/plugins/environments/mod.ts +++ b/lib/plugins/environments/mod.ts @@ -1,6 +1,6 @@ // deno-lint-ignore-file no-explicit-any -import { load } from "jsr:@std/dotenv"; import { netzo } from "../../apis/netzo.ts"; +import { load } from "../../deps/@std/dotenv.ts"; import type { Project } from "../types.ts"; import { logInfo, LOGS } from "../utils.ts"; diff --git a/lib/plugins/mdx/utils.ts b/lib/plugins/mdx/utils.ts index 582d83da..cddedb35 100644 --- a/lib/plugins/mdx/utils.ts +++ b/lib/plugins/mdx/utils.ts @@ -1,13 +1,13 @@ import { type PluginRoute } from "fresh/server.ts"; -import { compile } from "npm:@mdx-js/mdx"; -import { Root } from "npm:@types/hast@3.0.3"; -import { type MdxjsEsm } from "npm:mdast-util-mdxjs-esm@2.0.1"; -import { default as remarkFrontmatter } from "npm:remark-frontmatter@5.0.0"; -import { default as remarkGfm } from "npm:remark-gfm@4.0.0"; -import { Project } from "npm:ts-morph@21.0.1"; -import { visit } from "npm:unist-util-visit@4.1.2"; -import { walk } from "../../deps/std/fs.ts"; -import { join, toFileUrl } from "../../deps/std/path.ts"; +import { compile } from "../../deps/@mdx-js/mdx.ts"; +import { walk } from "../../deps/@std/fs.ts"; +import { join, toFileUrl } from "../../deps/@std/path.ts"; +import { Root } from "../../deps/@types/hast.ts"; +import { type MdxjsEsm } from "../../deps/mdast-util-mdxjs-esm.ts"; +import { remarkFrontmatter } from "../../deps/remark-frontmatter.ts"; +import { remarkGfm } from "../../deps/remark-gfm.ts"; +import { Project } from "../../deps/ts-morph.ts"; +import { visit } from "../../deps/unist-util-visit.ts"; export async function scanForMDXFiles(directory: string): Promise { const files: string[] = []; diff --git a/lib/plugins/unocss/plugin.ts b/lib/plugins/unocss/plugin.ts index bf0d119e..0ceea4c9 100644 --- a/lib/plugins/unocss/plugin.ts +++ b/lib/plugins/unocss/plugin.ts @@ -4,8 +4,8 @@ import { JSX, options as preactOptions, VNode } from "preact"; import { UnoGenerator, type UserConfig } from "../../deps/@unocss/core.ts"; import type { Theme } from "../../deps/@unocss/preset-uno.ts"; // IMPORTANT: import from @std/fs/exists directly to avoid Deno leaking to client +import { existsSync } from "../../deps/@std/fs/exists.ts"; import { minify } from "../../deps/csso.ts"; -import { existsSync } from "../../deps/std/fs/exists.ts"; import type { NetzoState } from "../../mod.ts"; import { logInfo } from "../utils.ts"; diff --git a/lib/plugins/utils.ts b/lib/plugins/utils.ts index a2a52754..9d0a76ac 100644 --- a/lib/plugins/utils.ts +++ b/lib/plugins/utils.ts @@ -1,7 +1,7 @@ // adapted from https://github.com/oaarnikoivu/shadcn-virtualized-combobox // @deno-types="npm:@types/react@18.2.60" -import { blue, bold, green, red, white, yellow } from "https://deno.land/std@0.208.0/fmt/colors.ts"; +import { blue, bold, green, red, white, yellow } from "../deps/@std/fmt/colors.ts"; import type { Project } from "./types.ts"; /** diff --git a/lib/storage/mod.test.ts b/lib/storage/mod.test.ts index 3de3f048..a6fd2215 100644 --- a/lib/storage/mod.test.ts +++ b/lib/storage/mod.test.ts @@ -1,4 +1,4 @@ -import { assertExists } from "../deps/std/assert.ts"; +import { assertExists } from "../deps/@std/assert.ts"; import { storage } from "./mod.ts"; const db = storage(); diff --git a/tests/fixture-plugins-mdx/deno.json b/tests/fixture-plugins-mdx/deno.json index 07e65431..e950c202 100644 --- a/tests/fixture-plugins-mdx/deno.json +++ b/tests/fixture-plugins-mdx/deno.json @@ -1,4 +1,5 @@ { + "exclude": ["**/_fresh/*"], "lock": false, "tasks": { "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx", @@ -9,38 +10,36 @@ "preview": "deno run -A main.ts", "update": "deno run -A -r https://fresh.deno.dev/update ." }, - "lint": { - "rules": { - "tags": [ - "fresh", - "recommended" - ] - } + "unstable": ["cron", "kv", "temporal"], + "lint": { "rules": { "tags": ["fresh", "recommended"] } }, + "fmt": { "lineWidth": 100 }, + "compilerOptions": { + "lib": ["dom", "dom.asynciterable", "deno.ns"], + "jsx": "precompile", + "jsxImportSource": "preact", + "jsxImportSourceTypes": "preact/compat", + "jsxPrecompileSkipElements": [ + "a", + "img", + "source", + "body", + "html", + "head", + "title", + "link", + "style", + "meta" + ] }, - "exclude": [ - "**/_fresh/*" - ], "imports": { "@/": "./", "netzo/": "../../lib/", "fresh/": "https://deno.land/x/fresh@1.6.8/", - "preact": "https://esm.sh/preact@10.19.6", - "preact/": "https://esm.sh/preact@10.19.6/", - "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.3.1", - "@preact/signals": "https://esm.sh/*@preact/signals@1.2.3", - "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.6.0", - "react": "https://esm.sh/preact@10.19.6/compat", - "react-dom": "https://esm.sh/preact@10.19.6/compat", - "std/": "https://deno.land/std@0.208.0/", - "react/jsx-runtime": "https://esm.sh/preact@10.19.6/compat", - "tailwindcss": "npm:tailwindcss@3.4.1", - "tailwindcss/": "npm:/tailwindcss@3.4.1/", - "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js", - "$std/": "https://deno.land/std@0.211.0/" - }, - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "preact" - }, - "nodeModulesDir": true + "preact": "npm:preact@10.22.0", + "react": "npm:preact@10.22.0/compat", + "react-dom": "npm:preact@10.22.0/compat", + "@preact/signals": "npm:@preact/signals@1.2.3", + "@preact/signals-core": "npm:@preact/signals-core@1.6.1", + "@std/dotenv": "jsr:@std/dotenv@0.224.1" + } } diff --git a/tests/fixture-plugins-mdx/dev.ts b/tests/fixture-plugins-mdx/dev.ts index 6d373531..03496f05 100644 --- a/tests/fixture-plugins-mdx/dev.ts +++ b/tests/fixture-plugins-mdx/dev.ts @@ -3,6 +3,6 @@ import dev from "fresh/dev.ts"; import config from "./fresh.config.ts"; -import "$std/dotenv/load.ts"; +import "@std/dotenv/load"; await dev(import.meta.url, "./main.ts", config); diff --git a/tests/fixture-plugins-mdx/main.ts b/tests/fixture-plugins-mdx/main.ts index ca536888..c5ec9a96 100644 --- a/tests/fixture-plugins-mdx/main.ts +++ b/tests/fixture-plugins-mdx/main.ts @@ -4,7 +4,7 @@ /// /// -import "$std/dotenv/load.ts"; +import "@std/dotenv/load"; import { start } from "fresh/server.ts"; import config from "./fresh.config.ts"; diff --git a/tests/fixture-plugins-unocss/deno.json b/tests/fixture-plugins-unocss/deno.json index b40eedb0..d23dbf44 100644 --- a/tests/fixture-plugins-unocss/deno.json +++ b/tests/fixture-plugins-unocss/deno.json @@ -1,24 +1,39 @@ { + "exclude": ["**/_fresh/*"], "lock": false, "tasks": { "start": "deno run -A --watch=static/,routes/ dev.ts" }, + "unstable": ["cron", "kv", "temporal"], + "lint": { "rules": { "tags": ["fresh", "recommended"] } }, + "fmt": { "lineWidth": 100 }, "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "preact" + "lib": ["dom", "dom.asynciterable", "deno.ns"], + "jsx": "precompile", + "jsxImportSource": "preact", + "jsxImportSourceTypes": "preact/compat", + "jsxPrecompileSkipElements": [ + "a", + "img", + "source", + "body", + "html", + "head", + "title", + "link", + "style", + "meta" + ] }, "imports": { "@/": "./", "netzo/": "../../lib/", "fresh/": "https://deno.land/x/fresh@1.6.8/", - "preact": "https://esm.sh/preact@10.19.6", - "preact/": "https://esm.sh/preact@10.19.6/", - "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.3.1", - "@preact/signals": "https://esm.sh/*@preact/signals@1.2.3", - "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.6.0", - "react": "https://esm.sh/preact@10.19.6/compat", - "react-dom": "https://esm.sh/preact@10.19.6/compat", - "std/": "https://deno.land/std@0.208.0/", - "react/jsx-runtime": "https://esm.sh/preact@10.19.6/compat" + "preact": "npm:preact@10.22.0", + "react": "npm:preact@10.22.0/compat", + "react-dom": "npm:preact@10.22.0/compat", + "@preact/signals": "npm:@preact/signals@1.2.3", + "@preact/signals-core": "npm:@preact/signals-core@1.6.1", + "@std/dotenv": "jsr:@std/dotenv@0.224.1" } } diff --git a/tests/fixture-plugins-unocss/uno.config.ts b/tests/fixture-plugins-unocss/uno.config.ts index d7c88fe3..1b58886c 100644 --- a/tests/fixture-plugins-unocss/uno.config.ts +++ b/tests/fixture-plugins-unocss/uno.config.ts @@ -1,5 +1,5 @@ -import presetUno from "https://esm.sh/@unocss/preset-uno@0.55.1"; import { defineUnocssConfig } from "netzo/plugins/unocss/plugin.ts"; +import { presetUno } from "../../lib/deps/@unocss/preset-uno.ts"; export default defineUnocssConfig({ url: import.meta.url,