eddev 2.0.0-beta.36 → 2.0.0-beta.38

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.
Files changed (65) hide show
  1. package/dist/node/cli/version.d.ts +1 -1
  2. package/dist/node/cli/version.js +1 -1
  3. package/dist/node/compiler/vinxi-app.js +5 -1
  4. package/package.json +1 -1
  5. package/dist/app/entry/ssr-root-client.d.ts +0 -6
  6. package/dist/app/entry/ssr-root.d.ts +0 -10
  7. package/dist/app/entry/ssr-root.js +0 -24
  8. package/dist/app/lib/blocks/EditableText.d.ts +0 -41
  9. package/dist/app/lib/blocks/EditableText.js +0 -50
  10. package/dist/app/lib/blocks/InnerBlocks.d.ts +0 -52
  11. package/dist/app/lib/blocks/InnerBlocks.js +0 -63
  12. package/dist/app/lib/blocks/defineBlock.d.ts +0 -2
  13. package/dist/app/lib/blocks/defineBlock.js +0 -3
  14. package/dist/app/lib/blocks/editor/controls.d.ts +0 -10
  15. package/dist/app/lib/blocks/editor/controls.js +0 -20
  16. package/dist/app/lib/blocks/index.d.ts +0 -9
  17. package/dist/app/lib/blocks/index.js +0 -9
  18. package/dist/app/lib/devtools/index.d.ts +0 -1
  19. package/dist/app/lib/devtools/index.js +0 -1
  20. package/dist/app/lib/devtools/tailwind.config.d.ts +0 -23
  21. package/dist/app/lib/devtools/tailwind.config.js +0 -24
  22. package/dist/app/lib/devtools/useQueryDebug.d.ts +0 -15
  23. package/dist/app/lib/devtools/useQueryDebug.js +0 -10
  24. package/dist/app/lib/dynamic/index.d.ts +0 -1
  25. package/dist/app/lib/dynamic/index.js +0 -1
  26. package/dist/app/lib/hooks/apiConfig.d.ts +0 -20
  27. package/dist/app/lib/hooks/apiConfig.js +0 -9
  28. package/dist/app/lib/hooks/index.d.ts +0 -4
  29. package/dist/app/lib/hooks/index.js +0 -4
  30. package/dist/app/lib/hooks/queryUtils.d.ts +0 -49
  31. package/dist/app/lib/hooks/queryUtils.js +0 -182
  32. package/dist/app/lib/hooks/useAppData.d.ts +0 -4
  33. package/dist/app/lib/hooks/useAppData.js +0 -11
  34. package/dist/app/lib/hooks/useRPC.d.ts +0 -9
  35. package/dist/app/lib/hooks/useRPC.js +0 -9
  36. package/dist/app/lib/internal/index.d.ts +0 -4
  37. package/dist/app/lib/internal/index.js +0 -4
  38. package/dist/app/lib/internal/internal-store.d.ts +0 -9
  39. package/dist/app/lib/internal/internal-store.js +0 -7
  40. package/dist/app/lib/legacy-stitches/createStitches.d.ts +0 -615
  41. package/dist/app/lib/legacy-stitches/createStitches.js +0 -439
  42. package/dist/app/lib/legacy-stitches/index.d.ts +0 -1
  43. package/dist/app/lib/legacy-stitches/index.js +0 -1
  44. package/dist/app/lib/routing/components/SSRRouter.d.ts +0 -9
  45. package/dist/app/lib/routing/components/SSRRouter.js +0 -13
  46. package/dist/app/lib/views/defineView.d.ts +0 -4
  47. package/dist/app/lib/views/defineView.js +0 -3
  48. package/dist/app/lib/views/index.d.ts +0 -1
  49. package/dist/app/lib/views/index.js +0 -1
  50. package/dist/app/server/defineRouter.d.ts +0 -2
  51. package/dist/app/server/defineRouter.js +0 -4
  52. package/dist/app/server/index.d.ts +0 -4
  53. package/dist/app/server/index.js +0 -4
  54. package/dist/app/server/proxy-wp-admin.d.ts +0 -3
  55. package/dist/app/server/proxy-wp-admin.js +0 -105
  56. package/dist/app/server/render-ssr-page.d.ts +0 -5
  57. package/dist/app/server/render-ssr-page.js +0 -31
  58. package/dist/app/server/server-context.d.ts +0 -50
  59. package/dist/app/server/server-context.js +0 -145
  60. package/dist/app/server/utils/headers.d.ts +0 -5
  61. package/dist/app/server/utils/headers.js +0 -28
  62. package/dist/app/server/utils/replace-host.d.ts +0 -10
  63. package/dist/app/server/utils/replace-host.js +0 -61
  64. package/dist/app/utils/wp.d.ts +0 -26
  65. package/dist/app/utils/wp.js +0 -1
