tamagui-loader 2.0.0-rc.8 → 2.0.0

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.
Files changed (50) hide show
  1. package/dist/cjs/TamaguiPlugin.cjs +131 -79
  2. package/dist/cjs/css.cjs +15 -11
  3. package/dist/cjs/index.cjs +15 -13
  4. package/dist/cjs/loader.cjs +61 -52
  5. package/dist/cjs/requireResolve.cjs +14 -12
  6. package/dist/cjs/shouldExclude.cjs +30 -23
  7. package/dist/cjs/test.cjs +15 -13
  8. package/dist/esm/TamaguiPlugin.mjs +102 -52
  9. package/dist/esm/TamaguiPlugin.mjs.map +1 -1
  10. package/dist/esm/css.mjs +3 -1
  11. package/dist/esm/css.mjs.map +1 -1
  12. package/dist/esm/index.js +5 -7
  13. package/dist/esm/index.js.map +1 -6
  14. package/dist/esm/loader.mjs +35 -28
  15. package/dist/esm/loader.mjs.map +1 -1
  16. package/dist/esm/shouldExclude.mjs +6 -1
  17. package/dist/esm/shouldExclude.mjs.map +1 -1
  18. package/dist/esm/test.mjs +3 -3
  19. package/dist/esm/test.mjs.map +1 -1
  20. package/package.json +9 -8
  21. package/dist/cjs/TamaguiPlugin.js +0 -179
  22. package/dist/cjs/TamaguiPlugin.js.map +0 -6
  23. package/dist/cjs/css.js +0 -28
  24. package/dist/cjs/css.js.map +0 -6
  25. package/dist/cjs/index.js +0 -24
  26. package/dist/cjs/index.js.map +0 -6
  27. package/dist/cjs/loader.js +0 -92
  28. package/dist/cjs/loader.js.map +0 -6
  29. package/dist/cjs/polyfills.js +0 -4
  30. package/dist/cjs/polyfills.js.map +0 -6
  31. package/dist/cjs/requireResolve.js +0 -22
  32. package/dist/cjs/requireResolve.js.map +0 -6
  33. package/dist/cjs/shouldExclude.js +0 -33
  34. package/dist/cjs/shouldExclude.js.map +0 -6
  35. package/dist/cjs/test.js +0 -25
  36. package/dist/cjs/test.js.map +0 -6
  37. package/dist/esm/TamaguiPlugin.js +0 -159
  38. package/dist/esm/TamaguiPlugin.js.map +0 -6
  39. package/dist/esm/css.js +0 -12
  40. package/dist/esm/css.js.map +0 -6
  41. package/dist/esm/loader.js +0 -69
  42. package/dist/esm/loader.js.map +0 -6
  43. package/dist/esm/polyfills.js +0 -4
  44. package/dist/esm/polyfills.js.map +0 -6
  45. package/dist/esm/requireResolve.js +0 -6
  46. package/dist/esm/requireResolve.js.map +0 -6
  47. package/dist/esm/shouldExclude.js +0 -9
  48. package/dist/esm/shouldExclude.js.map +0 -6
  49. package/dist/esm/test.js +0 -9
  50. package/dist/esm/test.js.map +0 -6
@@ -2,43 +2,45 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var TamaguiPlugin_exports = {};
33
35
  __export(TamaguiPlugin_exports, {
34
36
  TamaguiPlugin: () => TamaguiPlugin
35
37
  });
36
38
  module.exports = __toCommonJS(TamaguiPlugin_exports);
