vite-node 0.1.9 → 0.1.10

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/index.mjs +8 -8
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -107,10 +107,15 @@ function normalizeId(id) {
107
107
  }
108
108
 
109
109
  function toFilePath(id, server) {
110
- const absolute = id.startsWith('/@fs/')
110
+ let absolute = id.startsWith('/@fs/')
111
111
  ? id.slice(4)
112
112
  : slash(resolve(server.config.root, id.slice(1)))
113
113
 
114
+ if (absolute.startsWith('//'))
115
+ absolute = absolute.slice(1)
116
+ if (!absolute.startsWith('/'))
117
+ absolute = `/${absolute}`
118
+
114
119
  return absolute
115
120
  }
116
121
 
@@ -142,13 +147,8 @@ async function execute(files, server, shouldExternalize) {
142
147
 
143
148
  debugRequest(absolute)
144
149
 
145
- // for windows
146
- const unifiedPath = absolute[0] !== '/'
147
- ? `/${absolute}`
148
- : absolute
149
-
150
150
  if (shouldExternalize(absolute))
151
- return import(unifiedPath)
151
+ return import(absolute)
152
152
 
153
153
  const result = await server.transformRequest(id, { ssr: true })
154
154
  if (!result)
@@ -156,7 +156,7 @@ async function execute(files, server, shouldExternalize) {
156
156
 
157
157
  debugTransform(id, result.code)
158
158
 
159
- const url = pathToFileURL(unifiedPath)
159
+ const url = pathToFileURL(absolute)
160
160
  const exports = {}
161
161
 
162
162
  const context = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-node",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Vite as Node runtime",
5
5
  "keywords": [
6
6
  "vite"