@wix/zero-config-implementation 1.32.0 → 1.34.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 +1 -1
- package/dist/index.d.ts +2742 -45
- package/dist/index.js +22598 -14991
- package/dist/jsx-runtime-interceptor.d.ts +58 -42
- package/dist/jsx-runtime-loader.d.ts +27 -23
- package/package.json +4 -3
- package/src/index.ts +4 -0
- package/src/information-extractors/css/parse.ts +113 -437
- package/vite.config.ts +14 -2
- package/dist/component-renderer.d.ts +0 -31
- package/dist/converters/data-item-builder.d.ts +0 -18
- package/dist/converters/index.d.ts +0 -1
- package/dist/converters/to-editor-component.d.ts +0 -3
- package/dist/converters/utils.d.ts +0 -20
- package/dist/errors.d.ts +0 -230
- package/dist/extraction-types.d.ts +0 -7
- package/dist/information-extractors/css/index.d.ts +0 -3
- package/dist/information-extractors/css/parse.d.ts +0 -7
- package/dist/information-extractors/css/sass-adapter.d.ts +0 -2
- package/dist/information-extractors/css/selector-matcher.d.ts +0 -6
- package/dist/information-extractors/css/types.d.ts +0 -61
- package/dist/information-extractors/react/extractors/core/index.d.ts +0 -6
- package/dist/information-extractors/react/extractors/core/runner.d.ts +0 -23
- package/dist/information-extractors/react/extractors/core/store.d.ts +0 -17
- package/dist/information-extractors/react/extractors/core/tree-builder.d.ts +0 -15
- package/dist/information-extractors/react/extractors/core/types.d.ts +0 -40
- package/dist/information-extractors/react/extractors/css-properties.d.ts +0 -20
- package/dist/information-extractors/react/extractors/index.d.ts +0 -11
- package/dist/information-extractors/react/extractors/prop-tracker.d.ts +0 -21
- package/dist/information-extractors/react/index.d.ts +0 -8
- package/dist/information-extractors/react/types.d.ts +0 -38
- package/dist/information-extractors/react/utils/mock-generator.d.ts +0 -21
- package/dist/information-extractors/ts/components.d.ts +0 -14
- package/dist/information-extractors/ts/css-imports.d.ts +0 -2
- package/dist/information-extractors/ts/index.d.ts +0 -3
- package/dist/information-extractors/ts/types.d.ts +0 -54
- package/dist/information-extractors/ts/utils/semantic-type-resolver.d.ts +0 -12
- package/dist/manifest-pipeline.d.ts +0 -29
- package/dist/module-loader.d.ts +0 -27
- package/dist/ts-compiler.d.ts +0 -13
- package/dist/utils/css-class.d.ts +0 -9
- package/dist/wix-type-to-data-type.d.ts +0 -6
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { TrackingStores } from '../types';
|
|
2
|
-
import { ReactExtractor } from './core/types';
|
|
3
|
-
export interface PropTrackerData {
|
|
4
|
-
tag: string;
|
|
5
|
-
role?: string;
|
|
6
|
-
boundProps: string[];
|
|
7
|
-
concatenatedAttrs: Map<string, string>;
|
|
8
|
-
}
|
|
9
|
-
export interface PropTrackerExtractorState {
|
|
10
|
-
stores: TrackingStores;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Creates a prop tracker extractor that:
|
|
14
|
-
* 1. Generates spy-instrumented mock props during beforeRender
|
|
15
|
-
* 2. Detects spy markers in element props during onCreateElement
|
|
16
|
-
* 3. propUsages tracking data to the store namespaced by 'prop-tracker'
|
|
17
|
-
*/
|
|
18
|
-
export declare function createPropTrackerExtractor(): {
|
|
19
|
-
extractor: ReactExtractor;
|
|
20
|
-
state: PropTrackerExtractorState;
|
|
21
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
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, RunExtractorsOptions, ExtractedElement, ReactExtractor, RenderContext, CreateElementEvent, RenderCompleteEvent, PropTrackerData, PropTrackerExtractorState, CssPropertiesData, } from './extractors';
|
|
8
|
-
export type { CoupledComponentInfo, CoupledProp, TrackingStores, DOMBinding, PropWriteInfo, PropSpyMeta, } from './types';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { PropInfo } from '../ts/types';
|
|
2
|
-
import { ExtractedElement } from './extractors/core/tree-builder';
|
|
3
|
-
export interface PropSpyMeta {
|
|
4
|
-
path: string;
|
|
5
|
-
propName: string;
|
|
6
|
-
originalValue: unknown;
|
|
7
|
-
}
|
|
8
|
-
export interface PropWriteInfo {
|
|
9
|
-
elements: Map<string, {
|
|
10
|
-
tag: string;
|
|
11
|
-
elementId: string;
|
|
12
|
-
}>;
|
|
13
|
-
attributes: Map<string, {
|
|
14
|
-
attr: string;
|
|
15
|
-
concatenated: boolean;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export interface TrackingStores {
|
|
19
|
-
propUsages: Map<string, PropWriteInfo>;
|
|
20
|
-
}
|
|
21
|
-
export interface DOMBinding {
|
|
22
|
-
element: string;
|
|
23
|
-
attribute: string;
|
|
24
|
-
concatenated: boolean;
|
|
25
|
-
elementId: string;
|
|
26
|
-
}
|
|
27
|
-
export interface CoupledProp extends PropInfo {
|
|
28
|
-
/** Full stores.propUsages key for this prop, e.g. "props.linkUrl". */
|
|
29
|
-
propPath: string;
|
|
30
|
-
logicOnly: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface CoupledComponentInfo {
|
|
33
|
-
componentName: string;
|
|
34
|
-
props: Record<string, CoupledProp>;
|
|
35
|
-
elements: ExtractedElement[];
|
|
36
|
-
innerElementProps?: Map<string, Record<string, CoupledProp>>;
|
|
37
|
-
propUsages: TrackingStores['propUsages'];
|
|
38
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentInfo } from '../../ts/types';
|
|
2
|
-
export declare const PRESETS_WRAPPER_CLASS_NAME = "mock-presets-wrapper-probe";
|
|
3
|
-
/**
|
|
4
|
-
* Reset faker's seed and internal state for reproducible results
|
|
5
|
-
*/
|
|
6
|
-
export declare function resetMockCounter(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Narrow interface for registering spy markers during mock generation.
|
|
9
|
-
* Satisfied structurally by PropSpyContext.
|
|
10
|
-
*/
|
|
11
|
-
export interface PropSpyRegistrar {
|
|
12
|
-
registerString(path: string, propName: string, value: string): void;
|
|
13
|
-
registerNumber(path: string, propName: string, value: number): void;
|
|
14
|
-
registerFunction(path: string, propName: string, value: (...args: unknown[]) => unknown): void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Generate mock props object from ComponentInfo.
|
|
18
|
-
* When a registrar is provided, string and number values are spy-instrumented
|
|
19
|
-
* for DOM binding detection.
|
|
20
|
-
*/
|
|
21
|
-
export declare function generateMockProps(componentInfo: ComponentInfo, registrar?: PropSpyRegistrar): Record<string, unknown>;
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
* Handles the re-export case where the entry file only re-exports the component
|
|
10
|
-
* from another file (e.g. `export { Foo as default } from './Foo'`). In that
|
|
11
|
-
* situation react-docgen-typescript finds no component in the entry file, so we
|
|
12
|
-
* follow the re-export to the defining file and extract from there instead.
|
|
13
|
-
*/
|
|
14
|
-
export declare function extractDefaultComponentInfo(program: ts.Program, filePath: string): ComponentInfo | undefined;
|
|
@@ -1,54 +0,0 @@
|
|
|
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 structured literals (object, array), the value is the parsed JavaScript value.
|
|
18
|
-
* For unresolvable values (references, expressions), we store the raw source text.
|
|
19
|
-
*/
|
|
20
|
-
export type DefaultValue = {
|
|
21
|
-
kind: 'string';
|
|
22
|
-
value: string;
|
|
23
|
-
} | {
|
|
24
|
-
kind: 'number';
|
|
25
|
-
value: number;
|
|
26
|
-
} | {
|
|
27
|
-
kind: 'boolean';
|
|
28
|
-
value: boolean;
|
|
29
|
-
} | {
|
|
30
|
-
kind: 'null';
|
|
31
|
-
value: null;
|
|
32
|
-
} | {
|
|
33
|
-
kind: 'object';
|
|
34
|
-
value: Record<string, unknown>;
|
|
35
|
-
} | {
|
|
36
|
-
kind: 'array';
|
|
37
|
-
value: unknown[];
|
|
38
|
-
} | {
|
|
39
|
-
kind: 'unresolved';
|
|
40
|
-
value: string;
|
|
41
|
-
};
|
|
42
|
-
export interface PropInfo {
|
|
43
|
-
name: string;
|
|
44
|
-
type: string;
|
|
45
|
-
required: boolean;
|
|
46
|
-
defaultValue?: DefaultValue;
|
|
47
|
-
resolvedType: ResolvedType;
|
|
48
|
-
description?: string;
|
|
49
|
-
deprecated?: boolean;
|
|
50
|
-
}
|
|
51
|
-
export interface ComponentInfo {
|
|
52
|
-
componentName: string;
|
|
53
|
-
props: Record<string, PropInfo>;
|
|
54
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { default as ts } from 'typescript';
|
|
2
|
-
import { ResolvedType } from '../types';
|
|
3
|
-
interface ResolveTypeOptions {
|
|
4
|
-
type: ts.Type;
|
|
5
|
-
checker: ts.TypeChecker;
|
|
6
|
-
depth?: number;
|
|
7
|
-
typeString?: string;
|
|
8
|
-
declaredSymbol?: ts.Symbol;
|
|
9
|
-
seenTypes?: Set<ts.Type>;
|
|
10
|
-
}
|
|
11
|
-
export declare function resolveType({ type, checker, depth, typeString, declaredSymbol, seenTypes, }: ResolveTypeOptions): ResolvedType;
|
|
12
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ComponentInfo } from './information-extractors/ts';
|
|
2
|
-
import { RunExtractorsOptions, CoupledComponentInfo } from './information-extractors/react';
|
|
3
|
-
import { CSSParserAPI } from './information-extractors/css';
|
|
4
|
-
import { ComponentType } from 'react';
|
|
5
|
-
import { ExtractionError } from './extraction-types';
|
|
6
|
-
export interface ExtractedCssInfo {
|
|
7
|
-
filePath: string;
|
|
8
|
-
api: CSSParserAPI;
|
|
9
|
-
properties: Map<string, string>;
|
|
10
|
-
customProperties: Map<string, string>;
|
|
11
|
-
isCssModule: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface ComponentInfoWithCss extends CoupledComponentInfo {
|
|
14
|
-
css: ExtractedCssInfo[];
|
|
15
|
-
varUsedByTraceId: Map<string, Set<string>>;
|
|
16
|
-
}
|
|
17
|
-
/** The result of processing a single component through the manifest pipeline. */
|
|
18
|
-
export interface ProcessComponentResult {
|
|
19
|
-
component: ComponentInfoWithCss;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Processes a single component through the full manifest pipeline:
|
|
23
|
-
* loading, rendering with prop tracking, CSS extraction, and selector matching.
|
|
24
|
-
*
|
|
25
|
-
* Returns the enriched component info alongside any non-fatal warnings
|
|
26
|
-
* encountered during processing. Always returns a component, falling back
|
|
27
|
-
* to minimal info (without DOM coupling) when rendering fails.
|
|
28
|
-
*/
|
|
29
|
-
export declare function processComponent(componentInfo: ComponentInfo, loadComponent: (componentName: string) => ComponentType<unknown> | null, cssImportPaths: string[], loaderHasError: boolean, report: (error: ExtractionError) => void, options?: RunExtractorsOptions): ProcessComponentResult;
|
package/dist/module-loader.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ResultAsync } from 'neverthrow';
|
|
2
|
-
import { ComponentType } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Structured failure from `loadModule` when both ESM import and CJS require fail.
|
|
5
|
-
* Carries each error separately so callers can report them independently.
|
|
6
|
-
*/
|
|
7
|
-
export interface LoadModuleFailure {
|
|
8
|
-
/** The ESM import error, or null when no ESM was attempted (e.g. empty path). */
|
|
9
|
-
esmError: Error | null;
|
|
10
|
-
/** The CJS require error, or a generic error for the empty-path case. */
|
|
11
|
-
cjsError: Error;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Attempts to load a module, first via ESM `import()`, then via CJS `require`.
|
|
15
|
-
*
|
|
16
|
-
* ESM `import()` is preferred because it participates in the ESM loader hook
|
|
17
|
-
* pipeline (registered via `module.register()` in the CLI). This is required
|
|
18
|
-
* for JSX interception to work — the loader hook redirects `react/jsx-runtime`
|
|
19
|
-
* to the interceptable version. CJS `require()` bypasses ESM hooks even when
|
|
20
|
-
* loading ESM modules (Node 22+), so it's only used as a fallback.
|
|
21
|
-
*
|
|
22
|
-
* @param entryPath - Absolute path to the module entry point.
|
|
23
|
-
* @returns A `ResultAsync` containing the module exports on success.
|
|
24
|
-
* @errors {LoadModuleFailure} When both ESM import and CJS require fail.
|
|
25
|
-
*/
|
|
26
|
-
export declare function loadModule(entryPath: string): ResultAsync<Record<string, unknown>, LoadModuleFailure>;
|
|
27
|
-
export declare function findComponent(moduleExports: Record<string, unknown>, name: string): ComponentType<unknown> | null;
|
package/dist/ts-compiler.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ResultAsync } from 'neverthrow';
|
|
2
|
-
import { default as ts } from 'typescript';
|
|
3
|
-
import { NotFoundError, ParseError } from './errors';
|
|
4
|
-
/**
|
|
5
|
-
* Compile a TypeScript file into a ts.Program.
|
|
6
|
-
*
|
|
7
|
-
* @param filePath - Path to the TypeScript source file
|
|
8
|
-
* @returns The compiled TypeScript program on success
|
|
9
|
-
* @errors
|
|
10
|
-
* - {@link NotFoundError} — Source file does not exist (phase: `compile`)
|
|
11
|
-
* - {@link ParseError} — TypeScript config could not be parsed (phase: `compile`)
|
|
12
|
-
*/
|
|
13
|
-
export declare function compileTsFile(filePath: string): ResultAsync<ts.Program, InstanceType<typeof NotFoundError> | InstanceType<typeof ParseError>>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function isGlobalSemanticClass(className: string): boolean;
|
|
2
|
-
/**
|
|
3
|
-
* Picks the best semantic class from a list of class names.
|
|
4
|
-
* Prefers a class without a BEM modifier (e.g. `card__header`) over one with
|
|
5
|
-
* a modifier (e.g. `card__header--active`), since the base class is more
|
|
6
|
-
* stable as a selector or element name. Falls back to the first semantic class
|
|
7
|
-
* found if all candidates have modifiers.
|
|
8
|
-
*/
|
|
9
|
-
export declare function findPreferredSemanticClass(classNames: string[]): string | undefined;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DATA } from '@wix/zero-config-schema';
|
|
2
|
-
/**
|
|
3
|
-
* Maps @wix/public-schemas type names (PascalCase) to their DATA_TYPE keys.
|
|
4
|
-
* Derived from the exports of @wix/public-schemas.
|
|
5
|
-
*/
|
|
6
|
-
export declare const WIX_TYPE_TO_DATA_TYPE: Record<string, keyof typeof DATA.DATA_TYPE>;
|