@tamagui/vite-plugin 1.61.1 → 1.61.2
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/nativePlugin.js +7 -75
- package/dist/cjs/nativePlugin.js.map +2 -2
- package/dist/cjs/plugin.js +9 -10
- package/dist/cjs/plugin.js.map +1 -1
- package/dist/esm/nativePlugin.js +7 -75
- package/dist/esm/nativePlugin.js.map +1 -1
- package/dist/esm/plugin.js +9 -10
- package/dist/esm/plugin.js.map +1 -1
- package/package.json +7 -6
- package/src/nativePlugin.ts +12 -193
- package/src/plugin.ts +9 -9
- package/types/nativePlugin.d.ts.map +1 -1
package/dist/cjs/nativePlugin.js
CHANGED
|
@@ -32,9 +32,8 @@ __export(nativePlugin_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(nativePlugin_exports);
|
|
34
34
|
var import_path = require("path");
|
|
35
|
-
var import_core = require("@swc/core");
|
|
36
35
|
var import_es_module_lexer = require("es-module-lexer");
|
|
37
|
-
var
|
|
36
|
+
var import_vite_plugin_commonjs = __toESM(require("vite-plugin-commonjs"));
|
|
38
37
|
var import_extensions = require("./extensions");
|
|
39
38
|
var import_getVitePath = require("./getVitePath");
|
|
40
39
|
function nativePlugin(options) {
|
|
@@ -90,52 +89,13 @@ function nativePlugin(options) {
|
|
|
90
89
|
}
|
|
91
90
|
if (options.mode === "build") {
|
|
92
91
|
config.plugins || (config.plugins = []);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"utf-8"
|
|
98
|
-
)
|
|
99
|
-
};
|
|
100
|
-
const virtualModules = {
|
|
101
|
-
"react-native": {
|
|
102
|
-
alias: "virtual:react-native",
|
|
103
|
-
contents: await (0, import_fs_extra.readFile)(
|
|
104
|
-
require.resolve("@tamagui/react-native-prebuilt"),
|
|
105
|
-
"utf-8"
|
|
106
|
-
)
|
|
107
|
-
},
|
|
108
|
-
react: {
|
|
109
|
-
alias: "virtual:react",
|
|
110
|
-
contents: await (0, import_fs_extra.readFile)(
|
|
111
|
-
require.resolve("@tamagui/react-native-prebuilt/react"),
|
|
112
|
-
"utf-8"
|
|
113
|
-
)
|
|
114
|
-
},
|
|
115
|
-
"react/jsx-runtime": jsxRuntime,
|
|
116
|
-
"react/jsx-dev-runtime": jsxRuntime
|
|
117
|
-
};
|
|
118
|
-
config.plugins.unshift({
|
|
119
|
-
name: `swap-react-native`,
|
|
120
|
-
enforce: "pre",
|
|
121
|
-
resolveId(id) {
|
|
122
|
-
for (const targetId in virtualModules) {
|
|
123
|
-
if (id === targetId || id.includes(`node_modules/${targetId}/`)) {
|
|
124
|
-
const info = virtualModules[targetId];
|
|
125
|
-
console.log("resolving...", id, "to", info.alias);
|
|
126
|
-
return info.alias;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
load(id) {
|
|
131
|
-
for (const targetId in virtualModules) {
|
|
132
|
-
const info = virtualModules[targetId];
|
|
133
|
-
if (id === info.alias) {
|
|
134
|
-
return info.contents;
|
|
135
|
-
}
|
|
92
|
+
config.plugins.push(
|
|
93
|
+
(0, import_vite_plugin_commonjs.default)({
|
|
94
|
+
filter: (id) => {
|
|
95
|
+
return id.includes("react-native-screens/lib/module");
|
|
136
96
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
97
|
+
})
|
|
98
|
+
);
|
|
139
99
|
config.build.rollupOptions.plugins.push({
|
|
140
100
|
name: `force-export-all`,
|
|
141
101
|
async transform(code, id) {
|
|
@@ -171,34 +131,6 @@ function nativePlugin(options) {
|
|
|
171
131
|
}
|
|
172
132
|
}
|
|
173
133
|
});
|
|
174
|
-
config.build.rollupOptions.plugins.push({
|
|
175
|
-
name: `native-transform`,
|
|
176
|
-
async transform(code, id) {
|
|
177
|
-
if (id.includes(`node_modules/react/jsx-dev-runtime.js`) || id.includes(`node_modules/react/index.js`) || id.includes(`node_modules/react/cjs/react.development.js`) || id.includes(`node_modules/react-native/index.js`) || id.includes(
|
|
178
|
-
`node_modules/react/cjs/react-jsx-dev-runtime.development.js`
|
|
179
|
-
) || id.includes(`packages/vite-native-client/`)) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
let out = await (0, import_core.transform)(code, {
|
|
183
|
-
filename: id,
|
|
184
|
-
swcrc: false,
|
|
185
|
-
configFile: false,
|
|
186
|
-
sourceMaps: true,
|
|
187
|
-
jsc: {
|
|
188
|
-
target: "es5",
|
|
189
|
-
parser: id.endsWith(".tsx") ? { syntax: "typescript", tsx: true, decorators: true } : id.endsWith(".ts") ? { syntax: "typescript", tsx: false, decorators: true } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true } : { syntax: "ecmascript" },
|
|
190
|
-
transform: {
|
|
191
|
-
useDefineForClassFields: true,
|
|
192
|
-
react: {
|
|
193
|
-
development: true,
|
|
194
|
-
runtime: "automatic"
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
return out;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
134
|
}
|
|
203
135
|
if (process.env.DEBUG) {
|
|
204
136
|
console.log("config..", config);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/nativePlugin.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;
|
|
5
|
-
"names": ["_a"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAIxB,6BAAsB;AAGtB,kCAAqB;AAErB,wBAA2B;AAC3B,yBAA4B;AAErB,SAAS,aAAa,SAA4D;AACvF,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,QAAQ,OAAO,WAAW;AAjB9B;AAkB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CAAC;AAAA,MACH;AAEA,UAAI,QAAQ,IAAI,OAAO;AAErB,gBAAQ,IAAI,YAAY,MAAM;AAAA,MAChC;AAEA,YAAM,sBAAsB,CAAC,QAAuB;AAClD,YAAI,kBAAkB;AAKtB,YAAI,iBAAiB,CAAC,cAAc;AAElC,iBAAO;AAAA,QACT;AAKA,YAAI,eAAe;AAAA,MACrB;AAEA,UAAI,MAAM,QAAQ,OAAO,MAAM,cAAc,MAAM,GAAG;AACpD,mBAAW,KAAK,OAAO,MAAM,cAAc;AACzC,8BAAoB,CAAkB;AAAA,MAC1C,OAAO;AACL,4BAAoB,OAAO,MAAM,cAAc,MAAuB;AAAA,MACxE;AAAA,IACF;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["commonjs", "_a"]
|
|
6
6
|
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -21,7 +21,6 @@ __export(plugin_exports, {
|
|
|
21
21
|
tamaguiPlugin: () => tamaguiPlugin
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
-
var import_vite_plugin_commonjs = require("@originjs/vite-plugin-commonjs");
|
|
25
24
|
var import_static = require("@tamagui/static");
|
|
26
25
|
function tamaguiPlugin(options) {
|
|
27
26
|
const watcher = options.disableWatchTamaguiConfig ? null : (0, import_static.watchTamaguiConfig)(options);
|
|
@@ -71,15 +70,15 @@ function tamaguiPlugin(options) {
|
|
|
71
70
|
include: options.target !== "native" ? ["styleq"] : [],
|
|
72
71
|
esbuildOptions: {
|
|
73
72
|
jsx: "transform",
|
|
74
|
-
plugins: [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
],
|
|
73
|
+
// plugins: [
|
|
74
|
+
// esbuildCommonjs([
|
|
75
|
+
// 'styleq',
|
|
76
|
+
// 'inline-style-prefixer',
|
|
77
|
+
// 'create-react-class',
|
|
78
|
+
// 'copy-to-clipboard',
|
|
79
|
+
// 'escape-string-regexp',
|
|
80
|
+
// ]),
|
|
81
|
+
// ],
|
|
83
82
|
resolveExtensions: [
|
|
84
83
|
".web.js",
|
|
85
84
|
".web.jsx",
|
package/dist/cjs/plugin.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugin.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAmC;AAO5B,SAAS,cACd,SAKQ;AACR,QAAM,UAAU,QAAQ,4BAA4B,WAAO,kCAAmB,OAAO;AAErF,QAAM,aAAa,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,QAAQ,YAAY,WAAW,eAAe,CAAC,CAAC;AACnF,QAAM,gBAAgB,IAAI;AAAA,IACxB,GAAG,WAAW,KAAK,GAAG,CAAC;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,SAAiB;AAAA,IACrB,MAAM;AAAA,IACN,SAAS;AAAA,IAET,MAAM,WAAW;AACf,aAAM,mCAAS,KAAK,CAAC,QAAQ;AAC3B,mCAAK;AAAA,MACP;AAAA,IACF;AAAA,IAEA,OAAO,YAAY,KAAK;AACtB,aAAO;AAAA,QACL,SAAS;AAAA;AAAA;AAAA;AAAA,QAIT;AAAA,QACA,QAAQ;AAAA;AAAA,UAEN,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,SAAS,GAAG,IAAI,SAAS,gBAAgB,OAAO,KAAK;AAAA,UACrD,wBAAwB,KAAK,UAAU,QAAQ,IAAI,YAAY,IAAI,IAAI;AAAA,UACvE,8BAA8B,KAAK;AAAA,YACjC,QAAQ,UAAU,QAAQ,IAAI,kBAAkB;AAAA,UAClD;AAAA,UACA,0BAA0B,KAAK,UAAU,QAAQ,IAAI,cAAc,EAAE;AAAA,UACrE,4BAA4B,KAAK,UAAU,QAAQ,IAAI,gBAAgB,EAAE;AAAA,UACzE,yBAAyB,KAAK,UAAU,KAAK;AAAA,QAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMA,KAAK;AAAA,UACH,YAAY;AAAA,QACd;AAAA,QACA,cAAc;AAAA;AAAA,UAEZ,SAAS,QAAQ,WAAW,WAAW,CAAC,QAAQ,IAAI,CAAC;AAAA,UACrD,gBAAgB;AAAA,YACd,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAUL,mBAAmB;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA,QAAQ;AAAA,cACN,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA;AAAA;AAAA,UAGP,YAAY;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL,GAAI,QAAQ,WAAW,YAAY;AAAA,cACjC,qDAAqD;AAAA,cACrD,2DACE;AAAA,cACF,oBAAoB;AAAA,cACpB,gBAAgB;AAAA,cAChB,GAAI,QAAQ,yBAAyB;AAAA,gBACnC,gBAAgB;AAAA,gBAChB,oBAAoB;AAAA,cACtB;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/nativePlugin.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { dirname } from "path";
|
|
2
|
-
import { transform } from "@swc/core";
|
|
3
2
|
import { parse } from "es-module-lexer";
|
|
4
|
-
import
|
|
3
|
+
import commonjs from "vite-plugin-commonjs";
|
|
5
4
|
import { extensions } from "./extensions";
|
|
6
5
|
import { getVitePath } from "./getVitePath";
|
|
7
6
|
function nativePlugin(options) {
|
|
@@ -56,52 +55,13 @@ function nativePlugin(options) {
|
|
|
56
55
|
}
|
|
57
56
|
if (options.mode === "build") {
|
|
58
57
|
config.plugins ||= [];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"utf-8"
|
|
64
|
-
)
|
|
65
|
-
};
|
|
66
|
-
const virtualModules = {
|
|
67
|
-
"react-native": {
|
|
68
|
-
alias: "virtual:react-native",
|
|
69
|
-
contents: await readFile(
|
|
70
|
-
require.resolve("@tamagui/react-native-prebuilt"),
|
|
71
|
-
"utf-8"
|
|
72
|
-
)
|
|
73
|
-
},
|
|
74
|
-
react: {
|
|
75
|
-
alias: "virtual:react",
|
|
76
|
-
contents: await readFile(
|
|
77
|
-
require.resolve("@tamagui/react-native-prebuilt/react"),
|
|
78
|
-
"utf-8"
|
|
79
|
-
)
|
|
80
|
-
},
|
|
81
|
-
"react/jsx-runtime": jsxRuntime,
|
|
82
|
-
"react/jsx-dev-runtime": jsxRuntime
|
|
83
|
-
};
|
|
84
|
-
config.plugins.unshift({
|
|
85
|
-
name: `swap-react-native`,
|
|
86
|
-
enforce: "pre",
|
|
87
|
-
resolveId(id) {
|
|
88
|
-
for (const targetId in virtualModules) {
|
|
89
|
-
if (id === targetId || id.includes(`node_modules/${targetId}/`)) {
|
|
90
|
-
const info = virtualModules[targetId];
|
|
91
|
-
console.log("resolving...", id, "to", info.alias);
|
|
92
|
-
return info.alias;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
load(id) {
|
|
97
|
-
for (const targetId in virtualModules) {
|
|
98
|
-
const info = virtualModules[targetId];
|
|
99
|
-
if (id === info.alias) {
|
|
100
|
-
return info.contents;
|
|
101
|
-
}
|
|
58
|
+
config.plugins.push(
|
|
59
|
+
commonjs({
|
|
60
|
+
filter: (id) => {
|
|
61
|
+
return id.includes("react-native-screens/lib/module");
|
|
102
62
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
63
|
+
})
|
|
64
|
+
);
|
|
105
65
|
config.build.rollupOptions.plugins.push({
|
|
106
66
|
name: `force-export-all`,
|
|
107
67
|
async transform(code, id) {
|
|
@@ -136,34 +96,6 @@ function nativePlugin(options) {
|
|
|
136
96
|
}
|
|
137
97
|
}
|
|
138
98
|
});
|
|
139
|
-
config.build.rollupOptions.plugins.push({
|
|
140
|
-
name: `native-transform`,
|
|
141
|
-
async transform(code, id) {
|
|
142
|
-
if (id.includes(`node_modules/react/jsx-dev-runtime.js`) || id.includes(`node_modules/react/index.js`) || id.includes(`node_modules/react/cjs/react.development.js`) || id.includes(`node_modules/react-native/index.js`) || id.includes(
|
|
143
|
-
`node_modules/react/cjs/react-jsx-dev-runtime.development.js`
|
|
144
|
-
) || id.includes(`packages/vite-native-client/`)) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
let out = await transform(code, {
|
|
148
|
-
filename: id,
|
|
149
|
-
swcrc: false,
|
|
150
|
-
configFile: false,
|
|
151
|
-
sourceMaps: true,
|
|
152
|
-
jsc: {
|
|
153
|
-
target: "es5",
|
|
154
|
-
parser: id.endsWith(".tsx") ? { syntax: "typescript", tsx: true, decorators: true } : id.endsWith(".ts") ? { syntax: "typescript", tsx: false, decorators: true } : id.endsWith(".jsx") ? { syntax: "ecmascript", jsx: true } : { syntax: "ecmascript" },
|
|
155
|
-
transform: {
|
|
156
|
-
useDefineForClassFields: true,
|
|
157
|
-
react: {
|
|
158
|
-
development: true,
|
|
159
|
-
runtime: "automatic"
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
return out;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
99
|
}
|
|
168
100
|
if (process.env.DEBUG) {
|
|
169
101
|
console.log("config..", config);
|
|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AE;AAC3C,uBAAO;AAAA,cACT,CAAC,EACA,KAAK,GAAG;AAEX,qBAAO,OAAO,OAAO;AAAA,YACvB,SAAS,KAAK;AACZ,sBAAQ,KAAK,sCAAsC,EAAE;AAAA,YACvD;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAEA,UAAI,QAAQ,IAAI,OAAO;AAErB,gBAAQ,IAAI,YAAY,MAAM;AAAA,MAChC;AAEA,YAAM,sBAAsB,CAAC,QAAuB;AAClD,YAAI,kBAAkB;AAKtB,YAAI,iBAAiB,CAAC,cAAc;AAElC,iBAAO;AAAA,QACT;AAKA,YAAI,eAAe;AAAA,MACrB;AAEA,UAAI,MAAM,QAAQ,OAAO,MAAM,cAAc,MAAM,GAAG;AACpD,mBAAW,KAAK,OAAO,MAAM,cAAc;AACzC,8BAAoB,CAAkB;AAAA,MAC1C,OAAO;AACL,4BAAoB,OAAO,MAAM,cAAc,MAAuB;AAAA,MACxE;AAAA,IACF;AAAA,EACF;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { esbuildCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
2
1
|
import { watchTamaguiConfig } from "@tamagui/static";
|
|
3
2
|
function tamaguiPlugin(options) {
|
|
4
3
|
const watcher = options.disableWatchTamaguiConfig ? null : watchTamaguiConfig(options);
|
|
@@ -48,15 +47,15 @@ function tamaguiPlugin(options) {
|
|
|
48
47
|
include: options.target !== "native" ? ["styleq"] : [],
|
|
49
48
|
esbuildOptions: {
|
|
50
49
|
jsx: "transform",
|
|
51
|
-
plugins: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
],
|
|
50
|
+
// plugins: [
|
|
51
|
+
// esbuildCommonjs([
|
|
52
|
+
// 'styleq',
|
|
53
|
+
// 'inline-style-prefixer',
|
|
54
|
+
// 'create-react-class',
|
|
55
|
+
// 'copy-to-clipboard',
|
|
56
|
+
// 'escape-string-regexp',
|
|
57
|
+
// ]),
|
|
58
|
+
// ],
|
|
60
59
|
resolveExtensions: [
|
|
61
60
|
".web.js",
|
|
62
61
|
".web.jsx",
|
package/dist/esm/plugin.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/plugin.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAEA,SAAS,0BAA0B;AAO5B,SAAS,cACd,SAKQ;AACR,QAAM,UAAU,QAAQ,4BAA4B,OAAO,mBAAmB,OAAO;AAErF,QAAM,aAAa,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,QAAQ,YAAY,WAAW,eAAe,CAAC,CAAC;AACnF,QAAM,gBAAgB,IAAI;AAAA,IACxB,GAAG,WAAW,KAAK,GAAG,CAAC;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,SAAiB;AAAA,IACrB,MAAM;AAAA,IACN,SAAS;AAAA,IAET,MAAM,WAAW;AACf,aAAM,mCAAS,KAAK,CAAC,QAAQ;AAC3B,mCAAK;AAAA,MACP;AAAA,IACF;AAAA,IAEA,OAAO,YAAY,KAAK;AACtB,aAAO;AAAA,QACL,SAAS;AAAA;AAAA;AAAA;AAAA,QAIT;AAAA,QACA,QAAQ;AAAA;AAAA,UAEN,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,SAAS,GAAG,IAAI,SAAS,gBAAgB,OAAO,KAAK;AAAA,UACrD,wBAAwB,KAAK,UAAU,QAAQ,IAAI,YAAY,IAAI,IAAI;AAAA,UACvE,8BAA8B,KAAK;AAAA,YACjC,QAAQ,UAAU,QAAQ,IAAI,kBAAkB;AAAA,UAClD;AAAA,UACA,0BAA0B,KAAK,UAAU,QAAQ,IAAI,cAAc,EAAE;AAAA,UACrE,4BAA4B,KAAK,UAAU,QAAQ,IAAI,gBAAgB,EAAE;AAAA,UACzE,yBAAyB,KAAK,UAAU,KAAK;AAAA,QAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMA,KAAK;AAAA,UACH,YAAY;AAAA,QACd;AAAA,QACA,cAAc;AAAA;AAAA,UAEZ,SAAS,QAAQ,WAAW,WAAW,CAAC,QAAQ,IAAI,CAAC;AAAA,UACrD,gBAAgB;AAAA,YACd,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAUL,mBAAmB;AAAA,cACjB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,YACA,QAAQ;AAAA,cACN,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA;AAAA;AAAA,UAGP,YAAY;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL,GAAI,QAAQ,WAAW,YAAY;AAAA,cACjC,qDAAqD;AAAA,cACrD,2DACE;AAAA,cACF,oBAAoB;AAAA,cACpB,gBAAgB;AAAA,cAChB,GAAI,QAAQ,yBAAyB;AAAA,gBACnC,gBAAgB;AAAA,gBAChB,oBAAoB;AAAA,cACtB;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/vite-plugin",
|
|
3
|
-
"version": "1.61.
|
|
3
|
+
"version": "1.61.2",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@rollup/plugin-babel": "^6.0.3",
|
|
33
33
|
"@rollup/plugin-commonjs": "^25.0.4",
|
|
34
34
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
35
|
-
"@tamagui/fake-react-native": "1.61.
|
|
36
|
-
"@tamagui/proxy-worm": "1.61.
|
|
37
|
-
"@tamagui/react-native-svg": "1.61.
|
|
38
|
-
"@tamagui/static": "1.61.
|
|
35
|
+
"@tamagui/fake-react-native": "1.61.2",
|
|
36
|
+
"@tamagui/proxy-worm": "1.61.2",
|
|
37
|
+
"@tamagui/react-native-svg": "1.61.2",
|
|
38
|
+
"@tamagui/static": "1.61.2",
|
|
39
39
|
"esbuild": "^0.19.0",
|
|
40
40
|
"esm-resolve": "^1.0.8",
|
|
41
41
|
"fs-extra": "^11.1.0",
|
|
@@ -43,11 +43,12 @@
|
|
|
43
43
|
"micromatch": ">=4.0.0",
|
|
44
44
|
"outdent": "^0.8.0",
|
|
45
45
|
"rollup": ">=3.7.0",
|
|
46
|
+
"vite-plugin-commonjs": "^0.9.0",
|
|
46
47
|
"vite-plugin-commonjs-externals": "^0.1.3",
|
|
47
48
|
"vite-plugin-externals": "^0.6.2"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@tamagui/build": "1.61.
|
|
51
|
+
"@tamagui/build": "1.61.2"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
package/src/nativePlugin.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { dirname } from 'path'
|
|
|
3
3
|
// import { esbuildCommonjs, viteCommonjs } from '@originjs/vite-plugin-commonjs'
|
|
4
4
|
import { transform } from '@swc/core'
|
|
5
5
|
import { parse } from 'es-module-lexer'
|
|
6
|
-
import { readFile } from 'fs-extra'
|
|
7
6
|
import { OutputOptions } from 'rollup'
|
|
8
7
|
import type { Plugin } from 'vite'
|
|
8
|
+
import commonjs from 'vite-plugin-commonjs'
|
|
9
9
|
|
|
10
10
|
import { extensions } from './extensions'
|
|
11
11
|
import { getVitePath } from './getVitePath'
|
|
@@ -43,40 +43,12 @@ export function nativePlugin(options: { port: number; mode: 'build' | 'serve' })
|
|
|
43
43
|
config.optimizeDeps ??= {}
|
|
44
44
|
|
|
45
45
|
config.optimizeDeps.disabled = true
|
|
46
|
-
// config.optimizeDeps.include = ['escape-string-regexp']
|
|
47
|
-
|
|
48
|
-
// config.plugins ||= []
|
|
49
|
-
// config.plugins.push(viteCommonjs())
|
|
50
|
-
|
|
51
|
-
// config.optimizeDeps.needsInterop ??= []
|
|
52
|
-
// config.optimizeDeps.needsInterop.push('react-native')
|
|
53
|
-
|
|
54
|
-
// config.esbuild = false
|
|
55
46
|
|
|
56
47
|
config.optimizeDeps.esbuildOptions ??= {}
|
|
57
48
|
config.optimizeDeps.esbuildOptions.resolveExtensions = extensions
|
|
58
49
|
|
|
59
50
|
config.optimizeDeps.esbuildOptions.plugins ??= []
|
|
60
51
|
|
|
61
|
-
// CANT DO THIS BECAUSE TAMAGUI PLUGIN DOES THIS! they clobber each other!
|
|
62
|
-
// config.optimizeDeps.esbuildOptions.plugins.push(
|
|
63
|
-
// esbuildCommonjs(['escape-string-regexp'])
|
|
64
|
-
// )
|
|
65
|
-
|
|
66
|
-
// config.optimizeDeps.esbuildOptions.alias = {
|
|
67
|
-
// 'react-native': '@tamagui/proxy-worm',
|
|
68
|
-
// }
|
|
69
|
-
|
|
70
|
-
// config.optimizeDeps.esbuildOptions.plugins.push(
|
|
71
|
-
// esbuildFlowPlugin(
|
|
72
|
-
// /node_modules\/(react-native\/|@react-native\/)/,
|
|
73
|
-
// (_) => 'jsx',
|
|
74
|
-
// {
|
|
75
|
-
// all: true,
|
|
76
|
-
// }
|
|
77
|
-
// )
|
|
78
|
-
// )
|
|
79
|
-
|
|
80
52
|
config.optimizeDeps.esbuildOptions.loader ??= {}
|
|
81
53
|
config.optimizeDeps.esbuildOptions.loader['.js'] = 'jsx'
|
|
82
54
|
|
|
@@ -119,6 +91,14 @@ export function nativePlugin(options: { port: number; mode: 'build' | 'serve' })
|
|
|
119
91
|
if (options.mode === 'build') {
|
|
120
92
|
config.plugins ||= []
|
|
121
93
|
|
|
94
|
+
config.plugins.push(
|
|
95
|
+
commonjs({
|
|
96
|
+
filter: (id) => {
|
|
97
|
+
return id.includes('react-native-screens/lib/module')
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
)
|
|
101
|
+
|
|
122
102
|
// https://vitejs.dev/config/dep-optimization-options.html
|
|
123
103
|
// config.build.commonjsOptions ||= {}
|
|
124
104
|
// config.build.commonjsOptions.include = []
|
|
@@ -135,57 +115,6 @@ export function nativePlugin(options: { port: number; mode: 'build' | 'serve' })
|
|
|
135
115
|
// 'react-native': virtualModuleId,
|
|
136
116
|
// }
|
|
137
117
|
|
|
138
|
-
const jsxRuntime = {
|
|
139
|
-
alias: 'virtual:react-jsx',
|
|
140
|
-
contents: await readFile(
|
|
141
|
-
require.resolve('@tamagui/react-native-prebuilt/jsx-runtime'),
|
|
142
|
-
'utf-8'
|
|
143
|
-
),
|
|
144
|
-
} as const
|
|
145
|
-
|
|
146
|
-
const virtualModules = {
|
|
147
|
-
'react-native': {
|
|
148
|
-
alias: 'virtual:react-native',
|
|
149
|
-
contents: await readFile(
|
|
150
|
-
require.resolve('@tamagui/react-native-prebuilt'),
|
|
151
|
-
'utf-8'
|
|
152
|
-
),
|
|
153
|
-
},
|
|
154
|
-
react: {
|
|
155
|
-
alias: 'virtual:react',
|
|
156
|
-
contents: await readFile(
|
|
157
|
-
require.resolve('@tamagui/react-native-prebuilt/react'),
|
|
158
|
-
'utf-8'
|
|
159
|
-
),
|
|
160
|
-
},
|
|
161
|
-
'react/jsx-runtime': jsxRuntime,
|
|
162
|
-
'react/jsx-dev-runtime': jsxRuntime,
|
|
163
|
-
} as const
|
|
164
|
-
|
|
165
|
-
config.plugins.unshift({
|
|
166
|
-
name: `swap-react-native`,
|
|
167
|
-
enforce: 'pre',
|
|
168
|
-
|
|
169
|
-
resolveId(id) {
|
|
170
|
-
for (const targetId in virtualModules) {
|
|
171
|
-
if (id === targetId || id.includes(`node_modules/${targetId}/`)) {
|
|
172
|
-
const info = virtualModules[targetId]
|
|
173
|
-
console.log('resolving...', id, 'to', info.alias)
|
|
174
|
-
return info.alias
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
load(id) {
|
|
180
|
-
for (const targetId in virtualModules) {
|
|
181
|
-
const info = virtualModules[targetId as keyof typeof virtualModules]
|
|
182
|
-
if (id === info.alias) {
|
|
183
|
-
return info.contents
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
})
|
|
188
|
-
|
|
189
118
|
config.build.rollupOptions.plugins.push({
|
|
190
119
|
name: `force-export-all`,
|
|
191
120
|
|
|
@@ -234,51 +163,6 @@ export function nativePlugin(options: { port: number; mode: 'build' | 'serve' })
|
|
|
234
163
|
}
|
|
235
164
|
},
|
|
236
165
|
})
|
|
237
|
-
|
|
238
|
-
config.build.rollupOptions.plugins.push({
|
|
239
|
-
name: `native-transform`,
|
|
240
|
-
|
|
241
|
-
async transform(code, id) {
|
|
242
|
-
if (
|
|
243
|
-
id.includes(`node_modules/react/jsx-dev-runtime.js`) ||
|
|
244
|
-
id.includes(`node_modules/react/index.js`) ||
|
|
245
|
-
id.includes(`node_modules/react/cjs/react.development.js`) ||
|
|
246
|
-
id.includes(`node_modules/react-native/index.js`) ||
|
|
247
|
-
id.includes(
|
|
248
|
-
`node_modules/react/cjs/react-jsx-dev-runtime.development.js`
|
|
249
|
-
) ||
|
|
250
|
-
id.includes(`packages/vite-native-client/`)
|
|
251
|
-
) {
|
|
252
|
-
return
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
let out = await transform(code, {
|
|
256
|
-
filename: id,
|
|
257
|
-
swcrc: false,
|
|
258
|
-
configFile: false,
|
|
259
|
-
sourceMaps: true,
|
|
260
|
-
jsc: {
|
|
261
|
-
target: 'es5',
|
|
262
|
-
parser: id.endsWith('.tsx')
|
|
263
|
-
? { syntax: 'typescript', tsx: true, decorators: true }
|
|
264
|
-
: id.endsWith('.ts')
|
|
265
|
-
? { syntax: 'typescript', tsx: false, decorators: true }
|
|
266
|
-
: id.endsWith('.jsx')
|
|
267
|
-
? { syntax: 'ecmascript', jsx: true }
|
|
268
|
-
: { syntax: 'ecmascript' },
|
|
269
|
-
transform: {
|
|
270
|
-
useDefineForClassFields: true,
|
|
271
|
-
react: {
|
|
272
|
-
development: true,
|
|
273
|
-
runtime: 'automatic',
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
return out
|
|
280
|
-
},
|
|
281
|
-
})
|
|
282
166
|
}
|
|
283
167
|
|
|
284
168
|
if (process.env.DEBUG) {
|
|
@@ -286,13 +170,12 @@ export function nativePlugin(options: { port: number; mode: 'build' | 'serve' })
|
|
|
286
170
|
console.log('config..', config)
|
|
287
171
|
}
|
|
288
172
|
|
|
289
|
-
// config.build.commonjsOptions = {
|
|
290
|
-
// include: /node_modules\/react\//,
|
|
291
|
-
// }
|
|
292
|
-
|
|
293
173
|
const updateOutputOptions = (out: OutputOptions) => {
|
|
294
174
|
out.preserveModules = true
|
|
295
175
|
|
|
176
|
+
// this fixes some warnings but breaks import { default as config }
|
|
177
|
+
// out.exports = 'named'
|
|
178
|
+
|
|
296
179
|
out.entryFileNames = (chunkInfo) => {
|
|
297
180
|
// ensures we have clean names for our require paths
|
|
298
181
|
return '[name].js'
|
|
@@ -313,67 +196,3 @@ export function nativePlugin(options: { port: number; mode: 'build' | 'serve' })
|
|
|
313
196
|
},
|
|
314
197
|
}
|
|
315
198
|
}
|
|
316
|
-
|
|
317
|
-
// failed attempt to get vite to bundle rn, after a bunch of hacks still trouble
|
|
318
|
-
|
|
319
|
-
// config.build.rollupOptions.plugins.push({
|
|
320
|
-
// name: 'flow-remove-types',
|
|
321
|
-
// transform: async (codeIn, id) => {
|
|
322
|
-
// if (!id.includes('node_modules')) {
|
|
323
|
-
// return
|
|
324
|
-
// }
|
|
325
|
-
// const flowRemoved = flowRemoveTypes(codeIn).toString()
|
|
326
|
-
// let jsxRemoved = await nativeBabelRemoveJSX(flowRemoved)
|
|
327
|
-
|
|
328
|
-
// if (id.includes('BackHandler')) {
|
|
329
|
-
// jsxRemoved = jsxRemoved.replace(
|
|
330
|
-
// `module.exports = require('../Components/UnimplementedViews/UnimplementedView');`,
|
|
331
|
-
// ''
|
|
332
|
-
// )
|
|
333
|
-
// }
|
|
334
|
-
|
|
335
|
-
// if (jsxRemoved.includes(`module.exports = `)) {
|
|
336
|
-
// jsxRemoved = jsxRemoved.replace(
|
|
337
|
-
// /\nmodule.exports = /gi,
|
|
338
|
-
// `\nexport default `
|
|
339
|
-
// )
|
|
340
|
-
// }
|
|
341
|
-
|
|
342
|
-
// if (id.endsWith('ReactNativeViewConfigRegistry.js')) {
|
|
343
|
-
// jsxRemoved =
|
|
344
|
-
// jsxRemoved +
|
|
345
|
-
// `\nconst allExports = {...exports }; export default allExports;`
|
|
346
|
-
// }
|
|
347
|
-
|
|
348
|
-
// if (id.endsWith('ExceptionsManager.js')) {
|
|
349
|
-
// console.log('huh', id)
|
|
350
|
-
// jsxRemoved = jsxRemoved
|
|
351
|
-
// .replace(/\nfunction /g, 'export function')
|
|
352
|
-
// .replace('class SynthenticEvent', 'export class SyntheticEvent')
|
|
353
|
-
// .replace(
|
|
354
|
-
// `module.exports = {
|
|
355
|
-
// decoratedExtraDataKey,
|
|
356
|
-
// handleException,
|
|
357
|
-
// installConsoleErrorReporter,
|
|
358
|
-
// SyntheticError,
|
|
359
|
-
// unstable_setExceptionDecorator,
|
|
360
|
-
// };`,
|
|
361
|
-
// ``
|
|
362
|
-
// )
|
|
363
|
-
// }
|
|
364
|
-
|
|
365
|
-
// return {
|
|
366
|
-
// code: jsxRemoved,
|
|
367
|
-
// map: null,
|
|
368
|
-
// }
|
|
369
|
-
// },
|
|
370
|
-
// })
|
|
371
|
-
|
|
372
|
-
// config.build.rollupOptions.plugins.push(
|
|
373
|
-
// commonJs({
|
|
374
|
-
// include: ['**/node_modules/react-native/**', '**/node_modules/base64-js/**'],
|
|
375
|
-
// // ignoreGlobal: true,
|
|
376
|
-
// transformMixedEsModules: true,
|
|
377
|
-
// defaultIsModuleExports: true,
|
|
378
|
-
// }) as any
|
|
379
|
-
// )
|
package/src/plugin.ts
CHANGED
|
@@ -65,15 +65,15 @@ export function tamaguiPlugin(
|
|
|
65
65
|
include: options.target !== 'native' ? ['styleq'] : [],
|
|
66
66
|
esbuildOptions: {
|
|
67
67
|
jsx: 'transform',
|
|
68
|
-
plugins: [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
],
|
|
68
|
+
// plugins: [
|
|
69
|
+
// esbuildCommonjs([
|
|
70
|
+
// 'styleq',
|
|
71
|
+
// 'inline-style-prefixer',
|
|
72
|
+
// 'create-react-class',
|
|
73
|
+
// 'copy-to-clipboard',
|
|
74
|
+
// 'escape-string-regexp',
|
|
75
|
+
// ]),
|
|
76
|
+
// ],
|
|
77
77
|
resolveExtensions: [
|
|
78
78
|
'.web.js',
|
|
79
79
|
'.web.jsx',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativePlugin.d.ts","sourceRoot":"","sources":["../src/nativePlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nativePlugin.d.ts","sourceRoot":"","sources":["../src/nativePlugin.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC,wBAAgB,YAAY,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;CAAE,GAAG,MAAM,CAyLvF"}
|