refactor: replace references of options with config (#1903)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { FreshOptions } from "$fresh/server.ts";
|
||||
import { FreshConfig } from "$fresh/server.ts";
|
||||
|
||||
export default {
|
||||
async render(_ctx, render) {
|
||||
@@ -8,4 +8,4 @@ export default {
|
||||
throw new Error("body is missing");
|
||||
}
|
||||
},
|
||||
} as FreshOptions;
|
||||
} as FreshConfig;
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, options);
|
||||
await start(manifest, config);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
// this just exists to function as a type check to assert that we can actually pass a key and cert in
|
||||
await start(manifest, { ...options, key: "test", cert: "test" });
|
||||
await start(manifest, { ...config, key: "test", cert: "test" });
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
import "./polyfill_deno_deploy.ts";
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, options);
|
||||
await start(manifest, config);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FreshOptions } from "$fresh/server.ts";
|
||||
import { FreshConfig } from "$fresh/server.ts";
|
||||
import cssInjectPlugin from "./utils/css-inject-plugin.ts";
|
||||
import jsInjectPlugin from "./utils/js-inject-plugin.ts";
|
||||
import cssInjectPluginAsync from "./utils/css-inject-plugin-async.ts";
|
||||
@@ -13,4 +13,4 @@ export default {
|
||||
routePlugin({ title: "Title Set From Plugin Config" }),
|
||||
secondMiddlewarePlugin(),
|
||||
],
|
||||
} as FreshOptions;
|
||||
} as FreshConfig;
|
||||
@@ -6,5 +6,6 @@
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
await start(manifest, options);
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, config);
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { FreshOptions } from "$fresh/server.ts";
|
||||
import { FreshConfig } from "$fresh/server.ts";
|
||||
|
||||
export default {
|
||||
async render(_ctx, render) {
|
||||
@@ -8,4 +8,4 @@ export default {
|
||||
throw new Error("body is missing");
|
||||
}
|
||||
},
|
||||
} as FreshOptions;
|
||||
} as FreshConfig;
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, options);
|
||||
await start(manifest, config);
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
import "./polyfill_deno_deploy.ts";
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, options);
|
||||
await start(manifest, config);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env -S deno run -A --watch=static/,routes/
|
||||
|
||||
import dev from "$fresh/dev.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await dev(import.meta.url, "./main.ts", options);
|
||||
await dev(import.meta.url, "./main.ts", config);
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { FreshOptions } from "$fresh/server.ts";
|
||||
import { FreshConfig } from "$fresh/server.ts";
|
||||
|
||||
export default {
|
||||
router: {
|
||||
ignoreFilePattern: /[\.|_]cy\.[t|j]s(x)?$/,
|
||||
},
|
||||
} as FreshOptions;
|
||||
} as FreshConfig;
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, options);
|
||||
await start(manifest, config);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { FreshConfig } from "$fresh/server.ts";
|
||||
import twindPlugin from "../../plugins/twindv1.ts";
|
||||
import twindConfig from "./twind.config.ts";
|
||||
|
||||
export default { plugins: [twindPlugin(twindConfig)] } as FreshConfig;
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import manifest from "./fresh.gen.ts";
|
||||
import options from "./options.ts";
|
||||
import config from "./fresh.config.ts";
|
||||
|
||||
await start(manifest, options);
|
||||
await start(manifest, config);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { FreshOptions } from "$fresh/server.ts";
|
||||
import twindPlugin from "../../plugins/twindv1.ts";
|
||||
import twindConfig from "./twind.config.ts";
|
||||
|
||||
export default { plugins: [twindPlugin(twindConfig)] } as FreshOptions;
|
||||
+3
-3
@@ -10,7 +10,7 @@ import {
|
||||
retry,
|
||||
} from "./deps.ts";
|
||||
import manifest from "./fixture/fresh.gen.ts";
|
||||
import options from "./fixture/options.ts";
|
||||
import config from "./fixture/fresh.config.ts";
|
||||
import { BUILD_ID } from "../src/server/build_id.ts";
|
||||
import {
|
||||
assertSelector,
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
withPageName,
|
||||
} from "./test_utils.ts";
|
||||
|
||||
const ctx = await ServerContext.fromManifest(manifest, options);
|
||||
const ctx = await ServerContext.fromManifest(manifest, config);
|
||||
const handler = ctx.handler();
|
||||
|
||||
Deno.test("/ page prerender", async () => {
|
||||
@@ -303,7 +303,7 @@ Deno.test("/foo/:path*", async () => {
|
||||
|
||||
Deno.test("static files in custom directory", async () => {
|
||||
const newCtx = await ServerContext.fromManifest(manifest, {
|
||||
...options,
|
||||
...config,
|
||||
staticDir: "./custom_static",
|
||||
});
|
||||
const newRouter = (req: Request) => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
puppeteer,
|
||||
} from "./deps.ts";
|
||||
import manifest from "./fixture_plugin/fresh.gen.ts";
|
||||
import options from "./fixture_plugin/options.ts";
|
||||
import config from "./fixture_plugin/fresh.config.ts";
|
||||
import {
|
||||
clickWhenListenerReady,
|
||||
runBuild,
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
withPageName,
|
||||
} from "./test_utils.ts";
|
||||
|
||||
const ctx = await ServerContext.fromManifest(manifest, options);
|
||||
const ctx = await ServerContext.fromManifest(manifest, config);
|
||||
const handler = ctx.handler();
|
||||
const router = (req: Request) => {
|
||||
return handler(req, {
|
||||
|
||||
@@ -2,9 +2,9 @@ import { assertSelector, parseHtml } from "$fresh/tests/test_utils.ts";
|
||||
import { assertEquals } from "$std/testing/asserts.ts";
|
||||
import { createHandler } from "$fresh/server.ts";
|
||||
import manifest from "./fixture/fresh.gen.ts";
|
||||
import options from "./fixture/options.ts";
|
||||
import config from "./fixture/fresh.config.ts";
|
||||
|
||||
const handler = await createHandler(manifest, options);
|
||||
const handler = await createHandler(manifest, config);
|
||||
|
||||
// Issue: https://github.com/denoland/fresh/issues/1636
|
||||
Deno.test("doesn't leak data across renderers", async () => {
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ import { colors, toFileUrl } from "$fresh/src/server/deps.ts";
|
||||
import { assert } from "$std/_util/asserts.ts";
|
||||
import * as path from "$std/path/mod.ts";
|
||||
import {
|
||||
FromManifestOptions,
|
||||
FromManifestConfig,
|
||||
Manifest,
|
||||
ServeHandlerInfo,
|
||||
ServerContext,
|
||||
@@ -252,9 +252,9 @@ async function handleRequest(
|
||||
|
||||
export async function fakeServe(
|
||||
manifest: Manifest,
|
||||
options: FromManifestOptions,
|
||||
config: FromManifestConfig,
|
||||
): Promise<FakeServer> {
|
||||
const ctx = await ServerContext.fromManifest(manifest, options);
|
||||
const ctx = await ServerContext.fromManifest(manifest, config);
|
||||
const handler = ctx.handler();
|
||||
|
||||
const conn: ServeHandlerInfo = {
|
||||
|
||||
Reference in New Issue
Block a user