@tamagui/static 1.115.1 → 1.115.2
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.js +389 -0
- package/dist/check-dep-versions.js.map +6 -0
- package/dist/checkDeps.js +26 -0
- package/dist/checkDeps.js.map +6 -0
- package/dist/constants.js +34 -0
- package/dist/constants.js.map +6 -0
- package/dist/exports.js +33 -0
- package/dist/exports.js.map +6 -0
- package/dist/extractor/accessSafe.js +47 -0
- package/dist/extractor/accessSafe.js.map +6 -0
- package/dist/extractor/babelParse.js +59 -0
- package/dist/extractor/babelParse.js.map +6 -0
- package/dist/extractor/buildClassName.js +72 -0
- package/dist/extractor/buildClassName.js.map +6 -0
- package/dist/extractor/bundle.js +133 -0
- package/dist/extractor/bundle.js.map +6 -0
- package/dist/extractor/bundleConfig.js +350 -0
- package/dist/extractor/bundleConfig.js.map +6 -0
- package/dist/extractor/createEvaluator.js +54 -0
- package/dist/extractor/createEvaluator.js.map +6 -0
- package/dist/extractor/createExtractor.js +1217 -0
- package/dist/extractor/createExtractor.js.map +6 -0
- package/dist/extractor/createLogger.js +32 -0
- package/dist/extractor/createLogger.js.map +6 -0
- package/dist/extractor/ensureImportingConcat.js +50 -0
- package/dist/extractor/ensureImportingConcat.js.map +6 -0
- package/dist/extractor/esbuildAliasPlugin.js +36 -0
- package/dist/extractor/esbuildAliasPlugin.js.map +6 -0
- package/dist/extractor/evaluateAstNode.js +99 -0
- package/dist/extractor/evaluateAstNode.js.map +6 -0
- package/dist/extractor/extractHelpers.js +109 -0
- package/dist/extractor/extractHelpers.js.map +6 -0
- package/dist/extractor/extractMediaStyle.js +123 -0
- package/dist/extractor/extractMediaStyle.js.map +6 -0
- package/dist/extractor/extractToClassNames.js +291 -0
- package/dist/extractor/extractToClassNames.js.map +6 -0
- package/dist/extractor/extractToNative.js +319 -0
- package/dist/extractor/extractToNative.js.map +6 -0
- package/dist/extractor/findTopmostFunction.js +32 -0
- package/dist/extractor/findTopmostFunction.js.map +6 -0
- package/dist/extractor/generatedUid.js +42 -0
- package/dist/extractor/generatedUid.js.map +6 -0
- package/dist/extractor/getPrefixLogs.js +23 -0
- package/dist/extractor/getPrefixLogs.js.map +6 -0
- package/dist/extractor/getPropValueFromAttributes.js +65 -0
- package/dist/extractor/getPropValueFromAttributes.js.map +6 -0
- package/dist/extractor/getSourceModule.js +66 -0
- package/dist/extractor/getSourceModule.js.map +6 -0
- package/dist/extractor/getStaticBindingsForScope.js +143 -0
- package/dist/extractor/getStaticBindingsForScope.js.map +6 -0
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js +24 -0
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js.map +6 -0
- package/dist/extractor/hoistClassNames.js +63 -0
- package/dist/extractor/hoistClassNames.js.map +6 -0
- package/dist/extractor/literalToAst.js +90 -0
- package/dist/extractor/literalToAst.js.map +6 -0
- package/dist/extractor/loadFile.js +14 -0
- package/dist/extractor/loadFile.js.map +6 -0
- package/dist/extractor/loadTamagui.js +263 -0
- package/dist/extractor/loadTamagui.js.map +6 -0
- package/dist/extractor/logLines.js +30 -0
- package/dist/extractor/logLines.js.map +6 -0
- package/dist/extractor/normalizeTernaries.js +59 -0
- package/dist/extractor/normalizeTernaries.js.map +6 -0
- package/dist/extractor/propsToFontFamilyCache.js +34 -0
- package/dist/extractor/propsToFontFamilyCache.js.map +6 -0
- package/dist/extractor/regenerateConfig.js +111 -0
- package/dist/extractor/regenerateConfig.js.map +6 -0
- package/dist/extractor/removeUnusedHooks.js +72 -0
- package/dist/extractor/removeUnusedHooks.js.map +6 -0
- package/dist/extractor/timer.js +38 -0
- package/dist/extractor/timer.js.map +6 -0
- package/dist/extractor/validHTMLAttributes.js +68 -0
- package/dist/extractor/validHTMLAttributes.js.map +6 -0
- package/dist/extractor/watchTamaguiConfig.js +57 -0
- package/dist/extractor/watchTamaguiConfig.js.map +6 -0
- package/dist/getPragmaOptions.js +49 -0
- package/dist/getPragmaOptions.js.map +6 -0
- package/dist/helpers/memoize.js +33 -0
- package/dist/helpers/memoize.js.map +6 -0
- package/dist/helpers/requireTamaguiCore.js +30 -0
- package/dist/helpers/requireTamaguiCore.js.map +6 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +6 -0
- package/dist/registerRequire.js +96 -0
- package/dist/registerRequire.js.map +6 -0
- package/dist/server.js +58 -0
- package/dist/server.js.map +6 -0
- package/dist/setup.js +1 -0
- package/dist/setup.js.map +6 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +6 -0
- package/package.json +14 -14
@@ -0,0 +1,32 @@
|
|
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)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
10
|
+
for (let key of __getOwnPropNames(from))
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
15
|
+
var findTopmostFunction_exports = {};
|
16
|
+
__export(findTopmostFunction_exports, {
|
17
|
+
findTopmostFunction: () => findTopmostFunction
|
18
|
+
});
|
19
|
+
module.exports = __toCommonJS(findTopmostFunction_exports);
|
20
|
+
function findTopmostFunction(jsxPath) {
|
21
|
+
const isFunction = (path) => path.isArrowFunctionExpression() || path.isFunctionDeclaration() || path.isFunctionExpression();
|
22
|
+
let compFn = jsxPath.findParent(isFunction);
|
23
|
+
for (; compFn; ) {
|
24
|
+
const parent = compFn.findParent(isFunction);
|
25
|
+
if (parent)
|
26
|
+
compFn = parent;
|
27
|
+
else
|
28
|
+
break;
|
29
|
+
}
|
30
|
+
return compFn || null;
|
31
|
+
}
|
32
|
+
//# sourceMappingURL=findTopmostFunction.js.map
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/extractor/findTopmostFunction.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,oBAAoB,SAAiC;AAEnE,QAAM,aAAa,CAAC,SAClB,KAAK,0BAA0B,KAC/B,KAAK,sBAAsB,KAC3B,KAAK,qBAAqB;AAC5B,MAAI,SAA+B,QAAQ,WAAW,UAAU;AAChE,SAAO,UAAQ;AACb,UAAM,SAAS,OAAO,WAAW,UAAU;AAC3C,QAAI;AACF,eAAS;AAAA;AAET;AAAA,EAEJ;AACA,SAAK,UAEI;AAGX;",
|
5
|
+
"names": []
|
6
|
+
}
|
@@ -0,0 +1,42 @@
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
21
|
+
mod
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
23
|
+
var generatedUid_exports = {};
|
24
|
+
__export(generatedUid_exports, {
|
25
|
+
generateUid: () => generateUid
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(generatedUid_exports);
|
28
|
+
var t = __toESM(require("@babel/types"));
|
29
|
+
function generateUid(scope, name) {
|
30
|
+
if (typeof scope != "object")
|
31
|
+
throw "generateUid expects a scope object as its first parameter";
|
32
|
+
if (!(typeof name == "string" && name !== ""))
|
33
|
+
throw "generateUid expects a valid name as its second parameter";
|
34
|
+
name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
|
35
|
+
let uid, i = 0;
|
36
|
+
do
|
37
|
+
i > 1 ? uid = name + i : uid = name, i++;
|
38
|
+
while (scope.hasLabel(uid) || scope.hasBinding(uid) || scope.hasGlobal(uid) || scope.hasReference(uid));
|
39
|
+
const program = scope.getProgramParent();
|
40
|
+
return program.references[uid] = !0, program.uids[uid] = !0, uid;
|
41
|
+
}
|
42
|
+
//# sourceMappingURL=generatedUid.js.map
|
@@ -0,0 +1,6 @@
|
|
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
|
+
}
|
@@ -0,0 +1,23 @@
|
|
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)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
10
|
+
for (let key of __getOwnPropNames(from))
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
15
|
+
var getPrefixLogs_exports = {};
|
16
|
+
__export(getPrefixLogs_exports, {
|
17
|
+
getPrefixLogs: () => getPrefixLogs
|
18
|
+
});
|
19
|
+
module.exports = __toCommonJS(getPrefixLogs_exports);
|
20
|
+
function getPrefixLogs(options) {
|
21
|
+
return options?.prefixLogs ?? ` ${options?.platform || "web"} | `;
|
22
|
+
}
|
23
|
+
//# sourceMappingURL=getPrefixLogs.js.map
|
@@ -0,0 +1,65 @@
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
21
|
+
mod
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
23
|
+
var getPropValueFromAttributes_exports = {};
|
24
|
+
__export(getPropValueFromAttributes_exports, {
|
25
|
+
getPropValueFromAttributes: () => getPropValueFromAttributes
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(getPropValueFromAttributes_exports);
|
28
|
+
var import_generator = __toESM(require("@babel/generator")), t = __toESM(require("@babel/types")), import_accessSafe = require("./accessSafe");
|
29
|
+
function getPropValueFromAttributes(propName, attrs) {
|
30
|
+
let propIndex = -1, jsxAttr = null;
|
31
|
+
for (let idx = -1, len = attrs.length; ++idx < len; ) {
|
32
|
+
const attr = attrs[idx];
|
33
|
+
if (t.isJSXAttribute(attr) && attr.name && attr.name.name === propName) {
|
34
|
+
propIndex = idx, jsxAttr = attr;
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
if (!jsxAttr || jsxAttr.value == null)
|
39
|
+
return null;
|
40
|
+
let propValue = jsxAttr.value;
|
41
|
+
if (t.isJSXExpressionContainer(propValue) && (propValue = propValue.expression), t.isJSXEmptyExpression(propValue))
|
42
|
+
return console.error("encountered JSXEmptyExpression"), null;
|
43
|
+
const applicableSpreads = attrs.filter(
|
44
|
+
// 1. idx is greater than propValue prop index
|
45
|
+
// 2. attr is a spread operator
|
46
|
+
(attr, idx) => {
|
47
|
+
if (t.isJSXSpreadAttribute(attr)) {
|
48
|
+
if (t.isIdentifier(attr.argument) || t.isMemberExpression(attr.argument))
|
49
|
+
return idx > propIndex;
|
50
|
+
if (t.isLogicalExpression(attr.argument))
|
51
|
+
return !1;
|
52
|
+
throw new Error(
|
53
|
+
`unsupported spread of type "${attr.argument.type}": ${// @ts-ignore
|
54
|
+
(0, import_generator.default)(attr).code}`
|
55
|
+
);
|
56
|
+
}
|
57
|
+
return !1;
|
58
|
+
}
|
59
|
+
).map((attr) => attr.argument);
|
60
|
+
return applicableSpreads.length > 0 && (propValue = applicableSpreads.reduce(
|
61
|
+
(acc, val) => t.logicalExpression("||", (0, import_accessSafe.accessSafe)(val, propName), acc),
|
62
|
+
propValue
|
63
|
+
)), propValue;
|
64
|
+
}
|
65
|
+
//# sourceMappingURL=getPropValueFromAttributes.js.map
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/extractor/getPropValueFromAttributes.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB,sCACrB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PropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
21
|
+
mod
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
23
|
+
var getSourceModule_exports = {};
|
24
|
+
__export(getSourceModule_exports, {
|
25
|
+
getSourceModule: () => getSourceModule
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(getSourceModule_exports);
|
28
|
+
var t = __toESM(require("@babel/types"));
|
29
|
+
function getSourceModule(itemName, itemBinding) {
|
30
|
+
if (!itemBinding.constant)
|
31
|
+
return null;
|
32
|
+
let sourceModule, imported, local, destructured, usesImportSyntax = !1;
|
33
|
+
const itemNode = itemBinding.path.node;
|
34
|
+
if (
|
35
|
+
// import x from 'y';
|
36
|
+
t.isImportDefaultSpecifier(itemNode) || // import {x} from 'y';
|
37
|
+
t.isImportSpecifier(itemNode)
|
38
|
+
)
|
39
|
+
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));
|
40
|
+
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) {
|
41
|
+
const firstArg = itemNode.init.arguments[0];
|
42
|
+
if (!t.isStringLiteral(firstArg))
|
43
|
+
return null;
|
44
|
+
if (sourceModule = firstArg.value, t.isIdentifier(itemNode.id))
|
45
|
+
local = itemNode.id.name, imported = itemNode.id.name, destructured = !1;
|
46
|
+
else if (t.isObjectPattern(itemNode.id)) {
|
47
|
+
for (const objProp of itemNode.id.properties)
|
48
|
+
if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.value) && objProp.value.name === itemName) {
|
49
|
+
local = objProp.value.name, imported = objProp.key.name, destructured = !0;
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
if (!local || !imported)
|
53
|
+
return console.error("could not find prop with value `%s`", itemName), null;
|
54
|
+
} else
|
55
|
+
return console.error("Unhandled id type: %s", itemNode.id.type), null;
|
56
|
+
} else
|
57
|
+
return null;
|
58
|
+
return {
|
59
|
+
destructured,
|
60
|
+
imported,
|
61
|
+
local,
|
62
|
+
sourceModule,
|
63
|
+
usesImportSyntax
|
64
|
+
};
|
65
|
+
}
|
66
|
+
//# sourceMappingURL=getSourceModule.js.map
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/extractor/getSourceModule.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAUZ,SAAS,gBACd,UACA,aAIqB;AAErB,MAAI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AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
5
|
+
"names": []
|
6
|
+
}
|
@@ -0,0 +1,143 @@
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
21
|
+
mod
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
23
|
+
var getStaticBindingsForScope_exports = {};
|
24
|
+
__export(getStaticBindingsForScope_exports, {
|
25
|
+
cleanupBeforeExit: () => cleanupBeforeExit,
|
26
|
+
getStaticBindingsForScope: () => getStaticBindingsForScope
|
27
|
+
});
|
28
|
+
module.exports = __toCommonJS(getStaticBindingsForScope_exports);
|
29
|
+
var import_node_child_process = require("node:child_process"), import_node_path = require("node:path"), t = __toESM(require("@babel/types")), import_evaluateAstNode = require("./evaluateAstNode"), import_getSourceModule = require("./getSourceModule");
|
30
|
+
const isLocalImport = (path) => path.startsWith(".") || path.startsWith("/");
|
31
|
+
function resolveImportPath(sourcePath, path) {
|
32
|
+
const sourceDir = (0, import_node_path.dirname)(sourcePath);
|
33
|
+
return isLocalImport(path) ? ((0, import_node_path.extname)(path) === "" && (path += ""), (0, import_node_path.resolve)(sourceDir, path)) : path;
|
34
|
+
}
|
35
|
+
const cache = /* @__PURE__ */ new Map(), pending = /* @__PURE__ */ new Map(), loadCmd = `${(0, import_node_path.join)(__dirname, "loadFile.js")}`;
|
36
|
+
let exited = !1, child = null;
|
37
|
+
function forkChild() {
|
38
|
+
child = (0, import_node_child_process.fork)(loadCmd, [], {
|
39
|
+
execArgv: ["-r", "esbuild-register"],
|
40
|
+
detached: !1,
|
41
|
+
stdio: "ignore"
|
42
|
+
});
|
43
|
+
}
|
44
|
+
function cleanupBeforeExit() {
|
45
|
+
exited || child && (child.removeAllListeners(), child.unref(), child.disconnect(), child.kill(), exited = !0);
|
46
|
+
}
|
47
|
+
process.once("SIGTERM", cleanupBeforeExit);
|
48
|
+
process.once("SIGINT", cleanupBeforeExit);
|
49
|
+
process.once("beforeExit", cleanupBeforeExit);
|
50
|
+
function importModule(path) {
|
51
|
+
if (child || forkChild(), pending.has(path))
|
52
|
+
return pending.get(path);
|
53
|
+
const promise = new Promise((res, rej) => {
|
54
|
+
if (!child) return;
|
55
|
+
if (cache.size > 2e3 && cache.clear(), cache.has(path))
|
56
|
+
return cache.get(path);
|
57
|
+
const listener = (msg) => {
|
58
|
+
if (!child || !msg || typeof msg != "string") return;
|
59
|
+
if (msg[0] === "-") {
|
60
|
+
rej(new Error(msg.slice(1)));
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
child.removeListener("message", listener);
|
64
|
+
const val = JSON.parse(msg);
|
65
|
+
cache.set(path, val), res(val);
|
66
|
+
};
|
67
|
+
child.once("message", listener), child.send(`${path.replace(".js", "")}`);
|
68
|
+
});
|
69
|
+
return pending.set(path, promise), promise;
|
70
|
+
}
|
71
|
+
async function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCache, shouldPrintDebug) {
|
72
|
+
const bindings = scope.getAllBindings(), ret = {}, program = scope.getProgramParent().block;
|
73
|
+
for (const node of program.body)
|
74
|
+
if (t.isImportDeclaration(node)) {
|
75
|
+
const importPath = node.source.value;
|
76
|
+
if (!node.specifiers.length || !isLocalImport(importPath))
|
77
|
+
continue;
|
78
|
+
const moduleName = resolveImportPath(sourcePath, importPath);
|
79
|
+
if (!whitelist.some((test) => moduleName.endsWith(test))) continue;
|
80
|
+
try {
|
81
|
+
const src = await importModule(moduleName);
|
82
|
+
if (!src) continue;
|
83
|
+
for (const specifier of node.specifiers)
|
84
|
+
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported) && typeof src[specifier.imported.name] < "u") {
|
85
|
+
const val = src[specifier.local.name];
|
86
|
+
ret[specifier.local.name] = val;
|
87
|
+
}
|
88
|
+
} catch (err) {
|
89
|
+
shouldPrintDebug ? console.warn(
|
90
|
+
` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`
|
91
|
+
) : process.env.DEBUG?.startsWith("tamagui") && console.info("Error in partial evaluation", err.message, err.stack);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
if (!bindingCache)
|
95
|
+
throw new Error("BindingCache is a required param");
|
96
|
+
for (const k in bindings) {
|
97
|
+
const binding = bindings[k], sourceModule = (0, import_getSourceModule.getSourceModule)(k, binding);
|
98
|
+
if (sourceModule) {
|
99
|
+
if (!sourceModule.sourceModule)
|
100
|
+
continue;
|
101
|
+
const moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule);
|
102
|
+
if (whitelist.some((test) => moduleName.endsWith(test))) {
|
103
|
+
const src = importModule(moduleName);
|
104
|
+
if (!src)
|
105
|
+
return console.info(
|
106
|
+
` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`
|
107
|
+
), {};
|
108
|
+
sourceModule.destructured ? sourceModule.imported && (ret[k] = src[sourceModule.imported]) : ret[k] = src;
|
109
|
+
}
|
110
|
+
continue;
|
111
|
+
}
|
112
|
+
const { parent } = binding.path;
|
113
|
+
if (!t.isVariableDeclaration(parent) || parent.kind !== "const")
|
114
|
+
continue;
|
115
|
+
const dec = parent.declarations.find((d) => t.isIdentifier(d.id) && d.id.name === k);
|
116
|
+
if (!dec || !dec.init)
|
117
|
+
continue;
|
118
|
+
if (typeof dec.id.start != "number" || typeof dec.id.end != "number") {
|
119
|
+
console.error("dec.id.start/end is not a number");
|
120
|
+
continue;
|
121
|
+
}
|
122
|
+
if (!t.isIdentifier(dec.id)) {
|
123
|
+
console.error("dec is not an identifier");
|
124
|
+
continue;
|
125
|
+
}
|
126
|
+
const cacheKey = `${dec.id.name}_${dec.id.start}-${dec.id.end}`;
|
127
|
+
if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
|
128
|
+
ret[k] = bindingCache[cacheKey];
|
129
|
+
continue;
|
130
|
+
}
|
131
|
+
if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
|
132
|
+
ret[k] = bindingCache[cacheKey];
|
133
|
+
continue;
|
134
|
+
}
|
135
|
+
try {
|
136
|
+
ret[k] = (0, import_evaluateAstNode.evaluateAstNode)(dec.init, void 0, shouldPrintDebug), bindingCache[cacheKey] = ret[k];
|
137
|
+
continue;
|
138
|
+
} catch {
|
139
|
+
}
|
140
|
+
}
|
141
|
+
return ret;
|
142
|
+
}
|
143
|
+
//# sourceMappingURL=getStaticBindingsForScope.js.map
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/extractor/getStaticBindingsForScope.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAC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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
|
+
}
|
@@ -0,0 +1,24 @@
|
|
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)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
10
|
+
for (let key of __getOwnPropNames(from))
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
15
|
+
var getTamaguiConfigPathFromOptionsConfig_exports = {};
|
16
|
+
__export(getTamaguiConfigPathFromOptionsConfig_exports, {
|
17
|
+
getTamaguiConfigPathFromOptionsConfig: () => getTamaguiConfigPathFromOptionsConfig
|
18
|
+
});
|
19
|
+
module.exports = __toCommonJS(getTamaguiConfigPathFromOptionsConfig_exports);
|
20
|
+
var import_node_path = require("node:path");
|
21
|
+
function getTamaguiConfigPathFromOptionsConfig(config) {
|
22
|
+
return (0, import_node_path.isAbsolute)(config) ? config : (0, import_node_path.join)(process.cwd(), config);
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=getTamaguiConfigPathFromOptionsConfig.js.map
|
@@ -0,0 +1,63 @@
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
21
|
+
mod
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
23
|
+
var hoistClassNames_exports = {};
|
24
|
+
__export(hoistClassNames_exports, {
|
25
|
+
hoistClassNames: () => hoistClassNames
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(hoistClassNames_exports);
|
28
|
+
var t = __toESM(require("@babel/types"));
|
29
|
+
function hoistClassNames(path, existing, expr) {
|
30
|
+
const hoist = hoistClassNames.bind(null, path, existing);
|
31
|
+
if (t.isStringLiteral(expr)) {
|
32
|
+
if (expr.value.trim() === "")
|
33
|
+
return expr;
|
34
|
+
if (existing[expr.value])
|
35
|
+
return existing[expr.value];
|
36
|
+
const identifier = replaceStringWithVariable(expr);
|
37
|
+
return existing[expr.value] = identifier, identifier;
|
38
|
+
}
|
39
|
+
if (t.isBinaryExpression(expr)) {
|
40
|
+
if (t.isPrivateName(expr.left))
|
41
|
+
throw new Error("no private name");
|
42
|
+
return t.binaryExpression(expr.operator, hoist(expr.left), hoist(expr.right));
|
43
|
+
}
|
44
|
+
if (t.isLogicalExpression(expr))
|
45
|
+
return t.logicalExpression(expr.operator, hoist(expr.left), hoist(expr.right));
|
46
|
+
if (t.isConditionalExpression(expr))
|
47
|
+
return t.conditionalExpression(
|
48
|
+
expr.test,
|
49
|
+
hoist(expr.consequent),
|
50
|
+
hoist(expr.alternate)
|
51
|
+
);
|
52
|
+
return expr;
|
53
|
+
function replaceStringWithVariable(str) {
|
54
|
+
const uid = path.scope.generateUidIdentifier("cn"), parent = path.findParent((path2) => path2.isProgram());
|
55
|
+
if (!parent) throw new Error("no program?");
|
56
|
+
const variable = t.variableDeclaration("const", [
|
57
|
+
// adding a space for extra safety
|
58
|
+
t.variableDeclarator(uid, t.stringLiteral(` ${str.value}`))
|
59
|
+
]);
|
60
|
+
return parent.unshiftContainer("body", variable), uid;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
//# sourceMappingURL=hoistClassNames.js.map
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/extractor/hoistClassNames.ts"],
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,QAAmB;AAEZ,SAAS,gBACd,MACA,UACA,MACA;AACA,QAAM,QAAQ,gBAAgB,KAAK,MAAM,MAAM,QAAQ;AACvD,MAAI,EAAE,gBAAgB,IAAI,GAAG;AAC3B,QAAI,KAAK,MAAM,KAAK,MAAM;AACxB,aAAO;AAET,QAAI,SAAS,KAAK,KAAK;AACrB,aAAO,SAAS,KAAK,KAAK;AAE5B,UAAM,aAAa,0BAA0B,IAAI;AACjD,oBAAS,KAAK,KAAK,IAAI,YAChB;AAAA,EACT;AACA,MAAI,EAAE,mBAAmB,IAAI,GAAG;AAC9B,QAAI,EAAE,cAAc,KAAK,IAAI;AAC3B,YAAM,IAAI,MAAM,iBAAiB;AAEnC,WAAO,EAAE,iBAAiB,KAAK,UAAU,MAAM,KAAK,IAAI,GAAG,MAAM,KAAK,KAAK,CAAC;AAAA,EAC9E;AACA,MAAI,EAAE,oBAAoB,IAAI;AAC5B,WAAO,EAAE,kBAAkB,KAAK,UAAU,MAAM,KAAK,IAAI,GAAG,MAAM,KAAK,KAAK,CAAC;AAE/E,MAAI,EAAE,wBAAwB,IAAI;AAChC,WAAO,EAAE;AAAA,MACP,KAAK;AAAA,MACL,MAAM,KAAK,UAAU;AAAA,MACrB,MAAM,KAAK,SAAS;AAAA,IACtB;AAEF,SAAO;AAEP,WAAS,0BAA0B,KAAoC;AAErE,UAAM,MAAM,KAAK,MAAM,sBAAsB,IAAI,GAC3C,SAAS,KAAK,WAAW,CAACA,UAASA,MAAK,UAAU,CAAC;AACzD,QAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,aAAa;AAC1C,UAAM,WAAW,EAAE,oBAAoB,SAAS;AAAA;AAAA,MAE9C,EAAE,mBAAmB,KAAK,EAAE,cAAc,IAAI,IAAI,KAAK,EAAE,CAAC;AAAA,IAC5D,CAAC;AAED,kBAAO,iBAAiB,QAAQ,QAAQ,GACjC;AAAA,EACT;AACF;",
|
5
|
+
"names": ["path"]
|
6
|
+
}
|
@@ -0,0 +1,90 @@
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
21
|
+
mod
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
23
|
+
var literalToAst_exports = {};
|
24
|
+
__export(literalToAst_exports, {
|
25
|
+
astToLiteral: () => astToLiteral,
|
26
|
+
literalToAst: () => literalToAst
|
27
|
+
});
|
28
|
+
module.exports = __toCommonJS(literalToAst_exports);
|
29
|
+
var t = __toESM(require("@babel/types"));
|
30
|
+
function literalToAst(literal) {
|
31
|
+
if (literal === null)
|
32
|
+
return t.nullLiteral();
|
33
|
+
switch (typeof literal) {
|
34
|
+
case "function":
|
35
|
+
throw new Error("Unsupported");
|
36
|
+
case "number":
|
37
|
+
return t.numericLiteral(literal);
|
38
|
+
case "string":
|
39
|
+
return t.stringLiteral(literal);
|
40
|
+
case "boolean":
|
41
|
+
return t.booleanLiteral(literal);
|
42
|
+
case "undefined":
|
43
|
+
return t.unaryExpression("void", t.numericLiteral(0), !0);
|
44
|
+
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
|
+
);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
const easyPeasies = ["BooleanLiteral", "StringLiteral", "NumericLiteral"];
|
51
|
+
function astToLiteral(node) {
|
52
|
+
if (node) {
|
53
|
+
if (easyPeasies.includes(node.type))
|
54
|
+
return node.value;
|
55
|
+
if (!(node.name === "undefined" && !node.value)) {
|
56
|
+
if (t.isNullLiteral(node))
|
57
|
+
return null;
|
58
|
+
if (t.isObjectExpression(node))
|
59
|
+
return computeProps(node.properties);
|
60
|
+
if (t.isArrayExpression(node))
|
61
|
+
return node.elements.reduce(
|
62
|
+
// @ts-ignore
|
63
|
+
(acc, element) => [
|
64
|
+
...acc,
|
65
|
+
...element?.type === "SpreadElement" ? astToLiteral(element.argument) : [astToLiteral(element)]
|
66
|
+
],
|
67
|
+
[]
|
68
|
+
);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
function computeProps(props) {
|
73
|
+
return props.reduce((acc, prop) => {
|
74
|
+
if (prop.type === "SpreadElement")
|
75
|
+
return {
|
76
|
+
...acc,
|
77
|
+
...astToLiteral(prop.argument)
|
78
|
+
};
|
79
|
+
if (prop.type !== "ObjectMethod") {
|
80
|
+
const val = astToLiteral(prop.value);
|
81
|
+
if (val !== void 0)
|
82
|
+
return {
|
83
|
+
...acc,
|
84
|
+
[prop.key.name]: val
|
85
|
+
};
|
86
|
+
}
|
87
|
+
return acc;
|
88
|
+
}, {});
|
89
|
+
}
|
90
|
+
//# sourceMappingURL=literalToAst.js.map
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../src/extractor/literalToAst.ts"],
|
4
|
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