miaoda-expo-devkit 0.1.1-beta.16 → 0.1.1-beta.18
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/cli/lint.js +2 -0
- package/dist/metro.d.mts +7 -6
- package/dist/metro.d.ts +7 -6
- package/dist/metro.js +15 -1
- package/dist/metro.mjs +15 -1
- package/dist/rules/no-duplicate-expo-router-url.js +1 -1
- package/dist/stubs/expo-notifications-stub.js +57 -0
- package/package.json +10 -3
- package/tsconfig-base.json +7 -0
package/dist/cli/lint.js
CHANGED
|
@@ -18,4 +18,6 @@ var biome = (0, import_node_child_process.spawnSync)("biome", ["lint", "--config
|
|
|
18
18
|
stdio: "inherit"
|
|
19
19
|
});
|
|
20
20
|
if ((biome.status ?? 1) !== 0) failed = true;
|
|
21
|
+
var tsc = (0, import_node_child_process.spawnSync)("tsc", ["--noEmit"], { stdio: "inherit" });
|
|
22
|
+
if ((tsc.status ?? 1) !== 0) failed = true;
|
|
21
23
|
process.exit(failed ? 1 : 0);
|
package/dist/metro.d.mts
CHANGED
|
@@ -132,12 +132,13 @@ declare function withRouteEndpoint(config: MetroConfig, options: RouteEndpointOp
|
|
|
132
132
|
* 将模板 metro.config.js 所需的所有 devkit wrapper 封装为单个函数调用,
|
|
133
133
|
* 消除模板侧的 boilerplate。内部按固定顺序依次应用:
|
|
134
134
|
*
|
|
135
|
-
* withWorkspaceNodeModules
|
|
136
|
-
* withCssInterop
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
135
|
+
* withWorkspaceNodeModules — 修复沙箱中 node_modules 不在 projectRoot 内的问题
|
|
136
|
+
* withCssInterop — 为 expo-image / expo-camera 注入 NativeWind cssInterop
|
|
137
|
+
* withExpoNotificationsStub — Android:expo-notifications → stub(Expo Go no-op,Dev Build 透传)
|
|
138
|
+
* withEntryInjection — 在 expo-router 启动前注入脚本(仅 __DEV__)
|
|
139
|
+
* withDevStubs — 替换 Sentry DSN / 屏蔽 LogBox(仅 __DEV__)
|
|
140
|
+
* withRouteEndpoint — 添加 /__routes 端点(仅 __DEV__)
|
|
141
|
+
* withNativeWind — NativeWind 支持(含缓存路径修复)
|
|
141
142
|
*
|
|
142
143
|
* 用法(metro.config.js):
|
|
143
144
|
* const { getDefaultConfig } = require('expo/metro-config');
|
package/dist/metro.d.ts
CHANGED
|
@@ -132,12 +132,13 @@ declare function withRouteEndpoint(config: MetroConfig, options: RouteEndpointOp
|
|
|
132
132
|
* 将模板 metro.config.js 所需的所有 devkit wrapper 封装为单个函数调用,
|
|
133
133
|
* 消除模板侧的 boilerplate。内部按固定顺序依次应用:
|
|
134
134
|
*
|
|
135
|
-
* withWorkspaceNodeModules
|
|
136
|
-
* withCssInterop
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
135
|
+
* withWorkspaceNodeModules — 修复沙箱中 node_modules 不在 projectRoot 内的问题
|
|
136
|
+
* withCssInterop — 为 expo-image / expo-camera 注入 NativeWind cssInterop
|
|
137
|
+
* withExpoNotificationsStub — Android:expo-notifications → stub(Expo Go no-op,Dev Build 透传)
|
|
138
|
+
* withEntryInjection — 在 expo-router 启动前注入脚本(仅 __DEV__)
|
|
139
|
+
* withDevStubs — 替换 Sentry DSN / 屏蔽 LogBox(仅 __DEV__)
|
|
140
|
+
* withRouteEndpoint — 添加 /__routes 端点(仅 __DEV__)
|
|
141
|
+
* withNativeWind — NativeWind 支持(含缓存路径修复)
|
|
141
142
|
*
|
|
142
143
|
* 用法(metro.config.js):
|
|
143
144
|
* const { getDefaultConfig } = require('expo/metro-config');
|
package/dist/metro.js
CHANGED
|
@@ -299,13 +299,27 @@ function withEsbuildMinify(config) {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
// src/metro/withDevkit.ts
|
|
302
|
+
var EXPO_NOTIFICATIONS_STUB_FILENAME = "expo-notifications-stub.js";
|
|
303
|
+
var EXPO_NOTIFICATIONS_STUB_PATH = import_path7.default.resolve(__dirname, "stubs", EXPO_NOTIFICATIONS_STUB_FILENAME);
|
|
304
|
+
function withExpoNotificationsStub(config) {
|
|
305
|
+
const upstream = config.resolver?.resolveRequest ?? null;
|
|
306
|
+
const resolveRequest = (context, moduleName, platform) => {
|
|
307
|
+
if (platform === "android" && moduleName === "expo-notifications" && !context.originModulePath.includes(EXPO_NOTIFICATIONS_STUB_FILENAME)) {
|
|
308
|
+
return { filePath: EXPO_NOTIFICATIONS_STUB_PATH, type: "sourceFile" };
|
|
309
|
+
}
|
|
310
|
+
if (upstream) return upstream(context, moduleName, platform);
|
|
311
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
312
|
+
};
|
|
313
|
+
return { ...config, resolver: { ...config.resolver, resolveRequest } };
|
|
314
|
+
}
|
|
302
315
|
function withDevkit(config, options = {}) {
|
|
303
316
|
const projectRoot = config.projectRoot ?? process.cwd();
|
|
304
317
|
const { input = "./src/global.css" } = options;
|
|
305
318
|
config = withWorkspaceNodeModules(config);
|
|
306
319
|
config = withCssInterop(config);
|
|
307
320
|
config = withEsbuildMinify(config);
|
|
308
|
-
|
|
321
|
+
config = withExpoNotificationsStub(config);
|
|
322
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
309
323
|
config = withEntryInjection(config);
|
|
310
324
|
config = withDevStubs(config);
|
|
311
325
|
config = withRouteEndpoint(config, { appDir: import_path7.default.join(projectRoot, "src", "app") });
|
package/dist/metro.mjs
CHANGED
|
@@ -262,13 +262,27 @@ function withEsbuildMinify(config) {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
// src/metro/withDevkit.ts
|
|
265
|
+
var EXPO_NOTIFICATIONS_STUB_FILENAME = "expo-notifications-stub.js";
|
|
266
|
+
var EXPO_NOTIFICATIONS_STUB_PATH = path7.resolve(__dirname, "stubs", EXPO_NOTIFICATIONS_STUB_FILENAME);
|
|
267
|
+
function withExpoNotificationsStub(config) {
|
|
268
|
+
const upstream = config.resolver?.resolveRequest ?? null;
|
|
269
|
+
const resolveRequest = (context, moduleName, platform) => {
|
|
270
|
+
if (platform === "android" && moduleName === "expo-notifications" && !context.originModulePath.includes(EXPO_NOTIFICATIONS_STUB_FILENAME)) {
|
|
271
|
+
return { filePath: EXPO_NOTIFICATIONS_STUB_PATH, type: "sourceFile" };
|
|
272
|
+
}
|
|
273
|
+
if (upstream) return upstream(context, moduleName, platform);
|
|
274
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
275
|
+
};
|
|
276
|
+
return { ...config, resolver: { ...config.resolver, resolveRequest } };
|
|
277
|
+
}
|
|
265
278
|
function withDevkit(config, options = {}) {
|
|
266
279
|
const projectRoot = config.projectRoot ?? process.cwd();
|
|
267
280
|
const { input = "./src/global.css" } = options;
|
|
268
281
|
config = withWorkspaceNodeModules(config);
|
|
269
282
|
config = withCssInterop(config);
|
|
270
283
|
config = withEsbuildMinify(config);
|
|
271
|
-
|
|
284
|
+
config = withExpoNotificationsStub(config);
|
|
285
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
272
286
|
config = withEntryInjection(config);
|
|
273
287
|
config = withDevStubs(config);
|
|
274
288
|
config = withRouteEndpoint(config, { appDir: path7.join(projectRoot, "src", "app") });
|
|
@@ -103,7 +103,7 @@ var noDuplicateExpoRouterUrlRule = {
|
|
|
103
103
|
},
|
|
104
104
|
create(context) {
|
|
105
105
|
return {
|
|
106
|
-
Program(
|
|
106
|
+
Program() {
|
|
107
107
|
const projectRoot = findProjectRoot(context.filename);
|
|
108
108
|
if (!projectRoot) return;
|
|
109
109
|
const routerRoot = getRouterRoot(projectRoot);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_expo = require("expo");
|
|
3
|
+
var import_react_native = require("react-native");
|
|
4
|
+
if (!(0, import_expo.isRunningInExpoGo)()) {
|
|
5
|
+
module.exports = require("expo-notifications");
|
|
6
|
+
} else {
|
|
7
|
+
let _alertShown = false;
|
|
8
|
+
const showAlert = () => {
|
|
9
|
+
if (_alertShown) return;
|
|
10
|
+
_alertShown = true;
|
|
11
|
+
import_react_native.Alert.alert(
|
|
12
|
+
"\u79D2\u54D2\u901A\u77E5",
|
|
13
|
+
"\u53D7Android\u5E73\u53F0\u9650\u5236, \u626B\u7801\u4F53\u9A8C\u4E0D\u652F\u6301\u672C\u5730\u901A\u77E5\u3002\n\n \u6682\u65F6\u65E0\u6CD5\u5B8C\u6574\u9A8C\u8BC1\u6B64\u529F\u80FD",
|
|
14
|
+
[{ text: "\u77E5\u9053\u4E86" }]
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
const DENIED_PERMISSION = { status: "denied", granted: false, canAskAgain: false, expires: "never" };
|
|
18
|
+
const noopPermission = async () => {
|
|
19
|
+
showAlert();
|
|
20
|
+
return DENIED_PERMISSION;
|
|
21
|
+
};
|
|
22
|
+
const noopListener = () => {
|
|
23
|
+
showAlert();
|
|
24
|
+
return { remove: () => {
|
|
25
|
+
} };
|
|
26
|
+
};
|
|
27
|
+
const noop = async () => {
|
|
28
|
+
showAlert();
|
|
29
|
+
};
|
|
30
|
+
const enums = {
|
|
31
|
+
AndroidNotificationPriority: {
|
|
32
|
+
MIN: "min",
|
|
33
|
+
LOW: "low",
|
|
34
|
+
DEFAULT: "default",
|
|
35
|
+
HIGH: "high",
|
|
36
|
+
MAX: "max"
|
|
37
|
+
},
|
|
38
|
+
AndroidImportance: { NONE: 0, MIN: 1, LOW: 2, DEFAULT: 3, HIGH: 4, MAX: 5 },
|
|
39
|
+
SchedulableTriggerInputTypes: {
|
|
40
|
+
DATE: "date",
|
|
41
|
+
TIME_INTERVAL: "timeInterval",
|
|
42
|
+
CALENDAR: "calendar",
|
|
43
|
+
DAILY: "daily",
|
|
44
|
+
WEEKLY: "weekly",
|
|
45
|
+
YEARLY: "yearly"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
module.exports = new Proxy(enums, {
|
|
49
|
+
get(target, key) {
|
|
50
|
+
if (key in target) return target[key];
|
|
51
|
+
if (key.endsWith("PermissionsAsync")) return noopPermission;
|
|
52
|
+
if (key.endsWith("Listener")) return noopListener;
|
|
53
|
+
return noop;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=expo-notifications-stub.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miaoda-expo-devkit",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.18",
|
|
4
4
|
"description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"./sentry-react-native-stub": "./dist/stubs/sentry-react-native-stub.js",
|
|
42
42
|
"./no-op-logbox": "./dist/stubs/no-op-logbox.js",
|
|
43
|
+
"./expo-notifications-stub": "./dist/stubs/expo-notifications-stub.js",
|
|
43
44
|
"./rules/no-undeclared-expo-plugin": "./dist/rules/no-undeclared-expo-plugin.js",
|
|
44
45
|
"./rules/no-unused-expo-plugin": "./dist/rules/no-unused-expo-plugin.js",
|
|
45
46
|
"./rules/no-unstable-expo-router": "./dist/rules/no-unstable-expo-router.js",
|
|
@@ -47,13 +48,15 @@
|
|
|
47
48
|
"./rules/no-duplicate-expo-router-url": "./dist/rules/no-duplicate-expo-router-url.js",
|
|
48
49
|
"./rules/no-missing-css-import": "./dist/rules/no-missing-css-import.js",
|
|
49
50
|
"./biome": "./biome-config.json",
|
|
50
|
-
"./oxlint": "./oxlint-config.json"
|
|
51
|
+
"./oxlint": "./oxlint-config.json",
|
|
52
|
+
"./tsconfig-base": "./tsconfig-base.json"
|
|
51
53
|
},
|
|
52
54
|
"files": [
|
|
53
55
|
"dist",
|
|
54
56
|
"biome-config.json",
|
|
55
57
|
"oxlint-config.json",
|
|
56
58
|
"pnpm-config.json",
|
|
59
|
+
"tsconfig-base.json",
|
|
57
60
|
"!dist/**/*.map"
|
|
58
61
|
],
|
|
59
62
|
"scripts": {
|
|
@@ -82,7 +85,8 @@
|
|
|
82
85
|
"metro-resolver": ">=0.80.0",
|
|
83
86
|
"nativewind": ">=4.0.0",
|
|
84
87
|
"react-native": ">=0.79.0",
|
|
85
|
-
"react-native-css-interop": ">=0.2.0"
|
|
88
|
+
"react-native-css-interop": ">=0.2.0",
|
|
89
|
+
"typescript": ">=5.0.0"
|
|
86
90
|
},
|
|
87
91
|
"peerDependenciesMeta": {
|
|
88
92
|
"@sentry/core": {
|
|
@@ -105,6 +109,9 @@
|
|
|
105
109
|
},
|
|
106
110
|
"react-native-css-interop": {
|
|
107
111
|
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"typescript": {
|
|
114
|
+
"optional": true
|
|
108
115
|
}
|
|
109
116
|
},
|
|
110
117
|
"publishConfig": {
|