@vxrn/react-native-prebuilt 1.1.309 → 1.1.310
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 +191 -0
- package/package.json +4 -4
- package/dist/cjs/index.js +0 -329
- /package/dist/cjs/{index.js.map → index.cjs.map} +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
buildAll: () => buildAll,
|
|
35
|
+
buildReact: () => buildReact,
|
|
36
|
+
buildReactJSX: () => buildReactJSX,
|
|
37
|
+
buildReactNative: () => buildReactNative
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(src_exports);
|
|
40
|
+
var import_promises = require("node:fs/promises"),
|
|
41
|
+
import_vite_flow = require("@vxrn/vite-flow"),
|
|
42
|
+
import_esbuild = require("esbuild"),
|
|
43
|
+
import_fs_extra = __toESM(require("fs-extra"), 1),
|
|
44
|
+
import_node_module = require("node:module");
|
|
45
|
+
const import_meta = {},
|
|
46
|
+
requireResolve = "url" in import_meta ? (0, import_node_module.createRequire)(import_meta.url).resolve : require.resolve,
|
|
47
|
+
external = ["react", "react/jsx-runtime", "react/jsx-dev-runtime"];
|
|
48
|
+
async function buildAll() {
|
|
49
|
+
console.info("Prebuilding React Native (one time cost...)"), await Promise.all([
|
|
50
|
+
//
|
|
51
|
+
buildReactJSX(), buildReact(), buildReactNative()]);
|
|
52
|
+
}
|
|
53
|
+
async function buildReactJSX(options = {}) {
|
|
54
|
+
return (0, import_esbuild.build)({
|
|
55
|
+
bundle: !0,
|
|
56
|
+
entryPoints: [requireResolve("react/jsx-dev-runtime")],
|
|
57
|
+
format: "cjs",
|
|
58
|
+
target: "node16",
|
|
59
|
+
jsx: "transform",
|
|
60
|
+
jsxFactory: "react",
|
|
61
|
+
allowOverwrite: !0,
|
|
62
|
+
platform: "node",
|
|
63
|
+
define: {
|
|
64
|
+
__DEV__: "true",
|
|
65
|
+
"process.env.NODE_ENV": '"development"'
|
|
66
|
+
},
|
|
67
|
+
external,
|
|
68
|
+
logLevel: "warning",
|
|
69
|
+
...options
|
|
70
|
+
}).then(async () => {
|
|
71
|
+
const outCode = `
|
|
72
|
+
const run = () => {
|
|
73
|
+
${(await (0, import_promises.readFile)(options.outfile, "utf-8")).replace("module.exports = require_react_jsx_dev_runtime_development();", "return require_react_jsx_dev_runtime_development();").replace("module.exports = require_react_jsx_runtime_production_min();", "return require_react_jsx_runtime_production_min();").replace("process.env.VXRN_REACT_19", "false").replace(`Object.assign(exports, eval("require('@vxrn/vendor/react-jsx-19')"));`, "")}
|
|
74
|
+
}
|
|
75
|
+
const __mod__ = run()
|
|
76
|
+
${["jsx", "jsxs", "jsxDEV", "Fragment"].map(n => `export const ${n} = __mod__.${n} || __mod__.jsx || ${n === "jsxs" ? "function (type, props, key) { return __mod__.jsxDEV(type, props, key, true) }" : "__mod__.jsxDEV"}`).join(`
|
|
77
|
+
`)}
|
|
78
|
+
`;
|
|
79
|
+
await import_fs_extra.default.writeFile(options.outfile, outCode);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async function buildReact(options = {}) {
|
|
83
|
+
return (0, import_esbuild.build)({
|
|
84
|
+
bundle: !0,
|
|
85
|
+
entryPoints: [requireResolve("react")],
|
|
86
|
+
format: "cjs",
|
|
87
|
+
target: "node16",
|
|
88
|
+
jsx: "transform",
|
|
89
|
+
jsxFactory: "react",
|
|
90
|
+
allowOverwrite: !0,
|
|
91
|
+
platform: "node",
|
|
92
|
+
define: {
|
|
93
|
+
__DEV__: "true",
|
|
94
|
+
"process.env.NODE_ENV": '"development"'
|
|
95
|
+
},
|
|
96
|
+
logLevel: "warning",
|
|
97
|
+
external,
|
|
98
|
+
...options
|
|
99
|
+
}).then(async () => {
|
|
100
|
+
const outCode = `
|
|
101
|
+
const run = () => {
|
|
102
|
+
${(await (0, import_promises.readFile)(options.outfile, "utf-8")).replace(/module\.exports = require_react_development(\d*)\(\);/, "return require_react_development$1();").replace(/module\.exports = require_react_production_min(\d*)\(\);/, "return require_react_production_min$1();").replace("process.env.VXRN_REACT_19", "false").replace(`Object.assign(exports, eval("require('@vxrn/vendor/react-19')"));`, "")}
|
|
103
|
+
}
|
|
104
|
+
const __mod__ = run()
|
|
105
|
+
${RExports.map(n => `export const ${n} = __mod__.${n}`).join(`
|
|
106
|
+
`)}
|
|
107
|
+
export default __mod__
|
|
108
|
+
`;
|
|
109
|
+
await import_fs_extra.default.writeFile(options.outfile, outCode);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async function buildReactNative(options = {}) {
|
|
113
|
+
return (0, import_esbuild.build)({
|
|
114
|
+
bundle: !0,
|
|
115
|
+
entryPoints: [requireResolve("react-native")],
|
|
116
|
+
format: "cjs",
|
|
117
|
+
target: "node20",
|
|
118
|
+
// 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.
|
|
119
|
+
jsx: "transform",
|
|
120
|
+
jsxFactory: "react",
|
|
121
|
+
allowOverwrite: !0,
|
|
122
|
+
platform: "node",
|
|
123
|
+
external,
|
|
124
|
+
loader: {
|
|
125
|
+
".png": "dataurl",
|
|
126
|
+
".jpg": "dataurl",
|
|
127
|
+
".jpeg": "dataurl",
|
|
128
|
+
".gif": "dataurl"
|
|
129
|
+
},
|
|
130
|
+
define: {
|
|
131
|
+
__DEV__: "true",
|
|
132
|
+
"process.env.NODE_ENV": '"development"'
|
|
133
|
+
},
|
|
134
|
+
logLevel: "warning",
|
|
135
|
+
resolveExtensions: [".ios.js", ".native.js", ".native.ts", ".native.tsx", ".js", ".jsx", ".json", ".ts", ".tsx", ".mjs"],
|
|
136
|
+
...options,
|
|
137
|
+
plugins: [{
|
|
138
|
+
name: "remove-flow",
|
|
139
|
+
setup(build2) {
|
|
140
|
+
build2.onResolve({
|
|
141
|
+
filter: /HMRClient/
|
|
142
|
+
}, async input => ({
|
|
143
|
+
path: requireResolve("@vxrn/vite-native-hmr")
|
|
144
|
+
})), build2.onLoad({
|
|
145
|
+
filter: /.*.js/
|
|
146
|
+
}, async input => {
|
|
147
|
+
if (!input.path.includes("react-native") && !input.path.includes("vite-native-hmr")) return;
|
|
148
|
+
const code = await (0, import_promises.readFile)(input.path, "utf-8");
|
|
149
|
+
return {
|
|
150
|
+
contents: await (0, import_vite_flow.transformFlow)(code, {
|
|
151
|
+
development: !0
|
|
152
|
+
}),
|
|
153
|
+
loader: "jsx"
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}]
|
|
158
|
+
}).then(async () => {
|
|
159
|
+
const outCode = `
|
|
160
|
+
const run = () => {
|
|
161
|
+
${(await (0, import_promises.readFile)(options.outfile, "utf-8")).replace(esbuildCommonJSFunction, `
|
|
162
|
+
// replaced commonjs function to allow importing internals
|
|
163
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
164
|
+
if (mod) return mod
|
|
165
|
+
const path = __getOwnPropNames(cb)[0]
|
|
166
|
+
const moduleFn = cb[path]
|
|
167
|
+
mod = { exports: {} }
|
|
168
|
+
moduleFn(mod.exports, mod)
|
|
169
|
+
mod = mod.exports
|
|
170
|
+
|
|
171
|
+
// this is our patch basically allowing importing the inner contents:
|
|
172
|
+
globalThis['__cachedModules'][path.replace(/.*node_modules\\//, '').replace('.js', '')] = mod
|
|
173
|
+
|
|
174
|
+
return mod
|
|
175
|
+
};
|
|
176
|
+
`).replace("module.exports = require_react_native();", "return require_react_native();").replace("return require_react_native();", "const rn = require_react_native(); rn.AssetRegistry = require_registry(); return rn;")}
|
|
177
|
+
}
|
|
178
|
+
const RN = run()
|
|
179
|
+
${RNExportNames.map(n => `export const ${n} = RN.${n}`).join(`
|
|
180
|
+
`)}
|
|
181
|
+
`;
|
|
182
|
+
await import_fs_extra.default.writeFile(options.outfile, outCode);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function __require() {
|
|
186
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
187
|
+
};`,
|
|
188
|
+
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", "AssetRegistry"
|
|
189
|
+
// Normally not exported by React Native, but with a hack we make @react-native/assets-registry/registry available here.
|
|
190
|
+
],
|
|
191
|
+
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"];
|
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.310",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"main": "dist/cjs",
|
|
7
7
|
"module": "dist/esm",
|
|
@@ -31,14 +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.310",
|
|
35
|
+
"@vxrn/vite-native-hmr": "1.1.310",
|
|
36
36
|
"esbuild": "^0.24.0",
|
|
37
37
|
"fs-extra": "^11.2.0",
|
|
38
38
|
"import-meta-resolve": "^4.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "^1.
|
|
41
|
+
"@tamagui/build": "^1.115.0",
|
|
42
42
|
"react": "^18.2.0 || ^19.0.0",
|
|
43
43
|
"react-dom": "^18.2.0 || ^19.0.0",
|
|
44
44
|
"react-native": "0.74.1"
|
package/dist/cjs/index.js
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var src_exports = {};
|
|
24
|
-
__export(src_exports, {
|
|
25
|
-
buildAll: () => buildAll,
|
|
26
|
-
buildReact: () => buildReact,
|
|
27
|
-
buildReactJSX: () => buildReactJSX,
|
|
28
|
-
buildReactNative: () => buildReactNative
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(src_exports);
|
|
31
|
-
var import_promises = require("node:fs/promises"), import_vite_flow = require("@vxrn/vite-flow"), import_esbuild = require("esbuild"), import_fs_extra = __toESM(require("fs-extra"), 1), import_node_module = require("node:module");
|
|
32
|
-
const import_meta = {}, requireResolve = "url" in import_meta ? (0, import_node_module.createRequire)(import_meta.url).resolve : require.resolve, external = ["react", "react/jsx-runtime", "react/jsx-dev-runtime"];
|
|
33
|
-
async function buildAll() {
|
|
34
|
-
console.info("Prebuilding React Native (one time cost...)"), await Promise.all([
|
|
35
|
-
//
|
|
36
|
-
buildReactJSX(),
|
|
37
|
-
buildReact(),
|
|
38
|
-
buildReactNative()
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
|
-
async function buildReactJSX(options = {}) {
|
|
42
|
-
return (0, import_esbuild.build)({
|
|
43
|
-
bundle: !0,
|
|
44
|
-
entryPoints: [requireResolve("react/jsx-dev-runtime")],
|
|
45
|
-
format: "cjs",
|
|
46
|
-
target: "node16",
|
|
47
|
-
jsx: "transform",
|
|
48
|
-
jsxFactory: "react",
|
|
49
|
-
allowOverwrite: !0,
|
|
50
|
-
platform: "node",
|
|
51
|
-
define: {
|
|
52
|
-
__DEV__: "true",
|
|
53
|
-
"process.env.NODE_ENV": '"development"'
|
|
54
|
-
},
|
|
55
|
-
external,
|
|
56
|
-
logLevel: "warning",
|
|
57
|
-
...options
|
|
58
|
-
}).then(async () => {
|
|
59
|
-
const outCode = `
|
|
60
|
-
const run = () => {
|
|
61
|
-
${(await (0, import_promises.readFile)(options.outfile, "utf-8")).replace(
|
|
62
|
-
"module.exports = require_react_jsx_dev_runtime_development();",
|
|
63
|
-
"return require_react_jsx_dev_runtime_development();"
|
|
64
|
-
).replace(
|
|
65
|
-
"module.exports = require_react_jsx_runtime_production_min();",
|
|
66
|
-
"return require_react_jsx_runtime_production_min();"
|
|
67
|
-
).replace("process.env.VXRN_REACT_19", "false").replace(`Object.assign(exports, eval("require('@vxrn/vendor/react-jsx-19')"));`, "")}
|
|
68
|
-
}
|
|
69
|
-
const __mod__ = run()
|
|
70
|
-
${["jsx", "jsxs", "jsxDEV", "Fragment"].map(
|
|
71
|
-
(n) => `export const ${n} = __mod__.${n} || __mod__.jsx || ${n === "jsxs" ? "function (type, props, key) { return __mod__.jsxDEV(type, props, key, true) }" : "__mod__.jsxDEV"}`
|
|
72
|
-
).join(`
|
|
73
|
-
`)}
|
|
74
|
-
`;
|
|
75
|
-
await import_fs_extra.default.writeFile(options.outfile, outCode);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
async function buildReact(options = {}) {
|
|
79
|
-
return (0, import_esbuild.build)({
|
|
80
|
-
bundle: !0,
|
|
81
|
-
entryPoints: [requireResolve("react")],
|
|
82
|
-
format: "cjs",
|
|
83
|
-
target: "node16",
|
|
84
|
-
jsx: "transform",
|
|
85
|
-
jsxFactory: "react",
|
|
86
|
-
allowOverwrite: !0,
|
|
87
|
-
platform: "node",
|
|
88
|
-
define: {
|
|
89
|
-
__DEV__: "true",
|
|
90
|
-
"process.env.NODE_ENV": '"development"'
|
|
91
|
-
},
|
|
92
|
-
logLevel: "warning",
|
|
93
|
-
external,
|
|
94
|
-
...options
|
|
95
|
-
}).then(async () => {
|
|
96
|
-
const outCode = `
|
|
97
|
-
const run = () => {
|
|
98
|
-
${(await (0, import_promises.readFile)(options.outfile, "utf-8")).replace(
|
|
99
|
-
/module\.exports = require_react_development(\d*)\(\);/,
|
|
100
|
-
"return require_react_development$1();"
|
|
101
|
-
).replace(
|
|
102
|
-
/module\.exports = require_react_production_min(\d*)\(\);/,
|
|
103
|
-
"return require_react_production_min$1();"
|
|
104
|
-
).replace("process.env.VXRN_REACT_19", "false").replace(`Object.assign(exports, eval("require('@vxrn/vendor/react-19')"));`, "")}
|
|
105
|
-
}
|
|
106
|
-
const __mod__ = run()
|
|
107
|
-
${RExports.map((n) => `export const ${n} = __mod__.${n}`).join(`
|
|
108
|
-
`)}
|
|
109
|
-
export default __mod__
|
|
110
|
-
`;
|
|
111
|
-
await import_fs_extra.default.writeFile(options.outfile, outCode);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
async function buildReactNative(options = {}) {
|
|
115
|
-
return (0, import_esbuild.build)({
|
|
116
|
-
bundle: !0,
|
|
117
|
-
entryPoints: [requireResolve("react-native")],
|
|
118
|
-
format: "cjs",
|
|
119
|
-
target: "node20",
|
|
120
|
-
// 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.
|
|
121
|
-
jsx: "transform",
|
|
122
|
-
jsxFactory: "react",
|
|
123
|
-
allowOverwrite: !0,
|
|
124
|
-
platform: "node",
|
|
125
|
-
external,
|
|
126
|
-
loader: {
|
|
127
|
-
".png": "dataurl",
|
|
128
|
-
".jpg": "dataurl",
|
|
129
|
-
".jpeg": "dataurl",
|
|
130
|
-
".gif": "dataurl"
|
|
131
|
-
},
|
|
132
|
-
define: {
|
|
133
|
-
__DEV__: "true",
|
|
134
|
-
"process.env.NODE_ENV": '"development"'
|
|
135
|
-
},
|
|
136
|
-
logLevel: "warning",
|
|
137
|
-
resolveExtensions: [
|
|
138
|
-
".ios.js",
|
|
139
|
-
".native.js",
|
|
140
|
-
".native.ts",
|
|
141
|
-
".native.tsx",
|
|
142
|
-
".js",
|
|
143
|
-
".jsx",
|
|
144
|
-
".json",
|
|
145
|
-
".ts",
|
|
146
|
-
".tsx",
|
|
147
|
-
".mjs"
|
|
148
|
-
],
|
|
149
|
-
...options,
|
|
150
|
-
plugins: [
|
|
151
|
-
{
|
|
152
|
-
name: "remove-flow",
|
|
153
|
-
setup(build2) {
|
|
154
|
-
build2.onResolve(
|
|
155
|
-
{
|
|
156
|
-
filter: /HMRClient/
|
|
157
|
-
},
|
|
158
|
-
async (input) => ({
|
|
159
|
-
path: requireResolve("@vxrn/vite-native-hmr")
|
|
160
|
-
})
|
|
161
|
-
), build2.onLoad(
|
|
162
|
-
{
|
|
163
|
-
filter: /.*.js/
|
|
164
|
-
},
|
|
165
|
-
async (input) => {
|
|
166
|
-
if (!input.path.includes("react-native") && !input.path.includes("vite-native-hmr"))
|
|
167
|
-
return;
|
|
168
|
-
const code = await (0, import_promises.readFile)(input.path, "utf-8");
|
|
169
|
-
return {
|
|
170
|
-
contents: await (0, import_vite_flow.transformFlow)(code, { development: !0 }),
|
|
171
|
-
loader: "jsx"
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
}).then(async () => {
|
|
179
|
-
const outCode = `
|
|
180
|
-
const run = () => {
|
|
181
|
-
${(await (0, import_promises.readFile)(options.outfile, "utf-8")).replace(
|
|
182
|
-
esbuildCommonJSFunction,
|
|
183
|
-
`
|
|
184
|
-
// replaced commonjs function to allow importing internals
|
|
185
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
186
|
-
if (mod) return mod
|
|
187
|
-
const path = __getOwnPropNames(cb)[0]
|
|
188
|
-
const moduleFn = cb[path]
|
|
189
|
-
mod = { exports: {} }
|
|
190
|
-
moduleFn(mod.exports, mod)
|
|
191
|
-
mod = mod.exports
|
|
192
|
-
|
|
193
|
-
// this is our patch basically allowing importing the inner contents:
|
|
194
|
-
globalThis['__cachedModules'][path.replace(/.*node_modules\\//, '').replace('.js', '')] = mod
|
|
195
|
-
|
|
196
|
-
return mod
|
|
197
|
-
};
|
|
198
|
-
`
|
|
199
|
-
).replace("module.exports = require_react_native();", "return require_react_native();").replace(
|
|
200
|
-
"return require_react_native();",
|
|
201
|
-
"const rn = require_react_native(); rn.AssetRegistry = require_registry(); return rn;"
|
|
202
|
-
)}
|
|
203
|
-
}
|
|
204
|
-
const RN = run()
|
|
205
|
-
${RNExportNames.map((n) => `export const ${n} = RN.${n}`).join(`
|
|
206
|
-
`)}
|
|
207
|
-
`;
|
|
208
|
-
await import_fs_extra.default.writeFile(options.outfile, outCode);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
const esbuildCommonJSFunction = `var __commonJS = (cb, mod) => function __require() {
|
|
212
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
213
|
-
};`, RNExportNames = [
|
|
214
|
-
"registerCallableModule",
|
|
215
|
-
"AccessibilityInfo",
|
|
216
|
-
"ActivityIndicator",
|
|
217
|
-
"Button",
|
|
218
|
-
"DrawerLayoutAndroid",
|
|
219
|
-
"FlatList",
|
|
220
|
-
"Image",
|
|
221
|
-
"ImageBackground",
|
|
222
|
-
"InputAccessoryView",
|
|
223
|
-
"KeyboardAvoidingView",
|
|
224
|
-
"Modal",
|
|
225
|
-
"Pressable",
|
|
226
|
-
"RefreshControl",
|
|
227
|
-
"SafeAreaView",
|
|
228
|
-
"ScrollView",
|
|
229
|
-
"SectionList",
|
|
230
|
-
"StatusBar",
|
|
231
|
-
"Switch",
|
|
232
|
-
"Text",
|
|
233
|
-
"TextInput",
|
|
234
|
-
"Touchable",
|
|
235
|
-
"TouchableHighlight",
|
|
236
|
-
"TouchableNativeFeedback",
|
|
237
|
-
"TouchableOpacity",
|
|
238
|
-
"TouchableWithoutFeedback",
|
|
239
|
-
"View",
|
|
240
|
-
"VirtualizedList",
|
|
241
|
-
"VirtualizedSectionList",
|
|
242
|
-
"ActionSheetIOS",
|
|
243
|
-
"Alert",
|
|
244
|
-
"Animated",
|
|
245
|
-
"Appearance",
|
|
246
|
-
"AppRegistry",
|
|
247
|
-
"AppState",
|
|
248
|
-
"BackHandler",
|
|
249
|
-
"DeviceInfo",
|
|
250
|
-
"DevSettings",
|
|
251
|
-
"Dimensions",
|
|
252
|
-
"Easing",
|
|
253
|
-
"findNodeHandle",
|
|
254
|
-
"I18nManager",
|
|
255
|
-
"InteractionManager",
|
|
256
|
-
"Keyboard",
|
|
257
|
-
"LayoutAnimation",
|
|
258
|
-
"Linking",
|
|
259
|
-
"LogBox",
|
|
260
|
-
"NativeDialogManagerAndroid",
|
|
261
|
-
"NativeEventEmitter",
|
|
262
|
-
"Networking",
|
|
263
|
-
"PanResponder",
|
|
264
|
-
"PermissionsAndroid",
|
|
265
|
-
"PixelRatio",
|
|
266
|
-
"Settings",
|
|
267
|
-
"Share",
|
|
268
|
-
"StyleSheet",
|
|
269
|
-
"Systrace",
|
|
270
|
-
"ToastAndroid",
|
|
271
|
-
"TurboModuleRegistry",
|
|
272
|
-
"UIManager",
|
|
273
|
-
"unstable_batchedUpdates",
|
|
274
|
-
"useAnimatedValue",
|
|
275
|
-
"useColorScheme",
|
|
276
|
-
"useWindowDimensions",
|
|
277
|
-
"UTFSequence",
|
|
278
|
-
"Vibration",
|
|
279
|
-
"YellowBox",
|
|
280
|
-
"DeviceEventEmitter",
|
|
281
|
-
"DynamicColorIOS",
|
|
282
|
-
"NativeAppEventEmitter",
|
|
283
|
-
"NativeModules",
|
|
284
|
-
"Platform",
|
|
285
|
-
"PlatformColor",
|
|
286
|
-
"processColor",
|
|
287
|
-
"requireNativeComponent",
|
|
288
|
-
"RootTagContext",
|
|
289
|
-
"unstable_enableLogBox",
|
|
290
|
-
"AssetRegistry"
|
|
291
|
-
// Normally not exported by React Native, but with a hack we make @react-native/assets-registry/registry available here.
|
|
292
|
-
], RExports = [
|
|
293
|
-
"Children",
|
|
294
|
-
"Component",
|
|
295
|
-
"Fragment",
|
|
296
|
-
"Profiler",
|
|
297
|
-
"PureComponent",
|
|
298
|
-
"StrictMode",
|
|
299
|
-
"Suspense",
|
|
300
|
-
"__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
|
|
301
|
-
"cloneElement",
|
|
302
|
-
"createContext",
|
|
303
|
-
"createElement",
|
|
304
|
-
"createFactory",
|
|
305
|
-
"createRef",
|
|
306
|
-
"forwardRef",
|
|
307
|
-
"isValidElement",
|
|
308
|
-
"lazy",
|
|
309
|
-
"memo",
|
|
310
|
-
"startTransition",
|
|
311
|
-
"unstable_act",
|
|
312
|
-
"useCallback",
|
|
313
|
-
"useContext",
|
|
314
|
-
"useDebugValue",
|
|
315
|
-
"useDeferredValue",
|
|
316
|
-
"useEffect",
|
|
317
|
-
"useId",
|
|
318
|
-
"useImperativeHandle",
|
|
319
|
-
"useInsertionEffect",
|
|
320
|
-
"useLayoutEffect",
|
|
321
|
-
"useMemo",
|
|
322
|
-
"useReducer",
|
|
323
|
-
"useRef",
|
|
324
|
-
"useState",
|
|
325
|
-
"useSyncExternalStore",
|
|
326
|
-
"useTransition",
|
|
327
|
-
"version"
|
|
328
|
-
];
|
|
329
|
-
//# sourceMappingURL=index.js.map
|
|
File without changes
|