tinacms 3.9.0 → 3.9.2

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/client.js CHANGED
@@ -126,6 +126,15 @@ function replaceGithubPathSplit(url, replacement) {
126
126
  return url;
127
127
  }
128
128
  }
129
+ function isEdgeRuntimeWithoutFs() {
130
+ if (typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") {
131
+ return true;
132
+ }
133
+ if (typeof globalThis.EdgeRuntime !== "undefined") {
134
+ return true;
135
+ }
136
+ return false;
137
+ }
129
138
  var TinaClient = class {
130
139
  apiUrl;
131
140
  readonlyToken;
@@ -135,25 +144,28 @@ var TinaClient = class {
135
144
  cacheLock;
136
145
  cacheDir;
137
146
  cache;
147
+ cacheEnabled;
138
148
  constructor({
139
149
  token,
140
150
  url,
141
151
  queries,
142
152
  errorPolicy,
143
- cacheDir
153
+ cacheDir,
154
+ cache
144
155
  }) {
145
156
  this.apiUrl = url;
146
157
  this.readonlyToken = token?.trim();
147
158
  this.queries = queries(this);
148
159
  this.errorPolicy = errorPolicy || "throw";
149
160
  this.cacheDir = cacheDir || "";
161
+ this.cacheEnabled = cache !== false;
150
162
  }
151
163
  async init() {
152
164
  if (this.initialized) {
153
165
  return;
154
166
  }
155
167
  try {
156
- if (this.cacheDir && typeof window === "undefined") {
168
+ if (this.cacheEnabled && this.cacheDir && typeof window === "undefined" && !isEdgeRuntimeWithoutFs()) {
157
169
  const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => (init_node_cache(), node_cache_exports));
158
170
  this.cache = await NodeCache2(this.cacheDir);
159
171
  if (this.cache) {
package/dist/index.js CHANGED
@@ -13186,7 +13186,7 @@ const NavProvider = ({
13186
13186
  const name = "tinacms";
13187
13187
  const type = "module";
13188
13188
  const typings = "dist/index.d.ts";
13189
- const version$1 = "3.9.0";
13189
+ const version$1 = "3.9.2";
13190
13190
  const main = "dist/index.js";
13191
13191
  const module = "./dist/index.js";
13192
13192
  const exports = {
@@ -9,6 +9,13 @@ export interface TinaClientArgs<GenQueries = Record<string, unknown>> {
9
9
  queries: (client: TinaClient<GenQueries>) => GenQueries;
10
10
  errorPolicy?: Config['client']['errorPolicy'];
11
11
  cacheDir?: string;
12
+ /**
13
+ * Set to `false` to force-disable the filesystem-backed response cache, even
14
+ * when a `cacheDir` is provided. Useful as an escape hatch on runtimes where
15
+ * the cache shouldn't run (e.g. an edge runtime not auto-detected). Defaults
16
+ * to enabled when a `cacheDir` is set.
17
+ */
18
+ cache?: boolean;
12
19
  }
13
20
  export type TinaClientRequestArgs = {
14
21
  variables?: Record<string, any>;
@@ -30,7 +37,8 @@ export declare class TinaClient<GenQueries> {
30
37
  cacheLock: AsyncLock | undefined;
31
38
  cacheDir: string;
32
39
  cache: Cache | null;
33
- constructor({ token, url, queries, errorPolicy, cacheDir, }: TinaClientArgs<GenQueries>);
40
+ cacheEnabled: boolean;
41
+ constructor({ token, url, queries, errorPolicy, cacheDir, cache, }: TinaClientArgs<GenQueries>);
34
42
  init(): Promise<void>;
35
43
  request<DataType extends Record<string, any> = any>({ errorPolicy, ...args }: TinaClientRequestArgs, options: {
36
44
  fetchOptions?: Parameters<typeof fetch>[1];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tinacms",
3
3
  "type": "module",
4
4
  "typings": "dist/index.d.ts",
5
- "version": "3.9.0",
5
+ "version": "3.9.2",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -117,10 +117,10 @@
117
117
  "webfontloader": "1.6.28",
118
118
  "yup": "^1.6.1",
119
119
  "zod": "^3.24.2",
120
- "@tinacms/schema-tools": "2.8.1",
121
120
  "@tinacms/bridge": "0.3.0",
122
121
  "@tinacms/mdx": "2.1.6",
123
- "@tinacms/search": "1.2.17"
122
+ "@tinacms/schema-tools": "2.8.1",
123
+ "@tinacms/search": "1.2.18"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@graphql-tools/utils": "^10.8.1",