You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2026-04-18 19:42:23 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 001ecb6752 | |||
| 8c79d945c6 | |||
| 59662fd457 | |||
| 1bd4d4b07d | |||
| 45f1c2a334 |
@@ -1896,6 +1896,7 @@ packages/tools/buildServerDocker.js
|
||||
packages/tools/checkIgnoredFiles.js
|
||||
packages/tools/checkLibPaths.test.js
|
||||
packages/tools/checkLibPaths.js
|
||||
packages/tools/checkYarnPatches.js
|
||||
packages/tools/convertThemesToCss.js
|
||||
packages/tools/fuzzer/ActionRunner.js
|
||||
packages/tools/fuzzer/Fuzzer.js
|
||||
|
||||
@@ -172,6 +172,12 @@ if [ "$RUN_TESTS" == "1" ]; then
|
||||
if [ $testResult -ne 0 ]; then
|
||||
exit $testResult
|
||||
fi
|
||||
|
||||
yarn checkYarnPatches
|
||||
testResult=$?
|
||||
if [ $testResult -ne 0 ]; then
|
||||
exit $testResult
|
||||
fi
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
|
||||
@@ -1869,6 +1869,7 @@ packages/tools/buildServerDocker.js
|
||||
packages/tools/checkIgnoredFiles.js
|
||||
packages/tools/checkLibPaths.test.js
|
||||
packages/tools/checkLibPaths.js
|
||||
packages/tools/checkYarnPatches.js
|
||||
packages/tools/convertThemesToCss.js
|
||||
packages/tools/fuzzer/ActionRunner.js
|
||||
packages/tools/fuzzer/Fuzzer.js
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
diff --git a/src/RNCamera.js b/src/RNCamera.js
|
||||
index b7a271ad64771c0f654dbd5fe3c0d9e0d2e2c4ef..1182a40ace081a32fbaefe2bc4a499b79c2e7dac 100644
|
||||
--- a/src/RNCamera.js
|
||||
+++ b/src/RNCamera.js
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
findNodeHandle,
|
||||
Platform,
|
||||
NativeModules,
|
||||
- ViewPropTypes,
|
||||
requireNativeComponent,
|
||||
View,
|
||||
ActivityIndicator,
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
PermissionsAndroid,
|
||||
} from 'react-native';
|
||||
|
||||
+import ViewPropTypes from 'deprecated-react-native-prop-types';
|
||||
import type { FaceFeature } from './FaceDetector';
|
||||
|
||||
const Rationale = PropTypes.shape({
|
||||
@@ -0,0 +1,34 @@
|
||||
diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt
|
||||
index 3bc9143d7ed7923c11e5d73853a285f648e9745e..eb69fdc38be63bcf887cec5294e68b3128255083 100644
|
||||
--- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt
|
||||
+++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react.animated
|
||||
|
||||
+import android.os.Build
|
||||
import androidx.annotation.AnyThread
|
||||
import androidx.annotation.UiThread
|
||||
import com.facebook.common.logging.FLog
|
||||
@@ -34,6 +35,7 @@ import com.facebook.react.uimanager.common.ViewUtil
|
||||
import java.util.ArrayList
|
||||
import java.util.Queue
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
+import java.util.concurrent.LinkedBlockingQueue
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.concurrent.Volatile
|
||||
|
||||
@@ -130,7 +132,12 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) :
|
||||
}
|
||||
|
||||
private inner class ConcurrentOperationQueue {
|
||||
- private val queue: Queue<UIThreadOperation> = ConcurrentLinkedQueue()
|
||||
+ // Patch: Use LinkedBlockingQueue instead of ConcurrentLinkedQueue on Android 12.
|
||||
+ // In some versions of Android, ConcurrentLinkedQueue is known to drop
|
||||
+ // items, causing crashes. See https://github.com/laurent22/joplin/issues/8425
|
||||
+ private val queue: Queue<UIThreadOperation> = if (
|
||||
+ Build.VERSION.SDK_INT == 31 || Build.VERSION.SDK_INT == 32
|
||||
+ ) LinkedBlockingQueue() else ConcurrentLinkedQueue()
|
||||
private var peekedOperation: UIThreadOperation? = null
|
||||
|
||||
@get:AnyThread
|
||||
+2
-5
@@ -25,6 +25,7 @@
|
||||
"buildWebsiteTranslations": "node packages/tools/website/buildTranslations.js",
|
||||
"checkIgnoredFiles": "node ./packages/tools/checkIgnoredFiles.js",
|
||||
"checkLibPaths": "node ./packages/tools/checkLibPaths.js",
|
||||
"checkYarnPatches": "node ./packages/tools/checkYarnPatches.js",
|
||||
"circularDependencyCheck": "madge --warning --circular --extensions js ./",
|
||||
"clean": "npm run clean --workspaces --if-present && node packages/tools/clean && yarn cache clean",
|
||||
"crowdin": "crowdin",
|
||||
@@ -105,19 +106,15 @@
|
||||
"@codemirror/state": "6.6.0",
|
||||
"@codemirror/view": "6.41.0",
|
||||
"@codemirror/language": "6.12.3",
|
||||
"react-native-camera@4.2.1": "patch:react-native-camera@npm%3A4.2.1#./.yarn/patches/react-native-camera-npm-4.2.1-24b2600a7e.patch",
|
||||
"eslint": "patch:eslint@8.57.1#./.yarn/patches/eslint-npm-8.39.0-d92bace04d.patch",
|
||||
"app-builder-lib@24.4.0": "patch:app-builder-lib@npm%3A24.4.0#./.yarn/patches/app-builder-lib-npm-24.4.0-05322ff057.patch",
|
||||
"nanoid": "patch:nanoid@npm%3A3.3.7#./.yarn/patches/nanoid-npm-3.3.7-98824ba130.patch",
|
||||
"pdfjs-dist": "patch:pdfjs-dist@npm%3A3.11.174#./.yarn/patches/pdfjs-dist-npm-3.11.174-67f2fee6d6.patch",
|
||||
"chokidar@^2.0.0": "3.5.3",
|
||||
"rn-fetch-blob@0.12.0": "patch:rn-fetch-blob@npm%3A0.12.0#./.yarn/patches/rn-fetch-blob-npm-0.12.0-cf02e3c544.patch",
|
||||
"app-builder-lib@26.0.0-alpha.7": "patch:app-builder-lib@npm%3A26.0.0-alpha.7#./.yarn/patches/app-builder-lib-npm-26.0.0-alpha.7-e1b3dca119.patch",
|
||||
"app-builder-lib@24.13.3": "patch:app-builder-lib@npm%3A24.13.3#./.yarn/patches/app-builder-lib-npm-24.13.3-86a66c0bf3.patch",
|
||||
"react-native-sqlite-storage@6.0.1": "patch:react-native-sqlite-storage@npm%3A6.0.1#./.yarn/patches/react-native-sqlite-storage-npm-6.0.1-8369d747bd.patch",
|
||||
"react-native-paper@5.13.1": "patch:react-native-paper@npm%3A5.13.1#./.yarn/patches/react-native-paper-npm-5.13.1-f153e542e2.patch",
|
||||
"react-native@0.81.6": "patch:react-native@npm%3A0.81.6#./.yarn/patches/react-native-npm-0.81.6-e0b80aa8aa.patch",
|
||||
"react-native-popup-menu@0.17.0": "patch:react-native-popup-menu@npm%3A0.17.0#./.yarn/patches/react-native-popup-menu-npm-0.17.0-8b745d88dd.patch",
|
||||
"react-native@0.79.2": "patch:react-native@npm%3A0.79.2#./.yarn/patches/react-native-npm-0.79.2-9db13eddfe.patch",
|
||||
"pdfjs-dist@2.16.105": "patch:pdfjs-dist@npm%3A3.11.174#./.yarn/patches/pdfjs-dist-npm-3.11.174-67f2fee6d6.patch",
|
||||
"pdfjs-dist@*": "patch:pdfjs-dist@npm%3A3.11.174#./.yarn/patches/pdfjs-dist-npm-3.11.174-67f2fee6d6.patch",
|
||||
"pdfjs-dist@3.11.174": "patch:pdfjs-dist@npm%3A3.11.174#./.yarn/patches/pdfjs-dist-npm-3.11.174-67f2fee6d6.patch",
|
||||
|
||||
@@ -74,7 +74,6 @@ const buildSharedConfig = (hotReload: boolean): webpack.Configuration => {
|
||||
'react-native-quick-actions': emptyLibraryMock,
|
||||
'uglifycss': emptyLibraryMock,
|
||||
'react-native-share': emptyLibraryMock,
|
||||
'react-native-camera': emptyLibraryMock,
|
||||
'react-native-zip-archive': emptyLibraryMock,
|
||||
'@react-native-documents/picker': emptyLibraryMock,
|
||||
'react-native-exit-app': emptyLibraryMock,
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import { getRootDir } from '@joplin/utils';
|
||||
import { readFile } from 'fs-extra';
|
||||
import { join } from 'path';
|
||||
|
||||
// Checks that all patch resolutions in package.json are actually applied in
|
||||
// yarn.lock. Catches the case where a dependency version is upgraded but the
|
||||
// resolution still targets the old version, causing the patch to silently not
|
||||
// apply.
|
||||
|
||||
const main = async () => {
|
||||
const rootDir = await getRootDir();
|
||||
const packageJson = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf8'));
|
||||
const yarnLock = await readFile(join(rootDir, 'yarn.lock'), 'utf8');
|
||||
|
||||
const resolutions: Record<string, string> = packageJson.resolutions ?? {};
|
||||
const errors: string[] = [];
|
||||
|
||||
for (const [key, value] of Object.entries(resolutions)) {
|
||||
if (!value.startsWith('patch:')) continue;
|
||||
|
||||
// Extract the patch target, e.g. "patch:nanoid@npm%3A3.3.11#..." -> "nanoid@npm:3.3.11"
|
||||
const patchTarget = value
|
||||
.replace(/^patch:/, '')
|
||||
.replace(/#.*$/, '')
|
||||
.replace(/%3A/g, ':');
|
||||
|
||||
// Extract package name and version from the patch target.
|
||||
// Supports both "pkg@npm:version" and "pkg@version" formats.
|
||||
const match = patchTarget.match(/^(.+)@(?:npm:)?(.+)$/);
|
||||
if (!match) {
|
||||
errors.push(
|
||||
`Invalid patch format for "${key}": "${patchTarget}" does not match ` +
|
||||
'expected pattern "packageName@npm:version" or "packageName@version".',
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
const [, packageName, patchVersion] = match;
|
||||
const hasNpmPrefix = patchTarget.includes('@npm:');
|
||||
|
||||
// Check that yarn.lock contains a resolved entry for this exact
|
||||
// patch. The lockfile entry looks like:
|
||||
// "pkg@patch:pkg@npm%3Aversion#path::..." (with npm prefix)
|
||||
// "pkg@patch:pkg@version#path::..." (without npm prefix)
|
||||
const versionPart = hasNpmPrefix ? `@npm%3A${patchVersion}` : `@${patchVersion}`;
|
||||
const patchPattern = `"${packageName}@patch:${packageName}${versionPart}#`;
|
||||
if (!yarnLock.includes(patchPattern)) {
|
||||
errors.push(
|
||||
`Resolution "${key}" patches ${packageName}@${patchVersion}, ` +
|
||||
'but yarn.lock has no matching entry. The dependency was likely ' +
|
||||
'upgraded — update the patch to target the current version.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
throw new Error(`Yarn patch validation failed:\n\n${errors.join('\n\n')}`);
|
||||
}
|
||||
|
||||
console.log(`All ${Object.values(resolutions).filter(v => v.startsWith('patch:')).length} patch resolutions are applied.`);
|
||||
};
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user