@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,246 @@
|
|
|
1
|
+
import {
|
|
2
|
+
transform
|
|
3
|
+
} from "@swc/core";
|
|
4
|
+
import { extname } from "node:path";
|
|
5
|
+
import { merge } from "ts-deepmerge";
|
|
6
|
+
import { configuration } from "./configure";
|
|
7
|
+
import { asyncGeneratorRegex, debug, parsers, runtimePublicPath } from "./constants";
|
|
8
|
+
async function transformSWC(id, code, options, swcOptions) {
|
|
9
|
+
if (id.includes(".vite") || (id = id.split("?")[0].replace(process.cwd(), ""), id === runtimePublicPath))
|
|
10
|
+
return;
|
|
11
|
+
const parser = getParser(id, options.forceJSX);
|
|
12
|
+
if (!parser)
|
|
13
|
+
return;
|
|
14
|
+
const enableNativeCSS = configuration.enableNativeCSS && // temp fix idk why this error:
|
|
15
|
+
// 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
|
|
16
|
+
!id.includes("node_modules"), refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX, reactConfig = {
|
|
17
|
+
refresh,
|
|
18
|
+
development: !options.forceJSX && !options.production,
|
|
19
|
+
runtime: "automatic",
|
|
20
|
+
importSource: "react",
|
|
21
|
+
...enableNativeCSS ? {
|
|
22
|
+
importSource: "react-native-css-interop",
|
|
23
|
+
pragma: "createInteropElement",
|
|
24
|
+
// swc doesnt actually change the import right
|
|
25
|
+
runtime: "classic"
|
|
26
|
+
} : {}
|
|
27
|
+
}, transformOptions = (() => {
|
|
28
|
+
if (options.environment === "client" || options.environment === "ssr")
|
|
29
|
+
return {
|
|
30
|
+
sourceMaps: !0,
|
|
31
|
+
jsc: {
|
|
32
|
+
target: "es2020",
|
|
33
|
+
parser,
|
|
34
|
+
transform: {
|
|
35
|
+
useDefineForClassFields: !0,
|
|
36
|
+
react: reactConfig
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const opts = options.es5 || !process.env.VXRN_USE_BABEL_FOR_GENERATORS && asyncGeneratorRegex.test(code) ? {
|
|
41
|
+
jsc: {
|
|
42
|
+
parser,
|
|
43
|
+
target: "es5",
|
|
44
|
+
transform: {
|
|
45
|
+
useDefineForClassFields: !0,
|
|
46
|
+
react: reactConfig
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
} : {
|
|
50
|
+
...!options.forceJSX && { env: SWC_ENV },
|
|
51
|
+
jsc: {
|
|
52
|
+
...options.forceJSX && { target: "esnext" },
|
|
53
|
+
parser,
|
|
54
|
+
transform: {
|
|
55
|
+
useDefineForClassFields: !0,
|
|
56
|
+
react: reactConfig
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
sourceMaps: shouldSourceMap(),
|
|
62
|
+
module: {
|
|
63
|
+
importInterop: "none",
|
|
64
|
+
type: "nodenext"
|
|
65
|
+
},
|
|
66
|
+
...options.mode === "serve-cjs" && {
|
|
67
|
+
module: {
|
|
68
|
+
importInterop: "none",
|
|
69
|
+
type: "commonjs",
|
|
70
|
+
strict: !0
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
...opts
|
|
74
|
+
};
|
|
75
|
+
})(), finalOptions = merge(
|
|
76
|
+
{
|
|
77
|
+
filename: id,
|
|
78
|
+
swcrc: !1,
|
|
79
|
+
configFile: !1,
|
|
80
|
+
...transformOptions
|
|
81
|
+
},
|
|
82
|
+
swcOptions || {}
|
|
83
|
+
), result = await (async () => {
|
|
84
|
+
try {
|
|
85
|
+
return debug?.(`transformSWC ${id} using options:
|
|
86
|
+
${JSON.stringify(finalOptions, null, 2)}`), await transform(code, finalOptions);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
const message = e.message, fileStartIndex = message.indexOf("\u256D\u2500[");
|
|
89
|
+
if (fileStartIndex !== -1) {
|
|
90
|
+
const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
|
|
91
|
+
match && (e.line = match[1], e.column = match[2]);
|
|
92
|
+
}
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
96
|
+
enableNativeCSS && result.code.includes("createInteropElement") && (result.code = `import { createInteropElement } from 'react-native-css-interop/jsx-dev-runtime'
|
|
97
|
+
${result.code}`);
|
|
98
|
+
const shouldHMR = refresh && refreshContentRE.test(result.code);
|
|
99
|
+
if (options.fixNonTypeSpecificImports || id.includes("node_modules") && parser.syntax === "typescript") {
|
|
100
|
+
const typeExportsMatch = code.match(/^\s*export\s+type\s+([^\s]+)/gi);
|
|
101
|
+
if (typeExportsMatch)
|
|
102
|
+
for (const typeExport of Array.from(typeExportsMatch)) {
|
|
103
|
+
const [_export, _type, name] = typeExport.split(/\s+/);
|
|
104
|
+
if (name.startsWith("{") || name.includes("<")) continue;
|
|
105
|
+
if (!new RegExp(`export (const|let|class|function) ${name}\\s+`).test(
|
|
106
|
+
result.code
|
|
107
|
+
)) {
|
|
108
|
+
const fakeExport = `export let ${name} = {};`;
|
|
109
|
+
console.info(
|
|
110
|
+
` \u26A0\uFE0F Fixing non-type-specifc import in node_module, this should be fixed upstream: ${fakeExport} in ${id}`
|
|
111
|
+
), result.code += `
|
|
112
|
+
${fakeExport}
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return !result || options.noHMR || !shouldHMR ? result : (wrapSourceInRefreshRuntime(id, result, options, shouldHMR), { code: result.code });
|
|
118
|
+
}
|
|
119
|
+
const SWC_ENV = {
|
|
120
|
+
targets: {
|
|
121
|
+
node: "4"
|
|
122
|
+
},
|
|
123
|
+
// debug: true,
|
|
124
|
+
include: [],
|
|
125
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
126
|
+
exclude: [
|
|
127
|
+
"transform-spread",
|
|
128
|
+
"transform-destructuring",
|
|
129
|
+
"transform-object-rest-spread",
|
|
130
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
131
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
132
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
133
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
134
|
+
"transform-async-to-generator",
|
|
135
|
+
"transform-regenerator"
|
|
136
|
+
// Similar to above
|
|
137
|
+
]
|
|
138
|
+
}, refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
|
139
|
+
function shouldSourceMap() {
|
|
140
|
+
return process.env.VXRN_ENABLE_SOURCE_MAP === "1";
|
|
141
|
+
}
|
|
142
|
+
function wrapSourceInRefreshRuntime(id, result, options, shouldHMR) {
|
|
143
|
+
return options.environment === "client" || options.environment === "ssr" ? wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) : wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR);
|
|
144
|
+
}
|
|
145
|
+
function wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) {
|
|
146
|
+
const sourceMap = JSON.parse(result.map);
|
|
147
|
+
sourceMap.mappings = ";;" + sourceMap.mappings, result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
|
|
148
|
+
|
|
149
|
+
${result.code}`, shouldHMR && (sourceMap.mappings = ";;;;;;" + sourceMap.mappings, result.code = `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
|
|
150
|
+
const prevRefreshReg = window.$RefreshReg$;
|
|
151
|
+
const prevRefreshSig = window.$RefreshSig$;
|
|
152
|
+
window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
|
|
153
|
+
window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
154
|
+
|
|
155
|
+
${result.code}
|
|
156
|
+
|
|
157
|
+
window.$RefreshReg$ = prevRefreshReg;
|
|
158
|
+
window.$RefreshSig$ = prevRefreshSig;
|
|
159
|
+
`), result.code += `
|
|
160
|
+
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
161
|
+
RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
|
|
162
|
+
import.meta.hot.accept((nextExports) => {
|
|
163
|
+
if (!nextExports) return;
|
|
164
|
+
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate("${id}", currentExports, nextExports);
|
|
165
|
+
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
function wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR) {
|
|
171
|
+
const prefixCode = options.mode === "build" ? `
|
|
172
|
+
import 'react-native'
|
|
173
|
+
import 'react'
|
|
174
|
+
import '@vxrn/vite-native-client'
|
|
175
|
+
` : "";
|
|
176
|
+
if (options.production)
|
|
177
|
+
return `
|
|
178
|
+
${prefixCode}
|
|
179
|
+
module.url = '${id}'
|
|
180
|
+
${result.code}
|
|
181
|
+
`;
|
|
182
|
+
shouldHMR && (result.code = `const RefreshRuntime = __cachedModules["react-refresh/cjs/react-refresh-runtime.development"];
|
|
183
|
+
const prevRefreshReg = globalThis.$RefreshReg$;
|
|
184
|
+
const prevRefreshSig = globalThis.$RefreshSig$ || (() => {
|
|
185
|
+
console.info("no react refresh setup!")
|
|
186
|
+
return (x) => x
|
|
187
|
+
});
|
|
188
|
+
globalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, "${id}" + " " + id);
|
|
189
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
190
|
+
|
|
191
|
+
${prefixCode}
|
|
192
|
+
|
|
193
|
+
module.url = '${id}'
|
|
194
|
+
module.hot = createHotContext(module.url)
|
|
195
|
+
|
|
196
|
+
${result.code}
|
|
197
|
+
|
|
198
|
+
if (module.hot) {
|
|
199
|
+
globalThis.$RefreshReg$ = prevRefreshReg;
|
|
200
|
+
globalThis.$RefreshSig$ = prevRefreshSig;
|
|
201
|
+
globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))
|
|
202
|
+
}
|
|
203
|
+
`), result.code = `${result.code}
|
|
204
|
+
|
|
205
|
+
if (module.hot) {
|
|
206
|
+
if (module.hot.accept) {
|
|
207
|
+
module.hot.accept((nextExports) => {
|
|
208
|
+
RefreshRuntime.performReactRefresh()
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}`;
|
|
212
|
+
}
|
|
213
|
+
function getParser(id, forceJSX = !1) {
|
|
214
|
+
if (id.endsWith("one-entry-native"))
|
|
215
|
+
return parsers[".tsx"];
|
|
216
|
+
const extension = extname(id);
|
|
217
|
+
let parser = extension ? parsers[extension] : parsers[".js"];
|
|
218
|
+
return extension === ".js" && (forceJSX && (parser = parsers[".jsx"]), id.includes("expo-modules-core") && (parser = parsers[".jsx"])), parser;
|
|
219
|
+
}
|
|
220
|
+
const transformSWCStripJSX = async (id, code) => {
|
|
221
|
+
const parser = getParser(id);
|
|
222
|
+
if (parser)
|
|
223
|
+
return await transform(code, {
|
|
224
|
+
filename: id,
|
|
225
|
+
swcrc: !1,
|
|
226
|
+
configFile: !1,
|
|
227
|
+
sourceMaps: shouldSourceMap(),
|
|
228
|
+
jsc: {
|
|
229
|
+
target: "es2019",
|
|
230
|
+
parser,
|
|
231
|
+
transform: {
|
|
232
|
+
useDefineForClassFields: !0,
|
|
233
|
+
react: {
|
|
234
|
+
development: !0,
|
|
235
|
+
runtime: "automatic",
|
|
236
|
+
refresh: !1
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
export {
|
|
243
|
+
transformSWC,
|
|
244
|
+
transformSWCStripJSX
|
|
245
|
+
};
|
|
246
|
+
//# sourceMappingURL=transformSWC.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/transformSWC.ts"],
|
|
4
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,OAKK;AAEP,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB,OAAO,SAAS,yBAAyB;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,OAAO;AACT;AAGF,QAAM,SAAS,UAAU,IAAI,QAAQ,QAAQ;AAE7C,MAAI,CAAC;AACH;AAGF,QAAM,kBACJ,cAAc;AAAA;AAAA,EAGd,CAAC,GAAG,SAAS,cAAc,GAEvB,UACJ,QAAQ,gBAAgB,SAAS,CAAC,QAAQ,cAAc,CAAC,QAAQ,SAAS,CAAC,QAAQ,UAE/E,cAAc;AAAA,IAClB;AAAA,IACA,aAAa,CAAC,QAAQ,YAAY,CAAC,QAAQ;AAAA,IAC3C,SAAS;AAAA,IACT,cAAc;AAAA,IACd,GAAI,kBACA;AAAA,MACE,cAAc;AAAA,MACd,QAAQ;AAAA;AAAA,MAER,SAAS;AAAA,IACX,IACA,CAAC;AAAA,EACP,GAEM,oBAAoB,MAAkB;AAC1C,QAAI,QAAQ,gBAAgB,YAAY,QAAQ,gBAAgB;AAC9D,aAAO;AAAA,QACL,YAAY;AAAA,QACZ,KAAK;AAAA,UACH,QAAQ;AAAA,UACR;AAAA,UACA,WAAW;AAAA,YACT,yBAAyB;AAAA,YACzB,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAMF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S,IAAlC,QAAQ,KAAK;AAErD,SAAI,cAAc,UACZ,aACF,SAAS,QAAQ,MAAM,IAGrB,GAAG,SAAS,mBAAmB,MACjC,SAAS,QAAQ,MAAM,KAIpB;AACT;AAEO,MAAM,uBAAuB,OAAO,IAAY,SAAiB;AACtE,QAAM,SAAS,UAAU,EAAE;AAC3B,MAAK;AACL,WAAO,MAAM,UAAU,MAAM;AAAA,MAC3B,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,YAAY,gBAAgB;AAAA,MAC5B,KAAK;AAAA,QACH,QAAQ;AAAA,QACR;AAAA,QACA,WAAW;AAAA,UACT,yBAAyB;AAAA,UACzB,OAAO;AAAA,YACL,aAAa;AAAA,YACb,SAAS;AAAA,YACT,SAAS;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AACH;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { transform } from "@swc/core";
|
|
2
|
+
import { extname } from "node:path";
|
|
3
|
+
import { merge } from "ts-deepmerge";
|
|
4
|
+
import { configuration } from "./configure.mjs";
|
|
5
|
+
import { asyncGeneratorRegex, debug, parsers, runtimePublicPath } from "./constants.mjs";
|
|
6
|
+
async function transformSWC(id, code, options, swcOptions) {
|
|
7
|
+
if (id.includes(".vite") || (id = id.split("?")[0].replace(process.cwd(), ""), id === runtimePublicPath)) return;
|
|
8
|
+
const parser = getParser(id, options.forceJSX);
|
|
9
|
+
if (!parser) return;
|
|
10
|
+
const enableNativeCSS = configuration.enableNativeCSS &&
|
|
11
|
+
// temp fix idk why this error:
|
|
12
|
+
// 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
|
|
13
|
+
!id.includes("node_modules"),
|
|
14
|
+
refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX,
|
|
15
|
+
reactConfig = {
|
|
16
|
+
refresh,
|
|
17
|
+
development: !options.forceJSX && !options.production,
|
|
18
|
+
runtime: "automatic",
|
|
19
|
+
importSource: "react",
|
|
20
|
+
...(enableNativeCSS ? {
|
|
21
|
+
importSource: "react-native-css-interop",
|
|
22
|
+
pragma: "createInteropElement",
|
|
23
|
+
// swc doesnt actually change the import right
|
|
24
|
+
runtime: "classic"
|
|
25
|
+
} : {})
|
|
26
|
+
},
|
|
27
|
+
transformOptions = (() => {
|
|
28
|
+
if (options.environment === "client" || options.environment === "ssr") return {
|
|
29
|
+
sourceMaps: !0,
|
|
30
|
+
jsc: {
|
|
31
|
+
target: "es2020",
|
|
32
|
+
parser,
|
|
33
|
+
transform: {
|
|
34
|
+
useDefineForClassFields: !0,
|
|
35
|
+
react: reactConfig
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const opts = options.es5 || !process.env.VXRN_USE_BABEL_FOR_GENERATORS && asyncGeneratorRegex.test(code) ? {
|
|
40
|
+
jsc: {
|
|
41
|
+
parser,
|
|
42
|
+
target: "es5",
|
|
43
|
+
transform: {
|
|
44
|
+
useDefineForClassFields: !0,
|
|
45
|
+
react: reactConfig
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} : {
|
|
49
|
+
...(!options.forceJSX && {
|
|
50
|
+
env: SWC_ENV
|
|
51
|
+
}),
|
|
52
|
+
jsc: {
|
|
53
|
+
...(options.forceJSX && {
|
|
54
|
+
target: "esnext"
|
|
55
|
+
}),
|
|
56
|
+
parser,
|
|
57
|
+
transform: {
|
|
58
|
+
useDefineForClassFields: !0,
|
|
59
|
+
react: reactConfig
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
sourceMaps: shouldSourceMap(),
|
|
65
|
+
module: {
|
|
66
|
+
importInterop: "none",
|
|
67
|
+
type: "nodenext"
|
|
68
|
+
},
|
|
69
|
+
...(options.mode === "serve-cjs" && {
|
|
70
|
+
module: {
|
|
71
|
+
importInterop: "none",
|
|
72
|
+
type: "commonjs",
|
|
73
|
+
strict: !0
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
...opts
|
|
77
|
+
};
|
|
78
|
+
})(),
|
|
79
|
+
finalOptions = merge({
|
|
80
|
+
filename: id,
|
|
81
|
+
swcrc: !1,
|
|
82
|
+
configFile: !1,
|
|
83
|
+
...transformOptions
|
|
84
|
+
}, swcOptions || {}),
|
|
85
|
+
result = await (async () => {
|
|
86
|
+
try {
|
|
87
|
+
return debug?.(`transformSWC ${id} using options:
|
|
88
|
+
${JSON.stringify(finalOptions, null, 2)}`), await transform(code, finalOptions);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
const message = e.message,
|
|
91
|
+
fileStartIndex = message.indexOf("\u256D\u2500[");
|
|
92
|
+
if (fileStartIndex !== -1) {
|
|
93
|
+
const match = message.slice(fileStartIndex).match(/:(\d+):(\d+)]/);
|
|
94
|
+
match && (e.line = match[1], e.column = match[2]);
|
|
95
|
+
}
|
|
96
|
+
throw e;
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
enableNativeCSS && result.code.includes("createInteropElement") && (result.code = `import { createInteropElement } from 'react-native-css-interop/jsx-dev-runtime'
|
|
100
|
+
${result.code}`);
|
|
101
|
+
const shouldHMR = refresh && refreshContentRE.test(result.code);
|
|
102
|
+
if (options.fixNonTypeSpecificImports || id.includes("node_modules") && parser.syntax === "typescript") {
|
|
103
|
+
const typeExportsMatch = code.match(/^\s*export\s+type\s+([^\s]+)/gi);
|
|
104
|
+
if (typeExportsMatch) for (const typeExport of Array.from(typeExportsMatch)) {
|
|
105
|
+
const [_export, _type, name] = typeExport.split(/\s+/);
|
|
106
|
+
if (name.startsWith("{") || name.includes("<")) continue;
|
|
107
|
+
if (!new RegExp(`export (const|let|class|function) ${name}\\s+`).test(result.code)) {
|
|
108
|
+
const fakeExport = `export let ${name} = {};`;
|
|
109
|
+
console.info(` \u26A0\uFE0F Fixing non-type-specifc import in node_module, this should be fixed upstream: ${fakeExport} in ${id}`), result.code += `
|
|
110
|
+
${fakeExport}
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return !result || options.noHMR || !shouldHMR ? result : (wrapSourceInRefreshRuntime(id, result, options, shouldHMR), {
|
|
116
|
+
code: result.code
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const SWC_ENV = {
|
|
120
|
+
targets: {
|
|
121
|
+
node: "4"
|
|
122
|
+
},
|
|
123
|
+
// debug: true,
|
|
124
|
+
include: [],
|
|
125
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
126
|
+
exclude: ["transform-spread", "transform-destructuring", "transform-object-rest-spread",
|
|
127
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
128
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
129
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
130
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
131
|
+
"transform-async-to-generator", "transform-regenerator"
|
|
132
|
+
// Similar to above
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
|
136
|
+
function shouldSourceMap() {
|
|
137
|
+
return process.env.VXRN_ENABLE_SOURCE_MAP === "1";
|
|
138
|
+
}
|
|
139
|
+
function wrapSourceInRefreshRuntime(id, result, options, shouldHMR) {
|
|
140
|
+
return options.environment === "client" || options.environment === "ssr" ? wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) : wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR);
|
|
141
|
+
}
|
|
142
|
+
function wrapSourceInRefreshRuntimeWeb(id, result, shouldHMR) {
|
|
143
|
+
const sourceMap = JSON.parse(result.map);
|
|
144
|
+
sourceMap.mappings = ";;" + sourceMap.mappings, result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
|
|
145
|
+
|
|
146
|
+
${result.code}`, shouldHMR && (sourceMap.mappings = ";;;;;;" + sourceMap.mappings, result.code = `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
|
|
147
|
+
const prevRefreshReg = window.$RefreshReg$;
|
|
148
|
+
const prevRefreshSig = window.$RefreshSig$;
|
|
149
|
+
window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
|
|
150
|
+
window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
151
|
+
|
|
152
|
+
${result.code}
|
|
153
|
+
|
|
154
|
+
window.$RefreshReg$ = prevRefreshReg;
|
|
155
|
+
window.$RefreshSig$ = prevRefreshSig;
|
|
156
|
+
`), result.code += `
|
|
157
|
+
RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
158
|
+
RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
|
|
159
|
+
import.meta.hot.accept((nextExports) => {
|
|
160
|
+
if (!nextExports) return;
|
|
161
|
+
const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate("${id}", currentExports, nextExports);
|
|
162
|
+
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
function wrapSourceInRefreshRuntimeNative(id, result, options, shouldHMR) {
|
|
168
|
+
const prefixCode = options.mode === "build" ? `
|
|
169
|
+
import 'react-native'
|
|
170
|
+
import 'react'
|
|
171
|
+
import '@vxrn/vite-native-client'
|
|
172
|
+
` : "";
|
|
173
|
+
if (options.production) return `
|
|
174
|
+
${prefixCode}
|
|
175
|
+
module.url = '${id}'
|
|
176
|
+
${result.code}
|
|
177
|
+
`;
|
|
178
|
+
shouldHMR && (result.code = `const RefreshRuntime = __cachedModules["react-refresh/cjs/react-refresh-runtime.development"];
|
|
179
|
+
const prevRefreshReg = globalThis.$RefreshReg$;
|
|
180
|
+
const prevRefreshSig = globalThis.$RefreshSig$ || (() => {
|
|
181
|
+
console.info("no react refresh setup!")
|
|
182
|
+
return (x) => x
|
|
183
|
+
});
|
|
184
|
+
globalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, "${id}" + " " + id);
|
|
185
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
186
|
+
|
|
187
|
+
${prefixCode}
|
|
188
|
+
|
|
189
|
+
module.url = '${id}'
|
|
190
|
+
module.hot = createHotContext(module.url)
|
|
191
|
+
|
|
192
|
+
${result.code}
|
|
193
|
+
|
|
194
|
+
if (module.hot) {
|
|
195
|
+
globalThis.$RefreshReg$ = prevRefreshReg;
|
|
196
|
+
globalThis.$RefreshSig$ = prevRefreshSig;
|
|
197
|
+
globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))
|
|
198
|
+
}
|
|
199
|
+
`), result.code = `${result.code}
|
|
200
|
+
|
|
201
|
+
if (module.hot) {
|
|
202
|
+
if (module.hot.accept) {
|
|
203
|
+
module.hot.accept((nextExports) => {
|
|
204
|
+
RefreshRuntime.performReactRefresh()
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}`;
|
|
208
|
+
}
|
|
209
|
+
function getParser(id, forceJSX = !1) {
|
|
210
|
+
if (id.endsWith("one-entry-native")) return parsers[".tsx"];
|
|
211
|
+
const extension = extname(id);
|
|
212
|
+
let parser = extension ? parsers[extension] : parsers[".js"];
|
|
213
|
+
return extension === ".js" && (forceJSX && (parser = parsers[".jsx"]), id.includes("expo-modules-core") && (parser = parsers[".jsx"])), parser;
|
|
214
|
+
}
|
|
215
|
+
const transformSWCStripJSX = async (id, code) => {
|
|
216
|
+
const parser = getParser(id);
|
|
217
|
+
if (parser) return await transform(code, {
|
|
218
|
+
filename: id,
|
|
219
|
+
swcrc: !1,
|
|
220
|
+
configFile: !1,
|
|
221
|
+
sourceMaps: shouldSourceMap(),
|
|
222
|
+
jsc: {
|
|
223
|
+
target: "es2019",
|
|
224
|
+
parser,
|
|
225
|
+
transform: {
|
|
226
|
+
useDefineForClassFields: !0,
|
|
227
|
+
react: {
|
|
228
|
+
development: !0,
|
|
229
|
+
runtime: "automatic",
|
|
230
|
+
refresh: !1
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
export { transformSWC, transformSWCStripJSX };
|
|
237
|
+
//# sourceMappingURL=transformSWC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["transform","extname","merge","configuration","asyncGeneratorRegex","debug","parsers","runtimePublicPath","transformSWC","id","code","options","swcOptions","includes","split","replace","process","cwd","parser","getParser","forceJSX","enableNativeCSS","refresh","environment","production","noHMR","reactConfig","development","runtime","importSource","pragma","transformOptions","sourceMaps","jsc","target","useDefineForClassFields","react","opts","es5","env","VXRN_USE_BABEL_FOR_GENERATORS","test","SWC_ENV","shouldSourceMap","module","importInterop","type","mode","strict","finalOptions","filename","swcrc","configFile","result","JSON","stringify","e","message","fileStartIndex","indexOf","match","slice","line","column","shouldHMR","refreshContentRE","fixNonTypeSpecificImports","syntax","typeExportsMatch","typeExport","Array","from","_export","_type","name","startsWith","RegExp","fakeExport","console","info","wrapSourceInRefreshRuntime","targets","node","include","exclude","VXRN_ENABLE_SOURCE_MAP","wrapSourceInRefreshRuntimeWeb","wrapSourceInRefreshRuntimeNative","sourceMap","parse","map","mappings","prefixCode","endsWith","extension","transformSWCStripJSX"],"sources":["../../src/transformSWC.ts"],"sourcesContent":[null],"mappings":"AAAA,SACEA,SAAA,QAKK;AAEP,SAASC,OAAA,QAAe;AACxB,SAASC,KAAA,QAAa;AACtB,SAASC,aAAA,QAAqB;AAC9B,SAASC,mBAAA,EAAqBC,KAAA,EAAOC,OAAA,EAASC,iBAAA,QAAyB;AAG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