@vxrn/react-native-prebuilt 2.0.0-beta.33.1 → 2.0.0-beta.46.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 +7 -7
- 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
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["mustReplace","transformFlowBabel","build","FSExtra","readFile","createRequire","requireResolve","import","meta","url","resolve","require","external","buildReactJSX","options","isProd","define","bundle","entryPoints","format","target","jsx","jsxFactory","allowOverwrite","platform","__DEV__","logLevel","then","bundled","outfile","outCode","find","replace","optional","map","n","join","writeFile","buildReact","RExports","buildReactNative","loader","resolveExtensions","plugins","name","setup","onResolve","filter","input","path","possibleEsmPath","pathExistsSync","onLoad","includes","code","outagain","development","endsWith","trim","contents","esbuildCommonJSFunction","RNExportNames"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,WAAA,QAAmB;AAC5B,SAASC,kBAAA,QAA0B;AACnC,SAASC,KAAA,QAAgC;AACzC,OAAOC,OAAA,MAAa;AACpB,SAASC,QAAA,QAAgB;AAEzB,SAASC,aAAA,QAAqB;AAE9B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AAQkC,SAAA,CAAUvB,OAAA,CAAQe,OAAA,EAAUC,OAAO;EACnD,CAAC;AACH;AAEA,MAAM8B,uBAAA,GAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQzB,MAAMC,aAAA,GAAgB,CAC3B,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,sBACA,cACA,YACA,SACA,cACA,YACA,gBACA,uBACA,aACA,2BACA,oBACA,sBACA,oBACA,kBACA,mBACA,uBACA,eACA,aACA,sBACA,mBACA,gBACA,yBACA,iBACA,YACA,iBACA,gBACA,0BACA,kBACA;AAAA;AAAA,CACF;AAEO,MAAMtB,QAAA,GAAW,CACtB,YACA,aACA,YACA,YACA,iBACA,cACA,YACA;AAAA;AACA;AAAA;AACA,gBACA,iBACA,iBACA,iBACA,aACA,cACA,kBACA,QACA,QACA,mBACA,gBACA,eACA,cACA,iBACA,oBACA,aACA,SACA,uBACA,sBACA,mBACA,WACA,cACA,UACA,YACA,wBACA,iBACA;AAAA;AAEA,OACA,SACA,4BACA,OACA,kBACA,gBACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { mustReplace } from \"@vxrn/utils\";\nimport { transformFlowBabel } from \"@vxrn/vite-flow\";\nimport { build } from \"esbuild\";\nimport FSExtra from \"fs-extra\";\nimport { readFile } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nconst requireResolve = \"url\" in import.meta ? createRequire(import.meta.url).resolve : require.resolve;\nconst external = [\"react\", \"react/jsx-runtime\", \"react/jsx-dev-runtime\"];\nasync function buildReactJSX(options = {}) {\n const isProd = options.define?.[\"__DEV__\"] === \"false\";\n return build({\n bundle: true,\n entryPoints: [requireResolve(\"react/jsx-dev-runtime\")],\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 () => {\n const bundled = await readFile(options.outfile, \"utf-8\");\n const outCode = `\n const run = () => {\n ${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 { find: `process.env.VXRN_REACT_19`, replace: \"false\", optional: true },\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 ${[\"jsx\", \"jsxs\", \"jsxDEV\", \"Fragment\"].map(\n (n) => `export const ${n} = __mod__.${n} || __mod__.jsx || ${(() => {\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 FSExtra.writeFile(options.outfile, outCode);\n });\n}\nasync function buildReact(options = {}) {\n const isProd = options.define?.[\"__DEV__\"] === \"false\";\n return build({\n bundle: true,\n entryPoints: [requireResolve(\"react\")],\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 () => {\n const bundled = await readFile(options.outfile, \"utf-8\");\n const outCode = `\n const run = () => {\n ${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((n) => `export const ${n} = __mod__.${n}`).join(\"\\n\")}\n export default __mod__\n `;\n await FSExtra.writeFile(options.outfile, outCode);\n });\n}\nasync function buildReactNative(options = {}, { platform }) {\n return build({\n bundle: true,\n entryPoints: [requireResolve(\"react-native\")],\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: [`.${platform}.js`, \".native.js\", \".js\", \".jsx\", \".json\", \".mjs\"],\n ...options,\n plugins: [\n {\n name: \"remove-flow\",\n setup(build2) {\n build2.onResolve(\n {\n filter: /HMRClient/\n },\n async (input) => {\n const path = requireResolve(\"@vxrn/vite-native-hmr\");\n const possibleEsmPath = path.replace(\n \"/cjs/index.cjs\",\n \"/esm/index.native.js\"\n );\n if (FSExtra.pathExistsSync(possibleEsmPath)) {\n return { path: possibleEsmPath };\n }\n return { path };\n }\n );\n build2.onLoad(\n {\n filter: /.*\\.js$/\n },\n async (input) => {\n if (!input.path.includes(\"react-native\") && !input.path.includes(`vite-native-hmr`)) {\n return;\n }\n const code = await readFile(input.path, \"utf-8\");\n let outagain = await transformFlowBabel(code, {\n development: true,\n path: input.path\n });\n if (input.path.endsWith(\"react-native/index.js\")) {\n outagain = outagain.replace(\n /module\\.exports *= *{/,\n `\nmodule.exports = {\n get _vxrnInternalReactNativeVersionDoNotUse() {\n return require(\"./Libraries/Core/ReactNativeVersion\").default;\n },\n `.trim()\n );\n }\n return {\n contents: outagain,\n loader: \"jsx\"\n };\n }\n );\n }\n }\n ]\n }).then(async () => {\n const bundled = await readFile(options.outfile, \"utf-8\");\n const outCode = `\n const run = () => {\n ${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((n) => `export const ${n} = RN.${n}`).join(\"\\n\")}\n export const REACT_NATIVE_ESM_MANUAL_EXPORTS_END = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_END';\n `;\n await FSExtra.writeFile(options.outfile, outCode);\n });\n}\nconst 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};`;\nconst 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 // Normally not exported by React Native, but with a hack we make @react-native/assets-registry/registry available here.\n];\nconst 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];\nexport {\n RExports,\n RNExportNames,\n buildReact,\n buildReactJSX,\n buildReactNative\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAM,iBAAiB,SAAS,cAAc,cAAc,YAAY,GAAG,CAAC,CAAC,oBAAkB;AAC/F,MAAM,WAAW;CAAC;CAAS;CAAqB;AAAuB;AACvE,eAAe,cAAc,UAAU,CAAC,GAAG;CACzC,MAAM,SAAS,QAAQ,SAAS,eAAe;CAC/C,OAAO,MAAM;EACX,QAAQ;EACR,aAAa,CAAC,eAAe,uBAAuB,CAAC;EACrD,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACV,QAAQ;GACN,SAAS;GACT,wBAAwB;EAC1B;EACA;EACA,UAAU;EACV,GAAG;CACL,CAAC,CAAC,CAAC,KAAK,YAAY;EAClB,MAAM,UAAU,MAAM,SAAS,QAAQ,SAAS,OAAO;EACvD,MAAM,UAAU;;QAEZ,YAAY,SAAS;GACvB,GAAG,SAAS,CACV;IAEE,MAAM;IACN,SAAS;GACX,CACF,IAAI,CACF;IACE,MAAM;IACN,SAAS;GACX,CACF;GACA;IAAE,MAAM;IAA6B,SAAS;IAAS,UAAU;GAAK;GACtE;IACE,MAAM;IACN,UAAU;IACV,SAAS;GACX;EACF,CAAC,EAAE;;;MAGD;GAAC;GAAO;GAAQ;GAAU;EAAU,CAAC,CAAC,KACrC,MAAM,gBAAgB,EAAE,aAAa,EAAE,4BAA4B;GAClE,IAAI,MAAM,QAAQ;IAChB,OAAO;GACT;GACA,OAAO;EACT,EAAC,CAAE,GACL,CAAC,CAAC,KAAK,IAAI,EAAE;;EAEb,MAAM,QAAQ,UAAU,QAAQ,SAAS,OAAO;CAClD,CAAC;AACH;AACA,eAAe,WAAW,UAAU,CAAC,GAAG;CACtC,MAAM,SAAS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ACA;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;AAEF;AACA,MAAM,WAAW;CACf;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.native.js
CHANGED
|
@@ -4,193 +4,207 @@ import { build } from "esbuild";
|
|
|
4
4
|
import FSExtra from "fs-extra";
|
|
5
5
|
import { readFile } from "fs/promises";
|
|
6
6
|
import { createRequire } from "module";
|
|
7
|
+
|
|
7
8
|
var requireResolve = "url" in import.meta ? createRequire(import.meta.url).resolve : require.resolve;
|
|
8
|
-
var external = [
|
|
9
|
+
var external = [
|
|
10
|
+
"react",
|
|
11
|
+
"react/jsx-runtime",
|
|
12
|
+
"react/jsx-dev-runtime"
|
|
13
|
+
];
|
|
9
14
|
async function buildReactJSX() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
16
|
+
var _options_define;
|
|
17
|
+
var isProd = ((_options_define = options.define) === null || _options_define === void 0 ? void 0 : _options_define["__DEV__"]) === "false";
|
|
18
|
+
return build({
|
|
19
|
+
bundle: true,
|
|
20
|
+
entryPoints: [requireResolve("react/jsx-dev-runtime")],
|
|
21
|
+
format: "cjs",
|
|
22
|
+
target: "node16",
|
|
23
|
+
jsx: "transform",
|
|
24
|
+
jsxFactory: "react",
|
|
25
|
+
allowOverwrite: true,
|
|
26
|
+
platform: "node",
|
|
27
|
+
define: {
|
|
28
|
+
__DEV__: "true",
|
|
29
|
+
"process.env.NODE_ENV": `"development"`
|
|
30
|
+
},
|
|
31
|
+
external,
|
|
32
|
+
logLevel: "warning",
|
|
33
|
+
...options
|
|
34
|
+
}).then(async function() {
|
|
35
|
+
var bundled = await readFile(options.outfile, "utf-8");
|
|
36
|
+
var outCode = `
|
|
32
37
|
const run = () => {
|
|
33
|
-
${mustReplace(bundled, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
${mustReplace(bundled, [
|
|
39
|
+
...isProd ? [{
|
|
40
|
+
find: /module\.exports = require_react_jsx_runtime_production([a-z_]*)\(\);/,
|
|
41
|
+
replace: `return require_react_jsx_runtime_production$1();`
|
|
42
|
+
}] : [{
|
|
43
|
+
find: `module.exports = require_react_jsx_dev_runtime_development();`,
|
|
44
|
+
replace: `return require_react_jsx_dev_runtime_development();`
|
|
45
|
+
}],
|
|
46
|
+
{
|
|
47
|
+
find: `process.env.VXRN_REACT_19`,
|
|
48
|
+
replace: "false",
|
|
49
|
+
optional: true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
find: `Object.assign(exports, eval("require('@vxrn/vendor/react-jsx-19')"));`,
|
|
53
|
+
optional: true,
|
|
54
|
+
replace: ``
|
|
55
|
+
}
|
|
56
|
+
])}
|
|
49
57
|
}
|
|
50
58
|
const __mod__ = run()
|
|
51
|
-
${[
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
${[
|
|
60
|
+
"jsx",
|
|
61
|
+
"jsxs",
|
|
62
|
+
"jsxDEV",
|
|
63
|
+
"Fragment"
|
|
64
|
+
].map(function(n) {
|
|
65
|
+
return `export const ${n} = __mod__.${n} || __mod__.jsx || ${(function() {
|
|
66
|
+
if (n === "jsxs") {
|
|
67
|
+
return "function (type, props, key) { return __mod__.jsxDEV(type, props, key, true) }";
|
|
68
|
+
}
|
|
69
|
+
return "__mod__.jsxDEV";
|
|
70
|
+
})()}`;
|
|
71
|
+
}).join("\n")}
|
|
59
72
|
`;
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
74
|
+
});
|
|
62
75
|
}
|
|
63
76
|
async function buildReact() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
78
|
+
var _options_define;
|
|
79
|
+
var isProd = ((_options_define = options.define) === null || _options_define === void 0 ? void 0 : _options_define["__DEV__"]) === "false";
|
|
80
|
+
return build({
|
|
81
|
+
bundle: true,
|
|
82
|
+
entryPoints: [requireResolve("react")],
|
|
83
|
+
format: "cjs",
|
|
84
|
+
target: "node16",
|
|
85
|
+
jsx: "transform",
|
|
86
|
+
jsxFactory: "react",
|
|
87
|
+
allowOverwrite: true,
|
|
88
|
+
platform: "node",
|
|
89
|
+
define: {
|
|
90
|
+
__DEV__: "true",
|
|
91
|
+
"process.env.NODE_ENV": `"development"`
|
|
92
|
+
},
|
|
93
|
+
logLevel: "warning",
|
|
94
|
+
external,
|
|
95
|
+
...options
|
|
96
|
+
}).then(async function() {
|
|
97
|
+
var bundled = await readFile(options.outfile, "utf-8");
|
|
98
|
+
var outCode = `
|
|
86
99
|
const run = () => {
|
|
87
|
-
${mustReplace(bundled, [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
${mustReplace(bundled, [
|
|
101
|
+
isProd ? {
|
|
102
|
+
find: /module\.exports = require_react_production([a-z_]*)\(\);/,
|
|
103
|
+
replace: "return require_react_production$1();"
|
|
104
|
+
} : {
|
|
105
|
+
find: /module\.exports = require_react_development([a-z_]*)\(\);/,
|
|
106
|
+
replace: "return require_react_development$1();"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
find: `process.env.VXRN_REACT_19`,
|
|
110
|
+
optional: true,
|
|
111
|
+
replace: "false"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
find: `Object.assign(exports, eval("require('@vxrn/vendor/react-19')"));`,
|
|
115
|
+
optional: true,
|
|
116
|
+
replace: ``
|
|
117
|
+
}
|
|
118
|
+
])}
|
|
102
119
|
}
|
|
103
120
|
const __mod__ = run()
|
|
104
|
-
${RExports.map(function
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
${RExports.map(function(n) {
|
|
122
|
+
return `export const ${n} = __mod__.${n}`;
|
|
123
|
+
}).join("\n")}
|
|
107
124
|
export default __mod__
|
|
108
125
|
`;
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
127
|
+
});
|
|
111
128
|
}
|
|
112
129
|
async function buildReactNative() {
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
path: input.path
|
|
165
|
-
});
|
|
166
|
-
if (input.path.endsWith("react-native/index.js")) {
|
|
167
|
-
outagain = outagain.replace(/module\.exports *= *{/, `
|
|
130
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, { platform } = arguments.length > 1 ? arguments[1] : void 0;
|
|
131
|
+
return build({
|
|
132
|
+
bundle: true,
|
|
133
|
+
entryPoints: [requireResolve("react-native")],
|
|
134
|
+
format: "cjs",
|
|
135
|
+
target: "node20",
|
|
136
|
+
allowOverwrite: true,
|
|
137
|
+
platform: "node",
|
|
138
|
+
external,
|
|
139
|
+
loader: {
|
|
140
|
+
".png": "dataurl",
|
|
141
|
+
".jpg": "dataurl",
|
|
142
|
+
".jpeg": "dataurl",
|
|
143
|
+
".gif": "dataurl"
|
|
144
|
+
},
|
|
145
|
+
define: {
|
|
146
|
+
__DEV__: "true",
|
|
147
|
+
"process.env.NODE_ENV": `"development"`
|
|
148
|
+
},
|
|
149
|
+
logLevel: "warning",
|
|
150
|
+
resolveExtensions: [
|
|
151
|
+
`.${platform}.js`,
|
|
152
|
+
".native.js",
|
|
153
|
+
".js",
|
|
154
|
+
".jsx",
|
|
155
|
+
".json",
|
|
156
|
+
".mjs"
|
|
157
|
+
],
|
|
158
|
+
...options,
|
|
159
|
+
plugins: [{
|
|
160
|
+
name: "remove-flow",
|
|
161
|
+
setup(build2) {
|
|
162
|
+
build2.onResolve({ filter: /HMRClient/ }, async function(input) {
|
|
163
|
+
var path = requireResolve("@vxrn/vite-native-hmr");
|
|
164
|
+
var possibleEsmPath = path.replace("/cjs/index.cjs", "/esm/index.native.js");
|
|
165
|
+
if (FSExtra.pathExistsSync(possibleEsmPath)) {
|
|
166
|
+
return { path: possibleEsmPath };
|
|
167
|
+
}
|
|
168
|
+
return { path };
|
|
169
|
+
});
|
|
170
|
+
build2.onLoad({ filter: /.*\.js$/ }, async function(input) {
|
|
171
|
+
if (!input.path.includes("react-native") && !input.path.includes(`vite-native-hmr`)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
var code = await readFile(input.path, "utf-8");
|
|
175
|
+
var outagain = await transformFlowBabel(code, {
|
|
176
|
+
development: true,
|
|
177
|
+
path: input.path
|
|
178
|
+
});
|
|
179
|
+
if (input.path.endsWith("react-native/index.js")) {
|
|
180
|
+
outagain = outagain.replace(/module\.exports *= *{/, `
|
|
168
181
|
module.exports = {
|
|
169
182
|
get _vxrnInternalReactNativeVersionDoNotUse() {
|
|
170
183
|
return require("./Libraries/Core/ReactNativeVersion").default;
|
|
171
184
|
},
|
|
172
185
|
`.trim());
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
contents: outagain,
|
|
189
|
+
loader: "jsx"
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}]
|
|
194
|
+
}).then(async function() {
|
|
195
|
+
var bundled = await readFile(options.outfile, "utf-8");
|
|
196
|
+
var outCode = `
|
|
184
197
|
const run = () => {
|
|
185
|
-
${mustReplace(bundled, [
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
${mustReplace(bundled, [
|
|
199
|
+
{
|
|
200
|
+
find: esbuildCommonJSFunction,
|
|
201
|
+
replace: `
|
|
188
202
|
// replaced commonjs function to allow importing internals
|
|
189
203
|
var __commonJS = function __commonJS(cb, mod) {
|
|
190
204
|
var path = __getOwnPropNames(cb)[0];
|
|
191
205
|
var modulePath = path.replace(/.*node_modules\\//, '').replace('.js', '');
|
|
192
206
|
|
|
193
|
-
var
|
|
207
|
+
var require = function require() {
|
|
194
208
|
if (mod) return mod;
|
|
195
209
|
|
|
196
210
|
var cachedMod = globalThis["__cachedModules"][modulePath];
|
|
@@ -214,37 +228,39 @@ var __commonJS = function __commonJS(cb, mod) {
|
|
|
214
228
|
|
|
215
229
|
// this is another patch basically allowing importing the inner contents:
|
|
216
230
|
if (globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__']) {
|
|
217
|
-
globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__'][modulePath] =
|
|
231
|
+
globalThis['__RN_INTERNAL_MODULE_REQUIRES_MAP__'][modulePath] = require;
|
|
218
232
|
}
|
|
219
233
|
|
|
220
|
-
return
|
|
234
|
+
return require;
|
|
221
235
|
};
|
|
222
236
|
`
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
find: /module\.exports = require_(react_native|index)\(\);/,
|
|
240
|
+
replace: [
|
|
241
|
+
`const rn = require_$1();`,
|
|
242
|
+
`rn.AssetRegistry = require_registry();`,
|
|
243
|
+
`require_ReactFabric();`,
|
|
244
|
+
`if (typeof require_InitializeCore === 'function') { require_InitializeCore(); }`,
|
|
245
|
+
`return rn;`
|
|
246
|
+
].join("\n")
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
find: `originalMessage = e.message || "";`,
|
|
250
|
+
replace: `originalMessage = "" + (e.stack || "");`
|
|
251
|
+
}
|
|
252
|
+
])}
|
|
236
253
|
}
|
|
237
254
|
const RN = run()
|
|
238
255
|
|
|
239
|
-
export const REACT_NATIVE_ESM_MANUAL_EXPORTS_START = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_START';${
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}).join("\n")}
|
|
256
|
+
export const REACT_NATIVE_ESM_MANUAL_EXPORTS_START = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_START';${""}
|
|
257
|
+
${RNExportNames.map(function(n) {
|
|
258
|
+
return `export const ${n} = RN.${n}`;
|
|
259
|
+
}).join("\n")}
|
|
244
260
|
export const REACT_NATIVE_ESM_MANUAL_EXPORTS_END = 'REACT_NATIVE_ESM_MANUAL_EXPORTS_END';
|
|
245
261
|
`;
|
|
246
|
-
|
|
247
|
-
|
|
262
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
263
|
+
});
|
|
248
264
|
}
|
|
249
265
|
var esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function require() {
|
|
250
266
|
try {
|
|
@@ -253,13 +269,131 @@ var esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function require()
|
|
|
253
269
|
throw mod = 0, e;
|
|
254
270
|
}
|
|
255
271
|
};`;
|
|
256
|
-
var RNExportNames = [
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
"
|
|
260
|
-
|
|
261
|
-
"
|
|
262
|
-
|
|
263
|
-
"
|
|
272
|
+
var RNExportNames = [
|
|
273
|
+
"registerCallableModule",
|
|
274
|
+
"AccessibilityInfo",
|
|
275
|
+
"ActivityIndicator",
|
|
276
|
+
"Button",
|
|
277
|
+
"DrawerLayoutAndroid",
|
|
278
|
+
"FlatList",
|
|
279
|
+
"Image",
|
|
280
|
+
"ImageBackground",
|
|
281
|
+
"InputAccessoryView",
|
|
282
|
+
"KeyboardAvoidingView",
|
|
283
|
+
"Modal",
|
|
284
|
+
"Pressable",
|
|
285
|
+
"RefreshControl",
|
|
286
|
+
"SafeAreaView",
|
|
287
|
+
"ScrollView",
|
|
288
|
+
"SectionList",
|
|
289
|
+
"StatusBar",
|
|
290
|
+
"Switch",
|
|
291
|
+
"Text",
|
|
292
|
+
"TextInput",
|
|
293
|
+
"Touchable",
|
|
294
|
+
"TouchableHighlight",
|
|
295
|
+
"TouchableNativeFeedback",
|
|
296
|
+
"TouchableOpacity",
|
|
297
|
+
"TouchableWithoutFeedback",
|
|
298
|
+
"View",
|
|
299
|
+
"VirtualizedList",
|
|
300
|
+
"VirtualizedSectionList",
|
|
301
|
+
"ActionSheetIOS",
|
|
302
|
+
"Alert",
|
|
303
|
+
"Animated",
|
|
304
|
+
"Appearance",
|
|
305
|
+
"AppRegistry",
|
|
306
|
+
"AppState",
|
|
307
|
+
"BackHandler",
|
|
308
|
+
"DeviceInfo",
|
|
309
|
+
"DevSettings",
|
|
310
|
+
"Dimensions",
|
|
311
|
+
"Easing",
|
|
312
|
+
"findNodeHandle",
|
|
313
|
+
"I18nManager",
|
|
314
|
+
"InteractionManager",
|
|
315
|
+
"Keyboard",
|
|
316
|
+
"LayoutAnimation",
|
|
317
|
+
"Linking",
|
|
318
|
+
"LogBox",
|
|
319
|
+
"NativeDialogManagerAndroid",
|
|
320
|
+
"NativeEventEmitter",
|
|
321
|
+
"Networking",
|
|
322
|
+
"PanResponder",
|
|
323
|
+
"PermissionsAndroid",
|
|
324
|
+
"PixelRatio",
|
|
325
|
+
"Settings",
|
|
326
|
+
"Share",
|
|
327
|
+
"StyleSheet",
|
|
328
|
+
"Systrace",
|
|
329
|
+
"ToastAndroid",
|
|
330
|
+
"TurboModuleRegistry",
|
|
331
|
+
"UIManager",
|
|
332
|
+
"unstable_batchedUpdates",
|
|
333
|
+
"useAnimatedValue",
|
|
334
|
+
"useAnimatedValueXY",
|
|
335
|
+
"useAnimatedColor",
|
|
336
|
+
"useColorScheme",
|
|
337
|
+
"usePressability",
|
|
338
|
+
"useWindowDimensions",
|
|
339
|
+
"UTFSequence",
|
|
340
|
+
"Vibration",
|
|
341
|
+
"DeviceEventEmitter",
|
|
342
|
+
"DynamicColorIOS",
|
|
343
|
+
"EventEmitter",
|
|
344
|
+
"NativeAppEventEmitter",
|
|
345
|
+
"NativeModules",
|
|
346
|
+
"Platform",
|
|
347
|
+
"PlatformColor",
|
|
348
|
+
"processColor",
|
|
349
|
+
"requireNativeComponent",
|
|
350
|
+
"RootTagContext",
|
|
351
|
+
"AssetRegistry"
|
|
352
|
+
];
|
|
353
|
+
var RExports = [
|
|
354
|
+
"Children",
|
|
355
|
+
"Component",
|
|
356
|
+
"Fragment",
|
|
357
|
+
"Profiler",
|
|
358
|
+
"PureComponent",
|
|
359
|
+
"StrictMode",
|
|
360
|
+
"Suspense",
|
|
361
|
+
"__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
|
|
362
|
+
"__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE",
|
|
363
|
+
"cloneElement",
|
|
364
|
+
"createContext",
|
|
365
|
+
"createElement",
|
|
366
|
+
"createFactory",
|
|
367
|
+
"createRef",
|
|
368
|
+
"forwardRef",
|
|
369
|
+
"isValidElement",
|
|
370
|
+
"lazy",
|
|
371
|
+
"memo",
|
|
372
|
+
"startTransition",
|
|
373
|
+
"unstable_act",
|
|
374
|
+
"useCallback",
|
|
375
|
+
"useContext",
|
|
376
|
+
"useDebugValue",
|
|
377
|
+
"useDeferredValue",
|
|
378
|
+
"useEffect",
|
|
379
|
+
"useId",
|
|
380
|
+
"useImperativeHandle",
|
|
381
|
+
"useInsertionEffect",
|
|
382
|
+
"useLayoutEffect",
|
|
383
|
+
"useMemo",
|
|
384
|
+
"useReducer",
|
|
385
|
+
"useRef",
|
|
386
|
+
"useState",
|
|
387
|
+
"useSyncExternalStore",
|
|
388
|
+
"useTransition",
|
|
389
|
+
"version",
|
|
390
|
+
"act",
|
|
391
|
+
"cache",
|
|
392
|
+
"unstable_useCacheRefresh",
|
|
393
|
+
"use",
|
|
394
|
+
"useActionState",
|
|
395
|
+
"useOptimistic"
|
|
396
|
+
];
|
|
397
|
+
|
|
264
398
|
export { RExports, RNExportNames, buildReact, buildReactJSX, buildReactNative };
|
|
265
399
|
//# sourceMappingURL=index.native.js.map
|