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
package/README.md
CHANGED
|
@@ -1,4 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
[](https://github.com/tinacms/tinacms/blob/main/LICENSE)
|
|
2
|
+
[](https://www.npmjs.com/package/tinacms)
|
|
3
|
+
[](https://github.com/tinacms/tinacms/actions/workflows/main.yml)
|
|
3
4
|
|
|
4
|
-
[
|
|
5
|
+
# [](https://tina.io)
|
|
6
|
+
|
|
7
|
+
[](https://tina.io/)
|
|
8
|
+
|
|
9
|
+
Tina is a headless content management system with support for **Markdown**, MDX, JSON, YAML, and more.
|
|
10
|
+
|
|
11
|
+
It comes with a GraphQL API:
|
|
12
|
+
|
|
13
|
+
- Query your Markdown content like this 👉 `post.author.firstName`
|
|
14
|
+
- Supports statically generated and server side rendered pages
|
|
15
|
+
- Supports references between documents
|
|
16
|
+
|
|
17
|
+
Tina offers a live preview (optional and opt-in) that makes editing Markdown files very intuitive for less-technical people.
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
Test a TinaCMS starter site locally
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
npx create-tina-app@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or try a [demo site](https://app.tina.io/quickstart) on Tina Cloud.
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
Visit [Tina's documentation](https://tina.io/docs/) to learn more.
|
|
32
|
+
|
|
33
|
+
## Questions?
|
|
34
|
+
|
|
35
|
+
[](https://twitter.com/intent/tweet?url=https%3A%2F%2Ftinacms.org&text=I%20just%20checked%20out%20@tinacms%20on%20GitHub%20and%20it%20is%20sweet%21&hashtags=TinaCMS%2Cjamstack%2Cheadlesscms)
|
|
36
|
+
[](https://github.com/tinacms/tinacms/discussions)
|
|
37
|
+
|
|
38
|
+
Visit the [GitHub Discussions](https://github.com/tinacms/tinacms/discussions) or our [Community Discord](https://discord.com/invite/zumN63Ybpf) to ask questions, or look us up on on Twitter at [@tinacms](https://twitter.com/tinacms).
|
|
39
|
+
|
|
40
|
+
<!-- ## Changelog
|
|
41
|
+
|
|
42
|
+
Check the [CHANGELOG](./CHANGELOG.md) for the latest updates to TinaCMS. -->
|
|
43
|
+
|
|
44
|
+
## Vision
|
|
45
|
+
|
|
46
|
+
To be the world-leading CMS with Git support that developers love.
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
|
|
50
|
+
See
|
|
51
|
+
https://tina.io/docs/introduction/faq/#what-is-tinas-tech-stack
|
|
52
|
+
|
|
53
|
+
## Roadmap
|
|
54
|
+
|
|
55
|
+
Our development priorities can be read on our [Public Roadmap](https://tina.io/roadmap/).
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
Please see our [./CONTRIBUTING.md](https://github.com/tinacms/tinacms/blob/main/CONTRIBUTING.md)
|
|
60
|
+
|
|
61
|
+
### Maintainers
|
|
62
|
+
|
|
63
|
+
- Kelly Davis ([@kldavis](https://github.com/kldavis4))
|
|
64
|
+
- Jeff See ([@jeffsee55](https://github.com/jeffsee55))
|
|
65
|
+
- Matt Wicks ([@wicksipedia](https://github.com/wicksipedia))
|
|
66
|
+
- Jack Pettit ([@JackDevAU](https://github.com/JackDevAU))
|
|
67
|
+
- Jord Gui ([@Jord-Gui](https://github.com/Jord-Gui))
|
|
68
|
+
- Nick Curran ([@ncn-ssw](https://github.com/ncn-ssw))
|
|
69
|
+
- Brook Jeynes ([@brookjeynes-ssw](https://github.com/brookjeynes-ssw))
|
|
70
|
+
- Ben Neoh ([@Ben0189](https://github.com/Ben0189))
|
|
71
|
+
- Warwick Leahy ([@leahy268](https://github.com/leahy268))
|
|
72
|
+
- Seth Daily ([@sethdaily ](https://github.com/sethdaily))
|
|
73
|
+
- Josh Berman ([@joshbermanssw](https://github.com/joshbermanssw))
|
|
74
|
+
- Scott Gallant ([@scottgallant](https://github.com/scottgallant))
|
|
75
|
+
- Adam Cogan ([@adamcogan](https://github.com/adamcogan))
|
|
76
|
+
|
|
77
|
+
View our awesome SSW devs at [ssw.com.au/people](https://www.ssw.com.au/people/?skill=%F0%9F%A6%99-TinaCMS).
|
|
78
|
+
|
|
79
|
+

|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Collection } from '@tinacms/schema-tools';
|
|
2
3
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
3
4
|
declare const CollectionCreatePage: () => React.JSX.Element;
|
|
4
5
|
export declare const RenderForm: ({ cms, collection, folder, templateName, mutationInfo, customDefaults, }: {
|
|
5
6
|
cms: TinaCMS;
|
|
6
|
-
collection:
|
|
7
|
+
collection: Collection;
|
|
7
8
|
folder: any;
|
|
8
9
|
templateName: any;
|
|
9
10
|
mutationInfo: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { NavigateFunction } from 'react-router-dom';
|
|
3
|
-
import { TinaCMS } from '@tinacms/toolkit';
|
|
2
|
+
import { type NavigateFunction } from 'react-router-dom';
|
|
3
|
+
import { type TinaCMS } from '@tinacms/toolkit';
|
|
4
4
|
import type { CollectionResponse, DocumentSys } from '../types';
|
|
5
5
|
import type { Collection } from '@tinacms/schema-tools';
|
|
6
6
|
export declare const handleNavigate: (navigate: NavigateFunction, cms: TinaCMS, collection: CollectionResponse, collectionDefinition: Collection<true>, document: DocumentSys) => Promise<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Cache } from './index';
|
|
2
|
-
export declare const NodeCache: (dir: string
|
|
2
|
+
export declare const NodeCache: (dir: string) => Promise<Cache>;
|
package/dist/client.js
CHANGED
|
@@ -14,17 +14,30 @@
|
|
|
14
14
|
errorPolicy,
|
|
15
15
|
cacheDir
|
|
16
16
|
}) {
|
|
17
|
+
this.initialized = false;
|
|
17
18
|
this.apiUrl = url;
|
|
18
19
|
this.readonlyToken = token == null ? void 0 : token.trim();
|
|
19
20
|
this.queries = queries(this);
|
|
20
21
|
this.errorPolicy = errorPolicy || "throw";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
this.cacheDir = cacheDir || "";
|
|
23
|
+
}
|
|
24
|
+
async init() {
|
|
25
|
+
if (this.initialized) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
if (this.cacheDir && typeof require !== "undefined") {
|
|
30
|
+
const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => nodeCache);
|
|
31
|
+
this.cache = await NodeCache2(this.cacheDir);
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error(e);
|
|
24
35
|
}
|
|
36
|
+
this.initialized = true;
|
|
25
37
|
}
|
|
26
38
|
async request({ errorPolicy, ...args }, options) {
|
|
27
39
|
var _a;
|
|
40
|
+
await this.init();
|
|
28
41
|
const errorPolicyDefined = errorPolicy || this.errorPolicy;
|
|
29
42
|
const headers = new HeadersDefined();
|
|
30
43
|
if (this.readonlyToken) {
|
|
@@ -92,6 +105,50 @@
|
|
|
92
105
|
const client = new TinaClient(args);
|
|
93
106
|
return client;
|
|
94
107
|
}
|
|
108
|
+
const makeCacheDir = async (dir, fs) => {
|
|
109
|
+
const path = await import("path");
|
|
110
|
+
const os = await import("os");
|
|
111
|
+
const parts = dir.split(path.sep).filter(Boolean);
|
|
112
|
+
let cacheDir = dir;
|
|
113
|
+
if (!fs.existsSync(path.join(path.sep, parts[0]))) {
|
|
114
|
+
cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
|
|
115
|
+
}
|
|
116
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
117
|
+
return cacheDir;
|
|
118
|
+
};
|
|
119
|
+
const NodeCache = async (dir) => {
|
|
120
|
+
const fs = await import("fs");
|
|
121
|
+
const { createHash } = await import("crypto");
|
|
122
|
+
const cacheDir = await makeCacheDir(dir, fs);
|
|
123
|
+
return {
|
|
124
|
+
makeKey: (key) => {
|
|
125
|
+
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
126
|
+
return createHash("sha256").update(input).digest("hex");
|
|
127
|
+
},
|
|
128
|
+
get: async (key) => {
|
|
129
|
+
try {
|
|
130
|
+
const data = await fs.promises.readFile(`${cacheDir}/${key}`, "utf-8");
|
|
131
|
+
return JSON.parse(data);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
if (e.code === "ENOENT") {
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
throw e;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
set: async (key, value) => {
|
|
140
|
+
await fs.promises.writeFile(
|
|
141
|
+
`${cacheDir}/${key}`,
|
|
142
|
+
JSON.stringify(value),
|
|
143
|
+
"utf-8"
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
149
|
+
__proto__: null,
|
|
150
|
+
NodeCache
|
|
151
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
95
152
|
exports2.TINA_HOST = TINA_HOST;
|
|
96
153
|
exports2.TinaClient = TinaClient;
|
|
97
154
|
exports2.createClient = createClient;
|
package/dist/client.mjs
CHANGED
|
@@ -11,17 +11,30 @@ class TinaClient {
|
|
|
11
11
|
errorPolicy,
|
|
12
12
|
cacheDir
|
|
13
13
|
}) {
|
|
14
|
+
this.initialized = false;
|
|
14
15
|
this.apiUrl = url;
|
|
15
16
|
this.readonlyToken = token == null ? void 0 : token.trim();
|
|
16
17
|
this.queries = queries(this);
|
|
17
18
|
this.errorPolicy = errorPolicy || "throw";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
this.cacheDir = cacheDir || "";
|
|
20
|
+
}
|
|
21
|
+
async init() {
|
|
22
|
+
if (this.initialized) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
if (this.cacheDir && typeof require !== "undefined") {
|
|
27
|
+
const { NodeCache } = await import("./node-cache-2267a9e4.mjs");
|
|
28
|
+
this.cache = await NodeCache(this.cacheDir);
|
|
29
|
+
}
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(e);
|
|
21
32
|
}
|
|
33
|
+
this.initialized = true;
|
|
22
34
|
}
|
|
23
35
|
async request({ errorPolicy, ...args }, options) {
|
|
24
36
|
var _a;
|
|
37
|
+
await this.init();
|
|
25
38
|
const errorPolicyDefined = errorPolicy || this.errorPolicy;
|
|
26
39
|
const headers = new HeadersDefined();
|
|
27
40
|
if (this.readonlyToken) {
|