eddev 2.0.0-beta.14 → 2.0.0-beta.16
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.
- package/dist/app/lib/blocks/ContentBlocks.js +1 -1
- package/dist/app/lib/blocks/EditableText.js +1 -1
- package/dist/app/lib/blocks/inline-editing.js +1 -1
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +16 -16
- package/dist/app/lib/devtools/loader.js +2 -2
- package/dist/app/lib/hooks/queryUtils.d.ts +1 -1
- package/dist/app/lib/hooks/queryUtils.js +2 -2
- package/dist/app/lib/hooks/useAppData.js +1 -1
- package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
- package/dist/app/lib/routing/components/Link.js +2 -2
- package/dist/app/lib/routing/context.d.ts +4 -3
- package/dist/app/lib/routing/context.js +95 -0
- package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +1 -1
- package/dist/app/lib/routing/utils.js +1 -1
- package/dist/app/server/proxy-wp-admin.js +1 -2
- package/dist/app/server/render-ssr-page.d.ts +2 -1
- package/dist/app/server/render-ssr-page.js +3 -4
- package/dist/app/server/server-context.d.ts +4 -1
- package/dist/app/server/server-context.js +2 -0
- package/dist/node/cli/display/CLIApp.js +2 -5
- package/dist/node/cli/display/tools/cli-tools.d.ts +1 -1
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/get-vite-config.js +22 -6
- package/dist/node/compiler/vinxi-codegen.js +25 -17
- package/dist/node/project/manifest/view-manifest.js +1 -1
- package/dist/node/project/project.d.ts +1 -1
- package/dist/node/project/project.js +4 -4
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, createContext, memo, useContext, useMemo } from "react";
|
|
3
3
|
import { blockManifestReader } from "../internal/read-block-manifest.js";
|
|
4
|
-
import { addBlockMetadata } from "./block-utils.js";
|
|
5
4
|
import { ErrorBoundaryFrontend } from "./ErrorBoundaryFrontend.js";
|
|
6
5
|
import { InlineEditingContextProvider, ReadonlyInlineEditingProvider } from "./inline-editing.js";
|
|
6
|
+
import { addBlockMetadata } from "./block-utils.js";
|
|
7
7
|
export const BlocksContext = createContext(undefined);
|
|
8
8
|
/**
|
|
9
9
|
* Render a set of Gutenberg blocks
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRouter } from "../routing/
|
|
2
|
+
import { useRouter } from "../routing/hooks/useRouter.js";
|
|
3
3
|
import { useBlockAppender, useBlockContext, useValueStore } from "./inline-editing.js";
|
|
4
4
|
export function EditableText({ id, as, appendOnEnter, store, ...props }) {
|
|
5
5
|
if (env.admin) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
import { usePostEditor } from "./editor/usePostEditor.js";
|
|
4
|
-
import { useRoute } from "../routing/
|
|
4
|
+
import { useRoute } from "../routing/index.js";
|
|
5
5
|
import { addBlockMetadata } from "./block-utils.js";
|
|
6
6
|
const InlineEditingContext = createContext(undefined);
|
|
7
7
|
export function InlineEditingContextProvider(props) {
|
|
@@ -891,11 +891,8 @@ export declare function useTailwindConfig(): {
|
|
|
891
891
|
readonly fill?: boolean | undefined;
|
|
892
892
|
readonly display?: boolean | undefined;
|
|
893
893
|
readonly flex?: boolean | undefined;
|
|
894
|
-
readonly content?: boolean | undefined;
|
|
895
|
-
readonly size?: boolean | undefined;
|
|
896
|
-
readonly blur?: boolean | undefined;
|
|
897
|
-
readonly resize?: boolean | undefined;
|
|
898
894
|
readonly translate?: boolean | undefined;
|
|
895
|
+
readonly content?: boolean | undefined;
|
|
899
896
|
readonly height?: boolean | undefined;
|
|
900
897
|
readonly width?: boolean | undefined;
|
|
901
898
|
readonly cursor?: boolean | undefined;
|
|
@@ -913,6 +910,9 @@ export declare function useTailwindConfig(): {
|
|
|
913
910
|
readonly textDecoration?: boolean | undefined;
|
|
914
911
|
readonly transform?: boolean | undefined;
|
|
915
912
|
readonly visibility?: boolean | undefined;
|
|
913
|
+
readonly size?: boolean | undefined;
|
|
914
|
+
readonly blur?: boolean | undefined;
|
|
915
|
+
readonly resize?: boolean | undefined;
|
|
916
916
|
readonly preflight?: boolean | undefined;
|
|
917
917
|
readonly container?: boolean | undefined;
|
|
918
918
|
readonly accessibility?: boolean | undefined;
|
|
@@ -1936,11 +1936,8 @@ export declare function useTailwindConfig(): {
|
|
|
1936
1936
|
readonly fill?: boolean | undefined;
|
|
1937
1937
|
readonly display?: boolean | undefined;
|
|
1938
1938
|
readonly flex?: boolean | undefined;
|
|
1939
|
-
readonly content?: boolean | undefined;
|
|
1940
|
-
readonly size?: boolean | undefined;
|
|
1941
|
-
readonly blur?: boolean | undefined;
|
|
1942
|
-
readonly resize?: boolean | undefined;
|
|
1943
1939
|
readonly translate?: boolean | undefined;
|
|
1940
|
+
readonly content?: boolean | undefined;
|
|
1944
1941
|
readonly height?: boolean | undefined;
|
|
1945
1942
|
readonly width?: boolean | undefined;
|
|
1946
1943
|
readonly cursor?: boolean | undefined;
|
|
@@ -1958,6 +1955,9 @@ export declare function useTailwindConfig(): {
|
|
|
1958
1955
|
readonly textDecoration?: boolean | undefined;
|
|
1959
1956
|
readonly transform?: boolean | undefined;
|
|
1960
1957
|
readonly visibility?: boolean | undefined;
|
|
1958
|
+
readonly size?: boolean | undefined;
|
|
1959
|
+
readonly blur?: boolean | undefined;
|
|
1960
|
+
readonly resize?: boolean | undefined;
|
|
1961
1961
|
readonly preflight?: boolean | undefined;
|
|
1962
1962
|
readonly container?: boolean | undefined;
|
|
1963
1963
|
readonly accessibility?: boolean | undefined;
|
|
@@ -2956,11 +2956,8 @@ export declare function useTailwindConfig(): {
|
|
|
2956
2956
|
readonly fill?: boolean | undefined;
|
|
2957
2957
|
readonly display?: boolean | undefined;
|
|
2958
2958
|
readonly flex?: boolean | undefined;
|
|
2959
|
-
readonly content?: boolean | undefined;
|
|
2960
|
-
readonly size?: boolean | undefined;
|
|
2961
|
-
readonly blur?: boolean | undefined;
|
|
2962
|
-
readonly resize?: boolean | undefined;
|
|
2963
2959
|
readonly translate?: boolean | undefined;
|
|
2960
|
+
readonly content?: boolean | undefined;
|
|
2964
2961
|
readonly height?: boolean | undefined;
|
|
2965
2962
|
readonly width?: boolean | undefined;
|
|
2966
2963
|
readonly cursor?: boolean | undefined;
|
|
@@ -2978,6 +2975,9 @@ export declare function useTailwindConfig(): {
|
|
|
2978
2975
|
readonly textDecoration?: boolean | undefined;
|
|
2979
2976
|
readonly transform?: boolean | undefined;
|
|
2980
2977
|
readonly visibility?: boolean | undefined;
|
|
2978
|
+
readonly size?: boolean | undefined;
|
|
2979
|
+
readonly blur?: boolean | undefined;
|
|
2980
|
+
readonly resize?: boolean | undefined;
|
|
2981
2981
|
readonly preflight?: boolean | undefined;
|
|
2982
2982
|
readonly container?: boolean | undefined;
|
|
2983
2983
|
readonly accessibility?: boolean | undefined;
|
|
@@ -4001,11 +4001,8 @@ export declare function useTailwindConfig(): {
|
|
|
4001
4001
|
readonly fill?: boolean | undefined;
|
|
4002
4002
|
readonly display?: boolean | undefined;
|
|
4003
4003
|
readonly flex?: boolean | undefined;
|
|
4004
|
-
readonly content?: boolean | undefined;
|
|
4005
|
-
readonly size?: boolean | undefined;
|
|
4006
|
-
readonly blur?: boolean | undefined;
|
|
4007
|
-
readonly resize?: boolean | undefined;
|
|
4008
4004
|
readonly translate?: boolean | undefined;
|
|
4005
|
+
readonly content?: boolean | undefined;
|
|
4009
4006
|
readonly height?: boolean | undefined;
|
|
4010
4007
|
readonly width?: boolean | undefined;
|
|
4011
4008
|
readonly cursor?: boolean | undefined;
|
|
@@ -4023,6 +4020,9 @@ export declare function useTailwindConfig(): {
|
|
|
4023
4020
|
readonly textDecoration?: boolean | undefined;
|
|
4024
4021
|
readonly transform?: boolean | undefined;
|
|
4025
4022
|
readonly visibility?: boolean | undefined;
|
|
4023
|
+
readonly size?: boolean | undefined;
|
|
4024
|
+
readonly blur?: boolean | undefined;
|
|
4025
|
+
readonly resize?: boolean | undefined;
|
|
4026
4026
|
readonly preflight?: boolean | undefined;
|
|
4027
4027
|
readonly container?: boolean | undefined;
|
|
4028
4028
|
readonly accessibility?: boolean | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { dynamic } from "../dynamic/
|
|
3
|
+
import { dynamic } from "../dynamic/dynamic.js";
|
|
4
4
|
import { usePersistState } from "./hooks/usePersistState.js";
|
|
5
|
-
import { useIsSSR } from "../routing/
|
|
5
|
+
import { useIsSSR } from "../routing/hooks/useIsSSR.js";
|
|
6
6
|
const DevUI = dynamic(() => import("./components/DevUI.js"));
|
|
7
7
|
export function DevUILoader() {
|
|
8
8
|
const ssr = useIsSSR();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchQueryOptions,
|
|
1
|
+
import { FetchQueryOptions, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryResult, UseInfiniteQueryResult, UndefinedInitialDataInfiniteOptions } from "@tanstack/react-query";
|
|
2
2
|
type OptionalMaybes<T> = T extends any[] ? T : T extends {
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
} ? {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useMutation, useQuery, useInfiniteQuery, } from "@tanstack/react-query";
|
|
3
2
|
import { joinURL } from "ufo";
|
|
4
3
|
import { getQueryClient } from "../../utils/query-client.js";
|
|
5
4
|
import { useAPIConfig } from "./apiConfig.js";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
6
|
function createQueryError(messages, statusCode) {
|
|
7
7
|
const error = new Error(messages.join(", "));
|
|
8
8
|
error.statusCode = statusCode;
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
3
|
import { parseURL, resolveURL, withoutTrailingSlash } from "ufo";
|
|
4
4
|
import { useIsSSR } from "../hooks/useIsSSR.js";
|
|
5
|
-
import { useRoute } from "../hooks/useRoute.js";
|
|
6
5
|
import { useRouter } from "../hooks/useRouter.js";
|
|
7
|
-
import { useRouterState } from "../hooks/useRouterState.js";
|
|
8
6
|
import { isSameOrigin } from "../utils.js";
|
|
7
|
+
import { useRoute } from "../hooks/useRoute.js";
|
|
8
|
+
import { useRouterState } from "../hooks/useRouterState.js";
|
|
9
9
|
export const Link = forwardRef((props, ref) => {
|
|
10
10
|
const Comp = props.as || "a";
|
|
11
11
|
if (env.admin) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Context } from "react";
|
|
1
2
|
import { RouterAPI, RouterAPIState } from "./types.js";
|
|
2
|
-
export declare const RouterContext:
|
|
3
|
-
export declare const RouterStateContext:
|
|
4
|
-
export declare const RouteItemContext:
|
|
3
|
+
export declare const RouterContext: Context<RouterAPI>;
|
|
4
|
+
export declare const RouterStateContext: Context<RouterAPIState>;
|
|
5
|
+
export declare const RouteItemContext: Context<import("./types.js").TypedRouteState<"_unknown", {}>>;
|
|
@@ -32,3 +32,98 @@ export const RouterStateContext = createContext({
|
|
|
32
32
|
blockers: [],
|
|
33
33
|
});
|
|
34
34
|
export const RouteItemContext = createContext(NOOP_ROUTE);
|
|
35
|
+
// type StoreHook<State> = <Slice = State>(
|
|
36
|
+
// selector?: (state: State) => Slice,
|
|
37
|
+
// areEqual?: (a: Slice, b: Slice) => boolean,
|
|
38
|
+
// ) => Slice
|
|
39
|
+
// type Store<T> = {
|
|
40
|
+
// subscribe(sub: (value: T) => void): () => void
|
|
41
|
+
// value: T
|
|
42
|
+
// update(next: T): void
|
|
43
|
+
// }
|
|
44
|
+
// function createStore<T>(initial: T): Store<T> {
|
|
45
|
+
// let value = initial
|
|
46
|
+
// const subscribers = new Set<(value: T) => void>()
|
|
47
|
+
// return {
|
|
48
|
+
// subscribe(sub: (value: T) => void) {
|
|
49
|
+
// subscribers.add(sub)
|
|
50
|
+
// return () => {
|
|
51
|
+
// subscribers.delete(sub)
|
|
52
|
+
// }
|
|
53
|
+
// },
|
|
54
|
+
// get value() {
|
|
55
|
+
// return value
|
|
56
|
+
// },
|
|
57
|
+
// update(nextValue: T) {
|
|
58
|
+
// value = nextValue
|
|
59
|
+
// if (subscribers.size) {
|
|
60
|
+
// console.log("UPDATE", value)
|
|
61
|
+
// startTransition(() => {
|
|
62
|
+
// for (let sub of subscribers) {
|
|
63
|
+
// sub(value)
|
|
64
|
+
// }
|
|
65
|
+
// })
|
|
66
|
+
// }
|
|
67
|
+
// },
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
// export function createStoreHook<T>(store: Store<T>): StoreHook<T> {
|
|
71
|
+
// const hook = (selector: any) => {
|
|
72
|
+
// const get = () => (selector ? selector(store.value) : store.value)
|
|
73
|
+
// return useSyncExternalStore(store.subscribe, get, get)
|
|
74
|
+
// }
|
|
75
|
+
// return hook as StoreHook<T>
|
|
76
|
+
// }
|
|
77
|
+
// export function createStoreContextHook<T>(ctx: Context<Store<T>>): StoreHook<T> {
|
|
78
|
+
// const hook = (selector: any) => {
|
|
79
|
+
// const store = useContext(ctx)
|
|
80
|
+
// const get = () => (selector ? selector(store.value) : store.value)
|
|
81
|
+
// return useSyncExternalStore(store.subscribe, get, get)
|
|
82
|
+
// }
|
|
83
|
+
// return hook as StoreHook<T>
|
|
84
|
+
// }
|
|
85
|
+
// export const RouterContext = createContext<Store<RouterAPI>>(null!)
|
|
86
|
+
// export const RouterStateContext = createContext<Store<RouterAPIState>>(null!)
|
|
87
|
+
// export const RouteContext = createContext<Store<RouteState>>(null!)
|
|
88
|
+
// const NOOP_ROUTE: RouteState = {
|
|
89
|
+
// component: () => null,
|
|
90
|
+
// id: "initial",
|
|
91
|
+
// hash: "",
|
|
92
|
+
// key: "initial",
|
|
93
|
+
// pathname: "",
|
|
94
|
+
// props: {},
|
|
95
|
+
// uri: "",
|
|
96
|
+
// view: "_unknown",
|
|
97
|
+
// search: "",
|
|
98
|
+
// query: {},
|
|
99
|
+
// returnState: undefined,
|
|
100
|
+
// }
|
|
101
|
+
// export const createRouteItemStore = (initial?: RouteState) => {
|
|
102
|
+
// return createStore<RouteState>(initial ?? NOOP_ROUTE)
|
|
103
|
+
// }
|
|
104
|
+
// export function createRouterAPIStore(initial?: RouterAPI) {
|
|
105
|
+
// return createStore<RouterAPI>(
|
|
106
|
+
// initial ?? {
|
|
107
|
+
// loader: new RouteLoader(),
|
|
108
|
+
// async navigate(url) {},
|
|
109
|
+
// async prefetch(url) {},
|
|
110
|
+
// async preload(url) {},
|
|
111
|
+
// subscribe(fn) {
|
|
112
|
+
// return () => {}
|
|
113
|
+
// },
|
|
114
|
+
// replaceHash(hash) {},
|
|
115
|
+
// replaceQuery(query) {},
|
|
116
|
+
// handleClickEvent(e, originalHref) {},
|
|
117
|
+
// emitEvent(event) {},
|
|
118
|
+
// },
|
|
119
|
+
// )
|
|
120
|
+
// }
|
|
121
|
+
// export function createRouterStateStore(initial?: RouterAPIState) {
|
|
122
|
+
// return createStore<RouterAPIState>(
|
|
123
|
+
// initial ?? {
|
|
124
|
+
// history: [],
|
|
125
|
+
// activeRoute: NOOP_ROUTE,
|
|
126
|
+
// blockers: [],
|
|
127
|
+
// },
|
|
128
|
+
// )
|
|
129
|
+
// }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useRouterEvents } from "./useRouterEvents.js";
|
|
3
|
+
import { useRoute } from "./useRoute.js";
|
|
3
4
|
/**
|
|
4
5
|
* Works exactly like useState, but allows back and forward navigation to restore the previous state.
|
|
5
6
|
* You must pass a unique ID as an additional first parameter to ensure the state is restored correctly.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RouteState } from "../types.js";
|
|
1
|
+
import type { RouteState } from "../types.js";
|
|
2
2
|
export declare function useRoute(): RouteState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parse as qsParse, stringify as qsStringify } from "qs";
|
|
2
1
|
import { parseURL, resolveURL, stringifyParsedURL, withoutTrailingSlash } from "ufo";
|
|
2
|
+
import { stringify as qsStringify, parse as qsParse } from "qs";
|
|
3
3
|
export function isSameOrigin(url) {
|
|
4
4
|
if (typeof document === "undefined") {
|
|
5
5
|
return url.startsWith("/");
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="vinxi/types/server" />
|
|
2
2
|
import { splitSetCookieString } from "cookie-es";
|
|
3
3
|
import { getProxyRequestHeaders, getRequestURL, getWebRequest } from "vinxi/http";
|
|
4
|
-
import { getManifest } from "vinxi/manifest";
|
|
5
4
|
export async function proxyWpAdmin(event, serverContext) {
|
|
6
5
|
const replaceUrls = serverContext.replaceUrls;
|
|
7
6
|
const req = getWebRequest(event);
|
|
@@ -51,7 +50,7 @@ export async function proxyWpAdmin(event, serverContext) {
|
|
|
51
50
|
}
|
|
52
51
|
// If the content type is text/html, inject the Vite assets into the response — assuming the placeholder comments are found
|
|
53
52
|
if (contentType.startsWith("text/html")) {
|
|
54
|
-
const clientManifest = getManifest("admin");
|
|
53
|
+
const clientManifest = serverContext.getManifest("admin");
|
|
55
54
|
const assets = await clientManifest.inputs[clientManifest.handler].assets();
|
|
56
55
|
body = body.replace("<!---VITE_HEADER--->", () => assets.map((asset) => renderAsset(asset)).join("\n"));
|
|
57
56
|
body = body.replace("<!---VITE_FOOTER--->", () => renderAsset({
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { RouteData } from "../lib/routing/types.js";
|
|
2
|
-
|
|
2
|
+
import { ServerContext } from "./server-context.js";
|
|
3
|
+
export declare function renderPageToSSRStream(pathname: string, initialData: RouteData, serverContext: ServerContext): Promise<unknown>;
|
|
@@ -2,11 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { renderAsset } from "@vinxi/react";
|
|
3
3
|
import { Suspense } from "react";
|
|
4
4
|
import { renderToPipeableStream } from "react-dom/server";
|
|
5
|
-
import { getManifest } from "vinxi/manifest";
|
|
6
5
|
import { SSRRoot } from "../entry/ssr-root.js";
|
|
7
6
|
import { RouteLoader } from "../lib/routing/loader.js";
|
|
8
|
-
export async function renderPageToSSRStream(pathname, initialData) {
|
|
9
|
-
const clientManifest = getManifest("client");
|
|
7
|
+
export async function renderPageToSSRStream(pathname, initialData, serverContext) {
|
|
8
|
+
const clientManifest = serverContext.getManifest("client");
|
|
10
9
|
const assets = await clientManifest.inputs[clientManifest.handler].assets();
|
|
11
10
|
const jsx = (_jsx(SSRRoot, { assets: _jsx(Suspense, { children: assets.map((m) => renderAsset(m)) }), pathname: pathname, initialData: initialData, loader: new RouteLoader() }));
|
|
12
11
|
const stream = await new Promise(async (resolve) => {
|
|
@@ -15,7 +14,7 @@ export async function renderPageToSSRStream(pathname, initialData) {
|
|
|
15
14
|
resolve(stream);
|
|
16
15
|
},
|
|
17
16
|
bootstrapModules: [clientManifest.inputs[clientManifest.handler].output.path],
|
|
18
|
-
bootstrapScriptContent: `window.manifest = ${JSON.stringify(
|
|
17
|
+
bootstrapScriptContent: `window.manifest = ${JSON.stringify(clientManifest.json())}; window._PAGE_DATA = ${JSON.stringify(initialData)}`,
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
20
|
return stream;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { UrlReplacerConf } from "./utils/replace-host.js";
|
|
2
1
|
import { RequestHeaders } from "vinxi/http";
|
|
2
|
+
import { UrlReplacerConf } from "./utils/replace-host.js";
|
|
3
|
+
import { Manifest } from "vinxi/dist/types/types/manifest";
|
|
3
4
|
export type ServerContextArgs = {
|
|
4
5
|
dev: boolean;
|
|
5
6
|
origin: string;
|
|
7
|
+
getManifest: (name: string) => Manifest;
|
|
6
8
|
replaceUrls?: UrlReplacerConf;
|
|
7
9
|
};
|
|
8
10
|
export declare class ServerContext {
|
|
9
11
|
dev: boolean;
|
|
10
12
|
origin: string;
|
|
13
|
+
getManifest: (name: string) => Manifest;
|
|
11
14
|
replaceUrls?: (text: string) => string;
|
|
12
15
|
constructor(conf: ServerContextArgs);
|
|
13
16
|
getOriginUrl(url: string): string;
|
|
@@ -15,10 +15,12 @@ const PROXY_REQUEST_HEADERS = [
|
|
|
15
15
|
export class ServerContext {
|
|
16
16
|
dev;
|
|
17
17
|
origin;
|
|
18
|
+
getManifest;
|
|
18
19
|
replaceUrls;
|
|
19
20
|
constructor(conf) {
|
|
20
21
|
this.dev = conf.dev;
|
|
21
22
|
this.origin = conf.origin;
|
|
23
|
+
this.getManifest = conf.getManifest;
|
|
22
24
|
if (conf.replaceUrls) {
|
|
23
25
|
this.replaceUrls = createUrlReplacer(conf.replaceUrls);
|
|
24
26
|
}
|
|
@@ -83,17 +83,14 @@ function MainMenu(props) {
|
|
|
83
83
|
else if (key.return) {
|
|
84
84
|
const match = matches[focusIndex];
|
|
85
85
|
if (match) {
|
|
86
|
-
props.onSelect(match.tool.id)
|
|
86
|
+
// props.onSelect(match.tool.id)
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
return (_jsx(Panel, { label: "Main Menu", icon: "\u25C8", color: "yellow", info: "[ESC] to close", children: _jsxs(Box, { width: "100%", flexDirection: "column", paddingX: 1, paddingY: 0, children: [_jsxs(Box, { gap: 1, flexDirection: "row", children: [_jsx(Text, { color: "whiteBright", children: "What would you like to do?" }), _jsx(Text, { color: "gray", children: "[ESC] to close" })] }), _jsxs(Box, { paddingBottom: 1, children: [_jsx(Text, { color: "white", children: "> " }), _jsx(TextInput, { value: search, onChange: (value) => {
|
|
91
91
|
setSearch(value);
|
|
92
92
|
setFocusIndex(0);
|
|
93
|
-
}, showCursor: true, focus: true, placeholder: "Search..." })] }), matches.length === 0 ? _jsx(Text, { color: "redBright", children: "😓 No results" }) : null
|
|
94
|
-
const focused = focusIndex === index;
|
|
95
|
-
return (_jsxs(Box, { children: [_jsx(Box, { width: 3, children: _jsx(Text, { children: focused ? "👉" : "" }) }), _jsxs(Box, { children: [_jsx(Text, { color: focused ? "yellow" : "white", children: item.tool.name }), _jsx(Text, { children: String(item.score) })] })] }, item.tool.id));
|
|
96
|
-
})] }) }));
|
|
93
|
+
}, showCursor: true, focus: true, placeholder: "Search..." })] }), matches.length === 0 ? _jsx(Text, { color: "redBright", children: "😓 No results" }) : null] }) }));
|
|
97
94
|
}
|
|
98
95
|
function MiniLog({ log, border }) {
|
|
99
96
|
const color = statusColor(log.status);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.16";
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.16";
|
|
@@ -85,8 +85,29 @@ export function ssrPlugin() {
|
|
|
85
85
|
name: "proxy-external-ssr-modules",
|
|
86
86
|
config(config) {
|
|
87
87
|
config.legacy = {
|
|
88
|
+
...config.legacy,
|
|
88
89
|
proxySsrExternalModules: true,
|
|
89
90
|
};
|
|
91
|
+
// config.ssr = {
|
|
92
|
+
// ...config.ssr,
|
|
93
|
+
// noExternal: ["eddev", ...(config?.optimizeDeps?.noExternal ?? [])],
|
|
94
|
+
// // optimizeDeps: {
|
|
95
|
+
// // include: ["eddev", "vinxi"],
|
|
96
|
+
// // },
|
|
97
|
+
// }
|
|
98
|
+
config.optimizeDeps = {
|
|
99
|
+
...config.optimizeDeps,
|
|
100
|
+
include: [
|
|
101
|
+
"valtio",
|
|
102
|
+
"zustand",
|
|
103
|
+
"@tanstack/react-query",
|
|
104
|
+
"qs",
|
|
105
|
+
"react",
|
|
106
|
+
"react-dom/client",
|
|
107
|
+
...(config?.optimizeDeps?.include ?? []),
|
|
108
|
+
],
|
|
109
|
+
exclude: ["eddev", ...(config?.optimizeDeps?.exclude ?? [])],
|
|
110
|
+
};
|
|
90
111
|
return config;
|
|
91
112
|
},
|
|
92
113
|
};
|
|
@@ -113,12 +134,7 @@ function buildStatusPlugin(console) {
|
|
|
113
134
|
};
|
|
114
135
|
}
|
|
115
136
|
export function corePlugins(args) {
|
|
116
|
-
return [
|
|
117
|
-
tsconfigPaths(),
|
|
118
|
-
reactPlugin(),
|
|
119
|
-
args.mode === "development" && args.serverless && ssrPlugin(),
|
|
120
|
-
envPlugin(args),
|
|
121
|
-
].flat();
|
|
137
|
+
return [tsconfigPaths(), reactPlugin(), args.serverless && ssrPlugin(), envPlugin(args)].flat();
|
|
122
138
|
}
|
|
123
139
|
export function getViteConfig(args) {
|
|
124
140
|
const console = args.console;
|
|
@@ -17,22 +17,30 @@ export function createVinxiCodegen(opts) {
|
|
|
17
17
|
if (opts.serverless) {
|
|
18
18
|
codegen.registerFile({
|
|
19
19
|
name: "context.ts",
|
|
20
|
-
generate:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
generate: () => {
|
|
21
|
+
const args = {
|
|
22
|
+
dev: true,
|
|
23
|
+
origin: project.origin,
|
|
24
|
+
replaceUrls: {
|
|
25
|
+
from: project.origin,
|
|
26
|
+
to: opts.endpoint ?? "",
|
|
27
|
+
prefixes: [
|
|
28
|
+
{ prefix: "/wp-content/uploads", replace: project.config?.serverless.uploads === "proxy" },
|
|
29
|
+
{ prefix: "/wp-content/plugins", replace: project.config?.serverless.plugins === "proxy" },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
return code /* tsx */ `
|
|
34
|
+
import { ServerContext } from "eddev/server"
|
|
35
|
+
import { getManifest } from "vinxi/manifest"
|
|
36
|
+
|
|
37
|
+
export const serverContext = new ServerContext({${Object.entries(args)
|
|
38
|
+
.map(([key, value]) => `${key}: ${JSON.stringify(value)}`)
|
|
39
|
+
.join(",\n")},
|
|
40
|
+
getManifest
|
|
41
|
+
})
|
|
42
|
+
`.toString();
|
|
43
|
+
},
|
|
36
44
|
});
|
|
37
45
|
}
|
|
38
46
|
if (opts.serverless) {
|
|
@@ -238,7 +246,7 @@ export function createVinxiCodegen(opts) {
|
|
|
238
246
|
if (response.ok) {
|
|
239
247
|
setResponseStatus(event, response.status)
|
|
240
248
|
setResponseHeader(event, "Content-Type", "text/html; charset=utf-8")
|
|
241
|
-
return renderPageToSSRStream(url.pathname, await response.json())
|
|
249
|
+
return renderPageToSSRStream(url.pathname, await response.json(), serverContext)
|
|
242
250
|
} else {
|
|
243
251
|
return response
|
|
244
252
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { basename } from "node:path";
|
|
2
2
|
import { cliMode } from "../../cli/cli-mode.js";
|
|
3
3
|
import { ViewMetaSchema } from "../../types/view-type.js";
|
|
4
|
-
import { metaExtractor } from "../../utils/ts-export-extractor.js";
|
|
5
4
|
import { formatZodError } from "../../utils/format-zod-error.js";
|
|
6
5
|
import { fs } from "../../utils/fs.js";
|
|
6
|
+
import { metaExtractor } from "../../utils/ts-export-extractor.js";
|
|
7
7
|
import { createManifestGenerator } from "./manifest.js";
|
|
8
8
|
export function loadViewManifest(project) {
|
|
9
9
|
return createManifestGenerator({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EDConfig } from "./config.js";
|
|
2
2
|
import { BlockManifestGenerator } from "./manifest/block-manifest.js";
|
|
3
|
-
import { ViewManifestGenerator } from "./manifest/view-manifest.js";
|
|
4
3
|
import { FieldManifestGenerator } from "./manifest/field-manifest.js";
|
|
4
|
+
import { ViewManifestGenerator } from "./manifest/view-manifest.js";
|
|
5
5
|
import { WidgetManifestGenerator } from "./manifest/widget-manifest.js";
|
|
6
6
|
export declare const projectLog: import("../utils/stateful-log.js").StatefulLog<Project>;
|
|
7
7
|
type ProjectArgs = {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { objFormat } from "obj-console";
|
|
1
2
|
import { relative, resolve } from "path";
|
|
2
3
|
import { undent } from "undent";
|
|
3
|
-
import { objFormat } from "obj-console";
|
|
4
4
|
import { getRepoInfo } from "../utils/get-repo-info.js";
|
|
5
5
|
import { isDeploying } from "../utils/is-deploying.js";
|
|
6
6
|
import { createConsole } from "../utils/stateful-log.js";
|
|
7
7
|
import { Configurator } from "./config.js";
|
|
8
|
-
import { loadBlockManifest } from "./manifest/block-manifest.js";
|
|
9
|
-
import { loadViewManifest } from "./manifest/view-manifest.js";
|
|
10
|
-
import { WPInfo } from "./wp-info.js";
|
|
11
8
|
import { ProjectEnvUtils } from "./env.js";
|
|
9
|
+
import { loadBlockManifest } from "./manifest/block-manifest.js";
|
|
12
10
|
import { loadFieldManifest } from "./manifest/field-manifest.js";
|
|
11
|
+
import { loadViewManifest } from "./manifest/view-manifest.js";
|
|
13
12
|
import { loadWidgetManifest } from "./manifest/widget-manifest.js";
|
|
13
|
+
import { WPInfo } from "./wp-info.js";
|
|
14
14
|
const console = createConsole("Project", "project");
|
|
15
15
|
export const projectLog = console;
|
|
16
16
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"@types/node": "^20.9.0",
|
|
119
119
|
"@types/react": "^18.3.3",
|
|
120
120
|
"@types/react-dom": "^18.3.0",
|
|
121
|
+
"typescript": "^5.5.2",
|
|
121
122
|
"@types/wordpress__blocks": "^12.5.13",
|
|
122
123
|
"@types/wordpress__components": "^23.0.11",
|
|
123
124
|
"@types/wordpress__editor": "^13.6.7",
|
|
124
|
-
"@types/wordpress__hooks": "^2.11.0"
|
|
125
|
-
"typescript": "^5.5.2"
|
|
125
|
+
"@types/wordpress__hooks": "^2.11.0"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"react": "^18.3.1",
|