fluidcad 0.0.8 → 0.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.
- package/lib/dist/index.js +1 -1
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/server/dist/fluidcad-server.js +3 -2
- package/server/dist/index.js +2 -1
- package/server/dist/normalize-path.d.ts +6 -0
- package/server/dist/normalize-path.js +8 -0
- package/server/dist/vite-manager.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
3
|
import { ViteManager } from "./vite-manager.js";
|
|
4
|
+
import { normalizePath } from "./normalize-path.js";
|
|
4
5
|
export class FluidCadServer {
|
|
5
6
|
viteManager = new ViteManager();
|
|
6
7
|
sceneManager;
|
|
@@ -9,7 +10,7 @@ export class FluidCadServer {
|
|
|
9
10
|
currentFileName = '';
|
|
10
11
|
async init(workspacePath) {
|
|
11
12
|
await this.viteManager.init(workspacePath);
|
|
12
|
-
const initFilePath = join(workspacePath, 'init.js');
|
|
13
|
+
const initFilePath = normalizePath(join(workspacePath, 'init.js'));
|
|
13
14
|
if (existsSync(initFilePath)) {
|
|
14
15
|
const { default: _sceneManager } = await this.viteManager.loadModule(initFilePath);
|
|
15
16
|
this.sceneManager = await _sceneManager;
|
|
@@ -19,7 +20,7 @@ export class FluidCadServer {
|
|
|
19
20
|
if (!this.sceneManager) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
const normalizedFileName = filePath.replace('virtual:live-render:', '');
|
|
23
|
+
const normalizedFileName = normalizePath(filePath.replace('virtual:live-render:', ''));
|
|
23
24
|
this.currentFileName = normalizedFileName;
|
|
24
25
|
if (!ignoreCache) {
|
|
25
26
|
const fromCache = this.renderingCache.get(normalizedFileName);
|
package/server/dist/index.js
CHANGED
|
@@ -8,8 +8,9 @@ import { createPropertiesRouter } from "./routes/properties.js";
|
|
|
8
8
|
import { createActionsRouter } from "./routes/actions.js";
|
|
9
9
|
import { createExportRouter } from "./routes/export.js";
|
|
10
10
|
import { createScreenshotRouter } from "./routes/screenshot.js";
|
|
11
|
+
import { normalizePath } from "./normalize-path.js";
|
|
11
12
|
const PORT = parseInt(process.env.FLUIDCAD_SERVER_PORT || '3100', 10);
|
|
12
|
-
const WORKSPACE_PATH = process.env.FLUIDCAD_WORKSPACE_PATH || '';
|
|
13
|
+
const WORKSPACE_PATH = normalizePath(process.env.FLUIDCAD_WORKSPACE_PATH || '');
|
|
13
14
|
const UI_DIST = path.resolve(import.meta.dirname, '../../ui/dist');
|
|
14
15
|
// ---------------------------------------------------------------------------
|
|
15
16
|
// IPC helpers — communication with extension host process
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createServer } from 'vite';
|
|
2
2
|
import { dirname, resolve, isAbsolute } from 'path';
|
|
3
|
+
import { normalizePath } from "./normalize-path.js";
|
|
3
4
|
const BLOCKED_NODE_MODULES = new Set([
|
|
4
5
|
'fs',
|
|
5
6
|
'child_process',
|
|
@@ -42,7 +43,7 @@ export class ViteManager {
|
|
|
42
43
|
rootPath = '';
|
|
43
44
|
buffers = new Map();
|
|
44
45
|
async init(rootPath) {
|
|
45
|
-
this.rootPath = rootPath;
|
|
46
|
+
this.rootPath = normalizePath(rootPath);
|
|
46
47
|
const that = this;
|
|
47
48
|
this.server = await createServer({
|
|
48
49
|
root: rootPath,
|
|
@@ -66,7 +67,7 @@ export class ViteManager {
|
|
|
66
67
|
// Resolve relative imports from virtual modules against the real file path
|
|
67
68
|
if (importer && importer.startsWith('virtual:live-render:') && !isAbsolute(id)) {
|
|
68
69
|
const realImporter = importer.replace('virtual:live-render:', '');
|
|
69
|
-
return resolve(dirname(realImporter), id);
|
|
70
|
+
return normalizePath(resolve(dirname(realImporter), id));
|
|
70
71
|
}
|
|
71
72
|
},
|
|
72
73
|
transform(code, id) {
|