expo-tiddlywiki-filesystem-android-external-storage 2.1.0 → 2.2.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.
@@ -556,9 +556,16 @@ class ExternalStorageModule : Module() {
556
556
 
557
557
  // 1. Parse the git index
558
558
  val indexEntries = parseGitIndex(indexFile)
559
+ android.util.Log.i("GitStatus", "Parsed ${indexEntries.size} entries from git index at $gitRootDir")
560
+ if (indexEntries.size <= 5) {
561
+ indexEntries.forEach { e -> android.util.Log.i("GitStatus", " index: ${e.path} size=${e.size} mtime=${e.mtimeSeconds}") }
562
+ } else {
563
+ indexEntries.take(3).forEach { e -> android.util.Log.i("GitStatus", " index: ${e.path} size=${e.size} mtime=${e.mtimeSeconds}") }
564
+ android.util.Log.i("GitStatus", " ... and ${indexEntries.size - 3} more entries")
565
+ }
559
566
 
560
567
  // 2. Walk the working directory (skip .git, node_modules, etc.)
561
- val skipDirs = setOf(".git", "node_modules", ".DS_Store", "output")
568
+ val skipDirs = setOf(".git", "node_modules", "output")
562
569
  val workdirFiles = mutableSetOf<String>()
563
570
  fun walkDir(dir: File, prefix: String) {
564
571
  val children = dir.listFiles() ?: return
@@ -574,6 +581,10 @@ class ExternalStorageModule : Module() {
574
581
  }
575
582
  }
576
583
  walkDir(root, "")
584
+ android.util.Log.i("GitStatus", "Found ${workdirFiles.size} files on disk")
585
+ // Log files in tiddlers/ dir specifically
586
+ val tiddlerFiles = workdirFiles.filter { it.startsWith("tiddlers/") }
587
+ android.util.Log.i("GitStatus", " tiddlers/ count: ${tiddlerFiles.size}, sample: ${tiddlerFiles.take(5).joinToString()}")
577
588
 
578
589
  // 3. Compare index vs working directory
579
590
  val changes = JSONArray()
@@ -821,27 +832,46 @@ class ExternalStorageModule : Module() {
821
832
  val companionFile = File(companionPath)
822
833
 
823
834
  if (companionFile.exists()) {
824
- if (companionPath.endsWith(".json")) {
825
- // .meta + .json pair: the .json IS the text content (e.g. plugin bundles).
826
- // Must include text so the tiddler is complete.
835
+ val tiddlerType = json.optString("type", "text/vnd.tiddlywiki")
836
+ val hasModuleType = json.has("module-type")
837
+ val hasPluginType = json.has("plugin-type")
838
+
839
+ // Determine whether this companion is a text file whose content
840
+ // should be loaded as the tiddler's "text" field.
841
+ // JS modules, CSS, JSON, and other text-based companions need their content.
842
+ // Binary companions (images, pdfs, etc.) should NOT have their content loaded;
843
+ // they use _canonical_uri instead (handled later by JS).
844
+ val isTextCompanion = companionPath.endsWith(".json") ||
845
+ companionPath.endsWith(".js") ||
846
+ companionPath.endsWith(".css") ||
847
+ companionPath.endsWith(".svg") ||
848
+ companionPath.endsWith(".txt") ||
849
+ companionPath.endsWith(".html") ||
850
+ companionPath.endsWith(".htm") ||
851
+ tiddlerType.startsWith("text/") ||
852
+ tiddlerType == "application/javascript" ||
853
+ tiddlerType == "application/json" ||
854
+ tiddlerType == "application/x-tiddler-dictionary"
855
+
856
+ if (isTextCompanion) {
827
857
  val shouldIncludeText = if (quickLoadMode) {
828
858
  shouldPreserveFullTextInQuickLoad(
829
859
  json.optString("title", ""),
830
- json.optString("type", ""),
831
- json.has("module-type"),
832
- json.has("plugin-type"),
860
+ tiddlerType,
861
+ hasModuleType,
862
+ hasPluginType,
833
863
  )
834
864
  } else {
835
865
  true
836
866
  }
837
867
  if (shouldIncludeText) {
838
- val jsonContent = companionFile.readText(Charsets.UTF_8)
839
- json.put("text", jsonContent)
868
+ val textContent = companionFile.readText(Charsets.UTF_8)
869
+ json.put("text", textContent)
840
870
  } else {
841
871
  json.put("_is_skinny", "yes")
842
872
  }
843
873
  }
844
- // For non-JSON companions (images, etc.), we don't set _canonical_uri here —
874
+ // For binary companions (images, etc.), we don't set _canonical_uri here —
845
875
  // that requires knowing the workspace base path. JS side handles it.
846
876
  }
847
877
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-tiddlywiki-filesystem-android-external-storage",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Expo native module for TidGi-Mobile: external storage I/O + TiddlyWiki .tid/.meta/.json batch parsing in Kotlin",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",