vfsjs-test 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/main.js +16 -30
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -1,7 +1,5 @@
1
- // main.js - Simple Developer Interface Facade
2
- const display = document.getElementById('status');
1
+ // main.js - User API Facade and Browser Orchestration
3
2
 
4
- // Clean user-facing API surface area
5
3
  window.vfs = {
6
4
  add(filename, contentString, customMime = null) {
7
5
  return window._vfsKernel.write(filename, contentString, customMime);
@@ -11,43 +9,31 @@ window.vfs = {
11
9
  },
12
10
  clear() {
13
11
  return window._vfsKernel.wipe();
14
- },
15
- hook(filename, type) {
16
- // type should be 'js' or 'css'
17
- return window._vfsKernel.mount(filename, type);
18
- },
19
- unhook() {
20
- return window._vfsKernel.unmount();
21
12
  }
22
13
  };
23
14
 
24
15
  async function startDeveloperWorkspace() {
25
- // 1. Fire up the kernel underneath automatically
26
- const ready = await window._vfsKernel.init();
27
- if (!ready) return;
16
+ // FIX: Look up the display element now that the DOM layout is guaranteed to exist
17
+ const display = document.getElementById('status');
18
+ if (display) display.innerHTML += "<br>> Running developer asset deployment...";
28
19
 
29
- display.innerHTML += "<br>> Running developer asset deployment...";
30
-
31
- // 2. Add your scripts and styles to memory
32
- vfs.add('live-theme.css', `
20
+ // Add your scripts and styles to memory target registers
21
+ vfs.add('live_theme.css', `
33
22
  body { background: #020617 !important; color: #a5f3fc !important; }
34
23
  #status { border-color: #334155 !important; background: #0f172a !important; }
35
24
  `, 'text/css');
36
25
 
37
26
  vfs.add('index.js', `
38
- console.log("VFS Engine: Hooked successfully!");
39
- document.getElementById('status').innerHTML += "<br>> <span style='color: #22c55e;'>Virtual asset code running live!</span>";
27
+ console.log("VFS Engine: Intercepted via head script execution successfully!");
28
+ const statusEl = document.getElementById('status');
29
+ if (statusEl) statusEl.innerHTML += "<br>> <span style='color: #22c55e;'>Virtual asset code running live!</span>";
40
30
  `, 'text/javascript');
41
-
42
- // Give the worker split-second thread cache timing
43
- await new Promise(r => setTimeout(r, 50));
44
-
45
- // 3. Mount them into the page environment using your new API!
46
- vfs.hook('live-theme.css', 'css');
47
- vfs.hook('index.js', 'js');
48
-
49
- // Example Test: You can run vfs.unhook() anytime later to completely pull them out!
50
- // setTimeout(() => { vfs.unhook(); }, 5000);
51
31
  }
52
32
 
53
- startDeveloperWorkspace();
33
+ // FIX: Wait for the DOM to be built before initializing the workspace thread structures
34
+ document.addEventListener('DOMContentLoaded', async () => {
35
+ const ready = await window._vfsKernel.init();
36
+ if (ready) {
37
+ startDeveloperWorkspace();
38
+ }
39
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vfsjs-test",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "index.html",
6
6
  "scripts": {