@produtype/core 1.22.0 → 1.23.0
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.
|
@@ -247,6 +247,19 @@ function isTestOrExamplePath(file) {
|
|
|
247
247
|
* and it says which build the file is part of.
|
|
248
248
|
*/
|
|
249
249
|
|| /(^|\/)config\/(test|dev)\.exs$/i.test(file)
|
|
250
|
+
/**
|
|
251
|
+
* Gradle's source sets, which name the build they belong to.
|
|
252
|
+
*
|
|
253
|
+
* `src/androidTest/` is instrumentation tests and `src/test/` is unit tests;
|
|
254
|
+
* neither is compiled into the shipped application, and `src/main/` is. davx5
|
|
255
|
+
* keeps an `AndroidManifest.xml` in `core/src/androidTest/` declaring three
|
|
256
|
+
* permissions its tests need, and the report opened its permission finding with
|
|
257
|
+
* that file — a test's manifest offered as the app's permission surface.
|
|
258
|
+
*
|
|
259
|
+
* The same argument as `_test.go` and `config/test.exs`: the directory name is
|
|
260
|
+
* the toolchain's, not the author's, and it says which build the file is part of.
|
|
261
|
+
*/
|
|
262
|
+
|| /(^|\/)src\/(androidTest|test)\//i.test(file)
|
|
250
263
|
|| /(^|\/)test[-_][^/]+\.(ts|tsx|js|jsx|mjs|cjs|py)$/i.test(file)
|
|
251
264
|
/**
|
|
252
265
|
* The other half of the convention.
|
|
@@ -232,7 +232,20 @@ async function detectMobile(ctx) {
|
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Gradle names the source set a file belongs to, and `androidTest` is not shipped.
|
|
237
|
+
*
|
|
238
|
+
* davx5 keeps an `AndroidManifest.xml` in `core/src/androidTest/` declaring the
|
|
239
|
+
* three permissions its instrumentation tests need, and the permission finding
|
|
240
|
+
* opened with that file: a test's manifest offered as the application's permission
|
|
241
|
+
* surface. `src/main/` is what goes into the APK.
|
|
242
|
+
*
|
|
243
|
+
* Filtered here rather than in the path rule that excludes `_test.go` and
|
|
244
|
+
* `config/test.exs`, because these manifests are read from the whole file list and
|
|
245
|
+
* never pass through it.
|
|
246
|
+
*/
|
|
247
|
+
const SHIPPED_SOURCE_SET = (file) => !/(^|\/)src\/(androidTest|test)\//i.test(file);
|
|
248
|
+
for (const file of androidFiles.filter((f) => /AndroidManifest\.xml$/i.test(f) && SHIPPED_SOURCE_SET(f))) {
|
|
236
249
|
const text = (await (0, readTextFileSafe_1.readTextFileSafe)(ctx.root, file)) ?? '';
|
|
237
250
|
const declared = [...text.matchAll(/<uses-permission[^>]*android:name="([^"]+)"/g)].map(([, name]) => name);
|
|
238
251
|
// Android has no purpose strings, so the equivalent evidence is asking at the
|
|
@@ -253,6 +266,24 @@ async function detectMobile(ctx) {
|
|
|
253
266
|
/request\(\)\s*;?\s*\/\/\s*permission/,
|
|
254
267
|
/PermissionsAndroid\.request/,
|
|
255
268
|
/requestPermissionsAsync/,
|
|
269
|
+
/**
|
|
270
|
+
* How Android asks for a permission now, in the two libraries Google publishes.
|
|
271
|
+
*
|
|
272
|
+
* davx5 shows a switch per permission and calls
|
|
273
|
+
* `state::launchMultiplePermissionRequest` when somebody turns one on —
|
|
274
|
+
* Accompanist's API, which is asking at the moment of use as plainly as it can
|
|
275
|
+
* be asked. It was told at `high` that it gives no reason for any of the twelve
|
|
276
|
+
* permissions it declares.
|
|
277
|
+
*
|
|
278
|
+
* `ActivityResultContracts.RequestPermission` is the AndroidX contract that
|
|
279
|
+
* replaced `ActivityCompat.requestPermissions`, and
|
|
280
|
+
* `rememberMultiplePermissionsState` is Accompanist's. Both names belong to
|
|
281
|
+
* Google; what the launcher is called afterwards belongs to the author, which
|
|
282
|
+
* is why the pattern stops at the contract.
|
|
283
|
+
*/
|
|
284
|
+
/ActivityResultContracts\.RequestMultiplePermissions|ActivityResultContracts\.RequestPermission\b/,
|
|
285
|
+
/remember(?:Multiple)?Permissions?State\s*\(/,
|
|
286
|
+
/launch(?:Multiple)?Permissions?Request\b/,
|
|
256
287
|
], 3);
|
|
257
288
|
for (const match of runtimeRequests) {
|
|
258
289
|
permissionsExplained = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@produtype/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Deterministic CLI and library that analyzes a web application repository and reports how far it is from production-ready for the kind of product it is meant to be.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|