eddev 2.0.0-beta.71 → 2.0.0-beta.72

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.
@@ -119,7 +119,6 @@ export class ServerContext {
119
119
  return result;
120
120
  }
121
121
  async fetchAppData() {
122
- // console.log("Fetching app data")
123
122
  const response = await this.fetchOrigin("/_appdata", {
124
123
  cache: "no-cache",
125
124
  replaceUrls: true,
@@ -128,9 +127,7 @@ export class ServerContext {
128
127
  Accept: "application/json",
129
128
  },
130
129
  });
131
- // console.log("Decoding app data")
132
130
  const result = await response.json();
133
- // console.log("Done with app done")
134
131
  return result;
135
132
  }
136
133
  extractRequestHeaders(req) {
@@ -0,0 +1,7 @@
1
+ import { Cache } from "@epic-web/cachified";
2
+ export declare function swr<T>(args: {
3
+ key: string;
4
+ fetcher: () => Promise<T>;
5
+ ttl?: number;
6
+ cache?: Cache;
7
+ }): Promise<T>;
@@ -0,0 +1,29 @@
1
+ import { LRUCache } from "lru-cache";
2
+ import { cachified, totalTtl } from "@epic-web/cachified";
3
+ /* lru cache is not part of this package but a simple non-persistent cache */
4
+ const lruInstance = new LRUCache({ max: 1000 });
5
+ const lru = {
6
+ set(key, value) {
7
+ const ttl = totalTtl(value?.metadata);
8
+ return lruInstance.set(key, value, {
9
+ ttl: ttl === Infinity ? undefined : ttl,
10
+ start: value?.metadata?.createdTime,
11
+ });
12
+ },
13
+ get(key) {
14
+ return lruInstance.get(key);
15
+ },
16
+ delete(key) {
17
+ return lruInstance.delete(key);
18
+ },
19
+ };
20
+ export function swr(args) {
21
+ return cachified({
22
+ key: args.key,
23
+ cache: args.cache ?? lru,
24
+ getFreshValue: args.fetcher,
25
+ ttl: args.ttl,
26
+ swr: 3600_000,
27
+ fallbackToCache: 15_000,
28
+ });
29
+ }
@@ -1 +1 @@
1
- export declare const VERSION = "2.0.0-beta.71";
1
+ export declare const VERSION = "2.0.0-beta.72";
@@ -1 +1 @@
1
- export const VERSION = "2.0.0-beta.71";
1
+ export const VERSION = "2.0.0-beta.72";
@@ -130,8 +130,7 @@ export function createVinxiApp(args) {
130
130
  handler: `${folder}/handler.wp-proxy.ts`,
131
131
  target: "server",
132
132
  plugins: () => [
133
- tsconfigPaths(),
134
- envPlugin({
133
+ ...corePlugins({
135
134
  rootDir: args.rootDir,
136
135
  console: log,
137
136
  mode: args.mode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.0.0-beta.71",
3
+ "version": "2.0.0-beta.72",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -77,6 +77,7 @@
77
77
  "dependencies": {
78
78
  "@babel/types": "^7.25.2",
79
79
  "@clack/prompts": "^0.7.0",
80
+ "@epic-web/cachified": "^5.2.0",
80
81
  "@graphql-codegen/core": "^4.0.0",
81
82
  "@graphql-codegen/typescript": "^4.0.1",
82
83
  "@graphql-codegen/typescript-operations": "^4.0.1",
@@ -105,6 +106,7 @@
105
106
  "ink-spinner": "^5.0.0",
106
107
  "ink-text-input": "^6.0.0",
107
108
  "listhen": "^1.6.0",
109
+ "lru-cache": "^11.0.2",
108
110
  "mkcert": "^3.2.0",
109
111
  "obj-console": "^1.0.2",
110
112
  "object-code": "^1.3.3",