|
| 1 | +// THIS FILE IS GENERATED BY THE prepareVirtualFs COMMAND, DO NOT EDIT IT MANUALLY |
| 2 | + |
| 3 | +// It is meant to be used for mounting a virtual filesystem in the browser |
| 4 | +// interacting with @bytecodealliance/preview2-shim/filesystem , the shim for wasi:filesystem |
| 5 | +// |
| 6 | +// The `fs` calls like `read`, `readDir` ... in rust or other languages will be redirected to this virtual filesystem |
| 7 | +// and will interact as if the filesystem was a real one. |
| 8 | + |
| 9 | +export function makeVirtualFs() { |
| 10 | + return { |
| 11 | + dir: { |
| 12 | + ".config": { |
| 13 | + source: |
| 14 | + "# Hidden configuration file\n# This file contains sensitive configuration data\n# Should be handled carefully in tests\n\n[app]\ndebug = true\nlog_level = info\nmax_connections = 10\n\n[filesystem]\nroot_path = /tmp/filesystem\nallow_hidden = false\nmax_file_size = 1048576\n", |
| 15 | + }, |
| 16 | + ".hidden_file": { |
| 17 | + source: |
| 18 | + "# This is a hidden file\n# It should only be visible when explicitly requested\n# Used for testing hidden file operations\n", |
| 19 | + }, |
| 20 | + "README.md": { |
| 21 | + source: "# filesystem\n", |
| 22 | + }, |
| 23 | + data: { |
| 24 | + dir: { |
| 25 | + processed: { |
| 26 | + dir: { |
| 27 | + "2024": { |
| 28 | + dir: { |
| 29 | + ".gitkeep": { |
| 30 | + source: |
| 31 | + "# This file ensures the 2024 directory is tracked in git\n# Year-based nested directory for testing\n", |
| 32 | + }, |
| 33 | + "01": { |
| 34 | + dir: { |
| 35 | + ".gitkeep": { |
| 36 | + source: |
| 37 | + "# This file ensures the 01 directory is tracked in git\n# Month-based nested directory for testing\n", |
| 38 | + }, |
| 39 | + }, |
| 40 | + }, |
| 41 | + "02": { |
| 42 | + dir: { |
| 43 | + ".gitkeep": { |
| 44 | + source: |
| 45 | + "# This file ensures the 02 directory is tracked in git\n# Another month directory for testing\n", |
| 46 | + }, |
| 47 | + }, |
| 48 | + }, |
| 49 | + }, |
| 50 | + }, |
| 51 | + }, |
| 52 | + }, |
| 53 | + raw: { |
| 54 | + dir: { |
| 55 | + incoming: { |
| 56 | + dir: { |
| 57 | + ".gitkeep": { |
| 58 | + source: |
| 59 | + "# This file ensures the incoming directory is tracked in git\n# Raw data nested directory for testing\n", |
| 60 | + }, |
| 61 | + }, |
| 62 | + }, |
| 63 | + outgoing: { |
| 64 | + dir: { |
| 65 | + ".gitkeep": { |
| 66 | + source: |
| 67 | + "# This file ensures the outgoing directory is tracked in git\n# Outgoing data nested directory for testing\n", |
| 68 | + }, |
| 69 | + }, |
| 70 | + }, |
| 71 | + }, |
| 72 | + }, |
| 73 | + "sample.csv": { |
| 74 | + source: |
| 75 | + "id,name,age,city,active\n1,Alice,28,New York,true\n2,Bob,32,San Francisco,true\n3,Charlie,25,Chicago,false\n4,Diana,29,Boston,true\n5,Eve,35,Seattle,true\n", |
| 76 | + }, |
| 77 | + "users.yaml": { |
| 78 | + source: |
| 79 | + "users:\n - id: 1\n name: Alice\n email: alice@example.com\n role: admin\n permissions:\n - read\n - write\n - delete\n - id: 2\n name: Bob\n email: bob@example.com\n role: user\n permissions:\n - read\n - write\n - id: 3\n name: Charlie\n email: charlie@example.com\n role: guest\n permissions:\n - read\n\nsettings:\n max_file_size: 1048576\n allowed_extensions:\n - .txt\n - .md\n - .json\n - .yaml\n - .csv\n", |
| 80 | + }, |
| 81 | + }, |
| 82 | + }, |
| 83 | + documents: { |
| 84 | + dir: { |
| 85 | + "README.md": { |
| 86 | + source: |
| 87 | + "# Documents\n\nThis is a mock documents directory for testing filesystem operations.\n\n## Contents\n- Various text files\n- Configuration files\n- Sample data\n\nFeel free to modify these files during testing.\n", |
| 88 | + }, |
| 89 | + "config.json": { |
| 90 | + source: |
| 91 | + '{\n "app": {\n "name": "Test Application",\n "version": "1.0.0",\n "debug": true\n },\n "filesystem": {\n "root": "/tmp/filesystem",\n "max_file_size": 1048576,\n "allowed_extensions": [".txt", ".md", ".json", ".yaml", ".yml"]\n },\n "features": {\n "read": true,\n "write": true,\n "delete": false,\n "create_directories": true\n }\n}\n', |
| 92 | + }, |
| 93 | + "notes.txt": { |
| 94 | + source: |
| 95 | + "Meeting Notes - 2024-01-15\n\nAgenda:\n1. Project status review\n2. Next sprint planning\n3. Technical debt discussion\n\nAction Items:\n- Update documentation\n- Review pull requests\n- Schedule team meeting\n\nNotes:\nThe new filesystem API is working well. Need to add more test cases.\n", |
| 96 | + }, |
| 97 | + work: { |
| 98 | + dir: { |
| 99 | + projects: { |
| 100 | + dir: { |
| 101 | + ".gitkeep": { |
| 102 | + source: |
| 103 | + "# This file ensures the projects directory is tracked in git\n# Nested directory structure for testing\n", |
| 104 | + }, |
| 105 | + alpha: { |
| 106 | + dir: { |
| 107 | + ".gitkeep": { |
| 108 | + source: |
| 109 | + "# This file ensures the alpha directory is tracked in git\n# Deep nested directory for testing\n", |
| 110 | + }, |
| 111 | + }, |
| 112 | + }, |
| 113 | + beta: { |
| 114 | + dir: { |
| 115 | + ".gitkeep": { |
| 116 | + source: |
| 117 | + "# This file ensures the beta directory is tracked in git\n# Another nested directory for testing\n", |
| 118 | + }, |
| 119 | + }, |
| 120 | + }, |
| 121 | + }, |
| 122 | + }, |
| 123 | + }, |
| 124 | + }, |
| 125 | + }, |
| 126 | + }, |
| 127 | + logs: { |
| 128 | + dir: { |
| 129 | + "app.log": { |
| 130 | + source: |
| 131 | + "2024-01-15 10:30:15 INFO Application started\n2024-01-15 10:30:16 INFO Loading configuration from config.json\n2024-01-15 10:30:17 INFO Filesystem initialized with root: /tmp/filesystem\n2024-01-15 10:30:18 INFO User authentication successful\n2024-01-15 10:30:19 INFO File read operation: documents/notes.txt\n2024-01-15 10:30:20 INFO File write operation: temp/test.txt\n2024-01-15 10:30:21 WARN Large file detected: backup/archive.tar.gz\n2024-01-15 10:30:22 INFO Directory listing: documents/\n2024-01-15 10:30:23 INFO File delete operation: temp/old_file.txt\n2024-01-15 10:30:24 ERROR Permission denied: /etc/passwd\n2024-01-15 10:30:25 INFO Application shutdown\n", |
| 132 | + }, |
| 133 | + errors: { |
| 134 | + dir: { |
| 135 | + ".gitkeep": { |
| 136 | + source: |
| 137 | + "# This file ensures the errors directory is tracked in git\n# Error logs nested directory for testing\n", |
| 138 | + }, |
| 139 | + critical: { |
| 140 | + dir: { |
| 141 | + ".gitkeep": { |
| 142 | + source: |
| 143 | + "# This file ensures the critical directory is tracked in git\n# Critical error logs nested directory for testing\n", |
| 144 | + }, |
| 145 | + }, |
| 146 | + }, |
| 147 | + warning: { |
| 148 | + dir: { |
| 149 | + ".gitkeep": { |
| 150 | + source: |
| 151 | + "# This file ensures the warning directory is tracked in git\n# Warning logs nested directory for testing\n", |
| 152 | + }, |
| 153 | + }, |
| 154 | + }, |
| 155 | + }, |
| 156 | + }, |
| 157 | + }, |
| 158 | + }, |
| 159 | + }, |
| 160 | + }; |
| 161 | +} |
0 commit comments