tamagui-loader 1.110.4 → 1.111.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.
@@ -0,0 +1,236 @@
1
+ import Static from "@tamagui/static";
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import webpack from "webpack";
5
+ import { requireResolve } from "./requireResolve.mjs";
6
+ function _class_call_check(instance, Constructor) {
7
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
8
+ }
9
+ function _defineProperties(target, props) {
10
+ for (var i = 0; i < props.length; i++) {
11
+ var descriptor = props[i];
12
+ descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
13
+ }
14
+ }
15
+ function _create_class(Constructor, protoProps, staticProps) {
16
+ return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
17
+ }
18
+ function _define_property(obj, key, value) {
19
+ return key in obj ? Object.defineProperty(obj, key, {
20
+ value,
21
+ enumerable: !0,
22
+ configurable: !0,
23
+ writable: !0
24
+ }) : obj[key] = value, obj;
25
+ }
26
+ var {
27
+ loadTamagui,
28
+ watchTamaguiConfig
29
+ } = Static,
30
+ TamaguiPlugin = /* @__PURE__ */function () {
31
+ "use strict";
32
+
33
+ function TamaguiPlugin2() {
34
+ var _this = this,
35
+ options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
36
+ platform: "web",
37
+ components: ["@tamagui/core"]
38
+ };
39
+ _class_call_check(this, TamaguiPlugin2), _define_property(this, "options", void 0), _define_property(this, "pluginName", void 0), _define_property(this, "safeResolves", void 0), _define_property(this, "isInComponentModule", void 0), this.options = options, this.pluginName = "TamaguiPlugin", this.safeResolves = function (resolves) {
40
+ var multiple = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1,
41
+ res = [],
42
+ _iteratorNormalCompletion = !0,
43
+ _didIteratorError = !1,
44
+ _iteratorError = void 0;
45
+ try {
46
+ for (var _iterator = resolves[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
47
+ var [out, mod] = _step.value;
48
+ if (out.endsWith("$")) {
49
+ res.push([out, mod]);
50
+ continue;
51
+ }
52
+ try {
53
+ res.push([out, requireResolve(mod)]), multiple && res.push([out, requireResolve(mod)]);
54
+ } catch (err) {
55
+ var _process_env_DEBUG;
56
+ if (out.includes("@gorhom/bottom-sheet")) continue;
57
+ !((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0) && _process_env_DEBUG.startsWith("tamagui") && console.info(` withTamagui skipping resolving ${out}`, err);
58
+ }
59
+ }
60
+ } catch (err) {
61
+ _didIteratorError = !0, _iteratorError = err;
62
+ } finally {
63
+ try {
64
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
65
+ } finally {
66
+ if (_didIteratorError) throw _iteratorError;
67
+ }
68
+ }
69
+ return res;
70
+ }, this.isInComponentModule = function (fullPath) {
71
+ return _this.componentsBaseDirs.some(function (componentDir) {
72
+ return fullPath.startsWith(componentDir);
73
+ });
74
+ };
75
+ }
76
+ return _create_class(TamaguiPlugin2, [{
77
+ key: "componentsFullPaths",
78
+ get: function () {
79
+ var _this_options_components;
80
+ return this.safeResolves(((_this_options_components = this.options.components) === null || _this_options_components === void 0 ? void 0 : _this_options_components.map(function (moduleName) {
81
+ return [moduleName, moduleName];
82
+ })) || [], !0);
83
+ }
84
+ }, {
85
+ key: "componentsBaseDirs",
86
+ get: function () {
87
+ return this.componentsFullPaths.map(function (param) {
88
+ for (var [_, fullPath] = param, rootPath = dirname(fullPath); rootPath.length > 1;) {
89
+ var pkg = join(rootPath, "package.json"),
90
+ hasPkg = existsSync(pkg);
91
+ if (hasPkg) return rootPath;
92
+ rootPath = join(rootPath, "..");
93
+ }
94
+ throw new Error(`Couldn't find package.json in any path above: ${fullPath}`);
95
+ });
96
+ }
97
+ }, {
98
+ key: "defaultAliases",
99
+ get: function () {
100
+ return Object.fromEntries(this.safeResolves([["@tamagui/core/reset.css", "@tamagui/core/reset.css"], ["@tamagui/core", "@tamagui/core"], ["@tamagui/web", "@tamagui/web"],
101
+ // fixes https://github.com/kentcdodds/mdx-bundler/issues/143
102
+ ["react/jsx-runtime.js", "react/jsx-runtime"], ["react/jsx-runtime", "react/jsx-runtime"], ["react/jsx-dev-runtime.js", "react/jsx-dev-runtime"], ["react/jsx-dev-runtime", "react/jsx-dev-runtime"], ...(this.options.useTamaguiSVG ? [["react-native-svg", "@tamagui/react-native-svg"]] : []), ...(this.options.useReactNativeWebLite ? [["react-native$", "react-native-web-lite"], ["react-native-web$", "react-native-web-lite"]] : [["react-native$", "react-native-web"], ["react-native-web$", "react-native-web"]])]));
103
+ }
104
+ }, {
105
+ key: "apply",
106
+ value: function (compiler) {
107
+ var _this = this,
108
+ _existing_find,
109
+ _compiler_options_resolve,
110
+ _compiler_options_resolve_fallback,
111
+ _crypto,
112
+ {
113
+ isServer
114
+ } = this.options;
115
+ if (compiler.watchMode && !this.options.disableWatchConfig && watchTamaguiConfig(this.options).then(function (watcher) {
116
+ process.once("exit", function () {
117
+ watcher.dispose();
118
+ });
119
+ }), compiler.hooks.beforeRun.tapPromise(this.pluginName, async function () {
120
+ await loadTamagui(_this.options);
121
+ }), compiler.hooks.normalModuleFactory.tap(this.pluginName, function (nmf) {
122
+ nmf.hooks.createModule.tap(_this.pluginName,
123
+ // @ts-expect-error CreateData is typed as 'object'...
124
+ function (createData) {
125
+ var _createData_matchResource;
126
+ !((_createData_matchResource = createData.matchResource) === null || _createData_matchResource === void 0) && _createData_matchResource.endsWith(".tamagui.css") && (createData.settings.sideEffects = !0);
127
+ });
128
+ }), !this.options.disableAliases) {
129
+ var existingAlias = compiler.options.resolve.alias;
130
+ Array.isArray(existingAlias) || typeof existingAlias == "object" && Object.assign(existingAlias, this.defaultAliases);
131
+ }
132
+ var excludeExports = this.options.excludeReactNativeWebExports;
133
+ if (excludeExports && Array.isArray(excludeExports)) try {
134
+ var regexStr = `react-native-web(-lite)?/.*(${excludeExports.join("|")}).*js`,
135
+ regex = new RegExp(regexStr);
136
+ compiler.hooks.environment.tap("MyPlugin", function () {
137
+ var definePlugin = new webpack.NormalModuleReplacementPlugin(regex, requireResolve("@tamagui/proxy-worm"));
138
+ definePlugin.apply(compiler);
139
+ });
140
+ } catch {
141
+ console.warn(`Invalid names provided to excludeReactNativeWebExports: ${excludeExports.join(", ")}`);
142
+ }
143
+ this.options.emitSingleCSSFile && (console.info(" \u27A1 [tamagui] \u{1F3A8} combining css into one file"), compiler.hooks.make.tap(this.pluginName, function (compilation) {
144
+ compilation.hooks.processAssets.tap(_this.pluginName, function (assets) {
145
+ try {
146
+ var cssFiles = Object.keys(assets).filter(function (asset) {
147
+ return asset.endsWith(".css");
148
+ });
149
+ if (cssFiles.length === 0) return;
150
+ var combinedCSS = cssFiles.reduce(function (acc, file) {
151
+ var cssContent = compilation.assets[file].source();
152
+ return `${acc}
153
+ ${cssContent}`;
154
+ }, ""),
155
+ _iteratorNormalCompletion2 = !0,
156
+ _didIteratorError2 = !1,
157
+ _iteratorError2 = void 0;
158
+ try {
159
+ for (var _iterator2 = cssFiles.entries()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
160
+ var [index2, cssFile] = _step2.value;
161
+ index2 > 0 ? compilation.updateAsset(cssFile, new compiler.webpack.sources.RawSource("")) : (console.info(` \u27A1 [tamagui] \u{1F3A8} emitting single css to ${cssFile}`), compilation.updateAsset(cssFile, new compiler.webpack.sources.RawSource(Buffer.from(combinedCSS))));
162
+ }
163
+ } catch (err) {
164
+ _didIteratorError2 = !0, _iteratorError2 = err;
165
+ } finally {
166
+ try {
167
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
168
+ } finally {
169
+ if (_didIteratorError2) throw _iteratorError2;
170
+ }
171
+ }
172
+ } catch (error) {
173
+ compilation.errors.push(error);
174
+ }
175
+ });
176
+ })), compiler.options.resolve.extensions = [... /* @__PURE__ */new Set([".web.tsx", ".web.ts", ".web.js", ".ts", ".tsx", ".js", ...(compiler.options.resolve.extensions || [])])], (_compiler_options_resolve = compiler.options.resolve).fallback || (_compiler_options_resolve.fallback = {}), (_compiler_options_resolve_fallback = compiler.options.resolve.fallback)[_crypto = "crypto"] || (_compiler_options_resolve_fallback[_crypto] = !1);
177
+ var mainFields = compiler.options.resolve.mainFields;
178
+ if (mainFields && (compiler.options.resolve.mainFields = Array.isArray(mainFields) ? mainFields : [mainFields], this.options.disableModuleJSXEntry || mainFields.unshift("module:jsx")), !!compiler.options.module) {
179
+ var {
180
+ jsLoader
181
+ } = this.options,
182
+ existing = compiler.options.module.rules,
183
+ _existing_find_oneOf,
184
+ rules = (_existing_find_oneOf = (_existing_find = existing.find(function (x) {
185
+ return typeof x == "object" && "oneOf" in x ? x : null;
186
+ })) === null || _existing_find === void 0 ? void 0 : _existing_find.oneOf) !== null && _existing_find_oneOf !== void 0 ? _existing_find_oneOf : existing,
187
+ tamaguiLoader = {
188
+ loader: requireResolve("tamagui-loader"),
189
+ options: {
190
+ ...this.options,
191
+ _disableLoadTamagui: !0
192
+ }
193
+ },
194
+ didReplaceNextJS = !1,
195
+ _iteratorNormalCompletion = !0,
196
+ _didIteratorError = !1,
197
+ _iteratorError = void 0;
198
+ try {
199
+ for (var _iterator = rules.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
200
+ var [index, rule] = _step.value,
201
+ _rule_use,
202
+ shouldReplaceNextJSRule = ((rule == null || (_rule_use = rule.use) === null || _rule_use === void 0 ? void 0 : _rule_use.loader) === "next-swc-loader" || Array.isArray(rule?.use) && rule?.use[0].loader === "next-swc-loader") && !rule.issuerLayer;
203
+ if (shouldReplaceNextJSRule) {
204
+ didReplaceNextJS = !0;
205
+ var _this_options_test, _ref, _this_options_exclude;
206
+ rules[index] = {
207
+ ...rule,
208
+ test: (_ref = (_this_options_test = this.options.test) !== null && _this_options_test !== void 0 ? _this_options_test : rule.test) !== null && _ref !== void 0 ? _ref : /\.m?[jt]sx?$/,
209
+ exclude: (_this_options_exclude = this.options.exclude) !== null && _this_options_exclude !== void 0 ? _this_options_exclude : rule.exclude,
210
+ use: [...(jsLoader ? [jsLoader] : []), ...(rule.use ? [].concat(rule.use) : []), tamaguiLoader]
211
+ };
212
+ }
213
+ }
214
+ } catch (err) {
215
+ _didIteratorError = !0, _iteratorError = err;
216
+ } finally {
217
+ try {
218
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
219
+ } finally {
220
+ if (_didIteratorError) throw _iteratorError;
221
+ }
222
+ }
223
+ if (!didReplaceNextJS && compiler.options.mode === "development") {
224
+ var _this_options_test1;
225
+ existing.push({
226
+ test: (_this_options_test1 = this.options.test) !== null && _this_options_test1 !== void 0 ? _this_options_test1 : /\.tsx$/,
227
+ exclude: this.options.exclude,
228
+ use: [tamaguiLoader]
229
+ });
230
+ }
231
+ }
232
+ }
233
+ }]), TamaguiPlugin2;
234
+ }();
235
+ export { TamaguiPlugin };
236
+ //# sourceMappingURL=TamaguiPlugin.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Static","existsSync","dirname","join","webpack","requireResolve","_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj","value","loadTamagui","watchTamaguiConfig","TamaguiPlugin","TamaguiPlugin2","_this","options","arguments","platform","components","pluginName","safeResolves","resolves","multiple","res","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","out","mod","endsWith","push","err","_process_env_DEBUG","includes","process","env","DEBUG","startsWith","console","info","return","isInComponentModule","fullPath","componentsBaseDirs","some","componentDir","get","_this_options_components","map","moduleName","componentsFullPaths","param","_","rootPath","pkg","hasPkg","Error","fromEntries","useTamaguiSVG","useReactNativeWebLite","compiler","_existing_find","_compiler_options_resolve","_compiler_options_resolve_fallback","_crypto","isServer","watchMode","disableWatchConfig","then","watcher","once","dispose","hooks","beforeRun","tapPromise"],"sources":["../../src/TamaguiPlugin.ts"],"sourcesContent":[null],"mappings":"AACA,OAAOA,MAAA,MAAY;AACnB,SAASC,UAAA,QAAkB;AAC3B,SAASC,OAAA,EAASC,IAAA,QAAY;AAE9B,OAAOC,OAAA,MAAa;AACpB,SAASC,cAAA,QAAsB;AAE/B,SAAQC,iBAAaA,CAAAC,QAAA,EAAAC,WAAuB;EAcrC,IAAM,EAAAD,QAAA,YAAcC,WAAA,GAGzB,UACSC,SAAA,CAAyB;AAAA;AACpB,SACVC,iBAAaA,CAAAC,MAAe,EAAAC,KAAA;EAC9B,KACA,IAAAC,CAAA,MAAAA,CAAA,GAAAD,KAAA,CAAAE,MAAA,EAAAD,CAAA;IAJO,IAAAE,UAAA,GAAAH,KAAA,CAAAC,CAAA;IAINE,UAAA,CAAAC,UAAA,GAAAD,UAAA,CAAAC,UAAA,QAAAD,UAAA,CAAAE,YAAA,kBAAAF,UAAA,KAAAA,UAAA,CAAAG,QAAA,QAAAC,MAAA,CAAAC,cAAA,CAAAT,MAAA,EAAAI,UAAA,CAAAM,GAAA,EAAAN,UAAA;EAPH;AAAa;AAUX,SAAAO,aAAyBA,CAAAd,WAAA,EAAAe,UAAA,EAAAC,WAAA;EACzB,OAAAD,UAAY,IAAKb,iBAAkB,CAAAF,WAAA,CAAAiB,SAAA,EAAAF,UAAA,GAAAC,WAAA,IAAAd,iBAAA,CAAAF,WAAA,EAAAgB,WAAA,GAAAhB,WAAA;AACjC;AACE,SAAAkB,gBAAeA,CAAGC,GAAC,EAAAN,GAAA,EAAAO,KAAA;EACnB,OAAAP,GAAA,IAAAM,GAAA,GAAAR,MAAA,CAAAC,cAAA,CAAAO,GAAA,EAAAN,GAAA;IAAAO,KACF;IACA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define_property(obj, key, value) {
2
- return key in obj ? Object.defineProperty(obj, key, {
3
- value,
4
- enumerable: !0,
5
- configurable: !0,
6
- writable: !0
7
- }) : obj[key] = value, obj;
8
- }
9
- function _object_spread(target) {
10
- for (var i = 1; i < arguments.length; i++) {
11
- var source = arguments[i] != null ? arguments[i] : {}, ownKeys = Object.keys(source);
12
- typeof Object.getOwnPropertySymbols == "function" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
13
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
14
- }))), ownKeys.forEach(function(key) {
15
- _define_property(target, key, source[key]);
16
- });
17
- }
18
- return target;
19
- }
20
1
  function loader() {
21
2
  this.async();
22
- var options = _object_spread({}, this.getOptions()), out = Buffer.from(options.cssData, "base64").toString("utf-8");
3
+ var options = {
4
+ ...this.getOptions()
5
+ }, out = Buffer.from(options.cssData, "base64").toString("utf-8");
23
6
  if (out)
24
7
  return this.callback(null, out || "");
25
8
  this.callback({
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/tamagui/code/compiler/loader/src/css.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;AAGe,SAAf,SAAwBA;AACtB,OAAKC,MAAK;AACV,MAAMC,UAAU,eAAA,CAAA,GAAK,KAAKC,WAAU,CAAA,GAChCC,MAAMC,OAAOC,KAAKJ,QAAQK,SAAS,QAAA,EAAUC,SAAS,OAAA;AAC1D,MAAIJ;AAEF,WAAO,KAAKK,SAAS,MAAML,OAAO,EAAA;AAEpC,OAAKK,SAAS;IAAEC,SAAS;IAAgBC,MAAM;EAAc,CAAA;AAC/D;",
4
+ "mappings": "AAGe,SAAf,SAAwBA;AACtB,OAAKC,MAAK;AACV,MAAMC,UAAU;IAAE,GAAG,KAAKC,WAAU;EAAG,GACnCC,MAAMC,OAAOC,KAAKJ,QAAQK,SAAS,QAAA,EAAUC,SAAS,OAAA;AAC1D,MAAIJ;AAEF,WAAO,KAAKK,SAAS,MAAML,OAAO,EAAA;AAEpC,OAAKK,SAAS;IAAEC,SAAS;IAAgBC,MAAM;EAAc,CAAA;AAC/D;",
5
5
  "names": ["loader", "async", "options", "getOptions", "out", "Buffer", "from", "cssData", "toString", "callback", "message", "name"]
6
6
  }
@@ -0,0 +1,14 @@
1
+ function loader() {
2
+ this.async();
3
+ var options = {
4
+ ...this.getOptions()
5
+ },
6
+ out = Buffer.from(options.cssData, "base64").toString("utf-8");
7
+ if (out) return this.callback(null, out || "");
8
+ this.callback({
9
+ message: "No CSS found",
10
+ name: "missing_css"
11
+ });
12
+ }
13
+ export { loader as default };
14
+ //# sourceMappingURL=css.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["loader","async","options","getOptions","out","Buffer","from","cssData","toString","callback"],"sources":["../../src/css.ts"],"sourcesContent":[null],"mappings":"AAGe,SAARA,OAAA,EAA6D;EAClE,KAAKC,KAAA,CAAM;EACX,IAAAC,OAAM;MACN,GAAI,KAAMC,UAAO;IACjB;IAAAC,GAAI,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,OAAA,CAAAK,OAAA,YAAAC,QAAA;EAEF,IAAAJ,GAAA,EAEF,OAAK,KAASK,QAAE,KAAS,EAAAL,GAAA;EAC3B,KAAAK,QAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import "./polyfills.mjs";
2
+ import { loader } from "./loader.mjs";
3
+ export * from "./TamaguiPlugin.mjs";
4
+ export * from "./shouldExclude.mjs";
5
+ var src_default = loader;
6
+ export { src_default as default };
7
+ //# sourceMappingURL=index.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["loader","src_default"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO;AAEP,SAASA,MAAA,QAAc;AAGvB,cAAc;AACd,cAAc;AAFd,IAAOC,WAAA,GAAQD,MAAA","ignoreList":[]}
@@ -1,214 +1,56 @@
1
1
  import Static from "@tamagui/static";
2
2
  import { requireResolve } from "./requireResolve";
3
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4
- try {
5
- var info = gen[key](arg), value = info.value;
6
- } catch (error) {
7
- reject(error);
8
- return;
9
- }
10
- info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
11
- }
12
- function _async_to_generator(fn) {
13
- return function() {
14
- var self = this, args = arguments;
15
- return new Promise(function(resolve, reject) {
16
- var gen = fn.apply(self, args);
17
- function _next(value) {
18
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
19
- }
20
- function _throw(err) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
22
- }
23
- _next(void 0);
24
- });
25
- };
26
- }
27
- function _define_property(obj, key, value) {
28
- return key in obj ? Object.defineProperty(obj, key, {
29
- value,
30
- enumerable: !0,
31
- configurable: !0,
32
- writable: !0
33
- }) : obj[key] = value, obj;
34
- }
35
- function _instanceof(left, right) {
36
- return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
37
- }
38
- function _object_spread(target) {
39
- for (var i = 1; i < arguments.length; i++) {
40
- var source = arguments[i] != null ? arguments[i] : {}, ownKeys = Object.keys(source);
41
- typeof Object.getOwnPropertySymbols == "function" && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
42
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
43
- }))), ownKeys.forEach(function(key) {
44
- _define_property(target, key, source[key]);
45
- });
46
- }
47
- return target;
48
- }
49
- function _ts_generator(thisArg, body) {
50
- var f, y, t, g, _ = {
51
- label: 0,
52
- sent: function() {
53
- if (t[0] & 1) throw t[1];
54
- return t[1];
55
- },
56
- trys: [],
57
- ops: []
58
- };
59
- return g = {
60
- next: verb(0),
61
- throw: verb(1),
62
- return: verb(2)
63
- }, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
64
- return this;
65
- }), g;
66
- function verb(n) {
67
- return function(v) {
68
- return step([
69
- n,
70
- v
71
- ]);
72
- };
73
- }
74
- function step(op) {
75
- if (f) throw new TypeError("Generator is already executing.");
76
- for (; _; ) try {
77
- 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) return t;
78
- switch (y = 0, t && (op = [
79
- op[0] & 2,
80
- t.value
81
- ]), op[0]) {
82
- case 0:
83
- case 1:
84
- t = op;
85
- break;
86
- case 4:
87
- return _.label++, {
88
- value: op[1],
89
- done: !1
90
- };
91
- case 5:
92
- _.label++, y = op[1], op = [
93
- 0
94
- ];
95
- continue;
96
- case 7:
97
- op = _.ops.pop(), _.trys.pop();
98
- continue;
99
- default:
100
- if (t = _.trys, !(t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
101
- _ = 0;
102
- continue;
103
- }
104
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
105
- _.label = op[1];
106
- break;
107
- }
108
- if (op[0] === 6 && _.label < t[1]) {
109
- _.label = t[1], t = op;
110
- break;
111
- }
112
- if (t && _.label < t[2]) {
113
- _.label = t[2], _.ops.push(op);
114
- break;
115
- }
116
- t[2] && _.ops.pop(), _.trys.pop();
117
- continue;
118
- }
119
- op = body.call(thisArg, _);
120
- } catch (e) {
121
- op = [
122
- 6,
123
- e
124
- ], y = 0;
125
- } finally {
126
- f = t = 0;
127
- }
128
- if (op[0] & 5) throw op[1];
129
- return {
130
- value: op[0] ? op[1] : void 0,
131
- done: !0
132
- };
133
- }
134
- }
135
- var createExtractor = Static.createExtractor, extractToClassNames = Static.extractToClassNames, getPragmaOptions = Static.getPragmaOptions;
3
+ var { createExtractor, extractToClassNames, getPragmaOptions } = Static;
136
4
  Error.stackTraceLimit = Number.POSITIVE_INFINITY;
