tamagui-loader 1.89.26 → 1.89.27-1708112217600
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/TamaguiPlugin.native.js +536 -204
- package/dist/cjs/TamaguiPlugin.native.js.map +3 -3
- package/dist/cjs/css.native.js +24 -3
- package/dist/cjs/css.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +3 -3
- package/dist/cjs/loader.native.js +200 -42
- package/dist/cjs/loader.native.js.map +3 -3
- package/dist/cjs/shouldExclude.native.js +3 -2
- package/dist/cjs/shouldExclude.native.js.map +3 -3
- package/dist/esm/TamaguiPlugin.native.js +536 -204
- package/dist/esm/TamaguiPlugin.native.js.map +3 -3
- package/dist/esm/css.native.js +24 -3
- package/dist/esm/css.native.js.map +3 -3
- package/dist/esm/index.native.js.map +3 -3
- package/dist/esm/loader.native.js +200 -42
- package/dist/esm/loader.native.js.map +3 -3
- package/dist/esm/shouldExclude.native.js +3 -1
- package/dist/esm/shouldExclude.native.js.map +3 -3
- package/package.json +6 -6
|
@@ -4,227 +4,559 @@ import { loadTamagui, watchTamaguiConfig } from "@tamagui/static";
|
|
|
4
4
|
import buildResolver from "esm-resolve";
|
|
5
5
|
import webpack from "webpack";
|
|
6
6
|
import { shouldExclude } from "./shouldExclude";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (out.endsWith("$")) {
|
|
28
|
-
res.push([out, mod]);
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
res.push([out, this.resolveEsm(mod)]), multiple && res.push([out, this.resolveEsm(mod, !0)]);
|
|
33
|
-
} catch (err) {
|
|
34
|
-
if (out.includes("@gorhom/bottom-sheet"))
|
|
35
|
-
continue;
|
|
36
|
-
(_a = process.env.DEBUG) != null && _a.startsWith("tamagui") && console.info(` withTamagui skipping resolving ${out}`, err);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return res;
|
|
40
|
-
};
|
|
41
|
-
this.isInComponentModule = (fullPath) => this.componentsBaseDirs.some(
|
|
42
|
-
(componentDir) => fullPath.startsWith(componentDir)
|
|
43
|
-
);
|
|
7
|
+
function _array_like_to_array(arr, len) {
|
|
8
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
9
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
10
|
+
arr2[i] = arr[i];
|
|
11
|
+
return arr2;
|
|
12
|
+
}
|
|
13
|
+
function _array_with_holes(arr) {
|
|
14
|
+
if (Array.isArray(arr))
|
|
15
|
+
return arr;
|
|
16
|
+
}
|
|
17
|
+
function _array_without_holes(arr) {
|
|
18
|
+
if (Array.isArray(arr))
|
|
19
|
+
return _array_like_to_array(arr);
|
|
20
|
+
}
|
|
21
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
22
|
+
try {
|
|
23
|
+
var info = gen[key](arg), value = info.value;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
reject(error);
|
|
26
|
+
return;
|
|
44
27
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
28
|
+
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
|
|
29
|
+
}
|
|
30
|
+
function _async_to_generator(fn) {
|
|
31
|
+
return function() {
|
|
32
|
+
var self = this, args = arguments;
|
|
33
|
+
return new Promise(function(resolve, reject) {
|
|
34
|
+
var gen = fn.apply(self, args);
|
|
35
|
+
function _next(value) {
|
|
36
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
37
|
+
}
|
|
38
|
+
function _throw(err) {
|
|
39
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
40
|
+
}
|
|
41
|
+
_next(void 0);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function _class_call_check(instance, Constructor) {
|
|
46
|
+
if (!(instance instanceof Constructor))
|
|
47
|
+
throw new TypeError("Cannot call a class as a function");
|
|
48
|
+
}
|
|
49
|
+
function _defineProperties(target, props) {
|
|
50
|
+
for (var i = 0; i < props.length; i++) {
|
|
51
|
+
var descriptor = props[i];
|
|
52
|
+
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
}
|
|
55
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
56
|
+
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
|
|
57
|
+
}
|
|
58
|
+
function _define_property(obj, key, value) {
|
|
59
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
60
|
+
value,
|
|
61
|
+
enumerable: !0,
|
|
62
|
+
configurable: !0,
|
|
63
|
+
writable: !0
|
|
64
|
+
}) : obj[key] = value, obj;
|
|
65
|
+
}
|
|
66
|
+
function _iterable_to_array(iter) {
|
|
67
|
+
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
68
|
+
return Array.from(iter);
|
|
69
|
+
}
|
|
70
|
+
function _iterable_to_array_limit(arr, i) {
|
|
71
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
72
|
+
if (_i != null) {
|
|
73
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
74
|
+
try {
|
|
75
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
76
|
+
;
|
|
77
|
+
} catch (err) {
|
|
78
|
+
_d = !0, _e = err;
|
|
79
|
+
} finally {
|
|
80
|
+
try {
|
|
81
|
+
!_n && _i.return != null && _i.return();
|
|
82
|
+
} finally {
|
|
83
|
+
if (_d)
|
|
84
|
+
throw _e;
|
|
61
85
|
}
|
|
62
|
-
|
|
86
|
+
}
|
|
87
|
+
return _arr;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function _non_iterable_rest() {
|
|
91
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
|
+
}
|
|
93
|
+
function _non_iterable_spread() {
|
|
94
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
95
|
+
}
|
|
96
|
+
function _object_spread(target) {
|
|
97
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
98
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
99
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
100
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
101
|
+
}))), ownKeys2.forEach(function(key) {
|
|
102
|
+
_define_property(target, key, source[key]);
|
|
63
103
|
});
|
|
64
104
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
["react/jsx-runtime.js", "react/jsx-runtime"],
|
|
75
|
-
["react/jsx-runtime", "react/jsx-runtime"],
|
|
76
|
-
["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"],
|
|
77
|
-
["react/jsx-dev-runtime", "react/jsx-dev-runtime"],
|
|
78
|
-
["react-native-reanimated", "react-native-reanimated"],
|
|
79
|
-
["@testing-library/react-native", "@tamagui/proxy-worm"],
|
|
80
|
-
["@gorhom/bottom-sheet$", "@gorhom/bottom-sheet"],
|
|
81
|
-
// fix reanimated 3
|
|
82
|
-
["react-native/Libraries/Renderer/shims/ReactFabric", "@tamagui/proxy-worm"],
|
|
83
|
-
// @ts-expect-error deprecated
|
|
84
|
-
...this.options.useReactNativeWebLite ? [
|
|
85
|
-
["react-native$", "react-native-web-lite"],
|
|
86
|
-
["react-native-web$", "react-native-web-lite"]
|
|
87
|
-
] : [
|
|
88
|
-
["react-native$", "react-native-web"],
|
|
89
|
-
["react-native-web$", "react-native-web"]
|
|
90
|
-
]
|
|
91
|
-
])
|
|
92
|
-
);
|
|
105
|
+
return target;
|
|
106
|
+
}
|
|
107
|
+
function ownKeys(object, enumerableOnly) {
|
|
108
|
+
var keys = Object.keys(object);
|
|
109
|
+
if (Object.getOwnPropertySymbols) {
|
|
110
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
111
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
112
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
113
|
+
})), keys.push.apply(keys, symbols);
|
|
93
114
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Array.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
return keys;
|
|
116
|
+
}
|
|
117
|
+
function _object_spread_props(target, source) {
|
|
118
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
119
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
120
|
+
}), target;
|
|
121
|
+
}
|
|
122
|
+
function _sliced_to_array(arr, i) {
|
|
123
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
124
|
+
}
|
|
125
|
+
function _to_consumable_array(arr) {
|
|
126
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
127
|
+
}
|
|
128
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
129
|
+
if (o) {
|
|
130
|
+
if (typeof o == "string")
|
|
131
|
+
return _array_like_to_array(o, minLen);
|
|
132
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
133
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
134
|
+
return Array.from(n);
|
|
135
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
136
|
+
return _array_like_to_array(o, minLen);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function _ts_generator(thisArg, body) {
|
|
140
|
+
var f, y, t, g, _ = {
|
|
141
|
+
label: 0,
|
|
142
|
+
sent: function() {
|
|
143
|
+
if (t[0] & 1)
|
|
144
|
+
throw t[1];
|
|
145
|
+
return t[1];
|
|
146
|
+
},
|
|
147
|
+
trys: [],
|
|
148
|
+
ops: []
|
|
149
|
+
};
|
|
150
|
+
return g = {
|
|
151
|
+
next: verb(0),
|
|
152
|
+
throw: verb(1),
|
|
153
|
+
return: verb(2)
|
|
154
|
+
}, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
|
|
155
|
+
return this;
|
|
156
|
+
}), g;
|
|
157
|
+
function verb(n) {
|
|
158
|
+
return function(v) {
|
|
159
|
+
return step([
|
|
160
|
+
n,
|
|
161
|
+
v
|
|
162
|
+
]);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function step(op) {
|
|
166
|
+
if (f)
|
|
167
|
+
throw new TypeError("Generator is already executing.");
|
|
168
|
+
for (; _; )
|
|
117
169
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
170
|
+
if (f = 1, y && (t = op[0] & 2 ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
171
|
+
return t;
|
|
172
|
+
switch (y = 0, t && (op = [
|
|
173
|
+
op[0] & 2,
|
|
174
|
+
t.value
|
|
175
|
+
]), op[0]) {
|
|
176
|
+
case 0:
|
|
177
|
+
case 1:
|
|
178
|
+
t = op;
|
|
179
|
+
break;
|
|
180
|
+
case 4:
|
|
181
|
+
return _.label++, {
|
|
182
|
+
value: op[1],
|
|
183
|
+
done: !1
|
|
184
|
+
};
|
|
185
|
+
case 5:
|
|
186
|
+
_.label++, y = op[1], op = [
|
|
187
|
+
0
|
|
188
|
+
];
|
|
189
|
+
continue;
|
|
190
|
+
case 7:
|
|
191
|
+
op = _.ops.pop(), _.trys.pop();
|
|
192
|
+
continue;
|
|
193
|
+
default:
|
|
194
|
+
if (t = _.trys, !(t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
195
|
+
_ = 0;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
199
|
+
_.label = op[1];
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
203
|
+
_.label = t[1], t = op;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
if (t && _.label < t[2]) {
|
|
207
|
+
_.label = t[2], _.ops.push(op);
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
t[2] && _.ops.pop(), _.trys.pop();
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
op = body.call(thisArg, _);
|
|
214
|
+
} catch (e) {
|
|
215
|
+
op = [
|
|
216
|
+
6,
|
|
217
|
+
e
|
|
218
|
+
], y = 0;
|
|
219
|
+
} finally {
|
|
220
|
+
f = t = 0;
|
|
131
221
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
222
|
+
if (op[0] & 5)
|
|
223
|
+
throw op[1];
|
|
224
|
+
return {
|
|
225
|
+
value: op[0] ? op[1] : void 0,
|
|
226
|
+
done: !0
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
var dir = process.cwd(), resolver = buildResolver(join(dir, "index.js"), {
|
|
231
|
+
constraints: "node"
|
|
232
|
+
}), TamaguiPlugin = /* @__PURE__ */ function() {
|
|
233
|
+
"use strict";
|
|
234
|
+
function TamaguiPlugin2() {
|
|
235
|
+
var _this = this, options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
236
|
+
platform: "web",
|
|
237
|
+
components: [
|
|
238
|
+
"@tamagui/core"
|
|
239
|
+
]
|
|
240
|
+
}, _this1 = this;
|
|
241
|
+
_class_call_check(this, TamaguiPlugin2), _define_property(this, "options", void 0), _define_property(this, "pluginName", void 0), _define_property(this, "resolveEsm", void 0), _define_property(this, "safeResolves", void 0), _define_property(this, "isInComponentModule", void 0), this.options = options, this.pluginName = "TamaguiPlugin", this.resolveEsm = function(relativePath) {
|
|
242
|
+
var onlyRequire = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
243
|
+
if (_this1.options.isServer || onlyRequire)
|
|
244
|
+
return require.resolve(relativePath);
|
|
245
|
+
var esm = resolver(relativePath);
|
|
246
|
+
return esm ? path.join(dir, esm) : require.resolve(relativePath);
|
|
247
|
+
}, this.safeResolves = function(resolves) {
|
|
248
|
+
var multiple = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, res = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
249
|
+
try {
|
|
250
|
+
for (var _iterator = resolves[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
251
|
+
var _step_value = _sliced_to_array(_step.value, 2), out = _step_value[0], mod = _step_value[1];
|
|
252
|
+
if (out.endsWith("$")) {
|
|
253
|
+
res.push([
|
|
254
|
+
out,
|
|
255
|
+
mod
|
|
256
|
+
]);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
res.push([
|
|
261
|
+
out,
|
|
262
|
+
_this1.resolveEsm(mod)
|
|
263
|
+
]), multiple && res.push([
|
|
264
|
+
out,
|
|
265
|
+
_this1.resolveEsm(mod, !0)
|
|
266
|
+
]);
|
|
267
|
+
} catch (err) {
|
|
268
|
+
var _process_env_DEBUG;
|
|
269
|
+
if (out.includes("@gorhom/bottom-sheet"))
|
|
270
|
+
continue;
|
|
271
|
+
!((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0) && _process_env_DEBUG.startsWith("tamagui") && console.info(" withTamagui skipping resolving ".concat(out), err);
|
|
272
|
+
}
|
|
153
273
|
}
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
".js",
|
|
163
|
-
...compiler.options.resolve.extensions || []
|
|
164
|
-
])
|
|
165
|
-
];
|
|
166
|
-
const mainFields = compiler.options.resolve.mainFields;
|
|
167
|
-
if (mainFields && (compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields], this.options.disableModuleJSXEntry || mainFields.unshift("module:jsx")), !compiler.options.module)
|
|
168
|
-
return;
|
|
169
|
-
const { jsLoader } = this.options, existing = compiler.options.module.rules, rules = ((_a = existing.find((x) => typeof x == "object" && "oneOf" in x ? x : null)) == null ? void 0 : _a.oneOf) ?? existing, nextJsRules = rules.findIndex(
|
|
170
|
-
(x) => (x == null ? void 0 : x.use) && x.use.loader === "next-swc-loader" && x.issuerLayer !== "api"
|
|
171
|
-
), esbuildLoader = {
|
|
172
|
-
loader: require.resolve("esbuild-loader"),
|
|
173
|
-
options: {
|
|
174
|
-
target: "es2021",
|
|
175
|
-
keepNames: !0,
|
|
176
|
-
loader: "tsx",
|
|
177
|
-
tsconfigRaw: {
|
|
178
|
-
module: this.options.isServer ? "commonjs" : "esnext",
|
|
179
|
-
isolatedModules: !0,
|
|
180
|
-
resolveJsonModule: !0
|
|
274
|
+
} catch (err) {
|
|
275
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
276
|
+
} finally {
|
|
277
|
+
try {
|
|
278
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
279
|
+
} finally {
|
|
280
|
+
if (_didIteratorError)
|
|
281
|
+
throw _iteratorError;
|
|
181
282
|
}
|
|
182
283
|
}
|
|
284
|
+
return res;
|
|
285
|
+
}, this.isInComponentModule = function(fullPath) {
|
|
286
|
+
return _this.componentsBaseDirs.some(function(componentDir) {
|
|
287
|
+
return fullPath.startsWith(componentDir);
|
|
288
|
+
});
|
|
183
289
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
290
|
+
}
|
|
291
|
+
return _create_class(TamaguiPlugin2, [
|
|
292
|
+
{
|
|
293
|
+
key: "componentsFullPaths",
|
|
294
|
+
get: function() {
|
|
295
|
+
return this.safeResolves(this.options.components.map(function(moduleName) {
|
|
296
|
+
return [
|
|
297
|
+
moduleName,
|
|
298
|
+
moduleName
|
|
299
|
+
];
|
|
300
|
+
}), !0);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: "componentsBaseDirs",
|
|
305
|
+
get: function() {
|
|
306
|
+
return this.componentsFullPaths.map(function(param) {
|
|
307
|
+
for (var _param = _sliced_to_array(param, 2), _ = _param[0], fullPath = _param[1], rootPath = dirname(fullPath); rootPath.length > 1; ) {
|
|
308
|
+
var pkg = join(rootPath, "package.json"), hasPkg = existsSync(pkg);
|
|
309
|
+
if (hasPkg)
|
|
310
|
+
return rootPath;
|
|
311
|
+
rootPath = join(rootPath, "..");
|
|
312
|
+
}
|
|
313
|
+
throw new Error("Couldn't find package.json in any path above: ".concat(fullPath));
|
|
208
314
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
key: "defaultAliases",
|
|
319
|
+
get: function() {
|
|
320
|
+
return Object.fromEntries(this.safeResolves([
|
|
321
|
+
[
|
|
322
|
+
"@tamagui/core/reset.css",
|
|
323
|
+
"@tamagui/core/reset.css"
|
|
324
|
+
],
|
|
325
|
+
[
|
|
326
|
+
"@tamagui/core",
|
|
327
|
+
"@tamagui/core"
|
|
328
|
+
],
|
|
329
|
+
[
|
|
330
|
+
"@tamagui/web",
|
|
331
|
+
"@tamagui/web"
|
|
332
|
+
],
|
|
333
|
+
// web specific light react-native-svg, optional, can use svgs but had issues with compat
|
|
334
|
+
[
|
|
335
|
+
"react-native-svg",
|
|
336
|
+
"@tamagui/react-native-svg"
|
|
337
|
+
],
|
|
338
|
+
// fixes https://github.com/kentcdodds/mdx-bundler/issues/143
|
|
339
|
+
[
|
|
340
|
+
"react/jsx-runtime.js",
|
|
341
|
+
"react/jsx-runtime"
|
|
342
|
+
],
|
|
343
|
+
[
|
|
344
|
+
"react/jsx-runtime",
|
|
345
|
+
"react/jsx-runtime"
|
|
346
|
+
],
|
|
347
|
+
[
|
|
348
|
+
"react/jsx-dev-runtime.js",
|
|
349
|
+
"react/jsx-dev-runtime"
|
|
350
|
+
],
|
|
351
|
+
[
|
|
352
|
+
"react/jsx-dev-runtime",
|
|
353
|
+
"react/jsx-dev-runtime"
|
|
354
|
+
],
|
|
355
|
+
[
|
|
356
|
+
"react-native-reanimated",
|
|
357
|
+
"react-native-reanimated"
|
|
358
|
+
],
|
|
359
|
+
[
|
|
360
|
+
"@testing-library/react-native",
|
|
361
|
+
"@tamagui/proxy-worm"
|
|
362
|
+
],
|
|
363
|
+
[
|
|
364
|
+
"@gorhom/bottom-sheet$",
|
|
365
|
+
"@gorhom/bottom-sheet"
|
|
366
|
+
],
|
|
367
|
+
// fix reanimated 3
|
|
368
|
+
[
|
|
369
|
+
"react-native/Libraries/Renderer/shims/ReactFabric",
|
|
370
|
+
"@tamagui/proxy-worm"
|
|
222
371
|
]
|
|
372
|
+
].concat(
|
|
373
|
+
// @ts-expect-error deprecated
|
|
374
|
+
_to_consumable_array(this.options.useReactNativeWebLite ? [
|
|
375
|
+
[
|
|
376
|
+
"react-native$",
|
|
377
|
+
"react-native-web-lite"
|
|
378
|
+
],
|
|
379
|
+
[
|
|
380
|
+
"react-native-web$",
|
|
381
|
+
"react-native-web-lite"
|
|
382
|
+
]
|
|
383
|
+
] : [
|
|
384
|
+
[
|
|
385
|
+
"react-native$",
|
|
386
|
+
"react-native-web"
|
|
387
|
+
],
|
|
388
|
+
[
|
|
389
|
+
"react-native-web$",
|
|
390
|
+
"react-native-web"
|
|
391
|
+
]
|
|
392
|
+
])
|
|
393
|
+
)));
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
key: "apply",
|
|
398
|
+
value: function(compiler) {
|
|
399
|
+
var _this = this, _existing_find;
|
|
400
|
+
compiler.watchMode && !this.options.disableWatchConfig && watchTamaguiConfig(this.options).then(function(watcher) {
|
|
401
|
+
process.once("exit", function() {
|
|
402
|
+
watcher.dispose();
|
|
403
|
+
});
|
|
404
|
+
}), this.options.exclude || (this.options.exclude = function(path2) {
|
|
405
|
+
return _this.isInComponentModule(path2) ? !1 : shouldExclude(path2);
|
|
223
406
|
});
|
|
407
|
+
var _this1 = this;
|
|
408
|
+
if (compiler.hooks.beforeRun.tapPromise(this.pluginName, /* @__PURE__ */ _async_to_generator(function() {
|
|
409
|
+
return _ts_generator(this, function(_state) {
|
|
410
|
+
switch (_state.label) {
|
|
411
|
+
case 0:
|
|
412
|
+
return [
|
|
413
|
+
4,
|
|
414
|
+
loadTamagui(_this1.options)
|
|
415
|
+
];
|
|
416
|
+
case 1:
|
|
417
|
+
return _state.sent(), [
|
|
418
|
+
2
|
|
419
|
+
];
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
})), compiler.hooks.normalModuleFactory.tap(this.pluginName, function(nmf) {
|
|
423
|
+
nmf.hooks.createModule.tap(
|
|
424
|
+
_this.pluginName,
|
|
425
|
+
// @ts-expect-error CreateData is typed as 'object'...
|
|
426
|
+
function(createData) {
|
|
427
|
+
var _createData_matchResource;
|
|
428
|
+
!((_createData_matchResource = createData.matchResource) === null || _createData_matchResource === void 0) && _createData_matchResource.endsWith(".tamagui.css") && (createData.settings.sideEffects = !0);
|
|
429
|
+
}
|
|
430
|
+
);
|
|
431
|
+
}), !this.options.disableAliases) {
|
|
432
|
+
var existingAlias = compiler.options.resolve.alias;
|
|
433
|
+
Array.isArray(existingAlias) || typeof existingAlias == "object" && Object.assign(existingAlias, this.defaultAliases);
|
|
434
|
+
}
|
|
435
|
+
var excludeExports = this.options.excludeReactNativeWebExports;
|
|
436
|
+
if (excludeExports && Array.isArray(excludeExports))
|
|
437
|
+
try {
|
|
438
|
+
var regexStr = "react-native-web(-lite)?/.*(".concat(excludeExports.join("|"), ").*js"), regex = new RegExp(regexStr);
|
|
439
|
+
compiler.hooks.environment.tap("MyPlugin", function() {
|
|
440
|
+
var definePlugin = new webpack.NormalModuleReplacementPlugin(regex, _this.resolveEsm("@tamagui/proxy-worm"));
|
|
441
|
+
definePlugin.apply(compiler);
|
|
442
|
+
});
|
|
443
|
+
} catch {
|
|
444
|
+
console.warn("Invalid names provided to excludeReactNativeWebExports: ".concat(excludeExports.join(", ")));
|
|
445
|
+
}
|
|
446
|
+
this.options.emitSingleCSSFile && (console.info(" \u27A1 [tamagui] \u{1F3A8} combining css into one file"), compiler.hooks.make.tap(this.pluginName, function(compilation) {
|
|
447
|
+
compilation.hooks.processAssets.tap(_this.pluginName, function(assets) {
|
|
448
|
+
try {
|
|
449
|
+
var cssFiles = Object.keys(assets).filter(function(asset) {
|
|
450
|
+
return asset.endsWith(".css");
|
|
451
|
+
});
|
|
452
|
+
if (cssFiles.length === 0)
|
|
453
|
+
return;
|
|
454
|
+
var combinedCSS = cssFiles.reduce(function(acc, file) {
|
|
455
|
+
var cssContent = compilation.assets[file].source();
|
|
456
|
+
return "".concat(acc, `
|
|
457
|
+
`).concat(cssContent);
|
|
458
|
+
}, ""), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
459
|
+
try {
|
|
460
|
+
for (var _iterator = cssFiles.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
461
|
+
var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], cssFile = _step_value[1];
|
|
462
|
+
index > 0 ? compilation.updateAsset(cssFile, new compiler.webpack.sources.RawSource("")) : (console.info(" \u27A1 [tamagui] \u{1F3A8} emitting single css to ".concat(cssFile)), compilation.updateAsset(cssFile, new compiler.webpack.sources.RawSource(Buffer.from(combinedCSS))));
|
|
463
|
+
}
|
|
464
|
+
} catch (err) {
|
|
465
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
466
|
+
} finally {
|
|
467
|
+
try {
|
|
468
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
469
|
+
} finally {
|
|
470
|
+
if (_didIteratorError)
|
|
471
|
+
throw _iteratorError;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
compilation.errors.push(error);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
})), compiler.options.resolve.extensions = _to_consumable_array(new Set([
|
|
479
|
+
".web.tsx",
|
|
480
|
+
".web.ts",
|
|
481
|
+
".web.js",
|
|
482
|
+
".ts",
|
|
483
|
+
".tsx",
|
|
484
|
+
".js"
|
|
485
|
+
].concat(_to_consumable_array(compiler.options.resolve.extensions || []))));
|
|
486
|
+
var mainFields = compiler.options.resolve.mainFields;
|
|
487
|
+
if (mainFields && (compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [
|
|
488
|
+
mainFields
|
|
489
|
+
], this.options.disableModuleJSXEntry || mainFields.unshift("module:jsx")), !!compiler.options.module) {
|
|
490
|
+
var jsLoader = this.options.jsLoader, existing = compiler.options.module.rules, _existing_find_oneOf, rules = (_existing_find_oneOf = (_existing_find = existing.find(function(x) {
|
|
491
|
+
return typeof x == "object" && "oneOf" in x ? x : null;
|
|
492
|
+
})) === null || _existing_find === void 0 ? void 0 : _existing_find.oneOf) !== null && _existing_find_oneOf !== void 0 ? _existing_find_oneOf : existing, nextJsRules = rules.findIndex(function(x) {
|
|
493
|
+
return (x == null ? void 0 : x.use) && x.use.loader === "next-swc-loader" && x.issuerLayer !== "api";
|
|
494
|
+
}), esbuildLoader = {
|
|
495
|
+
loader: require.resolve("esbuild-loader"),
|
|
496
|
+
options: {
|
|
497
|
+
target: "es2021",
|
|
498
|
+
keepNames: !0,
|
|
499
|
+
loader: "tsx",
|
|
500
|
+
tsconfigRaw: {
|
|
501
|
+
module: this.options.isServer ? "commonjs" : "esnext",
|
|
502
|
+
isolatedModules: !0,
|
|
503
|
+
resolveJsonModule: !0
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
if (!this.options.disable) {
|
|
508
|
+
var tamaguiLoader = {
|
|
509
|
+
loader: require.resolve("tamagui-loader"),
|
|
510
|
+
options: _object_spread_props(_object_spread({}, this.options), {
|
|
511
|
+
_disableLoadTamagui: !0
|
|
512
|
+
})
|
|
513
|
+
};
|
|
514
|
+
if (nextJsRules === -1) {
|
|
515
|
+
existing.push({
|
|
516
|
+
// looks like its in jsx dir (could be better but windows path sep)
|
|
517
|
+
test: /jsx.*\.m?[jt]sx?$/,
|
|
518
|
+
exclude: this.options.exclude,
|
|
519
|
+
resolve: {
|
|
520
|
+
fullySpecified: !1
|
|
521
|
+
},
|
|
522
|
+
use: [
|
|
523
|
+
esbuildLoader
|
|
524
|
+
]
|
|
525
|
+
});
|
|
526
|
+
var _this_options_test;
|
|
527
|
+
existing.push({
|
|
528
|
+
test: (_this_options_test = this.options.test) !== null && _this_options_test !== void 0 ? _this_options_test : /\.m?[jt]sx?$/,
|
|
529
|
+
exclude: this.options.exclude,
|
|
530
|
+
resolve: {
|
|
531
|
+
fullySpecified: !1
|
|
532
|
+
},
|
|
533
|
+
use: [
|
|
534
|
+
tamaguiLoader
|
|
535
|
+
]
|
|
536
|
+
});
|
|
537
|
+
} else if (!this.options.disableEsbuildLoader) {
|
|
538
|
+
var startIndex = nextJsRules ? nextJsRules + 1 : 0, existingLoader = nextJsRules ? rules[startIndex] : void 0, _this_options_test1;
|
|
539
|
+
rules.splice(startIndex, 0, {
|
|
540
|
+
test: (_this_options_test1 = this.options.test) !== null && _this_options_test1 !== void 0 ? _this_options_test1 : /\.m?[jt]sx?$/,
|
|
541
|
+
exclude: this.options.exclude,
|
|
542
|
+
resolve: {
|
|
543
|
+
fullySpecified: !1
|
|
544
|
+
},
|
|
545
|
+
use: _to_consumable_array(jsLoader ? [
|
|
546
|
+
jsLoader
|
|
547
|
+
] : []).concat(_to_consumable_array(existingLoader && nextJsRules ? [].concat(existingLoader.use) : []), _to_consumable_array(jsLoader || existingLoader ? [] : [
|
|
548
|
+
esbuildLoader
|
|
549
|
+
]), [
|
|
550
|
+
tamaguiLoader
|
|
551
|
+
])
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
224
556
|
}
|
|
225
557
|
}
|
|
226
|
-
|
|
227
|
-
}
|
|
558
|
+
]), TamaguiPlugin2;
|
|
559
|
+
}();
|
|
228
560
|
export {
|
|
229
561
|
TamaguiPlugin
|
|
230
562
|
};
|