fix(plugins): avoid eager React Native spread during client evaluation
Spreading ReactNative at module scope evaluated getters for legacy or unlinked modules (such as PushNotificationIOS), which called new NativeEventEmitter(null) and crashed native startup. Pass ReactNative directly to runtimeRequire instead.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as React from "react";
|
||||
import * as ReactJsxRuntime from "react/jsx-runtime";
|
||||
// eslint-disable-next-line no-restricted-imports -- the plugin runtime replaces raw TextInput with Paseo's editing primitive below.
|
||||
// eslint-disable-next-line no-restricted-imports -- plugin client runtime injects host ReactNative.
|
||||
import * as ReactNative from "react-native";
|
||||
// eslint-disable-next-line no-restricted-imports -- plugin bundles receive TanStack's real runtime, not Paseo's query wrappers.
|
||||
import * as ReactQuery from "@tanstack/react-query";
|
||||
@@ -22,9 +22,6 @@ import { createPluginContext, type PluginRegistrationCollector } from "@paseo/pl
|
||||
import type { EvaluatedPlugin } from "./types";
|
||||
import type { ComponentType } from "react";
|
||||
import { resolvePluginIcon } from "./icons";
|
||||
import { EditingTextInput } from "@/components/ui/text-input";
|
||||
|
||||
const PluginReactNative = { ...ReactNative, TextInput: EditingTextInput };
|
||||
|
||||
const CONTRIBUTION_ID = /^[a-z][a-z0-9-]*$/;
|
||||
|
||||
@@ -151,7 +148,7 @@ export function evaluatePluginClientBundle(id: string, bundle: string): Evaluate
|
||||
const runtimeRequire = (name: string): unknown => {
|
||||
if (name === "react") return React;
|
||||
if (name === "react/jsx-runtime") return ReactJsxRuntime;
|
||||
if (name === "react-native") return PluginReactNative;
|
||||
if (name === "react-native") return ReactNative;
|
||||
if (name === "@paseo/plugin") {
|
||||
return {
|
||||
defineAttachmentSource,
|
||||
|
||||
Reference in New Issue
Block a user