137
5
  var CSS_LOADER_PATH = requireResolve("./css");
138
6
  Error.stackTraceLimit = Number.POSITIVE_INFINITY;
139
7
  var extractor = createExtractor(), index = 0;
140
8
  process.env.TAMAGUI_TARGET = "web";
141
- var loader = /* @__PURE__ */ function() {
142
- var _loader = _async_to_generator(function(sourceIn) {
143
- var callback, sourcePath, source, options, _getPragmaOptions, shouldDisable, shouldPrintDebug, cssPath, extracted, cssQuery, remReq, importPath, err, message;
144
- return _ts_generator(this, function(_state) {
145
- switch (_state.label) {
146
- case 0:
147
- if (this.cacheable(!0), callback = this.async(), sourcePath = "".concat(this.resourcePath), sourcePath.includes("node_modules") || sourcePath.includes("lucide-icons"))
148
- return [
149
- 2,
150
- callback(null, sourceIn)
151
- ];
152
- source = sourceIn.toString(), _state.label = 1;
153
- case 1:
154
- return _state.trys.push([
155
- 1,
156
- 3,
157
- ,
158
- 4
159
- ]), options = _object_spread({
160
- // @ts-ignore
161
- platform: "web"
162
- }, this.getOptions()), _getPragmaOptions = getPragmaOptions({
163
- source,
164
- path: sourcePath
165
- }), shouldDisable = _getPragmaOptions.shouldDisable, shouldPrintDebug = _getPragmaOptions.shouldPrintDebug, shouldPrintDebug === "verbose" && (console.warn(`
9
+ var loader = async function(sourceIn) {
10
+ this.cacheable(!0);
11
+ var callback = this.async(), sourcePath = `${this.resourcePath}`;
12
+ if (sourcePath.includes("node_modules") || sourcePath.includes("lucide-icons"))
13
+ return callback(null, sourceIn);
14
+ var source = sourceIn.toString();
15
+ try {
16
+ var options = {
17
+ // @ts-ignore
18
+ platform: "web",
19
+ ...this.getOptions()
20
+ }, { shouldDisable, shouldPrintDebug } = getPragmaOptions({
21
+ source,
22
+ path: sourcePath
23
+ });
24
+ if (shouldPrintDebug === "verbose" && (console.warn(`
166
25
 
167
26
  --- Incoming source ---
168
27
 
169
- `), console.warn(source)), shouldDisable ? (shouldPrintDebug && console.info("Disabling on file via pragma"), [
170
- 2,
171
- callback(null, source)
172
- ]) : (cssPath = "".concat(sourcePath, ".").concat(index++, ".tamagui.css"), [
173
- 4,
174
- extractToClassNames({
175
- extractor,
176
- source,
177
- sourcePath,
178
- options,
179
- shouldPrintDebug
180
- })
181
- ]);
182
- case 2:
183
- return extracted = _state.sent(), extracted ? (extracted.styles && (cssQuery = "cssData=".concat(Buffer.from(extracted.styles).toString("base64")), remReq = this.remainingRequest, importPath = "".concat(cssPath, "!=!").concat(CSS_LOADER_PATH, "?").concat(cssQuery, "!").concat(remReq), extracted.js = "".concat(extracted.js, `
184
-
185
- require(`).concat(JSON.stringify(importPath), ")")), callback(null, extracted.js, extracted.map), [
186
- 3,
187
- 4
188
- ]) : [
189
- 2,
190
- callback(null, source)
191
- ];
192
- case 3:
193
- return err = _state.sent(), message = _instanceof(err, Error) ? "".concat(err.message, `
194
- `).concat(err.stack) : String(err), console.error(`Tamagui Webpack Loader Error:
195
- `, " ".concat(message, `
196
- `)), 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), [
197
- 3,
198
- 4
199
- ];
200
- case 4:
201
- return [
202
- 2
203
- ];
204
- }
28
+ `), console.warn(source)), shouldDisable)
29
+ return shouldPrintDebug && console.info("Disabling on file via pragma"), callback(null, source);
30
+ var cssPath = `${sourcePath}.${index++}.tamagui.css`, extracted = await extractToClassNames({
31
+ extractor,
32
+ source,
33
+ sourcePath,
34
+ options,
35
+ shouldPrintDebug
205
36
  });
206
- });
207
- function loader2(sourceIn) {
208
- return _loader.apply(this, arguments);
37
+ if (!extracted)
38
+ return callback(null, source);
39
+ if (extracted.styles) {
40
+ var cssQuery = `cssData=${Buffer.from(extracted.styles).toString("base64")}`, remReq = this.remainingRequest, importPath = `${cssPath}!=!${CSS_LOADER_PATH}?${cssQuery}!${remReq}`;
41
+ extracted.js = `${extracted.js}
42
+
43
+ require(${JSON.stringify(importPath)})`;
44
+ }
45
+ callback(null, extracted.js, extracted.map);
46
+ } catch (err) {
47
+ var message = err instanceof Error ? `${err.message}
48
+ ${err.stack}` : String(err);
49
+ console.error(`Tamagui Webpack Loader Error:
50
+ `, ` ${message}
51
+ `), 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);
209
52
  }
210
- return loader2;
211
- }();
53
+ };
212
54
  export {
213
55
  loader
214
56
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Users/n8/tamagui/code/compiler/loader/src/loader.ts"],
4
- "mappings": "AACA,OAAOA,YAAY;AAEnB,SAASC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/B,IAAQC,kBAA2DF,OAA3DE,iBAAiBC,sBAA0CH,OAA1CG,qBAAqBC,mBAAqBJ,OAArBI;AAE9CC,MAAMC,kBAAkBC,OAAOC;AAG/B,IAAMC,kBAAkBR,eAAe,OAAA;AAEvCI,MAAMC,kBAAkBC,OAAOC;AAC/B,IAAME,YAAYR,gBAAAA,GAEdS,QAAQ;AAEZC,QAAQC,IAAIC,iBAAiB;AAEtB,IAAMC,SAAAA,2BAAAA;MAAwBA,UAAf,oBAAA,SAEpBC,UAAyB;QAGnBC,UACAC,YAMAC,QAGEC,SAMsChB,mBAApCiB,eAAeC,kBAiBjBC,SAEAC,WAcEC,UACAC,QACAC,YAKDC,KACDC;;;;AAtDR,cAJA,KAAKC,UAAU,EAAA,GACTb,WAAW,KAAKc,MAAK,GACrBb,aAAc,GAAoB,OAAlB,KAAKc,YAAY,GAEnCd,WAAWe,SAAS,cAAA,KAAmBf,WAAWe,SAAS,cAAA;AAC7D,mBAAA;;cAAOhB,SAAS,MAAMD,QAAAA;;AAGlBG,mBAASH,SAASkB,SAAQ;;AAmB9B;;;;;cAhBMd,UAA0B,eAAA;;YAE9Be,UAAU;aACP,KAAKC,WAAU,CAAA,GAGwBhC,oBAAAA,iBAAiB;YAC3De;YACAkB,MAAMnB;UACR,CAAA,GAHQG,gBAAoCjB,kBAApCiB,eAAeC,mBAAqBlB,kBAAr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ames", "getPragmaOptions", "Error", "stackTraceLimit", "Number", "POSITIVE_INFINITY", "CSS_LOADER_PATH", "extractor", "index", "process", "env", "TAMAGUI_TARGET", "loader", "sourceIn", "callback", "sourcePath", "source", "options", "shouldDisable", "shouldPrintDebug", "cssPath", "extracted", "cssQuery", "remReq", "importPath", "err", "message", "cacheable", "async", "resourcePath", "includes", "toString", "platform", "getOptions", "path", "console", "warn", "info", "styles", "Buffer", "from", "remainingRequest", "js", "JSON", "stringify", "map", "stack", "String", "error"]
4
+ "mappings": "AACA,OAAOA,YAAY;AAEnB,SAASC,sBAAsB;AAE/B,IAAM,EAAEC,iBAAiBC,qBAAqBC,iBAAgB,IAAKJ;AAEnEK,MAAMC,kBAAkBC,OAAOC;AAG/B,IAAMC,kBAAkBR,eAAe,OAAA;AAEvCI,MAAMC,kBAAkBC,OAAOC;AAC/B,IAAME,YAAYR,gBAAAA,GAEdS,QAAQ;AAEZC,QAAQC,IAAIC,iBAAiB;AAEtB,IAAMC,SAAS,eAEpBC,UAAyB;AAEzB,OAAKC,UAAU,EAAA;AACf,MAAMC,WAAW,KAAKC,MAAK,GACrBC,aAAa,GAAG,KAAKC,YAAY;AAEvC,MAAID,WAAWE,SAAS,cAAA,KAAmBF,WAAWE,SAAS,cAAA;AAC7D,WAAOJ,SAAS,MAAMF,QAAAA;AAGxB,MAAMO,SAASP,SAASQ,SAAQ;AAEhC,MAAI;AACF,QAAMC,UAA0B;;MAE9BC,UAAU;MACV,GAAG,KAAKC,WAAU;IACpB,GAEM,EAAEC,eAAeC,iBAAgB,IAAKzB,iBAAiB;MAC3DmB;MACAO,MAAMV;IACR,CAAA;AAOA,QALIS,qBAAqB,cACvBE,QAAQC,KAAK;;;;CAAmC,GAChDD,QAAQC,KAAKT,MAAAA,IAGXK;AACF,aAAIC,oBACFE,QAAQE,KAAK,8BAAA,GAERf,SAAS,MAAMK,MAAAA;AAGxB,QAAMW,UAAU,GAAGd,UAAAA,IAAcT,OAAAA,gBAE3BwB,YAAY,MAAMhC,oBAAoB;MAC1CO;MACAa;MACAH;MACAK;MACAI;IACF,CAAA;AAEA,QAAI,CAACM;AACH,aAAOjB,SAAS,MAAMK,MAAAA;AAIxB,QAAIY,UAAUC,QAAQ;AACpB,UAAMC,WAAW,WAAWC,OAAOC,KAAKJ,UAAUC,MAAM,EAAEZ,SAAS,QAAA,CAAA,IAC7DgB,SAAS,KAAKC,kBACdC,aAAa,GAAGR,OAAAA,MAAazB,eAAAA,IAAmB4B,QAAAA,IAAYG,MAAAA;AAClEL,gBAAUQ,KAAK,GAAGR,UAAUQ,EAAE;;UAAeC,KAAKC,UAAUH,UAAAA,CAAAA;IAC9D;AAEAxB,aAAS,MAAMiB,UAAUQ,IAAIR,UAAUW,GAAG;EAC5C,SAASC,KAAK;AACZ,QAAMC,UAAUD,eAAe1C,QAAQ,GAAG0C,IAAIC,OAAO;EAAKD,IAAIE,KAAK,KAAKC,OAAOH,GAAAA;AAE/EhB,YAAQoB,MAAM;GAAmC,KAAKH,OAAAA;CAAW,GAE7DA,QAAQ1B,SAAS,qBAAA,KACnBS,QAAQE,KACN,wGAAA,GAIJf,SAAS,MAAMK,MAAAA;EACjB;AACF;",
5
+ "names": ["Static", "requireResolve", "createExtractor", "extractToClassNames", "getPragmaOptions", "Error", "stackTraceLimit", "Number", "POSITIVE_INFINITY", "CSS_LOADER_PATH", "extractor", "index", "process", "env", "TAMAGUI_TARGET", "loader", "sourceIn", "cacheable", "callback", "async", "sourcePath", "resourcePath", "includes", "source", "toString", "options", "platform", "getOptions", "shouldDisable", "shouldPrintDebug", "path", "console", "warn", "info", "cssPath", "extracted", "styles", "cssQuery", "Buffer", "from", "remReq", "remainingRequest", "importPath", "js", "JSON", "stringify", "map", "err", "message", "stack", "String", "error"]
6
6
  }