@tamagui/static 1.89.26 → 1.89.27-1708113113238
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/constants.native.js +4 -4
- package/dist/cjs/constants.native.js.map +3 -3
- package/dist/cjs/extractor/accessSafe.native.js +1 -5
- package/dist/cjs/extractor/accessSafe.native.js.map +3 -3
- package/dist/cjs/extractor/babelParse.native.js +5 -8
- package/dist/cjs/extractor/babelParse.native.js.map +3 -3
- package/dist/cjs/extractor/buildClassName.native.js +31 -42
- package/dist/cjs/extractor/buildClassName.native.js.map +3 -3
- package/dist/cjs/extractor/bundle.js +6 -4
- package/dist/cjs/extractor/bundle.js.map +1 -1
- package/dist/cjs/extractor/bundle.native.js +321 -56
- package/dist/cjs/extractor/bundle.native.js.map +3 -3
- package/dist/cjs/extractor/bundleConfig.native.js +499 -187
- package/dist/cjs/extractor/bundleConfig.native.js.map +3 -3
- package/dist/cjs/extractor/createEvaluator.native.js +9 -11
- package/dist/cjs/extractor/createEvaluator.native.js.map +3 -3
- package/dist/cjs/extractor/createExtractor.native.js +1240 -906
- package/dist/cjs/extractor/createExtractor.native.js.map +3 -3
- package/dist/cjs/extractor/ensureImportingConcat.native.js +11 -17
- package/dist/cjs/extractor/ensureImportingConcat.native.js.map +3 -3
- package/dist/cjs/extractor/esbuildAliasPlugin.native.js +22 -11
- package/dist/cjs/extractor/esbuildAliasPlugin.native.js.map +3 -3
- package/dist/cjs/extractor/evaluateAstNode.native.js +15 -21
- package/dist/cjs/extractor/evaluateAstNode.native.js.map +3 -3
- package/dist/cjs/extractor/extractHelpers.native.js +146 -38
- package/dist/cjs/extractor/extractHelpers.native.js.map +3 -3
- package/dist/cjs/extractor/extractMediaStyle.native.js +127 -54
- package/dist/cjs/extractor/extractMediaStyle.native.js.map +3 -3
- package/dist/cjs/extractor/extractToClassNames.native.js +449 -252
- package/dist/cjs/extractor/extractToClassNames.native.js.map +3 -3
- package/dist/cjs/extractor/findTopmostFunction.native.js +4 -4
- package/dist/cjs/extractor/findTopmostFunction.native.js.map +3 -3
- package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js +415 -54
- package/dist/cjs/extractor/generateTamaguiStudioConfig.native.js.map +3 -3
- package/dist/cjs/extractor/generatedUid.native.js +2 -2
- package/dist/cjs/extractor/generatedUid.native.js.map +3 -3
- package/dist/cjs/extractor/getPrefixLogs.native.js +2 -1
- package/dist/cjs/extractor/getPrefixLogs.native.js.map +3 -3
- package/dist/cjs/extractor/getPropValueFromAttributes.native.js +16 -19
- package/dist/cjs/extractor/getPropValueFromAttributes.native.js.map +3 -3
- package/dist/cjs/extractor/getSourceModule.native.js +20 -7
- package/dist/cjs/extractor/getSourceModule.native.js.map +3 -3
- package/dist/cjs/extractor/getStaticBindingsForScope.native.js +336 -94
- package/dist/cjs/extractor/getStaticBindingsForScope.native.js.map +3 -3
- package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +3 -3
- package/dist/cjs/extractor/hoistClassNames.native.js +8 -10
- package/dist/cjs/extractor/hoistClassNames.native.js.map +3 -3
- package/dist/cjs/extractor/literalToAst.native.js +89 -19
- package/dist/cjs/extractor/literalToAst.native.js.map +3 -3
- package/dist/cjs/extractor/loadFile.native.js +16 -8
- package/dist/cjs/extractor/loadFile.native.js.map +3 -3
- package/dist/cjs/extractor/loadTamagui.js +3 -3
- package/dist/cjs/extractor/loadTamagui.js.map +1 -1
- package/dist/cjs/extractor/loadTamagui.native.js +667 -192
- package/dist/cjs/extractor/loadTamagui.native.js.map +3 -3
- package/dist/cjs/extractor/logLines.native.js +24 -6
- package/dist/cjs/extractor/logLines.native.js.map +3 -3
- package/dist/cjs/extractor/normalizeTernaries.native.js +71 -20
- package/dist/cjs/extractor/normalizeTernaries.native.js.map +3 -3
- package/dist/cjs/extractor/propsToFontFamilyCache.native.js +3 -3
- package/dist/cjs/extractor/propsToFontFamilyCache.native.js.map +3 -3
- package/dist/cjs/extractor/removeUnusedHooks.native.js +69 -36
- package/dist/cjs/extractor/removeUnusedHooks.native.js.map +3 -3
- package/dist/cjs/extractor/timer.native.js +10 -9
- package/dist/cjs/extractor/timer.native.js.map +3 -3
- package/dist/cjs/extractor/validHTMLAttributes.native.js +1 -1
- package/dist/cjs/extractor/validHTMLAttributes.native.js.map +3 -3
- package/dist/cjs/getPragmaOptions.native.js +4 -9
- package/dist/cjs/getPragmaOptions.native.js.map +3 -3
- package/dist/cjs/helpers/memoize.native.js +5 -3
- package/dist/cjs/helpers/memoize.native.js.map +3 -3
- package/dist/cjs/helpers/requireTamaguiCore.native.js +2 -1
- package/dist/cjs/helpers/requireTamaguiCore.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/minifyCSS.native.js.map +3 -3
- package/dist/cjs/registerRequire.native.js +56 -28
- package/dist/cjs/registerRequire.native.js.map +3 -3
- package/dist/cjs/server.native.js +175 -21
- package/dist/cjs/server.native.js.map +3 -3
- package/dist/cjs/setup.native.js.map +3 -3
- package/dist/cjs/static.native.js.map +2 -2
- package/dist/cjs/types.native.js.map +2 -2
- package/dist/cjs/webpackPlugin.native.js +26 -5
- package/dist/cjs/webpackPlugin.native.js.map +3 -3
- package/dist/esm/constants.native.js +4 -3
- package/dist/esm/constants.native.js.map +3 -3
- package/dist/esm/extractor/accessSafe.native.js +1 -5
- package/dist/esm/extractor/accessSafe.native.js.map +3 -3
- package/dist/esm/extractor/babelParse.native.js +5 -7
- package/dist/esm/extractor/babelParse.native.js.map +3 -3
- package/dist/esm/extractor/buildClassName.native.js +31 -41
- package/dist/esm/extractor/buildClassName.native.js.map +3 -3
- package/dist/esm/extractor/bundle.js +6 -4
- package/dist/esm/extractor/bundle.js.map +1 -1
- package/dist/esm/extractor/bundle.mjs +7 -5
- package/dist/esm/extractor/bundle.native.js +321 -56
- package/dist/esm/extractor/bundle.native.js.map +3 -3
- package/dist/esm/extractor/bundleConfig.native.js +499 -187
- package/dist/esm/extractor/bundleConfig.native.js.map +3 -3
- package/dist/esm/extractor/createEvaluator.native.js +9 -11
- package/dist/esm/extractor/createEvaluator.native.js.map +3 -3
- package/dist/esm/extractor/createExtractor.native.js +1241 -916
- package/dist/esm/extractor/createExtractor.native.js.map +3 -3
- package/dist/esm/extractor/ensureImportingConcat.native.js +11 -16
- package/dist/esm/extractor/ensureImportingConcat.native.js.map +3 -3
- package/dist/esm/extractor/esbuildAliasPlugin.native.js +22 -11
- package/dist/esm/extractor/esbuildAliasPlugin.native.js.map +3 -3
- package/dist/esm/extractor/evaluateAstNode.native.js +15 -21
- package/dist/esm/extractor/evaluateAstNode.native.js.map +3 -3
- package/dist/esm/extractor/extractHelpers.native.js +146 -38
- package/dist/esm/extractor/extractHelpers.native.js.map +3 -3
- package/dist/esm/extractor/extractMediaStyle.native.js +127 -54
- package/dist/esm/extractor/extractMediaStyle.native.js.map +3 -3
- package/dist/esm/extractor/extractToClassNames.native.js +449 -252
- package/dist/esm/extractor/extractToClassNames.native.js.map +3 -3
- package/dist/esm/extractor/findTopmostFunction.native.js +4 -4
- package/dist/esm/extractor/findTopmostFunction.native.js.map +3 -3
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js +415 -54
- package/dist/esm/extractor/generateTamaguiStudioConfig.native.js.map +3 -3
- package/dist/esm/extractor/generatedUid.native.js +2 -2
- package/dist/esm/extractor/generatedUid.native.js.map +3 -3
- package/dist/esm/extractor/getPrefixLogs.native.js +2 -1
- package/dist/esm/extractor/getPrefixLogs.native.js.map +3 -3
- package/dist/esm/extractor/getPropValueFromAttributes.native.js +16 -19
- package/dist/esm/extractor/getPropValueFromAttributes.native.js.map +3 -3
- package/dist/esm/extractor/getSourceModule.native.js +20 -7
- package/dist/esm/extractor/getSourceModule.native.js.map +3 -3
- package/dist/esm/extractor/getStaticBindingsForScope.native.js +336 -94
- package/dist/esm/extractor/getStaticBindingsForScope.native.js.map +3 -3
- package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.native.js.map +3 -3
- package/dist/esm/extractor/hoistClassNames.native.js +8 -10
- package/dist/esm/extractor/hoistClassNames.native.js.map +3 -3
- package/dist/esm/extractor/literalToAst.native.js +89 -19
- package/dist/esm/extractor/literalToAst.native.js.map +3 -3
- package/dist/esm/extractor/loadFile.native.js +16 -8
- package/dist/esm/extractor/loadFile.native.js.map +3 -3
- package/dist/esm/extractor/loadTamagui.js +1 -2
- package/dist/esm/extractor/loadTamagui.js.map +1 -1
- package/dist/esm/extractor/loadTamagui.mjs +5 -3
- package/dist/esm/extractor/loadTamagui.native.js +668 -203
- package/dist/esm/extractor/loadTamagui.native.js.map +3 -3
- package/dist/esm/extractor/logLines.native.js +24 -6
- package/dist/esm/extractor/logLines.native.js.map +3 -3
- package/dist/esm/extractor/normalizeTernaries.native.js +71 -20
- package/dist/esm/extractor/normalizeTernaries.native.js.map +3 -3
- package/dist/esm/extractor/propsToFontFamilyCache.native.js +3 -3
- package/dist/esm/extractor/propsToFontFamilyCache.native.js.map +3 -3
- package/dist/esm/extractor/removeUnusedHooks.native.js +69 -35
- package/dist/esm/extractor/removeUnusedHooks.native.js.map +3 -3
- package/dist/esm/extractor/timer.native.js +10 -9
- package/dist/esm/extractor/timer.native.js.map +3 -3
- package/dist/esm/extractor/validHTMLAttributes.native.js +1 -1
- package/dist/esm/extractor/validHTMLAttributes.native.js.map +3 -3
- package/dist/esm/getPragmaOptions.native.js +4 -9
- package/dist/esm/getPragmaOptions.native.js.map +3 -3
- package/dist/esm/helpers/memoize.native.js +5 -3
- package/dist/esm/helpers/memoize.native.js.map +3 -3
- package/dist/esm/helpers/requireTamaguiCore.native.js +2 -1
- package/dist/esm/helpers/requireTamaguiCore.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/minifyCSS.native.js.map +3 -3
- package/dist/esm/registerRequire.native.js +56 -28
- package/dist/esm/registerRequire.native.js.map +3 -3
- package/dist/esm/server.native.js +175 -21
- package/dist/esm/server.native.js.map +3 -3
- package/dist/esm/setup.native.js.map +3 -3
- package/dist/esm/static.native.js.map +3 -3
- package/dist/esm/webpackPlugin.native.js +26 -5
- package/dist/esm/webpackPlugin.native.js.map +3 -3
- package/package.json +14 -15
- package/src/extractor/bundle.ts +5 -2
- package/src/extractor/loadTamagui.ts +3 -2
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/loadTamagui.d.ts.map +1 -1
- package/tamagui.tsconfig.json +0 -5
@@ -28,16 +28,154 @@ __export(getStaticBindingsForScope_exports, {
|
|
28
28
|
});
|
29
29
|
module.exports = __toCommonJS(getStaticBindingsForScope_exports);
|
30
30
|
var import_child_process = require("child_process"), import_path = require("path"), t = __toESM(require("@babel/types")), import_evaluateAstNode = require("./evaluateAstNode"), import_getSourceModule = require("./getSourceModule");
|
31
|
-
|
31
|
+
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
32
|
+
try {
|
33
|
+
var info = gen[key](arg), value = info.value;
|
34
|
+
} catch (error) {
|
35
|
+
reject(error);
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
info.done ? resolve2(value) : Promise.resolve(value).then(_next, _throw);
|
39
|
+
}
|
40
|
+
function _async_to_generator(fn) {
|
41
|
+
return function() {
|
42
|
+
var self = this, args = arguments;
|
43
|
+
return new Promise(function(resolve2, reject) {
|
44
|
+
var gen = fn.apply(self, args);
|
45
|
+
function _next(value) {
|
46
|
+
asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "next", value);
|
47
|
+
}
|
48
|
+
function _throw(err) {
|
49
|
+
asyncGeneratorStep(gen, resolve2, reject, _next, _throw, "throw", err);
|
50
|
+
}
|
51
|
+
_next(void 0);
|
52
|
+
});
|
53
|
+
};
|
54
|
+
}
|
55
|
+
function _type_of(obj) {
|
56
|
+
"@swc/helpers - typeof";
|
57
|
+
return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
58
|
+
}
|
59
|
+
function _ts_generator(thisArg, body) {
|
60
|
+
var f, y, t2, g, _ = {
|
61
|
+
label: 0,
|
62
|
+
sent: function() {
|
63
|
+
if (t2[0] & 1)
|
64
|
+
throw t2[1];
|
65
|
+
return t2[1];
|
66
|
+
},
|
67
|
+
trys: [],
|
68
|
+
ops: []
|
69
|
+
};
|
70
|
+
return g = {
|
71
|
+
next: verb(0),
|
72
|
+
throw: verb(1),
|
73
|
+
return: verb(2)
|
74
|
+
}, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
|
75
|
+
return this;
|
76
|
+
}), g;
|
77
|
+
function verb(n) {
|
78
|
+
return function(v) {
|
79
|
+
return step([
|
80
|
+
n,
|
81
|
+
v
|
82
|
+
]);
|
83
|
+
};
|
84
|
+
}
|
85
|
+
function step(op) {
|
86
|
+
if (f)
|
87
|
+
throw new TypeError("Generator is already executing.");
|
88
|
+
for (; _; )
|
89
|
+
try {
|
90
|
+
if (f = 1, y && (t2 = op[0] & 2 ? y.return : op[0] ? y.throw || ((t2 = y.return) && t2.call(y), 0) : y.next) && !(t2 = t2.call(y, op[1])).done)
|
91
|
+
return t2;
|
92
|
+
switch (y = 0, t2 && (op = [
|
93
|
+
op[0] & 2,
|
94
|
+
t2.value
|
95
|
+
]), op[0]) {
|
96
|
+
case 0:
|
97
|
+
case 1:
|
98
|
+
t2 = op;
|
99
|
+
break;
|
100
|
+
case 4:
|
101
|
+
return _.label++, {
|
102
|
+
value: op[1],
|
103
|
+
done: !1
|
104
|
+
};
|
105
|
+
case 5:
|
106
|
+
_.label++, y = op[1], op = [
|
107
|
+
0
|
108
|
+
];
|
109
|
+
continue;
|
110
|
+
case 7:
|
111
|
+
op = _.ops.pop(), _.trys.pop();
|
112
|
+
continue;
|
113
|
+
default:
|
114
|
+
if (t2 = _.trys, !(t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
115
|
+
_ = 0;
|
116
|
+
continue;
|
117
|
+
}
|
118
|
+
if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
|
119
|
+
_.label = op[1];
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
if (op[0] === 6 && _.label < t2[1]) {
|
123
|
+
_.label = t2[1], t2 = op;
|
124
|
+
break;
|
125
|
+
}
|
126
|
+
if (t2 && _.label < t2[2]) {
|
127
|
+
_.label = t2[2], _.ops.push(op);
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
t2[2] && _.ops.pop(), _.trys.pop();
|
131
|
+
continue;
|
132
|
+
}
|
133
|
+
op = body.call(thisArg, _);
|
134
|
+
} catch (e) {
|
135
|
+
op = [
|
136
|
+
6,
|
137
|
+
e
|
138
|
+
], y = 0;
|
139
|
+
} finally {
|
140
|
+
f = t2 = 0;
|
141
|
+
}
|
142
|
+
if (op[0] & 5)
|
143
|
+
throw op[1];
|
144
|
+
return {
|
145
|
+
value: op[0] ? op[1] : void 0,
|
146
|
+
done: !0
|
147
|
+
};
|
148
|
+
}
|
149
|
+
}
|
150
|
+
function _ts_values(o) {
|
151
|
+
var s = typeof Symbol == "function" && Symbol.iterator, m = s && o[s], i = 0;
|
152
|
+
if (m)
|
153
|
+
return m.call(o);
|
154
|
+
if (o && typeof o.length == "number")
|
155
|
+
return {
|
156
|
+
next: function() {
|
157
|
+
return o && i >= o.length && (o = void 0), {
|
158
|
+
value: o && o[i++],
|
159
|
+
done: !o
|
160
|
+
};
|
161
|
+
}
|
162
|
+
};
|
163
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
164
|
+
}
|
165
|
+
var isLocalImport = function(path) {
|
166
|
+
return path.startsWith(".") || path.startsWith("/");
|
167
|
+
};
|
32
168
|
function resolveImportPath(sourcePath, path) {
|
33
|
-
|
169
|
+
var sourceDir = (0, import_path.dirname)(sourcePath);
|
34
170
|
return isLocalImport(path) ? ((0, import_path.extname)(path) === "" && (path += ".js"), (0, import_path.resolve)(sourceDir, path)) : path;
|
35
171
|
}
|
36
|
-
|
37
|
-
let exited = !1, child = null;
|
172
|
+
var cache = /* @__PURE__ */ new Map(), pending = /* @__PURE__ */ new Map(), loadCmd = "".concat((0, import_path.join)(__dirname, "loadFile.js")), exited = !1, child = null;
|
38
173
|
function forkChild() {
|
39
174
|
child = (0, import_child_process.fork)(loadCmd, [], {
|
40
|
-
execArgv: [
|
175
|
+
execArgv: [
|
176
|
+
"-r",
|
177
|
+
"esbuild-register"
|
178
|
+
],
|
41
179
|
detached: !1,
|
42
180
|
stdio: "ignore"
|
43
181
|
});
|
@@ -51,100 +189,204 @@ process.once("beforeExit", cleanupBeforeExit);
|
|
51
189
|
function importModule(path) {
|
52
190
|
if (child || forkChild(), pending.has(path))
|
53
191
|
return pending.get(path);
|
54
|
-
|
55
|
-
if (
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
192
|
+
var promise = new Promise(function(res, rej) {
|
193
|
+
if (child) {
|
194
|
+
if (cache.size > 2e3 && cache.clear(), cache.has(path))
|
195
|
+
return cache.get(path);
|
196
|
+
var listener = function(msg) {
|
197
|
+
if (child && msg && typeof msg == "string") {
|
198
|
+
if (msg[0] === "-") {
|
199
|
+
rej(new Error(msg.slice(1)));
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
child.removeListener("message", listener);
|
203
|
+
var val = JSON.parse(msg);
|
204
|
+
cache.set(path, val), res(val);
|
205
|
+
}
|
206
|
+
};
|
207
|
+
child.once("message", listener), child.send("".concat(path.replace(".js", "")));
|
208
|
+
}
|
71
209
|
});
|
72
210
|
return pending.set(path, promise), promise;
|
73
211
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
212
|
+
function getStaticBindingsForScope(scope) {
|
213
|
+
return _getStaticBindingsForScope.apply(this, arguments);
|
214
|
+
}
|
215
|
+
function _getStaticBindingsForScope() {
|
216
|
+
return _getStaticBindingsForScope = _async_to_generator(function(scope) {
|
217
|
+
var _loop, whitelist, sourcePath, bindingCache, shouldPrintDebug, bindings, ret, program, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop1, _iterator, _step, err, k, _ret, _arguments = arguments;
|
218
|
+
return _ts_generator(this, function(_state) {
|
219
|
+
switch (_state.label) {
|
220
|
+
case 0:
|
221
|
+
_loop = function(k3) {
|
222
|
+
var binding = bindings[k3], sourceModule = (0, import_getSourceModule.getSourceModule)(k3, binding);
|
223
|
+
if (sourceModule) {
|
224
|
+
if (!sourceModule.sourceModule)
|
225
|
+
return "continue";
|
226
|
+
var moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule), isOnWhitelist = whitelist.some(function(test) {
|
227
|
+
return moduleName.endsWith(test);
|
228
|
+
});
|
229
|
+
if (isOnWhitelist) {
|
230
|
+
var src = importModule(moduleName);
|
231
|
+
if (!src)
|
232
|
+
return console.info(" | \u26A0\uFE0F Missing file ".concat(moduleName, " via ").concat(sourcePath, " import ").concat(sourceModule.sourceModule, "?")), {
|
233
|
+
v: {}
|
234
|
+
};
|
235
|
+
sourceModule.destructured ? sourceModule.imported && (ret[k3] = src[sourceModule.imported]) : ret[k3] = src;
|
236
|
+
}
|
237
|
+
return "continue";
|
238
|
+
}
|
239
|
+
var parent = binding.path.parent;
|
240
|
+
if (!t.isVariableDeclaration(parent) || parent.kind !== "const")
|
241
|
+
return "continue";
|
242
|
+
var dec = parent.declarations.find(function(d) {
|
243
|
+
return t.isIdentifier(d.id) && d.id.name === k3;
|
244
|
+
});
|
245
|
+
if (!dec || !dec.init)
|
246
|
+
return "continue";
|
247
|
+
if (typeof dec.id.start != "number" || typeof dec.id.end != "number")
|
248
|
+
return console.error("dec.id.start/end is not a number"), "continue";
|
249
|
+
if (!t.isIdentifier(dec.id))
|
250
|
+
return console.error("dec is not an identifier"), "continue";
|
251
|
+
var cacheKey = "".concat(dec.id.name, "_").concat(dec.id.start, "-").concat(dec.id.end);
|
252
|
+
if (Object.hasOwnProperty.call(bindingCache, cacheKey) || Object.hasOwnProperty.call(bindingCache, cacheKey))
|
253
|
+
return ret[k3] = bindingCache[cacheKey], "continue";
|
254
|
+
try {
|
255
|
+
return ret[k3] = (0, import_evaluateAstNode.evaluateAstNode)(dec.init, void 0, shouldPrintDebug), bindingCache[cacheKey] = ret[k3], "continue";
|
256
|
+
} catch {
|
257
|
+
}
|
258
|
+
}, whitelist = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : [], sourcePath = _arguments.length > 2 ? _arguments[2] : void 0, bindingCache = _arguments.length > 3 ? _arguments[3] : void 0, shouldPrintDebug = _arguments.length > 4 ? _arguments[4] : void 0, bindings = scope.getAllBindings(), ret = {}, program = scope.getProgramParent().block, _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0, _state.label = 1;
|
259
|
+
case 1:
|
260
|
+
_state.trys.push([
|
261
|
+
1,
|
262
|
+
6,
|
263
|
+
7,
|
264
|
+
8
|
265
|
+
]), _loop1 = function() {
|
266
|
+
var node, importPath, moduleName, isOnWhitelist, src, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step1, specifier, val, err1, _process_env_DEBUG;
|
267
|
+
return _ts_generator(this, function(_state2) {
|
268
|
+
switch (_state2.label) {
|
269
|
+
case 0:
|
270
|
+
if (node = _step.value, !t.isImportDeclaration(node))
|
271
|
+
return [
|
272
|
+
3,
|
273
|
+
4
|
274
|
+
];
|
275
|
+
if (importPath = node.source.value, !node.specifiers.length)
|
276
|
+
return [
|
277
|
+
2,
|
278
|
+
"continue"
|
279
|
+
];
|
280
|
+
if (!isLocalImport(importPath))
|
281
|
+
return [
|
282
|
+
2,
|
283
|
+
"continue"
|
284
|
+
];
|
285
|
+
if (moduleName = resolveImportPath(sourcePath, importPath), isOnWhitelist = whitelist.some(function(test) {
|
286
|
+
return moduleName.endsWith(test);
|
287
|
+
}), !isOnWhitelist)
|
288
|
+
return [
|
289
|
+
2,
|
290
|
+
"continue"
|
291
|
+
];
|
292
|
+
_state2.label = 1;
|
293
|
+
case 1:
|
294
|
+
return _state2.trys.push([
|
295
|
+
1,
|
296
|
+
3,
|
297
|
+
,
|
298
|
+
4
|
299
|
+
]), [
|
300
|
+
4,
|
301
|
+
importModule(moduleName)
|
302
|
+
];
|
303
|
+
case 2:
|
304
|
+
if (src = _state2.sent(), !src)
|
305
|
+
return [
|
306
|
+
2,
|
307
|
+
"continue"
|
308
|
+
];
|
309
|
+
_iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
|
310
|
+
try {
|
311
|
+
for (_iterator2 = node.specifiers[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0)
|
312
|
+
specifier = _step1.value, t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported) && typeof src[specifier.imported.name] < "u" && (val = src[specifier.local.name], ret[specifier.local.name] = val);
|
313
|
+
} catch (err2) {
|
314
|
+
_didIteratorError2 = !0, _iteratorError2 = err2;
|
315
|
+
} finally {
|
316
|
+
try {
|
317
|
+
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
318
|
+
} finally {
|
319
|
+
if (_didIteratorError2)
|
320
|
+
throw _iteratorError2;
|
321
|
+
}
|
322
|
+
}
|
323
|
+
return [
|
324
|
+
3,
|
325
|
+
4
|
326
|
+
];
|
327
|
+
case 3:
|
328
|
+
return err1 = _state2.sent(), shouldPrintDebug ? console.warn(" | Skipping partial evaluation of constant file: ".concat(moduleName, " (DEBUG=tamagui for more)")) : !((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0) && _process_env_DEBUG.startsWith("tamagui") && console.info("Error in partial evaluation", err1.message, err1.stack), [
|
329
|
+
3,
|
330
|
+
4
|
331
|
+
];
|
332
|
+
case 4:
|
333
|
+
return [
|
334
|
+
2
|
335
|
+
];
|
336
|
+
}
|
337
|
+
});
|
338
|
+
}, _iterator = program.body[Symbol.iterator](), _state.label = 2;
|
339
|
+
case 2:
|
340
|
+
return (_iteratorNormalCompletion = (_step = _iterator.next()).done) ? [
|
341
|
+
3,
|
342
|
+
5
|
343
|
+
] : [
|
344
|
+
5,
|
345
|
+
_ts_values(_loop1())
|
346
|
+
];
|
347
|
+
case 3:
|
348
|
+
_state.sent(), _state.label = 4;
|
349
|
+
case 4:
|
350
|
+
return _iteratorNormalCompletion = !0, [
|
351
|
+
3,
|
352
|
+
2
|
353
|
+
];
|
354
|
+
case 5:
|
355
|
+
return [
|
356
|
+
3,
|
357
|
+
8
|
358
|
+
];
|
359
|
+
case 6:
|
360
|
+
return err = _state.sent(), _didIteratorError = !0, _iteratorError = err, [
|
361
|
+
3,
|
362
|
+
8
|
363
|
+
];
|
364
|
+
case 7:
|
365
|
+
try {
|
366
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
367
|
+
} finally {
|
368
|
+
if (_didIteratorError)
|
369
|
+
throw _iteratorError;
|
93
370
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
if (!src)
|
111
|
-
return console.info(
|
112
|
-
` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`
|
113
|
-
), {};
|
114
|
-
sourceModule.destructured ? sourceModule.imported && (ret[k] = src[sourceModule.imported]) : ret[k] = src;
|
371
|
+
return [
|
372
|
+
7
|
373
|
+
];
|
374
|
+
case 8:
|
375
|
+
if (!bindingCache)
|
376
|
+
throw new Error("BindingCache is a required param");
|
377
|
+
for (var k2 in bindings)
|
378
|
+
if (_ret = _loop(k2), _type_of(_ret) === "object")
|
379
|
+
return [
|
380
|
+
2,
|
381
|
+
_ret.v
|
382
|
+
];
|
383
|
+
return [
|
384
|
+
2,
|
385
|
+
ret
|
386
|
+
];
|
115
387
|
}
|
116
|
-
|
117
|
-
|
118
|
-
const { parent } = binding.path;
|
119
|
-
if (!t.isVariableDeclaration(parent) || parent.kind !== "const")
|
120
|
-
continue;
|
121
|
-
const dec = parent.declarations.find((d) => t.isIdentifier(d.id) && d.id.name === k);
|
122
|
-
if (!dec || !dec.init)
|
123
|
-
continue;
|
124
|
-
if (typeof dec.id.start != "number" || typeof dec.id.end != "number") {
|
125
|
-
console.error("dec.id.start/end is not a number");
|
126
|
-
continue;
|
127
|
-
}
|
128
|
-
if (!t.isIdentifier(dec.id)) {
|
129
|
-
console.error("dec is not an identifier");
|
130
|
-
continue;
|
131
|
-
}
|
132
|
-
const cacheKey = `${dec.id.name}_${dec.id.start}-${dec.id.end}`;
|
133
|
-
if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
|
134
|
-
ret[k] = bindingCache[cacheKey];
|
135
|
-
continue;
|
136
|
-
}
|
137
|
-
if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
|
138
|
-
ret[k] = bindingCache[cacheKey];
|
139
|
-
continue;
|
140
|
-
}
|
141
|
-
try {
|
142
|
-
ret[k] = (0, import_evaluateAstNode.evaluateAstNode)(dec.init, void 0, shouldPrintDebug), bindingCache[cacheKey] = ret[k];
|
143
|
-
continue;
|
144
|
-
} catch {
|
145
|
-
}
|
146
|
-
}
|
147
|
-
return ret;
|
388
|
+
});
|
389
|
+
}), _getStaticBindingsForScope.apply(this, arguments);
|
148
390
|
}
|
149
391
|
// Annotate the CommonJS export names for ESM import in node:
|
150
392
|
0 && (module.exports = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/getStaticBindingsForScope.ts"],
|
4
|
-
"mappings": "
|
5
|
-
"names": []
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/getStaticBindingsForScope.ts"],
|
4
|
+
"mappings": ";;;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AAAA,KAAc7B,EAAEO,aAAasB,UAAU/B,QAAQ,KACjE,OAAOJ,IAAImC,UAAU/B,SAASW,IAAI,IAAM,QACpCtC,MAAMuB,IAAImC,UAAUS,MAAM7B,IAAI,GACpC1B,IAAI8C,UAAUS,MAAM7B,IAAI,IAAItC;;AAJ7B,oBAAAuD,qBAAA,IAAAC,kBAAAG;;;uBAAAL,8BAAAG,WAAA,UAAA,QAAAA,WAAA,OAAA;;0BAAAF;8BAAAC;;;;;;;;AAQEG,gCAAAA,QAAAA,KAAAA,GACHjD,mBACFc,QAAQ4C,KACL,uDAAiE,OAAXlD,YAAW,2BAAA,CAAA,IAE3DlC,wBAAAA,QAAQqF,IAAIC,WAAK,QAAjBtF,uBAAAA,WAAAA,mBAAmBzB,WAAW,SAAA,KACvCiE,QAAQC,KAAM,+BAA8BkC,KAAIY,SAASZ,KAAIa,KAAK;;;;;;;;;;UAI1E,GA/BK,YAAc3D,QAAQ4D,KAAI,OAAA,QAAA,EAAA;;kBAA1B,6BAAA,QAAA,UAAA,KAAA,GAAA,QAAA;;;;;;;;;;AAAA,6CAAA;;;;;;;;;;sCAAA,oBAAA,IAAA,iBAAA;;;;;;aAAA,6BAAA,UAAA,UAAA,QAAA,UAAA,OAAA;;gBAAA;oBAAA;;;;;;AAiCL,cAAI,CAAChE;AACH,kBAAM,IAAIZ,MAAM,kCAAA;AAGlB,mBAAWiB,MAAKH;;;;;;AAmFhB,iBAAA;;YAAOC;;;;EACT,CAAA,GA5IsBN,2BAAAA,MAAAA,MAAAA,SAAAA;;",
|
5
|
+
"names": ["isLocalImport", "path", "startsWith", "resolveImportPath", "sourcePath", "sourceDir", "dirname", "extname", "resolve", "cache", "Map", "pending", "loadCmd", "join", "__dirname", "exited", "child", "forkChild", "fork", "execArgv", "detached", "stdio", "cleanupBeforeExit", "removeAllListeners", "unref", "disconnect", "kill", "process", "once", "importModule", "has", "get", "promise", "Promise", "res", "rej", "size", "clear", "listener", "msg", "Error", "slice", "removeListener", "val", "JSON", "parse", "set", "send", "replace", "getStaticBindingsForScope", "scope", "whitelist", "bindingCache", "shouldPrintDebug", "bindings", "ret", "program", "k", "binding", "sourceModule", "getSourceModule", "moduleName", "isOnWhitelist", "some", "test", "endsWith", "src", "console", "info", "destructured", "imported", "parent", "t", "isVariableDeclaration", "kind", "dec", "declarations", "find", "d", "isIdentifier", "id", "name", "init", "start", "end", "error", "cacheKey", "Object", "hasOwnProperty", "call", "evaluateAstNode", "undefined", "getAllBindings", "getProgramParent", "block", "node", "importPath", "_iteratorNormalCompletion", "_didIteratorError", "_iteratorError", "_iterator", "specifier", "err", "isImportDeclaration", "source", "value", "specifiers", "length", "_state", "isImportSpecifier", "local", "warn", "env", "DEBUG", "message", "stack", "body"]
|
6
6
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/getTamaguiConfigPathFromOptionsConfig.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA
|
5
|
-
"names": []
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/getTamaguiConfigPathFromOptionsConfig.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;kBAAiC;AAI1B,SAASA,sCACdC,QAA6C;AAE7C,aAAIC,wBAAWD,MAAAA,IACNA,aAGFE,kBAAKC,QAAQC,IAAG,GAAIJ,MAAAA;AAC7B;",
|
5
|
+
"names": ["getTamaguiConfigPathFromOptionsConfig", "config", "isAbsolute", "join", "process", "cwd"]
|
6
6
|
}
|
@@ -28,13 +28,13 @@ __export(hoistClassNames_exports, {
|
|
28
28
|
module.exports = __toCommonJS(hoistClassNames_exports);
|
29
29
|
var t = __toESM(require("@babel/types"));
|
30
30
|
function hoistClassNames(path, existing, expr) {
|
31
|
-
|
31
|
+
var hoist = hoistClassNames.bind(null, path, existing);
|
32
32
|
if (t.isStringLiteral(expr)) {
|
33
33
|
if (expr.value.trim() === "")
|
34
34
|
return expr;
|
35
35
|
if (existing[expr.value])
|
36
36
|
return existing[expr.value];
|
37
|
-
|
37
|
+
var identifier = replaceStringWithVariable(expr);
|
38
38
|
return existing[expr.value] = identifier, identifier;
|
39
39
|
}
|
40
40
|
if (t.isBinaryExpression(expr))
|
@@ -42,19 +42,17 @@ function hoistClassNames(path, existing, expr) {
|
|
42
42
|
if (t.isLogicalExpression(expr))
|
43
43
|
return t.logicalExpression(expr.operator, hoist(expr.left), hoist(expr.right));
|
44
44
|
if (t.isConditionalExpression(expr))
|
45
|
-
return t.conditionalExpression(
|
46
|
-
expr.test,
|
47
|
-
hoist(expr.consequent),
|
48
|
-
hoist(expr.alternate)
|
49
|
-
);
|
45
|
+
return t.conditionalExpression(expr.test, hoist(expr.consequent), hoist(expr.alternate));
|
50
46
|
return expr;
|
51
47
|
function replaceStringWithVariable(str) {
|
52
|
-
|
48
|
+
var uid = path.scope.generateUidIdentifier("cn"), parent = path.findParent(function(path2) {
|
49
|
+
return path2.isProgram();
|
50
|
+
});
|
53
51
|
if (!parent)
|
54
52
|
throw new Error("no program?");
|
55
|
-
|
53
|
+
var variable = t.variableDeclaration("const", [
|
56
54
|
// adding a space for extra safety
|
57
|
-
t.variableDeclarator(uid, t.stringLiteral(
|
55
|
+
t.variableDeclarator(uid, t.stringLiteral(" ".concat(str.value)))
|
58
56
|
]);
|
59
57
|
return parent.unshiftContainer("body", variable), uid;
|
60
58
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../../../src/extractor/hoistClassNames.ts"],
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;
|
5
|
-
"names": ["path"]
|
3
|
+
"sources": ["../../../src/extractor/Users/n8/tamagui/packages/static/src/extractor/hoistClassNames.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AACA;;;;;QAAmB;AAEZ,SAASA,gBACdC,MACAC,UACAC,MAAkB;AAElB,MAAMC,QAAQJ,gBAAgBK,KAAK,MAAMJ,MAAMC,QAAAA;AAC/C,MAAII,EAAEC,gBAAgBJ,IAAAA,GAAO;AAC3B,QAAIA,KAAKK,MAAMC,KAAI,MAAO;AACxB,aAAON;AAET,QAAID,SAASC,KAAKK,KAAK;AACrB,aAAON,SAASC,KAAKK,KAAK;AAE5B,QAAME,aAAaC,0BAA0BR,IAAAA;AAC7CD,oBAASC,KAAKK,KAAK,IAAIE,YAChBA;EACT;AACA,MAAIJ,EAAEM,mBAAmBT,IAAAA;AACvB,WAAOG,EAAEO,iBAAiBV,KAAKW,UAAUV,MAAMD,KAAKY,IAAI,GAAGX,MAAMD,KAAKa,KAAK,CAAA;AAE7E,MAAIV,EAAEW,oBAAoBd,IAAAA;AACxB,WAAOG,EAAEY,kBAAkBf,KAAKW,UAAUV,MAAMD,KAAKY,IAAI,GAAGX,MAAMD,KAAKa,KAAK,CAAA;AAE9E,MAAIV,EAAEa,wBAAwBhB,IAAAA;AAC5B,WAAOG,EAAEc,sBACPjB,KAAKkB,MACLjB,MAAMD,KAAKmB,UAAU,GACrBlB,MAAMD,KAAKoB,SAAS,CAAA;AAGxB,SAAOpB;AAEP,WAASQ,0BAA0Ba,KAAoB;AAErD,QAAMC,MAAMxB,KAAKyB,MAAMC,sBAAsB,IAAA,GACvCC,SAAS3B,KAAK4B,WAAW,SAAC5B,OAAAA;aAASA,MAAK6B,UAAS;;AACvD,QAAI,CAACF;AAAQ,YAAM,IAAIG,MAAO,aAAA;AAC9B,QAAMC,WAAW1B,EAAE2B,oBAAoB,SAAS;;MAE9C3B,EAAE4B,mBAAmBT,KAAKnB,EAAE6B,cAAe,IAAa,OAAVX,IAAIhB,KAAK,CAAA,CAAA;KACxD;AAEDoB,kBAAOQ,iBAAiB,QAAQJ,QAAAA,GACzBP;EACT;AACF;",
|
5
|
+
"names": ["hoistClassNames", "path", "existing", "expr", "hoist", "bind", "t", "isStringLiteral", "value", "trim", "identifier", "replaceStringWithVariable", "isBinaryExpression", "binaryExpression", "operator", "left", "right", "isLogicalExpression", "logicalExpression", "isConditionalExpression", "conditionalExpression", "test", "consequent", "alternate", "str", "uid", "scope", "generateUidIdentifier", "parent", "findParent", "isProgram", "Error", "variable", "variableDeclaration", "variableDeclarator", "stringLiteral", "unshiftContainer"]
|
6
6
|
}
|