@motiadev/workbench 0.5.11-beta.120-777374 → 0.5.11-beta.120-568724

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/dist/index.html CHANGED
@@ -45,7 +45,33 @@
45
45
 
46
46
  <script>
47
47
  const importFile = async (path) => {
48
- return await import(/* @vite-ignore */ `/@fs/${processCwd}/${path}`)
48
+ // Normalize the path for cross-platform compatibility
49
+ const normalizedPath = path.replace(/\\/g, '/')
50
+ const fullPath = `${processCwd}/${normalizedPath}`.replace(/\\/g, '/')
51
+
52
+ // Handle Windows drive letters properly
53
+ let importPath = fullPath
54
+ if (navigator.platform.includes('Win')) {
55
+ // On Windows, ensure proper drive letter handling
56
+ if (fullPath.match(/^[A-Za-z]:/)) {
57
+ importPath = `/@fs/${fullPath}`
58
+ } else {
59
+ importPath = `/@fs/${fullPath}`
60
+ }
61
+ } else {
62
+ importPath = `/@fs/${fullPath}`
63
+ }
64
+
65
+ try {
66
+ return await import(/* @vite-ignore */ importPath)
67
+ } catch (error) {
68
+ console.error(`Failed to import ${path}:`, error)
69
+ // Return empty module if tutorial.tsx doesn't exist
70
+ if (path === 'tutorial.tsx') {
71
+ return { steps: [] }
72
+ }
73
+ throw error
74
+ }
49
75
  }
50
76
  </script>
51
77
 
@@ -12,7 +12,8 @@ const processCwdPlugin = () => {
12
12
  return {
13
13
  name: 'html-transform',
14
14
  transformIndexHtml: (html) => {
15
- const cwd = process.cwd();
15
+ // Normalize path for cross-platform compatibility
16
+ const cwd = process.cwd().replace(/\\/g, '/');
16
17
  return html.replace('</head>', `<script>const processCwd = "${cwd}";</script></head>`);
17
18
  },
18
19
  };
@@ -131,10 +131,15 @@ export const useTutorialEngine = () => {
131
131
  }
132
132
  };
133
133
  useEffect(() => {
134
- importFile('tutorial.tsx').then((module) => {
134
+ importFile('tutorial.tsx')
135
+ .then((module) => {
135
136
  if (Array.isArray(module.steps) && module.steps.length > 0) {
136
137
  MotiaTutorial.register(module.steps);
137
138
  }
139
+ })
140
+ .catch((error) => {
141
+ // Tutorial file is optional, so we don't need to throw an error
142
+ console.log('Tutorial file not found or could not be loaded:', error.message);
138
143
  });
139
144
  }, []);
140
145
  useEffect(() => {