@tamagui/static 1.114.4 → 1.115.1

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 (123) hide show
  1. package/dist/check-dep-versions.cjs +267 -0
  2. package/dist/checkDeps.cjs +32 -0
  3. package/dist/{constants.js → constants.cjs} +29 -14
  4. package/dist/exports.cjs +40 -0
  5. package/dist/extractor/accessSafe.cjs +46 -0
  6. package/dist/extractor/babelParse.cjs +54 -0
  7. package/dist/extractor/buildClassName.cjs +62 -0
  8. package/dist/extractor/bundle.cjs +146 -0
  9. package/dist/extractor/bundleConfig.cjs +322 -0
  10. package/dist/extractor/{createEvaluator.js → createEvaluator.cjs} +37 -21
  11. package/dist/extractor/createExtractor.cjs +1008 -0
  12. package/dist/extractor/createLogger.cjs +45 -0
  13. package/dist/extractor/ensureImportingConcat.cjs +48 -0
  14. package/dist/extractor/esbuildAliasPlugin.cjs +44 -0
  15. package/dist/extractor/evaluateAstNode.cjs +83 -0
  16. package/dist/extractor/extractHelpers.cjs +120 -0
  17. package/dist/extractor/extractMediaStyle.cjs +129 -0
  18. package/dist/extractor/extractToClassNames.cjs +254 -0
  19. package/dist/extractor/extractToNative.cjs +274 -0
  20. package/dist/extractor/findTopmostFunction.cjs +34 -0
  21. package/dist/extractor/generatedUid.cjs +47 -0
  22. package/dist/extractor/getPrefixLogs.cjs +28 -0
  23. package/dist/extractor/getPropValueFromAttributes.cjs +67 -0
  24. package/dist/extractor/getSourceModule.cjs +68 -0
  25. package/dist/extractor/{getStaticBindingsForScope.js → getStaticBindingsForScope.cjs} +66 -61
  26. package/dist/extractor/{getTamaguiConfigPathFromOptionsConfig.js → getTamaguiConfigPathFromOptionsConfig.cjs} +16 -11
  27. package/dist/extractor/{hoistClassNames.js → hoistClassNames.cjs} +31 -32
  28. package/dist/extractor/{literalToAst.js → literalToAst.cjs} +38 -44
  29. package/dist/extractor/{loadFile.js → loadFile.cjs} +3 -6
  30. package/dist/extractor/{loadTamagui.js → loadTamagui.cjs} +99 -78
  31. package/dist/extractor/logLines.cjs +35 -0
  32. package/dist/extractor/{normalizeTernaries.js → normalizeTernaries.cjs} +38 -29
  33. package/dist/extractor/{propsToFontFamilyCache.js → propsToFontFamilyCache.cjs} +18 -14
  34. package/dist/extractor/regenerateConfig.cjs +144 -0
  35. package/dist/extractor/{removeUnusedHooks.js → removeUnusedHooks.cjs} +31 -27
  36. package/dist/extractor/{timer.js → timer.cjs} +16 -11
  37. package/dist/extractor/{validHTMLAttributes.js → validHTMLAttributes.cjs} +16 -11
  38. package/dist/extractor/{watchTamaguiConfig.js → watchTamaguiConfig.cjs} +30 -29
  39. package/dist/{getPragmaOptions.js → getPragmaOptions.cjs} +22 -17
  40. package/dist/helpers/memoize.cjs +37 -0
  41. package/dist/helpers/requireTamaguiCore.cjs +33 -0
  42. package/dist/index.cjs +40 -0
  43. package/dist/registerRequire.cjs +102 -0
  44. package/dist/{server.js → server.cjs} +38 -21
  45. package/dist/setup.cjs +0 -0
  46. package/dist/types.cjs +16 -0
  47. package/package.json +18 -16
  48. package/dist/check-dep-versions.js +0 -389
  49. package/dist/checkDeps.js +0 -26
  50. package/dist/exports.js +0 -33
  51. package/dist/extractor/accessSafe.js +0 -47
  52. package/dist/extractor/babelParse.js +0 -59
  53. package/dist/extractor/buildClassName.js +0 -72
  54. package/dist/extractor/bundle.js +0 -133
  55. package/dist/extractor/bundleConfig.js +0 -350
  56. package/dist/extractor/createExtractor.js +0 -1217
  57. package/dist/extractor/createLogger.js +0 -32
  58. package/dist/extractor/ensureImportingConcat.js +0 -50
  59. package/dist/extractor/esbuildAliasPlugin.js +0 -36
  60. package/dist/extractor/evaluateAstNode.js +0 -99
  61. package/dist/extractor/extractHelpers.js +0 -109
  62. package/dist/extractor/extractMediaStyle.js +0 -123
  63. package/dist/extractor/extractToClassNames.js +0 -291
  64. package/dist/extractor/extractToNative.js +0 -319
  65. package/dist/extractor/findTopmostFunction.js +0 -32
  66. package/dist/extractor/generatedUid.js +0 -42
  67. package/dist/extractor/getPrefixLogs.js +0 -23
  68. package/dist/extractor/getPropValueFromAttributes.js +0 -65
  69. package/dist/extractor/getSourceModule.js +0 -66
  70. package/dist/extractor/logLines.js +0 -30
  71. package/dist/extractor/regenerateConfig.js +0 -111
  72. package/dist/helpers/memoize.js +0 -33
  73. package/dist/helpers/requireTamaguiCore.js +0 -30
  74. package/dist/index.js +0 -30
  75. package/dist/registerRequire.js +0 -96
  76. package/dist/setup.js +0 -1
  77. package/dist/types.js +0 -14
  78. /package/dist/{check-dep-versions.js.map → check-dep-versions.cjs.map} +0 -0
  79. /package/dist/{checkDeps.js.map → checkDeps.cjs.map} +0 -0
  80. /package/dist/{constants.js.map → constants.cjs.map} +0 -0
  81. /package/dist/{exports.js.map → exports.cjs.map} +0 -0
  82. /package/dist/extractor/{accessSafe.js.map → accessSafe.cjs.map} +0 -0
  83. /package/dist/extractor/{babelParse.js.map → babelParse.cjs.map} +0 -0
  84. /package/dist/extractor/{buildClassName.js.map → buildClassName.cjs.map} +0 -0
  85. /package/dist/extractor/{bundle.js.map → bundle.cjs.map} +0 -0
  86. /package/dist/extractor/{bundleConfig.js.map → bundleConfig.cjs.map} +0 -0
  87. /package/dist/extractor/{createEvaluator.js.map → createEvaluator.cjs.map} +0 -0
  88. /package/dist/extractor/{createExtractor.js.map → createExtractor.cjs.map} +0 -0
  89. /package/dist/extractor/{createLogger.js.map → createLogger.cjs.map} +0 -0
  90. /package/dist/extractor/{ensureImportingConcat.js.map → ensureImportingConcat.cjs.map} +0 -0
  91. /package/dist/extractor/{esbuildAliasPlugin.js.map → esbuildAliasPlugin.cjs.map} +0 -0
  92. /package/dist/extractor/{evaluateAstNode.js.map → evaluateAstNode.cjs.map} +0 -0
  93. /package/dist/extractor/{extractHelpers.js.map → extractHelpers.cjs.map} +0 -0
  94. /package/dist/extractor/{extractMediaStyle.js.map → extractMediaStyle.cjs.map} +0 -0
  95. /package/dist/extractor/{extractToClassNames.js.map → extractToClassNames.cjs.map} +0 -0
  96. /package/dist/extractor/{extractToNative.js.map → extractToNative.cjs.map} +0 -0
  97. /package/dist/extractor/{findTopmostFunction.js.map → findTopmostFunction.cjs.map} +0 -0
  98. /package/dist/extractor/{generatedUid.js.map → generatedUid.cjs.map} +0 -0
  99. /package/dist/extractor/{getPrefixLogs.js.map → getPrefixLogs.cjs.map} +0 -0
  100. /package/dist/extractor/{getPropValueFromAttributes.js.map → getPropValueFromAttributes.cjs.map} +0 -0
  101. /package/dist/extractor/{getSourceModule.js.map → getSourceModule.cjs.map} +0 -0
  102. /package/dist/extractor/{getStaticBindingsForScope.js.map → getStaticBindingsForScope.cjs.map} +0 -0
  103. /package/dist/extractor/{getTamaguiConfigPathFromOptionsConfig.js.map → getTamaguiConfigPathFromOptionsConfig.cjs.map} +0 -0
  104. /package/dist/extractor/{hoistClassNames.js.map → hoistClassNames.cjs.map} +0 -0
  105. /package/dist/extractor/{literalToAst.js.map → literalToAst.cjs.map} +0 -0
  106. /package/dist/extractor/{loadFile.js.map → loadFile.cjs.map} +0 -0
  107. /package/dist/extractor/{loadTamagui.js.map → loadTamagui.cjs.map} +0 -0
  108. /package/dist/extractor/{logLines.js.map → logLines.cjs.map} +0 -0
  109. /package/dist/extractor/{normalizeTernaries.js.map → normalizeTernaries.cjs.map} +0 -0
  110. /package/dist/extractor/{propsToFontFamilyCache.js.map → propsToFontFamilyCache.cjs.map} +0 -0
  111. /package/dist/extractor/{regenerateConfig.js.map → regenerateConfig.cjs.map} +0 -0
  112. /package/dist/extractor/{removeUnusedHooks.js.map → removeUnusedHooks.cjs.map} +0 -0
  113. /package/dist/extractor/{timer.js.map → timer.cjs.map} +0 -0
  114. /package/dist/extractor/{validHTMLAttributes.js.map → validHTMLAttributes.cjs.map} +0 -0
  115. /package/dist/extractor/{watchTamaguiConfig.js.map → watchTamaguiConfig.cjs.map} +0 -0
  116. /package/dist/{getPragmaOptions.js.map → getPragmaOptions.cjs.map} +0 -0
  117. /package/dist/helpers/{memoize.js.map → memoize.cjs.map} +0 -0
  118. /package/dist/helpers/{requireTamaguiCore.js.map → requireTamaguiCore.cjs.map} +0 -0
  119. /package/dist/{index.js.map → index.cjs.map} +0 -0
  120. /package/dist/{registerRequire.js.map → registerRequire.cjs.map} +0 -0
  121. /package/dist/{server.js.map → server.cjs.map} +0 -0
  122. /package/dist/{setup.js.map → setup.cjs.map} +0 -0
  123. /package/dist/{types.js.map → types.cjs.map} +0 -0
