@wix/zero-config-implementation 1.46.0 → 1.48.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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.46.0",
7
+ "version": "1.48.0",
8
8
  "description": "Core library for extracting component manifests from JS and CSS files",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@faker-js/faker": "^10.2.0",
51
+ "happy-dom": "^20.4.0",
51
52
  "@types/css-tree": "^2.3.11",
52
53
  "@types/node": "^20.0.0",
53
54
  "@types/react": "^18.3.1",
@@ -64,7 +65,7 @@
64
65
  "tsconfck": "^3.1.6",
65
66
  "typedoc": "^0.28.16",
66
67
  "typedoc-plugin-markdown": "^4.9.0",
67
- "vite": "^7.3.1",
68
+ "vite": "^7.3.2",
68
69
  "vite-plugin-dts": "^4.5.4",
69
70
  "vitest": "^4.0.17"
70
71
  },
@@ -84,5 +85,5 @@
84
85
  ]
85
86
  }
86
87
  },
87
- "falconPackageHash": "9f4aa3db6c672e0f49191ce43b8bf9de7c884e07c4765eef9a0ed3e7"
88
+ "falconPackageHash": "8fd0a1265e02ba71d5ed24fddbddbf66183b17ff76ac71ce067af6c6"
88
89
  }
@@ -104,6 +104,7 @@ function buildElements(
104
104
  inlineElement: {
105
105
  selector: buildSelector(element),
106
106
  displayName: formatDisplayName(element.name),
107
+ behaviors: { removable: true, selectable: false },
107
108
  // Add data from inner element props if available
108
109
  ...(data && Object.keys(data).length > 0 && { data }),
109
110
  // CSS properties from heuristic + matched CSS files
@@ -1,6 +1,9 @@
1
1
  import { createRequire } from 'node:module'
2
+ import { Window } from 'happy-dom'
2
3
  import { ResultAsync, errAsync, okAsync } from 'neverthrow'
4
+ import React from 'react'
3
5
  import type { ComponentType } from 'react'
6
+ import ReactDOM from 'react-dom'
4
7
 
5
8
  /**
6
9
  * Structured failure from `loadModule` when both ESM import and CJS require fail.
@@ -13,6 +16,24 @@ export interface LoadModuleFailure {
13
16
  cjsError: Error
14
17
  }
15
18
 
19
+ function setupWindowGlobals(): void {
20
+ const globals = globalThis as Record<string, unknown>
21
+
22
+ if (globals.window === undefined) {
23
+ const happyWindow = new Window()
24
+ globals.window = happyWindow
25
+ globals.document = happyWindow.document
26
+ globals.HTMLElement = happyWindow.HTMLElement
27
+ globals.customElements = happyWindow.customElements
28
+ }
29
+
30
+ const windowObj = globals.window as Record<string, unknown>
31
+ if (globals.React === undefined) globals.React = React
32
+ if (globals.ReactDOM === undefined) globals.ReactDOM = ReactDOM
33
+ if (windowObj.React === undefined) windowObj.React = React
34
+ if (windowObj.ReactDOM === undefined) windowObj.ReactDOM = ReactDOM
35
+ }
36
+
16
37
  /**
17
38
  * Attempts to load a module, first via ESM `import()`, then via CJS `require`.
18
39
  *
@@ -31,6 +52,7 @@ export function loadModule(entryPath: string): ResultAsync<Record<string, unknow
31
52
  return errAsync({ esmError: null, cjsError: new Error('No compiled entry path provided') })
32
53
  }
33
54
 
55
+ setupWindowGlobals()
34
56
  return ResultAsync.fromPromise(
35
57
  import(entryPath) as Promise<Record<string, unknown>>,
36
58
  (esmErr): Error => (esmErr instanceof Error ? esmErr : new Error(String(esmErr))),