Skip to content

Commit 4f61267

Browse files
committed
RELEASING: Releasing 2 package(s)
Releases: @m2d/core@1.4.0 @repo/shared@0.0.21
1 parent f4157a2 commit 4f61267

File tree

6 files changed

+46
-41
lines changed

6 files changed

+46
-41
lines changed

.changeset/lazy-bars-call.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

lib/CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# @m2d/core
22

3+
## 1.4.0
4+
5+
### Minor Changes
6+
7+
- 0a4b4b6: Refactored `createPersistentCache` to accept a `config` object for optional settings.
8+
9+
**Before:**
10+
11+
```ts
12+
createPersistentCache(generator, namespace, ignoreKeys?, useIdb?)
13+
```
14+
15+
**Now:**
16+
17+
```ts
18+
createPersistentCache(generator, namespace, {
19+
ignoreKeys,
20+
cache, // optional in-memory cache object for cross-plugin sharing
21+
cacheTarget, // "memory" | "idb" | "both" (default: "both")
22+
parallel, // compute + read race (default: true)
23+
});
24+
```
25+
26+
- **In-memory cache sharing**: Pass a shared cache object to coordinate between modules or tabs.
27+
- **Configurable cache strategies**:
28+
29+
- `cacheTarget`: choose where data is stored — RAM, IndexedDB, or both.
30+
- `parallel`: race compute and read to optimize latency.
31+
32+
This is a **breaking change** for plugins that use caching due to the updated function signature.
33+
No changes for other users.
34+
335
## 1.3.4
436
537
### Patch Changes

lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@m2d/core",
33
"author": "Mayank Kumar Chaudhari (https://mayank-chaudhari.vercel.app)",
44
"private": false,
5-
"version": "1.3.4",
5+
"version": "1.4.0",
66
"description": "Core engine to convert extended MDAST to DOCX. Supports plugins for footnotes, images, lists, tables, and more. Designed for seamless Markdown-to-DOCX conversion.",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",

lib/src/utils/cache.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ export const generateCacheKey = async (
180180
* - `cache` _(Record<string, Promise<Result>>)_ — External in-memory cache object to sync across plugins/tabs (default: internal default cache)
181181
* - `cacheTarget` _(`"memory"` | `"idb"` | `"both"`)_ — Where to store the result:
182182
* - `"memory"`: RAM-only; fast but temporary
183-
* - `"idb"`: stores in IndexedDB only; avoids memory usage
183+
* - `"idb"`: stores in IndexedDB only; avoids memory usage; Useful for processing large data
184184
* - `"both"` (default): caches in both RAM and IndexedDB
185-
* - `resolveInParallel` _(boolean)_ — If true, reads from cache and computes in parallel (default: `true`);
185+
* - `parallel` _(boolean)_ — If true, reads from cache and computes in parallel (default: `true`);
186186
* ignored when `cacheTarget` is `"memory"`
187187
*
188188
* @returns A memoized async function that handles caching automatically.
@@ -198,14 +198,14 @@ export const createPersistentCache = <Args extends unknown[], Result>(
198198
ignoreKeys?: string[];
199199
cache?: Record<string, Promise<Result>>;
200200
cacheTarget?: "idb" | "memory" | "both";
201-
resolveInParallel?: boolean;
201+
parallel?: boolean;
202202
},
203203
): ((...args: Args) => Promise<Result>) => {
204204
const {
205205
ignoreKeys = [],
206206
cache = defaultCache as Record<string, Promise<Result>>,
207207
cacheTarget = "both",
208-
resolveInParallel = true,
208+
parallel = true,
209209
} = config ?? {};
210210

211211
return async (...args: Args): Promise<Result> => {
@@ -214,7 +214,7 @@ export const createPersistentCache = <Args extends unknown[], Result>(
214214
if (cacheTarget === "memory") return (cache[cacheKey] ??= generator(...args));
215215

216216
const resultPromise = (async () => {
217-
const result = resolveInParallel
217+
const result = parallel
218218
? await Promise.any([
219219
readFromCache<Result>(cacheKey).then(result => result ?? Promise.reject()),
220220
generator(...args),

packages/shared/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @repo/shared
22

3+
## 0.0.21
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [0a4b4b6]
8+
- @m2d/core@1.4.0
9+
310
## 0.0.20
411

512
### Patch Changes

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@repo/shared",
3-
"version": "0.0.20",
3+
"version": "0.0.21",
44
"private": true,
55
"sideEffects": false,
66
"main": "./dist/index.js",

0 commit comments

Comments
 (0)