scribe-cms 0.0.16 → 0.0.17

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/dist/index.js CHANGED
@@ -2448,6 +2448,11 @@ function computePageEnHash(translatableFrontmatter, body) {
2448
2448
  }
2449
2449
 
2450
2450
  // src/translate/worklist.ts
2451
+ function parseContentTypeFilter(contentType) {
2452
+ if (!contentType) return void 0;
2453
+ const ids = contentType.split(",").map((id) => id.trim()).filter(Boolean);
2454
+ return ids.length > 0 ? new Set(ids) : void 0;
2455
+ }
2451
2456
  function listEnSlugs4(rootDir, contentDir) {
2452
2457
  const dir = path3.join(rootDir, contentDir);
2453
2458
  if (!fs2.existsSync(dir)) return [];
@@ -2457,8 +2462,9 @@ function buildWorklist(config, options = {}) {
2457
2462
  const db = openStore(config, "readonly");
2458
2463
  const items = [];
2459
2464
  const locales = options.locales ?? config.locales.filter((locale) => locale !== config.defaultLocale);
2465
+ const contentTypes = parseContentTypeFilter(options.contentType);
2460
2466
  for (const type of config.types) {
2461
- if (options.contentType && type.id !== options.contentType) continue;
2467
+ if (contentTypes && !contentTypes.has(type.id)) continue;
2462
2468
  const enSlugs = options.enSlug ? [options.enSlug] : listEnSlugs4(config.rootDir, type.contentDir);
2463
2469
  for (const enSlug of enSlugs) {
2464
2470
  const enDoc = readEnDocument(config, type, enSlug);
@@ -2478,12 +2484,13 @@ function buildWorklist(config, options = {}) {
2478
2484
  });
2479
2485
  continue;
2480
2486
  }
2481
- if (existing.en_hash !== currentEnHash) {
2487
+ const stale = existing.en_hash !== currentEnHash;
2488
+ if (stale || options.force) {
2482
2489
  items.push({
2483
2490
  contentType: type.id,
2484
2491
  enSlug,
2485
2492
  locale,
2486
- reason: "stale",
2493
+ reason: stale ? "stale" : "forced",
2487
2494
  currentEnHash,
2488
2495
  storedEnHash: existing.en_hash
2489
2496
  });