ssml-builder-js 2.10.0 → 2.11.0

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/core.js CHANGED
@@ -1487,6 +1487,9 @@ var AZURE_VOICE_DEFINITIONS = [
1487
1487
  },
1488
1488
  { name: "es-ES-ElviraNeural", locale: "es-ES" },
1489
1489
  { name: "fil-PH-AngeloNeural", locale: "fil-PH" },
1490
+ { name: "fil-PH-Angelo:DragonHDLatestNeural", locale: "fil-PH" },
1491
+ { name: "fil-PH-BlessicaNeural", locale: "fil-PH" },
1492
+ { name: "fil-PH-Blessica:DragonHDLatestNeural", locale: "fil-PH" },
1490
1493
  { name: "fr-FR-DeniseNeural", locale: "fr-FR", styles: ["cheerful", "sad"] },
1491
1494
  { name: "fr-FR-HenriNeural", locale: "fr-FR", styles: ["cheerful", "sad"] },
1492
1495
  { name: "id-ID-GadisNeural", locale: "id-ID" },
@@ -1583,6 +1586,18 @@ var ALLOWED_SILENCE_TYPES = /* @__PURE__ */ new Set([
1583
1586
  "Enumerationcomma"
1584
1587
  ]);
1585
1588
  var ALLOWED_VISEME_TYPES = /* @__PURE__ */ new Set(["redlips_front", "FacialExpression"]);
1589
+ var DEFAULT_PREVIEW_TAGS = /* @__PURE__ */ new Set(["mstts:voiceconversion"]);
1590
+ function featureStatusForTag(name, options) {
1591
+ const tagName = canonicalTagName(name);
1592
+ const configured = Object.entries(options.tagStatuses ?? {}).find(
1593
+ ([candidate]) => canonicalTagName(candidate) === tagName
1594
+ )?.[1];
1595
+ if (configured) return configured;
1596
+ if ((options.previewTags ?? [...DEFAULT_PREVIEW_TAGS]).some((candidate) => canonicalTagName(candidate) === tagName))
1597
+ return "preview";
1598
+ if ((options.deprecatedTags ?? []).some((candidate) => canonicalTagName(candidate) === tagName)) return "deprecated";
1599
+ return void 0;
1600
+ }
1586
1601
  function decodeAttribute(value) {
1587
1602
  return value.replace(
1588
1603
  /&(?:amp|apos|gt|lt|quot);/gi,
@@ -1699,9 +1714,9 @@ function isValidAzureAudioDuration(value) {
1699
1714
  return Number(clock[1]) > 0 || Number(clock[2]) > 0 || Number(clock[3]) > 0 || Number(clock[4] ?? 0) > 0;
1700
1715
  }
1701
1716
  function isValidAzureBackgroundAudioDuration(value) {
1702
- const match = /^(\d+(?:\.\d+)?)(ms|s)?$/i.exec(value.trim());
1717
+ const match = /^(\d+)$/.exec(value.trim());
1703
1718
  if (!match) return false;
1704
- const milliseconds = Number(match[1]) * (match[2]?.toLowerCase() === "s" ? 1e3 : 1);
1719
+ const milliseconds = Number(match[1]);
1705
1720
  return Number.isFinite(milliseconds) && milliseconds >= 0 && milliseconds <= 1e4;
1706
1721
  }
1707
1722
  function attr(token, name) {
@@ -1862,6 +1877,25 @@ function validateAudioSource(token, source, diagnostics, options, elementName2)
1862
1877
  }
1863
1878
  function validateElement(token, source, diagnostics, voiceName, options, voiceCatalog) {
1864
1879
  const name = token.name.toLowerCase();
1880
+ const tagStatus = featureStatusForTag(token.name, options);
1881
+ if (tagStatus === "preview")
1882
+ addDiagnostic(
1883
+ diagnostics,
1884
+ source,
1885
+ token.start,
1886
+ `<${token.name}> is an Azure Speech preview feature and may change or require preview access.`,
1887
+ "warning",
1888
+ "azure-preview-tag"
1889
+ );
1890
+ if (tagStatus === "deprecated")
1891
+ addDiagnostic(
1892
+ diagnostics,
1893
+ source,
1894
+ token.start,
1895
+ `<${token.name}> is deprecated by Azure Speech; migrate to a supported alternative.`,
1896
+ "info",
1897
+ "azure-deprecated-tag"
1898
+ );
1865
1899
  if (name === "voice" && !attr(token, "name")?.trim())
1866
1900
  addDiagnostic(diagnostics, source, token.start, '<voice> requires a non-empty "name" attribute.');
1867
1901
  if (name === "break") {
@@ -2073,6 +2107,24 @@ function validateAzureSsml(ssml, options = {}) {
2073
2107
  const name = attr(token, "name")?.trim();
2074
2108
  const language = attr(token, "xml:lang")?.trim() || (speak ? attr(speak, "xml:lang")?.trim() : void 0);
2075
2109
  const definition = name ? voiceCatalog.get(name.toLowerCase()) : void 0;
2110
+ if (name && definition?.status === "preview")
2111
+ addDiagnostic(
2112
+ diagnostics,
2113
+ ssml,
2114
+ token.start,
2115
+ `Voice "${name}" is an Azure Speech preview voice and may change or require preview access.`,
2116
+ "warning",
2117
+ "azure-preview-voice"
2118
+ );
2119
+ if (name && definition?.status === "deprecated")
2120
+ addDiagnostic(
2121
+ diagnostics,
2122
+ ssml,
2123
+ token.start,
2124
+ `Voice "${name}" is deprecated by Azure Speech; migrate to a supported voice.`,
2125
+ "info",
2126
+ "azure-deprecated-voice"
2127
+ );
2076
2128
  if (name && !definition && policySeverity)
2077
2129
  addDiagnostic(
2078
2130
  diagnostics,