@uptrademedia/site-kit 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/dist/analytics/index.js +7 -7
- package/dist/analytics/index.mjs +3 -3
- package/dist/api-QUIPJJCX.js +77 -0
- package/dist/api-QUIPJJCX.js.map +1 -0
- package/dist/api-V3BA5PMX.mjs +4 -0
- package/dist/api-V3BA5PMX.mjs.map +1 -0
- package/dist/blog/index.d.mts +2 -2
- package/dist/blog/index.d.ts +2 -2
- package/dist/blog/index.js +40 -6
- package/dist/blog/index.js.map +1 -1
- package/dist/blog/index.mjs +40 -6
- package/dist/blog/index.mjs.map +1 -1
- package/dist/blog/server.d.mts +3 -2
- package/dist/blog/server.d.ts +3 -2
- package/dist/blog/server.js +13 -6
- package/dist/blog/server.js.map +1 -1
- package/dist/blog/server.mjs +13 -6
- package/dist/blog/server.mjs.map +1 -1
- package/dist/{chunk-FKVJOT2F.mjs → chunk-42EXHJTC.mjs} +196 -7
- package/dist/chunk-42EXHJTC.mjs.map +1 -0
- package/dist/{scanner-AZV5I6US.mjs → chunk-44OMJFCG.mjs} +354 -14
- package/dist/chunk-44OMJFCG.mjs.map +1 -0
- package/dist/chunk-4TGJYNHV.js +981 -0
- package/dist/chunk-4TGJYNHV.js.map +1 -0
- package/dist/chunk-4XPGGLVP.mjs +53 -0
- package/dist/{chunk-NYKRE2FL.mjs.map → chunk-4XPGGLVP.mjs.map} +1 -1
- package/dist/{generators-TO2FKJR6.mjs → chunk-6ONUXZDO.mjs} +26 -9
- package/dist/chunk-6ONUXZDO.mjs.map +1 -0
- package/dist/chunk-CG53ASWX.mjs +729 -0
- package/dist/chunk-CG53ASWX.mjs.map +1 -0
- package/dist/{scanner-ETJAMIT7.js → chunk-DERI27QC.js} +448 -102
- package/dist/chunk-DERI27QC.js.map +1 -0
- package/dist/chunk-DYM5ML2V.mjs +1518 -0
- package/dist/chunk-DYM5ML2V.mjs.map +1 -0
- package/dist/chunk-FLZZOX44.js +1526 -0
- package/dist/chunk-FLZZOX44.js.map +1 -0
- package/dist/{chunk-7H6I3ECV.mjs → chunk-FQVGK746.mjs} +63 -3
- package/dist/chunk-FQVGK746.mjs.map +1 -0
- package/dist/{chunk-GQ6ZOU2N.mjs → chunk-JGQPAXTL.mjs} +4 -4
- package/dist/{chunk-GQ6ZOU2N.mjs.map → chunk-JGQPAXTL.mjs.map} +1 -1
- package/dist/{chunk-V3F5J6CV.js → chunk-JUEVN4Q4.js} +196 -7
- package/dist/chunk-JUEVN4Q4.js.map +1 -0
- package/dist/chunk-KKMGTT7F.mjs +968 -0
- package/dist/chunk-KKMGTT7F.mjs.map +1 -0
- package/dist/{chunk-XQJX252G.mjs → chunk-MB3WR5KJ.mjs} +28 -18
- package/dist/chunk-MB3WR5KJ.mjs.map +1 -0
- package/dist/{chunk-2IHTEKHU.mjs → chunk-QD5CN2OI.mjs} +16 -7
- package/dist/chunk-QD5CN2OI.mjs.map +1 -0
- package/dist/{chunk-SBVEYCSV.js → chunk-QQB4FO4Q.js} +7 -7
- package/dist/{chunk-SBVEYCSV.js.map → chunk-QQB4FO4Q.js.map} +1 -1
- package/dist/{generators-YZWIGHCO.js → chunk-S2GXR5HY.js} +26 -9
- package/dist/chunk-S2GXR5HY.js.map +1 -0
- package/dist/{chunk-O2OHHBUD.js → chunk-TDK7DLCH.js} +30 -20
- package/dist/chunk-TDK7DLCH.js.map +1 -0
- package/dist/{chunk-QP5NCO2E.js → chunk-VDI7KYME.js} +67 -2
- package/dist/chunk-VDI7KYME.js.map +1 -0
- package/dist/chunk-VOR53RUR.js +753 -0
- package/dist/chunk-VOR53RUR.js.map +1 -0
- package/dist/{chunk-GAJLEDRD.js → chunk-ZKJ7JKFV.js} +16 -7
- package/dist/chunk-ZKJ7JKFV.js.map +1 -0
- package/dist/chunk-ZSMWDLMK.js +63 -0
- package/dist/{chunk-EQCVQC35.js.map → chunk-ZSMWDLMK.js.map} +1 -1
- package/dist/cli/index.js +37269 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +37233 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/commerce/index.js +1 -1
- package/dist/commerce/index.mjs +1 -1
- package/dist/commerce/server.d.mts +12 -3
- package/dist/commerce/server.d.ts +12 -3
- package/dist/commerce/server.js +71 -70
- package/dist/commerce/server.js.map +1 -1
- package/dist/commerce/server.mjs +71 -70
- package/dist/commerce/server.mjs.map +1 -1
- package/dist/engage/index.d.mts +6 -4
- package/dist/engage/index.d.ts +6 -4
- package/dist/engage/index.js +8 -4
- package/dist/engage/index.mjs +2 -2
- package/dist/forms/index.js +1 -1
- package/dist/forms/index.mjs +1 -1
- package/dist/generators-5EU4PTVF.js +33 -0
- package/dist/generators-5EU4PTVF.js.map +1 -0
- package/dist/generators-TYPILCWD.mjs +4 -0
- package/dist/generators-TYPILCWD.mjs.map +1 -0
- package/dist/images/index.js +11 -11
- package/dist/images/index.mjs +4 -4
- package/dist/index.d.mts +154 -5
- package/dist/index.d.ts +154 -5
- package/dist/index.js +940 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +819 -7
- package/dist/index.mjs.map +1 -1
- package/dist/llms/index.d.mts +657 -0
- package/dist/llms/index.d.ts +657 -0
- package/dist/llms/index.js +101 -0
- package/dist/llms/index.js.map +1 -0
- package/dist/llms/index.mjs +4 -0
- package/dist/llms/index.mjs.map +1 -0
- package/dist/migrator-ARLHUNB3.mjs +4 -0
- package/dist/migrator-ARLHUNB3.mjs.map +1 -0
- package/dist/migrator-VZLBH3VY.js +37 -0
- package/dist/migrator-VZLBH3VY.js.map +1 -0
- package/dist/redirects/index.js +1 -1
- package/dist/redirects/index.mjs +1 -1
- package/dist/reputation/index.js +1 -1
- package/dist/reputation/index.mjs +1 -1
- package/dist/{routing-BWjUF7lp.d.ts → routing-CF91y6NO.d.ts} +1 -1
- package/dist/{routing-CgmRi9tD.d.mts → routing-CIOFpFCB.d.mts} +1 -1
- package/dist/scanner-7ZMUM2P5.mjs +4 -0
- package/dist/scanner-7ZMUM2P5.mjs.map +1 -0
- package/dist/scanner-OY7UF3WA.js +53 -0
- package/dist/scanner-OY7UF3WA.js.map +1 -0
- package/dist/seo/index.d.mts +267 -7
- package/dist/seo/index.d.ts +267 -7
- package/dist/seo/index.js +432 -24
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +400 -11
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo/server.d.mts +11 -4
- package/dist/seo/server.d.ts +11 -4
- package/dist/seo/server.js +17 -17
- package/dist/seo/server.mjs +3 -3
- package/dist/setup/client.js +1 -1
- package/dist/setup/client.mjs +1 -1
- package/dist/setup/index.js +3 -3
- package/dist/setup/index.mjs +2 -2
- package/dist/setup/server.js +3 -3
- package/dist/setup/server.mjs +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/sitemap/index.js.map +1 -1
- package/dist/sitemap/index.mjs +2 -2
- package/dist/sitemap/index.mjs.map +1 -1
- package/dist/{types-C0pJGfbH.d.mts → types-D6FHAVWX.d.mts} +99 -3
- package/dist/{types-C0pJGfbH.d.ts → types-D6FHAVWX.d.ts} +99 -3
- package/dist/{types-BN4OwtCO.d.mts → types-DI0jnhjJ.d.mts} +2 -0
- package/dist/{types-BN4OwtCO.d.ts → types-DI0jnhjJ.d.ts} +2 -0
- package/dist/{types-BmzutFwy.d.ts → types-j8X4vUhB.d.mts} +19 -2
- package/dist/{types-BmzutFwy.d.mts → types-j8X4vUhB.d.ts} +19 -2
- package/dist/{web-vitals-BH55V7EJ.js → web-vitals-444RLW3B.js} +11 -11
- package/dist/{web-vitals-BH55V7EJ.js.map → web-vitals-444RLW3B.js.map} +1 -1
- package/dist/{web-vitals-RJYPWAR3.mjs → web-vitals-KPICZIEF.mjs} +3 -3
- package/dist/{web-vitals-RJYPWAR3.mjs.map → web-vitals-KPICZIEF.mjs.map} +1 -1
- package/package.json +9 -2
- package/dist/api-N35S3EES.js +0 -57
- package/dist/api-N35S3EES.js.map +0 -1
- package/dist/api-SYBTK7Z7.mjs +0 -4
- package/dist/api-SYBTK7Z7.mjs.map +0 -1
- package/dist/chunk-2IHTEKHU.mjs.map +0 -1
- package/dist/chunk-7H6I3ECV.mjs.map +0 -1
- package/dist/chunk-BGJLOJ7T.mjs +0 -605
- package/dist/chunk-BGJLOJ7T.mjs.map +0 -1
- package/dist/chunk-EQCVQC35.js +0 -35
- package/dist/chunk-FKVJOT2F.mjs.map +0 -1
- package/dist/chunk-GAJLEDRD.js.map +0 -1
- package/dist/chunk-NYKRE2FL.mjs +0 -31
- package/dist/chunk-O2OHHBUD.js.map +0 -1
- package/dist/chunk-QAYJV4KK.js +0 -608
- package/dist/chunk-QAYJV4KK.js.map +0 -1
- package/dist/chunk-QP5NCO2E.js.map +0 -1
- package/dist/chunk-V3F5J6CV.js.map +0 -1
- package/dist/chunk-XQJX252G.mjs.map +0 -1
- package/dist/generators-TO2FKJR6.mjs.map +0 -1
- package/dist/generators-YZWIGHCO.js.map +0 -1
- package/dist/migrator-V6KS75EA.mjs +0 -265
- package/dist/migrator-V6KS75EA.mjs.map +0 -1
- package/dist/migrator-XKM7YQCY.js +0 -272
- package/dist/migrator-XKM7YQCY.js.map +0 -1
- package/dist/scanner-AZV5I6US.mjs.map +0 -1
- package/dist/scanner-ETJAMIT7.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __commonJS, __toESM } from './chunk-
|
|
1
|
+
import { __commonJS, __toESM } from './chunk-4XPGGLVP.mjs';
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { parse } from '@babel/parser';
|
|
@@ -202,7 +202,7 @@ var require_generated = __commonJS({
|
|
|
202
202
|
exports$1.isJSXExpressionContainer = isJSXExpressionContainer2;
|
|
203
203
|
exports$1.isJSXFragment = isJSXFragment;
|
|
204
204
|
exports$1.isJSXIdentifier = isJSXIdentifier2;
|
|
205
|
-
exports$1.isJSXMemberExpression =
|
|
205
|
+
exports$1.isJSXMemberExpression = isJSXMemberExpression2;
|
|
206
206
|
exports$1.isJSXNamespacedName = isJSXNamespacedName;
|
|
207
207
|
exports$1.isJSXOpeningElement = isJSXOpeningElement;
|
|
208
208
|
exports$1.isJSXOpeningFragment = isJSXOpeningFragment;
|
|
@@ -1191,7 +1191,7 @@ var require_generated = __commonJS({
|
|
|
1191
1191
|
if (node.type !== "JSXIdentifier") return false;
|
|
1192
1192
|
return opts == null || (0, _shallowEqual.default)(node, opts);
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function isJSXMemberExpression2(node, opts) {
|
|
1195
1195
|
if (!node) return false;
|
|
1196
1196
|
if (node.type !== "JSXMemberExpression") return false;
|
|
1197
1197
|
return opts == null || (0, _shallowEqual.default)(node, opts);
|
|
@@ -13977,7 +13977,11 @@ async function scanCodebase(rootDir) {
|
|
|
13977
13977
|
forms: [],
|
|
13978
13978
|
metadata: [],
|
|
13979
13979
|
widgets: [],
|
|
13980
|
-
sitemaps: []
|
|
13980
|
+
sitemaps: [],
|
|
13981
|
+
schemas: [],
|
|
13982
|
+
faqs: [],
|
|
13983
|
+
analytics: [],
|
|
13984
|
+
images: []
|
|
13981
13985
|
};
|
|
13982
13986
|
const files = await findSourceFiles(rootDir);
|
|
13983
13987
|
for (const file of files) {
|
|
@@ -13996,12 +14000,37 @@ async function scanCodebase(rootDir) {
|
|
|
13996
14000
|
results.widgets.push(...widgets);
|
|
13997
14001
|
const sitemaps = scanForSitemaps(content, relPath);
|
|
13998
14002
|
results.sitemaps.push(...sitemaps);
|
|
14003
|
+
const schemas = scanForSchemas(ast, content, relPath);
|
|
14004
|
+
results.schemas.push(...schemas);
|
|
14005
|
+
const faqs = scanForFAQs(ast, content, relPath);
|
|
14006
|
+
results.faqs.push(...faqs);
|
|
14007
|
+
const analytics = scanForAnalytics(ast, content, relPath);
|
|
14008
|
+
results.analytics.push(...analytics);
|
|
14009
|
+
const images = scanForImages(ast, content, relPath);
|
|
14010
|
+
results.images.push(...images);
|
|
13999
14011
|
} catch (error) {
|
|
14000
14012
|
continue;
|
|
14001
14013
|
}
|
|
14002
14014
|
}
|
|
14003
14015
|
const sitemapFiles = await scanForSitemapFiles(rootDir);
|
|
14004
14016
|
results.sitemaps.push(...sitemapFiles);
|
|
14017
|
+
const layoutsWithMetadata = /* @__PURE__ */ new Set();
|
|
14018
|
+
for (const meta of results.metadata) {
|
|
14019
|
+
if (meta.filePath.includes("/layout.") && meta.type !== "no-metadata") {
|
|
14020
|
+
const dir = meta.filePath.replace(/\/layout\.(tsx?|jsx?)$/, "");
|
|
14021
|
+
layoutsWithMetadata.add(dir);
|
|
14022
|
+
}
|
|
14023
|
+
}
|
|
14024
|
+
results.metadata = results.metadata.filter((meta) => {
|
|
14025
|
+
if (meta.type === "no-metadata") {
|
|
14026
|
+
const dir = meta.filePath.replace(/\/page\.(tsx?|jsx?)$/, "");
|
|
14027
|
+
if (layoutsWithMetadata.has(dir)) {
|
|
14028
|
+
return false;
|
|
14029
|
+
}
|
|
14030
|
+
meta.hasLayout = false;
|
|
14031
|
+
}
|
|
14032
|
+
return true;
|
|
14033
|
+
});
|
|
14005
14034
|
return results;
|
|
14006
14035
|
}
|
|
14007
14036
|
async function findSourceFiles(dir, files = []) {
|
|
@@ -14304,7 +14333,16 @@ function extractSubmitUrl(content) {
|
|
|
14304
14333
|
}
|
|
14305
14334
|
function scanForMetadata(ast, content, filePath) {
|
|
14306
14335
|
const metadata = [];
|
|
14307
|
-
|
|
14336
|
+
const isPageFile = /\/page\.(tsx?|jsx?)$/.test(filePath);
|
|
14337
|
+
const isLayoutFile = /\/layout\.(tsx?|jsx?)$/.test(filePath);
|
|
14338
|
+
if (!isPageFile && !isLayoutFile) {
|
|
14339
|
+
return metadata;
|
|
14340
|
+
}
|
|
14341
|
+
const isClientComponent = /['"]use client['"]/.test(content.split("\n").slice(0, 5).join("\n"));
|
|
14342
|
+
if (content.includes("getManagedMetadata")) {
|
|
14343
|
+
return metadata;
|
|
14344
|
+
}
|
|
14345
|
+
if (content.includes("export const metadata") || content.includes("export async function generateMetadata")) {
|
|
14308
14346
|
let title;
|
|
14309
14347
|
let description;
|
|
14310
14348
|
const titleMatch = content.match(/title:\s*['"]([^'"]+)['"]/);
|
|
@@ -14315,26 +14353,46 @@ function scanForMetadata(ast, content, filePath) {
|
|
|
14315
14353
|
filePath,
|
|
14316
14354
|
type: "next-metadata",
|
|
14317
14355
|
title,
|
|
14318
|
-
description
|
|
14356
|
+
description,
|
|
14357
|
+
isClientComponent
|
|
14319
14358
|
});
|
|
14359
|
+
return metadata;
|
|
14320
14360
|
}
|
|
14321
14361
|
if (content.includes("NextSeo") || content.includes("next-seo")) {
|
|
14322
14362
|
metadata.push({
|
|
14323
14363
|
filePath,
|
|
14324
|
-
type: "next-seo"
|
|
14364
|
+
type: "next-seo",
|
|
14365
|
+
isClientComponent
|
|
14325
14366
|
});
|
|
14367
|
+
return metadata;
|
|
14326
14368
|
}
|
|
14369
|
+
let hasHeadComponent = false;
|
|
14327
14370
|
traverse(ast, {
|
|
14328
14371
|
JSXElement(path2) {
|
|
14329
14372
|
const opening = path2.node.openingElement;
|
|
14330
14373
|
if (t.isJSXIdentifier(opening.name) && opening.name.name === "Head") {
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
type: "head"
|
|
14334
|
-
});
|
|
14374
|
+
hasHeadComponent = true;
|
|
14375
|
+
path2.stop();
|
|
14335
14376
|
}
|
|
14336
14377
|
}
|
|
14337
14378
|
});
|
|
14379
|
+
if (hasHeadComponent) {
|
|
14380
|
+
metadata.push({
|
|
14381
|
+
filePath,
|
|
14382
|
+
type: "head",
|
|
14383
|
+
isClientComponent
|
|
14384
|
+
});
|
|
14385
|
+
return metadata;
|
|
14386
|
+
}
|
|
14387
|
+
if (isPageFile) {
|
|
14388
|
+
filePath.replace(/\/page\.(tsx?|jsx?)$/, "");
|
|
14389
|
+
metadata.push({
|
|
14390
|
+
filePath,
|
|
14391
|
+
type: "no-metadata",
|
|
14392
|
+
isClientComponent
|
|
14393
|
+
// hasLayout will be determined by the caller
|
|
14394
|
+
});
|
|
14395
|
+
}
|
|
14338
14396
|
return metadata;
|
|
14339
14397
|
}
|
|
14340
14398
|
function scanForWidgets(ast, content, filePath) {
|
|
@@ -14499,7 +14557,289 @@ function extractExcludePaths(content) {
|
|
|
14499
14557
|
}
|
|
14500
14558
|
return paths;
|
|
14501
14559
|
}
|
|
14560
|
+
function scanForSchemas(ast, content, filePath) {
|
|
14561
|
+
const schemas = [];
|
|
14562
|
+
if (content.includes("@uptrade/site-kit") && content.includes("ManagedSchema")) {
|
|
14563
|
+
return schemas;
|
|
14564
|
+
}
|
|
14565
|
+
traverse(ast, {
|
|
14566
|
+
JSXElement(path2) {
|
|
14567
|
+
const opening = path2.node.openingElement;
|
|
14568
|
+
if (t.isJSXIdentifier(opening.name) && (opening.name.name === "script" || opening.name.name === "Script")) {
|
|
14569
|
+
const typeAttr = opening.attributes.find(
|
|
14570
|
+
(attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === "type"
|
|
14571
|
+
);
|
|
14572
|
+
if (typeAttr && t.isJSXAttribute(typeAttr)) {
|
|
14573
|
+
let typeValue = "";
|
|
14574
|
+
if (t.isStringLiteral(typeAttr.value)) {
|
|
14575
|
+
typeValue = typeAttr.value.value;
|
|
14576
|
+
}
|
|
14577
|
+
if (typeValue === "application/ld+json") {
|
|
14578
|
+
let schemaType = "Unknown";
|
|
14579
|
+
const typeMatch = content.match(/"@type"\s*:\s*"([^"]+)"/);
|
|
14580
|
+
if (typeMatch) {
|
|
14581
|
+
schemaType = typeMatch[1];
|
|
14582
|
+
}
|
|
14583
|
+
let detectedType = "json-ld";
|
|
14584
|
+
if (schemaType === "FAQPage") detectedType = "faq-schema";
|
|
14585
|
+
else if (schemaType === "Organization") detectedType = "organization";
|
|
14586
|
+
else if (schemaType === "LocalBusiness" || schemaType.includes("Business")) detectedType = "local-business";
|
|
14587
|
+
else if (schemaType === "Service" || schemaType.includes("Service")) detectedType = "service";
|
|
14588
|
+
else if (schemaType === "Product") detectedType = "product";
|
|
14589
|
+
else if (schemaType === "Article" || schemaType === "BlogPosting") detectedType = "article";
|
|
14590
|
+
schemas.push({
|
|
14591
|
+
filePath,
|
|
14592
|
+
type: detectedType,
|
|
14593
|
+
schemaType,
|
|
14594
|
+
startLine: path2.node.loc?.start.line || 0,
|
|
14595
|
+
endLine: path2.node.loc?.end.line || 0
|
|
14596
|
+
});
|
|
14597
|
+
}
|
|
14598
|
+
}
|
|
14599
|
+
}
|
|
14600
|
+
}
|
|
14601
|
+
});
|
|
14602
|
+
const jsonLdPattern = /@context["']?\s*:\s*["']https?:\/\/schema\.org/;
|
|
14603
|
+
if (jsonLdPattern.test(content)) {
|
|
14604
|
+
const typeMatch = content.match(/@type["']?\s*:\s*["']([^"']+)["']/);
|
|
14605
|
+
if (typeMatch && !schemas.some((s) => s.schemaType === typeMatch[1])) {
|
|
14606
|
+
schemas.push({
|
|
14607
|
+
filePath,
|
|
14608
|
+
type: "json-ld",
|
|
14609
|
+
schemaType: typeMatch[1],
|
|
14610
|
+
startLine: findLineNumber(content, "@context"),
|
|
14611
|
+
endLine: findLineNumber(content, "@context") + 20
|
|
14612
|
+
});
|
|
14613
|
+
}
|
|
14614
|
+
}
|
|
14615
|
+
return schemas;
|
|
14616
|
+
}
|
|
14617
|
+
function scanForFAQs(ast, content, filePath) {
|
|
14618
|
+
const faqs = [];
|
|
14619
|
+
if (content.includes("@uptrade/site-kit") && content.includes("ManagedFAQ")) {
|
|
14620
|
+
return faqs;
|
|
14621
|
+
}
|
|
14622
|
+
const faqPatterns = [
|
|
14623
|
+
/FAQ|Faq|faq/,
|
|
14624
|
+
/Accordion/i,
|
|
14625
|
+
/questions?\s*(?:and|&)?\s*answers?/i
|
|
14626
|
+
];
|
|
14627
|
+
traverse(ast, {
|
|
14628
|
+
JSXElement(path2) {
|
|
14629
|
+
const opening = path2.node.openingElement;
|
|
14630
|
+
let tagName = "";
|
|
14631
|
+
if (t.isJSXIdentifier(opening.name)) {
|
|
14632
|
+
tagName = opening.name.name;
|
|
14633
|
+
} else if (t.isJSXMemberExpression(opening.name)) {
|
|
14634
|
+
if (t.isJSXIdentifier(opening.name.object)) {
|
|
14635
|
+
tagName = opening.name.object.name;
|
|
14636
|
+
}
|
|
14637
|
+
}
|
|
14638
|
+
if (tagName === "details") {
|
|
14639
|
+
faqs.push({
|
|
14640
|
+
filePath,
|
|
14641
|
+
type: "details-summary",
|
|
14642
|
+
startLine: path2.node.loc?.start.line || 0,
|
|
14643
|
+
endLine: path2.node.loc?.end.line || 0,
|
|
14644
|
+
hasSchema: content.includes("FAQPage") || content.includes("application/ld+json")
|
|
14645
|
+
});
|
|
14646
|
+
return;
|
|
14647
|
+
}
|
|
14648
|
+
for (const pattern of faqPatterns) {
|
|
14649
|
+
if (pattern.test(tagName)) {
|
|
14650
|
+
let itemCount = 0;
|
|
14651
|
+
path2.traverse({
|
|
14652
|
+
JSXElement(itemPath) {
|
|
14653
|
+
const itemOpening = itemPath.node.openingElement;
|
|
14654
|
+
if (t.isJSXIdentifier(itemOpening.name)) {
|
|
14655
|
+
const itemName = itemOpening.name.name.toLowerCase();
|
|
14656
|
+
if (itemName.includes("item") || itemName.includes("question")) {
|
|
14657
|
+
itemCount++;
|
|
14658
|
+
}
|
|
14659
|
+
}
|
|
14660
|
+
}
|
|
14661
|
+
});
|
|
14662
|
+
faqs.push({
|
|
14663
|
+
filePath,
|
|
14664
|
+
type: "accordion",
|
|
14665
|
+
componentName: tagName,
|
|
14666
|
+
itemCount: itemCount || void 0,
|
|
14667
|
+
startLine: path2.node.loc?.start.line || 0,
|
|
14668
|
+
endLine: path2.node.loc?.end.line || 0,
|
|
14669
|
+
hasSchema: content.includes("FAQPage") || content.includes("application/ld+json")
|
|
14670
|
+
});
|
|
14671
|
+
return;
|
|
14672
|
+
}
|
|
14673
|
+
}
|
|
14674
|
+
}
|
|
14675
|
+
});
|
|
14676
|
+
return faqs;
|
|
14677
|
+
}
|
|
14678
|
+
async function scanForManagedFAQPaths(rootDir) {
|
|
14679
|
+
const paths = /* @__PURE__ */ new Set();
|
|
14680
|
+
const files = await findSourceFiles(rootDir);
|
|
14681
|
+
for (const file of files) {
|
|
14682
|
+
let content;
|
|
14683
|
+
try {
|
|
14684
|
+
content = await fs.readFile(file, "utf-8");
|
|
14685
|
+
} catch {
|
|
14686
|
+
continue;
|
|
14687
|
+
}
|
|
14688
|
+
if (!content.includes("ManagedFAQ")) continue;
|
|
14689
|
+
try {
|
|
14690
|
+
const ast = parse(content, {
|
|
14691
|
+
sourceType: "module",
|
|
14692
|
+
plugins: ["jsx", "typescript"]
|
|
14693
|
+
});
|
|
14694
|
+
traverse(ast, {
|
|
14695
|
+
JSXElement(jsxPath) {
|
|
14696
|
+
const opening = jsxPath.node.openingElement;
|
|
14697
|
+
const name = opening.name;
|
|
14698
|
+
let tagName = "";
|
|
14699
|
+
if (t.isJSXIdentifier(name)) {
|
|
14700
|
+
tagName = name.name;
|
|
14701
|
+
} else if (t.isJSXMemberExpression(name) && t.isJSXIdentifier(name.property)) {
|
|
14702
|
+
tagName = name.property.name;
|
|
14703
|
+
}
|
|
14704
|
+
if (tagName !== "ManagedFAQ") return;
|
|
14705
|
+
for (const attr of opening.attributes) {
|
|
14706
|
+
if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name)) continue;
|
|
14707
|
+
if (attr.name.name !== "path") continue;
|
|
14708
|
+
const value = attr.value;
|
|
14709
|
+
if (t.isStringLiteral(value)) {
|
|
14710
|
+
let p = value.value;
|
|
14711
|
+
if (typeof p !== "string") continue;
|
|
14712
|
+
if (!p.startsWith("/")) p = `/${p}`;
|
|
14713
|
+
paths.add(p);
|
|
14714
|
+
}
|
|
14715
|
+
}
|
|
14716
|
+
}
|
|
14717
|
+
});
|
|
14718
|
+
} catch {
|
|
14719
|
+
continue;
|
|
14720
|
+
}
|
|
14721
|
+
}
|
|
14722
|
+
return [...paths];
|
|
14723
|
+
}
|
|
14724
|
+
function scanForAnalytics(ast, content, filePath) {
|
|
14725
|
+
const analytics = [];
|
|
14726
|
+
const analyticsPatterns = [
|
|
14727
|
+
{
|
|
14728
|
+
pattern: /googletagmanager\.com|gtag|google-analytics/i,
|
|
14729
|
+
type: "google-analytics",
|
|
14730
|
+
idPattern: /(?:G-|UA-|GTM-)[\w-]+/
|
|
14731
|
+
},
|
|
14732
|
+
{
|
|
14733
|
+
pattern: /gtm\.js|GTM-/i,
|
|
14734
|
+
type: "google-tag-manager",
|
|
14735
|
+
idPattern: /GTM-[\w]+/
|
|
14736
|
+
},
|
|
14737
|
+
{
|
|
14738
|
+
pattern: /@vercel\/analytics|vercel\.com.*analytics/i,
|
|
14739
|
+
type: "vercel-analytics"
|
|
14740
|
+
},
|
|
14741
|
+
{
|
|
14742
|
+
pattern: /posthog/i,
|
|
14743
|
+
type: "posthog",
|
|
14744
|
+
idPattern: /phc_[\w]+/
|
|
14745
|
+
},
|
|
14746
|
+
{
|
|
14747
|
+
pattern: /mixpanel/i,
|
|
14748
|
+
type: "mixpanel"
|
|
14749
|
+
},
|
|
14750
|
+
{
|
|
14751
|
+
pattern: /plausible\.io/i,
|
|
14752
|
+
type: "plausible"
|
|
14753
|
+
},
|
|
14754
|
+
{
|
|
14755
|
+
pattern: /usefathom\.com|fathom/i,
|
|
14756
|
+
type: "fathom"
|
|
14757
|
+
}
|
|
14758
|
+
];
|
|
14759
|
+
for (const { pattern, type, idPattern } of analyticsPatterns) {
|
|
14760
|
+
if (pattern.test(content)) {
|
|
14761
|
+
let trackingId;
|
|
14762
|
+
if (idPattern) {
|
|
14763
|
+
const match = content.match(idPattern);
|
|
14764
|
+
if (match) trackingId = match[0];
|
|
14765
|
+
}
|
|
14766
|
+
const lines = content.split("\n");
|
|
14767
|
+
let startLine = 1;
|
|
14768
|
+
for (let i = 0; i < lines.length; i++) {
|
|
14769
|
+
if (pattern.test(lines[i])) {
|
|
14770
|
+
startLine = i + 1;
|
|
14771
|
+
break;
|
|
14772
|
+
}
|
|
14773
|
+
}
|
|
14774
|
+
analytics.push({
|
|
14775
|
+
filePath,
|
|
14776
|
+
type,
|
|
14777
|
+
trackingId,
|
|
14778
|
+
startLine,
|
|
14779
|
+
endLine: startLine + 5
|
|
14780
|
+
});
|
|
14781
|
+
}
|
|
14782
|
+
}
|
|
14783
|
+
return analytics;
|
|
14784
|
+
}
|
|
14785
|
+
function scanForImages(ast, content, filePath) {
|
|
14786
|
+
const images = [];
|
|
14787
|
+
if (filePath.includes("/public/") || filePath.includes("/assets/")) {
|
|
14788
|
+
return images;
|
|
14789
|
+
}
|
|
14790
|
+
traverse(ast, {
|
|
14791
|
+
JSXElement(path2) {
|
|
14792
|
+
const opening = path2.node.openingElement;
|
|
14793
|
+
if (!t.isJSXIdentifier(opening.name)) return;
|
|
14794
|
+
const tagName = opening.name.name;
|
|
14795
|
+
if (tagName === "img" || tagName === "Image") {
|
|
14796
|
+
let src = "";
|
|
14797
|
+
let alt = "";
|
|
14798
|
+
for (const attr of opening.attributes) {
|
|
14799
|
+
if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name)) continue;
|
|
14800
|
+
const attrName = attr.name.name;
|
|
14801
|
+
let attrValue = "";
|
|
14802
|
+
if (t.isStringLiteral(attr.value)) {
|
|
14803
|
+
attrValue = attr.value.value;
|
|
14804
|
+
} else if (t.isJSXExpressionContainer(attr.value) && t.isStringLiteral(attr.value.expression)) {
|
|
14805
|
+
attrValue = attr.value.expression.value;
|
|
14806
|
+
}
|
|
14807
|
+
if (attrName === "src") src = attrValue;
|
|
14808
|
+
if (attrName === "alt") alt = attrValue;
|
|
14809
|
+
}
|
|
14810
|
+
if (src.includes("uptrade") || src.includes("portal")) {
|
|
14811
|
+
return;
|
|
14812
|
+
}
|
|
14813
|
+
const isLocal = !src.startsWith("http") && !src.startsWith("//");
|
|
14814
|
+
images.push({
|
|
14815
|
+
filePath,
|
|
14816
|
+
type: tagName === "Image" ? "next-image" : "img",
|
|
14817
|
+
src: src || void 0,
|
|
14818
|
+
alt: alt || void 0,
|
|
14819
|
+
isLocal,
|
|
14820
|
+
startLine: path2.node.loc?.start.line || 0,
|
|
14821
|
+
endLine: path2.node.loc?.end.line || 0
|
|
14822
|
+
});
|
|
14823
|
+
}
|
|
14824
|
+
}
|
|
14825
|
+
});
|
|
14826
|
+
const bgImagePattern = /background(?:-image)?:\s*url\(['"]?([^'")]+)['"]?\)/g;
|
|
14827
|
+
let match;
|
|
14828
|
+
while ((match = bgImagePattern.exec(content)) !== null) {
|
|
14829
|
+
const src = match[1];
|
|
14830
|
+
if (src.includes("uptrade") || src.includes("portal")) continue;
|
|
14831
|
+
images.push({
|
|
14832
|
+
filePath,
|
|
14833
|
+
type: "background-image",
|
|
14834
|
+
src,
|
|
14835
|
+
isLocal: !src.startsWith("http") && !src.startsWith("//"),
|
|
14836
|
+
startLine: findLineNumber(content, match[0]),
|
|
14837
|
+
endLine: findLineNumber(content, match[0])
|
|
14838
|
+
});
|
|
14839
|
+
}
|
|
14840
|
+
return images;
|
|
14841
|
+
}
|
|
14502
14842
|
|
|
14503
|
-
export { scanCodebase, scanForForms, scanForMetadata, scanForSitemapFiles, scanForSitemaps, scanForWidgets };
|
|
14504
|
-
//# sourceMappingURL=
|
|
14505
|
-
//# sourceMappingURL=
|
|
14843
|
+
export { require_lib3 as require_lib, scanCodebase, scanForAnalytics, scanForFAQs, scanForForms, scanForImages, scanForManagedFAQPaths, scanForMetadata, scanForSchemas, scanForSitemapFiles, scanForSitemaps, scanForWidgets };
|
|
14844
|
+
//# sourceMappingURL=chunk-44OMJFCG.mjs.map
|
|
14845
|
+
//# sourceMappingURL=chunk-44OMJFCG.mjs.map
|