@utilix-tech/sdk 0.1.1 → 0.1.4

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.
@@ -1,4 +1,5 @@
1
1
  import { __export } from './chunk-MLKGABMK.js';
2
+ import QRCode from 'qrcode';
2
3
 
3
4
  // src/tools/misc.ts
4
5
  var misc_exports = {};
@@ -6,6 +7,7 @@ __export(misc_exports, {
6
7
  COLOR_PRESETS: () => COLOR_PRESETS,
7
8
  DATA_TYPES: () => DATA_TYPES,
8
9
  DEFAULT_CONFIG: () => DEFAULT_CONFIG,
10
+ DEFAULT_QR_OPTIONS: () => DEFAULT_QR_OPTIONS,
9
11
  FORMAT_EXTENSIONS: () => FORMAT_EXTENSIONS,
10
12
  FORMAT_LABELS: () => FORMAT_LABELS,
11
13
  analyzeString: () => analyzeString,
@@ -21,6 +23,9 @@ __export(misc_exports, {
21
23
  formatSvg: () => formatSvg,
22
24
  fromUnicodeEscape: () => fromUnicodeEscape,
23
25
  generateData: () => generateData,
26
+ generateMetaHtml: () => generateMetaHtml,
27
+ generateQrDataUrl: () => generateQrDataUrl,
28
+ generateQrSvg: () => generateQrSvg,
24
29
  generateSingle: () => generateSingle,
25
30
  generateSvgFavicon: () => generateSvgFavicon,
26
31
  getConversionWarnings: () => getConversionWarnings,
@@ -34,10 +39,12 @@ __export(misc_exports, {
34
39
  numberToWords: () => numberToWords,
35
40
  optimizeSvg: () => optimizeSvg,
36
41
  ordinalWords: () => ordinalWords,
42
+ parseMetaTags: () => parseMetaTags,
37
43
  romanToNumber: () => romanToNumber,
38
44
  sanitizeSvg: () => sanitizeSvg,
39
45
  svgToDataUrl: () => svgToDataUrl,
40
- toUnicodeEscape: () => toUnicodeEscape
46
+ toUnicodeEscape: () => toUnicodeEscape,
47
+ validateOgTags: () => validateOgTags
41
48
  });
42
49
  var NAMED_HTML_ENTITIES = {
43
50
  34: """,
@@ -1082,5 +1089,129 @@ function generateData(config) {
1082
1089
  }
1083
1090
  return results;
1084
1091
  }
1092
+ var DEFAULT_QR_OPTIONS = {
1093
+ errorLevel: "M",
1094
+ size: 256,
1095
+ margin: 1,
1096
+ darkColor: "#000000",
1097
+ lightColor: "#ffffff"
1098
+ };
1099
+ async function generateQrSvg(text, options) {
1100
+ const o = { ...DEFAULT_QR_OPTIONS, ...options };
1101
+ return QRCode.toString(text, {
1102
+ type: "svg",
1103
+ errorCorrectionLevel: o.errorLevel,
1104
+ margin: o.margin,
1105
+ color: { dark: o.darkColor, light: o.lightColor }
1106
+ });
1107
+ }
1108
+ async function generateQrDataUrl(text, options) {
1109
+ const o = { ...DEFAULT_QR_OPTIONS, ...options };
1110
+ return QRCode.toDataURL(text, {
1111
+ width: o.size,
1112
+ errorCorrectionLevel: o.errorLevel,
1113
+ margin: o.margin,
1114
+ color: { dark: o.darkColor, light: o.lightColor }
1115
+ });
1116
+ }
1117
+ function _getMetaContent(html, property) {
1118
+ const esc = property.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1119
+ const patterns = [
1120
+ new RegExp(`<meta[^>]+property=["']${esc}["'][^>]+content=["']([^"']*)["']`, "i"),
1121
+ new RegExp(`<meta[^>]+content=["']([^"']*)["'][^>]+property=["']${esc}["']`, "i"),
1122
+ new RegExp(`<meta[^>]+name=["']${esc}["'][^>]+content=["']([^"']*)["']`, "i"),
1123
+ new RegExp(`<meta[^>]+content=["']([^"']*)["'][^>]+name=["']${esc}["']`, "i")
1124
+ ];
1125
+ for (const p of patterns) {
1126
+ const m = html.match(p);
1127
+ if (m) return m[1];
1128
+ }
1129
+ return void 0;
1130
+ }
1131
+ function parseMetaTags(html) {
1132
+ const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i);
1133
+ const canonicalMatch = html.match(/<link[^>]+rel=["']canonical["'][^>]+href=["']([^"']*)["']/i) || html.match(/<link[^>]+href=["']([^"']*)["'][^>]+rel=["']canonical["']/i);
1134
+ const charsetMatch = html.match(/<meta[^>]+charset=["']([^"']*)["']/i) || html.match(/<meta[^>]+charset=([^\s>]*)/i);
1135
+ return {
1136
+ og: {
1137
+ title: _getMetaContent(html, "og:title"),
1138
+ description: _getMetaContent(html, "og:description"),
1139
+ image: _getMetaContent(html, "og:image"),
1140
+ imageAlt: _getMetaContent(html, "og:image:alt"),
1141
+ imageWidth: _getMetaContent(html, "og:image:width"),
1142
+ imageHeight: _getMetaContent(html, "og:image:height"),
1143
+ url: _getMetaContent(html, "og:url"),
1144
+ type: _getMetaContent(html, "og:type"),
1145
+ siteName: _getMetaContent(html, "og:site_name"),
1146
+ locale: _getMetaContent(html, "og:locale")
1147
+ },
1148
+ twitter: {
1149
+ card: _getMetaContent(html, "twitter:card"),
1150
+ site: _getMetaContent(html, "twitter:site"),
1151
+ creator: _getMetaContent(html, "twitter:creator"),
1152
+ title: _getMetaContent(html, "twitter:title"),
1153
+ description: _getMetaContent(html, "twitter:description"),
1154
+ image: _getMetaContent(html, "twitter:image")
1155
+ },
1156
+ standard: {
1157
+ title: titleMatch ? titleMatch[1].trim() : void 0,
1158
+ description: _getMetaContent(html, "description"),
1159
+ keywords: _getMetaContent(html, "keywords"),
1160
+ canonical: canonicalMatch ? canonicalMatch[1] : void 0,
1161
+ robots: _getMetaContent(html, "robots"),
1162
+ viewport: _getMetaContent(html, "viewport"),
1163
+ charset: charsetMatch ? charsetMatch[1] : void 0
1164
+ }
1165
+ };
1166
+ }
1167
+ function validateOgTags(tags) {
1168
+ const warnings = [];
1169
+ const missing = [];
1170
+ const required = ["title", "description", "image", "url", "type"];
1171
+ for (const field of required) {
1172
+ if (!tags[field]) missing.push(`og:${field}`);
1173
+ }
1174
+ if (tags.image && !/^https?:\/\//i.test(tags.image))
1175
+ warnings.push("og:image should be an absolute URL");
1176
+ if (tags.url && !/^https?:\/\//i.test(tags.url))
1177
+ warnings.push("og:url should be an absolute URL");
1178
+ if (tags.title && tags.title.length > 95)
1179
+ warnings.push("og:title is longer than 95 characters and may be truncated");
1180
+ if (tags.description && tags.description.length > 300)
1181
+ warnings.push("og:description is longer than 300 characters and may be truncated");
1182
+ const standardTypes = ["website", "article", "video.movie", "video.episode", "music.song", "music.album", "book", "profile"];
1183
+ if (tags.type && !standardTypes.includes(tags.type))
1184
+ warnings.push(`og:type "${tags.type}" is not a standard type`);
1185
+ return { warnings, missing };
1186
+ }
1187
+ function generateMetaHtml(tags) {
1188
+ const lines = [];
1189
+ const ogMap = {
1190
+ title: "og:title",
1191
+ description: "og:description",
1192
+ image: "og:image",
1193
+ imageAlt: "og:image:alt",
1194
+ imageWidth: "og:image:width",
1195
+ imageHeight: "og:image:height",
1196
+ url: "og:url",
1197
+ type: "og:type",
1198
+ siteName: "og:site_name",
1199
+ locale: "og:locale"
1200
+ };
1201
+ const twitterMap = {
1202
+ card: "twitter:card",
1203
+ site: "twitter:site",
1204
+ creator: "twitter:creator"
1205
+ };
1206
+ for (const [key, property] of Object.entries(ogMap)) {
1207
+ const v = tags[key];
1208
+ if (v) lines.push(`<meta property="${property}" content="${v}" />`);
1209
+ }
1210
+ for (const [key, name] of Object.entries(twitterMap)) {
1211
+ const v = tags[key];
1212
+ if (v) lines.push(`<meta name="${name}" content="${v}" />`);
1213
+ }
1214
+ return lines.join("\n");
1215
+ }
1085
1216
 
1086
- export { COLOR_PRESETS, DATA_TYPES, DEFAULT_CONFIG, FORMAT_EXTENSIONS, FORMAT_LABELS, analyzeString, analyzeSvg, calcResizeDimensions, calcSavings, charToCodePoint, codePointToChar, detectFormatFromDataUrl, detectFormatFromFilename, formatBytes, formatLabel, formatSvg, fromUnicodeEscape, generateData, generateSingle, generateSvgFavicon, getConversionWarnings, getDefaultQuality, getDownloadFilename, getSupportedFormats, getSupportedOutputFormats, minifySvg, misc_exports, numberToOrdinal, numberToRoman, numberToWords, optimizeSvg, ordinalWords, romanToNumber, sanitizeSvg, svgToDataUrl, toUnicodeEscape };
1217
+ export { COLOR_PRESETS, DATA_TYPES, DEFAULT_CONFIG, DEFAULT_QR_OPTIONS, FORMAT_EXTENSIONS, FORMAT_LABELS, analyzeString, analyzeSvg, calcResizeDimensions, calcSavings, charToCodePoint, codePointToChar, detectFormatFromDataUrl, detectFormatFromFilename, formatBytes, formatLabel, formatSvg, fromUnicodeEscape, generateData, generateMetaHtml, generateQrDataUrl, generateQrSvg, generateSingle, generateSvgFavicon, getConversionWarnings, getDefaultQuality, getDownloadFilename, getSupportedFormats, getSupportedOutputFormats, minifySvg, misc_exports, numberToOrdinal, numberToRoman, numberToWords, optimizeSvg, ordinalWords, parseMetaTags, romanToNumber, sanitizeSvg, svgToDataUrl, toUnicodeEscape, validateOgTags };
@@ -16,6 +16,7 @@
16
16
  * removeConsoleCalls, getJsStats)
17
17
  * - openapi-viewer (parseSpec, getEndpointsByTag, searchEndpoints, getMethodColor)
18
18
  * - env-parser (parseEnv, envToJson, envToExport, validateEnvKey)
19
+ * - css-minifier (minifyCss, formatCss, countRules, countProperties)
19
20
  */
20
21
  type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
21
22
  declare const ALL_FLAGS: RegexFlag[];
@@ -251,12 +252,23 @@ declare function envToJson(input: string): string | {
251
252
  };
252
253
  declare function envToExport(input: string): string;
253
254
  declare function validateEnvKey(key: string): boolean;
255
+ interface CssResult {
256
+ output: string;
257
+ originalSize: number;
258
+ outputSize: number;
259
+ savingsPercent: number;
260
+ }
261
+ declare function minifyCss(input: string): CssResult;
262
+ declare function formatCss(input: string, indentSize?: number): CssResult;
263
+ declare function countRules(css: string): number;
264
+ declare function countProperties(css: string): number;
254
265
 
255
266
  declare const code_ALL_FLAGS: typeof ALL_FLAGS;
256
267
  type code_ApiEndpoint = ApiEndpoint;
257
268
  type code_ApiInfo = ApiInfo;
258
269
  declare const code_CHEATSHEET: typeof CHEATSHEET;
259
270
  type code_CheatsheetEntry = CheatsheetEntry;
271
+ type code_CssResult = CssResult;
260
272
  type code_DockerImageRef = DockerImageRef;
261
273
  type code_EnvEntry = EnvEntry;
262
274
  type code_EnvParseResult = EnvParseResult;
@@ -288,10 +300,13 @@ declare const code_buildDockerRun: typeof buildDockerRun;
288
300
  declare const code_buildGitCommand: typeof buildGitCommand;
289
301
  declare const code_collapseHtmlWhitespace: typeof collapseHtmlWhitespace;
290
302
  declare const code_collapseJsWhitespace: typeof collapseJsWhitespace;
303
+ declare const code_countProperties: typeof countProperties;
304
+ declare const code_countRules: typeof countRules;
291
305
  declare const code_detectDialect: typeof detectDialect;
292
306
  declare const code_detectOperationType: typeof detectOperationType;
293
307
  declare const code_envToExport: typeof envToExport;
294
308
  declare const code_envToJson: typeof envToJson;
309
+ declare const code_formatCss: typeof formatCss;
295
310
  declare const code_formatGql: typeof formatGql;
296
311
  declare const code_formatHtml: typeof formatHtml;
297
312
  declare const code_formatSql: typeof formatSql;
@@ -300,6 +315,7 @@ declare const code_getHtmlStats: typeof getHtmlStats;
300
315
  declare const code_getJsStats: typeof getJsStats;
301
316
  declare const code_getMethodColor: typeof getMethodColor;
302
317
  declare const code_isValidTag: typeof isValidTag;
318
+ declare const code_minifyCss: typeof minifyCss;
303
319
  declare const code_minifyGql: typeof minifyGql;
304
320
  declare const code_minifyHtml: typeof minifyHtml;
305
321
  declare const code_minifyJs: typeof minifyJs;
@@ -321,7 +337,7 @@ declare const code_testPattern: typeof testPattern;
321
337
  declare const code_testRegex: typeof testRegex;
322
338
  declare const code_validateEnvKey: typeof validateEnvKey;
323
339
  declare namespace code {
324
- export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, type code_MatchResult as MatchResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
340
+ export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, type code_MatchResult as MatchResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
325
341
  }
326
342
 
327
- export { normalizeRef as $, ALL_FLAGS as A, envToExport as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, envToJson as F, type GitCommandConfig as G, type HtmlFormatResult as H, formatGql as I, type JsMinifyOptions as J, formatHtml as K, formatSql as L, type MatchResult as M, getEndpointsByTag as N, OPERATIONS as O, type ParsedSpec as P, getHtmlStats as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, getJsStats as U, getMethodColor as V, isValidTag as W, minifyGql as X, minifyHtml as Y, minifyJs as Z, minifySql as _, type ApiEndpoint as a, parseDockerImage as a0, parseEnv as a1, parseGitCommand as a2, parseSpec as a3, removeConsoleCalls as a4, removeEmptyAttributes as a5, removeHtmlComments as a6, removeJsComments as a7, removeRedundantAttributes as a8, searchCheatsheet as a9, searchEndpoints as aa, splitStatements as ab, testPattern as ac, testRegex as ad, validateEnvKey as ae, type ApiInfo as b, code as c, type CheatsheetEntry as d, type EnvParseResult as e, type GitCommandResult as f, type GitOperation as g, type GqlFormatResult as h, type HtmlMinifyOptions as i, type HtmlMinifyResult as j, type JsMinifyResult as k, type RegexFlag as l, type RegexMatch as m, type RegexResult as n, type RegexSuccess as o, type Segment as p, type SpecVersion as q, type SqlDialect as r, type SqlFormatOptions as s, buildDockerPull as t, buildDockerRun as u, buildGitCommand as v, collapseHtmlWhitespace as w, collapseJsWhitespace as x, detectDialect as y, detectOperationType as z };
343
+ export { minifyCss as $, ALL_FLAGS as A, countRules as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, detectDialect as F, type GitCommandConfig as G, type HtmlFormatResult as H, detectOperationType as I, type JsMinifyOptions as J, envToExport as K, envToJson as L, type MatchResult as M, formatCss as N, OPERATIONS as O, type ParsedSpec as P, formatGql as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, formatHtml as U, formatSql as V, getEndpointsByTag as W, getHtmlStats as X, getJsStats as Y, getMethodColor as Z, isValidTag as _, type ApiEndpoint as a, minifyGql as a0, minifyHtml as a1, minifyJs as a2, minifySql as a3, normalizeRef as a4, parseDockerImage as a5, parseEnv as a6, parseGitCommand as a7, parseSpec as a8, removeConsoleCalls as a9, removeEmptyAttributes as aa, removeHtmlComments as ab, removeJsComments as ac, removeRedundantAttributes as ad, searchCheatsheet as ae, searchEndpoints as af, splitStatements as ag, testPattern as ah, testRegex as ai, validateEnvKey as aj, type ApiInfo as b, code as c, type CheatsheetEntry as d, type CssResult as e, type EnvParseResult as f, type GitCommandResult as g, type GitOperation as h, type GqlFormatResult as i, type HtmlMinifyOptions as j, type HtmlMinifyResult as k, type JsMinifyResult as l, type RegexFlag as m, type RegexMatch as n, type RegexResult as o, type RegexSuccess as p, type Segment as q, type SpecVersion as r, type SqlDialect as s, type SqlFormatOptions as t, buildDockerPull as u, buildDockerRun as v, buildGitCommand as w, collapseHtmlWhitespace as x, collapseJsWhitespace as y, countProperties as z };
@@ -16,6 +16,7 @@
16
16
  * removeConsoleCalls, getJsStats)
17
17
  * - openapi-viewer (parseSpec, getEndpointsByTag, searchEndpoints, getMethodColor)
18
18
  * - env-parser (parseEnv, envToJson, envToExport, validateEnvKey)
19
+ * - css-minifier (minifyCss, formatCss, countRules, countProperties)
19
20
  */
20
21
  type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
21
22
  declare const ALL_FLAGS: RegexFlag[];
@@ -251,12 +252,23 @@ declare function envToJson(input: string): string | {
251
252
  };
252
253
  declare function envToExport(input: string): string;
253
254
  declare function validateEnvKey(key: string): boolean;
255
+ interface CssResult {
256
+ output: string;
257
+ originalSize: number;
258
+ outputSize: number;
259
+ savingsPercent: number;
260
+ }
261
+ declare function minifyCss(input: string): CssResult;
262
+ declare function formatCss(input: string, indentSize?: number): CssResult;
263
+ declare function countRules(css: string): number;
264
+ declare function countProperties(css: string): number;
254
265
 
255
266
  declare const code_ALL_FLAGS: typeof ALL_FLAGS;
256
267
  type code_ApiEndpoint = ApiEndpoint;
257
268
  type code_ApiInfo = ApiInfo;
258
269
  declare const code_CHEATSHEET: typeof CHEATSHEET;
259
270
  type code_CheatsheetEntry = CheatsheetEntry;
271
+ type code_CssResult = CssResult;
260
272
  type code_DockerImageRef = DockerImageRef;
261
273
  type code_EnvEntry = EnvEntry;
262
274
  type code_EnvParseResult = EnvParseResult;
@@ -288,10 +300,13 @@ declare const code_buildDockerRun: typeof buildDockerRun;
288
300
  declare const code_buildGitCommand: typeof buildGitCommand;
289
301
  declare const code_collapseHtmlWhitespace: typeof collapseHtmlWhitespace;
290
302
  declare const code_collapseJsWhitespace: typeof collapseJsWhitespace;
303
+ declare const code_countProperties: typeof countProperties;
304
+ declare const code_countRules: typeof countRules;
291
305
  declare const code_detectDialect: typeof detectDialect;
292
306
  declare const code_detectOperationType: typeof detectOperationType;
293
307
  declare const code_envToExport: typeof envToExport;
294
308
  declare const code_envToJson: typeof envToJson;
309
+ declare const code_formatCss: typeof formatCss;
295
310
  declare const code_formatGql: typeof formatGql;
296
311
  declare const code_formatHtml: typeof formatHtml;
297
312
  declare const code_formatSql: typeof formatSql;
@@ -300,6 +315,7 @@ declare const code_getHtmlStats: typeof getHtmlStats;
300
315
  declare const code_getJsStats: typeof getJsStats;
301
316
  declare const code_getMethodColor: typeof getMethodColor;
302
317
  declare const code_isValidTag: typeof isValidTag;
318
+ declare const code_minifyCss: typeof minifyCss;
303
319
  declare const code_minifyGql: typeof minifyGql;
304
320
  declare const code_minifyHtml: typeof minifyHtml;
305
321
  declare const code_minifyJs: typeof minifyJs;
@@ -321,7 +337,7 @@ declare const code_testPattern: typeof testPattern;
321
337
  declare const code_testRegex: typeof testRegex;
322
338
  declare const code_validateEnvKey: typeof validateEnvKey;
323
339
  declare namespace code {
324
- export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, type code_MatchResult as MatchResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
340
+ export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, type code_MatchResult as MatchResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
325
341
  }
326
342
 
327
- export { normalizeRef as $, ALL_FLAGS as A, envToExport as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, envToJson as F, type GitCommandConfig as G, type HtmlFormatResult as H, formatGql as I, type JsMinifyOptions as J, formatHtml as K, formatSql as L, type MatchResult as M, getEndpointsByTag as N, OPERATIONS as O, type ParsedSpec as P, getHtmlStats as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, getJsStats as U, getMethodColor as V, isValidTag as W, minifyGql as X, minifyHtml as Y, minifyJs as Z, minifySql as _, type ApiEndpoint as a, parseDockerImage as a0, parseEnv as a1, parseGitCommand as a2, parseSpec as a3, removeConsoleCalls as a4, removeEmptyAttributes as a5, removeHtmlComments as a6, removeJsComments as a7, removeRedundantAttributes as a8, searchCheatsheet as a9, searchEndpoints as aa, splitStatements as ab, testPattern as ac, testRegex as ad, validateEnvKey as ae, type ApiInfo as b, code as c, type CheatsheetEntry as d, type EnvParseResult as e, type GitCommandResult as f, type GitOperation as g, type GqlFormatResult as h, type HtmlMinifyOptions as i, type HtmlMinifyResult as j, type JsMinifyResult as k, type RegexFlag as l, type RegexMatch as m, type RegexResult as n, type RegexSuccess as o, type Segment as p, type SpecVersion as q, type SqlDialect as r, type SqlFormatOptions as s, buildDockerPull as t, buildDockerRun as u, buildGitCommand as v, collapseHtmlWhitespace as w, collapseJsWhitespace as x, detectDialect as y, detectOperationType as z };
343
+ export { minifyCss as $, ALL_FLAGS as A, countRules as B, CHEATSHEET as C, type DockerImageRef as D, type EnvEntry as E, detectDialect as F, type GitCommandConfig as G, type HtmlFormatResult as H, detectOperationType as I, type JsMinifyOptions as J, envToExport as K, envToJson as L, type MatchResult as M, formatCss as N, OPERATIONS as O, type ParsedSpec as P, formatGql as Q, type RegexError as R, SQL_DEFAULT_OPTIONS as S, type TestPatternResult as T, formatHtml as U, formatSql as V, getEndpointsByTag as W, getHtmlStats as X, getJsStats as Y, getMethodColor as Z, isValidTag as _, type ApiEndpoint as a, minifyGql as a0, minifyHtml as a1, minifyJs as a2, minifySql as a3, normalizeRef as a4, parseDockerImage as a5, parseEnv as a6, parseGitCommand as a7, parseSpec as a8, removeConsoleCalls as a9, removeEmptyAttributes as aa, removeHtmlComments as ab, removeJsComments as ac, removeRedundantAttributes as ad, searchCheatsheet as ae, searchEndpoints as af, splitStatements as ag, testPattern as ah, testRegex as ai, validateEnvKey as aj, type ApiInfo as b, code as c, type CheatsheetEntry as d, type CssResult as e, type EnvParseResult as f, type GitCommandResult as g, type GitOperation as h, type GqlFormatResult as i, type HtmlMinifyOptions as j, type HtmlMinifyResult as k, type JsMinifyResult as l, type RegexFlag as m, type RegexMatch as n, type RegexResult as o, type RegexSuccess as p, type Segment as q, type SpecVersion as r, type SqlDialect as s, type SqlFormatOptions as t, buildDockerPull as u, buildDockerRun as v, buildGitCommand as w, collapseHtmlWhitespace as x, collapseJsWhitespace as y, countProperties as z };
package/dist/index.cjs CHANGED
@@ -9798,10 +9798,13 @@ __export(code_exports, {
9798
9798
  buildGitCommand: () => buildGitCommand,
9799
9799
  collapseHtmlWhitespace: () => collapseHtmlWhitespace,
9800
9800
  collapseJsWhitespace: () => collapseJsWhitespace,
9801
+ countProperties: () => countProperties,
9802
+ countRules: () => countRules,
9801
9803
  detectDialect: () => detectDialect,
9802
9804
  detectOperationType: () => detectOperationType,
9803
9805
  envToExport: () => envToExport2,
9804
9806
  envToJson: () => envToJson2,
9807
+ formatCss: () => formatCss,
9805
9808
  formatGql: () => formatGql,
9806
9809
  formatHtml: () => formatHtml,
9807
9810
  formatSql: () => formatSql,
@@ -9810,6 +9813,7 @@ __export(code_exports, {
9810
9813
  getJsStats: () => getJsStats,
9811
9814
  getMethodColor: () => getMethodColor,
9812
9815
  isValidTag: () => isValidTag,
9816
+ minifyCss: () => minifyCss,
9813
9817
  minifyGql: () => minifyGql,
9814
9818
  minifyHtml: () => minifyHtml,
9815
9819
  minifyJs: () => minifyJs,
@@ -11996,6 +12000,69 @@ function envToExport2(input) {
11996
12000
  function validateEnvKey2(key) {
11997
12001
  return /^[A-Za-z_][A-Za-z0-9_]*$/.test(key);
11998
12002
  }
12003
+ function _calcCssResult(input, output) {
12004
+ const originalSize = input.length;
12005
+ const outputSize = output.length;
12006
+ const savingsPercent = originalSize === 0 ? 0 : Math.round((originalSize - outputSize) / originalSize * 100 * 100) / 100;
12007
+ return { output, originalSize, outputSize, savingsPercent };
12008
+ }
12009
+ function minifyCss(input) {
12010
+ let output = input;
12011
+ output = output.replace(/\/\*[\s\S]*?\*\//g, "");
12012
+ output = output.replace(/\s+/g, " ");
12013
+ output = output.replace(/\s*{\s*/g, "{");
12014
+ output = output.replace(/\s*}\s*/g, "}");
12015
+ output = output.replace(/\s*:\s*/g, ":");
12016
+ output = output.replace(/\s*;\s*/g, ";");
12017
+ output = output.replace(/\s*,\s*/g, ",");
12018
+ output = output.replace(/;}/g, "}");
12019
+ output = output.trim();
12020
+ return _calcCssResult(input, output);
12021
+ }
12022
+ function formatCss(input, indentSize = 2) {
12023
+ const indent = " ".repeat(indentSize);
12024
+ const { output: minified } = minifyCss(input);
12025
+ let result = "";
12026
+ let insideBlock = false;
12027
+ let i = 0;
12028
+ while (i < minified.length) {
12029
+ const char = minified[i];
12030
+ if (char === "{") {
12031
+ result += " {\n";
12032
+ insideBlock = true;
12033
+ } else if (char === "}") {
12034
+ result = result.trimEnd() + "\n";
12035
+ result += "}\n\n";
12036
+ insideBlock = false;
12037
+ } else if (char === ";" && insideBlock) {
12038
+ result += ";\n";
12039
+ if (i + 1 < minified.length && minified[i + 1] !== "}") result += indent;
12040
+ } else {
12041
+ if (insideBlock && result.endsWith("{\n")) result += indent;
12042
+ result += char;
12043
+ }
12044
+ i++;
12045
+ }
12046
+ return _calcCssResult(input, result.trimEnd());
12047
+ }
12048
+ function countRules(css) {
12049
+ return (css.match(/{/g) ?? []).length;
12050
+ }
12051
+ function countProperties(css) {
12052
+ let count = 0;
12053
+ let insideBlock = false;
12054
+ for (const char of css) {
12055
+ if (char === "{") insideBlock = true;
12056
+ else if (char === "}") insideBlock = false;
12057
+ else if (char === ";" && insideBlock) count++;
12058
+ }
12059
+ css.replace(/{[^{}]*}/g, (block) => {
12060
+ const last = block.slice(1, -1).trim().split(";").pop()?.trim();
12061
+ if (last?.includes(":")) count++;
12062
+ return block;
12063
+ });
12064
+ return count;
12065
+ }
11999
12066
 
12000
12067
  // src/tools/color.ts
12001
12068
  var color_exports = {};
@@ -13139,10 +13206,10 @@ __export(css_exports, {
13139
13206
  calcClamp: () => calcClamp,
13140
13207
  calcSpecificity: () => calcSpecificity,
13141
13208
  compareSpecificity: () => compareSpecificity,
13142
- countProperties: () => countProperties,
13143
- countRules: () => countRules,
13209
+ countProperties: () => countProperties2,
13210
+ countRules: () => countRules2,
13144
13211
  explainSelector: () => explainSelector,
13145
- formatCss: () => formatCss,
13212
+ formatCss: () => formatCss2,
13146
13213
  generateAnimationCSS: () => generateAnimationCSS,
13147
13214
  generateBorderRadius: () => generateBorderRadius,
13148
13215
  generateBoxShadow: () => generateBoxShadow,
@@ -13156,7 +13223,7 @@ __export(css_exports, {
13156
13223
  generateKeyframesCSS: () => generateKeyframesCSS,
13157
13224
  getCurvePoints: () => getCurvePoints,
13158
13225
  isUniform: () => isUniform,
13159
- minifyCss: () => minifyCss,
13226
+ minifyCss: () => minifyCss2,
13160
13227
  multipleSelectors: () => multipleSelectors,
13161
13228
  parseBorderRadius: () => parseBorderRadius,
13162
13229
  parseBoxShadow: () => parseBoxShadow,
@@ -14032,7 +14099,7 @@ function calcCssResult(input, output) {
14032
14099
  const savingsPercent = originalSize === 0 ? 0 : Math.round((originalSize - outputSize) / originalSize * 100 * 100) / 100;
14033
14100
  return { output, originalSize, outputSize, savingsPercent };
14034
14101
  }
14035
- function minifyCss(input) {
14102
+ function minifyCss2(input) {
14036
14103
  let output = input;
14037
14104
  output = output.replace(/\/\*[\s\S]*?\*\//g, "");
14038
14105
  output = output.replace(/\s+/g, " ");
@@ -14045,9 +14112,9 @@ function minifyCss(input) {
14045
14112
  output = output.trim();
14046
14113
  return calcCssResult(input, output);
14047
14114
  }
14048
- function formatCss(input, indentSize = 2) {
14115
+ function formatCss2(input, indentSize = 2) {
14049
14116
  const indent = " ".repeat(indentSize);
14050
- const { output: minified } = minifyCss(input);
14117
+ const { output: minified } = minifyCss2(input);
14051
14118
  let result = "";
14052
14119
  let insideBlock = false;
14053
14120
  let i = 0;
@@ -14079,11 +14146,11 @@ function formatCss(input, indentSize = 2) {
14079
14146
  const output = result.trimEnd();
14080
14147
  return calcCssResult(input, output);
14081
14148
  }
14082
- function countRules(css) {
14149
+ function countRules2(css) {
14083
14150
  const matches = css.match(/{/g);
14084
14151
  return matches ? matches.length : 0;
14085
14152
  }
14086
- function countProperties(css) {
14153
+ function countProperties2(css) {
14087
14154
  let count = 0;
14088
14155
  let insideBlock = false;
14089
14156
  for (let i = 0; i < css.length; i++) {
@@ -14369,6 +14436,7 @@ __export(misc_exports, {
14369
14436
  COLOR_PRESETS: () => COLOR_PRESETS,
14370
14437
  DATA_TYPES: () => DATA_TYPES2,
14371
14438
  DEFAULT_CONFIG: () => DEFAULT_CONFIG2,
14439
+ DEFAULT_QR_OPTIONS: () => DEFAULT_QR_OPTIONS2,
14372
14440
  FORMAT_EXTENSIONS: () => FORMAT_EXTENSIONS,
14373
14441
  FORMAT_LABELS: () => FORMAT_LABELS,
14374
14442
  analyzeString: () => analyzeString,
@@ -14384,6 +14452,9 @@ __export(misc_exports, {
14384
14452
  formatSvg: () => formatSvg,
14385
14453
  fromUnicodeEscape: () => fromUnicodeEscape,
14386
14454
  generateData: () => generateData2,
14455
+ generateMetaHtml: () => generateMetaHtml2,
14456
+ generateQrDataUrl: () => generateQrDataUrl2,
14457
+ generateQrSvg: () => generateQrSvg2,
14387
14458
  generateSingle: () => generateSingle2,
14388
14459
  generateSvgFavicon: () => generateSvgFavicon,
14389
14460
  getConversionWarnings: () => getConversionWarnings,
@@ -14397,10 +14468,12 @@ __export(misc_exports, {
14397
14468
  numberToWords: () => numberToWords2,
14398
14469
  optimizeSvg: () => optimizeSvg,
14399
14470
  ordinalWords: () => ordinalWords2,
14471
+ parseMetaTags: () => parseMetaTags2,
14400
14472
  romanToNumber: () => romanToNumber2,
14401
14473
  sanitizeSvg: () => sanitizeSvg,
14402
14474
  svgToDataUrl: () => svgToDataUrl,
14403
- toUnicodeEscape: () => toUnicodeEscape
14475
+ toUnicodeEscape: () => toUnicodeEscape,
14476
+ validateOgTags: () => validateOgTags2
14404
14477
  });
14405
14478
  var NAMED_HTML_ENTITIES = {
14406
14479
  34: "&quot;",
@@ -15445,6 +15518,130 @@ function generateData2(config) {
15445
15518
  }
15446
15519
  return results;
15447
15520
  }
15521
+ var DEFAULT_QR_OPTIONS2 = {
15522
+ errorLevel: "M",
15523
+ size: 256,
15524
+ margin: 1,
15525
+ darkColor: "#000000",
15526
+ lightColor: "#ffffff"
15527
+ };
15528
+ async function generateQrSvg2(text, options) {
15529
+ const o = { ...DEFAULT_QR_OPTIONS2, ...options };
15530
+ return QRCode__default.default.toString(text, {
15531
+ type: "svg",
15532
+ errorCorrectionLevel: o.errorLevel,
15533
+ margin: o.margin,
15534
+ color: { dark: o.darkColor, light: o.lightColor }
15535
+ });
15536
+ }
15537
+ async function generateQrDataUrl2(text, options) {
15538
+ const o = { ...DEFAULT_QR_OPTIONS2, ...options };
15539
+ return QRCode__default.default.toDataURL(text, {
15540
+ width: o.size,
15541
+ errorCorrectionLevel: o.errorLevel,
15542
+ margin: o.margin,
15543
+ color: { dark: o.darkColor, light: o.lightColor }
15544
+ });
15545
+ }
15546
+ function _getMetaContent(html, property) {
15547
+ const esc = property.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
15548
+ const patterns = [
15549
+ new RegExp(`<meta[^>]+property=["']${esc}["'][^>]+content=["']([^"']*)["']`, "i"),
15550
+ new RegExp(`<meta[^>]+content=["']([^"']*)["'][^>]+property=["']${esc}["']`, "i"),
15551
+ new RegExp(`<meta[^>]+name=["']${esc}["'][^>]+content=["']([^"']*)["']`, "i"),
15552
+ new RegExp(`<meta[^>]+content=["']([^"']*)["'][^>]+name=["']${esc}["']`, "i")
15553
+ ];
15554
+ for (const p of patterns) {
15555
+ const m = html.match(p);
15556
+ if (m) return m[1];
15557
+ }
15558
+ return void 0;
15559
+ }
15560
+ function parseMetaTags2(html) {
15561
+ const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i);
15562
+ const canonicalMatch = html.match(/<link[^>]+rel=["']canonical["'][^>]+href=["']([^"']*)["']/i) || html.match(/<link[^>]+href=["']([^"']*)["'][^>]+rel=["']canonical["']/i);
15563
+ const charsetMatch = html.match(/<meta[^>]+charset=["']([^"']*)["']/i) || html.match(/<meta[^>]+charset=([^\s>]*)/i);
15564
+ return {
15565
+ og: {
15566
+ title: _getMetaContent(html, "og:title"),
15567
+ description: _getMetaContent(html, "og:description"),
15568
+ image: _getMetaContent(html, "og:image"),
15569
+ imageAlt: _getMetaContent(html, "og:image:alt"),
15570
+ imageWidth: _getMetaContent(html, "og:image:width"),
15571
+ imageHeight: _getMetaContent(html, "og:image:height"),
15572
+ url: _getMetaContent(html, "og:url"),
15573
+ type: _getMetaContent(html, "og:type"),
15574
+ siteName: _getMetaContent(html, "og:site_name"),
15575
+ locale: _getMetaContent(html, "og:locale")
15576
+ },
15577
+ twitter: {
15578
+ card: _getMetaContent(html, "twitter:card"),
15579
+ site: _getMetaContent(html, "twitter:site"),
15580
+ creator: _getMetaContent(html, "twitter:creator"),
15581
+ title: _getMetaContent(html, "twitter:title"),
15582
+ description: _getMetaContent(html, "twitter:description"),
15583
+ image: _getMetaContent(html, "twitter:image")
15584
+ },
15585
+ standard: {
15586
+ title: titleMatch ? titleMatch[1].trim() : void 0,
15587
+ description: _getMetaContent(html, "description"),
15588
+ keywords: _getMetaContent(html, "keywords"),
15589
+ canonical: canonicalMatch ? canonicalMatch[1] : void 0,
15590
+ robots: _getMetaContent(html, "robots"),
15591
+ viewport: _getMetaContent(html, "viewport"),
15592
+ charset: charsetMatch ? charsetMatch[1] : void 0
15593
+ }
15594
+ };
15595
+ }
15596
+ function validateOgTags2(tags) {
15597
+ const warnings = [];
15598
+ const missing = [];
15599
+ const required = ["title", "description", "image", "url", "type"];
15600
+ for (const field of required) {
15601
+ if (!tags[field]) missing.push(`og:${field}`);
15602
+ }
15603
+ if (tags.image && !/^https?:\/\//i.test(tags.image))
15604
+ warnings.push("og:image should be an absolute URL");
15605
+ if (tags.url && !/^https?:\/\//i.test(tags.url))
15606
+ warnings.push("og:url should be an absolute URL");
15607
+ if (tags.title && tags.title.length > 95)
15608
+ warnings.push("og:title is longer than 95 characters and may be truncated");
15609
+ if (tags.description && tags.description.length > 300)
15610
+ warnings.push("og:description is longer than 300 characters and may be truncated");
15611
+ const standardTypes = ["website", "article", "video.movie", "video.episode", "music.song", "music.album", "book", "profile"];
15612
+ if (tags.type && !standardTypes.includes(tags.type))
15613
+ warnings.push(`og:type "${tags.type}" is not a standard type`);
15614
+ return { warnings, missing };
15615
+ }
15616
+ function generateMetaHtml2(tags) {
15617
+ const lines = [];
15618
+ const ogMap = {
15619
+ title: "og:title",
15620
+ description: "og:description",
15621
+ image: "og:image",
15622
+ imageAlt: "og:image:alt",
15623
+ imageWidth: "og:image:width",
15624
+ imageHeight: "og:image:height",
15625
+ url: "og:url",
15626
+ type: "og:type",
15627
+ siteName: "og:site_name",
15628
+ locale: "og:locale"
15629
+ };
15630
+ const twitterMap = {
15631
+ card: "twitter:card",
15632
+ site: "twitter:site",
15633
+ creator: "twitter:creator"
15634
+ };
15635
+ for (const [key, property] of Object.entries(ogMap)) {
15636
+ const v = tags[key];
15637
+ if (v) lines.push(`<meta property="${property}" content="${v}" />`);
15638
+ }
15639
+ for (const [key, name] of Object.entries(twitterMap)) {
15640
+ const v = tags[key];
15641
+ if (v) lines.push(`<meta name="${name}" content="${v}" />`);
15642
+ }
15643
+ return lines.join("\n");
15644
+ }
15448
15645
 
15449
15646
  // src/index.ts
15450
15647
  var version = "0.1.0";
package/dist/index.d.cts CHANGED
@@ -8,10 +8,10 @@ export { t as time } from './time-DbT8fjaF.cjs';
8
8
  export { u as units } from './units-6lwDYBvX.cjs';
9
9
  export { n as network } from './network-CNtmrDeN.cjs';
10
10
  export { a as api } from './api-8aZtWhSj.cjs';
11
- export { c as code } from './code-QNrdLIR3.cjs';
11
+ export { c as code } from './code-BUqyaofO.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
14
- export { m as misc } from './misc-DcVBManm.cjs';
14
+ export { m as misc } from './misc-CA3N198T.cjs';
15
15
 
16
16
  declare const version = "0.1.0";
17
17
 
package/dist/index.d.ts CHANGED
@@ -8,10 +8,10 @@ export { t as time } from './time-DbT8fjaF.js';
8
8
  export { u as units } from './units-6lwDYBvX.js';
9
9
  export { n as network } from './network-CNtmrDeN.js';
10
10
  export { a as api } from './api-8aZtWhSj.js';
11
- export { c as code } from './code-QNrdLIR3.js';
11
+ export { c as code } from './code-BUqyaofO.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
14
- export { m as misc } from './misc-DcVBManm.js';
14
+ export { m as misc } from './misc-CA3N198T.js';
15
15
 
16
16
  declare const version = "0.1.0";
17
17