@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 +13 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1209 -1200
- package/package.json +2 -2
- package/src/component-renderer.ts +0 -10
- package/src/index.ts +15 -1
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"registry": "https://registry.npmjs.org/",
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.38.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",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
]
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
-
"falconPackageHash": "
|
|
87
|
+
"falconPackageHash": "e65c0344d74e7ed0164dee43129b7d1dc6963129ff26e0dbc2346c28"
|
|
88
88
|
}
|
|
@@ -138,8 +138,6 @@ export function renderWithExtractors(
|
|
|
138
138
|
): string {
|
|
139
139
|
let nextId = 0
|
|
140
140
|
const getNextId = () => `t${++nextId}`
|
|
141
|
-
const globalScopeWithReact = globalThis as typeof globalThis & { React?: typeof React }
|
|
142
|
-
const hasExistingGlobalReact = Object.prototype.hasOwnProperty.call(globalScopeWithReact, 'React')
|
|
143
141
|
|
|
144
142
|
// Store originals
|
|
145
143
|
const originalCreateElement = React.createElement
|
|
@@ -167,11 +165,6 @@ export function renderWithExtractors(
|
|
|
167
165
|
const interceptedJsxDEV = createInterceptor(originalJsxDEV as ElementCreator, listeners, getNextId, store)
|
|
168
166
|
|
|
169
167
|
try {
|
|
170
|
-
// Provide a scoped global React binding only when absent, for classic bundles
|
|
171
|
-
// that reference `React.createElement` without a runtime React import.
|
|
172
|
-
if (!hasExistingGlobalReact) {
|
|
173
|
-
globalScopeWithReact.React = React
|
|
174
|
-
}
|
|
175
168
|
// @ts-expect-error Monkey-patch createElement
|
|
176
169
|
React.createElement = interceptedCreateElement
|
|
177
170
|
// Use the interceptor API for jsx-runtime (includes jsxDEV for dev mode)
|
|
@@ -195,8 +188,5 @@ export function renderWithExtractors(
|
|
|
195
188
|
cjsRuntime.jsx = origCjsJsx
|
|
196
189
|
cjsRuntime.jsxs = origCjsJsxs
|
|
197
190
|
cjsDevRuntime.jsxDEV = origCjsJsxDEV
|
|
198
|
-
if (!hasExistingGlobalReact) {
|
|
199
|
-
Reflect.deleteProperty(globalScopeWithReact, 'React')
|
|
200
|
-
}
|
|
201
191
|
}
|
|
202
192
|
}
|
package/src/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface ExtractComponentManifestOptions extends RunExtractorsOptions {
|
|
|
39
39
|
onError?: (error: ExtractionError) => void
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function
|
|
42
|
+
export function extractComponentManifestResult(
|
|
43
43
|
componentPath: string,
|
|
44
44
|
compiledEntryPath: string,
|
|
45
45
|
options?: ExtractComponentManifestOptions,
|
|
@@ -129,6 +129,20 @@ export function extractComponentManifest(
|
|
|
129
129
|
})
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
export async function extractComponentManifest(
|
|
133
|
+
componentPath: string,
|
|
134
|
+
compiledEntryPath: string,
|
|
135
|
+
options?: ExtractComponentManifestOptions,
|
|
136
|
+
): Promise<ManifestResult> {
|
|
137
|
+
const extractionResult = await extractComponentManifestResult(componentPath, compiledEntryPath, options)
|
|
138
|
+
return extractionResult.match(
|
|
139
|
+
(manifestResult) => manifestResult,
|
|
140
|
+
(error) => {
|
|
141
|
+
throw error
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
132
146
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
133
147
|
// Public API Exports
|
|
134
148
|
//
|