tinacms 0.0.0-ad8dbc0-20241003000436 → 0.0.0-b20679d-20241024054309

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 (27) hide show
  1. package/dist/cache/node-cache.d.ts +1 -0
  2. package/dist/client.js +17 -15
  3. package/dist/client.mjs +2 -2
  4. package/dist/index.js +1533 -905
  5. package/dist/index.mjs +1502 -870
  6. package/dist/{node-cache-7fa2452c.mjs → node-cache-906fcb22.mjs} +16 -9
  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/package.json +8 -6
  27. 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) => Promise<string>;
2
3
  export declare const NodeCache: (dir: string) => Promise<Cache>;
package/dist/client.js CHANGED
@@ -26,7 +26,7 @@
26
26
  return;
27
27
  }
28
28
  try {
29
- if (this.cacheDir && window === void 0 && typeof require !== "undefined") {
29
+ if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
30
30
  const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => nodeCache);
31
31
  this.cache = await NodeCache2(this.cacheDir);
32
32
  }
@@ -106,19 +106,25 @@
106
106
  return client;
107
107
  }
108
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);
109
+ const path = require("node:path");
110
+ const os = require("node:os");
111
+ const pathParts = dir.split(path.sep).filter(Boolean);
112
+ const cacheHash = pathParts[pathParts.length - 1];
113
+ const rootUser = pathParts[0];
112
114
  let cacheDir = dir;
113
- if (!fs.existsSync(path.join(path.sep, parts[0]))) {
114
- cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
115
+ if (!fs.existsSync(path.join(path.sep, rootUser))) {
116
+ cacheDir = path.join(os.tmpdir(), cacheHash);
117
+ }
118
+ try {
119
+ fs.mkdirSync(cacheDir, { recursive: true });
120
+ } catch (error) {
121
+ throw new Error(`Failed to create cache directory: ${error.message}`);
115
122
  }
116
- fs.mkdirSync(cacheDir, { recursive: true });
117
123
  return cacheDir;
118
124
  };
119
125
  const NodeCache = async (dir) => {
120
- const fs = await Promise.resolve().then(() => __viteBrowserExternal$1);
121
- const { createHash } = await Promise.resolve().then(() => __viteBrowserExternal$1);
126
+ const fs = require("node:fs");
127
+ const { createHash } = require("node:crypto");
122
128
  const cacheDir = await makeCacheDir(dir, fs);
123
129
  return {
124
130
  makeKey: (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
@@ -23,8 +23,8 @@ class TinaClient {
23
23
  return;
24
24
  }
25
25
  try {
26
- if (this.cacheDir && window === void 0 && typeof require !== "undefined") {
27
- const { NodeCache } = await import("./node-cache-7fa2452c.mjs");
26
+ if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
27
+ const { NodeCache } = await import("./node-cache-906fcb22.mjs");
28
28
  this.cache = await NodeCache(this.cacheDir);
29
29
  }
30
30
  } catch (e) {