@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.js.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,M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QkC,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,Q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;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.mjs
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.mjs.map
|