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.cjs CHANGED
@@ -2461,6 +2461,11 @@ function computePageEnHash(translatableFrontmatter, body) {
2461
2461
  }
2462
2462
 
2463
2463
  // src/translate/worklist.ts
2464
+ function parseContentTypeFilter(contentType) {
2465
+ if (!contentType) return void 0;
2466
+ const ids = contentType.split(",").map((id) => id.trim()).filter(Boolean);
2467
+ return ids.length > 0 ? new Set(ids) : void 0;
2468
+ }
2464
2469
  function listEnSlugs4(rootDir, contentDir) {
2465
2470
  const dir = path3__default.default.join(rootDir, contentDir);
2466
2471
  if (!fs2__default.default.existsSync(dir)) return [];
@@ -2470,8 +2475,9 @@ function buildWorklist(config, options = {}) {
2470
2475
  const db = openStore(config, "readonly");
2471
2476
  const items = [];
2472
2477
  const locales = options.locales ?? config.locales.filter((locale) => locale !== config.defaultLocale);
2478
+ const contentTypes = parseContentTypeFilter(options.contentType);
2473
2479
  for (const type of config.types) {
2474
- if (options.contentType && type.id !== options.contentType) continue;
2480
+ if (contentTypes && !contentTypes.has(type.id)) continue;
2475
2481
  const enSlugs = options.enSlug ? [options.enSlug] : listEnSlugs4(config.rootDir, type.contentDir);
2476
2482
  for (const enSlug of enSlugs) {
2477
2483
  const enDoc = readEnDocument(config, type, enSlug);
@@ -2491,12 +2497,13 @@ function buildWorklist(config, options = {}) {
2491
2497
  });
2492
2498
  continue;
2493
2499
  }
2494
- if (existing.en_hash !== currentEnHash) {
2500
+ const stale = existing.en_hash !== currentEnHash;
2501
+ if (stale || options.force) {
2495
2502
  items.push({
2496
2503
  contentType: type.id,
2497
2504
  enSlug,
2498
2505
  locale,
2499
- reason: "stale",
2506
+ reason: stale ? "stale" : "forced",
2500
2507
  currentEnHash,
2501
2508
  storedEnHash: existing.en_hash
2502
2509
  });