chore: remove $fresh from import statements (#2079)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
b902205feb
commit
ad33501692
@@ -5,7 +5,7 @@ import { build } from "./build.ts";
|
|||||||
import { collect, ensureMinDenoVersion, generate, Manifest } from "./mod.ts";
|
import { collect, ensureMinDenoVersion, generate, Manifest } from "./mod.ts";
|
||||||
import { startServer } from "../server/boot.ts";
|
import { startServer } from "../server/boot.ts";
|
||||||
import { getInternalFreshState } from "../server/config.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(
|
export async function dev(
|
||||||
base: string,
|
base: string,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { ComponentChildren } from "preact";
|
import { ComponentChildren } from "preact";
|
||||||
import {
|
import {
|
||||||
|
AppContext,
|
||||||
AsyncLayout,
|
AsyncLayout,
|
||||||
AsyncRoute,
|
AsyncRoute,
|
||||||
FreshConfig,
|
FreshConfig,
|
||||||
@@ -7,7 +8,6 @@ import {
|
|||||||
RouteContext,
|
RouteContext,
|
||||||
} from "./types.ts";
|
} from "./types.ts";
|
||||||
import { checkAsyncComponent } from "./render.ts";
|
import { checkAsyncComponent } from "./render.ts";
|
||||||
import { AppContext } from "$fresh/server.ts";
|
|
||||||
|
|
||||||
export function defineConfig(config: FreshConfig): FreshConfig {
|
export function defineConfig(config: FreshConfig): FreshConfig {
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
+2
-2
@@ -12,8 +12,8 @@ import {
|
|||||||
startFreshServer,
|
startFreshServer,
|
||||||
waitForText,
|
waitForText,
|
||||||
withFakeServe,
|
withFakeServe,
|
||||||
} from "$fresh/tests/test_utils.ts";
|
} from "./test_utils.ts";
|
||||||
import { BuildSnapshotJson } from "$fresh/src/build/mod.ts";
|
import { BuildSnapshotJson } from "../src/build/mod.ts";
|
||||||
|
|
||||||
function runBuild(fixture: string, subDirPath: string, outDir: string) {
|
function runBuild(fixture: string, subDirPath: string, outDir: string) {
|
||||||
return new Deno.Command(Deno.execPath(), {
|
return new Deno.Command(Deno.execPath(), {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import {
|
|||||||
assertNotMatch,
|
assertNotMatch,
|
||||||
} from "./deps.ts";
|
} from "./deps.ts";
|
||||||
import versions from "../versions.json" assert { type: "json" };
|
import versions from "../versions.json" assert { type: "json" };
|
||||||
import { CheckFile } from "$fresh/src/dev/update_check.ts";
|
import { CheckFile } from "../src/dev/update_check.ts";
|
||||||
import { WEEK } from "$fresh/src/dev/deps.ts";
|
import { WEEK } from "../src/dev/deps.ts";
|
||||||
import { getStdOutput } from "$fresh/tests/test_utils.ts";
|
import { getStdOutput } from "../tests/test_utils.ts";
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
name: "stores update check file in $HOME/fresh",
|
name: "stores update check file in $HOME/fresh",
|
||||||
|
|||||||
@@ -40,5 +40,7 @@ export {
|
|||||||
fromFileUrl,
|
fromFileUrl,
|
||||||
join,
|
join,
|
||||||
relative,
|
relative,
|
||||||
|
toFileUrl,
|
||||||
} from "https://deno.land/std@0.208.0/path/mod.ts";
|
} 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 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";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
assertSelector,
|
assertSelector,
|
||||||
assertTextMany,
|
assertTextMany,
|
||||||
withFakeServe,
|
withFakeServe,
|
||||||
} from "$fresh/tests/test_utils.ts";
|
} from "./test_utils.ts";
|
||||||
import { assertNotMatch } from "./deps.ts";
|
import { assertNotMatch } from "./deps.ts";
|
||||||
|
|
||||||
Deno.test("doesn't apply internal app template", async () => {
|
Deno.test("doesn't apply internal app template", async () => {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import {
|
|||||||
assertTextMany,
|
assertTextMany,
|
||||||
parseHtml,
|
parseHtml,
|
||||||
withFakeServe,
|
withFakeServe,
|
||||||
} from "$fresh/tests/test_utils.ts";
|
} from "./test_utils.ts";
|
||||||
import { assertEquals } from "./deps.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 manifest from "./fixture/fresh.gen.ts";
|
||||||
import config from "./fixture/fresh.config.ts";
|
import config from "./fixture/fresh.config.ts";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { startFreshServerExpectErrors } from "./test_utils.ts";
|
import { startFreshServerExpectErrors } from "./test_utils.ts";
|
||||||
import { dirname, join } from "$std/path/mod.ts";
|
import { dirname, join } from "$std/path/mod.ts";
|
||||||
import { assertEquals, assertStringIncludes } from "./deps.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";
|
import manifest from "./fixture/fresh.gen.ts";
|
||||||
|
|
||||||
const dir = dirname(import.meta.url);
|
const dir = dirname(import.meta.url);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { runBuild, withFakeServe } from "$fresh/tests/test_utils.ts";
|
import { runBuild, withFakeServe } from "./test_utils.ts";
|
||||||
import { assertStringIncludes } from "$std/assert/mod.ts";
|
import { assertStringIncludes } from "./deps.ts";
|
||||||
|
|
||||||
Deno.test("TailwindCSS - dev mode", async () => {
|
Deno.test("TailwindCSS - dev mode", async () => {
|
||||||
await withFakeServe("./tests/fixture_tailwind/dev.ts", async (server) => {
|
await withFakeServe("./tests/fixture_tailwind/dev.ts", async (server) => {
|
||||||
|
|||||||
+4
-4
@@ -1,15 +1,14 @@
|
|||||||
import { colors, toFileUrl } from "$fresh/src/server/deps.ts";
|
|
||||||
import * as path from "$std/path/mod.ts";
|
|
||||||
import {
|
import {
|
||||||
FromManifestConfig,
|
FromManifestConfig,
|
||||||
Manifest,
|
Manifest,
|
||||||
ServeHandlerInfo,
|
ServeHandlerInfo,
|
||||||
ServerContext,
|
ServerContext,
|
||||||
} from "$fresh/server.ts";
|
} from "../server.ts";
|
||||||
import {
|
import {
|
||||||
assert,
|
assert,
|
||||||
assertEquals,
|
assertEquals,
|
||||||
basename,
|
basename,
|
||||||
|
colors,
|
||||||
delay,
|
delay,
|
||||||
dirname,
|
dirname,
|
||||||
DOMParser,
|
DOMParser,
|
||||||
@@ -19,6 +18,7 @@ import {
|
|||||||
Page,
|
Page,
|
||||||
puppeteer,
|
puppeteer,
|
||||||
TextLineStream,
|
TextLineStream,
|
||||||
|
toFileUrl,
|
||||||
} from "./deps.ts";
|
} from "./deps.ts";
|
||||||
|
|
||||||
export interface TestDocument extends Document {
|
export interface TestDocument extends Document {
|
||||||
@@ -507,7 +507,7 @@ export async function recreateFolder(folderPath: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function runBuild(fixture: string) {
|
export async function runBuild(fixture: string) {
|
||||||
const outDir = path.join(path.dirname(fixture), "_fresh");
|
const outDir = join(dirname(fixture), "_fresh");
|
||||||
try {
|
try {
|
||||||
await Deno.remove(outDir, { recursive: true });
|
await Deno.remove(outDir, { recursive: true });
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
+15
-15
@@ -1,11 +1,11 @@
|
|||||||
import * as path from "$std/path/mod.ts";
|
import { DenoConfig } from "../server.ts";
|
||||||
import { DenoConfig } from "$fresh/server.ts";
|
|
||||||
import {
|
import {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertExists,
|
assertExists,
|
||||||
assertMatch,
|
assertMatch,
|
||||||
assertRejects,
|
assertRejects,
|
||||||
assertStringIncludes,
|
assertStringIncludes,
|
||||||
|
join,
|
||||||
JSONC,
|
JSONC,
|
||||||
retry,
|
retry,
|
||||||
} from "./deps.ts";
|
} from "./deps.ts";
|
||||||
@@ -16,7 +16,7 @@ async function updateAndVerify(cwd: string | URL, expected: RegExp) {
|
|||||||
"run",
|
"run",
|
||||||
"-A",
|
"-A",
|
||||||
"--no-config",
|
"--no-config",
|
||||||
path.join(Deno.cwd(), "update.ts"),
|
join(Deno.cwd(), "update.ts"),
|
||||||
".",
|
".",
|
||||||
],
|
],
|
||||||
cwd,
|
cwd,
|
||||||
@@ -42,7 +42,7 @@ async function initProject() {
|
|||||||
"run",
|
"run",
|
||||||
"-A",
|
"-A",
|
||||||
"--no-config",
|
"--no-config",
|
||||||
path.join(Deno.cwd(), "init.ts"),
|
join(Deno.cwd(), "init.ts"),
|
||||||
".",
|
".",
|
||||||
],
|
],
|
||||||
cwd: tmpDirName,
|
cwd: tmpDirName,
|
||||||
@@ -70,7 +70,7 @@ Deno.test("fresh-update", async function fn(t) {
|
|||||||
await executeUpdateCommand(t, tmpDirName);
|
await executeUpdateCommand(t, tmpDirName);
|
||||||
|
|
||||||
await t.step("check deno.json", async () => {
|
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;
|
const json = JSONC.parse(await Deno.readTextFile(configPath)) as DenoConfig;
|
||||||
|
|
||||||
assertExists(json.tasks?.start, "Missing 'start' task");
|
assertExists(json.tasks?.start, "Missing 'start' task");
|
||||||
@@ -118,8 +118,8 @@ Deno.test("fresh-update", async function fn(t) {
|
|||||||
Deno.mkdirSync(tmpDirName + "/src");
|
Deno.mkdirSync(tmpDirName + "/src");
|
||||||
names.forEach((x) => {
|
names.forEach((x) => {
|
||||||
Deno.renameSync(
|
Deno.renameSync(
|
||||||
path.join(tmpDirName, x),
|
join(tmpDirName, x),
|
||||||
path.join(tmpDirName, "src", x),
|
join(tmpDirName, "src", x),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
await updateAndVerify(
|
await updateAndVerify(
|
||||||
@@ -129,8 +129,8 @@ Deno.test("fresh-update", async function fn(t) {
|
|||||||
} finally {
|
} finally {
|
||||||
names.forEach((x) => {
|
names.forEach((x) => {
|
||||||
Deno.renameSync(
|
Deno.renameSync(
|
||||||
path.join(tmpDirName, "src", x),
|
join(tmpDirName, "src", x),
|
||||||
path.join(tmpDirName, x),
|
join(tmpDirName, x),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
Deno.removeSync(tmpDirName + "/src", { recursive: true });
|
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 t.step("execute update command (no islands directory)", async () => {
|
||||||
await retry(() =>
|
await retry(() =>
|
||||||
Deno.remove(path.join(tmpDirName, "islands"), { recursive: true })
|
Deno.remove(join(tmpDirName, "islands"), { recursive: true })
|
||||||
);
|
);
|
||||||
await updateAndVerify(
|
await updateAndVerify(
|
||||||
tmpDirName,
|
tmpDirName,
|
||||||
@@ -154,7 +154,7 @@ Deno.test("fresh-update add _app.tsx if not present", async function fn(t) {
|
|||||||
// Preparation
|
// Preparation
|
||||||
const tmpDirName = await initProject();
|
const tmpDirName = await initProject();
|
||||||
|
|
||||||
const appTsx = path.join(tmpDirName, "routes", "_app.tsx");
|
const appTsx = join(tmpDirName, "routes", "_app.tsx");
|
||||||
await Deno.remove(appTsx);
|
await Deno.remove(appTsx);
|
||||||
|
|
||||||
await executeUpdateCommand(t, tmpDirName);
|
await executeUpdateCommand(t, tmpDirName);
|
||||||
@@ -171,7 +171,7 @@ Deno.test(
|
|||||||
// Preparation
|
// Preparation
|
||||||
const tmpDirName = await initProject();
|
const tmpDirName = await initProject();
|
||||||
|
|
||||||
const gitignore = path.join(tmpDirName, ".gitignore");
|
const gitignore = join(tmpDirName, ".gitignore");
|
||||||
await Deno.writeTextFile(gitignore, ""); // clear .gitignore
|
await Deno.writeTextFile(gitignore, ""); // clear .gitignore
|
||||||
|
|
||||||
await executeUpdateCommand(t, tmpDirName);
|
await executeUpdateCommand(t, tmpDirName);
|
||||||
@@ -189,7 +189,7 @@ Deno.test(
|
|||||||
// Preparation
|
// Preparation
|
||||||
const tmpDirName = await initProject();
|
const tmpDirName = await initProject();
|
||||||
|
|
||||||
const gitignore = path.join(tmpDirName, ".gitignore");
|
const gitignore = join(tmpDirName, ".gitignore");
|
||||||
await Deno.writeTextFile(gitignore, "_fresh");
|
await Deno.writeTextFile(gitignore, "_fresh");
|
||||||
|
|
||||||
await executeUpdateCommand(t, tmpDirName);
|
await executeUpdateCommand(t, tmpDirName);
|
||||||
@@ -209,7 +209,7 @@ Deno.test(
|
|||||||
// Preparation
|
// Preparation
|
||||||
const tmpDirName = await initProject();
|
const tmpDirName = await initProject();
|
||||||
|
|
||||||
const gitignore = path.join(tmpDirName, ".gitignore");
|
const gitignore = join(tmpDirName, ".gitignore");
|
||||||
await Deno.remove(gitignore);
|
await Deno.remove(gitignore);
|
||||||
|
|
||||||
await executeUpdateCommand(t, tmpDirName);
|
await executeUpdateCommand(t, tmpDirName);
|
||||||
@@ -230,7 +230,7 @@ Deno.test(
|
|||||||
async (t) => {
|
async (t) => {
|
||||||
// Preparation
|
// Preparation
|
||||||
const tmpDirName = await initProject();
|
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));
|
const denoJson = JSON.parse(await Deno.readTextFile(denoJsonFile));
|
||||||
delete denoJson.exclude;
|
delete denoJson.exclude;
|
||||||
if (!denoJson.fmt) denoJson.fmt = {};
|
if (!denoJson.fmt) denoJson.fmt = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user