@motiadev/workbench 0.6.0-beta.122 → 0.6.1-beta.124

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
  };
@@ -38,6 +38,7 @@ export const useTutorialEngine = () => {
38
38
  // Run any before actions
39
39
  if (step.before) {
40
40
  for (const action of step.before) {
41
+ const monaco = window.monaco;
41
42
  if (action.type === 'click') {
42
43
  const element = await waitForElementByXPath(action.selector, action.optional);
43
44
  if (element) {
@@ -131,10 +132,15 @@ export const useTutorialEngine = () => {
131
132
  }
132
133
  };
133
134
  useEffect(() => {
134
- importFile('tutorial.tsx').then((module) => {
135
+ importFile('tutorial.tsx')
136
+ .then((module) => {
135
137
  if (Array.isArray(module.steps) && module.steps.length > 0) {
136
138
  MotiaTutorial.register(module.steps);
137
139
  }
140
+ })
141
+ .catch((error) => {
142
+ // Tutorial file is optional, so we don't need to throw an error
143
+ console.log('Tutorial file not found or could not be loaded:', error.message);
138
144
  });
139
145
  }, []);
140
146
  useEffect(() => {