@@ -0,0 +1,67 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ 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);
32
+ var getPropValueFromAttributes_exports = {};
33
+ __export(getPropValueFromAttributes_exports, {
34
+ getPropValueFromAttributes: () => getPropValueFromAttributes
35
+ });
36
+ module.exports = __toCommonJS(getPropValueFromAttributes_exports);
37
+ var import_generator = __toESM(require("@babel/generator")),
38
+ t = __toESM(require("@babel/types")),
39
+ import_accessSafe = require("./accessSafe.cjs");
40
+ function getPropValueFromAttributes(propName, attrs) {
41
+ let propIndex = -1,
42
+ jsxAttr = null;
43
+ for (let idx = -1, len = attrs.length; ++idx < len;) {
44
+ const attr = attrs[idx];
45
+ if (t.isJSXAttribute(attr) && attr.name && attr.name.name === propName) {
46
+ propIndex = idx, jsxAttr = attr;
47
+ break;
48
+ }
49
+ }
50
+ if (!jsxAttr || jsxAttr.value == null) return null;
51
+ let propValue = jsxAttr.value;
52
+ if (t.isJSXExpressionContainer(propValue) && (propValue = propValue.expression), t.isJSXEmptyExpression(propValue)) return console.error("encountered JSXEmptyExpression"), null;
53
+ const applicableSpreads = attrs.filter(
54
+ // 1. idx is greater than propValue prop index
55
+ // 2. attr is a spread operator
56
+ (attr, idx) => {
57
+ if (t.isJSXSpreadAttribute(attr)) {
58
+ if (t.isIdentifier(attr.argument) || t.isMemberExpression(attr.argument)) return idx > propIndex;
59
+ if (t.isLogicalExpression(attr.argument)) return !1;
60
+ throw new Error(`unsupported spread of type "${attr.argument.type}": ${
61
+ // @ts-ignore
62
+ (0, import_generator.default)(attr).code}`);
63
+ }
64
+ return !1;
65
+ }).map(attr => attr.argument);
66
+ return applicableSpreads.length > 0 && (propValue = applicableSpreads.reduce((acc, val) => t.logicalExpression("||", (0, import_accessSafe.accessSafe)(val, propName), acc), propValue)), propValue;
67
+ }
@@ -0,0 +1,68 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ 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);
32
+ var getSourceModule_exports = {};
33
+ __export(getSourceModule_exports, {
34
+ getSourceModule: () => getSourceModule
35
+ });
36
+ module.exports = __toCommonJS(getSourceModule_exports);
37
+ var t = __toESM(require("@babel/types"));
38
+ function getSourceModule(itemName, itemBinding) {
39
+ if (!itemBinding.constant) return null;
40
+ let sourceModule,
41
+ imported,
42
+ local,
43
+ destructured,
44
+ usesImportSyntax = !1;
45
+ const itemNode = itemBinding.path.node;
46
+ if (
47
+ // import x from 'y';
48
+ t.isImportDefaultSpecifier(itemNode) ||
49
+ // import {x} from 'y';
50
+ t.isImportSpecifier(itemNode)) t.isImportDeclaration(itemBinding.path.parent) && (sourceModule = itemBinding.path.parent.source.value, local = itemNode.local.name, usesImportSyntax = !0, t.isImportSpecifier(itemNode) ? (imported = itemNode.imported.name, destructured = !0) : (imported = itemNode.local.name, destructured = !1));else if (t.isVariableDeclarator(itemNode) && itemNode.init != null && t.isCallExpression(itemNode.init) && t.isIdentifier(itemNode.init.callee) && itemNode.init.callee.name === "require" && itemNode.init.arguments.length === 1) {
51
+ const firstArg = itemNode.init.arguments[0];
52
+ if (!t.isStringLiteral(firstArg)) return null;
53
+ if (sourceModule = firstArg.value, t.isIdentifier(itemNode.id)) local = itemNode.id.name, imported = itemNode.id.name, destructured = !1;else if (t.isObjectPattern(itemNode.id)) {
54
+ for (const objProp of itemNode.id.properties) if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.value) && objProp.value.name === itemName) {
55
+ local = objProp.value.name, imported = objProp.key.name, destructured = !0;
56
+ break;
57
+ }
58
+ if (!local || !imported) return console.error("could not find prop with value `%s`", itemName), null;
59
+ } else return console.error("Unhandled id type: %s", itemNode.id.type), null;
60
+ } else return null;
61
+ return {
62
+ destructured,
63
+ imported,
64
+ local,
65
+ sourceModule,
66
+ usesImportSyntax
67
+ };
68
+ }
@@ -2,38 +2,54 @@ 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, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
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
32
  var getStaticBindingsForScope_exports = {};
