chore: remove $fresh from import statements (#2079)

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
Reed von Redwitz
2023-11-28 16:43:50 +00:00
committed by GitHub
co-authored by Marvin Hagemeister
parent b902205feb
commit ad33501692
11 changed files with 34 additions and 32 deletions
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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(), {
+3 -3
View File
@@ -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",
+2
View File
@@ -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";
+1 -1
View File
@@ -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 () => {
+2 -2
View File
@@ -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";
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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) => {
+4 -4
View File
@@ -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 {
+15 -15
View File
@@ -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 = {};