@vxrn/react-native-prebuilt 1.1.221 → 1.1.227
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.native.js +151 -425
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/index.native.js +150 -423
- package/dist/esm/index.native.js.map +2 -2
- package/dist/esm/index.native.mjs +176 -0
- package/dist/esm/index.native.mjs.map +1 -0
- package/package.json +5 -6
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { transformFlow } from "@vxrn/vite-flow";
|
|
3
|
+
import { build } from "esbuild";
|
|
4
|
+
import FSExtra from "fs-extra";
|
|
5
|
+
import { resolve as importMetaResolve } from "import-meta-resolve";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
var external = ["react", "react/jsx-runtime", "react/jsx-dev-runtime"];
|
|
8
|
+
async function buildAll() {
|
|
9
|
+
console.info("Prebuilding React Native (one time cost...)"), await Promise.all([
|
|
10
|
+
//
|
|
11
|
+
buildReactJSX(), buildReact(), buildReactNative()]);
|
|
12
|
+
}
|
|
13
|
+
var resolveFile = function (path) {
|
|
14
|
+
try {
|
|
15
|
+
return importMetaResolve(path, `file://${process.cwd()}`).replace("file://", "");
|
|
16
|
+
} catch {
|
|
17
|
+
return require.resolve(path);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
async function buildReactJSX() {
|
|
21
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
22
|
+
return build({
|
|
23
|
+
bundle: !0,
|
|
24
|
+
entryPoints: [resolveFile("react/jsx-dev-runtime")],
|
|
25
|
+
format: "cjs",
|
|
26
|
+
target: "node16",
|
|
27
|
+
jsx: "transform",
|
|
28
|
+
jsxFactory: "react",
|
|
29
|
+
allowOverwrite: !0,
|
|
30
|
+
platform: "node",
|
|
31
|
+
define: {
|
|
32
|
+
__DEV__: "true",
|
|
33
|
+
"process.env.NODE_ENV": '"development"'
|
|
34
|
+
},
|
|
35
|
+
external,
|
|
36
|
+
logLevel: "warning",
|
|
37
|
+
...options
|
|
38
|
+
}).then(async function () {
|
|
39
|
+
var bundled = await readFile(options.outfile, "utf-8"),
|
|
40
|
+
outCode = `
|
|
41
|
+
const run = () => {
|
|
42
|
+
${bundled.replace("module.exports = require_react_jsx_dev_runtime_development();", "return require_react_jsx_dev_runtime_development();")}
|
|
43
|
+
}
|
|
44
|
+
const __mod__ = run()
|
|
45
|
+
${["jsx", "jsxs", "jsxDEV", "Fragment"].map(function (n) {
|
|
46
|
+
return `export const ${n} = __mod__.${n} || __mod__.jsx || ${/* @__PURE__ */function () {
|
|
47
|
+
return n === "jsxs" ? "function (type, props, key) { return __mod__.jsxDEV(type, props, key, true) }" : "__mod__.jsxDEV";
|
|
48
|
+
}()}`;
|
|
49
|
+
}).join(`
|
|
50
|
+
`)}
|
|
51
|
+
`;
|
|
52
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async function buildReact() {
|
|
56
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
57
|
+
return build({
|
|
58
|
+
bundle: !0,
|
|
59
|
+
entryPoints: [resolveFile("react")],
|
|
60
|
+
format: "cjs",
|
|
61
|
+
target: "node16",
|
|
62
|
+
jsx: "transform",
|
|
63
|
+
jsxFactory: "react",
|
|
64
|
+
allowOverwrite: !0,
|
|
65
|
+
platform: "node",
|
|
66
|
+
define: {
|
|
67
|
+
__DEV__: "true",
|
|
68
|
+
"process.env.NODE_ENV": '"development"'
|
|
69
|
+
},
|
|
70
|
+
logLevel: "warning",
|
|
71
|
+
external,
|
|
72
|
+
...options
|
|
73
|
+
}).then(async function () {
|
|
74
|
+
var bundled = await readFile(options.outfile, "utf-8"),
|
|
75
|
+
outCode = `
|
|
76
|
+
const run = () => {
|
|
77
|
+
${bundled.replace("module.exports = require_react_development();", "return require_react_development();")}
|
|
78
|
+
}
|
|
79
|
+
const __mod__ = run()
|
|
80
|
+
${RExports.map(function (n) {
|
|
81
|
+
return `export const ${n} = __mod__.${n}`;
|
|
82
|
+
}).join(`
|
|
83
|
+
`)}
|
|
84
|
+
export default __mod__
|
|
85
|
+
`;
|
|
86
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async function buildReactNative() {
|
|
90
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
91
|
+
return build({
|
|
92
|
+
bundle: !0,
|
|
93
|
+
entryPoints: [resolveFile("react-native")],
|
|
94
|
+
format: "cjs",
|
|
95
|
+
target: "node20",
|
|
96
|
+
// Note: JSX is actually being transformed by the "remove-flow" plugin defined underneath, not by esbuild. The following JSX options may not actually make a difference.
|
|
97
|
+
jsx: "transform",
|
|
98
|
+
jsxFactory: "react",
|
|
99
|
+
allowOverwrite: !0,
|
|
100
|
+
platform: "node",
|
|
101
|
+
external,
|
|
102
|
+
loader: {
|
|
103
|
+
".png": "dataurl",
|
|
104
|
+
".jpg": "dataurl",
|
|
105
|
+
".jpeg": "dataurl",
|
|
106
|
+
".gif": "dataurl"
|
|
107
|
+
},
|
|
108
|
+
define: {
|
|
109
|
+
__DEV__: "true",
|
|
110
|
+
"process.env.NODE_ENV": '"development"'
|
|
111
|
+
},
|
|
112
|
+
logLevel: "warning",
|
|
113
|
+
resolveExtensions: [".ios.js", ".native.js", ".native.ts", ".native.tsx", ".js", ".jsx", ".json", ".ts", ".tsx", ".mjs"],
|
|
114
|
+
...options,
|
|
115
|
+
plugins: [{
|
|
116
|
+
name: "remove-flow",
|
|
117
|
+
setup(build2) {
|
|
118
|
+
build2.onResolve({
|
|
119
|
+
filter: /HMRClient/
|
|
120
|
+
}, async function (input) {
|
|
121
|
+
return {
|
|
122
|
+
path: resolveFile("@vxrn/vite-native-hmr")
|
|
123
|
+
};
|
|
124
|
+
}), build2.onLoad({
|
|
125
|
+
filter: /.*.js/
|
|
126
|
+
}, async function (input) {
|
|
127
|
+
if (!(!input.path.includes("react-native") && !input.path.includes("vite-native-hmr"))) {
|
|
128
|
+
var code = await readFile(input.path, "utf-8"),
|
|
129
|
+
outagain = await transformFlow(code, {
|
|
130
|
+
development: !0
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
contents: outagain,
|
|
134
|
+
loader: "jsx"
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}]
|
|
140
|
+
}).then(async function () {
|
|
141
|
+
var bundled = await readFile(options.outfile, "utf-8"),
|
|
142
|
+
outCode = `
|
|
143
|
+
const run = () => {
|
|
144
|
+
${bundled.replace(esbuildCommonJSFunction, `
|
|
145
|
+
// replaced commonjs function to allow importing internals
|
|
146
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
147
|
+
if (mod) return mod
|
|
148
|
+
const path = __getOwnPropNames(cb)[0]
|
|
149
|
+
const moduleFn = cb[path]
|
|
150
|
+
mod = { exports: {} }
|
|
151
|
+
moduleFn(mod.exports, mod)
|
|
152
|
+
mod = mod.exports
|
|
153
|
+
|
|
154
|
+
// this is our patch basically allowing importing the inner contents:
|
|
155
|
+
globalThis['__cachedModules'][path.replace(/.*node_modules\\//, '').replace('.js', '')] = mod
|
|
156
|
+
|
|
157
|
+
return mod
|
|
158
|
+
};
|
|
159
|
+
`).replace("module.exports = require_react_native();", "return require_react_native();")}
|
|
160
|
+
}
|
|
161
|
+
const RN = run()
|
|
162
|
+
${RNExportNames.map(function (n) {
|
|
163
|
+
return `export const ${n} = RN.${n}`;
|
|
164
|
+
}).join(`
|
|
165
|
+
`)}
|
|
166
|
+
`;
|
|
167
|
+
await FSExtra.writeFile(options.outfile, outCode);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
var esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function __require() {
|
|
171
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
172
|
+
};`,
|
|
173
|
+
RNExportNames = ["registerCallableModule", "AccessibilityInfo", "ActivityIndicator", "Button", "DrawerLayoutAndroid", "FlatList", "Image", "ImageBackground", "InputAccessoryView", "KeyboardAvoidingView", "Modal", "Pressable", "RefreshControl", "SafeAreaView", "ScrollView", "SectionList", "StatusBar", "Switch", "Text", "TextInput", "Touchable", "TouchableHighlight", "TouchableNativeFeedback", "TouchableOpacity", "TouchableWithoutFeedback", "View", "VirtualizedList", "VirtualizedSectionList", "ActionSheetIOS", "Alert", "Animated", "Appearance", "AppRegistry", "AppState", "BackHandler", "DeviceInfo", "DevSettings", "Dimensions", "Easing", "findNodeHandle", "I18nManager", "InteractionManager", "Keyboard", "LayoutAnimation", "Linking", "LogBox", "NativeDialogManagerAndroid", "NativeEventEmitter", "Networking", "PanResponder", "PermissionsAndroid", "PixelRatio", "Settings", "Share", "StyleSheet", "Systrace", "ToastAndroid", "TurboModuleRegistry", "UIManager", "unstable_batchedUpdates", "useAnimatedValue", "useColorScheme", "useWindowDimensions", "UTFSequence", "Vibration", "YellowBox", "DeviceEventEmitter", "DynamicColorIOS", "NativeAppEventEmitter", "NativeModules", "Platform", "PlatformColor", "processColor", "requireNativeComponent", "RootTagContext", "unstable_enableLogBox"],
|
|
174
|
+
RExports = ["Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED", "cloneElement", "createContext", "createElement", "createFactory", "createRef", "forwardRef", "isValidElement", "lazy", "memo", "startTransition", "unstable_act", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition", "version"];
|
|
175
|
+
export { buildAll, buildReact, buildReactJSX, buildReactNative };
|
|
176
|
+
//# sourceMappingURL=index.native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["readFile","transformFlow","build","FSExtra","resolve","importMetaResolve","process","external","buildAll","console","info","Promise","all","buildReactJSX","buildReact","buildReactNative","resolveFile","path","cwd","replace","require","options","arguments","length","bundle","entryPoints","format","target","jsx","jsxFactory","allowOverwrite","platform","define","__DEV__","logLevel","then","bundled","outfile","outCode","map","n","join","writeFile","RExports","loader","resolveExtensions","plugins","name","setup","build2","onResolve","filter","input","onLoad","includes","code","outagain","development","contents","esbuildCommonJSFunction","RNExportNames"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AAEzB,SAASC,aAAA,QAAqB;AAC9B,SAASC,KAAA,QAAgC;AACzC,OAAOC,OAAA,MAAa;AACpB,SAASC,OAAA,IAAWC,iBAAA,QAAyB;AAC7C,OAAOC,OAAA,MAAa;AAEpB,IAAAC,QAAM,IAEN,SACE,mBAAa,EACK;AAEF,eACHC,SAAA;EAAAC,OACX,CAAAC,IAAA,8CAAiB,SAAAC,OAAA,CAAAC,GAAA;EAClB;EACHC,aAAA,IAEAC,UAAM,IACJC,gBAAI,GACF;AAA+E;AAE/E,IAAAC,WAAO,YAAAA,CAAgBC,IAAI;EAC7B;IACF,OAAAZ,iBAAA,CAAAY,IAAA,YAAAX,OAAA,CAAAY,GAAA,MAAAC,OAAA;EAEA;IACE,OAAOC,OAAM,CAAAhB,OAAA,CAAAa,IAAA;EAAA;AACH;AAC0C,eAC1CJ,cAAA;EAAA,IACRQ,OAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAAA,OACHpB,KAAA;IACLsB,MAAA;IACAC,WAAA,GACAT,WAAU,0BACV;IAAQU,MACN,OAAS;IAAAC,MACT;IACFC,GAAA;IACAC,UAAA;IACAC,cAAU;IACVC,QAAG;IACJC,MAAO;MAGNC,OAAM,QAAU;MAAA;IAAA;IAEJ1B,QACR;IAAA2B,QACA;IACF,GAACb;EAAA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,uBAAAA,CAAA,SAAAA,CAAA;MACA,GAAAC,IAAA;AAAA,EACA;AAAA,KACA;IACA,MAAAtC,OAAA,CAAAuC,SAAA,CAAArB,OAAA,CAAAgB,OAAA,EAAAC,OAAA;EACA;AAAA;AACA,IACAqB,uBAAA;AAAA;AACA,GACA;EAAAC,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,sBACA,cACA,YACA,SACA,cACA,YACA,gBACA,uBACA,aACA,2BACA,oBACA,kBACA,uBACF,aAEiB,EACf,aACA,aACA,sBACA,mBACA,yBACA,iBACA,YACA,iBACA,gBACA,0BACA,kBACA;EACAjB,QAAA,IACA,YACA,aACA,YACA,YACA,iBACA,cACA,YACA,sDACA,gBACA,iBACA,iBACA,iBACA,aACA,cACA,kBACA,QACA,QACA,mBACA,gBACA,eACA,cACA,iBACF,oB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/react-native-prebuilt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.227",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
7
7
|
"module": "dist/esm",
|
|
@@ -31,15 +31,14 @@
|
|
|
31
31
|
"./vendor/react-jsx-runtime-18.3.1": "./vendor/react-jsx-runtime-18.3.1/index.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@vxrn/vite-flow": "1.1.
|
|
35
|
-
"@vxrn/vite-native-hmr": "1.1.
|
|
34
|
+
"@vxrn/vite-flow": "1.1.227",
|
|
35
|
+
"@vxrn/vite-native-hmr": "1.1.227",
|
|
36
36
|
"esbuild": "^0.23.1",
|
|
37
37
|
"fs-extra": "^11.2.0",
|
|
38
|
-
"import-meta-resolve": "^4.1.0"
|
|
39
|
-
"metro-react-native-babel-preset": "^0.77.0"
|
|
38
|
+
"import-meta-resolve": "^4.1.0"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "^1.
|
|
41
|
+
"@tamagui/build": "^1.111.1",
|
|
43
42
|
"react": "^18.2.0 || ^19.0.0",
|
|
44
43
|
"react-dom": "^18.2.0 || ^19.0.0",
|
|
45
44
|
"react-native": "0.74.1"
|