@andre1502/react-utilities 1.0.5 → 1.0.7
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 +35 -51
- package/dist/Config/Config.d.ts +12 -1
- package/dist/EnvironmentEnum-CXTWJxNo.js +10 -0
- package/dist/EnvironmentEnum-CXTWJxNo.js.map +1 -0
- package/dist/Utils-CJ7ureSW.js +14 -0
- package/dist/Utils-CJ7ureSW.js.map +1 -0
- package/dist/browser-ponyfill-C-HVh7ck.js +321 -0
- package/dist/browser-ponyfill-C-HVh7ck.js.map +1 -0
- package/dist/chunk-vKJrgz-R.js +16 -0
- package/dist/config-cli-BIF4xuoO.js +1491 -0
- package/dist/config-cli-BIF4xuoO.js.map +1 -0
- package/dist/config-cli.d.ts +1 -1
- package/dist/config-cli.js +3 -222
- package/dist/enums/CurrencySymbolEnum.d.ts +6 -5
- package/dist/enums/DeviceEnum.d.ts +5 -4
- package/dist/enums/EnvironmentEnum.d.ts +6 -5
- package/dist/format-BgweN3o5.js +65549 -0
- package/dist/format-BgweN3o5.js.map +1 -0
- package/dist/format.d.ts +26 -26
- package/dist/format.js +2 -55
- package/dist/hooks-oAipbPQ2.js +78 -0
- package/dist/hooks-oAipbPQ2.js.map +1 -0
- package/dist/hooks.js +2 -86
- package/dist/i18n-D1jKJPI0.js +1941 -0
- package/dist/i18n-D1jKJPI0.js.map +1 -0
- package/dist/i18n.js +4 -28
- package/dist/index-cli.d.ts +0 -1
- package/dist/index-cli.js +3 -28
- package/dist/index-rn.js +6 -39
- package/dist/index.js +7 -61
- package/dist/interfaces/Config/EntryOptions.d.ts +4 -0
- package/dist/sentry-rn-DZwIel7y.js +743 -0
- package/dist/sentry-rn-DZwIel7y.js.map +1 -0
- package/dist/sentry-rn.js +2 -28
- package/dist/sentry.js +39 -26
- package/dist/sentry.js.map +1 -1
- package/dist/utils.js +45 -37
- package/dist/utils.js.map +1 -1
- package/package.json +56 -86
- package/src/Config/Config.ts +48 -1
- package/src/Config/GoogleAuth.ts +1 -1
- package/src/Sentry/React.ts +2 -4
- package/src/Sentry/ReactNative.ts +2 -4
- package/src/config-cli.ts +1 -1
- package/src/enums/CurrencySymbolEnum.ts +8 -5
- package/src/enums/DeviceEnum.ts +6 -4
- package/src/enums/EnvironmentEnum.ts +8 -5
- package/src/format.ts +32 -32
- package/src/index-cli.ts +0 -1
- package/src/interfaces/Config/EntryOptions.ts +4 -0
- package/dist/Config/Config.js +0 -216
- package/dist/Config/Config.js.map +0 -1
- package/dist/Config/GoogleAuth.js +0 -68
- package/dist/Config/GoogleAuth.js.map +0 -1
- package/dist/Config/Locales.js +0 -62
- package/dist/Config/Locales.js.map +0 -1
- package/dist/Config/Output.js +0 -36
- package/dist/Config/Output.js.map +0 -1
- package/dist/Config/Sitemap.js +0 -72
- package/dist/Config/Sitemap.js.map +0 -1
- package/dist/EnvironmentEnum-BjXsfSRZ.js +0 -9
- package/dist/EnvironmentEnum-BjXsfSRZ.js.map +0 -1
- package/dist/EnvironmentEnum-UcQ6Il1O.js +0 -9
- package/dist/EnvironmentEnum-UcQ6Il1O.js.map +0 -1
- package/dist/Format/NumberFormat.js +0 -77
- package/dist/Format/NumberFormat.js.map +0 -1
- package/dist/Format/NumberParser.js +0 -51
- package/dist/Format/NumberParser.js.map +0 -1
- package/dist/Hooks/useDevice.js +0 -47
- package/dist/Hooks/useDevice.js.map +0 -1
- package/dist/Hooks/useSound.js +0 -47
- package/dist/Hooks/useSound.js.map +0 -1
- package/dist/Hooks/useWebSocket.js +0 -120
- package/dist/Hooks/useWebSocket.js.map +0 -1
- package/dist/I18n/I18n.js +0 -134
- package/dist/I18n/I18n.js.map +0 -1
- package/dist/NumberFormat-CvvBWhHc.js +0 -89
- package/dist/NumberFormat-CvvBWhHc.js.map +0 -1
- package/dist/NumberFormat-glmpbk7E.js +0 -94
- package/dist/NumberFormat-glmpbk7E.js.map +0 -1
- package/dist/React-BaJ1KfGF.js +0 -87
- package/dist/React-BaJ1KfGF.js.map +0 -1
- package/dist/React-qUl0CBmE.js +0 -109
- package/dist/React-qUl0CBmE.js.map +0 -1
- package/dist/ReactNative-B4gt8nBr.js +0 -1790
- package/dist/ReactNative-B4gt8nBr.js.map +0 -1
- package/dist/ReactNative-CDMfQFfN.js +0 -1812
- package/dist/ReactNative-CDMfQFfN.js.map +0 -1
- package/dist/Sentry/Build.d.ts +0 -9
- package/dist/Sentry/Build.js +0 -87
- package/dist/Sentry/Build.js.map +0 -1
- package/dist/Sentry/React.js +0 -103
- package/dist/Sentry/React.js.map +0 -1
- package/dist/Sentry/ReactNative.js +0 -113
- package/dist/Sentry/ReactNative.js.map +0 -1
- package/dist/Sentry/Utils.js +0 -24
- package/dist/Sentry/Utils.js.map +0 -1
- package/dist/Utils/Array.js +0 -26
- package/dist/Utils/Array.js.map +0 -1
- package/dist/Utils/Files.js +0 -51
- package/dist/Utils/Files.js.map +0 -1
- package/dist/Utils/Pagination.js +0 -32
- package/dist/Utils/Pagination.js.map +0 -1
- package/dist/Utils/Utils.js +0 -101
- package/dist/Utils/Utils.js.map +0 -1
- package/dist/Utils-BC1fDy39.js +0 -74
- package/dist/Utils-BC1fDy39.js.map +0 -1
- package/dist/Utils-Cq948gfa.js +0 -20
- package/dist/Utils-Cq948gfa.js.map +0 -1
- package/dist/Utils-D7KRF8VU.js +0 -64
- package/dist/Utils-D7KRF8VU.js.map +0 -1
- package/dist/Utils-Dilye04y.js +0 -22
- package/dist/Utils-Dilye04y.js.map +0 -1
- package/dist/config-cli.cjs +0 -500
- package/dist/config-cli.cjs.map +0 -1
- package/dist/config-cli.js.map +0 -1
- package/dist/config-cli.mjs +0 -469
- package/dist/config-cli.mjs.map +0 -1
- package/dist/enums/CurrencySymbolEnum.js +0 -15
- package/dist/enums/CurrencySymbolEnum.js.map +0 -1
- package/dist/enums/DeviceEnum.js +0 -12
- package/dist/enums/DeviceEnum.js.map +0 -1
- package/dist/enums/EnvironmentEnum.js +0 -13
- package/dist/enums/EnvironmentEnum.js.map +0 -1
- package/dist/format.cjs +0 -43
- package/dist/format.cjs.map +0 -1
- package/dist/format.js.map +0 -1
- package/dist/format.mjs +0 -30
- package/dist/format.mjs.map +0 -1
- package/dist/hooks.cjs +0 -13
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/hooks.mjs +0 -4
- package/dist/hooks.mjs.map +0 -1
- package/dist/i18n.cjs +0 -3039
- package/dist/i18n.cjs.map +0 -1
- package/dist/i18n.js.map +0 -1
- package/dist/i18n.mjs +0 -3032
- package/dist/i18n.mjs.map +0 -1
- package/dist/index-cli.cjs +0 -30
- package/dist/index-cli.cjs.map +0 -1
- package/dist/index-cli.js.map +0 -1
- package/dist/index-cli.mjs +0 -14
- package/dist/index-cli.mjs.map +0 -1
- package/dist/index-rn.cjs +0 -57
- package/dist/index-rn.cjs.map +0 -1
- package/dist/index-rn.js.map +0 -1
- package/dist/index-rn.mjs +0 -36
- package/dist/index-rn.mjs.map +0 -1
- package/dist/index.cjs +0 -79
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -40
- package/dist/index.mjs.map +0 -1
- package/dist/interfaces/Config/ConfigOptions.js +0 -6
- package/dist/interfaces/Config/ConfigOptions.js.map +0 -1
- package/dist/interfaces/Config/OutputMap.js +0 -6
- package/dist/interfaces/Config/OutputMap.js.map +0 -1
- package/dist/interfaces/Config/OutputOptions.js +0 -6
- package/dist/interfaces/Config/OutputOptions.js.map +0 -1
- package/dist/interfaces/Config/SitemapMap.js +0 -6
- package/dist/interfaces/Config/SitemapMap.js.map +0 -1
- package/dist/interfaces/Config/StringMap.js +0 -6
- package/dist/interfaces/Config/StringMap.js.map +0 -1
- package/dist/interfaces/Format/FormatOptions.js +0 -6
- package/dist/interfaces/Format/FormatOptions.js.map +0 -1
- package/dist/interfaces/Sentry/InitOptions.js +0 -6
- package/dist/interfaces/Sentry/InitOptions.js.map +0 -1
- package/dist/interfaces/Sentry/InitOptionsRN.js +0 -6
- package/dist/interfaces/Sentry/InitOptionsRN.js.map +0 -1
- package/dist/interfaces/Sentry/SourceMapOptions.d.ts +0 -7
- package/dist/interfaces/Sentry/SourceMapOptions.js +0 -6
- package/dist/interfaces/Sentry/SourceMapOptions.js.map +0 -1
- package/dist/sentry-cli.cjs +0 -119
- package/dist/sentry-cli.cjs.map +0 -1
- package/dist/sentry-cli.d.ts +0 -9
- package/dist/sentry-cli.js +0 -49
- package/dist/sentry-cli.js.map +0 -1
- package/dist/sentry-cli.mjs +0 -98
- package/dist/sentry-cli.mjs.map +0 -1
- package/dist/sentry-rn.cjs +0 -11
- package/dist/sentry-rn.cjs.map +0 -1
- package/dist/sentry-rn.js.map +0 -1
- package/dist/sentry-rn.mjs +0 -4
- package/dist/sentry-rn.mjs.map +0 -1
- package/dist/sentry.cjs +0 -11
- package/dist/sentry.cjs.map +0 -1
- package/dist/sentry.mjs +0 -4
- package/dist/sentry.mjs.map +0 -1
- package/dist/types/Config/OptionType.js +0 -6
- package/dist/types/Config/OptionType.js.map +0 -1
- package/dist/types/Format/OptionType.js +0 -6
- package/dist/types/Format/OptionType.js.map +0 -1
- package/dist/types/Sentry/OptionType.js +0 -6
- package/dist/types/Sentry/OptionType.js.map +0 -1
- package/dist/useWebSocket-B_B6kWXM.js +0 -167
- package/dist/useWebSocket-B_B6kWXM.js.map +0 -1
- package/dist/useWebSocket-YQWaiBz9.js +0 -172
- package/dist/useWebSocket-YQWaiBz9.js.map +0 -1
- package/dist/utils.cjs +0 -59
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.mjs +0 -43
- package/dist/utils.mjs.map +0 -1
- package/src/Sentry/Build.ts +0 -67
- package/src/interfaces/Sentry/SourceMapOptions.ts +0 -7
- package/src/sentry-cli.ts +0 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-cli-BIF4xuoO.js","names":["URL"],"sources":["../src/Config/Output.ts","../src/Config/Config.ts","../src/Config/GoogleAuth.ts","../src/Config/Locales.ts","../node_modules/sitemap/dist/esm/lib/errors.js","../node_modules/sitemap/dist/esm/lib/types.js","../node_modules/sitemap/dist/esm/lib/sitemap-xml.js","../node_modules/sitemap/dist/esm/lib/sitemap-item-stream.js","../node_modules/sitemap/dist/esm/lib/constants.js","../node_modules/sitemap/dist/esm/lib/validation.js","../node_modules/sitemap/dist/esm/lib/utils.js","../node_modules/sitemap/dist/esm/lib/sitemap-stream.js","../node_modules/sax/lib/sax.js","../node_modules/sitemap/dist/esm/lib/sitemap-parser.js","../src/Config/Sitemap.ts","../src/config-cli.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFile } from 'fs';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\n\n/**\n * Write content into target file\n *\n * @param {string} content\n * @param {OutputOptions} options\n * @return {void}\n */\nconst outputToFile = (content: string, options: OutputOptions): void => {\n let filename = options.filename;\n\n if (options.isFilenameLowercase) {\n filename = filename.toLowerCase();\n }\n\n const filePath = `${options.folder}/${filename}`;\n\n if (!existsSync(options.folder)) {\n mkdirSync(options.folder, { recursive: true });\n }\n\n writeFile(\n filePath,\n content,\n { encoding: 'utf-8', flag: 'w' },\n function (err) {\n if (err) {\n throw err;\n }\n\n console.log(filePath, content);\n },\n );\n};\n\nexport { outputToFile };\n","import { copyFile, existsSync } from 'fs';\nimport { isNull } from 'lodash-es';\nimport { EnvironmentEnum } from '../enums/EnvironmentEnum';\nimport { EntryOptions } from '../interfaces/Config/EntryOptions';\nimport { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { isHiddenKey } from '../utils';\nimport { outputToFile } from './Output';\n\n/**\n * Process config data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processConfig = (rows: any[][]): OutputMap => {\n let versionConfig: OutputMap = {};\n\n let params = rows[0].map((key) => {\n return key;\n });\n\n rows.forEach((row: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n versionConfig = processRow(row, params, versionConfig);\n });\n\n return versionConfig;\n};\n\n/**\n * Process config item\n *\n * @param {string[]} data\n * @param {string[]} params\n * @param {OutputMap} versionConfig\n * @return {OutputMap}\n */\nconst processRow = (\n data: string[],\n params: string[],\n versionConfig: OutputMap,\n): OutputMap => {\n const versionName = data[0];\n versionConfig[versionName] = {};\n\n params.forEach((paramsName, index) => {\n if (index === 0 || data[index] === undefined || data[index] === '') {\n return;\n }\n\n versionConfig[versionName][paramsName] = paramsTypeHandler(data[index]);\n });\n\n return versionConfig;\n};\n\n/**\n * Check is JSON value\n *\n * @param {string} str\n * @return {boolean}\n */\nconst isJsonString = (str: string): boolean => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Handling config value type\n *\n * @param {string} params\n * @return {any}\n */\nconst paramsTypeHandler = (params: string): any => {\n const booleanText = ['TRUE', 'FALSE'];\n\n if (booleanText.includes(params.toUpperCase())) {\n return params === 'TRUE';\n }\n\n if (isJsonString(params)) {\n return JSON.parse(params);\n }\n\n return params;\n};\n\n/**\n * Export config data into js file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportConfig = (data: OutputMap, options: OutputOptions): void => {\n const config = {\n params: data,\n };\n\n let content = '';\n\n switch (options.exportAs) {\n case 'ts':\n content = 'export default ' + JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.ts`;\n break;\n case 'json':\n content = JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.json`;\n break;\n case 'js':\n content = `module.exports = ${JSON.stringify(config, null, 2)}`;\n options.filename = `${options.filename}.js`;\n break;\n default:\n throw new Error(`exportAs ${options.exportAs} not supported.`);\n }\n\n outputToFile(content, options);\n};\n\n/**\n * Handling env map value\n *\n * @param {string} env\n * @return {string}\n */\nconst envMap = (env: string): string => {\n let result;\n\n switch (env) {\n case 'dev':\n case 'develop':\n case 'development':\n result = EnvironmentEnum.DEV;\n break;\n case 'stg':\n case 'stag':\n case 'staging':\n result = EnvironmentEnum.STAGING;\n break;\n case 'prd':\n case 'prod':\n case 'production':\n result = EnvironmentEnum.PRODUCTION;\n break;\n default:\n throw new Error(`env ${env} not supported.`);\n }\n\n return result;\n};\n\n/**\n * Mapping content to exportAs value\n *\n * @param {string} key\n * @param {any} value\n * @param {string} exportAs\n * @return {string}\n */\nconst contentMap = (key: string, value: any, exportAs: string): string => {\n let content = '';\n\n switch (exportAs) {\n case 'ts':\n if (isNull(value)) {\n content += `export const ${key}: string | null = ${value};\\n`;\n } else if (typeof value === 'boolean') {\n content += `export const ${key}: boolean = ${value};\\n`;\n } else {\n content += `export const ${key} = '${value}';\\n`;\n }\n break;\n case 'js':\n content += `export const ${key} = \"${value}\";\\n`;\n break;\n case 'env':\n content += `${key} = \"${value}\"\\n`;\n break;\n default:\n throw new Error(`exportAs ${exportAs} not supported.`);\n }\n\n return content;\n};\n\n/**\n * Transform config\n *\n * @param {OutputMap} data\n * @param {string} env\n * @param {string} configKeyPrefix\n * @param {OutputOptions} options\n * @return {void}\n */\nconst transformConfig = (\n data: OutputMap,\n env: string,\n configKeyPrefix: string,\n options: OutputOptions,\n): void => {\n const envKey = configKeyPrefix ? `${configKeyPrefix}ENV` : 'ENV';\n\n let content = contentMap(envKey, envMap(env), options.exportAs!);\n\n Object.keys(data).forEach((key) => {\n const newConfigKey =\n configKeyPrefix && !isHiddenKey(key) ? `${configKeyPrefix}${key}` : key;\n\n if (key === 'BASE_PROJECT' || key === '__BASE_PROJECT') {\n const extensionFile = [\n `.${data[key]}.js`,\n `.${data[key]}.jsx`,\n `.${data[key]}.ts`,\n `.${data[key]}.tsx`,\n `.${data[key]}.css`,\n `.${data[key]}.json`,\n `.${data[key]}.scss`,\n ];\n\n content += contentMap(\n newConfigKey,\n extensionFile.join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (key === 'SITEMAP' || key === '__SITEMAP') {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n\n return;\n }\n\n if (Array.isArray(data[key])) {\n content += contentMap(\n newConfigKey,\n data[key].join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (typeof data[key] === 'object') {\n if (data[key].hasOwnProperty(env)) {\n content += contentMap(newConfigKey, data[key][env], options.exportAs!);\n } else {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n }\n\n return;\n }\n\n content += contentMap(newConfigKey, data[key], options.exportAs!);\n });\n\n outputToFile(content, options);\n};\n\n/**\n * Change Entry index.html file\n * Format entry file should be index[.{version}][.{env}].html\n *\n * @param {string} version\n * @param {string} env\n * @param {EntryOptions} options\n * @return {void}\n */\nconst changeEntry = (\n version: string,\n env: string,\n options: EntryOptions,\n): void => {\n const newPath = 'index.html';\n let oldPath = `index`;\n\n if (!options.excludeVersion.includes(version)) {\n oldPath = `.${version}.`;\n }\n\n if (!options.excludeEnv.includes(env)) {\n oldPath = `${oldPath}.${env}`;\n }\n\n oldPath = `${oldPath}.html`;\n\n if (oldPath !== newPath && existsSync(oldPath)) {\n copyFile(oldPath, newPath, (err) => {\n if (err) {\n console.error(err);\n return;\n }\n\n console.log(\n `File copied from '${oldPath}' to '${newPath}' successfully!`,\n );\n });\n\n return;\n }\n\n console.log('use current index.html');\n};\n\nexport { changeEntry, exportConfig, processConfig, transformConfig };\n","import { existsSync } from 'fs';\nimport { GoogleAuth } from 'google-auth-library';\nimport { JSONClient } from 'google-auth-library/build/src/auth/googleauth';\nimport { google } from 'googleapis';\nimport * as path from 'path';\nimport * as process from 'process';\n\nconst SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'];\nconst GOOGLE_APPLICATION_CREDENTIALS_PATH = path.join(\n process.cwd(),\n '/google_application_credentials.json',\n);\n\n/**\n * Authenticate using google console service account.\n * @return {GoogleAuth<JSONClient>}\n */\nconst authorizeServiceAccount = (): GoogleAuth<JSONClient> => {\n const isExist = existsSync(GOOGLE_APPLICATION_CREDENTIALS_PATH);\n\n const options: any = {\n scopes: SCOPES,\n };\n\n if (isExist) {\n options.keyFile = GOOGLE_APPLICATION_CREDENTIALS_PATH;\n }\n\n return new GoogleAuth(options);\n};\n\n/**\n * @param {GoogleAuth<JSONClient>} auth The authenticated Google OAuth client.\n * @param {string} spreadsheetId\n * @param {string} spreadsheetTab\n * @return {Promise<any[][] | null | undefined>}\n */\nconst fetchGoogleSheet = async (\n auth: GoogleAuth<JSONClient>,\n spreadsheetId: string,\n spreadsheetTab: string,\n): Promise<any[][] | null | undefined> => {\n const sheets = google.sheets({ version: 'v4', auth: auth as any });\n\n const res = await sheets.spreadsheets.values.get({\n spreadsheetId: spreadsheetId,\n range: spreadsheetTab,\n majorDimension: 'COLUMNS',\n });\n\n return res.data.values;\n};\n\nexport { authorizeServiceAccount, fetchGoogleSheet };\n","import { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { StringMap } from '../interfaces/Config/StringMap';\nimport { outputToFile } from './Output';\n\n/**\n * Process locales data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processLocales = (rows: any[][]): OutputMap => {\n let keys = rows[0].map((key) => {\n return key;\n });\n\n let data: OutputMap = {};\n\n rows.forEach((lang: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n let langData: StringMap = {};\n\n lang.forEach((data: string, dIndex: number) => {\n if (dIndex === 0) {\n return;\n }\n\n langData[keys[dIndex]] = data;\n });\n\n data[lang[0]] = langData;\n });\n\n return data;\n};\n\n/**\n * Export locales data to file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportLocales = (data: OutputMap, options: OutputOptions): void => {\n Object.keys(data).forEach((key) => {\n options.filename = `${key}.${options.exportAs!.toLowerCase()}`;\n\n let content = '';\n\n switch (options.exportAs) {\n case 'ts':\n content = 'export default ' + JSON.stringify(data[key], null, 2);\n break;\n case 'json':\n content = JSON.stringify(data[key], null, 2);\n break;\n default:\n throw new Error(`exportAs ${options.exportAs} not supported.`);\n }\n\n if (!content) {\n throw new Error(`empty content, please check remote value.`);\n }\n\n outputToFile(content, options);\n });\n};\n\nexport { exportLocales, processLocales };\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/*!\n * Sitemap\n * Copyright(c) 2011 Eugene Kalinin\n * MIT Licensed\n */\n/**\n * URL in SitemapItem does not exist\n */\nexport class NoURLError extends Error {\n constructor(message) {\n super(message || 'URL is required');\n this.name = 'NoURLError';\n Error.captureStackTrace(this, NoURLError);\n }\n}\n/**\n * Config was not passed to SitemapItem constructor\n */\nexport class NoConfigError extends Error {\n constructor(message) {\n super(message || 'SitemapItem requires a configuration');\n this.name = 'NoConfigError';\n Error.captureStackTrace(this, NoConfigError);\n }\n}\n/**\n * changefreq property in sitemap is invalid\n */\nexport class ChangeFreqInvalidError extends Error {\n constructor(url, changefreq) {\n super(`${url}: changefreq \"${changefreq}\" is invalid`);\n this.name = 'ChangeFreqInvalidError';\n Error.captureStackTrace(this, ChangeFreqInvalidError);\n }\n}\n/**\n * priority property in sitemap is invalid\n */\nexport class PriorityInvalidError extends Error {\n constructor(url, priority) {\n super(`${url}: priority \"${priority}\" must be a number between 0 and 1 inclusive`);\n this.name = 'PriorityInvalidError';\n Error.captureStackTrace(this, PriorityInvalidError);\n }\n}\n/**\n * SitemapIndex target Folder does not exists\n */\nexport class UndefinedTargetFolder extends Error {\n constructor(message) {\n super(message || 'Target folder must exist');\n this.name = 'UndefinedTargetFolder';\n Error.captureStackTrace(this, UndefinedTargetFolder);\n }\n}\nexport class InvalidVideoFormat extends Error {\n constructor(url) {\n super(`${url} video must include thumbnail_loc, title and description fields for videos`);\n this.name = 'InvalidVideoFormat';\n Error.captureStackTrace(this, InvalidVideoFormat);\n }\n}\nexport class InvalidVideoDuration extends Error {\n constructor(url, duration) {\n super(`${url} duration \"${duration}\" must be an integer of seconds between 0 and 28800`);\n this.name = 'InvalidVideoDuration';\n Error.captureStackTrace(this, InvalidVideoDuration);\n }\n}\nexport class InvalidVideoDescription extends Error {\n constructor(url, length) {\n const message = `${url}: video description is too long ${length} vs limit of 2048 characters.`;\n super(message);\n this.name = 'InvalidVideoDescription';\n Error.captureStackTrace(this, InvalidVideoDescription);\n }\n}\nexport class InvalidVideoRating extends Error {\n constructor(url, title, rating) {\n super(`${url}: video \"${title}\" rating \"${rating}\" must be between 0 and 5 inclusive`);\n this.name = 'InvalidVideoRating';\n Error.captureStackTrace(this, InvalidVideoRating);\n }\n}\nexport class InvalidAttrValue extends Error {\n constructor(key, val, validator) {\n super('\"' +\n val +\n '\" tested against: ' +\n validator +\n ' is not a valid value for attr: \"' +\n key +\n '\"');\n this.name = 'InvalidAttrValue';\n Error.captureStackTrace(this, InvalidAttrValue);\n }\n}\n// InvalidAttr is only thrown when attrbuilder is called incorrectly internally\n/* istanbul ignore next */\nexport class InvalidAttr extends Error {\n constructor(key) {\n super('\"' + key + '\" is malformed');\n this.name = 'InvalidAttr';\n Error.captureStackTrace(this, InvalidAttr);\n }\n}\nexport class InvalidNewsFormat extends Error {\n constructor(url) {\n super(`${url} News must include publication, publication name, publication language, title, and publication_date for news`);\n this.name = 'InvalidNewsFormat';\n Error.captureStackTrace(this, InvalidNewsFormat);\n }\n}\nexport class InvalidNewsAccessValue extends Error {\n constructor(url, access) {\n super(`${url} News access \"${access}\" must be either Registration, Subscription or not be present`);\n this.name = 'InvalidNewsAccessValue';\n Error.captureStackTrace(this, InvalidNewsAccessValue);\n }\n}\nexport class XMLLintUnavailable extends Error {\n constructor(message) {\n super(message || 'xmlLint is not installed. XMLLint is required to validate');\n this.name = 'XMLLintUnavailable';\n Error.captureStackTrace(this, XMLLintUnavailable);\n }\n}\nexport class InvalidVideoTitle extends Error {\n constructor(url, length) {\n super(`${url}: video title is too long ${length} vs 100 character limit`);\n this.name = 'InvalidVideoTitle';\n Error.captureStackTrace(this, InvalidVideoTitle);\n }\n}\nexport class InvalidVideoViewCount extends Error {\n constructor(url, count) {\n super(`${url}: video view count must be positive, view count was ${count}`);\n this.name = 'InvalidVideoViewCount';\n Error.captureStackTrace(this, InvalidVideoViewCount);\n }\n}\nexport class InvalidVideoTagCount extends Error {\n constructor(url, count) {\n super(`${url}: video can have no more than 32 tags, this has ${count}`);\n this.name = 'InvalidVideoTagCount';\n Error.captureStackTrace(this, InvalidVideoTagCount);\n }\n}\nexport class InvalidVideoCategory extends Error {\n constructor(url, count) {\n super(`${url}: video category can only be 256 characters but was passed ${count}`);\n this.name = 'InvalidVideoCategory';\n Error.captureStackTrace(this, InvalidVideoCategory);\n }\n}\nexport class InvalidVideoFamilyFriendly extends Error {\n constructor(url, fam) {\n super(`${url}: video family friendly must be yes or no, was passed \"${fam}\"`);\n this.name = 'InvalidVideoFamilyFriendly';\n Error.captureStackTrace(this, InvalidVideoFamilyFriendly);\n }\n}\nexport class InvalidVideoRestriction extends Error {\n constructor(url, code) {\n super(`${url}: video restriction must be one or more two letter country codes. Was passed \"${code}\"`);\n this.name = 'InvalidVideoRestriction';\n Error.captureStackTrace(this, InvalidVideoRestriction);\n }\n}\nexport class InvalidVideoRestrictionRelationship extends Error {\n constructor(url, val) {\n super(`${url}: video restriction relationship must be either allow or deny. Was passed \"${val}\"`);\n this.name = 'InvalidVideoRestrictionRelationship';\n Error.captureStackTrace(this, InvalidVideoRestrictionRelationship);\n }\n}\nexport class InvalidVideoPriceType extends Error {\n constructor(url, priceType, price) {\n super(priceType === undefined && price === ''\n ? `${url}: video priceType is required when price is not provided`\n : `${url}: video price type \"${priceType}\" is not \"rent\" or \"purchase\"`);\n this.name = 'InvalidVideoPriceType';\n Error.captureStackTrace(this, InvalidVideoPriceType);\n }\n}\nexport class InvalidVideoResolution extends Error {\n constructor(url, resolution) {\n super(`${url}: video price resolution \"${resolution}\" is not hd or sd`);\n this.name = 'InvalidVideoResolution';\n Error.captureStackTrace(this, InvalidVideoResolution);\n }\n}\nexport class InvalidVideoPriceCurrency extends Error {\n constructor(url, currency) {\n super(`${url}: video price currency \"${currency}\" must be a three capital letter abbrieviation for the country currency`);\n this.name = 'InvalidVideoPriceCurrency';\n Error.captureStackTrace(this, InvalidVideoPriceCurrency);\n }\n}\nexport class EmptyStream extends Error {\n constructor() {\n super('You have ended the stream before anything was written. streamToPromise MUST be called before ending the stream.');\n this.name = 'EmptyStream';\n Error.captureStackTrace(this, EmptyStream);\n }\n}\nexport class EmptySitemap extends Error {\n constructor() {\n super('You ended the stream without writing anything.');\n this.name = 'EmptySitemap';\n Error.captureStackTrace(this, EmptyStream);\n }\n}\nexport class InvalidPathError extends Error {\n constructor(path, reason) {\n super(`Invalid path \"${path}\": ${reason}`);\n this.name = 'InvalidPathError';\n Error.captureStackTrace(this, InvalidPathError);\n }\n}\nexport class InvalidHostnameError extends Error {\n constructor(hostname, reason) {\n super(`Invalid hostname \"${hostname}\": ${reason}`);\n this.name = 'InvalidHostnameError';\n Error.captureStackTrace(this, InvalidHostnameError);\n }\n}\nexport class InvalidLimitError extends Error {\n constructor(limit) {\n super(`Invalid limit \"${limit}\": must be a number between 1 and 50000 (per sitemaps.org spec)`);\n this.name = 'InvalidLimitError';\n Error.captureStackTrace(this, InvalidLimitError);\n }\n}\nexport class InvalidPublicBasePathError extends Error {\n constructor(publicBasePath, reason) {\n super(`Invalid publicBasePath \"${publicBasePath}\": ${reason}`);\n this.name = 'InvalidPublicBasePathError';\n Error.captureStackTrace(this, InvalidPublicBasePathError);\n }\n}\nexport class InvalidXSLUrlError extends Error {\n constructor(xslUrl, reason) {\n super(`Invalid xslUrl \"${xslUrl}\": ${reason}`);\n this.name = 'InvalidXSLUrlError';\n Error.captureStackTrace(this, InvalidXSLUrlError);\n }\n}\nexport class InvalidXMLAttributeNameError extends Error {\n constructor(attributeName) {\n super(`Invalid XML attribute name \"${attributeName}\": must contain only alphanumeric characters, hyphens, underscores, and colons`);\n this.name = 'InvalidXMLAttributeNameError';\n Error.captureStackTrace(this, InvalidXMLAttributeNameError);\n }\n}\n","/**\n * How frequently the page is likely to change. This value provides general\n * information to search engines and may not correlate exactly to how often they crawl the page. Please note that the\n * value of this tag is considered a hint and not a command. See\n * <https://www.sitemaps.org/protocol.html#xmlTagDefinitions> for the acceptable\n * values\n */\nexport var EnumChangefreq;\n(function (EnumChangefreq) {\n EnumChangefreq[\"DAILY\"] = \"daily\";\n EnumChangefreq[\"MONTHLY\"] = \"monthly\";\n EnumChangefreq[\"ALWAYS\"] = \"always\";\n EnumChangefreq[\"HOURLY\"] = \"hourly\";\n EnumChangefreq[\"WEEKLY\"] = \"weekly\";\n EnumChangefreq[\"YEARLY\"] = \"yearly\";\n EnumChangefreq[\"NEVER\"] = \"never\";\n})(EnumChangefreq || (EnumChangefreq = {}));\nexport var EnumYesNo;\n(function (EnumYesNo) {\n EnumYesNo[\"YES\"] = \"YES\";\n EnumYesNo[\"NO\"] = \"NO\";\n EnumYesNo[\"Yes\"] = \"Yes\";\n EnumYesNo[\"No\"] = \"No\";\n EnumYesNo[\"yes\"] = \"yes\";\n EnumYesNo[\"no\"] = \"no\";\n})(EnumYesNo || (EnumYesNo = {}));\nexport var EnumAllowDeny;\n(function (EnumAllowDeny) {\n EnumAllowDeny[\"ALLOW\"] = \"allow\";\n EnumAllowDeny[\"DENY\"] = \"deny\";\n})(EnumAllowDeny || (EnumAllowDeny = {}));\n/**\n * How to handle errors in passed in urls\n */\nexport var ErrorLevel;\n(function (ErrorLevel) {\n /**\n * Validation will be skipped and nothing logged or thrown.\n */\n ErrorLevel[\"SILENT\"] = \"silent\";\n /**\n * If an invalid value is encountered, a console.warn will be called with details\n */\n ErrorLevel[\"WARN\"] = \"warn\";\n /**\n * An Error will be thrown on encountering invalid data.\n */\n ErrorLevel[\"THROW\"] = \"throw\";\n})(ErrorLevel || (ErrorLevel = {}));\nexport var TagNames;\n(function (TagNames) {\n TagNames[\"url\"] = \"url\";\n TagNames[\"loc\"] = \"loc\";\n TagNames[\"urlset\"] = \"urlset\";\n TagNames[\"lastmod\"] = \"lastmod\";\n TagNames[\"changefreq\"] = \"changefreq\";\n TagNames[\"priority\"] = \"priority\";\n TagNames[\"video:thumbnail_loc\"] = \"video:thumbnail_loc\";\n TagNames[\"video:video\"] = \"video:video\";\n TagNames[\"video:title\"] = \"video:title\";\n TagNames[\"video:description\"] = \"video:description\";\n TagNames[\"video:tag\"] = \"video:tag\";\n TagNames[\"video:duration\"] = \"video:duration\";\n TagNames[\"video:player_loc\"] = \"video:player_loc\";\n TagNames[\"video:content_loc\"] = \"video:content_loc\";\n TagNames[\"image:image\"] = \"image:image\";\n TagNames[\"image:loc\"] = \"image:loc\";\n TagNames[\"image:geo_location\"] = \"image:geo_location\";\n TagNames[\"image:license\"] = \"image:license\";\n TagNames[\"image:title\"] = \"image:title\";\n TagNames[\"image:caption\"] = \"image:caption\";\n TagNames[\"video:requires_subscription\"] = \"video:requires_subscription\";\n TagNames[\"video:publication_date\"] = \"video:publication_date\";\n TagNames[\"video:id\"] = \"video:id\";\n TagNames[\"video:restriction\"] = \"video:restriction\";\n TagNames[\"video:family_friendly\"] = \"video:family_friendly\";\n TagNames[\"video:view_count\"] = \"video:view_count\";\n TagNames[\"video:uploader\"] = \"video:uploader\";\n TagNames[\"video:expiration_date\"] = \"video:expiration_date\";\n TagNames[\"video:platform\"] = \"video:platform\";\n TagNames[\"video:price\"] = \"video:price\";\n TagNames[\"video:rating\"] = \"video:rating\";\n TagNames[\"video:category\"] = \"video:category\";\n TagNames[\"video:live\"] = \"video:live\";\n TagNames[\"video:gallery_loc\"] = \"video:gallery_loc\";\n TagNames[\"news:news\"] = \"news:news\";\n TagNames[\"news:publication\"] = \"news:publication\";\n TagNames[\"news:name\"] = \"news:name\";\n TagNames[\"news:access\"] = \"news:access\";\n TagNames[\"news:genres\"] = \"news:genres\";\n TagNames[\"news:publication_date\"] = \"news:publication_date\";\n TagNames[\"news:title\"] = \"news:title\";\n TagNames[\"news:keywords\"] = \"news:keywords\";\n TagNames[\"news:stock_tickers\"] = \"news:stock_tickers\";\n TagNames[\"news:language\"] = \"news:language\";\n TagNames[\"mobile:mobile\"] = \"mobile:mobile\";\n TagNames[\"xhtml:link\"] = \"xhtml:link\";\n TagNames[\"expires\"] = \"expires\";\n})(TagNames || (TagNames = {}));\nexport var IndexTagNames;\n(function (IndexTagNames) {\n IndexTagNames[\"sitemap\"] = \"sitemap\";\n IndexTagNames[\"sitemapindex\"] = \"sitemapindex\";\n IndexTagNames[\"loc\"] = \"loc\";\n IndexTagNames[\"lastmod\"] = \"lastmod\";\n})(IndexTagNames || (IndexTagNames = {}));\n","/*!\n * Sitemap\n * Copyright(c) 2011 Eugene Kalinin\n * MIT Licensed\n */\nimport { InvalidXMLAttributeNameError } from './errors.js';\n/**\n * Regular expression matching invalid XML 1.0 Unicode characters that must be removed.\n *\n * Based on the XML 1.0 specification (https://www.w3.org/TR/xml/#charsets):\n * - Control characters (U+0000-U+001F except tab, newline, carriage return)\n * - Delete character (U+007F)\n * - Invalid control characters (U+0080-U+009F except U+0085)\n * - Surrogate pairs (U+D800-U+DFFF)\n * - Non-characters (\\p{NChar} - permanently reserved code points)\n *\n * Performance note: This regex uses Unicode property escapes and may be slower\n * on very large strings (100KB+). Consider pre-validation for untrusted input.\n *\n * @see https://www.w3.org/TR/xml/#charsets\n */\nconst invalidXMLUnicodeRegex = \n// eslint-disable-next-line no-control-regex\n/[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F-\\u0084\\u0086-\\u009F\\uD800-\\uDFFF\\p{NChar}]/gu;\n/**\n * Regular expressions for XML entity escaping\n */\nconst amp = /&/g;\nconst lt = /</g;\nconst gt = />/g;\nconst apos = /'/g;\nconst quot = /\"/g;\n/**\n * Valid XML attribute name pattern. XML names must:\n * - Start with a letter, underscore, or colon\n * - Contain only letters, digits, hyphens, underscores, colons, or periods\n *\n * This is a simplified validation that accepts the most common attribute names.\n * Note: In practice, this library only uses namespaced attributes like \"video:title\"\n * which are guaranteed to be valid.\n *\n * @see https://www.w3.org/TR/xml/#NT-Name\n */\nconst validAttributeNameRegex = /^[a-zA-Z_:][\\w:.-]*$/;\n/**\n * Validates that an attribute name is a valid XML identifier.\n *\n * XML attribute names must start with a letter, underscore, or colon,\n * and contain only alphanumeric characters, hyphens, underscores, colons, or periods.\n *\n * @param name - The attribute name to validate\n * @throws {InvalidXMLAttributeNameError} If the attribute name is invalid\n *\n * @example\n * validateAttributeName('href'); // OK\n * validateAttributeName('xml:lang'); // OK\n * validateAttributeName('data-value'); // OK\n * validateAttributeName('<script>'); // Throws InvalidXMLAttributeNameError\n */\nfunction validateAttributeName(name) {\n if (!validAttributeNameRegex.test(name)) {\n throw new InvalidXMLAttributeNameError(name);\n }\n}\n/**\n * Escapes text content for safe inclusion in XML text nodes.\n *\n * **Security Model:**\n * - Escapes `&` → `&` (required to prevent entity interpretation)\n * - Escapes `<` → `<` (required to prevent tag injection)\n * - Escapes `>` → `>` (defense-in-depth, prevents CDATA injection)\n * - Does NOT escape `\"` or `'` (not required in text content, only in attributes)\n * - Removes invalid XML Unicode characters per XML 1.0 spec\n *\n * **Why quotes aren't escaped:**\n * In XML text content (between tags), quotes have no special meaning and don't\n * need escaping. They only need escaping in attribute values, which is handled\n * by the `otag()` function.\n *\n * @param txt - The text content to escape\n * @returns XML-safe escaped text with invalid characters removed\n * @throws {TypeError} If txt is not a string\n *\n * @example\n * text('Hello & World'); // Returns: 'Hello & World'\n * text('5 < 10'); // Returns: '5 < 10'\n * text('Hello \"World\"'); // Returns: 'Hello \"World\"' (quotes OK in text)\n *\n * @see https://www.w3.org/TR/xml/#syntax\n */\nexport function text(txt) {\n if (typeof txt !== 'string') {\n throw new TypeError(`text() requires a string, received ${typeof txt}: ${String(txt)}`);\n }\n return txt\n .replace(amp, '&')\n .replace(lt, '<')\n .replace(gt, '>')\n .replace(invalidXMLUnicodeRegex, '');\n}\n/**\n * Generates an opening XML tag with optional attributes.\n *\n * **Security Model:**\n * - Validates attribute names to prevent injection via malformed names\n * - Escapes all attribute values with proper XML entity encoding\n * - Escapes `&`, `<`, `>`, `\"`, and `'` in attribute values\n * - Removes invalid XML Unicode characters\n *\n * Attribute values use full escaping (including quotes) because they appear\n * within quoted strings in the XML output: `<tag attr=\"value\">`.\n *\n * @param nodeName - The XML element name (e.g., 'url', 'loc', 'video:title')\n * @param attrs - Optional object mapping attribute names to string values\n * @param selfClose - If true, generates a self-closing tag (e.g., `<tag/>`)\n * @returns Opening XML tag string\n * @throws {InvalidXMLAttributeNameError} If an attribute name contains invalid characters\n * @throws {TypeError} If nodeName is not a string or attrs values are not strings\n *\n * @example\n * otag('url'); // Returns: '<url>'\n * otag('video:player_loc', { autoplay: 'ap=1' }); // Returns: '<video:player_loc autoplay=\"ap=1\">'\n * otag('image:image', {}, true); // Returns: '<image:image/>'\n *\n * @see https://www.w3.org/TR/xml/#NT-Attribute\n */\nexport function otag(nodeName, attrs, selfClose = false) {\n if (typeof nodeName !== 'string') {\n throw new TypeError(`otag() nodeName must be a string, received ${typeof nodeName}: ${String(nodeName)}`);\n }\n let attrstr = '';\n for (const k in attrs) {\n // Validate attribute name to prevent injection\n validateAttributeName(k);\n const attrValue = attrs[k];\n if (typeof attrValue !== 'string') {\n throw new TypeError(`otag() attribute \"${k}\" value must be a string, received ${typeof attrValue}: ${String(attrValue)}`);\n }\n // Escape attribute value with full entity encoding\n const val = attrValue\n .replace(amp, '&')\n .replace(lt, '<')\n .replace(gt, '>')\n .replace(apos, ''')\n .replace(quot, '"')\n .replace(invalidXMLUnicodeRegex, '');\n attrstr += ` ${k}=\"${val}\"`;\n }\n return `<${nodeName}${attrstr}${selfClose ? '/' : ''}>`;\n}\n/**\n * Generates a closing XML tag.\n *\n * @param nodeName - The XML element name (e.g., 'url', 'loc', 'video:title')\n * @returns Closing XML tag string\n * @throws {TypeError} If nodeName is not a string\n *\n * @example\n * ctag('url'); // Returns: '</url>'\n * ctag('video:title'); // Returns: '</video:title>'\n */\nexport function ctag(nodeName) {\n if (typeof nodeName !== 'string') {\n throw new TypeError(`ctag() nodeName must be a string, received ${typeof nodeName}: ${String(nodeName)}`);\n }\n return `</${nodeName}>`;\n}\nexport function element(nodeName, attrs, innerText) {\n if (typeof attrs === 'string') {\n // Pattern 1: element(nodeName, textContent)\n return otag(nodeName) + text(attrs) + ctag(nodeName);\n }\n else if (innerText !== undefined) {\n // Pattern 2: element(nodeName, attrs, textContent)\n return otag(nodeName, attrs) + text(innerText) + ctag(nodeName);\n }\n else {\n // Pattern 3: element(nodeName, attrs) - self-closing\n return otag(nodeName, attrs, true);\n }\n}\n","import { Transform } from 'node:stream';\nimport { InvalidAttr } from './errors.js';\nimport { ErrorLevel, TagNames } from './types.js';\nimport { element, otag, ctag } from './sitemap-xml.js';\n/**\n * Builds an attributes object for XML elements from configuration object\n * Extracts attributes based on colon-delimited keys (e.g., 'price:currency' -> { currency: value })\n *\n * @param conf - Configuration object containing attribute values\n * @param keys - Single key or array of keys in format 'namespace:attribute'\n * @returns Record of attribute names to string values (may contain non-string values from conf)\n * @throws {InvalidAttr} When key format is invalid (must contain exactly one colon)\n *\n * @example\n * attrBuilder({ 'price:currency': 'USD', 'price:type': 'rent' }, ['price:currency', 'price:type'])\n * // Returns: { currency: 'USD', type: 'rent' }\n */\nfunction attrBuilder(conf, keys) {\n if (typeof keys === 'string') {\n keys = [keys];\n }\n const iv = {};\n return keys.reduce((attrs, key) => {\n if (conf[key] !== undefined) {\n const keyAr = key.split(':');\n if (keyAr.length !== 2) {\n throw new InvalidAttr(key);\n }\n attrs[keyAr[1]] = conf[key];\n }\n return attrs;\n }, iv);\n}\n/**\n * Takes a stream of SitemapItemOptions and spits out xml for each\n * @example\n * // writes <url><loc>https://example.com</loc><url><url><loc>https://example.com/2</loc><url>\n * const smis = new SitemapItemStream({level: 'warn'})\n * smis.pipe(writestream)\n * smis.write({url: 'https://example.com', img: [], video: [], links: []})\n * smis.write({url: 'https://example.com/2', img: [], video: [], links: []})\n * smis.end()\n * @param level - Error level\n */\nexport class SitemapItemStream extends Transform {\n level;\n constructor(opts = { level: ErrorLevel.WARN }) {\n opts.objectMode = true;\n super(opts);\n this.level = opts.level || ErrorLevel.WARN;\n }\n _transform(item, encoding, callback) {\n this.push(otag(TagNames.url));\n this.push(element(TagNames.loc, item.url));\n if (item.lastmod) {\n this.push(element(TagNames.lastmod, item.lastmod));\n }\n if (item.changefreq) {\n this.push(element(TagNames.changefreq, item.changefreq));\n }\n if (item.priority !== undefined && item.priority !== null) {\n if (item.fullPrecisionPriority) {\n this.push(element(TagNames.priority, item.priority.toString()));\n }\n else {\n this.push(element(TagNames.priority, item.priority.toFixed(1)));\n }\n }\n item.video.forEach((video) => {\n this.push(otag(TagNames['video:video']));\n this.push(element(TagNames['video:thumbnail_loc'], video.thumbnail_loc));\n this.push(element(TagNames['video:title'], video.title));\n this.push(element(TagNames['video:description'], video.description));\n if (video.content_loc) {\n this.push(element(TagNames['video:content_loc'], video.content_loc));\n }\n if (video.player_loc) {\n this.push(element(TagNames['video:player_loc'], attrBuilder(video, [\n 'player_loc:autoplay',\n 'player_loc:allow_embed',\n ]), video.player_loc));\n }\n if (video.duration) {\n this.push(element(TagNames['video:duration'], video.duration.toString()));\n }\n if (video.expiration_date) {\n this.push(element(TagNames['video:expiration_date'], video.expiration_date));\n }\n if (video.rating !== undefined) {\n this.push(element(TagNames['video:rating'], video.rating.toString()));\n }\n if (video.view_count !== undefined) {\n this.push(element(TagNames['video:view_count'], String(video.view_count)));\n }\n if (video.publication_date) {\n this.push(element(TagNames['video:publication_date'], video.publication_date));\n }\n if (video.tag && video.tag.length > 0) {\n for (const tag of video.tag) {\n this.push(element(TagNames['video:tag'], tag));\n }\n }\n if (video.category) {\n this.push(element(TagNames['video:category'], video.category));\n }\n if (video.family_friendly) {\n this.push(element(TagNames['video:family_friendly'], video.family_friendly));\n }\n if (video.restriction) {\n this.push(element(TagNames['video:restriction'], attrBuilder(video, 'restriction:relationship'), video.restriction));\n }\n if (video.gallery_loc) {\n this.push(element(TagNames['video:gallery_loc'], attrBuilder(video, 'gallery_loc:title'), video.gallery_loc));\n }\n if (video.price) {\n this.push(element(TagNames['video:price'], attrBuilder(video, [\n 'price:resolution',\n 'price:currency',\n 'price:type',\n ]), video.price));\n }\n if (video.requires_subscription) {\n this.push(element(TagNames['video:requires_subscription'], video.requires_subscription));\n }\n if (video.uploader) {\n this.push(element(TagNames['video:uploader'], attrBuilder(video, 'uploader:info'), video.uploader));\n }\n if (video.platform) {\n this.push(element(TagNames['video:platform'], attrBuilder(video, 'platform:relationship'), video.platform));\n }\n if (video.live) {\n this.push(element(TagNames['video:live'], video.live));\n }\n if (video.id) {\n this.push(element(TagNames['video:id'], { type: 'url' }, video.id));\n }\n this.push(ctag(TagNames['video:video']));\n });\n item.links.forEach((link) => {\n this.push(element(TagNames['xhtml:link'], {\n rel: 'alternate',\n hreflang: link.lang || link.hreflang,\n href: link.url,\n }));\n });\n if (item.expires) {\n this.push(element(TagNames.expires, new Date(item.expires).toISOString()));\n }\n if (item.androidLink) {\n this.push(element(TagNames['xhtml:link'], {\n rel: 'alternate',\n href: item.androidLink,\n }));\n }\n if (item.ampLink) {\n this.push(element(TagNames['xhtml:link'], {\n rel: 'amphtml',\n href: item.ampLink,\n }));\n }\n if (item.news) {\n this.push(otag(TagNames['news:news']));\n this.push(otag(TagNames['news:publication']));\n this.push(element(TagNames['news:name'], item.news.publication.name));\n this.push(element(TagNames['news:language'], item.news.publication.language));\n this.push(ctag(TagNames['news:publication']));\n if (item.news.access) {\n this.push(element(TagNames['news:access'], item.news.access));\n }\n if (item.news.genres) {\n this.push(element(TagNames['news:genres'], item.news.genres));\n }\n this.push(element(TagNames['news:publication_date'], item.news.publication_date));\n this.push(element(TagNames['news:title'], item.news.title));\n if (item.news.keywords) {\n this.push(element(TagNames['news:keywords'], item.news.keywords));\n }\n if (item.news.stock_tickers) {\n this.push(element(TagNames['news:stock_tickers'], item.news.stock_tickers));\n }\n this.push(ctag(TagNames['news:news']));\n }\n // Image handling\n item.img.forEach((image) => {\n this.push(otag(TagNames['image:image']));\n this.push(element(TagNames['image:loc'], image.url));\n if (image.caption) {\n this.push(element(TagNames['image:caption'], image.caption));\n }\n if (image.geoLocation) {\n this.push(element(TagNames['image:geo_location'], image.geoLocation));\n }\n if (image.title) {\n this.push(element(TagNames['image:title'], image.title));\n }\n if (image.license) {\n this.push(element(TagNames['image:license'], image.license));\n }\n this.push(ctag(TagNames['image:image']));\n });\n this.push(ctag(TagNames.url));\n callback();\n }\n}\n","/*!\n * Sitemap\n * Copyright(c) 2011 Eugene Kalinin\n * MIT Licensed\n */\n/**\n * Shared constants used across the sitemap library\n * This file serves as a single source of truth for limits and validation patterns\n */\n/**\n * Security limits for sitemap generation and parsing\n *\n * These limits are based on:\n * - sitemaps.org protocol specification\n * - Security best practices to prevent DoS and injection attacks\n * - Google's sitemap extension specifications\n *\n * @see https://www.sitemaps.org/protocol.html\n * @see https://developers.google.com/search/docs/advanced/sitemaps/build-sitemap\n */\nexport const LIMITS = {\n // URL constraints per sitemaps.org spec\n MAX_URL_LENGTH: 2048,\n URL_PROTOCOL_REGEX: /^https?:\\/\\//i,\n // Sitemap size limits per sitemaps.org spec\n MIN_SITEMAP_ITEM_LIMIT: 1,\n MAX_SITEMAP_ITEM_LIMIT: 50000,\n // Video field length constraints per Google spec\n MAX_VIDEO_TITLE_LENGTH: 100,\n MAX_VIDEO_DESCRIPTION_LENGTH: 2048,\n MAX_VIDEO_CATEGORY_LENGTH: 256,\n MAX_TAGS_PER_VIDEO: 32,\n // News field length constraints per Google spec\n MAX_NEWS_TITLE_LENGTH: 200,\n MAX_NEWS_NAME_LENGTH: 256,\n // Image field length constraints per Google spec\n MAX_IMAGE_CAPTION_LENGTH: 512,\n MAX_IMAGE_TITLE_LENGTH: 512,\n // Limits on number of items per URL entry\n MAX_IMAGES_PER_URL: 1000,\n MAX_VIDEOS_PER_URL: 100,\n MAX_LINKS_PER_URL: 100,\n // Total entries in a sitemap\n MAX_URL_ENTRIES: 50000,\n // Date validation - ISO 8601 / W3C format\n ISO_DATE_REGEX: /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?([+-]\\d{2}:\\d{2}|Z)?)?$/,\n // Custom namespace limits to prevent DoS\n MAX_CUSTOM_NAMESPACES: 20,\n MAX_NAMESPACE_LENGTH: 512,\n // Cap on stored parser errors to prevent memory DoS (BB-03)\n // Errors beyond this limit are counted in errorCount but not retained as objects\n MAX_PARSER_ERRORS: 100,\n};\n/**\n * Default maximum number of items in each sitemap XML file\n * Set below the max to leave room for URLs added during processing\n *\n * @see https://www.sitemaps.org/protocol.html#index\n */\nexport const DEFAULT_SITEMAP_ITEM_LIMIT = 45000;\n","/*!\n * Sitemap\n * Copyright(c) 2011 Eugene Kalinin\n * MIT Licensed\n */\nimport { InvalidPathError, InvalidHostnameError, InvalidLimitError, InvalidPublicBasePathError, InvalidXSLUrlError, ChangeFreqInvalidError, InvalidAttrValue, InvalidNewsAccessValue, InvalidNewsFormat, InvalidVideoDescription, InvalidVideoDuration, InvalidVideoFormat, InvalidVideoRating, NoURLError, NoConfigError, PriorityInvalidError, InvalidVideoTitle, InvalidVideoViewCount, InvalidVideoTagCount, InvalidVideoCategory, InvalidVideoFamilyFriendly, InvalidVideoRestriction, InvalidVideoRestrictionRelationship, InvalidVideoPriceType, InvalidVideoResolution, InvalidVideoPriceCurrency, } from './errors.js';\nimport { ErrorLevel, EnumChangefreq, } from './types.js';\nimport { LIMITS } from './constants.js';\nimport { isAbsolute } from 'node:path';\n/**\n * Validator regular expressions for various sitemap fields\n */\nconst allowDeny = /^(?:allow|deny)$/;\nexport const validators = {\n 'price:currency': /^[A-Z]{3}$/,\n 'price:type': /^(?:rent|purchase|RENT|PURCHASE)$/,\n 'price:resolution': /^(?:HD|hd|sd|SD)$/,\n 'platform:relationship': allowDeny,\n 'restriction:relationship': allowDeny,\n restriction: /^([A-Z]{2}( +[A-Z]{2})*)?$/,\n platform: /^((web|mobile|tv)( (web|mobile|tv))*)?$/,\n // Language codes: zh-cn, zh-tw, or ISO 639 2-3 letter codes\n language: /^(zh-cn|zh-tw|[a-z]{2,3})$/,\n genres: /^(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated)(, *(PressRelease|Satire|Blog|OpEd|Opinion|UserGenerated))*$/,\n stock_tickers: /^(\\w+:\\w+(, *\\w+:\\w+){0,4})?$/,\n};\n/**\n * Type guard to check if a string is a valid price type\n */\nexport function isPriceType(pt) {\n return validators['price:type'].test(pt);\n}\n/**\n * Type guard to check if a string is a valid resolution\n */\nexport function isResolution(res) {\n return validators['price:resolution'].test(res);\n}\n/**\n * Type guard to check if a string is a valid changefreq value\n */\nconst CHANGEFREQ = Object.values(EnumChangefreq);\nexport function isValidChangeFreq(freq) {\n return CHANGEFREQ.includes(freq);\n}\n/**\n * Type guard to check if a string is a valid yes/no value\n */\nexport function isValidYesNo(yn) {\n return /^YES|NO|[Yy]es|[Nn]o$/.test(yn);\n}\n/**\n * Type guard to check if a string is a valid allow/deny value\n */\nexport function isAllowDeny(ad) {\n return allowDeny.test(ad);\n}\n/**\n * Validates that a URL is well-formed and meets security requirements\n *\n * Security: This function enforces that URLs use safe protocols (http/https),\n * are within reasonable length limits (2048 chars per sitemaps.org spec),\n * and can be properly parsed. This prevents protocol injection attacks and\n * ensures compliance with sitemap specifications.\n *\n * @param url - The URL to validate\n * @param paramName - The parameter name for error messages\n * @throws {InvalidHostnameError} If the URL is invalid\n */\nexport function validateURL(url, paramName) {\n if (!url || typeof url !== 'string') {\n throw new InvalidHostnameError(url, `${paramName} must be a non-empty string`);\n }\n if (url.length > LIMITS.MAX_URL_LENGTH) {\n throw new InvalidHostnameError(url, `${paramName} exceeds maximum length of ${LIMITS.MAX_URL_LENGTH} characters`);\n }\n if (!LIMITS.URL_PROTOCOL_REGEX.test(url)) {\n throw new InvalidHostnameError(url, `${paramName} must use http:// or https:// protocol`);\n }\n // Validate URL can be parsed\n try {\n new URL(url);\n }\n catch (err) {\n throw new InvalidHostnameError(url, `${paramName} is not a valid URL: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n/**\n * Validates that a path doesn't contain path traversal sequences\n *\n * Security: This function prevents path traversal attacks by detecting\n * any occurrence of '..' in the path, whether it appears as '../', '/..',\n * or standalone. This prevents attackers from accessing files outside\n * the intended directory structure.\n *\n * @param path - The path to validate\n * @param paramName - The parameter name for error messages\n * @throws {InvalidPathError} If the path contains traversal sequences\n */\nexport function validatePath(path, paramName) {\n if (!path || typeof path !== 'string') {\n throw new InvalidPathError(path, `${paramName} must be a non-empty string`);\n }\n // Reject absolute paths to prevent arbitrary write location when caller input\n // reaches destinationDir (BB-04)\n if (isAbsolute(path)) {\n throw new InvalidPathError(path, `${paramName} must be a relative path (absolute paths are not allowed)`);\n }\n // Check for path traversal sequences - must check before and after normalization\n // to catch both Windows-style (\\) and Unix-style (/) separators\n if (path.includes('..')) {\n throw new InvalidPathError(path, `${paramName} contains path traversal sequence (..)`);\n }\n // Additional check after normalization to catch encoded or obfuscated attempts\n const normalizedPath = path.replace(/\\\\/g, '/');\n const pathComponents = normalizedPath.split('/').filter((p) => p.length > 0);\n if (pathComponents.includes('..')) {\n throw new InvalidPathError(path, `${paramName} contains path traversal sequence (..)`);\n }\n // Check for null bytes (security issue in some contexts)\n if (path.includes('\\0')) {\n throw new InvalidPathError(path, `${paramName} contains null byte character`);\n }\n}\n/**\n * Validates that a public base path is safe for URL construction\n *\n * Security: This function prevents path traversal attacks and validates\n * that the path is safe for use in URL construction within sitemap indexes.\n * It checks for '..' sequences, null bytes, and invalid whitespace that\n * could be used to manipulate URL structure or inject malicious content.\n *\n * @param publicBasePath - The public base path to validate\n * @throws {InvalidPublicBasePathError} If the path is invalid\n */\nexport function validatePublicBasePath(publicBasePath) {\n if (!publicBasePath || typeof publicBasePath !== 'string') {\n throw new InvalidPublicBasePathError(publicBasePath, 'must be a non-empty string');\n }\n // Check for path traversal - check the raw string first\n if (publicBasePath.includes('..')) {\n throw new InvalidPublicBasePathError(publicBasePath, 'contains path traversal sequence (..)');\n }\n // Additional check for path components after normalization\n const normalizedPath = publicBasePath.replace(/\\\\/g, '/');\n const pathComponents = normalizedPath.split('/').filter((p) => p.length > 0);\n if (pathComponents.includes('..')) {\n throw new InvalidPublicBasePathError(publicBasePath, 'contains path traversal sequence (..)');\n }\n // Check for null bytes\n if (publicBasePath.includes('\\0')) {\n throw new InvalidPublicBasePathError(publicBasePath, 'contains null byte character');\n }\n // Check for potentially dangerous characters that could break URL construction\n if (/[\\r\\n\\t]/.test(publicBasePath)) {\n throw new InvalidPublicBasePathError(publicBasePath, 'contains invalid whitespace characters');\n }\n}\n/**\n * Validates that a limit is within acceptable range per sitemaps.org spec\n *\n * Security: This function enforces sitemap size limits (1-50,000 URLs per\n * sitemap) as specified by sitemaps.org. This prevents resource exhaustion\n * attacks and ensures compliance with search engine requirements.\n *\n * @param limit - The limit to validate\n * @throws {InvalidLimitError} If the limit is out of range\n */\nexport function validateLimit(limit) {\n if (typeof limit !== 'number' ||\n !Number.isFinite(limit) ||\n Number.isNaN(limit)) {\n throw new InvalidLimitError(limit);\n }\n if (limit < LIMITS.MIN_SITEMAP_ITEM_LIMIT ||\n limit > LIMITS.MAX_SITEMAP_ITEM_LIMIT) {\n throw new InvalidLimitError(limit);\n }\n // Ensure it's an integer\n if (!Number.isInteger(limit)) {\n throw new InvalidLimitError(limit);\n }\n}\n/**\n * Validates that an XSL URL is safe and well-formed\n *\n * Security: This function validates XSL stylesheet URLs to prevent\n * injection attacks. It blocks dangerous protocols and content patterns\n * that could be used for XSS or other attacks. The validation uses\n * case-insensitive matching to catch obfuscated attacks.\n *\n * @param xslUrl - The XSL URL to validate\n * @throws {InvalidXSLUrlError} If the URL is invalid\n */\nexport function validateXSLUrl(xslUrl) {\n if (!xslUrl || typeof xslUrl !== 'string') {\n throw new InvalidXSLUrlError(xslUrl, 'must be a non-empty string');\n }\n if (xslUrl.length > LIMITS.MAX_URL_LENGTH) {\n throw new InvalidXSLUrlError(xslUrl, `exceeds maximum length of ${LIMITS.MAX_URL_LENGTH} characters`);\n }\n if (!LIMITS.URL_PROTOCOL_REGEX.test(xslUrl)) {\n throw new InvalidXSLUrlError(xslUrl, 'must use http:// or https:// protocol');\n }\n // Validate URL can be parsed\n try {\n new URL(xslUrl);\n }\n catch (err) {\n throw new InvalidXSLUrlError(xslUrl, `is not a valid URL: ${err instanceof Error ? err.message : String(err)}`);\n }\n // Check for potentially dangerous content (case-insensitive)\n const lowerUrl = xslUrl.toLowerCase();\n // Block dangerous HTML/script content\n if (lowerUrl.includes('<script')) {\n throw new InvalidXSLUrlError(xslUrl, 'contains potentially malicious content (<script tag)');\n }\n // Block dangerous protocols (already checked http/https above, but double-check for encoded variants)\n const dangerousProtocols = [\n 'javascript:',\n 'data:',\n 'vbscript:',\n 'file:',\n 'about:',\n ];\n for (const protocol of dangerousProtocols) {\n if (lowerUrl.includes(protocol)) {\n throw new InvalidXSLUrlError(xslUrl, `contains dangerous protocol: ${protocol}`);\n }\n }\n // Check for URL-encoded variants of dangerous patterns\n // %3C = '<', %3E = '>', %3A = ':'\n const encodedPatterns = [\n '%3cscript', // <script\n '%3c%73%63%72%69%70%74', // <script (fully encoded)\n 'javascript%3a', // javascript:\n 'data%3a', // data:\n ];\n for (const pattern of encodedPatterns) {\n if (lowerUrl.includes(pattern)) {\n throw new InvalidXSLUrlError(xslUrl, 'contains URL-encoded malicious content');\n }\n }\n // Reject unencoded XML special characters — these must be percent-encoded in\n // valid URLs and could break out of XML attribute context if left raw.\n if (xslUrl.includes('\"') || xslUrl.includes('<') || xslUrl.includes('>')) {\n throw new InvalidXSLUrlError(xslUrl, 'contains unencoded XML special characters (\" < >); percent-encode them in the URL');\n }\n}\n/**\n * Internal helper to validate fields against their validators\n */\nfunction validate(subject, name, url, level) {\n Object.keys(subject).forEach((key) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const val = subject[key];\n if (validators[key] && !validators[key].test(val)) {\n if (level === ErrorLevel.THROW) {\n throw new InvalidAttrValue(key, val, validators[key]);\n }\n else {\n console.warn(`${url}: ${name} key ${key} has invalid value: ${val}`);\n }\n }\n });\n}\n/**\n * Internal helper to handle errors based on error level\n */\nfunction handleError(error, level) {\n if (level === ErrorLevel.THROW) {\n throw error;\n }\n else if (level === ErrorLevel.WARN) {\n console.warn(error.name, error.message);\n }\n}\n/**\n * Verifies all data passed in will comply with sitemap spec.\n * @param conf Options to validate\n * @param level logging level\n * @param errorHandler error handling func\n */\nexport function validateSMIOptions(conf, level = ErrorLevel.WARN, errorHandler = handleError) {\n if (!conf) {\n throw new NoConfigError();\n }\n if (level === ErrorLevel.SILENT) {\n return conf;\n }\n const { url, changefreq, priority, news, video } = conf;\n if (!url) {\n errorHandler(new NoURLError(), level);\n }\n if (changefreq) {\n if (!isValidChangeFreq(changefreq)) {\n errorHandler(new ChangeFreqInvalidError(url, changefreq), level);\n }\n }\n if (priority) {\n if (!(priority >= 0.0 && priority <= 1.0)) {\n errorHandler(new PriorityInvalidError(url, priority), level);\n }\n }\n if (news) {\n if (news.access &&\n news.access !== 'Registration' &&\n news.access !== 'Subscription') {\n errorHandler(new InvalidNewsAccessValue(url, news.access), level);\n }\n if (!news.publication ||\n !news.publication.name ||\n !news.publication.language ||\n !news.publication_date ||\n !news.title) {\n errorHandler(new InvalidNewsFormat(url), level);\n }\n validate(news, 'news', url, level);\n validate(news.publication, 'publication', url, level);\n }\n if (video) {\n video.forEach((vid) => {\n if (vid.duration !== undefined) {\n if (vid.duration < 0 || vid.duration > 28800) {\n errorHandler(new InvalidVideoDuration(url, vid.duration), level);\n }\n }\n if (vid.rating !== undefined && (vid.rating < 0 || vid.rating > 5)) {\n errorHandler(new InvalidVideoRating(url, vid.title, vid.rating), level);\n }\n if (typeof vid !== 'object' ||\n !vid.thumbnail_loc ||\n !vid.title ||\n !vid.description) {\n // has to be an object and include required categories https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190\n errorHandler(new InvalidVideoFormat(url), level);\n }\n if (vid.title.length > 100) {\n errorHandler(new InvalidVideoTitle(url, vid.title.length), level);\n }\n if (vid.description.length > 2048) {\n errorHandler(new InvalidVideoDescription(url, vid.description.length), level);\n }\n if (vid.view_count !== undefined && vid.view_count < 0) {\n errorHandler(new InvalidVideoViewCount(url, vid.view_count), level);\n }\n if (vid.tag.length > 32) {\n errorHandler(new InvalidVideoTagCount(url, vid.tag.length), level);\n }\n if (vid.category !== undefined && vid.category?.length > 256) {\n errorHandler(new InvalidVideoCategory(url, vid.category.length), level);\n }\n if (vid.family_friendly !== undefined &&\n !isValidYesNo(vid.family_friendly)) {\n errorHandler(new InvalidVideoFamilyFriendly(url, vid.family_friendly), level);\n }\n if (vid.restriction) {\n if (!validators.restriction.test(vid.restriction)) {\n errorHandler(new InvalidVideoRestriction(url, vid.restriction), level);\n }\n if (!vid['restriction:relationship'] ||\n !isAllowDeny(vid['restriction:relationship'])) {\n errorHandler(new InvalidVideoRestrictionRelationship(url, vid['restriction:relationship']), level);\n }\n }\n // TODO price element should be unbounded\n if ((vid.price === '' && vid['price:type'] === undefined) ||\n (vid['price:type'] !== undefined && !isPriceType(vid['price:type']))) {\n errorHandler(new InvalidVideoPriceType(url, vid['price:type'], vid.price), level);\n }\n if (vid['price:resolution'] !== undefined &&\n !isResolution(vid['price:resolution'])) {\n errorHandler(new InvalidVideoResolution(url, vid['price:resolution']), level);\n }\n if (vid['price:currency'] !== undefined &&\n !validators['price:currency'].test(vid['price:currency'])) {\n errorHandler(new InvalidVideoPriceCurrency(url, vid['price:currency']), level);\n }\n validate(vid, 'video', url, level);\n });\n }\n return conf;\n}\n","/*!\n * Sitemap\n * Copyright(c) 2011 Eugene Kalinin\n * MIT Licensed\n */\nimport { statSync } from 'node:fs';\nimport { Readable, Transform, PassThrough, } from 'node:stream';\nimport { createInterface } from 'node:readline';\nimport { URL } from 'node:url';\nimport { EnumYesNo, } from './types.js';\n// Re-export validateSMIOptions from validation.ts for backward compatibility\nexport { validateSMIOptions } from './validation.js';\n/**\n * Combines multiple streams into one\n * @param streams the streams to combine\n */\nexport function mergeStreams(streams, options) {\n let pass = new PassThrough(options);\n let waiting = streams.length;\n for (const stream of streams) {\n pass = stream.pipe(pass, { end: false });\n stream.once('end', () => --waiting === 0 && pass.emit('end'));\n }\n return pass;\n}\n/**\n * Wraps node's ReadLine in a stream\n */\nexport class ReadlineStream extends Readable {\n _source;\n constructor(options) {\n if (options.autoDestroy === undefined) {\n options.autoDestroy = true;\n }\n options.objectMode = true;\n super(options);\n this._source = createInterface({\n input: options.input,\n terminal: false,\n crlfDelay: Infinity,\n });\n // Every time there's data, push it into the internal buffer.\n this._source.on('line', (chunk) => {\n // If push() returns false, then stop reading from source.\n if (!this.push(chunk))\n this._source.pause();\n });\n // When the source ends, push the EOF-signaling `null` chunk.\n this._source.on('close', () => {\n this.push(null);\n });\n }\n // _read() will be called when the stream wants to pull more data in.\n // The advisory size argument is ignored in this case.\n _read(size) {\n this._source.resume();\n }\n}\n/**\n * Takes a stream likely from fs.createReadStream('./path') and returns a stream\n * of sitemap items\n * @param stream a stream of line separated urls.\n * @param opts.isJSON is the stream line separated JSON. leave undefined to guess\n */\nexport function lineSeparatedURLsToSitemapOptions(stream, { isJSON } = {}) {\n return new ReadlineStream({ input: stream }).pipe(new Transform({\n objectMode: true,\n transform: (line, encoding, cb) => {\n if (isJSON || (isJSON === undefined && line[0] === '{')) {\n cb(null, JSON.parse(line));\n }\n else {\n cb(null, line);\n }\n },\n }));\n}\n/**\n * Based on lodash's implementation of chunk.\n *\n * Copyright JS Foundation and other contributors <https://js.foundation/>\n *\n * Based on Underscore.js, copyright Jeremy Ashkenas,\n * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>\n *\n * This software consists of voluntary contributions made by many\n * individuals. For exact contribution history, see the revision history\n * available at https://github.com/lodash/lodash\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function chunk(array, size = 1) {\n size = Math.max(Math.trunc(size), 0);\n const length = array ? array.length : 0;\n if (!length || size < 1) {\n return [];\n }\n const result = Array(Math.ceil(length / size));\n let index = 0, resIndex = 0;\n while (index < length) {\n result[resIndex++] = array.slice(index, (index += size));\n }\n return result;\n}\nfunction boolToYESNO(bool) {\n if (bool === undefined) {\n return undefined;\n }\n if (typeof bool === 'boolean') {\n return bool ? EnumYesNo.yes : EnumYesNo.no;\n }\n return bool;\n}\n/**\n * Converts the passed in sitemap entry into one capable of being consumed by SitemapItem\n * @param {string | SitemapItemLoose} elem the string or object to be converted\n * @param {string} hostname\n * @returns SitemapItemOptions a strict sitemap item option\n */\nexport function normalizeURL(elem, hostname, lastmodDateOnly = false) {\n // SitemapItem\n // create object with url property\n const smi = {\n img: [],\n video: [],\n links: [],\n url: '',\n };\n if (typeof elem === 'string') {\n smi.url = new URL(elem, hostname).toString();\n return smi;\n }\n const { url, img, links, video, lastmodfile, lastmodISO, lastmod, ...other } = elem;\n Object.assign(smi, other);\n smi.url = new URL(url, hostname).toString();\n if (img) {\n // prepend hostname to all image urls\n smi.img = (Array.isArray(img) ? img : [img]).map((el) => typeof el === 'string'\n ? { url: new URL(el, hostname).toString() }\n : { ...el, url: new URL(el.url, hostname).toString() });\n }\n if (links) {\n smi.links = links.map((link) => ({\n ...link,\n url: new URL(link.url, hostname).toString(),\n }));\n }\n if (video) {\n smi.video = (Array.isArray(video) ? video : [video]).map((video) => {\n const nv = {\n ...video,\n family_friendly: boolToYESNO(video.family_friendly),\n live: boolToYESNO(video.live),\n requires_subscription: boolToYESNO(video.requires_subscription),\n tag: [],\n rating: undefined,\n };\n if (video.tag !== undefined) {\n nv.tag = !Array.isArray(video.tag) ? [video.tag] : video.tag;\n }\n if (video.rating !== undefined) {\n if (typeof video.rating === 'string') {\n const parsedRating = parseFloat(video.rating);\n // Validate parsed rating is a valid number\n if (Number.isNaN(parsedRating)) {\n throw new Error(`Invalid video rating \"${video.rating}\" for URL \"${elem.url}\": must be a valid number`);\n }\n nv.rating = parsedRating;\n }\n else {\n nv.rating = video.rating;\n }\n }\n if (typeof video.view_count === 'string') {\n const parsedViewCount = parseInt(video.view_count, 10);\n // Validate parsed view count is a valid non-negative integer\n if (Number.isNaN(parsedViewCount)) {\n throw new Error(`Invalid video view_count \"${video.view_count}\" for URL \"${elem.url}\": must be a valid number`);\n }\n if (parsedViewCount < 0) {\n throw new Error(`Invalid video view_count \"${video.view_count}\" for URL \"${elem.url}\": cannot be negative`);\n }\n nv.view_count = parsedViewCount;\n }\n else if (typeof video.view_count === 'number') {\n nv.view_count = video.view_count;\n }\n return nv;\n });\n }\n // If given a file to use for last modified date\n if (lastmodfile) {\n const { mtime } = statSync(lastmodfile);\n const lastmodDate = new Date(mtime);\n // Validate date is valid\n if (Number.isNaN(lastmodDate.getTime())) {\n throw new Error(`Invalid date from file stats for URL \"${smi.url}\": file modification time is invalid`);\n }\n smi.lastmod = lastmodDate.toISOString();\n // The date of last modification (YYYY-MM-DD)\n }\n else if (lastmodISO) {\n const lastmodDate = new Date(lastmodISO);\n // Validate date is valid\n if (Number.isNaN(lastmodDate.getTime())) {\n throw new Error(`Invalid lastmodISO \"${lastmodISO}\" for URL \"${smi.url}\": must be a valid date string`);\n }\n smi.lastmod = lastmodDate.toISOString();\n }\n else if (lastmod) {\n const lastmodDate = new Date(lastmod);\n // Validate date is valid\n if (Number.isNaN(lastmodDate.getTime())) {\n throw new Error(`Invalid lastmod \"${lastmod}\" for URL \"${smi.url}\": must be a valid date string`);\n }\n smi.lastmod = lastmodDate.toISOString();\n }\n if (lastmodDateOnly && smi.lastmod) {\n smi.lastmod = smi.lastmod.slice(0, 10);\n }\n return smi;\n}\n","import { Transform, Writable, } from 'node:stream';\nimport { ErrorLevel } from './types.js';\nimport { normalizeURL } from './utils.js';\nimport { validateSMIOptions, validateURL, validateXSLUrl, } from './validation.js';\nimport { SitemapItemStream } from './sitemap-item-stream.js';\nimport { EmptyStream, EmptySitemap } from './errors.js';\nimport { LIMITS } from './constants.js';\nconst xmlDec = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';\nexport const stylesheetInclude = (url) => {\n const safe = url\n .replace(/&/g, '&')\n .replace(/\"/g, '"')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n return `<?xml-stylesheet type=\"text/xsl\" href=\"${safe}\"?>`;\n};\nconst urlsetTagStart = '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"';\n/**\n * Validates custom namespace declarations for security\n * @param custom - Array of custom namespace declarations\n * @throws {Error} If namespace format is invalid or contains malicious content\n */\nfunction validateCustomNamespaces(custom) {\n if (!Array.isArray(custom)) {\n throw new Error('Custom namespaces must be an array');\n }\n // Limit number of custom namespaces to prevent DoS\n if (custom.length > LIMITS.MAX_CUSTOM_NAMESPACES) {\n throw new Error(`Too many custom namespaces: ${custom.length} exceeds limit of ${LIMITS.MAX_CUSTOM_NAMESPACES}`);\n }\n // Basic format validation for xmlns declarations and namespace-qualified attributes\n // Supports both xmlns:prefix=\"uri\" and prefix:attribute=\"value\" (e.g., xsi:schemaLocation)\n const xmlAttributePattern = /^[a-zA-Z_][\\w.-]*:[a-zA-Z_][\\w.-]*=\"[^\"<>]*\"$/;\n for (const ns of custom) {\n if (typeof ns !== 'string' || ns.length === 0) {\n throw new Error('Custom namespace must be a non-empty string');\n }\n if (ns.length > LIMITS.MAX_NAMESPACE_LENGTH) {\n throw new Error(`Custom namespace exceeds maximum length of ${LIMITS.MAX_NAMESPACE_LENGTH} characters: ${ns.substring(0, 50)}...`);\n }\n // Check for potentially malicious content BEFORE format check\n // (format check will reject < and > but we want specific error message)\n const lowerNs = ns.toLowerCase();\n if (lowerNs.includes('<script') ||\n lowerNs.includes('javascript:') ||\n lowerNs.includes('data:text/html')) {\n throw new Error(`Custom namespace contains potentially malicious content: ${ns.substring(0, 50)}`);\n }\n // Check format matches xmlns declaration or namespace-qualified attribute\n if (!xmlAttributePattern.test(ns)) {\n throw new Error(`Invalid namespace format (must be prefix:name=\"value\", e.g., xmlns:prefix=\"uri\" or xsi:schemaLocation=\"...\"): ${ns.substring(0, 50)}`);\n }\n }\n}\nconst getURLSetNs = ({ news, video, image, xhtml, custom }, xslURL) => {\n let ns = xmlDec;\n if (xslURL) {\n ns += stylesheetInclude(xslURL);\n }\n ns += urlsetTagStart;\n if (news) {\n ns += ' xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"';\n }\n if (xhtml) {\n ns += ' xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"';\n }\n if (image) {\n ns += ' xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\"';\n }\n if (video) {\n ns += ' xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"';\n }\n if (custom) {\n validateCustomNamespaces(custom);\n ns += ' ' + custom.join(' ');\n }\n return ns + '>';\n};\nexport const closetag = '</urlset>';\nconst defaultXMLNS = {\n news: true,\n xhtml: true,\n image: true,\n video: true,\n};\nconst defaultStreamOpts = {\n xmlns: defaultXMLNS,\n};\n/**\n * A [Transform](https://nodejs.org/api/stream.html#stream_implementing_a_transform_stream)\n * for turning a\n * [Readable stream](https://nodejs.org/api/stream.html#stream_readable_streams)\n * of either [SitemapItemOptions](#sitemap-item-options) or url strings into a\n * Sitemap. The readable stream it transforms **must** be in object mode.\n *\n * @param {SitemapStreamOptions} opts - Configuration options\n * @param {string} [opts.hostname] - Base URL for relative paths. Must use http:// or https:// protocol\n * @param {ErrorLevel} [opts.level=ErrorLevel.WARN] - Error handling level (SILENT, WARN, or THROW)\n * @param {boolean} [opts.lastmodDateOnly=false] - Format lastmod as date only (YYYY-MM-DD)\n * @param {NSArgs} [opts.xmlns] - Control which XML namespaces to include in output\n * @param {string} [opts.xslUrl] - URL to XSL stylesheet for sitemap display. Must use http:// or https://\n * @param {ErrorHandler} [opts.errorHandler] - Custom error handler function\n *\n * @throws {InvalidHostnameError} If hostname is provided but invalid (non-http(s), malformed, or >2048 chars)\n * @throws {InvalidXSLUrlError} If xslUrl is provided but invalid (non-http(s), malformed, >2048 chars, or contains malicious content)\n * @throws {Error} If xmlns.custom contains invalid namespace declarations\n *\n * @example\n * ```typescript\n * const stream = new SitemapStream({\n * hostname: 'https://example.com',\n * level: ErrorLevel.THROW\n * });\n * stream.write({ url: '/page', changefreq: 'daily' });\n * stream.end();\n * ```\n *\n * @security\n * - Hostname and xslUrl are validated to prevent URL injection attacks\n * - Custom namespaces are validated to prevent XML injection\n * - All URLs are normalized and validated before output\n * - XML content is properly escaped to prevent injection\n */\nexport class SitemapStream extends Transform {\n hostname;\n level;\n hasHeadOutput;\n xmlNS;\n xslUrl;\n errorHandler;\n smiStream;\n lastmodDateOnly;\n constructor(opts = defaultStreamOpts) {\n opts.objectMode = true;\n super(opts);\n // Validate hostname if provided\n if (opts.hostname !== undefined) {\n validateURL(opts.hostname, 'hostname');\n }\n // Validate xslUrl if provided\n if (opts.xslUrl !== undefined) {\n validateXSLUrl(opts.xslUrl);\n }\n this.hasHeadOutput = false;\n this.hostname = opts.hostname;\n this.level = opts.level || ErrorLevel.WARN;\n this.errorHandler = opts.errorHandler;\n this.smiStream = new SitemapItemStream({ level: opts.level });\n this.smiStream.on('data', (data) => this.push(data));\n this.lastmodDateOnly = opts.lastmodDateOnly || false;\n this.xmlNS = opts.xmlns || defaultXMLNS;\n this.xslUrl = opts.xslUrl;\n }\n _transform(item, encoding, callback) {\n if (!this.hasHeadOutput) {\n this.hasHeadOutput = true;\n this.push(getURLSetNs(this.xmlNS, this.xslUrl));\n }\n if (!this.smiStream.write(validateSMIOptions(normalizeURL(item, this.hostname, this.lastmodDateOnly), this.level, this.errorHandler))) {\n this.smiStream.once('drain', callback);\n }\n else {\n process.nextTick(callback);\n }\n }\n _flush(cb) {\n if (!this.hasHeadOutput) {\n cb(new EmptySitemap());\n }\n else {\n this.push(closetag);\n cb();\n }\n }\n}\n/**\n * Converts a readable stream into a promise that resolves with the concatenated data from the stream.\n *\n * The function listens for 'data' events from the stream, and when the stream ends, it resolves the promise with the concatenated data. If an error occurs while reading from the stream, the promise is rejected with the error.\n *\n * ⚠️ CAUTION: This function should not generally be used in production / when writing to files as it holds a copy of the entire file contents in memory until finished.\n *\n * @param {Readable} stream - The readable stream to convert to a promise.\n * @returns {Promise<Buffer>} A promise that resolves with the concatenated data from the stream as a Buffer, or rejects with an error if one occurred while reading from the stream. If the stream is empty, the promise is rejected with an EmptyStream error.\n * @throws {EmptyStream} If the stream is empty.\n */\nexport function streamToPromise(stream) {\n return new Promise((resolve, reject) => {\n const drain = [];\n stream\n // Error propagation is not automatic\n // Bubble up errors on the read stream\n .on('error', reject)\n .pipe(new Writable({\n write(chunk, enc, next) {\n drain.push(chunk);\n next();\n },\n }))\n // This bubbles up errors when writing to the internal buffer\n // This is unlikely to happen, but we have this for completeness\n .on('error', reject)\n .on('finish', () => {\n if (!drain.length) {\n reject(new EmptyStream());\n }\n else {\n resolve(Buffer.concat(drain));\n }\n });\n });\n}\n",";(function (sax) {\n // wrapper for non-node envs\n sax.parser = function (strict, opt) {\n return new SAXParser(strict, opt)\n }\n sax.SAXParser = SAXParser\n sax.SAXStream = SAXStream\n sax.createStream = createStream\n\n // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.\n // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),\n // since that's the earliest that a buffer overrun could occur. This way, checks are\n // as rare as required, but as often as necessary to ensure never crossing this bound.\n // Furthermore, buffers are only tested at most once per write(), so passing a very\n // large string into write() might have undesirable effects, but this is manageable by\n // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme\n // edge case, result in creating at most one complete copy of the string passed in.\n // Set to Infinity to have unlimited buffers.\n sax.MAX_BUFFER_LENGTH = 64 * 1024\n\n var buffers = [\n 'comment',\n 'sgmlDecl',\n 'textNode',\n 'tagName',\n 'doctype',\n 'procInstName',\n 'procInstBody',\n 'entity',\n 'attribName',\n 'attribValue',\n 'cdata',\n 'script',\n ]\n\n sax.EVENTS = [\n 'text',\n 'processinginstruction',\n 'sgmldeclaration',\n 'doctype',\n 'comment',\n 'opentagstart',\n 'attribute',\n 'opentag',\n 'closetag',\n 'opencdata',\n 'cdata',\n 'closecdata',\n 'error',\n 'end',\n 'ready',\n 'script',\n 'opennamespace',\n 'closenamespace',\n ]\n\n function SAXParser(strict, opt) {\n if (!(this instanceof SAXParser)) {\n return new SAXParser(strict, opt)\n }\n\n var parser = this\n clearBuffers(parser)\n parser.q = parser.c = ''\n parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH\n parser.encoding = null;\n parser.opt = opt || {}\n parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags\n parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'\n parser.opt.maxEntityCount = parser.opt.maxEntityCount || 512\n parser.opt.maxEntityDepth = parser.opt.maxEntityDepth || 4\n parser.entityCount = parser.entityDepth = 0\n parser.tags = []\n parser.closed = parser.closedRoot = parser.sawRoot = false\n parser.tag = parser.error = null\n parser.strict = !!strict\n parser.noscript = !!(strict || parser.opt.noscript)\n parser.state = S.BEGIN\n parser.strictEntities = parser.opt.strictEntities\n parser.ENTITIES =\n parser.strictEntities ?\n Object.create(sax.XML_ENTITIES)\n : Object.create(sax.ENTITIES)\n parser.attribList = []\n\n // namespaces form a prototype chain.\n // it always points at the current tag,\n // which protos to its parent tag.\n if (parser.opt.xmlns) {\n parser.ns = Object.create(rootNS)\n }\n\n // disallow unquoted attribute values if not otherwise configured\n // and strict mode is true\n if (parser.opt.unquotedAttributeValues === undefined) {\n parser.opt.unquotedAttributeValues = !strict\n }\n\n // mostly just for error reporting\n parser.trackPosition = parser.opt.position !== false\n if (parser.trackPosition) {\n parser.position = parser.line = parser.column = 0\n }\n emit(parser, 'onready')\n }\n\n if (!Object.create) {\n Object.create = function (o) {\n function F() {}\n F.prototype = o\n var newf = new F()\n return newf\n }\n }\n\n if (!Object.keys) {\n Object.keys = function (o) {\n var a = []\n for (var i in o) if (o.hasOwnProperty(i)) a.push(i)\n return a\n }\n }\n\n function checkBufferLength(parser) {\n var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)\n var maxActual = 0\n for (var i = 0, l = buffers.length; i < l; i++) {\n var len = parser[buffers[i]].length\n if (len > maxAllowed) {\n // Text/cdata nodes can get big, and since they're buffered,\n // we can get here under normal conditions.\n // Avoid issues by emitting the text node now,\n // so at least it won't get any bigger.\n switch (buffers[i]) {\n case 'textNode':\n closeText(parser)\n break\n\n case 'cdata':\n emitNode(parser, 'oncdata', parser.cdata)\n parser.cdata = ''\n break\n\n case 'script':\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n break\n\n default:\n error(parser, 'Max buffer length exceeded: ' + buffers[i])\n }\n }\n maxActual = Math.max(maxActual, len)\n }\n // schedule the next check for the earliest possible buffer overrun.\n var m = sax.MAX_BUFFER_LENGTH - maxActual\n parser.bufferCheckPosition = m + parser.position\n }\n\n function clearBuffers(parser) {\n for (var i = 0, l = buffers.length; i < l; i++) {\n parser[buffers[i]] = ''\n }\n }\n\n function flushBuffers(parser) {\n closeText(parser)\n if (parser.cdata !== '') {\n emitNode(parser, 'oncdata', parser.cdata)\n parser.cdata = ''\n }\n if (parser.script !== '') {\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n }\n }\n\n SAXParser.prototype = {\n end: function () {\n end(this)\n },\n write: write,\n resume: function () {\n this.error = null\n return this\n },\n close: function () {\n return this.write(null)\n },\n flush: function () {\n flushBuffers(this)\n },\n }\n\n var Stream\n try {\n Stream = require('stream').Stream\n } catch (ex) {\n Stream = function () {}\n }\n if (!Stream) Stream = function () {}\n\n var streamWraps = sax.EVENTS.filter(function (ev) {\n return ev !== 'error' && ev !== 'end'\n })\n\n function createStream(strict, opt) {\n return new SAXStream(strict, opt)\n }\n\n function determineBufferEncoding(data, isEnd) {\n // BOM-based detection is the most reliable signal when present.\n if (data.length >= 2) {\n if (data[0] === 0xff && data[1] === 0xfe) {\n return 'utf-16le'\n }\n\n if (data[0] === 0xfe && data[1] === 0xff) {\n return 'utf-16be'\n }\n }\n\n if (data.length >= 3 && data[0] === 0xef && data[1] === 0xbb && data[2] === 0xbf) {\n return 'utf8'\n }\n\n if (data.length >= 4) {\n // XML documents without a BOM still start with \"<?xml\", which is enough\n // to distinguish UTF-16LE/BE from UTF-8 by looking at the zero bytes.\n if (data[0] === 0x3c && data[1] === 0x00 && data[2] === 0x3f && data[3] === 0x00) {\n return 'utf-16le'\n }\n\n if (data[0] === 0x00 && data[1] === 0x3c && data[2] === 0x00 && data[3] === 0x3f) {\n return 'utf-16be'\n }\n\n return 'utf8'\n }\n\n return isEnd ? 'utf8' : null\n }\n\n function SAXStream(strict, opt) {\n if (!(this instanceof SAXStream)) {\n return new SAXStream(strict, opt)\n }\n\n Stream.apply(this)\n\n this._parser = new SAXParser(strict, opt)\n this.writable = true\n this.readable = true\n\n var me = this\n\n this._parser.onend = function () {\n me.emit('end')\n }\n\n this._parser.onerror = function (er) {\n me.emit('error', er)\n\n // if didn't throw, then means error was handled.\n // go ahead and clear error, so we can write again.\n me._parser.error = null\n }\n\n this._decoder = null\n this._decoderBuffer = null\n streamWraps.forEach(function (ev) {\n Object.defineProperty(me, 'on' + ev, {\n get: function () {\n return me._parser['on' + ev]\n },\n set: function (h) {\n if (!h) {\n me.removeAllListeners(ev)\n me._parser['on' + ev] = h\n return h\n }\n me.on(ev, h)\n },\n enumerable: true,\n configurable: false,\n })\n })\n }\n\n SAXStream.prototype = Object.create(Stream.prototype, {\n constructor: {\n value: SAXStream,\n },\n })\n\n SAXStream.prototype._decodeBuffer = function (data, isEnd) {\n if (this._decoderBuffer) {\n // Keep incomplete leading bytes until we have enough data to infer the\n // stream encoding, then decode the buffered prefix together with the next chunk.\n data = Buffer.concat([this._decoderBuffer, data])\n this._decoderBuffer = null\n }\n\n if (!this._decoder) {\n var encoding = determineBufferEncoding(data, isEnd)\n if (!encoding) {\n // A very short first chunk may not contain enough bytes to detect the\n // encoding yet, so defer decoding until the next write/end call.\n this._decoderBuffer = data\n return ''\n }\n\n // Store the detected transport encoding so strict mode can compare it\n // with the optional encoding declared in the XML prolog later on.\n this._parser.encoding = encoding\n this._decoder = new TextDecoder(encoding)\n }\n\n return this._decoder.decode(data, { stream: !isEnd })\n }\n\n SAXStream.prototype.write = function (data) {\n if (\n typeof Buffer === 'function' &&\n typeof Buffer.isBuffer === 'function' &&\n Buffer.isBuffer(data)\n ) {\n data = this._decodeBuffer(data, false)\n } else if (this._decoderBuffer) {\n // Flush any buffered binary prefix before handling a string chunk.\n // This only matters if the caller mixes Buffer and string writes (used in test).\n var remaining = this._decodeBuffer(Buffer.alloc(0), true)\n if (remaining) {\n this._parser.write(remaining)\n this.emit('data', remaining)\n }\n }\n\n this._parser.write(data.toString())\n this.emit('data', data)\n return true\n }\n\n SAXStream.prototype.end = function (chunk) {\n if (chunk && chunk.length) {\n this.write(chunk)\n }\n // Flush any remaining decoded data from the TextDecoder\n if (this._decoderBuffer) {\n var finalChunk = this._decodeBuffer(Buffer.alloc(0), true)\n if (finalChunk) {\n this._parser.write(finalChunk)\n this.emit('data', finalChunk)\n }\n } else if (this._decoder) {\n var remaining = this._decoder.decode()\n if (remaining) {\n this._parser.write(remaining)\n this.emit('data', remaining)\n }\n }\n this._parser.end()\n return true\n }\n\n SAXStream.prototype.on = function (ev, handler) {\n var me = this\n if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {\n me._parser['on' + ev] = function () {\n var args =\n arguments.length === 1 ?\n [arguments[0]]\n : Array.apply(null, arguments)\n args.splice(0, 0, ev)\n me.emit.apply(me, args)\n }\n }\n\n return Stream.prototype.on.call(me, ev, handler)\n }\n\n // this really needs to be replaced with character classes.\n // XML allows all manner of ridiculous numbers and digits.\n var CDATA = '[CDATA['\n var DOCTYPE = 'DOCTYPE'\n var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'\n var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'\n var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }\n\n // http://www.w3.org/TR/REC-xml/#NT-NameStartChar\n // This implementation works on strings, a single character at a time\n // as such, it cannot ever support astral-plane characters (10000-EFFFF)\n // without a significant breaking change to either this parser, or the\n // JavaScript language. Implementation of an emoji-capable xml parser\n // is left as an exercise for the reader.\n var nameStart =\n /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n\n var nameBody =\n /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/\n\n var entityStart =\n /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n var entityBody =\n /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040.\\d-]/\n\n function isWhitespace(c) {\n return c === ' ' || c === '\\n' || c === '\\r' || c === '\\t'\n }\n\n function isQuote(c) {\n return c === '\"' || c === \"'\"\n }\n\n function isAttribEnd(c) {\n return c === '>' || isWhitespace(c)\n }\n\n function isMatch(regex, c) {\n return regex.test(c)\n }\n\n function notMatch(regex, c) {\n return !isMatch(regex, c)\n }\n\n var S = 0\n sax.STATE = {\n BEGIN: S++, // leading byte order mark or whitespace\n BEGIN_WHITESPACE: S++, // leading whitespace\n TEXT: S++, // general stuff\n TEXT_ENTITY: S++, // & and such.\n OPEN_WAKA: S++, // <\n SGML_DECL: S++, // <!BLARG\n SGML_DECL_QUOTED: S++, // <!BLARG foo \"bar\n DOCTYPE: S++, // <!DOCTYPE\n DOCTYPE_QUOTED: S++, // <!DOCTYPE \"//blah\n DOCTYPE_DTD: S++, // <!DOCTYPE \"//blah\" [ ...\n DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE \"//blah\" [ \"foo\n COMMENT_STARTING: S++, // <!-\n COMMENT: S++, // <!--\n COMMENT_ENDING: S++, // <!-- blah -\n COMMENT_ENDED: S++, // <!-- blah --\n CDATA: S++, // <![CDATA[ something\n CDATA_ENDING: S++, // ]\n CDATA_ENDING_2: S++, // ]]\n PROC_INST: S++, // <?hi\n PROC_INST_BODY: S++, // <?hi there\n PROC_INST_ENDING: S++, // <?hi \"there\" ?\n OPEN_TAG: S++, // <strong\n OPEN_TAG_SLASH: S++, // <strong /\n ATTRIB: S++, // <a\n ATTRIB_NAME: S++, // <a foo\n ATTRIB_NAME_SAW_WHITE: S++, // <a foo _\n ATTRIB_VALUE: S++, // <a foo=\n ATTRIB_VALUE_QUOTED: S++, // <a foo=\"bar\n ATTRIB_VALUE_CLOSED: S++, // <a foo=\"bar\"\n ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar\n ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar=\""\"\n ATTRIB_VALUE_ENTITY_U: S++, // <foo bar="\n CLOSE_TAG: S++, // </a\n CLOSE_TAG_SAW_WHITE: S++, // </a >\n SCRIPT: S++, // <script> ...\n SCRIPT_ENDING: S++, // <script> ... <\n }\n\n sax.XML_ENTITIES = {\n amp: '&',\n gt: '>',\n lt: '<',\n quot: '\"',\n apos: \"'\",\n }\n\n sax.ENTITIES = {\n amp: '&',\n gt: '>',\n lt: '<',\n quot: '\"',\n apos: \"'\",\n AElig: 198,\n Aacute: 193,\n Acirc: 194,\n Agrave: 192,\n Aring: 197,\n Atilde: 195,\n Auml: 196,\n Ccedil: 199,\n ETH: 208,\n Eacute: 201,\n Ecirc: 202,\n Egrave: 200,\n Euml: 203,\n Iacute: 205,\n Icirc: 206,\n Igrave: 204,\n Iuml: 207,\n Ntilde: 209,\n Oacute: 211,\n Ocirc: 212,\n Ograve: 210,\n Oslash: 216,\n Otilde: 213,\n Ouml: 214,\n THORN: 222,\n Uacute: 218,\n Ucirc: 219,\n Ugrave: 217,\n Uuml: 220,\n Yacute: 221,\n aacute: 225,\n acirc: 226,\n aelig: 230,\n agrave: 224,\n aring: 229,\n atilde: 227,\n auml: 228,\n ccedil: 231,\n eacute: 233,\n ecirc: 234,\n egrave: 232,\n eth: 240,\n euml: 235,\n iacute: 237,\n icirc: 238,\n igrave: 236,\n iuml: 239,\n ntilde: 241,\n oacute: 243,\n ocirc: 244,\n ograve: 242,\n oslash: 248,\n otilde: 245,\n ouml: 246,\n szlig: 223,\n thorn: 254,\n uacute: 250,\n ucirc: 251,\n ugrave: 249,\n uuml: 252,\n yacute: 253,\n yuml: 255,\n copy: 169,\n reg: 174,\n nbsp: 160,\n iexcl: 161,\n cent: 162,\n pound: 163,\n curren: 164,\n yen: 165,\n brvbar: 166,\n sect: 167,\n uml: 168,\n ordf: 170,\n laquo: 171,\n not: 172,\n shy: 173,\n macr: 175,\n deg: 176,\n plusmn: 177,\n sup1: 185,\n sup2: 178,\n sup3: 179,\n acute: 180,\n micro: 181,\n para: 182,\n middot: 183,\n cedil: 184,\n ordm: 186,\n raquo: 187,\n frac14: 188,\n frac12: 189,\n frac34: 190,\n iquest: 191,\n times: 215,\n divide: 247,\n OElig: 338,\n oelig: 339,\n Scaron: 352,\n scaron: 353,\n Yuml: 376,\n fnof: 402,\n circ: 710,\n tilde: 732,\n Alpha: 913,\n Beta: 914,\n Gamma: 915,\n Delta: 916,\n Epsilon: 917,\n Zeta: 918,\n Eta: 919,\n Theta: 920,\n Iota: 921,\n Kappa: 922,\n Lambda: 923,\n Mu: 924,\n Nu: 925,\n Xi: 926,\n Omicron: 927,\n Pi: 928,\n Rho: 929,\n Sigma: 931,\n Tau: 932,\n Upsilon: 933,\n Phi: 934,\n Chi: 935,\n Psi: 936,\n Omega: 937,\n alpha: 945,\n beta: 946,\n gamma: 947,\n delta: 948,\n epsilon: 949,\n zeta: 950,\n eta: 951,\n theta: 952,\n iota: 953,\n kappa: 954,\n lambda: 955,\n mu: 956,\n nu: 957,\n xi: 958,\n omicron: 959,\n pi: 960,\n rho: 961,\n sigmaf: 962,\n sigma: 963,\n tau: 964,\n upsilon: 965,\n phi: 966,\n chi: 967,\n psi: 968,\n omega: 969,\n thetasym: 977,\n upsih: 978,\n piv: 982,\n ensp: 8194,\n emsp: 8195,\n thinsp: 8201,\n zwnj: 8204,\n zwj: 8205,\n lrm: 8206,\n rlm: 8207,\n ndash: 8211,\n mdash: 8212,\n lsquo: 8216,\n rsquo: 8217,\n sbquo: 8218,\n ldquo: 8220,\n rdquo: 8221,\n bdquo: 8222,\n dagger: 8224,\n Dagger: 8225,\n bull: 8226,\n hellip: 8230,\n permil: 8240,\n prime: 8242,\n Prime: 8243,\n lsaquo: 8249,\n rsaquo: 8250,\n oline: 8254,\n frasl: 8260,\n euro: 8364,\n image: 8465,\n weierp: 8472,\n real: 8476,\n trade: 8482,\n alefsym: 8501,\n larr: 8592,\n uarr: 8593,\n rarr: 8594,\n darr: 8595,\n harr: 8596,\n crarr: 8629,\n lArr: 8656,\n uArr: 8657,\n rArr: 8658,\n dArr: 8659,\n hArr: 8660,\n forall: 8704,\n part: 8706,\n exist: 8707,\n empty: 8709,\n nabla: 8711,\n isin: 8712,\n notin: 8713,\n ni: 8715,\n prod: 8719,\n sum: 8721,\n minus: 8722,\n lowast: 8727,\n radic: 8730,\n prop: 8733,\n infin: 8734,\n ang: 8736,\n and: 8743,\n or: 8744,\n cap: 8745,\n cup: 8746,\n int: 8747,\n there4: 8756,\n sim: 8764,\n cong: 8773,\n asymp: 8776,\n ne: 8800,\n equiv: 8801,\n le: 8804,\n ge: 8805,\n sub: 8834,\n sup: 8835,\n nsub: 8836,\n sube: 8838,\n supe: 8839,\n oplus: 8853,\n otimes: 8855,\n perp: 8869,\n sdot: 8901,\n lceil: 8968,\n rceil: 8969,\n lfloor: 8970,\n rfloor: 8971,\n lang: 9001,\n rang: 9002,\n loz: 9674,\n spades: 9824,\n clubs: 9827,\n hearts: 9829,\n diams: 9830,\n }\n\n Object.keys(sax.ENTITIES).forEach(function (key) {\n var e = sax.ENTITIES[key]\n var s = typeof e === 'number' ? String.fromCharCode(e) : e\n sax.ENTITIES[key] = s\n })\n\n for (var s in sax.STATE) {\n sax.STATE[sax.STATE[s]] = s\n }\n\n // shorthand\n S = sax.STATE\n\n function emit(parser, event, data) {\n parser[event] && parser[event](data)\n }\n\n function getDeclaredEncoding(body) {\n var match = body && body.match(/(?:^|\\s)encoding\\s*=\\s*(['\"])([^'\"]+)\\1/i)\n return match ? match[2] : null\n }\n\n function normalizeEncodingName(encoding) {\n if (!encoding) {\n return null\n }\n\n return encoding.toLowerCase().replace(/[^a-z0-9]/g, '')\n }\n\n function encodingsMatch(detectedEncoding, declaredEncoding) {\n const detected = normalizeEncodingName(detectedEncoding)\n const declared = normalizeEncodingName(declaredEncoding)\n\n if (!detected || !declared) {\n return true\n }\n\n if (declared === 'utf16') {\n return detected === 'utf16le' || detected === 'utf16be'\n }\n\n return detected === declared\n }\n\n function validateXmlDeclarationEncoding(parser, data) {\n if (\n !parser.strict ||\n !parser.encoding ||\n !data ||\n data.name !== 'xml'\n ) {\n return\n }\n\n var declaredEncoding = getDeclaredEncoding(data.body)\n if (\n declaredEncoding &&\n !encodingsMatch(parser.encoding, declaredEncoding)\n ) {\n strictFail(\n parser,\n 'XML declaration encoding ' +\n declaredEncoding +\n ' does not match detected stream encoding ' +\n parser.encoding.toUpperCase()\n )\n }\n }\n\n function emitNode(parser, nodeType, data) {\n if (parser.textNode) closeText(parser)\n emit(parser, nodeType, data)\n }\n\n function closeText(parser) {\n parser.textNode = textopts(parser.opt, parser.textNode)\n if (parser.textNode) emit(parser, 'ontext', parser.textNode)\n parser.textNode = ''\n }\n\n function textopts(opt, text) {\n if (opt.trim) text = text.trim()\n if (opt.normalize) text = text.replace(/\\s+/g, ' ')\n return text\n }\n\n function error(parser, er) {\n closeText(parser)\n if (parser.trackPosition) {\n er +=\n '\\nLine: ' +\n parser.line +\n '\\nColumn: ' +\n parser.column +\n '\\nChar: ' +\n parser.c\n }\n er = new Error(er)\n parser.error = er\n emit(parser, 'onerror', er)\n return parser\n }\n\n function end(parser) {\n if (parser.sawRoot && !parser.closedRoot)\n strictFail(parser, 'Unclosed root tag')\n if (\n parser.state !== S.BEGIN &&\n parser.state !== S.BEGIN_WHITESPACE &&\n parser.state !== S.TEXT\n ) {\n error(parser, 'Unexpected end')\n }\n closeText(parser)\n parser.c = ''\n parser.closed = true\n emit(parser, 'onend')\n SAXParser.call(parser, parser.strict, parser.opt)\n return parser\n }\n\n function strictFail(parser, message) {\n if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {\n throw new Error('bad call to strictFail')\n }\n if (parser.strict) {\n error(parser, message)\n }\n }\n\n function newTag(parser) {\n if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()\n var parent = parser.tags[parser.tags.length - 1] || parser\n var tag = (parser.tag = { name: parser.tagName, attributes: {} })\n\n // will be overridden if tag contails an xmlns=\"foo\" or xmlns:foo=\"bar\"\n if (parser.opt.xmlns) {\n tag.ns = parent.ns\n }\n parser.attribList.length = 0\n emitNode(parser, 'onopentagstart', tag)\n }\n\n function qname(name, attribute) {\n var i = name.indexOf(':')\n var qualName = i < 0 ? ['', name] : name.split(':')\n var prefix = qualName[0]\n var local = qualName[1]\n\n // <x \"xmlns\"=\"http://foo\">\n if (attribute && name === 'xmlns') {\n prefix = 'xmlns'\n local = ''\n }\n\n return { prefix: prefix, local: local }\n }\n\n function attrib(parser) {\n if (!parser.strict) {\n parser.attribName = parser.attribName[parser.looseCase]()\n }\n\n if (\n parser.attribList.indexOf(parser.attribName) !== -1 ||\n parser.tag.attributes.hasOwnProperty(parser.attribName)\n ) {\n parser.attribName = parser.attribValue = ''\n return\n }\n\n if (parser.opt.xmlns) {\n var qn = qname(parser.attribName, true)\n var prefix = qn.prefix\n var local = qn.local\n\n if (prefix === 'xmlns') {\n // namespace binding attribute. push the binding into scope\n if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {\n strictFail(\n parser,\n 'xml: prefix must be bound to ' +\n XML_NAMESPACE +\n '\\n' +\n 'Actual: ' +\n parser.attribValue\n )\n } else if (\n local === 'xmlns' &&\n parser.attribValue !== XMLNS_NAMESPACE\n ) {\n strictFail(\n parser,\n 'xmlns: prefix must be bound to ' +\n XMLNS_NAMESPACE +\n '\\n' +\n 'Actual: ' +\n parser.attribValue\n )\n } else {\n var tag = parser.tag\n var parent = parser.tags[parser.tags.length - 1] || parser\n if (tag.ns === parent.ns) {\n tag.ns = Object.create(parent.ns)\n }\n tag.ns[local] = parser.attribValue\n }\n }\n\n // defer onattribute events until all attributes have been seen\n // so any new bindings can take effect. preserve attribute order\n // so deferred events can be emitted in document order\n parser.attribList.push([parser.attribName, parser.attribValue])\n } else {\n // in non-xmlns mode, we can emit the event right away\n parser.tag.attributes[parser.attribName] = parser.attribValue\n emitNode(parser, 'onattribute', {\n name: parser.attribName,\n value: parser.attribValue,\n })\n }\n\n parser.attribName = parser.attribValue = ''\n }\n\n function openTag(parser, selfClosing) {\n if (parser.opt.xmlns) {\n // emit namespace binding events\n var tag = parser.tag\n\n // add namespace info to tag\n var qn = qname(parser.tagName)\n tag.prefix = qn.prefix\n tag.local = qn.local\n tag.uri = tag.ns[qn.prefix] || ''\n\n if (tag.prefix && !tag.uri) {\n strictFail(\n parser,\n 'Unbound namespace prefix: ' + JSON.stringify(parser.tagName)\n )\n tag.uri = qn.prefix\n }\n\n var parent = parser.tags[parser.tags.length - 1] || parser\n if (tag.ns && parent.ns !== tag.ns) {\n Object.keys(tag.ns).forEach(function (p) {\n emitNode(parser, 'onopennamespace', {\n prefix: p,\n uri: tag.ns[p],\n })\n })\n }\n\n // handle deferred onattribute events\n // Note: do not apply default ns to attributes:\n // http://www.w3.org/TR/REC-xml-names/#defaulting\n for (var i = 0, l = parser.attribList.length; i < l; i++) {\n var nv = parser.attribList[i]\n var name = nv[0]\n var value = nv[1]\n var qualName = qname(name, true)\n var prefix = qualName.prefix\n var local = qualName.local\n var uri = prefix === '' ? '' : tag.ns[prefix] || ''\n var a = {\n name: name,\n value: value,\n prefix: prefix,\n local: local,\n uri: uri,\n }\n\n // if there's any attributes with an undefined namespace,\n // then fail on them now.\n if (prefix && prefix !== 'xmlns' && !uri) {\n strictFail(\n parser,\n 'Unbound namespace prefix: ' + JSON.stringify(prefix)\n )\n a.uri = prefix\n }\n parser.tag.attributes[name] = a\n emitNode(parser, 'onattribute', a)\n }\n parser.attribList.length = 0\n }\n\n parser.tag.isSelfClosing = !!selfClosing\n\n // process the tag\n parser.sawRoot = true\n parser.tags.push(parser.tag)\n emitNode(parser, 'onopentag', parser.tag)\n if (!selfClosing) {\n // special case for <script> in non-strict mode.\n if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {\n parser.state = S.SCRIPT\n } else {\n parser.state = S.TEXT\n }\n parser.tag = null\n parser.tagName = ''\n }\n parser.attribName = parser.attribValue = ''\n parser.attribList.length = 0\n }\n\n function closeTag(parser) {\n if (!parser.tagName) {\n strictFail(parser, 'Weird empty close tag.')\n parser.textNode += '</>'\n parser.state = S.TEXT\n return\n }\n\n if (parser.script) {\n if (parser.tagName !== 'script') {\n parser.script += '</' + parser.tagName + '>'\n parser.tagName = ''\n parser.state = S.SCRIPT\n return\n }\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n }\n\n // first make sure that the closing tag actually exists.\n // <a><b></c></b></a> will close everything, otherwise.\n var t = parser.tags.length\n var tagName = parser.tagName\n if (!parser.strict) {\n tagName = tagName[parser.looseCase]()\n }\n var closeTo = tagName\n while (t--) {\n var close = parser.tags[t]\n if (close.name !== closeTo) {\n // fail the first time in strict mode\n strictFail(parser, 'Unexpected close tag')\n } else {\n break\n }\n }\n\n // didn't find it. we already failed for strict, so just abort.\n if (t < 0) {\n strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)\n parser.textNode += '</' + parser.tagName + '>'\n parser.state = S.TEXT\n return\n }\n parser.tagName = tagName\n var s = parser.tags.length\n while (s-- > t) {\n var tag = (parser.tag = parser.tags.pop())\n parser.tagName = parser.tag.name\n emitNode(parser, 'onclosetag', parser.tagName)\n\n var x = {}\n for (var i in tag.ns) {\n x[i] = tag.ns[i]\n }\n\n var parent = parser.tags[parser.tags.length - 1] || parser\n if (parser.opt.xmlns && tag.ns !== parent.ns) {\n // remove namespace bindings introduced by tag\n Object.keys(tag.ns).forEach(function (p) {\n var n = tag.ns[p]\n emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })\n })\n }\n }\n if (t === 0) parser.closedRoot = true\n parser.tagName = parser.attribValue = parser.attribName = ''\n parser.attribList.length = 0\n parser.state = S.TEXT\n }\n\n function parseEntity(parser) {\n var entity = parser.entity\n var entityLC = entity.toLowerCase()\n var num\n var numStr = ''\n\n if (parser.ENTITIES[entity]) {\n return parser.ENTITIES[entity]\n }\n if (parser.ENTITIES[entityLC]) {\n return parser.ENTITIES[entityLC]\n }\n entity = entityLC\n if (entity.charAt(0) === '#') {\n if (entity.charAt(1) === 'x') {\n entity = entity.slice(2)\n num = parseInt(entity, 16)\n numStr = num.toString(16)\n } else {\n entity = entity.slice(1)\n num = parseInt(entity, 10)\n numStr = num.toString(10)\n }\n }\n entity = entity.replace(/^0+/, '')\n if (\n isNaN(num) ||\n numStr.toLowerCase() !== entity ||\n num < 0 ||\n num > 0x10ffff\n ) {\n strictFail(parser, 'Invalid character entity')\n return '&' + parser.entity + ';'\n }\n\n return String.fromCodePoint(num)\n }\n\n function beginWhiteSpace(parser, c) {\n if (c === '<') {\n parser.state = S.OPEN_WAKA\n parser.startTagPosition = parser.position\n } else if (!isWhitespace(c)) {\n // have to process this as a text node.\n // weird, but happens.\n strictFail(parser, 'Non-whitespace before first tag.')\n parser.textNode = c\n parser.state = S.TEXT\n }\n }\n\n function charAt(chunk, i) {\n var result = ''\n if (i < chunk.length) {\n result = chunk.charAt(i)\n }\n return result\n }\n\n function write(chunk) {\n var parser = this\n if (this.error) {\n throw this.error\n }\n if (parser.closed) {\n return error(\n parser,\n 'Cannot write after close. Assign an onready handler.'\n )\n }\n if (chunk === null) {\n return end(parser)\n }\n if (typeof chunk === 'object') {\n chunk = chunk.toString()\n }\n var i = 0\n var c = ''\n while (true) {\n c = charAt(chunk, i++)\n parser.c = c\n\n if (!c) {\n break\n }\n\n if (parser.trackPosition) {\n parser.position++\n if (c === '\\n') {\n parser.line++\n parser.column = 0\n } else {\n parser.column++\n }\n }\n\n switch (parser.state) {\n case S.BEGIN:\n parser.state = S.BEGIN_WHITESPACE\n if (c === '\\uFEFF') {\n continue\n }\n beginWhiteSpace(parser, c)\n continue\n\n case S.BEGIN_WHITESPACE:\n beginWhiteSpace(parser, c)\n continue\n\n case S.TEXT:\n if (parser.sawRoot && !parser.closedRoot) {\n var starti = i - 1\n while (c && c !== '<' && c !== '&') {\n c = charAt(chunk, i++)\n if (c && parser.trackPosition) {\n parser.position++\n if (c === '\\n') {\n parser.line++\n parser.column = 0\n } else {\n parser.column++\n }\n }\n }\n parser.textNode += chunk.substring(starti, i - 1)\n }\n if (\n c === '<' &&\n !(parser.sawRoot && parser.closedRoot && !parser.strict)\n ) {\n parser.state = S.OPEN_WAKA\n parser.startTagPosition = parser.position\n } else {\n if (\n !isWhitespace(c) &&\n (!parser.sawRoot || parser.closedRoot)\n ) {\n strictFail(parser, 'Text data outside of root node.')\n }\n if (c === '&') {\n parser.state = S.TEXT_ENTITY\n } else {\n parser.textNode += c\n }\n }\n continue\n\n case S.SCRIPT:\n // only non-strict\n if (c === '<') {\n parser.state = S.SCRIPT_ENDING\n } else {\n parser.script += c\n }\n continue\n\n case S.SCRIPT_ENDING:\n if (c === '/') {\n parser.state = S.CLOSE_TAG\n } else {\n parser.script += '<' + c\n parser.state = S.SCRIPT\n }\n continue\n\n case S.OPEN_WAKA:\n // either a /, ?, !, or text is coming next.\n if (c === '!') {\n parser.state = S.SGML_DECL\n parser.sgmlDecl = ''\n } else if (isWhitespace(c)) {\n // wait for it...\n } else if (isMatch(nameStart, c)) {\n parser.state = S.OPEN_TAG\n parser.tagName = c\n } else if (c === '/') {\n parser.state = S.CLOSE_TAG\n parser.tagName = ''\n } else if (c === '?') {\n parser.state = S.PROC_INST\n parser.procInstName = parser.procInstBody = ''\n } else {\n strictFail(parser, 'Unencoded <')\n // if there was some whitespace, then add that in.\n if (parser.startTagPosition + 1 < parser.position) {\n var pad = parser.position - parser.startTagPosition\n c = new Array(pad).join(' ') + c\n }\n parser.textNode += '<' + c\n parser.state = S.TEXT\n }\n continue\n\n case S.SGML_DECL:\n if (parser.sgmlDecl + c === '--') {\n parser.state = S.COMMENT\n parser.comment = ''\n parser.sgmlDecl = ''\n continue\n }\n\n if (\n parser.doctype &&\n parser.doctype !== true &&\n parser.sgmlDecl\n ) {\n parser.state = S.DOCTYPE_DTD\n parser.doctype += '<!' + parser.sgmlDecl + c\n parser.sgmlDecl = ''\n } else if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {\n emitNode(parser, 'onopencdata')\n parser.state = S.CDATA\n parser.sgmlDecl = ''\n parser.cdata = ''\n } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {\n parser.state = S.DOCTYPE\n if (parser.doctype || parser.sawRoot) {\n strictFail(\n parser,\n 'Inappropriately located doctype declaration'\n )\n }\n parser.doctype = ''\n parser.sgmlDecl = ''\n } else if (c === '>') {\n emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)\n parser.sgmlDecl = ''\n parser.state = S.TEXT\n } else if (isQuote(c)) {\n parser.state = S.SGML_DECL_QUOTED\n parser.sgmlDecl += c\n } else {\n parser.sgmlDecl += c\n }\n continue\n\n case S.SGML_DECL_QUOTED:\n if (c === parser.q) {\n parser.state = S.SGML_DECL\n parser.q = ''\n }\n parser.sgmlDecl += c\n continue\n\n case S.DOCTYPE:\n if (c === '>') {\n parser.state = S.TEXT\n emitNode(parser, 'ondoctype', parser.doctype)\n parser.doctype = true // just remember that we saw it.\n } else {\n parser.doctype += c\n if (c === '[') {\n parser.state = S.DOCTYPE_DTD\n } else if (isQuote(c)) {\n parser.state = S.DOCTYPE_QUOTED\n parser.q = c\n }\n }\n continue\n\n case S.DOCTYPE_QUOTED:\n parser.doctype += c\n if (c === parser.q) {\n parser.q = ''\n parser.state = S.DOCTYPE\n }\n continue\n\n case S.DOCTYPE_DTD:\n if (c === ']') {\n parser.doctype += c\n parser.state = S.DOCTYPE\n } else if (c === '<') {\n parser.state = S.OPEN_WAKA\n parser.startTagPosition = parser.position\n } else if (isQuote(c)) {\n parser.doctype += c\n parser.state = S.DOCTYPE_DTD_QUOTED\n parser.q = c\n } else {\n parser.doctype += c\n }\n continue\n\n case S.DOCTYPE_DTD_QUOTED:\n parser.doctype += c\n if (c === parser.q) {\n parser.state = S.DOCTYPE_DTD\n parser.q = ''\n }\n continue\n\n case S.COMMENT:\n if (c === '-') {\n parser.state = S.COMMENT_ENDING\n } else {\n parser.comment += c\n }\n continue\n\n case S.COMMENT_ENDING:\n if (c === '-') {\n parser.state = S.COMMENT_ENDED\n parser.comment = textopts(parser.opt, parser.comment)\n if (parser.comment) {\n emitNode(parser, 'oncomment', parser.comment)\n }\n parser.comment = ''\n } else {\n parser.comment += '-' + c\n parser.state = S.COMMENT\n }\n continue\n\n case S.COMMENT_ENDED:\n if (c !== '>') {\n strictFail(parser, 'Malformed comment')\n // allow <!-- blah -- bloo --> in non-strict mode,\n // which is a comment of \" blah -- bloo \"\n parser.comment += '--' + c\n parser.state = S.COMMENT\n } else if (parser.doctype && parser.doctype !== true) {\n parser.state = S.DOCTYPE_DTD\n } else {\n parser.state = S.TEXT\n }\n continue\n\n case S.CDATA:\n var starti = i - 1\n while (c && c !== ']') {\n c = charAt(chunk, i++)\n if (c && parser.trackPosition) {\n parser.position++\n if (c === '\\n') {\n parser.line++\n parser.column = 0\n } else {\n parser.column++\n }\n }\n }\n parser.cdata += chunk.substring(starti, i - 1)\n if (c === ']') {\n parser.state = S.CDATA_ENDING\n }\n continue\n\n case S.CDATA_ENDING:\n if (c === ']') {\n parser.state = S.CDATA_ENDING_2\n } else {\n parser.cdata += ']' + c\n parser.state = S.CDATA\n }\n continue\n\n case S.CDATA_ENDING_2:\n if (c === '>') {\n if (parser.cdata) {\n emitNode(parser, 'oncdata', parser.cdata)\n }\n emitNode(parser, 'onclosecdata')\n parser.cdata = ''\n parser.state = S.TEXT\n } else if (c === ']') {\n parser.cdata += ']'\n } else {\n parser.cdata += ']]' + c\n parser.state = S.CDATA\n }\n continue\n\n case S.PROC_INST:\n if (c === '?') {\n parser.state = S.PROC_INST_ENDING\n } else if (isWhitespace(c)) {\n parser.state = S.PROC_INST_BODY\n } else {\n parser.procInstName += c\n }\n continue\n\n case S.PROC_INST_BODY:\n if (!parser.procInstBody && isWhitespace(c)) {\n continue\n } else if (c === '?') {\n parser.state = S.PROC_INST_ENDING\n } else {\n parser.procInstBody += c\n }\n continue\n\n case S.PROC_INST_ENDING:\n if (c === '>') {\n const procInstEndData = {\n name: parser.procInstName,\n body: parser.procInstBody,\n }\n validateXmlDeclarationEncoding(parser, procInstEndData)\n emitNode(parser, 'onprocessinginstruction', procInstEndData)\n parser.procInstName = parser.procInstBody = ''\n parser.state = S.TEXT\n } else {\n parser.procInstBody += '?' + c\n parser.state = S.PROC_INST_BODY\n }\n continue\n\n case S.OPEN_TAG:\n if (isMatch(nameBody, c)) {\n parser.tagName += c\n } else {\n newTag(parser)\n if (c === '>') {\n openTag(parser)\n } else if (c === '/') {\n parser.state = S.OPEN_TAG_SLASH\n } else {\n if (!isWhitespace(c)) {\n strictFail(parser, 'Invalid character in tag name')\n }\n parser.state = S.ATTRIB\n }\n }\n continue\n\n case S.OPEN_TAG_SLASH:\n if (c === '>') {\n openTag(parser, true)\n closeTag(parser)\n } else {\n strictFail(\n parser,\n 'Forward-slash in opening tag not followed by >'\n )\n parser.state = S.ATTRIB\n }\n continue\n\n case S.ATTRIB:\n // haven't read the attribute name yet.\n if (isWhitespace(c)) {\n continue\n } else if (c === '>') {\n openTag(parser)\n } else if (c === '/') {\n parser.state = S.OPEN_TAG_SLASH\n } else if (isMatch(nameStart, c)) {\n parser.attribName = c\n parser.attribValue = ''\n parser.state = S.ATTRIB_NAME\n } else {\n strictFail(parser, 'Invalid attribute name')\n }\n continue\n\n case S.ATTRIB_NAME:\n if (c === '=') {\n parser.state = S.ATTRIB_VALUE\n } else if (c === '>') {\n strictFail(parser, 'Attribute without value')\n parser.attribValue = parser.attribName\n attrib(parser)\n openTag(parser)\n } else if (isWhitespace(c)) {\n parser.state = S.ATTRIB_NAME_SAW_WHITE\n } else if (isMatch(nameBody, c)) {\n parser.attribName += c\n } else {\n strictFail(parser, 'Invalid attribute name')\n }\n continue\n\n case S.ATTRIB_NAME_SAW_WHITE:\n if (c === '=') {\n parser.state = S.ATTRIB_VALUE\n } else if (isWhitespace(c)) {\n continue\n } else {\n strictFail(parser, 'Attribute without value')\n parser.tag.attributes[parser.attribName] = ''\n parser.attribValue = ''\n emitNode(parser, 'onattribute', {\n name: parser.attribName,\n value: '',\n })\n parser.attribName = ''\n if (c === '>') {\n openTag(parser)\n } else if (isMatch(nameStart, c)) {\n parser.attribName = c\n parser.state = S.ATTRIB_NAME\n } else {\n strictFail(parser, 'Invalid attribute name')\n parser.state = S.ATTRIB\n }\n }\n continue\n\n case S.ATTRIB_VALUE:\n if (isWhitespace(c)) {\n continue\n } else if (isQuote(c)) {\n parser.q = c\n parser.state = S.ATTRIB_VALUE_QUOTED\n } else {\n if (!parser.opt.unquotedAttributeValues) {\n error(parser, 'Unquoted attribute value')\n }\n parser.state = S.ATTRIB_VALUE_UNQUOTED\n parser.attribValue = c\n }\n continue\n\n case S.ATTRIB_VALUE_QUOTED:\n if (c !== parser.q) {\n if (c === '&') {\n parser.state = S.ATTRIB_VALUE_ENTITY_Q\n } else {\n parser.attribValue += c\n }\n continue\n }\n attrib(parser)\n parser.q = ''\n parser.state = S.ATTRIB_VALUE_CLOSED\n continue\n\n case S.ATTRIB_VALUE_CLOSED:\n if (isWhitespace(c)) {\n parser.state = S.ATTRIB\n } else if (c === '>') {\n openTag(parser)\n } else if (c === '/') {\n parser.state = S.OPEN_TAG_SLASH\n } else if (isMatch(nameStart, c)) {\n strictFail(parser, 'No whitespace between attributes')\n parser.attribName = c\n parser.attribValue = ''\n parser.state = S.ATTRIB_NAME\n } else {\n strictFail(parser, 'Invalid attribute name')\n }\n continue\n\n case S.ATTRIB_VALUE_UNQUOTED:\n if (!isAttribEnd(c)) {\n if (c === '&') {\n parser.state = S.ATTRIB_VALUE_ENTITY_U\n } else {\n parser.attribValue += c\n }\n continue\n }\n attrib(parser)\n if (c === '>') {\n openTag(parser)\n } else {\n parser.state = S.ATTRIB\n }\n continue\n\n case S.CLOSE_TAG:\n if (!parser.tagName) {\n if (isWhitespace(c)) {\n continue\n } else if (notMatch(nameStart, c)) {\n if (parser.script) {\n parser.script += '</' + c\n parser.state = S.SCRIPT\n } else {\n strictFail(parser, 'Invalid tagname in closing tag.')\n }\n } else {\n parser.tagName = c\n }\n } else if (c === '>') {\n closeTag(parser)\n } else if (isMatch(nameBody, c)) {\n parser.tagName += c\n } else if (parser.script) {\n parser.script += '</' + parser.tagName + c\n parser.tagName = ''\n parser.state = S.SCRIPT\n } else {\n if (!isWhitespace(c)) {\n strictFail(parser, 'Invalid tagname in closing tag')\n }\n parser.state = S.CLOSE_TAG_SAW_WHITE\n }\n continue\n\n case S.CLOSE_TAG_SAW_WHITE:\n if (isWhitespace(c)) {\n continue\n }\n if (c === '>') {\n closeTag(parser)\n } else {\n strictFail(parser, 'Invalid characters in closing tag')\n }\n continue\n\n case S.TEXT_ENTITY:\n case S.ATTRIB_VALUE_ENTITY_Q:\n case S.ATTRIB_VALUE_ENTITY_U:\n var returnState\n var buffer\n switch (parser.state) {\n case S.TEXT_ENTITY:\n returnState = S.TEXT\n buffer = 'textNode'\n break\n\n case S.ATTRIB_VALUE_ENTITY_Q:\n returnState = S.ATTRIB_VALUE_QUOTED\n buffer = 'attribValue'\n break\n\n case S.ATTRIB_VALUE_ENTITY_U:\n returnState = S.ATTRIB_VALUE_UNQUOTED\n buffer = 'attribValue'\n break\n }\n\n if (c === ';') {\n var parsedEntity = parseEntity(parser)\n if (\n parser.opt.unparsedEntities &&\n !Object.values(sax.XML_ENTITIES).includes(parsedEntity)\n ) {\n if ((parser.entityCount += 1) > parser.opt.maxEntityCount) {\n error(\n parser,\n 'Parsed entity count exceeds max entity count'\n )\n }\n\n if ((parser.entityDepth += 1) > parser.opt.maxEntityDepth) {\n error(\n parser,\n 'Parsed entity depth exceeds max entity depth'\n )\n }\n\n parser.entity = ''\n parser.state = returnState\n parser.write(parsedEntity)\n parser.entityDepth -= 1\n } else {\n parser[buffer] += parsedEntity\n parser.entity = ''\n parser.state = returnState\n }\n } else if (\n isMatch(parser.entity.length ? entityBody : entityStart, c)\n ) {\n parser.entity += c\n } else {\n strictFail(parser, 'Invalid character in entity name')\n parser[buffer] += '&' + parser.entity + c\n parser.entity = ''\n parser.state = returnState\n }\n\n continue\n\n default: /* istanbul ignore next */ {\n throw new Error(parser, 'Unknown state: ' + parser.state)\n }\n }\n } // while\n\n if (parser.position >= parser.bufferCheckPosition) {\n checkBufferLength(parser)\n }\n return parser\n }\n\n /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */\n /* istanbul ignore next */\n if (!String.fromCodePoint) {\n ;(function () {\n var stringFromCharCode = String.fromCharCode\n var floor = Math.floor\n var fromCodePoint = function () {\n var MAX_SIZE = 0x4000\n var codeUnits = []\n var highSurrogate\n var lowSurrogate\n var index = -1\n var length = arguments.length\n if (!length) {\n return ''\n }\n var result = ''\n while (++index < length) {\n var codePoint = Number(arguments[index])\n if (\n !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\n codePoint < 0 || // not a valid Unicode code point\n codePoint > 0x10ffff || // not a valid Unicode code point\n floor(codePoint) !== codePoint // not an integer\n ) {\n throw RangeError('Invalid code point: ' + codePoint)\n }\n if (codePoint <= 0xffff) {\n // BMP code point\n codeUnits.push(codePoint)\n } else {\n // Astral code point; split in surrogate halves\n // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n codePoint -= 0x10000\n highSurrogate = (codePoint >> 10) + 0xd800\n lowSurrogate = (codePoint % 0x400) + 0xdc00\n codeUnits.push(highSurrogate, lowSurrogate)\n }\n if (index + 1 === length || codeUnits.length > MAX_SIZE) {\n result += stringFromCharCode.apply(null, codeUnits)\n codeUnits.length = 0\n }\n }\n return result\n }\n /* istanbul ignore next */\n if (Object.defineProperty) {\n Object.defineProperty(String, 'fromCodePoint', {\n value: fromCodePoint,\n configurable: true,\n writable: true,\n })\n } else {\n String.fromCodePoint = fromCodePoint\n }\n })()\n }\n})(typeof exports === 'undefined' ? (this.sax = {}) : exports)\n","import sax from 'sax';\nimport { Transform, } from 'node:stream';\nimport { ErrorLevel, TagNames, } from './types.js';\nimport { isValidChangeFreq, isValidYesNo, isAllowDeny, isPriceType, isResolution, } from './validation.js';\nimport { LIMITS } from './constants.js';\nfunction isValidTagName(tagName) {\n // This only works because the enum name and value are the same\n return tagName in TagNames;\n}\nfunction getAttrValue(attr) {\n if (!attr)\n return undefined;\n return typeof attr === 'string' ? attr : attr.value;\n}\nfunction tagTemplate() {\n return {\n img: [],\n video: [],\n links: [],\n url: '',\n };\n}\nfunction videoTemplate() {\n return {\n tag: [],\n thumbnail_loc: '',\n title: '',\n description: '',\n };\n}\nconst imageTemplate = {\n url: '',\n};\nconst linkTemplate = {\n lang: '',\n url: '',\n};\nfunction newsTemplate() {\n return {\n publication: { name: '', language: '' },\n publication_date: '',\n title: '',\n };\n}\nconst defaultLogger = (level, ...message) => console[level](...message);\nconst defaultStreamOpts = {\n logger: defaultLogger,\n};\n// TODO does this need to end with `options`\n/**\n * Takes a stream of xml and transforms it into a stream of SitemapItems\n * Use this to parse existing sitemaps into config options compatible with this library\n */\nexport class XMLToSitemapItemStream extends Transform {\n level;\n logger;\n /**\n * Errors encountered during parsing, capped at LIMITS.MAX_PARSER_ERRORS entries\n * to prevent memory DoS from malformed XML (BB-03).\n * Use errorCount for the total number of errors regardless of the cap.\n */\n errors;\n /** Total number of errors seen, including those beyond the stored cap. */\n errorCount;\n saxStream;\n urlCount;\n constructor(opts = defaultStreamOpts) {\n opts.objectMode = true;\n super(opts);\n this.errors = [];\n this.errorCount = 0;\n this.urlCount = 0;\n this.saxStream = sax.createStream(true, {\n xmlns: true,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n strictEntities: true,\n trim: true,\n });\n this.level = opts.level || ErrorLevel.WARN;\n if (this.level !== ErrorLevel.SILENT && opts.logger !== false) {\n this.logger = opts.logger ?? defaultLogger;\n }\n else {\n this.logger = () => undefined;\n }\n let currentItem = tagTemplate();\n let currentTag;\n let currentVideo = videoTemplate();\n let currentImage = { ...imageTemplate };\n let currentLink = { ...linkTemplate };\n let dontpushCurrentLink = false;\n this.saxStream.on('opentagstart', (tag) => {\n currentTag = tag.name;\n if (currentTag.startsWith('news:') && !currentItem.news) {\n currentItem.news = newsTemplate();\n }\n });\n this.saxStream.on('opentag', (tag) => {\n if (isValidTagName(tag.name)) {\n if (tag.name === 'xhtml:link') {\n // SAX returns attributes as objects with {name, value, prefix, local, uri}\n // Check if required attributes exist and have values\n const rel = getAttrValue(tag.attributes.rel);\n const href = getAttrValue(tag.attributes.href);\n const hreflang = getAttrValue(tag.attributes.hreflang);\n if (!rel || !href) {\n this.logger('warn', 'xhtml:link missing required rel or href attribute');\n this.err('xhtml:link missing required rel or href attribute');\n return;\n }\n if (rel === 'alternate' && hreflang) {\n currentLink.url = href;\n currentLink.lang = hreflang;\n }\n else if (rel === 'alternate') {\n dontpushCurrentLink = true;\n currentItem.androidLink = href;\n }\n else if (rel === 'amphtml') {\n dontpushCurrentLink = true;\n currentItem.ampLink = href;\n }\n else {\n this.logger('log', 'unhandled attr for xhtml:link', tag.attributes);\n this.err(`unhandled attr for xhtml:link ${JSON.stringify(tag.attributes)}`);\n }\n }\n }\n else {\n this.logger('warn', 'unhandled tag', tag.name);\n this.err(`unhandled tag: ${tag.name}`);\n }\n });\n this.saxStream.on('text', (text) => {\n switch (currentTag) {\n case 'mobile:mobile':\n break;\n case TagNames.loc:\n // Validate URL\n if (text.length > LIMITS.MAX_URL_LENGTH) {\n this.logger('warn', `URL exceeds max length of ${LIMITS.MAX_URL_LENGTH}: ${text.substring(0, 100)}...`);\n this.err(`URL exceeds max length of ${LIMITS.MAX_URL_LENGTH}`);\n }\n else if (!LIMITS.URL_PROTOCOL_REGEX.test(text)) {\n this.logger('warn', `URL must start with http:// or https://: ${text}`);\n this.err(`URL must start with http:// or https://: ${text}`);\n }\n else {\n currentItem.url = text;\n }\n break;\n case TagNames.changefreq:\n if (isValidChangeFreq(text)) {\n currentItem.changefreq = text;\n }\n break;\n case TagNames.priority:\n {\n const priority = parseFloat(text);\n if (isNaN(priority) ||\n !isFinite(priority) ||\n priority < 0 ||\n priority > 1) {\n this.logger('warn', `Invalid priority \"${text}\" - must be between 0 and 1`);\n this.err(`Invalid priority \"${text}\" - must be between 0 and 1`);\n }\n else {\n currentItem.priority = priority;\n }\n }\n break;\n case TagNames.lastmod:\n if (LIMITS.ISO_DATE_REGEX.test(text)) {\n currentItem.lastmod = text;\n }\n else {\n this.logger('warn', `Invalid lastmod date format \"${text}\" - expected ISO 8601 format`);\n this.err(`Invalid lastmod date format \"${text}\" - expected ISO 8601 format`);\n }\n break;\n case TagNames['video:thumbnail_loc']:\n currentVideo.thumbnail_loc = text;\n break;\n case TagNames['video:tag']:\n if (currentVideo.tag.length < LIMITS.MAX_TAGS_PER_VIDEO) {\n currentVideo.tag.push(text);\n }\n else {\n this.logger('warn', `video has too many tags (max ${LIMITS.MAX_TAGS_PER_VIDEO})`);\n this.err(`video has too many tags (max ${LIMITS.MAX_TAGS_PER_VIDEO})`);\n }\n break;\n case TagNames['video:duration']:\n {\n const duration = parseInt(text, 10);\n if (isNaN(duration) ||\n !isFinite(duration) ||\n duration < 0 ||\n duration > 28800) {\n this.logger('warn', `Invalid video duration \"${text}\" - must be between 0 and 28800 seconds`);\n this.err(`Invalid video duration \"${text}\" - must be between 0 and 28800 seconds`);\n }\n else {\n currentVideo.duration = duration;\n }\n }\n break;\n case TagNames['video:player_loc']:\n currentVideo.player_loc = text;\n break;\n case TagNames['video:content_loc']:\n currentVideo.content_loc = text;\n break;\n case TagNames['video:requires_subscription']:\n if (isValidYesNo(text)) {\n currentVideo.requires_subscription = text;\n }\n break;\n case TagNames['video:publication_date']:\n if (LIMITS.ISO_DATE_REGEX.test(text)) {\n currentVideo.publication_date = text;\n }\n else {\n this.logger('warn', `Invalid video publication_date format \"${text}\" - expected ISO 8601 format`);\n this.err(`Invalid video publication_date format \"${text}\" - expected ISO 8601 format`);\n }\n break;\n case TagNames['video:id']:\n currentVideo.id = text;\n break;\n case TagNames['video:restriction']:\n currentVideo.restriction = text;\n break;\n case TagNames['video:view_count']:\n {\n const viewCount = parseInt(text, 10);\n if (isNaN(viewCount) || !isFinite(viewCount) || viewCount < 0) {\n this.logger('warn', `Invalid video view_count \"${text}\" - must be a positive integer`);\n this.err(`Invalid video view_count \"${text}\" - must be a positive integer`);\n }\n else {\n currentVideo.view_count = viewCount;\n }\n }\n break;\n case TagNames['video:uploader']:\n currentVideo.uploader = text;\n break;\n case TagNames['video:family_friendly']:\n if (isValidYesNo(text)) {\n currentVideo.family_friendly = text;\n }\n break;\n case TagNames['video:expiration_date']:\n if (LIMITS.ISO_DATE_REGEX.test(text)) {\n currentVideo.expiration_date = text;\n }\n else {\n this.logger('warn', `Invalid video expiration_date format \"${text}\" - expected ISO 8601 format`);\n this.err(`Invalid video expiration_date format \"${text}\" - expected ISO 8601 format`);\n }\n break;\n case TagNames['video:platform']:\n currentVideo.platform = text;\n break;\n case TagNames['video:price']:\n currentVideo.price = text;\n break;\n case TagNames['video:rating']:\n {\n const rating = parseFloat(text);\n if (isNaN(rating) ||\n !isFinite(rating) ||\n rating < 0 ||\n rating > 5) {\n this.logger('warn', `Invalid video rating \"${text}\" - must be between 0 and 5`);\n this.err(`Invalid video rating \"${text}\" - must be between 0 and 5`);\n }\n else {\n currentVideo.rating = rating;\n }\n }\n break;\n case TagNames['video:category']:\n currentVideo.category = text;\n break;\n case TagNames['video:live']:\n if (isValidYesNo(text)) {\n currentVideo.live = text;\n }\n break;\n case TagNames['video:gallery_loc']:\n currentVideo.gallery_loc = text;\n break;\n case TagNames['image:loc']:\n currentImage.url = text;\n break;\n case TagNames['image:geo_location']:\n currentImage.geoLocation = text;\n break;\n case TagNames['image:license']:\n currentImage.license = text;\n break;\n case TagNames['news:access']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n if (text === 'Registration' || text === 'Subscription') {\n currentItem.news.access = text;\n }\n else {\n this.logger('warn', `Invalid news:access value \"${text}\" - must be \"Registration\" or \"Subscription\"`);\n this.err(`Invalid news:access value \"${text}\" - must be \"Registration\" or \"Subscription\"`);\n }\n break;\n case TagNames['news:genres']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n currentItem.news.genres = text;\n break;\n case TagNames['news:publication_date']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n if (LIMITS.ISO_DATE_REGEX.test(text)) {\n currentItem.news.publication_date = text;\n }\n else {\n this.logger('warn', `Invalid news publication_date format \"${text}\" - expected ISO 8601 format`);\n this.err(`Invalid news publication_date format \"${text}\" - expected ISO 8601 format`);\n }\n break;\n case TagNames['news:keywords']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n currentItem.news.keywords = text;\n break;\n case TagNames['news:stock_tickers']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n currentItem.news.stock_tickers = text;\n break;\n case TagNames['news:language']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n currentItem.news.publication.language = text;\n break;\n case TagNames['video:title']:\n if (currentVideo.title.length + text.length <=\n LIMITS.MAX_VIDEO_TITLE_LENGTH) {\n currentVideo.title += text;\n }\n else {\n this.logger('warn', `video title exceeds max length of ${LIMITS.MAX_VIDEO_TITLE_LENGTH}`);\n this.err(`video title exceeds max length of ${LIMITS.MAX_VIDEO_TITLE_LENGTH}`);\n }\n break;\n case TagNames['video:description']:\n if (currentVideo.description.length + text.length <=\n LIMITS.MAX_VIDEO_DESCRIPTION_LENGTH) {\n currentVideo.description += text;\n }\n else {\n this.logger('warn', `video description exceeds max length of ${LIMITS.MAX_VIDEO_DESCRIPTION_LENGTH}`);\n this.err(`video description exceeds max length of ${LIMITS.MAX_VIDEO_DESCRIPTION_LENGTH}`);\n }\n break;\n case TagNames['news:name']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n if (currentItem.news.publication.name.length + text.length <=\n LIMITS.MAX_NEWS_NAME_LENGTH) {\n currentItem.news.publication.name += text;\n }\n else {\n this.logger('warn', `news name exceeds max length of ${LIMITS.MAX_NEWS_NAME_LENGTH}`);\n this.err(`news name exceeds max length of ${LIMITS.MAX_NEWS_NAME_LENGTH}`);\n }\n break;\n case TagNames['news:title']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n if (currentItem.news.title.length + text.length <=\n LIMITS.MAX_NEWS_TITLE_LENGTH) {\n currentItem.news.title += text;\n }\n else {\n this.logger('warn', `news title exceeds max length of ${LIMITS.MAX_NEWS_TITLE_LENGTH}`);\n this.err(`news title exceeds max length of ${LIMITS.MAX_NEWS_TITLE_LENGTH}`);\n }\n break;\n case TagNames['image:caption']:\n if (!currentImage.caption) {\n currentImage.caption =\n text.length <= LIMITS.MAX_IMAGE_CAPTION_LENGTH\n ? text\n : text.substring(0, LIMITS.MAX_IMAGE_CAPTION_LENGTH);\n if (text.length > LIMITS.MAX_IMAGE_CAPTION_LENGTH) {\n this.logger('warn', `image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n this.err(`image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n }\n }\n else if (currentImage.caption.length + text.length <=\n LIMITS.MAX_IMAGE_CAPTION_LENGTH) {\n currentImage.caption += text;\n }\n else {\n this.logger('warn', `image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n this.err(`image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n }\n break;\n case TagNames['image:title']:\n if (!currentImage.title) {\n currentImage.title =\n text.length <= LIMITS.MAX_IMAGE_TITLE_LENGTH\n ? text\n : text.substring(0, LIMITS.MAX_IMAGE_TITLE_LENGTH);\n if (text.length > LIMITS.MAX_IMAGE_TITLE_LENGTH) {\n this.logger('warn', `image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n this.err(`image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n }\n }\n else if (currentImage.title.length + text.length <=\n LIMITS.MAX_IMAGE_TITLE_LENGTH) {\n currentImage.title += text;\n }\n else {\n this.logger('warn', `image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n this.err(`image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n }\n break;\n default:\n this.logger('log', 'unhandled text for tag:', currentTag, `'${text}'`);\n this.err(`unhandled text for tag: ${currentTag} '${text}'`);\n break;\n }\n });\n this.saxStream.on('cdata', (text) => {\n switch (currentTag) {\n case TagNames.loc:\n // Validate URL\n if (text.length > LIMITS.MAX_URL_LENGTH) {\n this.logger('warn', `URL exceeds max length of ${LIMITS.MAX_URL_LENGTH}: ${text.substring(0, 100)}...`);\n this.err(`URL exceeds max length of ${LIMITS.MAX_URL_LENGTH}`);\n }\n else if (!LIMITS.URL_PROTOCOL_REGEX.test(text)) {\n this.logger('warn', `URL must start with http:// or https://: ${text}`);\n this.err(`URL must start with http:// or https://: ${text}`);\n }\n else {\n currentItem.url = text;\n }\n break;\n case TagNames['image:loc']:\n currentImage.url = text;\n break;\n case TagNames['video:title']:\n if (currentVideo.title.length + text.length <=\n LIMITS.MAX_VIDEO_TITLE_LENGTH) {\n currentVideo.title += text;\n }\n else {\n this.logger('warn', `video title exceeds max length of ${LIMITS.MAX_VIDEO_TITLE_LENGTH}`);\n this.err(`video title exceeds max length of ${LIMITS.MAX_VIDEO_TITLE_LENGTH}`);\n }\n break;\n case TagNames['video:description']:\n if (currentVideo.description.length + text.length <=\n LIMITS.MAX_VIDEO_DESCRIPTION_LENGTH) {\n currentVideo.description += text;\n }\n else {\n this.logger('warn', `video description exceeds max length of ${LIMITS.MAX_VIDEO_DESCRIPTION_LENGTH}`);\n this.err(`video description exceeds max length of ${LIMITS.MAX_VIDEO_DESCRIPTION_LENGTH}`);\n }\n break;\n case TagNames['news:name']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n if (currentItem.news.publication.name.length + text.length <=\n LIMITS.MAX_NEWS_NAME_LENGTH) {\n currentItem.news.publication.name += text;\n }\n else {\n this.logger('warn', `news name exceeds max length of ${LIMITS.MAX_NEWS_NAME_LENGTH}`);\n this.err(`news name exceeds max length of ${LIMITS.MAX_NEWS_NAME_LENGTH}`);\n }\n break;\n case TagNames['news:title']:\n if (!currentItem.news) {\n currentItem.news = newsTemplate();\n }\n if (currentItem.news.title.length + text.length <=\n LIMITS.MAX_NEWS_TITLE_LENGTH) {\n currentItem.news.title += text;\n }\n else {\n this.logger('warn', `news title exceeds max length of ${LIMITS.MAX_NEWS_TITLE_LENGTH}`);\n this.err(`news title exceeds max length of ${LIMITS.MAX_NEWS_TITLE_LENGTH}`);\n }\n break;\n case TagNames['image:caption']:\n if (!currentImage.caption) {\n currentImage.caption =\n text.length <= LIMITS.MAX_IMAGE_CAPTION_LENGTH\n ? text\n : text.substring(0, LIMITS.MAX_IMAGE_CAPTION_LENGTH);\n if (text.length > LIMITS.MAX_IMAGE_CAPTION_LENGTH) {\n this.logger('warn', `image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n this.err(`image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n }\n }\n else if (currentImage.caption.length + text.length <=\n LIMITS.MAX_IMAGE_CAPTION_LENGTH) {\n currentImage.caption += text;\n }\n else {\n this.logger('warn', `image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n this.err(`image caption exceeds max length of ${LIMITS.MAX_IMAGE_CAPTION_LENGTH}`);\n }\n break;\n case TagNames['image:title']:\n if (!currentImage.title) {\n currentImage.title =\n text.length <= LIMITS.MAX_IMAGE_TITLE_LENGTH\n ? text\n : text.substring(0, LIMITS.MAX_IMAGE_TITLE_LENGTH);\n if (text.length > LIMITS.MAX_IMAGE_TITLE_LENGTH) {\n this.logger('warn', `image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n this.err(`image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n }\n }\n else if (currentImage.title.length + text.length <=\n LIMITS.MAX_IMAGE_TITLE_LENGTH) {\n currentImage.title += text;\n }\n else {\n this.logger('warn', `image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n this.err(`image title exceeds max length of ${LIMITS.MAX_IMAGE_TITLE_LENGTH}`);\n }\n break;\n default:\n this.logger('log', 'unhandled cdata for tag:', currentTag);\n this.err(`unhandled cdata for tag: ${currentTag}`);\n break;\n }\n });\n this.saxStream.on('attribute', (attr) => {\n switch (currentTag) {\n case TagNames['urlset']:\n case TagNames['xhtml:link']:\n case TagNames['video:id']:\n break;\n case TagNames['video:restriction']:\n if (attr.name === 'relationship' && isAllowDeny(attr.value)) {\n currentVideo['restriction:relationship'] = attr.value;\n }\n else {\n this.logger('log', 'unhandled attr', currentTag, attr.name);\n this.err(`unhandled attr: ${currentTag} ${attr.name}`);\n }\n break;\n case TagNames['video:price']:\n if (attr.name === 'type' && isPriceType(attr.value)) {\n currentVideo['price:type'] = attr.value;\n }\n else if (attr.name === 'currency') {\n currentVideo['price:currency'] = attr.value;\n }\n else if (attr.name === 'resolution' && isResolution(attr.value)) {\n currentVideo['price:resolution'] = attr.value;\n }\n else {\n this.logger('log', 'unhandled attr for video:price', attr.name);\n this.err(`unhandled attr: ${currentTag} ${attr.name}`);\n }\n break;\n case TagNames['video:player_loc']:\n if (attr.name === 'autoplay') {\n currentVideo['player_loc:autoplay'] = attr.value;\n }\n else if (attr.name === 'allow_embed' && isValidYesNo(attr.value)) {\n currentVideo['player_loc:allow_embed'] = attr.value;\n }\n else {\n this.logger('log', 'unhandled attr for video:player_loc', attr.name);\n this.err(`unhandled attr: ${currentTag} ${attr.name}`);\n }\n break;\n case TagNames['video:platform']:\n if (attr.name === 'relationship' && isAllowDeny(attr.value)) {\n currentVideo['platform:relationship'] = attr.value;\n }\n else {\n this.logger('log', 'unhandled attr for video:platform', attr.name, attr.value);\n this.err(`unhandled attr: ${currentTag} ${attr.name} ${attr.value}`);\n }\n break;\n case TagNames['video:gallery_loc']:\n if (attr.name === 'title') {\n currentVideo['gallery_loc:title'] = attr.value;\n }\n else {\n this.logger('log', 'unhandled attr for video:galler_loc', attr.name);\n this.err(`unhandled attr: ${currentTag} ${attr.name}`);\n }\n break;\n case TagNames['video:uploader']:\n if (attr.name === 'info') {\n currentVideo['uploader:info'] = attr.value;\n }\n else {\n this.logger('log', 'unhandled attr for video:uploader', attr.name);\n this.err(`unhandled attr: ${currentTag} ${attr.name}`);\n }\n break;\n default:\n this.logger('log', 'unhandled attr', currentTag, attr.name);\n this.err(`unhandled attr: ${currentTag} ${attr.name}`);\n }\n });\n this.saxStream.on('closetag', (tag) => {\n switch (tag) {\n case TagNames.url:\n this.urlCount++;\n if (this.urlCount > LIMITS.MAX_URL_ENTRIES) {\n this.logger('error', `Sitemap exceeds maximum of ${LIMITS.MAX_URL_ENTRIES} URLs`);\n this.err(`Sitemap exceeds maximum of ${LIMITS.MAX_URL_ENTRIES} URLs`);\n currentItem = tagTemplate();\n break;\n }\n this.push(currentItem);\n currentItem = tagTemplate();\n break;\n case TagNames['video:video']:\n if (currentItem.video.length < LIMITS.MAX_VIDEOS_PER_URL) {\n currentItem.video.push(currentVideo);\n }\n else {\n this.logger('warn', `URL has too many videos (max ${LIMITS.MAX_VIDEOS_PER_URL})`);\n this.err(`URL has too many videos (max ${LIMITS.MAX_VIDEOS_PER_URL})`);\n }\n currentVideo = videoTemplate();\n break;\n case TagNames['image:image']:\n if (currentItem.img.length < LIMITS.MAX_IMAGES_PER_URL) {\n currentItem.img.push(currentImage);\n }\n else {\n this.logger('warn', `URL has too many images (max ${LIMITS.MAX_IMAGES_PER_URL})`);\n this.err(`URL has too many images (max ${LIMITS.MAX_IMAGES_PER_URL})`);\n }\n currentImage = { ...imageTemplate };\n break;\n case TagNames['xhtml:link']:\n if (!dontpushCurrentLink) {\n if (currentItem.links.length < LIMITS.MAX_LINKS_PER_URL) {\n currentItem.links.push(currentLink);\n }\n else {\n this.logger('warn', `URL has too many links (max ${LIMITS.MAX_LINKS_PER_URL})`);\n this.err(`URL has too many links (max ${LIMITS.MAX_LINKS_PER_URL})`);\n }\n }\n currentLink = { ...linkTemplate };\n dontpushCurrentLink = false; // Reset flag for next link\n break;\n default:\n break;\n }\n });\n }\n _transform(data, encoding, callback) {\n try {\n const cb = () => callback(this.level === ErrorLevel.THROW && this.errors.length > 0\n ? this.errors[0]\n : null);\n // correcting the type here can be done without making it a breaking change\n // TODO fix this\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (!this.saxStream.write(data, encoding)) {\n this.saxStream.once('drain', cb);\n }\n else {\n process.nextTick(cb);\n }\n }\n catch (error) {\n callback(error);\n }\n }\n err(msg) {\n this.errorCount++;\n if (this.errors.length < LIMITS.MAX_PARSER_ERRORS) {\n this.errors.push(new Error(msg));\n }\n }\n}\n/**\n Read xml and resolve with the configuration that would produce it or reject with\n an error\n ```\n const { createReadStream } = require('fs')\n const { parseSitemap, createSitemap } = require('sitemap')\n parseSitemap(createReadStream('./example.xml')).then(\n // produces the same xml\n // you can, of course, more practically modify it or store it\n (xmlConfig) => console.log(createSitemap(xmlConfig).toString()),\n (err) => console.log(err)\n )\n ```\n @param {Readable} xml what to parse\n @return {Promise<SitemapItem[]>} resolves with list of sitemap items that can be fed into a SitemapStream. Rejects with an Error object.\n */\nexport async function parseSitemap(xml) {\n const urls = [];\n return new Promise((resolve, reject) => {\n xml\n .pipe(new XMLToSitemapItemStream())\n .on('data', (smi) => urls.push(smi))\n .on('end', () => {\n resolve(urls);\n })\n .on('error', (error) => {\n reject(error);\n });\n });\n}\nconst defaultObjectStreamOpts = {\n lineSeparated: false,\n};\n/**\n * A Transform that converts a stream of objects into a JSON Array or a line\n * separated stringified JSON\n * @param [lineSeparated=false] whether to separate entries by a new line or comma\n */\nexport class ObjectStreamToJSON extends Transform {\n lineSeparated;\n firstWritten;\n constructor(opts = defaultObjectStreamOpts) {\n opts.writableObjectMode = true;\n super(opts);\n this.lineSeparated = opts.lineSeparated;\n this.firstWritten = false;\n }\n _transform(chunk, encoding, cb) {\n if (!this.firstWritten) {\n this.firstWritten = true;\n if (!this.lineSeparated) {\n this.push('[');\n }\n }\n else if (this.lineSeparated) {\n this.push('\\n');\n }\n else {\n this.push(',');\n }\n if (chunk) {\n this.push(JSON.stringify(chunk));\n }\n cb();\n }\n _flush(cb) {\n if (!this.lineSeparated) {\n this.push(']');\n }\n cb();\n }\n}\n","import { SitemapStream, streamToPromise } from 'sitemap';\nimport { Readable } from 'stream';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { SitemapMap } from '../interfaces/Config/SitemapMap';\nimport { outputToFile } from './Output';\n\n/**\n * Generate Sitemap Robots\n *\n * @param {string} hostname\n * @param {OutputOptions} options\n * @return {void}\n */\nconst generateRobots = (hostname: string, options: OutputOptions): void => {\n let content = [\n '# https://www.robotstxt.org/robotstxt.html',\n `Sitemap: ${hostname}/${options.filename}`,\n 'User-agent: *',\n 'Disallow:',\n ];\n\n options.filename = 'robots.txt';\n\n outputToFile(content.join('\\r\\n'), options);\n};\n\n/**\n * Transform Sitemap\n *\n * @param {string} hostname\n * @param {SitemapMap[]} urls\n * @param {boolean} includeRobots\n * @param {OutputOptions} options\n * @return {Promise<void>}\n */\nconst transformSitemap = async (\n hostname: string,\n urls: SitemapMap[],\n includeRobots: boolean,\n options: OutputOptions,\n): Promise<void> => {\n const stream = new SitemapStream({\n hostname: hostname,\n lastmodDateOnly: false,\n xmlns: {\n news: false,\n xhtml: false,\n image: false,\n video: false,\n custom: [\n 'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"',\n 'xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\"',\n ],\n },\n });\n const content = await streamToPromise(Readable.from(urls).pipe(stream)).then(\n (data) => data.toString(),\n );\n\n outputToFile(content, options);\n\n if (includeRobots) {\n generateRobots(hostname, options);\n }\n};\n\nexport { transformSitemap };\n","import { GoogleAuth } from 'google-auth-library';\nimport { JSONClient } from 'google-auth-library/build/src/auth/googleauth';\nimport { exportConfig, processConfig } from './Config/Config';\nimport { authorizeServiceAccount, fetchGoogleSheet } from './Config/GoogleAuth';\nimport { exportLocales, processLocales } from './Config/Locales';\nimport { EnvironmentEnum } from './enums/EnvironmentEnum';\nimport { ConfigOptions } from './interfaces/Config/ConfigOptions';\n\nexport { changeEntry, transformConfig } from './Config/Config';\nexport { transformSitemap } from './Config/Sitemap';\nexport * from './interfaces/Config/ConfigOptions';\nexport * from './interfaces/Config/OutputOptions';\nexport type { ExportAs, FormatAs } from './types/Config/OptionType';\nexport { EnvironmentEnum };\n\n/**\n * Private function to fetch locales\n *\n * @param {GoogleAuth<JSONClient>} auth\n * @param {ConfigOption} options\n * @return {Promise<void>}\n */\nconst innerFetchLocales = async (\n auth: GoogleAuth<JSONClient>,\n options: ConfigOptions,\n): Promise<void> => {\n // console.log('auth', auth);\n\n const values = await fetchGoogleSheet(\n auth,\n options.spreadsheetId,\n options.spreadsheetTab,\n );\n\n if (!values || values.length === 0) {\n console.log('No data found.');\n return;\n }\n\n // console.log('values,', values);\n\n const data = processLocales(values);\n\n exportLocales(data, options.output);\n};\n\n/**\n * Private function to fetch config\n *\n * @param {GoogleAuth<JSONClient>} auth\n * @param {ConfigOption} options\n * @return {Promise<void>}\n */\nconst innerFetchConfig = async (\n auth: GoogleAuth<JSONClient>,\n options: ConfigOptions,\n): Promise<void> => {\n // console.log('auth', auth);\n\n const values = await fetchGoogleSheet(\n auth,\n options.spreadsheetId,\n options.spreadsheetTab,\n );\n\n if (!values || values.length === 0) {\n console.log('No data found.');\n return;\n }\n\n // console.log('values,', values);\n\n const data = processConfig(values);\n\n exportConfig(data, options.output);\n};\n\n/**\n * Fetch locales\n *\n * @param {ConfigOptions} options\n * @return {void}\n */\nexport const fetchLocales = (options: ConfigOptions): void => {\n try {\n const auth = authorizeServiceAccount();\n\n innerFetchLocales(auth, options);\n } catch (error) {\n console.error(error);\n }\n};\n\n/**\n * Fetch config\n *\n * @param {ConfigOptions} options\n * @return {void}\n */\nexport const fetchConfig = (options: ConfigOptions): void => {\n try {\n const auth = authorizeServiceAccount();\n\n innerFetchConfig(auth, options);\n } catch (error) {\n console.error(error);\n }\n};\n\n/**\n * Fetch all format from array options\n *\n * @param {ConfigOptions[]} options\n * @return {void}\n */\nexport const fetchAll = (options: ConfigOptions[]): void => {\n try {\n const auth = authorizeServiceAccount();\n\n options.forEach((option) => {\n if (option.formatAs === 'locales') {\n innerFetchLocales(auth, option);\n } else if (option.formatAs === 'config') {\n innerFetchConfig(auth, option);\n }\n });\n } catch (error) {\n console.error(error);\n }\n};\n\n/**\n * Fetch raw value\n *\n * @param {ConfigOptions} options\n * @return {Promise<any[][] | null | undefined>}\n */\nexport const fetchRawValue = async (\n options: ConfigOptions,\n): Promise<any[][] | null | undefined> => {\n try {\n const auth = authorizeServiceAccount();\n\n return await fetchGoogleSheet(\n auth,\n options.spreadsheetId,\n options.spreadsheetTab,\n );\n } catch (error) {\n console.error(error);\n }\n\n return null;\n};\n"],"x_google_ignoreList":[4,5,6,7,8,9,10,11,12,13],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAM,KAAgB,GAAiB,MAAiC;CACtE,IAAI,IAAW,EAAQ;AAEvB,CAAI,EAAQ,wBACV,IAAW,EAAS,aAAa;CAGnC,IAAM,IAAW,GAAG,EAAQ,OAAO,GAAG;AAMtC,CAJK,EAAW,EAAQ,OAAO,IAC7B,EAAU,EAAQ,QAAQ,EAAE,WAAW,IAAM,CAAC,EAGhD,EACE,GACA,GACA;EAAE,UAAU;EAAS,MAAM;EAAK,EAChC,SAAU,GAAK;AACb,MAAI,EACF,OAAM;AAGR,UAAQ,IAAI,GAAU,EAAQ;GAEjC;GCnBG,MAAiB,MAA6B;CAClD,IAAI,IAA2B,EAAE,EAE7B,IAAS,EAAK,GAAG,KAAK,MACjB,EACP;AAUF,QARA,EAAK,SAAS,GAAe,MAAkB;AACzC,QAAU,MAId,IAAgB,GAAW,GAAK,GAAQ,EAAc;GACtD,EAEK;GAWH,MACJ,GACA,GACA,MACc;CACd,IAAM,IAAc,EAAK;AAWzB,QAVA,EAAc,KAAe,EAAE,EAE/B,EAAO,SAAS,GAAY,MAAU;AAChC,QAAU,KAAK,EAAK,OAAW,KAAA,KAAa,EAAK,OAAW,OAIhE,EAAc,GAAa,KAAc,EAAkB,EAAK,GAAO;GACvE,EAEK;GASH,KAAgB,MAAyB;AAC7C,KAAI;AACF,OAAK,MAAM,EAAI;SACL;AACV,SAAO;;AAGT,QAAO;GASH,KAAqB,MACL,CAAC,QAAQ,QAAQ,CAErB,SAAS,EAAO,aAAa,CAAC,GACrC,MAAW,SAGhB,EAAa,EAAO,GACf,KAAK,MAAM,EAAO,GAGpB,GAUH,MAAgB,GAAiB,MAAiC;CACtE,IAAM,IAAS,EACb,QAAQ,GACT,EAEG,IAAU;AAEd,S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,KAAI,CAAC,KAAU,EAAO,WAAW,GAAG;AAClC,UAAQ,IAAI,iBAAiB;AAC7B;;AAOF,GAFa,GAAe,EAAO,EAEf,EAAQ,OAAO;GAU/B,KAAmB,OACvB,GACA,MACkB;CAGlB,IAAM,IAAS,MAAM,EACnB,GACA,EAAQ,eACR,EAAQ,eACT;AAED,KAAI,CAAC,KAAU,EAAO,WAAW,GAAG;AAClC,UAAQ,IAAI,iBAAiB;AAC7B;;AAOF,IAFa,GAAc,EAAO,EAEf,EAAQ,OAAO;GASvB,MAAgB,MAAiC;AAC5D,KAAI;AAGF,KAFa,GAAyB,EAEd,EAAQ;UACzB,GAAO;AACd,UAAQ,MAAM,EAAM;;GAUX,MAAe,MAAiC;AAC3D,KAAI;AAGF,KAFa,GAAyB,EAEf,EAAQ;UACxB,GAAO;AACd,UAAQ,MAAM,EAAM;;GAUX,MAAY,MAAmC;AAC1D,KAAI;EACF,IAAM,IAAO,GAAyB;AAEtC,IAAQ,SAAS,MAAW;AAC1B,GAAI,EAAO,aAAa,YACtB,GAAkB,GAAM,EAAO,GACtB,EAAO,aAAa,YAC7B,GAAiB,GAAM,EAAO;IAEhC;UACK,GAAO;AACd,UAAQ,MAAM,EAAM;;GAUX,KAAgB,OAC3B,MACwC;AACxC,KAAI;AAGF,SAAO,MAAM,EAFA,GAAyB,EAIpC,EAAQ,eACR,EAAQ,eACT;UACM,GAAO;AACd,UAAQ,MAAM,EAAM;;AAGtB,QAAO"}
|
package/dist/config-cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EnvironmentEnum } from './enums/EnvironmentEnum';
|
|
2
2
|
import { ConfigOptions } from './interfaces/Config/ConfigOptions';
|
|
3
|
-
export { transformConfig } from './Config/Config';
|
|
3
|
+
export { changeEntry, transformConfig } from './Config/Config';
|
|
4
4
|
export { transformSitemap } from './Config/Sitemap';
|
|
5
5
|
export * from './interfaces/Config/ConfigOptions';
|
|
6
6
|
export * from './interfaces/Config/OutputOptions';
|