37
- var StaticWorker = __toESM(require("@tamagui/static-worker"), 1),
38
- import_node_fs = require("node:fs"),
39
- import_node_path = require("node:path"),
40
- import_webpack = __toESM(require("webpack"), 1),
41
- import_requireResolve = require("./requireResolve.cjs");
39
+ var StaticWorker = __toESM(require("@tamagui/static-worker"), 1);
40
+ var import_node_fs = require("node:fs");
41
+ var import_node_path = require("node:path");
42
+ var import_webpack = __toESM(require("webpack"), 1);
43
+ var import_requireResolve = require("./requireResolve.cjs");
42
44
  class TamaguiPlugin {
43
45
  constructor(options = {
44
46
  platform: "web",
@@ -47,7 +49,7 @@ class TamaguiPlugin {
47
49
  this.options = options;
48
50
  }
49
51
  pluginName = "TamaguiPlugin";
50
- safeResolves = (resolves, multiple = !1) => {
52
+ safeResolves = (resolves, multiple = false) => {
51
53
  const res = [];
52
54
  for (const [out, mod] of resolves) {
53
55
  if (out.endsWith("$")) {
@@ -55,29 +57,41 @@ class TamaguiPlugin {
55
57
  continue;
56
58
  }
57
59
  try {
58
- res.push([out, (0, import_requireResolve.requireResolve)(mod)]), multiple && res.push([out, (0, import_requireResolve.requireResolve)(mod)]);
60
+ res.push([out, (0, import_requireResolve.requireResolve)(mod)]);
61
+ if (multiple) {
62
+ res.push([out, (0, import_requireResolve.requireResolve)(mod)]);
63
+ }
59
64
  } catch (err) {
60
- if (out.includes("@gorhom/bottom-sheet")) continue;
61
- process.env.DEBUG?.startsWith("tamagui") && console.info(` withTamagui skipping resolving ${out}`, err);
65
+ if (out.includes(`@gorhom/bottom-sheet`)) {
66
+ continue;
67
+ }
68
+ if (process.env.DEBUG?.startsWith("tamagui")) {
69
+ console.info(` withTamagui skipping resolving ${out}`, err);
70
+ }
62
71
  }
63
72
  }
64
73
  return res;
65
74
  };
66
75
  get componentsFullPaths() {
67
- return this.safeResolves(this.options.components?.map(moduleName => [moduleName, moduleName]) || [], !0);
76
+ return this.safeResolves(this.options.components?.map(moduleName => [moduleName, moduleName]) || [], true);
68
77
  }
69
78
  get componentsBaseDirs() {
70
79
  return this.componentsFullPaths.map(([_, fullPath]) => {
71
80
  let rootPath = (0, import_node_path.dirname)(fullPath);
72
- for (; rootPath.length > 1;) {
81
+ while (rootPath.length > 1) {
73
82
  const pkg = (0, import_node_path.join)(rootPath, "package.json");
74
- if ((0, import_node_fs.existsSync)(pkg)) return rootPath;
83
+ const hasPkg = (0, import_node_fs.existsSync)(pkg);
84
+ if (hasPkg) {
85
+ return rootPath;
86
+ }
75
87
  rootPath = (0, import_node_path.join)(rootPath, "..");
76
88
  }
77
89
  throw new Error(`Couldn't find package.json in any path above: ${fullPath}`);
78
90
  });
79
91
  }
80
- isInComponentModule = fullPath => this.componentsBaseDirs.some(componentDir => fullPath.startsWith(componentDir));
92
+ isInComponentModule = fullPath => {
93
+ return this.componentsBaseDirs.some(componentDir => fullPath.startsWith(componentDir));
94
+ };
81
95
  get defaultAliases() {
82
96
  return Object.fromEntries(this.safeResolves([["@tamagui/core/reset.css", "@tamagui/core/reset.css"],
83
97
  // fixes https://github.com/kentcdodds/mdx-bundler/issues/143
@@ -88,63 +102,101 @@ class TamaguiPlugin {
88
102
  const serializableOptions = {
89
103
  ...this.options
90
104
  };
91
- for (const key in serializableOptions) typeof serializableOptions[key] == "function" && delete serializableOptions[key];
92
- if (StaticWorker.loadTamagui({
105
+ for (const key in serializableOptions) {
106
+ const value = serializableOptions[key];
107
+ if (typeof value === "function") {
108
+ delete serializableOptions[key];
109
+ }
110
+ }
111
+ void StaticWorker.loadTamagui({
93
112
  components: ["tamagui"],
94
113
  platform: "web",
95
114
  ...serializableOptions
96
- }), compiler.options.mode === "development" && !this.options.disableWatchConfig && StaticWorker.watchTamaguiConfig(serializableOptions).then(watcher => {
97
- process.once("exit", () => {
98
- watcher?.dispose();
115
+ });
116
+ if (compiler.options.mode === "development" && !this.options.disableWatchConfig) {
117
+ void StaticWorker.watchTamaguiConfig(serializableOptions).then(watcher => {
118
+ process.once("exit", () => {
119
+ watcher?.dispose();
120
+ });
99
121
  });
100
- }), process.once("exit", () => {
101
- StaticWorker.destroyPool();
102
- }), compiler.hooks.normalModuleFactory.tap(this.pluginName, nmf => {
122
+ }
123
+ process.once("exit", () => {
124
+ void StaticWorker.destroyPool();
125
+ });
126
+ compiler.hooks.normalModuleFactory.tap(this.pluginName, nmf => {
103
127
  nmf.hooks.createModule.tap(this.pluginName,
104
128
  // @ts-expect-error CreateData is typed as 'object'...
105
129
  createData => {
106
- createData.matchResource?.endsWith(".tamagui.css") && (createData.settings.sideEffects = !0);
130
+ if (createData.matchResource?.endsWith(".tamagui.css")) {
131
+ createData.settings.sideEffects = true;
132
+ }
107
133
  });
108
- }), !this.options.disableAliases) {
134
+ });
135
+ if (!this.options.disableAliases) {
109
136
  const existingAlias = compiler.options.resolve.alias;
110
- Array.isArray(existingAlias) || typeof existingAlias == "object" && Object.assign(existingAlias, this.defaultAliases);
137
+ if (Array.isArray(existingAlias)) {} else if (typeof existingAlias === "object") {
138
+ Object.assign(existingAlias, this.defaultAliases);
139
+ }
111
140
  }
112
141
  const excludeExports = this.options.excludeReactNativeWebExports;
113
- if (excludeExports && Array.isArray(excludeExports)) try {
114
- const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join("|")}).*js`,
115
- regex = new RegExp(regexStr);
116
- compiler.hooks.environment.tap("MyPlugin", () => {
117
- new import_webpack.default.NormalModuleReplacementPlugin(regex, (0, import_requireResolve.requireResolve)("@tamagui/proxy-worm")).apply(compiler);
118
- });
119
- } catch {
120
- console.warn(`Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(", ")}`);
142
+ if (excludeExports) {
143
+ if (Array.isArray(excludeExports)) {
144
+ try {
145
+ const regexStr = `react-native-web(-lite)?/.*(${excludeExports.join("|")}).*js`;
146
+ const regex = new RegExp(regexStr);
147
+ compiler.hooks.environment.tap("MyPlugin", () => {
148
+ const definePlugin = new import_webpack.default.NormalModuleReplacementPlugin(regex, (0, import_requireResolve.requireResolve)("@tamagui/proxy-worm"));
149
+ definePlugin.apply(compiler);
150
+ });
151
+ } catch (err) {
152
+ console.warn(`Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(", ")}`);
153
+ }
154
+ }
121
155
  }
122
- compiler.options.resolve.extensions = [... /* @__PURE__ */new Set([".web.tsx", ".web.ts", ".web.js", ".ts", ".tsx", ".js", ...(compiler.options.resolve.extensions || [])])], compiler.options.resolve.fallback ||= {}, compiler.options.resolve.fallback.crypto ||= !1;
156
+ compiler.options.resolve.extensions = [... /* @__PURE__ */new Set([".web.tsx", ".web.ts", ".web.js", ".ts", ".tsx", ".js", ...(compiler.options.resolve.extensions || [])])];
157
+ compiler.options.resolve.fallback ||= {};
158
+ compiler.options.resolve.fallback["crypto"] ||= false;
123
159
  const mainFields = compiler.options.resolve.mainFields;
124
- if (mainFields && (compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields], this.options.disableModuleJSXEntry || mainFields.unshift("module:jsx")), !compiler.options.module) return;
160
+ if (mainFields) {
161
+ compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields];
162
+ if (!this.options.disableModuleJSXEntry) mainFields.unshift("module:jsx");
163
+ }
164
+ if (!compiler.options.module) {
165
+ return;
166
+ }
125
167
  const {
126
- jsLoader
127
- } = this.options,
128
- existing = compiler.options.module.rules,
129
- rules = existing.find(x => typeof x == "object" && "oneOf" in x ? x : null)?.oneOf ?? existing,
130
- tamaguiLoader = {
131
- loader: (0, import_requireResolve.requireResolve)("tamagui-loader"),
132
- options: {
133
- ...this.options,
134
- _disableLoadTamagui: !0
135
- }
136
- };
137
- let didReplaceNextJS = !1;
138
- for (const [index, rule] of rules.entries()) (rule?.use?.loader === "next-swc-loader" || Array.isArray(rule?.use) && rule?.use[0].loader === "next-swc-loader") && !rule.issuerLayer && (didReplaceNextJS = !0, rules[index] = {
139
- ...rule,
140
- test: this.options.test ?? rule.test ?? /\.m?[jt]sx?$/,
141
- exclude: this.options.exclude ?? rule.exclude,
142
- use: [...(jsLoader ? [jsLoader] : []), ...(rule.use ? [].concat(rule.use) : []), tamaguiLoader]
143
- });
144
- didReplaceNextJS || compiler.options.mode === "development" && existing.push({
145
- test: this.options.test ?? /\.tsx$/,
146
- exclude: this.options.exclude,
147
- use: [tamaguiLoader]
148
- });
168
+ jsLoader
169
+ } = this.options;
170
+ const existing = compiler.options.module.rules;
171
+ const rules = existing.find(x => typeof x === "object" && "oneOf" in x ? x : null)?.oneOf ?? existing;
172
+ const tamaguiLoader = {
173
+ loader: (0, import_requireResolve.requireResolve)("tamagui-loader"),
174
+ options: {
175
+ ...this.options,
176
+ _disableLoadTamagui: true
177
+ }
178
+ };
179
+ let didReplaceNextJS = false;
180
+ for (const [index, rule] of rules.entries()) {
181
+ const shouldReplaceNextJSRule = (rule?.use?.loader === "next-swc-loader" || Array.isArray(rule?.use) && rule?.use[0].loader === "next-swc-loader") && !rule.issuerLayer;
182
+ if (shouldReplaceNextJSRule) {
183
+ didReplaceNextJS = true;
184
+ rules[index] = {
185
+ ...rule,
186
+ test: this.options.test ?? rule.test ?? /\.m?[jt]sx?$/,
187
+ exclude: this.options.exclude ?? rule.exclude,
188
+ use: [...(jsLoader ? [jsLoader] : []), ...(rule.use ? [].concat(rule.use) : []), tamaguiLoader]
189
+ };
190
+ }
191
+ }
192
+ if (!didReplaceNextJS) {
193
+ if (compiler.options.mode === "development") {
194
+ existing.push({
195
+ test: this.options.test ?? /\.tsx$/,
196
+ exclude: this.options.exclude,
197
+ use: [tamaguiLoader]
198
+ });
199
+ }
200
+ }
149
201
  }
150
202
  }
package/dist/cjs/css.cjs CHANGED
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var css_exports = {};
22
24
  __export(css_exports, {
@@ -29,7 +31,9 @@ function loader() {
29
31
  ...this.getOptions()
30
32
  };
31
33
  let out = Buffer.from(options.cssData, "base64").toString("utf-8");
32
- if (out) return this.callback(null, out || "");
34
+ if (out) {
35
+ return this.callback(null, out || "");
36
+ }
33
37
  this.callback({
34
38
  message: "No CSS found",
35
39
  name: "missing_css"
@@ -3,29 +3,31 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- },
18
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
21
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
20
- value: !0
22
+ value: true
21
23
  }), mod);
22
24
  var index_exports = {};
23
25
  __export(index_exports, {
24
26
  default: () => index_default
25
27
  });
26
28
  module.exports = __toCommonJS(index_exports);
27
- var import_polyfills = require("./polyfills.cjs"),
28
- import_loader = require("./loader.cjs");
29
+ var import_polyfills = require("./polyfills.cjs");
30
+ var import_loader = require("./loader.cjs");
29
31
  __reExport(index_exports, require("./TamaguiPlugin.cjs"), module.exports);
30
32
  __reExport(index_exports, require("./shouldExclude.cjs"), module.exports);
31
33
  var index_default = import_loader.loader;
@@ -2,40 +2,42 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var loader_exports = {};
33
35
  __export(loader_exports, {
34
36
  loader: () => loader
35
37
  });
36
38
  module.exports = __toCommonJS(loader_exports);
37
- var StaticWorker = __toESM(require("@tamagui/static-worker"), 1),
38
- import_requireResolve = require("./requireResolve.cjs");
39
+ var StaticWorker = __toESM(require("@tamagui/static-worker"), 1);
40
+ var import_requireResolve = require("./requireResolve.cjs");
39
41
  const {
40
42
  getPragmaOptions
41
43
  } = StaticWorker;
@@ -52,35 +54,41 @@ try {
52
54
  }
53
55
  let index = 0;
54
56
  process.env.TAMAGUI_TARGET = "web";
55
- const loader = async function (sourceIn) {
56
- this.cacheable(!0);
57
- const callback = this.async(),
58
- sourcePath = `${this.resourcePath}`;
57
+ const loader = async function loader2(sourceIn) {
58
+ this.cacheable(true);
59
+ const callback = this.async();
60
+ const sourcePath = `${this.resourcePath}`;
59
61
  if (sourcePath.includes("node_modules") || sourcePath.includes("lucide-icons")) return callback(null, sourceIn);
60
62
  const source = sourceIn.toString();
61
63
  try {
62
64
  const options = {
63
- // @ts-ignore
64
- platform: "web",
65
- ...this.getOptions()
66
- },
67
- {
68
- shouldDisable,
69
- shouldPrintDebug
70
- } = await getPragmaOptions({
71
- source,
72
- path: sourcePath
73
- });
74
- if (shouldPrintDebug === "verbose" && (console.warn(`
65
+ platform: "web",
66
+ ...this.getOptions()
67
+ };
68
+ const {
69
+ shouldDisable,
70
+ shouldPrintDebug
71
+ } = await getPragmaOptions({
72
+ source,
73
+ path: sourcePath
74
+ });
75
+ if (shouldPrintDebug === "verbose") {
76
+ console.warn(`
75
77
 
76
78
  --- Incoming source ---
77
79
 
78
- `), console.warn(source)), shouldDisable) return shouldPrintDebug && console.info("Disabling on file via pragma"), callback(null, source);
79
- const cssPath = `${sourcePath}.${index++}.tamagui.css`,
80
- serializableOptions = {
81
- ...options
82
- };
83
- for (const key in serializableOptions) typeof serializableOptions[key] == "function" && delete serializableOptions[key];
80
+ `);
81
+ console.warn(source);
82
+ }
83
+ if (shouldDisable) {
84
+ if (shouldPrintDebug) console.info("Disabling on file via pragma");
85
+ return callback(null, source);
86
+ }
87
+ const cssPath = `${sourcePath}.${index++}.tamagui.css`;
88
+ const serializableOptions = {
89
+ ...options
90
+ };
91
+ for (const key in serializableOptions) if (typeof serializableOptions[key] === "function") delete serializableOptions[key];
84
92
  const extracted = await StaticWorker.extractToClassNames({
85
93
  source,
86
94
  sourcePath,
@@ -89,9 +97,9 @@ const loader = async function (sourceIn) {
89
97
  });
90
98
  if (!extracted) return callback(null, source);
91
99
  if (extracted.styles) {
92
- const cssQuery = `cssData=${Buffer.from(extracted.styles).toString("base64")}`,
93
- remReq = this.remainingRequest,
94
- importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
100
+ const cssQuery = `cssData=${Buffer.from(extracted.styles).toString("base64")}`;
101
+ const remReq = this.remainingRequest;
102
+ const importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
95
103
  extracted.js = `${extracted.js}
96
104
 
97
105
  require(${JSON.stringify(importPath)})`;
@@ -100,8 +108,9 @@ require(${JSON.stringify(importPath)})`;
100
108
  } catch (err) {
101
109
  const message = err instanceof Error ? `${err.message}
102
110
  ${err.stack}` : String(err);
103
- console.error(`Tamagui Webpack Loader Error:
104
- `, ` ${message}
105
- `), message.includes("Cannot create proxy") && console.info("This is usually due to components not loading at build-time. Check for logs just below the line above:"), callback(null, source);
111
+ console.error("Tamagui Webpack Loader Error:\n", ` ${message}
112
+ `);
113
+ if (message.includes("Cannot create proxy")) console.info("This is usually due to components not loading at build-time. Check for logs just below the line above:");
114
+ callback(null, source);
106
115
  }
107
116
  };
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var requireResolve_exports = {};
22
24
  __export(requireResolve_exports, {
@@ -24,5 +26,5 @@ __export(requireResolve_exports, {
24
26
  });
25
27
  module.exports = __toCommonJS(requireResolve_exports);
26
28
  var import_node_module = require("node:module");
27
- const import_meta = {},
28
- requireResolve = "url" in import_meta ? (0, import_node_module.createRequire)(import_meta.url).resolve : require.resolve;
29
+ const import_meta = {};
30
+ const requireResolve = "url" in import_meta ? (0, import_node_module.createRequire)(import_meta.url).resolve : require.resolve;
@@ -2,40 +2,47 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var shouldExclude_exports = {};
33
35
  __export(shouldExclude_exports, {
34
36
  shouldExclude: () => shouldExclude
35
37
  });
36
38
  module.exports = __toCommonJS(shouldExclude_exports);
37
39
  var import_node_path = __toESM(require("node:path"), 1);
38
- const shouldExclude = (filePath, projectRoot) => !(projectRoot && filePath.includes(projectRoot) && filePath.endsWith("sx") || isTamaguiDistJSX(filePath));
40
+ const shouldExclude = (filePath, projectRoot) => {
41
+ if (projectRoot && filePath.includes(projectRoot) && filePath.endsWith("sx") || isTamaguiDistJSX(filePath)) {
42
+ return false;
43
+ }
44
+ return true;
45
+ };
39
46
  function isTamaguiDistJSX(filePath) {
40
47
  return filePath.includes("/dist/jsx/".replace(/\//g, import_node_path.default.sep));
41
48
  }