diff --git a/src/dev/dev_command.ts b/src/dev/dev_command.ts index 2b740ab1..d953ad20 100644 --- a/src/dev/dev_command.ts +++ b/src/dev/dev_command.ts @@ -5,7 +5,7 @@ import { build } from "./build.ts"; import { collect, ensureMinDenoVersion, generate, Manifest } from "./mod.ts"; import { startServer } from "../server/boot.ts"; import { getInternalFreshState } from "../server/config.ts"; -import { getServerContext } from "$fresh/src/server/context.ts"; +import { getServerContext } from "../server/context.ts"; export async function dev( base: string, diff --git a/src/server/defines.ts b/src/server/defines.ts index 61718abd..46929dcc 100644 --- a/src/server/defines.ts +++ b/src/server/defines.ts @@ -1,5 +1,6 @@ import { ComponentChildren } from "preact"; import { + AppContext, AsyncLayout, AsyncRoute, FreshConfig, @@ -7,7 +8,6 @@ import { RouteContext, } from "./types.ts"; import { checkAsyncComponent } from "./render.ts"; -import { AppContext } from "$fresh/server.ts"; export function defineConfig(config: FreshConfig): FreshConfig { return config; diff --git a/tests/build_test.ts b/tests/build_test.ts index d01da7d1..ab327a98 100644 --- a/tests/build_test.ts +++ b/tests/build_test.ts @@ -12,8 +12,8 @@ import { startFreshServer, waitForText, withFakeServe, -} from "$fresh/tests/test_utils.ts"; -import { BuildSnapshotJson } from "$fresh/src/build/mod.ts"; +} from "./test_utils.ts"; +import { BuildSnapshotJson } from "../src/build/mod.ts"; function runBuild(fixture: string, subDirPath: string, outDir: string) { return new Deno.Command(Deno.execPath(), { diff --git a/tests/cli_update_check_test.ts b/tests/cli_update_check_test.ts index 362cf3ad..b8bd5205 100644 --- a/tests/cli_update_check_test.ts +++ b/tests/cli_update_check_test.ts @@ -7,9 +7,9 @@ import { assertNotMatch, } from "./deps.ts"; import versions from "../versions.json" assert { type: "json" }; -import { CheckFile } from "$fresh/src/dev/update_check.ts"; -import { WEEK } from "$fresh/src/dev/deps.ts"; -import { getStdOutput } from "$fresh/tests/test_utils.ts"; +import { CheckFile } from "../src/dev/update_check.ts"; +import { WEEK } from "../src/dev/deps.ts"; +import { getStdOutput } from "../tests/test_utils.ts"; Deno.test({ name: "stores update check file in $HOME/fresh", diff --git a/tests/deps.ts b/tests/deps.ts index e727d44c..4f268ef0 100644 --- a/tests/deps.ts +++ b/tests/deps.ts @@ -40,5 +40,7 @@ export { fromFileUrl, join, relative, + toFileUrl, } from "https://deno.land/std@0.208.0/path/mod.ts"; export * as JSONC from "https://deno.land/std@0.208.0/jsonc/mod.ts"; +export * as colors from "https://deno.land/std@0.208.0/fmt/colors.ts"; diff --git a/tests/explicit_app_template_test.ts b/tests/explicit_app_template_test.ts index e791a72d..c92bb438 100644 --- a/tests/explicit_app_template_test.ts +++ b/tests/explicit_app_template_test.ts @@ -3,7 +3,7 @@ import { assertSelector, assertTextMany, withFakeServe, -} from "$fresh/tests/test_utils.ts"; +} from "./test_utils.ts"; import { assertNotMatch } from "./deps.ts"; Deno.test("doesn't apply internal app template", async () => { diff --git a/tests/render_test.ts b/tests/render_test.ts index e0c1b021..067a7459 100644 --- a/tests/render_test.ts +++ b/tests/render_test.ts @@ -3,9 +3,9 @@ import { assertTextMany, parseHtml, withFakeServe, -} from "$fresh/tests/test_utils.ts"; +} from "./test_utils.ts"; import { assertEquals } from "./deps.ts"; -import { createHandler } from "$fresh/server.ts"; +import { createHandler } from "../server.ts"; import manifest from "./fixture/fresh.gen.ts"; import config from "./fixture/fresh.config.ts"; diff --git a/tests/route_analysis_test.ts b/tests/route_analysis_test.ts index f86b6e0c..9efe4b54 100644 --- a/tests/route_analysis_test.ts +++ b/tests/route_analysis_test.ts @@ -1,7 +1,7 @@ import { startFreshServerExpectErrors } from "./test_utils.ts"; import { dirname, join } from "$std/path/mod.ts"; import { assertEquals, assertStringIncludes } from "./deps.ts"; -import { ServerContext } from "$fresh/server.ts"; +import { ServerContext } from "../server.ts"; import manifest from "./fixture/fresh.gen.ts"; const dir = dirname(import.meta.url); diff --git a/tests/tailwind_test.ts b/tests/tailwind_test.ts index 7acb2f6e..2f8ffb31 100644 --- a/tests/tailwind_test.ts +++ b/tests/tailwind_test.ts @@ -1,5 +1,5 @@ -import { runBuild, withFakeServe } from "$fresh/tests/test_utils.ts"; -import { assertStringIncludes } from "$std/assert/mod.ts"; +import { runBuild, withFakeServe } from "./test_utils.ts"; +import { assertStringIncludes } from "./deps.ts"; Deno.test("TailwindCSS - dev mode", async () => { await withFakeServe("./tests/fixture_tailwind/dev.ts", async (server) => { diff --git a/tests/test_utils.ts b/tests/test_utils.ts index d02bae7c..21f2fb9b 100644 --- a/tests/test_utils.ts +++ b/tests/test_utils.ts @@ -1,15 +1,14 @@ -import { colors, toFileUrl } from "$fresh/src/server/deps.ts"; -import * as path from "$std/path/mod.ts"; import { FromManifestConfig, Manifest, ServeHandlerInfo, ServerContext, -} from "$fresh/server.ts"; +} from "../server.ts"; import { assert, assertEquals, basename, + colors, delay, dirname, DOMParser, @@ -19,6 +18,7 @@ import { Page, puppeteer, TextLineStream, + toFileUrl, } from "./deps.ts"; export interface TestDocument extends Document { @@ -507,7 +507,7 @@ export async function recreateFolder(folderPath: string) { } export async function runBuild(fixture: string) { - const outDir = path.join(path.dirname(fixture), "_fresh"); + const outDir = join(dirname(fixture), "_fresh"); try { await Deno.remove(outDir, { recursive: true }); } catch { diff --git a/tests/update_test.ts b/tests/update_test.ts index 15443cda..3d65aeee 100644 --- a/tests/update_test.ts +++ b/tests/update_test.ts @@ -1,11 +1,11 @@ -import * as path from "$std/path/mod.ts"; -import { DenoConfig } from "$fresh/server.ts"; +import { DenoConfig } from "../server.ts"; import { assertEquals, assertExists, assertMatch, assertRejects, assertStringIncludes, + join, JSONC, retry, } from "./deps.ts"; @@ -16,7 +16,7 @@ async function updateAndVerify(cwd: string | URL, expected: RegExp) { "run", "-A", "--no-config", - path.join(Deno.cwd(), "update.ts"), + join(Deno.cwd(), "update.ts"), ".", ], cwd, @@ -42,7 +42,7 @@ async function initProject() { "run", "-A", "--no-config", - path.join(Deno.cwd(), "init.ts"), + join(Deno.cwd(), "init.ts"), ".", ], cwd: tmpDirName, @@ -70,7 +70,7 @@ Deno.test("fresh-update", async function fn(t) { await executeUpdateCommand(t, tmpDirName); await t.step("check deno.json", async () => { - const configPath = path.join(tmpDirName, "deno.json"); + const configPath = join(tmpDirName, "deno.json"); const json = JSONC.parse(await Deno.readTextFile(configPath)) as DenoConfig; assertExists(json.tasks?.start, "Missing 'start' task"); @@ -118,8 +118,8 @@ Deno.test("fresh-update", async function fn(t) { Deno.mkdirSync(tmpDirName + "/src"); names.forEach((x) => { Deno.renameSync( - path.join(tmpDirName, x), - path.join(tmpDirName, "src", x), + join(tmpDirName, x), + join(tmpDirName, "src", x), ); }); await updateAndVerify( @@ -129,8 +129,8 @@ Deno.test("fresh-update", async function fn(t) { } finally { names.forEach((x) => { Deno.renameSync( - path.join(tmpDirName, "src", x), - path.join(tmpDirName, x), + join(tmpDirName, "src", x), + join(tmpDirName, x), ); }); Deno.removeSync(tmpDirName + "/src", { recursive: true }); @@ -139,7 +139,7 @@ Deno.test("fresh-update", async function fn(t) { await t.step("execute update command (no islands directory)", async () => { await retry(() => - Deno.remove(path.join(tmpDirName, "islands"), { recursive: true }) + Deno.remove(join(tmpDirName, "islands"), { recursive: true }) ); await updateAndVerify( tmpDirName, @@ -154,7 +154,7 @@ Deno.test("fresh-update add _app.tsx if not present", async function fn(t) { // Preparation const tmpDirName = await initProject(); - const appTsx = path.join(tmpDirName, "routes", "_app.tsx"); + const appTsx = join(tmpDirName, "routes", "_app.tsx"); await Deno.remove(appTsx); await executeUpdateCommand(t, tmpDirName); @@ -171,7 +171,7 @@ Deno.test( // Preparation const tmpDirName = await initProject(); - const gitignore = path.join(tmpDirName, ".gitignore"); + const gitignore = join(tmpDirName, ".gitignore"); await Deno.writeTextFile(gitignore, ""); // clear .gitignore await executeUpdateCommand(t, tmpDirName); @@ -189,7 +189,7 @@ Deno.test( // Preparation const tmpDirName = await initProject(); - const gitignore = path.join(tmpDirName, ".gitignore"); + const gitignore = join(tmpDirName, ".gitignore"); await Deno.writeTextFile(gitignore, "_fresh"); await executeUpdateCommand(t, tmpDirName); @@ -209,7 +209,7 @@ Deno.test( // Preparation const tmpDirName = await initProject(); - const gitignore = path.join(tmpDirName, ".gitignore"); + const gitignore = join(tmpDirName, ".gitignore"); await Deno.remove(gitignore); await executeUpdateCommand(t, tmpDirName); @@ -230,7 +230,7 @@ Deno.test( async (t) => { // Preparation const tmpDirName = await initProject(); - const denoJsonFile = path.join(tmpDirName, "deno.json"); + const denoJsonFile = join(tmpDirName, "deno.json"); const denoJson = JSON.parse(await Deno.readTextFile(denoJsonFile)); delete denoJson.exclude; if (!denoJson.fmt) denoJson.fmt = {};