@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.
- package/dist/check-dep-versions.cjs +267 -0
- package/dist/checkDeps.cjs +32 -0
- package/dist/{constants.js → constants.cjs} +29 -14
- package/dist/exports.cjs +40 -0
- package/dist/extractor/accessSafe.cjs +46 -0
- package/dist/extractor/babelParse.cjs +54 -0
- package/dist/extractor/buildClassName.cjs +62 -0
- package/dist/extractor/bundle.cjs +146 -0
- package/dist/extractor/bundleConfig.cjs +322 -0
- package/dist/extractor/{createEvaluator.js → createEvaluator.cjs} +37 -21
- package/dist/extractor/createExtractor.cjs +1008 -0
- package/dist/extractor/createLogger.cjs +45 -0
- package/dist/extractor/ensureImportingConcat.cjs +48 -0
- package/dist/extractor/esbuildAliasPlugin.cjs +44 -0
- package/dist/extractor/evaluateAstNode.cjs +83 -0
- package/dist/extractor/extractHelpers.cjs +120 -0
- package/dist/extractor/extractMediaStyle.cjs +129 -0
- package/dist/extractor/extractToClassNames.cjs +254 -0
- package/dist/extractor/extractToNative.cjs +274 -0
- package/dist/extractor/findTopmostFunction.cjs +34 -0
- package/dist/extractor/generatedUid.cjs +47 -0
- package/dist/extractor/getPrefixLogs.cjs +28 -0
- package/dist/extractor/getPropValueFromAttributes.cjs +67 -0
- package/dist/extractor/getSourceModule.cjs +68 -0
- package/dist/extractor/{getStaticBindingsForScope.js → getStaticBindingsForScope.cjs} +66 -61
- package/dist/extractor/{getTamaguiConfigPathFromOptionsConfig.js → getTamaguiConfigPathFromOptionsConfig.cjs} +16 -11
- package/dist/extractor/{hoistClassNames.js → hoistClassNames.cjs} +31 -32
- package/dist/extractor/{literalToAst.js → literalToAst.cjs} +38 -44
- package/dist/extractor/{loadFile.js → loadFile.cjs} +3 -6
- package/dist/extractor/{loadTamagui.js → loadTamagui.cjs} +99 -78
- package/dist/extractor/logLines.cjs +35 -0
- package/dist/extractor/{normalizeTernaries.js → normalizeTernaries.cjs} +38 -29
- package/dist/extractor/{propsToFontFamilyCache.js → propsToFontFamilyCache.cjs} +18 -14
- package/dist/extractor/regenerateConfig.cjs +144 -0
- package/dist/extractor/{removeUnusedHooks.js → removeUnusedHooks.cjs} +31 -27
- package/dist/extractor/{timer.js → timer.cjs} +16 -11
- package/dist/extractor/{validHTMLAttributes.js → validHTMLAttributes.cjs} +16 -11
- package/dist/extractor/{watchTamaguiConfig.js → watchTamaguiConfig.cjs} +30 -29
- package/dist/{getPragmaOptions.js → getPragmaOptions.cjs} +22 -17
- package/dist/helpers/memoize.cjs +37 -0
- package/dist/helpers/requireTamaguiCore.cjs +33 -0
- package/dist/index.cjs +40 -0
- package/dist/registerRequire.cjs +102 -0
- package/dist/{server.js → server.cjs} +38 -21
- package/dist/setup.cjs +0 -0
- package/dist/types.cjs +16 -0
- package/package.json +18 -16
- package/dist/check-dep-versions.js +0 -389
- package/dist/checkDeps.js +0 -26
- package/dist/exports.js +0 -33
- package/dist/extractor/accessSafe.js +0 -47
- package/dist/extractor/babelParse.js +0 -59
- package/dist/extractor/buildClassName.js +0 -72
- package/dist/extractor/bundle.js +0 -133
- package/dist/extractor/bundleConfig.js +0 -350
- package/dist/extractor/createExtractor.js +0 -1217
- package/dist/extractor/createLogger.js +0 -32
- package/dist/extractor/ensureImportingConcat.js +0 -50
- package/dist/extractor/esbuildAliasPlugin.js +0 -36
- package/dist/extractor/evaluateAstNode.js +0 -99
- package/dist/extractor/extractHelpers.js +0 -109
- package/dist/extractor/extractMediaStyle.js +0 -123
- package/dist/extractor/extractToClassNames.js +0 -291
- package/dist/extractor/extractToNative.js +0 -319
- package/dist/extractor/findTopmostFunction.js +0 -32
- package/dist/extractor/generatedUid.js +0 -42
- package/dist/extractor/getPrefixLogs.js +0 -23
- package/dist/extractor/getPropValueFromAttributes.js +0 -65
- package/dist/extractor/getSourceModule.js +0 -66
- package/dist/extractor/logLines.js +0 -30
- package/dist/extractor/regenerateConfig.js +0 -111
- package/dist/helpers/memoize.js +0 -33
- package/dist/helpers/requireTamaguiCore.js +0 -30
- package/dist/index.js +0 -30
- package/dist/registerRequire.js +0 -96
- package/dist/setup.js +0 -1
- package/dist/types.js +0 -14
- /package/dist/{check-dep-versions.js.map → check-dep-versions.cjs.map} +0 -0
- /package/dist/{checkDeps.js.map → checkDeps.cjs.map} +0 -0
- /package/dist/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/{exports.js.map → exports.cjs.map} +0 -0
- /package/dist/extractor/{accessSafe.js.map → accessSafe.cjs.map} +0 -0
- /package/dist/extractor/{babelParse.js.map → babelParse.cjs.map} +0 -0
- /package/dist/extractor/{buildClassName.js.map → buildClassName.cjs.map} +0 -0
- /package/dist/extractor/{bundle.js.map → bundle.cjs.map} +0 -0
- /package/dist/extractor/{bundleConfig.js.map → bundleConfig.cjs.map} +0 -0
- /package/dist/extractor/{createEvaluator.js.map → createEvaluator.cjs.map} +0 -0
- /package/dist/extractor/{createExtractor.js.map → createExtractor.cjs.map} +0 -0
- /package/dist/extractor/{createLogger.js.map → createLogger.cjs.map} +0 -0
- /package/dist/extractor/{ensureImportingConcat.js.map → ensureImportingConcat.cjs.map} +0 -0
- /package/dist/extractor/{esbuildAliasPlugin.js.map → esbuildAliasPlugin.cjs.map} +0 -0
- /package/dist/extractor/{evaluateAstNode.js.map → evaluateAstNode.cjs.map} +0 -0
- /package/dist/extractor/{extractHelpers.js.map → extractHelpers.cjs.map} +0 -0
- /package/dist/extractor/{extractMediaStyle.js.map → extractMediaStyle.cjs.map} +0 -0
- /package/dist/extractor/{extractToClassNames.js.map → extractToClassNames.cjs.map} +0 -0
- /package/dist/extractor/{extractToNative.js.map → extractToNative.cjs.map} +0 -0
- /package/dist/extractor/{findTopmostFunction.js.map → findTopmostFunction.cjs.map} +0 -0
- /package/dist/extractor/{generatedUid.js.map → generatedUid.cjs.map} +0 -0
- /package/dist/extractor/{getPrefixLogs.js.map → getPrefixLogs.cjs.map} +0 -0
- /package/dist/extractor/{getPropValueFromAttributes.js.map → getPropValueFromAttributes.cjs.map} +0 -0
- /package/dist/extractor/{getSourceModule.js.map → getSourceModule.cjs.map} +0 -0
- /package/dist/extractor/{getStaticBindingsForScope.js.map → getStaticBindingsForScope.cjs.map} +0 -0
- /package/dist/extractor/{getTamaguiConfigPathFromOptionsConfig.js.map → getTamaguiConfigPathFromOptionsConfig.cjs.map} +0 -0
- /package/dist/extractor/{hoistClassNames.js.map → hoistClassNames.cjs.map} +0 -0
- /package/dist/extractor/{literalToAst.js.map → literalToAst.cjs.map} +0 -0
- /package/dist/extractor/{loadFile.js.map → loadFile.cjs.map} +0 -0
- /package/dist/extractor/{loadTamagui.js.map → loadTamagui.cjs.map} +0 -0
- /package/dist/extractor/{logLines.js.map → logLines.cjs.map} +0 -0
- /package/dist/extractor/{normalizeTernaries.js.map → normalizeTernaries.cjs.map} +0 -0
- /package/dist/extractor/{propsToFontFamilyCache.js.map → propsToFontFamilyCache.cjs.map} +0 -0
- /package/dist/extractor/{regenerateConfig.js.map → regenerateConfig.cjs.map} +0 -0
- /package/dist/extractor/{removeUnusedHooks.js.map → removeUnusedHooks.cjs.map} +0 -0
- /package/dist/extractor/{timer.js.map → timer.cjs.map} +0 -0
- /package/dist/extractor/{validHTMLAttributes.js.map → validHTMLAttributes.cjs.map} +0 -0
- /package/dist/extractor/{watchTamaguiConfig.js.map → watchTamaguiConfig.cjs.map} +0 -0
- /package/dist/{getPragmaOptions.js.map → getPragmaOptions.cjs.map} +0 -0
- /package/dist/helpers/{memoize.js.map → memoize.cjs.map} +0 -0
- /package/dist/helpers/{requireTamaguiCore.js.map → requireTamaguiCore.cjs.map} +0 -0
- /package/dist/{index.js.map → index.cjs.map} +0 -0
- /package/dist/{registerRequire.js.map → registerRequire.cjs.map} +0 -0
- /package/dist/{server.js.map → server.cjs.map} +0 -0
- /package/dist/{setup.js.map → setup.cjs.map} +0 -0
- /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,
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
6
7
|
var __export = (target, all) => {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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", {
|
21
|
-
|
22
|
-
|
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"),
|
30
|
-
|
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__ */
|
36
|
-
|
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
|
-
|
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(),
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
95
|
-
|
104
|
+
}
|
105
|
+
if (!bindingCache) throw new Error("BindingCache is a required param");
|
96
106
|
for (const k in bindings) {
|
97
|
-
const binding = bindings[k],
|
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(
|
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 {
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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,
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
6
7
|
var __export = (target, all) => {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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", {
|
21
|
-
|
22
|
-
|
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
|
-
|
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
|
-
|
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"),
|
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
|
-
|
58
|
-
|
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,
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
6
7
|
var __export = (target, all) => {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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", {
|
21
|
-
|
22
|
-
|
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
|
-
|
58
|
-
if (t.
|
59
|
-
|
60
|
-
|
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
|
-
|
76
|
-
|
77
|
-
|
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
|
-
|
83
|
-
|
84
|
-
|
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",
|
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);
|