@wix/zero-config-implementation 1.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.
Files changed (78) hide show
  1. package/README.md +72 -0
  2. package/dist/component-loader.d.ts +42 -0
  3. package/dist/component-renderer.d.ts +31 -0
  4. package/dist/converters/data-item-builder.d.ts +15 -0
  5. package/dist/converters/index.d.ts +1 -0
  6. package/dist/converters/to-editor-component.d.ts +3 -0
  7. package/dist/converters/utils.d.ts +16 -0
  8. package/dist/errors.d.ts +230 -0
  9. package/dist/index.d.ts +42 -0
  10. package/dist/index.js +51978 -0
  11. package/dist/information-extractors/css/index.d.ts +3 -0
  12. package/dist/information-extractors/css/parse.d.ts +7 -0
  13. package/dist/information-extractors/css/selector-matcher.d.ts +3 -0
  14. package/dist/information-extractors/css/types.d.ts +49 -0
  15. package/dist/information-extractors/react/extractors/core/index.d.ts +6 -0
  16. package/dist/information-extractors/react/extractors/core/runner.d.ts +19 -0
  17. package/dist/information-extractors/react/extractors/core/store.d.ts +17 -0
  18. package/dist/information-extractors/react/extractors/core/tree-builder.d.ts +15 -0
  19. package/dist/information-extractors/react/extractors/core/types.d.ts +40 -0
  20. package/dist/information-extractors/react/extractors/css-properties.d.ts +20 -0
  21. package/dist/information-extractors/react/extractors/index.d.ts +11 -0
  22. package/dist/information-extractors/react/extractors/prop-tracker.d.ts +24 -0
  23. package/dist/information-extractors/react/index.d.ts +9 -0
  24. package/dist/information-extractors/react/types.d.ts +51 -0
  25. package/dist/information-extractors/react/utils/mock-generator.d.ts +9 -0
  26. package/dist/information-extractors/react/utils/prop-spy.d.ts +10 -0
  27. package/dist/information-extractors/ts/components.d.ts +9 -0
  28. package/dist/information-extractors/ts/css-imports.d.ts +2 -0
  29. package/dist/information-extractors/ts/index.d.ts +3 -0
  30. package/dist/information-extractors/ts/types.d.ts +47 -0
  31. package/dist/information-extractors/ts/utils/semantic-type-resolver.d.ts +3 -0
  32. package/dist/jsx-runtime-interceptor.d.ts +42 -0
  33. package/dist/jsx-runtime-interceptor.js +63 -0
  34. package/dist/jsx-runtime-loader.d.ts +23 -0
  35. package/dist/jsx-runtime-loader.js +7 -0
  36. package/dist/manifest-pipeline.d.ts +33 -0
  37. package/dist/schema.d.ts +167 -0
  38. package/dist/ts-compiler.d.ts +13 -0
  39. package/package.json +81 -0
  40. package/src/component-loader.test.ts +277 -0
  41. package/src/component-loader.ts +256 -0
  42. package/src/component-renderer.ts +192 -0
  43. package/src/converters/data-item-builder.ts +354 -0
  44. package/src/converters/index.ts +1 -0
  45. package/src/converters/to-editor-component.ts +167 -0
  46. package/src/converters/utils.ts +21 -0
  47. package/src/errors.ts +103 -0
  48. package/src/index.ts +223 -0
  49. package/src/information-extractors/css/README.md +3 -0
  50. package/src/information-extractors/css/index.ts +3 -0
  51. package/src/information-extractors/css/parse.ts +450 -0
  52. package/src/information-extractors/css/selector-matcher.ts +88 -0
  53. package/src/information-extractors/css/types.ts +56 -0
  54. package/src/information-extractors/react/extractors/core/index.ts +6 -0
  55. package/src/information-extractors/react/extractors/core/runner.ts +89 -0
  56. package/src/information-extractors/react/extractors/core/store.ts +36 -0
  57. package/src/information-extractors/react/extractors/core/tree-builder.ts +273 -0
  58. package/src/information-extractors/react/extractors/core/types.ts +48 -0
  59. package/src/information-extractors/react/extractors/css-properties.ts +214 -0
  60. package/src/information-extractors/react/extractors/index.ts +27 -0
  61. package/src/information-extractors/react/extractors/prop-tracker.ts +132 -0
  62. package/src/information-extractors/react/index.ts +53 -0
  63. package/src/information-extractors/react/types.ts +70 -0
  64. package/src/information-extractors/react/utils/mock-generator.ts +331 -0
  65. package/src/information-extractors/react/utils/prop-spy.ts +168 -0
  66. package/src/information-extractors/ts/components.ts +300 -0
  67. package/src/information-extractors/ts/css-imports.ts +26 -0
  68. package/src/information-extractors/ts/index.ts +3 -0
  69. package/src/information-extractors/ts/types.ts +56 -0
  70. package/src/information-extractors/ts/utils/semantic-type-resolver.ts +377 -0
  71. package/src/jsx-runtime-interceptor.ts +146 -0
  72. package/src/jsx-runtime-loader.ts +38 -0
  73. package/src/manifest-pipeline.ts +362 -0
  74. package/src/schema.ts +174 -0
  75. package/src/ts-compiler.ts +41 -0
  76. package/tsconfig.json +17 -0
  77. package/typedoc.json +18 -0
  78. package/vite.config.ts +45 -0
