miaoda-expo-devkit 0.1.1-beta.73 → 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.
@@ -37,6 +37,8 @@ interface JsxSourcePluginOptions {
37
37
  rootDir?: string;
38
38
  /** 需要跳过注入的路径模式列表(相对于 rootDir 的路径片段) */
39
39
  excludePaths?: string[];
40
+ /** 需要跳过注入的包名列表,从这些包导入的组件不会被注入 */
41
+ excludePackages?: string[];
40
42
  }
41
43
  /**
42
44
  * Babel 插件:为 JSX 元素注入 dataSet
@@ -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;
package/dist/metro.js CHANGED
@@ -616,14 +616,16 @@ function withPersistentCache(config, options = {}) {
616
616
  return {
617
617
  ...config,
618
618
  // transform cache:JS/TS 编译结果
619
- cacheStores: [new StoreClass({ root: cacheRoot })]
620
- // FileMap cache 暂时禁用:pnpm install 每次重建 symlink 导致 30839 fake changes,
621
- // 加载旧缓存反而比冷启动更慢,触发 120s 超时。
622
- // fileMapCacheDirectory: cacheRoot,
623
- // watcher: {
624
- // ...config.watcher,
625
- // unstable_autoSaveCache: { enabled: true },
626
- // },
619
+ cacheStores: [new StoreClass({ root: cacheRoot })],
620
+ // FileMap cache:文件系统索引快照 + Watchman clock
621
+ // transform cache 放同一目录,文件名由 Metro 按 projectRoot+config hash 自动区分
622
+ fileMapCacheDirectory: cacheRoot,
623
+ watcher: {
624
+ ...config.watcher,
625
+ // 运行时文件变化后自动将 FileMap cache 写回磁盘(debounce 5s)
626
+ // 保证进程意外退出后下次启动仍能命中缓存
627
+ unstable_autoSaveCache: { enabled: true }
628
+ }
627
629
  };
628
630
  }
629
631
 
package/dist/metro.mjs CHANGED
@@ -567,14 +567,16 @@ function withPersistentCache(config, options = {}) {
567
567
  return {
568
568
  ...config,
569
569
  // transform cache:JS/TS 编译结果
570
- cacheStores: [new StoreClass({ root: cacheRoot })]
571
- // FileMap cache 暂时禁用:pnpm install 每次重建 symlink 导致 30839 fake changes,
572
- // 加载旧缓存反而比冷启动更慢,触发 120s 超时。
573
- // fileMapCacheDirectory: cacheRoot,
574
- // watcher: {
575
- // ...config.watcher,
576
- // unstable_autoSaveCache: { enabled: true },
577
- // },
570
+ cacheStores: [new StoreClass({ root: cacheRoot })],
571
+ // FileMap cache:文件系统索引快照 + Watchman clock
572
+ // transform cache 放同一目录,文件名由 Metro 按 projectRoot+config hash 自动区分
573
+ fileMapCacheDirectory: cacheRoot,
574
+ watcher: {
575
+ ...config.watcher,
576
+ // 运行时文件变化后自动将 FileMap cache 写回磁盘(debounce 5s)
577
+ // 保证进程意外退出后下次启动仍能命中缓存
578
+ unstable_autoSaveCache: { enabled: true }
579
+ }
578
580
  };
579
581
  }
580
582
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-expo-devkit",
3
- "version": "0.1.1-beta.73",
3
+ "version": "0.1.1-beta.74",
4
4
  "description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",