24
33
  __export(getStaticBindingsForScope_exports, {
25
34
  cleanupBeforeExit: () => cleanupBeforeExit,
26
35
  getStaticBindingsForScope: () => getStaticBindingsForScope
27
36
  });
28
37
  module.exports = __toCommonJS(getStaticBindingsForScope_exports);
29
- var import_node_child_process = require("node:child_process"), import_node_path = require("node:path"), t = __toESM(require("@babel/types")), import_evaluateAstNode = require("./evaluateAstNode"), import_getSourceModule = require("./getSourceModule");
30
- const isLocalImport = (path) => path.startsWith(".") || path.startsWith("/");
38
+ var import_node_child_process = require("node:child_process"),
39
+ import_node_path = require("node:path"),
40
+ t = __toESM(require("@babel/types")),
41
+ import_evaluateAstNode = require("./evaluateAstNode.cjs"),
42
+ import_getSourceModule = require("./getSourceModule.cjs");
43
+ const isLocalImport = path => path.startsWith(".") || path.startsWith("/");
31
44
  function resolveImportPath(sourcePath, path) {
32
45
  const sourceDir = (0, import_node_path.dirname)(sourcePath);
33
46
  return isLocalImport(path) ? ((0, import_node_path.extname)(path) === "" && (path += ""), (0, import_node_path.resolve)(sourceDir, path)) : path;
34
47
  }
