@wix/zero-config-implementation 1.36.0 → 1.38.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 CHANGED
@@ -15,19 +15,24 @@ Peer dependencies: `react` (^18 || ^19), `react-dom` (^18 || ^19), `typescript`
15
15
  ### Programmatic
16
16
 
17
17
  ```ts
18
- import { extractComponentManifest } from '@wix/zero-config'
18
+ import { extractComponentManifest, extractComponentManifestResult } from '@wix/zero-config'
19
19
 
20
- const result = await extractComponentManifest(
20
+ const manifest = await extractComponentManifest(
21
21
  './src/MyComponent.tsx',
22
22
  './dist/index.js', // path to the compiled JS entry of the component's package
23
23
  )
24
24
 
25
+ console.log(manifest.component) // EditorReactComponent
26
+ console.log(manifest.errors) // non-fatal ExtractionError[]
27
+
28
+ // If you prefer neverthrow ResultAsync semantics:
29
+ const result = await extractComponentManifestResult('./src/MyComponent.tsx', './dist/index.js')
25
30
  result.match(
26
- (manifest) => {
27
- console.log(manifest.component) // EditorReactComponent
28
- console.log(manifest.errors) // non-fatal ExtractionError[]
31
+ (manifestResult) => {
32
+ console.log(manifestResult.component)
33
+ console.log(manifestResult.errors)
29
34
  },
30
- (err) => console.error(err),
35
+ (error) => console.error(error),
31
36
  )
32
37
  ```
33
38
 
@@ -53,7 +58,8 @@ npx @wix/zero-config
53
58
 
54
59
  ## API layers
55
60
 
56
- - **Tier 1 — High-level:** `extractComponentManifest()` — one call, default pipeline.
61
+ - **Tier 1 — High-level:** `extractComponentManifest()` — one call, default pipeline (`Promise<ManifestResult>`).
62
+ - **Tier 1 (neverthrow variant):** `extractComponentManifestResult()` — same pipeline with `ResultAsync` return.
57
63
  - **Tier 2 — Pipeline building blocks:** `compileTsFile`, `extractAllComponentInfo`, `extractCssImports`, `processComponent`, `runExtractors`, `ExtractorStore`, `buildElementTree`, `createPropTrackerExtractor`, `createCssPropertiesExtractor`, `parseCss`, `toEditorReactComponent`, and exported types (e.g. `ComponentInfo`, `PropInfo`, `ExtractionResult`, `ReactExtractor`).
58
64
  - **Tier 3 — Low-level:** `renderWithExtractors`, `CreateElementListener` for custom createElement/JSX interception.
59
65
 
package/dist/index.d.ts CHANGED
@@ -813,7 +813,7 @@ declare type ExternalPluginsOptions<PluginsArg extends Plugins> = {
813
813
 
814
814
  export declare function extractAllComponentInfo(program: default_2.Program, filePath: string): ComponentInfo[];
815
815
 
816
- export declare function extractComponentManifest(componentPath: string, compiledEntryPath: string, options?: ExtractComponentManifestOptions): ResultAsync<ManifestResult, InstanceType<typeof NotFoundError> | InstanceType<typeof ParseError>>;
816
+ export declare function extractComponentManifest(componentPath: string, compiledEntryPath: string, options?: ExtractComponentManifestOptions): Promise<ManifestResult>;
817
817
 
818
818
  /**
819
819
  * Extract component manifest from a TypeScript source file.
@@ -829,6 +829,8 @@ export declare interface ExtractComponentManifestOptions extends RunExtractorsOp
829
829
  onError?: (error: ExtractionError) => void;
830
830
  }
831
831
 
832
+ export declare function extractComponentManifestResult(componentPath: string, compiledEntryPath: string, options?: ExtractComponentManifestOptions): ResultAsync<ManifestResult, InstanceType<typeof NotFoundError> | InstanceType<typeof ParseError>>;
833
+
832
834
  export declare function extractCssImports(program: Program): string[];
833
835
 
834
836
  /**