@vxrn/compiler 1.1.397
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/LICENSE +45 -0
- package/dist/cjs/configure.cjs +34 -0
- package/dist/cjs/configure.js +29 -0
- package/dist/cjs/configure.js.map +6 -0
- package/dist/cjs/configure.native.js +35 -0
- package/dist/cjs/configure.native.js.map +6 -0
- package/dist/cjs/constants.cjs +65 -0
- package/dist/cjs/constants.js +34 -0
- package/dist/cjs/constants.js.map +6 -0
- package/dist/cjs/constants.native.js +65 -0
- package/dist/cjs/constants.native.js.map +6 -0
- package/dist/cjs/index.cjs +124 -0
- package/dist/cjs/index.js +113 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/index.native.js +123 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/refresh-runtime.cjs +295 -0
- package/dist/cjs/refresh-runtime.js +296 -0
- package/dist/cjs/refresh-runtime.js.map +6 -0
- package/dist/cjs/refresh-runtime.native.js +316 -0
- package/dist/cjs/refresh-runtime.native.js.map +6 -0
- package/dist/cjs/transformBabel.cjs +111 -0
- package/dist/cjs/transformBabel.js +116 -0
- package/dist/cjs/transformBabel.js.map +6 -0
- package/dist/cjs/transformBabel.native.js +152 -0
- package/dist/cjs/transformBabel.native.js.map +6 -0
- package/dist/cjs/transformSWC.cjs +261 -0
- package/dist/cjs/transformSWC.js +256 -0
- package/dist/cjs/transformSWC.js.map +6 -0
- package/dist/cjs/transformSWC.native.js +275 -0
- package/dist/cjs/transformSWC.native.js.map +6 -0
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/types.js.map +6 -0
- package/dist/cjs/types.native.js +15 -0
- package/dist/cjs/types.native.js.map +6 -0
- package/dist/esm/configure.js +13 -0
- package/dist/esm/configure.js.map +6 -0
- package/dist/esm/configure.mjs +10 -0
- package/dist/esm/configure.mjs.map +1 -0
- package/dist/esm/configure.native.js +13 -0
- package/dist/esm/configure.native.js.map +6 -0
- package/dist/esm/constants.js +18 -0
- package/dist/esm/constants.js.map +6 -0
- package/dist/esm/constants.mjs +38 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/constants.native.js +41 -0
- package/dist/esm/constants.native.js.map +6 -0
- package/dist/esm/index.js +102 -0
- package/dist/esm/index.js.map +6 -0
- package/dist/esm/index.mjs +99 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +104 -0
- package/dist/esm/index.native.js.map +6 -0
- package/dist/esm/refresh-runtime.js +280 -0
- package/dist/esm/refresh-runtime.js.map +6 -0
- package/dist/esm/refresh-runtime.mjs +266 -0
- package/dist/esm/refresh-runtime.mjs.map +1 -0
- package/dist/esm/refresh-runtime.native.js +290 -0
- package/dist/esm/refresh-runtime.native.js.map +6 -0
- package/dist/esm/transformBabel.js +95 -0
- package/dist/esm/transformBabel.js.map +6 -0
- package/dist/esm/transformBabel.mjs +76 -0
- package/dist/esm/transformBabel.mjs.map +1 -0
- package/dist/esm/transformBabel.native.js +125 -0
- package/dist/esm/transformBabel.native.js.map +6 -0
- package/dist/esm/transformSWC.js +246 -0
- package/dist/esm/transformSWC.js.map +6 -0
- package/dist/esm/transformSWC.mjs +237 -0
- package/dist/esm/transformSWC.mjs.map +1 -0
- package/dist/esm/transformSWC.native.js +257 -0
- package/dist/esm/transformSWC.native.js.map +6 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +6 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +1 -0
- package/dist/esm/types.native.js.map +6 -0
- package/package.json +54 -0
- package/src/configure.ts +17 -0
- package/src/constants.ts +21 -0
- package/src/index.ts +166 -0
- package/src/refresh-runtime.js +619 -0
- package/src/transformBabel.ts +218 -0
- package/src/transformSWC.ts +381 -0
- package/src/types.ts +36 -0
- package/types/configure.d.ts +10 -0
- package/types/configure.d.ts.map +1 -0
- package/types/constants.d.ts +9 -0
- package/types/constants.d.ts.map +1 -0
- package/types/index.d.ts +12 -0
- package/types/index.d.ts.map +1 -0
- package/types/transformBabel.d.ts +12 -0
- package/types/transformBabel.d.ts.map +1 -0
- package/types/transformSWC.d.ts +7 -0
- package/types/transformSWC.d.ts.map +1 -0
- package/types/types.d.ts +29 -0
- package/types/types.d.ts.map +1 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var transformSWC_exports = {};
|
|
16
|
+
__export(transformSWC_exports, {
|
|
17
|
+
transformSWC: () => transformSWC,
|
|
18
|
+
transformSWCStripJSX: () => transformSWCStripJSX
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(transformSWC_exports);
|
|
21
|
+
var import_core = require("@swc/core"), import_node_path = require("node:path"), import_ts_deepmerge = require("ts-deepmerge"), import_configure = require("./configure"), import_constants = require("./constants");
|
|
22
|
+
async function transformSWC(id, code, options, swcOptions) {
|
|
23
|
+
if (id.includes(".vite") || (id = id.split("?")[0].replace(process.cwd(), ""), id === import_constants.runtimePublicPath))
|
|
24
|
+
return;
|
|
25
|
+
const parser = getParser(id, options.forceJSX);
|
|
26
|
+
if (!parser)
|
|
27
|
+
return;
|
|
28
|
+
const enableNativeCSS = import_configure.configuration.enableNativeCSS && // temp fix idk why this error:
|
|
29
|
+
// node_modules/react-native-reanimated/src/component/LayoutAnimationConfig.tsx (19:9): "createInteropElement" is not exported by "../../node_modules/react-native-css-interop/dist/runtime/jsx-dev-runtime.js", imported by "node_modules/react-native-reanimated/src/component/LayoutAnimationConfig.tsx
|
|
30
|
+
!id.includes("node_modules"), refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX, reactConfig = {
|
|
31
|
+
refresh,
|
|
32
|
+
development: !options.forceJSX && !options.production,
|
|
33
|
+
runtime: "automatic",
|
|
34
|
+
importSource: "react",
|
|
35
|
+
...enableNativeCSS ? {
|
|
36
|
+
importSource: "react-native-css-interop",
|
|
37
|
+
pragma: "createInteropElement",
|
|
38
|
+
// swc doesnt actually change the import right
|
|
39
|
+
runtime: "classic"
|
|
40
|
+
} : {}
|
|
41
|
+
}, transformOptions = (() => {
|
|
42
|
+
if (options.environment === "client" || options.environment === "ssr")
|
|
43
|
+
return {
|
|
44
|
+
sourceMaps: !0,
|
|
45
|
+
jsc: {
|
|
46
|
+
target: "es2020",
|
|
47
|
+
parser,
|
|
48
|
+
transform: {
|
|
49
|
+
useDefineForClassFields: !0,
|
|
50
|
+
react: reactConfig
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const opts = options.es5 || !process.env.VXRN_USE_BABEL_FOR_GENERATORS && import_constants.asyncGeneratorRegex.test(code) ? {
|
|
55
|
+
jsc: {
|
|
56
|
+
parser,
|
|
57
|
+
target: "es5",
|
|
58
|
+
transform: {
|
|
59
|
+
useDefineForClassFields: !0,
|
|
60
|
+
react: reactConfig
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} : {
|
|
64
|
+
...!options.forceJSX && { env: SWC_ENV },
|
|
65
|
+
jsc: {
|
|
66
|
+
...options.forceJSX && { target: "esnext" },
|
|
67
|
+
parser,
|
|
68
|
+
transform: {
|
|
69
|
+
useDefineForClassFields: !0,
|
|
70
|
+
react: reactConfig
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
sourceMaps: shouldSourceMap(),
|
|
76
|
+
module: {
|
|
77
|
+
importInterop: "none",
|
|
78
|
+
type: "nodenext"
|
|
79
|
+
},
|
|
80
|
+
...options.mode === "serve-cjs" && {
|
|
81
|
+
module: {
|
|
82
|
+
importInterop: "none",
|
|
83
|
+
type: "commonjs",
|
|
84
|
+
strict: !0
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
...opts
|
|
88
|
+
};
|
|
89
|
+
})(), finalOptions = (0, import_ts_deepmerge.merge)(
|
|
90
|
+
{
|
|
91
|
+
filename: id,
|
|
92
|
+
swcrc: !1,
|
|
93
|
+
configFile: !1,
|
|
94
|
+
...transformOptions
|
|
95
|
+
},
|
|
96
|
+
swcOptions || {}
|
|
97
|
+
), result = await (async () => {
|
|
98
|
+
try {
|
|
99
|
+
return (0, import_constants.debug)?.(`transformSWC ${id} using options:
|
|
100
|
+
${JSON.stringify(finalOptions, null, 2)}`), await (0, import_core.transform)(code, finalOptions);
|
|
101
|
+
} catch (e) {
|
|
102
|
+
const message = e.message, fileStartIndex = message.indexOf("\u256D\u2500[");
|
|
103
|
+
if (fileStartIndex !== -1) {
|
|
104
|
+
const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
|
|
105
|
+
match && (e.line = match[1], e.column = match[2]);
|
|
106
|
+
}
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
109
|
+
})();
|
|
110
|
+
enableNativeCSS && result.code.includes("createInteropElement") && (result.code = `import { createInteropElement } from 'react-native-css-interop/jsx-dev-runtime'
|
|
111
|
+
${result.code}`);
|
|
112
|
+
const shouldHMR = refresh && refreshContentRE.test(result.code);
|
|
113
|
+
if (options.fixNonTypeSpecificImports || id.includes("node_modules") && parser.syntax === "typescript") {
|
|
114
|
+
const typeExportsMatch = code.match(/^\s*export\s+type\s+([^\s]+)/gi);
|
|
115
|
+
if (typeExportsMatch)
|
|
116
|
+
for (const typeExport of Array.from(typeExportsMatch)) {
|
|
117
|
+
const [_export, _type, name] = typeExport.split(/\s+/);
|
|
118
|
+
if (name.startsWith("{") || name.includes("<")) continue;
|
|
119
|
+
if (!new RegExp(`export (const|let|class|function) ${name}\\s+`).test(
|
|
120
|
+
result.code
|
|
121
|
+
)) {
|
|
122
|
+
const fakeExport = `export let ${name} = {};`;
|
|
123
|
+
console.info(
|
|
124
|
+
` \u26A0\uFE0F Fixing non-type-specifc import in node_module, this should be fixed upstream: ${fakeExport} in ${id}`
|
|
125
|
+
), result.code += `
|
|
126
|
+
${fakeExport}
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return !result || options.noHMR || !shouldHMR ? result : (wrapSourceInRefreshRuntime(id, result, options, shouldHMR), { code: result.code });
|
|
132
|
+
}
|
|
133
|
+
const SWC_ENV = {
|
|
134
|
+
targets: {
|
|
135
|
+
node: "4"
|
|
136
|
+
},
|
|
137
|
+
// debug: true,
|
|
138
|
+
include: [],
|
|
139
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
140
|
+
exclude: [
|
|
141
|
+
"transform-spread",
|
|
142
|
+
"transform-destructuring",
|
|
143
|
+
"transform-object-rest-spread",
|
|
144
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
145
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
146
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
147
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
148
|
+
"transform-async-to-generator",
|
|
149
|
+
"transform-regenerator"
|
|
150
|
+
// Similar to above
|
|
151
|
+
]
|
|
152
|
+
}, refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
|
153
|
+
function shouldSourceMap() {
|
|
154
|
+
return process.env.VXRN_ENABLE_SOURCE_MAP === "1";
|
|
155
|
+
}
|
|
156
|
+
function wrapSourceInRefreshRuntime(id, result, options, shouldHMR) {
|
|
157
|
+
return options.environment === "client" || options.environment === "ssr" ? wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) : wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR);
|
|
158
|
+
}
|
|
159
|
+
function wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) {
|
|
160
|
+
const sourceMap = JSON.parse(result.map);
|
|
161
|
+
sourceMap.mappings = ";;" + sourceMap.mappings, result.code = `import * as RefreshRuntime from "${import_constants.runtimePublicPath}";
|
|
162
|
+
|
|
163
|
+
${result.code}`, shouldHMR && (sourceMap.mappings = ";;;;;;" + sourceMap.mappings, result.code = `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
|
|
164
|
+
const prevRefreshReg = window.$RefreshReg$;
|
|
165
|
+
const prevRefreshSig = window.$RefreshSig$;
|
|
166
|
+
window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
|
|
167
|
+
window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
168
|
+
|
|
169
|
+
${result.code}
|
|
170
|
+
|
|
171
|
+
window.$RefreshReg$ = prevRefreshReg;
|
|
172
|
+
window.$RefreshSig$ = prevRefreshSig;
|
|
173
|
+
`), result.code += `
|
|
174
|
+
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
175
|
+
RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
|
|
176
|
+
import.meta.hot.accept((nextExports) => {
|
|
177
|
+
if (!nextExports) return;
|
|
178
|
+
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate("${id}", currentExports, nextExports);
|
|
179
|
+
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
function wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR) {
|
|
185
|
+
const prefixCode = options.mode === "build" ? `
|
|
186
|
+
import 'react-native'
|
|
187
|
+
import 'react'
|
|
188
|
+
import '@vxrn/vite-native-client'
|
|
189
|
+
` : "";
|
|
190
|
+
if (options.production)
|
|
191
|
+
return `
|
|
192
|
+
${prefixCode}
|
|
193
|
+
module.url = '${id}'
|
|
194
|
+
${result.code}
|
|
195
|
+
`;
|
|
196
|
+
shouldHMR && (result.code = `const RefreshRuntime = __cachedModules["react-refresh/cjs/react-refresh-runtime.development"];
|
|
197
|
+
const prevRefreshReg = globalThis.$RefreshReg$;
|
|
198
|
+
const prevRefreshSig = globalThis.$RefreshSig$ || (() => {
|
|
199
|
+
console.info("no react refresh setup!")
|
|
200
|
+
return (x) => x
|
|
201
|
+
});
|
|
202
|
+
globalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, "${id}" + " " + id);
|
|
203
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
204
|
+
|
|
205
|
+
${prefixCode}
|
|
206
|
+
|
|
207
|
+
module.url = '${id}'
|
|
208
|
+
module.hot = createHotContext(module.url)
|
|
209
|
+
|
|
210
|
+
${result.code}
|
|
211
|
+
|
|
212
|
+
if (module.hot) {
|
|
213
|
+
globalThis.$RefreshReg$ = prevRefreshReg;
|
|
214
|
+
globalThis.$RefreshSig$ = prevRefreshSig;
|
|
215
|
+
globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))
|
|
216
|
+
}
|
|
217
|
+
`), result.code = `${result.code}
|
|
218
|
+
|
|
219
|
+
if (module.hot) {
|
|
220
|
+
if (module.hot.accept) {
|
|
221
|
+
module.hot.accept((nextExports) => {
|
|
222
|
+
RefreshRuntime.performReactRefresh()
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}`;
|
|
226
|
+
}
|
|
227
|
+
function getParser(id, forceJSX = !1) {
|
|
228
|
+
if (id.endsWith("one-entry-native"))
|
|
229
|
+
return import_constants.parsers[".tsx"];
|
|
230
|
+
const extension = (0, import_node_path.extname)(id);
|
|
231
|
+
let parser = extension ? import_constants.parsers[extension] : import_constants.parsers[".js"];
|
|
232
|
+
return extension === ".js" && (forceJSX && (parser = import_constants.parsers[".jsx"]), id.includes("expo-modules-core") && (parser = import_constants.parsers[".jsx"])), parser;
|
|
233
|
+
}
|
|
234
|
+
const transformSWCStripJSX = async (id, code) => {
|
|
235
|
+
const parser = getParser(id);
|
|
236
|
+
if (parser)
|
|
237
|
+
return await (0, import_core.transform)(code, {
|
|
238
|
+
filename: id,
|
|
239
|
+
swcrc: !1,
|
|
240
|
+
configFile: !1,
|
|
241
|
+
sourceMaps: shouldSourceMap(),
|
|
242
|
+
jsc: {
|
|
243
|
+
target: "es2019",
|
|
244
|
+
parser,
|
|
245
|
+
transform: {
|
|
246
|
+
useDefineForClassFields: !0,
|
|
247
|
+
react: {
|
|
248
|
+
development: !0,
|
|
249
|
+
runtime: "automatic",
|
|
250
|
+
refresh: !1
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
//# sourceMappingURL=transformSWC.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/transformSWC.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAMO,sBAEP,mBAAwB,sBACxB,sBAAsB,yBACtB,mBAA8B,wBAC9B,mBAAuE;AAGvE,eAAsB,aACpB,IACA,MACA,SACA,YACA;AAUA,MATI,GAAG,SAAS,OAAO,MAIvB,KAAK,GACF,MAAM,GAAG,EAAE,CAAC,EAEZ,QAAQ,QAAQ,IAAI,GAAG,EAAE,GAExB,OAA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AAC;AACH;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var transformSWC_exports = {};
|
|
17
|
+
__export(transformSWC_exports, {
|
|
18
|
+
transformSWC: () => transformSWC,
|
|
19
|
+
transformSWCStripJSX: () => transformSWCStripJSX
|
|
20
|
+
});
|
|
21
|
+
module.exports = __toCommonJS(transformSWC_exports);
|
|
22
|
+
var import_core = require("@swc/core"), import_node_path = require("node:path"), import_ts_deepmerge = require("ts-deepmerge"), import_configure = require("./configure"), import_constants = require("./constants");
|
|
23
|
+
async function transformSWC(id, code, options, swcOptions) {
|
|
24
|
+
if (!id.includes(".vite") && (id = id.split("?")[0].replace(process.cwd(), ""), id !== import_constants.runtimePublicPath)) {
|
|
25
|
+
var parser = getParser(id, options.forceJSX);
|
|
26
|
+
if (parser) {
|
|
27
|
+
var enableNativeCSS = import_configure.configuration.enableNativeCSS && // temp fix idk why this error:
|
|
28
|
+
// node_modules/react-native-reanimated/src/component/LayoutAnimationConfig.tsx (19:9): "createInteropElement" is not exported by "../../node_modules/react-native-css-interop/dist/runtime/jsx-dev-runtime.js", imported by "node_modules/react-native-reanimated/src/component/LayoutAnimationConfig.tsx
|
|
29
|
+
!id.includes("node_modules"), refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX, reactConfig = {
|
|
30
|
+
refresh,
|
|
31
|
+
development: !options.forceJSX && !options.production,
|
|
32
|
+
runtime: "automatic",
|
|
33
|
+
importSource: "react",
|
|
34
|
+
...enableNativeCSS ? {
|
|
35
|
+
importSource: "react-native-css-interop",
|
|
36
|
+
pragma: "createInteropElement",
|
|
37
|
+
// swc doesnt actually change the import right
|
|
38
|
+
runtime: "classic"
|
|
39
|
+
} : {}
|
|
40
|
+
}, transformOptions = function() {
|
|
41
|
+
if (options.environment === "client" || options.environment === "ssr")
|
|
42
|
+
return {
|
|
43
|
+
sourceMaps: !0,
|
|
44
|
+
jsc: {
|
|
45
|
+
target: "es2020",
|
|
46
|
+
parser,
|
|
47
|
+
transform: {
|
|
48
|
+
useDefineForClassFields: !0,
|
|
49
|
+
react: reactConfig
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var shouldEs5Transform = options.es5 || !process.env.VXRN_USE_BABEL_FOR_GENERATORS && import_constants.asyncGeneratorRegex.test(code), opts = shouldEs5Transform ? {
|
|
54
|
+
jsc: {
|
|
55
|
+
parser,
|
|
56
|
+
target: "es5",
|
|
57
|
+
transform: {
|
|
58
|
+
useDefineForClassFields: !0,
|
|
59
|
+
react: reactConfig
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} : {
|
|
63
|
+
...!options.forceJSX && {
|
|
64
|
+
env: SWC_ENV
|
|
65
|
+
},
|
|
66
|
+
jsc: {
|
|
67
|
+
...options.forceJSX && {
|
|
68
|
+
target: "esnext"
|
|
69
|
+
},
|
|
70
|
+
parser,
|
|
71
|
+
transform: {
|
|
72
|
+
useDefineForClassFields: !0,
|
|
73
|
+
react: reactConfig
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
sourceMaps: shouldSourceMap(),
|
|
79
|
+
module: {
|
|
80
|
+
importInterop: "none",
|
|
81
|
+
type: "nodenext"
|
|
82
|
+
},
|
|
83
|
+
...options.mode === "serve-cjs" && {
|
|
84
|
+
module: {
|
|
85
|
+
importInterop: "none",
|
|
86
|
+
type: "commonjs",
|
|
87
|
+
strict: !0
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
...opts
|
|
91
|
+
};
|
|
92
|
+
}(), finalOptions = (0, import_ts_deepmerge.merge)({
|
|
93
|
+
filename: id,
|
|
94
|
+
swcrc: !1,
|
|
95
|
+
configFile: !1,
|
|
96
|
+
...transformOptions
|
|
97
|
+
}, swcOptions || {}), result = await async function() {
|
|
98
|
+
try {
|
|
99
|
+
return import_constants.debug === null || import_constants.debug === void 0 || (0, import_constants.debug)(`transformSWC ${id} using options:
|
|
100
|
+
${JSON.stringify(finalOptions, null, 2)}`), await (0, import_core.transform)(code, finalOptions);
|
|
101
|
+
} catch (e) {
|
|
102
|
+
var message = e.message, fileStartIndex = message.indexOf("\u256D\u2500[");
|
|
103
|
+
if (fileStartIndex !== -1) {
|
|
104
|
+
var match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
|
|
105
|
+
match && (e.line = match[1], e.column = match[2]);
|
|
106
|
+
}
|
|
107
|
+
throw e;
|
|
108
|
+
}
|
|
109
|
+
}();
|
|
110
|
+
enableNativeCSS && result.code.includes("createInteropElement") && (result.code = `import { createInteropElement } from 'react-native-css-interop/jsx-dev-runtime'
|
|
111
|
+
${result.code}`);
|
|
112
|
+
var shouldHMR = refresh && refreshContentRE.test(result.code);
|
|
113
|
+
if (options.fixNonTypeSpecificImports || id.includes("node_modules") && parser.syntax === "typescript") {
|
|
114
|
+
var typeExportsMatch = code.match(/^\s*export\s+type\s+([^\s]+)/gi);
|
|
115
|
+
if (typeExportsMatch) {
|
|
116
|
+
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
117
|
+
try {
|
|
118
|
+
for (var _iterator = Array.from(typeExportsMatch)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
119
|
+
var typeExport = _step.value, [_export, _type, name] = typeExport.split(/\s+/);
|
|
120
|
+
if (!name.startsWith("{") && !name.includes("<")) {
|
|
121
|
+
var alreadyExported = new RegExp(`export (const|let|class|function) ${name}\\s+`).test(result.code);
|
|
122
|
+
if (!alreadyExported) {
|
|
123
|
+
var fakeExport = `export let ${name} = {};`;
|
|
124
|
+
console.info(` \u26A0\uFE0F Fixing non-type-specifc import in node_module, this should be fixed upstream: ${fakeExport} in ${id}`), result.code += `
|
|
125
|
+
${fakeExport}
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} catch (err) {
|
|
131
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
132
|
+
} finally {
|
|
133
|
+
try {
|
|
134
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
135
|
+
} finally {
|
|
136
|
+
if (_didIteratorError)
|
|
137
|
+
throw _iteratorError;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return !result || options.noHMR || !shouldHMR ? result : (wrapSourceInRefreshRuntime(id, result, options, shouldHMR), {
|
|
143
|
+
code: result.code
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
var SWC_ENV = {
|
|
149
|
+
targets: {
|
|
150
|
+
node: "4"
|
|
151
|
+
},
|
|
152
|
+
// debug: true,
|
|
153
|
+
include: [],
|
|
154
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
155
|
+
exclude: [
|
|
156
|
+
"transform-spread",
|
|
157
|
+
"transform-destructuring",
|
|
158
|
+
"transform-object-rest-spread",
|
|
159
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
160
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
161
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
162
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
163
|
+
"transform-async-to-generator",
|
|
164
|
+
"transform-regenerator"
|
|
165
|
+
]
|
|
166
|
+
}, refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
|
167
|
+
function shouldSourceMap() {
|
|
168
|
+
return process.env.VXRN_ENABLE_SOURCE_MAP === "1";
|
|
169
|
+
}
|
|
170
|
+
function wrapSourceInRefreshRuntime(id, result, options, shouldHMR) {
|
|
171
|
+
return options.environment === "client" || options.environment === "ssr" ? wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) : wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR);
|
|
172
|
+
}
|
|
173
|
+
function wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) {
|
|
174
|
+
var sourceMap = JSON.parse(result.map);
|
|
175
|
+
sourceMap.mappings = ";;" + sourceMap.mappings, result.code = `import * as RefreshRuntime from "${import_constants.runtimePublicPath}";
|
|
176
|
+
|
|
177
|
+
${result.code}`, shouldHMR && (sourceMap.mappings = ";;;;;;" + sourceMap.mappings, result.code = `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
|
|
178
|
+
const prevRefreshReg = window.$RefreshReg$;
|
|
179
|
+
const prevRefreshSig = window.$RefreshSig$;
|
|
180
|
+
window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
|
|
181
|
+
window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
182
|
+
|
|
183
|
+
${result.code}
|
|
184
|
+
|
|
185
|
+
window.$RefreshReg$ = prevRefreshReg;
|
|
186
|
+
window.$RefreshSig$ = prevRefreshSig;
|
|
187
|
+
`), result.code += `
|
|
188
|
+
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
189
|
+
RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
|
|
190
|
+
import.meta.hot.accept((nextExports) => {
|
|
191
|
+
if (!nextExports) return;
|
|
192
|
+
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate("${id}", currentExports, nextExports);
|
|
193
|
+
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
`;
|
|
197
|
+
}
|
|
198
|
+
function wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR) {
|
|
199
|
+
var prefixCode = options.mode === "build" ? `
|
|
200
|
+
import 'react-native'
|
|
201
|
+
import 'react'
|
|
202
|
+
import '@vxrn/vite-native-client'
|
|
203
|
+
` : "";
|
|
204
|
+
if (options.production)
|
|
205
|
+
return `
|
|
206
|
+
${prefixCode}
|
|
207
|
+
module.url = '${id}'
|
|
208
|
+
${result.code}
|
|
209
|
+
`;
|
|
210
|
+
shouldHMR && (result.code = `const RefreshRuntime = __cachedModules["react-refresh/cjs/react-refresh-runtime.development"];
|
|
211
|
+
const prevRefreshReg = globalThis.$RefreshReg$;
|
|
212
|
+
const prevRefreshSig = globalThis.$RefreshSig$ || (() => {
|
|
213
|
+
console.info("no react refresh setup!")
|
|
214
|
+
return (x) => x
|
|
215
|
+
});
|
|
216
|
+
globalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, "${id}" + " " + id);
|
|
217
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
218
|
+
|
|
219
|
+
${prefixCode}
|
|
220
|
+
|
|
221
|
+
module.url = '${id}'
|
|
222
|
+
module.hot = createHotContext(module.url)
|
|
223
|
+
|
|
224
|
+
${result.code}
|
|
225
|
+
|
|
226
|
+
if (module.hot) {
|
|
227
|
+
globalThis.$RefreshReg$ = prevRefreshReg;
|
|
228
|
+
globalThis.$RefreshSig$ = prevRefreshSig;
|
|
229
|
+
globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))
|
|
230
|
+
}
|
|
231
|
+
`), result.code = `${result.code}
|
|
232
|
+
|
|
233
|
+
if (module.hot) {
|
|
234
|
+
if (module.hot.accept) {
|
|
235
|
+
module.hot.accept((nextExports) => {
|
|
236
|
+
RefreshRuntime.performReactRefresh()
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}`;
|
|
240
|
+
}
|
|
241
|
+
function getParser(id) {
|
|
242
|
+
var forceJSX = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
243
|
+
if (id.endsWith("one-entry-native"))
|
|
244
|
+
return import_constants.parsers[".tsx"];
|
|
245
|
+
var extension = (0, import_node_path.extname)(id), parser = extension ? import_constants.parsers[extension] : import_constants.parsers[".js"];
|
|
246
|
+
return extension === ".js" && (forceJSX && (parser = import_constants.parsers[".jsx"]), id.includes("expo-modules-core") && (parser = import_constants.parsers[".jsx"])), parser;
|
|
247
|
+
}
|
|
248
|
+
var transformSWCStripJSX = async function(id, code) {
|
|
249
|
+
var parser = getParser(id);
|
|
250
|
+
if (parser)
|
|
251
|
+
return await (0, import_core.transform)(code, {
|
|
252
|
+
filename: id,
|
|
253
|
+
swcrc: !1,
|
|
254
|
+
configFile: !1,
|
|
255
|
+
sourceMaps: shouldSourceMap(),
|
|
256
|
+
jsc: {
|
|
257
|
+
target: "es2019",
|
|
258
|
+
parser,
|
|
259
|
+
transform: {
|
|
260
|
+
useDefineForClassFields: !0,
|
|
261
|
+
react: {
|
|
262
|
+
development: !0,
|
|
263
|
+
runtime: "automatic",
|
|
264
|
+
refresh: !1
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
271
|
+
0 && (module.exports = {
|
|
272
|
+
transformSWC,
|
|
273
|
+
transformSWCStripJSX
|
|
274
|
+
});
|
|
275
|
+
//# sourceMappingURL=transformSWC.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/one/packages/compiler/src/transformSWC.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;kBAMO,sBAEP,mBAAwB,sBACxB,sBAAsB,yBACtB,mBAA8B,wBAC9B,mBAAuE;AAGvE,eAAsBA,aACpBC,IACAC,MACAC,SACAC,YAAuB;AAEvB,MAAIH,IAAGI,SAAS,OAAA,MAIhBJ,KAAKA,GACFK,MAAM,GAAA,EAAK,CAAA,EAEXC,QAAQC,QAAQC,IAAG,GAAI,EAAA,GAEtBR,OAAOS,qCAIX;QAAMC,SAASC,UAAUX,IAAIE,QAAQU,QAAQ;AAE7C,QAAKF,QAIL;UAAMG,kBACJC,+BAAcD;;MAGd,CAACb,GAAGI,SAAS,cAAA,GAETW,UACJb,QAAQc,gBAAgB,SAAS,CAACd,QAAQe,cAAc,CAACf,QAAQgB,SAAS,CAAChB,QAAQU,UAE/EO,cAAc;QAClBJ;QACAK,aAAa,CAAClB,QAAQU,YAAY,CAACV,QAAQe;QAC3CI,SAAS;QACTC,cAAc;QACd,GAAIT,kBACA;UACES,cAAc;UACdC,QAAQ;;UAERF,SAAS;QACX,IACA,CAAC;MACP,GAEMG,mBAAoB,WAAA;AACxB,YAAItB,QAAQc,gBAAgB,YAAYd,QAAQc,gBAAgB;AAC9D,iBAAO;YACLS,YAAY;YACZC,KAAK;cACHC,QAAQ;cACRjB;cACAkB,WAAW;gBACTC,yBAAyB;gBACzBC,OAAOX;cACT;YACF;UACF;AAGF,YAAMY,qBACJ7B,QAAQ8B,OAAQ,CAACzB,QAAQ0B,IAAIC,iCAAiCC,qCAAoBC,KAAKnC,IAAAA,GAEnFoC,OAAmBN,qBACrB;UACEL,KAAK;YACHhB;YACAiB,QAAQ;YACRC,W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Ac,UACZlF,aACFF,SAASmF,yBAAQ,MAAA,IAGf7F,GAAGI,SAAS,mBAAA,MACdM,SAASmF,yBAAQ,MAAA,KAIdnF;AACT;AAEO,IAAMsF,uBAAuB,eAAOhG,IAAYC,MAAAA;AACrD,MAAMS,SAASC,UAAUX,EAAAA;AACzB,MAAKU;AACL,WAAO,UAAMkB,uBAAU3B,MAAM;MAC3B8C,UAAU/C;MACVgD,OAAO;MACPC,YAAY;MACZxB,YAAYc,gBAAAA;MACZb,KAAK;QACHC,QAAQ;QACRjB;QACAkB,WAAW;UACTC,yBAAyB;UACzBC,OAAO;YACLV,aAAa;YACbC,SAAS;YACTN,SAAS;UACX;QACF;MACF;IACF,CAAA;AACF;",
|
|
5
|
+
"names": ["transformSWC", "id", "code", "options", "swcOptions", "includes", "split", "replace", "process", "cwd", "runtimePublicPath", "parser", "getParser", "forceJSX", "enableNativeCSS", "configuration", "refresh", "environment", "production", "noHMR", "reactConfig", "development", "runtime", "importSource", "pragma", "transformOptions", "sourceMaps", "jsc", "target", "transform", "useDefineForClassFields", "react", "shouldEs5Transform", "es5", "env", "VXRN_USE_BABEL_FOR_GENERATORS", "asyncGeneratorRegex", "test", "opts", "SWC_ENV", "shouldSourceMap", "module", "importInterop", "type", "mode", "strict", "finalOptions", "merge", "filename", "swcrc", "configFile", "result", "debug", "JSON", "stringify", "e", "message", "fileStartIndex", "indexOf", "match", "slice", "line", "column", "shouldHMR", "refreshContentRE", "fixNonTypeSpecificImports", "syntax", "typeExportsMatch", "Array", "from", "typeExport", "_export", "_type", "name", "startsWith", "alreadyExported", "RegExp", "fakeExport", "console", "info", "wrapSourceInRefreshRuntime", "targets", "node", "include", "exclude", "VXRN_ENABLE_SOURCE_MAP", "wrapSourceInRefreshRuntimeWeb", "wrapSourceInRefreshRuntimeNative", "sourceMap", "parse", "map", "mappings", "prefixCode", "endsWith", "parsers", "extension", "extname", "transformSWCStripJSX"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
|
+
get: () => from[key],
|
|
8
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
|
+
});
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
13
|
+
value: !0
|
|
14
|
+
}), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
+
return to;
|
|
10
|
+
};
|
|
11
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
+
var types_exports = {};
|
|
13
|
+
module.exports = __toCommonJS(types_exports);
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var types_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(types_exports);
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const configuration = {
|
|
2
|
+
enableReanimated: !1,
|
|
3
|
+
enableCompiler: !1,
|
|
4
|
+
enableNativeCSS: !1
|
|
5
|
+
};
|
|
6
|
+
function configureVXRNCompilerPlugin(_) {
|
|
7
|
+
Object.assign(configuration, _);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
configuration,
|
|
11
|
+
configureVXRNCompilerPlugin
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=configure.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const configuration = {
|
|
2
|
+
enableReanimated: !1,
|
|
3
|
+
enableCompiler: !1,
|
|
4
|
+
enableNativeCSS: !1
|
|
5
|
+
};
|
|
6
|
+
function configureVXRNCompilerPlugin(_) {
|
|
7
|
+
Object.assign(configuration, _);
|
|
8
|
+
}
|
|
9
|
+
export { configuration, configureVXRNCompilerPlugin };
|
|
10
|
+
//# sourceMappingURL=configure.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["configuration","enableReanimated","enableCompiler","enableNativeCSS","configureVXRNCompilerPlugin","_","Object","assign"],"sources":["../../src/configure.ts"],"sourcesContent":[null],"mappings":"AAQO,MAAMA,aAAA,GAAsB;EACjCC,gBAAA,EAAkB;EAClBC,cAAA,EAAgB;EAChBC,eAAA,EAAiB;AACnB;AAEO,SAASC,4BAA4BC,CAAA,EAAS;EACnDC,MAAA,CAAOC,MAAA,CAAOP,aAAA,EAAeK,CAAC;AAChC","ignoreList":[]}
|