@@ -0,0 +1,3 @@
1
+ export { parseCss } from './parse';
2
+ export { matchCssSelectors } from './selector-matcher';
3
+ export type { CSSParserAPI } from './types';
@@ -0,0 +1,7 @@
1
+ import { CSSParserAPI } from './types';
2
+ /**
3
+ * Factory function that parses CSS and returns an API to query the parsed result
4
+ * @param cssString - The CSS file content as a string
5
+ * @returns API object with methods to query the parsed CSS
6
+ */
7
+ export declare function parseCss(cssString: string): CSSParserAPI;
@@ -0,0 +1,3 @@
1
+ import { ExtractedCssInfo } from '../../index';
2
+ import { ExtractedElement } from '../react/extractors/core/tree-builder';
3
+ export declare function matchCssSelectors(html: string, elements: ExtractedElement[], cssInfos: ExtractedCssInfo[]): ExtractedElement[];
@@ -0,0 +1,49 @@
1
+ export interface CSSProperty {
2
+ name: string;
3
+ value: string;
4
+ }
5
+ export interface CssSelectorMatch {
6
+ selector: string;
7
+ properties: CSSProperty[];
8
+ }
9
+ export interface MatchedCssData {
10
+ matches: CssSelectorMatch[];
11
+ customProperties: Record<string, string>;
12
+ }
13
+ /**
14
+ * API returned by parseCss function for querying parsed CSS
15
+ */
16
+ export interface CSSParserAPI {
17
+ /**
18
+ * Gets CSS properties for a specific selector
19
+ * @param selector - The selector to extract properties for
20
+ * @returns Array of CSS properties for the specified selector
21
+ */
22
+ getPropertiesForSelector: (selector: string) => CSSProperty[];
23
+ /**
24
+ * Gets all selectors and their properties from the CSS
25
+ * @returns Map from selector to its CSS properties
26
+ */
27
+ getAllProperties: () => Map<string, CSSProperty[]>;
28
+ /**
29
+ * Gets all CSS property names that use a specific CSS variable
30
+ * @param varName - The CSS variable name (with or without --)
31
+ * @returns Array of CSS property names that use this variable
32
+ */
33
+ getVarUsages: (varName: string) => string[];
34
+ /**
35
+ * Gets unique properties from multiple selectors with CSS cascade rules:
36
+ * - First selector wins (properties from earlier selectors take precedence)
37
+ * - Within a selector, last value wins (if property appears multiple times)
38
+ * @param selectors - Array of selectors to extract properties from
39
+ * @returns Map of property names to their values
40
+ */
41
+ getUniqueProperties: (selectors: string[]) => Map<string, string>;
42
+ /**
43
+ * Gets a DOM-matchable selector by stripping pseudo-classes.
44
+ * Returns null if the selector contains pseudo-elements (unmatchable against real DOM).
45
+ * @param selector - The original CSS selector string
46
+ * @returns DOM-matchable selector string or null
47
+ */
48
+ getDomSelector: (selector: string) => string | null;
49
+ }
@@ -0,0 +1,6 @@
1
+ export { ExtractorStore } from './store';
2
+ export { runExtractors } from './runner';
3
+ export type { ExtractionResult } from './runner';
4
+ export { buildElementTree } from './tree-builder';
5
+ export type { ExtractedElement } from './tree-builder';
6
+ export type { ReactExtractor, RenderContext, CreateElementEvent, RenderCompleteEvent } from './types';
@@ -0,0 +1,19 @@
1
+ import { ComponentType } from 'react';
2
+ import { ComponentInfo } from '../../../ts/types';
3
+ import { ExtractorStore } from './store';
4
+ import { ExtractedElement } from './tree-builder';
5
+ import { ReactExtractor } from './types';
6
+ export interface ExtractionResult {
7
+ html: string;
8
+ store: ExtractorStore;
9
+ elements: ExtractedElement[];
10
+ }
11
+ /**
12
+ * Runs extractors through the full lifecycle and returns extraction results.
13
+ *
14
+ * @param componentInfo - TypeScript-extracted component information
15
+ * @param component - The React component to render
16
+ * @param extractors - Array of extractors to run
17
+ * @returns Extraction results including HTML, store, and element tree
18
+ */
19
+ export declare function runExtractors(componentInfo: ComponentInfo, component: ComponentType<unknown>, extractors: ReactExtractor[]): ExtractionResult;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ExtractorStore - Shared store for extractors with namespace support
3
+ *
4
+ * Extractors write to this store during render, namespaced by their name:
5
+ * store.set(traceId, 'prop-tracker', { boundProps: ['label', 'onClick'] })
6
+ * store.set(traceId, 'css-properties', { relevant: ['color', 'background'] })
7
+ *
8
+ * Store structure: Map<traceId, Map<extractorName, data>>
9
+ */
10
+ export declare class ExtractorStore {
11
+ private data;
12
+ set<T>(traceId: string, extractorName: string, value: T): void;
13
+ get<T>(traceId: string, extractorName: string): T | undefined;
14
+ getAll(traceId: string): Map<string, unknown> | undefined;
15
+ entries(): IterableIterator<[string, Map<string, unknown>]>;
16
+ clear(): void;
17
+ }
@@ -0,0 +1,15 @@
1
+ import { ExtractorStore } from './store';
2
+ export interface ExtractedElement {
3
+ traceId: string;
4
+ name: string;
5
+ tag: string;
6
+ attributes: Record<string, string>;
7
+ extractorData: Map<string, unknown>;
8
+ children: ExtractedElement[];
9
+ hasTextContent?: boolean;
10
+ }
11
+ /**
12
+ * Builds an element tree from HTML, merging with store data.
13
+ * Each element gets a semantic name from concatenated ancestor names.
14
+ */
15
+ export declare function buildElementTree(html: string, store: ExtractorStore): ExtractedElement[];
@@ -0,0 +1,40 @@
1
+ import { ComponentType } from 'react';
2
+ import { ComponentInfo } from '../../../ts/types';
3
+ import { ExtractorStore } from './store';
4
+ /**
5
+ * Context available to extractors during the beforeRender phase.
6
+ * Props are mutable - extractors can modify them before render.
7
+ */
8
+ export interface RenderContext {
9
+ componentInfo: ComponentInfo;
10
+ component: ComponentType<unknown>;
11
+ props: Record<string, unknown>;
12
+ store: ExtractorStore;
13
+ }
14
+ /**
15
+ * Event emitted for each DOM element created during render.
16
+ */
17
+ export interface CreateElementEvent {
18
+ tag: string;
19
+ props: Record<string, unknown>;
20
+ traceId: string;
21
+ children: unknown[];
22
+ store: ExtractorStore;
23
+ }
24
+ /**
25
+ * Event emitted after render completes.
26
+ */
27
+ export interface RenderCompleteEvent {
28
+ html: string;
29
+ context: RenderContext;
30
+ }
31
+ /**
32
+ * Interface for pluggable extractors.
33
+ * Extractors can hook into any combination of lifecycle events.
34
+ */
35
+ export interface ReactExtractor {
36
+ name: string;
37
+ onBeforeRender?(context: RenderContext): void;
38
+ onCreateElement?(event: CreateElementEvent): void;
39
+ onRenderComplete?(event: RenderCompleteEvent): void;
40
+ }
@@ -0,0 +1,20 @@
1
+ import { ReactExtractor } from './core/types';
2
+ export interface CssPropertiesData {
3
+ relevant: string[];
4
+ }
5
+ /**
6
+ * Gets CSS properties relevant to an element based on tag and role.
7
+ * Note: hasTextContent determination is deferred to tree building since
8
+ * we can't know during createElement if a child will have text content.
9
+ */
10
+ export declare function getCssPropertiesForTag(tag: string, role?: string): string[];
11
+ /**
12
+ * Adds text CSS properties to an existing property list without duplicates.
13
+ * Called during tree building when we know an element has text content.
14
+ */
15
+ export declare function addTextProperties(existing: string[]): string[];
16
+ /**
17
+ * Creates a CSS properties extractor that determines relevant CSS properties
18
+ * for each element based on its tag and role.
19
+ */
20
+ export declare function createCssPropertiesExtractor(): ReactExtractor;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * React Extractors
3
+ *
4
+ * Core infrastructure and pluggable extractors for the React information extraction system.
5
+ */
6
+ export { ExtractorStore, runExtractors, buildElementTree, } from './core';
7
+ export type { ExtractionResult, ExtractedElement, ReactExtractor, RenderContext, CreateElementEvent, RenderCompleteEvent, } from './core';
8
+ export { createPropTrackerExtractor } from './prop-tracker';
9
+ export type { PropTrackerData, PropTrackerExtractorState } from './prop-tracker';
10
+ export { createCssPropertiesExtractor } from './css-properties';
11
+ export type { CssPropertiesData } from './css-properties';
@@ -0,0 +1,24 @@
1
+ import { PropSpyMeta, TrackingStores } from '../types';
2
+ import { PropSpyContext } from '../utils/prop-spy';
3
+ import { ReactExtractor } from './core/types';
4
+ export type GetSpyMetadataFn = (id: string) => PropSpyMeta | null;
5
+ export interface PropTrackerData {
6
+ tag: string;
7
+ role?: string;
8
+ boundProps: string[];
9
+ concatenatedAttrs: Map<string, string>;
10
+ }
11
+ export interface PropTrackerExtractorState {
12
+ stores: TrackingStores;
13
+ spyContext: PropSpyContext;
14
+ }
15
+ /**
16
+ * Creates a prop tracker extractor that:
17
+ * 1. Wraps props with spy proxies during beforeRender
18
+ * 2. Detects spy markers in element props during onCreateElement
19
+ * 3. Writes tracking data to the store namespaced by 'prop-tracker'
20
+ */
21
+ export declare function createPropTrackerExtractor(): {
22
+ extractor: ReactExtractor;
23
+ state: PropTrackerExtractorState;
24
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * React Information Extraction
3
+ *
4
+ * API: runExtractors() with pluggable extractors
5
+ */
6
+ export { ExtractorStore, runExtractors, buildElementTree, createPropTrackerExtractor, createCssPropertiesExtractor, } from './extractors';
7
+ export type { ExtractionResult, ExtractedElement, ReactExtractor, RenderContext, CreateElementEvent, RenderCompleteEvent, PropTrackerData, PropTrackerExtractorState, CssPropertiesData, } from './extractors';
8
+ export type { CoupledComponentInfo, CoupledProp, TrackingStores, DOMBinding, PropReadInfo, PropWriteInfo, PropSpyMeta, } from './types';
9
+ export type { PropSpyContext } from './utils/prop-spy';
@@ -0,0 +1,51 @@
1
+ import { PropInfo } from '../ts/types';
2
+ import { ExtractedElement } from './extractors/core/tree-builder';
3
+ export declare const PROP_SPY_SYMBOL: unique symbol;
4
+ export interface PropSpyMeta {
5
+ path: string;
6
+ propName: string;
7
+ uniqueId: string;
8
+ originalValue: unknown;
9
+ }
10
+ export interface PropSpy<T = unknown> {
11
+ [PROP_SPY_SYMBOL]: true;
12
+ __meta: PropSpyMeta;
13
+ valueOf: () => T;
14
+ toString: () => string;
15
+ toJSON: () => T;
16
+ [Symbol.toPrimitive]?: (hint: string) => T | string | number;
17
+ }
18
+ export interface PropReadInfo {
19
+ components: Set<string>;
20
+ value: unknown;
21
+ }
22
+ export interface PropWriteInfo {
23
+ elements: Map<string, {
24
+ tag: string;
25
+ elementId: string;
26
+ }>;
27
+ attributes: Map<string, {
28
+ attr: string;
29
+ concatenated: boolean;
30
+ }>;
31
+ }
32
+ export interface TrackingStores {
33
+ reads: Map<string, PropReadInfo>;
34
+ writes: Map<string, PropWriteInfo>;
35
+ }
36
+ export interface DOMBinding {
37
+ element: string;
38
+ attribute: string;
39
+ concatenated: boolean;
40
+ elementId: string;
41
+ }
42
+ export interface CoupledProp extends PropInfo {
43
+ bindings: DOMBinding[];
44
+ logicOnly: boolean;
45
+ }
46
+ export interface CoupledComponentInfo {
47
+ componentName: string;
48
+ props: Record<string, CoupledProp>;
49
+ elements: ExtractedElement[];
50
+ innerElementProps?: Map<string, Record<string, CoupledProp>>;
51
+ }
@@ -0,0 +1,9 @@
1
+ import { ComponentInfo } from '../../ts/types';
2
+ /**
3
+ * Reset faker's seed and internal state for reproducible results
4
+ */
5
+ export declare function resetMockCounter(): void;
6
+ /**
7
+ * Generate mock props object from ComponentInfo
8
+ */
9
+ export declare function generateMockProps(componentInfo: ComponentInfo): Record<string, unknown>;
@@ -0,0 +1,10 @@
1
+ import { PropSpyMeta, TrackingStores } from '../types';
2
+ export interface PropSpyContext {
3
+ createAuditedProps: <T extends object | null>(target: T, stores: TrackingStores, getComponent: () => string, basePath?: string) => T;
4
+ getSpyMetadataByUniqueId: (id: string) => PropSpyMeta | null;
5
+ }
6
+ /**
7
+ * Creates an encapsulated prop spy context.
8
+ * Each context has its own ID counter and metadata map, avoiding global state.
9
+ */
10
+ export declare function createPropSpyContext(): PropSpyContext;
@@ -0,0 +1,9 @@
1
+ import { default as ts } from 'typescript';
2
+ import { ComponentInfo } from './types';
3
+ export declare function extractAllComponentInfo(program: ts.Program, filePath: string): ComponentInfo[];
4
+ /**
5
+ * Extracts component info for only the default-exported component in a file.
6
+ * Returns `undefined` if the file has no default export or if the default export
7
+ * is not a recognized React component.
8
+ */
9
+ export declare function extractDefaultComponentInfo(program: ts.Program, filePath: string): ComponentInfo | undefined;
@@ -0,0 +1,2 @@
1
+ import { Program } from 'typescript';
2
+ export declare function extractCssImports(program: Program): string[];
@@ -0,0 +1,3 @@
1
+ export { extractAllComponentInfo, extractDefaultComponentInfo } from './components';
2
+ export { extractCssImports } from './css-imports';
3
+ export type { ComponentInfo } from './types';
@@ -0,0 +1,47 @@
1
+ /**
2
+ * API to extract component props with full TypeScript type resolution
3
+ */
4
+ export type ResolvedKind = 'primitive' | 'semantic' | 'array' | 'object' | 'union' | 'intersection' | 'enum' | 'literal' | 'function';
5
+ export interface ResolvedType {
6
+ kind: ResolvedKind;
7
+ value?: unknown;
8
+ /** For semantic types, the package the symbol came from */
9
+ source?: string;
10
+ properties?: Record<string, PropInfo>;
11
+ elementType?: ResolvedType;
12
+ types?: ResolvedType[];
13
+ }
14
+ /**
15
+ * Resolved default value with its type.
16
+ * For literals (string, number, boolean, null), the value is the actual JavaScript value.
17
+ * For unresolvable values (references, expressions), we store the raw source text.
18
+ */
19
+ export type DefaultValue = {
20
+ kind: 'string';
21
+ value: string;
22
+ } | {
23
+ kind: 'number';
24
+ value: number;
25
+ } | {
26
+ kind: 'boolean';
27
+ value: boolean;
28
+ } | {
29
+ kind: 'null';
30
+ value: null;
31
+ } | {
32
+ kind: 'unresolved';
33
+ value: string;
34
+ };
35
+ export interface PropInfo {
36
+ name: string;
37
+ type: string;
38
+ required: boolean;
39
+ defaultValue?: DefaultValue;
40
+ resolvedType: ResolvedType;
41
+ description?: string;
42
+ deprecated?: boolean;
43
+ }
44
+ export interface ComponentInfo {
45
+ componentName: string;
46
+ props: Record<string, PropInfo>;
47
+ }
@@ -0,0 +1,3 @@
1
+ import { default as ts } from 'typescript';
2
+ import { ResolvedType } from '../types';
3
+ export declare function resolveType(type: ts.Type, checker: ts.TypeChecker, depth?: number, typeString?: string, declaredSymbol?: ts.Symbol): ResolvedType;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Interceptable JSX Runtime
3
+ *
4
+ * This module wraps React's jsx-runtime and allows dynamic interception
5
+ * of jsx/jsxs/jsxDEV calls. This is necessary because ESM imports are immutable,
6
+ * so we can't monkey-patch react/jsx-runtime directly.
7
+ *
8
+ * ## Usage contexts
9
+ *
10
+ * This module runs in two contexts that must share mutable state:
11
+ *
12
+ * 1. **Vite alias (tests)** — aliased to `react/jsx-runtime` in vite.config.ts
13
+ * 2. **Node.js ESM loader hook (CLI)** — redirected via `module.register()` in cli.ts
14
+ *
15
+ * In both cases the interceptor may be loaded as a separate module instance from
16
+ * the copy bundled into the main dist files. To ensure `setJsxInterceptors()`
17
+ * (called from component-renderer.ts) affects the `jsx`/`jsxs` that user
18
+ * components call, mutable state lives on `globalThis` via `Symbol.for()`.
19
+ */
20
+ declare const originalRuntime: typeof import("react/jsx-runtime");
21
+ declare const originalDevRuntime: typeof import("react/jsx-dev-runtime");
22
+ export declare const Fragment: import('react').ExoticComponent<{
23
+ children?: import('react').ReactNode | undefined;
24
+ }>;
25
+ type JsxDevFn = typeof originalDevRuntime.jsxDEV;
26
+ /**
27
+ * Sets custom jsx/jsxs/jsxDEV implementations for interception.
28
+ * Call with no arguments to restore originals.
29
+ */
30
+ export declare function setJsxInterceptors(jsx?: typeof originalRuntime.jsx, jsxs?: typeof originalRuntime.jsxs, jsxDEV?: JsxDevFn): void;
31
+ /**
32
+ * Gets the original jsx/jsxs/jsxDEV functions.
33
+ */
34
+ export declare function getOriginals(): {
35
+ jsx: typeof import('./jsx-runtime-interceptor.ts').jsx;
36
+ jsxs: typeof import('./jsx-runtime-interceptor.ts').jsxs;
37
+ jsxDEV: typeof import('./jsx-runtime-interceptor.ts').jsxDEV;
38
+ };
39
+ export declare function jsx(type: Parameters<typeof originalRuntime.jsx>[0], props: Parameters<typeof originalRuntime.jsx>[1], key?: Parameters<typeof originalRuntime.jsx>[2]): import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
40
+ export declare function jsxs(type: Parameters<typeof originalRuntime.jsxs>[0], props: Parameters<typeof originalRuntime.jsxs>[1], key?: Parameters<typeof originalRuntime.jsxs>[2]): import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
41
+ export declare function jsxDEV(type: Parameters<JsxDevFn>[0], props: Parameters<JsxDevFn>[1], key: Parameters<JsxDevFn>[2], isStaticChildren: Parameters<JsxDevFn>[3], source: Parameters<JsxDevFn>[4], self: Parameters<JsxDevFn>[5]): import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>>;
42
+ export {};
@@ -0,0 +1,63 @@
1
+ import { createRequire as j } from "node:module";
2
+ const o = j(import.meta.url), t = o("react/jsx-runtime"), u = o("react/jsx-dev-runtime"), f = t.Fragment, a = /* @__PURE__ */ Symbol.for("zero-config:jsx-interceptor");
3
+ function x() {
4
+ const n = globalThis;
5
+ return n[a] || (n[a] = {
6
+ currentJsx: t.jsx,
7
+ currentJsxs: t.jsxs,
8
+ currentJsxDEV: u.jsxDEV,
9
+ isInsideOriginal: !1
10
+ }), n[a];
11
+ }
12
+ function m(n, r, i) {
13
+ const s = x();
14
+ s.currentJsx = n ?? t.jsx, s.currentJsxs = r ?? t.jsxs, s.currentJsxDEV = i ?? u.jsxDEV;
15
+ }
16
+ function E() {
17
+ return {
18
+ jsx: t.jsx,
19
+ jsxs: t.jsxs,
20
+ jsxDEV: u.jsxDEV
21
+ };
22
+ }
23
+ function I(n, r, i) {
24
+ const s = x();
25
+ if (s.isInsideOriginal)
26
+ return t.jsx(n, r, i);
27
+ s.isInsideOriginal = !0;
28
+ try {
29
+ return s.currentJsx(n, r, i);
30
+ } finally {
31
+ s.isInsideOriginal = !1;
32
+ }
33
+ }
34
+ function O(n, r, i) {
35
+ const s = x();
36
+ if (s.isInsideOriginal)
37
+ return t.jsxs(n, r, i);
38
+ s.isInsideOriginal = !0;
39
+ try {
40
+ return s.currentJsxs(n, r, i);
41
+ } finally {
42
+ s.isInsideOriginal = !1;
43
+ }
44
+ }
45
+ function d(n, r, i, s, c, l) {
46
+ const e = x();
47
+ if (e.isInsideOriginal)
48
+ return u.jsxDEV(n, r, i, s, c, l);
49
+ e.isInsideOriginal = !0;
50
+ try {
51
+ return e.currentJsxDEV(n, r, i, s, c, l);
52
+ } finally {
53
+ e.isInsideOriginal = !1;
54
+ }
55
+ }
56
+ export {
57
+ f as Fragment,
58
+ E as getOriginals,
59
+ I as jsx,
60
+ d as jsxDEV,
61
+ O as jsxs,
62
+ m as setJsxInterceptors
63
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Node.js ESM Customization Hook
3
+ *
4
+ * Redirects ESM `import 'react/jsx-runtime'` and `import 'react/jsx-dev-runtime'`
5
+ * to the interceptable jsx-runtime-interceptor module.
6
+ *
7
+ * Registered via `module.register()` in the CLI before loading user components.
8
+ * This ensures that dynamically imported user components use the interceptable
9
+ * jsx-runtime, enabling prop tracking and element tracing.
10
+ *
11
+ * CJS `require()` calls are not affected by this hook — the interceptor uses
12
+ * `createRequire` internally, so it always loads the real React runtime.
13
+ */
14
+ interface ResolveResult {
15
+ url: string;
16
+ shortCircuit?: boolean;
17
+ }
18
+ interface ResolveContext {
19
+ parentURL?: string;
20
+ }
21
+ type NextResolve = (specifier: string, context: ResolveContext) => Promise<ResolveResult>;
22
+ export declare function resolve(specifier: string, context: ResolveContext, nextResolve: NextResolve): Promise<ResolveResult>;
23
+ export {};
@@ -0,0 +1,7 @@
1
+ const n = import.meta.url.replace(/jsx-runtime-loader\.js$/, "jsx-runtime-interceptor.js");
2
+ async function u(r, t, e) {
3
+ return r === "react/jsx-runtime" || r === "react/jsx-dev-runtime" ? { shortCircuit: !0, url: n } : e(r, t);
4
+ }
5
+ export {
6
+ u as resolve
7
+ };
@@ -0,0 +1,33 @@
1
+ import { ComponentInfo } from './information-extractors/ts';
2
+ import { CoupledComponentInfo } from './information-extractors/react';
3
+ import { CSSParserAPI } from './information-extractors/css';
4
+ import { ComponentType } from 'react';
5
+ /** A non-fatal issue encountered during component processing. */
6
+ export interface ExtractionWarning {
7
+ componentName: string;
8
+ phase: 'render' | 'coupling' | 'css' | 'loader' | 'conversion';
9
+ error: string;
10
+ }
11
+ export interface ExtractedCssInfo {
12
+ filePath: string;
13
+ api: CSSParserAPI;
14
+ properties: Map<string, string>;
15
+ customProperties: Map<string, string>;
16
+ }
17
+ export interface ComponentInfoWithCss extends CoupledComponentInfo {
18
+ css: ExtractedCssInfo[];
19
+ }
20
+ /** The result of processing a single component through the manifest pipeline. */
21
+ export interface ProcessComponentResult {
22
+ component: ComponentInfoWithCss;
23
+ warnings: ExtractionWarning[];
24
+ }
25
+ /**
26
+ * Processes a single component through the full manifest pipeline:
27
+ * loading, rendering with prop tracking, CSS extraction, and selector matching.
28
+ *
29
+ * Returns the enriched component info alongside any non-fatal warnings
30
+ * encountered during processing. Always returns a component, falling back
31
+ * to minimal info (without DOM coupling) when rendering fails.
32
+ */
33
+ export declare function processComponent(componentInfo: ComponentInfo, loadComponent: (componentName: string) => ComponentType<unknown> | null, cssImportPaths: string[], loaderHasError?: boolean): ProcessComponentResult;