@vxrn/react-native-prebuilt 2.0.0-beta.33.1 → 2.0.0-beta.45.1
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/dist/cjs/index.cjs +329 -205
- package/dist/cjs/index.native.cjs +433 -0
- package/dist/cjs/index.native.js +341 -215
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/index.js +315 -182
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +315 -182
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +325 -191
- package/dist/esm/index.native.js.map +1 -1
- package/package.json +5 -5
- package/dist/cjs/index.test.cjs +0 -34
- package/dist/cjs/index.test.native.js +0 -37
- package/dist/cjs/index.test.native.js.map +0 -1
- package/dist/esm/index.test.mjs +0 -11
- package/dist/esm/index.test.mjs.map +0 -1
- package/dist/esm/index.test.native.js +0 -11
- package/dist/esm/index.test.native.js.map +0 -1
- package/types/index.test.d.ts +0 -2
- package/types/index.test.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","RExports","RNExportNames","buildReact","buildReactJSX","buildReactNative","module","exports","import_utils","require","import_vite_flow","import_esbuild","import_fs_extra","__toESM","import_promises","import_module","import_meta","requireResolve","createRequire","url","resolve","external","options","arguments","length","_options_define","isProd","define","build","bundle","entryPoints","format","target","jsx","jsxFactory","allowOverwrite","platform","__DEV__","logLevel","then","bundled","readFile","outfile","outCode","mustReplace","find","replace","optional","map","n","join","default","writeFile","loader","resolveExtensions","plugins","name","setup","build2","onResolve","filter","input","path","possibleEsmPath","pathExistsSync","onLoad","includes","code","outagain","transformFlowBabel","development","endsWith","trim","contents","esbuildCommonJSFunction"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAA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A;MACHC,OAAA,GAEM,0BAA0B;MAAA;MAAA;MAAA;MAAA,aAQnB,CAAAI,IAAA;IACX;IACA;IACA;MACAL,IAAA;MACAC,OAAA;IACA,EACA;AAAA;AACA;AACA;AACA,mGAHA,CAIA;IACA;AAAA,MACA5C,aAAA,CAAA8C,GAAA,WAAAC,CAAA;MACA,uBAAAA,CAAA,SAAAA,CAAA;IACA,GAAAC,IAAA;AAAA;AACA,KACA;IACA,MAAAtC,eAAA,CAAAuC,OAAA,CAAAC,SAAA,CAAA9B,OAAA,CAAAoB,OAAA,EAAAC,OAAA;EACA;AAAA;AACA,IACA+B,uBAAA;AAAA;AACA;AACA;AACA;AACA;AACA,GACA;AAAA,IACAxE,aAAA,IACA,0BACA,qBACA,qBACA,UACA,uBACA,YACA,SACA,mBACA,sBACA,wBACA,SACA,aACA,kBACA,gBACA,cACA,eACA,aACA,UACA,QACA,aACA,aACA,sBACA,2BACA,oBACA,4BACA,QACA,mBACA,0BACA,kBACA,SACA,YACA,cACA,eACA,YACA,eACA,cACA,eACA,cACA,UACA,kBACA,eACA,sBACA,YACA,mBACA,WACA,UACA,8BACA,sBACA,cACA,gBACA,oCACF,YAEO,OAAM,EACX,cACA,YACA,gBACA,uBACA,aACA,2BACA,oBACA,0CACA,qCACA,uBACA,eACA,aACA,sBACA,mBACA,gBACA,yBACA,iBACA,YACA,iBACA,gBACA,0BACA,kBACA;AACA,IACAD,QAAA,IACA,YACA,aACA,YACA,YACA,iBACA,cACA,YACA;AACA;AACA;AACA;AAAA,gBAEA,iBACA,iBACA,iBACA,aACA,cACA,kBACF,Q","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n RExports: () => RExports,\n RNExportNames: () => RNExportNames,\n buildReact: () => buildReact,\n buildReactJSX: () => buildReactJSX,\n buildReactNative: () => buildReactNative\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_utils = require(\"@vxrn/utils\");\nvar import_vite_flow = require(\"@vxrn/vite-flow\");\nvar import_esbuild = require(\"esbuild\");\nvar import_fs_extra = __toESM(require(\"fs-extra\"), 1);\nvar import_promises = require(\"fs/promises\");\nvar import_module = require(\"module\");\nconst import_meta = {};\nvar requireResolve = \"url\" in import_meta ? (0, import_module.createRequire)(import_meta.url).resolve : require.resolve;\nvar external = [\n \"react\",\n \"react/jsx-runtime\",\n \"react/jsx-dev-runtime\"\n];\nasync function buildReactJSX() {\n var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var _options_define;\n var isProd = ((_options_define = options.define) === null || _options_define === void 0 ? void 0 : _options_define[\"__DEV__\"]) === \"false\";\n return (0, import_esbuild.build)({\n bundle: true,\n entryPoints: [\n requireResolve(\"react/jsx-dev-runtime\")\n ],\n format: \"cjs\",\n target: \"node16\",\n jsx: \"transform\",\n jsxFactory: \"react\",\n allowOverwrite: true,\n platform: \"node\",\n define: {\n __DEV__: \"true\",\n \"process.env.NODE_ENV\": `\"development\"`\n },\n external,\n logLevel: \"warning\",\n ...options\n }).then(async function() {\n var bundled = await (0, import_promises.readFile)(options.outfile, \"utf-8\");\n var outCode = `\n const run = () => {\n ${(0, import_utils.mustReplace)(bundled, [\n ...isProd ? [\n {\n // react 18 and 19 (18 has _min)\n find: /module\\.exports = require_react_jsx_runtime_production([a-z_]*)\\(\\);/,\n replace: `return require_react_jsx_runtime_production$1();`\n }\n ] : [\n {\n find: `module.exports = require_react_jsx_dev_runtime_development();`,\n replace: `return require_react_jsx_dev_runtime_development();`\n }\n ],\n {\n find: `process.env.VXRN_REACT_19`,\n replace: \"false\",\n optional: true\n },\n {\n find: `Object.assign(exports, eval(\"require('@vxrn/vendor/react-jsx-19')\"));`,\n optional: true,\n replace: ``\n }\n ])}\n }\n const __mod__ = run()\n ${[\n \"jsx\",\n \"jsxs\",\n \"jsxDEV\",\n \"Fragment\"\n ].map(function(n) {\n return `export const ${n} = __mod__.${n} || __mod__.jsx || ${(function() {\n if (n === \"jsxs\") {\n return \"function (type, props, key) { return __mod__.jsxDEV(type, props, key, true) }\";\n }\n return \"__mod__.jsxDEV\";\n })()}`;\n }).join(\"\\n\")}\n `;\n await import_fs_extra.default.writeFile(options.outfile, outCode);\n });\n}\nasync function buildReact() {\n var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n var _options_define;\n var isProd = ((_options_define = options.define) === null || _options_define === void 0 ? void 0 : _options_define[\"__DEV__\"]) === \"false\";\n return (0, import_esbuild.build)({\n bundle: true,\n entryPoints: [\n requireResolve(\"react\")\n ],\n format: \"cjs\",\n target: \"node16\",\n jsx: \"transform\",\n jsxFactory: \"react\",\n allowOverwrite: true,\n platform: \"node\",\n define: {\n __DEV__: \"true\",\n \"process.env.NODE_ENV\": `\"development\"`\n },\n logLevel: \"warning\",\n external,\n ...options\n }).then(async function() {\n var bundled = await (0, import_promises.readFile)(options.outfile, \"utf-8\");\n var outCode = `\n const run = () => {\n ${(0, import_utils.mustReplace)(bundled, [\n isProd ? {\n find: /module\\.exports = require_react_production([a-z_]*)\\(\\);/,\n replace: \"return require_react_production$1();\"\n } : {\n find: /module\\.exports = require_react_development([a-z_]*)\\(\\);/,\n replace: \"return require_react_development$1();\"\n },\n {\n find: `process.env.VXRN_REACT_19`,\n optional: true,\n replace: \"false\"\n },\n {\n find: `Object.assign(exports, eval(\"require('@vxrn/vendor/react-19')\"));`,\n optional: true,\n replace: ``\n }\n ])}\n }\n const __mod__ = run()\n ${RExports.map(function(n) {\n return `export const ${n} = __mod__.${n}`;\n }).join(\"\\n\")}\n export default __mod__\n `;\n await import_fs_extra.default.writeFile(options.outfile, outCode);\n });\n}\nasync function buildReactNative() {\n var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, { platform } = arguments.length > 1 ? arguments[1] : void 0;\n return (0, import_esbuild.build)({\n bundle: true,\n entryPoints: [\n requireResolve(\"react-native\")\n ],\n format: \"cjs\",\n target: \"node20\",\n allowOverwrite: true,\n platform: \"node\",\n external,\n loader: {\n \".png\": \"dataurl\",\n \".jpg\": \"dataurl\",\n \".jpeg\": \"dataurl\",\n \".gif\": \"dataurl\"\n },\n define: {\n __DEV__: \"true\",\n \"process.env.NODE_ENV\": `\"development\"`\n },\n logLevel: \"warning\",\n resolveExtensions: [\n `.${platform}.js`,\n \".native.js\",\n \".js\",\n \".jsx\",\n \".json\",\n \".mjs\"\n ],\n ...options,\n plugins: [\n {\n name: \"remove-flow\",\n setup(build2) {\n build2.onResolve({\n filter: /HMRClient/\n }, async function(input) {\n var path = requireResolve(\"@vxrn/vite-native-hmr\");\n var possibleEsmPath = path.replace(\"/cjs/index.cjs\", \"/esm/index.native.js\");\n if (import_fs_extra.default.pathExistsSync(possibleEsmPath)) {\n return {\n path: possibleEsmPath\n };\n }\n return {\n path\n };\n });\n build2.onLoad({\n filter: /.*\\.js$/\n }, async function(input) {\n if (!input.path.includes(\"react-native\") && !input.path.includes(`vite-native-hmr`)) {\n return;\n }\n var code = await (0, import_promises.readFile)(input.path, \"utf-8\");\n var outagain = await (0, import_vite_flow.transformFlowBabel)(code, {\n development: true,\n path: input.path\n });\n if (input.path.endsWith(\"react-native/index.js\")) {\n outagain = outagain.replace(/module\\.exports *= *{/, `\nmodule.exports = {\n get _vxrnInternalReactNativeVersionDoNotUse() {\n return require(\"./Libraries/Core/ReactNativeVersion\").default;\n },\n `.trim());\n }\n return {\n contents: outagain,\n loader: \"jsx\"\n };\n });\n }\n }\n ]\n }).then(async function() {\n var bundled = await (0, import_promises.readFile)(options.outfile, \"utf-8\");\n var outCode = `\n const run = () => {\n ${(0, import_utils.mustReplace)(bundled, [\n {\n find: esbuildCommonJSFunction,\n replace: `\n// replaced commonjs function to allow importing internals\nvar __commonJS = function __commonJS(cb, mod) {\n var path = __getOwnPropNames(cb)[0];\n var modulePath = path.replace(/.*node_modules\\\\//, '').replace('.js', '');\n\n var __require = function __require() {\n if (mod) return mod;\n\n var cachedMod = globalThis[\"__cachedModules\"][modulePath];\n if (cachedMod) return cachedMod;\n\n var moduleFn = cb[path];\n try {\n mod = {\n exports: {}\n };\n moduleFn(mod.exports, mod);\n mod = mod.exports;\n } catch (e) {\n // match esbuild: don't leave a half-initialized module cached\n throw mod = 0, e;\n }\n // this is one of our patches basically allowing importing the inner contents:\n globalThis[\"__cachedModules\"][modulePath] = mod;\n return mod;\n };\n\n // this is another patch basically allowing importing the inner contents:\n if (globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__']) {\n globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__'][modulePath] = __require;\n }\n\n return __require;\n};\n`\n },\n {\n find: /module\\.exports = require_(react_native|index)\\(\\);/,\n replace: [\n `const rn = require_$1();`,\n `rn.AssetRegistry = require_registry();`,\n `require_ReactFabric();`,\n // This is react-native/Libraries/Renderer/shims/ReactFabric.js, we call it here to ensure shims are initialized since we won't lazy load React Native components. See the NOTE below.\n `if (typeof require_InitializeCore === 'function') { require_InitializeCore(); }`,\n // Since we're accessing the RefreshRuntime directly via `__cachedModules` directly in the RN bundle, we need to ensure it's loaded in time. Note that calling `require_react_refresh_runtime_development()`, `require_setUpReactRefresh()` or `require_setUpDeveloperTools()` directly won't work.\n `return rn;`\n ].join(\"\\n\")\n },\n // improve error logs a lot including stack of original error\n {\n find: `originalMessage = e.message || \"\";`,\n replace: `originalMessage = \"\" + (e.stack || \"\");`\n }\n ])}\n }\n const RN = run()\n\n export const REACT_NATIVE_ESM_MANUAL_EXPORTS_START = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_START';${/* NOTE: The `REACT_NATIVE_ESM_MANUAL_EXPORTS_*` vars here are used by other tools to replace exports in this section with a CJS `module.export` which supports dynamic loaded lazy exports, if CJS can be used - such as in a React Native bundle. */\n \"\"}\n ${RNExportNames.map(function(n) {\n return `export const ${n} = RN.${n}`;\n }).join(\"\\n\")}\n export const REACT_NATIVE_ESM_MANUAL_EXPORTS_END = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_END';\n `;\n await import_fs_extra.default.writeFile(options.outfile, outCode);\n });\n}\nvar esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function __require() {\n try {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n } catch (e) {\n throw mod = 0, e;\n }\n};`;\nvar RNExportNames = [\n \"registerCallableModule\",\n \"AccessibilityInfo\",\n \"ActivityIndicator\",\n \"Button\",\n \"DrawerLayoutAndroid\",\n \"FlatList\",\n \"Image\",\n \"ImageBackground\",\n \"InputAccessoryView\",\n \"KeyboardAvoidingView\",\n \"Modal\",\n \"Pressable\",\n \"RefreshControl\",\n \"SafeAreaView\",\n \"ScrollView\",\n \"SectionList\",\n \"StatusBar\",\n \"Switch\",\n \"Text\",\n \"TextInput\",\n \"Touchable\",\n \"TouchableHighlight\",\n \"TouchableNativeFeedback\",\n \"TouchableOpacity\",\n \"TouchableWithoutFeedback\",\n \"View\",\n \"VirtualizedList\",\n \"VirtualizedSectionList\",\n \"ActionSheetIOS\",\n \"Alert\",\n \"Animated\",\n \"Appearance\",\n \"AppRegistry\",\n \"AppState\",\n \"BackHandler\",\n \"DeviceInfo\",\n \"DevSettings\",\n \"Dimensions\",\n \"Easing\",\n \"findNodeHandle\",\n \"I18nManager\",\n \"InteractionManager\",\n \"Keyboard\",\n \"LayoutAnimation\",\n \"Linking\",\n \"LogBox\",\n \"NativeDialogManagerAndroid\",\n \"NativeEventEmitter\",\n \"Networking\",\n \"PanResponder\",\n \"PermissionsAndroid\",\n \"PixelRatio\",\n \"Settings\",\n \"Share\",\n \"StyleSheet\",\n \"Systrace\",\n \"ToastAndroid\",\n \"TurboModuleRegistry\",\n \"UIManager\",\n \"unstable_batchedUpdates\",\n \"useAnimatedValue\",\n \"useAnimatedValueXY\",\n \"useAnimatedColor\",\n \"useColorScheme\",\n \"usePressability\",\n \"useWindowDimensions\",\n \"UTFSequence\",\n \"Vibration\",\n \"DeviceEventEmitter\",\n \"DynamicColorIOS\",\n \"EventEmitter\",\n \"NativeAppEventEmitter\",\n \"NativeModules\",\n \"Platform\",\n \"PlatformColor\",\n \"processColor\",\n \"requireNativeComponent\",\n \"RootTagContext\",\n \"AssetRegistry\"\n];\nvar RExports = [\n \"Children\",\n \"Component\",\n \"Fragment\",\n \"Profiler\",\n \"PureComponent\",\n \"StrictMode\",\n \"Suspense\",\n \"__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\",\n // For React 18\n \"__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE\",\n // For React 19\n \"cloneElement\",\n \"createContext\",\n \"createElement\",\n \"createFactory\",\n \"createRef\",\n \"forwardRef\",\n \"isValidElement\",\n \"lazy\",\n \"memo\",\n \"startTransition\",\n \"unstable_act\",\n \"useCallback\",\n \"useContext\",\n \"useDebugValue\",\n \"useDeferredValue\",\n \"useEffect\",\n \"useId\",\n \"useImperativeHandle\",\n \"useInsertionEffect\",\n \"useLayoutEffect\",\n \"useMemo\",\n \"useReducer\",\n \"useRef\",\n \"useState\",\n \"useSyncExternalStore\",\n \"useTransition\",\n \"version\",\n // Added in React 19\n \"act\",\n \"cache\",\n \"unstable_useCacheRefresh\",\n \"use\",\n \"useActionState\",\n \"useOptimistic\"\n];\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAA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M,MAAM;KACd,CAAC;KACD,IAAI,MAAM,KAAK,SAAS,uBAAuB,GAAG;MAChD,WAAW,SAAS,QAAQ,yBAAyB;;;;;oBAK/C,KAAK,CAAC;KACd;KACA,OAAO;MACL,UAAU;MACV,QAAQ;KACV;IACF,CAAC;GACH;EACF,CACF;CACF,CAAC,CAAC,CAAC,KAAK,iBAAiB;EACvB,IAAI,UAAU,OAAO,GAAG,gBAAgB,SAAQ,CAAE,QAAQ,SAAS,OAAO;EAC1E,IAAI,UAAU;;SAET,GAAG,aAAa,YAAW,CAAE,SAAS;GACzC;IACE,MAAM;IACN,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCX;GACA;IACE,MAAM;IACN,SAAS;KACP;KACA;KACA;KAEA;KAEA;IACF,CAAC,CAAC,KAAK,IAAI;GACb;GAEA;IACE,MAAM;IACN,SAAS;GACX;EACF,CAAC,EAAE;;;;mGAKH,GAAG;MACD,cAAc,IAAI,SAAS,GAAG;GAC9B,OAAO,gBAAgB,EAAE,QAAQ;EACnC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;;;EAGd,MAAM,gBAAgB,QAAQ,UAAU,QAAQ,SAAS,OAAO;CAClE,CAAC;AACH;AACA,IAAI,0BAA0B;;;;;;;AAO9B,IAAI,gBAAgB;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAI,WAAW;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,183 +4,198 @@ import { build } from "esbuild";
|
|
|
4
4
|
import FSExtra from "fs-extra";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
|
+
|
|
7
8
|
const requireResolve = "url" in import.meta ? createRequire(import.meta.url).resolve : require.resolve;
|
|
8
|
-
const external = [
|
|
9
|
+
const external = [
|
|
10
|
+
"react",
|
|
11
|
+
"react/jsx-runtime",
|
|
12
|
+
"react/jsx-dev-runtime"
|
|
13
|
+
];
|
|
9
14
|
async function buildReactJSX(options = {}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
const isProd = options.define?.["__DEV__"] === "false";
|
|
16
|
+
return build({
|
|
17
|
+
bundle: true,
|
|
18
|
+
entryPoints: [requireResolve("react/jsx-dev-runtime")],
|
|
19
|
+
format: "cjs",
|
|
20
|
+
target: "node16",
|
|
21
|
+
jsx: "transform",
|
|
22
|
+
jsxFactory: "react",
|
|
23
|
+
allowOverwrite: true,
|
|
24
|
+
platform: "node",
|
|
25
|
+
define: {
|
|
26
|
+
__DEV__: "true",
|
|
27
|
+
"process.env.NODE_ENV": `"development"`
|
|
28
|
+
},
|
|
29
|
+
external,
|
|
30
|
+
logLevel: "warning",
|
|
31
|
+
...options
|
|
32
|
+
}).then(async () => {
|
|
33
|
+
const bundled = await readFile(options.outfile, "utf-8");
|
|
34
|
+
const outCode = `
|
|
30
35
|
const run = () => {
|
|
31
|
-
${mustReplace(bundled, [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
${mustReplace(bundled, [
|
|
37
|
+
...isProd ? [{
|
|
38
|
+
find: /module\.exports = require_react_jsx_runtime_production([a-z_]*)\(\);/,
|
|
39
|
+
replace: `return require_react_jsx_runtime_production$1();`
|
|
40
|
+
}] : [{
|
|
41
|
+
find: `module.exports = require_react_jsx_dev_runtime_development();`,
|
|
42
|
+
replace: `return require_react_jsx_dev_runtime_development();`
|
|
43
|
+
}],
|
|
44
|
+
{
|
|
45
|
+
find: `process.env.VXRN_REACT_19`,
|
|
46
|
+
replace: "false",
|
|
47
|
+
optional: true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
find: `Object.assign(exports, eval("require('@vxrn/vendor/react-jsx-19')"));`,
|
|
51
|
+
optional: true,
|
|
52
|
+
replace: ``
|
|
53
|
+
}
|
|
54
|
+
])}
|
|
47
55
|
}
|
|
48
56
|
const __mod__ = run()
|
|
49
|
-
${[
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
${[
|
|
58
|
+
"jsx",
|
|
59
|
+
"jsxs",
|
|
60
|
+
"jsxDEV",
|
|
61
|
+
"Fragment"
|
|
62
|
+
].map((n) => `export const ${n} = __mod__.${n} || __mod__.jsx || ${(() => {
|
|
63
|
+
if (n === "jsxs") {
|
|
64
|
+
return "function (type, props, key) { return __mod__.jsxDEV(type, props, key, true) }";
|
|
65
|
+
}
|
|
66
|
+
return "__mod__.jsxDEV";
|
|
67
|
+
})()}`).join("\n")}
|
|
55
68
|
`;
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
70
|
+
});
|
|
58
71
|
}
|
|
59
72
|
async function buildReact(options = {}) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
const isProd = options.define?.["__DEV__"] === "false";
|
|
74
|
+
return build({
|
|
75
|
+
bundle: true,
|
|
76
|
+
entryPoints: [requireResolve("react")],
|
|
77
|
+
format: "cjs",
|
|
78
|
+
target: "node16",
|
|
79
|
+
jsx: "transform",
|
|
80
|
+
jsxFactory: "react",
|
|
81
|
+
allowOverwrite: true,
|
|
82
|
+
platform: "node",
|
|
83
|
+
define: {
|
|
84
|
+
__DEV__: "true",
|
|
85
|
+
"process.env.NODE_ENV": `"development"`
|
|
86
|
+
},
|
|
87
|
+
logLevel: "warning",
|
|
88
|
+
external,
|
|
89
|
+
...options
|
|
90
|
+
}).then(async () => {
|
|
91
|
+
const bundled = await readFile(options.outfile, "utf-8");
|
|
92
|
+
const outCode = `
|
|
80
93
|
const run = () => {
|
|
81
|
-
${mustReplace(bundled, [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
${mustReplace(bundled, [
|
|
95
|
+
isProd ? {
|
|
96
|
+
find: /module\.exports = require_react_production([a-z_]*)\(\);/,
|
|
97
|
+
replace: "return require_react_production$1();"
|
|
98
|
+
} : {
|
|
99
|
+
find: /module\.exports = require_react_development([a-z_]*)\(\);/,
|
|
100
|
+
replace: "return require_react_development$1();"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
find: `process.env.VXRN_REACT_19`,
|
|
104
|
+
optional: true,
|
|
105
|
+
replace: "false"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
find: `Object.assign(exports, eval("require('@vxrn/vendor/react-19')"));`,
|
|
109
|
+
optional: true,
|
|
110
|
+
replace: ``
|
|
111
|
+
}
|
|
112
|
+
])}
|
|
96
113
|
}
|
|
97
114
|
const __mod__ = run()
|
|
98
|
-
${RExports.map(n => `export const ${n} = __mod__.${n}`).join("\n")}
|
|
115
|
+
${RExports.map((n) => `export const ${n} = __mod__.${n}`).join("\n")}
|
|
99
116
|
export default __mod__
|
|
100
117
|
`;
|
|
101
|
-
|
|
102
|
-
|
|
118
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
119
|
+
});
|
|
103
120
|
}
|
|
104
|
-
async function buildReactNative(options = {}, {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
if (input.path.endsWith("react-native/index.js")) {
|
|
157
|
-
outagain = outagain.replace(/module\.exports *= *{/, `
|
|
121
|
+
async function buildReactNative(options = {}, { platform }) {
|
|
122
|
+
return build({
|
|
123
|
+
bundle: true,
|
|
124
|
+
entryPoints: [requireResolve("react-native")],
|
|
125
|
+
format: "cjs",
|
|
126
|
+
target: "node20",
|
|
127
|
+
allowOverwrite: true,
|
|
128
|
+
platform: "node",
|
|
129
|
+
external,
|
|
130
|
+
loader: {
|
|
131
|
+
".png": "dataurl",
|
|
132
|
+
".jpg": "dataurl",
|
|
133
|
+
".jpeg": "dataurl",
|
|
134
|
+
".gif": "dataurl"
|
|
135
|
+
},
|
|
136
|
+
define: {
|
|
137
|
+
__DEV__: "true",
|
|
138
|
+
"process.env.NODE_ENV": `"development"`
|
|
139
|
+
},
|
|
140
|
+
logLevel: "warning",
|
|
141
|
+
resolveExtensions: [
|
|
142
|
+
`.${platform}.js`,
|
|
143
|
+
".native.js",
|
|
144
|
+
".js",
|
|
145
|
+
".jsx",
|
|
146
|
+
".json",
|
|
147
|
+
".mjs"
|
|
148
|
+
],
|
|
149
|
+
...options,
|
|
150
|
+
plugins: [{
|
|
151
|
+
name: "remove-flow",
|
|
152
|
+
setup(build2) {
|
|
153
|
+
build2.onResolve({ filter: /HMRClient/ }, async (input) => {
|
|
154
|
+
const path = requireResolve("@vxrn/vite-native-hmr");
|
|
155
|
+
const possibleEsmPath = path.replace("/cjs/index.cjs", "/esm/index.native.js");
|
|
156
|
+
if (FSExtra.pathExistsSync(possibleEsmPath)) {
|
|
157
|
+
return { path: possibleEsmPath };
|
|
158
|
+
}
|
|
159
|
+
return { path };
|
|
160
|
+
});
|
|
161
|
+
build2.onLoad({ filter: /.*\.js$/ }, async (input) => {
|
|
162
|
+
if (!input.path.includes("react-native") && !input.path.includes(`vite-native-hmr`)) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const code = await readFile(input.path, "utf-8");
|
|
166
|
+
let outagain = await transformFlowBabel(code, {
|
|
167
|
+
development: true,
|
|
168
|
+
path: input.path
|
|
169
|
+
});
|
|
170
|
+
if (input.path.endsWith("react-native/index.js")) {
|
|
171
|
+
outagain = outagain.replace(/module\.exports *= *{/, `
|
|
158
172
|
module.exports = {
|
|
159
173
|
get _vxrnInternalReactNativeVersionDoNotUse() {
|
|
160
174
|
return require("./Libraries/Core/ReactNativeVersion").default;
|
|
161
175
|
},
|
|
162
176
|
`.trim());
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
contents: outagain,
|
|
180
|
+
loader: "jsx"
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}]
|
|
185
|
+
}).then(async () => {
|
|
186
|
+
const bundled = await readFile(options.outfile, "utf-8");
|
|
187
|
+
const outCode = `
|
|
174
188
|
const run = () => {
|
|
175
|
-
${mustReplace(bundled, [
|
|
176
|
-
|
|
177
|
-
|
|
189
|
+
${mustReplace(bundled, [
|
|
190
|
+
{
|
|
191
|
+
find: esbuildCommonJSFunction,
|
|
192
|
+
replace: `
|
|
178
193
|
// replaced commonjs function to allow importing internals
|
|
179
194
|
var __commonJS = function __commonJS(cb, mod) {
|
|
180
195
|
var path = __getOwnPropNames(cb)[0];
|
|
181
196
|
var modulePath = path.replace(/.*node_modules\\//, '').replace('.js', '');
|
|
182
197
|
|
|
183
|
-
var
|
|
198
|
+
var require = function require() {
|
|
184
199
|
if (mod) return mod;
|
|
185
200
|
|
|
186
201
|
var cachedMod = globalThis["__cachedModules"][modulePath];
|
|
@@ -204,52 +219,170 @@ var __commonJS = function __commonJS(cb, mod) {
|
|
|
204
219
|
|
|
205
220
|
// this is another patch basically allowing importing the inner contents:
|
|
206
221
|
if (globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__']) {
|
|
207
|
-
globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__'][modulePath] =
|
|
222
|
+
globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__'][modulePath] = require;
|
|
208
223
|
}
|
|
209
224
|
|
|
210
|
-
return
|
|
225
|
+
return require;
|
|
211
226
|
};
|
|
212
227
|
`
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
find: /module\.exports = require_(react_native|index)\(\);/,
|
|
231
|
+
replace: [
|
|
232
|
+
`const rn = require_$1();`,
|
|
233
|
+
`rn.AssetRegistry = require_registry();`,
|
|
234
|
+
`require_ReactFabric();`,
|
|
235
|
+
`if (typeof require_InitializeCore === 'function') { require_InitializeCore(); }`,
|
|
236
|
+
`return rn;`
|
|
237
|
+
].join("\n")
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
find: `originalMessage = e.message || "";`,
|
|
241
|
+
replace: `originalMessage = "" + (e.stack || "");`
|
|
242
|
+
}
|
|
243
|
+
])}
|
|
226
244
|
}
|
|
227
245
|
const RN = run()
|
|
228
246
|
|
|
229
|
-
export const REACT_NATIVE_ESM_MANUAL_EXPORTS_START = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_START';${
|
|
230
|
-
""}
|
|
231
|
-
${RNExportNames.map(n => `export const ${n} = RN.${n}`).join("\n")}
|
|
247
|
+
export const REACT_NATIVE_ESM_MANUAL_EXPORTS_START = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_START';${""}
|
|
248
|
+
${RNExportNames.map((n) => `export const ${n} = RN.${n}`).join("\n")}
|
|
232
249
|
export const REACT_NATIVE_ESM_MANUAL_EXPORTS_END = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_END';
|
|
233
250
|
`;
|
|
234
|
-
|
|
235
|
-
|
|
251
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
252
|
+
});
|
|
236
253
|
}
|
|
237
|
-
const esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function
|
|
254
|
+
const esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function require() {
|
|
238
255
|
try {
|
|
239
256
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
240
257
|
} catch (e) {
|
|
241
258
|
throw mod = 0, e;
|
|
242
259
|
}
|
|
243
260
|
};`;
|
|
244
|
-
const RNExportNames = [
|
|
245
|
-
|
|
261
|
+
const RNExportNames = [
|
|
262
|
+
"registerCallableModule",
|
|
263
|
+
"AccessibilityInfo",
|
|
264
|
+
"ActivityIndicator",
|
|
265
|
+
"Button",
|
|
266
|
+
"DrawerLayoutAndroid",
|
|
267
|
+
"FlatList",
|
|
268
|
+
"Image",
|
|
269
|
+
"ImageBackground",
|
|
270
|
+
"InputAccessoryView",
|
|
271
|
+
"KeyboardAvoidingView",
|
|
272
|
+
"Modal",
|
|
273
|
+
"Pressable",
|
|
274
|
+
"RefreshControl",
|
|
275
|
+
"SafeAreaView",
|
|
276
|
+
"ScrollView",
|
|
277
|
+
"SectionList",
|
|
278
|
+
"StatusBar",
|
|
279
|
+
"Switch",
|
|
280
|
+
"Text",
|
|
281
|
+
"TextInput",
|
|
282
|
+
"Touchable",
|
|
283
|
+
"TouchableHighlight",
|
|
284
|
+
"TouchableNativeFeedback",
|
|
285
|
+
"TouchableOpacity",
|
|
286
|
+
"TouchableWithoutFeedback",
|
|
287
|
+
"View",
|
|
288
|
+
"VirtualizedList",
|
|
289
|
+
"VirtualizedSectionList",
|
|
290
|
+
"ActionSheetIOS",
|
|
291
|
+
"Alert",
|
|
292
|
+
"Animated",
|
|
293
|
+
"Appearance",
|
|
294
|
+
"AppRegistry",
|
|
295
|
+
"AppState",
|
|
296
|
+
"BackHandler",
|
|
297
|
+
"DeviceInfo",
|
|
298
|
+
"DevSettings",
|
|
299
|
+
"Dimensions",
|
|
300
|
+
"Easing",
|
|
301
|
+
"findNodeHandle",
|
|
302
|
+
"I18nManager",
|
|
303
|
+
"InteractionManager",
|
|
304
|
+
"Keyboard",
|
|
305
|
+
"LayoutAnimation",
|
|
306
|
+
"Linking",
|
|
307
|
+
"LogBox",
|
|
308
|
+
"NativeDialogManagerAndroid",
|
|
309
|
+
"NativeEventEmitter",
|
|
310
|
+
"Networking",
|
|
311
|
+
"PanResponder",
|
|
312
|
+
"PermissionsAndroid",
|
|
313
|
+
"PixelRatio",
|
|
314
|
+
"Settings",
|
|
315
|
+
"Share",
|
|
316
|
+
"StyleSheet",
|
|
317
|
+
"Systrace",
|
|
318
|
+
"ToastAndroid",
|
|
319
|
+
"TurboModuleRegistry",
|
|
320
|
+
"UIManager",
|
|
321
|
+
"unstable_batchedUpdates",
|
|
322
|
+
"useAnimatedValue",
|
|
323
|
+
"useAnimatedValueXY",
|
|
324
|
+
"useAnimatedColor",
|
|
325
|
+
"useColorScheme",
|
|
326
|
+
"usePressability",
|
|
327
|
+
"useWindowDimensions",
|
|
328
|
+
"UTFSequence",
|
|
329
|
+
"Vibration",
|
|
330
|
+
"DeviceEventEmitter",
|
|
331
|
+
"DynamicColorIOS",
|
|
332
|
+
"EventEmitter",
|
|
333
|
+
"NativeAppEventEmitter",
|
|
334
|
+
"NativeModules",
|
|
335
|
+
"Platform",
|
|
336
|
+
"PlatformColor",
|
|
337
|
+
"processColor",
|
|
338
|
+
"requireNativeComponent",
|
|
339
|
+
"RootTagContext",
|
|
340
|
+
"AssetRegistry"
|
|
246
341
|
];
|
|
247
|
-
const RExports = [
|
|
248
|
-
|
|
249
|
-
"
|
|
250
|
-
|
|
251
|
-
"
|
|
252
|
-
|
|
253
|
-
"
|
|
342
|
+
const RExports = [
|
|
343
|
+
"Children",
|
|
344
|
+
"Component",
|
|
345
|
+
"Fragment",
|
|
346
|
+
"Profiler",
|
|
347
|
+
"PureComponent",
|
|
348
|
+
"StrictMode",
|
|
349
|
+
"Suspense",
|
|
350
|
+
"__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
|
|
351
|
+
"__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE",
|
|
352
|
+
"cloneElement",
|
|
353
|
+
"createContext",
|
|
354
|
+
"createElement",
|
|
355
|
+
"createFactory",
|
|
356
|
+
"createRef",
|
|
357
|
+
"forwardRef",
|
|
358
|
+
"isValidElement",
|
|
359
|
+
"lazy",
|
|
360
|
+
"memo",
|
|
361
|
+
"startTransition",
|
|
362
|
+
"unstable_act",
|
|
363
|
+
"useCallback",
|
|
364
|
+
"useContext",
|
|
365
|
+
"useDebugValue",
|
|
366
|
+
"useDeferredValue",
|
|
367
|
+
"useEffect",
|
|
368
|
+
"useId",
|
|
369
|
+
"useImperativeHandle",
|
|
370
|
+
"useInsertionEffect",
|
|
371
|
+
"useLayoutEffect",
|
|
372
|
+
"useMemo",
|
|
373
|
+
"useReducer",
|
|
374
|
+
"useRef",
|
|
375
|
+
"useState",
|
|
376
|
+
"useSyncExternalStore",
|
|
377
|
+
"useTransition",
|
|
378
|
+
"version",
|
|
379
|
+
"act",
|
|
380
|
+
"cache",
|
|
381
|
+
"unstable_useCacheRefresh",
|
|
382
|
+
"use",
|
|
383
|
+
"useActionState",
|
|
384
|
+
"useOptimistic"
|
|
385
|
+
];
|
|
386
|
+
|
|
254
387
|
export { RExports, RNExportNames, buildReact, buildReactJSX, buildReactNative };
|
|
255
388
|
//# sourceMappingURL=index.js.map
|