eddev 2.3.18 → 2.3.20
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/EditableText.d.ts +2 -0
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -1
- package/dist/app/lib/blocks/EditableText.js +8 -2
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts.map +1 -1
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +16 -0
- package/dist/app/lib/blocks/editor/useBlockLabel.d.ts +2 -0
- package/dist/app/lib/blocks/editor/useBlockLabel.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/useBlockLabel.js +8 -0
- package/dist/app/lib/blocks/index.d.ts +1 -0
- package/dist/app/lib/blocks/index.d.ts.map +1 -1
- package/dist/app/lib/blocks/index.js +1 -0
- package/dist/app/lib/blocks/inline-editing.d.ts +3 -0
- package/dist/app/lib/blocks/inline-editing.d.ts.map +1 -1
- package/dist/app/lib/blocks/inline-editing.js +8 -0
- package/dist/app/lib/dynamic/dynamic.js +2 -2
- package/dist/app/lib/hooks/query-hooks.d.ts +7 -6
- package/dist/app/lib/hooks/query-hooks.d.ts.map +1 -1
- package/dist/app/lib/hooks/query-hooks.js +25 -23
- package/dist/app/server/render-ssr-page.d.ts.map +1 -1
- package/dist/app/server/render-ssr-page.js +11 -7
- package/dist/app/utils/query-client.d.ts +1 -0
- package/dist/app/utils/query-client.d.ts.map +1 -1
- package/dist/app/utils/query-client.js +42 -9
- package/dist/app/utils/ssr-response-data.d.ts +13 -0
- package/dist/app/utils/ssr-response-data.d.ts.map +1 -0
- package/dist/app/utils/ssr-response-data.js +14 -0
- package/dist/app/utils/trpc-client.d.ts.map +1 -1
- package/dist/app/utils/trpc-client.js +32 -36
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/get-vite-config.d.ts.map +1 -1
- package/dist/node/compiler/get-vite-config.js +4 -4
- package/dist/node/compiler/vinxi-app.d.ts.map +1 -1
- package/dist/node/compiler/vinxi-app.js +1 -0
- package/dist/node/project/eddev-build-file.d.ts.map +1 -1
- package/dist/node/project/eddev-build-file.js +3 -1
- package/dist/node/project/manifest/block-manifest.js +1 -0
- package/dist/node/types/block-type.d.ts +19 -0
- package/dist/node/types/block-type.d.ts.map +1 -1
- package/dist/node/types/block-type.js +1 -0
- package/package.json +1 -1
- package/types.env.d.ts +92 -5
- package/types.meta.d.ts +35 -8
- package/dist/app/utils/asset-capture.d.ts +0 -3
- package/dist/app/utils/asset-capture.d.ts.map +0 -1
- package/dist/app/utils/asset-capture.js +0 -5
|
@@ -41,6 +41,8 @@ type Props<T extends ElementType> = {
|
|
|
41
41
|
removeOnDelete?: boolean;
|
|
42
42
|
/** An optional placeholder to indicate a typable area */
|
|
43
43
|
placeholder?: string | null;
|
|
44
|
+
/** Automatically set the block name based on this store value */
|
|
45
|
+
asBlockName?: boolean;
|
|
44
46
|
} & {
|
|
45
47
|
/**
|
|
46
48
|
* The 'key' of this editable text value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableText.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/EditableText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA0C,MAAM,OAAO,CAAA;AAE3E,OAAO,EAAE,gBAAgB,EAAoD,MAAM,qBAAqB,CAAA;AAGxG,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;AAE3D,KAAK,cAAc,GACf,WAAW,GACX,WAAW,GACX,aAAa,GACb,WAAW,GACX,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,yBAAyB,GACzB,eAAe,CAAA;AAEnB,KAAK,KAAK,CAAC,CAAC,SAAS,WAAW,IAAI;IAClC,4CAA4C;IAC5C,EAAE,CAAC,EAAE,CAAC,CAAA;IACN,uDAAuD;IACvD,iBAAiB,CAA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;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACxC;;;QAGI;IACJ,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAChC;;;QAGI;IACJ,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,GAAG;IACF;;;;QAII;IACJ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;;;;QAKI;IACJ,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAA;CACrC,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,aAAa,CAAC,GAChF,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAA;AAEhD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,CAAC,SAAS,OAAO,GAAG,EAAE,GAAG;IAAE,MAAM,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,GAAG,EAAE,CAAA;AAEjG,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,EAAE,EAClD,EAAE,EACF,EAAE,EACF,aAAa,EACb,cAAc,EACd,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,CAAC,CAAC,sCAmHV"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useRef } from "react";
|
|
2
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { useRouter } from "../routing/hooks/useRouter.js";
|
|
4
4
|
import { useBlockAppender, useBlockContext, useValueStore } from "./inline-editing.js";
|
|
5
5
|
import { resolveAcfBlockName } from "./editor/block-templates.js";
|
|
6
6
|
export function EditableText({ id, as, appendOnEnter, removeOnDelete, plainText, store, ...props }) {
|
|
7
7
|
if (env.admin) {
|
|
8
|
-
const
|
|
8
|
+
const ctx = useBlockContext();
|
|
9
|
+
const readOnly = ctx?.readonly;
|
|
9
10
|
if (!readOnly) {
|
|
10
11
|
const ref = useRef(null);
|
|
11
12
|
const [value, setValue] = useValueStore(store ?? id);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (props.asBlockName) {
|
|
15
|
+
ctx?.setBlockLabel(value || props.defaultValue || props.placeholder || "");
|
|
16
|
+
}
|
|
17
|
+
}, [props.asBlockName, value || props.defaultValue || props.placeholder]);
|
|
12
18
|
// useEffect(() => {
|
|
13
19
|
// if ((plainText || props.allowedFormats?.length === 0) && ref.current && !!value) {
|
|
14
20
|
// const placeholder = ref.current.querySelector("[data-rich-text-placeholder]")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installGutenbergHooks.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/installGutenbergHooks.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,oBAAoB;;CAAgC,CAAA;AAEjE,wBAAgB,iBAAiB,kBAsBhC;AAED,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"installGutenbergHooks.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/installGutenbergHooks.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,oBAAoB;;CAAgC,CAAA;AAEjE,wBAAgB,iBAAiB,kBAsBhC;AAED,wBAAgB,uBAAuB,SAyVtC"}
|
|
@@ -134,6 +134,8 @@ export function installEDGutenbergHooks() {
|
|
|
134
134
|
return null;
|
|
135
135
|
return (_jsx(InlineEditingContextProvider, { values: props.attributes.inline || {}, innerBlocks: children, block: [props.name, props], editorBlock: block, index: index ?? -1, onChange: (attrs) => {
|
|
136
136
|
props.setAttributes({ ...props.attributes, inline: attrs });
|
|
137
|
+
}, onChangeMetadata: (meta) => {
|
|
138
|
+
props.setAttributes({ ...props.attributes, metadata: { ...(props.attributes.metadata ?? {}), ...meta } });
|
|
137
139
|
}, insertBlocksAfter: props.insertBlocksAfter, clientId: props.clientId, children: _createElement(BlockEdit, { ...props, key: "edit" }) }));
|
|
138
140
|
};
|
|
139
141
|
}, "withMyPluginControls");
|
|
@@ -225,6 +227,20 @@ export function installEDGutenbergHooks() {
|
|
|
225
227
|
}
|
|
226
228
|
item.attributes.isFromTemplate = { type: "boolean" };
|
|
227
229
|
item.supports.customClassName = false;
|
|
230
|
+
item.supports.className = false;
|
|
231
|
+
item.supports.style = false;
|
|
232
|
+
item.supports.customCSS = false;
|
|
233
|
+
item.supports = {
|
|
234
|
+
...item.supports,
|
|
235
|
+
};
|
|
236
|
+
// item.supports.listView = true
|
|
237
|
+
// item.supports.anchor = true
|
|
238
|
+
// if (name === "acf/cards-hero-card-item") {
|
|
239
|
+
// console.log("Support before", item.supports.anchor)
|
|
240
|
+
// item.supports.anchor = true
|
|
241
|
+
// // Object.assign(item.supports, blockMetaDescriptors.get(name)?.supports ?? {})
|
|
242
|
+
// // console.log("Support after", { ...item.supports })
|
|
243
|
+
// }
|
|
228
244
|
item.edit = function (props) {
|
|
229
245
|
const self = this;
|
|
230
246
|
useEffect(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBlockLabel.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/useBlockLabel.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,QAK5D"}
|
|
@@ -6,6 +6,7 @@ export * from "./editor/controls.js";
|
|
|
6
6
|
export * from "./editor/create-block.js";
|
|
7
7
|
export { defineEditorConfig, type BlockWrapperClassGenerator, type BlockWrapperGenerator } from "./editor/editor-config.js";
|
|
8
8
|
export * from "./editor/usePostEditor.js";
|
|
9
|
+
export * from "./editor/useBlockLabel.js";
|
|
9
10
|
export { useBlockContext, useInlineEditableValue, useInnerBlocks, useTemplate, useBlockSelection, useBlockParentProps, } from "./inline-editing.js";
|
|
10
11
|
export * from "./InnerBlocks.js";
|
|
11
12
|
export * from "./SlotBlocks.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,KAAK,0BAA0B,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAC3H,cAAc,2BAA2B,CAAA;AACzC,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,KAAK,0BAA0B,EAAE,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAC3H,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -6,6 +6,7 @@ export * from "./editor/controls.js";
|
|
|
6
6
|
export * from "./editor/create-block.js";
|
|
7
7
|
export { defineEditorConfig } from "./editor/editor-config.js";
|
|
8
8
|
export * from "./editor/usePostEditor.js";
|
|
9
|
+
export * from "./editor/useBlockLabel.js";
|
|
9
10
|
export { useBlockContext, useInlineEditableValue, useInnerBlocks, useTemplate, useBlockSelection, useBlockParentProps, } from "./inline-editing.js";
|
|
10
11
|
export * from "./InnerBlocks.js";
|
|
11
12
|
export * from "./SlotBlocks.js";
|
|
@@ -20,6 +20,8 @@ export type InlineEditingContext = {
|
|
|
20
20
|
index: number;
|
|
21
21
|
setValue(key: string, value: any): any;
|
|
22
22
|
getValue(key: string): any;
|
|
23
|
+
setBlockLabel(label: string | undefined): any;
|
|
24
|
+
getBlockLabel(): any;
|
|
23
25
|
insertBlocksAfter?: (block: any) => void;
|
|
24
26
|
readonly?: boolean;
|
|
25
27
|
clientId?: string;
|
|
@@ -33,6 +35,7 @@ type ProviderProps = PropsWithChildren<{
|
|
|
33
35
|
editorBlock?: BlockInstance;
|
|
34
36
|
index: number;
|
|
35
37
|
onChange?: (attrs: Attributes) => void;
|
|
38
|
+
onChangeMetadata?: (data: Record<string, any>) => void;
|
|
36
39
|
insertBlocksAfter?: (block: any) => void;
|
|
37
40
|
readonly?: boolean;
|
|
38
41
|
clientId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-editing.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/blocks/inline-editing.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAA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,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAC,CAAA;AAEF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,aAAa,+BAgDhE;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,+BAazE;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAQ5F;AAED;;;IAGI;AACJ,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAexG;AAED,wBAAgB,gBAAgB,aA7HF,GAAG,KAAK,IAAI,cAgIzC;AAED,wBAAgB,cAAc,IAAI,YAAY,EAAE,CAM/C;AAED,wBAAgB,eAAe,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAGxD;AAED,wBAAgB,eAAe,qCAE9B;AAED,wBAAgB,iBAAiB,QAOhC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,MAAM,SAAS,CAa7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,SAAS,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAYvG"}
|
|
@@ -28,6 +28,14 @@ export function InlineEditingContextProvider(props) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
+
getBlockLabel() {
|
|
32
|
+
return;
|
|
33
|
+
},
|
|
34
|
+
setBlockLabel(value) {
|
|
35
|
+
if (props.onChangeMetadata) {
|
|
36
|
+
props.onChangeMetadata({ name: value });
|
|
37
|
+
}
|
|
38
|
+
},
|
|
31
39
|
insertBlocksAfter: props.insertBlocksAfter,
|
|
32
40
|
readonly: props.readonly || parentContext?.readonly,
|
|
33
41
|
editorBlock: props.editorBlock,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createElement, forwardRef, lazy, memo, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useSSRResponse } from "../../utils/ssr-response-data.js";
|
|
3
3
|
export function dynamic(factory, name) {
|
|
4
4
|
const ReactLazyComponent = lazy(factory);
|
|
5
5
|
let PreloadedComponent;
|
|
6
6
|
let factoryPromise;
|
|
7
7
|
const Component = memo(forwardRef(function LazyWithPreload(props, ref) {
|
|
8
8
|
if (env.serverless && !env.client && name) {
|
|
9
|
-
|
|
9
|
+
useSSRResponse()?.addPreload(name);
|
|
10
10
|
}
|
|
11
11
|
// Once one of these is chosen, we must ensure that it continues to be
|
|
12
12
|
// used for all subsequent renders, otherwise it can cause the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchQueryOptions, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryResult } from "@tanstack/react-query";
|
|
1
|
+
import { type FetchQueryOptions, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialDataOptions, type UseInfiniteQueryResult, type UseMutationOptions, type UseMutationResult, type UseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import { TRPCClientError, TRPCRequestOptions } from "@trpc/client";
|
|
3
3
|
type OptionalMaybes<T> = T extends any[] ? T : T extends {
|
|
4
4
|
[key: string]: any;
|
|
@@ -37,14 +37,15 @@ type CreateUseInfiniteQueryOptions = {
|
|
|
37
37
|
defaultLimit: number;
|
|
38
38
|
paths: Record<"nodesPath" | "pageInfoPath" | "endCursorPath" | "hasNextPagePath", string[]>;
|
|
39
39
|
};
|
|
40
|
+
export type InfiniteQueryResult<TData = any, TVars = any> = UseInfiniteQueryResult<{
|
|
41
|
+
nodes: TData;
|
|
42
|
+
total?: number | null;
|
|
43
|
+
}, QueryError>;
|
|
40
44
|
export type UseInfiniteQueryFunction<TData, TVars> = (args: OptionalMaybes<Omit<TVars, "cursor">>, options?: Omit<UndefinedInitialDataInfiniteOptions<TData, QueryError, TData, any[]>, "queryKey" | "queryFn" | "initialData" | "initialPageParam" | "getNextPageParam" | "select"> & {
|
|
41
45
|
headers?: Record<string, string>;
|
|
42
46
|
/** Initial data can be passed in, but should match the original GraphQL query in structure (including nodes/hasNextPage/endCursor) */
|
|
43
47
|
initialData?: any;
|
|
44
|
-
}) =>
|
|
45
|
-
nodes: TData;
|
|
46
|
-
total?: number | null;
|
|
47
|
-
}, QueryError>;
|
|
48
|
+
}) => InfiniteQueryResult<TData, TVars>;
|
|
48
49
|
export declare function createUseInfiniteQuery<TData extends any, TVars extends MaybeVars>(init: CreateUseInfiniteQueryOptions): UseInfiniteQueryFunction<TData, TVars>;
|
|
49
50
|
export type UseMutationFunction<TData, TArgs> = ((options?: Omit<UseMutationOptions<TData, QueryError, TArgs>, "mutationFn"> & {
|
|
50
51
|
headers?: Record<string, string>;
|
|
@@ -86,5 +87,5 @@ export declare const rpcClient: {
|
|
|
86
87
|
mutation<TName extends RPCMutationName>(name: TName, input: RPCMutationInput<TName>, opts?: TRPCRequestOptions): Promise<RPCMutationResult<TName>>;
|
|
87
88
|
};
|
|
88
89
|
export declare function getQueryClient(): import("@tanstack/react-query").QueryClient;
|
|
89
|
-
export type { QueryError,
|
|
90
|
+
export type { QueryError, UseMutationResult, UseQueryResult };
|
|
90
91
|
//# sourceMappingURL=query-hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-hooks.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/hooks/query-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"query-hooks.d.ts","sourceRoot":"","sources":["../../../../src/app/lib/hooks/query-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,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,CAAC,CAAC;CAGrC,CAAA;AAED,wBAAgB,cAAc,gDAE7B;AAED,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useInfiniteQuery, useMutation, useQuery, useQueryClient, } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
1
|
+
import { useInfiniteQuery, useMutation, useQuery, useQueryClient, useSuspenseQuery, useSuspenseInfiniteQuery } from "@tanstack/react-query";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
3
|
import { joinURL } from "ufo";
|
|
4
|
-
import { getQueryClient as utilGetQueryClient } from "../../utils/query-client.js";
|
|
4
|
+
import { getHydratedSSRQuery, getQueryClient as utilGetQueryClient } from "../../utils/query-client.js";
|
|
5
5
|
import { getRPCClient } from "../../utils/trpc-client.js";
|
|
6
6
|
import { apiConfig } from "../runtime/apiConfig.js";
|
|
7
7
|
class QueryError extends Error {
|
|
@@ -73,11 +73,13 @@ const fetchQuery = async (name, params, opts) => {
|
|
|
73
73
|
export function createUseQuery(init) {
|
|
74
74
|
const hook = (args, options) => {
|
|
75
75
|
const customKey = apiConfig.customQueryKey;
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const queryKey = ["query", init.name, args, options?.headers, customKey];
|
|
77
|
+
return (env.server ? useSuspenseQuery : useQuery)({
|
|
78
|
+
queryKey: queryKey,
|
|
78
79
|
queryFn: (args) => fetchQuery(init.name, args.queryKey[2] ? JSON.stringify(args.queryKey[2]) : "", {
|
|
79
80
|
headers: options?.headers,
|
|
80
81
|
}),
|
|
82
|
+
initialData: env.client ? getHydratedSSRQuery(queryKey) : undefined,
|
|
81
83
|
...options,
|
|
82
84
|
}, useFallbackClient());
|
|
83
85
|
};
|
|
@@ -99,31 +101,31 @@ function selectByPath(data, path) {
|
|
|
99
101
|
export function createUseInfiniteQuery(init) {
|
|
100
102
|
const hook = (args, options) => {
|
|
101
103
|
const customKey = apiConfig.customQueryKey;
|
|
102
|
-
const [
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
const queryKey = ["query", init.name, args, init.defaultLimit, options?.headers, customKey];
|
|
105
|
+
const initial = useMemo(() => {
|
|
106
|
+
let data = options?.initialData;
|
|
107
|
+
if (data) {
|
|
105
108
|
const endCursor = selectByPath(data, init.paths.endCursorPath);
|
|
106
109
|
const hasNextPage = selectByPath(data, init.paths.hasNextPagePath);
|
|
107
110
|
const nodes = selectByPath(data, init.paths.nodesPath);
|
|
108
|
-
if (
|
|
109
|
-
return {
|
|
111
|
+
if (nodes) {
|
|
112
|
+
return {
|
|
113
|
+
initialData: {
|
|
114
|
+
pages: [{ nodes, endCursor, hasNextPage }],
|
|
115
|
+
pageParams: [],
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
data = getHydratedSSRQuery(queryKey);
|
|
121
|
+
if (data) {
|
|
110
122
|
return {
|
|
111
|
-
initialData:
|
|
112
|
-
pages: [{ nodes, endCursor, hasNextPage }],
|
|
113
|
-
pageParams: [],
|
|
114
|
-
},
|
|
123
|
+
initialData: data,
|
|
115
124
|
};
|
|
116
125
|
}
|
|
117
|
-
});
|
|
118
|
-
useEffect(() => {
|
|
119
|
-
startTransition(() => {
|
|
120
|
-
setInitial({
|
|
121
|
-
initialData: undefined,
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
126
|
}, []);
|
|
125
|
-
return useInfiniteQuery({
|
|
126
|
-
queryKey
|
|
127
|
+
return (env.server ? useSuspenseInfiniteQuery : useInfiniteQuery)({
|
|
128
|
+
queryKey,
|
|
127
129
|
queryFn: async (args) => {
|
|
128
130
|
const finalArgs = {
|
|
129
131
|
limit: args.queryKey[3],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-ssr-page.d.ts","sourceRoot":"","sources":["../../../src/app/server/render-ssr-page.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,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,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiBlF;AAED,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAgB,WAAW,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,UA8B1D"}
|
|
@@ -5,14 +5,17 @@ import { Writable } from "stream";
|
|
|
5
5
|
import { MetaTags } from "../entry/MetaTags.js";
|
|
6
6
|
import { SSRRoot } from "../entry/ssr-root.js";
|
|
7
7
|
import { RouteLoader } from "../lib/routing/loader.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ServerRenderResponseContext } from "../utils/ssr-response-data.js";
|
|
9
9
|
import { ServerContext } from "./server-context.js";
|
|
10
10
|
import { SecureHeaderBuilder } from "./utils/content-security.js";
|
|
11
11
|
export async function getSsrStream(args) {
|
|
12
12
|
const clientManifest = ServerContext.main.runtime.getManifest("client");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const ssrResponse = {
|
|
14
|
+
preloadAssets: new Set([clientManifest.handler]),
|
|
15
|
+
includedAssets: new Set(),
|
|
16
|
+
queryCache: new Map(),
|
|
17
|
+
};
|
|
18
|
+
const jsx = (_jsx(Suspense, { children: _jsx(ServerRenderResponseContext.Provider, { value: ssrResponse, children: _jsx(SSRRoot, { metaTags: args.initialData?.meta?.head || [], pathname: args.pathname, hostname: args.hostname, initialData: args.initialData, loader: new RouteLoader() }) }) }));
|
|
16
19
|
const stream = await new Promise(async (resolve, reject) => {
|
|
17
20
|
// console.log("Rendering to pipable")
|
|
18
21
|
const stream = renderToPipeableStream(jsx, {
|
|
@@ -63,7 +66,7 @@ export async function getSsrStream(args) {
|
|
|
63
66
|
});
|
|
64
67
|
stream.pipe(writableStream);
|
|
65
68
|
});
|
|
66
|
-
for (const input of preloadAssets) {
|
|
69
|
+
for (const input of ssrResponse.preloadAssets) {
|
|
67
70
|
const assets = await clientManifest.inputs[input].assets();
|
|
68
71
|
// controller.enqueue(new TextEncoder().encode(`\n<!-- for ${input} -->`))
|
|
69
72
|
for (const _asset of assets) {
|
|
@@ -75,9 +78,9 @@ export async function getSsrStream(args) {
|
|
|
75
78
|
if (!key) {
|
|
76
79
|
throw new Error("Asset must have a key: " + JSON.stringify(asset));
|
|
77
80
|
}
|
|
78
|
-
if (includedAssets.has(key))
|
|
81
|
+
if (ssrResponse.includedAssets.has(key))
|
|
79
82
|
continue;
|
|
80
|
-
includedAssets.add(key);
|
|
83
|
+
ssrResponse.includedAssets.add(key);
|
|
81
84
|
// Render the asset
|
|
82
85
|
try {
|
|
83
86
|
const tag = renderAsset(asset);
|
|
@@ -88,6 +91,7 @@ export async function getSsrStream(args) {
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
94
|
+
controller.enqueue(new TextEncoder().encode(`<script type="text/javascript">window._SSR_CACHE=${JSON.stringify([...ssrResponse.queryCache.entries()])}</script>`));
|
|
91
95
|
// console.log("ASSETS", await clientManifest)
|
|
92
96
|
controller.enqueue(new TextEncoder().encode(middle));
|
|
93
97
|
for (const chunk of inner) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QueryClient } from "@tanstack/react-query";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
3
|
export declare function getQueryClient(): QueryClient;
|
|
4
|
+
export declare function getHydratedSSRQuery(queryKey: any): any;
|
|
4
5
|
export declare function QueryProvider(props: PropsWithChildren<{}>): import("react").JSX.Element;
|
|
5
6
|
//# sourceMappingURL=query-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-client.d.ts","sourceRoot":"","sources":["../../../src/app/utils/query-client.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"query-client.d.ts","sourceRoot":"","sources":["../../../src/app/utils/query-client.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,WAAW,EAAuB,MAAM,uBAAuB,CAAA;AACpG,OAAO,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAelD,wBAAgB,cAAc,gBAO7B;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,GAAG,OAMhD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,+BAyBzD"}
|
|
@@ -1,20 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useSSRResponse } from "./ssr-response-data.js";
|
|
5
|
+
function getQueryClientOptions() {
|
|
6
|
+
if (env.serverless && env.dev && !env.client) {
|
|
7
|
+
return {
|
|
8
|
+
queries: {
|
|
9
|
+
staleTime: 1,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
3
15
|
let queryClient = null;
|
|
4
16
|
export function getQueryClient() {
|
|
5
17
|
if (!queryClient) {
|
|
6
18
|
queryClient = new QueryClient({
|
|
7
|
-
defaultOptions:
|
|
8
|
-
? {
|
|
9
|
-
queries: {
|
|
10
|
-
staleTime: 1,
|
|
11
|
-
},
|
|
12
|
-
}
|
|
13
|
-
: {},
|
|
19
|
+
defaultOptions: getQueryClientOptions(),
|
|
14
20
|
});
|
|
15
21
|
}
|
|
16
22
|
return queryClient;
|
|
17
23
|
}
|
|
24
|
+
export function getHydratedSSRQuery(queryKey) {
|
|
25
|
+
const queryHash = JSON.stringify(queryKey);
|
|
26
|
+
if (env.client && env.frontend && typeof window !== "undefined" && "_SSR_CACHE" in window) {
|
|
27
|
+
const cache = window._SSR_CACHE;
|
|
28
|
+
return cache.find(([hash]) => hash === queryHash)?.[1];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
18
31
|
export function QueryProvider(props) {
|
|
19
|
-
|
|
32
|
+
const ssrResponse = useSSRResponse();
|
|
33
|
+
const queryClient = useMemo(() => {
|
|
34
|
+
let queryCache;
|
|
35
|
+
/**
|
|
36
|
+
* In SSR server mode, save query cache values to the SSR Response metadata.
|
|
37
|
+
* The client will try to get these from getHydratedSSRQuery()
|
|
38
|
+
*/
|
|
39
|
+
if (env.server) {
|
|
40
|
+
queryCache = new QueryCache({
|
|
41
|
+
onSuccess(data, query) {
|
|
42
|
+
ssrResponse?.queryCache.set(JSON.stringify(query.queryKey), data);
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
return new QueryClient({
|
|
46
|
+
queryCache: queryCache,
|
|
47
|
+
defaultOptions: getQueryClientOptions(),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return getQueryClient();
|
|
51
|
+
}, []);
|
|
52
|
+
return _jsx(QueryClientProvider, { client: queryClient, children: props.children });
|
|
20
53
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ServerRenderResponseData = {
|
|
2
|
+
preloadAssets: Set<string>;
|
|
3
|
+
includedAssets: Set<string>;
|
|
4
|
+
queryCache: Map<string, any>;
|
|
5
|
+
};
|
|
6
|
+
export declare const ServerRenderResponseContext: import("react").Context<ServerRenderResponseData | undefined>;
|
|
7
|
+
export declare function useSSRResponse(): {
|
|
8
|
+
addPreload(name: string): void;
|
|
9
|
+
preloadAssets: Set<string>;
|
|
10
|
+
includedAssets: Set<string>;
|
|
11
|
+
queryCache: Map<string, any>;
|
|
12
|
+
} | null;
|
|
13
|
+
//# sourceMappingURL=ssr-response-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-response-data.d.ts","sourceRoot":"","sources":["../../../src/app/utils/ssr-response-data.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,2BAA2B,+DAAiE,CAAA;AAEzG,wBAAgB,cAAc;qBAMP,MAAM;mBAbZ,GAAG,CAAC,MAAM,CAAC;oBACV,GAAG,CAAC,MAAM,CAAC;gBACf,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;SAiB7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
export const ServerRenderResponseContext = createContext(undefined);
|
|
3
|
+
export function useSSRResponse() {
|
|
4
|
+
const data = useContext(ServerRenderResponseContext);
|
|
5
|
+
if (data) {
|
|
6
|
+
return {
|
|
7
|
+
...data,
|
|
8
|
+
addPreload(name) {
|
|
9
|
+
data.preloadAssets.add(name);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trpc-client.d.ts","sourceRoot":"","sources":["../../../src/app/utils/trpc-client.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAiBpH,wBAAgB,YAAY,IAAI,iBAAiB,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"trpc-client.d.ts","sourceRoot":"","sources":["../../../src/app/utils/trpc-client.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAiBpH,wBAAgB,YAAY,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAqCrD"}
|
|
@@ -13,43 +13,39 @@ const getRPCName = (url) => {
|
|
|
13
13
|
};
|
|
14
14
|
let client;
|
|
15
15
|
export function getRPCClient() {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
true: httpSubscriptionLink({
|
|
25
|
-
url: endpoint,
|
|
26
|
-
transformer: SuperJSON,
|
|
27
|
-
}),
|
|
28
|
-
false: httpLink({
|
|
29
|
-
url: endpoint,
|
|
30
|
-
fetch: async (url, opts) => {
|
|
31
|
-
const type = (opts?.method ?? "GET").toUpperCase() === "POST" ? "mutation" : "query";
|
|
32
|
-
const name = getRPCName(url);
|
|
33
|
-
const finalUrl = updatePath(url);
|
|
34
|
-
let options = {
|
|
35
|
-
...opts,
|
|
36
|
-
credentials: "omit",
|
|
37
|
-
};
|
|
38
|
-
// Apply API configuration
|
|
39
|
-
if (apiConfig.customRPCFetchOptions) {
|
|
40
|
-
options = await apiConfig.customRPCFetchOptions(type, name, finalUrl, options);
|
|
41
|
-
}
|
|
42
|
-
const response = await fetch(finalUrl, options);
|
|
43
|
-
if (apiConfig.onRPCResponse)
|
|
44
|
-
apiConfig.onRPCResponse(response, type, name, finalUrl, options);
|
|
45
|
-
return response;
|
|
46
|
-
},
|
|
47
|
-
transformer: SuperJSON,
|
|
48
|
-
}),
|
|
16
|
+
if (!client) {
|
|
17
|
+
client = createTRPCUntypedClient({
|
|
18
|
+
links: [
|
|
19
|
+
splitLink({
|
|
20
|
+
condition: (op) => op.type === "subscription",
|
|
21
|
+
true: httpSubscriptionLink({
|
|
22
|
+
url: env.serverlessOrigin,
|
|
23
|
+
transformer: SuperJSON,
|
|
49
24
|
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
false: httpLink({
|
|
26
|
+
url: env.serverlessOrigin,
|
|
27
|
+
fetch: async (url, opts) => {
|
|
28
|
+
const type = (opts?.method ?? "GET").toUpperCase() === "POST" ? "mutation" : "query";
|
|
29
|
+
const name = getRPCName(url);
|
|
30
|
+
const finalUrl = updatePath(url);
|
|
31
|
+
let options = {
|
|
32
|
+
...opts,
|
|
33
|
+
credentials: "omit",
|
|
34
|
+
};
|
|
35
|
+
// Apply API configuration
|
|
36
|
+
if (apiConfig.customRPCFetchOptions) {
|
|
37
|
+
options = await apiConfig.customRPCFetchOptions(type, name, finalUrl, options);
|
|
38
|
+
}
|
|
39
|
+
const response = await fetch(finalUrl, options);
|
|
40
|
+
if (apiConfig.onRPCResponse)
|
|
41
|
+
apiConfig.onRPCResponse(response, type, name, finalUrl, options);
|
|
42
|
+
return response;
|
|
43
|
+
},
|
|
44
|
+
transformer: SuperJSON,
|
|
45
|
+
}),
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
});
|
|
53
49
|
}
|
|
54
50
|
return client;
|
|
55
51
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.3.
|
|
1
|
+
export declare const VERSION = "2.3.20";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.3.
|
|
1
|
+
export const VERSION = "2.3.20";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-vite-config.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/get-vite-config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAA;IAClC,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,UAAU,GAAG,KAAK,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;CAChB,CA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C,IAAI,EAAE,IAAI,GAAG,YAAY,CAkEtD"}
|
|
@@ -8,18 +8,18 @@ import { createLogger } from "vite";
|
|
|
8
8
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
9
9
|
import { cliMode } from "../cli/cli-mode.js";
|
|
10
10
|
export function envPlugin(args) {
|
|
11
|
+
const serverlessOrigin = args.client && !args.serverless ? '(window.SERVERLESS_ENDPOINT ?? "/")' : JSON.stringify("/");
|
|
11
12
|
const envDefines = {
|
|
12
13
|
client: args.client ? "true" : "false",
|
|
13
14
|
serverless: args.serverless ? "true" : "false",
|
|
15
|
+
server: !args.client && args.serverless ? "true" : "false",
|
|
14
16
|
dev: args.mode === "development" ? "true" : "false",
|
|
15
17
|
admin: args.target === "cms" ? "true" : "false",
|
|
18
|
+
frontend: args.target === "frontend" ? "true" : "false",
|
|
16
19
|
themePath: JSON.stringify(args.publicUrl),
|
|
17
20
|
devUI: args.mode === "development" ? "true" : "false",
|
|
18
|
-
serverlessOrigin
|
|
19
|
-
rpcEnabled: "true",
|
|
21
|
+
serverlessOrigin,
|
|
20
22
|
origin: JSON.stringify(process.env.SITE_URL ?? "/"),
|
|
21
|
-
VERCEL_DEPLOYMENT_ID: JSON.stringify(process.env.VERCEL_DEPLOYMENT_ID ?? ""),
|
|
22
|
-
VERCEL_SKEW_PROTECTION_ENABLED: JSON.stringify(process.env.VERCEL_SKEW_PROTECTION_ENABLED ?? "0"),
|
|
23
23
|
FRONTEND_ORIGIN: process.env.FRONTEND_ORIGIN ? JSON.stringify(process.env.FRONTEND_ORIGIN) : "undefined",
|
|
24
24
|
};
|
|
25
25
|
const expandDefines = (obj, prefixes = []) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vinxi-app.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/vinxi-app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vinxi-app.d.ts","sourceRoot":"","sources":["../../../src/node/compiler/vinxi-app.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAKtD,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,MAAM,EAAE,QAAQ,CAAA;CACjB,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAA;AAC7D,KAAK,mBAAmB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,QAAQ,CAAA;AACrD,KAAK,iBAAiB,GAAG,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAA;AAEhE,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAC1C,CAAA;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,OA4P3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eddev-build-file.d.ts","sourceRoot":"","sources":["../../../src/node/project/eddev-build-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAI3C;;GAEG;AACH,qBAAa,eAAe;IACP,OAAO,EAAE,OAAO;gBAAhB,OAAO,EAAE,OAAO;IAEnC,KAAK;IAUC,KAAK;
|
|
1
|
+
{"version":3,"file":"eddev-build-file.d.ts","sourceRoot":"","sources":["../../../src/node/project/eddev-build-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAI3C;;GAEG;AACH,qBAAa,eAAe;IACP,OAAO,EAAE,OAAO;gBAAhB,OAAO,EAAE,OAAO;IAEnC,KAAK;IAUC,KAAK;CAoEZ"}
|
|
@@ -51,13 +51,15 @@ export class BuildInfoWriter {
|
|
|
51
51
|
childTags: block.childTags?.length ? block.childTags : undefined,
|
|
52
52
|
allowed_blocks: block.childBlocks?.length ? block.childBlocks.map(toAcfBlockName) : undefined,
|
|
53
53
|
supports: {
|
|
54
|
-
|
|
54
|
+
...block.supports ?? {},
|
|
55
|
+
align: block.supports?.align ?? false,
|
|
55
56
|
align_text: false,
|
|
56
57
|
align_center: false,
|
|
57
58
|
multiple: block.allowMultiple ? true : false,
|
|
58
59
|
mode: block.mode === "both" ? true : false,
|
|
59
60
|
customClassName: false,
|
|
60
61
|
inserter: block.inserter,
|
|
62
|
+
blockVisibility: block.supports?.visibility ?? (block.inserter === false ? false : true),
|
|
61
63
|
},
|
|
62
64
|
mode: block.mode === "edit" ? "edit" : "preview",
|
|
63
65
|
canCache: block.cache,
|
|
@@ -158,6 +158,7 @@ function readBlockDataAsJSONExport(file, contents) {
|
|
|
158
158
|
result.blockStyles = userData.blockStyles;
|
|
159
159
|
result.dynamic = userData.lazyLoad ?? true;
|
|
160
160
|
result.templatePart = userData.templatePart;
|
|
161
|
+
result.supports = userData.supports;
|
|
161
162
|
if (userData.postMetaBlock) {
|
|
162
163
|
result.postMetaBlock = {
|
|
163
164
|
postTypes: userData.postMetaBlock.postTypes,
|
|
@@ -42,6 +42,25 @@ export declare const BlockMetaSchema: z.ZodObject<{
|
|
|
42
42
|
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
43
43
|
}, z.core.$strip>>>;
|
|
44
44
|
lazyLoad: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
supports: z.ZodOptional<z.ZodType<{
|
|
46
|
+
visibility?: booean;
|
|
47
|
+
anchor?: boolean;
|
|
48
|
+
listView?: boolean;
|
|
49
|
+
align?: boolean | ("left" | "right" | "full")[];
|
|
50
|
+
background?: {
|
|
51
|
+
backgroundImage: boolean;
|
|
52
|
+
backgroundSize: boolean;
|
|
53
|
+
};
|
|
54
|
+
} | undefined, undefined, z.core.$ZodTypeInternals<{
|
|
55
|
+
visibility?: booean;
|
|
56
|
+
anchor?: boolean;
|
|
57
|
+
listView?: boolean;
|
|
58
|
+
align?: boolean | ("left" | "right" | "full")[];
|
|
59
|
+
background?: {
|
|
60
|
+
backgroundImage: boolean;
|
|
61
|
+
backgroundSize: boolean;
|
|
62
|
+
};
|
|
63
|
+
} | undefined, undefined>>>;
|
|
45
64
|
templatePart: z.ZodOptional<z.ZodObject<{
|
|
46
65
|
area: z.ZodString;
|
|
47
66
|
slug: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-type.d.ts","sourceRoot":"","sources":["../../../src/node/types/block-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAMrE,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"block-type.d.ts","sourceRoot":"","sources":["../../../src/node/types/block-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAMrE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAuGk4B,MAAO;;;;;;;;;qBAAP,MAAO;;;;;;;;;;;;;iBAhEn6B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAE3D,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEtE,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,UAkBjD;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,UA6B5D"}
|
|
@@ -35,6 +35,7 @@ export const BlockMetaSchema = z.object({
|
|
|
35
35
|
inserter: z.boolean().default(true),
|
|
36
36
|
blockStyles: z.array(z.object({ name: z.string(), label: z.string(), isDefault: z.boolean().optional() })).optional(),
|
|
37
37
|
lazyLoad: z.boolean().optional(),
|
|
38
|
+
supports: z.any().optional(),
|
|
38
39
|
templatePart: z
|
|
39
40
|
.object({
|
|
40
41
|
area: z.string(),
|
package/package.json
CHANGED
package/types.env.d.ts
CHANGED
|
@@ -1,20 +1,107 @@
|
|
|
1
1
|
declare global {
|
|
2
|
+
/**
|
|
3
|
+
* Compile-time environment values injected into eddev bundles.
|
|
4
|
+
*
|
|
5
|
+
* These properties are statically replaced during bundling; `env` is not a
|
|
6
|
+
* mutable runtime environment object.
|
|
7
|
+
*/
|
|
2
8
|
interface EDEnv {
|
|
9
|
+
/**
|
|
10
|
+
* Whether this bundle targets a browser environment.
|
|
11
|
+
*
|
|
12
|
+
* This is `true` for both the public frontend client and WordPress admin
|
|
13
|
+
* bundles, and `false` for the server-side SSR bundle.
|
|
14
|
+
*/
|
|
3
15
|
client: boolean
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether this bundle belongs to the Vinxi serverless/SSR application.
|
|
19
|
+
*
|
|
20
|
+
* This is also `true` when running the local serverless dev server; it does
|
|
21
|
+
* not specifically mean that the code is deployed on Vercel.
|
|
22
|
+
*/
|
|
4
23
|
serverless: boolean
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether this is the server-side portion of a serverless/SSR build.
|
|
27
|
+
*
|
|
28
|
+
* Equivalent to `env.serverless && !env.client`.
|
|
29
|
+
*/
|
|
30
|
+
server: boolean
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Whether this bundle targets the React application rendered inside
|
|
34
|
+
* WordPress admin.
|
|
35
|
+
*/
|
|
5
36
|
admin: boolean
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whether this bundle targets the public website rather than WordPress admin.
|
|
40
|
+
*
|
|
41
|
+
* This can be `true` in either the browser client or the server-side SSR
|
|
42
|
+
* bundle; use `env.client` when browser execution is the relevant distinction.
|
|
43
|
+
*/
|
|
44
|
+
frontend: boolean
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether the bundle was compiled in development mode.
|
|
48
|
+
*
|
|
49
|
+
* This is a compile-time build-mode flag, not a runtime hostname or deployment
|
|
50
|
+
* check.
|
|
51
|
+
*/
|
|
6
52
|
dev: boolean
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Whether development UI features are available in this bundle.
|
|
56
|
+
*
|
|
57
|
+
* This currently mirrors `env.dev` and is not derived from the project's
|
|
58
|
+
* `devUI` configuration setting.
|
|
59
|
+
*/
|
|
7
60
|
devUI: boolean
|
|
8
|
-
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Base URL used to call eddev serverless RPC routes.
|
|
64
|
+
*
|
|
65
|
+
* In WordPress-hosted browser bundles this evaluates at runtime to
|
|
66
|
+
* `window.SERVERLESS_ENDPOINT`, falling back to `/` when PHP has not set it.
|
|
67
|
+
* Serverless and server-side bundles use `/` because the RPC routes share
|
|
68
|
+
* the application's origin.
|
|
69
|
+
*/
|
|
9
70
|
serverlessOrigin: string
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Public URL path of the active WordPress theme, usually ending with a slash.
|
|
74
|
+
*
|
|
75
|
+
* For example: `/wp-content/themes/example-theme/`.
|
|
76
|
+
*/
|
|
10
77
|
themePath: string
|
|
11
|
-
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* WordPress origin URL injected from `SITE_URL`.
|
|
81
|
+
*
|
|
82
|
+
* Server-side serverless code uses this to construct requests back to
|
|
83
|
+
* WordPress. Browser code should normally use the current document URL.
|
|
84
|
+
*/
|
|
12
85
|
origin?: string
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Optional public frontend origin override used by server-side data requests.
|
|
89
|
+
*
|
|
90
|
+
* When set, URLs returned by WordPress are rewritten for this origin instead
|
|
91
|
+
* of the origin inferred from the incoming request.
|
|
92
|
+
*/
|
|
16
93
|
FRONTEND_ORIGIN: string | undefined
|
|
17
94
|
}
|
|
95
|
+
|
|
96
|
+
namespace NodeJS {
|
|
97
|
+
interface ProcessEnv {
|
|
98
|
+
/** Vercel deployment identifier, when running on a Vercel deployment. */
|
|
99
|
+
VERCEL_DEPLOYMENT_ID?: string
|
|
100
|
+
|
|
101
|
+
/** Raw Vercel skew-protection setting supplied by the deployment environment. */
|
|
102
|
+
VERCEL_SKEW_PROTECTION_ENABLED?: string
|
|
103
|
+
}
|
|
104
|
+
}
|
|
18
105
|
}
|
|
19
106
|
|
|
20
107
|
export {}
|
package/types.meta.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare global {
|
|
|
5
5
|
type ChildBlockTypeName = BlockTypeName | keyof CoreBlockProps
|
|
6
6
|
type BlockTagName = keyof DefinedBlockTags
|
|
7
7
|
|
|
8
|
-
interface PostTypes {}
|
|
9
|
-
interface PageTemplates {}
|
|
10
|
-
interface CoreBlockProps {}
|
|
11
|
-
interface DefinedBlockTags {}
|
|
12
|
-
interface DefinedBlockFlags {}
|
|
13
|
-
interface PostMetaTypes {}
|
|
8
|
+
interface PostTypes { }
|
|
9
|
+
interface PageTemplates { }
|
|
10
|
+
interface CoreBlockProps { }
|
|
11
|
+
interface DefinedBlockTags { }
|
|
12
|
+
interface DefinedBlockFlags { }
|
|
13
|
+
interface PostMetaTypes { }
|
|
14
14
|
|
|
15
15
|
type ViewMeta = {
|
|
16
16
|
/** The human-readable title of this page template, shown in the template dropdown */
|
|
@@ -113,7 +113,34 @@ declare global {
|
|
|
113
113
|
ancestors?: (BlockTypeName | BlockTagName)[]
|
|
114
114
|
/** Whether multiple of this block can be used @default true */
|
|
115
115
|
multiple?: boolean
|
|
116
|
-
}
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
supports?: {
|
|
119
|
+
/**
|
|
120
|
+
* By default, a block can be hidden by a user from the block ‘Options’ dropdown. To disable this behavior, set visibility to false.
|
|
121
|
+
* @default true
|
|
122
|
+
**/
|
|
123
|
+
visibility?: booean,
|
|
124
|
+
/**
|
|
125
|
+
* Anchors let you link directly to a specific block on a page. This property adds a field to define an id for the block and a button to copy the direct link.
|
|
126
|
+
* @default false
|
|
127
|
+
**/
|
|
128
|
+
anchor?: boolean
|
|
129
|
+
/**
|
|
130
|
+
* Enables a List View panel in the block inspector for the block’s inner blocks.
|
|
131
|
+
*
|
|
132
|
+
* When this support is enabled, the inspector shows a List View tree allowing users to inspect and manage the block’s inner blocks from the sidebar instead of only using the global document List View.
|
|
133
|
+
*/
|
|
134
|
+
listView?: boolean,
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
align?: boolean | ('left' | 'right' | 'full')[]
|
|
139
|
+
background?: {
|
|
140
|
+
backgroundImage: boolean,
|
|
141
|
+
backgroundSize: boolean
|
|
142
|
+
}
|
|
143
|
+
},
|
|
117
144
|
|
|
118
145
|
/**
|
|
119
146
|
* Apply additional caching to this block, so that even if the page is updated, the block props will be cached for an additional period of time.
|
|
@@ -640,4 +667,4 @@ type BlockInstance<T extends Record<string, any> = { [k: string]: any }> = {
|
|
|
640
667
|
readonly originalContent?: string | undefined
|
|
641
668
|
}
|
|
642
669
|
|
|
643
|
-
export {}
|
|
670
|
+
export { }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset-capture.d.ts","sourceRoot":"","sources":["../../../src/app/utils/asset-capture.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,sCAAwC,CAAA;AAExE,eAAO,MAAM,eAAe,mBAE3B,CAAA"}
|