@intlayer/core 9.5.12 → 9.7.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/cjs/formatters/compact.cjs +1 -2
- package/dist/cjs/formatters/compact.cjs.map +1 -1
- package/dist/cjs/formatters/currency.cjs +1 -2
- package/dist/cjs/formatters/currency.cjs.map +1 -1
- package/dist/cjs/formatters/date.cjs +1 -2
- package/dist/cjs/formatters/date.cjs.map +1 -1
- package/dist/cjs/formatters/list.cjs +1 -2
- package/dist/cjs/formatters/list.cjs.map +1 -1
- package/dist/cjs/formatters/number.cjs +1 -2
- package/dist/cjs/formatters/number.cjs.map +1 -1
- package/dist/cjs/formatters/percentage.cjs +1 -2
- package/dist/cjs/formatters/percentage.cjs.map +1 -1
- package/dist/cjs/formatters/relativeTime.cjs +1 -2
- package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
- package/dist/cjs/formatters/units.cjs +1 -2
- package/dist/cjs/formatters/units.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/localization/localeDetector.cjs +60 -22
- package/dist/cjs/localization/localeDetector.cjs.map +1 -1
- package/dist/cjs/markdown/constants.cjs +5 -2
- package/dist/cjs/markdown/constants.cjs.map +1 -1
- package/dist/cjs/transpiler/index.cjs +1 -0
- package/dist/cjs/transpiler/plural/index.cjs +1 -0
- package/dist/cjs/transpiler/plural/plural.cjs +20 -1
- package/dist/cjs/transpiler/plural/plural.cjs.map +1 -1
- package/dist/cjs/utils/intl.cjs +2 -27
- package/dist/cjs/utils/intl.cjs.map +1 -1
- package/dist/esm/formatters/compact.mjs +1 -2
- package/dist/esm/formatters/compact.mjs.map +1 -1
- package/dist/esm/formatters/currency.mjs +1 -2
- package/dist/esm/formatters/currency.mjs.map +1 -1
- package/dist/esm/formatters/date.mjs +1 -2
- package/dist/esm/formatters/date.mjs.map +1 -1
- package/dist/esm/formatters/list.mjs +1 -2
- package/dist/esm/formatters/list.mjs.map +1 -1
- package/dist/esm/formatters/number.mjs +1 -2
- package/dist/esm/formatters/number.mjs.map +1 -1
- package/dist/esm/formatters/percentage.mjs +1 -2
- package/dist/esm/formatters/percentage.mjs.map +1 -1
- package/dist/esm/formatters/relativeTime.mjs +1 -2
- package/dist/esm/formatters/relativeTime.mjs.map +1 -1
- package/dist/esm/formatters/units.mjs +1 -2
- package/dist/esm/formatters/units.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/localization/localeDetector.mjs +60 -22
- package/dist/esm/localization/localeDetector.mjs.map +1 -1
- package/dist/esm/markdown/constants.mjs +5 -2
- package/dist/esm/markdown/constants.mjs.map +1 -1
- package/dist/esm/transpiler/index.mjs +2 -2
- package/dist/esm/transpiler/plural/index.mjs +2 -2
- package/dist/esm/transpiler/plural/plural.mjs +20 -2
- package/dist/esm/transpiler/plural/plural.mjs.map +1 -1
- package/dist/esm/utils/intl.mjs +2 -27
- package/dist/esm/utils/intl.mjs.map +1 -1
- package/dist/types/formatters/compact.d.ts.map +1 -1
- package/dist/types/formatters/currency.d.ts.map +1 -1
- package/dist/types/formatters/date.d.ts.map +1 -1
- package/dist/types/formatters/list.d.ts.map +1 -1
- package/dist/types/formatters/number.d.ts.map +1 -1
- package/dist/types/formatters/percentage.d.ts.map +1 -1
- package/dist/types/formatters/relativeTime.d.ts.map +1 -1
- package/dist/types/formatters/units.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/localization/localeDetector.d.ts +2 -0
- package/dist/types/localization/localeDetector.d.ts.map +1 -1
- package/dist/types/markdown/constants.d.ts +4 -1
- package/dist/types/markdown/constants.d.ts.map +1 -1
- package/dist/types/transpiler/index.d.ts +2 -2
- package/dist/types/transpiler/plural/index.d.ts +2 -2
- package/dist/types/transpiler/plural/plural.d.ts +31 -2
- package/dist/types/transpiler/plural/plural.d.ts.map +1 -1
- package/dist/types/utils/intl.d.ts +1 -1
- package/dist/types/utils/intl.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -153,8 +153,11 @@ const ATTRIBUTES_TO_SANITIZE = [
|
|
|
153
153
|
"srcDoc",
|
|
154
154
|
"action"
|
|
155
155
|
];
|
|
156
|
-
/**
|
|
157
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Attribute extractor regex. Values may be double/single quoted, `{…}`
|
|
158
|
+
* expressions, or unquoted `[…]` arrays (`codeFormat=["typescript", "esm"]`).
|
|
159
|
+
*/
|
|
160
|
+
const ATTR_EXTRACTOR_R = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})|(?:\[[^\]]*\])))?/gi;
|
|
158
161
|
/** First character of a valid attribute name (a letter, `_` or `:`). */
|
|
159
162
|
const ATTRIBUTE_NAME_START_R = /^[A-Z_:]/i;
|
|
160
163
|
/** Block end detection */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":[],"sources":["../../../src/markdown/constants.ts"],"sourcesContent":["// ============================================================================\n// RULE TYPES\n// ============================================================================\n\n/**\n * Analogous to `node.type`. Please note that the values here may change at any time,\n * so do not hard code against the value directly.\n */\nexport const RuleType = {\n blockQuote: '0',\n breakLine: '1',\n breakThematic: '2',\n codeBlock: '3',\n codeFenced: '4',\n codeInline: '5',\n footnote: '6',\n footnoteReference: '7',\n gfmTask: '8',\n heading: '9',\n headingSetext: '10',\n /** only available if not `disableHTMLParsing` */\n htmlBlock: '11',\n htmlComment: '12',\n /** only available if not `disableHTMLParsing` */\n htmlSelfClosing: '13',\n /** Custom components like <Tabs>, <TabItem> */\n customComponent: '34',\n image: '14',\n link: '15',\n /** emits a `link` 'node', does not render directly */\n linkAngleBraceStyleDetector: '16',\n /** emits a `link` 'node', does not render directly */\n linkBareUrlDetector: '17',\n newlineCoalescer: '19',\n orderedList: '20',\n paragraph: '21',\n ref: '22',\n refImage: '23',\n refLink: '24',\n table: '25',\n tableSeparator: '26',\n text: '27',\n textBolded: '28',\n textEmphasized: '29',\n textEscaped: '30',\n textMarked: '31',\n textStrikethroughed: '32',\n unorderedList: '33',\n} as const;\n\n// In test environment, use human-readable keys for easier debugging\nif (process.env.NODE_ENV === 'test') {\n Object.keys(RuleType).forEach((key) => {\n (RuleType as any)[key] = key;\n });\n}\n\nexport type RuleTypeValue = (typeof RuleType)[keyof typeof RuleType];\n\n// ============================================================================\n// PRIORITY LEVELS\n// ============================================================================\n\n/**\n * Priority levels for rule ordering.\n */\nexport const Priority = {\n /** anything that must scan the tree before everything else */\n MAX: 0,\n /** scans for block-level constructs */\n HIGH: 1,\n /** inline w/ more priority than other inline */\n MED: 2,\n /** inline elements */\n LOW: 3,\n /** bare text and stuff that is considered leftovers */\n MIN: 4,\n} as const;\n\nexport type PriorityValue = (typeof Priority)[keyof typeof Priority];\n\n// ============================================================================\n// RULE SCOPE CONSTANTS\n// ============================================================================\n\n/**\n * Parsing scope for markdown rules.\n * Bitmask representation for fast bitwise checking and bundle minification.\n * - BLOCK (1): evaluated only when !state.inline && !state.simple\n * - INLINE (2): evaluated only when state.inline || state.simple\n * - BOTH (3): evaluated in both scopes (default)\n */\nexport const RuleScope = {\n BLOCK: 1,\n INLINE: 2,\n BOTH: 3,\n} as const;\n\nexport const SCOPE_BLOCK = RuleScope.BLOCK;\nexport const SCOPE_INLINE = RuleScope.INLINE;\nexport const SCOPE_BOTH = RuleScope.BOTH;\n\nexport type RuleScopeValue =\n | (typeof RuleScope)[keyof typeof RuleScope]\n | 'block'\n | 'inline'\n | 'both';\n\n// ============================================================================\n// ATTRIBUTE MAPPING\n// ============================================================================\n\n/**\n * Map of HTML attributes to their JSX prop equivalents.\n * Some renderers use camelCase for certain attributes.\n */\nexport const ATTRIBUTE_TO_NODE_PROP_MAP: Record<string, string> = [\n 'allowFullScreen',\n 'autoComplete',\n 'autoFocus',\n 'autoPlay',\n 'cellPadding',\n 'cellSpacing',\n 'charSet',\n 'classId',\n 'colSpan',\n 'contentEditable',\n 'contextMenu',\n 'crossOrigin',\n 'encType',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'frameBorder',\n 'hrefLang',\n 'inputMode',\n 'keyParams',\n 'keyType',\n 'marginHeight',\n 'marginWidth',\n 'maxLength',\n 'mediaGroup',\n 'minLength',\n 'noValidate',\n 'radioGroup',\n 'readOnly',\n 'rowSpan',\n 'spellCheck',\n 'srcDoc',\n 'srcLang',\n 'srcSet',\n 'tabIndex',\n 'useMap',\n].reduce(\n (obj: Record<string, string>, x) => {\n obj[x.toLowerCase()] = x;\n return obj;\n },\n { class: 'className', for: 'htmlFor' }\n);\n\n// ============================================================================\n// NAMED CODES TO UNICODE\n// ============================================================================\n\n/**\n * Default HTML entity to unicode mappings.\n */\nexport const NAMED_CODES_TO_UNICODE: Record<string, string> = {\n amp: '\\u0026',\n apos: '\\u0027',\n gt: '\\u003e',\n lt: '\\u003c',\n nbsp: '\\u00a0',\n quot: '\\u201c',\n};\n\n// ============================================================================\n// SPECIAL ELEMENTS\n// ============================================================================\n\n/** HTML elements that should not have their content processed */\nexport const DO_NOT_PROCESS_HTML_ELEMENTS = ['style', 'script', 'pre'];\n\n/** Attributes that require URL sanitization */\nexport const ATTRIBUTES_TO_SANITIZE = [\n 'src',\n 'href',\n 'data',\n 'formAction',\n 'srcDoc',\n 'action',\n];\n\n// ============================================================================\n// REGEX PATTERNS\n// ============================================================================\n\n/** Attribute extractor regex */\nexport const ATTR_EXTRACTOR_R =\n /([-A-Z0-9_:]+)(?:\\s*=\\s*(?:(?:\"((?:\\\\.|[^\"])*)\")|(?:'((?:\\\\.|[^'])*)')|(?:\\{((?:\\\\.|{[^}]*?}|[^}])*)\\})))?/gi;\n\n/** First character of a valid attribute name (a letter, `_` or `:`). */\nexport const ATTRIBUTE_NAME_START_R = /^[A-Z_:]/i;\n\n/** Block end detection */\nexport const BLOCK_END_R = /\\n{2,}$/;\n\n/** Blockquote patterns */\nexport const BLOCKQUOTE_R = /^(\\s*>[\\s\\S]*?)(?=\\n\\n|$)/;\nexport const BLOCKQUOTE_TRIM_LEFT_MULTILINE_R = /^ *> ?/gm;\nexport const BLOCKQUOTE_ALERT_R = /^(?:\\[!([^\\]]*)\\]\\n)?([\\s\\S]*)/;\n\n/** Line break patterns */\nexport const BREAK_LINE_R = /^(?=( {2,}))\\1\\n/;\nexport const BREAK_THEMATIC_R = /^(?:([-*_])( *\\1){2,}) *(?:\\n *)+\\n/;\n\n/** Code block patterns */\n// The body is consumed a whole line at a time rather than character by\n// character: a closing fence only ever starts a line, so the backreference is\n// tested once per line instead of once per character. The trailing `$` branch\n// inside the loop keeps an unterminated fence that ends without a newline.\nexport const CODE_BLOCK_FENCED_R =\n /^(?: {1,3})?(`{3,}|~{3,}) *(\\S+)? *([^\\n]*?)?\\n((?:[^\\n]*(?:\\n|$))*?)(?:\\1\\n?|$)/;\nexport const CODE_BLOCK_R = /^(?: {4}[^\\n]+\\n*)+(?:\\n *)+\\n?/;\n/** A single line opening or closing a fenced code block, with its indentation. */\nexport const FENCE_DELIMITER_R = /^([ \\t]*)(`{3,}|~{3,})/;\nexport const CODE_INLINE_R = /^(`+)((?:\\\\`|(?!\\1)`|[^`])+)\\1/;\n\n/** Newline patterns */\nexport const CONSECUTIVE_NEWLINE_R = /^(?:\\n *)*\\n/;\nexport const CR_NEWLINE_R = /\\r\\n?/g;\n\n/** Footnote patterns */\nexport const FOOTNOTE_R = /^\\[\\^([^\\]]+)](:(.*)((\\n+ {4,}.*)|(\\n(?!\\[\\^).+))*)/;\nexport const FOOTNOTE_REFERENCE_R = /^\\[\\^([^\\]]+)]/;\n\n/** Form feed */\nexport const FORMFEED_R = /\\f/g;\n\n/** Front matter */\nexport const FRONT_MATTER_R = /^---[ \\t]*\\n(.|\\n)*?\\n---[ \\t]*\\n/;\n\n/** GFM task */\nexport const GFM_TASK_R = /^\\s*?\\[(x|\\s)\\]/;\n\n/** Heading patterns */\nexport const HEADING_R = /^ *(#{1,6}) *([^\\n]+?)(?: +#*)?(?:\\n *)*(?:\\n|$)/;\nexport const HEADING_ATX_COMPLIANT_R =\n /^ *(#{1,6}) +([^\\n]+?)(?: +#*)?(?:\\n *)*(?:\\n|$)/;\nexport const HEADING_SETEXT_R = /^([^\\n]+)\\n *(=|-)\\2{2,} *\\n/;\n\n/** HTML patterns */\n\nexport const HTML_CHAR_CODE_R =\n /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;\nexport const HTML_COMMENT_R = /^<!--[\\s\\S]*?(?:-->)/;\nexport const HTML_CUSTOM_ATTR_R = /^(data|aria|x)-[a-z_][a-z\\d_.-]*$/;\n\n/** Interpolation */\nexport const INTERPOLATION_R = /^\\{.*\\}$/;\n\n/** Link patterns */\nexport const LINK_AUTOLINK_BARE_URL_R = /^(https?:\\/\\/[^\\s<]+[^<.,:;\"')\\]\\s])/;\nexport const LINK_AUTOLINK_R = /^<([^ >]+[:@/][^ >]+)>/;\nexport const CAPTURE_LETTER_AFTER_HYPHEN = /-([a-z])?/gi;\n\n/**\n * Table patterns.\n *\n * The row scans spell \"any character but a newline\" as `[^\\n]` rather than `.`:\n * `.` is a four-range exclusion, and matching it over rows this wide costs a\n * third more than the single-range class. It is also the more faithful reading\n * — only `\\n` ends a line here, and `\\r` is normalized away before parsing.\n */\nexport const NP_TABLE_R =\n /^(\\|[^\\n]*)\\n(?: *(\\|? *[-:]+ *\\|[-| :]*)\\n((?:[^\\n]*\\|[^\\n]*\\n)*))?\\n?/;\nexport const TABLE_TRIM_PIPES = /(^ *\\||\\| *$)/g;\nexport const TABLE_CENTER_ALIGN = /^ *:-+: *$/;\nexport const TABLE_LEFT_ALIGN = /^ *:-+ *$/;\nexport const TABLE_RIGHT_ALIGN = /^ *-+: *$/;\n\n/** Paragraph */\nexport const PARAGRAPH_R = /^[^\\n]+(?: {2}\\n|\\n{2,})/;\n\n/** Reference patterns */\nexport const REFERENCE_IMAGE_OR_LINK =\n /^\\[([^\\]]*)\\]:\\s+<?([^\\s>]+)>?\\s*(\"([^\"]*)\")?/;\nexport const REFERENCE_IMAGE_R = /^!\\[([^\\]]*)\\] ?\\[([^\\]]*)\\]/;\nexport const REFERENCE_LINK_R = /^\\[([^\\]]*)\\] ?\\[([^\\]]*)\\]/;\n\n/** Block detection */\nexport const SHOULD_RENDER_AS_BLOCK_R = /(\\n|^[-*]\\s|^#|^ {2,}|^-{2,}|^>\\s)/;\n\n/** Tabs, which `normalizeWhitespace` widens to four spaces. */\nexport const TAB_R = /\\t/g;\nexport const TRIM_STARTING_NEWLINES = /^\\n+/;\nexport const HTML_LEFT_TRIM_AMOUNT_R = /^\\n*([ \\t]*)/;\n\n/** List patterns */\nexport const ORDERED_LIST_BULLET = '(?:\\\\d+\\\\.)';\nexport const UNORDERED_LIST_BULLET = '(?:[*+-])';\n\n/** Text formatting patterns */\nexport const TEXT_ESCAPED_R = /^\\\\([^0-9A-Za-z\\s])/;\nexport const UNESCAPE_R = /\\\\([^0-9A-Za-z\\s])/g;\n\n/** Shortcode pattern */\nexport const SHORTCODE_R = /^(:[a-zA-Z0-9-_]+:)/;\n\n// ============================================================================\n// LIST TYPE CONSTANTS\n// ============================================================================\n\nexport type ListType = 1 | 2;\nexport const ORDERED: ListType = 1;\nexport const UNORDERED: ListType = 2;\n\n// ============================================================================\n// INLINE PATTERN HELPERS\n// ============================================================================\n\n/**\n * Ensure there's at least one more instance of the delimiter later\n * in the current sequence.\n */\nexport const LOOKAHEAD = (double: number): string =>\n `(?=[\\\\s\\\\S]+?\\\\1${double ? '\\\\1' : ''})`;\n\n/**\n * For inline formatting, this partial attempts to ignore characters that\n * may appear in nested formatting.\n */\nexport const INLINE_SKIP_R =\n '((?:\\\\[.*?\\\\][([].*?[)\\\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\\\[^\\\\s]|[\\\\s\\\\S])+?)';\n\n/** Bold text pattern */\nexport const TEXT_BOLD_R = new RegExp(\n `^([*_])\\\\1${LOOKAHEAD(1)}${INLINE_SKIP_R}\\\\1\\\\1(?!\\\\1)`\n);\n\n/** Emphasized text pattern */\nexport const TEXT_EMPHASIZED_R = new RegExp(\n `^([*_])${LOOKAHEAD(0)}${INLINE_SKIP_R}\\\\1(?!\\\\1)`\n);\n\n/** Marked text pattern */\nexport const TEXT_MARKED_R = new RegExp(\n `^(==)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\\\1`\n);\n\n/** Strikethrough text pattern */\nexport const TEXT_STRIKETHROUGHED_R = new RegExp(\n `^(~~)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\\\1`\n);\n\n// ============================================================================\n// LIST REGEX GENERATORS\n// ============================================================================\n\nexport const generateListItemPrefix = (type: ListType): string => {\n return (\n '( *)(' +\n (type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) +\n ') +'\n );\n};\n\nexport const ORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(ORDERED);\nexport const UNORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(UNORDERED);\n\nexport const generateListItemPrefixRegex = (type: ListType): RegExp => {\n return new RegExp(\n '^' +\n (type === ORDERED ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX)\n );\n};\n\nexport const ORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(ORDERED);\nexport const UNORDERED_LIST_ITEM_PREFIX_R =\n generateListItemPrefixRegex(UNORDERED);\n\nexport const generateListItemRegex = (type: ListType): RegExp => {\n return new RegExp(\n '^' +\n (type === ORDERED\n ? ORDERED_LIST_ITEM_PREFIX\n : UNORDERED_LIST_ITEM_PREFIX) +\n '[^\\\\n]*(?:\\\\n' +\n '(?!\\\\1' +\n (type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) +\n ' )[^\\\\n]*)*(\\\\n|$)',\n 'gm'\n );\n};\n\nexport const ORDERED_LIST_ITEM_R = generateListItemRegex(ORDERED);\nexport const UNORDERED_LIST_ITEM_R = generateListItemRegex(UNORDERED);\n\nexport const generateListRegex = (type: ListType): RegExp => {\n const bullet = type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET;\n\n return new RegExp(\n '^( *)(' +\n bullet +\n ') ' +\n // The body advances a line at a time rather than a character at a time: a\n // list can only end at a line boundary, so the terminator — the expensive\n // half, with its two nested lookaheads — is tried once per line instead of\n // once per character. The step swallows the newline that used to open the\n // terminator, which is why it now reads `\\n+` and not `\\n{2,}`, and the\n // leading lookahead keeps a source with nothing left after the bullet from\n // matching through a zero-width step.\n '(?=[\\\\s\\\\S])(?:[^\\\\n]*(?:\\\\n|$))+?' +\n '(?:\\\\n+(?! )' +\n '(?!\\\\1' +\n bullet +\n ' (?!' +\n bullet +\n ' ))\\\\n*' +\n // `\\s` already covers `\\n`, so the trailing `\\n*` the pattern used to\n // carry could only ever match empty — and paying for it at every step of\n // the lazy scan cost a third of the whole match.\n '|\\\\s*$)'\n );\n};\n\nexport const ORDERED_LIST_R = generateListRegex(ORDERED);\nexport const UNORDERED_LIST_R = generateListRegex(UNORDERED);\n"],"mappings":";;;;;AAQA,MAAa,WAAW;CACtB,YAAY;CACZ,WAAW;CACX,eAAe;CACf,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,mBAAmB;CACnB,SAAS;CACT,SAAS;CACT,eAAe;;CAEf,WAAW;CACX,aAAa;;CAEb,iBAAiB;;CAEjB,iBAAiB;CACjB,OAAO;CACP,MAAM;;CAEN,6BAA6B;;CAE7B,qBAAqB;CACrB,kBAAkB;CAClB,aAAa;CACb,WAAW;CACX,KAAK;CACL,UAAU;CACV,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,MAAM;CACN,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,YAAY;CACZ,qBAAqB;CACrB,eAAe;AACjB;AAGA,6BAA6B,QAC3B,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,QAAQ;CACrC,AAAC,SAAiB,OAAO;AAC3B,CAAC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AAO,IAAI,OACT,OACG,aACG,2BACA,8BACJ,yBAEC,aAAmB,sBAAsB,yBAC1C,sBACF,IACF;AACF;AAEA,MAAa,sBAAsB,uBAA6B;AAChE,MAAa,wBAAwB,uBAA+B;AAEpE,MAAa,qBAAqB,SAA2B;CAC3D,MAAM,SAAS,aAAmB,sBAAsB;CAExD,OAAO,IAAI,OACT,WACE,SACA,2DAWA,SACA,SACA,SACA,gBAKJ;AACF;AAEA,MAAa,iBAAiB,mBAAyB;AACvD,MAAa,mBAAmB,mBAA2B"}
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../../src/markdown/constants.ts"],"sourcesContent":["// ============================================================================\n// RULE TYPES\n// ============================================================================\n\n/**\n * Analogous to `node.type`. Please note that the values here may change at any time,\n * so do not hard code against the value directly.\n */\nexport const RuleType = {\n blockQuote: '0',\n breakLine: '1',\n breakThematic: '2',\n codeBlock: '3',\n codeFenced: '4',\n codeInline: '5',\n footnote: '6',\n footnoteReference: '7',\n gfmTask: '8',\n heading: '9',\n headingSetext: '10',\n /** only available if not `disableHTMLParsing` */\n htmlBlock: '11',\n htmlComment: '12',\n /** only available if not `disableHTMLParsing` */\n htmlSelfClosing: '13',\n /** Custom components like <Tabs>, <TabItem> */\n customComponent: '34',\n image: '14',\n link: '15',\n /** emits a `link` 'node', does not render directly */\n linkAngleBraceStyleDetector: '16',\n /** emits a `link` 'node', does not render directly */\n linkBareUrlDetector: '17',\n newlineCoalescer: '19',\n orderedList: '20',\n paragraph: '21',\n ref: '22',\n refImage: '23',\n refLink: '24',\n table: '25',\n tableSeparator: '26',\n text: '27',\n textBolded: '28',\n textEmphasized: '29',\n textEscaped: '30',\n textMarked: '31',\n textStrikethroughed: '32',\n unorderedList: '33',\n} as const;\n\n// In test environment, use human-readable keys for easier debugging\nif (process.env.NODE_ENV === 'test') {\n Object.keys(RuleType).forEach((key) => {\n (RuleType as any)[key] = key;\n });\n}\n\nexport type RuleTypeValue = (typeof RuleType)[keyof typeof RuleType];\n\n// ============================================================================\n// PRIORITY LEVELS\n// ============================================================================\n\n/**\n * Priority levels for rule ordering.\n */\nexport const Priority = {\n /** anything that must scan the tree before everything else */\n MAX: 0,\n /** scans for block-level constructs */\n HIGH: 1,\n /** inline w/ more priority than other inline */\n MED: 2,\n /** inline elements */\n LOW: 3,\n /** bare text and stuff that is considered leftovers */\n MIN: 4,\n} as const;\n\nexport type PriorityValue = (typeof Priority)[keyof typeof Priority];\n\n// ============================================================================\n// RULE SCOPE CONSTANTS\n// ============================================================================\n\n/**\n * Parsing scope for markdown rules.\n * Bitmask representation for fast bitwise checking and bundle minification.\n * - BLOCK (1): evaluated only when !state.inline && !state.simple\n * - INLINE (2): evaluated only when state.inline || state.simple\n * - BOTH (3): evaluated in both scopes (default)\n */\nexport const RuleScope = {\n BLOCK: 1,\n INLINE: 2,\n BOTH: 3,\n} as const;\n\nexport const SCOPE_BLOCK = RuleScope.BLOCK;\nexport const SCOPE_INLINE = RuleScope.INLINE;\nexport const SCOPE_BOTH = RuleScope.BOTH;\n\nexport type RuleScopeValue =\n | (typeof RuleScope)[keyof typeof RuleScope]\n | 'block'\n | 'inline'\n | 'both';\n\n// ============================================================================\n// ATTRIBUTE MAPPING\n// ============================================================================\n\n/**\n * Map of HTML attributes to their JSX prop equivalents.\n * Some renderers use camelCase for certain attributes.\n */\nexport const ATTRIBUTE_TO_NODE_PROP_MAP: Record<string, string> = [\n 'allowFullScreen',\n 'autoComplete',\n 'autoFocus',\n 'autoPlay',\n 'cellPadding',\n 'cellSpacing',\n 'charSet',\n 'classId',\n 'colSpan',\n 'contentEditable',\n 'contextMenu',\n 'crossOrigin',\n 'encType',\n 'formAction',\n 'formEncType',\n 'formMethod',\n 'formNoValidate',\n 'formTarget',\n 'frameBorder',\n 'hrefLang',\n 'inputMode',\n 'keyParams',\n 'keyType',\n 'marginHeight',\n 'marginWidth',\n 'maxLength',\n 'mediaGroup',\n 'minLength',\n 'noValidate',\n 'radioGroup',\n 'readOnly',\n 'rowSpan',\n 'spellCheck',\n 'srcDoc',\n 'srcLang',\n 'srcSet',\n 'tabIndex',\n 'useMap',\n].reduce(\n (obj: Record<string, string>, x) => {\n obj[x.toLowerCase()] = x;\n return obj;\n },\n { class: 'className', for: 'htmlFor' }\n);\n\n// ============================================================================\n// NAMED CODES TO UNICODE\n// ============================================================================\n\n/**\n * Default HTML entity to unicode mappings.\n */\nexport const NAMED_CODES_TO_UNICODE: Record<string, string> = {\n amp: '\\u0026',\n apos: '\\u0027',\n gt: '\\u003e',\n lt: '\\u003c',\n nbsp: '\\u00a0',\n quot: '\\u201c',\n};\n\n// ============================================================================\n// SPECIAL ELEMENTS\n// ============================================================================\n\n/** HTML elements that should not have their content processed */\nexport const DO_NOT_PROCESS_HTML_ELEMENTS = ['style', 'script', 'pre'];\n\n/** Attributes that require URL sanitization */\nexport const ATTRIBUTES_TO_SANITIZE = [\n 'src',\n 'href',\n 'data',\n 'formAction',\n 'srcDoc',\n 'action',\n];\n\n// ============================================================================\n// REGEX PATTERNS\n// ============================================================================\n\n/**\n * Attribute extractor regex. Values may be double/single quoted, `{…}`\n * expressions, or unquoted `[…]` arrays (`codeFormat=[\"typescript\", \"esm\"]`).\n */\nexport const ATTR_EXTRACTOR_R =\n /([-A-Z0-9_:]+)(?:\\s*=\\s*(?:(?:\"((?:\\\\.|[^\"])*)\")|(?:'((?:\\\\.|[^'])*)')|(?:\\{((?:\\\\.|{[^}]*?}|[^}])*)\\})|(?:\\[[^\\]]*\\])))?/gi;\n\n/** First character of a valid attribute name (a letter, `_` or `:`). */\nexport const ATTRIBUTE_NAME_START_R = /^[A-Z_:]/i;\n\n/** Block end detection */\nexport const BLOCK_END_R = /\\n{2,}$/;\n\n/** Blockquote patterns */\nexport const BLOCKQUOTE_R = /^(\\s*>[\\s\\S]*?)(?=\\n\\n|$)/;\nexport const BLOCKQUOTE_TRIM_LEFT_MULTILINE_R = /^ *> ?/gm;\nexport const BLOCKQUOTE_ALERT_R = /^(?:\\[!([^\\]]*)\\]\\n)?([\\s\\S]*)/;\n\n/** Line break patterns */\nexport const BREAK_LINE_R = /^(?=( {2,}))\\1\\n/;\nexport const BREAK_THEMATIC_R = /^(?:([-*_])( *\\1){2,}) *(?:\\n *)+\\n/;\n\n/** Code block patterns */\n// The body is consumed a whole line at a time rather than character by\n// character: a closing fence only ever starts a line, so the backreference is\n// tested once per line instead of once per character. The trailing `$` branch\n// inside the loop keeps an unterminated fence that ends without a newline.\nexport const CODE_BLOCK_FENCED_R =\n /^(?: {1,3})?(`{3,}|~{3,}) *(\\S+)? *([^\\n]*?)?\\n((?:[^\\n]*(?:\\n|$))*?)(?:\\1\\n?|$)/;\nexport const CODE_BLOCK_R = /^(?: {4}[^\\n]+\\n*)+(?:\\n *)+\\n?/;\n/** A single line opening or closing a fenced code block, with its indentation. */\nexport const FENCE_DELIMITER_R = /^([ \\t]*)(`{3,}|~{3,})/;\nexport const CODE_INLINE_R = /^(`+)((?:\\\\`|(?!\\1)`|[^`])+)\\1/;\n\n/** Newline patterns */\nexport const CONSECUTIVE_NEWLINE_R = /^(?:\\n *)*\\n/;\nexport const CR_NEWLINE_R = /\\r\\n?/g;\n\n/** Footnote patterns */\nexport const FOOTNOTE_R = /^\\[\\^([^\\]]+)](:(.*)((\\n+ {4,}.*)|(\\n(?!\\[\\^).+))*)/;\nexport const FOOTNOTE_REFERENCE_R = /^\\[\\^([^\\]]+)]/;\n\n/** Form feed */\nexport const FORMFEED_R = /\\f/g;\n\n/** Front matter */\nexport const FRONT_MATTER_R = /^---[ \\t]*\\n(.|\\n)*?\\n---[ \\t]*\\n/;\n\n/** GFM task */\nexport const GFM_TASK_R = /^\\s*?\\[(x|\\s)\\]/;\n\n/** Heading patterns */\nexport const HEADING_R = /^ *(#{1,6}) *([^\\n]+?)(?: +#*)?(?:\\n *)*(?:\\n|$)/;\nexport const HEADING_ATX_COMPLIANT_R =\n /^ *(#{1,6}) +([^\\n]+?)(?: +#*)?(?:\\n *)*(?:\\n|$)/;\nexport const HEADING_SETEXT_R = /^([^\\n]+)\\n *(=|-)\\2{2,} *\\n/;\n\n/** HTML patterns */\n\nexport const HTML_CHAR_CODE_R =\n /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;\nexport const HTML_COMMENT_R = /^<!--[\\s\\S]*?(?:-->)/;\nexport const HTML_CUSTOM_ATTR_R = /^(data|aria|x)-[a-z_][a-z\\d_.-]*$/;\n\n/** Interpolation */\nexport const INTERPOLATION_R = /^\\{.*\\}$/;\n\n/** Link patterns */\nexport const LINK_AUTOLINK_BARE_URL_R = /^(https?:\\/\\/[^\\s<]+[^<.,:;\"')\\]\\s])/;\nexport const LINK_AUTOLINK_R = /^<([^ >]+[:@/][^ >]+)>/;\nexport const CAPTURE_LETTER_AFTER_HYPHEN = /-([a-z])?/gi;\n\n/**\n * Table patterns.\n *\n * The row scans spell \"any character but a newline\" as `[^\\n]` rather than `.`:\n * `.` is a four-range exclusion, and matching it over rows this wide costs a\n * third more than the single-range class. It is also the more faithful reading\n * — only `\\n` ends a line here, and `\\r` is normalized away before parsing.\n */\nexport const NP_TABLE_R =\n /^(\\|[^\\n]*)\\n(?: *(\\|? *[-:]+ *\\|[-| :]*)\\n((?:[^\\n]*\\|[^\\n]*\\n)*))?\\n?/;\nexport const TABLE_TRIM_PIPES = /(^ *\\||\\| *$)/g;\nexport const TABLE_CENTER_ALIGN = /^ *:-+: *$/;\nexport const TABLE_LEFT_ALIGN = /^ *:-+ *$/;\nexport const TABLE_RIGHT_ALIGN = /^ *-+: *$/;\n\n/** Paragraph */\nexport const PARAGRAPH_R = /^[^\\n]+(?: {2}\\n|\\n{2,})/;\n\n/** Reference patterns */\nexport const REFERENCE_IMAGE_OR_LINK =\n /^\\[([^\\]]*)\\]:\\s+<?([^\\s>]+)>?\\s*(\"([^\"]*)\")?/;\nexport const REFERENCE_IMAGE_R = /^!\\[([^\\]]*)\\] ?\\[([^\\]]*)\\]/;\nexport const REFERENCE_LINK_R = /^\\[([^\\]]*)\\] ?\\[([^\\]]*)\\]/;\n\n/** Block detection */\nexport const SHOULD_RENDER_AS_BLOCK_R = /(\\n|^[-*]\\s|^#|^ {2,}|^-{2,}|^>\\s)/;\n\n/** Tabs, which `normalizeWhitespace` widens to four spaces. */\nexport const TAB_R = /\\t/g;\nexport const TRIM_STARTING_NEWLINES = /^\\n+/;\nexport const HTML_LEFT_TRIM_AMOUNT_R = /^\\n*([ \\t]*)/;\n\n/** List patterns */\nexport const ORDERED_LIST_BULLET = '(?:\\\\d+\\\\.)';\nexport const UNORDERED_LIST_BULLET = '(?:[*+-])';\n\n/** Text formatting patterns */\nexport const TEXT_ESCAPED_R = /^\\\\([^0-9A-Za-z\\s])/;\nexport const UNESCAPE_R = /\\\\([^0-9A-Za-z\\s])/g;\n\n/** Shortcode pattern */\nexport const SHORTCODE_R = /^(:[a-zA-Z0-9-_]+:)/;\n\n// ============================================================================\n// LIST TYPE CONSTANTS\n// ============================================================================\n\nexport type ListType = 1 | 2;\nexport const ORDERED: ListType = 1;\nexport const UNORDERED: ListType = 2;\n\n// ============================================================================\n// INLINE PATTERN HELPERS\n// ============================================================================\n\n/**\n * Ensure there's at least one more instance of the delimiter later\n * in the current sequence.\n */\nexport const LOOKAHEAD = (double: number): string =>\n `(?=[\\\\s\\\\S]+?\\\\1${double ? '\\\\1' : ''})`;\n\n/**\n * For inline formatting, this partial attempts to ignore characters that\n * may appear in nested formatting.\n */\nexport const INLINE_SKIP_R =\n '((?:\\\\[.*?\\\\][([].*?[)\\\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\\\[^\\\\s]|[\\\\s\\\\S])+?)';\n\n/** Bold text pattern */\nexport const TEXT_BOLD_R = new RegExp(\n `^([*_])\\\\1${LOOKAHEAD(1)}${INLINE_SKIP_R}\\\\1\\\\1(?!\\\\1)`\n);\n\n/** Emphasized text pattern */\nexport const TEXT_EMPHASIZED_R = new RegExp(\n `^([*_])${LOOKAHEAD(0)}${INLINE_SKIP_R}\\\\1(?!\\\\1)`\n);\n\n/** Marked text pattern */\nexport const TEXT_MARKED_R = new RegExp(\n `^(==)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\\\1`\n);\n\n/** Strikethrough text pattern */\nexport const TEXT_STRIKETHROUGHED_R = new RegExp(\n `^(~~)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\\\1`\n);\n\n// ============================================================================\n// LIST REGEX GENERATORS\n// ============================================================================\n\nexport const generateListItemPrefix = (type: ListType): string => {\n return (\n '( *)(' +\n (type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) +\n ') +'\n );\n};\n\nexport const ORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(ORDERED);\nexport const UNORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(UNORDERED);\n\nexport const generateListItemPrefixRegex = (type: ListType): RegExp => {\n return new RegExp(\n '^' +\n (type === ORDERED ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX)\n );\n};\n\nexport const ORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(ORDERED);\nexport const UNORDERED_LIST_ITEM_PREFIX_R =\n generateListItemPrefixRegex(UNORDERED);\n\nexport const generateListItemRegex = (type: ListType): RegExp => {\n return new RegExp(\n '^' +\n (type === ORDERED\n ? ORDERED_LIST_ITEM_PREFIX\n : UNORDERED_LIST_ITEM_PREFIX) +\n '[^\\\\n]*(?:\\\\n' +\n '(?!\\\\1' +\n (type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) +\n ' )[^\\\\n]*)*(\\\\n|$)',\n 'gm'\n );\n};\n\nexport const ORDERED_LIST_ITEM_R = generateListItemRegex(ORDERED);\nexport const UNORDERED_LIST_ITEM_R = generateListItemRegex(UNORDERED);\n\nexport const generateListRegex = (type: ListType): RegExp => {\n const bullet = type === ORDERED ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET;\n\n return new RegExp(\n '^( *)(' +\n bullet +\n ') ' +\n // The body advances a line at a time rather than a character at a time: a\n // list can only end at a line boundary, so the terminator — the expensive\n // half, with its two nested lookaheads — is tried once per line instead of\n // once per character. The step swallows the newline that used to open the\n // terminator, which is why it now reads `\\n+` and not `\\n{2,}`, and the\n // leading lookahead keeps a source with nothing left after the bullet from\n // matching through a zero-width step.\n '(?=[\\\\s\\\\S])(?:[^\\\\n]*(?:\\\\n|$))+?' +\n '(?:\\\\n+(?! )' +\n '(?!\\\\1' +\n bullet +\n ' (?!' +\n bullet +\n ' ))\\\\n*' +\n // `\\s` already covers `\\n`, so the trailing `\\n*` the pattern used to\n // carry could only ever match empty — and paying for it at every step of\n // the lazy scan cost a third of the whole match.\n '|\\\\s*$)'\n );\n};\n\nexport const ORDERED_LIST_R = generateListRegex(ORDERED);\nexport const UNORDERED_LIST_R = generateListRegex(UNORDERED);\n"],"mappings":";;;;;AAQA,MAAa,WAAW;CACtB,YAAY;CACZ,WAAW;CACX,eAAe;CACf,WAAW;CACX,YAAY;CACZ,YAAY;CACZ,UAAU;CACV,mBAAmB;CACnB,SAAS;CACT,SAAS;CACT,eAAe;;CAEf,WAAW;CACX,aAAa;;CAEb,iBAAiB;;CAEjB,iBAAiB;CACjB,OAAO;CACP,MAAM;;CAEN,6BAA6B;;CAE7B,qBAAqB;CACrB,kBAAkB;CAClB,aAAa;CACb,WAAW;CACX,KAAK;CACL,UAAU;CACV,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,MAAM;CACN,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,YAAY;CACZ,qBAAqB;CACrB,eAAe;AACjB;AAGA,6BAA6B,QAC3B,OAAO,KAAK,QAAQ,CAAC,CAAC,SAAS,QAAQ;CACrC,AAAC,SAAiB,OAAO;AAC3B,CAAC;;;;AAYH,MAAa,WAAW;;CAEtB,KAAK;;CAEL,MAAM;;CAEN,KAAK;;CAEL,KAAK;;CAEL,KAAK;AACP;;;;;;;;AAeA,MAAa,YAAY;CACvB,OAAO;CACP,QAAQ;CACR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EpE,MAAa,qBAAqB,SAA2B;CAC3D,MAAM,SAAS,aAAmB,sBAAsB;CAExD,OAAO,IAAI,OACT,WACE,SACA,2DAWA,SACA,SACA,SACA,gBAKJ;AACF;AAEA,MAAa,iBAAiB,mBAAyB;AACvD,MAAa,mBAAmB,mBAA2B"}
|
|
@@ -10,8 +10,8 @@ import { getMarkdownMetadata } from "./markdown/getMarkdownMetadata.mjs";
|
|
|
10
10
|
import { validateMarkdown } from "./markdown/validateMarkdown.mjs";
|
|
11
11
|
import { md as markdown } from "./markdown/markdown.mjs";
|
|
12
12
|
import { nest as nesting } from "./nesting/nesting.mjs";
|
|
13
|
-
import { plural } from "./plural/plural.mjs";
|
|
13
|
+
import { DEFAULT_PLURAL_VARIABLE, plural } from "./plural/plural.mjs";
|
|
14
14
|
import { select } from "./select/select.mjs";
|
|
15
15
|
import { t as translation } from "./translation/translation.mjs";
|
|
16
16
|
|
|
17
|
-
export { HTML_TAGS, VOID_HTML_ELEMENTS, condition as cond, enumeration as enu, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, select, translation as t, validateHTML, validateMarkdown };
|
|
17
|
+
export { DEFAULT_PLURAL_VARIABLE, HTML_TAGS, VOID_HTML_ELEMENTS, condition as cond, enumeration as enu, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, select, translation as t, validateHTML, validateMarkdown };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { plural } from "./plural.mjs";
|
|
1
|
+
import { DEFAULT_PLURAL_VARIABLE, plural } from "./plural.mjs";
|
|
2
2
|
|
|
3
|
-
export { plural };
|
|
3
|
+
export { DEFAULT_PLURAL_VARIABLE, plural };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PLURAL, formatNodeType } from "@intlayer/types/nodeType";
|
|
2
2
|
|
|
3
3
|
//#region src/transpiler/plural/plural.ts
|
|
4
|
+
/** Name of the value a plural selects on when no `variable` is declared. */
|
|
5
|
+
const DEFAULT_PLURAL_VARIABLE = "count";
|
|
4
6
|
/**
|
|
5
7
|
* Function intended to be used to build intlayer dictionaries.
|
|
6
8
|
*
|
|
@@ -23,9 +25,25 @@ import { PLURAL, formatNodeType } from "@intlayer/types/nodeType";
|
|
|
23
25
|
* other: '{{count}} вакансий',
|
|
24
26
|
* });
|
|
25
27
|
* ```
|
|
28
|
+
*
|
|
29
|
+
* Nest plurals declaring a `variable` to select on several quantities:
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* plural(
|
|
33
|
+
* {
|
|
34
|
+
* one: plural(
|
|
35
|
+
* { one: '{{files}} file in {{folders}} folder', other: '…' },
|
|
36
|
+
* { variable: 'folders' }
|
|
37
|
+
* ),
|
|
38
|
+
* other: plural({ … }, { variable: 'folders' }),
|
|
39
|
+
* },
|
|
40
|
+
* { variable: 'files' }
|
|
41
|
+
* );
|
|
42
|
+
* // content.filesInFolders({ files: 1, folders: 2 })
|
|
43
|
+
* ```
|
|
26
44
|
*/
|
|
27
|
-
const plural = (content) => formatNodeType(PLURAL, content);
|
|
45
|
+
const plural = (content, options) => formatNodeType(PLURAL, content, options?.variable ? { variable: options.variable } : void 0);
|
|
28
46
|
|
|
29
47
|
//#endregion
|
|
30
|
-
export { plural };
|
|
48
|
+
export { DEFAULT_PLURAL_VARIABLE, plural };
|
|
31
49
|
//# sourceMappingURL=plural.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plural.mjs","names":[],"sources":["../../../../src/transpiler/plural/plural.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, PLURAL } from '@intlayer/types/nodeType';\n\nexport type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\nexport type PluralContentState<Content> = Partial<\n Record<PluralCategory, Content>\n> & {\n other: Content;\n};\n\nexport type PluralContent
|
|
1
|
+
{"version":3,"file":"plural.mjs","names":[],"sources":["../../../../src/transpiler/plural/plural.ts"],"sourcesContent":["import type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { formatNodeType, PLURAL } from '@intlayer/types/nodeType';\n\nexport type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\n\nexport type PluralContentState<Content> = Partial<\n Record<PluralCategory, Content>\n> & {\n other: Content;\n};\n\n/** Name of the value a plural selects on when no `variable` is declared. */\nexport const DEFAULT_PLURAL_VARIABLE = 'count';\n\nexport type PluralOptions<Variable extends string = string> = {\n /**\n * Name of the value the plural category is selected on.\n *\n * Defaults to `count`. Set it to nest plurals over independent quantities:\n * the resolved function then takes `{ [variable]: number, … }`.\n */\n variable?: Variable;\n};\n\nexport type PluralContent<\n Content = unknown,\n Variable extends string = typeof DEFAULT_PLURAL_VARIABLE,\n> = TypedNodeModel<\n typeof PLURAL,\n PluralContentState<Content>,\n { variable?: Variable }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity using CLDR pluralization rules\n * (`Intl.PluralRules`). The selected category depends on the active locale.\n *\n * Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.\n * `other` is required as the fallback.\n *\n * The string content can include a `{{count}}` placeholder, which is\n * automatically replaced with the provided count.\n *\n * Usage:\n *\n * ```ts\n * plural({\n * one: '{{count}} вакансия',\n * few: '{{count}} вакансии',\n * many: '{{count}} вакансий',\n * other: '{{count}} вакансий',\n * });\n * ```\n *\n * Nest plurals declaring a `variable` to select on several quantities:\n *\n * ```ts\n * plural(\n * {\n * one: plural(\n * { one: '{{files}} file in {{folders}} folder', other: '…' },\n * { variable: 'folders' }\n * ),\n * other: plural({ … }, { variable: 'folders' }),\n * },\n * { variable: 'files' }\n * );\n * // content.filesInFolders({ files: 1, folders: 2 })\n * ```\n */\nconst plural = <\n Content = unknown,\n const Variable extends string = typeof DEFAULT_PLURAL_VARIABLE,\n>(\n content: PluralContentState<Content>,\n options?: PluralOptions<Variable>\n): PluralContent<Content, Variable> =>\n formatNodeType(\n PLURAL,\n content,\n options?.variable ? { variable: options.variable } : undefined\n );\n\nexport { plural };\n"],"mappings":";;;;AAYA,MAAa,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DvC,MAAM,UAIJ,SACA,YAEA,eACE,QACA,SACA,SAAS,WAAW,EAAE,UAAU,QAAQ,SAAS,IAAI,MACvD"}
|
package/dist/esm/utils/intl.mjs
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveInterpreterLocale } from "../interpreter/resolveInterpreterLocale.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/intl.ts
|
|
4
|
-
/**
|
|
5
|
-
* Cached Intl helper – drop‑in replacement for the global `Intl` object.
|
|
6
|
-
* ‑‑‑
|
|
7
|
-
* • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).
|
|
8
|
-
* • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests
|
|
9
|
-
* reuse the same heavy instance instead of reparsing CLDR data every time.
|
|
10
|
-
* • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.
|
|
11
|
-
* • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –
|
|
12
|
-
* you can treat `CachedIntl` just like the built‑in `Intl`.
|
|
13
|
-
*
|
|
14
|
-
* Usage @example:
|
|
15
|
-
* ---------------
|
|
16
|
-
* ```ts
|
|
17
|
-
* import { CachedIntl } from "./cached-intl";
|
|
18
|
-
*
|
|
19
|
-
* const nf = CachedIntl.NumberFormat("en-US", { style: "currency", currency: "USD" });
|
|
20
|
-
* console.log(nf.format(1234));
|
|
21
|
-
*
|
|
22
|
-
* const dn = CachedIntl.DisplayNames(["fr"], { type: "language" });
|
|
23
|
-
* console.log(dn.of("en")); * → "anglais"
|
|
24
|
-
*
|
|
25
|
-
* You can also spin up an isolated instance with its own caches (handy in test suites):
|
|
26
|
-
* const TestIntl = createCachedIntl();
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
4
|
const MAX_CACHE_SIZE = 50;
|
|
30
5
|
const cache = /* @__PURE__ */ new Map();
|
|
31
6
|
const alreadyWarnedConstructors = /* @__PURE__ */ new Set();
|
|
@@ -105,7 +80,7 @@ const resolveIntlConstructor = (constructorName) => {
|
|
|
105
80
|
return intlConstructorFallbacks[constructorName];
|
|
106
81
|
};
|
|
107
82
|
function getCachedIntl(intlConstructor, locale, options) {
|
|
108
|
-
const resLoc = locale
|
|
83
|
+
const resLoc = resolveInterpreterLocale(locale);
|
|
109
84
|
const key = `${resLoc}|${options ? JSON.stringify(options) : ""}`;
|
|
110
85
|
const cacheKey = intlConstructor;
|
|
111
86
|
let ctorCache = cache.get(cacheKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl.mjs","names":[],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["/**\n * Cached Intl helper – drop‑in replacement for the global `Intl` object.\n * ‑‑‑\n * • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n * • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n * reuse the same heavy instance instead of reparsing CLDR data every time.\n * • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n * • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n * you can treat `CachedIntl` just like the built‑in `Intl`.\n *\n * Usage @example:\n * ---------------\n * ```ts\n * import { CachedIntl } from \"./cached-intl\";\n *\n * const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n * console.log(nf.format(1234));\n *\n * const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n * console.log(dn.of(\"en\")); * → \"anglais\"\n *\n * You can also spin up an isolated instance with its own caches (handy in test suites):\n * const TestIntl = createCachedIntl();\n * ```\n */\n\nimport { internationalization } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nconst MAX_CACHE_SIZE = 50;\nconst cache = new Map<any, Map<string, any>>();\n\n/**\n * Minimal `Intl.ListFormat` surface, declared locally so consumers do not need\n * the `ES2021.Intl` lib in their tsconfig.\n */\ntype ListFormatInstance = {\n format(list: Iterable<string>): string;\n formatToParts(\n list: Iterable<string>\n ): { type: 'element' | 'literal'; value: string }[];\n};\n\n/**\n * Minimal `Intl.Segmenter` surface, declared locally so consumers do not need\n * the `ES2022.Intl` lib in their tsconfig.\n */\ntype SegmenterInstance = {\n segment(input: string): Iterable<{ segment: string; index: number }>;\n};\n\n/**\n * Instance type produced by each `Intl` constructor this module can build.\n */\ntype IntlInstanceByName = {\n Collator: Intl.Collator;\n DateTimeFormat: Intl.DateTimeFormat;\n DisplayNames: Intl.DisplayNames;\n ListFormat: ListFormatInstance;\n Locale: Intl.Locale;\n NumberFormat: Intl.NumberFormat;\n PluralRules: Intl.PluralRules;\n RelativeTimeFormat: Intl.RelativeTimeFormat;\n Segmenter: SegmenterInstance;\n};\n\n/**\n * Names of the `Intl` constructors this module knows how to instantiate.\n */\nexport type IntlConstructorName = keyof IntlInstanceByName;\n\nconst alreadyWarnedConstructors = new Set<string>();\n\n/**\n * Warns once per missing `Intl` constructor, in development only.\n */\nconst warnMissingIntlConstructor = (constructorName: string): void => {\n if (process.env.NODE_ENV === 'production') return;\n if (alreadyWarnedConstructors.has(constructorName)) return;\n\n alreadyWarnedConstructors.add(constructorName);\n\n console.warn(\n `[intlayer] \\`Intl.${constructorName}\\` is not available in this JavaScript engine. ` +\n `A degraded fallback is used instead. ` +\n `On React Native, load a polyfill (e.g. \\`@formatjs/intl-${constructorName.toLowerCase()}/polyfill\\`) before rendering your app.`\n );\n};\n\n/**\n * Minimal stand-ins used when the engine ships without the matching `Intl`\n * constructor. Hermes — the default React Native engine — omits\n * `DisplayNames`, `ListFormat` and `Segmenter` in release builds unless the\n * app opts into the full ICU build or loads a polyfill. Without these shims,\n * `new Intl.DisplayNames(...)` throws\n * `TypeError: undefined cannot be used as a constructor` and takes the whole\n * app down at render time.\n *\n * Each shim mirrors only the surface Intlayer relies on, and returns the\n * un-localized input so rendering degrades rather than crashing.\n */\nconst intlConstructorFallbacks: Partial<\n Record<IntlConstructorName, new (locale?: any, options?: any) => any>\n> = {\n DisplayNames: class DisplayNamesFallback {\n /** Returns the requested code unchanged, since no CLDR data is available. */\n public of(code: string): string {\n return code;\n }\n },\n ListFormat: class ListFormatFallback {\n /** Joins the list with a comma, the most neutral separator available. */\n public format(list: Iterable<string>): string {\n return Array.from(list).join(', ');\n }\n\n /** Mirrors `Intl.ListFormat.prototype.formatToParts` shape. */\n public formatToParts(\n list: Iterable<string>\n ): { type: 'element' | 'literal'; value: string }[] {\n return Array.from(list).flatMap((value, index) =>\n index === 0\n ? [{ type: 'element' as const, value }]\n : [\n { type: 'literal' as const, value: ', ' },\n { type: 'element' as const, value },\n ]\n );\n }\n },\n Segmenter: class SegmenterFallback {\n /** Segments by code point, the closest approximation without ICU data. */\n public segment(input: string): { segment: string; index: number }[] {\n let index = 0;\n\n return Array.from(input).map((segment) => {\n const segmentStart = index;\n index += segment.length;\n\n return { segment, index: segmentStart };\n });\n }\n },\n};\n\n/**\n * Resolves an `Intl` constructor by name at call time, falling back to a\n * degraded shim when the engine does not provide it.\n *\n * Resolution is deliberately lazy: React Native apps install their polyfills\n * at startup, which may run after this module is first imported.\n */\nconst resolveIntlConstructor = (\n constructorName: IntlConstructorName\n): (new (locale?: any, options?: any) => any) | undefined => {\n const nativeConstructor = (\n Intl as unknown as Record<string, new (...args: any[]) => any>\n )[constructorName];\n\n if (typeof nativeConstructor === 'function') return nativeConstructor;\n\n warnMissingIntlConstructor(constructorName);\n\n return intlConstructorFallbacks[constructorName];\n};\n\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues, options?: Options): Instance;\n (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues): Instance;\n (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\nexport type WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n/**\n * Generic caching instantiator for Intl constructors.\n *\n * Prefer passing the constructor *name* (e.g. `'DisplayNames'`) rather than the\n * constructor itself: the name is resolved lazily against the global `Intl`, so\n * late-installed polyfills are picked up and missing constructors degrade to a\n * fallback instead of throwing.\n */\nexport function getCachedIntl<Name extends IntlConstructorName>(\n constructorName: Name,\n locale?: LocalesValues | string,\n options?: any\n): IntlInstanceByName[Name];\nexport function getCachedIntl<T extends new (...args: any[]) => any>(\n Ctor: T,\n locale?: LocalesValues | string,\n options?: any\n): InstanceType<T>;\nexport function getCachedIntl(\n intlConstructor: IntlConstructorName | (new (...args: any[]) => any),\n locale?: LocalesValues | string,\n options?: any\n): any {\n const resLoc = locale ?? internationalization?.defaultLocale;\n\n const optKey = options ? JSON.stringify(options) : '';\n const key = `${resLoc}|${optKey}`;\n\n // Cache per name when available, so two constructors that are both missing\n // from the engine do not collide on a single `undefined` cache bucket.\n const cacheKey = intlConstructor;\n\n let ctorCache = cache.get(cacheKey);\n\n if (!ctorCache) {\n ctorCache = new Map();\n cache.set(cacheKey, ctorCache);\n }\n\n let instance = ctorCache.get(key);\n\n if (!instance) {\n const ResolvedConstructor =\n typeof intlConstructor === 'string'\n ? resolveIntlConstructor(intlConstructor)\n : intlConstructor;\n\n if (typeof ResolvedConstructor !== 'function') {\n throw new Error(\n `[intlayer] \\`Intl.${String(intlConstructor)}\\` is not available in this JavaScript engine and has no fallback. ` +\n `Load the matching polyfill before formatting.`\n );\n }\n\n if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();\n instance = new ResolvedConstructor(resLoc, options);\n ctorCache.set(key, instance);\n }\n return instance;\n}\n\n/**\n * Optional: Keep bindIntl if your library exports it publicly.\n * It now uses the much smaller getCachedIntl under the hood.\n */\nexport const bindIntl = (boundLocale: LocalesValues): WrappedIntl => {\n const bindWrap = (constructorName: IntlConstructorName) =>\n // function is used as a constructor, do not change in arrow function\n function intlConstructor(locales?: any, options?: any) {\n const isOptsFirst =\n locales !== null &&\n typeof locales === 'object' &&\n !Array.isArray(locales);\n const resOpts = isOptsFirst ? locales : options;\n const resLoc = isOptsFirst\n ? (resOpts as any).locale || boundLocale\n : locales || boundLocale;\n\n return getCachedIntl(constructorName, resLoc, resOpts);\n };\n\n return {\n ...Intl,\n Collator: bindWrap('Collator'),\n DateTimeFormat: bindWrap('DateTimeFormat'),\n DisplayNames: bindWrap('DisplayNames'),\n ListFormat: bindWrap('ListFormat'),\n NumberFormat: bindWrap('NumberFormat'),\n PluralRules: bindWrap('PluralRules'),\n RelativeTimeFormat: bindWrap('RelativeTimeFormat'),\n Locale: bindWrap('Locale'),\n Segmenter: bindWrap('Segmenter'),\n } as unknown as WrappedIntl;\n};\n\n// Add this to the bottom of utils/intl.ts ONLY if required for public API compatibility.\nexport const CachedIntl = {\n // function is used as a constructor, do not change in arrow function\n Collator: function Collator(locales?: any, options?: any) {\n return getCachedIntl('Collator', locales, options);\n },\n DateTimeFormat: function DateTimeFormat(locales?: any, options?: any) {\n return getCachedIntl('DateTimeFormat', locales, options);\n },\n DisplayNames: function DisplayNames(locales?: any, options?: any) {\n return getCachedIntl('DisplayNames', locales, options);\n },\n ListFormat: function ListFormat(locales?: any, options?: any) {\n return getCachedIntl('ListFormat', locales, options);\n },\n NumberFormat: function NumberFormat(locales?: any, options?: any) {\n return getCachedIntl('NumberFormat', locales, options);\n },\n PluralRules: function PluralRules(locales?: any, options?: any) {\n return getCachedIntl('PluralRules', locales, options);\n },\n RelativeTimeFormat: function RelativeTimeFormat(\n locales?: any,\n options?: any\n ) {\n return getCachedIntl('RelativeTimeFormat', locales, options);\n },\n Segmenter: function Segmenter(locales?: any, options?: any) {\n return getCachedIntl('Segmenter', locales, options);\n },\n} as any; // Cast to 'any' internally to avoid TS readonly errors\n\nexport { CachedIntl as Intl };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,wBAAQ,IAAI,IAA2B;AAyC7C,MAAM,4CAA4B,IAAI,IAAY;;;;AAKlD,MAAM,8BAA8B,oBAAkC;CACpE,6BAA6B,cAAc;CAC3C,IAAI,0BAA0B,IAAI,eAAe,GAAG;CAEpD,0BAA0B,IAAI,eAAe;CAE7C,QAAQ,KACN,qBAAqB,gBAAgB,8IAEwB,gBAAgB,YAAY,EAAE,wCAC7F;AACF;;;;;;;;;;;;;AAcA,MAAM,2BAEF;CACF,cAAc,MAAM,qBAAqB;;EAEvC,AAAO,GAAG,MAAsB;GAC9B,OAAO;EACT;CACF;CACA,YAAY,MAAM,mBAAmB;;EAEnC,AAAO,OAAO,MAAgC;GAC5C,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI;EACnC;;EAGA,AAAO,cACL,MACkD;GAClD,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,SAAS,OAAO,UACtC,UAAU,IACN,CAAC;IAAE,MAAM;IAAoB;GAAM,CAAC,IACpC,CACE;IAAE,MAAM;IAAoB,OAAO;GAAK,GACxC;IAAE,MAAM;IAAoB;GAAM,CACpC,CACN;EACF;CACF;CACA,WAAW,MAAM,kBAAkB;;EAEjC,AAAO,QAAQ,OAAqD;GAClE,IAAI,QAAQ;GAEZ,OAAO,MAAM,KAAK,KAAK,CAAC,CAAC,KAAK,YAAY;IACxC,MAAM,eAAe;IACrB,SAAS,QAAQ;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AAS,cAAc;EACrC,aAAa,SAAS,aAAa;EACnC,oBAAoB,SAAS,oBAAoB;EACjD,QAAQ,SAAS,QAAQ;EACzB,WAAW,SAAS,WAAW;CACjC;AACF;AAGA,MAAa,aAAa;CAExB,UAAU,SAAS,SAAS,SAAe,SAAe;EACxD,OAAO,cAAc,YAAY,SAAS,OAAO;CACnD;CACA,gBAAgB,SAAS,eAAe,SAAe,SAAe;EACpE,OAAO,cAAc,kBAAkB,SAAS,OAAO;CACzD;CACA,cAAc,SAAS,aAAa,SAAe,SAAe;EAChE,OAAO,cAAc,gBAAgB,SAAS,OAAO;CACvD;CACA,YAAY,SAAS,WAAW,SAAe,SAAe;EAC5D,OAAO,cAAc,cAAc,SAAS,OAAO;CACrD;CACA,cAAc,SAAS,aAAa,SAAe,SAAe;EAChE,OAAO,cAAc,gBAAgB,SAAS,OAAO;CACvD;CACA,aAAa,SAAS,YAAY,SAAe,SAAe;EAC9D,OAAO,cAAc,eAAe,SAAS,OAAO;CACtD;CACA,oBAAoB,SAAS,mBAC3B,SACA,SACA;EACA,OAAO,cAAc,sBAAsB,SAAS,OAAO;CAC7D;CACA,WAAW,SAAS,UAAU,SAAe,SAAe;EAC1D,OAAO,cAAc,aAAa,SAAS,OAAO;CACpD;AACF"}
|
|
1
|
+
{"version":3,"file":"intl.mjs","names":[],"sources":["../../../src/utils/intl.ts"],"sourcesContent":["/**\n * Cached Intl helper – drop‑in replacement for the global `Intl` object.\n * ‑‑‑\n * • Uses a `Proxy` to lazily wrap every *constructor* hanging off `Intl` (NumberFormat, DateTimeFormat, …).\n * • Each wrapped constructor keeps an in‑memory cache keyed by `[locales, options]` so that identical requests\n * reuse the same heavy instance instead of reparsing CLDR data every time.\n * • A polyfill warning for `Intl.DisplayNames` is emitted only once and only in dev.\n * • The public API is fully type‑safe and mirrors the native `Intl` surface exactly –\n * you can treat `CachedIntl` just like the built‑in `Intl`.\n *\n * Usage @example:\n * ---------------\n * ```ts\n * import { CachedIntl } from \"./cached-intl\";\n *\n * const nf = CachedIntl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n * console.log(nf.format(1234));\n *\n * const dn = CachedIntl.DisplayNames([\"fr\"], { type: \"language\" });\n * console.log(dn.of(\"en\")); * → \"anglais\"\n *\n * You can also spin up an isolated instance with its own caches (handy in test suites):\n * const TestIntl = createCachedIntl();\n * ```\n */\n\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { resolveInterpreterLocale } from '../interpreter/resolveInterpreterLocale';\n\nconst MAX_CACHE_SIZE = 50;\nconst cache = new Map<any, Map<string, any>>();\n\n/**\n * Minimal `Intl.ListFormat` surface, declared locally so consumers do not need\n * the `ES2021.Intl` lib in their tsconfig.\n */\ntype ListFormatInstance = {\n format(list: Iterable<string>): string;\n formatToParts(\n list: Iterable<string>\n ): { type: 'element' | 'literal'; value: string }[];\n};\n\n/**\n * Minimal `Intl.Segmenter` surface, declared locally so consumers do not need\n * the `ES2022.Intl` lib in their tsconfig.\n */\ntype SegmenterInstance = {\n segment(input: string): Iterable<{ segment: string; index: number }>;\n};\n\n/**\n * Instance type produced by each `Intl` constructor this module can build.\n */\ntype IntlInstanceByName = {\n Collator: Intl.Collator;\n DateTimeFormat: Intl.DateTimeFormat;\n DisplayNames: Intl.DisplayNames;\n ListFormat: ListFormatInstance;\n Locale: Intl.Locale;\n NumberFormat: Intl.NumberFormat;\n PluralRules: Intl.PluralRules;\n RelativeTimeFormat: Intl.RelativeTimeFormat;\n Segmenter: SegmenterInstance;\n};\n\n/**\n * Names of the `Intl` constructors this module knows how to instantiate.\n */\nexport type IntlConstructorName = keyof IntlInstanceByName;\n\nconst alreadyWarnedConstructors = new Set<string>();\n\n/**\n * Warns once per missing `Intl` constructor, in development only.\n */\nconst warnMissingIntlConstructor = (constructorName: string): void => {\n if (process.env.NODE_ENV === 'production') return;\n if (alreadyWarnedConstructors.has(constructorName)) return;\n\n alreadyWarnedConstructors.add(constructorName);\n\n console.warn(\n `[intlayer] \\`Intl.${constructorName}\\` is not available in this JavaScript engine. ` +\n `A degraded fallback is used instead. ` +\n `On React Native, load a polyfill (e.g. \\`@formatjs/intl-${constructorName.toLowerCase()}/polyfill\\`) before rendering your app.`\n );\n};\n\n/**\n * Minimal stand-ins used when the engine ships without the matching `Intl`\n * constructor. Hermes — the default React Native engine — omits\n * `DisplayNames`, `ListFormat` and `Segmenter` in release builds unless the\n * app opts into the full ICU build or loads a polyfill. Without these shims,\n * `new Intl.DisplayNames(...)` throws\n * `TypeError: undefined cannot be used as a constructor` and takes the whole\n * app down at render time.\n *\n * Each shim mirrors only the surface Intlayer relies on, and returns the\n * un-localized input so rendering degrades rather than crashing.\n */\nconst intlConstructorFallbacks: Partial<\n Record<IntlConstructorName, new (locale?: any, options?: any) => any>\n> = {\n DisplayNames: class DisplayNamesFallback {\n /** Returns the requested code unchanged, since no CLDR data is available. */\n public of(code: string): string {\n return code;\n }\n },\n ListFormat: class ListFormatFallback {\n /** Joins the list with a comma, the most neutral separator available. */\n public format(list: Iterable<string>): string {\n return Array.from(list).join(', ');\n }\n\n /** Mirrors `Intl.ListFormat.prototype.formatToParts` shape. */\n public formatToParts(\n list: Iterable<string>\n ): { type: 'element' | 'literal'; value: string }[] {\n return Array.from(list).flatMap((value, index) =>\n index === 0\n ? [{ type: 'element' as const, value }]\n : [\n { type: 'literal' as const, value: ', ' },\n { type: 'element' as const, value },\n ]\n );\n }\n },\n Segmenter: class SegmenterFallback {\n /** Segments by code point, the closest approximation without ICU data. */\n public segment(input: string): { segment: string; index: number }[] {\n let index = 0;\n\n return Array.from(input).map((segment) => {\n const segmentStart = index;\n index += segment.length;\n\n return { segment, index: segmentStart };\n });\n }\n },\n};\n\n/**\n * Resolves an `Intl` constructor by name at call time, falling back to a\n * degraded shim when the engine does not provide it.\n *\n * Resolution is deliberately lazy: React Native apps install their polyfills\n * at startup, which may run after this module is first imported.\n */\nconst resolveIntlConstructor = (\n constructorName: IntlConstructorName\n): (new (locale?: any, options?: any) => any) | undefined => {\n const nativeConstructor = (\n Intl as unknown as Record<string, new (...args: any[]) => any>\n )[constructorName];\n\n if (typeof nativeConstructor === 'function') return nativeConstructor;\n\n warnMissingIntlConstructor(constructorName);\n\n return intlConstructorFallbacks[constructorName];\n};\n\ntype IntlConstructors = {\n [K in keyof typeof Intl as (typeof Intl)[K] extends new (\n ...args: any\n ) => any\n ? K\n : never]: (typeof Intl)[K];\n};\n\ntype ReplaceLocaleWithLocalesValues<T> = T extends new (\n locales: any,\n options?: infer Options\n) => infer Instance\n ? {\n new (locales?: LocalesValues, options?: Options): Instance;\n new (options?: Options & { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues, options?: Options): Instance;\n (options?: Options & { locale?: LocalesValues }): Instance;\n }\n : T extends new (\n locales: any\n ) => infer Instance\n ? {\n new (locales?: LocalesValues): Instance;\n new (options?: { locale?: LocalesValues }): Instance;\n (locales?: LocalesValues): Instance;\n (options?: { locale?: LocalesValues }): Instance;\n }\n : T;\n\nexport type WrappedIntl = {\n [K in keyof typeof Intl]: K extends keyof IntlConstructors\n ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]>\n : (typeof Intl)[K];\n};\n\n/**\n * Generic caching instantiator for Intl constructors.\n *\n * Prefer passing the constructor *name* (e.g. `'DisplayNames'`) rather than the\n * constructor itself: the name is resolved lazily against the global `Intl`, so\n * late-installed polyfills are picked up and missing constructors degrade to a\n * fallback instead of throwing.\n */\nexport function getCachedIntl<Name extends IntlConstructorName>(\n constructorName: Name,\n locale?: LocalesValues | string,\n options?: any\n): IntlInstanceByName[Name];\nexport function getCachedIntl<T extends new (...args: any[]) => any>(\n Ctor: T,\n locale?: LocalesValues | string,\n options?: any\n): InstanceType<T>;\nexport function getCachedIntl(\n intlConstructor: IntlConstructorName | (new (...args: any[]) => any),\n locale?: LocalesValues | string,\n options?: any\n): any {\n // No locale given: request locale → browser storage → default locale\n const resLoc = resolveInterpreterLocale(locale as LocalesValues | undefined);\n\n const optKey = options ? JSON.stringify(options) : '';\n const key = `${resLoc}|${optKey}`;\n\n // Cache per name when available, so two constructors that are both missing\n // from the engine do not collide on a single `undefined` cache bucket.\n const cacheKey = intlConstructor;\n\n let ctorCache = cache.get(cacheKey);\n\n if (!ctorCache) {\n ctorCache = new Map();\n cache.set(cacheKey, ctorCache);\n }\n\n let instance = ctorCache.get(key);\n\n if (!instance) {\n const ResolvedConstructor =\n typeof intlConstructor === 'string'\n ? resolveIntlConstructor(intlConstructor)\n : intlConstructor;\n\n if (typeof ResolvedConstructor !== 'function') {\n throw new Error(\n `[intlayer] \\`Intl.${String(intlConstructor)}\\` is not available in this JavaScript engine and has no fallback. ` +\n `Load the matching polyfill before formatting.`\n );\n }\n\n if (ctorCache.size > MAX_CACHE_SIZE) ctorCache.clear();\n instance = new ResolvedConstructor(resLoc, options);\n ctorCache.set(key, instance);\n }\n return instance;\n}\n\n/**\n * Optional: Keep bindIntl if your library exports it publicly.\n * It now uses the much smaller getCachedIntl under the hood.\n */\nexport const bindIntl = (boundLocale?: LocalesValues): WrappedIntl => {\n const bindWrap = (constructorName: IntlConstructorName) =>\n // function is used as a constructor, do not change in arrow function\n function intlConstructor(locales?: any, options?: any) {\n const isOptsFirst =\n locales !== null &&\n typeof locales === 'object' &&\n !Array.isArray(locales);\n const resOpts = isOptsFirst ? locales : options;\n const resLoc = isOptsFirst\n ? (resOpts as any).locale || boundLocale\n : locales || boundLocale;\n\n return getCachedIntl(constructorName, resLoc, resOpts);\n };\n\n return {\n ...Intl,\n Collator: bindWrap('Collator'),\n DateTimeFormat: bindWrap('DateTimeFormat'),\n DisplayNames: bindWrap('DisplayNames'),\n ListFormat: bindWrap('ListFormat'),\n NumberFormat: bindWrap('NumberFormat'),\n PluralRules: bindWrap('PluralRules'),\n RelativeTimeFormat: bindWrap('RelativeTimeFormat'),\n Locale: bindWrap('Locale'),\n Segmenter: bindWrap('Segmenter'),\n } as unknown as WrappedIntl;\n};\n\n// Add this to the bottom of utils/intl.ts ONLY if required for public API compatibility.\nexport const CachedIntl = {\n // function is used as a constructor, do not change in arrow function\n Collator: function Collator(locales?: any, options?: any) {\n return getCachedIntl('Collator', locales, options);\n },\n DateTimeFormat: function DateTimeFormat(locales?: any, options?: any) {\n return getCachedIntl('DateTimeFormat', locales, options);\n },\n DisplayNames: function DisplayNames(locales?: any, options?: any) {\n return getCachedIntl('DisplayNames', locales, options);\n },\n ListFormat: function ListFormat(locales?: any, options?: any) {\n return getCachedIntl('ListFormat', locales, options);\n },\n NumberFormat: function NumberFormat(locales?: any, options?: any) {\n return getCachedIntl('NumberFormat', locales, options);\n },\n PluralRules: function PluralRules(locales?: any, options?: any) {\n return getCachedIntl('PluralRules', locales, options);\n },\n RelativeTimeFormat: function RelativeTimeFormat(\n locales?: any,\n options?: any\n ) {\n return getCachedIntl('RelativeTimeFormat', locales, options);\n },\n Segmenter: function Segmenter(locales?: any, options?: any) {\n return getCachedIntl('Segmenter', locales, options);\n },\n} as any; // Cast to 'any' internally to avoid TS readonly errors\n\nexport { CachedIntl as Intl };\n"],"mappings":";;;AA6BA,MAAM,iBAAiB;AACvB,MAAM,wBAAQ,IAAI,IAA2B;AAyC7C,MAAM,4CAA4B,IAAI,IAAY;;;;AAKlD,MAAM,8BAA8B,oBAAkC;CACpE,6BAA6B,cAAc;CAC3C,IAAI,0BAA0B,IAAI,eAAe,GAAG;CAEpD,0BAA0B,IAAI,eAAe;CAE7C,QAAQ,KACN,qBAAqB,gBAAgB,8IAEwB,gBAAgB,YAAY,EAAE,wCAC7F;AACF;;;;;;;;;;;;;AAcA,MAAM,2BAEF;CACF,cAAc,MAAM,qBAAqB;;EAEvC,AAAO,GAAG,MAAsB;GAC9B,OAAO;EACT;CACF;CACA,YAAY,MAAM,mBAAmB;;EAEnC,AAAO,OAAO,MAAgC;GAC5C,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI;EACnC;;EAGA,AAAO,cACL,MACkD;GAClD,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,SAAS,OAAO,UACt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,MAAM,cACJ,YAAY,QACZ,OAAO,YAAY,YACnB,CAAC,MAAM,QAAQ,OAAO;EACxB,MAAM,UAAU,cAAc,UAAU;EAKxC,OAAO,cAAc,iBAJN,cACV,QAAgB,UAAU,cAC3B,WAAW,aAE+B,OAAO;CACvD;CAEF,OAAO;EACL,GAAG;EACH,UAAU,SAAS,UAAU;EAC7B,gBAAgB,SAAS,gBAAgB;EACzC,cAAc,SAAS,cAAc;EACrC,YAAY,SAAS,YAAY;EACjC,cAAc,SAAS,cAAc;EACrC,aAAa,SAAS,aAAa;EACnC,oBAAoB,SAAS,oBAAoB;EACjD,QAAQ,SAAS,QAAQ;EACzB,WAAW,SAAS,WAAW;CACjC;AACF;AAGA,MAAa,aAAa;CAExB,UAAU,SAAS,SAAS,SAAe,SAAe;EACxD,OAAO,cAAc,YAAY,SAAS,OAAO;CACnD;CACA,gBAAgB,SAAS,eAAe,SAAe,SAAe;EACpE,OAAO,cAAc,kBAAkB,SAAS,OAAO;CACzD;CACA,cAAc,SAAS,aAAa,SAAe,SAAe;EAChE,OAAO,cAAc,gBAAgB,SAAS,OAAO;CACvD;CACA,YAAY,SAAS,WAAW,SAAe,SAAe;EAC5D,OAAO,cAAc,cAAc,SAAS,OAAO;CACrD;CACA,cAAc,SAAS,aAAa,SAAe,SAAe;EAChE,OAAO,cAAc,gBAAgB,SAAS,OAAO;CACvD;CACA,aAAa,SAAS,YAAY,SAAe,SAAe;EAC9D,OAAO,cAAc,eAAe,SAAS,OAAO;CACtD;CACA,oBAAoB,SAAS,mBAC3B,SACA,SACA;EACA,OAAO,cAAc,sBAAsB,SAAS,OAAO;CAC7D;CACA,WAAW,SAAS,UAAU,SAAe,SAAe;EAC1D,OAAO,cAAc,aAAa,SAAS,OAAO;CACpD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","names":[],"sources":["../../../src/formatters/compact.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"compact.d.ts","names":[],"sources":["../../../src/formatters/compact.ts"],"mappings":";;;;;;;;;;;;;qBAca,UAAO,wBACI,UACZ,KAAK;EAAwB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.d.ts","names":[],"sources":["../../../src/formatters/currency.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"currency.d.ts","names":[],"sources":["../../../src/formatters/currency.ts"],"mappings":";;;;;;;;;;;;;qBAca,WAAQ,wBACG,UACZ,KAAK;EAAwB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","names":[],"sources":["../../../src/formatters/date.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"date.d.ts","names":[],"sources":["../../../src/formatters/date.ts"],"mappings":";;YAGY;qBAOC,SAAS,OAAO,gBAAgB,KAAK;;;;;;;;;;;;qBA8CrC,OAAI,MACT,wBAAsB,WAEvB,KAAK;EAA0B,SAAS;KACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","names":[],"sources":["../../../src/formatters/list.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"list.d.ts","names":[],"sources":["../../../src/formatters/list.ts"],"mappings":";;;YAIY;EACV;EACA;EACA;;;;;;;;;;;;;;;;;qBAkBW,OAAI,6BACY,UACjB;EAAsB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","names":[],"sources":["../../../src/formatters/number.ts"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"number.d.ts","names":[],"sources":["../../../src/formatters/number.ts"],"mappings":";;;;;;;;;;;qBAYa,SAAM,0BACK,WAAA,YAInB,KAAK;EAAwB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percentage.d.ts","names":[],"sources":["../../../src/formatters/percentage.ts"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"percentage.d.ts","names":[],"sources":["../../../src/formatters/percentage.ts"],"mappings":";;;;;;;;;;;qBAYa,aAAU,0BACC,WAAA,YAInB,KAAK;EAAwB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relativeTime.d.ts","names":[],"sources":["../../../src/formatters/relativeTime.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"relativeTime.d.ts","names":[],"sources":["../../../src/formatters/relativeTime.ts"],"mappings":";;KAGK,mBAAmB,KAAK;;;;;;;;;;;qBAuChB,eAAY,MACjB,wBAAsB,KACxB,wBAAsB,UAChB,KAAK;EACb,SAAS;EACT,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","names":[],"sources":["../../../src/formatters/units.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"units.d.ts","names":[],"sources":["../../../src/formatters/units.ts"],"mappings":";;;;;;;;;qBAUa,QAAK,wBACM,UACZ,KAAK;EAAwB,SAAS"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { getMarkdownMetadata } from "./transpiler/markdown/getMarkdownMetadata.j
|
|
|
12
12
|
import { MarkdownContent, MarkdownContentConstructor, md as markdown } from "./transpiler/markdown/markdown.js";
|
|
13
13
|
import { MarkdownValidationResult, validateMarkdown } from "./transpiler/markdown/validateMarkdown.js";
|
|
14
14
|
import { DotPath, NestedContent, NestedContentState, ValidDotPathsFor, nest as nesting } from "./transpiler/nesting/nesting.js";
|
|
15
|
-
import { PluralCategory, PluralContent, PluralContentState, plural } from "./transpiler/plural/plural.js";
|
|
15
|
+
import { DEFAULT_PLURAL_VARIABLE, PluralCategory, PluralContent, PluralContentState, PluralOptions, plural } from "./transpiler/plural/plural.js";
|
|
16
16
|
import { SelectContent, SelectContentStates, select } from "./transpiler/select/select.js";
|
|
17
17
|
import { TranslationContent, t as translation } from "./transpiler/translation/translation.js";
|
|
18
18
|
import "./transpiler/index.js";
|
|
@@ -126,4 +126,4 @@ import { CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorag
|
|
|
126
126
|
import { YamlRecord, YamlValue, parseYaml } from "./utils/parseYaml.js";
|
|
127
127
|
import { stringifyYaml } from "./utils/stringifyYaml.js";
|
|
128
128
|
import "./utils/index.js";
|
|
129
|
-
export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_NAME_START_R, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, AmbientLocaleResolver, AsyncAmbientLocaleResolver, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, BlockSyntaxProbe, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DEFAULT_VARIANT_ID, DO_NOT_PROCESS_HTML_ELEMENTS, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, FENCE_DELIMITER_R, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, type FileContent, type FileContentConstructor, type FootnoteNode, type FootnoteReferenceNode, type GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, type GenerateSitemapOptions, GetNestingResult, type GetPrefixOptions, type GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, type HTMLCommentNode, HTMLContent, HTMLContentConstructor, type HTMLNode, type HTMLSelfClosingNode, type HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, InterpolableNode, IntlConstructorName, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListFormatOptions, ListType, type LocaleDomainMap, type LocaleRequest, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, MarkdownReferences, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, NestedFieldReferences, type NestedParser, type NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, type OrderedListNode, PARAGRAPH_R, PRELOADED_DYNAMIC_KEY, type ParagraphNode, type ParseState, ParsedMarkdown, type Parser, type ParserResult, PlainDynamicLoaderMap, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PortableObject, PreloadableDynamicLoaderMap, PreloadedDynamicEntry, Priority, PriorityValue, type ProxyMode, type ProxyStorageSuppressionPurpose, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, ResolvedDynamicLoader, type Rule, type RuleOutput, RuleScope, RuleScopeValue, RuleType, RuleTypeValue, type Rules, SCOPE_BLOCK, SCOPE_BOTH, SCOPE_INLINE, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SelectCond, SelectContent, SelectContentStates, SelectSelector, type SitemapUrlEntry, type StrikethroughTextNode, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, TEXT_BOLD_R, TEXT_EMPHASIZED_R, TEXT_ESCAPED_R, TEXT_MARKED_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, TaggedMessageToken, type TextNode, TranslationCond, TranslationContent, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, UnionKeys, type UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindInsertedValues, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createMessageResolver, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, findPlainDynamicLoader, formatProxyEnabledMessage, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCachedLocaleFromStorageClient, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryAsync, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDictionaryTransformCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getGender, getHTML, getHTMLTextDir, getInsertion, getInsertionValues, getInternalPath, getInterpolableContent, getIntlayer, getIntlayerAsync, getIntlayerNodePrototype, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleFromRequest, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNestedDictionaryGraph, getNestedDictionaryKeys, getNestedDictionaryReferences, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPluginsCacheKey, getPlural, getPrefix, getPreloadLocale, getPreloadedDictionary, getReplacedValuesContent, getRewritePath, getRewriteRules, getRuleSet, getSelect, getSplittedContent, getSplittedDictionaryContent, getTranslation, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isDeclaredLocale, isInterpolableWrapperNode, isLocaleExclusiveOnDomain, isProxyStorageLocaleEnabled, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, navigatePath, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizePath, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseDictionarySelector, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseTaggedMessage, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, readTransformCache, rebuildInterpolableContent, reconstructQualifiedEntry, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveBrowserLocale, resolveDictionaryArgument, resolveEffectiveVariantId, resolveInsertedSelector, resolveInterpreterLocale, resolveInterpreterLocaleAsync, resolveLocalizedPath, resolveMessage, resolveMessageNode, resolveMessageNodeToString, resolvePlainDynamicLoader, resolveProviderVariant, resolveProxyMode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, select, selectPlugin, serializeVariant, serializeVariantChain, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, transformInterpolableNode, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter, writeTransformCache };
|
|
129
|
+
export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_NAME_START_R, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, AmbientLocaleResolver, AsyncAmbientLocaleResolver, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, BlockSyntaxProbe, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, COMPOSITE_ID_SEPARATOR, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DEFAULT_PLURAL_VARIABLE, DEFAULT_VARIANT_ID, DO_NOT_PROCESS_HTML_ELEMENTS, DateTimePreset, DeepTransformContent, DotPath, DynamicDictionaryLoader, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, FENCE_DELIMITER_R, FOOTNOTE_R, FOOTNOTE_REFERENCE_R, FORMFEED_R, FRONT_MATTER_R, FileCond, type FileContent, type FileContentConstructor, type FootnoteNode, type FootnoteReferenceNode, type GFMTaskNode, GFM_TASK_R, Gender, GenderCond, GenderContent, GenderContentStates, type GenerateSitemapOptions, GetNestingResult, type GetPrefixOptions, type GetPrefixResult, HEADING_ATX_COMPLIANT_R, HEADING_R, HEADING_SETEXT_R, type HTMLCommentNode, HTMLContent, HTMLContentConstructor, type HTMLNode, type HTMLSelfClosingNode, type HTMLTag, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, InterpolableNode, IntlConstructorName, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListFormatOptions, ListType, type LocaleDomainMap, type LocaleRequest, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, MarkdownReferences, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, MessageFormatDialect, MessageFormatter, MessageResolver, MessageValues, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, NestedFieldReferences, type NestedParser, type NewlineNode, NodeProps, ORDERED, ORDERED_LIST_BULLET, ORDERED_LIST_ITEM_PREFIX, ORDERED_LIST_ITEM_PREFIX_R, ORDERED_LIST_ITEM_R, ORDERED_LIST_R, type OrderedListNode, PARAGRAPH_R, PRELOADED_DYNAMIC_KEY, type ParagraphNode, type ParseState, ParsedMarkdown, type Parser, type ParserResult, PlainDynamicLoaderMap, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PluralOptions, PortableObject, PreloadableDynamicLoaderMap, PreloadedDynamicEntry, Priority, PriorityValue, type ProxyMode, type ProxyStorageSuppressionPurpose, QUALIFIER_DYNAMIC_TYPES_KEY, QUALIFIER_ORDER, QualifiedDynamicLoaderMap, QualifiedDynamicLoaderTree, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, ResolvedDynamicLoader, type Rule, type RuleOutput, RuleScope, RuleScopeValue, RuleType, RuleTypeValue, type Rules, SCOPE_BLOCK, SCOPE_BOTH, SCOPE_INLINE, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, SelectCond, SelectContent, SelectContentStates, SelectSelector, type SitemapUrlEntry, type StrikethroughTextNode, TABLE_CENTER_ALIGN, TABLE_LEFT_ALIGN, TABLE_RIGHT_ALIGN, TABLE_TRIM_PIPES, TAB_R, TEXT_BOLD_R, TEXT_EMPHASIZED_R, TEXT_ESCAPED_R, TEXT_MARKED_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, TaggedMessageToken, type TextNode, TranslationCond, TranslationContent, UNESCAPE_R, UNORDERED, UNORDERED_LIST_BULLET, UNORDERED_LIST_ITEM_PREFIX, UNORDERED_LIST_ITEM_PREFIX_R, UNORDERED_LIST_ITEM_R, UNORDERED_LIST_R, UnionKeys, type UnorderedListNode, VOID_HTML_ELEMENTS, ValidDotPathsFor, ValueAtKey, WrappedIntl, YamlRecord, YamlValue, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindInsertedValues, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, comparePaths, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createMessageResolver, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, findPlainDynamicLoader, formatProxyEnabledMessage, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCachedLocaleFromStorageClient, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getDictionaryAsync, getDictionaryCompositeIds, getDictionaryQualifierIds, getDictionaryQualifierTypes, getDictionarySelectorCacheKey, getDictionaryTransformCacheKey, getDomainHostname, getDomainOrigin, getEditedContent, getEditedDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getGender, getHTML, getHTMLTextDir, getInsertion, getInsertionValues, getInternalPath, getInterpolableContent, getIntlayer, getIntlayerAsync, getIntlayerNodePrototype, getLocale, getLocaleFromDomain, getLocaleFromPath, getLocaleFromRequest, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNestedDictionaryGraph, getNestedDictionaryKeys, getNestedDictionaryReferences, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPluginsCacheKey, getPlural, getPrefix, getPreloadLocale, getPreloadedDictionary, getReplacedValuesContent, getRewritePath, getRewriteRules, getRuleSet, getSelect, getSplittedContent, getSplittedDictionaryContent, getTranslation, getVariantIds, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, interpolateMessage, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isDeclaredLocale, isInterpolableWrapperNode, isLocaleExclusiveOnDomain, isProxyStorageLocaleEnabled, isQualifiedDictionaryGroup, isQualifiedDynamicLoaderMap, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, mergeQualifiedDictionaries, navigatePath, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizePath, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseDictionarySelector, parseInline, parseMarkdown, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseTaggedMessage, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, readTransformCache, rebuildInterpolableContent, reconstructQualifiedEntry, registerAmbientLocaleResolver, registerAsyncAmbientLocaleResolver, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderMarkdownAst, renderNothing, resolveBrowserLocale, resolveDictionaryArgument, resolveEffectiveVariantId, resolveInsertedSelector, resolveInterpreterLocale, resolveInterpreterLocaleAsync, resolveLocalizedPath, resolveMessage, resolveMessageNode, resolveMessageNodeToString, resolvePlainDynamicLoader, resolveProviderVariant, resolveProxyMode, resolveQualifiedDictionary, resolveQualifiedDynamicContent, resolveQualifiedDynamicContentAsync, sanitizer, select, selectPlugin, serializeVariant, serializeVariantChain, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, transformInterpolableNode, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter, writeTransformCache };
|
|
@@ -11,6 +11,8 @@ export declare const getPreferredLanguages: (acceptHeader: string | undefined, a
|
|
|
11
11
|
*
|
|
12
12
|
* Headers are provided by the browser/client and can be used to determine the user's preferred language.
|
|
13
13
|
* This function intersects the user's `Accept-Language` header with the application's available locales.
|
|
14
|
+
*
|
|
15
|
+
* The result is memoized, as it only depends on its arguments.
|
|
14
16
|
*/
|
|
15
17
|
export declare const localeDetector: (headers: Record<string, string | undefined>, availableLocales?: Locale[], defaultLocale?: Locale) => DeclaredLocales;
|
|
16
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localeDetector.d.ts","names":[],"sources":["../../../src/localization/localeDetector.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"localeDetector.d.ts","names":[],"sources":["../../../src/localization/localeDetector.ts"],"mappings":";;;;;;;qBAuQa,wBAAqB,kCACA;;;;;;;;;qBAuCrB,iBAAc,SAChB,oCAAkC,mBACxB,UAAQ,gBACX,WACf"}
|
|
@@ -90,7 +90,10 @@ export declare const NAMED_CODES_TO_UNICODE: Record<string, string>;
|
|
|
90
90
|
export declare const DO_NOT_PROCESS_HTML_ELEMENTS: string[];
|
|
91
91
|
/** Attributes that require URL sanitization */
|
|
92
92
|
export declare const ATTRIBUTES_TO_SANITIZE: string[];
|
|
93
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Attribute extractor regex. Values may be double/single quoted, `{…}`
|
|
95
|
+
* expressions, or unquoted `[…]` arrays (`codeFormat=["typescript", "esm"]`).
|
|
96
|
+
*/
|
|
94
97
|
export declare const ATTR_EXTRACTOR_R: RegExp;
|
|
95
98
|
/** First character of a valid attribute name (a letter, `_` or `:`). */
|
|
96
99
|
export declare const ATTRIBUTE_NAME_START_R: RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/markdown/constants.ts"],"mappings":";;;;;qBAQa;WACX;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;;WAEA;;WAEA;WACA;WACA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAUU,wBAAwB,uBAAuB;;;;qBAS9C;;WAEX;;WAEA;;WAEA;;WAEA;;WAEA;;YAGU,wBAAwB,uBAAuB;;;;;;;;qBAa9C;WACX;WACA;WACA;;qBAGW;qBACA;qBACA;YAED,yBACA,wBAAwB;;;;;qBAavB,4BAA4B;;;;qBAsD5B,wBAAwB;;qBAcxB;;qBAGA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/markdown/constants.ts"],"mappings":";;;;;qBAQa;WACX;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;;WAEA;;WAEA;WACA;WACA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAUU,wBAAwB,uBAAuB;;;;qBAS9C;;WAEX;;WAEA;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BAAc;qBACd,kBAAgB"}
|
|
@@ -19,10 +19,10 @@ import { MarkdownValidationResult, validateMarkdown } from "./markdown/validateM
|
|
|
19
19
|
import "./markdown/index.js";
|
|
20
20
|
import { DotPath, NestedContent, NestedContentState, ValidDotPathsFor, nest as nesting } from "./nesting/nesting.js";
|
|
21
21
|
import "./nesting/index.js";
|
|
22
|
-
import { PluralCategory, PluralContent, PluralContentState, plural } from "./plural/plural.js";
|
|
22
|
+
import { DEFAULT_PLURAL_VARIABLE, PluralCategory, PluralContent, PluralContentState, PluralOptions, plural } from "./plural/plural.js";
|
|
23
23
|
import "./plural/index.js";
|
|
24
24
|
import { SelectContent, SelectContentStates, select } from "./select/select.js";
|
|
25
25
|
import "./select/index.js";
|
|
26
26
|
import { TranslationContent, t as translation } from "./translation/translation.js";
|
|
27
27
|
import "./translation/index.js";
|
|
28
|
-
export { ConditionContent, ConditionContentStates, DotPath, EnterFormat, EnumerationContent, EnumerationContentState, type FileContent, type FileContentConstructor, Gender, GenderContent, GenderContentStates, HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, InsertionContent, InsertionContentConstructor, MarkdownContent, MarkdownContentConstructor, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, NestedContent, NestedContentState, PluralCategory, PluralContent, PluralContentState, SelectContent, SelectContentStates, TranslationContent, VOID_HTML_ELEMENTS, ValidDotPathsFor, condition as cond, enumeration as enu, type file, type fileContent, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, select, translation as t, validateHTML, validateMarkdown };
|
|
28
|
+
export { ConditionContent, ConditionContentStates, DEFAULT_PLURAL_VARIABLE, DotPath, EnterFormat, EnumerationContent, EnumerationContentState, type FileContent, type FileContentConstructor, Gender, GenderContent, GenderContentStates, HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, InsertionContent, InsertionContentConstructor, MarkdownContent, MarkdownContentConstructor, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, NestedContent, NestedContentState, PluralCategory, PluralContent, PluralContentState, PluralOptions, SelectContent, SelectContentStates, TranslationContent, VOID_HTML_ELEMENTS, ValidDotPathsFor, condition as cond, enumeration as enu, type file, type fileContent, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, select, translation as t, validateHTML, validateMarkdown };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PluralCategory, PluralContent, PluralContentState, plural } from "./plural.js";
|
|
2
|
-
export { PluralCategory, PluralContent, PluralContentState, plural };
|
|
1
|
+
import { DEFAULT_PLURAL_VARIABLE, PluralCategory, PluralContent, PluralContentState, PluralOptions, plural } from "./plural.js";
|
|
2
|
+
export { DEFAULT_PLURAL_VARIABLE, PluralCategory, PluralContent, PluralContentState, PluralOptions, plural };
|
|
@@ -4,7 +4,20 @@ export type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
|
4
4
|
export type PluralContentState<Content> = Partial<Record<PluralCategory, Content>> & {
|
|
5
5
|
other: Content;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
/** Name of the value a plural selects on when no `variable` is declared. */
|
|
8
|
+
export declare const DEFAULT_PLURAL_VARIABLE = "count";
|
|
9
|
+
export type PluralOptions<Variable extends string = string> = {
|
|
10
|
+
/**
|
|
11
|
+
* Name of the value the plural category is selected on.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to `count`. Set it to nest plurals over independent quantities:
|
|
14
|
+
* the resolved function then takes `{ [variable]: number, … }`.
|
|
15
|
+
*/
|
|
16
|
+
variable?: Variable;
|
|
17
|
+
};
|
|
18
|
+
export type PluralContent<Content = unknown, Variable extends string = typeof DEFAULT_PLURAL_VARIABLE> = TypedNodeModel<typeof PLURAL, PluralContentState<Content>, {
|
|
19
|
+
variable?: Variable;
|
|
20
|
+
}>;
|
|
8
21
|
/**
|
|
9
22
|
* Function intended to be used to build intlayer dictionaries.
|
|
10
23
|
*
|
|
@@ -27,8 +40,24 @@ export type PluralContent<Content = unknown> = TypedNodeModel<typeof PLURAL, Plu
|
|
|
27
40
|
* other: '{{count}} вакансий',
|
|
28
41
|
* });
|
|
29
42
|
* ```
|
|
43
|
+
*
|
|
44
|
+
* Nest plurals declaring a `variable` to select on several quantities:
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* plural(
|
|
48
|
+
* {
|
|
49
|
+
* one: plural(
|
|
50
|
+
* { one: '{{files}} file in {{folders}} folder', other: '…' },
|
|
51
|
+
* { variable: 'folders' }
|
|
52
|
+
* ),
|
|
53
|
+
* other: plural({ … }, { variable: 'folders' }),
|
|
54
|
+
* },
|
|
55
|
+
* { variable: 'files' }
|
|
56
|
+
* );
|
|
57
|
+
* // content.filesInFolders({ files: 1, folders: 2 })
|
|
58
|
+
* ```
|
|
30
59
|
*/
|
|
31
|
-
declare const plural: <Content = unknown>(content: PluralContentState<Content>) => PluralContent<Content>;
|
|
60
|
+
declare const plural: <Content = unknown, const Variable extends string = typeof DEFAULT_PLURAL_VARIABLE>(content: PluralContentState<Content>, options?: PluralOptions<Variable>) => PluralContent<Content, Variable>;
|
|
32
61
|
//#endregion
|
|
33
62
|
export { plural };
|
|
34
63
|
//# sourceMappingURL=plural.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plural.d.ts","names":[],"sources":["../../../../src/transpiler/plural/plural.ts"],"mappings":";;YAGY;YAEA,mBAAmB,WAAW,QACxC,OAAO,gBAAgB;EAEvB,OAAO
|
|
1
|
+
{"version":3,"file":"plural.d.ts","names":[],"sources":["../../../../src/transpiler/plural/plural.ts"],"mappings":";;YAGY;YAEA,mBAAmB,WAAW,QACxC,OAAO,gBAAgB;EAEvB,OAAO;;;qBAII;YAED,cAAc;;;;;;;EAOxB,WAAW;;YAGD,cACV,mBACA,iCAAiC,2BAC/B,sBACK,QACP,mBAAmB;EACjB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0CT,SACJ,yBACM,iCAAiC,yBAAuB,SAErD,mBAAmB,UAAQ,UAC1B,cAAc,cACvB,cAAc,SAAS"}
|
|
@@ -74,7 +74,7 @@ export declare function getCachedIntl<T extends new (...args: any[]) => any>(Cto
|
|
|
74
74
|
* Optional: Keep bindIntl if your library exports it publicly.
|
|
75
75
|
* It now uses the much smaller getCachedIntl under the hood.
|
|
76
76
|
*/
|
|
77
|
-
export declare const bindIntl: (boundLocale
|
|
77
|
+
export declare const bindIntl: (boundLocale?: LocalesValues) => WrappedIntl;
|
|
78
78
|
export declare const CachedIntl: any;
|
|
79
79
|
//#endregion
|
|
80
80
|
export { CachedIntl as Intl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl.d.ts","names":[],"sources":["../../../src/utils/intl.ts"],"mappings":";;;;;;KAoCK;EACH,OAAO,MAAM;EACb,cACE,MAAM;IACH;IAA6B;;;;;;;KAO/B;EACH,QAAQ,gBAAgB;IAAW;IAAiB;;;;;;KAMjD;EACH,UAAU,KAAK;EACf,gBAAgB,KAAK;EACrB,cAAc,KAAK;EACnB,YAAY;EACZ,QAAQ,KAAK;EACb,cAAc,KAAK;EACnB,aAAa,KAAK;EAClB,oBAAoB,KAAK;EACzB,WAAW;;;;;YAMD,4BAA4B;KAiGnC,sBACF,kBAAkB,gBAAgB,MAAM,oBACpC,qBAED,oBACgB,MAAM;KAGvB,+BAA+B,KAAK,gBACvC,cACA,gBAAgB,kBACP;OAEA,UAAU,eAAe,UAAU,UAAU;OAC7C,UAAU;IAAY,SAAS;MAAkB;GACrD,UAAU,eAAe,UAAU,UAAU;GAC7C,UAAU;IAAY,SAAS;MAAkB;IAEpD,gBACI,uBACS;OAEJ,UAAU,gBAAgB;OAC1B;IAAY,SAAS;MAAkB;GAC3C,UAAU,gBAAgB;GAC1B;IAAY,SAAS;MAAkB;IAE1C;YAEM,iBACT,kBAAkB,OAAO,gBAAgB,mBACtC,uCAAuC,MAAM,cACrC,MAAM;;;;;;;;;wBAWJ,cAAc,aAAa,qBACzC,iBAAiB,MACjB,SAAS,wBACT,gBACC,mBAAmB;wBACN,cAAc,kBAAkB,qBAC9C,MAAM,GACN,SAAS,wBACT,gBACC,aAAa;;;;;
|
|
1
|
+
{"version":3,"file":"intl.d.ts","names":[],"sources":["../../../src/utils/intl.ts"],"mappings":";;;;;;KAoCK;EACH,OAAO,MAAM;EACb,cACE,MAAM;IACH;IAA6B;;;;;;;KAO/B;EACH,QAAQ,gBAAgB;IAAW;IAAiB;;;;;;KAMjD;EACH,UAAU,KAAK;EACf,gBAAgB,KAAK;EACrB,cAAc,KAAK;EACnB,YAAY;EACZ,QAAQ,KAAK;EACb,cAAc,KAAK;EACnB,aAAa,KAAK;EAClB,oBAAoB,KAAK;EACzB,WAAW;;;;;YAMD,4BAA4B;KAiGnC,sBACF,kBAAkB,gBAAgB,MAAM,oBACpC,qBAED,oBACgB,MAAM;KAGvB,+BAA+B,KAAK,gBACvC,cACA,gBAAgB,kBACP;OAEA,UAAU,eAAe,UAAU,UAAU;OAC7C,UAAU;IAAY,SAAS;MAAkB;GACrD,UAAU,eAAe,UAAU,UAAU;GAC7C,UAAU;IAAY,SAAS;MAAkB;IAEpD,gBACI,uBACS;OAEJ,UAAU,gBAAgB;OAC1B;IAAY,SAAS;MAAkB;GAC3C,UAAU,gBAAgB;GAC1B;IAAY,SAAS;MAAkB;IAE1C;YAEM,iBACT,kBAAkB,OAAO,gBAAgB,mBACtC,uCAAuC,MAAM,cACrC,MAAM;;;;;;;;;wBAWJ,cAAc,aAAa,qBACzC,iBAAiB,MACjB,SAAS,wBACT,gBACC,mBAAmB;wBACN,cAAc,kBAAkB,qBAC9C,MAAM,GACN,SAAS,wBACT,gBACC,aAAa;;;;;qBAiDH,WAAQ,cAAkB,kBAAgB;qBA+B1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -173,21 +173,21 @@
|
|
|
173
173
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
174
174
|
},
|
|
175
175
|
"dependencies": {
|
|
176
|
-
"@intlayer/api": "9.
|
|
177
|
-
"@intlayer/config": "9.
|
|
178
|
-
"@intlayer/dictionaries-entry": "9.
|
|
179
|
-
"@intlayer/types": "9.
|
|
176
|
+
"@intlayer/api": "9.7.0",
|
|
177
|
+
"@intlayer/config": "9.6.0",
|
|
178
|
+
"@intlayer/dictionaries-entry": "9.6.0",
|
|
179
|
+
"@intlayer/types": "9.7.0",
|
|
180
180
|
"defu": "6.1.7"
|
|
181
181
|
},
|
|
182
182
|
"devDependencies": {
|
|
183
|
-
"@types/node": "^
|
|
183
|
+
"@types/node": "^26",
|
|
184
184
|
"@utils/ts-config": "1.0.4",
|
|
185
185
|
"@utils/ts-config-types": "1.0.4",
|
|
186
186
|
"@utils/tsdown-config": "1.0.4",
|
|
187
187
|
"rimraf": "6.1.3",
|
|
188
188
|
"tsdown": "0.23.0",
|
|
189
189
|
"typescript": "7.0.2",
|
|
190
|
-
"vitest": "5.0.
|
|
190
|
+
"vitest": "5.0.3"
|
|
191
191
|
},
|
|
192
192
|
"engines": {
|
|
193
193
|
"node": ">=14.18"
|