@tamagui/static 1.13.3 → 1.13.4
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.
- package/dist/cjs/constants.js +1 -52
- package/dist/cjs/constants.js.map +2 -2
- package/dist/cjs/extractor/accessSafe.js +1 -52
- package/dist/cjs/extractor/accessSafe.js.map +2 -2
- package/dist/cjs/extractor/babelParse.js +1 -66
- package/dist/cjs/extractor/babelParse.js.map +2 -2
- package/dist/cjs/extractor/buildClassName.js +1 -99
- package/dist/cjs/extractor/buildClassName.js.map +2 -2
- package/dist/cjs/extractor/bundle.js +1 -126
- package/dist/cjs/extractor/bundle.js.map +2 -2
- package/dist/cjs/extractor/createEvaluator.js +1 -86
- package/dist/cjs/extractor/createEvaluator.js.map +2 -2
- package/dist/cjs/extractor/createExtractor.js +15 -1630
- package/dist/cjs/extractor/createExtractor.js.map +2 -2
- package/dist/cjs/extractor/ensureImportingConcat.js +1 -64
- package/dist/cjs/extractor/ensureImportingConcat.js.map +2 -2
- package/dist/cjs/extractor/evaluateAstNode.js +1 -130
- package/dist/cjs/extractor/evaluateAstNode.js.map +2 -2
- package/dist/cjs/extractor/extractHelpers.js +1 -207
- package/dist/cjs/extractor/extractHelpers.js.map +2 -2
- package/dist/cjs/extractor/extractMediaStyle.js +1 -193
- package/dist/cjs/extractor/extractMediaStyle.js.map +2 -2
- package/dist/cjs/extractor/extractToClassNames.js +13 -413
- package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
- package/dist/cjs/extractor/findTopmostFunction.js +1 -43
- package/dist/cjs/extractor/findTopmostFunction.js.map +2 -2
- package/dist/cjs/extractor/generatedUid.js +1 -59
- package/dist/cjs/extractor/generatedUid.js.map +2 -2
- package/dist/cjs/extractor/getPrefixLogs.js +1 -31
- package/dist/cjs/extractor/getPrefixLogs.js.map +2 -2
- package/dist/cjs/extractor/getPropValueFromAttributes.js +1 -89
- package/dist/cjs/extractor/getPropValueFromAttributes.js.map +2 -2
- package/dist/cjs/extractor/getSourceModule.js +1 -103
- package/dist/cjs/extractor/getSourceModule.js.map +2 -2
- package/dist/cjs/extractor/getStaticBindingsForScope.js +1 -225
- package/dist/cjs/extractor/getStaticBindingsForScope.js.map +2 -2
- package/dist/cjs/extractor/hoistClassNames.js +1 -74
- package/dist/cjs/extractor/hoistClassNames.js.map +2 -2
- package/dist/cjs/extractor/literalToAst.js +1 -115
- package/dist/cjs/extractor/literalToAst.js.map +2 -2
- package/dist/cjs/extractor/loadFile.js +2 -20
- package/dist/cjs/extractor/loadFile.js.map +2 -2
- package/dist/cjs/extractor/loadTamagui.js +15 -432
- package/dist/cjs/extractor/loadTamagui.js.map +2 -2
- package/dist/cjs/extractor/logLines.js +3 -43
- package/dist/cjs/extractor/logLines.js.map +2 -2
- package/dist/cjs/extractor/normalizeTernaries.js +1 -85
- package/dist/cjs/extractor/normalizeTernaries.js.map +2 -2
- package/dist/cjs/extractor/removeUnusedHooks.js +1 -109
- package/dist/cjs/extractor/removeUnusedHooks.js.map +2 -2
- package/dist/cjs/extractor/timer.js +1 -52
- package/dist/cjs/extractor/timer.js.map +2 -2
- package/dist/cjs/extractor/validHTMLAttributes.js +1 -126
- package/dist/cjs/extractor/validHTMLAttributes.js.map +2 -2
- package/dist/cjs/getPragmaOptions.js +2 -67
- package/dist/cjs/getPragmaOptions.js.map +2 -2
- package/dist/cjs/helpers/memoize.js +1 -45
- package/dist/cjs/helpers/memoize.js.map +2 -2
- package/dist/cjs/index.js +1 -42
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/require.js +5 -81
- package/dist/cjs/require.js.map +2 -2
- package/dist/cjs/types.js +1 -16
- package/dist/cjs/types.js.map +2 -2
- package/dist/cjs/webpackPlugin.js +1 -34
- package/dist/cjs/webpackPlugin.js.map +2 -2
- package/dist/esm/constants.js +1 -14
- package/dist/esm/constants.js.map +2 -2
- package/dist/esm/constants.mjs +1 -14
- package/dist/esm/constants.mjs.map +2 -2
- package/dist/esm/extractor/accessSafe.js +1 -18
- package/dist/esm/extractor/accessSafe.js.map +2 -2
- package/dist/esm/extractor/accessSafe.mjs +1 -18
- package/dist/esm/extractor/accessSafe.mjs.map +2 -2
- package/dist/esm/extractor/babelParse.js +1 -31
- package/dist/esm/extractor/babelParse.js.map +2 -2
- package/dist/esm/extractor/babelParse.mjs +1 -31
- package/dist/esm/extractor/babelParse.mjs.map +2 -2
- package/dist/esm/extractor/buildClassName.js +1 -64
- package/dist/esm/extractor/buildClassName.js.map +2 -2
- package/dist/esm/extractor/buildClassName.mjs +1 -64
- package/dist/esm/extractor/buildClassName.mjs.map +2 -2
- package/dist/esm/extractor/bundle.js +1 -91
- package/dist/esm/extractor/bundle.js.map +2 -2
- package/dist/esm/extractor/bundle.mjs +1 -91
- package/dist/esm/extractor/bundle.mjs.map +2 -2
- package/dist/esm/extractor/createEvaluator.js +1 -51
- package/dist/esm/extractor/createEvaluator.js.map +2 -2
- package/dist/esm/extractor/createEvaluator.mjs +1 -51
- package/dist/esm/extractor/createEvaluator.mjs.map +2 -2
- package/dist/esm/extractor/createExtractor.js +15 -1613
- package/dist/esm/extractor/createExtractor.js.map +2 -2
- package/dist/esm/extractor/createExtractor.mjs +15 -1613
- package/dist/esm/extractor/createExtractor.mjs.map +2 -2
- package/dist/esm/extractor/ensureImportingConcat.js +1 -30
- package/dist/esm/extractor/ensureImportingConcat.js.map +2 -2
- package/dist/esm/extractor/ensureImportingConcat.mjs +1 -30
- package/dist/esm/extractor/ensureImportingConcat.mjs.map +2 -2
- package/dist/esm/extractor/evaluateAstNode.js +1 -96
- package/dist/esm/extractor/evaluateAstNode.js.map +2 -2
- package/dist/esm/extractor/evaluateAstNode.mjs +1 -96
- package/dist/esm/extractor/evaluateAstNode.mjs.map +2 -2
- package/dist/esm/extractor/extractHelpers.js +1 -161
- package/dist/esm/extractor/extractHelpers.js.map +2 -2
- package/dist/esm/extractor/extractHelpers.mjs +1 -161
- package/dist/esm/extractor/extractHelpers.mjs.map +2 -2
- package/dist/esm/extractor/extractMediaStyle.js +1 -158
- package/dist/esm/extractor/extractMediaStyle.js.map +2 -2
- package/dist/esm/extractor/extractMediaStyle.mjs +1 -158
- package/dist/esm/extractor/extractMediaStyle.mjs.map +2 -2
- package/dist/esm/extractor/extractToClassNames.js +13 -379
- package/dist/esm/extractor/extractToClassNames.js.map +2 -2
- package/dist/esm/extractor/extractToClassNames.mjs +13 -379
- package/dist/esm/extractor/extractToClassNames.mjs.map +2 -2
- package/dist/esm/extractor/findTopmostFunction.js +1 -19
- package/dist/esm/extractor/findTopmostFunction.js.map +2 -2
- package/dist/esm/extractor/findTopmostFunction.mjs +1 -19
- package/dist/esm/extractor/findTopmostFunction.mjs.map +2 -2
- package/dist/esm/extractor/generatedUid.js +1 -25
- package/dist/esm/extractor/generatedUid.js.map +2 -2
- package/dist/esm/extractor/generatedUid.mjs +1 -25
- package/dist/esm/extractor/generatedUid.mjs.map +2 -2
- package/dist/esm/extractor/getPrefixLogs.js +1 -7
- package/dist/esm/extractor/getPrefixLogs.js.map +2 -2
- package/dist/esm/extractor/getPrefixLogs.mjs +1 -7
- package/dist/esm/extractor/getPrefixLogs.mjs.map +2 -2
- package/dist/esm/extractor/getPropValueFromAttributes.js +1 -55
- package/dist/esm/extractor/getPropValueFromAttributes.js.map +2 -2
- package/dist/esm/extractor/getPropValueFromAttributes.mjs +1 -55
- package/dist/esm/extractor/getPropValueFromAttributes.mjs.map +2 -2
- package/dist/esm/extractor/getSourceModule.js +1 -69
- package/dist/esm/extractor/getSourceModule.js.map +2 -2
- package/dist/esm/extractor/getSourceModule.mjs +1 -69
- package/dist/esm/extractor/getSourceModule.mjs.map +2 -2
- package/dist/esm/extractor/getStaticBindingsForScope.js +1 -190
- package/dist/esm/extractor/getStaticBindingsForScope.js.map +2 -2
- package/dist/esm/extractor/getStaticBindingsForScope.mjs +1 -190
- package/dist/esm/extractor/getStaticBindingsForScope.mjs.map +2 -2
- package/dist/esm/extractor/hoistClassNames.js +1 -40
- package/dist/esm/extractor/hoistClassNames.js.map +2 -2
- package/dist/esm/extractor/hoistClassNames.mjs +1 -40
- package/dist/esm/extractor/hoistClassNames.mjs.map +2 -2
- package/dist/esm/extractor/literalToAst.js +1 -80
- package/dist/esm/extractor/literalToAst.js.map +2 -2
- package/dist/esm/extractor/literalToAst.mjs +1 -80
- package/dist/esm/extractor/literalToAst.mjs.map +2 -2
- package/dist/esm/extractor/loadFile.js +2 -19
- package/dist/esm/extractor/loadFile.js.map +2 -2
- package/dist/esm/extractor/loadFile.mjs +2 -19
- package/dist/esm/extractor/loadFile.mjs.map +2 -2
- package/dist/esm/extractor/loadTamagui.js +15 -396
- package/dist/esm/extractor/loadTamagui.js.map +2 -2
- package/dist/esm/extractor/loadTamagui.mjs +15 -396
- package/dist/esm/extractor/loadTamagui.mjs.map +2 -2
- package/dist/esm/extractor/logLines.js +3 -19
- package/dist/esm/extractor/logLines.js.map +2 -2
- package/dist/esm/extractor/logLines.mjs +3 -19
- package/dist/esm/extractor/logLines.mjs.map +2 -2
- package/dist/esm/extractor/normalizeTernaries.js +1 -51
- package/dist/esm/extractor/normalizeTernaries.js.map +2 -2
- package/dist/esm/extractor/normalizeTernaries.mjs +1 -51
- package/dist/esm/extractor/normalizeTernaries.mjs.map +2 -2
- package/dist/esm/extractor/removeUnusedHooks.js +1 -75
- package/dist/esm/extractor/removeUnusedHooks.js.map +2 -2
- package/dist/esm/extractor/removeUnusedHooks.mjs +1 -75
- package/dist/esm/extractor/removeUnusedHooks.mjs.map +2 -2
- package/dist/esm/extractor/timer.js +1 -28
- package/dist/esm/extractor/timer.js.map +2 -2
- package/dist/esm/extractor/timer.mjs +1 -28
- package/dist/esm/extractor/timer.mjs.map +2 -2
- package/dist/esm/extractor/validHTMLAttributes.js +1 -101
- package/dist/esm/extractor/validHTMLAttributes.js.map +2 -2
- package/dist/esm/extractor/validHTMLAttributes.mjs +1 -101
- package/dist/esm/extractor/validHTMLAttributes.mjs.map +2 -2
- package/dist/esm/getPragmaOptions.js +2 -43
- package/dist/esm/getPragmaOptions.js.map +2 -2
- package/dist/esm/getPragmaOptions.mjs +2 -43
- package/dist/esm/getPragmaOptions.mjs.map +2 -2
- package/dist/esm/helpers/memoize.js +1 -21
- package/dist/esm/helpers/memoize.js.map +2 -2
- package/dist/esm/helpers/memoize.mjs +1 -21
- package/dist/esm/helpers/memoize.mjs.map +2 -2
- package/dist/esm/index.js +1 -15
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/index.mjs +1 -15
- package/dist/esm/index.mjs.map +2 -2
- package/dist/esm/require.js +5 -55
- package/dist/esm/require.js.map +2 -2
- package/dist/esm/require.mjs +5 -55
- package/dist/esm/require.mjs.map +2 -2
- package/dist/esm/webpackPlugin.js +1 -10
- package/dist/esm/webpackPlugin.js.map +2 -2
- package/dist/esm/webpackPlugin.mjs +1 -10
- package/dist/esm/webpackPlugin.mjs.map +2 -2
- package/package.json +14 -14
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
const buildClassName = (objectsIn, extras = "") => {
|
|
3
|
-
let objects = buildClassNameLogic(objectsIn);
|
|
4
|
-
if (!objects)
|
|
5
|
-
return null;
|
|
6
|
-
if (t.isStringLiteral(objects)) {
|
|
7
|
-
objects.value = `${extras} ${objects.value}`;
|
|
8
|
-
} else {
|
|
9
|
-
objects = t.binaryExpression("+", t.stringLiteral(extras), objects);
|
|
10
|
-
}
|
|
11
|
-
return objects;
|
|
12
|
-
};
|
|
13
|
-
const buildClassNameLogic = (objects) => {
|
|
14
|
-
return objects.reduce((acc, val) => {
|
|
15
|
-
if (acc == null) {
|
|
16
|
-
if (
|
|
17
|
-
// pass conditional expressions through
|
|
18
|
-
t.isConditionalExpression(val) || // pass non-null literals through
|
|
19
|
-
t.isStringLiteral(val) || t.isNumericLiteral(val)
|
|
20
|
-
) {
|
|
21
|
-
return val;
|
|
22
|
-
}
|
|
23
|
-
return t.logicalExpression("||", val, t.stringLiteral(""));
|
|
24
|
-
}
|
|
25
|
-
let inner;
|
|
26
|
-
if (t.isStringLiteral(val)) {
|
|
27
|
-
if (t.isStringLiteral(acc)) {
|
|
28
|
-
return t.stringLiteral(`${acc.value} ${val.value}`);
|
|
29
|
-
}
|
|
30
|
-
inner = t.stringLiteral(` ${val.value}`);
|
|
31
|
-
} else if (t.isLiteral(val)) {
|
|
32
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), val);
|
|
33
|
-
} else if (t.isConditionalExpression(val) || t.isBinaryExpression(val)) {
|
|
34
|
-
if (t.isStringLiteral(acc)) {
|
|
35
|
-
return t.binaryExpression("+", t.stringLiteral(`${acc.value} `), val);
|
|
36
|
-
}
|
|
37
|
-
inner = t.binaryExpression("+", t.stringLiteral(" "), val);
|
|
38
|
-
} else if (t.isIdentifier(val) || t.isMemberExpression(val)) {
|
|
39
|
-
inner = t.conditionalExpression(
|
|
40
|
-
val,
|
|
41
|
-
t.binaryExpression("+", t.stringLiteral(" "), val),
|
|
42
|
-
t.stringLiteral("")
|
|
43
|
-
);
|
|
44
|
-
} else {
|
|
45
|
-
if (t.isStringLiteral(acc)) {
|
|
46
|
-
return t.binaryExpression(
|
|
47
|
-
"+",
|
|
48
|
-
t.stringLiteral(`${acc.value} `),
|
|
49
|
-
t.logicalExpression("||", val, t.stringLiteral(""))
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
inner = t.binaryExpression(
|
|
53
|
-
"+",
|
|
54
|
-
t.stringLiteral(" "),
|
|
55
|
-
t.logicalExpression("||", val, t.stringLiteral(""))
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
return t.binaryExpression("+", acc, inner);
|
|
59
|
-
}, null);
|
|
60
|
-
};
|
|
61
|
-
export {
|
|
62
|
-
buildClassName,
|
|
63
|
-
buildClassNameLogic
|
|
64
|
-
};
|
|
1
|
+
import*as i from"@babel/types";const l=(t,e="")=>{let r=n(t);return r?(i.isStringLiteral(r)?r.value=`${e} ${r.value}`:r=i.binaryExpression("+",i.stringLiteral(e),r),r):null},n=t=>t.reduce((e,r)=>{if(e==null)return i.isConditionalExpression(r)||i.isStringLiteral(r)||i.isNumericLiteral(r)?r:i.logicalExpression("||",r,i.stringLiteral(""));let s;if(i.isStringLiteral(r)){if(i.isStringLiteral(e))return i.stringLiteral(`${e.value} ${r.value}`);s=i.stringLiteral(` ${r.value}`)}else if(i.isLiteral(r))s=i.binaryExpression("+",i.stringLiteral(" "),r);else if(i.isConditionalExpression(r)||i.isBinaryExpression(r)){if(i.isStringLiteral(e))return i.binaryExpression("+",i.stringLiteral(`${e.value} `),r);s=i.binaryExpression("+",i.stringLiteral(" "),r)}else if(i.isIdentifier(r)||i.isMemberExpression(r))s=i.conditionalExpression(r,i.binaryExpression("+",i.stringLiteral(" "),r),i.stringLiteral(""));else{if(i.isStringLiteral(e))return i.binaryExpression("+",i.stringLiteral(`${e.value} `),i.logicalExpression("||",r,i.stringLiteral("")));s=i.binaryExpression("+",i.stringLiteral(" "),i.logicalExpression("||",r,i.stringLiteral("")))}return i.binaryExpression("+",e,s)},null);export{l as buildClassName,n as buildClassNameLogic};
|
|
65
2
|
//# sourceMappingURL=buildClassName.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/buildClassName.ts"],
|
|
4
4
|
"sourcesContent": ["import * as t from '@babel/types'\n\nimport type { ClassNameObject } from '../types.js'\n\ntype Builder = (\n objects: ClassNameObject[],\n extras?: string\n) => t.Expression | t.StringLiteral | null\n\nexport const buildClassName: Builder = (objectsIn, extras = '') => {\n let objects = buildClassNameLogic(objectsIn)\n if (!objects) return null\n if (t.isStringLiteral(objects)) {\n // objects.value = objects.value\n objects.value = `${extras} ${objects.value}`\n } else {\n objects = t.binaryExpression('+', t.stringLiteral(extras), objects)\n }\n return objects\n}\n\nexport const buildClassNameLogic: Builder = (objects) => {\n return objects.reduce<t.Expression | null>((acc, val) => {\n if (acc == null) {\n if (\n // pass conditional expressions through\n t.isConditionalExpression(val) ||\n // pass non-null literals through\n t.isStringLiteral(val) ||\n t.isNumericLiteral(val)\n ) {\n return val\n }\n return t.logicalExpression('||', val, t.stringLiteral(''))\n }\n\n let inner: t.Expression\n if (t.isStringLiteral(val)) {\n if (t.isStringLiteral(acc)) {\n // join adjacent string literals\n return t.stringLiteral(`${acc.value} ${val.value}`)\n }\n inner = t.stringLiteral(` ${val.value}`)\n } else if (t.isLiteral(val)) {\n inner = t.binaryExpression('+', t.stringLiteral(' '), val)\n } else if (t.isConditionalExpression(val) || t.isBinaryExpression(val)) {\n if (t.isStringLiteral(acc)) {\n return t.binaryExpression('+', t.stringLiteral(`${acc.value} `), val)\n }\n inner = t.binaryExpression('+', t.stringLiteral(' '), val)\n } else if (t.isIdentifier(val) || t.isMemberExpression(val)) {\n // identifiers and member expressions make for reasonable ternaries\n inner = t.conditionalExpression(\n val,\n t.binaryExpression('+', t.stringLiteral(' '), val),\n t.stringLiteral('')\n )\n } else {\n if (t.isStringLiteral(acc)) {\n return t.binaryExpression(\n '+',\n t.stringLiteral(`${acc.value} `),\n t.logicalExpression('||', val, t.stringLiteral(''))\n )\n }\n // use a logical expression for more complex prop values\n inner = t.binaryExpression(\n '+',\n t.stringLiteral(' '),\n t.logicalExpression('||', val, t.stringLiteral(''))\n )\n }\n\n return t.binaryExpression('+', acc, inner)\n }, null)\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAO,eASZ,MAAMC,EAA0B,CAACC,EAAWC,EAAS,KAAO,CACjE,IAAIC,EAAUC,EAAoBH,CAAS,EAC3C,OAAKE,GACDJ,EAAE,gBAAgBI,CAAO,EAE3BA,EAAQ,MAAQ,GAAGD,KAAUC,EAAQ,QAErCA,EAAUJ,EAAE,iBAAiB,IAAKA,EAAE,cAAcG,CAAM,EAAGC,CAAO,EAE7DA,GAPc,IAQvB,EAEaC,EAAgCD,GACpCA,EAAQ,OAA4B,CAACE,EAAKC,IAAQ,CACvD,GAAID,GAAO,KACT,OAEEN,EAAE,wBAAwBO,CAAG,GAE7BP,EAAE,gBAAgBO,CAAG,GACrBP,EAAE,iBAAiBO,CAAG,EAEfA,EAEFP,EAAE,kBAAkB,KAAMO,EAAKP,EAAE,cAAc,EAAE,CAAC,EAG3D,IAAIQ,EACJ,GAAIR,EAAE,gBAAgBO,CAAG,EAAG,CAC1B,GAAIP,EAAE,gBAAgBM,CAAG,EAEvB,OAAON,EAAE,cAAc,GAAGM,EAAI,SAASC,EAAI,OAAO,EAEpDC,EAAQR,EAAE,cAAc,IAAIO,EAAI,OAAO,CACzC,SAAWP,EAAE,UAAUO,CAAG,EACxBC,EAAQR,EAAE,iBAAiB,IAAKA,EAAE,cAAc,GAAG,EAAGO,CAAG,UAChDP,EAAE,wBAAwBO,CAAG,GAAKP,EAAE,mBAAmBO,CAAG,EAAG,CACtE,GAAIP,EAAE,gBAAgBM,CAAG,EACvB,OAAON,EAAE,iBAAiB,IAAKA,EAAE,cAAc,GAAGM,EAAI,QAAQ,EAAGC,CAAG,EAEtEC,EAAQR,EAAE,iBAAiB,IAAKA,EAAE,cAAc,GAAG,EAAGO,CAAG,CAC3D,SAAWP,EAAE,aAAaO,CAAG,GAAKP,EAAE,mBAAmBO,CAAG,EAExDC,EAAQR,EAAE,sBACRO,EACAP,EAAE,iBAAiB,IAAKA,EAAE,cAAc,GAAG,EAAGO,CAAG,EACjDP,EAAE,cAAc,EAAE,CACpB,MACK,CACL,GAAIA,EAAE,gBAAgBM,CAAG,EACvB,OAAON,EAAE,iBACP,IACAA,EAAE,cAAc,GAAGM,EAAI,QAAQ,EAC/BN,EAAE,kBAAkB,KAAMO,EAAKP,EAAE,cAAc,EAAE,CAAC,CACpD,EAGFQ,EAAQR,EAAE,iBACR,IACAA,EAAE,cAAc,GAAG,EACnBA,EAAE,kBAAkB,KAAMO,EAAKP,EAAE,cAAc,EAAE,CAAC,CACpD,CACF,CAEA,OAAOA,EAAE,iBAAiB,IAAKM,EAAKE,CAAK,CAC3C,EAAG,IAAI",
|
|
6
|
+
"names": ["t", "buildClassName", "objectsIn", "extras", "objects", "buildClassNameLogic", "acc", "val", "inner"]
|
|
7
7
|
}
|
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import esbuild from "esbuild";
|
|
3
|
-
import { pathExists, stat, writeFile } from "fs-extra";
|
|
4
|
-
import { resolveWebOrNativeSpecificEntry } from "./loadTamagui.js";
|
|
5
|
-
function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, ...options }, aliases) {
|
|
6
|
-
var _a;
|
|
7
|
-
const alias = require("@tamagui/core-node").aliasPlugin;
|
|
8
|
-
if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
|
|
9
|
-
console.log(`Building`, entryPoints);
|
|
10
|
-
}
|
|
11
|
-
const tsconfig = join(__dirname, "..", "..", "..", "tamagui.tsconfig.json");
|
|
12
|
-
const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map(resolveWebOrNativeSpecificEntry);
|
|
13
|
-
const res = {
|
|
14
|
-
bundle: true,
|
|
15
|
-
entryPoints: resolvedEntryPoints,
|
|
16
|
-
format: "cjs",
|
|
17
|
-
target: "node18",
|
|
18
|
-
jsx: "transform",
|
|
19
|
-
jsxFactory: "react",
|
|
20
|
-
allowOverwrite: true,
|
|
21
|
-
keepNames: true,
|
|
22
|
-
platform: "node",
|
|
23
|
-
tsconfig,
|
|
24
|
-
loader: {
|
|
25
|
-
".js": "jsx"
|
|
26
|
-
},
|
|
27
|
-
logLevel: "warning",
|
|
28
|
-
plugins: [
|
|
29
|
-
{
|
|
30
|
-
name: "external",
|
|
31
|
-
setup(build) {
|
|
32
|
-
build.onResolve({ filter: /@tamagui\/core/ }, (args) => {
|
|
33
|
-
return {
|
|
34
|
-
path: "@tamagui/core-node",
|
|
35
|
-
external: true
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
build.onResolve({ filter: /@tamagui\/web/ }, (args) => {
|
|
39
|
-
return {
|
|
40
|
-
path: "@tamagui/core-node",
|
|
41
|
-
external: true
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
build.onResolve({ filter: /^(react-native|react-native\/.*)$/ }, (args) => {
|
|
45
|
-
return {
|
|
46
|
-
path: "react-native-web-lite",
|
|
47
|
-
external: true
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
alias({
|
|
53
|
-
...aliases
|
|
54
|
-
})
|
|
55
|
-
],
|
|
56
|
-
...options
|
|
57
|
-
};
|
|
58
|
-
return res;
|
|
59
|
-
}
|
|
60
|
-
async function bundle(props, aliases) {
|
|
61
|
-
await asyncLock(props);
|
|
62
|
-
return esbuild.build(getESBuildConfig(props, aliases));
|
|
63
|
-
}
|
|
64
|
-
function bundleSync(props, aliases) {
|
|
65
|
-
return esbuild.buildSync(getESBuildConfig(props, aliases));
|
|
66
|
-
}
|
|
67
|
-
async function asyncLock(props) {
|
|
68
|
-
var _a;
|
|
69
|
-
const lockFile = join(dirname(props.outfile), basename(props.outfile, ".lock"));
|
|
70
|
-
const lockStat = await stat(lockFile).catch(() => {
|
|
71
|
-
});
|
|
72
|
-
const lockedMsAgo = !lockStat ? Infinity : (/* @__PURE__ */ new Date()).getTime() - new Date(lockStat.mtime).getTime();
|
|
73
|
-
if (lockedMsAgo < 500) {
|
|
74
|
-
if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
|
|
75
|
-
console.log(`Waiting for existing build`, props.entryPoints);
|
|
76
|
-
}
|
|
77
|
-
let tries = 5;
|
|
78
|
-
while (tries--) {
|
|
79
|
-
if (await pathExists(props.outfile)) {
|
|
80
|
-
return;
|
|
81
|
-
} else {
|
|
82
|
-
await new Promise((res) => setTimeout(res, 50));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
void writeFile(lockFile, "");
|
|
87
|
-
}
|
|
88
|
-
export {
|
|
89
|
-
bundle,
|
|
90
|
-
bundleSync
|
|
91
|
-
};
|
|
1
|
+
import{basename as f,dirname as d,join as u}from"path";import g from"esbuild";import{pathExists as p,stat as v,writeFile as w}from"fs-extra";import{resolveWebOrNativeSpecificEntry as y}from"./loadTamagui.js";function m({entryPoints:e,resolvePlatformSpecificEntries:t,...i},s){var l;const r=require("@tamagui/core-node").aliasPlugin;(l=process.env.DEBUG)!=null&&l.startsWith("tamagui")&&console.log("Building",e);const n=u(__dirname,"..","..","..","tamagui.tsconfig.json");return{bundle:!0,entryPoints:t?e.map(y):e,format:"cjs",target:"node18",jsx:"transform",jsxFactory:"react",allowOverwrite:!0,keepNames:!0,platform:"node",tsconfig:n,loader:{".js":"jsx"},logLevel:"warning",plugins:[{name:"external",setup(o){o.onResolve({filter:/@tamagui\/core/},c=>({path:"@tamagui/core-node",external:!0})),o.onResolve({filter:/@tamagui\/web/},c=>({path:"@tamagui/core-node",external:!0})),o.onResolve({filter:/^(react-native|react-native\/.*)$/},c=>({path:"react-native-web-lite",external:!0}))}},r({...s})],...i}}async function k(e,t){return await P(e),g.build(m(e,t))}function B(e,t){return g.buildSync(m(e,t))}async function P(e){var r;const t=u(d(e.outfile),f(e.outfile,".lock")),i=await v(t).catch(()=>{});if((i?new Date().getTime()-new Date(i.mtime).getTime():1/0)<500){(r=process.env.DEBUG)!=null&&r.startsWith("tamagui")&&console.log("Waiting for existing build",e.entryPoints);let n=5;for(;n--;){if(await p(e.outfile))return;await new Promise(a=>setTimeout(a,50))}}w(t,"")}export{k as bundle,B as bundleSync};
|
|
92
2
|
//# sourceMappingURL=bundle.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/bundle.ts"],
|
|
4
4
|
"sourcesContent": ["import { basename, dirname, join } from 'path'\n\nimport esbuild from 'esbuild'\nimport { pathExists, stat, writeFile } from 'fs-extra'\n\nimport { resolveWebOrNativeSpecificEntry } from './loadTamagui.js'\n\n/**\n * For internal loading of new files\n */\n\ntype Props = Omit<Partial<esbuild.BuildOptions>, 'entryPoints'> & {\n outfile: string\n entryPoints: string[]\n resolvePlatformSpecificEntries?: boolean\n}\n\nfunction getESBuildConfig(\n { entryPoints, resolvePlatformSpecificEntries, ...options }: Props,\n aliases?: Record<string, string>\n) {\n const alias = require('@tamagui/core-node').aliasPlugin\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(`Building`, entryPoints)\n }\n const tsconfig = join(__dirname, '..', '..', '..', 'tamagui.tsconfig.json')\n\n const resolvedEntryPoints = !resolvePlatformSpecificEntries\n ? entryPoints\n : entryPoints.map(resolveWebOrNativeSpecificEntry)\n\n const res: esbuild.BuildOptions = {\n bundle: true,\n entryPoints: resolvedEntryPoints,\n format: 'cjs',\n target: 'node18',\n jsx: 'transform',\n jsxFactory: 'react',\n allowOverwrite: true,\n keepNames: true,\n platform: 'node',\n tsconfig,\n loader: {\n '.js': 'jsx',\n },\n logLevel: 'warning',\n plugins: [\n {\n name: 'external',\n setup(build) {\n build.onResolve({ filter: /@tamagui\\/core/ }, (args) => {\n return {\n path: '@tamagui/core-node',\n external: true,\n }\n })\n\n build.onResolve({ filter: /@tamagui\\/web/ }, (args) => {\n return {\n path: '@tamagui/core-node',\n external: true,\n }\n })\n\n build.onResolve({ filter: /^(react-native|react-native\\/.*)$/ }, (args) => {\n return {\n path: 'react-native-web-lite',\n external: true,\n }\n })\n },\n },\n alias({\n ...aliases,\n }),\n ],\n ...options,\n }\n\n return res\n}\n\nexport async function bundle(props: Props, aliases?: Record<string, string>) {\n await asyncLock(props)\n return esbuild.build(getESBuildConfig(props, aliases))\n}\n\nexport function bundleSync(props: Props, aliases?: Record<string, string>) {\n return esbuild.buildSync(getESBuildConfig(props, aliases))\n}\n\n// until i do fancier things w plugins:\nasync function asyncLock(props: Props) {\n const lockFile = join(dirname(props.outfile), basename(props.outfile, '.lock'))\n const lockStat = await stat(lockFile).catch(() => {\n /* ok */\n })\n const lockedMsAgo = !lockStat\n ? Infinity\n : new Date().getTime() - new Date(lockStat.mtime).getTime()\n if (lockedMsAgo < 500) {\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(`Waiting for existing build`, props.entryPoints)\n }\n let tries = 5\n while (tries--) {\n if (await pathExists(props.outfile)) {\n return\n } else {\n await new Promise((res) => setTimeout(res, 50))\n }\n }\n }\n void writeFile(lockFile, '')\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,WAAAC,EAAS,QAAAC,MAAY,OAExC,OAAOC,MAAa,UACpB,OAAS,cAAAC,EAAY,QAAAC,EAAM,aAAAC,MAAiB,WAE5C,OAAS,mCAAAC,MAAuC,mBAYhD,SAASC,EACP,CAAE,YAAAC,EAAa,+BAAAC,EAAgC,GAAGC,CAAQ,EAC1DC,EACA,CApBF,IAAAC,EAqBE,MAAMC,EAAQ,QAAQ,oBAAoB,EAAE,aACxCD,EAAA,QAAQ,IAAI,QAAZ,MAAAA,EAAmB,WAAW,YAEhC,QAAQ,IAAI,WAAYJ,CAAW,EAErC,MAAMM,EAAWb,EAAK,UAAW,KAAM,KAAM,KAAM,uBAAuB,EAsD1E,MAhDkC,CAChC,OAAQ,GACR,YAN2BQ,EAEzBD,EAAY,IAAIF,CAA+B,EAD/CE,EAMF,OAAQ,MACR,OAAQ,SACR,IAAK,YACL,WAAY,QACZ,eAAgB,GAChB,UAAW,GACX,SAAU,OACV,SAAAM,EACA,OAAQ,CACN,MAAO,KACT,EACA,SAAU,UACV,QAAS,CACP,CACE,KAAM,WACN,MAAMC,EAAO,CACXA,EAAM,UAAU,CAAE,OAAQ,gBAAiB,EAAIC,IACtC,CACL,KAAM,qBACN,SAAU,EACZ,EACD,EAEDD,EAAM,UAAU,CAAE,OAAQ,eAAgB,EAAIC,IACrC,CACL,KAAM,qBACN,SAAU,EACZ,EACD,EAEDD,EAAM,UAAU,CAAE,OAAQ,mCAAoC,EAAIC,IACzD,CACL,KAAM,wBACN,SAAU,EACZ,EACD,CACH,CACF,EACAH,EAAM,CACJ,GAAGF,CACL,CAAC,CACH,EACA,GAAGD,CACL,CAGF,CAEA,eAAsBO,EAAOC,EAAcP,EAAkC,CAC3E,aAAMQ,EAAUD,CAAK,EACdhB,EAAQ,MAAMK,EAAiBW,EAAOP,CAAO,CAAC,CACvD,CAEO,SAASS,EAAWF,EAAcP,EAAkC,CACzE,OAAOT,EAAQ,UAAUK,EAAiBW,EAAOP,CAAO,CAAC,CAC3D,CAGA,eAAeQ,EAAUD,EAAc,CA7FvC,IAAAN,EA8FE,MAAMS,EAAWpB,EAAKD,EAAQkB,EAAM,OAAO,EAAGnB,EAASmB,EAAM,QAAS,OAAO,CAAC,EACxEI,EAAW,MAAMlB,EAAKiB,CAAQ,EAAE,MAAM,IAAM,CAElD,CAAC,EAID,IAHqBC,EAEjB,IAAI,KAAK,EAAE,QAAQ,EAAI,IAAI,KAAKA,EAAS,KAAK,EAAE,QAAQ,EADxD,KAEc,IAAK,EACjBV,EAAA,QAAQ,IAAI,QAAZ,MAAAA,EAAmB,WAAW,YAEhC,QAAQ,IAAI,6BAA8BM,EAAM,WAAW,EAE7D,IAAIK,EAAQ,EACZ,KAAOA,KAAS,CACd,GAAI,MAAMpB,EAAWe,EAAM,OAAO,EAChC,OAEA,MAAM,IAAI,QAASM,GAAQ,WAAWA,EAAK,EAAE,CAAC,CAElD,CACF,CACKnB,EAAUgB,EAAU,EAAE,CAC7B",
|
|
6
|
+
"names": ["basename", "dirname", "join", "esbuild", "pathExists", "stat", "writeFile", "resolveWebOrNativeSpecificEntry", "getESBuildConfig", "entryPoints", "resolvePlatformSpecificEntries", "options", "aliases", "_a", "alias", "tsconfig", "build", "args", "bundle", "props", "asyncLock", "bundleSync", "lockFile", "lockStat", "tries", "res"]
|
|
7
7
|
}
|
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import esbuild from "esbuild";
|
|
3
|
-
import { pathExists, stat, writeFile } from "fs-extra";
|
|
4
|
-
import { resolveWebOrNativeSpecificEntry } from "./loadTamagui.js";
|
|
5
|
-
function getESBuildConfig({ entryPoints, resolvePlatformSpecificEntries, ...options }, aliases) {
|
|
6
|
-
var _a;
|
|
7
|
-
const alias = require("@tamagui/core-node").aliasPlugin;
|
|
8
|
-
if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
|
|
9
|
-
console.log(`Building`, entryPoints);
|
|
10
|
-
}
|
|
11
|
-
const tsconfig = join(__dirname, "..", "..", "..", "tamagui.tsconfig.json");
|
|
12
|
-
const resolvedEntryPoints = !resolvePlatformSpecificEntries ? entryPoints : entryPoints.map(resolveWebOrNativeSpecificEntry);
|
|
13
|
-
const res = {
|
|
14
|
-
bundle: true,
|
|
15
|
-
entryPoints: resolvedEntryPoints,
|
|
16
|
-
format: "cjs",
|
|
17
|
-
target: "node18",
|
|
18
|
-
jsx: "transform",
|
|
19
|
-
jsxFactory: "react",
|
|
20
|
-
allowOverwrite: true,
|
|
21
|
-
keepNames: true,
|
|
22
|
-
platform: "node",
|
|
23
|
-
tsconfig,
|
|
24
|
-
loader: {
|
|
25
|
-
".js": "jsx"
|
|
26
|
-
},
|
|
27
|
-
logLevel: "warning",
|
|
28
|
-
plugins: [
|
|
29
|
-
{
|
|
30
|
-
name: "external",
|
|
31
|
-
setup(build) {
|
|
32
|
-
build.onResolve({ filter: /@tamagui\/core/ }, (args) => {
|
|
33
|
-
return {
|
|
34
|
-
path: "@tamagui/core-node",
|
|
35
|
-
external: true
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
build.onResolve({ filter: /@tamagui\/web/ }, (args) => {
|
|
39
|
-
return {
|
|
40
|
-
path: "@tamagui/core-node",
|
|
41
|
-
external: true
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
build.onResolve({ filter: /^(react-native|react-native\/.*)$/ }, (args) => {
|
|
45
|
-
return {
|
|
46
|
-
path: "react-native-web-lite",
|
|
47
|
-
external: true
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
alias({
|
|
53
|
-
...aliases
|
|
54
|
-
})
|
|
55
|
-
],
|
|
56
|
-
...options
|
|
57
|
-
};
|
|
58
|
-
return res;
|
|
59
|
-
}
|
|
60
|
-
async function bundle(props, aliases) {
|
|
61
|
-
await asyncLock(props);
|
|
62
|
-
return esbuild.build(getESBuildConfig(props, aliases));
|
|
63
|
-
}
|
|
64
|
-
function bundleSync(props, aliases) {
|
|
65
|
-
return esbuild.buildSync(getESBuildConfig(props, aliases));
|
|
66
|
-
}
|
|
67
|
-
async function asyncLock(props) {
|
|
68
|
-
var _a;
|
|
69
|
-
const lockFile = join(dirname(props.outfile), basename(props.outfile, ".lock"));
|
|
70
|
-
const lockStat = await stat(lockFile).catch(() => {
|
|
71
|
-
});
|
|
72
|
-
const lockedMsAgo = !lockStat ? Infinity : (/* @__PURE__ */ new Date()).getTime() - new Date(lockStat.mtime).getTime();
|
|
73
|
-
if (lockedMsAgo < 500) {
|
|
74
|
-
if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
|
|
75
|
-
console.log(`Waiting for existing build`, props.entryPoints);
|
|
76
|
-
}
|
|
77
|
-
let tries = 5;
|
|
78
|
-
while (tries--) {
|
|
79
|
-
if (await pathExists(props.outfile)) {
|
|
80
|
-
return;
|
|
81
|
-
} else {
|
|
82
|
-
await new Promise((res) => setTimeout(res, 50));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
void writeFile(lockFile, "");
|
|
87
|
-
}
|
|
88
|
-
export {
|
|
89
|
-
bundle,
|
|
90
|
-
bundleSync
|
|
91
|
-
};
|
|
1
|
+
import{basename as f,dirname as d,join as u}from"path";import g from"esbuild";import{pathExists as p,stat as v,writeFile as w}from"fs-extra";import{resolveWebOrNativeSpecificEntry as y}from"./loadTamagui.js";function m({entryPoints:e,resolvePlatformSpecificEntries:t,...i},s){var l;const r=require("@tamagui/core-node").aliasPlugin;(l=process.env.DEBUG)!=null&&l.startsWith("tamagui")&&console.log("Building",e);const n=u(__dirname,"..","..","..","tamagui.tsconfig.json");return{bundle:!0,entryPoints:t?e.map(y):e,format:"cjs",target:"node18",jsx:"transform",jsxFactory:"react",allowOverwrite:!0,keepNames:!0,platform:"node",tsconfig:n,loader:{".js":"jsx"},logLevel:"warning",plugins:[{name:"external",setup(o){o.onResolve({filter:/@tamagui\/core/},c=>({path:"@tamagui/core-node",external:!0})),o.onResolve({filter:/@tamagui\/web/},c=>({path:"@tamagui/core-node",external:!0})),o.onResolve({filter:/^(react-native|react-native\/.*)$/},c=>({path:"react-native-web-lite",external:!0}))}},r({...s})],...i}}async function k(e,t){return await P(e),g.build(m(e,t))}function B(e,t){return g.buildSync(m(e,t))}async function P(e){var r;const t=u(d(e.outfile),f(e.outfile,".lock")),i=await v(t).catch(()=>{});if((i?new Date().getTime()-new Date(i.mtime).getTime():1/0)<500){(r=process.env.DEBUG)!=null&&r.startsWith("tamagui")&&console.log("Waiting for existing build",e.entryPoints);let n=5;for(;n--;){if(await p(e.outfile))return;await new Promise(a=>setTimeout(a,50))}}w(t,"")}export{k as bundle,B as bundleSync};
|
|
92
2
|
//# sourceMappingURL=bundle.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/bundle.ts"],
|
|
4
4
|
"sourcesContent": ["import { basename, dirname, join } from 'path'\n\nimport esbuild from 'esbuild'\nimport { pathExists, stat, writeFile } from 'fs-extra'\n\nimport { resolveWebOrNativeSpecificEntry } from './loadTamagui.js'\n\n/**\n * For internal loading of new files\n */\n\ntype Props = Omit<Partial<esbuild.BuildOptions>, 'entryPoints'> & {\n outfile: string\n entryPoints: string[]\n resolvePlatformSpecificEntries?: boolean\n}\n\nfunction getESBuildConfig(\n { entryPoints, resolvePlatformSpecificEntries, ...options }: Props,\n aliases?: Record<string, string>\n) {\n const alias = require('@tamagui/core-node').aliasPlugin\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(`Building`, entryPoints)\n }\n const tsconfig = join(__dirname, '..', '..', '..', 'tamagui.tsconfig.json')\n\n const resolvedEntryPoints = !resolvePlatformSpecificEntries\n ? entryPoints\n : entryPoints.map(resolveWebOrNativeSpecificEntry)\n\n const res: esbuild.BuildOptions = {\n bundle: true,\n entryPoints: resolvedEntryPoints,\n format: 'cjs',\n target: 'node18',\n jsx: 'transform',\n jsxFactory: 'react',\n allowOverwrite: true,\n keepNames: true,\n platform: 'node',\n tsconfig,\n loader: {\n '.js': 'jsx',\n },\n logLevel: 'warning',\n plugins: [\n {\n name: 'external',\n setup(build) {\n build.onResolve({ filter: /@tamagui\\/core/ }, (args) => {\n return {\n path: '@tamagui/core-node',\n external: true,\n }\n })\n\n build.onResolve({ filter: /@tamagui\\/web/ }, (args) => {\n return {\n path: '@tamagui/core-node',\n external: true,\n }\n })\n\n build.onResolve({ filter: /^(react-native|react-native\\/.*)$/ }, (args) => {\n return {\n path: 'react-native-web-lite',\n external: true,\n }\n })\n },\n },\n alias({\n ...aliases,\n }),\n ],\n ...options,\n }\n\n return res\n}\n\nexport async function bundle(props: Props, aliases?: Record<string, string>) {\n await asyncLock(props)\n return esbuild.build(getESBuildConfig(props, aliases))\n}\n\nexport function bundleSync(props: Props, aliases?: Record<string, string>) {\n return esbuild.buildSync(getESBuildConfig(props, aliases))\n}\n\n// until i do fancier things w plugins:\nasync function asyncLock(props: Props) {\n const lockFile = join(dirname(props.outfile), basename(props.outfile, '.lock'))\n const lockStat = await stat(lockFile).catch(() => {\n /* ok */\n })\n const lockedMsAgo = !lockStat\n ? Infinity\n : new Date().getTime() - new Date(lockStat.mtime).getTime()\n if (lockedMsAgo < 500) {\n if (process.env.DEBUG?.startsWith('tamagui')) {\n // eslint-disable-next-line no-console\n console.log(`Waiting for existing build`, props.entryPoints)\n }\n let tries = 5\n while (tries--) {\n if (await pathExists(props.outfile)) {\n return\n } else {\n await new Promise((res) => setTimeout(res, 50))\n }\n }\n }\n void writeFile(lockFile, '')\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,WAAAC,EAAS,QAAAC,MAAY,OAExC,OAAOC,MAAa,UACpB,OAAS,cAAAC,EAAY,QAAAC,EAAM,aAAAC,MAAiB,WAE5C,OAAS,mCAAAC,MAAuC,mBAYhD,SAASC,EACP,CAAE,YAAAC,EAAa,+BAAAC,EAAgC,GAAGC,CAAQ,EAC1DC,EACA,CApBF,IAAAC,EAqBE,MAAMC,EAAQ,QAAQ,oBAAoB,EAAE,aACxCD,EAAA,QAAQ,IAAI,QAAZ,MAAAA,EAAmB,WAAW,YAEhC,QAAQ,IAAI,WAAYJ,CAAW,EAErC,MAAMM,EAAWb,EAAK,UAAW,KAAM,KAAM,KAAM,uBAAuB,EAsD1E,MAhDkC,CAChC,OAAQ,GACR,YAN2BQ,EAEzBD,EAAY,IAAIF,CAA+B,EAD/CE,EAMF,OAAQ,MACR,OAAQ,SACR,IAAK,YACL,WAAY,QACZ,eAAgB,GAChB,UAAW,GACX,SAAU,OACV,SAAAM,EACA,OAAQ,CACN,MAAO,KACT,EACA,SAAU,UACV,QAAS,CACP,CACE,KAAM,WACN,MAAMC,EAAO,CACXA,EAAM,UAAU,CAAE,OAAQ,gBAAiB,EAAIC,IACtC,CACL,KAAM,qBACN,SAAU,EACZ,EACD,EAEDD,EAAM,UAAU,CAAE,OAAQ,eAAgB,EAAIC,IACrC,CACL,KAAM,qBACN,SAAU,EACZ,EACD,EAEDD,EAAM,UAAU,CAAE,OAAQ,mCAAoC,EAAIC,IACzD,CACL,KAAM,wBACN,SAAU,EACZ,EACD,CACH,CACF,EACAH,EAAM,CACJ,GAAGF,CACL,CAAC,CACH,EACA,GAAGD,CACL,CAGF,CAEA,eAAsBO,EAAOC,EAAcP,EAAkC,CAC3E,aAAMQ,EAAUD,CAAK,EACdhB,EAAQ,MAAMK,EAAiBW,EAAOP,CAAO,CAAC,CACvD,CAEO,SAASS,EAAWF,EAAcP,EAAkC,CACzE,OAAOT,EAAQ,UAAUK,EAAiBW,EAAOP,CAAO,CAAC,CAC3D,CAGA,eAAeQ,EAAUD,EAAc,CA7FvC,IAAAN,EA8FE,MAAMS,EAAWpB,EAAKD,EAAQkB,EAAM,OAAO,EAAGnB,EAASmB,EAAM,QAAS,OAAO,CAAC,EACxEI,EAAW,MAAMlB,EAAKiB,CAAQ,EAAE,MAAM,IAAM,CAElD,CAAC,EAID,IAHqBC,EAEjB,IAAI,KAAK,EAAE,QAAQ,EAAI,IAAI,KAAKA,EAAS,KAAK,EAAE,QAAQ,EADxD,KAEc,IAAK,EACjBV,EAAA,QAAQ,IAAI,QAAZ,MAAAA,EAAmB,WAAW,YAEhC,QAAQ,IAAI,6BAA8BM,EAAM,WAAW,EAE7D,IAAIK,EAAQ,EACZ,KAAOA,KAAS,CACd,GAAI,MAAMpB,EAAWe,EAAM,OAAO,EAChC,OAEA,MAAM,IAAI,QAASM,GAAQ,WAAWA,EAAK,EAAE,CAAC,CAElD,CACF,CACKnB,EAAUgB,EAAU,EAAE,CAC7B",
|
|
6
|
+
"names": ["basename", "dirname", "join", "esbuild", "pathExists", "stat", "writeFile", "resolveWebOrNativeSpecificEntry", "getESBuildConfig", "entryPoints", "resolvePlatformSpecificEntries", "options", "aliases", "_a", "alias", "tsconfig", "build", "args", "bundle", "props", "asyncLock", "bundleSync", "lockFile", "lockStat", "tries", "res"]
|
|
7
7
|
}
|
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
import vm from "
|
|
2
|
-
import generate from "@babel/generator";
|
|
3
|
-
import * as t from "@babel/types";
|
|
4
|
-
import { createCSSVariable } from "@tamagui/core-node";
|
|
5
|
-
import esbuild from "esbuild";
|
|
6
|
-
import { FAILED_EVAL } from "../constants.js";
|
|
7
|
-
import { evaluateAstNode } from "./evaluateAstNode.js";
|
|
8
|
-
import { isValidThemeHook } from "./extractHelpers.js";
|
|
9
|
-
function createEvaluator({
|
|
10
|
-
props,
|
|
11
|
-
staticNamespace,
|
|
12
|
-
sourcePath,
|
|
13
|
-
traversePath,
|
|
14
|
-
shouldPrintDebug
|
|
15
|
-
}) {
|
|
16
|
-
const evalFn = (n) => {
|
|
17
|
-
if (t.isMemberExpression(n) && t.isIdentifier(n.property) && traversePath && isValidThemeHook(props, traversePath, n, sourcePath)) {
|
|
18
|
-
const key = n.property.name;
|
|
19
|
-
if (shouldPrintDebug) {
|
|
20
|
-
console.log(" > found theme prop", key);
|
|
21
|
-
}
|
|
22
|
-
return createCSSVariable(key);
|
|
23
|
-
}
|
|
24
|
-
if (t.isIdentifier(n) && typeof staticNamespace[n.name] !== "undefined") {
|
|
25
|
-
return staticNamespace[n.name];
|
|
26
|
-
}
|
|
27
|
-
const evalContext = vm.createContext(staticNamespace);
|
|
28
|
-
const codeWithTypescriptAnnotations = `(${generate(n).code})`;
|
|
29
|
-
const code = esbuild.transformSync(codeWithTypescriptAnnotations, { loader: "tsx" }).code.replace(/;\n$/, "");
|
|
30
|
-
if (shouldPrintDebug) {
|
|
31
|
-
console.log("evaluating", code);
|
|
32
|
-
}
|
|
33
|
-
return vm.runInContext(code, evalContext);
|
|
34
|
-
};
|
|
35
|
-
return (n) => {
|
|
36
|
-
return evaluateAstNode(n, evalFn);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function createSafeEvaluator(attemptEval) {
|
|
40
|
-
return (n) => {
|
|
41
|
-
try {
|
|
42
|
-
return attemptEval(n);
|
|
43
|
-
} catch (err) {
|
|
44
|
-
return FAILED_EVAL;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
createEvaluator,
|
|
50
|
-
createSafeEvaluator
|
|
51
|
-
};
|
|
1
|
+
import s from"vm";import d from"@babel/generator";import*as r from"@babel/types";import{createCSSVariable as l}from"@tamagui/core-node";import y from"esbuild";import{FAILED_EVAL as h}from"../constants.js";import{evaluateAstNode as g}from"./evaluateAstNode.js";import{isValidThemeHook as v}from"./extractHelpers.js";function V({props:t,staticNamespace:o,sourcePath:n,traversePath:i,shouldPrintDebug:a}){const f=e=>{if(r.isMemberExpression(e)&&r.isIdentifier(e.property)&&i&&v(t,i,e,n)){const p=e.property.name;return a&&console.log(" > found theme prop",p),l(p)}if(r.isIdentifier(e)&&typeof o[e.name]<"u")return o[e.name];const c=s.createContext(o),u=`(${d(e).code})`,m=y.transformSync(u,{loader:"tsx"}).code.replace(/;\n$/,"");return a&&console.log("evaluating",m),s.runInContext(m,c)};return e=>g(e,f)}function W(t){return o=>{try{return t(o)}catch{return h}}}export{V as createEvaluator,W as createSafeEvaluator};
|
|
52
2
|
//# sourceMappingURL=createEvaluator.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/createEvaluator.ts"],
|
|
4
4
|
"sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport { createCSSVariable } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\n\nimport { FAILED_EVAL } from '../constants.js'\nimport { TamaguiOptionsWithFileInfo } from '../types.js'\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport { isValidThemeHook } from './extractHelpers.js'\n\nexport function createEvaluator({\n props,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n props: TamaguiOptionsWithFileInfo\n staticNamespace: Record<string, any>\n sourcePath?: string\n traversePath?: NodePath<t.JSXElement>\n shouldPrintDebug: boolean | 'verbose'\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n traversePath &&\n isValidThemeHook(props, traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log(' > found theme prop', key)\n }\n return createCSSVariable(key)\n }\n // variable\n if (t.isIdentifier(n) && typeof staticNamespace[n.name] !== 'undefined') {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n // @ts-ignore\n const codeWithTypescriptAnnotations = `(${generate(n as any).code})`\n const code = esbuild\n .transformSync(codeWithTypescriptAnnotations, { loader: 'tsx' })\n .code.replace(/;\\n$/, '')\n\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log('evaluating', code)\n }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAQ,KAEf,OAAOC,MAAc,mBAErB,UAAYC,MAAO,eACnB,OAAS,qBAAAC,MAAyB,qBAClC,OAAOC,MAAa,UAEpB,OAAS,eAAAC,MAAmB,kBAE5B,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,oBAAAC,MAAwB,sBAE1B,SAASC,EAAgB,CAC9B,MAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,aAAAC,EACA,iBAAAC,CACF,EAMG,CAED,MAAMC,EAAUC,GAAc,CAE5B,GACEb,EAAE,mBAAmBa,CAAC,GACtBb,EAAE,aAAaa,EAAE,QAAQ,GACzBH,GACAL,EAAiBE,EAAOG,EAAcG,EAAGJ,CAAU,EACnD,CACA,MAAMK,EAAMD,EAAE,SAAS,KACvB,OAAIF,GAEF,QAAQ,IAAI,yBAA0BG,CAAG,EAEpCb,EAAkBa,CAAG,CAC9B,CAEA,GAAId,EAAE,aAAaa,CAAC,GAAK,OAAOL,EAAgBK,EAAE,IAAI,EAAM,IAC1D,OAAOL,EAAgBK,EAAE,IAAI,EAE/B,MAAME,EAAcjB,EAAG,cAAcU,CAAe,EAE9CQ,EAAgC,IAAIjB,EAASc,CAAQ,EAAE,QACvDI,EAAOf,EACV,cAAcc,EAA+B,CAAE,OAAQ,KAAM,CAAC,EAC9D,KAAK,QAAQ,OAAQ,EAAE,EAE1B,OAAIL,GAEF,QAAQ,IAAI,aAAcM,CAAI,EAEzBnB,EAAG,aAAamB,EAAMF,CAAW,CAC1C,EAEA,OAAQF,GACCT,EAAgBS,EAAGD,CAAM,CAEpC,CAEO,SAASM,EAAoBC,EAAiC,CACnE,OAAQN,GAAc,CACpB,GAAI,CACF,OAAOM,EAAYN,CAAC,CACtB,MAAE,CACA,OAAOV,CACT,CACF,CACF",
|
|
6
|
+
"names": ["vm", "generate", "t", "createCSSVariable", "esbuild", "FAILED_EVAL", "evaluateAstNode", "isValidThemeHook", "createEvaluator", "props", "staticNamespace", "sourcePath", "traversePath", "shouldPrintDebug", "evalFn", "n", "key", "evalContext", "codeWithTypescriptAnnotations", "code", "createSafeEvaluator", "attemptEval"]
|
|
7
7
|
}
|
|
@@ -1,52 +1,2 @@
|
|
|
1
|
-
import vm from "
|
|
2
|
-
import generate from "@babel/generator";
|
|
3
|
-
import * as t from "@babel/types";
|
|
4
|
-
import { createCSSVariable } from "@tamagui/core-node";
|
|
5
|
-
import esbuild from "esbuild";
|
|
6
|
-
import { FAILED_EVAL } from "../constants.js";
|
|
7
|
-
import { evaluateAstNode } from "./evaluateAstNode.js";
|
|
8
|
-
import { isValidThemeHook } from "./extractHelpers.js";
|
|
9
|
-
function createEvaluator({
|
|
10
|
-
props,
|
|
11
|
-
staticNamespace,
|
|
12
|
-
sourcePath,
|
|
13
|
-
traversePath,
|
|
14
|
-
shouldPrintDebug
|
|
15
|
-
}) {
|
|
16
|
-
const evalFn = (n) => {
|
|
17
|
-
if (t.isMemberExpression(n) && t.isIdentifier(n.property) && traversePath && isValidThemeHook(props, traversePath, n, sourcePath)) {
|
|
18
|
-
const key = n.property.name;
|
|
19
|
-
if (shouldPrintDebug) {
|
|
20
|
-
console.log(" > found theme prop", key);
|
|
21
|
-
}
|
|
22
|
-
return createCSSVariable(key);
|
|
23
|
-
}
|
|
24
|
-
if (t.isIdentifier(n) && typeof staticNamespace[n.name] !== "undefined") {
|
|
25
|
-
return staticNamespace[n.name];
|
|
26
|
-
}
|
|
27
|
-
const evalContext = vm.createContext(staticNamespace);
|
|
28
|
-
const codeWithTypescriptAnnotations = `(${generate(n).code})`;
|
|
29
|
-
const code = esbuild.transformSync(codeWithTypescriptAnnotations, { loader: "tsx" }).code.replace(/;\n$/, "");
|
|
30
|
-
if (shouldPrintDebug) {
|
|
31
|
-
console.log("evaluating", code);
|
|
32
|
-
}
|
|
33
|
-
return vm.runInContext(code, evalContext);
|
|
34
|
-
};
|
|
35
|
-
return (n) => {
|
|
36
|
-
return evaluateAstNode(n, evalFn);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function createSafeEvaluator(attemptEval) {
|
|
40
|
-
return (n) => {
|
|
41
|
-
try {
|
|
42
|
-
return attemptEval(n);
|
|
43
|
-
} catch (err) {
|
|
44
|
-
return FAILED_EVAL;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
createEvaluator,
|
|
50
|
-
createSafeEvaluator
|
|
51
|
-
};
|
|
1
|
+
import s from"vm";import d from"@babel/generator";import*as r from"@babel/types";import{createCSSVariable as l}from"@tamagui/core-node";import y from"esbuild";import{FAILED_EVAL as h}from"../constants.js";import{evaluateAstNode as g}from"./evaluateAstNode.js";import{isValidThemeHook as v}from"./extractHelpers.js";function V({props:t,staticNamespace:o,sourcePath:n,traversePath:i,shouldPrintDebug:a}){const f=e=>{if(r.isMemberExpression(e)&&r.isIdentifier(e.property)&&i&&v(t,i,e,n)){const p=e.property.name;return a&&console.log(" > found theme prop",p),l(p)}if(r.isIdentifier(e)&&typeof o[e.name]<"u")return o[e.name];const c=s.createContext(o),u=`(${d(e).code})`,m=y.transformSync(u,{loader:"tsx"}).code.replace(/;\n$/,"");return a&&console.log("evaluating",m),s.runInContext(m,c)};return e=>g(e,f)}function W(t){return o=>{try{return t(o)}catch{return h}}}export{V as createEvaluator,W as createSafeEvaluator};
|
|
52
2
|
//# sourceMappingURL=createEvaluator.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/extractor/createEvaluator.ts"],
|
|
4
4
|
"sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport { createCSSVariable } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\n\nimport { FAILED_EVAL } from '../constants.js'\nimport { TamaguiOptionsWithFileInfo } from '../types.js'\nimport { evaluateAstNode } from './evaluateAstNode.js'\nimport { isValidThemeHook } from './extractHelpers.js'\n\nexport function createEvaluator({\n props,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n props: TamaguiOptionsWithFileInfo\n staticNamespace: Record<string, any>\n sourcePath?: string\n traversePath?: NodePath<t.JSXElement>\n shouldPrintDebug: boolean | 'verbose'\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n traversePath &&\n isValidThemeHook(props, traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log(' > found theme prop', key)\n }\n return createCSSVariable(key)\n }\n // variable\n if (t.isIdentifier(n) && typeof staticNamespace[n.name] !== 'undefined') {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n // @ts-ignore\n const codeWithTypescriptAnnotations = `(${generate(n as any).code})`\n const code = esbuild\n .transformSync(codeWithTypescriptAnnotations, { loader: 'tsx' })\n .code.replace(/;\\n$/, '')\n\n if (shouldPrintDebug) {\n // eslint-disable-next-line no-console\n console.log('evaluating', code)\n }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAQ,KAEf,OAAOC,MAAc,mBAErB,UAAYC,MAAO,eACnB,OAAS,qBAAAC,MAAyB,qBAClC,OAAOC,MAAa,UAEpB,OAAS,eAAAC,MAAmB,kBAE5B,OAAS,mBAAAC,MAAuB,uBAChC,OAAS,oBAAAC,MAAwB,sBAE1B,SAASC,EAAgB,CAC9B,MAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,aAAAC,EACA,iBAAAC,CACF,EAMG,CAED,MAAMC,EAAUC,GAAc,CAE5B,GACEb,EAAE,mBAAmBa,CAAC,GACtBb,EAAE,aAAaa,EAAE,QAAQ,GACzBH,GACAL,EAAiBE,EAAOG,EAAcG,EAAGJ,CAAU,EACnD,CACA,MAAMK,EAAMD,EAAE,SAAS,KACvB,OAAIF,GAEF,QAAQ,IAAI,yBAA0BG,CAAG,EAEpCb,EAAkBa,CAAG,CAC9B,CAEA,GAAId,EAAE,aAAaa,CAAC,GAAK,OAAOL,EAAgBK,EAAE,IAAI,EAAM,IAC1D,OAAOL,EAAgBK,EAAE,IAAI,EAE/B,MAAME,EAAcjB,EAAG,cAAcU,CAAe,EAE9CQ,EAAgC,IAAIjB,EAASc,CAAQ,EAAE,QACvDI,EAAOf,EACV,cAAcc,EAA+B,CAAE,OAAQ,KAAM,CAAC,EAC9D,KAAK,QAAQ,OAAQ,EAAE,EAE1B,OAAIL,GAEF,QAAQ,IAAI,aAAcM,CAAI,EAEzBnB,EAAG,aAAamB,EAAMF,CAAW,CAC1C,EAEA,OAAQF,GACCT,EAAgBS,EAAGD,CAAM,CAEpC,CAEO,SAASM,EAAoBC,EAAiC,CACnE,OAAQN,GAAc,CACpB,GAAI,CACF,OAAOM,EAAYN,CAAC,CACtB,MAAE,CACA,OAAOV,CACT,CACF,CACF",
|
|
6
|
+
"names": ["vm", "generate", "t", "createCSSVariable", "esbuild", "FAILED_EVAL", "evaluateAstNode", "isValidThemeHook", "createEvaluator", "props", "staticNamespace", "sourcePath", "traversePath", "shouldPrintDebug", "evalFn", "n", "key", "evalContext", "codeWithTypescriptAnnotations", "code", "createSafeEvaluator", "attemptEval"]
|
|
7
7
|
}
|