eddev 2.0.0-beta.78 → 2.0.0-beta.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,8 +6,8 @@ import { useRouter } from "../hooks/useRouter.js";
6
6
  import { isSameOrigin } from "../utils.js";
7
7
  import { useRoute } from "../hooks/useRoute.js";
8
8
  import { useRouterState } from "../hooks/useRouterState.js";
9
- export const Link = forwardRef(({ preferBack, ...props }, ref) => {
10
- const Comp = props.as || "a";
9
+ export const Link = forwardRef(({ preferBack, as, ...props }, ref) => {
10
+ const Comp = as || "a";
11
11
  if (env.admin) {
12
12
  return (_jsx(Comp, { ref: ref, ...props, href: props.href ?? undefined, onClick: (e) => {
13
13
  props.onClick?.(e);
@@ -1 +1 @@
1
- export declare const VERSION = "2.0.0-beta.78";
1
+ export declare const VERSION = "2.0.0-beta.79";
@@ -1 +1 @@
1
- export const VERSION = "2.0.0-beta.78";
1
+ export const VERSION = "2.0.0-beta.79";
@@ -1,7 +1,8 @@
1
1
  import { joinURL } from "ufo";
2
2
  import { createApp } from "vinxi";
3
+ import tsconfigPaths from "vite-tsconfig-paths";
3
4
  import { StatefulLog } from "../utils/stateful-log.js";
4
- import { corePlugins } from "./get-vite-config.js";
5
+ import { corePlugins, envPlugin } from "./get-vite-config.js";
5
6
  import { getVinxiFolder } from "./vinxi-codegen.js";
6
7
  export function createVinxiApp(args) {
7
8
  const log = args.log ?? new StatefulLog({ label: "Build" });
@@ -110,24 +111,25 @@ export function createVinxiApp(args) {
110
111
  base: joinURL(args.publicUrl, folderName),
111
112
  };
112
113
  }),
113
- // {
114
- // name: "data-api",
115
- // type: "http",
116
- // base: "/_data/",
117
- // handler: `${folder}/handler.data-api.ts`,
118
- // target: "server",
119
- // plugins: () => [
120
- // tsconfigPaths(),
121
- // envPlugin({
122
- // rootDir: args.rootDir,
123
- // console: log,
124
- // mode: args.mode,
125
- // publicUrl: args.publicUrl,
126
- // serverless: true,
127
- // target: "frontend",
128
- // }),
129
- // ],
130
- // },
114
+ {
115
+ name: "bypass-api",
116
+ type: "http",
117
+ base: "/_bypass/",
118
+ handler: `${folder}/handler.bypass.ts`,
119
+ target: "server",
120
+ plugins: () => [
121
+ tsconfigPaths(),
122
+ envPlugin({
123
+ rootDir: args.rootDir,
124
+ console: log,
125
+ mode: args.mode,
126
+ publicUrl: args.publicUrl,
127
+ serverless: true,
128
+ target: "frontend",
129
+ client: false,
130
+ }),
131
+ ],
132
+ },
131
133
  // {
132
134
  // name: "wp-proxy",
133
135
  // type: "http",
@@ -177,6 +177,36 @@ export function createVinxiCodegen(opts) {
177
177
  },
178
178
  });
179
179
  if (opts.serverless) {
180
+ codegen.registerFile({
181
+ name: "handler.bypass.ts",
182
+ generate: code /* tsx */ `
183
+ /// <reference types="vinxi/types/server" />
184
+ import { createRouter, eventHandler, getRouterParam, getQuery, getWebRequest, getRequestHeaders, getRequestURL } from "vinxi/http"
185
+ import { serverContext } from "./context.js"
186
+ const router = createRouter()
187
+ .get(
188
+ "/setBypassCookie/",
189
+ eventHandler(async (event) => {
190
+ const bypassToken = process.env.VERCEL_BYPASS_TOKEN
191
+ const cookieName = "__prerender_bypass"
192
+
193
+ setCookie(event, "eddev", "true", {
194
+ expires: new Date(Date.now() + 1000 * 60 * 60 * 24),
195
+ })
196
+
197
+ return {
198
+ status: 200,
199
+ headers: {
200
+ "content-type": "text/plain",
201
+ },
202
+ body: bypassToken,
203
+ }
204
+
205
+ }),
206
+ )
207
+ export default router.handler
208
+ `,
209
+ });
180
210
  // codegen.registerFile({
181
211
  // name: "handler.data-api.ts",
182
212
  // generate: code/* tsx */ `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.0.0-beta.78",
3
+ "version": "2.0.0-beta.79",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",