tinacms 2.2.4 → 2.2.6
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/README.md +78 -3
- package/dist/admin/pages/CollectionCreatePage.d.ts +2 -1
- package/dist/admin/pages/CollectionListPage.d.ts +2 -2
- package/dist/cache/node-cache.d.ts +1 -1
- package/dist/client.js +60 -3
- package/dist/client.mjs +16 -3
- package/dist/index.js +718 -301
- package/dist/index.mjs +721 -304
- package/dist/node-cache-2267a9e4.mjs +43 -0
- package/dist/toolkit/fields/plugins/blocks-field-plugin/block-selector-big.d.ts +1 -1
- package/dist/toolkit/fields/plugins/blocks-field-plugin/block-selector.d.ts +1 -1
- package/dist/toolkit/react-sidebar/components/nav.d.ts +1 -1
- package/dist/toolkit/react-sidebar/components/sidebar.d.ts +1 -6
- package/dist/unifiedClient/index.d.ts +3 -0
- package/package.json +24 -20
- package/dist/cache.js +0 -36
- package/dist/cache.mjs +0 -32
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const makeCacheDir = async (dir, fs) => {
|
|
2
|
+
const path = await import("path");
|
|
3
|
+
const os = await import("os");
|
|
4
|
+
const parts = dir.split(path.sep).filter(Boolean);
|
|
5
|
+
let cacheDir = dir;
|
|
6
|
+
if (!fs.existsSync(path.join(path.sep, parts[0]))) {
|
|
7
|
+
cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
|
|
8
|
+
}
|
|
9
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
10
|
+
return cacheDir;
|
|
11
|
+
};
|
|
12
|
+
const NodeCache = async (dir) => {
|
|
13
|
+
const fs = await import("fs");
|
|
14
|
+
const { createHash } = await import("crypto");
|
|
15
|
+
const cacheDir = await makeCacheDir(dir, fs);
|
|
16
|
+
return {
|
|
17
|
+
makeKey: (key) => {
|
|
18
|
+
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
19
|
+
return createHash("sha256").update(input).digest("hex");
|
|
20
|
+
},
|
|
21
|
+
get: async (key) => {
|
|
22
|
+
try {
|
|
23
|
+
const data = await fs.promises.readFile(`${cacheDir}/${key}`, "utf-8");
|
|
24
|
+
return JSON.parse(data);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
if (e.code === "ENOENT") {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
throw e;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
set: async (key, value) => {
|
|
33
|
+
await fs.promises.writeFile(
|
|
34
|
+
`${cacheDir}/${key}`,
|
|
35
|
+
JSON.stringify(value),
|
|
36
|
+
"utf-8"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
NodeCache
|
|
43
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { ScreenPlugin } from '../../react-screens';
|
|
3
|
-
import { CloudConfigPlugin } from '../../react-cloud-config';
|
|
3
|
+
import type { CloudConfigPlugin } from '../../react-cloud-config';
|
|
4
4
|
interface NavCollection {
|
|
5
5
|
label?: string;
|
|
6
6
|
name: string;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
1
|
import * as React from 'react';
|
|
7
|
-
import { SidebarState, SidebarStateOptions } from '../sidebar';
|
|
2
|
+
import type { SidebarState, SidebarStateOptions } from '../sidebar';
|
|
8
3
|
export declare const SidebarContext: React.Context<any>;
|
|
9
4
|
export declare const minPreviewWidth = 440;
|
|
10
5
|
export declare const minSidebarWidth = 360;
|
|
@@ -24,8 +24,11 @@ export declare class TinaClient<GenQueries> {
|
|
|
24
24
|
readonlyToken?: string;
|
|
25
25
|
queries: GenQueries;
|
|
26
26
|
errorPolicy: Config['client']['errorPolicy'];
|
|
27
|
+
initialized: boolean;
|
|
28
|
+
cacheDir: string;
|
|
27
29
|
cache: Cache;
|
|
28
30
|
constructor({ token, url, queries, errorPolicy, cacheDir, }: TinaClientArgs<GenQueries>);
|
|
31
|
+
init(): Promise<void>;
|
|
29
32
|
request<DataType extends Record<string, any> = any>({ errorPolicy, ...args }: TinaClientRequestArgs, options: {
|
|
30
33
|
fetchOptions?: Parameters<typeof fetch>[1];
|
|
31
34
|
}): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
"import": "./dist/client.mjs",
|
|
15
15
|
"require": "./dist/client.js"
|
|
16
16
|
},
|
|
17
|
-
"./dist/cache": {
|
|
18
|
-
"types": "./dist/cache.d.ts",
|
|
19
|
-
"import": "./dist/cache.mjs",
|
|
20
|
-
"require": "./dist/cache.js"
|
|
21
|
-
},
|
|
22
17
|
"./dist/edit-state": {
|
|
23
18
|
"types": "./dist/edit-state.d.ts",
|
|
24
19
|
"import": "./dist/edit-state.mjs",
|
|
@@ -49,19 +44,27 @@
|
|
|
49
44
|
"src/rich-text/index.tsx",
|
|
50
45
|
"src/rich-text/prism.tsx",
|
|
51
46
|
"src/react.tsx",
|
|
52
|
-
"src/client.ts"
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
"src/client.ts"
|
|
48
|
+
],
|
|
49
|
+
"build": {
|
|
50
|
+
"rollupOptions": {
|
|
51
|
+
"external": [
|
|
52
|
+
"crypto",
|
|
53
|
+
"fs",
|
|
54
|
+
"path",
|
|
55
|
+
"os"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
55
59
|
},
|
|
56
60
|
"typings": "dist/index.d.ts",
|
|
57
61
|
"license": "Apache-2.0",
|
|
58
62
|
"dependencies": {
|
|
59
|
-
"cmdk": "^1.0.0",
|
|
60
63
|
"@ariakit/react": "^0.4.7",
|
|
61
64
|
"@floating-ui/dom": "^1.6.9",
|
|
62
65
|
"@floating-ui/react-dom": "^2.1.1",
|
|
63
66
|
"@graphql-inspector/core": "^6.1.0",
|
|
64
|
-
"@headlessui/react": "
|
|
67
|
+
"@headlessui/react": "2.1.8",
|
|
65
68
|
"@heroicons/react": "^1.0.4",
|
|
66
69
|
"@monaco-editor/react": "4.4.5",
|
|
67
70
|
"@radix-ui/react-checkbox": "^1.1.1",
|
|
@@ -89,6 +92,8 @@
|
|
|
89
92
|
"@udecode/plate-paragraph": "^36.0.0",
|
|
90
93
|
"@udecode/plate-slash-command": "^36.0.0",
|
|
91
94
|
"class-variance-authority": "^0.7.0",
|
|
95
|
+
"clsx": "^2.1.1",
|
|
96
|
+
"cmdk": "^1.0.0",
|
|
92
97
|
"color-string": "^1.9.1",
|
|
93
98
|
"crypto-js": "^4.2.0",
|
|
94
99
|
"date-fns": "2.30.0",
|
|
@@ -118,14 +123,13 @@
|
|
|
118
123
|
"slate-history": "^0.100.0",
|
|
119
124
|
"slate-hyperscript": "^0.100.0",
|
|
120
125
|
"slate-react": "^0.107.1",
|
|
121
|
-
"webfontloader": "1.6.28",
|
|
122
126
|
"tailwind-merge": "^2.4.0",
|
|
123
|
-
"
|
|
127
|
+
"webfontloader": "1.6.28",
|
|
124
128
|
"yup": "^1.4.0",
|
|
125
129
|
"zod": "^3.23.8",
|
|
126
|
-
"@tinacms/
|
|
127
|
-
"@tinacms/search": "1.0.
|
|
128
|
-
"@tinacms/
|
|
130
|
+
"@tinacms/schema-tools": "1.6.3",
|
|
131
|
+
"@tinacms/search": "1.0.30",
|
|
132
|
+
"@tinacms/mdx": "1.4.3"
|
|
129
133
|
},
|
|
130
134
|
"devDependencies": {
|
|
131
135
|
"@graphql-tools/utils": "^10.3.3",
|
|
@@ -138,7 +142,7 @@
|
|
|
138
142
|
"@types/color-string": "^1.5.5",
|
|
139
143
|
"@types/lodash.debounce": "^4.0.9",
|
|
140
144
|
"@types/lodash.get": "^4.4.9",
|
|
141
|
-
"@types/node": "^22.
|
|
145
|
+
"@types/node": "^22.7.3",
|
|
142
146
|
"@types/prop-types": "^15.7.12",
|
|
143
147
|
"@types/react": "^18.3.3",
|
|
144
148
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
@@ -149,16 +153,16 @@
|
|
|
149
153
|
"identity-obj-proxy": "^3.0.0",
|
|
150
154
|
"isomorphic-fetch": "^3.0.0",
|
|
151
155
|
"jest-file-snapshot": "^0.7.0",
|
|
152
|
-
"next": "14.2.
|
|
156
|
+
"next": "14.2.10",
|
|
153
157
|
"react": "^18.3.1",
|
|
154
158
|
"react-dom": "^18.3.1",
|
|
155
159
|
"react-is": "^18.3.1",
|
|
156
160
|
"tsc-alias": "^1.8.10",
|
|
157
161
|
"tslib": "^2.6.3",
|
|
158
|
-
"typescript": "^5.
|
|
162
|
+
"typescript": "^5.6.2",
|
|
159
163
|
"vite": "^5.3.5",
|
|
160
164
|
"vitest": "^2.0.5",
|
|
161
|
-
"@tinacms/scripts": "1.2.
|
|
165
|
+
"@tinacms/scripts": "1.2.2"
|
|
162
166
|
},
|
|
163
167
|
"peerDependencies": {
|
|
164
168
|
"react": ">=16.14.0",
|
package/dist/cache.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}));
|
|
3
|
-
})(this, function(exports2) {
|
|
4
|
-
"use strict";
|
|
5
|
-
const { createHash } = require("crypto");
|
|
6
|
-
const makeKey = (key) => {
|
|
7
|
-
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
8
|
-
return createHash("sha256").update(input).digest("hex");
|
|
9
|
-
};
|
|
10
|
-
const NodeCache = (dir, fs) => {
|
|
11
|
-
return {
|
|
12
|
-
makeKey,
|
|
13
|
-
get: async (key) => {
|
|
14
|
-
try {
|
|
15
|
-
const data = await fs.promises.readFile(`${dir}/${key}`, "utf-8");
|
|
16
|
-
return JSON.parse(data);
|
|
17
|
-
} catch (e) {
|
|
18
|
-
if (e.code === "ENOENT") {
|
|
19
|
-
return void 0;
|
|
20
|
-
}
|
|
21
|
-
throw e;
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
set: async (key, value) => {
|
|
25
|
-
await fs.promises.mkdir(dir, { recursive: true });
|
|
26
|
-
await fs.promises.writeFile(
|
|
27
|
-
`${dir}/${key}`,
|
|
28
|
-
JSON.stringify(value),
|
|
29
|
-
"utf-8"
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
exports2.NodeCache = NodeCache;
|
|
35
|
-
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
36
|
-
});
|
package/dist/cache.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const { createHash } = require("crypto");
|
|
2
|
-
const makeKey = (key) => {
|
|
3
|
-
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
4
|
-
return createHash("sha256").update(input).digest("hex");
|
|
5
|
-
};
|
|
6
|
-
const NodeCache = (dir, fs) => {
|
|
7
|
-
return {
|
|
8
|
-
makeKey,
|
|
9
|
-
get: async (key) => {
|
|
10
|
-
try {
|
|
11
|
-
const data = await fs.promises.readFile(`${dir}/${key}`, "utf-8");
|
|
12
|
-
return JSON.parse(data);
|
|
13
|
-
} catch (e) {
|
|
14
|
-
if (e.code === "ENOENT") {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
set: async (key, value) => {
|
|
21
|
-
await fs.promises.mkdir(dir, { recursive: true });
|
|
22
|
-
await fs.promises.writeFile(
|
|
23
|
-
`${dir}/${key}`,
|
|
24
|
-
JSON.stringify(value),
|
|
25
|
-
"utf-8"
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
NodeCache
|
|
32
|
-
};
|