@puzzle-ui/seo 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +755 -2
- package/dist/LICENSE +21 -0
- package/dist/context/config.cjs +82 -0
- package/dist/context/config.cjs.map +1 -0
- package/dist/context/config.d.cts +6 -0
- package/dist/context/config.d.ts +6 -0
- package/dist/context/config.js +80 -0
- package/dist/context/config.js.map +1 -0
- package/dist/context/index.cjs +6 -0
- package/dist/context/index.d.cts +4 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.js +3 -0
- package/dist/context/types.d.cts +46 -0
- package/dist/context/types.d.ts +46 -0
- package/dist/core/graph.cjs +464 -0
- package/dist/core/graph.cjs.map +1 -0
- package/dist/core/graph.d.cts +62 -0
- package/dist/core/graph.d.ts +62 -0
- package/dist/core/graph.js +456 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/index.cjs +11 -0
- package/dist/core/index.d.cts +3 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +1 -0
- package/dist/core/types.d.cts +92 -0
- package/dist/core/types.d.ts +92 -0
- package/dist/index.cjs +96 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata/index.cjs +4 -0
- package/dist/metadata/index.d.cts +3 -0
- package/dist/metadata/index.d.ts +3 -0
- package/dist/metadata/index.js +1 -0
- package/dist/metadata/resolve.cjs +122 -0
- package/dist/metadata/resolve.cjs.map +1 -0
- package/dist/metadata/resolve.d.cts +4 -0
- package/dist/metadata/resolve.d.ts +4 -0
- package/dist/metadata/resolve.js +121 -0
- package/dist/metadata/resolve.js.map +1 -0
- package/dist/metadata/types.d.cts +82 -0
- package/dist/metadata/types.d.ts +82 -0
- package/dist/next/index.cjs +13 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +15 -0
- package/dist/next/index.d.ts +14 -0
- package/dist/next/index.js +12 -0
- package/dist/next/index.js.map +1 -0
- package/dist/react/context.cjs +30 -0
- package/dist/react/context.cjs.map +1 -0
- package/dist/react/context.d.cts +14 -0
- package/dist/react/context.d.ts +14 -0
- package/dist/react/context.js +27 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/index.cjs +48 -0
- package/dist/react/index.d.cts +6 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +5 -0
- package/dist/react/metadata.cjs +100 -0
- package/dist/react/metadata.cjs.map +1 -0
- package/dist/react/metadata.d.cts +18 -0
- package/dist/react/metadata.d.ts +18 -0
- package/dist/react/metadata.js +99 -0
- package/dist/react/metadata.js.map +1 -0
- package/dist/react/provider.cjs +42 -0
- package/dist/react/provider.cjs.map +1 -0
- package/dist/react/provider.d.cts +3 -0
- package/dist/react/provider.d.ts +3 -0
- package/dist/react/provider.js +42 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/react/schema-components.cjs +294 -0
- package/dist/react/schema-components.cjs.map +1 -0
- package/dist/react/schema-components.d.cts +84 -0
- package/dist/react/schema-components.d.ts +80 -0
- package/dist/react/schema-components.js +254 -0
- package/dist/react/schema-components.js.map +1 -0
- package/dist/react/types.d.cts +81 -0
- package/dist/react/types.d.ts +80 -0
- package/dist/react-router/index.cjs +13 -0
- package/dist/react-router/index.cjs.map +1 -0
- package/dist/react-router/index.d.cts +21 -0
- package/dist/react-router/index.d.ts +20 -0
- package/dist/react-router/index.js +12 -0
- package/dist/react-router/index.js.map +1 -0
- package/dist/robots/generate.cjs +88 -0
- package/dist/robots/generate.cjs.map +1 -0
- package/dist/robots/generate.d.cts +4 -0
- package/dist/robots/generate.d.ts +4 -0
- package/dist/robots/generate.js +86 -0
- package/dist/robots/generate.js.map +1 -0
- package/dist/robots/index.cjs +5 -0
- package/dist/robots/index.d.cts +3 -0
- package/dist/robots/index.d.ts +3 -0
- package/dist/robots/index.js +1 -0
- package/dist/robots/types.d.cts +27 -0
- package/dist/robots/types.d.ts +27 -0
- package/dist/schema/create-registry.cjs +12 -0
- package/dist/schema/create-registry.cjs.map +1 -0
- package/dist/schema/create-registry.d.cts +2 -0
- package/dist/schema/create-registry.d.ts +2 -0
- package/dist/schema/create-registry.js +12 -0
- package/dist/schema/create-registry.js.map +1 -0
- package/dist/schema/generated/index.d.cts +2 -0
- package/dist/schema/generated/schemaorg.cjs +36386 -0
- package/dist/schema/generated/schemaorg.cjs.map +1 -0
- package/dist/schema/generated/schemaorg.d.cts +945 -0
- package/dist/schema/generated/schemaorg.d.ts +945 -0
- package/dist/schema/generated/schemaorg.js +36384 -0
- package/dist/schema/generated/schemaorg.js.map +1 -0
- package/dist/schema/index.cjs +11 -0
- package/dist/schema/index.d.cts +7 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/registry.cjs +194 -0
- package/dist/schema/registry.cjs.map +1 -0
- package/dist/schema/registry.d.cts +2 -0
- package/dist/schema/registry.d.ts +2 -0
- package/dist/schema/registry.js +194 -0
- package/dist/schema/registry.js.map +1 -0
- package/dist/schema/types.d.cts +79 -0
- package/dist/schema/types.d.ts +79 -0
- package/dist/schema/validate.cjs +131 -0
- package/dist/schema/validate.cjs.map +1 -0
- package/dist/schema/validate.d.cts +16 -0
- package/dist/schema/validate.d.ts +16 -0
- package/dist/schema/validate.js +131 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/server/handlers.cjs +96 -0
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.cts +3 -0
- package/dist/server/handlers.d.ts +3 -0
- package/dist/server/handlers.js +95 -0
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/index.cjs +6 -0
- package/dist/server/index.d.cts +4 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +3 -0
- package/dist/server/routes.cjs +17 -0
- package/dist/server/routes.cjs.map +1 -0
- package/dist/server/routes.d.cts +2 -0
- package/dist/server/routes.d.ts +2 -0
- package/dist/server/routes.js +17 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/server/types.d.cts +61 -0
- package/dist/server/types.d.ts +61 -0
- package/dist/sitemap/generate.cjs +147 -0
- package/dist/sitemap/generate.cjs.map +1 -0
- package/dist/sitemap/generate.d.cts +3 -0
- package/dist/sitemap/generate.d.ts +3 -0
- package/dist/sitemap/generate.js +146 -0
- package/dist/sitemap/generate.js.map +1 -0
- package/dist/sitemap/index.cjs +11 -0
- package/dist/sitemap/index.d.cts +4 -0
- package/dist/sitemap/index.d.ts +4 -0
- package/dist/sitemap/index.js +3 -0
- package/dist/sitemap/types.d.cts +82 -0
- package/dist/sitemap/types.d.ts +82 -0
- package/dist/sitemap/xml.cjs +215 -0
- package/dist/sitemap/xml.cjs.map +1 -0
- package/dist/sitemap/xml.d.cts +16 -0
- package/dist/sitemap/xml.d.ts +16 -0
- package/dist/sitemap/xml.js +210 -0
- package/dist/sitemap/xml.js.map +1 -0
- package/dist/tanstack/index.cjs +13 -0
- package/dist/tanstack/index.cjs.map +1 -0
- package/dist/tanstack/index.d.cts +19 -0
- package/dist/tanstack/index.d.ts +18 -0
- package/dist/tanstack/index.js +12 -0
- package/dist/tanstack/index.js.map +1 -0
- package/dist/testing/diagnostics.cjs +27 -0
- package/dist/testing/diagnostics.cjs.map +1 -0
- package/dist/testing/diagnostics.d.cts +3 -0
- package/dist/testing/diagnostics.d.ts +3 -0
- package/dist/testing/diagnostics.js +27 -0
- package/dist/testing/diagnostics.js.map +1 -0
- package/dist/testing/fixture.cjs +80 -0
- package/dist/testing/fixture.cjs.map +1 -0
- package/dist/testing/fixture.d.cts +4 -0
- package/dist/testing/fixture.d.ts +4 -0
- package/dist/testing/fixture.js +78 -0
- package/dist/testing/fixture.js.map +1 -0
- package/dist/testing/index.cjs +9 -0
- package/dist/testing/index.d.cts +5 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/inspect.cjs +63 -0
- package/dist/testing/inspect.cjs.map +1 -0
- package/dist/testing/inspect.d.cts +5 -0
- package/dist/testing/inspect.d.ts +5 -0
- package/dist/testing/inspect.js +63 -0
- package/dist/testing/inspect.js.map +1 -0
- package/dist/testing/types.d.cts +40 -0
- package/dist/testing/types.d.ts +40 -0
- package/dist/urls/index.cjs +8 -0
- package/dist/urls/index.d.cts +3 -0
- package/dist/urls/index.d.ts +3 -0
- package/dist/urls/index.js +1 -0
- package/dist/urls/normalize.cjs +65 -0
- package/dist/urls/normalize.cjs.map +1 -0
- package/dist/urls/normalize.d.cts +14 -0
- package/dist/urls/normalize.d.ts +14 -0
- package/dist/urls/normalize.js +60 -0
- package/dist/urls/normalize.js.map +1 -0
- package/dist/urls/types.d.cts +22 -0
- package/dist/urls/types.d.ts +22 -0
- package/dist/validation/index.cjs +5 -0
- package/dist/validation/index.d.cts +3 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +1 -0
- package/dist/validation/types.d.cts +75 -0
- package/dist/validation/types.d.ts +75 -0
- package/dist/validation/validate.cjs +452 -0
- package/dist/validation/validate.cjs.map +1 -0
- package/dist/validation/validate.d.cts +7 -0
- package/dist/validation/validate.d.ts +6 -0
- package/dist/validation/validate.js +450 -0
- package/dist/validation/validate.js.map +1 -0
- package/package.json +203 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SeoRouteOptions } from "../server/types.js";
|
|
2
|
+
export interface TanStackServerRouteContext {
|
|
3
|
+
request: Request;
|
|
4
|
+
}
|
|
5
|
+
export type TanStackSeoRouteHandler = (context: TanStackServerRouteContext) => Promise<Response>;
|
|
6
|
+
export interface TanStackSeoRoutes {
|
|
7
|
+
/**
|
|
8
|
+
* Mount on a dynamic root route, e.g. /$seoFile.
|
|
9
|
+
*
|
|
10
|
+
* Handles the sitemap index and every generated sitemap file.
|
|
11
|
+
*/
|
|
12
|
+
sitemapGET: TanStackSeoRouteHandler;
|
|
13
|
+
/**
|
|
14
|
+
* Mount on the static /robots.txt route.
|
|
15
|
+
*/
|
|
16
|
+
robotsGET: TanStackSeoRouteHandler;
|
|
17
|
+
}
|
|
18
|
+
export declare const createTanStackSeoRoutes: (options: SeoRouteOptions) => TanStackSeoRoutes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createSeoRouteHandlers } from "../server/routes.js";
|
|
2
|
+
// src/tanstack/index.ts
|
|
3
|
+
const createTanStackSeoRoutes = (options) => {
|
|
4
|
+
const handlers = createSeoRouteHandlers(options);
|
|
5
|
+
return {
|
|
6
|
+
sitemapGET: ({ request }) => handlers.sitemap(request),
|
|
7
|
+
robotsGET: ({ request }) => handlers.robots(request)
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export { createTanStackSeoRoutes };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/tanstack/index.ts"],"sourcesContent":["import { createSeoRouteHandlers } from \"../server\";\n\nimport type { SeoRouteOptions } from \"../server\";\n\nexport interface TanStackServerRouteContext {\n request: Request;\n}\n\nexport type TanStackSeoRouteHandler = (\n context: TanStackServerRouteContext,\n) => Promise<Response>;\n\nexport interface TanStackSeoRoutes {\n /**\n * Mount on a dynamic root route, e.g. /$seoFile.\n *\n * Handles the sitemap index and every generated sitemap file.\n */\n sitemapGET: TanStackSeoRouteHandler;\n\n /**\n * Mount on the static /robots.txt route.\n */\n robotsGET: TanStackSeoRouteHandler;\n}\n\nexport const createTanStackSeoRoutes = (\n options: SeoRouteOptions,\n): TanStackSeoRoutes => {\n const handlers = createSeoRouteHandlers(options);\n\n return {\n sitemapGET: ({ request }) => handlers.sitemap(request),\n robotsGET: ({ request }) => handlers.robots(request),\n };\n};\n"],"mappings":";;AA0BA,MAAa,2BACX,YACsB;CACtB,MAAM,WAAW,uBAAuB,OAAO;CAE/C,OAAO;EACL,aAAa,EAAE,cAAc,SAAS,QAAQ,OAAO;EACrD,YAAY,EAAE,cAAc,SAAS,OAAO,OAAO;CACrD;AACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/testing/diagnostics.ts
|
|
2
|
+
const formatIssue = (issue, options) => {
|
|
3
|
+
const parts = [
|
|
4
|
+
`[${issue.severity.toUpperCase()}]`,
|
|
5
|
+
`[${issue.source}]`,
|
|
6
|
+
issue.code,
|
|
7
|
+
issue.message
|
|
8
|
+
];
|
|
9
|
+
if (options.includePaths !== false) {
|
|
10
|
+
const location = issue.path ?? issue.nodeId;
|
|
11
|
+
if (location) parts.push(`Path: ${location}`);
|
|
12
|
+
}
|
|
13
|
+
if (options.includeSuggestions !== false && issue.suggestion) parts.push(`Suggestion: ${issue.suggestion}`);
|
|
14
|
+
if (issue.docsUrl) parts.push(`Documentation: ${issue.docsUrl}`);
|
|
15
|
+
return parts.join(" — ");
|
|
16
|
+
};
|
|
17
|
+
const formatSeoDiagnostics = (report, options = {}) => {
|
|
18
|
+
const lines = report.issues.map((issue) => formatIssue(issue, options));
|
|
19
|
+
if (options.includeSummary !== false) {
|
|
20
|
+
const { errors, warnings, infos, total } = report.summary;
|
|
21
|
+
lines.push("", `SEO validation: ${report.valid ? "PASSED" : "FAILED"}`, `Mode: ${report.mode}`, `Issues: ${total}`, `Errors: ${errors}`, `Warnings: ${warnings}`, `Info: ${infos}`);
|
|
22
|
+
}
|
|
23
|
+
return lines.join("\n");
|
|
24
|
+
};
|
|
25
|
+
exports.formatSeoDiagnostics = formatSeoDiagnostics;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=diagnostics.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.cjs","names":[],"sources":["../../src/testing/diagnostics.ts"],"sourcesContent":["import type {\n SeoValidationReport,\n SeoValidationIssue,\n} from \"../validation/types\";\n\nimport type { SeoDiagnosticFormatOptions } from \"./types\";\n\nconst formatIssue = (\n issue: SeoValidationIssue,\n options: SeoDiagnosticFormatOptions,\n): string => {\n const parts = [\n `[${issue.severity.toUpperCase()}]`,\n `[${issue.source}]`,\n issue.code,\n issue.message,\n ];\n\n if (options.includePaths !== false) {\n const location = issue.path ?? issue.nodeId;\n\n if (location) {\n parts.push(`Path: ${location}`);\n }\n }\n\n if (options.includeSuggestions !== false && issue.suggestion) {\n parts.push(`Suggestion: ${issue.suggestion}`);\n }\n\n if (issue.docsUrl) {\n parts.push(`Documentation: ${issue.docsUrl}`);\n }\n\n return parts.join(\" — \");\n};\n\nexport const formatSeoDiagnostics = (\n report: SeoValidationReport,\n options: SeoDiagnosticFormatOptions = {},\n): string => {\n const lines = report.issues.map((issue) => formatIssue(issue, options));\n\n if (options.includeSummary !== false) {\n const { errors, warnings, infos, total } = report.summary;\n\n lines.push(\n \"\",\n `SEO validation: ${report.valid ? \"PASSED\" : \"FAILED\"}`,\n `Mode: ${report.mode}`,\n `Issues: ${total}`,\n `Errors: ${errors}`,\n `Warnings: ${warnings}`,\n `Info: ${infos}`,\n );\n }\n\n return lines.join(\"\\n\");\n};\n"],"mappings":";AAOA,MAAM,eACJ,OACA,YACW;CACX,MAAM,QAAQ;EACZ,IAAI,MAAM,SAAS,YAAY,EAAE;EACjC,IAAI,MAAM,OAAO;EACjB,MAAM;EACN,MAAM;CACR;CAEA,IAAI,QAAQ,iBAAiB,OAAO;EAClC,MAAM,WAAW,MAAM,QAAQ,MAAM;EAErC,IAAI,UACF,MAAM,KAAK,SAAS,UAAU;CAElC;CAEA,IAAI,QAAQ,uBAAuB,SAAS,MAAM,YAChD,MAAM,KAAK,eAAe,MAAM,YAAY;CAG9C,IAAI,MAAM,SACR,MAAM,KAAK,kBAAkB,MAAM,SAAS;CAG9C,OAAO,MAAM,KAAK,KAAK;AACzB;AAEA,MAAa,wBACX,QACA,UAAsC,CAAC,MAC5B;CACX,MAAM,QAAQ,OAAO,OAAO,KAAK,UAAU,YAAY,OAAO,OAAO,CAAC;CAEtE,IAAI,QAAQ,mBAAmB,OAAO;EACpC,MAAM,EAAE,QAAQ,UAAU,OAAO,UAAU,OAAO;EAElD,MAAM,KACJ,IACA,mBAAmB,OAAO,QAAQ,WAAW,YAC7C,SAAS,OAAO,QAChB,WAAW,SACX,WAAW,UACX,aAAa,YACb,SAAS,OACX;CACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/testing/diagnostics.ts
|
|
2
|
+
const formatIssue = (issue, options) => {
|
|
3
|
+
const parts = [
|
|
4
|
+
`[${issue.severity.toUpperCase()}]`,
|
|
5
|
+
`[${issue.source}]`,
|
|
6
|
+
issue.code,
|
|
7
|
+
issue.message
|
|
8
|
+
];
|
|
9
|
+
if (options.includePaths !== false) {
|
|
10
|
+
const location = issue.path ?? issue.nodeId;
|
|
11
|
+
if (location) parts.push(`Path: ${location}`);
|
|
12
|
+
}
|
|
13
|
+
if (options.includeSuggestions !== false && issue.suggestion) parts.push(`Suggestion: ${issue.suggestion}`);
|
|
14
|
+
if (issue.docsUrl) parts.push(`Documentation: ${issue.docsUrl}`);
|
|
15
|
+
return parts.join(" — ");
|
|
16
|
+
};
|
|
17
|
+
const formatSeoDiagnostics = (report, options = {}) => {
|
|
18
|
+
const lines = report.issues.map((issue) => formatIssue(issue, options));
|
|
19
|
+
if (options.includeSummary !== false) {
|
|
20
|
+
const { errors, warnings, infos, total } = report.summary;
|
|
21
|
+
lines.push("", `SEO validation: ${report.valid ? "PASSED" : "FAILED"}`, `Mode: ${report.mode}`, `Issues: ${total}`, `Errors: ${errors}`, `Warnings: ${warnings}`, `Info: ${infos}`);
|
|
22
|
+
}
|
|
23
|
+
return lines.join("\n");
|
|
24
|
+
};
|
|
25
|
+
export { formatSeoDiagnostics };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","names":[],"sources":["../../src/testing/diagnostics.ts"],"sourcesContent":["import type {\n SeoValidationReport,\n SeoValidationIssue,\n} from \"../validation/types\";\n\nimport type { SeoDiagnosticFormatOptions } from \"./types\";\n\nconst formatIssue = (\n issue: SeoValidationIssue,\n options: SeoDiagnosticFormatOptions,\n): string => {\n const parts = [\n `[${issue.severity.toUpperCase()}]`,\n `[${issue.source}]`,\n issue.code,\n issue.message,\n ];\n\n if (options.includePaths !== false) {\n const location = issue.path ?? issue.nodeId;\n\n if (location) {\n parts.push(`Path: ${location}`);\n }\n }\n\n if (options.includeSuggestions !== false && issue.suggestion) {\n parts.push(`Suggestion: ${issue.suggestion}`);\n }\n\n if (issue.docsUrl) {\n parts.push(`Documentation: ${issue.docsUrl}`);\n }\n\n return parts.join(\" — \");\n};\n\nexport const formatSeoDiagnostics = (\n report: SeoValidationReport,\n options: SeoDiagnosticFormatOptions = {},\n): string => {\n const lines = report.issues.map((issue) => formatIssue(issue, options));\n\n if (options.includeSummary !== false) {\n const { errors, warnings, infos, total } = report.summary;\n\n lines.push(\n \"\",\n `SEO validation: ${report.valid ? \"PASSED\" : \"FAILED\"}`,\n `Mode: ${report.mode}`,\n `Issues: ${total}`,\n `Errors: ${errors}`,\n `Warnings: ${warnings}`,\n `Info: ${infos}`,\n );\n }\n\n return lines.join(\"\\n\");\n};\n"],"mappings":";AAOA,MAAM,eACJ,OACA,YACW;CACX,MAAM,QAAQ;EACZ,IAAI,MAAM,SAAS,YAAY,EAAE;EACjC,IAAI,MAAM,OAAO;EACjB,MAAM;EACN,MAAM;CACR;CAEA,IAAI,QAAQ,iBAAiB,OAAO;EAClC,MAAM,WAAW,MAAM,QAAQ,MAAM;EAErC,IAAI,UACF,MAAM,KAAK,SAAS,UAAU;CAElC;CAEA,IAAI,QAAQ,uBAAuB,SAAS,MAAM,YAChD,MAAM,KAAK,eAAe,MAAM,YAAY;CAG9C,IAAI,MAAM,SACR,MAAM,KAAK,kBAAkB,MAAM,SAAS;CAG9C,OAAO,MAAM,KAAK,KAAK;AACzB;AAEA,MAAa,wBACX,QACA,UAAsC,CAAC,MAC5B;CACX,MAAM,QAAQ,OAAO,OAAO,KAAK,UAAU,YAAY,OAAO,OAAO,CAAC;CAEtE,IAAI,QAAQ,mBAAmB,OAAO;EACpC,MAAM,EAAE,QAAQ,UAAU,OAAO,UAAU,OAAO;EAElD,MAAM,KACJ,IACA,mBAAmB,OAAO,QAAQ,WAAW,YAC7C,SAAS,OAAO,QAChB,WAAW,SACX,WAAW,UACX,aAAa,YACb,SAAS,OACX;CACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const require_graph = require("../core/graph.cjs");
|
|
2
|
+
const require_validate = require("../validation/validate.cjs");
|
|
3
|
+
const require_diagnostics = require("./diagnostics.cjs");
|
|
4
|
+
// src/testing/fixture.ts
|
|
5
|
+
const getBaseUrl = (fixture) => String(fixture.config.siteUrl);
|
|
6
|
+
const resolveFixtureGraph = (fixture) => {
|
|
7
|
+
if (fixture.graph) return fixture.graph;
|
|
8
|
+
return require_graph.buildSeoGraph(fixture.nodes ?? [], { baseUrl: getBaseUrl(fixture) });
|
|
9
|
+
};
|
|
10
|
+
const createSeoTestFixture = (fixture) => {
|
|
11
|
+
if (fixture.graph && fixture.nodes) throw new Error("Provide either graph or nodes when creating an SEO test fixture, not both.");
|
|
12
|
+
if (!fixture.config?.siteUrl) throw new Error("SEO test fixtures require a valid siteUrl.");
|
|
13
|
+
const graph = resolveFixtureGraph(fixture);
|
|
14
|
+
return {
|
|
15
|
+
config: fixture.config,
|
|
16
|
+
graph,
|
|
17
|
+
metadata: fixture.metadata
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const filterIssues = (report, options) => {
|
|
21
|
+
return report.issues.filter((issue) => {
|
|
22
|
+
if (options.validateSchema === false && issue.source === "schema") return false;
|
|
23
|
+
if (options.validateMetadata === false && issue.source === "metadata") return false;
|
|
24
|
+
if (options.validateReferences === false && issue.code === "unresolved-reference") return false;
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const createFilteredReport = (report, issues) => {
|
|
29
|
+
const summary = {
|
|
30
|
+
errors: 0,
|
|
31
|
+
warnings: 0,
|
|
32
|
+
infos: 0,
|
|
33
|
+
total: issues.length
|
|
34
|
+
};
|
|
35
|
+
for (const issue of issues) switch (issue.severity) {
|
|
36
|
+
case "error":
|
|
37
|
+
summary.errors += 1;
|
|
38
|
+
break;
|
|
39
|
+
case "warning":
|
|
40
|
+
summary.warnings += 1;
|
|
41
|
+
break;
|
|
42
|
+
case "info": summary.infos += 1;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...report,
|
|
46
|
+
valid: summary.errors === 0,
|
|
47
|
+
issues,
|
|
48
|
+
summary
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const runSeoTest = (fixture, options = {}) => {
|
|
52
|
+
const graph = resolveFixtureGraph(fixture);
|
|
53
|
+
const report = require_validate.validateSeo({
|
|
54
|
+
graph,
|
|
55
|
+
metadata: options.validateMetadata === false ? void 0 : fixture.metadata
|
|
56
|
+
}, {
|
|
57
|
+
mode: options.strict ? "strict" : "warn",
|
|
58
|
+
baseUrl: getBaseUrl(fixture)
|
|
59
|
+
});
|
|
60
|
+
const filteredIssues = filterIssues(report, options);
|
|
61
|
+
const filteredReport = createFilteredReport(report, filteredIssues);
|
|
62
|
+
const errors = filteredIssues.filter((issue) => issue.severity === "error").map((issue) => issue.message);
|
|
63
|
+
const warnings = filteredIssues.filter((issue) => issue.severity === "warning").map((issue) => issue.message);
|
|
64
|
+
return {
|
|
65
|
+
passed: filteredReport.valid,
|
|
66
|
+
errors,
|
|
67
|
+
warnings,
|
|
68
|
+
report: filteredReport
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const assertSeoTest = (fixture, options = {}) => {
|
|
72
|
+
const result = runSeoTest(fixture, options);
|
|
73
|
+
if (!result.passed) throw new Error(require_diagnostics.formatSeoDiagnostics(result.report));
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
exports.assertSeoTest = assertSeoTest;
|
|
77
|
+
exports.createSeoTestFixture = createSeoTestFixture;
|
|
78
|
+
exports.runSeoTest = runSeoTest;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=fixture.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.cjs","names":["buildSeoGraph","validateSeo","formatSeoDiagnostics"],"sources":["../../src/testing/fixture.ts"],"sourcesContent":["import { buildSeoGraph } from \"../core\";\n\nimport type { SeoGraph } from \"../core\";\n\nimport { validateSeo } from \"../validation\";\n\nimport type { SeoValidationIssue, SeoValidationReport } from \"../validation\";\n\nimport type { SeoTestFixture, SeoTestOptions, SeoTestResult } from \"./types\";\n\nimport { formatSeoDiagnostics } from \"./diagnostics\";\n\nconst getBaseUrl = (fixture: SeoTestFixture): string =>\n String(fixture.config.siteUrl);\n\nconst resolveFixtureGraph = (fixture: SeoTestFixture): SeoGraph => {\n if (fixture.graph) {\n return fixture.graph;\n }\n\n return buildSeoGraph(fixture.nodes ?? [], {\n baseUrl: getBaseUrl(fixture),\n });\n};\n\nexport const createSeoTestFixture = (\n fixture: SeoTestFixture,\n): SeoTestFixture => {\n if (fixture.graph && fixture.nodes) {\n throw new Error(\n \"Provide either graph or nodes when creating an SEO test fixture, not both.\",\n );\n }\n\n if (!fixture.config?.siteUrl) {\n throw new Error(\"SEO test fixtures require a valid siteUrl.\");\n }\n\n const graph = resolveFixtureGraph(fixture);\n\n return {\n config: fixture.config,\n graph,\n metadata: fixture.metadata,\n };\n};\n\nconst filterIssues = (\n report: SeoValidationReport,\n options: SeoTestOptions,\n): SeoValidationIssue[] => {\n return report.issues.filter((issue) => {\n if (options.validateSchema === false && issue.source === \"schema\") {\n return false;\n }\n\n if (options.validateMetadata === false && issue.source === \"metadata\") {\n return false;\n }\n\n if (\n options.validateReferences === false &&\n issue.code === \"unresolved-reference\"\n ) {\n return false;\n }\n\n return true;\n });\n};\n\nconst createFilteredReport = (\n report: SeoValidationReport,\n issues: SeoValidationIssue[],\n): SeoValidationReport => {\n const summary = {\n errors: 0,\n warnings: 0,\n infos: 0,\n total: issues.length,\n };\n\n for (const issue of issues) {\n switch (issue.severity) {\n case \"error\":\n summary.errors += 1;\n break;\n case \"warning\":\n summary.warnings += 1;\n break;\n case \"info\":\n summary.infos += 1;\n break;\n }\n }\n\n return {\n ...report,\n valid: summary.errors === 0,\n issues,\n summary,\n };\n};\n\nexport const runSeoTest = (\n fixture: SeoTestFixture,\n options: SeoTestOptions = {},\n): SeoTestResult => {\n const graph = resolveFixtureGraph(fixture);\n\n const report = validateSeo(\n {\n graph,\n metadata:\n options.validateMetadata === false ? undefined : fixture.metadata,\n },\n {\n mode: options.strict ? \"strict\" : \"warn\",\n baseUrl: getBaseUrl(fixture),\n },\n );\n\n const filteredIssues = filterIssues(report, options);\n const filteredReport = createFilteredReport(report, filteredIssues);\n\n const errors = filteredIssues\n .filter((issue) => issue.severity === \"error\")\n .map((issue) => issue.message);\n\n const warnings = filteredIssues\n .filter((issue) => issue.severity === \"warning\")\n .map((issue) => issue.message);\n\n return {\n passed: filteredReport.valid,\n errors,\n warnings,\n report: filteredReport,\n };\n};\n\nexport const assertSeoTest = (\n fixture: SeoTestFixture,\n options: SeoTestOptions = {},\n): SeoTestResult => {\n const result = runSeoTest(fixture, options);\n\n if (!result.passed) {\n throw new Error(formatSeoDiagnostics(result.report));\n }\n\n return result;\n};\n"],"mappings":";;;;AAYA,MAAM,cAAc,YAClB,OAAO,QAAQ,OAAO,OAAO;AAE/B,MAAM,uBAAuB,YAAsC;CACjE,IAAI,QAAQ,OACV,OAAO,QAAQ;CAGjB,OAAOA,cAAAA,cAAc,QAAQ,SAAS,CAAC,GAAG,EACxC,SAAS,WAAW,OAAO,EAC7B,CAAC;AACH;AAEA,MAAa,wBACX,YACmB;CACnB,IAAI,QAAQ,SAAS,QAAQ,OAC3B,MAAM,IAAI,MACR,4EACF;CAGF,IAAI,CAAC,QAAQ,QAAQ,SACn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AO;CAE/B,OAAO;EACL,QAAQ,eAAe;EACvB;EACA;EACA,QAAQ;CACV;AACF;AAEA,MAAa,iBACX,SACA,UAA0B,CAAC,MACT;CAClB,MAAM,SAAS,WAAW,SAAS,OAAO;CAE1C,IAAI,CAAC,OAAO,QACV,MAAM,IAAI,MAAMC,oBAAAA,qBAAqB,OAAO,MAAM,CAAC;CAGrD,OAAO;AACT"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SeoTestFixture, SeoTestOptions, SeoTestResult } from "./types.cjs";
|
|
2
|
+
export declare const createSeoTestFixture: (fixture: SeoTestFixture) => SeoTestFixture;
|
|
3
|
+
export declare const runSeoTest: (fixture: SeoTestFixture, options?: SeoTestOptions) => SeoTestResult;
|
|
4
|
+
export declare const assertSeoTest: (fixture: SeoTestFixture, options?: SeoTestOptions) => SeoTestResult;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SeoTestFixture, SeoTestOptions, SeoTestResult } from "./types.js";
|
|
2
|
+
export declare const createSeoTestFixture: (fixture: SeoTestFixture) => SeoTestFixture;
|
|
3
|
+
export declare const runSeoTest: (fixture: SeoTestFixture, options?: SeoTestOptions) => SeoTestResult;
|
|
4
|
+
export declare const assertSeoTest: (fixture: SeoTestFixture, options?: SeoTestOptions) => SeoTestResult;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { buildSeoGraph } from "../core/graph.js";
|
|
2
|
+
import { validateSeo } from "../validation/validate.js";
|
|
3
|
+
import { formatSeoDiagnostics } from "./diagnostics.js";
|
|
4
|
+
// src/testing/fixture.ts
|
|
5
|
+
const getBaseUrl = (fixture) => String(fixture.config.siteUrl);
|
|
6
|
+
const resolveFixtureGraph = (fixture) => {
|
|
7
|
+
if (fixture.graph) return fixture.graph;
|
|
8
|
+
return buildSeoGraph(fixture.nodes ?? [], { baseUrl: getBaseUrl(fixture) });
|
|
9
|
+
};
|
|
10
|
+
const createSeoTestFixture = (fixture) => {
|
|
11
|
+
if (fixture.graph && fixture.nodes) throw new Error("Provide either graph or nodes when creating an SEO test fixture, not both.");
|
|
12
|
+
if (!fixture.config?.siteUrl) throw new Error("SEO test fixtures require a valid siteUrl.");
|
|
13
|
+
const graph = resolveFixtureGraph(fixture);
|
|
14
|
+
return {
|
|
15
|
+
config: fixture.config,
|
|
16
|
+
graph,
|
|
17
|
+
metadata: fixture.metadata
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const filterIssues = (report, options) => {
|
|
21
|
+
return report.issues.filter((issue) => {
|
|
22
|
+
if (options.validateSchema === false && issue.source === "schema") return false;
|
|
23
|
+
if (options.validateMetadata === false && issue.source === "metadata") return false;
|
|
24
|
+
if (options.validateReferences === false && issue.code === "unresolved-reference") return false;
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const createFilteredReport = (report, issues) => {
|
|
29
|
+
const summary = {
|
|
30
|
+
errors: 0,
|
|
31
|
+
warnings: 0,
|
|
32
|
+
infos: 0,
|
|
33
|
+
total: issues.length
|
|
34
|
+
};
|
|
35
|
+
for (const issue of issues) switch (issue.severity) {
|
|
36
|
+
case "error":
|
|
37
|
+
summary.errors += 1;
|
|
38
|
+
break;
|
|
39
|
+
case "warning":
|
|
40
|
+
summary.warnings += 1;
|
|
41
|
+
break;
|
|
42
|
+
case "info": summary.infos += 1;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...report,
|
|
46
|
+
valid: summary.errors === 0,
|
|
47
|
+
issues,
|
|
48
|
+
summary
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const runSeoTest = (fixture, options = {}) => {
|
|
52
|
+
const graph = resolveFixtureGraph(fixture);
|
|
53
|
+
const report = validateSeo({
|
|
54
|
+
graph,
|
|
55
|
+
metadata: options.validateMetadata === false ? void 0 : fixture.metadata
|
|
56
|
+
}, {
|
|
57
|
+
mode: options.strict ? "strict" : "warn",
|
|
58
|
+
baseUrl: getBaseUrl(fixture)
|
|
59
|
+
});
|
|
60
|
+
const filteredIssues = filterIssues(report, options);
|
|
61
|
+
const filteredReport = createFilteredReport(report, filteredIssues);
|
|
62
|
+
const errors = filteredIssues.filter((issue) => issue.severity === "error").map((issue) => issue.message);
|
|
63
|
+
const warnings = filteredIssues.filter((issue) => issue.severity === "warning").map((issue) => issue.message);
|
|
64
|
+
return {
|
|
65
|
+
passed: filteredReport.valid,
|
|
66
|
+
errors,
|
|
67
|
+
warnings,
|
|
68
|
+
report: filteredReport
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const assertSeoTest = (fixture, options = {}) => {
|
|
72
|
+
const result = runSeoTest(fixture, options);
|
|
73
|
+
if (!result.passed) throw new Error(formatSeoDiagnostics(result.report));
|
|
74
|
+
return result;
|
|
75
|
+
};
|
|
76
|
+
export { assertSeoTest, createSeoTestFixture, runSeoTest };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","names":[],"sources":["../../src/testing/fixture.ts"],"sourcesContent":["import { buildSeoGraph } from \"../core\";\n\nimport type { SeoGraph } from \"../core\";\n\nimport { validateSeo } from \"../validation\";\n\nimport type { SeoValidationIssue, SeoValidationReport } from \"../validation\";\n\nimport type { SeoTestFixture, SeoTestOptions, SeoTestResult } from \"./types\";\n\nimport { formatSeoDiagnostics } from \"./diagnostics\";\n\nconst getBaseUrl = (fixture: SeoTestFixture): string =>\n String(fixture.config.siteUrl);\n\nconst resolveFixtureGraph = (fixture: SeoTestFixture): SeoGraph => {\n if (fixture.graph) {\n return fixture.graph;\n }\n\n return buildSeoGraph(fixture.nodes ?? [], {\n baseUrl: getBaseUrl(fixture),\n });\n};\n\nexport const createSeoTestFixture = (\n fixture: SeoTestFixture,\n): SeoTestFixture => {\n if (fixture.graph && fixture.nodes) {\n throw new Error(\n \"Provide either graph or nodes when creating an SEO test fixture, not both.\",\n );\n }\n\n if (!fixture.config?.siteUrl) {\n throw new Error(\"SEO test fixtures require a valid siteUrl.\");\n }\n\n const graph = resolveFixtureGraph(fixture);\n\n return {\n config: fixture.config,\n graph,\n metadata: fixture.metadata,\n };\n};\n\nconst filterIssues = (\n report: SeoValidationReport,\n options: SeoTestOptions,\n): SeoValidationIssue[] => {\n return report.issues.filter((issue) => {\n if (options.validateSchema === false && issue.source === \"schema\") {\n return false;\n }\n\n if (options.validateMetadata === false && issue.source === \"metadata\") {\n return false;\n }\n\n if (\n options.validateReferences === false &&\n issue.code === \"unresolved-reference\"\n ) {\n return false;\n }\n\n return true;\n });\n};\n\nconst createFilteredReport = (\n report: SeoValidationReport,\n issues: SeoValidationIssue[],\n): SeoValidationReport => {\n const summary = {\n errors: 0,\n warnings: 0,\n infos: 0,\n total: issues.length,\n };\n\n for (const issue of issues) {\n switch (issue.severity) {\n case \"error\":\n summary.errors += 1;\n break;\n case \"warning\":\n summary.warnings += 1;\n break;\n case \"info\":\n summary.infos += 1;\n break;\n }\n }\n\n return {\n ...report,\n valid: summary.errors === 0,\n issues,\n summary,\n };\n};\n\nexport const runSeoTest = (\n fixture: SeoTestFixture,\n options: SeoTestOptions = {},\n): SeoTestResult => {\n const graph = resolveFixtureGraph(fixture);\n\n const report = validateSeo(\n {\n graph,\n metadata:\n options.validateMetadata === false ? undefined : fixture.metadata,\n },\n {\n mode: options.strict ? \"strict\" : \"warn\",\n baseUrl: getBaseUrl(fixture),\n },\n );\n\n const filteredIssues = filterIssues(report, options);\n const filteredReport = createFilteredReport(report, filteredIssues);\n\n const errors = filteredIssues\n .filter((issue) => issue.severity === \"error\")\n .map((issue) => issue.message);\n\n const warnings = filteredIssues\n .filter((issue) => issue.severity === \"warning\")\n .map((issue) => issue.message);\n\n return {\n passed: filteredReport.valid,\n errors,\n warnings,\n report: filteredReport,\n };\n};\n\nexport const assertSeoTest = (\n fixture: SeoTestFixture,\n options: SeoTestOptions = {},\n): SeoTestResult => {\n const result = runSeoTest(fixture, options);\n\n if (!result.passed) {\n throw new Error(format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Q,KAAA,IAAY,QAAQ;CAC7D,GACA;EACE,MAAM,QAAQ,SAAS,WAAW;EAClC,SAAS,WAAW,OAAO;CAC7B,CACF;CAEA,MAAM,iBAAiB,aAAa,QAAQ,OAAO;CACnD,MAAM,iBAAiB,qBAAqB,QAAQ,cAAc;CAElE,MAAM,SAAS,eACZ,QAAQ,UAAU,MAAM,aAAa,OAAO,CAAC,CAC7C,KAAK,UAAU,MAAM,OAAO;CAE/B,MAAM,WAAW,eACd,QAAQ,UAAU,MAAM,aAAa,SAAS,CAAC,CAC/C,KAAK,UAAU,MAAM,OAAO;CAE/B,OAAO;EACL,QAAQ,eAAe;EACvB;EACA;EACA,QAAQ;CACV;AACF;AAEA,MAAa,iBACX,SACA,UAA0B,CAAC,MACT;CAClB,MAAM,SAAS,WAAW,SAAS,OAAO;CAE1C,IAAI,CAAC,OAAO,QACV,MAAM,IAAI,MAAM,qBAAqB,OAAO,MAAM,CAAC;CAGrD,OAAO;AACT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_inspect = require("./inspect.cjs");
|
|
3
|
+
const require_diagnostics = require("./diagnostics.cjs");
|
|
4
|
+
const require_fixture = require("./fixture.cjs");
|
|
5
|
+
exports.assertSeoTest = require_fixture.assertSeoTest;
|
|
6
|
+
exports.createSeoTestFixture = require_fixture.createSeoTestFixture;
|
|
7
|
+
exports.formatSeoDiagnostics = require_diagnostics.formatSeoDiagnostics;
|
|
8
|
+
exports.inspectSeoGraph = require_inspect.inspectSeoGraph;
|
|
9
|
+
exports.runSeoTest = require_fixture.runSeoTest;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SeoDiagnosticFormatOptions, SeoGraphInspection, SeoGraphNodeInspection, SeoTestFixture, SeoTestOptions, SeoTestResult } from "./types.cjs";
|
|
2
|
+
import { inspectSeoGraph } from "./inspect.cjs";
|
|
3
|
+
import { formatSeoDiagnostics } from "./diagnostics.cjs";
|
|
4
|
+
import { assertSeoTest, createSeoTestFixture, runSeoTest } from "./fixture.cjs";
|
|
5
|
+
export { type SeoDiagnosticFormatOptions, type SeoGraphInspection, type SeoGraphNodeInspection, type SeoTestFixture, type SeoTestOptions, type SeoTestResult, assertSeoTest, createSeoTestFixture, formatSeoDiagnostics, inspectSeoGraph, runSeoTest };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SeoDiagnosticFormatOptions, SeoGraphInspection, SeoGraphNodeInspection, SeoTestFixture, SeoTestOptions, SeoTestResult } from "./types.js";
|
|
2
|
+
import { inspectSeoGraph } from "./inspect.js";
|
|
3
|
+
import { formatSeoDiagnostics } from "./diagnostics.js";
|
|
4
|
+
import { assertSeoTest, createSeoTestFixture, runSeoTest } from "./fixture.js";
|
|
5
|
+
export { type SeoDiagnosticFormatOptions, type SeoGraphInspection, type SeoGraphNodeInspection, type SeoTestFixture, type SeoTestOptions, type SeoTestResult, assertSeoTest, createSeoTestFixture, formatSeoDiagnostics, inspectSeoGraph, runSeoTest };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { inspectSeoGraph } from "./inspect.js";
|
|
2
|
+
import { formatSeoDiagnostics } from "./diagnostics.js";
|
|
3
|
+
import { assertSeoTest, createSeoTestFixture, runSeoTest } from "./fixture.js";
|
|
4
|
+
export { assertSeoTest, createSeoTestFixture, formatSeoDiagnostics, inspectSeoGraph, runSeoTest };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_graph = require("../core/graph.cjs");
|
|
2
|
+
// src/testing/inspect.ts
|
|
3
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
const getTypes = (node) => {
|
|
5
|
+
const value = node["@type"];
|
|
6
|
+
return (Array.isArray(value) ? value : [value]).filter((type) => typeof type === "string" && type.length > 0).map((type) => type.split("/").pop() ?? type).sort();
|
|
7
|
+
};
|
|
8
|
+
const collectReferences = (value, references) => {
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
for (const item of value) collectReferences(item, references);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!isObject(value)) return;
|
|
14
|
+
if (typeof value["@id"] === "string" && Object.keys(value).every((key) => key === "@id")) {
|
|
15
|
+
references.add(value["@id"]);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
for (const nestedValue of Object.values(value)) collectReferences(nestedValue, references);
|
|
19
|
+
};
|
|
20
|
+
const inspectSeoGraph = (graph, options = {}) => {
|
|
21
|
+
const nodes = Array.isArray(graph["@graph"]) ? graph["@graph"] : [];
|
|
22
|
+
const typeCounts = {};
|
|
23
|
+
const references = /* @__PURE__ */ new Set();
|
|
24
|
+
const inspectedNodes = nodes.map((node) => {
|
|
25
|
+
const types = getTypes(node);
|
|
26
|
+
for (const type of types) typeCounts[type] = (typeCounts[type] ?? 0) + 1;
|
|
27
|
+
collectReferences(node, references);
|
|
28
|
+
return {
|
|
29
|
+
id: typeof node["@id"] === "string" ? node["@id"] : void 0,
|
|
30
|
+
types,
|
|
31
|
+
properties: Object.keys(node).filter((property) => !property.startsWith("__puzzle")).sort()
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
const graphIds = new Set(nodes.map((node) => node["@id"]).filter((id) => typeof id === "string"));
|
|
35
|
+
const unresolvedReferences = [...references].filter((reference) => {
|
|
36
|
+
if (graphIds.has(reference)) return false;
|
|
37
|
+
if (reference.startsWith("#")) return true;
|
|
38
|
+
if (!options.baseUrl) return false;
|
|
39
|
+
try {
|
|
40
|
+
const target = new URL(reference);
|
|
41
|
+
const base = new URL(options.baseUrl);
|
|
42
|
+
return target.origin === base.origin;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}).sort();
|
|
47
|
+
const validation = require_graph.validateSeoGraph(graph, {
|
|
48
|
+
baseUrl: options.baseUrl,
|
|
49
|
+
strictReferences: true,
|
|
50
|
+
allowedExternalReferences: true
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
nodeCount: nodes.length,
|
|
54
|
+
typeCounts,
|
|
55
|
+
nodes: inspectedNodes,
|
|
56
|
+
references: [...references].sort(),
|
|
57
|
+
unresolvedReferences,
|
|
58
|
+
valid: validation.valid
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
exports.inspectSeoGraph = inspectSeoGraph;
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=inspect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.cjs","names":["validateSeoGraph"],"sources":["../../src/testing/inspect.ts"],"sourcesContent":["import type { SeoGraph, SeoNode } from \"../core/types\";\n\nimport { validateSeoGraph } from \"../core\";\n\nimport type { SeoGraphInspection } from \"./types\";\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getTypes = (node: SeoNode): string[] => {\n const value = node[\"@type\"];\n const types = Array.isArray(value) ? value : [value];\n\n return types\n .filter(\n (type): type is string => typeof type === \"string\" && type.length > 0,\n )\n .map((type) => type.split(\"/\").pop() ?? type)\n .sort();\n};\n\nconst collectReferences = (value: unknown, references: Set<string>): void => {\n if (Array.isArray(value)) {\n for (const item of value) {\n collectReferences(item, references);\n }\n\n return;\n }\n\n if (!isObject(value)) {\n return;\n }\n\n if (\n typeof value[\"@id\"] === \"string\" &&\n Object.keys(value).every((key) => key === \"@id\")\n ) {\n references.add(value[\"@id\"]);\n return;\n }\n\n for (const nestedValue of Object.values(value)) {\n collectReferences(nestedValue, references);\n }\n};\n\nexport const inspectSeoGraph = (\n graph: SeoGraph,\n options: {\n baseUrl?: string;\n } = {},\n): SeoGraphInspection => {\n const nodes = Array.isArray(graph[\"@graph\"]) ? graph[\"@graph\"] : [];\n\n const typeCounts: Record<string, number> = {};\n const references = new Set<string>();\n\n const inspectedNodes = nodes.map((node) => {\n const types = getTypes(node);\n\n for (const type of types) {\n typeCounts[type] = (typeCounts[type] ?? 0) + 1;\n }\n\n collectReferences(node, references);\n\n return {\n id: typeof node[\"@id\"] === \"string\" ? node[\"@id\"] : undefined,\n types,\n properties: Object.keys(node)\n .filter((property) => !property.startsWith(\"__puzzle\"))\n .sort(),\n };\n });\n\n const graphIds = new Set(\n nodes\n .map((node) => node[\"@id\"])\n .filter((id): id is string => typeof id === \"string\"),\n );\n\n const unresolvedReferences = [...references]\n .filter((reference) => {\n if (graphIds.has(reference)) {\n return false;\n }\n\n // Only local references are considered unresolved.\n if (reference.startsWith(\"#\")) {\n return true;\n }\n\n if (!options.baseUrl) {\n return false;\n }\n\n try {\n const target = new URL(reference);\n const base = new URL(options.baseUrl);\n\n return target.origin === base.origin;\n } catch {\n return false;\n }\n })\n .sort();\n\n const validation = validateSeoGraph(graph, {\n baseUrl: options.baseUrl,\n strictReferences: true,\n allowedExternalReferences: true,\n });\n\n return {\n nodeCount: nodes.length,\n typeCounts,\n nodes: inspectedNodes,\n references: [...references].sort(),\n unresolvedReferences,\n valid: validation.valid,\n };\n};\n"],"mappings":";;AAMA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,YAAY,SAA4B;CAC5C,MAAM,QAAQ,KAAK;CAGnB,QAFc,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAA,CAGhD,QACE,SAAyB,OAAO,SAAS,YAAY,KAAK,SAAS,CACtE,CAAC,CACA,KAAK,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAC5C,KAAK;AACV;AAEA,MAAM,qBAAqB,OAAgB,eAAkC;CAC3E,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxB,KAAK,MAAM,QAAQ,OACjB,kBAAkB,MAAM,UAAU;EAGpC;CACF;CAEA,IAAI,CAAC,SAAS,KAAK,GACjB;CAGF,IACE,OAAO,MAAM,WAAW,YACxB,OAAO,KAAK,KAAK,C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B,2BAA2B;CAC7B,CAAC;CAED,OAAO;EACL,WAAW,MAAM;EACjB;EACA,OAAO;EACP,YAAY,CAAC,GAAG,UAAU,CAAC,CAAC,KAAK;EACjC;EACA,OAAO,WAAW;CACpB;AACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { validateSeoGraph } from "../core/graph.js";
|
|
2
|
+
// src/testing/inspect.ts
|
|
3
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
const getTypes = (node) => {
|
|
5
|
+
const value = node["@type"];
|
|
6
|
+
return (Array.isArray(value) ? value : [value]).filter((type) => typeof type === "string" && type.length > 0).map((type) => type.split("/").pop() ?? type).sort();
|
|
7
|
+
};
|
|
8
|
+
const collectReferences = (value, references) => {
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
for (const item of value) collectReferences(item, references);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!isObject(value)) return;
|
|
14
|
+
if (typeof value["@id"] === "string" && Object.keys(value).every((key) => key === "@id")) {
|
|
15
|
+
references.add(value["@id"]);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
for (const nestedValue of Object.values(value)) collectReferences(nestedValue, references);
|
|
19
|
+
};
|
|
20
|
+
const inspectSeoGraph = (graph, options = {}) => {
|
|
21
|
+
const nodes = Array.isArray(graph["@graph"]) ? graph["@graph"] : [];
|
|
22
|
+
const typeCounts = {};
|
|
23
|
+
const references = /* @__PURE__ */ new Set();
|
|
24
|
+
const inspectedNodes = nodes.map((node) => {
|
|
25
|
+
const types = getTypes(node);
|
|
26
|
+
for (const type of types) typeCounts[type] = (typeCounts[type] ?? 0) + 1;
|
|
27
|
+
collectReferences(node, references);
|
|
28
|
+
return {
|
|
29
|
+
id: typeof node["@id"] === "string" ? node["@id"] : void 0,
|
|
30
|
+
types,
|
|
31
|
+
properties: Object.keys(node).filter((property) => !property.startsWith("__puzzle")).sort()
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
const graphIds = new Set(nodes.map((node) => node["@id"]).filter((id) => typeof id === "string"));
|
|
35
|
+
const unresolvedReferences = [...references].filter((reference) => {
|
|
36
|
+
if (graphIds.has(reference)) return false;
|
|
37
|
+
if (reference.startsWith("#")) return true;
|
|
38
|
+
if (!options.baseUrl) return false;
|
|
39
|
+
try {
|
|
40
|
+
const target = new URL(reference);
|
|
41
|
+
const base = new URL(options.baseUrl);
|
|
42
|
+
return target.origin === base.origin;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}).sort();
|
|
47
|
+
const validation = validateSeoGraph(graph, {
|
|
48
|
+
baseUrl: options.baseUrl,
|
|
49
|
+
strictReferences: true,
|
|
50
|
+
allowedExternalReferences: true
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
nodeCount: nodes.length,
|
|
54
|
+
typeCounts,
|
|
55
|
+
nodes: inspectedNodes,
|
|
56
|
+
references: [...references].sort(),
|
|
57
|
+
unresolvedReferences,
|
|
58
|
+
valid: validation.valid
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export { inspectSeoGraph };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=inspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","names":[],"sources":["../../src/testing/inspect.ts"],"sourcesContent":["import type { SeoGraph, SeoNode } from \"../core/types\";\n\nimport { validateSeoGraph } from \"../core\";\n\nimport type { SeoGraphInspection } from \"./types\";\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getTypes = (node: SeoNode): string[] => {\n const value = node[\"@type\"];\n const types = Array.isArray(value) ? value : [value];\n\n return types\n .filter(\n (type): type is string => typeof type === \"string\" && type.length > 0,\n )\n .map((type) => type.split(\"/\").pop() ?? type)\n .sort();\n};\n\nconst collectReferences = (value: unknown, references: Set<string>): void => {\n if (Array.isArray(value)) {\n for (const item of value) {\n collectReferences(item, references);\n }\n\n return;\n }\n\n if (!isObject(value)) {\n return;\n }\n\n if (\n typeof value[\"@id\"] === \"string\" &&\n Object.keys(value).every((key) => key === \"@id\")\n ) {\n references.add(value[\"@id\"]);\n return;\n }\n\n for (const nestedValue of Object.values(value)) {\n collectReferences(nestedValue, references);\n }\n};\n\nexport const inspectSeoGraph = (\n graph: SeoGraph,\n options: {\n baseUrl?: string;\n } = {},\n): SeoGraphInspection => {\n const nodes = Array.isArray(graph[\"@graph\"]) ? graph[\"@graph\"] : [];\n\n const typeCounts: Record<string, number> = {};\n const references = new Set<string>();\n\n const inspectedNodes = nodes.map((node) => {\n const types = getTypes(node);\n\n for (const type of types) {\n typeCounts[type] = (typeCounts[type] ?? 0) + 1;\n }\n\n collectReferences(node, references);\n\n return {\n id: typeof node[\"@id\"] === \"string\" ? node[\"@id\"] : undefined,\n types,\n properties: Object.keys(node)\n .filter((property) => !property.startsWith(\"__puzzle\"))\n .sort(),\n };\n });\n\n const graphIds = new Set(\n nodes\n .map((node) => node[\"@id\"])\n .filter((id): id is string => typeof id === \"string\"),\n );\n\n const unresolvedReferences = [...references]\n .filter((reference) => {\n if (graphIds.has(reference)) {\n return false;\n }\n\n // Only local references are considered unresolved.\n if (reference.startsWith(\"#\")) {\n return true;\n }\n\n if (!options.baseUrl) {\n return false;\n }\n\n try {\n const target = new URL(reference);\n const base = new URL(options.baseUrl);\n\n return target.origin === base.origin;\n } catch {\n return false;\n }\n })\n .sort();\n\n const validation = validateSeoGraph(graph, {\n baseUrl: options.baseUrl,\n strictReferences: true,\n allowedExternalReferences: true,\n });\n\n return {\n nodeCount: nodes.length,\n typeCounts,\n nodes: inspectedNodes,\n references: [...references].sort(),\n unresolvedReferences,\n valid: validation.valid,\n };\n};\n"],"mappings":";;AAMA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,YAAY,SAA4B;CAC5C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O,OAAO,QAAQ,CACxD;CAEA,MAAM,uBAAuB,CAAC,GAAG,UAAU,CAAC,CACzC,QAAQ,cAAc;EACrB,IAAI,SAAS,IAAI,SAAS,GACxB,OAAO;EAIT,IAAI,UAAU,WAAW,GAAG,GAC1B,OAAO;EAGT,IAAI,CAAC,QAAQ,SACX,OAAO;EAGT,IAAI;GACF,MAAM,SAAS,IAAI,IAAI,SAAS;GAChC,MAAM,OAAO,IAAI,IAAI,QAAQ,OAAO;GAEpC,OAAO,OAAO,WAAW,KAAK;EAChC,QAAQ;GACN,OAAO;EACT;CACF,CAAC,CAAC,CACD,KAAK;CAER,MAAM,aAAa,iBAAiB,OAAO;EACzC,SAAS,QAAQ;EACjB,kBAAkB;EAClB,2BAA2B;CAC7B,CAAC;CAED,OAAO;EACL,WAAW,MAAM;EACjB;EACA,OAAO;EACP,YAAY,CAAC,GAAG,UAAU,CAAC,CAAC,KAAK;EACjC;EACA,OAAO,WAAW;CACpB;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SeoConfig } from "../context/types.cjs";
|
|
2
|
+
import { SeoGraph, SeoNode } from "../core/types.cjs";
|
|
3
|
+
import { SeoPageMetadata } from "../metadata/types.cjs";
|
|
4
|
+
import { SeoValidationReport } from "../validation/types.cjs";
|
|
5
|
+
export interface SeoTestFixture {
|
|
6
|
+
config: SeoConfig;
|
|
7
|
+
nodes?: SeoNode[];
|
|
8
|
+
graph?: SeoGraph;
|
|
9
|
+
metadata?: SeoPageMetadata;
|
|
10
|
+
}
|
|
11
|
+
export interface SeoTestResult {
|
|
12
|
+
passed: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
warnings: string[];
|
|
15
|
+
report: SeoValidationReport;
|
|
16
|
+
}
|
|
17
|
+
export interface SeoTestOptions {
|
|
18
|
+
strict?: boolean;
|
|
19
|
+
validateSchema?: boolean;
|
|
20
|
+
validateMetadata?: boolean;
|
|
21
|
+
validateReferences?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface SeoGraphNodeInspection {
|
|
24
|
+
id?: string;
|
|
25
|
+
types: string[];
|
|
26
|
+
properties: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface SeoGraphInspection {
|
|
29
|
+
nodeCount: number;
|
|
30
|
+
typeCounts: Record<string, number>;
|
|
31
|
+
nodes: SeoGraphNodeInspection[];
|
|
32
|
+
references: string[];
|
|
33
|
+
unresolvedReferences: string[];
|
|
34
|
+
valid: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface SeoDiagnosticFormatOptions {
|
|
37
|
+
includeSuggestions?: boolean;
|
|
38
|
+
includePaths?: boolean;
|
|
39
|
+
includeSummary?: boolean;
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SeoConfig } from "../context/types.js";
|
|
2
|
+
import { SeoGraph, SeoNode } from "../core/types.js";
|
|
3
|
+
import { SeoPageMetadata } from "../metadata/types.js";
|
|
4
|
+
import { SeoValidationReport } from "../validation/types.js";
|
|
5
|
+
export interface SeoTestFixture {
|
|
6
|
+
config: SeoConfig;
|
|
7
|
+
nodes?: SeoNode[];
|
|
8
|
+
graph?: SeoGraph;
|
|
9
|
+
metadata?: SeoPageMetadata;
|
|
10
|
+
}
|
|
11
|
+
export interface SeoTestResult {
|
|
12
|
+
passed: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
warnings: string[];
|
|
15
|
+
report: SeoValidationReport;
|
|
16
|
+
}
|
|
17
|
+
export interface SeoTestOptions {
|
|
18
|
+
strict?: boolean;
|
|
19
|
+
validateSchema?: boolean;
|
|
20
|
+
validateMetadata?: boolean;
|
|
21
|
+
validateReferences?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface SeoGraphNodeInspection {
|
|
24
|
+
id?: string;
|
|
25
|
+
types: string[];
|
|
26
|
+
properties: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface SeoGraphInspection {
|
|
29
|
+
nodeCount: number;
|
|
30
|
+
typeCounts: Record<string, number>;
|
|
31
|
+
nodes: SeoGraphNodeInspection[];
|
|
32
|
+
references: string[];
|
|
33
|
+
unresolvedReferences: string[];
|
|
34
|
+
valid: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface SeoDiagnosticFormatOptions {
|
|
37
|
+
includeSuggestions?: boolean;
|
|
38
|
+
includePaths?: boolean;
|
|
39
|
+
includeSummary?: boolean;
|
|
40
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_normalize = require("./normalize.cjs");
|
|
3
|
+
exports.isSameSeoOrigin = require_normalize.isSameSeoOrigin;
|
|
4
|
+
exports.isValidSeoUrl = require_normalize.isValidSeoUrl;
|
|
5
|
+
exports.normalizeSeoOrigin = require_normalize.normalizeSeoOrigin;
|
|
6
|
+
exports.normalizeSeoPath = require_normalize.normalizeSeoPath;
|
|
7
|
+
exports.normalizeSeoUrl = require_normalize.normalizeSeoUrl;
|
|
8
|
+
exports.resolveSeoUrls = require_normalize.resolveSeoUrls;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SeoOriginOptions, SeoUrlOptions, SeoUrlResult, SeoUrlValidationIssue } from "./types.cjs";
|
|
2
|
+
import { isSameSeoOrigin, isValidSeoUrl, normalizeSeoOrigin, normalizeSeoPath, normalizeSeoUrl, resolveSeoUrls } from "./normalize.cjs";
|
|
3
|
+
export { type SeoOriginOptions, type SeoUrlOptions, type SeoUrlResult, type SeoUrlValidationIssue, isSameSeoOrigin, isValidSeoUrl, normalizeSeoOrigin, normalizeSeoPath, normalizeSeoUrl, resolveSeoUrls };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SeoOriginOptions, SeoUrlOptions, SeoUrlResult, SeoUrlValidationIssue } from "./types.js";
|
|
2
|
+
import { isSameSeoOrigin, isValidSeoUrl, normalizeSeoOrigin, normalizeSeoPath, normalizeSeoUrl, resolveSeoUrls } from "./normalize.js";
|
|
3
|
+
export { type SeoOriginOptions, type SeoUrlOptions, type SeoUrlResult, type SeoUrlValidationIssue, isSameSeoOrigin, isValidSeoUrl, normalizeSeoOrigin, normalizeSeoPath, normalizeSeoUrl, resolveSeoUrls };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isSameSeoOrigin, isValidSeoUrl, normalizeSeoOrigin, normalizeSeoPath, normalizeSeoUrl, resolveSeoUrls } from "./normalize.js";
|