@nuasite/cms 0.1.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 +237 -0
- package/dist/src/build-processor.d.ts +20 -0
- package/dist/src/build-processor.d.ts.map +1 -0
- package/dist/src/collection-scanner.d.ts +6 -0
- package/dist/src/collection-scanner.d.ts.map +1 -0
- package/dist/src/component-registry.d.ts +63 -0
- package/dist/src/component-registry.d.ts.map +1 -0
- package/dist/src/config.d.ts +24 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/dev-middleware.d.ts +20 -0
- package/dist/src/dev-middleware.d.ts.map +1 -0
- package/dist/src/editor/ai.d.ts +60 -0
- package/dist/src/editor/ai.d.ts.map +1 -0
- package/dist/src/editor/api.d.ts +140 -0
- package/dist/src/editor/api.d.ts.map +1 -0
- package/dist/src/editor/color-utils.d.ts +106 -0
- package/dist/src/editor/color-utils.d.ts.map +1 -0
- package/dist/src/editor/components/ai-chat.d.ts +11 -0
- package/dist/src/editor/components/ai-chat.d.ts.map +1 -0
- package/dist/src/editor/components/ai-tooltip.d.ts +12 -0
- package/dist/src/editor/components/ai-tooltip.d.ts.map +1 -0
- package/dist/src/editor/components/attribute-editor.d.ts +5 -0
- package/dist/src/editor/components/attribute-editor.d.ts.map +1 -0
- package/dist/src/editor/components/block-editor.d.ts +12 -0
- package/dist/src/editor/components/block-editor.d.ts.map +1 -0
- package/dist/src/editor/components/collections-browser.d.ts +2 -0
- package/dist/src/editor/components/collections-browser.d.ts.map +1 -0
- package/dist/src/editor/components/color-toolbar.d.ts +12 -0
- package/dist/src/editor/components/color-toolbar.d.ts.map +1 -0
- package/dist/src/editor/components/confirm-dialog.d.ts +2 -0
- package/dist/src/editor/components/confirm-dialog.d.ts.map +1 -0
- package/dist/src/editor/components/create-page-modal.d.ts +2 -0
- package/dist/src/editor/components/create-page-modal.d.ts.map +1 -0
- package/dist/src/editor/components/editable-highlights.d.ts +9 -0
- package/dist/src/editor/components/editable-highlights.d.ts.map +1 -0
- package/dist/src/editor/components/error-boundary.d.ts +32 -0
- package/dist/src/editor/components/error-boundary.d.ts.map +1 -0
- package/dist/src/editor/components/fields.d.ts +75 -0
- package/dist/src/editor/components/fields.d.ts.map +1 -0
- package/dist/src/editor/components/frontmatter-fields.d.ts +29 -0
- package/dist/src/editor/components/frontmatter-fields.d.ts.map +1 -0
- package/dist/src/editor/components/highlight-overlay.d.ts +64 -0
- package/dist/src/editor/components/highlight-overlay.d.ts.map +1 -0
- package/dist/src/editor/components/image-overlay.d.ts +12 -0
- package/dist/src/editor/components/image-overlay.d.ts.map +1 -0
- package/dist/src/editor/components/markdown-editor-overlay.d.ts +6 -0
- package/dist/src/editor/components/markdown-editor-overlay.d.ts.map +1 -0
- package/dist/src/editor/components/markdown-inline-editor.d.ts +10 -0
- package/dist/src/editor/components/markdown-inline-editor.d.ts.map +1 -0
- package/dist/src/editor/components/media-library.d.ts +2 -0
- package/dist/src/editor/components/media-library.d.ts.map +1 -0
- package/dist/src/editor/components/outline.d.ts +21 -0
- package/dist/src/editor/components/outline.d.ts.map +1 -0
- package/dist/src/editor/components/redirect-countdown.d.ts +2 -0
- package/dist/src/editor/components/redirect-countdown.d.ts.map +1 -0
- package/dist/src/editor/components/seo-editor.d.ts +2 -0
- package/dist/src/editor/components/seo-editor.d.ts.map +1 -0
- package/dist/src/editor/components/text-style-toolbar.d.ts +8 -0
- package/dist/src/editor/components/text-style-toolbar.d.ts.map +1 -0
- package/dist/src/editor/components/toast/toast-container.d.ts +7 -0
- package/dist/src/editor/components/toast/toast-container.d.ts.map +1 -0
- package/dist/src/editor/components/toast/toast.d.ts +7 -0
- package/dist/src/editor/components/toast/toast.d.ts.map +1 -0
- package/dist/src/editor/components/toast/types.d.ts +7 -0
- package/dist/src/editor/components/toast/types.d.ts.map +1 -0
- package/dist/src/editor/components/toolbar.d.ts +21 -0
- package/dist/src/editor/components/toolbar.d.ts.map +1 -0
- package/dist/src/editor/config.d.ts +4 -0
- package/dist/src/editor/config.d.ts.map +1 -0
- package/dist/src/editor/constants.d.ts +101 -0
- package/dist/src/editor/constants.d.ts.map +1 -0
- package/dist/src/editor/context.d.ts +14 -0
- package/dist/src/editor/context.d.ts.map +1 -0
- package/dist/src/editor/dom.d.ts +77 -0
- package/dist/src/editor/dom.d.ts.map +1 -0
- package/dist/src/editor/editor.d.ts +64 -0
- package/dist/src/editor/editor.d.ts.map +1 -0
- package/dist/src/editor/history.d.ts +20 -0
- package/dist/src/editor/history.d.ts.map +1 -0
- package/dist/src/editor/hooks/index.d.ts +14 -0
- package/dist/src/editor/hooks/index.d.ts.map +1 -0
- package/dist/src/editor/hooks/useAIHandlers.d.ts +22 -0
- package/dist/src/editor/hooks/useAIHandlers.d.ts.map +1 -0
- package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts +18 -0
- package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts.map +1 -0
- package/dist/src/editor/hooks/useElementDetection.d.ts +26 -0
- package/dist/src/editor/hooks/useElementDetection.d.ts.map +1 -0
- package/dist/src/editor/hooks/useImageHoverDetection.d.ts +12 -0
- package/dist/src/editor/hooks/useImageHoverDetection.d.ts.map +1 -0
- package/dist/src/editor/hooks/useTextSelection.d.ts +23 -0
- package/dist/src/editor/hooks/useTextSelection.d.ts.map +1 -0
- package/dist/src/editor/hooks/useTooltipState.d.ts +19 -0
- package/dist/src/editor/hooks/useTooltipState.d.ts.map +1 -0
- package/dist/src/editor/hooks/utils.d.ts +32 -0
- package/dist/src/editor/hooks/utils.d.ts.map +1 -0
- package/dist/src/editor/index.d.ts +12 -0
- package/dist/src/editor/index.d.ts.map +1 -0
- package/dist/src/editor/lib/cn.d.ts +3 -0
- package/dist/src/editor/lib/cn.d.ts.map +1 -0
- package/dist/src/editor/manifest.d.ts +19 -0
- package/dist/src/editor/manifest.d.ts.map +1 -0
- package/dist/src/editor/markdown-api.d.ts +36 -0
- package/dist/src/editor/markdown-api.d.ts.map +1 -0
- package/dist/src/editor/signals.d.ts +242 -0
- package/dist/src/editor/signals.d.ts.map +1 -0
- package/dist/src/editor/storage.d.ts +27 -0
- package/dist/src/editor/storage.d.ts.map +1 -0
- package/dist/src/editor/text-styling.d.ts +350 -0
- package/dist/src/editor/text-styling.d.ts.map +1 -0
- package/dist/src/editor/themes.d.ts +38 -0
- package/dist/src/editor/themes.d.ts.map +1 -0
- package/dist/src/editor/types.d.ts +454 -0
- package/dist/src/editor/types.d.ts.map +1 -0
- package/dist/src/error-collector.d.ts +56 -0
- package/dist/src/error-collector.d.ts.map +1 -0
- package/dist/src/handlers/component-ops.d.ts +34 -0
- package/dist/src/handlers/component-ops.d.ts.map +1 -0
- package/dist/src/handlers/markdown-ops.d.ts +41 -0
- package/dist/src/handlers/markdown-ops.d.ts.map +1 -0
- package/dist/src/handlers/request-utils.d.ts +20 -0
- package/dist/src/handlers/request-utils.d.ts.map +1 -0
- package/dist/src/handlers/source-writer.d.ts +51 -0
- package/dist/src/handlers/source-writer.d.ts.map +1 -0
- package/dist/src/html-processor.d.ts +63 -0
- package/dist/src/html-processor.d.ts.map +1 -0
- package/dist/src/index.d.ts +41 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/manifest-writer.d.ts +111 -0
- package/dist/src/manifest-writer.d.ts.map +1 -0
- package/dist/src/media/contember.d.ts +15 -0
- package/dist/src/media/contember.d.ts.map +1 -0
- package/dist/src/media/local.d.ts +9 -0
- package/dist/src/media/local.d.ts.map +1 -0
- package/dist/src/media/s3.d.ts +12 -0
- package/dist/src/media/s3.d.ts.map +1 -0
- package/dist/src/media/types.d.ts +40 -0
- package/dist/src/media/types.d.ts.map +1 -0
- package/dist/src/preview-generator.d.ts +19 -0
- package/dist/src/preview-generator.d.ts.map +1 -0
- package/dist/src/seo-processor.d.ts +23 -0
- package/dist/src/seo-processor.d.ts.map +1 -0
- package/dist/src/source-finder/ast-extractors.d.ts +35 -0
- package/dist/src/source-finder/ast-extractors.d.ts.map +1 -0
- package/dist/src/source-finder/ast-parser.d.ts +16 -0
- package/dist/src/source-finder/ast-parser.d.ts.map +1 -0
- package/dist/src/source-finder/cache.d.ts +18 -0
- package/dist/src/source-finder/cache.d.ts.map +1 -0
- package/dist/src/source-finder/collection-finder.d.ts +29 -0
- package/dist/src/source-finder/collection-finder.d.ts.map +1 -0
- package/dist/src/source-finder/cross-file-tracker.d.ts +39 -0
- package/dist/src/source-finder/cross-file-tracker.d.ts.map +1 -0
- package/dist/src/source-finder/element-finder.d.ts +42 -0
- package/dist/src/source-finder/element-finder.d.ts.map +1 -0
- package/dist/src/source-finder/image-finder.d.ts +24 -0
- package/dist/src/source-finder/image-finder.d.ts.map +1 -0
- package/dist/src/source-finder/index.d.ts +9 -0
- package/dist/src/source-finder/index.d.ts.map +1 -0
- package/dist/src/source-finder/search-index.d.ts +27 -0
- package/dist/src/source-finder/search-index.d.ts.map +1 -0
- package/dist/src/source-finder/snippet-utils.d.ts +90 -0
- package/dist/src/source-finder/snippet-utils.d.ts.map +1 -0
- package/dist/src/source-finder/source-lookup.d.ts +16 -0
- package/dist/src/source-finder/source-lookup.d.ts.map +1 -0
- package/dist/src/source-finder/types.d.ts +167 -0
- package/dist/src/source-finder/types.d.ts.map +1 -0
- package/dist/src/source-finder/variable-extraction.d.ts +37 -0
- package/dist/src/source-finder/variable-extraction.d.ts.map +1 -0
- package/dist/src/tailwind-colors.d.ts +54 -0
- package/dist/src/tailwind-colors.d.ts.map +1 -0
- package/dist/src/tsconfig.tsbuildinfo +1 -0
- package/dist/src/types.d.ts +367 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils.d.ts +61 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/vite-plugin.d.ts +14 -0
- package/dist/src/vite-plugin.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +80 -0
- package/src/build-processor.ts +784 -0
- package/src/collection-scanner.ts +304 -0
- package/src/component-registry.ts +393 -0
- package/src/config.ts +74 -0
- package/src/dev-middleware.ts +525 -0
- package/src/dist/src/tsconfig.tsbuildinfo +1 -0
- package/src/editor/ai.ts +185 -0
- package/src/editor/api.ts +513 -0
- package/src/editor/color-utils.ts +556 -0
- package/src/editor/components/ai-chat.tsx +632 -0
- package/src/editor/components/ai-tooltip.tsx +179 -0
- package/src/editor/components/attribute-editor.tsx +596 -0
- package/src/editor/components/block-editor.tsx +546 -0
- package/src/editor/components/collections-browser.tsx +248 -0
- package/src/editor/components/color-toolbar.tsx +314 -0
- package/src/editor/components/confirm-dialog.tsx +69 -0
- package/src/editor/components/create-page-modal.tsx +163 -0
- package/src/editor/components/editable-highlights.tsx +260 -0
- package/src/editor/components/error-boundary.tsx +87 -0
- package/src/editor/components/fields.tsx +387 -0
- package/src/editor/components/frontmatter-fields.tsx +469 -0
- package/src/editor/components/highlight-overlay.ts +229 -0
- package/src/editor/components/image-overlay.tsx +230 -0
- package/src/editor/components/markdown-editor-overlay.tsx +505 -0
- package/src/editor/components/markdown-inline-editor.tsx +780 -0
- package/src/editor/components/media-library.tsx +297 -0
- package/src/editor/components/outline.tsx +402 -0
- package/src/editor/components/redirect-countdown.tsx +45 -0
- package/src/editor/components/seo-editor.tsx +498 -0
- package/src/editor/components/text-style-toolbar.tsx +362 -0
- package/src/editor/components/toast/toast-container.tsx +15 -0
- package/src/editor/components/toast/toast.tsx +49 -0
- package/src/editor/components/toast/types.ts +7 -0
- package/src/editor/components/toolbar.tsx +366 -0
- package/src/editor/config.ts +12 -0
- package/src/editor/constants.ts +106 -0
- package/src/editor/context.tsx +38 -0
- package/src/editor/dom.ts +357 -0
- package/src/editor/editor.ts +1510 -0
- package/src/editor/env.d.ts +4 -0
- package/src/editor/history.ts +355 -0
- package/src/editor/hooks/index.ts +19 -0
- package/src/editor/hooks/useAIHandlers.ts +345 -0
- package/src/editor/hooks/useBlockEditorHandlers.ts +206 -0
- package/src/editor/hooks/useElementDetection.ts +284 -0
- package/src/editor/hooks/useImageHoverDetection.ts +102 -0
- package/src/editor/hooks/useTextSelection.ts +187 -0
- package/src/editor/hooks/useTooltipState.ts +126 -0
- package/src/editor/hooks/utils.ts +101 -0
- package/src/editor/index.tsx +481 -0
- package/src/editor/lib/cn.ts +4 -0
- package/src/editor/manifest.ts +25 -0
- package/src/editor/markdown-api.ts +209 -0
- package/src/editor/signals.ts +1351 -0
- package/src/editor/storage.ts +266 -0
- package/src/editor/styles.css +465 -0
- package/src/editor/text-styling.ts +773 -0
- package/src/editor/themes.ts +210 -0
- package/src/editor/types.ts +591 -0
- package/src/error-collector.ts +106 -0
- package/src/handlers/component-ops.ts +463 -0
- package/src/handlers/markdown-ops.ts +202 -0
- package/src/handlers/request-utils.ts +151 -0
- package/src/handlers/source-writer.ts +649 -0
- package/src/html-processor.ts +1108 -0
- package/src/index.ts +284 -0
- package/src/manifest-writer.ts +371 -0
- package/src/media/contember.ts +84 -0
- package/src/media/local.ts +114 -0
- package/src/media/s3.ts +133 -0
- package/src/media/types.ts +33 -0
- package/src/preview-generator.ts +293 -0
- package/src/seo-processor.ts +567 -0
- package/src/source-finder/ast-extractors.ts +185 -0
- package/src/source-finder/ast-parser.ts +150 -0
- package/src/source-finder/cache.ts +76 -0
- package/src/source-finder/collection-finder.ts +335 -0
- package/src/source-finder/cross-file-tracker.ts +741 -0
- package/src/source-finder/element-finder.ts +387 -0
- package/src/source-finder/image-finder.ts +283 -0
- package/src/source-finder/index.ts +37 -0
- package/src/source-finder/search-index.ts +525 -0
- package/src/source-finder/snippet-utils.ts +668 -0
- package/src/source-finder/source-lookup.ts +200 -0
- package/src/source-finder/types.ts +210 -0
- package/src/source-finder/variable-extraction.ts +406 -0
- package/src/tailwind-colors.ts +874 -0
- package/src/tsconfig.json +25 -0
- package/src/types.ts +406 -0
- package/src/utils.ts +186 -0
- package/src/vite-plugin.ts +42 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Node as AstroNode } from '@astrojs/compiler/types';
|
|
2
|
+
import type { ComponentPropMatch, ExpressionPropMatch, FindElementResult, ImportInfo, SpreadPropMatch, VariableDefinition } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Get text content from an AST node recursively.
|
|
5
|
+
* Treats <br> elements as whitespace to match rendered HTML behavior.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getTextContent(node: AstroNode): string;
|
|
8
|
+
/**
|
|
9
|
+
* Check for expression children and extract variable names
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasExpressionChild(node: AstroNode): {
|
|
12
|
+
found: boolean;
|
|
13
|
+
varNames: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Walk the Astro AST to find elements matching a tag with specific text content.
|
|
17
|
+
* Returns the best match (local variables or static content) AND all prop/import candidates
|
|
18
|
+
* that need cross-file verification for multiple same-tag elements.
|
|
19
|
+
* @param propAliases - Map of local variable names to prop names from Astro.props (for cross-file tracking)
|
|
20
|
+
* @param imports - Import information from frontmatter (for cross-file tracking)
|
|
21
|
+
*/
|
|
22
|
+
export declare function findElementWithText(ast: AstroNode, tag: string, searchText: string, variableDefinitions: VariableDefinition[], propAliases?: Map<string, string>, imports?: ImportInfo[]): FindElementResult;
|
|
23
|
+
/**
|
|
24
|
+
* Walk the Astro AST to find component props with specific text value
|
|
25
|
+
*/
|
|
26
|
+
export declare function findComponentProp(ast: AstroNode, searchText: string): ComponentPropMatch | null;
|
|
27
|
+
/**
|
|
28
|
+
* Walk the Astro AST to find component usages with expression props.
|
|
29
|
+
* Looks for patterns like: <Nav items={navItems} />
|
|
30
|
+
* @param ast - The Astro AST
|
|
31
|
+
* @param componentName - The component name to search for (e.g., 'Nav')
|
|
32
|
+
* @param propName - The prop name to find (e.g., 'items')
|
|
33
|
+
*/
|
|
34
|
+
export declare function findExpressionProp(ast: AstroNode, componentName: string, propName: string): ExpressionPropMatch | null;
|
|
35
|
+
/**
|
|
36
|
+
* Walk the Astro AST to find component usages with spread props.
|
|
37
|
+
* Looks for patterns like: <Card {...cardProps} />
|
|
38
|
+
* @param ast - The Astro AST
|
|
39
|
+
* @param componentName - The component name to search for (e.g., 'Card')
|
|
40
|
+
*/
|
|
41
|
+
export declare function findSpreadProp(ast: AstroNode, componentName: string): SpreadPropMatch | null;
|
|
42
|
+
//# sourceMappingURL=element-finder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-finder.d.ts","sourceRoot":"","sources":["../../../src/source-finder/element-finder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,IAAI,IAAI,SAAS,EAAY,MAAM,yBAAyB,CAAA;AAItG,OAAO,KAAK,EACX,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,eAAe,EAEf,kBAAkB,EAClB,MAAM,SAAS,CAAA;AAMhB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAgBtD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAsB1F;AAMD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,WAAW,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,EAC5C,OAAO,GAAE,UAAU,EAAO,GACxB,iBAAiB,CAoKnB;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,MAAM,GAChB,kBAAkB,GAAG,IAAI,CAiC3B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,SAAS,EACd,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACd,mBAAmB,GAAG,IAAI,CAoC5B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,SAAS,EACd,aAAa,EAAE,MAAM,GACnB,eAAe,GAAG,IAAI,CAgCxB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Node as AstroNode } from '@astrojs/compiler/types';
|
|
2
|
+
import type { ImageMatch, SourceLocation } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Walk the Astro AST to find img elements or Image component usages with specific src
|
|
5
|
+
*/
|
|
6
|
+
export declare function findImageElement(ast: AstroNode, imageSrc: string, lines: string[]): ImageMatch | null;
|
|
7
|
+
/**
|
|
8
|
+
* Walk the Astro AST to find img elements near a given source line.
|
|
9
|
+
* Used as a fallback when the src value can't be matched (expression attributes).
|
|
10
|
+
* Returns the img element closest to the expected line.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findImageElementNearLine(ast: AstroNode, expectedLine: number, lines: string[]): ImageMatch | null;
|
|
13
|
+
/**
|
|
14
|
+
* Find source file and line number for an image by its src attribute.
|
|
15
|
+
* Also checks srcset URLs as fallback when src doesn't match (e.g., when src
|
|
16
|
+
* is a local upload path but srcset contains CDN-transformed original URLs).
|
|
17
|
+
* Uses pre-built search index for fast lookups.
|
|
18
|
+
*/
|
|
19
|
+
export declare function findImageSourceLocation(imageSrc: string, imageSrcSet?: string): Promise<SourceLocation | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Recursively search directory for image with matching src
|
|
22
|
+
*/
|
|
23
|
+
export declare function searchDirectoryForImage(dir: string, imageSrc: string): Promise<SourceLocation | undefined>;
|
|
24
|
+
//# sourceMappingURL=image-finder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-finder.d.ts","sourceRoot":"","sources":["../../../src/source-finder/image-finder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,IAAI,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAS5F,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAMzD;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EAAE,GACb,UAAU,GAAG,IAAI,CAgDnB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,SAAS,EACd,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EAAE,GACb,UAAU,GAAG,IAAI,CAwCnB;AAiBD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC5C,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA2CrC;AAMD;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAoBrC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { CollectionInfo, MarkdownContent, SourceLocation, VariableReference } from './types';
|
|
2
|
+
export { clearSourceFinderCache } from './cache';
|
|
3
|
+
export { initializeSearchIndex } from './search-index';
|
|
4
|
+
export { findSourceLocation } from './source-lookup';
|
|
5
|
+
export { findAttributeSourceLocation } from './cross-file-tracker';
|
|
6
|
+
export { findImageSourceLocation } from './image-finder';
|
|
7
|
+
export { findCollectionSource, findMarkdownSourceLocation, parseMarkdownContent } from './collection-finder';
|
|
8
|
+
export { enhanceManifestWithSourceSnippets, extractCompleteTagSnippet, extractInnerHtmlFromSnippet, extractOpeningTagWithLine, extractSourceSnippet, updateAttributeSources, updateColorClassSources, } from './snippet-utils';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/source-finder/index.ts"],"names":[],"mappings":"AAOA,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAGlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAGxD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAG5G,OAAO,EACN,iCAAiC,EACjC,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,GACvB,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CachedParsedFile, SourceLocation } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Collect all .astro files in a directory recursively
|
|
4
|
+
*/
|
|
5
|
+
export declare function collectAstroFiles(dir: string): Promise<string[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Initialize search index by pre-scanning all source files.
|
|
8
|
+
* This is much faster than searching per-entry.
|
|
9
|
+
*/
|
|
10
|
+
export declare function initializeSearchIndex(): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Index all searchable text content from a parsed file
|
|
13
|
+
*/
|
|
14
|
+
export declare function indexFileContent(cached: CachedParsedFile, relFile: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Index all images from a parsed file
|
|
17
|
+
*/
|
|
18
|
+
export declare function indexFileImages(cached: CachedParsedFile, relFile: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Fast text lookup using pre-built index
|
|
21
|
+
*/
|
|
22
|
+
export declare function findInTextIndex(textContent: string, tag: string): SourceLocation | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Fast image lookup using pre-built index
|
|
25
|
+
*/
|
|
26
|
+
export declare function findInImageIndex(imageSrc: string): SourceLocation | undefined;
|
|
27
|
+
//# sourceMappingURL=search-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-index.d.ts","sourceRoot":"","sources":["../../../src/source-finder/search-index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAM/D;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyBtE;AAMD;;;GAGG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwC3D;AAmJD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAuFhF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAqE/E;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAsD5F;AAaD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAgC7E"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Attribute, ManifestEntry } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize text for comparison (handles escaping and entities)
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeText(text: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Strip markdown syntax for text comparison
|
|
8
|
+
*/
|
|
9
|
+
export declare function stripMarkdownSyntax(text: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Extract complete tag snippet including content and indentation.
|
|
12
|
+
* Exported for use in html-processor to populate sourceSnippet.
|
|
13
|
+
*
|
|
14
|
+
* When startLine points to a line inside the element (e.g., the text content line),
|
|
15
|
+
* this function searches backwards to find the opening tag first.
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractCompleteTagSnippet(lines: string[], startLine: number, tag: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Extract just the opening tag from source lines (e.g., `<a href="/foo" class="btn">`)
|
|
20
|
+
* Handles multi-line opening tags.
|
|
21
|
+
*
|
|
22
|
+
* @param lines - Source file lines
|
|
23
|
+
* @param startLine - 0-indexed line number where element starts
|
|
24
|
+
* @param tag - The tag name
|
|
25
|
+
* @returns The opening tag string, or undefined if can't extract
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractOpeningTagSnippet(lines: string[], startLine: number, tag: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Extract the opening tag from source lines along with its starting line number.
|
|
30
|
+
* Handles multi-line opening tags.
|
|
31
|
+
*
|
|
32
|
+
* @param lines - Source file lines
|
|
33
|
+
* @param startLine - 0-indexed line number where element starts
|
|
34
|
+
* @param tag - The tag name
|
|
35
|
+
* @returns Object with the opening tag snippet and 0-indexed startLine, or undefined if can't extract
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractOpeningTagWithLine(lines: string[], startLine: number, tag: string): {
|
|
38
|
+
snippet: string;
|
|
39
|
+
startLine: number;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Update attribute source information from an opening tag snippet.
|
|
43
|
+
* Determines whether each attribute is static (quoted value) or dynamic (expression).
|
|
44
|
+
* - For static attributes: sourcePath/Line/Snippet point to the template file
|
|
45
|
+
* - For dynamic attributes: sourcePath/Line/Snippet point to where the VALUE is defined
|
|
46
|
+
*
|
|
47
|
+
* @param openingTagSnippet - The opening tag string (e.g., `<a href={url} class="btn">`)
|
|
48
|
+
* @param attributes - Existing attributes with resolved values (isStatic will be updated)
|
|
49
|
+
* @param sourceFilePath - The source file path (used for static attrs and as starting point for dynamic attr tracing)
|
|
50
|
+
* @param openingTagStartLine - 1-indexed line number where the opening tag starts in the source file
|
|
51
|
+
* @returns Updated attributes with sourcePath, sourceLine, and sourceSnippet
|
|
52
|
+
*/
|
|
53
|
+
export declare function updateAttributeSources(openingTagSnippet: string, attributes: Record<string, Attribute>, sourceFilePath?: string, openingTagStartLine?: number, sourceLines?: string[]): Promise<Record<string, Attribute>>;
|
|
54
|
+
/**
|
|
55
|
+
* Update colorClasses entries with source info from the class attribute in the opening tag.
|
|
56
|
+
* All color classes come from the same `class="..."` attribute, so they share the same source location.
|
|
57
|
+
*/
|
|
58
|
+
export declare function updateColorClassSources(openingTagSnippet: string, colorClasses: Record<string, Attribute>, sourceFilePath?: string, openingTagStartLine?: number, sourceLines?: string[]): Record<string, Attribute>;
|
|
59
|
+
/**
|
|
60
|
+
* Extract innerHTML from a complete tag snippet.
|
|
61
|
+
* Given `<p class="foo">content here</p>`, returns `content here`.
|
|
62
|
+
*
|
|
63
|
+
* @param snippet - The complete tag snippet from source
|
|
64
|
+
* @param tag - The tag name (e.g., 'p', 'h1')
|
|
65
|
+
* @returns The innerHTML portion, or undefined if can't extract
|
|
66
|
+
*/
|
|
67
|
+
export declare function extractInnerHtmlFromSnippet(snippet: string, tag: string): string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Extract the full <img> tag snippet from source lines
|
|
70
|
+
*/
|
|
71
|
+
export declare function extractImageSnippet(lines: string[], startLine: number): string;
|
|
72
|
+
/**
|
|
73
|
+
* Read source file and extract the complete element at the specified line.
|
|
74
|
+
*
|
|
75
|
+
* @param sourceFile - Path to source file (relative to cwd)
|
|
76
|
+
* @param sourceLine - 1-indexed line number
|
|
77
|
+
* @param tag - The tag name
|
|
78
|
+
* @returns The complete element from source, or undefined if can't extract
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractSourceSnippet(sourceFile: string, sourceLine: number, tag: string): Promise<string | undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* Enhance manifest entries with actual source snippets from source files.
|
|
83
|
+
* This reads the source files and extracts the innerHTML at the specified locations.
|
|
84
|
+
* For images, it finds the correct line containing the src attribute.
|
|
85
|
+
*
|
|
86
|
+
* @param entries - Manifest entries to enhance
|
|
87
|
+
* @returns Enhanced entries with sourceSnippet and openingTagSnippet populated
|
|
88
|
+
*/
|
|
89
|
+
export declare function enhanceManifestWithSourceSnippets(entries: Record<string, ManifestEntry>): Promise<Record<string, ManifestEntry>>;
|
|
90
|
+
//# sourceMappingURL=snippet-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet-utils.d.ts","sourceRoot":"","sources":["../../../src/source-finder/snippet-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAWxD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAclD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYxD;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CA0DjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG5G;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACT;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2CpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAC3C,iBAAiB,EAAE,MAAM,EACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACrC,cAAc,CAAC,EAAE,MAAM,EACvB,mBAAmB,CAAC,EAAE,MAAM,EAC5B,WAAW,CAAC,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CA8EpC;AAoBD;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,iBAAiB,EAAE,MAAM,EACzB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACvC,cAAc,CAAC,EAAE,MAAM,EACvB,mBAAmB,CAAC,EAAE,MAAM,EAC5B,WAAW,CAAC,EAAE,MAAM,EAAE,GACpB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAe3B;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAsB5F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAuB9E;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAc7B;AAMD;;;;;;;GAOG;AACH,wBAAsB,iCAAiC,CACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACpC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAoMxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SourceLocation } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Find source file and line number for text content.
|
|
4
|
+
* Uses pre-built search index for fast lookups.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findSourceLocation(textContent: string, tag: string): Promise<SourceLocation | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Recursively search directory for matching content
|
|
9
|
+
*/
|
|
10
|
+
export declare function searchDirectory(dir: string, textContent: string, tag: string): Promise<SourceLocation | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Search a single Astro file for matching content using AST parsing.
|
|
13
|
+
* Uses caching for better performance.
|
|
14
|
+
*/
|
|
15
|
+
export declare function searchAstroFile(filePath: string, textContent: string, tag: string): Promise<SourceLocation | undefined>;
|
|
16
|
+
//# sourceMappingURL=source-lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-lookup.d.ts","sourceRoot":"","sources":["../../../src/source-finder/source-lookup.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAM7C;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA2CrC;AAMD;;GAEG;AACH,wBAAsB,eAAe,CACpC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAoBrC;AAMD;;;GAGG;AACH,wBAAsB,eAAe,CACpC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAsFrC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { Node as AstroNode } from '@astrojs/compiler/types';
|
|
2
|
+
/** Import information from frontmatter */
|
|
3
|
+
export interface ImportInfo {
|
|
4
|
+
/** Local name of the imported binding */
|
|
5
|
+
localName: string;
|
|
6
|
+
/** Original exported name (or 'default' for default imports) */
|
|
7
|
+
importedName: string;
|
|
8
|
+
/** The import source path (e.g., './config', '../data/nav') */
|
|
9
|
+
source: string;
|
|
10
|
+
}
|
|
11
|
+
export interface VariableDefinition {
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
line: number;
|
|
15
|
+
/** For object properties, the parent variable name */
|
|
16
|
+
parentName?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CachedParsedFile {
|
|
19
|
+
content: string;
|
|
20
|
+
lines: string[];
|
|
21
|
+
ast: AstroNode;
|
|
22
|
+
frontmatterContent: string | null;
|
|
23
|
+
frontmatterStartLine: number;
|
|
24
|
+
variableDefinitions: VariableDefinition[];
|
|
25
|
+
/** Mapping of local variable names to prop names from Astro.props destructuring
|
|
26
|
+
* e.g., { navItems: 'items' } for `const { items: navItems } = Astro.props` */
|
|
27
|
+
propAliases: Map<string, string>;
|
|
28
|
+
/** Import information from frontmatter */
|
|
29
|
+
imports: ImportInfo[];
|
|
30
|
+
}
|
|
31
|
+
/** Pre-built search index for fast lookups */
|
|
32
|
+
export interface SearchIndexEntry {
|
|
33
|
+
file: string;
|
|
34
|
+
line: number;
|
|
35
|
+
snippet: string;
|
|
36
|
+
/** Just the opening tag with attributes (for attribute/class updates) */
|
|
37
|
+
openingTagSnippet?: string;
|
|
38
|
+
type: 'static' | 'variable' | 'prop' | 'computed';
|
|
39
|
+
variableName?: string;
|
|
40
|
+
definitionLine?: number;
|
|
41
|
+
normalizedText: string;
|
|
42
|
+
tag: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ImageIndexEntry {
|
|
45
|
+
file: string;
|
|
46
|
+
line: number;
|
|
47
|
+
snippet: string;
|
|
48
|
+
src: string;
|
|
49
|
+
}
|
|
50
|
+
export interface SourceLocation {
|
|
51
|
+
file: string;
|
|
52
|
+
line: number;
|
|
53
|
+
snippet?: string;
|
|
54
|
+
/** Just the opening tag with attributes (for attribute/class updates) */
|
|
55
|
+
openingTagSnippet?: string;
|
|
56
|
+
type?: 'static' | 'variable' | 'prop' | 'computed' | 'collection';
|
|
57
|
+
variableName?: string;
|
|
58
|
+
definitionLine?: number;
|
|
59
|
+
/** Collection name for collection entries */
|
|
60
|
+
collectionName?: string;
|
|
61
|
+
/** Entry slug for collection entries */
|
|
62
|
+
collectionSlug?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface VariableReference {
|
|
65
|
+
name: string;
|
|
66
|
+
pattern: string;
|
|
67
|
+
definitionLine: number;
|
|
68
|
+
}
|
|
69
|
+
export interface CollectionInfo {
|
|
70
|
+
name: string;
|
|
71
|
+
slug: string;
|
|
72
|
+
file: string;
|
|
73
|
+
}
|
|
74
|
+
export interface MarkdownContent {
|
|
75
|
+
/** Frontmatter fields as key-value pairs with line numbers */
|
|
76
|
+
frontmatter: Record<string, {
|
|
77
|
+
value: string;
|
|
78
|
+
line: number;
|
|
79
|
+
}>;
|
|
80
|
+
/** The full markdown body content */
|
|
81
|
+
body: string;
|
|
82
|
+
/** Line number where body starts */
|
|
83
|
+
bodyStartLine: number;
|
|
84
|
+
/** File path relative to cwd */
|
|
85
|
+
file: string;
|
|
86
|
+
/** Collection name */
|
|
87
|
+
collectionName: string;
|
|
88
|
+
/** Collection slug */
|
|
89
|
+
collectionSlug: string;
|
|
90
|
+
}
|
|
91
|
+
export interface ParsedAstroFile {
|
|
92
|
+
ast: AstroNode;
|
|
93
|
+
frontmatterContent: string | null;
|
|
94
|
+
frontmatterStartLine: number;
|
|
95
|
+
}
|
|
96
|
+
/** Minimal Babel AST node type for our usage */
|
|
97
|
+
export interface BabelNode {
|
|
98
|
+
type: string;
|
|
99
|
+
[key: string]: unknown;
|
|
100
|
+
}
|
|
101
|
+
/** Minimal Babel File type */
|
|
102
|
+
export interface BabelFile {
|
|
103
|
+
type: 'File';
|
|
104
|
+
program: BabelNode & {
|
|
105
|
+
body: BabelNode[];
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export interface TemplateMatch {
|
|
109
|
+
line: number;
|
|
110
|
+
type: 'static' | 'variable' | 'computed';
|
|
111
|
+
variableName?: string;
|
|
112
|
+
/** For variables, the definition line in frontmatter */
|
|
113
|
+
definitionLine?: number;
|
|
114
|
+
/** If true, the expression uses a variable from props that needs cross-file tracking */
|
|
115
|
+
usesProp?: boolean;
|
|
116
|
+
/** The prop name if usesProp is true */
|
|
117
|
+
propName?: string;
|
|
118
|
+
/** The full expression path if usesProp is true (e.g., 'items[0]') */
|
|
119
|
+
expressionPath?: string;
|
|
120
|
+
/** If true, the expression uses a variable from an import */
|
|
121
|
+
usesImport?: boolean;
|
|
122
|
+
/** The import info if usesImport is true */
|
|
123
|
+
importInfo?: ImportInfo;
|
|
124
|
+
}
|
|
125
|
+
/** Result type for findElementWithText - returns best match and all prop/import candidates */
|
|
126
|
+
export interface FindElementResult {
|
|
127
|
+
/** The best match found (local variables or static content) */
|
|
128
|
+
bestMatch: TemplateMatch | null;
|
|
129
|
+
/** All prop-based matches for the tag (need cross-file verification) */
|
|
130
|
+
propCandidates: TemplateMatch[];
|
|
131
|
+
/** All import-based matches for the tag (need cross-file verification) */
|
|
132
|
+
importCandidates: TemplateMatch[];
|
|
133
|
+
}
|
|
134
|
+
export interface ComponentPropMatch {
|
|
135
|
+
line: number;
|
|
136
|
+
propName: string;
|
|
137
|
+
propValue: string;
|
|
138
|
+
}
|
|
139
|
+
export interface ExpressionPropMatch {
|
|
140
|
+
componentName: string;
|
|
141
|
+
propName: string;
|
|
142
|
+
/** The expression text (e.g., 'navItems' from items={navItems}) */
|
|
143
|
+
expressionText: string;
|
|
144
|
+
line: number;
|
|
145
|
+
}
|
|
146
|
+
export interface SpreadPropMatch {
|
|
147
|
+
componentName: string;
|
|
148
|
+
/** The variable name being spread (e.g., 'cardProps' from {...cardProps}) */
|
|
149
|
+
spreadVarName: string;
|
|
150
|
+
line: number;
|
|
151
|
+
}
|
|
152
|
+
export interface ImageMatch {
|
|
153
|
+
line: number;
|
|
154
|
+
src: string;
|
|
155
|
+
snippet: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Transforms Babel line numbers to actual file line numbers.
|
|
159
|
+
* Babel parses content starting at line 1, but frontmatter content
|
|
160
|
+
* may start at a different line in the actual file.
|
|
161
|
+
*/
|
|
162
|
+
export type LineTransformer = (babelLine: number) => number;
|
|
163
|
+
/** Identity transformer - use for standalone files where Babel line = file line */
|
|
164
|
+
export declare const identityLine: LineTransformer;
|
|
165
|
+
/** Create a transformer for frontmatter content that starts at a specific line */
|
|
166
|
+
export declare const createFrontmatterLineTransformer: (startLine: number) => LineTransformer;
|
|
167
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/source-finder/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAMhE,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IAC1B,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAA;IACpB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAMD,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,GAAG,EAAE,SAAS,CAAA;IACd,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,oBAAoB,EAAE,MAAM,CAAA;IAC5B,mBAAmB,EAAE,kBAAkB,EAAE,CAAA;IACzC;oFACgF;IAChF,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,0CAA0C;IAC1C,OAAO,EAAE,UAAU,EAAE,CAAA;CACrB;AAMD,8CAA8C;AAC9C,MAAM,WAAW,gBAAgB;IAChC,IA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W,iBAAiB;IACjC,+DAA+D;IAC/D,SAAS,EAAE,aAAa,GAAG,IAAI,CAAA;IAC/B,wEAAwE;IACxE,cAAc,EAAE,aAAa,EAAE,CAAA;IAC/B,0EAA0E;IAC1E,gBAAgB,EAAE,aAAa,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,mEAAmE;IACnE,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,eAAe;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;CACf;AAMD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;AAE3D,mFAAmF;AACnF,eAAO,MAAM,YAAY,EAAE,eAAgC,CAAA;AAE3D,kFAAkF;AAClF,eAAO,MAAM,gCAAgC,GAAI,WAAW,MAAM,KAAG,eAA6D,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { BabelFile, ImportInfo, VariableDefinition } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Extract variable definitions from Babel AST
|
|
4
|
+
* Finds const/let/var declarations with string literal values
|
|
5
|
+
*
|
|
6
|
+
* Note: Babel parses the frontmatter content (without --- delimiters) starting at line 1.
|
|
7
|
+
* frontmatterStartLine is the actual file line where the content begins (after first ---).
|
|
8
|
+
* So we convert: file_line = (babel_line - 1) + frontmatterStartLine
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractVariableDefinitions(ast: BabelFile, frontmatterStartLine: number): VariableDefinition[];
|
|
11
|
+
/**
|
|
12
|
+
* Extract prop aliases from Astro.props destructuring patterns.
|
|
13
|
+
* Returns a Map of local variable name -> prop name.
|
|
14
|
+
* Examples:
|
|
15
|
+
* const { title } = Astro.props -> Map { 'title' => 'title' }
|
|
16
|
+
* const { items: navItems } = Astro.props -> Map { 'navItems' => 'items' }
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractPropAliases(ast: BabelFile): Map<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* Extract import information from Babel AST.
|
|
21
|
+
* Handles:
|
|
22
|
+
* import { foo } from './file' -> { localName: 'foo', importedName: 'foo', source: './file' }
|
|
23
|
+
* import { foo as bar } from './file' -> { localName: 'bar', importedName: 'foo', source: './file' }
|
|
24
|
+
* import foo from './file' -> { localName: 'foo', importedName: 'default', source: './file' }
|
|
25
|
+
* import * as foo from './file' -> { localName: 'foo', importedName: '*', source: './file' }
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractImports(ast: BabelFile): ImportInfo[];
|
|
28
|
+
/**
|
|
29
|
+
* Resolve an import source path to an absolute file path.
|
|
30
|
+
* Handles relative paths and tries common extensions.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveImportPath(source: string, fromFile: string): Promise<string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Parse a TypeScript/JavaScript file and extract exported variable definitions.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getExportedDefinitions(filePath: string): Promise<VariableDefinition[]>;
|
|
37
|
+
//# sourceMappingURL=variable-extraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable-extraction.d.ts","sourceRoot":"","sources":["../../../src/source-finder/variable-extraction.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAa,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAOnF;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAwG7G;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAgFtE;AAMD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,UAAU,EAAE,CA+C3D;AAMD;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiChG;AAMD;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA2E5F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Attribute, AvailableColors, AvailableTextStyles } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Default Tailwind CSS v4 color names.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_TAILWIND_COLORS: readonly ["slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
|
|
6
|
+
/**
|
|
7
|
+
* Standard Tailwind color shades.
|
|
8
|
+
*/
|
|
9
|
+
export declare const STANDARD_SHADES: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
10
|
+
/**
|
|
11
|
+
* Special color values that don't have shades.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SPECIAL_COLORS: readonly ["transparent", "current", "inherit", "white", "black"];
|
|
14
|
+
/**
|
|
15
|
+
* Parse Tailwind v4 CSS config to extract available colors with their values.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseTailwindConfig(projectRoot?: string): Promise<AvailableColors>;
|
|
18
|
+
/**
|
|
19
|
+
* Parse Tailwind v4 CSS config to extract available text styles.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseTextStyles(projectRoot?: string): Promise<AvailableTextStyles>;
|
|
22
|
+
/**
|
|
23
|
+
* Extract color classes from an element's class attribute.
|
|
24
|
+
* Returns a flat Record<string, Attribute> with keys like bg, text, gradientFrom, bgOpacity, etc.
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractColorClasses(classAttr: string | null | undefined): Record<string, Attribute> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a class is a color class (including gradient colors).
|
|
29
|
+
*/
|
|
30
|
+
export declare function isColorClass(className: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Generate a new class string with a color class replaced.
|
|
33
|
+
*/
|
|
34
|
+
export declare function replaceColorClass(currentClasses: string, oldColorClass: string, newColorClass: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get the color type from a color class.
|
|
37
|
+
* Returns the flat key name (e.g., 'bg', 'gradientFrom', 'bgOpacity').
|
|
38
|
+
*/
|
|
39
|
+
export declare function getColorType(colorClass: string): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Parse a color class into its components.
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseColorClass(colorClass: string): {
|
|
44
|
+
prefix: string;
|
|
45
|
+
colorName: string;
|
|
46
|
+
shade?: string;
|
|
47
|
+
isHover: boolean;
|
|
48
|
+
isArbitrary?: boolean;
|
|
49
|
+
} | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Build a color class from components.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildColorClass(prefix: string, colorName: string, shade?: string): string;
|
|
54
|
+
//# sourceMappingURL=tailwind-colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind-colors.d.ts","sourceRoot":"","sources":["../../src/tailwind-colors.ts"],"names":[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