tinacms 2.2.9 → 2.4.0

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 (28) hide show
  1. package/dist/cache/node-cache.d.ts +1 -0
  2. package/dist/client.js +18 -16
  3. package/dist/client.mjs +1 -1
  4. package/dist/index.js +1429 -769
  5. package/dist/index.mjs +1410 -746
  6. package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
  7. package/dist/rich-text/index.d.ts +3 -0
  8. package/dist/rich-text/index.js +45 -12
  9. package/dist/rich-text/index.mjs +45 -12
  10. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  11. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
  12. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
  13. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
  14. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
  15. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
  24. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +7 -3
  25. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +1 -1
  26. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  27. package/package.json +8 -6
  28. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
@@ -1,2 +1,3 @@
1
1
  import type { Cache } from './index';
2
+ export declare const makeCacheDir: (dir: string, fs: any, path: any, os: any) => Promise<string>;
2
3
  export declare const NodeCache: (dir: string) => Promise<Cache>;
package/dist/client.js CHANGED
@@ -105,21 +105,27 @@
105
105
  const client = new TinaClient(args);
106
106
  return client;
107
107
  }
108
- const makeCacheDir = async (dir, fs) => {
109
- const path = await Promise.resolve().then(() => __viteBrowserExternal$1);
110
- const os = await Promise.resolve().then(() => __viteBrowserExternal$1);
111
- const parts = dir.split(path.sep).filter(Boolean);
108
+ const makeCacheDir = async (dir, fs, path, os) => {
109
+ const pathParts = dir.split(path.sep).filter(Boolean);
110
+ const cacheHash = pathParts[pathParts.length - 1];
111
+ const rootUser = pathParts[0];
112
112
  let cacheDir = dir;
113
- if (!fs.existsSync(path.join(path.sep, parts[0]))) {
114
- cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
113
+ if (!fs.existsSync(path.join(path.sep, rootUser))) {
114
+ cacheDir = path.join(os.tmpdir(), cacheHash);
115
+ }
116
+ try {
117
+ fs.mkdirSync(cacheDir, { recursive: true });
118
+ } catch (error) {
119
+ throw new Error(`Failed to create cache directory: ${error.message}`);
115
120
  }
116
- fs.mkdirSync(cacheDir, { recursive: true });
117
121
  return cacheDir;
118
122
  };
119
123
  const NodeCache = async (dir) => {
120
- const fs = await Promise.resolve().then(() => __viteBrowserExternal$1);
121
- const { createHash } = await Promise.resolve().then(() => __viteBrowserExternal$1);
122
- const cacheDir = await makeCacheDir(dir, fs);
124
+ const fs = require("node:fs");
125
+ const path = require("node:path");
126
+ const os = require("node:os");
127
+ const { createHash } = require("node:crypto");
128
+ const cacheDir = await makeCacheDir(dir, fs, path, os);
123
129
  return {
124
130
  makeKey: (key) => {
125
131
  const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
@@ -147,12 +153,8 @@
147
153
  };
148
154
  const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
149
155
  __proto__: null,
150
- NodeCache
151
- }, Symbol.toStringTag, { value: "Module" }));
152
- const __viteBrowserExternal = {};
153
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154
- __proto__: null,
155
- default: __viteBrowserExternal
156
+ NodeCache,
157
+ makeCacheDir
156
158
  }, Symbol.toStringTag, { value: "Module" }));
157
159
  exports2.TINA_HOST = TINA_HOST;
158
160
  exports2.TinaClient = TinaClient;
package/dist/client.mjs CHANGED
@@ -24,7 +24,7 @@ class TinaClient {
24
24
  }
25
25
  try {
26
26
  if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
27
- const { NodeCache } = await import("./node-cache-7fa2452c.mjs");
27
+ const { NodeCache } = await import("./node-cache-4c336858.mjs");
28
28
  this.cache = await NodeCache(this.cacheDir);
29
29
  }
30
30
  } catch (e) {