35
- const cache = /* @__PURE__ */ new Map(), pending = /* @__PURE__ */ new Map(), loadCmd = `${(0, import_node_path.join)(__dirname, "loadFile.js")}`;
36
- let exited = !1, child = null;
48
+ const cache = /* @__PURE__ */new Map(),
49
+ pending = /* @__PURE__ */new Map(),
50
+ loadCmd = `${(0, import_node_path.join)(__dirname, "loadFile.js")}`;
51
+ let exited = !1,
52
+ child = null;
37
53
  function forkChild() {
38
54
  child = (0, import_node_child_process.fork)(loadCmd, [], {
39
55
  execArgv: ["-r", "esbuild-register"],
@@ -48,13 +64,11 @@ process.once("SIGTERM", cleanupBeforeExit);
48
64
  process.once("SIGINT", cleanupBeforeExit);
49
65
  process.once("beforeExit", cleanupBeforeExit);
50
66
  function importModule(path) {
51
- if (child || forkChild(), pending.has(path))
52
- return pending.get(path);
67
+ if (child || forkChild(), pending.has(path)) return pending.get(path);
53
68
  const promise = new Promise((res, rej) => {
54
69
  if (!child) return;
55
- if (cache.size > 2e3 && cache.clear(), cache.has(path))
56
- return cache.get(path);
57
- const listener = (msg) => {
70
+ if (cache.size > 2e3 && cache.clear(), cache.has(path)) return cache.get(path);
71
+ const listener = msg => {
58
72
  if (!child || !msg || typeof msg != "string") return;
59
73
  if (msg[0] === "-") {
60
74
  rej(new Error(msg.slice(1)));
@@ -69,52 +83,45 @@ function importModule(path) {
69
83
  return pending.set(path, promise), promise;
70
84
  }
71
85
  async function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCache, shouldPrintDebug) {
72
- const bindings = scope.getAllBindings(), ret = {}, program = scope.getProgramParent().block;
73
- for (const node of program.body)
74
- if (t.isImportDeclaration(node)) {
75
- const importPath = node.source.value;
76
- if (!node.specifiers.length || !isLocalImport(importPath))
77
- continue;
78
- const moduleName = resolveImportPath(sourcePath, importPath);
79
- if (!whitelist.some((test) => moduleName.endsWith(test))) continue;
80
- try {
81
- const src = await importModule(moduleName);
82
- if (!src) continue;
83
- for (const specifier of node.specifiers)
84
- if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported) && typeof src[specifier.imported.name] < "u") {
85
- const val = src[specifier.local.name];
86
- ret[specifier.local.name] = val;
87
- }
88
- } catch (err) {
89
- shouldPrintDebug ? console.warn(
90
- ` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`
91
- ) : process.env.DEBUG?.startsWith("tamagui") && console.info("Error in partial evaluation", err.message, err.stack);
86
+ const bindings = scope.getAllBindings(),
87
+ ret = {},
88
+ program = scope.getProgramParent().block;
89
+ for (const node of program.body) if (t.isImportDeclaration(node)) {
90
+ const importPath = node.source.value;
91
+ if (!node.specifiers.length || !isLocalImport(importPath)) continue;
92
+ const moduleName = resolveImportPath(sourcePath, importPath);
93
+ if (!whitelist.some(test => moduleName.endsWith(test))) continue;
94
+ try {
95
+ const src = await importModule(moduleName);
96
+ if (!src) continue;
97
+ for (const specifier of node.specifiers) if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported) && typeof src[specifier.imported.name] < "u") {
98
+ const val = src[specifier.local.name];
99
+ ret[specifier.local.name] = val;
92
100
  }
101
+ } catch (err) {
102
+ shouldPrintDebug ? console.warn(` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`) : process.env.DEBUG?.startsWith("tamagui") && console.info("Error in partial evaluation", err.message, err.stack);
93
103
  }
94
- if (!bindingCache)
95
- throw new Error("BindingCache is a required param");
104
+ }
105
+ if (!bindingCache) throw new Error("BindingCache is a required param");
96
106
  for (const k in bindings) {
97
- const binding = bindings[k], sourceModule = (0, import_getSourceModule.getSourceModule)(k, binding);
107
+ const binding = bindings[k],
108
+ sourceModule = (0, import_getSourceModule.getSourceModule)(k, binding);
98
109
  if (sourceModule) {
99
- if (!sourceModule.sourceModule)
100
- continue;
110
+ if (!sourceModule.sourceModule) continue;
101
111
  const moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule);
102
- if (whitelist.some((test) => moduleName.endsWith(test))) {
112
+ if (whitelist.some(test => moduleName.endsWith(test))) {
103
113
  const src = importModule(moduleName);
104
- if (!src)
105
- return console.info(
106
- ` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`
107
- ), {};
114
+ if (!src) return console.info(` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`), {};
108
115
  sourceModule.destructured ? sourceModule.imported && (ret[k] = src[sourceModule.imported]) : ret[k] = src;
109
116
  }
110
117
  continue;
111
118
  }
112
- const { parent } = binding.path;
113
- if (!t.isVariableDeclaration(parent) || parent.kind !== "const")
114
- continue;
115
- const dec = parent.declarations.find((d) => t.isIdentifier(d.id) && d.id.name === k);
116
- if (!dec || !dec.init)
117
- continue;
119
+ const {
120
+ parent
121
+ } = binding.path;
122
+ if (!t.isVariableDeclaration(parent) || parent.kind !== "const") continue;
123
+ const dec = parent.declarations.find(d => t.isIdentifier(d.id) && d.id.name === k);
124
+ if (!dec || !dec.init) continue;
118
125
  if (typeof dec.id.start != "number" || typeof dec.id.end != "number") {
119
126
  console.error("dec.id.start/end is not a number");
120
127
  continue;
@@ -135,9 +142,7 @@ async function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bind
135
142
  try {
136
143
  ret[k] = (0, import_evaluateAstNode.evaluateAstNode)(dec.init, void 0, shouldPrintDebug), bindingCache[cacheKey] = ret[k];
137
144
  continue;
138
- } catch {
139
- }
145
+ } catch {}
140
146
  }
141
147
  return ret;
142
- }
143
- //# sourceMappingURL=getStaticBindingsForScope.js.map
148
+ }
@@ -3,15 +3,21 @@ 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)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
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, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
15
21
  var getTamaguiConfigPathFromOptionsConfig_exports = {};
16
22
  __export(getTamaguiConfigPathFromOptionsConfig_exports, {
17
23
  getTamaguiConfigPathFromOptionsConfig: () => getTamaguiConfigPathFromOptionsConfig
@@ -20,5 +26,4 @@ module.exports = __toCommonJS(getTamaguiConfigPathFromOptionsConfig_exports);
20
26
  var import_node_path = require("node:path");
21
27
  function getTamaguiConfigPathFromOptionsConfig(config) {
22
28
  return (0, import_node_path.isAbsolute)(config) ? config : (0, import_node_path.join)(process.cwd(), config);
23
- }
24
- //# sourceMappingURL=getTamaguiConfigPathFromOptionsConfig.js.map
29
+ }
@@ -2,24 +2,33 @@ 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, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
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
32
  var hoistClassNames_exports = {};
24
33
  __export(hoistClassNames_exports, {
25
34
  hoistClassNames: () => hoistClassNames
@@ -29,35 +38,25 @@ var t = __toESM(require("@babel/types"));
29
38
  function hoistClassNames(path, existing, expr) {
30
39
  const hoist = hoistClassNames.bind(null, path, existing);
31
40
  if (t.isStringLiteral(expr)) {
32
- if (expr.value.trim() === "")
33
- return expr;
34
- if (existing[expr.value])
35
- return existing[expr.value];
41
+ if (expr.value.trim() === "") return expr;
42
+ if (existing[expr.value]) return existing[expr.value];
36
43
  const identifier = replaceStringWithVariable(expr);
37
44
  return existing[expr.value] = identifier, identifier;
38
45
  }
39
46
  if (t.isBinaryExpression(expr)) {
40
- if (t.isPrivateName(expr.left))
41
- throw new Error("no private name");
47
+ if (t.isPrivateName(expr.left)) throw new Error("no private name");
42
48
  return t.binaryExpression(expr.operator, hoist(expr.left), hoist(expr.right));
43
49
  }
44
- if (t.isLogicalExpression(expr))
45
- return t.logicalExpression(expr.operator, hoist(expr.left), hoist(expr.right));
46
- if (t.isConditionalExpression(expr))
47
- return t.conditionalExpression(
48
- expr.test,
49
- hoist(expr.consequent),
50
- hoist(expr.alternate)
51
- );
50
+ if (t.isLogicalExpression(expr)) return t.logicalExpression(expr.operator, hoist(expr.left), hoist(expr.right));
51
+ if (t.isConditionalExpression(expr)) return t.conditionalExpression(expr.test, hoist(expr.consequent), hoist(expr.alternate));
52
52
  return expr;
53
53
  function replaceStringWithVariable(str) {
54
- const uid = path.scope.generateUidIdentifier("cn"), parent = path.findParent((path2) => path2.isProgram());
54
+ const uid = path.scope.generateUidIdentifier("cn"),
55
+ parent = path.findParent(path2 => path2.isProgram());
55
56
  if (!parent) throw new Error("no program?");
56
57
  const variable = t.variableDeclaration("const", [
57
- // adding a space for extra safety
58
- t.variableDeclarator(uid, t.stringLiteral(` ${str.value}`))
59
- ]);
58
+ // adding a space for extra safety
59
+ t.variableDeclarator(uid, t.stringLiteral(` ${str.value}`))]);
60
60
  return parent.unshiftContainer("body", variable), uid;
61
61
  }
62
- }
63
- //# sourceMappingURL=hoistClassNames.js.map
62
+ }
@@ -2,24 +2,33 @@ 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, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
6
7
  var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
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, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
15
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
21
  // If the importer is in node compatibility mode or this is not an ESM
17
22
  // file that has been converted to a CommonJS file using a Babel-
18
23
  // compatible transform (i.e. "__esModule" has not been set), then set
19
24
  // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
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
32
  var literalToAst_exports = {};
24
33
  __export(literalToAst_exports, {
25
34
  astToLiteral: () => astToLiteral,
@@ -28,8 +37,7 @@ __export(literalToAst_exports, {
28
37
  module.exports = __toCommonJS(literalToAst_exports);
29
38
  var t = __toESM(require("@babel/types"));
30
39
  function literalToAst(literal) {
31
- if (literal === null)
32
- return t.nullLiteral();
40
+ if (literal === null) return t.nullLiteral();
33
41
  switch (typeof literal) {
34
42
  case "function":
35
43
  throw new Error("Unsupported");
@@ -42,49 +50,35 @@ function literalToAst(literal) {
42
50
  case "undefined":
43
51
  return t.unaryExpression("void", t.numericLiteral(0), !0);
44
52
  default:
45
- return Array.isArray(literal) ? t.arrayExpression(literal.map(literalToAst)) : t.objectExpression(
46
- Object.keys(literal).filter((k) => typeof literal[k] < "u").map((k) => t.objectProperty(t.stringLiteral(k), literalToAst(literal[k])))
47
- );
53
+ return Array.isArray(literal) ? t.arrayExpression(literal.map(literalToAst)) : t.objectExpression(Object.keys(literal).filter(k => typeof literal[k] < "u").map(k => t.objectProperty(t.stringLiteral(k), literalToAst(literal[k]))));
48
54
  }
49
55
  }
50
56
  const easyPeasies = ["BooleanLiteral", "StringLiteral", "NumericLiteral"];
51
57
  function astToLiteral(node) {
52
58
  if (node) {
53
- if (easyPeasies.includes(node.type))
54
- return node.value;
59
+ if (easyPeasies.includes(node.type)) return node.value;
55
60
  if (!(node.name === "undefined" && !node.value)) {
56
- if (t.isNullLiteral(node))
57
- return null;
58
- if (t.isObjectExpression(node))
59
- return computeProps(node.properties);
60
- if (t.isArrayExpression(node))
61
- return node.elements.reduce(
62
- // @ts-ignore
63
- (acc, element) => [
64
- ...acc,
65
- ...element?.type === "SpreadElement" ? astToLiteral(element.argument) : [astToLiteral(element)]
66
- ],
67
- []
68
- );
61
+ if (t.isNullLiteral(node)) return null;
62
+ if (t.isObjectExpression(node)) return computeProps(node.properties);
63
+ if (t.isArrayExpression(node)) return node.elements.reduce(
64
+ // @ts-ignore
65
+ (acc, element) => [...acc, ...(element?.type === "SpreadElement" ? astToLiteral(element.argument) : [astToLiteral(element)])], []);
69
66
  }
70
67
  }
71
68
  }
72
69
  function computeProps(props) {
73
70
  return props.reduce((acc, prop) => {
74
- if (prop.type === "SpreadElement")
75
- return {
76
- ...acc,
77
- ...astToLiteral(prop.argument)
78
- };
71
+ if (prop.type === "SpreadElement") return {
72
+ ...acc,
73
+ ...astToLiteral(prop.argument)
74
+ };
79
75
  if (prop.type !== "ObjectMethod") {
80
76
  const val = astToLiteral(prop.value);
81
- if (val !== void 0)
82
- return {
83
- ...acc,
84
- [prop.key.name]: val
85
- };
77
+ if (val !== void 0) return {
78
+ ...acc,
79
+ [prop.key.name]: val
80
+ };
86
81
  }
87
82
  return acc;
88
83
  }, {});
89
- }
90
- //# sourceMappingURL=literalToAst.js.map
84
+ }
@@ -1,6 +1,5 @@
1
- process.on("message", (path) => {
2
- if (typeof path != "string")
3
- throw new Error(`Not a string: ${path}`);
1
+ process.on("message", path => {
2
+ if (typeof path != "string") throw new Error(`Not a string: ${path}`);
4
3
  try {
5
4
  const out = require(path);
6
5
  process.send?.(JSON.stringify(out));
@@ -9,6 +8,4 @@ process.on("message", (path) => {
9
8
  ${err.stack}`) : process.send?.(`-${err}`);
10
9
  }
11
10
  });
12
- setInterval(() => {
13
- }, 1e3);
14
- //# sourceMappingURL=loadFile.js.map
11
+ setInterval(() => {}, 1e3);