miaoda-expo-devkit 0.1.1-beta.72 → 0.1.1-beta.74
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.
|
@@ -23,6 +23,7 @@ __export(plugin_jsx_source_exports, {
|
|
|
23
23
|
default: () => babelPluginJsxSource
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(plugin_jsx_source_exports);
|
|
26
|
+
var DEFAULT_EXCLUDE_PACKAGES = ["react-native-gifted-charts"];
|
|
26
27
|
var DATASET_PROP_NAME = "dataSet";
|
|
27
28
|
var MD_ID_KEY = "mdId";
|
|
28
29
|
var MD_CONTENT_KEY = "componentContent";
|
|
@@ -103,15 +104,34 @@ function shouldSkipElement(t, name) {
|
|
|
103
104
|
function babelPluginJsxSource({
|
|
104
105
|
types: t
|
|
105
106
|
}) {
|
|
107
|
+
let excludedIdentifiers;
|
|
106
108
|
return {
|
|
107
109
|
name: "babel-plugin-jsx-source",
|
|
108
110
|
visitor: {
|
|
111
|
+
Program(_path, state) {
|
|
112
|
+
excludedIdentifiers = /* @__PURE__ */ new Set();
|
|
113
|
+
const excludePackages = [
|
|
114
|
+
...DEFAULT_EXCLUDE_PACKAGES,
|
|
115
|
+
...state.opts.excludePackages || []
|
|
116
|
+
];
|
|
117
|
+
const programBody = _path.node.body;
|
|
118
|
+
for (const node of programBody) {
|
|
119
|
+
if (t.isImportDeclaration(node) && excludePackages.some((pkg) => node.source.value === pkg || node.source.value.startsWith(pkg + "/"))) {
|
|
120
|
+
for (const specifier of node.specifiers) {
|
|
121
|
+
excludedIdentifiers.add(specifier.local.name);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
109
126
|
JSXOpeningElement(path, state) {
|
|
110
127
|
const { opts, filename } = state;
|
|
111
128
|
if (!filename) return;
|
|
112
129
|
if (filename.includes("node_modules")) return;
|
|
113
130
|
if (opts.excludePaths?.some((p) => filename.includes(p))) return;
|
|
114
131
|
if (shouldSkipElement(t, path.node.name)) return;
|
|
132
|
+
const elementName = path.node.name;
|
|
133
|
+
if (t.isJSXIdentifier(elementName) && excludedIdentifiers.has(elementName.name)) return;
|
|
134
|
+
if (t.isJSXMemberExpression(elementName) && t.isJSXIdentifier(elementName.object) && excludedIdentifiers.has(elementName.object.name)) return;
|
|
115
135
|
const loc = path.node.loc;
|
|
116
136
|
if (!loc) return;
|
|
117
137
|
let filePath = filename;
|