react-compiler-runtime
Advanced tools
Comparing version 0.0.0-experimental-fa06e2c-20241016 to 0.0.0-experimental-fa43e63-20250117
@@ -1,19 +0,26 @@ | ||
type MemoCache = Array<number | typeof $empty>; | ||
declare const $empty: unique symbol; | ||
export declare const c: any; | ||
declare enum GuardKind { | ||
PushGuardContext = 0, | ||
PopGuardContext = 1, | ||
PushExpectHook = 2, | ||
PopExpectHook = 3 | ||
declare module 'react-compiler-runtime/index' { | ||
type MemoCache = Array<number | typeof $empty>; | ||
const $empty: unique symbol; | ||
export const c: any; | ||
enum GuardKind { | ||
PushGuardContext = 0, | ||
PopGuardContext = 1, | ||
PushExpectHook = 2, | ||
PopExpectHook = 3 | ||
} | ||
export function $dispatcherGuard(kind: GuardKind): void; | ||
export function $reset($: MemoCache): void; | ||
export function $makeReadOnly(): void; | ||
export const renderCounterRegistry: Map<string, Set<{ | ||
count: number; | ||
}>>; | ||
export function clearRenderCounterRegistry(): void; | ||
export function useRenderCounter(name: string): void; | ||
export function $structuralCheck(oldValue: any, newValue: any, variableName: string, fnName: string, kind: string, loc: string): void; | ||
export {}; | ||
} | ||
export declare function $dispatcherGuard(kind: GuardKind): void; | ||
export declare function $reset($: MemoCache): void; | ||
export declare function $makeReadOnly(): void; | ||
export declare const renderCounterRegistry: Map<string, Set<{ | ||
count: number; | ||
}>>; | ||
export declare function clearRenderCounterRegistry(): void; | ||
export declare function useRenderCounter(name: string): void; | ||
export declare function $structuralCheck(oldValue: any, newValue: any, variableName: string, fnName: string, kind: string, loc: string): void; | ||
export {}; | ||
declare module 'react-compiler-runtime' { | ||
import main = require('react-compiler-runtime/src/index'); | ||
export = main; | ||
} |
@@ -14,3 +14,373 @@ /** | ||
"use no memo";"use strict";function e(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var t,n,o=e(require("react"));const{useRef:r,useEffect:c,isValidElement:a}=o,i=null!==(t=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)&&void 0!==t?t:o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,s=Symbol.for("react.memo_cache_sentinel"),u="function"==typeof(null===(n=o.__COMPILER_RUNTIME)||void 0===n?void 0:n.c)?o.__COMPILER_RUNTIME.c:function(e){return o.useMemo((()=>{const t=new Array(e);for(let n=0;n<e;n++)t[n]=s;return t[s]=!0,t}),[])},l={};["readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","getCacheSignal","getCacheForType","useCacheRefresh"].forEach((e=>{l[e]=()=>{throw new Error(`[React] Unexpected React hook call (${e}) from a React Forget compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') `)}}));let f=null;var p;function h(e){return i.ReactCurrentDispatcher.current=e,i.ReactCurrentDispatcher.current}l.useMemoCache=e=>{if(null==f)throw new Error("React Forget internal invariant violation: unexpected null dispatcher");return f.useMemoCache(e)},function(e){e[e.PushGuardContext=0]="PushGuardContext",e[e.PopGuardContext=1]="PopGuardContext",e[e.PushExpectHook=2]="PushExpectHook",e[e.PopExpectHook=3]="PopExpectHook"}(p||(p={}));const d=[];const y=new Map;const R=new Set;exports.$dispatcherGuard=function(e){const t=i.ReactCurrentDispatcher.current;if(e===p.PushGuardContext){if(d.push(t),1===d.length&&(f=t),t===l)throw new Error("[React] Unexpected call to custom hook or component from a React Forget compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked.");h(l)}else if(e===p.PopGuardContext){const e=d.pop();if(null==e)throw new Error("React Forget internal error: unexpected null in guard stack");0===d.length&&(f=null),h(e)}else if(e===p.PushExpectHook)d.push(t),h(f);else{if(e!==p.PopExpectHook)throw new Error("Forget internal error: unreachable block"+e);{const e=d.pop();if(null==e)throw new Error("React Forget internal error: unexpected null in guard stack");h(e)}}},exports.$makeReadOnly=function(){throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime")},exports.$reset=function(e){for(let t=0;t<e.length;t++)e[t]=s},exports.$structuralCheck=function(e,t,n,o,r,c){function i(e,t,a,i){const s=`${o}:${c} [${r}] ${n}${a} changed from ${e} to ${t} at depth ${i}`;R.has(s)||(R.add(s),console.error(s))}!function e(t,n,o,r){if(!(r>2)&&t!==n)if(typeof t!=typeof n)i("type "+typeof t,"type "+typeof n,o,r);else if("object"==typeof t){const c=Array.isArray(t),s=Array.isArray(n);if(null===t&&null!==n)i("null","type "+typeof n,o,r);else if(null===n)i("type "+typeof t,"null",o,r);else if(t instanceof Map)if(n instanceof Map)if(t.size!==n.size)i(`Map instance with size ${t.size}`,`Map instance with size ${n.size}`,o,r);else for(const[c,a]of t)n.has(c)?e(a,n.get(c),`${o}.get(${c})`,r+1):i(`Map instance with key ${c}`,`Map instance without key ${c}`,o,r);else i("Map instance","other value",o,r);else if(n instanceof Map)i("other value","Map instance",o,r);else if(t instanceof Set)if(n instanceof Set)if(t.size!==n.size)i(`Set instance with size ${t.size}`,`Set instance with size ${n.size}`,o,r);else for(const e of n)t.has(e)||i(`Set instance without element ${e}`,`Set instance with element ${e}`,o,r);else i("Set instance","other value",o,r);else if(n instanceof Set)i("other value","Set instance",o,r);else if(c||s)if(c!==s)i("type "+(c?"array":"object"),"type "+(s?"array":"object"),o,r);else if(t.length!==n.length)i(`array with length ${t.length}`,`array with length ${n.length}`,o,r);else for(let c=0;c<t.length;c++)e(t[c],n[c],`${o}[${c}]`,r+1);else if(a(t)||a(n))a(t)!==a(n)?i("type "+(a(t)?"React element":"object"),"type "+(a(n)?"React element":"object"),o,r):t.type!==n.type?i(`React element of type ${t.type}`,`React element of type ${n.type}`,o,r):e(t.props,n.props,`[props of ${o}]`,r+1);else{for(const e in n)e in t||i(`object without key ${e}`,`object with key ${e}`,o,r);for(const c in t)c in n?e(t[c],n[c],`${o}.${c}`,r+1):i(`object with key ${c}`,`object without key ${c}`,o,r)}}else{if("function"==typeof t)return;isNaN(t)||isNaN(n)?isNaN(t)!==isNaN(n)&&i(""+(isNaN(t)?"NaN":"non-NaN value"),""+(isNaN(n)?"NaN":"non-NaN value"),o,r):t!==n&&i(t,n,o,r)}}(e,t,"",0)},exports.c=u,exports.clearRenderCounterRegistry=function(){for(const e of y.values())e.forEach((e=>{e.count=0}))},exports.renderCounterRegistry=y,exports.useRenderCounter=function(e){const t=r(null);null!=t.current&&(t.current.count+=1),c((()=>{if(null==t.current){const n={count:0};!function(e,t){let n=y.get(e);null==n&&(n=new Set,y.set(e,n)),n.add(t)}(e,n),t.current=n}return()=>{null!==t.current&&function(e,t){const n=y.get(e);null!=n&&n.delete(t)}(e,t.current)}}))}; | ||
"use no memo"; | ||
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/index.ts | ||
var index_exports = {}; | ||
__export(index_exports, { | ||
$dispatcherGuard: () => $dispatcherGuard, | ||
$makeReadOnly: () => $makeReadOnly, | ||
$reset: () => $reset, | ||
$structuralCheck: () => $structuralCheck, | ||
c: () => c, | ||
clearRenderCounterRegistry: () => clearRenderCounterRegistry, | ||
renderCounterRegistry: () => renderCounterRegistry, | ||
useRenderCounter: () => useRenderCounter | ||
}); | ||
module.exports = __toCommonJS(index_exports); | ||
var React = __toESM(require("react")); | ||
var { useRef, useEffect, isValidElement } = React; | ||
var _a; | ||
var ReactSecretInternals = ( | ||
//@ts-ignore | ||
(_a = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) != null ? _a : React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED | ||
); | ||
var $empty = Symbol.for("react.memo_cache_sentinel"); | ||
var _a2; | ||
var c = ( | ||
// @ts-expect-error | ||
typeof ((_a2 = React.__COMPILER_RUNTIME) == null ? void 0 : _a2.c) === "function" ? ( | ||
// @ts-expect-error | ||
React.__COMPILER_RUNTIME.c | ||
) : function c2(size) { | ||
return React.useMemo(() => { | ||
const $ = new Array(size); | ||
for (let ii = 0; ii < size; ii++) { | ||
$[ii] = $empty; | ||
} | ||
$[$empty] = true; | ||
return $; | ||
}, []); | ||
} | ||
); | ||
var LazyGuardDispatcher = {}; | ||
[ | ||
"readContext", | ||
"useCallback", | ||
"useContext", | ||
"useEffect", | ||
"useImperativeHandle", | ||
"useInsertionEffect", | ||
"useLayoutEffect", | ||
"useMemo", | ||
"useReducer", | ||
"useRef", | ||
"useState", | ||
"useDebugValue", | ||
"useDeferredValue", | ||
"useTransition", | ||
"useMutableSource", | ||
"useSyncExternalStore", | ||
"useId", | ||
"unstable_isNewReconciler", | ||
"getCacheSignal", | ||
"getCacheForType", | ||
"useCacheRefresh" | ||
].forEach((name) => { | ||
LazyGuardDispatcher[name] = () => { | ||
throw new Error( | ||
`[React] Unexpected React hook call (${name}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') ` | ||
); | ||
}; | ||
}); | ||
var originalDispatcher = null; | ||
LazyGuardDispatcher["useMemoCache"] = (count) => { | ||
if (originalDispatcher == null) { | ||
throw new Error( | ||
"React Compiler internal invariant violation: unexpected null dispatcher" | ||
); | ||
} else { | ||
return originalDispatcher.useMemoCache(count); | ||
} | ||
}; | ||
function setCurrent(newDispatcher) { | ||
ReactSecretInternals.ReactCurrentDispatcher.current = newDispatcher; | ||
return ReactSecretInternals.ReactCurrentDispatcher.current; | ||
} | ||
var guardFrames = []; | ||
function $dispatcherGuard(kind) { | ||
const curr = ReactSecretInternals.ReactCurrentDispatcher.current; | ||
if (kind === 0 /* PushGuardContext */) { | ||
guardFrames.push(curr); | ||
if (guardFrames.length === 1) { | ||
originalDispatcher = curr; | ||
} | ||
if (curr === LazyGuardDispatcher) { | ||
throw new Error( | ||
`[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked.` | ||
); | ||
} | ||
setCurrent(LazyGuardDispatcher); | ||
} else if (kind === 1 /* PopGuardContext */) { | ||
const lastFrame = guardFrames.pop(); | ||
if (lastFrame == null) { | ||
throw new Error( | ||
"React Compiler internal error: unexpected null in guard stack" | ||
); | ||
} | ||
if (guardFrames.length === 0) { | ||
originalDispatcher = null; | ||
} | ||
setCurrent(lastFrame); | ||
} else if (kind === 2 /* PushExpectHook */) { | ||
guardFrames.push(curr); | ||
setCurrent(originalDispatcher); | ||
} else if (kind === 3 /* PopExpectHook */) { | ||
const lastFrame = guardFrames.pop(); | ||
if (lastFrame == null) { | ||
throw new Error( | ||
"React Compiler internal error: unexpected null in guard stack" | ||
); | ||
} | ||
setCurrent(lastFrame); | ||
} else { | ||
throw new Error("React Compiler internal error: unreachable block" + kind); | ||
} | ||
} | ||
function $reset($) { | ||
for (let ii = 0; ii < $.length; ii++) { | ||
$[ii] = $empty; | ||
} | ||
} | ||
function $makeReadOnly() { | ||
throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime"); | ||
} | ||
var renderCounterRegistry = /* @__PURE__ */ new Map(); | ||
function clearRenderCounterRegistry() { | ||
for (const counters of renderCounterRegistry.values()) { | ||
counters.forEach((counter) => { | ||
counter.count = 0; | ||
}); | ||
} | ||
} | ||
function registerRenderCounter(name, val) { | ||
let counters = renderCounterRegistry.get(name); | ||
if (counters == null) { | ||
counters = /* @__PURE__ */ new Set(); | ||
renderCounterRegistry.set(name, counters); | ||
} | ||
counters.add(val); | ||
} | ||
function removeRenderCounter(name, val) { | ||
const counters = renderCounterRegistry.get(name); | ||
if (counters == null) { | ||
return; | ||
} | ||
counters.delete(val); | ||
} | ||
function useRenderCounter(name) { | ||
const val = useRef(null); | ||
if (val.current != null) { | ||
val.current.count += 1; | ||
} | ||
useEffect(() => { | ||
if (val.current == null) { | ||
const counter = { count: 0 }; | ||
registerRenderCounter(name, counter); | ||
val.current = counter; | ||
} | ||
return () => { | ||
if (val.current !== null) { | ||
removeRenderCounter(name, val.current); | ||
} | ||
}; | ||
}); | ||
} | ||
var seenErrors = /* @__PURE__ */ new Set(); | ||
function $structuralCheck(oldValue, newValue, variableName, fnName, kind, loc) { | ||
function error(l, r, path, depth) { | ||
const str = `${fnName}:${loc} [${kind}] ${variableName}${path} changed from ${l} to ${r} at depth ${depth}`; | ||
if (seenErrors.has(str)) { | ||
return; | ||
} | ||
seenErrors.add(str); | ||
console.error(str); | ||
} | ||
const depthLimit = 2; | ||
function recur(oldValue2, newValue2, path, depth) { | ||
if (depth > depthLimit) { | ||
return; | ||
} else if (oldValue2 === newValue2) { | ||
return; | ||
} else if (typeof oldValue2 !== typeof newValue2) { | ||
error(`type ${typeof oldValue2}`, `type ${typeof newValue2}`, path, depth); | ||
} else if (typeof oldValue2 === "object") { | ||
const oldArray = Array.isArray(oldValue2); | ||
const newArray = Array.isArray(newValue2); | ||
if (oldValue2 === null && newValue2 !== null) { | ||
error("null", `type ${typeof newValue2}`, path, depth); | ||
} else if (newValue2 === null) { | ||
error(`type ${typeof oldValue2}`, "null", path, depth); | ||
} else if (oldValue2 instanceof Map) { | ||
if (!(newValue2 instanceof Map)) { | ||
error(`Map instance`, `other value`, path, depth); | ||
} else if (oldValue2.size !== newValue2.size) { | ||
error( | ||
`Map instance with size ${oldValue2.size}`, | ||
`Map instance with size ${newValue2.size}`, | ||
path, | ||
depth | ||
); | ||
} else { | ||
for (const [k, v] of oldValue2) { | ||
if (!newValue2.has(k)) { | ||
error( | ||
`Map instance with key ${k}`, | ||
`Map instance without key ${k}`, | ||
path, | ||
depth | ||
); | ||
} else { | ||
recur(v, newValue2.get(k), `${path}.get(${k})`, depth + 1); | ||
} | ||
} | ||
} | ||
} else if (newValue2 instanceof Map) { | ||
error("other value", `Map instance`, path, depth); | ||
} else if (oldValue2 instanceof Set) { | ||
if (!(newValue2 instanceof Set)) { | ||
error(`Set instance`, `other value`, path, depth); | ||
} else if (oldValue2.size !== newValue2.size) { | ||
error( | ||
`Set instance with size ${oldValue2.size}`, | ||
`Set instance with size ${newValue2.size}`, | ||
path, | ||
depth | ||
); | ||
} else { | ||
for (const v of newValue2) { | ||
if (!oldValue2.has(v)) { | ||
error( | ||
`Set instance without element ${v}`, | ||
`Set instance with element ${v}`, | ||
path, | ||
depth | ||
); | ||
} | ||
} | ||
} | ||
} else if (newValue2 instanceof Set) { | ||
error("other value", `Set instance`, path, depth); | ||
} else if (oldArray || newArray) { | ||
if (oldArray !== newArray) { | ||
error( | ||
`type ${oldArray ? "array" : "object"}`, | ||
`type ${newArray ? "array" : "object"}`, | ||
path, | ||
depth | ||
); | ||
} else if (oldValue2.length !== newValue2.length) { | ||
error( | ||
`array with length ${oldValue2.length}`, | ||
`array with length ${newValue2.length}`, | ||
path, | ||
depth | ||
); | ||
} else { | ||
for (let ii = 0; ii < oldValue2.length; ii++) { | ||
recur(oldValue2[ii], newValue2[ii], `${path}[${ii}]`, depth + 1); | ||
} | ||
} | ||
} else if (isValidElement(oldValue2) || isValidElement(newValue2)) { | ||
if (isValidElement(oldValue2) !== isValidElement(newValue2)) { | ||
error( | ||
`type ${isValidElement(oldValue2) ? "React element" : "object"}`, | ||
`type ${isValidElement(newValue2) ? "React element" : "object"}`, | ||
path, | ||
depth | ||
); | ||
} else if (oldValue2.type !== newValue2.type) { | ||
error( | ||
`React element of type ${oldValue2.type}`, | ||
`React element of type ${newValue2.type}`, | ||
path, | ||
depth | ||
); | ||
} else { | ||
recur( | ||
oldValue2.props, | ||
newValue2.props, | ||
`[props of ${path}]`, | ||
depth + 1 | ||
); | ||
} | ||
} else { | ||
for (const key in newValue2) { | ||
if (!(key in oldValue2)) { | ||
error( | ||
`object without key ${key}`, | ||
`object with key ${key}`, | ||
path, | ||
depth | ||
); | ||
} | ||
} | ||
for (const key in oldValue2) { | ||
if (!(key in newValue2)) { | ||
error( | ||
`object with key ${key}`, | ||
`object without key ${key}`, | ||
path, | ||
depth | ||
); | ||
} else { | ||
recur(oldValue2[key], newValue2[key], `${path}.${key}`, depth + 1); | ||
} | ||
} | ||
} | ||
} else if (typeof oldValue2 === "function") { | ||
return; | ||
} else if (isNaN(oldValue2) || isNaN(newValue2)) { | ||
if (isNaN(oldValue2) !== isNaN(newValue2)) { | ||
error( | ||
`${isNaN(oldValue2) ? "NaN" : "non-NaN value"}`, | ||
`${isNaN(newValue2) ? "NaN" : "non-NaN value"}`, | ||
path, | ||
depth | ||
); | ||
} | ||
} else if (oldValue2 !== newValue2) { | ||
error(oldValue2, newValue2, path, depth); | ||
} | ||
} | ||
recur(oldValue, newValue, "", 0); | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
$dispatcherGuard, | ||
$makeReadOnly, | ||
$reset, | ||
$structuralCheck, | ||
c, | ||
clearRenderCounterRegistry, | ||
renderCounterRegistry, | ||
useRenderCounter | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "react-compiler-runtime", | ||
"version": "0.0.0-experimental-fa06e2c-20241016", | ||
"version": "0.0.0-experimental-fa43e63-20250117", | ||
"description": "Runtime for React Compiler", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"files": [ | ||
@@ -12,7 +13,8 @@ "dist", | ||
"peerDependencies": { | ||
"react": "^18.2.0 || ^19.0.0" | ||
"react": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^0.0.0-experimental" | ||
}, | ||
"scripts": { | ||
"build": "rimraf dist && rollup --config --bundleConfigAsCjs", | ||
"test": "echo 'no tests'" | ||
"build": "rimraf dist && scripts/build.js", | ||
"test": "echo 'no tests'", | ||
"watch": "scripts/build.js --watch" | ||
}, | ||
@@ -19,0 +21,0 @@ "repository": { |
@@ -8,4 +8,2 @@ /** | ||
'use no forget'; | ||
import * as React from 'react'; | ||
@@ -71,3 +69,3 @@ | ||
throw new Error( | ||
`[React] Unexpected React hook call (${name}) from a React Forget compiled function. ` + | ||
`[React] Unexpected React hook call (${name}) from a React compiled function. ` + | ||
"Check that all hooks are called directly and named according to convention ('use[A-Z]') ", | ||
@@ -84,3 +82,3 @@ ); | ||
throw new Error( | ||
'React Forget internal invariant violation: unexpected null dispatcher', | ||
'React Compiler internal invariant violation: unexpected null dispatcher', | ||
); | ||
@@ -109,8 +107,8 @@ } else { | ||
* of the no-conditional-hook-calls rule. | ||
* As Forget needs to statically understand which calls to move out of | ||
* conditional branches (i.e. Forget cannot memoize the results of hook | ||
* As React Compiler needs to statically understand which calls to move out of | ||
* conditional branches (i.e. React Compiler cannot memoize the results of hook | ||
* calls), its understanding of "the rules of React" are more restrictive. | ||
* This validation throws on unsound inputs at runtime. | ||
* | ||
* Components should only be invoked through React as Forget could memoize | ||
* Components should only be invoked through React as React Compiler could memoize | ||
* the call to AnotherComponent, introducing conditional hook calls in its | ||
@@ -155,3 +153,3 @@ * compiled output. | ||
throw new Error( | ||
`[React] Unexpected call to custom hook or component from a React Forget compiled function. ` + | ||
`[React] Unexpected call to custom hook or component from a React compiled function. ` + | ||
"Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') " + | ||
@@ -168,3 +166,3 @@ 'and (2) components are returned as JSX instead of being directly invoked.', | ||
throw new Error( | ||
'React Forget internal error: unexpected null in guard stack', | ||
'React Compiler internal error: unexpected null in guard stack', | ||
); | ||
@@ -185,3 +183,3 @@ } | ||
throw new Error( | ||
'React Forget internal error: unexpected null in guard stack', | ||
'React Compiler internal error: unexpected null in guard stack', | ||
); | ||
@@ -191,3 +189,3 @@ } | ||
} else { | ||
throw new Error('Forget internal error: unreachable block' + kind); | ||
throw new Error('React Compiler internal error: unreachable block' + kind); | ||
} | ||
@@ -194,0 +192,0 @@ } |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
45826
800
3