@tamagui/static 2.0.0-rc.4 → 2.0.0-rc.40
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 +201 -96
- package/dist/checkDeps.cjs +250 -46
- package/dist/constants.cjs +32 -30
- package/dist/exports.cjs +18 -13
- package/dist/extractor/accessSafe.cjs +25 -23
- package/dist/extractor/babelParse.cjs +30 -28
- package/dist/extractor/buildClassName.cjs +59 -35
- package/dist/extractor/bundle.cjs +177 -101
- package/dist/extractor/bundleConfig.cjs +554 -167
- package/dist/extractor/concatClassName.cjs +41 -29
- package/dist/extractor/createEvaluator.cjs +54 -41
- package/dist/extractor/createExtractor.cjs +1400 -581
- package/dist/extractor/createLogger.cjs +30 -25
- package/dist/extractor/detectModuleFormat.cjs +55 -0
- package/dist/extractor/ensureImportingConcat.cjs +31 -25
- package/dist/extractor/errors.cjs +12 -10
- package/dist/extractor/esbuildAliasPlugin.cjs +28 -16
- package/dist/extractor/esbuildTsconfigPaths.cjs +60 -36
- package/dist/extractor/evaluateAstNode.cjs +104 -59
- package/dist/extractor/extractHelpers.cjs +130 -67
- package/dist/extractor/extractMediaStyle.cjs +110 -69
- package/dist/extractor/extractToClassNames.cjs +337 -229
- package/dist/extractor/extractToNative.cjs +248 -154
- package/dist/extractor/findTopmostFunction.cjs +22 -13
- package/dist/extractor/generatedUid.cjs +39 -28
- package/dist/extractor/getPrefixLogs.cjs +12 -10
- package/dist/extractor/getPropValueFromAttributes.cjs +52 -34
- package/dist/extractor/getSourceModule.cjs +73 -37
- package/dist/extractor/getStaticBindingsForScope.cjs +131 -68
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +20 -14
- package/dist/extractor/hasTopLevelAwait.cjs +62 -0
- package/dist/extractor/hoistClassNames.cjs +46 -32
- package/dist/extractor/literalToAst.cjs +67 -42
- package/dist/extractor/loadFile.cjs +9 -3
- package/dist/extractor/loadTamagui.cjs +149 -104
- package/dist/extractor/logLines.cjs +27 -19
- package/dist/extractor/normalizeTernaries.cjs +66 -44
- package/dist/extractor/propsToFontFamilyCache.cjs +15 -11
- package/dist/extractor/regenerateConfig.cjs +109 -81
- package/dist/extractor/removeUnusedHooks.cjs +73 -41
- package/dist/extractor/timer.cjs +23 -14
- package/dist/extractor/validHTMLAttributes.cjs +61 -59
- package/dist/extractor/watchTamaguiConfig.cjs +35 -23
- package/dist/getPragmaOptions.cjs +38 -19
- package/dist/helpers/memoize.cjs +24 -16
- package/dist/helpers/requireTamaguiCore.cjs +22 -15
- package/dist/index.cjs +26 -24
- package/dist/registerRequire.cjs +167 -65
- package/dist/server.cjs +35 -28
- package/dist/types.cjs +7 -5
- package/dist/worker.cjs +62 -40
- package/package.json +26 -22
- package/src/checkDeps.ts +305 -68
- package/src/exports.ts +1 -0
- package/src/extractor/babelParse.ts +1 -0
- package/src/extractor/bundle.ts +140 -37
- package/src/extractor/bundleConfig.ts +435 -61
- package/src/extractor/createExtractor.ts +283 -48
- package/src/extractor/detectModuleFormat.ts +42 -0
- package/src/extractor/esbuildTsconfigPaths.ts +6 -1
- package/src/extractor/extractToClassNames.ts +15 -9
- package/src/extractor/extractToNative.ts +66 -33
- package/src/extractor/hasTopLevelAwait.ts +28 -0
- package/src/extractor/loadTamagui.ts +2 -2
- package/src/getPragmaOptions.ts +6 -1
- package/src/registerRequire.ts +88 -8
- package/types/checkDeps.d.ts.map +1 -1
- package/types/exports.d.ts +1 -0
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/babelParse.d.ts.map +1 -1
- package/types/extractor/bundle.d.ts +83 -1
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/bundleConfig.d.ts +15 -2
- package/types/extractor/bundleConfig.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/detectModuleFormat.d.ts +5 -0
- package/types/extractor/detectModuleFormat.d.ts.map +1 -0
- package/types/extractor/esbuildTsconfigPaths.d.ts +8 -0
- package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/types/extractor/extractToNative.d.ts.map +1 -1
- package/types/extractor/hasTopLevelAwait.d.ts +2 -0
- package/types/extractor/hasTopLevelAwait.d.ts.map +1 -0
- package/types/getPragmaOptions.d.ts.map +1 -1
- package/types/registerRequire.d.ts.map +1 -1
- package/dist/check-dep-versions.js +0 -389
- package/dist/check-dep-versions.js.map +0 -6
- package/dist/checkDeps.js +0 -60
- package/dist/checkDeps.js.map +0 -6
- package/dist/constants.js +0 -34
- package/dist/constants.js.map +0 -6
- package/dist/exports.js +0 -34
- package/dist/exports.js.map +0 -6
- package/dist/extractor/accessSafe.js +0 -47
- package/dist/extractor/accessSafe.js.map +0 -6
- package/dist/extractor/babelParse.js +0 -59
- package/dist/extractor/babelParse.js.map +0 -6
- package/dist/extractor/buildClassName.js +0 -72
- package/dist/extractor/buildClassName.js.map +0 -6
- package/dist/extractor/bundle.js +0 -135
- package/dist/extractor/bundle.js.map +0 -6
- package/dist/extractor/bundleConfig.js +0 -352
- package/dist/extractor/bundleConfig.js.map +0 -6
- package/dist/extractor/concatClassName.js +0 -69
- package/dist/extractor/concatClassName.js.map +0 -6
- package/dist/extractor/createEvaluator.js +0 -66
- package/dist/extractor/createEvaluator.js.map +0 -6
- package/dist/extractor/createExtractor.js +0 -1215
- package/dist/extractor/createExtractor.js.map +0 -6
- package/dist/extractor/createLogger.js +0 -32
- package/dist/extractor/createLogger.js.map +0 -6
- package/dist/extractor/ensureImportingConcat.js +0 -50
- package/dist/extractor/ensureImportingConcat.js.map +0 -6
- package/dist/extractor/errors.js +0 -22
- package/dist/extractor/errors.js.map +0 -6
- package/dist/extractor/esbuildAliasPlugin.js +0 -36
- package/dist/extractor/esbuildAliasPlugin.js.map +0 -6
- package/dist/extractor/esbuildTsconfigPaths.js +0 -79
- package/dist/extractor/esbuildTsconfigPaths.js.map +0 -6
- package/dist/extractor/evaluateAstNode.js +0 -99
- package/dist/extractor/evaluateAstNode.js.map +0 -6
- package/dist/extractor/extractHelpers.js +0 -108
- package/dist/extractor/extractHelpers.js.map +0 -6
- package/dist/extractor/extractMediaStyle.js +0 -123
- package/dist/extractor/extractMediaStyle.js.map +0 -6
- package/dist/extractor/extractToClassNames.js +0 -351
- package/dist/extractor/extractToClassNames.js.map +0 -6
- package/dist/extractor/extractToNative.js +0 -286
- package/dist/extractor/extractToNative.js.map +0 -6
- package/dist/extractor/findTopmostFunction.js +0 -32
- package/dist/extractor/findTopmostFunction.js.map +0 -6
- package/dist/extractor/generatedUid.js +0 -42
- package/dist/extractor/generatedUid.js.map +0 -6
- package/dist/extractor/getPrefixLogs.js +0 -24
- package/dist/extractor/getPrefixLogs.js.map +0 -6
- package/dist/extractor/getPropValueFromAttributes.js +0 -65
- package/dist/extractor/getPropValueFromAttributes.js.map +0 -6
- package/dist/extractor/getSourceModule.js +0 -62
- package/dist/extractor/getSourceModule.js.map +0 -6
- package/dist/extractor/getStaticBindingsForScope.js +0 -145
- package/dist/extractor/getStaticBindingsForScope.js.map +0 -6
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js +0 -32
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js.map +0 -6
- package/dist/extractor/hoistClassNames.js +0 -63
- package/dist/extractor/hoistClassNames.js.map +0 -6
- package/dist/extractor/literalToAst.js +0 -90
- package/dist/extractor/literalToAst.js.map +0 -6
- package/dist/extractor/loadFile.js +0 -14
- package/dist/extractor/loadFile.js.map +0 -6
- package/dist/extractor/loadTamagui.js +0 -306
- package/dist/extractor/loadTamagui.js.map +0 -6
- package/dist/extractor/logLines.js +0 -30
- package/dist/extractor/logLines.js.map +0 -6
- package/dist/extractor/normalizeTernaries.js +0 -61
- package/dist/extractor/normalizeTernaries.js.map +0 -6
- package/dist/extractor/propsToFontFamilyCache.js +0 -33
- package/dist/extractor/propsToFontFamilyCache.js.map +0 -6
- package/dist/extractor/regenerateConfig.js +0 -123
- package/dist/extractor/regenerateConfig.js.map +0 -6
- package/dist/extractor/removeUnusedHooks.js +0 -72
- package/dist/extractor/removeUnusedHooks.js.map +0 -6
- package/dist/extractor/timer.js +0 -38
- package/dist/extractor/timer.js.map +0 -6
- package/dist/extractor/validHTMLAttributes.js +0 -72
- package/dist/extractor/validHTMLAttributes.js.map +0 -6
- package/dist/extractor/watchTamaguiConfig.js +0 -57
- package/dist/extractor/watchTamaguiConfig.js.map +0 -6
- package/dist/getPragmaOptions.js +0 -46
- package/dist/getPragmaOptions.js.map +0 -6
- package/dist/helpers/memoize.js +0 -33
- package/dist/helpers/memoize.js.map +0 -6
- package/dist/helpers/requireTamaguiCore.js +0 -30
- package/dist/helpers/requireTamaguiCore.js.map +0 -6
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -6
- package/dist/registerRequire.js +0 -100
- package/dist/registerRequire.js.map +0 -6
- package/dist/server.js +0 -58
- package/dist/server.js.map +0 -6
- package/dist/setup.js +0 -1
- package/dist/setup.js.map +0 -6
- package/dist/types.js +0 -14
- package/dist/types.js.map +0 -6
- package/dist/worker.js +0 -72
- package/dist/worker.js.map +0 -6
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __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 extractToNative_exports = {};
|
|
24
|
-
__export(extractToNative_exports, {
|
|
25
|
-
extractToNative: () => extractToNative,
|
|
26
|
-
getBabelParseDefinition: () => getBabelParseDefinition,
|
|
27
|
-
getBabelPlugin: () => getBabelPlugin
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(extractToNative_exports);
|
|
30
|
-
var import_core = require("@babel/core"), import_generator = __toESM(require("@babel/generator")), import_helper_plugin_utils = require("@babel/helper-plugin-utils"), import_parser = require("@babel/parser"), import_template = __toESM(require("@babel/template")), t = __toESM(require("@babel/types")), import_node_path = require("node:path"), import_getPragmaOptions = require("../getPragmaOptions"), import_createExtractor = require("./createExtractor"), import_createLogger = require("./createLogger"), import_extractHelpers = require("./extractHelpers"), import_literalToAst = require("./literalToAst"), import_loadTamagui = require("./loadTamagui");
|
|
31
|
-
const importNativeView = (0, import_template.default)(`
|
|
32
|
-
const __ReactNativeView = require('react-native').View;
|
|
33
|
-
const __ReactNativeText = require('react-native').Text;
|
|
34
|
-
`), importStyleSheet = (0, import_template.default)(`
|
|
35
|
-
const __ReactNativeStyleSheet = require('react-native').StyleSheet;
|
|
36
|
-
`), importWithStyle = (0, import_template.default)(`
|
|
37
|
-
const __withStableStyle = require('@tamagui/core')._withStableStyle;
|
|
38
|
-
`), importReactUseMemo = (0, import_template.default)(`
|
|
39
|
-
const __ReactUseMemo = require('react').useMemo;
|
|
40
|
-
`), extractor = (0, import_createExtractor.createExtractor)({ platform: "native" });
|
|
41
|
-
let tamaguiBuildOptionsLoaded;
|
|
42
|
-
function extractToNative(sourceFileName, sourceCode, options) {
|
|
43
|
-
const ast = (0, import_parser.parse)(sourceCode, {
|
|
44
|
-
sourceType: "module",
|
|
45
|
-
plugins: ["jsx", "typescript"]
|
|
46
|
-
}), babelPlugin = getBabelPlugin(), out = (0, import_core.transformFromAstSync)(ast, sourceCode, {
|
|
47
|
-
plugins: [[babelPlugin, options]],
|
|
48
|
-
configFile: !1,
|
|
49
|
-
sourceFileName,
|
|
50
|
-
filename: sourceFileName
|
|
51
|
-
});
|
|
52
|
-
if (!out)
|
|
53
|
-
throw new Error("No output returned");
|
|
54
|
-
return out;
|
|
55
|
-
}
|
|
56
|
-
function getBabelPlugin() {
|
|
57
|
-
return (0, import_helper_plugin_utils.declare)((api, options) => (api.assertVersion(7), getBabelParseDefinition(options)));
|
|
58
|
-
}
|
|
59
|
-
function getBabelParseDefinition(options) {
|
|
60
|
-
return {
|
|
61
|
-
name: "tamagui",
|
|
62
|
-
visitor: {
|
|
63
|
-
Program: {
|
|
64
|
-
enter(root) {
|
|
65
|
-
let sourcePath = this.file.opts.filename;
|
|
66
|
-
if (sourcePath?.includes("node_modules") || !sourcePath?.endsWith(".jsx") && !sourcePath?.endsWith(".tsx"))
|
|
67
|
-
return;
|
|
68
|
-
process.env.SOURCE_ROOT?.endsWith("ios") && (sourcePath = sourcePath.replace("/ios", ""));
|
|
69
|
-
let hasImportedView = !1, hasImportedViewWrapper = !1, wrapperCount = 0;
|
|
70
|
-
const sheetStyles = {}, sheetIdentifier = root.scope.generateUidIdentifier("sheet"), firstCommentContents = (
|
|
71
|
-
// join because you can join together multiple pragmas
|
|
72
|
-
root.node.body[0]?.leadingComments?.map((comment) => comment?.value || " ").join(" ") ?? ""
|
|
73
|
-
), firstComment = firstCommentContents ? `//${firstCommentContents}` : "", { shouldPrintDebug, shouldDisable } = (0, import_getPragmaOptions.getPragmaOptions)({
|
|
74
|
-
source: firstComment,
|
|
75
|
-
path: sourcePath
|
|
76
|
-
});
|
|
77
|
-
if (shouldDisable)
|
|
78
|
-
return;
|
|
79
|
-
!options.config && !options.components && (tamaguiBuildOptionsLoaded ||= (0, import_loadTamagui.loadTamaguiBuildConfigSync)({}));
|
|
80
|
-
const finalOptions = {
|
|
81
|
-
// @ts-ignore just in case they leave it out
|
|
82
|
-
platform: "native",
|
|
83
|
-
...tamaguiBuildOptionsLoaded,
|
|
84
|
-
...options
|
|
85
|
-
}, printLog = (0, import_createLogger.createLogger)(sourcePath, finalOptions);
|
|
86
|
-
function addSheetStyle(style, node) {
|
|
87
|
-
let key = `${`${Object.keys(sheetStyles).length}`}`;
|
|
88
|
-
if (process.env.NODE_ENV === "development") {
|
|
89
|
-
const lineNumbers = node.loc ? node.loc.start.line + (node.loc.start.line !== node.loc.end.line ? `-${node.loc.end.line}` : "") : "";
|
|
90
|
-
key += `:${(0, import_node_path.basename)(sourcePath)}:${lineNumbers}`;
|
|
91
|
-
}
|
|
92
|
-
return sheetStyles[key] = style, readStyleExpr(key);
|
|
93
|
-
}
|
|
94
|
-
function readStyleExpr(key) {
|
|
95
|
-
return (0, import_template.default)("SHEET['KEY']")({
|
|
96
|
-
SHEET: sheetIdentifier.name,
|
|
97
|
-
KEY: key
|
|
98
|
-
}).expression;
|
|
99
|
-
}
|
|
100
|
-
let res;
|
|
101
|
-
try {
|
|
102
|
-
res = extractor.parseSync(root, {
|
|
103
|
-
importsWhitelist: ["constants.js", "colors.js"],
|
|
104
|
-
excludeProps: /* @__PURE__ */ new Set([
|
|
105
|
-
"className",
|
|
106
|
-
"userSelect",
|
|
107
|
-
"whiteSpace",
|
|
108
|
-
"textOverflow",
|
|
109
|
-
"cursor",
|
|
110
|
-
"contain"
|
|
111
|
-
]),
|
|
112
|
-
shouldPrintDebug,
|
|
113
|
-
...finalOptions,
|
|
114
|
-
// disable extracting variables as no native concept of them (only theme values)
|
|
115
|
-
disableExtractVariables: !1,
|
|
116
|
-
sourcePath,
|
|
117
|
-
// disabling flattening for now
|
|
118
|
-
// it's flattening a plain <Paragraph>hello</Paragraph> which breaks things because themes
|
|
119
|
-
// thinking it's not really worth the effort to do much compilation on native
|
|
120
|
-
// for now just disable flatten as it can only run in narrow places on native
|
|
121
|
-
// disableFlattening: 'styled',
|
|
122
|
-
getFlattenedNode({ isTextView }) {
|
|
123
|
-
return hasImportedView || (hasImportedView = !0, root.unshiftContainer("body", importNativeView())), isTextView ? "__ReactNativeText" : "__ReactNativeView";
|
|
124
|
-
},
|
|
125
|
-
onExtractTag(props) {
|
|
126
|
-
assertValidTag(props.node);
|
|
127
|
-
const stylesExpr = t.arrayExpression([]), hocStylesExpr = t.arrayExpression([]), expressions = [], finalAttrs = [], themeKeysUsed = /* @__PURE__ */ new Set();
|
|
128
|
-
function getStyleExpression(style) {
|
|
129
|
-
if (!style) return;
|
|
130
|
-
const { plain, themed } = splitThemeStyles(style);
|
|
131
|
-
let themeExpr = null;
|
|
132
|
-
if (themed) {
|
|
133
|
-
for (const key in themed)
|
|
134
|
-
themeKeysUsed.add(themed[key].split("$")[1]);
|
|
135
|
-
themeExpr = getThemedStyleExpression(themed);
|
|
136
|
-
}
|
|
137
|
-
const ident = addSheetStyle(plain, props.node);
|
|
138
|
-
return themeExpr ? (addStyleExpression(ident), addStyleExpression(ident, !0), themeExpr) : ident;
|
|
139
|
-
}
|
|
140
|
-
function addStyleExpression(expr, HOC = !1) {
|
|
141
|
-
Array.isArray(expr) ? (HOC ? hocStylesExpr : stylesExpr).elements.push(...expr) : (HOC ? hocStylesExpr : stylesExpr).elements.push(expr);
|
|
142
|
-
}
|
|
143
|
-
function getThemedStyleExpression(styles) {
|
|
144
|
-
const themedStylesAst = (0, import_literalToAst.literalToAst)(styles);
|
|
145
|
-
return themedStylesAst.properties.forEach((_) => {
|
|
146
|
-
const prop = _;
|
|
147
|
-
if (prop.value.type === "StringLiteral") {
|
|
148
|
-
const propVal = prop.value.value.slice(1), isComputed = !t.isValidIdentifier(propVal);
|
|
149
|
-
prop.value = t.callExpression(
|
|
150
|
-
t.memberExpression(
|
|
151
|
-
t.memberExpression(
|
|
152
|
-
t.identifier("theme"),
|
|
153
|
-
isComputed ? t.stringLiteral(propVal) : t.identifier(propVal),
|
|
154
|
-
isComputed
|
|
155
|
-
),
|
|
156
|
-
t.identifier("get")
|
|
157
|
-
),
|
|
158
|
-
[]
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
}), themedStylesAst;
|
|
162
|
-
}
|
|
163
|
-
let hasDynamicStyle = !1;
|
|
164
|
-
for (const attr of props.attrs)
|
|
165
|
-
switch (attr.type) {
|
|
166
|
-
case "style": {
|
|
167
|
-
let styleExpr = getStyleExpression(attr.value);
|
|
168
|
-
addStyleExpression(styleExpr), addStyleExpression(styleExpr, !0);
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
case "ternary": {
|
|
172
|
-
const { consequent, alternate } = attr.value, consExpr = getStyleExpression(consequent), altExpr = getStyleExpression(alternate);
|
|
173
|
-
expressions.push(attr.value.test), addStyleExpression(
|
|
174
|
-
t.conditionalExpression(
|
|
175
|
-
t.identifier(`_expressions[${expressions.length - 1}]`),
|
|
176
|
-
consExpr || t.nullLiteral(),
|
|
177
|
-
altExpr || t.nullLiteral()
|
|
178
|
-
),
|
|
179
|
-
!0
|
|
180
|
-
);
|
|
181
|
-
const styleExpr = t.conditionalExpression(
|
|
182
|
-
attr.value.test,
|
|
183
|
-
consExpr || t.nullLiteral(),
|
|
184
|
-
altExpr || t.nullLiteral()
|
|
185
|
-
);
|
|
186
|
-
addStyleExpression(styleExpr);
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
case "attr": {
|
|
190
|
-
t.isJSXSpreadAttribute(attr.value) && (0, import_extractHelpers.isSimpleSpread)(attr.value) && (stylesExpr.elements.push(
|
|
191
|
-
t.memberExpression(attr.value.argument, t.identifier("style"))
|
|
192
|
-
), hocStylesExpr.elements.push(
|
|
193
|
-
t.memberExpression(attr.value.argument, t.identifier("style"))
|
|
194
|
-
)), finalAttrs.push(attr.value);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if (props.node.attributes = finalAttrs, themeKeysUsed.size || hocStylesExpr.elements.length > 1 || hasDynamicStyle) {
|
|
199
|
-
hasImportedViewWrapper || (root.unshiftContainer("body", importWithStyle()), root.unshiftContainer("body", importReactUseMemo()), hasImportedViewWrapper = !0);
|
|
200
|
-
const name = props.flatNodeName || props.node.name.name, wrapperName = `_${name.replace(/^_+/, "")}Styled${wrapperCount++}`, WrapperIdentifier = t.identifier(wrapperName), WrapperJSXIdentifier = t.jsxIdentifier(wrapperName);
|
|
201
|
-
root.pushContainer(
|
|
202
|
-
"body",
|
|
203
|
-
t.variableDeclaration("const", [
|
|
204
|
-
t.variableDeclarator(
|
|
205
|
-
WrapperIdentifier,
|
|
206
|
-
t.callExpression(t.identifier("__withStableStyle"), [
|
|
207
|
-
t.identifier(name),
|
|
208
|
-
t.arrowFunctionExpression(
|
|
209
|
-
[t.identifier("theme"), t.identifier("_expressions")],
|
|
210
|
-
t.blockStatement([
|
|
211
|
-
t.returnStatement(
|
|
212
|
-
t.callExpression(t.identifier("__ReactUseMemo"), [
|
|
213
|
-
t.arrowFunctionExpression(
|
|
214
|
-
[],
|
|
215
|
-
t.blockStatement([
|
|
216
|
-
t.returnStatement(
|
|
217
|
-
t.arrayExpression([...hocStylesExpr.elements])
|
|
218
|
-
)
|
|
219
|
-
])
|
|
220
|
-
),
|
|
221
|
-
t.identifier("_expressions")
|
|
222
|
-
])
|
|
223
|
-
)
|
|
224
|
-
])
|
|
225
|
-
)
|
|
226
|
-
])
|
|
227
|
-
)
|
|
228
|
-
])
|
|
229
|
-
), props.node.name = WrapperJSXIdentifier, props.jsxPath.node.openingElement.name = WrapperJSXIdentifier, props.jsxPath.node.closingElement && (props.jsxPath.node.closingElement.name = t.jsxIdentifier(wrapperName)), expressions.length && props.node.attributes.push(
|
|
230
|
-
t.jsxAttribute(
|
|
231
|
-
t.jsxIdentifier("_expressions"),
|
|
232
|
-
t.jsxExpressionContainer(t.arrayExpression(expressions))
|
|
233
|
-
)
|
|
234
|
-
);
|
|
235
|
-
} else
|
|
236
|
-
props.node.attributes.push(
|
|
237
|
-
t.jsxAttribute(
|
|
238
|
-
t.jsxIdentifier("style"),
|
|
239
|
-
t.jsxExpressionContainer(
|
|
240
|
-
stylesExpr.elements.length === 1 ? stylesExpr.elements[0] : stylesExpr
|
|
241
|
-
)
|
|
242
|
-
)
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
} catch (err) {
|
|
247
|
-
if (err instanceof Error) {
|
|
248
|
-
let message = `${shouldPrintDebug === "verbose" ? err : err.message}`;
|
|
249
|
-
message.includes("Unexpected return value from visitor method") && (message = "Unexpected return value from visitor method"), console.warn("Error in Tamagui parse, skipping", message, err.stack);
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
if (!Object.keys(sheetStyles).length) {
|
|
254
|
-
shouldPrintDebug && console.info("END no styles"), res && printLog(res);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
const sheetObject = (0, import_literalToAst.literalToAst)(sheetStyles), sheetOuter = (0, import_template.default)(
|
|
258
|
-
"const SHEET = __ReactNativeStyleSheet.create(null)"
|
|
259
|
-
)({
|
|
260
|
-
SHEET: sheetIdentifier.name
|
|
261
|
-
});
|
|
262
|
-
sheetOuter.declarations[0].init.arguments[0] = sheetObject, root.unshiftContainer("body", sheetOuter), root.unshiftContainer("body", importStyleSheet()), shouldPrintDebug && (console.info(`
|
|
263
|
-
-------- output code -------
|
|
264
|
-
`), console.info(
|
|
265
|
-
(0, import_generator.default)(root.parent).code.split(`
|
|
266
|
-
`).filter((x) => !x.startsWith("//")).join(`
|
|
267
|
-
`)
|
|
268
|
-
)), res && printLog(res);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
function assertValidTag(node) {
|
|
275
|
-
node.attributes.find((x) => x.type === "JSXAttribute" && x.name.name === "style") && process.env.DEBUG?.startsWith("tamagui") && console.warn("\u26A0\uFE0F Cannot pass style attribute to extracted style");
|
|
276
|
-
}
|
|
277
|
-
function splitThemeStyles(style) {
|
|
278
|
-
const themed = {}, plain = {};
|
|
279
|
-
let noTheme = !0;
|
|
280
|
-
for (const key in style) {
|
|
281
|
-
const val = style[key];
|
|
282
|
-
val && val[0] === "$" ? (themed[key] = val, noTheme = !1) : plain[key] = val;
|
|
283
|
-
}
|
|
284
|
-
return { themed: noTheme ? null : themed, plain };
|
|
285
|
-
}
|
|
286
|
-
//# sourceMappingURL=extractToNative.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/extractor/extractToNative.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2D,wBAC3D,mBAAsB,sCACtB,6BAAwB,uCACxB,gBAAsB,0BACtB,kBAAqB,qCACrB,IAAmB,kCACnB,mBAAyB,sBACzB,0BAAiC,gCAEjC,yBAAgC,8BAChC,sBAA6B,2BAC7B,wBAA+B,6BAC/B,sBAA6B,2BAC7B,qBAA2C;AAE3C,MAAM,uBAAmB,gBAAAA,SAAS;AAAA;AAAA;AAAA,CAGjC,GAEK,uBAAmB,gBAAAA,SAAS;AAAA;AAAA,CAEjC,GAEK,sBAAkB,gBAAAA,SAAS;AAAA;AAAA,CAEhC,GAEK,yBAAqB,gBAAAA,SAAS;AAAA;AAAA,CAEnC,GAEK,gBAAY,wCAAgB,EAAE,UAAU,SAAS,CAAC;AAExD,I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I,KAAK,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,KAAK,SAAS,OAAO,KAG9E,QAAQ,IAAI,OAAO,WAAW,SAAS,KACzC,QAAQ,KAAK,6DAAmD;AAGtE;AAEA,SAAS,iBAAiB,OAAe;AACvC,QAAM,SAAiB,CAAC,GAClB,QAAgB,CAAC;AACvB,MAAI,UAAU;AACd,aAAW,OAAO,OAAO;AACvB,UAAM,MAAM,MAAM,GAAG;AACrB,IAAI,OAAO,IAAI,CAAC,MAAM,OACpB,OAAO,GAAG,IAAI,KACd,UAAU,MAEV,MAAM,GAAG,IAAI;AAAA,EAEjB;AACA,SAAO,EAAE,QAAQ,UAAU,OAAO,QAAQ,MAAM;AAClD;",
|
|
5
|
-
"names": ["template", "generator"]
|
|
6
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
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
|
|
@@ -1,6 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __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
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/extractor/generatedUid.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAQZ,SAAS,YAAY,OAAY,MAAsB;AAC5D,MAAM,OAAO,SAAU;AACrB,UAAM;AACR,MAAI,EAAE,OAAO,QAAS,YAAY,SAAS;AACzC,UAAM;AAER,SAAO,EACJ,aAAa,IAAI,EACjB,QAAQ,OAAO,EAAE,EACjB,QAAQ,YAAY,EAAE;AAEzB,MAAI,KACA,IAAI;AACR;AACE,IAAI,IAAI,IACN,MAAM,OAAO,IAEb,MAAM,MAER;AAAA,SAEA,MAAM,SAAS,GAAG,KAClB,MAAM,WAAW,GAAG,KACpB,MAAM,UAAU,GAAG,KACnB,MAAM,aAAa,GAAG;AAGxB,QAAM,UAAU,MAAM,iBAAiB;AACvC,iBAAQ,WAAW,GAAG,IAAI,IAC1B,QAAQ,KAAK,GAAG,IAAI,IAEb;AACT;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
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
|
-
var import_cli_color = require("@tamagui/cli-color");
|
|
21
|
-
function getPrefixLogs(options) {
|
|
22
|
-
return options?.prefixLogs ?? ` \u{1F425} [tamagui] ${(0, import_cli_color.colorString)(import_cli_color.Color.FgYellow, options?.platform || "web")}`;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=getPrefixLogs.js.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __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
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/extractor/getPropValueFromAttributes.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB,sCACrB,IAAmB,kCAEnB,oBAA2B;AAkBpB,SAAS,2BACd,UACA,OACqB;AACrB,MAAI,YAAY,IACZ,UAAiC;AACrC,WAAS,MAAM,IAAI,MAAM,MAAM,QAAQ,EAAE,MAAM,OAAO;AACpD,UAAM,OAAO,MAAM,GAAG;AACtB,QAAI,EAAE,eAAe,IAAI,KAAK,KAAK,QAAQ,KAAK,KAAK,SAAS,UAAU;AACtE,kBAAY,KACZ,UAAU;AACV;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW,QAAQ,SAAS;AAC/B,WAAO;AAGT,MAAI,YAMe,QAAQ;AAO3B,MALI,EAAE,yBAAyB,SAAS,MACtC,YAAY,UAAU,aAIpB,EAAE,qBAAqB,SAAS;AAClC,mBAAQ,MAAM,gCAAgC,GACvC;AAIT,QAAM,oBAAoB,MACvB;AAAA;AAAA;AAAA,IAGC,CAAC,MAAM,QAAsC;AAC3C,UAAI,EAAE,qBAAqB,IAAI,GAAG;AAChC,YAAI,EAAE,aAAa,KAAK,QAAQ,KAAK,EAAE,mBAAmB,KAAK,QAAQ;AACrE,iBAAO,MAAM;AAEf,YAAI,EAAE,oBAAoB,KAAK,QAAQ;AACrC,iBAAO;AAET,cAAM,IAAI;AAAA,UACR,+BAA+B,KAAK,SAAS,IAAI;AAAA,cAE/C,iBAAAA,SAAS,IAAW,EAAE,IACxB;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF,EACC,IAAI,CAAC,SAAS,KAAK,QAAQ;AAK9B,SAAI,kBAAkB,SAAS,MAC7B,YAAY,kBAAkB;AAAA,IAC5B,CAAC,KAAK,QAAQ,EAAE,kBAAkB,UAAM,8BAAW,KAAK,QAAQ,GAAG,GAAG;AAAA,IACtE;AAAA,EACF,IAGK;AACT;",
|
|
5
|
-
"names": ["generate"]
|
|
6
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __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 (t.isImportDefaultSpecifier(itemNode) || t.isImportSpecifier(itemNode))
|
|
35
|
-
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));
|
|
36
|
-
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) {
|
|
37
|
-
const firstArg = itemNode.init.arguments[0];
|
|
38
|
-
if (!t.isStringLiteral(firstArg))
|
|
39
|
-
return null;
|
|
40
|
-
if (sourceModule = firstArg.value, t.isIdentifier(itemNode.id))
|
|
41
|
-
local = itemNode.id.name, imported = itemNode.id.name, destructured = !1;
|
|
42
|
-
else if (t.isObjectPattern(itemNode.id)) {
|
|
43
|
-
for (const objProp of itemNode.id.properties)
|
|
44
|
-
if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.value) && objProp.value.name === itemName) {
|
|
45
|
-
local = objProp.value.name, imported = objProp.key.name, destructured = !0;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
if (!local || !imported)
|
|
49
|
-
return console.error("could not find prop with value `%s`", itemName), null;
|
|
50
|
-
} else
|
|
51
|
-
return console.error("Unhandled id type: %s", itemNode.id.type), null;
|
|
52
|
-
} else
|
|
53
|
-
return null;
|
|
54
|
-
return {
|
|
55
|
-
destructured,
|
|
56
|
-
imported,
|
|
57
|
-
local,
|
|
58
|
-
sourceModule,
|
|
59
|
-
usesImportSyntax
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=getSourceModule.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
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,CAAC,YAAY;AACf,WAAO;AAGT,MAAI,cACA,UACA,OACA,cACA,mBAAmB;AAEvB,QAAM,WAAW,YAAY,KAAK;AAElC,MAAI,EAAE,yBAAyB,QAAQ,KAAK,EAAE,kBAAkB,QAAQ;AACtE,IAAI,EAAE,oBAAoB,YAAY,KAAK,MAAM,MAC/C,eAAe,YAAY,KAAK,OAAO,OAAO,OAC9C,QAAQ,SAAS,MAAM,MACvB,mBAAmB,IACf,EAAE,kBAAkB,QAAQ,KAC9B,WAAW,SAAS,SAAS,MAC7B,eAAe,OAEf,WAAW,SAAS,MAAM,MAC1B,eAAe;AAAA,WAInB,EAAE,qBAAqB,QAAQ,KAC/B,SAAS,QAAQ,QACjB,EAAE,iBAA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