scribe-cms 0.0.20 → 0.0.22

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.
@@ -1169,18 +1169,18 @@ function parseTokenInner(inner) {
1169
1169
  }
1170
1170
  case "relation": {
1171
1171
  const parts = rest.split(":");
1172
- if (parts.length < 2 || parts.length > 3) {
1172
+ if (parts.length !== 3) {
1173
1173
  return {
1174
1174
  ok: false,
1175
- reason: `relation must be relation:<typeId>:<enSlug> or relation:<typeId>:<enSlug>:slug`
1175
+ reason: `relation must be relation:<typeId>:<enSlug>:href or relation:<typeId>:<enSlug>:slug`
1176
1176
  };
1177
1177
  }
1178
1178
  const [targetTypeId, enSlug, mode] = parts;
1179
1179
  if (!targetTypeId || !enSlug) {
1180
1180
  return { ok: false, reason: `relation is missing a typeId or enSlug` };
1181
1181
  }
1182
- if (mode !== void 0 && mode !== "slug") {
1183
- return { ok: false, reason: `relation mode must be "slug" (got "${mode}")` };
1182
+ if (mode !== "href" && mode !== "slug") {
1183
+ return { ok: false, reason: `relation mode must be "href" or "slug" (got "${mode}")` };
1184
1184
  }
1185
1185
  return {
1186
1186
  ok: true,
@@ -1188,7 +1188,7 @@ function parseTokenInner(inner) {
1188
1188
  kind: "relation",
1189
1189
  targetTypeId,
1190
1190
  enSlug,
1191
- mode: mode === "slug" ? "slug" : "url"
1191
+ mode
1192
1192
  }
1193
1193
  };
1194
1194
  }
@@ -1294,7 +1294,9 @@ function isStringRecord(value) {
1294
1294
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1295
1295
  return Object.values(value).every((v) => typeof v === "string");
1296
1296
  }
1297
- function createInlineResolver(config) {
1297
+ function createInlineResolver(config, options = {}) {
1298
+ const linkStyle = options.linkStyle ?? "app";
1299
+ const exportExtension = options.exportExtension ?? ".md";
1298
1300
  const urlBuilder = createUrlBuilder(config);
1299
1301
  const typeById = new Map(config.types.map((t) => [t.id, t]));
1300
1302
  const storePath = resolveStorePath(config);
@@ -1355,7 +1357,10 @@ function createInlineResolver(config) {
1355
1357
  if (token.mode === "slug") return token.enSlug;
1356
1358
  if (!isRoutableType(type)) return "";
1357
1359
  const slug = localizedSlug(token.targetTypeId, token.enSlug, locale);
1358
- return urlBuilder.resolvePath(type.path, slug, locale);
1360
+ if (linkStyle === "export") {
1361
+ return urlBuilder.resolvePath(type.path, `${slug}${exportExtension}`, locale);
1362
+ }
1363
+ return type.path.replace("{slug}", slug);
1359
1364
  }
1360
1365
  }
1361
1366
  }
@@ -1896,7 +1901,10 @@ function createProject(config, options = {}) {
1896
1901
  }
1897
1902
  return runtime;
1898
1903
  };
1899
- const inlineResolver = options.resolveInlineTokens ? createInlineResolver(config) : void 0;
1904
+ const inlineResolver = options.resolveInlineTokens ? createInlineResolver(config, {
1905
+ linkStyle: options.inlineLinkStyle,
1906
+ exportExtension: options.exportLinkExtension
1907
+ }) : void 0;
1900
1908
  for (const type of config.types) {
1901
1909
  runtimes.set(
1902
1910
  type.id,
@@ -2652,7 +2660,7 @@ function validateInlineTokens(config) {
2652
2660
  });
2653
2661
  break;
2654
2662
  }
2655
- if (token.mode === "url") {
2663
+ if (token.mode === "href") {
2656
2664
  const targetType = typeById.get(token.targetTypeId);
2657
2665
  if (!isRoutableType(targetType)) {
2658
2666
  issues.push({
@@ -3356,10 +3364,10 @@ var LOCALE_NAMES = {
3356
3364
  };
3357
3365
  function defaultLocalizationPrompt(localeName, locale) {
3358
3366
  return [
3359
- `Localize the content above into natural ${localeName} (${locale}).`,
3360
- "Do not translate word-for-word.",
3361
- "Preserve the source tone and brand voice.",
3362
- "Write as if a native speaker authored it for the target market."
3367
+ `Write the content above in natural ${localeName} (${locale}), as if it had been originally authored by a native ${localeName} copywriter for that market.`,
3368
+ `Preserve the source tone and brand voice, but express every idea the way ${localeName} copy actually reads \u2014 never word-for-word.`,
3369
+ `Use native ${localeName} typographic conventions for quotation marks, apostrophes, and spacing around punctuation \u2014 not the source language's.`,
3370
+ `Before returning, re-read each ${localeName} sentence on its own: if it is ambiguous, unidiomatic, or reads like a translation, rewrite it.`
3363
3371
  ].join(" ");
3364
3372
  }
3365
3373
  function buildLocalizationPrompt(promptOverride, localeName, locale) {
@@ -3369,7 +3377,12 @@ function buildLocalizationPrompt(promptOverride, localeName, locale) {
3369
3377
 
3370
3378
  ${localeDirective}`;
3371
3379
  }
3372
- var TASK_FRAMING = "You are localizing the content below into a target language specified at the end of this prompt.";
3380
+ var TASK_FRAMING = [
3381
+ "You are a native-speaker marketing copywriter producing the localized edition of the content below. The target language is specified at the end of this prompt.",
3382
+ "You are NOT translating a document. Each sentence in the source tells you the INTENT \u2014 what it must make the reader feel or understand. Write copy that accomplishes the same thing, the way a native copywriter would have written it from scratch.",
3383
+ "Never mirror the source sentence structure when the target language would naturally phrase the idea differently. Calqued syntax is the #1 failure mode.",
3384
+ "When the source uses wordplay, an idiom, or a punchy rhetorical device, recreate the effect rather than the words. If no natural equivalent exists, write a plain, confident line that carries the same message \u2014 never a literal rendering that sounds odd or ambiguous in the target language."
3385
+ ].join("\n");
3373
3386
  function buildOutputFormatLine(hasFrontmatter, slugStrategy) {
3374
3387
  if (!hasFrontmatter) {
3375
3388
  return slugStrategy === "localized" ? "`body` (string, full MDX body), `slug` (string)." : "`body` (string, full MDX body).";