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