miaoda-expo-devkit 0.1.1-beta.99 → 0.1.1-dev.development-build.2
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 +163 -111
- package/dist/babel/plugin-lucide-react-native.js +185 -185
- package/dist/cli/lint.js +317 -309
- package/dist/index.d.mts +1 -110
- package/dist/index.d.ts +1 -110
- package/dist/index.js +0 -159
- package/dist/index.mjs +0 -132
- package/dist/metro.d.mts +25 -5
- package/dist/metro.d.ts +25 -5
- package/dist/metro.js +49 -18
- package/dist/metro.mjs +50 -20
- package/dist/rules/no-bare-web-crypto.js +235 -0
- package/dist/rules/no-expo-audio-compat.js +90 -90
- package/dist/rules/no-expo-file-system-compat.js +2130 -0
- package/dist/rules/no-expo-video-compat.js +90 -90
- package/dist/rules/no-lucide-star-import.js +78 -0
- package/dist/rules/no-sentry-default-import.js +83 -0
- package/dist/rules/no-typeof-window-check.js +85 -0
- package/dist/stubs/entry-inject.js +0 -2
- package/dist/stubs/expo-native-wechat-stub.js +116 -0
- package/dist/stubs/expo-router-entry-native-stub.js +4 -0
- package/dist/stubs/i18n/en.js +16 -1
- package/dist/stubs/i18n/zh.js +16 -1
- package/dist/stubs/logbox-control.js +9 -0
- package/dist/stubs/screenshot-control.js +1 -1
- package/dist/stubs/sentry-react-native-stub.js +15 -180
- package/oxlint-config.json +20 -5
- package/package.json +65 -5
- package/pnpm-patches/@expo__cli@55.0.16-55.0.22.patch +712 -0
- package/pnpm-patches/@expo__cli@55.0.16.patch +218 -0
- package/pnpm-patches/@expo__cli@55.0.17.patch +218 -0
- package/pnpm-patches/@expo__cli@55.0.18.patch +218 -0
- package/pnpm-patches/@expo__cli@55.0.19.patch +218 -0
- package/pnpm-patches/@expo__cli@55.0.20.patch +218 -0
- package/pnpm-patches/@expo__cli@55.0.21.patch +218 -0
- package/pnpm-patches/@expo__cli@55.0.22.patch +218 -0
- package/pnpm-patches/@shopify__react-native-skia@2.4.18.patch +14 -0
- package/pnpm-patches/expo-modules-core@55.0.15.patch +21 -0
- package/pnpm-patches/expo@55.0.6.patch +283 -0
- package/pnpm-patches/metro-file-map@0.83.3.patch +28 -0
- package/pnpm-patches/metro-runtime@0.83.3.patch +17 -0
- package/pnpm-patches/react-native-css-interop@0.2.6.patch +12 -0
- package/pnpm-patches/react-native-reanimated@4.2.1.patch +53 -0
- package/pnpm-patches/react-native-worklets@0.7.2.patch +91 -0
- package/pnpm-patches/react-native-worklets@0.7.4.patch +91 -0
- package/pnpm-patches/react-native@0.83.2.patch +384 -0
- package/pnpmfile.cjs +251 -0
- package/dist/stubs/preview-control.js +0 -60
package/pnpmfile.cjs
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
const crypto = require('node:crypto');
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
|
|
5
|
+
const MAX_VIRTUAL_STORE_DIR_LENGTH = 50;
|
|
6
|
+
const EXPO_CLI_PATCH_SELECTOR = '@expo/cli@>=55.0.16 <55.0.23';
|
|
7
|
+
const REACT_NATIVE_PATCH_SELECTOR = 'react-native@0.83.2';
|
|
8
|
+
const { blockedPackages = [] } = require('./pnpm-config.json');
|
|
9
|
+
|
|
10
|
+
const managedPatches = {
|
|
11
|
+
[REACT_NATIVE_PATCH_SELECTOR]: {
|
|
12
|
+
filename: 'react-native@0.83.2.patch',
|
|
13
|
+
legacyHashes: new Set([
|
|
14
|
+
'bc87e66a7a5c2e0fbe5d1be5c20d1c6b8456e84ea287a1acb15202264b4f2c37',
|
|
15
|
+
'c03c7638b6393e9876df08f7e9160a9122f00d6e1f1e76e8f4adb4cba3c3b539',
|
|
16
|
+
]),
|
|
17
|
+
},
|
|
18
|
+
[EXPO_CLI_PATCH_SELECTOR]: {
|
|
19
|
+
filename: '@expo__cli@55.0.16-55.0.22.patch',
|
|
20
|
+
legacyHashes: new Set([
|
|
21
|
+
'98c96a6bae56f47c0a47efe9a68e7a6751022d812b569b68d03b93753635c32c',
|
|
22
|
+
'9a0d662675fba8088396c6cdbab7d36d81fbe9acb3727144a50826ff3500b093',
|
|
23
|
+
]),
|
|
24
|
+
},
|
|
25
|
+
'metro-runtime@0.83.3': {
|
|
26
|
+
filename: 'metro-runtime@0.83.3.patch',
|
|
27
|
+
legacyHashes: new Set([
|
|
28
|
+
'bd14ae6037bcf49028607c01caf67d4bd03e543460609a62e72647664c27b242',
|
|
29
|
+
]),
|
|
30
|
+
},
|
|
31
|
+
'metro-file-map@0.83.3': {
|
|
32
|
+
filename: 'metro-file-map@0.83.3.patch',
|
|
33
|
+
legacyHashes: new Set([
|
|
34
|
+
'41bc590f22f0e8ba73f090394db218bbb9c808a1eafdc70bfb746abbd3017b3b',
|
|
35
|
+
]),
|
|
36
|
+
},
|
|
37
|
+
'@shopify/react-native-skia@2.4.18': {
|
|
38
|
+
filename: '@shopify__react-native-skia@2.4.18.patch',
|
|
39
|
+
legacyHashes: new Set([
|
|
40
|
+
'daf0050c82cb2494564e4244a4f5cd06787ee8817b054903f9e1e5eb0d734fa0',
|
|
41
|
+
]),
|
|
42
|
+
},
|
|
43
|
+
'expo-modules-core@55.0.15': {
|
|
44
|
+
filename: 'expo-modules-core@55.0.15.patch',
|
|
45
|
+
legacyHashes: new Set([
|
|
46
|
+
'77aed95955570699b427770e962fe49168c03e900577e28b717afcc56c084dca',
|
|
47
|
+
]),
|
|
48
|
+
},
|
|
49
|
+
'expo@55.0.6': {
|
|
50
|
+
filename: 'expo@55.0.6.patch',
|
|
51
|
+
legacyHashes: new Set([
|
|
52
|
+
'8ac63998a9852ddafda7af96deb4d7ac4c3a5da5e65e865af32be9d4fd966e02',
|
|
53
|
+
'12efbb4c64bc67744a838cc5d9d88604ad2a99cdd578a5cfab31b8d1c2be1144',
|
|
54
|
+
'd2507f55976f6c5da8f35d26906f4bd46415e042570afc3bd7c543c86abc5a61',
|
|
55
|
+
'5dda484d5acb6475495587d96c8cbae5bc7514a5781159c92faa9637e6e257ec',
|
|
56
|
+
]),
|
|
57
|
+
},
|
|
58
|
+
'react-native-css-interop@0.2.6': {
|
|
59
|
+
filename: 'react-native-css-interop@0.2.6.patch',
|
|
60
|
+
legacyHashes: new Set([
|
|
61
|
+
'c703e879e4691574bf5e47d743a9a33846b3145149f2398c3bbd6ed835575635',
|
|
62
|
+
]),
|
|
63
|
+
},
|
|
64
|
+
'react-native-reanimated@4.2.1': {
|
|
65
|
+
filename: 'react-native-reanimated@4.2.1.patch',
|
|
66
|
+
legacyHashes: new Set([
|
|
67
|
+
'b2c55038b2fa525ad5e84bd4940ddd2b7298b559de2d0d1709f32ced57e929e9',
|
|
68
|
+
]),
|
|
69
|
+
},
|
|
70
|
+
'react-native@0.83.2': {
|
|
71
|
+
filename: 'react-native@0.83.2.patch',
|
|
72
|
+
legacyHashes: new Set(),
|
|
73
|
+
},
|
|
74
|
+
'react-native-worklets@0.7.4': {
|
|
75
|
+
filename: 'react-native-worklets@0.7.4.patch',
|
|
76
|
+
legacyHashes: new Set([
|
|
77
|
+
'8fee2c39a582a0ec150a3fd5af632fba6736dc03565763d21376b54820fe6668',
|
|
78
|
+
'd9e02591e77a9f510e215ce273330381f81c68659c5736374f33e231d0bc9611',
|
|
79
|
+
]),
|
|
80
|
+
},
|
|
81
|
+
'react-native-worklets@0.7.2': {
|
|
82
|
+
filename: 'react-native-worklets@0.7.2.patch',
|
|
83
|
+
legacyHashes: new Set([
|
|
84
|
+
'8fee2c39a582a0ec150a3fd5af632fba6736dc03565763d21376b54820fe6668',
|
|
85
|
+
'd9e02591e77a9f510e215ce273330381f81c68659c5736374f33e231d0bc9611',
|
|
86
|
+
]),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const legacyPatchSelectors = new Set([
|
|
91
|
+
'@shopify/react-native-skia@2.4.18',
|
|
92
|
+
'react-native-css-interop@0.2.6',
|
|
93
|
+
'react-native-worklets@0.7.2',
|
|
94
|
+
]);
|
|
95
|
+
|
|
96
|
+
function getPatchHash(patchPath) {
|
|
97
|
+
return crypto.createHash('sha256').update(fs.readFileSync(patchPath)).digest('hex');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function resolveProjectPatchPath(config, patchPath) {
|
|
101
|
+
if (path.isAbsolute(patchPath)) return patchPath;
|
|
102
|
+
|
|
103
|
+
return path.resolve(getProjectRoot(config), patchPath);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function getProjectRoot(config) {
|
|
107
|
+
return config.lockfileDir || config.dir || process.cwd();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function getBundledPatchPath(config, filename) {
|
|
111
|
+
const configDependencyPath = path.join(
|
|
112
|
+
getProjectRoot(config),
|
|
113
|
+
'node_modules',
|
|
114
|
+
'.pnpm-config',
|
|
115
|
+
'miaoda-expo-devkit',
|
|
116
|
+
'pnpm-patches',
|
|
117
|
+
filename,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
if (fs.existsSync(configDependencyPath)) return configDependencyPath;
|
|
121
|
+
return path.join(__dirname, 'pnpm-patches', filename);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function projectRequestsLegacySelector(config, selector) {
|
|
125
|
+
const at = selector.lastIndexOf('@');
|
|
126
|
+
if (at <= 0) return false;
|
|
127
|
+
const name = selector.slice(0, at);
|
|
128
|
+
const version = selector.slice(at + 1);
|
|
129
|
+
const projectRoot = getProjectRoot(config);
|
|
130
|
+
const manifests = [path.join(projectRoot, 'package.json')];
|
|
131
|
+
for (const directory of ['template', 'packages']) {
|
|
132
|
+
const candidate = path.join(projectRoot, directory);
|
|
133
|
+
if (!fs.existsSync(candidate)) continue;
|
|
134
|
+
for (const entry of fs.readdirSync(candidate, { withFileTypes: true })) {
|
|
135
|
+
if (entry.isDirectory()) manifests.push(path.join(candidate, entry.name, 'package.json'));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
for (const manifest of manifests) {
|
|
139
|
+
try {
|
|
140
|
+
const packageJson = JSON.parse(fs.readFileSync(manifest, 'utf8'));
|
|
141
|
+
for (const section of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
142
|
+
for (const [dependency, spec] of Object.entries(packageJson[section] ?? {})) {
|
|
143
|
+
if (typeof spec !== 'string') continue;
|
|
144
|
+
if (
|
|
145
|
+
(dependency === name || spec.includes(name)) &&
|
|
146
|
+
(spec === version || spec === `${name}@${version}` || spec.endsWith(`@${version}`))
|
|
147
|
+
) return true;
|
|
148
|
+
if (spec === 'catalog:' || spec === 'catalog') {
|
|
149
|
+
const workspace = fs.existsSync(path.join(projectRoot, 'pnpm-workspace.yaml'))
|
|
150
|
+
? fs.readFileSync(path.join(projectRoot, 'pnpm-workspace.yaml'), 'utf8')
|
|
151
|
+
: '';
|
|
152
|
+
const match = new RegExp(`^\\s{2}${name.replace(/[.*+?^${}()|[\\]\\]/g, '\\\\$&')}:\\s*([^#\\n]+)`, 'm').exec(workspace);
|
|
153
|
+
if (match?.[1].trim() === version) return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} catch {
|
|
158
|
+
// Defer malformed manifest errors to pnpm.
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const lockfile = fs.readFileSync(path.join(projectRoot, 'pnpm-lock.yaml'), 'utf8');
|
|
163
|
+
return new RegExp(`(?:^|\\n)\\s{2}${selector.replace(/[.*+?^${}()|[\\]\\]/g, '\\\\$&')}:`).test(lockfile);
|
|
164
|
+
} catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function applyManagedPatches(config) {
|
|
170
|
+
const patchedDependencies = { ...config.patchedDependencies };
|
|
171
|
+
|
|
172
|
+
for (const [selector, managedPatch] of Object.entries(managedPatches)) {
|
|
173
|
+
const bundledPatchPath = getBundledPatchPath(config, managedPatch.filename);
|
|
174
|
+
const projectPatch = patchedDependencies[selector];
|
|
175
|
+
|
|
176
|
+
if (legacyPatchSelectors.has(selector) && !projectRequestsLegacySelector(config, selector)) {
|
|
177
|
+
if (projectPatch != null) {
|
|
178
|
+
try {
|
|
179
|
+
if (managedPatch.legacyHashes.has(getPatchHash(resolveProjectPatchPath(config, projectPatch)))) {
|
|
180
|
+
delete patchedDependencies[selector];
|
|
181
|
+
}
|
|
182
|
+
} catch {
|
|
183
|
+
// Keep unreadable or custom project patches for pnpm's normal diagnostics.
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (projectPatch == null) {
|
|
190
|
+
patchedDependencies[selector] = bundledPatchPath;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const projectPatchPath = resolveProjectPatchPath(config, projectPatch);
|
|
195
|
+
try {
|
|
196
|
+
if (managedPatch.legacyHashes.has(getPatchHash(projectPatchPath))) {
|
|
197
|
+
patchedDependencies[selector] = bundledPatchPath;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
} catch {
|
|
201
|
+
// Keep pnpm's normal missing/unreadable patch error and add migration context below.
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
console.warn(
|
|
205
|
+
`[miaoda-expo-devkit] Preserving custom patch for ${selector}: ${projectPatch}. ` +
|
|
206
|
+
'It differs from the known template patch and overrides the DevKit patch.',
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const configuredMaxLength = Number.isFinite(config.virtualStoreDirMaxLength)
|
|
211
|
+
? config.virtualStoreDirMaxLength
|
|
212
|
+
: 120;
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
...config,
|
|
216
|
+
allowUnusedPatches: config.allowUnusedPatches ?? true,
|
|
217
|
+
virtualStoreDirMaxLength: Math.min(configuredMaxLength, MAX_VIRTUAL_STORE_DIR_LENGTH),
|
|
218
|
+
patchedDependencies,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function hasManagedExpoCliPatch(version) {
|
|
223
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
|
224
|
+
if (match == null) return false;
|
|
225
|
+
|
|
226
|
+
const [, major, minor, patch] = match.map(Number);
|
|
227
|
+
return major === 55 && minor === 0 && patch >= 16 && patch < 23;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function readPackage(pkg, context) {
|
|
231
|
+
if (pkg.name === '@expo/cli' && !hasManagedExpoCliPatch(pkg.version)) {
|
|
232
|
+
console.warn(
|
|
233
|
+
`[miaoda-expo-devkit] No AI error collector patch is registered for @expo/cli@${pkg.version}. ` +
|
|
234
|
+
`The validated range is ${EXPO_CLI_PATCH_SELECTOR}.`,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
const blockedPackage = blockedPackages.find(({ name }) => name === pkg.name);
|
|
238
|
+
if (blockedPackage == null) return pkg;
|
|
239
|
+
|
|
240
|
+
context.log(`Blocked installation of ${pkg.name}`);
|
|
241
|
+
const error = new Error(`Restricted: ${blockedPackage.reason}`);
|
|
242
|
+
error.code = 'ERR_PNPM_RESTRICTED_PACKAGE';
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
module.exports = {
|
|
247
|
+
hooks: {
|
|
248
|
+
readPackage,
|
|
249
|
+
updateConfig: applyManagedPatches,
|
|
250
|
+
},
|
|
251
|
+
};
|
|
@@ -1,60 +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
|
-
var preview_control_exports = {};
|
|
20
|
-
__export(preview_control_exports, {
|
|
21
|
-
setupPreviewControl: () => setupPreviewControl
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(preview_control_exports);
|
|
24
|
-
function getParentOrigin() {
|
|
25
|
-
try {
|
|
26
|
-
const w = globalThis.window;
|
|
27
|
-
if (!w) return "*";
|
|
28
|
-
return new URLSearchParams(w.location.search).get("parentOrigin") || "*";
|
|
29
|
-
} catch {
|
|
30
|
-
return "*";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function postPreviewSuccess() {
|
|
34
|
-
const w = globalThis.window;
|
|
35
|
-
if (!w || w.editorPreviewSuccessPosted) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
w.editorPreviewSuccessPosted = true;
|
|
39
|
-
w.parent.postMessage(
|
|
40
|
-
{
|
|
41
|
-
type: "editor-preview-success"
|
|
42
|
-
},
|
|
43
|
-
getParentOrigin()
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
function setupPreviewControl() {
|
|
47
|
-
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
if (document.readyState === "complete") {
|
|
51
|
-
postPreviewSuccess();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
window.addEventListener("load", postPreviewSuccess, { once: true });
|
|
55
|
-
}
|
|
56
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
-
0 && (module.exports = {
|
|
58
|
-
setupPreviewControl
|
|
59
|
-
});
|
|
60
|
-
//# sourceMappingURL=preview-control.js.map
|