@cap-kit/test-plugin 1.0.0 → 1.0.1
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 +63 -31
- package/android/src/main/java/io/capkit/test/Test.kt +48 -7
- package/android/src/main/java/io/capkit/test/TestConfig.kt +39 -4
- package/android/src/main/java/io/capkit/test/TestPlugin.kt +65 -9
- package/android/src/main/java/io/capkit/test/utils/Logger.kt +85 -0
- package/android/src/main/java/io/capkit/test/utils/TestUtils.kt +14 -0
- package/dist/docs.json +57 -21
- package/dist/esm/definitions.d.ts +137 -35
- package/dist/esm/definitions.js +23 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +4 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +16 -27
- package/dist/esm/web.js +25 -28
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +54 -39
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +54 -39
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/TestPlugin/Test.swift +40 -8
- package/ios/Sources/TestPlugin/TestConfig.swift +52 -9
- package/ios/Sources/TestPlugin/TestPlugin.swift +83 -34
- package/ios/Sources/TestPlugin/Utils/Logging.swift +57 -0
- package/ios/Sources/TestPlugin/Utils/TestUtils.swift +12 -0
- package/package.json +9 -9
- package/android/src/main/java/io/capkit/test/Logger.kt +0 -25
- package/ios/Sources/TestPlugin/Logging.swift +0 -32
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Centralized logger for the Test plugin.
|
|
5
|
+
|
|
6
|
+
This logger mirrors the Android Logger pattern and provides:
|
|
7
|
+
- a single logging entry point
|
|
8
|
+
- runtime-controlled verbose logging
|
|
9
|
+
- consistent log formatting
|
|
10
|
+
|
|
11
|
+
Business logic MUST NOT perform configuration checks directly.
|
|
12
|
+
*/
|
|
13
|
+
enum TestLogger {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Controls whether debug logs are printed.
|
|
17
|
+
|
|
18
|
+
This value is set once during plugin load
|
|
19
|
+
based on configuration values.
|
|
20
|
+
*/
|
|
21
|
+
static var verbose: Bool = false
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
Prints a verbose / debug log message.
|
|
25
|
+
|
|
26
|
+
This method is intended for development-time diagnostics
|
|
27
|
+
and is automatically silenced when verbose logging is disabled.
|
|
28
|
+
*/
|
|
29
|
+
static func debug(_ items: Any...) {
|
|
30
|
+
guard verbose else { return }
|
|
31
|
+
log(items)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
Prints an error log message.
|
|
36
|
+
|
|
37
|
+
Error logs are always printed regardless of verbosity.
|
|
38
|
+
*/
|
|
39
|
+
static func error(_ items: Any...) {
|
|
40
|
+
log(items)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
Low-level log printer with a consistent prefix.
|
|
46
|
+
|
|
47
|
+
This function should not be used directly outside this file.
|
|
48
|
+
*/
|
|
49
|
+
private func log(_ items: Any..., separator: String = " ", terminator: String = "\n") {
|
|
50
|
+
CAPLog.print("⚡️ Test -", terminator: separator)
|
|
51
|
+
for (itemIndex, item) in items.enumerated() {
|
|
52
|
+
CAPLog.print(
|
|
53
|
+
item,
|
|
54
|
+
terminator: itemIndex == items.count - 1 ? terminator : separator
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Utility helpers for the Test plugin.
|
|
5
|
+
|
|
6
|
+
This type is intentionally empty and serves as a placeholder
|
|
7
|
+
for future shared helper functions.
|
|
8
|
+
|
|
9
|
+
Keeping a dedicated utilities file helps maintain a clean
|
|
10
|
+
separation between core logic and helper code.
|
|
11
|
+
*/
|
|
12
|
+
struct TestUtils {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-kit/test-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Test plugin for Cap-Kit.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@capacitor/cli": "^8.0.
|
|
41
|
-
"@capacitor/android": "^8.0.
|
|
42
|
-
"@capacitor/core": "^8.0.
|
|
40
|
+
"@capacitor/cli": "^8.0.1",
|
|
41
|
+
"@capacitor/android": "^8.0.1",
|
|
42
|
+
"@capacitor/core": "^8.0.1",
|
|
43
43
|
"@capacitor/docgen": "^0.3.1",
|
|
44
|
-
"@capacitor/ios": "^8.0.
|
|
44
|
+
"@capacitor/ios": "^8.0.1",
|
|
45
45
|
"@eslint/eslintrc": "^3.3.3",
|
|
46
46
|
"@eslint/js": "^9.39.2",
|
|
47
47
|
"eslint": "^9.39.2",
|
|
48
48
|
"eslint-plugin-import": "^2.32.0",
|
|
49
49
|
"globals": "^17.0.0",
|
|
50
|
-
"prettier": "^3.
|
|
50
|
+
"prettier": "^3.8.0",
|
|
51
51
|
"prettier-plugin-java": "^2.8.1",
|
|
52
52
|
"rimraf": "^6.1.2",
|
|
53
|
-
"rollup": "^4.55.
|
|
53
|
+
"rollup": "^4.55.2",
|
|
54
54
|
"swiftlint": "^2.0.0",
|
|
55
55
|
"typescript": "^5.9.3",
|
|
56
|
-
"typescript-eslint": "^8.
|
|
56
|
+
"typescript-eslint": "^8.53.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@capacitor/core": ">=8.0.
|
|
59
|
+
"@capacitor/core": ">=8.0.1"
|
|
60
60
|
},
|
|
61
61
|
"capacitor": {
|
|
62
62
|
"ios": {
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
package io.capkit.test
|
|
2
|
-
|
|
3
|
-
import android.util.Log
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Utility object for logging messages with a custom prefix.
|
|
7
|
-
*/
|
|
8
|
-
object Logger {
|
|
9
|
-
private const val TAG = "⚡️ Test"
|
|
10
|
-
|
|
11
|
-
fun debug(vararg messages: String) {
|
|
12
|
-
log(TAG, *messages)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
fun log(
|
|
16
|
-
tag: String,
|
|
17
|
-
vararg messages: String,
|
|
18
|
-
) {
|
|
19
|
-
val sb = StringBuilder()
|
|
20
|
-
for (msg in messages) {
|
|
21
|
-
sb.append(msg).append(" ")
|
|
22
|
-
}
|
|
23
|
-
Log.d(tag, sb.toString())
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Capacitor
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Utility function for logging messages with a custom prefix.
|
|
5
|
-
*
|
|
6
|
-
* This function is designed to format log messages for the Test plugin. It prepends the log output
|
|
7
|
-
* with a custom prefix (`⚡️ Test -`) to easily identify logs associated with this plugin.
|
|
8
|
-
*
|
|
9
|
-
* @param items - Items to log, stringified and logged in order.
|
|
10
|
-
* @param separator - A string used to separate the logged items. Defaults to a single space (`" "`).
|
|
11
|
-
* @param terminator - A string appended to the end of the log message. Defaults to a newline (`"\n"`).
|
|
12
|
-
*
|
|
13
|
-
* Example Usage:
|
|
14
|
-
* ```
|
|
15
|
-
* log("This is a message", "with multiple parts", separator: ", ")
|
|
16
|
-
* // Output: ⚡️ Test - This is a message, with multiple parts
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* Note:
|
|
20
|
-
* - This function uses Capacitor's `CAPLog.print` for outputting log messages.
|
|
21
|
-
* - Multiple items use `separator` and end with `terminator`.
|
|
22
|
-
*/
|
|
23
|
-
func log(_ items: Any..., separator: String = " ", terminator: String = "\n") {
|
|
24
|
-
// Prefix the log with "⚡️ Test -"
|
|
25
|
-
CAPLog.print("⚡️ Test -", terminator: separator)
|
|
26
|
-
|
|
27
|
-
// Iterate over the provided items and print each one
|
|
28
|
-
for (itemIndex, item) in items.enumerated() {
|
|
29
|
-
// Use the specified separator between items, and the terminator for the final item
|
|
30
|
-
CAPLog.print(item, terminator: itemIndex == items.count - 1 ? terminator : separator)
|
|
31
|
-
}
|
|
32
|
-
}
|