@vxrn/compiler 1.1.397 → 1.1.398
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/configure.cjs +1 -0
- package/dist/cjs/configure.js +1 -0
- package/dist/cjs/configure.js.map +1 -1
- package/dist/cjs/index.cjs +57 -7
- package/dist/cjs/index.js +51 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/refresh-runtime.cjs +1 -3
- package/dist/cjs/refresh-runtime.js +1 -1
- package/dist/cjs/refresh-runtime.js.map +1 -1
- package/dist/cjs/transformBabel.cjs +22 -18
- package/dist/cjs/transformBabel.js +19 -22
- package/dist/cjs/transformBabel.js.map +1 -1
- package/dist/cjs/transformSWC.cjs +77 -76
- package/dist/cjs/transformSWC.js +76 -76
- package/dist/cjs/transformSWC.js.map +1 -1
- package/dist/esm/configure.js +1 -0
- package/dist/esm/configure.js.map +1 -1
- package/dist/esm/configure.mjs +1 -0
- package/dist/esm/configure.mjs.map +1 -1
- package/dist/esm/index.js +53 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +58 -8
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/refresh-runtime.js +1 -1
- package/dist/esm/refresh-runtime.js.map +1 -1
- package/dist/esm/refresh-runtime.mjs +1 -3
- package/dist/esm/refresh-runtime.mjs.map +1 -1
- package/dist/esm/transformBabel.js +19 -21
- package/dist/esm/transformBabel.js.map +1 -1
- package/dist/esm/transformBabel.mjs +22 -18
- package/dist/esm/transformBabel.mjs.map +1 -1
- package/dist/esm/transformSWC.js +77 -77
- package/dist/esm/transformSWC.js.map +1 -1
- package/dist/esm/transformSWC.mjs +78 -77
- package/dist/esm/transformSWC.mjs.map +1 -1
- package/package.json +10 -8
- package/src/configure.ts +2 -0
- package/src/index.ts +108 -11
- package/src/refresh-runtime.js +1 -1
- package/src/transformBabel.ts +36 -17
- package/src/transformSWC.ts +102 -102
- package/types/configure.d.ts +1 -0
- package/types/configure.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/transformBabel.d.ts +1 -1
- package/types/transformBabel.d.ts.map +1 -1
- package/types/transformSWC.d.ts +4 -1
- package/types/transformSWC.d.ts.map +1 -1
- package/dist/cjs/configure.native.js +0 -35
- package/dist/cjs/configure.native.js.map +0 -6
- package/dist/cjs/constants.native.js +0 -65
- package/dist/cjs/constants.native.js.map +0 -6
- package/dist/cjs/index.native.js +0 -123
- package/dist/cjs/index.native.js.map +0 -6
- package/dist/cjs/refresh-runtime.native.js +0 -316
- package/dist/cjs/refresh-runtime.native.js.map +0 -6
- package/dist/cjs/transformBabel.native.js +0 -152
- package/dist/cjs/transformBabel.native.js.map +0 -6
- package/dist/cjs/transformSWC.native.js +0 -275
- package/dist/cjs/transformSWC.native.js.map +0 -6
- package/dist/cjs/types.native.js +0 -15
- package/dist/cjs/types.native.js.map +0 -6
- package/dist/esm/configure.native.js +0 -13
- package/dist/esm/configure.native.js.map +0 -6
- package/dist/esm/constants.native.js +0 -41
- package/dist/esm/constants.native.js.map +0 -6
- package/dist/esm/index.native.js +0 -104
- package/dist/esm/index.native.js.map +0 -6
- package/dist/esm/refresh-runtime.native.js +0 -290
- package/dist/esm/refresh-runtime.native.js.map +0 -6
- package/dist/esm/transformBabel.native.js +0 -125
- package/dist/esm/transformBabel.native.js.map +0 -6
- package/dist/esm/transformSWC.native.js +0 -257
- package/dist/esm/transformSWC.native.js.map +0 -6
- package/dist/esm/types.native.js +0 -1
- package/dist/esm/types.native.js.map +0 -6
package/dist/esm/transformSWC.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
transform
|
|
3
3
|
} from "@swc/core";
|
|
4
|
-
import { extname } from "node:path";
|
|
4
|
+
import { extname, sep } from "node:path";
|
|
5
5
|
import { merge } from "ts-deepmerge";
|
|
6
6
|
import { configuration } from "./configure";
|
|
7
7
|
import { asyncGeneratorRegex, debug, parsers, runtimePublicPath } from "./constants";
|
|
8
|
+
const ignoreId = new RegExp(`node_modules\\${sep}(\\.vite|vite)\\${sep}`);
|
|
8
9
|
async function transformSWC(id, code, options, swcOptions) {
|
|
9
|
-
if (
|
|
10
|
+
if (ignoreId.test(id) || (id = id.split("?")[0].replace(process.cwd(), ""), id === runtimePublicPath))
|
|
10
11
|
return;
|
|
11
12
|
const parser = getParser(id, options.forceJSX);
|
|
12
13
|
if (!parser)
|
|
13
14
|
return;
|
|
14
|
-
const enableNativeCSS = configuration.enableNativeCSS
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const enableNativeCSS = configuration.enableNativeCSS;
|
|
16
|
+
id.includes("node_modules");
|
|
17
|
+
const refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX, reactConfig = {
|
|
17
18
|
refresh,
|
|
18
19
|
development: !options.forceJSX && !options.production,
|
|
19
20
|
runtime: "automatic",
|
|
20
21
|
importSource: "react",
|
|
21
22
|
...enableNativeCSS ? {
|
|
22
|
-
importSource: "
|
|
23
|
-
pragma:
|
|
23
|
+
importSource: "nativewind"
|
|
24
|
+
// pragma: 'createInteropElement',
|
|
25
|
+
// pragmaFrag: '_InteropFragment',
|
|
24
26
|
// swc doesnt actually change the import right
|
|
25
|
-
runtime:
|
|
27
|
+
// runtime: 'classic',
|
|
26
28
|
} : {}
|
|
27
29
|
}, transformOptions = (() => {
|
|
28
30
|
if (options.environment === "client" || options.environment === "ssr")
|
|
@@ -93,9 +95,9 @@ ${JSON.stringify(finalOptions, null, 2)}`), await transform(code, finalOptions);
|
|
|
93
95
|
throw e;
|
|
94
96
|
}
|
|
95
97
|
})();
|
|
96
|
-
enableNativeCSS && result.code.includes("createInteropElement") && (result.code = `import { createInteropElement } from 'react-native-css-interop/jsx-dev-runtime'
|
|
98
|
+
enableNativeCSS && result.code.includes("createInteropElement(") && (result.code = `import { createInteropElement, Fragment as _InteropFragment } from 'react-native-css-interop/jsx-dev-runtime'
|
|
97
99
|
${result.code}`);
|
|
98
|
-
const
|
|
100
|
+
const hasRefreshRuntime = refresh && refreshContentRE.test(result.code);
|
|
99
101
|
if (options.fixNonTypeSpecificImports || id.includes("node_modules") && parser.syntax === "typescript") {
|
|
100
102
|
const typeExportsMatch = code.match(/^\s*export\s+type\s+([^\s]+)/gi);
|
|
101
103
|
if (typeExportsMatch)
|
|
@@ -114,39 +116,16 @@ ${fakeExport}
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
|
-
return
|
|
119
|
+
return result && !options.production && !options.noHMR ? wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime) : result;
|
|
118
120
|
}
|
|
119
|
-
|
|
120
|
-
|
|
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);
|
|
121
|
+
function wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime) {
|
|
122
|
+
return options.environment === "ssr" ? result : options.environment === "client" ? wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime) : wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime);
|
|
144
123
|
}
|
|
145
|
-
function wrapSourceInRefreshRuntimeWeb(id, result,
|
|
146
|
-
const sourceMap = JSON.parse(result.map);
|
|
147
|
-
sourceMap.mappings = ";;" + sourceMap.mappings, result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
|
|
124
|
+
function wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime) {
|
|
125
|
+
const sourceMap = result.map ? JSON.parse(result.map) : void 0;
|
|
126
|
+
return sourceMap && (sourceMap.mappings = ";;" + sourceMap.mappings), result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
|
|
148
127
|
|
|
149
|
-
${result.code}`,
|
|
128
|
+
${result.code}`, hasRefreshRuntime && (sourceMap && (sourceMap.mappings = ";;;;;;" + sourceMap.mappings), result.code = `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
|
|
150
129
|
const prevRefreshReg = window.$RefreshReg$;
|
|
151
130
|
const prevRefreshSig = window.$RefreshSig$;
|
|
152
131
|
window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
|
|
@@ -165,50 +144,71 @@ RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
|
165
144
|
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
|
166
145
|
});
|
|
167
146
|
});
|
|
168
|
-
|
|
147
|
+
`, { code: result.code, map: sourceMap };
|
|
169
148
|
}
|
|
170
|
-
function wrapSourceInRefreshRuntimeNative(id, result, options,
|
|
171
|
-
const
|
|
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) {
|
|
149
|
+
function wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime) {
|
|
150
|
+
const postfixCode = `if (module.hot) {
|
|
206
151
|
if (module.hot.accept) {
|
|
207
152
|
module.hot.accept((nextExports) => {
|
|
208
153
|
RefreshRuntime.performReactRefresh()
|
|
209
154
|
});
|
|
210
155
|
}
|
|
211
156
|
}`;
|
|
157
|
+
if (hasRefreshRuntime) {
|
|
158
|
+
const prefixCode = `const RefreshRuntime = __cachedModules["react-refresh/cjs/react-refresh-runtime.development"];
|
|
159
|
+
const prevRefreshReg = globalThis.$RefreshReg$;
|
|
160
|
+
const prevRefreshSig = globalThis.$RefreshSig$ || (() => {
|
|
161
|
+
console.info("no react refresh setup!")
|
|
162
|
+
return (x) => x
|
|
163
|
+
});
|
|
164
|
+
globalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, "${id}" + " " + id);
|
|
165
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
166
|
+
module.url = '${id}'
|
|
167
|
+
module.hot = createHotContext(module.url)`, sourceMap = result.map ? JSON.parse(result.map) : void 0;
|
|
168
|
+
if (sourceMap) {
|
|
169
|
+
const prefixLen = prefixCode.split(`
|
|
170
|
+
`).length + 1;
|
|
171
|
+
sourceMap.mappings = new Array(prefixLen).fill(";").join("") + sourceMap.mappings;
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
code: `${prefixCode}
|
|
175
|
+
${result.code}
|
|
176
|
+
|
|
177
|
+
if (module.hot) {
|
|
178
|
+
globalThis.$RefreshReg$ = prevRefreshReg;
|
|
179
|
+
globalThis.$RefreshSig$ = prevRefreshSig;
|
|
180
|
+
globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
${postfixCode}
|
|
184
|
+
`,
|
|
185
|
+
map: sourceMap
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return result.code += postfixCode, result;
|
|
189
|
+
}
|
|
190
|
+
const SWC_ENV = {
|
|
191
|
+
targets: {
|
|
192
|
+
node: "4"
|
|
193
|
+
},
|
|
194
|
+
// debug: true,
|
|
195
|
+
include: [],
|
|
196
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
197
|
+
exclude: [
|
|
198
|
+
"transform-spread",
|
|
199
|
+
"transform-destructuring",
|
|
200
|
+
"transform-object-rest-spread",
|
|
201
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
202
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
203
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
204
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
205
|
+
"transform-async-to-generator",
|
|
206
|
+
"transform-regenerator"
|
|
207
|
+
// Similar to above
|
|
208
|
+
]
|
|
209
|
+
}, refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
|
210
|
+
function shouldSourceMap() {
|
|
211
|
+
return process.env.VXRN_ENABLE_SOURCE_MAP === "1";
|
|
212
212
|
}
|
|
213
213
|
function getParser(id, forceJSX = !1) {
|
|
214
214
|
if (id.endsWith("one-entry-native"))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/transformSWC.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,OAKK;AAEP,SAAS,
|
|
4
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,OAKK;AAEP,SAAS,SAAS,WAAW;AAC7B,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB,OAAO,SAAS,yBAAyB;AAGvE,MAAM,WAAW,IAAI,OAAO,iBAAiB,GAAG,mBAAmB,GAAG,EAAE;AAExE,eAAsB,aACpB,IACA,MACA,SACA,YACA;AAUA,MATI,SAAS,KAAK,EAAE,MAIpB,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,kBAAkB,cAAc;AAItC,EAAC,GAAG,SAAS,cAAc;AAE3B,QAAM,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;AAA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ep } from "node:path";
|
|
3
3
|
import { merge } from "ts-deepmerge";
|
|
4
4
|
import { configuration } from "./configure.mjs";
|
|
5
5
|
import { asyncGeneratorRegex, debug, parsers, runtimePublicPath } from "./constants.mjs";
|
|
6
|
+
const ignoreId = new RegExp(`node_modules\\${sep}(\\.vite|vite)\\${sep}`);
|
|
6
7
|
async function transformSWC(id, code, options, swcOptions) {
|
|
7
|
-
if (
|
|
8
|
+
if (ignoreId.test(id) || (id = id.split("?")[0].replace(process.cwd(), ""), id === runtimePublicPath)) return;
|
|
8
9
|
const parser = getParser(id, options.forceJSX);
|
|
9
10
|
if (!parser) return;
|
|
10
|
-
const enableNativeCSS = configuration.enableNativeCSS
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
!id.includes("node_modules"),
|
|
14
|
-
refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX,
|
|
11
|
+
const enableNativeCSS = configuration.enableNativeCSS;
|
|
12
|
+
id.includes("node_modules");
|
|
13
|
+
const refresh = options.environment !== "ssr" && !options.production && !options.noHMR && !options.forceJSX,
|
|
15
14
|
reactConfig = {
|
|
16
15
|
refresh,
|
|
17
16
|
development: !options.forceJSX && !options.production,
|
|
18
17
|
runtime: "automatic",
|
|
19
18
|
importSource: "react",
|
|
20
19
|
...(enableNativeCSS ? {
|
|
21
|
-
importSource: "
|
|
22
|
-
pragma:
|
|
20
|
+
importSource: "nativewind"
|
|
21
|
+
// pragma: 'createInteropElement',
|
|
22
|
+
// pragmaFrag: '_InteropFragment',
|
|
23
23
|
// swc doesnt actually change the import right
|
|
24
|
-
runtime:
|
|
24
|
+
// runtime: 'classic',
|
|
25
25
|
} : {})
|
|
26
26
|
},
|
|
27
27
|
transformOptions = (() => {
|
|
@@ -96,9 +96,9 @@ ${JSON.stringify(finalOptions, null, 2)}`), await transform(code, finalOptions);
|
|
|
96
96
|
throw e;
|
|
97
97
|
}
|
|
98
98
|
})();
|
|
99
|
-
enableNativeCSS && result.code.includes("createInteropElement") && (result.code = `import { createInteropElement } from 'react-native-css-interop/jsx-dev-runtime'
|
|
99
|
+
enableNativeCSS && result.code.includes("createInteropElement(") && (result.code = `import { createInteropElement, Fragment as _InteropFragment } from 'react-native-css-interop/jsx-dev-runtime'
|
|
100
100
|
${result.code}`);
|
|
101
|
-
const
|
|
101
|
+
const hasRefreshRuntime = refresh && refreshContentRE.test(result.code);
|
|
102
102
|
if (options.fixNonTypeSpecificImports || id.includes("node_modules") && parser.syntax === "typescript") {
|
|
103
103
|
const typeExportsMatch = code.match(/^\s*export\s+type\s+([^\s]+)/gi);
|
|
104
104
|
if (typeExportsMatch) for (const typeExport of Array.from(typeExportsMatch)) {
|
|
@@ -112,38 +112,16 @@ ${fakeExport}
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
return
|
|
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";
|
|
115
|
+
return result && !options.production && !options.noHMR ? wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime) : result;
|
|
138
116
|
}
|
|
139
|
-
function wrapSourceInRefreshRuntime(id, result, options,
|
|
140
|
-
return options.environment === "
|
|
117
|
+
function wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime) {
|
|
118
|
+
return options.environment === "ssr" ? result : options.environment === "client" ? wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime) : wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime);
|
|
141
119
|
}
|
|
142
|
-
function wrapSourceInRefreshRuntimeWeb(id, result,
|
|
143
|
-
const sourceMap = JSON.parse(result.map);
|
|
144
|
-
sourceMap.mappings = ";;" + sourceMap.mappings, result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
|
|
120
|
+
function wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime) {
|
|
121
|
+
const sourceMap = result.map ? JSON.parse(result.map) : void 0;
|
|
122
|
+
return sourceMap && (sourceMap.mappings = ";;" + sourceMap.mappings), result.code = `import * as RefreshRuntime from "${runtimePublicPath}";
|
|
145
123
|
|
|
146
|
-
${result.code}`,
|
|
124
|
+
${result.code}`, hasRefreshRuntime && (sourceMap && (sourceMap.mappings = ";;;;;;" + sourceMap.mappings), result.code = `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
|
|
147
125
|
const prevRefreshReg = window.$RefreshReg$;
|
|
148
126
|
const prevRefreshSig = window.$RefreshSig$;
|
|
149
127
|
window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
|
|
@@ -162,49 +140,72 @@ RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
|
162
140
|
if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
|
|
163
141
|
});
|
|
164
142
|
});
|
|
165
|
-
|
|
143
|
+
`, {
|
|
144
|
+
code: result.code,
|
|
145
|
+
map: sourceMap
|
|
146
|
+
};
|
|
166
147
|
}
|
|
167
|
-
function wrapSourceInRefreshRuntimeNative(id, result, options,
|
|
168
|
-
const
|
|
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) {
|
|
148
|
+
function wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime) {
|
|
149
|
+
const postfixCode = `if (module.hot) {
|
|
202
150
|
if (module.hot.accept) {
|
|
203
151
|
module.hot.accept((nextExports) => {
|
|
204
152
|
RefreshRuntime.performReactRefresh()
|
|
205
153
|
});
|
|
206
154
|
}
|
|
207
155
|
}`;
|
|
156
|
+
if (hasRefreshRuntime) {
|
|
157
|
+
const prefixCode = `const RefreshRuntime = __cachedModules["react-refresh/cjs/react-refresh-runtime.development"];
|
|
158
|
+
const prevRefreshReg = globalThis.$RefreshReg$;
|
|
159
|
+
const prevRefreshSig = globalThis.$RefreshSig$ || (() => {
|
|
160
|
+
console.info("no react refresh setup!")
|
|
161
|
+
return (x) => x
|
|
162
|
+
});
|
|
163
|
+
globalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, "${id}" + " " + id);
|
|
164
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
165
|
+
module.url = '${id}'
|
|
166
|
+
module.hot = createHotContext(module.url)`,
|
|
167
|
+
sourceMap = result.map ? JSON.parse(result.map) : void 0;
|
|
168
|
+
if (sourceMap) {
|
|
169
|
+
const prefixLen = prefixCode.split(`
|
|
170
|
+
`).length + 1;
|
|
171
|
+
sourceMap.mappings = new Array(prefixLen).fill(";").join("") + sourceMap.mappings;
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
code: `${prefixCode}
|
|
175
|
+
${result.code}
|
|
176
|
+
|
|
177
|
+
if (module.hot) {
|
|
178
|
+
globalThis.$RefreshReg$ = prevRefreshReg;
|
|
179
|
+
globalThis.$RefreshSig$ = prevRefreshSig;
|
|
180
|
+
globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
${postfixCode}
|
|
184
|
+
`,
|
|
185
|
+
map: sourceMap
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return result.code += postfixCode, result;
|
|
189
|
+
}
|
|
190
|
+
const SWC_ENV = {
|
|
191
|
+
targets: {
|
|
192
|
+
node: "4"
|
|
193
|
+
},
|
|
194
|
+
// debug: true,
|
|
195
|
+
include: [],
|
|
196
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
197
|
+
exclude: ["transform-spread", "transform-destructuring", "transform-object-rest-spread",
|
|
198
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
199
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
200
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
201
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
202
|
+
"transform-async-to-generator", "transform-regenerator"
|
|
203
|
+
// Similar to above
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
refreshContentRE = /\$Refresh(?:Reg|Sig)\$\(/;
|
|
207
|
+
function shouldSourceMap() {
|
|
208
|
+
return process.env.VXRN_ENABLE_SOURCE_MAP === "1";
|
|
208
209
|
}
|
|
209
210
|
function getParser(id, forceJSX = !1) {
|
|
210
211
|
if (id.endsWith("one-entry-native")) return parsers[".tsx"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transform","extname","merge","configuration","asyncGeneratorRegex","debug","parsers","runtimePublicPath","transformSWC","id","code","options","swcOptions","
|
|
1
|
+
{"version":3,"names":["transform","extname","sep","merge","configuration","asyncGeneratorRegex","debug","parsers","runtimePublicPath","ignoreId","RegExp","transformSWC","id","code","options","swcOptions","test","split","replace","process","cwd","parser","getParser","forceJSX","enableNativeCSS","includes","refresh","environment","production","noHMR","reactConfig","development","runtime","importSource","transformOptions","sourceMaps","jsc","target","useDefineForClassFields","react","opts","es5","env","VXRN_USE_BABEL_FOR_GENERATORS","SWC_ENV","shouldSourceMap","module","importInterop","type","mode","strict","finalOptions","filename","swcrc","configFile","result","JSON","stringify","e","message","fileStartIndex","indexOf","match","slice","line","column","hasRefreshRuntime","refreshContentRE","fixNonTypeSpecificImports","syntax","typeExportsMatch","typeExport","Array","from","_export","_type","name","startsWith","fakeExport","console","info","wrapSourceInRefreshRuntime","wrapSourceInRefreshRuntimeWeb","wrapSourceInRefreshRuntimeNative","sourceMap","map","parse","mappings","postfixCode","prefixCode","prefixLen","length","fill","join","targets","node","include","exclude","VXRN_ENABLE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;EACF,CAAC;AACH","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/compiler",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.398",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "tamagui-build",
|
|
22
|
+
"build": "tamagui-build --skip-native",
|
|
23
|
+
"watch": "yarn build --watch",
|
|
23
24
|
"check": "depcheck",
|
|
24
25
|
"clean": "tamagui-build clean",
|
|
25
26
|
"clean:build": "tamagui-build clean:build",
|
|
26
27
|
"lint": "../../node_modules/.bin/biome check src",
|
|
27
|
-
"lint:fix": "../../node_modules/.bin/biome check --write --unsafe src"
|
|
28
|
-
"watch": "tamagui-build --watch"
|
|
28
|
+
"lint:fix": "../../node_modules/.bin/biome check --write --unsafe src"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/core": "^7.26.0",
|
|
@@ -34,16 +34,18 @@
|
|
|
34
34
|
"@babel/plugin-transform-react-jsx": "^7.25.9",
|
|
35
35
|
"@babel/plugin-transform-regenerator": "^7.25.9",
|
|
36
36
|
"@swc/core": "^1.10.4",
|
|
37
|
-
"@vxrn/utils": "1.1.
|
|
38
|
-
"@vxrn/vite-native-client": "1.1.
|
|
37
|
+
"@vxrn/utils": "1.1.398",
|
|
38
|
+
"@vxrn/vite-native-client": "1.1.398",
|
|
39
39
|
"babel-plugin-react-compiler": "^19.0.0-beta-201e55d-20241215",
|
|
40
|
+
"react-native-css-interop": "^0.1.22",
|
|
40
41
|
"ts-deepmerge": "^7.0.2",
|
|
41
42
|
"vite": "^6.0.6"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@tamagui/build": "^1.121.
|
|
45
|
+
"@tamagui/build": "^1.121.10",
|
|
45
46
|
"depcheck": "^1.4.7",
|
|
46
|
-
"react-native": "^0.76.5"
|
|
47
|
+
"react-native": "^0.76.5",
|
|
48
|
+
"rollup": "^4.29.1"
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
51
|
"react-native": "*"
|
package/src/configure.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Environment } from './types'
|
|
2
2
|
|
|
3
3
|
type Conf = {
|
|
4
|
+
enableNativewind?: boolean
|
|
4
5
|
enableReanimated?: boolean
|
|
5
6
|
enableCompiler?: boolean | Environment[]
|
|
6
7
|
enableNativeCSS?: boolean
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export const configuration: Conf = {
|
|
11
|
+
enableNativewind: false,
|
|
10
12
|
enableReanimated: false,
|
|
11
13
|
enableCompiler: false,
|
|
12
14
|
enableNativeCSS: false,
|