@tamagui/static 1.115.2 → 1.115.3

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 (93) hide show
  1. package/package.json +16 -16
  2. package/dist/check-dep-versions.cjs +0 -267
  3. package/dist/check-dep-versions.cjs.map +0 -6
  4. package/dist/checkDeps.cjs +0 -32
  5. package/dist/checkDeps.cjs.map +0 -6
  6. package/dist/constants.cjs +0 -49
  7. package/dist/constants.cjs.map +0 -6
  8. package/dist/exports.cjs +0 -40
  9. package/dist/exports.cjs.map +0 -6
  10. package/dist/extractor/accessSafe.cjs +0 -46
  11. package/dist/extractor/accessSafe.cjs.map +0 -6
  12. package/dist/extractor/babelParse.cjs +0 -54
  13. package/dist/extractor/babelParse.cjs.map +0 -6
  14. package/dist/extractor/buildClassName.cjs +0 -62
  15. package/dist/extractor/buildClassName.cjs.map +0 -6
  16. package/dist/extractor/bundle.cjs +0 -146
  17. package/dist/extractor/bundle.cjs.map +0 -6
  18. package/dist/extractor/bundleConfig.cjs +0 -322
  19. package/dist/extractor/bundleConfig.cjs.map +0 -6
  20. package/dist/extractor/createEvaluator.cjs +0 -70
  21. package/dist/extractor/createEvaluator.cjs.map +0 -6
  22. package/dist/extractor/createExtractor.cjs +0 -1008
  23. package/dist/extractor/createExtractor.cjs.map +0 -6
  24. package/dist/extractor/createLogger.cjs +0 -45
  25. package/dist/extractor/createLogger.cjs.map +0 -6
  26. package/dist/extractor/ensureImportingConcat.cjs +0 -48
  27. package/dist/extractor/ensureImportingConcat.cjs.map +0 -6
  28. package/dist/extractor/esbuildAliasPlugin.cjs +0 -44
  29. package/dist/extractor/esbuildAliasPlugin.cjs.map +0 -6
  30. package/dist/extractor/evaluateAstNode.cjs +0 -83
  31. package/dist/extractor/evaluateAstNode.cjs.map +0 -6
  32. package/dist/extractor/extractHelpers.cjs +0 -120
  33. package/dist/extractor/extractHelpers.cjs.map +0 -6
  34. package/dist/extractor/extractMediaStyle.cjs +0 -129
  35. package/dist/extractor/extractMediaStyle.cjs.map +0 -6
  36. package/dist/extractor/extractToClassNames.cjs +0 -254
  37. package/dist/extractor/extractToClassNames.cjs.map +0 -6
  38. package/dist/extractor/extractToNative.cjs +0 -274
  39. package/dist/extractor/extractToNative.cjs.map +0 -6
  40. package/dist/extractor/findTopmostFunction.cjs +0 -34
  41. package/dist/extractor/findTopmostFunction.cjs.map +0 -6
  42. package/dist/extractor/generatedUid.cjs +0 -47
  43. package/dist/extractor/generatedUid.cjs.map +0 -6
  44. package/dist/extractor/getPrefixLogs.cjs +0 -28
  45. package/dist/extractor/getPrefixLogs.cjs.map +0 -6
  46. package/dist/extractor/getPropValueFromAttributes.cjs +0 -67
  47. package/dist/extractor/getPropValueFromAttributes.cjs.map +0 -6
  48. package/dist/extractor/getSourceModule.cjs +0 -68
  49. package/dist/extractor/getSourceModule.cjs.map +0 -6
  50. package/dist/extractor/getStaticBindingsForScope.cjs +0 -148
  51. package/dist/extractor/getStaticBindingsForScope.cjs.map +0 -6
  52. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +0 -29
  53. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs.map +0 -6
  54. package/dist/extractor/hoistClassNames.cjs +0 -62
  55. package/dist/extractor/hoistClassNames.cjs.map +0 -6
  56. package/dist/extractor/literalToAst.cjs +0 -84
  57. package/dist/extractor/literalToAst.cjs.map +0 -6
  58. package/dist/extractor/loadFile.cjs +0 -11
  59. package/dist/extractor/loadFile.cjs.map +0 -6
  60. package/dist/extractor/loadTamagui.cjs +0 -284
  61. package/dist/extractor/loadTamagui.cjs.map +0 -6
  62. package/dist/extractor/logLines.cjs +0 -35
  63. package/dist/extractor/logLines.cjs.map +0 -6
  64. package/dist/extractor/normalizeTernaries.cjs +0 -68
  65. package/dist/extractor/normalizeTernaries.cjs.map +0 -6
  66. package/dist/extractor/propsToFontFamilyCache.cjs +0 -38
  67. package/dist/extractor/propsToFontFamilyCache.cjs.map +0 -6
  68. package/dist/extractor/regenerateConfig.cjs +0 -144
  69. package/dist/extractor/regenerateConfig.cjs.map +0 -6
  70. package/dist/extractor/removeUnusedHooks.cjs +0 -76
  71. package/dist/extractor/removeUnusedHooks.cjs.map +0 -6
  72. package/dist/extractor/timer.cjs +0 -43
  73. package/dist/extractor/timer.cjs.map +0 -6
  74. package/dist/extractor/validHTMLAttributes.cjs +0 -73
  75. package/dist/extractor/validHTMLAttributes.cjs.map +0 -6
  76. package/dist/extractor/watchTamaguiConfig.cjs +0 -58
  77. package/dist/extractor/watchTamaguiConfig.cjs.map +0 -6
  78. package/dist/getPragmaOptions.cjs +0 -54
  79. package/dist/getPragmaOptions.cjs.map +0 -6
  80. package/dist/helpers/memoize.cjs +0 -37
  81. package/dist/helpers/memoize.cjs.map +0 -6
  82. package/dist/helpers/requireTamaguiCore.cjs +0 -33
  83. package/dist/helpers/requireTamaguiCore.cjs.map +0 -6
  84. package/dist/index.cjs +0 -40
  85. package/dist/index.cjs.map +0 -6
  86. package/dist/registerRequire.cjs +0 -102
  87. package/dist/registerRequire.cjs.map +0 -6
  88. package/dist/server.cjs +0 -75
  89. package/dist/server.cjs.map +0 -6
  90. package/dist/setup.cjs +0 -0
  91. package/dist/setup.cjs.map +0 -6
  92. package/dist/types.cjs +0 -16
  93. package/dist/types.cjs.map +0 -6
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/generatedUid.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAQZ,SAAS,YAAY,OAAY,MAAsB;AAC5D,MAAM,OAAO,SAAU;AACrB,UAAM;AACR,MAAI,EAAE,OAAO,QAAS,YAAY,SAAS;AACzC,UAAM;AAER,SAAO,EACJ,aAAa,IAAI,EACjB,QAAQ,OAAO,EAAE,EACjB,QAAQ,YAAY,EAAE;AAEzB,MAAI,KACA,IAAI;AACR;AACE,IAAI,IAAI,IACN,MAAM,OAAO,IAEb,MAAM,MAER;AAAA,SAEA,MAAM,SAAS,GAAG,KAClB,MAAM,WAAW,GAAG,KACpB,MAAM,UAAU,GAAG,KACnB,MAAM,aAAa,GAAG;AAGxB,QAAM,UAAU,MAAM,iBAAiB;AACvC,iBAAQ,WAAW,GAAG,IAAI,IAC1B,QAAQ,KAAK,GAAG,IAAI,IAEb;AACT;",
5
- "names": []
6
- }
@@ -1,28 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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);
21
- var getPrefixLogs_exports = {};
22
- __export(getPrefixLogs_exports, {
23
- getPrefixLogs: () => getPrefixLogs
24
- });
25
- module.exports = __toCommonJS(getPrefixLogs_exports);
26
- function getPrefixLogs(options) {
27
- return options?.prefixLogs ?? ` ${options?.platform || "web"} | `;
28
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/getPrefixLogs.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,cAAc,SAA0B;AACtD,SAAO,SAAS,cAAc,IAAI,SAAS,YAAY,KAAK;AAC9D;",
5
- "names": []
6
- }
@@ -1,67 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/getPropValueFromAttributes.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB,sCACrB,IAAmB,kCAEnB,oBAA2B;AAkBpB,SAAS,2BACd,UACA,OACqB;AACrB,MAAI,YAAY,IACZ,UAAiC;AACrC,WAAS,MAAM,IAAI,MAAM,MAAM,QAAQ,EAAE,MAAM,OAAO;AACpD,UAAM,OAAO,MAAM,GAAG;AACtB,QAAI,EAAE,eAAe,IAAI,KAAK,KAAK,QAAQ,KAAK,KAAK,SAAS,UAAU;AACtE,kBAAY,KACZ,UAAU;AACV;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW,QAAQ,SAAS;AAC/B,WAAO;AAGT,MAAI,YAMe,QAAQ;AAO3B,MALI,EAAE,yBAAyB,SAAS,MACtC,YAAY,UAAU,aAIpB,EAAE,qBAAqB,SAAS;AAClC,mBAAQ,MAAM,gCAAgC,GACvC;AAIT,QAAM,oBAAoB,MACvB;AAAA;AAAA;AAAA,IAGC,CAAC,MAAM,QAAsC;AAC3C,UAAI,EAAE,qBAAqB,IAAI,GAAG;AAChC,YAAI,EAAE,aAAa,KAAK,QAAQ,KAAK,EAAE,mBAAmB,KAAK,QAAQ;AACrE,iBAAO,MAAM;AAEf,YAAI,EAAE,oBAAoB,KAAK,QAAQ;AACrC,iBAAO;AAET,cAAM,IAAI;AAAA,UACR,+BAA+B,KAAK,SAAS,IAAI;AAAA,cAE/C,iBAAAA,SAAS,IAAW,EAAE,IACxB;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF,EACC,IAAI,CAAC,SAAS,KAAK,QAAQ;AAK9B,SAAI,kBAAkB,SAAS,MAC7B,YAAY,kBAAkB;AAAA,IAC5B,CAAC,KAAK,QAAQ,EAAE,kBAAkB,UAAM,8BAAW,KAAK,QAAQ,GAAG,GAAG;AAAA,IACtE;AAAA,EACF,IAGK;AACT;",
5
- "names": ["generate"]
6
- }
@@ -1,68 +0,0 @@
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
- sourceMod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,MAEtB,WAAW,QAAQ,IAAI,MACvB,eAAe;AACf;AAAA,QACF;AAGF,UAAI,CAAC,SAAS,CAAC;AACb,uBAAQ,MAAM,uCAAuC,QAAQ,GACtD;AAAA,IAEX;AACE,qBAAQ,MAAM,yBAAyB,SAAS,GAAG,IAAI,GAChD;AAAA,EAEX;AACE,WAAO;AAGT,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
5
- "names": []
6
- }
@@ -1,148 +0,0 @@
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 getStaticBindingsForScope_exports = {};
33
- __export(getStaticBindingsForScope_exports, {
34
- cleanupBeforeExit: () => cleanupBeforeExit,
35
- getStaticBindingsForScope: () => getStaticBindingsForScope
36
- });
37
- module.exports = __toCommonJS(getStaticBindingsForScope_exports);
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("/");
44
- function resolveImportPath(sourcePath, path) {
45
- const sourceDir = (0, import_node_path.dirname)(sourcePath);
46
- return isLocalImport(path) ? ((0, import_node_path.extname)(path) === "" && (path += ""), (0, import_node_path.resolve)(sourceDir, path)) : path;
47
- }
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;
53
- function forkChild() {
54
- child = (0, import_node_child_process.fork)(loadCmd, [], {
55
- execArgv: ["-r", "esbuild-register"],
56
- detached: !1,
57
- stdio: "ignore"
58
- });
59
- }
60
- function cleanupBeforeExit() {
61
- exited || child && (child.removeAllListeners(), child.unref(), child.disconnect(), child.kill(), exited = !0);
62
- }
63
- process.once("SIGTERM", cleanupBeforeExit);
64
- process.once("SIGINT", cleanupBeforeExit);
65
- process.once("beforeExit", cleanupBeforeExit);
66
- function importModule(path) {
67
- if (child || forkChild(), pending.has(path)) return pending.get(path);
68
- const promise = new Promise((res, rej) => {
69
- if (!child) return;
70
- if (cache.size > 2e3 && cache.clear(), cache.has(path)) return cache.get(path);
71
- const listener = msg => {
72
- if (!child || !msg || typeof msg != "string") return;
73
- if (msg[0] === "-") {
74
- rej(new Error(msg.slice(1)));
75
- return;
76
- }
77
- child.removeListener("message", listener);
78
- const val = JSON.parse(msg);
79
- cache.set(path, val), res(val);
80
- };
81
- child.once("message", listener), child.send(`${path.replace(".js", "")}`);
82
- });
83
- return pending.set(path, promise), promise;
84
- }
85
- async function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCache, shouldPrintDebug) {
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;
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);
103
- }
104
- }
105
- if (!bindingCache) throw new Error("BindingCache is a required param");
106
- for (const k in bindings) {
107
- const binding = bindings[k],
108
- sourceModule = (0, import_getSourceModule.getSourceModule)(k, binding);
109
- if (sourceModule) {
110
- if (!sourceModule.sourceModule) continue;
111
- const moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule);
112
- if (whitelist.some(test => moduleName.endsWith(test))) {
113
- const src = importModule(moduleName);
114
- if (!src) return console.info(` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`), {};
115
- sourceModule.destructured ? sourceModule.imported && (ret[k] = src[sourceModule.imported]) : ret[k] = src;
116
- }
117
- continue;
118
- }
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;
125
- if (typeof dec.id.start != "number" || typeof dec.id.end != "number") {
126
- console.error("dec.id.start/end is not a number");
127
- continue;
128
- }
129
- if (!t.isIdentifier(dec.id)) {
130
- console.error("dec is not an identifier");
131
- continue;
132
- }
133
- const cacheKey = `${dec.id.name}_${dec.id.start}-${dec.id.end}`;
134
- if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
135
- ret[k] = bindingCache[cacheKey];
136
- continue;
137
- }
138
- if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
139
- ret[k] = bindingCache[cacheKey];
140
- continue;
141
- }
142
- try {
143
- ret[k] = (0, import_evaluateAstNode.evaluateAstNode)(dec.init, void 0, shouldPrintDebug), bindingCache[cacheKey] = ret[k];
144
- continue;
145
- } catch {}
146
- }
147
- return ret;
148
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/getStaticBindingsForScope.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAqB,+BACrB,mBAAgD,sBAGhD,IAAmB,kCAEnB,yBAAgC,8BAChC,yBAAgC;AAMhC,MAAM,gBAAgB,CAAC,SAAiB,KAAK,WAAW,GAAG,KAAK,KAAK,WAAW,GAAG;AAEnF,SAAS,kBAAkB,YAAoB,MAAc;AAC3D,QAAM,gBAAY,0BAAQ,UAAU;AACpC,SAAI,cAAc,IAAI,SAChB,0BAAQ,IAAI,MAAM,OACpB,QAAQ,SAEH,0BAAQ,WAAW,IAAI,KAEzB;AACT;AAEA,MAAM,QAAQ,oBAAI,IAAI,GAChB,UAAU,oBAAI,IAA0B,GAExC,UAAU,OAAG,uBAAK,WAAW,aAAa,CAAC;AAEjD,IAAI,SAAS,IAET,QAA6B;AAEjC,SAAS,YAAY;AACnB,cAAQ,gCAAK,SAAS,CAAC,GAAG;AAAA,IACxB,UAAU,CAAC,MAAM,kBAAkB;AAAA,IACnC,UAAU;AAAA,IACV,OAAO;AAAA,EACT,CAAC;AACH;AAEO,SAAS,oBAAoB;AAClC,EAAI,UACC,UACL,MAAM,mBAAmB,GACzB,MAAM,MAAM,GACZ,MA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,OAAO,SAAS;AACtD;AAIF,UAAM,MAAM,OAAO,aAAa,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;AAInF,QAAI,CAAC,OAAO,CAAC,IAAI;AACf;AAIF,QAAI,OAAO,IAAI,GAAG,SAAU,YAAY,OAAO,IAAI,GAAG,OAAQ,UAAU;AACtE,cAAQ,MAAM,kCAAkC;AAChD;AAAA,IACF;AAEA,QAAI,CAAC,EAAE,aAAa,IAAI,EAAE,GAAG;AAC3B,cAAQ,MAAM,0BAA0B;AACxC;AAAA,IACF;AAEA,UAAM,WAAW,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,GAAG;AAG7D,QAAI,OAAO,eAAe,KAAK,cAAc,QAAQ,GAAG;AACtD,UAAI,CAAC,IAAI,aAAa,QAAQ;AAC9B;AAAA,IACF;AAEA,QAAI,OAAO,eAAe,KAAK,cAAc,QAAQ,GAAG;AACtD,UAAI,CAAC,IAAI,aAAa,QAAQ;AAC9B;AAAA,IACF;AAGA,QAAI;AACF,UAAI,CAAC,QAAI,wCAAgB,IAAI,MAAM,QAAW,gBAAgB,GAC9D,aAAa,QAAQ,IAAI,IAAI,CAAC;AAC9B;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,SAAO;AACT;",
5
- "names": []
6
- }
@@ -1,29 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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);
21
- var getTamaguiConfigPathFromOptionsConfig_exports = {};
22
- __export(getTamaguiConfigPathFromOptionsConfig_exports, {
23
- getTamaguiConfigPathFromOptionsConfig: () => getTamaguiConfigPathFromOptionsConfig
24
- });
25
- module.exports = __toCommonJS(getTamaguiConfigPathFromOptionsConfig_exports);
26
- var import_node_path = require("node:path");
27
- function getTamaguiConfigPathFromOptionsConfig(config) {
28
- return (0, import_node_path.isAbsolute)(config) ? config : (0, import_node_path.join)(process.cwd(), config);
29
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/getTamaguiConfigPathFromOptionsConfig.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiC;AAI1B,SAAS,sCACd,QACA;AACA,aAAI,6BAAW,MAAM,IACZ,aAGF,uBAAK,QAAQ,IAAI,GAAG,MAAM;AACnC;",
5
- "names": []
6
- }
@@ -1,62 +0,0 @@
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 hoistClassNames_exports = {};
33
- __export(hoistClassNames_exports, {
34
- hoistClassNames: () => hoistClassNames
35
- });
36
- module.exports = __toCommonJS(hoistClassNames_exports);
37
- var t = __toESM(require("@babel/types"));
38
- function hoistClassNames(path, existing, expr) {
39
- const hoist = hoistClassNames.bind(null, path, existing);
40
- if (t.isStringLiteral(expr)) {
41
- if (expr.value.trim() === "") return expr;
42
- if (existing[expr.value]) return existing[expr.value];
43
- const identifier = replaceStringWithVariable(expr);
44
- return existing[expr.value] = identifier, identifier;
45
- }
46
- if (t.isBinaryExpression(expr)) {
47
- if (t.isPrivateName(expr.left)) throw new Error("no private name");
48
- return t.binaryExpression(expr.operator, hoist(expr.left), hoist(expr.right));
49
- }
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
- return expr;
53
- function replaceStringWithVariable(str) {
54
- const uid = path.scope.generateUidIdentifier("cn"),
55
- parent = path.findParent(path2 => path2.isProgram());
56
- if (!parent) throw new Error("no program?");
57
- const variable = t.variableDeclaration("const", [
58
- // adding a space for extra safety
59
- t.variableDeclarator(uid, t.stringLiteral(` ${str.value}`))]);
60
- return parent.unshiftContainer("body", variable), uid;
61
- }
62
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/hoistClassNames.ts"],
4
- "mappings": ";;;;;;;;;;;;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["path"]
6
- }
@@ -1,84 +0,0 @@
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 literalToAst_exports = {};
33
- __export(literalToAst_exports, {
34
- astToLiteral: () => astToLiteral,
35
- literalToAst: () => literalToAst
36
- });
37
- module.exports = __toCommonJS(literalToAst_exports);
38
- var t = __toESM(require("@babel/types"));
39
- function literalToAst(literal) {
40
- if (literal === null) return t.nullLiteral();
41
- switch (typeof literal) {
42
- case "function":
43
- throw new Error("Unsupported");
44
- case "number":
45
- return t.numericLiteral(literal);
46
- case "string":
47
- return t.stringLiteral(literal);
48
- case "boolean":
49
- return t.booleanLiteral(literal);
50
- case "undefined":
51
- return t.unaryExpression("void", t.numericLiteral(0), !0);
52
- default:
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]))));
54
- }
55
- }
56
- const easyPeasies = ["BooleanLiteral", "StringLiteral", "NumericLiteral"];
57
- function astToLiteral(node) {
58
- if (node) {
59
- if (easyPeasies.includes(node.type)) return node.value;
60
- if (!(node.name === "undefined" && !node.value)) {
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)])], []);
66
- }
67
- }
68
- }
69
- function computeProps(props) {
70
- return props.reduce((acc, prop) => {
71
- if (prop.type === "SpreadElement") return {
72
- ...acc,
73
- ...astToLiteral(prop.argument)
74
- };
75
- if (prop.type !== "ObjectMethod") {
76
- const val = astToLiteral(prop.value);
77
- if (val !== void 0) return {
78
- ...acc,
79
- [prop.key.name]: val
80
- };
81
- }
82
- return acc;
83
- }, {});
84
- }
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/literalToAst.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAEZ,SAAS,aAAa,SAA4B;AACvD,MAAI,YAAY;AACd,WAAO,EAAE,YAAY;AAEvB,UAAQ,OAAO,SAAS;AAAA,IACtB,KAAK;AACH,YAAM,IAAI,MAAM,aAAa;AAAA,IAC/B,KAAK;AACH,aAAO,EAAE,eAAe,OAAO;AAAA,IACjC,KAAK;AACH,aAAO,EAAE,cAAc,OAAO;AAAA,IAChC,KAAK;AACH,aAAO,EAAE,eAAe,OAAO;AAAA,IACjC,KAAK;AACH,aAAO,EAAE,gBAAgB,QAAQ,EAAE,eAAe,CAAC,GAAG,EAAI;AAA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AA,EACT,GAAG,CAAC,CAAC;AACP;",
5
- "names": []
6
- }
@@ -1,11 +0,0 @@
1
- process.on("message", path => {
2
- if (typeof path != "string") throw new Error(`Not a string: ${path}`);
3
- try {
4
- const out = require(path);
5
- process.send?.(JSON.stringify(out));
6
- } catch (err) {
7
- err instanceof Error ? process.send?.(`-${err.message}
8
- ${err.stack}`) : process.send?.(`-${err}`);
9
- }
10
- });
11
- setInterval(() => {}, 1e3);
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/extractor/loadFile.ts"],
4
- "mappings": "AAAA,QAAQ,GAAG,WAAW,CAAC,SAAS;AAC9B,MAAI,OAAO,QAAS;AAClB,UAAM,IAAI,MAAM,iBAAiB,IAAI,EAAE;AAEzC,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,YAAQ,OAAO,KAAK,UAAU,GAAG,CAAC;AAAA,EACpC,SAAS,KAAK;AACZ,IAAI,eAAe,QACjB,QAAQ,OAAO,IAAI,IAAI,OAAO;AAAA,EAAK,IAAI,KAAK,EAAE,IAE9C,QAAQ,OAAO,IAAI,GAAG,EAAE;AAAA,EAE5B;AACF,CAAC;AAED,YAAY,MAAM;AAAC,GAAG,GAAI;",
5
- "names": []
6
- }