@nuasite/cms-marker 0.0.75 → 0.0.77
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/types/build-processor.d.ts.map +1 -1
- package/dist/types/dev-middleware.d.ts.map +1 -1
- package/dist/types/html-processor.d.ts +5 -1
- package/dist/types/html-processor.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/manifest-writer.d.ts +3 -2
- package/dist/types/manifest-writer.d.ts.map +1 -1
- package/dist/types/seo-processor.d.ts +23 -0
- package/dist/types/seo-processor.d.ts.map +1 -0
- package/dist/types/source-finder/index.d.ts +3 -1
- package/dist/types/source-finder/index.d.ts.map +1 -1
- package/dist/types/source-finder/seo-finder.d.ts +32 -0
- package/dist/types/source-finder/seo-finder.d.ts.map +1 -0
- package/dist/types/source-finder/snippet-utils.d.ts +3 -3
- package/dist/types/source-finder/snippet-utils.d.ts.map +1 -1
- package/dist/types/source-finder/source-lookup.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +89 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/build-processor.ts +3 -1
- package/src/dev-middleware.ts +16 -13
- package/src/html-processor.ts +42 -2
- package/src/index.ts +38 -4
- package/src/manifest-writer.ts +12 -2
- package/src/seo-processor.ts +325 -0
- package/src/source-finder/index.ts +5 -1
- package/src/source-finder/seo-finder.ts +336 -0
- package/src/source-finder/snippet-utils.ts +7 -10
- package/src/source-finder/source-lookup.ts +3 -4
- package/src/types.ts +101 -0
|
@@ -136,12 +136,11 @@ export async function searchAstroFile(
|
|
|
136
136
|
? bestMatch.definitionLine
|
|
137
137
|
: bestMatch.line
|
|
138
138
|
|
|
139
|
-
// Get the source snippet -
|
|
139
|
+
// Get the source snippet - complete element for static content, definition line for variables
|
|
140
140
|
let snippet: string
|
|
141
141
|
if (bestMatch.type === 'static') {
|
|
142
|
-
// For static content, extract
|
|
143
|
-
|
|
144
|
-
snippet = extractInnerHtmlFromSnippet(completeSnippet, tag) ?? completeSnippet
|
|
142
|
+
// For static content, extract the complete element (including wrapper tags)
|
|
143
|
+
snippet = extractCompleteTagSnippet(lines, editableLine - 1, tag)
|
|
145
144
|
} else {
|
|
146
145
|
// For variables/props, just the definition line with indentation
|
|
147
146
|
snippet = lines[editableLine - 1] || ''
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/** SEO tracking options */
|
|
2
|
+
export interface SeoOptions {
|
|
3
|
+
/** Whether to track SEO elements (default: true) */
|
|
4
|
+
trackSeo?: boolean
|
|
5
|
+
/** Whether to mark the page title with a CMS ID (default: true) */
|
|
6
|
+
markTitle?: boolean
|
|
7
|
+
/** Whether to parse JSON-LD structured data (default: true) */
|
|
8
|
+
parseJsonLd?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
export interface CmsMarkerOptions {
|
|
2
12
|
attributeName?: string
|
|
3
13
|
includeTags?: string[] | null
|
|
@@ -9,6 +19,8 @@ export interface CmsMarkerOptions {
|
|
|
9
19
|
componentDirs?: string[]
|
|
10
20
|
/** Directory containing content collections (default: 'src/content') */
|
|
11
21
|
contentDir?: string
|
|
22
|
+
/** SEO tracking options */
|
|
23
|
+
seo?: SeoOptions
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
export interface ComponentProp {
|
|
@@ -308,3 +320,92 @@ export interface CmsManifest {
|
|
|
308
320
|
/** Available text styles from the project's Tailwind config */
|
|
309
321
|
availableTextStyles?: AvailableTextStyles
|
|
310
322
|
}
|
|
323
|
+
|
|
324
|
+
// === SEO Types ===
|
|
325
|
+
|
|
326
|
+
/** Source tracking information for SEO elements */
|
|
327
|
+
export interface SeoSourceInfo {
|
|
328
|
+
/** Path to source file */
|
|
329
|
+
sourcePath: string
|
|
330
|
+
/** Line number in source file (1-indexed) */
|
|
331
|
+
sourceLine: number
|
|
332
|
+
/** Exact source code snippet for matching/replacement */
|
|
333
|
+
sourceSnippet: string
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** SEO meta tag with source tracking */
|
|
337
|
+
export interface SeoMetaTag extends SeoSourceInfo {
|
|
338
|
+
/** Meta tag name attribute (for name-based meta tags) */
|
|
339
|
+
name?: string
|
|
340
|
+
/** Meta tag property attribute (for Open Graph/Twitter tags) */
|
|
341
|
+
property?: string
|
|
342
|
+
/** Meta tag content value */
|
|
343
|
+
content: string
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Open Graph metadata */
|
|
347
|
+
export interface OpenGraphData {
|
|
348
|
+
title?: SeoMetaTag
|
|
349
|
+
description?: SeoMetaTag
|
|
350
|
+
image?: SeoMetaTag
|
|
351
|
+
url?: SeoMetaTag
|
|
352
|
+
type?: SeoMetaTag
|
|
353
|
+
siteName?: SeoMetaTag
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** Twitter Card metadata */
|
|
357
|
+
export interface TwitterCardData {
|
|
358
|
+
card?: SeoMetaTag
|
|
359
|
+
title?: SeoMetaTag
|
|
360
|
+
description?: SeoMetaTag
|
|
361
|
+
image?: SeoMetaTag
|
|
362
|
+
site?: SeoMetaTag
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** JSON-LD structured data entry */
|
|
366
|
+
export interface JsonLdEntry extends SeoSourceInfo {
|
|
367
|
+
/** Schema.org @type value */
|
|
368
|
+
type: string
|
|
369
|
+
/** Parsed JSON-LD data */
|
|
370
|
+
data: Record<string, unknown>
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** Canonical URL link element */
|
|
374
|
+
export interface CanonicalUrl extends SeoSourceInfo {
|
|
375
|
+
/** The canonical URL href value */
|
|
376
|
+
href: string
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** Page title element with optional CMS ID */
|
|
380
|
+
export interface SeoTitle extends SeoSourceInfo {
|
|
381
|
+
/** Title text content */
|
|
382
|
+
content: string
|
|
383
|
+
/** CMS ID if title was marked for editing */
|
|
384
|
+
cmsId?: string
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** Meta keywords with parsed array */
|
|
388
|
+
export interface SeoKeywords extends SeoSourceInfo {
|
|
389
|
+
/** Raw keywords string */
|
|
390
|
+
content: string
|
|
391
|
+
/** Parsed array of individual keywords */
|
|
392
|
+
keywords: string[]
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** Complete SEO data for a page */
|
|
396
|
+
export interface PageSeoData {
|
|
397
|
+
/** Page title */
|
|
398
|
+
title?: SeoTitle
|
|
399
|
+
/** Meta description */
|
|
400
|
+
description?: SeoMetaTag
|
|
401
|
+
/** Meta keywords */
|
|
402
|
+
keywords?: SeoKeywords
|
|
403
|
+
/** Canonical URL */
|
|
404
|
+
canonical?: CanonicalUrl
|
|
405
|
+
/** Open Graph metadata */
|
|
406
|
+
openGraph?: OpenGraphData
|
|
407
|
+
/** Twitter Card metadata */
|
|
408
|
+
twitterCard?: TwitterCardData
|
|
409
|
+
/** JSON-LD structured data blocks */
|
|
410
|
+
jsonLd?: JsonLdEntry[]
|
|
411
|
+
}
|