@@ -1,50 +0,0 @@
1
- import { RequestHeaders } from "vinxi/http";
2
- import { UrlReplacerConf } from "./utils/replace-host.js";
3
- import { Manifest } from "vinxi/dist/types/types/manifest";
4
- import { TrackerTags } from "../lib/routing/types.js";
5
- export type ServerContextArgs = {
6
- dev: boolean;
7
- origin: string;
8
- replaceUrls?: UrlReplacerConf;
9
- };
10
- export type ServerContextRuntime = {
11
- getManifest: (name: string) => Manifest;
12
- };
13
- /**
14
- * Data returned from WordPress origin /_appdata route
15
- */
16
- type ServerAppData = {
17
- appData: any;
18
- trackers: TrackerTags;
19
- };
20
- export declare class ServerContext {
21
- dev: boolean;
22
- origin: string;
23
- replaceUrls?: (text: string) => string;
24
- constructor(conf: ServerContextArgs);
25
- get runtime(): ServerContextRuntime;
26
- static setRuntime(rt: ServerContextRuntime): void;
27
- getOriginUrl(url: string): string;
28
- fetchOrigin(url: string, opts?: RequestInit & {
29
- replaceUrls?: boolean;
30
- }): Promise<Response>;
31
- fetchRouteData(req: {
32
- pathname: string;
33
- query?: Record<string, any>;
34
- headers?: RequestHeaders;
35
- withAppData?: boolean;
36
- }): Promise<Response>;
37
- fetchAppData(): Promise<ServerAppData>;
38
- extractRequestHeaders(req?: RequestHeaders): Partial<Record<import("vinxi/http").HTTPHeaderName, string | undefined>>;
39
- fetchNamedQuery(req: {
40
- name: string;
41
- params: object;
42
- headers: RequestHeaders;
43
- }): Promise<Response>;
44
- fetchMutation(req: {
45
- name: string;
46
- body: object;
47
- headers: RequestHeaders;
48
- }): Promise<Response>;
49
- }
50
- export {};
@@ -1,145 +0,0 @@
1
- import { parseURL, stringifyParsedURL, withQuery } from "ufo";
2
- import { filterHeader } from "./utils/headers.js";
3
- import { createUrlReplacer } from "./utils/replace-host.js";
4
- const PROXY_RESPONSE_HEADERS = ["content-type", "set-cookie", /^x-/, "cache-control", /woocommerce/];
5
- const PROXY_REQUEST_HEADERS = [
6
- "content-type",
7
- "accept",
8
- "accept-encoding",
9
- "accept-language",
10
- "origin",
11
- "referer",
12
- "user-agent",
13
- "authorization",
14
- "woocommerce-session",
15
- ];
16
- let runtime;
17
- export class ServerContext {
18
- dev;
19
- origin;
20
- replaceUrls;
21
- constructor(conf) {
22
- this.dev = conf.dev;
23
- this.origin = conf.origin;
24
- if (conf.replaceUrls) {
25
- this.replaceUrls = createUrlReplacer(conf.replaceUrls);
26
- }
27
- }
28
- get runtime() {
29
- return runtime;
30
- }
31
- static setRuntime(rt) {
32
- runtime = rt;
33
- }
34
- getOriginUrl(url) {
35
- const parsed = parseURL(url);
36
- const parsedOrigin = parseURL(this.origin);
37
- parsed.host = parsedOrigin.host;
38
- parsed.protocol = parsedOrigin.protocol;
39
- return stringifyParsedURL(parsed);
40
- }
41
- async fetchOrigin(url, opts) {
42
- url = this.getOriginUrl(url);
43
- const response = await fetch(url, {
44
- ...opts,
45
- headers: {
46
- "Content-Type": "application/json",
47
- Accept: "application/json",
48
- ...opts?.headers,
49
- },
50
- });
51
- if (!response.ok) {
52
- return response;
53
- }
54
- // console.log("Response headers", response.headers)
55
- const headers = {};
56
- response.headers.forEach((value, key) => {
57
- if (filterHeader(key, PROXY_RESPONSE_HEADERS)) {
58
- headers[key] = value;
59
- }
60
- });
61
- // console.log("Returning headers", headers)
62
- let text = await response.text();
63
- if (opts?.replaceUrls && this.replaceUrls) {
64
- text = this.replaceUrls(text);
65
- }
66
- return new Response(text, {
67
- status: response.status,
68
- statusText: response.statusText,
69
- headers,
70
- });
71
- }
72
- async fetchRouteData(req) {
73
- const fetchUrl = withQuery(req.pathname, {
74
- ...req.query,
75
- _props: "1",
76
- _ssr: "1",
77
- _debug: this.dev ? "1" : undefined,
78
- });
79
- // console.log("Fetching route data", req.pathname)
80
- const result = this.fetchOrigin(fetchUrl, {
81
- cache: "no-cache",
82
- replaceUrls: true,
83
- headers: {
84
- "Content-Type": "application/json",
85
- Accept: "application/json",
86
- },
87
- });
88
- // console.log("Finished fetching route data")
89
- return result;
90
- }
91
- async fetchAppData() {
92
- // console.log("Fetching app data")
93
- const response = await this.fetchOrigin("/_appdata", {
94
- cache: "no-cache",
95
- replaceUrls: true,
96
- headers: {
97
- "Content-Type": "application/json",
98
- Accept: "application/json",
99
- },
100
- });
101
- // console.log("Decoding app data")
102
- const result = await response.json();
103
- // console.log("Done with app done")
104
- return result;
105
- }
106
- extractRequestHeaders(req) {
107
- const headers = {};
108
- if (req) {
109
- for (let key of PROXY_REQUEST_HEADERS) {
110
- if (req[key]) {
111
- headers[key] = req[key];
112
- }
113
- }
114
- }
115
- return headers;
116
- }
117
- async fetchNamedQuery(req) {
118
- const url = `/wp-json/ed/v1/query/${req.name}?params=${encodeURIComponent(JSON.stringify(req.params))}`;
119
- return this.fetchOrigin(url, {
120
- cache: "no-cache",
121
- replaceUrls: true,
122
- headers: {
123
- ...this.extractRequestHeaders(req.headers),
124
- "Content-Type": "application/json",
125
- Accept: "application/json",
126
- },
127
- redirect: "manual",
128
- });
129
- }
130
- async fetchMutation(req) {
131
- const url = `/wp-json/ed/v1/mutation/${req.name}`;
132
- return this.fetchOrigin(url, {
133
- method: "POST",
134
- cache: "no-cache",
135
- replaceUrls: true,
136
- headers: {
137
- ...this.extractRequestHeaders(req.headers),
138
- "Content-Type": "application/json",
139
- Accept: "application/json",
140
- },
141
- body: JSON.stringify(req.body),
142
- redirect: "manual",
143
- });
144
- }
145
- }
@@ -1,5 +0,0 @@
1
- export declare function filterHeader(key: string, allowed: (string | RegExp)[]): boolean;
2
- export declare const BRANDED_HEADERS: {
3
- "X-Powered-By": string;
4
- };
5
- export declare function extractHeaders(rawHeaders: Headers): Record<string, string>;
@@ -1,28 +0,0 @@
1
- export function filterHeader(key, allowed) {
2
- return allowed.some((allowedKey) => {
3
- if (allowedKey instanceof RegExp) {
4
- return allowedKey.test(key);
5
- }
6
- return allowedKey === key;
7
- });
8
- }
9
- export const BRANDED_HEADERS = {
10
- "X-Powered-By": "ed.studio",
11
- };
12
- const IGNORE_REQUEST_HEADERS = [
13
- "host",
14
- "connection",
15
- "accept-encoding",
16
- "accept-language",
17
- "origin",
18
- "referer",
19
- "user-agent",
20
- ];
21
- export function extractHeaders(rawHeaders) {
22
- const headers = {};
23
- rawHeaders.forEach((value, key) => {
24
- headers[key] = value;
25
- });
26
- IGNORE_REQUEST_HEADERS.forEach((key) => delete headers[key]);
27
- return headers;
28
- }
@@ -1,10 +0,0 @@
1
- export type UrlReplacerConf = {
2
- from: string;
3
- to: string;
4
- /** A dictionary of prefixes (eg /wp-content), and whether to replace them (true/false) */
5
- prefixes: {
6
- prefix: string;
7
- replace: boolean;
8
- }[];
9
- };
10
- export declare function createUrlReplacer(conf: UrlReplacerConf): (text: string) => string;
@@ -1,61 +0,0 @@
1
- export function createUrlReplacer(conf) {
2
- // Create a regular expression to match the URL
3
- // Note that that the regex doesn't necessarily match the entire URL
4
- const lookup = new RegExp(conf.from.replace(/https?[:\\\/]+/, "https?[:\\/\\\\]+") + "([a-z0-9\\-_/\\\\]+)", "ig");
5
- return (text) => {
6
- return text.replace(lookup, (url) => {
7
- // Strip out the origin, to create a relative path
8
- const path = url.replace(/https?:[\/\\]+[^\/\\]+/, "");
9
- const isEscaped = url.includes(":\\/\\/");
10
- const key = "/" +
11
- path
12
- .split(/[\/\\]+/g)
13
- .filter((v) => v)
14
- .join("/");
15
- for (let item of conf.prefixes) {
16
- if (key.startsWith(item.prefix)) {
17
- if (item.replace) {
18
- return url;
19
- }
20
- else {
21
- return path;
22
- }
23
- }
24
- }
25
- return path;
26
- // if (path.startsWith("/wp-content/uploads/")) {
27
- // if (!conf.ignoreUploads) {
28
- // return path
29
- // } else {
30
- // return url
31
- // }
32
- // // } else if (path.startsWith("/wp-content/themes/")) {
33
- // // if (settings?.uploads === "proxy") {
34
- // // return path
35
- // // } else if (settings?.uploads === "remote") {
36
- // // return url
37
- // // }
38
- // // } else if (path.startsWith("/wp-content/plugins/")) {
39
- // // if (settings?.uploads === "proxy") {
40
- // // return path
41
- // // } else if (settings?.uploads === "remote") {
42
- // // return url
43
- // // }
44
- // } else {
45
- // return path
46
- // }
47
- });
48
- };
49
- // const from = conf.from
50
- // const to = conf.to
51
- // const https = conf.https
52
- // const ignoreUploads = conf.ignoreUploads
53
- // const ignorePlugins = conf.ignorePlugins
54
- // const replaceTargetString = from.replaceAll(/https?:/g, "https?:").replaceAll("/", "\\/")
55
- // const replaceTargetEscapedString = from.replaceAll(/https?:/g, "https?:").replaceAll("/", "\\\\/")
56
- // const replaceTarget = new RegExp(replaceTargetString, "g")
57
- // const replaceTargetEscaped = new RegExp(replaceTargetEscapedString, "g")
58
- // return (value: string) => {
59
- // return value.replaceAll(replaceTarget, to).replace(replaceTargetEscaped, to.replaceAll("/", "\\/"))
60
- // }
61
- }
@@ -1,26 +0,0 @@
1
- import type * as BlockEditor from "@wordpress/block-editor";
2
- import type * as Blocks from "@wordpress/blocks";
3
- import type * as Hooks from "@wordpress/hooks";
4
- import type * as Element from "@wordpress/element";
5
- import type * as Components from "@wordpress/components";
6
- import type * as Data from "@wordpress/data";
7
- import type * as CoreData from "@wordpress/core-data";
8
- import type * as Editor from "@wordpress/editor";
9
- import type * as Compose from "@wordpress/compose";
10
- import type * as RichText from "@wordpress/rich-text";
11
- type WordPressGlobal = {
12
- blockEditor: typeof BlockEditor;
13
- blocks: typeof Blocks;
14
- hooks: typeof Hooks;
15
- element: typeof Element;
16
- data: typeof Data;
17
- components: typeof Components;
18
- compose: typeof Compose;
19
- coreData: typeof CoreData;
20
- editor: typeof Editor;
21
- richText: typeof RichText;
22
- };
23
- declare global {
24
- const wp: WordPressGlobal;
25
- }
26
- export {};
@@ -1 +0,0 @@
1
- export {};