@intlayer/core 8.9.8 → 8.10.0-canary.1
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/README.md +14 -0
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +2 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -1
- package/dist/cjs/interpreter/getIntlayer.cjs +10 -19
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/transpiler/file/file.cjs +2 -3
- package/dist/cjs/transpiler/file/file.cjs.map +1 -1
- package/dist/cjs/transpiler/html/index.cjs +1 -1
- package/dist/cjs/transpiler/html/validateHTML.cjs +3 -3
- package/dist/cjs/transpiler/html/validateHTML.cjs.map +1 -1
- package/dist/cjs/transpiler/index.cjs +1 -1
- package/dist/cjs/utils/index.cjs +3 -1
- package/dist/cjs/utils/stringifyYaml.cjs +59 -0
- package/dist/cjs/utils/stringifyYaml.cjs.map +1 -0
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +2 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/interpreter/getIntlayer.mjs +10 -18
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
- package/dist/esm/transpiler/file/file.mjs +2 -3
- package/dist/esm/transpiler/file/file.mjs.map +1 -1
- package/dist/esm/transpiler/html/index.mjs +2 -2
- package/dist/esm/transpiler/html/validateHTML.mjs +3 -3
- package/dist/esm/transpiler/html/validateHTML.mjs.map +1 -1
- package/dist/esm/transpiler/index.mjs +2 -2
- package/dist/esm/utils/index.mjs +2 -1
- package/dist/esm/utils/stringifyYaml.mjs +57 -0
- package/dist/esm/utils/stringifyYaml.mjs.map +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/compact.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/currency.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/date.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/list.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/number.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/percentage.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/relativeTime.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/units.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getCondition.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/deepTransform.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/getContent.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/plugins.d.ts +4 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getDictionary.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayer.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getNesting.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getTranslation.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/generateSitemap.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getBrowserLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getHTMLTextDir.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromPath.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleLang.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleName.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocalizedUrl.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getMultilingualUrls.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getPathWithoutLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getPrefix.d.ts +3 -0
- package/dist/types/@intlayer/core/dist/types/localization/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/localeDetector.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/localeMapper.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/localeResolver.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/rewriteUtils.d.ts +3 -0
- package/dist/types/@intlayer/core/dist/types/localization/validatePrefix.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/markdown/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/condition/condition.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/enumeration.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/file/file.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/gender/gender.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/html/html.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/insertion/insertion.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/markdown/markdown.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/plural/plural.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/translation/translation.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/utils/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/utils/intl.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/utils/isSameKeyPath.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/utils/localeStorage.d.ts +2 -0
- package/dist/types/dictionaryManipulator/getNodeChildren.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
- package/dist/types/intlayer/dist/types/index.d.ts +3 -0
- package/dist/types/transpiler/file/file.d.ts.map +1 -1
- package/dist/types/transpiler/html/index.d.ts +2 -2
- package/dist/types/transpiler/html/validateHTML.d.ts +2 -2
- package/dist/types/transpiler/html/validateHTML.d.ts.map +1 -1
- package/dist/types/transpiler/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/stringifyYaml.d.ts +5 -0
- package/dist/types/utils/stringifyYaml.d.ts.map +1 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.mjs","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/logger';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\n/**\n * Creates a Recursive Proxy that returns the path of the accessed key\n * stringified. This prevents the app from crashing on undefined access.\n */\nconst createSafeFallback = (path = ''): any => {\n return new Proxy(
|
|
1
|
+
{"version":3,"file":"getIntlayer.mjs","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/logger';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\n/**\n * Creates a Recursive Proxy that returns the path of the accessed key\n * stringified. This prevents the app from crashing on undefined access.\n */\nconst createSafeFallback = (path = ''): any => {\n return new Proxy({} as Record<string | symbol, unknown>, {\n get: (_target, prop) => {\n if (\n prop === 'toJSON' ||\n prop === Symbol.toPrimitive ||\n prop === 'toString' ||\n prop === 'valueOf'\n ) {\n return () => path;\n }\n if (prop === 'then') {\n return undefined; // Prevent it from being treated as a Promise\n }\n if (prop === Symbol.iterator) {\n return function* () {\n yield path;\n };\n }\n\n // Recursively build the path (e.g., \"myDictionary.home.title\")\n const nextPath = path ? `${path}.${String(prop)}` : String(prop);\n return createSafeFallback(nextPath);\n },\n });\n};\n\nconst dictionaryCache = new Map<string, any>();\nconst warnedMissingDictionaries = new Set<string>();\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<\n DictionaryRegistryContent<T>,\n IInterpreterPluginState,\n L\n> => {\n const dictionaries = getDictionaries();\n const dictionary = dictionaries[key as T] as DictionaryRegistryElement<T>;\n\n if (!dictionary && process.env.NODE_ENV === 'development') {\n if (!warnedMissingDictionaries.has(key as string)) {\n // Log a warning instead of throwing (so developers know it's missing)\n const logger = getAppLogger({ log });\n logger(\n typeof window === 'undefined'\n ? `Dictionary ${colorizeKey(key)} was not found. Using fallback proxy.`\n : `Dictionary ${key} was not found. Using fallback proxy.`,\n {\n level: 'warn',\n }\n );\n warnedMissingDictionaries.add(key as string);\n }\n\n return createSafeFallback(key as string);\n }\n\n const cacheKey = `${key}_${locale ?? 'default'}_${plugins ? 'custom_plugins' : 'default_plugins'}`;\n\n if (dictionaryCache.has(cacheKey)) {\n return dictionaryCache.get(cacheKey);\n }\n\n const result = getDictionary<DictionaryRegistryElement<T>, L>(\n dictionary,\n locale,\n plugins\n );\n\n dictionaryCache.set(cacheKey, result);\n\n return result;\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,sBAAsB,OAAO,OAAY;CAC7C,OAAO,IAAI,MAAM,CAAC,GAAuC,EACvD,MAAM,SAAS,SAAS;EACtB,IACE,SAAS,YACT,SAAS,OAAO,eAChB,SAAS,cACT,SAAS,WAET,aAAa;EAEf,IAAI,SAAS,QACX;EAEF,IAAI,SAAS,OAAO,UAClB,OAAO,aAAa;GAClB,MAAM;EACR;EAKF,OAAO,mBADU,OAAO,GAAG,KAAK,GAAG,OAAO,IAAI,MAAM,OAAO,IAAI,CAC7B;CACpC,EACF,CAAC;AACH;AAEA,MAAM,kCAAkB,IAAI,IAAiB;AAC7C,MAAM,4CAA4B,IAAI,IAAY;AAElD,MAAa,eAIX,KACA,QACA,YAKG;CAEH,MAAM,aADe,gBACS,EAAE;CAEhC,IAAI,CAAC,cAAc,MAAwC;EACzD,IAAI,CAAC,0BAA0B,IAAI,GAAa,GAAG;GAGjD,AADe,aAAa,EAAE,IAAI,CAC7B,EACH,OAAO,WAAW,cACd,cAAc,YAAY,GAAG,EAAE,yCAC/B,cAAc,IAAI,wCACtB,EACE,OAAO,OACT,CACF;GACA,0BAA0B,IAAI,GAAa;EAC7C;EAEA,OAAO,mBAAmB,GAAa;CACzC;CAEA,MAAM,WAAW,GAAG,IAAI,GAAG,UAAU,UAAU,GAAG,UAAU,mBAAmB;CAE/E,IAAI,gBAAgB,IAAI,QAAQ,GAC9B,OAAO,gBAAgB,IAAI,QAAQ;CAGrC,MAAM,SAAS,cACb,YACA,QACA,OACF;CAEA,gBAAgB,IAAI,UAAU,MAAM;CAEpC,OAAO;AACT"}
|
|
@@ -19,10 +19,9 @@ const fileContent = (path, callerDir, baseDir) => {
|
|
|
19
19
|
fixedPath: relative(baseDir, filePath)
|
|
20
20
|
});
|
|
21
21
|
} catch {
|
|
22
|
-
|
|
22
|
+
throw new Error(`Unable to read path: ${colorizePath(relative(baseDir, filePath))}`);
|
|
23
23
|
}
|
|
24
|
-
else
|
|
25
|
-
return formatNodeType(FILE, path, { content: `-` });
|
|
24
|
+
else throw new Error(`File not found: ${colorizePath(relative(baseDir, filePath))}`);
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
27
|
* Function intended to be used to build intlayer dictionaries.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.mjs","names":["baseDir"],"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve } from 'node:path';\nimport { colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { FILE, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<typeof FILE, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\nexport const fileContent = (\n path: string,\n callerDir: string,\n baseDir: string\n): FileContent => {\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger();\n\n let filePath: string;\n if (isAbsolute(path)) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(baseDir, path);\n }\n\n if (existsSync(filePath) && statSync(filePath).isFile()) {\n try {\n const content = readFileSync(filePath, 'utf8');\n\n return formatNodeType(FILE, path, {\n content,\n fixedPath: relative(baseDir, filePath),\n });\n } catch {\n
|
|
1
|
+
{"version":3,"file":"file.mjs","names":["baseDir"],"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve } from 'node:path';\nimport { colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport type { TypedNodeModel } from '@intlayer/types/nodeType';\nimport { FILE, formatNodeType } from '@intlayer/types/nodeType';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<typeof FILE, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\nexport const fileContent = (\n path: string,\n callerDir: string,\n baseDir: string\n): FileContent => {\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger();\n\n let filePath: string;\n if (isAbsolute(path)) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(baseDir, path);\n }\n\n if (existsSync(filePath) && statSync(filePath).isFile()) {\n try {\n const content = readFileSync(filePath, 'utf8');\n\n return formatNodeType(FILE, path, {\n content,\n fixedPath: relative(baseDir, filePath),\n });\n } catch {\n throw new Error(\n `Unable to read path: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n } else {\n throw new Error(\n `File not found: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n};\n\ntype GlobalIntlayerFilePath = {\n INTLAYER_FILE_PATH: string;\n INTLAYER_BASE_DIR: string;\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } =\n globalThis as unknown as GlobalIntlayerFilePath;\n\n const callerDir = dirname(INTLAYER_FILE_PATH);\n const baseDir = INTLAYER_BASE_DIR;\n\n return fileContent(path, callerDir, baseDir);\n};\n"],"mappings":";;;;;;AAcA,MAAa,eACX,MACA,WACA,YACgB;CAChB,MAAM,iBAAiB,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;CACrE,MAAM,YAAY,aAAa;CAE/B,IAAI;CACJ,IAAI,WAAW,IAAI,GAAG;EACpB,UACE,sFAAsF,KAAK,mBAAmB,aAC9G,EAAE,OAAO,OAAO,CAClB;EACA,WAAW;CACb,OAAO,IAAI,gBACT,WAAW,QAAQ,WAAW,IAAI;MAElC,WAAW,QAAQ,SAAS,IAAI;CAGlC,IAAI,WAAW,QAAQ,KAAK,SAAS,QAAQ,EAAE,OAAO,GACpD,IAAI;EAGF,OAAO,eAAe,MAAM,MAAM;GAChC,SAHc,aAAa,UAAU,MAG/B;GACN,WAAW,SAAS,SAAS,QAAQ;EACvC,CAAC;CACH,QAAQ;EACN,MAAM,IAAI,MACR,wBAAwB,aAAa,SAAS,SAAS,QAAQ,CAAC,GAClE;CACF;MAEA,MAAM,IAAI,MACR,mBAAmB,aAAa,SAAS,SAAS,QAAQ,CAAC,GAC7D;AAEJ;;;;;;;;;;;;;;;;AAsBA,MAAa,QAAQ,SAA8B;CACjD,MAAM,EAAE,oBAAoB,sBAC1B;CAKF,OAAO,YAAY,MAHD,QAAQ,kBAGO,GAAGA,iBAAO;AAC7C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VOID_HTML_ELEMENTS, validateHTML } from "./validateHTML.mjs";
|
|
2
2
|
import { html } from "./html.mjs";
|
|
3
3
|
import { HTML_TAGS } from "./htmlTags.mjs";
|
|
4
4
|
|
|
5
|
-
export { HTML_TAGS,
|
|
5
|
+
export { HTML_TAGS, VOID_HTML_ELEMENTS, html, validateHTML };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/transpiler/html/validateHTML.ts
|
|
2
|
-
const
|
|
2
|
+
const VOID_HTML_ELEMENTS = new Set([
|
|
3
3
|
"area",
|
|
4
4
|
"base",
|
|
5
5
|
"br",
|
|
@@ -44,7 +44,7 @@ const validateHTML = (content) => {
|
|
|
44
44
|
stack.pop();
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
const isVoidElement =
|
|
47
|
+
const isVoidElement = VOID_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
48
48
|
if (!isSelfClosing && !isVoidElement) stack.push({ tag: tagName });
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -59,5 +59,5 @@ const validateHTML = (content) => {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
//#endregion
|
|
62
|
-
export {
|
|
62
|
+
export { VOID_HTML_ELEMENTS, validateHTML };
|
|
63
63
|
//# sourceMappingURL=validateHTML.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateHTML.mjs","names":[],"sources":["../../../../src/transpiler/html/validateHTML.ts"],"sourcesContent":["export const
|
|
1
|
+
{"version":3,"file":"validateHTML.mjs","names":[],"sources":["../../../../src/transpiler/html/validateHTML.ts"],"sourcesContent":["export const VOID_HTML_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'source',\n 'track',\n 'wbr',\n]);\n\nexport type HTMLValidationIssue = {\n type: 'error' | 'warning';\n message: string;\n};\n\nexport type HTMLValidationResult = {\n valid: boolean;\n issues: HTMLValidationIssue[];\n};\n\n// Matches HTML tags: <Tag ...>, </Tag>, or <Tag ... />\n// Attributes may span multiple lines but NOT blank lines (two consecutive newlines),\n// which prevents matching blockquote `>` markers as tag closers.\n// Groups: 1: closing slash, 2: tag name, 3: attributes, 4: self-closing slash\nconst TAG_REGEX =\n /<(\\/)?([a-zA-Z][a-zA-Z0-9.-]*)\\s*((?:[^\\n]|\\n(?!\\n))*?)(\\/?)>/g;\n\n/**\n * Validates that HTML tags in `content` are properly opened, nested, and closed.\n * Returns structured issues instead of logging to the console.\n *\n * False-positive exclusions:\n * - Tags whose attribute string starts with `://` are URL autolinks (e.g. `<https://…>`).\n */\nexport const validateHTML = (content: string): HTMLValidationResult => {\n const issues: HTMLValidationIssue[] = [];\n const stack: Array<{ tag: string }> = [];\n\n for (const match of content.matchAll(TAG_REGEX)) {\n const isClosing = !!match[1];\n const tagName = match[2];\n const attrs = match[3];\n const isSelfClosing = !!match[4];\n\n // Skip URL autolinks like <https://example.com> or <mailto:user@example.com>\n if (\n attrs.trimStart().startsWith('://') ||\n attrs.trimStart().startsWith(':')\n ) {\n continue;\n }\n\n if (isClosing) {\n if (stack.length === 0) {\n issues.push({\n type: 'error',\n message: `Closing tag </${tagName}> has no matching opening tag`,\n });\n } else {\n const last = stack[stack.length - 1];\n if (last.tag.toLowerCase() !== tagName.toLowerCase()) {\n issues.push({\n type: 'error',\n message: `Mismatched closing tag: expected </${last.tag}> but found </${tagName}>`,\n });\n }\n stack.pop();\n }\n } else {\n const isVoidElement = VOID_HTML_ELEMENTS.has(tagName.toLowerCase());\n if (!isSelfClosing && !isVoidElement) {\n stack.push({ tag: tagName });\n }\n }\n }\n\n for (const unclosed of stack) {\n issues.push({\n type: 'error',\n message: `Unclosed HTML tag: <${unclosed.tag}>`,\n });\n }\n\n return {\n valid: issues.filter((i) => i.type === 'error').length === 0,\n issues,\n };\n};\n"],"mappings":";AAAA,MAAa,qBAAqB,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAgBD,MAAM,YACJ;;;;;;;;AASF,MAAa,gBAAgB,YAA0C;CACrE,MAAM,SAAgC,CAAC;CACvC,MAAM,QAAgC,CAAC;CAEvC,KAAK,MAAM,SAAS,QAAQ,SAAS,SAAS,GAAG;EAC/C,MAAM,YAAY,CAAC,CAAC,MAAM;EAC1B,MAAM,UAAU,MAAM;EACtB,MAAM,QAAQ,MAAM;EACpB,MAAM,gBAAgB,CAAC,CAAC,MAAM;EAG9B,IACE,MAAM,UAAU,EAAE,WAAW,KAAK,KAClC,MAAM,UAAU,EAAE,WAAW,GAAG,GAEhC;EAGF,IAAI,WACF,IAAI,MAAM,WAAW,GACnB,OAAO,KAAK;GACV,MAAM;GACN,SAAS,iBAAiB,QAAQ;EACpC,CAAC;OACI;GACL,MAAM,OAAO,MAAM,MAAM,SAAS;GAClC,IAAI,KAAK,IAAI,YAAY,MAAM,QAAQ,YAAY,GACjD,OAAO,KAAK;IACV,MAAM;IACN,SAAS,sCAAsC,KAAK,IAAI,gBAAgB,QAAQ;GAClF,CAAC;GAEH,MAAM,IAAI;EACZ;OACK;GACL,MAAM,gBAAgB,mBAAmB,IAAI,QAAQ,YAAY,CAAC;GAClE,IAAI,CAAC,iBAAiB,CAAC,eACrB,MAAM,KAAK,EAAE,KAAK,QAAQ,CAAC;EAE/B;CACF;CAEA,KAAK,MAAM,YAAY,OACrB,OAAO,KAAK;EACV,MAAM;EACN,SAAS,uBAAuB,SAAS,IAAI;CAC/C,CAAC;CAGH,OAAO;EACL,OAAO,OAAO,QAAQ,MAAM,EAAE,SAAS,OAAO,EAAE,WAAW;EAC3D;CACF;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cond as condition } from "./condition/condition.mjs";
|
|
2
2
|
import { enu as enumeration } from "./enumeration/enumeration.mjs";
|
|
3
3
|
import { gender } from "./gender/gender.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { VOID_HTML_ELEMENTS, validateHTML } from "./html/validateHTML.mjs";
|
|
5
5
|
import { html } from "./html/html.mjs";
|
|
6
6
|
import { HTML_TAGS } from "./html/htmlTags.mjs";
|
|
7
7
|
import { getInsertionValues } from "./insertion/getInsertionValues.mjs";
|
|
@@ -13,4 +13,4 @@ import { nest as nesting } from "./nesting/nesting.mjs";
|
|
|
13
13
|
import { plural } from "./plural/plural.mjs";
|
|
14
14
|
import { t as translation } from "./translation/translation.mjs";
|
|
15
15
|
|
|
16
|
-
export { HTML_TAGS,
|
|
16
|
+
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, translation as t, validateHTML, validateMarkdown };
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -5,5 +5,6 @@ import { checkIsURLAbsolute } from "./checkIsURLAbsolute.mjs";
|
|
|
5
5
|
import { getCookie } from "./getCookie.mjs";
|
|
6
6
|
import { LocaleStorage, LocaleStorageClient, LocaleStorageServer, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer } from "./localeStorage.mjs";
|
|
7
7
|
import { isSameKeyPath } from "./isSameKeyPath.mjs";
|
|
8
|
+
import { stringifyYaml } from "./stringifyYaml.mjs";
|
|
8
9
|
|
|
9
|
-
export { CachedIntl, CachedIntl as Intl, LocaleStorage, LocaleStorageClient, LocaleStorageServer, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer };
|
|
10
|
+
export { CachedIntl, CachedIntl as Intl, LocaleStorage, LocaleStorageClient, LocaleStorageServer, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, stringifyYaml };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/utils/stringifyYaml.ts
|
|
2
|
+
const NEEDS_QUOTING = /[\n\r\t#:{}[\],&*?|<>=!%@`'"\\]|^[-?!]|\s$|^\s|^[>|]|^[.]{2,}/;
|
|
3
|
+
const PRESERVED_LITERALS = new Set([
|
|
4
|
+
"true",
|
|
5
|
+
"false",
|
|
6
|
+
"null",
|
|
7
|
+
"undefined",
|
|
8
|
+
"yes",
|
|
9
|
+
"no",
|
|
10
|
+
"on",
|
|
11
|
+
"off",
|
|
12
|
+
"NaN",
|
|
13
|
+
"Infinity",
|
|
14
|
+
"-Infinity"
|
|
15
|
+
]);
|
|
16
|
+
const serializeString = (value, indent) => {
|
|
17
|
+
if (value.includes("\n")) return `|\n${value.split("\n").map((l) => `${indent} ${l}`).join("\n")}`;
|
|
18
|
+
if (NEEDS_QUOTING.test(value) || PRESERVED_LITERALS.has(value) || /^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i.test(value)) return JSON.stringify(value);
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
const serializeValue = (value, indent) => {
|
|
22
|
+
if (value === null || value === void 0) return "null";
|
|
23
|
+
if (typeof value === "boolean" || typeof value === "number") return String(value);
|
|
24
|
+
if (typeof value === "string") return serializeString(value, indent);
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
if (value.length === 0) return "[]";
|
|
27
|
+
return value.map((item) => {
|
|
28
|
+
const serialized = serializeValue(item, `${indent} `);
|
|
29
|
+
if (typeof item === "object" && item !== null && !Array.isArray(item) && !serialized.startsWith("'") && !serialized.startsWith("\"")) {
|
|
30
|
+
const lines = serialized.split("\n");
|
|
31
|
+
return `${indent}- ${lines[0]}\n${lines.slice(1).map((l) => `${indent} ${l}`).join("\n")}`.trimEnd();
|
|
32
|
+
}
|
|
33
|
+
return `${indent}- ${serialized}`;
|
|
34
|
+
}).join("\n");
|
|
35
|
+
}
|
|
36
|
+
if (typeof value === "object") {
|
|
37
|
+
const entries = Object.entries(value).filter(([, v]) => v !== void 0);
|
|
38
|
+
if (entries.length === 0) return "{}";
|
|
39
|
+
return entries.map(([k, value]) => {
|
|
40
|
+
const key = /[\s:{}[\]]/.test(k) ? JSON.stringify(k) : k;
|
|
41
|
+
const childIndent = `${indent} `;
|
|
42
|
+
if (value === null || value === void 0) return `${indent}${key}: null`;
|
|
43
|
+
if (typeof value === "object" && !Array.isArray(value)) return `${indent}${key}:\n${serializeValue(value, childIndent)}`;
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
if (value.length === 0) return `${indent}${key}: []`;
|
|
46
|
+
return `${indent}${key}:\n${serializeValue(value, childIndent)}`;
|
|
47
|
+
}
|
|
48
|
+
return `${indent}${key}: ${serializeValue(value, indent)}`;
|
|
49
|
+
}).join("\n");
|
|
50
|
+
}
|
|
51
|
+
return String(value);
|
|
52
|
+
};
|
|
53
|
+
const stringifyYaml = (value) => `${serializeValue(value, "")}\n`;
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { stringifyYaml };
|
|
57
|
+
//# sourceMappingURL=stringifyYaml.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringifyYaml.mjs","names":[],"sources":["../../../src/utils/stringifyYaml.ts"],"sourcesContent":["// Characters/patterns in a string that require quoting in YAML\nconst NEEDS_QUOTING =\n /[\\n\\r\\t#:{}[\\],&*?|<>=!%@`'\"\\\\]|^[-?!]|\\s$|^\\s|^[>|]|^[.]{2,}/;\n\n// Values that parseYaml treats as preserved literals (not typed conversions)\nconst PRESERVED_LITERALS = new Set([\n 'true',\n 'false',\n 'null',\n 'undefined',\n 'yes',\n 'no',\n 'on',\n 'off',\n 'NaN',\n 'Infinity',\n '-Infinity',\n]);\n\nconst serializeString = (value: string, indent: string): string => {\n if (value.includes('\\n')) {\n const lines = value.split('\\n');\n const body = lines.map((l) => `${indent} ${l}`).join('\\n');\n return `|\\n${body}`;\n }\n\n if (\n NEEDS_QUOTING.test(value) ||\n PRESERVED_LITERALS.has(value) ||\n /^-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i.test(value)\n ) {\n return JSON.stringify(value);\n }\n\n return value;\n};\n\nconst serializeValue = (value: any, indent: string): string => {\n if (value === null || value === undefined) return 'null';\n\n if (typeof value === 'boolean' || typeof value === 'number') {\n return String(value);\n }\n\n if (typeof value === 'string') {\n return serializeString(value, indent);\n }\n\n if (Array.isArray(value)) {\n if (value.length === 0) return '[]';\n return value\n .map((item) => {\n const serialized = serializeValue(item, `${indent} `);\n if (\n typeof item === 'object' &&\n item !== null &&\n !Array.isArray(item) &&\n !serialized.startsWith(\"'\") &&\n !serialized.startsWith('\"')\n ) {\n // Object items: put first key inline with the dash\n const lines = serialized.split('\\n');\n return `${indent}- ${lines[0]}\\n${lines\n .slice(1)\n .map((l) => `${indent} ${l}`)\n .join('\\n')}`.trimEnd();\n }\n return `${indent}- ${serialized}`;\n })\n .join('\\n');\n }\n\n if (typeof value === 'object') {\n const entries = Object.entries(value).filter(([, v]) => v !== undefined);\n if (entries.length === 0) return '{}';\n\n return entries\n .map(([k, value]) => {\n const key = /[\\s:{}[\\]]/.test(k) ? JSON.stringify(k) : k;\n const childIndent = `${indent} `;\n\n if (value === null || value === undefined) {\n return `${indent}${key}: null`;\n }\n\n if (typeof value === 'object' && !Array.isArray(value)) {\n const nested = serializeValue(value, childIndent);\n return `${indent}${key}:\\n${nested}`;\n }\n\n if (Array.isArray(value)) {\n if (value.length === 0) return `${indent}${key}: []`;\n const nested = serializeValue(value, childIndent);\n return `${indent}${key}:\\n${nested}`;\n }\n\n return `${indent}${key}: ${serializeValue(value, indent)}`;\n })\n .join('\\n');\n }\n\n return String(value);\n};\n\nexport const stringifyYaml = (value: any): string =>\n `${serializeValue(value, '')}\\n`;\n"],"mappings":";AACA,MAAM,gBACJ;AAGF,MAAM,qBAAqB,IAAI,IAAI;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,mBAAmB,OAAe,WAA2B;CACjE,IAAI,MAAM,SAAS,IAAI,GAGrB,OAAO,MAFO,MAAM,MAAM,IACT,EAAE,KAAK,MAAM,GAAG,OAAO,IAAI,GAAG,EAAE,KAAK,IACtC;CAGlB,IACE,cAAc,KAAK,KAAK,KACxB,mBAAmB,IAAI,KAAK,KAC5B,mCAAmC,KAAK,KAAK,GAE7C,OAAO,KAAK,UAAU,KAAK;CAG7B,OAAO;AACT;AAEA,MAAM,kBAAkB,OAAY,WAA2B;CAC7D,IAAI,UAAU,QAAQ,UAAU,QAAW,OAAO;CAElD,IAAI,OAAO,UAAU,aAAa,OAAO,UAAU,UACjD,OAAO,OAAO,KAAK;CAGrB,IAAI,OAAO,UAAU,UACnB,OAAO,gBAAgB,OAAO,MAAM;CAGtC,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,IAAI,MAAM,WAAW,GAAG,OAAO;EAC/B,OAAO,MACJ,KAAK,SAAS;GACb,MAAM,aAAa,eAAe,MAAM,GAAG,OAAO,GAAG;GACrD,IACE,OAAO,SAAS,YAChB,SAAS,QACT,CAAC,MAAM,QAAQ,IAAI,KACnB,CAAC,WAAW,WAAW,GAAG,KAC1B,CAAC,WAAW,WAAW,IAAG,GAC1B;IAEA,MAAM,QAAQ,WAAW,MAAM,IAAI;IACnC,OAAO,GAAG,OAAO,IAAI,MAAM,GAAG,IAAI,MAC/B,MAAM,CAAC,EACP,KAAK,MAAM,GAAG,OAAO,IAAI,GAAG,EAC5B,KAAK,IAAI,IAAI,QAAQ;GAC1B;GACA,OAAO,GAAG,OAAO,IAAI;EACvB,CAAC,EACA,KAAK,IAAI;CACd;CAEA,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,UAAU,OAAO,QAAQ,KAAK,EAAE,QAAQ,GAAG,OAAO,MAAM,MAAS;EACvE,IAAI,QAAQ,WAAW,GAAG,OAAO;EAEjC,OAAO,QACJ,KAAK,CAAC,GAAG,WAAW;GACnB,MAAM,MAAM,aAAa,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;GACvD,MAAM,cAAc,GAAG,OAAO;GAE9B,IAAI,UAAU,QAAQ,UAAU,QAC9B,OAAO,GAAG,SAAS,IAAI;GAGzB,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAEnD,OAAO,GAAG,SAAS,IAAI,KADR,eAAe,OAAO,WACJ;GAGnC,IAAI,MAAM,QAAQ,KAAK,GAAG;IACxB,IAAI,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,IAAI;IAE/C,OAAO,GAAG,SAAS,IAAI,KADR,eAAe,OAAO,WACJ;GACnC;GAEA,OAAO,GAAG,SAAS,IAAI,IAAI,eAAe,OAAO,MAAM;EACzD,CAAC,EACA,KAAK,IAAI;CACd;CAEA,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,iBAAiB,UAC5B,GAAG,eAAe,OAAO,EAAE,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryContent, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DeclaredLocales } from "@intlayer/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues, StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Locale } from "@intlayer/types/allLocales";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Locale } from "@intlayer/types/allLocales";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Locale } from "@intlayer/types/allLocales";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Locale } from "@intlayer/types/allLocales";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { CONDITION, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ENUMERATION, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { FILE, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { GENDER, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { HTML, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { INSERTION, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { MARKDOWN, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { PLURAL, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { LocalesValues } from "@intlayer/types/module_augmentation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { KeyPath } from "@intlayer/types/keyPath";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNodeChildren.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getNodeChildren.ts"],"mappings":";;;cAIa,eAAA,GAAmB,OAAA,EAAS,WAAA,KAAc,
|
|
1
|
+
{"version":3,"file":"getNodeChildren.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getNodeChildren.ts"],"mappings":";;;cAIa,eAAA,GAAmB,OAAA,EAAS,WAAA,KAAc,WAmDtD"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { FileContent, FileContentConstructor, file, fileContent } from "./transp
|
|
|
4
4
|
import { Gender, GenderContent, GenderContentStates, gender } from "./transpiler/gender/gender.js";
|
|
5
5
|
import { HTMLContent, HTMLContentConstructor, html } from "./transpiler/html/html.js";
|
|
6
6
|
import { HTMLTagsType, HTML_TAGS } from "./transpiler/html/htmlTags.js";
|
|
7
|
-
import { HTMLValidationIssue, HTMLValidationResult,
|
|
7
|
+
import { HTMLValidationIssue, HTMLValidationResult, VOID_HTML_ELEMENTS, validateHTML } from "./transpiler/html/validateHTML.js";
|
|
8
8
|
import { getInsertionValues } from "./transpiler/insertion/getInsertionValues.js";
|
|
9
9
|
import { InsertionContent, InsertionContentConstructor, insert as insertion } from "./transpiler/insertion/insertion.js";
|
|
10
10
|
import { getMarkdownMetadata } from "./transpiler/markdown/getMarkdownMetadata.js";
|
|
@@ -88,4 +88,5 @@ import { getCookie } from "./utils/getCookie.js";
|
|
|
88
88
|
import { isSameKeyPath } from "./utils/isSameKeyPath.js";
|
|
89
89
|
import { isValidElement } from "./utils/isValidReactElement.js";
|
|
90
90
|
import { parseYaml } from "./utils/parseYaml.js";
|
|
91
|
-
|
|
91
|
+
import { stringifyYaml } from "./utils/stringifyYaml.js";
|
|
92
|
+
export { ATTRIBUTES_TO_SANITIZE, ATTRIBUTE_TO_NODE_PROP_MAP, ATTR_EXTRACTOR_R, BLOCKQUOTE_ALERT_R, BLOCKQUOTE_R, BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, BLOCK_END_R, BREAK_LINE_R, BREAK_THEMATIC_R, type BlockQuoteNode, type BoldTextNode, type BreakLineNode, type BreakThematicNode, CAPTURE_LETTER_AFTER_HYPHEN, CODE_BLOCK_FENCED_R, CODE_BLOCK_R, CODE_INLINE_R, CONSECUTIVE_NEWLINE_R, CR_NEWLINE_R, CUSTOM_COMPONENT_R, CachedIntl, CachedIntl as Intl, type CodeBlockNode, type CodeFencedNode, type CodeInlineNode, type CompileOptions, type ComponentOverrides, ConditionCond, ConditionContent, ConditionContentStates, CookieBuildAttributes, type CustomComponentNode, DO_NOT_PROCESS_HTML_ELEMENTS, DURATION_DELAY_TRIGGER, DateTimePreset, DeepTransformContent, DotPath, type ElementType, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, type EscapedTextNode, 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_BLOCK_ELEMENT_R, HTML_CHAR_CODE_R, HTML_COMMENT_R, HTML_CUSTOM_ATTR_R, HTML_LEFT_TRIM_AMOUNT_R, HTML_SELF_CLOSING_ELEMENT_R, HTML_TAGS, type HeadingNode, type HeadingSetextNode, IInterpreterPlugin, IInterpreterPluginState, INLINE_SKIP_R, INTERPOLATION_R, type ImageNode, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, type ItalicTextNode, JsonValue, LINK_AUTOLINK_BARE_URL_R, LINK_AUTOLINK_R, LIST_LOOKBEHIND_R, LOOKAHEAD, type LinkAngleBraceNode, type LinkBareURLNode, type LinkNode, ListType, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, type LocalizedPathResult, MarkdownContent, MarkdownContentConstructor, type MarkdownContext, type MarkdownOptions, type MarkdownRuntime, type HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, type MarkedTextNode, NAMED_CODES_TO_UNICODE, NP_TABLE_R, NestedCond, NestedContent, NestedContentState, 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, type ParagraphNode, type ParseState, type Parser, type ParserResult, Plugins, PluralCategory, PluralCond, PluralContent, PluralContentState, PortableObject, Priority, PriorityValue, REFERENCE_IMAGE_OR_LINK, REFERENCE_IMAGE_R, REFERENCE_LINK_R, type ReferenceImageNode, type ReferenceLinkNode, type ReferenceNode, type RenderRuleHook, type Rule, type RuleOutput, RuleType, RuleTypeValue, type Rules, SHORTCODE_R, SHOULD_RENDER_AS_BLOCK_R, 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_PLAIN_R, TEXT_STRIKETHROUGHED_R, TRIM_STARTING_NEWLINES, type TableNode, type TableSeparatorNode, 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, allowInline, anyScopeRegex, attributeValueToNodePropValue, bindIntl, blockRegex, buildMaskPlugin, captureNothing, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, compile, compileWithOptions, condition as cond, conditionPlugin, createCompiler, createRenderer, currency, cx, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, fallbackPlugin, type file, type fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, generateListItemPrefix, generateListItemPrefixRegex, generateListItemRegex, generateListRegex, generateSitemap, generateSitemapUrl, get, getBasePlugins, getBrowserLocale, getCachedIntl, getCanonicalPath, getCondition, getContent, getContentNodeByKeyPath, getCookie, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTML, getHTMLTextDir, getInsertionValues, getInternalPath, getIntlayer, getLocale, getLocaleFromPath, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedPath, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getPlural, getPrefix, getReplacedValuesContent, getRewritePath, getRewriteRules, getSplittedContent, getSplittedDictionaryContent, getTranslation, html, i18nextToIntlayerFormatter, icuToIntlayerFormatter, inlineRegex, insertion as insert, insertContentInDictionary, insertionPlugin, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToPortableObjectFormatter, intlayerToVueI18nFormatter, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeAttributeKey, normalizeDictionaries, normalizeDictionary, normalizeWhitespace, number, orderDictionaries, parseBlock, parseCaptureInline, parseInline, parseSimpleInline, parseStyleAttribute, parseTableAlign, parseTableAlignCapture, parseTableCells, parseTableRow, parseYaml, parserFor, percentage, plural, pluralPlugin, portableObjectToIntlayerFormatter, presets, qualifies, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, renderFor, renderNothing, sanitizer, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, simpleInlineRegex, slugify, some, splitInsertionTemplate, startsWith, stringifyYaml, translation as t, translationPlugin, trimEnd, trimLeadingWhitespaceOutsideFences, unescapeString, units, unquote, updateNodeChildren, validateHTML, validateMarkdown, validatePrefix, vueI18nToIntlayerFormatter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"getIntlayer.d.ts","names":[],"sources":["../../../src/interpreter/getIntlayer.ts"],"mappings":";;;;cAmDa,WAAA,aACD,cAAA,YACA,aAAA,GAAgB,eAAA,EAE1B,GAAA,EAAK,CAAA,EACL,MAAA,GAAS,CAAA,EACT,OAAA,GAAU,OAAA,OACT,oBAAA,CACD,yBAAA,CAA0B,CAAA,GAC1B,uBAAA,EACA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","names":[],"sources":["../../../../src/transpiler/file/file.ts"],"mappings":";;;KAMY,sBAAA,WAAiC,MAAA,sBAC3C,cAAA,QAAsB,IAAA,UAAc,CAAA;AAAA,KAE1B,WAAA,GAAc,sBAAsB;EAC9C,OAAA;EACA,SAAA;AAAA;AAAA,cAGW,WAAA,GACX,IAAA,UACA,SAAA,UACA,OAAA,aACC,
|
|
1
|
+
{"version":3,"file":"file.d.ts","names":[],"sources":["../../../../src/transpiler/file/file.ts"],"mappings":";;;KAMY,sBAAA,WAAiC,MAAA,sBAC3C,cAAA,QAAsB,IAAA,UAAc,CAAA;AAAA,KAE1B,WAAA,GAAc,sBAAsB;EAC9C,OAAA;EACA,SAAA;AAAA;AAAA,cAGW,WAAA,GACX,IAAA,UACA,SAAA,UACA,OAAA,aACC,WAmCF;;;;;;;;;;;AA9CsC;AAEvC;;;;cAkEa,IAAA,GAAQ,IAAA,aAAe,WAQnC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { HTMLContent, HTMLContentConstructor, html } from "./html.js";
|
|
2
2
|
import { HTMLTagsType, HTML_TAGS } from "./htmlTags.js";
|
|
3
|
-
import { HTMLValidationIssue, HTMLValidationResult,
|
|
4
|
-
export { HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS,
|
|
3
|
+
import { HTMLValidationIssue, HTMLValidationResult, VOID_HTML_ELEMENTS, validateHTML } from "./validateHTML.js";
|
|
4
|
+
export { HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, VOID_HTML_ELEMENTS, html, validateHTML };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/transpiler/html/validateHTML.d.ts
|
|
2
|
-
declare const
|
|
2
|
+
declare const VOID_HTML_ELEMENTS: Set<string>;
|
|
3
3
|
type HTMLValidationIssue = {
|
|
4
4
|
type: 'error' | 'warning';
|
|
5
5
|
message: string;
|
|
@@ -17,5 +17,5 @@ type HTMLValidationResult = {
|
|
|
17
17
|
*/
|
|
18
18
|
declare const validateHTML: (content: string) => HTMLValidationResult;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { HTMLValidationIssue, HTMLValidationResult,
|
|
20
|
+
export { HTMLValidationIssue, HTMLValidationResult, VOID_HTML_ELEMENTS, validateHTML };
|
|
21
21
|
//# sourceMappingURL=validateHTML.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateHTML.d.ts","names":[],"sources":["../../../../src/transpiler/html/validateHTML.ts"],"mappings":";cAAa,
|
|
1
|
+
{"version":3,"file":"validateHTML.d.ts","names":[],"sources":["../../../../src/transpiler/html/validateHTML.ts"],"mappings":";cAAa,kBAAA,EAAkB,GAAA;AAAA,KAgBnB,mBAAA;EACV,IAAA;EACA,OAAO;AAAA;AAAA,KAGG,oBAAA;EACV,KAAA;EACA,MAAA,EAAQ,mBAAmB;AAAA;;AALpB;AAGT;;;;;cAmBa,YAAA,GAAgB,OAAA,aAAkB,oBAqD9C"}
|
|
@@ -4,7 +4,7 @@ import { FileContent, FileContentConstructor, file, fileContent } from "./file/f
|
|
|
4
4
|
import { Gender, GenderContent, GenderContentStates, gender } from "./gender/gender.js";
|
|
5
5
|
import { HTMLContent, HTMLContentConstructor, html } from "./html/html.js";
|
|
6
6
|
import { HTMLTagsType, HTML_TAGS } from "./html/htmlTags.js";
|
|
7
|
-
import { HTMLValidationIssue, HTMLValidationResult,
|
|
7
|
+
import { HTMLValidationIssue, HTMLValidationResult, VOID_HTML_ELEMENTS, validateHTML } from "./html/validateHTML.js";
|
|
8
8
|
import { getInsertionValues } from "./insertion/getInsertionValues.js";
|
|
9
9
|
import { InsertionContent, InsertionContentConstructor, insert as insertion } from "./insertion/insertion.js";
|
|
10
10
|
import { getMarkdownMetadata } from "./markdown/getMarkdownMetadata.js";
|
|
@@ -13,4 +13,4 @@ import { MarkdownValidationResult, validateMarkdown } from "./markdown/validateM
|
|
|
13
13
|
import { DotPath, NestedContent, NestedContentState, ValidDotPathsFor, nest as nesting } from "./nesting/nesting.js";
|
|
14
14
|
import { PluralCategory, PluralContent, PluralContentState, plural } from "./plural/plural.js";
|
|
15
15
|
import { TranslationContent, t as translation } from "./translation/translation.js";
|
|
16
|
-
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, TranslationContent,
|
|
16
|
+
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, 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, translation as t, validateHTML, validateMarkdown };
|
|
@@ -5,4 +5,5 @@ import { getCookie } from "./getCookie.js";
|
|
|
5
5
|
import { isSameKeyPath } from "./isSameKeyPath.js";
|
|
6
6
|
import { isValidElement } from "./isValidReactElement.js";
|
|
7
7
|
import { parseYaml } from "./parseYaml.js";
|
|
8
|
-
|
|
8
|
+
import { stringifyYaml } from "./stringifyYaml.js";
|
|
9
|
+
export { CachedIntl, CachedIntl as Intl, CookieBuildAttributes, LocaleStorage, LocaleStorageClient, LocaleStorageClientOptions, LocaleStorageOptions, LocaleStorageServer, LocaleStorageServerOptions, WrappedIntl, bindIntl, checkIsURLAbsolute, getCachedIntl, getCookie, getLocaleFromStorage, getLocaleFromStorageClient, getLocaleFromStorageServer, isSameKeyPath, isValidElement, parseYaml, setLocaleInStorage, setLocaleInStorageClient, setLocaleInStorageServer, stringifyYaml };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringifyYaml.d.ts","names":[],"sources":["../../../src/utils/stringifyYaml.ts"],"mappings":";cAwGa,aAAA,GAAiB,KAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.10.0-canary.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -168,15 +168,15 @@
|
|
|
168
168
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
169
169
|
},
|
|
170
170
|
"dependencies": {
|
|
171
|
-
"@intlayer/api": "8.
|
|
172
|
-
"@intlayer/config": "8.
|
|
173
|
-
"@intlayer/dictionaries-entry": "8.
|
|
174
|
-
"@intlayer/types": "8.
|
|
175
|
-
"@intlayer/unmerged-dictionaries-entry": "8.
|
|
171
|
+
"@intlayer/api": "8.10.0-canary.1",
|
|
172
|
+
"@intlayer/config": "8.10.0-canary.1",
|
|
173
|
+
"@intlayer/dictionaries-entry": "8.10.0-canary.1",
|
|
174
|
+
"@intlayer/types": "8.10.0-canary.1",
|
|
175
|
+
"@intlayer/unmerged-dictionaries-entry": "8.10.0-canary.1",
|
|
176
176
|
"defu": "6.1.7"
|
|
177
177
|
},
|
|
178
178
|
"devDependencies": {
|
|
179
|
-
"@types/node": "25.
|
|
179
|
+
"@types/node": "25.9.1",
|
|
180
180
|
"@utils/ts-config": "1.0.4",
|
|
181
181
|
"@utils/ts-config-types": "1.0.4",
|
|
182
182
|
"@utils/tsdown-config": "1.0.4",
|