miaoda-expo-devkit 0.1.1-beta.48 → 0.1.1-beta.49

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/README.md CHANGED
@@ -10,7 +10,6 @@ Expo / React Native 开发环境工具集,通过 Metro 构建层注入以下
10
10
  - **expo-notifications stub** — Expo Go(Android)中提供 no-op 实现,核心 API 调用时弹出带参数校验的调试 Alert,Dev Build 透传真实模块
11
11
  - **expo-media-library stub** — Expo Go / Web 中提供 no-op 实现,`saveToLibraryAsync`、`createAssetAsync`、权限请求等 API 调用时弹出 Alert 提示,Dev Build 原生环境透传真实模块
12
12
  - **expo-calendar stub** — Expo Go / Web 中提供 no-op 实现,`getEventsAsync`、`createEventAsync`、`getCalendarsAsync`、权限请求等核心 API 调用时弹出 Alert 提示并校验参数,Dev Build 原生环境透传真实模块
13
- - **async-storage local repo 注入** — Expo Config Plugin,修复 `@react-native-async-storage/async-storage` v3.x 构建时找不到 `storage-android` AAR 的问题(上游 PR #1279 合并前的临时方案)
14
13
 
15
14
  ## 安装
16
15
 
@@ -31,26 +30,6 @@ pnpm install
31
30
 
32
31
  ## 使用
33
32
 
34
- ### Expo Config Plugin(async-storage v3)
35
-
36
- `@react-native-async-storage/async-storage` v3.x 将 `storage-android` AAR 打包在本地 `local_repo` 目录,未发布至 Maven Central,需在 `android/build.gradle` 中手动注册路径。此 Plugin 在 `expo prebuild` 时自动完成注入。
37
-
38
- 在 `app.json` 中注册:
39
-
40
- ```json
41
- {
42
- "expo": {
43
- "plugins": [
44
- "miaoda-expo-devkit/plugin-async-storage-local-repo"
45
- ]
46
- }
47
- }
48
- ```
49
-
50
- > 上游 PR [#1279](https://github.com/react-native-async-storage/async-storage/pull/1279) 合并并发版后可移除此 Plugin。
51
-
52
- ---
53
-
54
33
  ### Metro 配置
55
34
 
56
35
  ```js
@@ -309,7 +288,6 @@ sentry-react-native-stub.js
309
288
  | `./expo-notifications-stub` | `dist/stubs/expo-notifications-stub.js` | `expo-notifications` Expo Go Android stub |
310
289
  | `./expo-media-library-stub` | `dist/stubs/expo-media-library-stub.js` | `expo-media-library` Expo Go / Web stub |
311
290
  | `./expo-calendar-stub` | `dist/stubs/expo-calendar-stub.js` | `expo-calendar` Expo Go / Web stub |
312
- | `./plugin-async-storage-local-repo` | `dist/plugins/with-async-storage-local-repo.js` | Expo Config Plugin:注入 async-storage v3 本地 Maven 仓库路径 |
313
291
 
314
292
  ---
315
293
 
@@ -45,6 +45,9 @@ function findProjectRoot(startPath) {
45
45
  }
46
46
 
47
47
  // src/rules/no-undeclared-expo-plugin.ts
48
+ var PLUGIN_PACKAGE_ALIASES = /* @__PURE__ */ new Map([
49
+ ["@react-native-async-storage/async-storage", "@react-native-async-storage/expo-with-async-storage"]
50
+ ]);
48
51
  var KNOWN_CONFIG_PLUGIN_PACKAGES = /* @__PURE__ */ new Set([
49
52
  "expo-apple-authentication",
50
53
  "expo-asset",
@@ -122,7 +125,8 @@ var requireExpoPluginRule = {
122
125
  },
123
126
  schema: [],
124
127
  messages: {
125
- missingPlugin: "'{{packageName}}' has a config plugin but is not declared in app.json \u2192 expo.plugins."
128
+ missingPlugin: "'{{packageName}}' has a config plugin but is not declared in app.json \u2192 expo.plugins.",
129
+ missingAliasPlugin: "'{{importPackage}}' requires '{{pluginPackage}}' to be declared in app.json \u2192 expo.plugins."
126
130
  }
127
131
  },
128
132
  create(context) {
@@ -132,6 +136,19 @@ var requireExpoPluginRule = {
132
136
  function check(node, importPath) {
133
137
  const pkg = getPackageName(importPath);
134
138
  if (!pkg) return;
139
+ const aliasPlugin = PLUGIN_PACKAGE_ALIASES.get(pkg);
140
+ if (aliasPlugin !== void 0) {
141
+ if (declaredPlugins.includes(aliasPlugin)) return;
142
+ const reportKey2 = `${projectRoot}::${pkg}`;
143
+ if (reportedPackages.has(reportKey2)) return;
144
+ reportedPackages.add(reportKey2);
145
+ context.report({
146
+ node,
147
+ messageId: "missingAliasPlugin",
148
+ data: { importPackage: pkg, pluginPackage: aliasPlugin }
149
+ });
150
+ return;
151
+ }
135
152
  if (!KNOWN_CONFIG_PLUGIN_PACKAGES.has(pkg)) return;
136
153
  if (declaredPlugins.includes(pkg)) return;
137
154
  const reportKey = `${projectRoot}::${pkg}`;
@@ -46,6 +46,7 @@ function findProjectRoot(startPath) {
46
46
 
47
47
  // src/rules/no-unused-expo-plugin.ts
48
48
  var KNOWN_CONFIG_PLUGIN_PACKAGES = /* @__PURE__ */ new Set([
49
+ "@react-native-async-storage/expo-with-async-storage",
49
50
  "expo-apple-authentication",
50
51
  "expo-asset",
51
52
  "expo-audio",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-expo-devkit",
3
- "version": "0.1.1-beta.48",
3
+ "version": "0.1.1-beta.49",
4
4
  "description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -59,7 +59,6 @@
59
59
  "./rules/no-pressable-without-on-press": "./dist/rules/no-pressable-without-on-press.js",
60
60
  "./rules/no-expo-video-compat": "./dist/rules/no-expo-video-compat.js",
61
61
  "./rules/no-inline-box-shadow-string": "./dist/rules/no-inline-box-shadow-string.js",
62
- "./plugin-async-storage-local-repo": "./dist/plugins/with-async-storage-local-repo.js",
63
62
  "./biome": "./biome-config.json",
64
63
  "./oxlint": "./oxlint-config.json",
65
64
  "./tsconfig-base": "./tsconfig-base.json"
@@ -81,7 +80,6 @@
81
80
  "stacktrace-parser": "^0.1.11"
82
81
  },
83
82
  "peerDependencies": {
84
- "@expo/config-plugins": ">=8.0.0",
85
83
  "@sentry/core": "^10.38.0",
86
84
  "@sentry/react-native": ">=8.0.0",
87
85
  "metro": ">=0.80.0",
@@ -94,9 +92,6 @@
94
92
  "typescript": ">=5.0.0"
95
93
  },
96
94
  "peerDependenciesMeta": {
97
- "@expo/config-plugins": {
98
- "optional": true
99
- },
100
95
  "@sentry/core": {
101
96
  "optional": true
102
97
  },
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/plugins/with-async-storage-local-repo.ts
21
- var with_async_storage_local_repo_exports = {};
22
- __export(with_async_storage_local_repo_exports, {
23
- default: () => with_async_storage_local_repo_default
24
- });
25
- module.exports = __toCommonJS(with_async_storage_local_repo_exports);
26
- var import_config_plugins = require("@expo/config-plugins");
27
- var MAVEN_BLOCK = ` maven {
28
- // @react-native-async-storage/async-storage v3 \u5C06 storage-android AAR
29
- // \u6253\u5305\u5728\u672C\u5730 local_repo \u4E2D\uFF0C\u672A\u53D1\u5E03\u81F3 Maven Central\uFF0C\u9700\u624B\u52A8\u6CE8\u518C\u8DEF\u5F84\u3002
30
- // \u5F85\u4E0A\u6E38 PR #1279 \u5408\u5E76\u53D1\u7248\u540E\u53EF\u79FB\u9664\u6B64\u63D2\u4EF6\u3002
31
- url = uri("../node_modules/@react-native-async-storage/async-storage/android/local_repo")
32
- }`;
33
- var withAsyncStorageLocalRepo = (config) => {
34
- return (0, import_config_plugins.withProjectBuildGradle)(config, (config2) => {
35
- if (config2.modResults.contents.includes("async-storage/android/local_repo")) {
36
- return config2;
37
- }
38
- config2.modResults.contents = config2.modResults.contents.replace(
39
- /allprojects\s*\{[^}]*repositories\s*\{/,
40
- (match) => `${match}
41
- ${MAVEN_BLOCK}`
42
- );
43
- return config2;
44
- });
45
- };
46
- var with_async_storage_local_repo_default = withAsyncStorageLocalRepo;