fluidcad 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluidcad",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Parametric CAD modeling library using javascript",
5
5
  "author": "Marwan Aouida <contact@marwan.dev>",
6
6
  "homepage": "https://fluidcad.io",
@@ -20,7 +20,8 @@ export class FluidCadServer {
20
20
  if (!this.sceneManager) {
21
21
  return null;
22
22
  }
23
- const normalizedFileName = normalizePath(filePath.replace('virtual:live-render:', ''));
23
+ filePath = normalizePath(filePath);
24
+ const normalizedFileName = filePath.replace('virtual:live-render:', '');
24
25
  this.currentFileName = normalizedFileName;
25
26
  if (!ignoreCache) {
26
27
  const fromCache = this.renderingCache.get(normalizedFileName);
@@ -65,6 +66,7 @@ export class FluidCadServer {
65
66
  }
66
67
  }
67
68
  async updateLiveCode(fileName, code) {
69
+ fileName = normalizePath(fileName);
68
70
  const id = `virtual:live-render:${fileName}`;
69
71
  this.viteManager.setBuffer(id, code);
70
72
  this.renderingCache.delete(fileName);
@@ -57,6 +57,9 @@ export class ViteManager {
57
57
  noDiscovery: true,
58
58
  include: []
59
59
  },
60
+ ssr: {
61
+ external: ['fluidcad']
62
+ },
60
63
  plugins: [
61
64
  {
62
65
  name: 'virtual-module',
@@ -71,7 +74,7 @@ export class ViteManager {
71
74
  }
72
75
  },
73
76
  transform(code, id) {
74
- if (id.startsWith(rootPath) || id.startsWith('virtual:live-render')) {
77
+ if ((id.startsWith(that.rootPath) && !id.includes('/node_modules/')) || id.startsWith('virtual:live-render')) {
75
78
  const blocked = scanForBlockedImports(code);
76
79
  if (blocked) {
77
80
  const moduleName = getBlockedNodeModule(blocked);
@@ -104,7 +107,7 @@ export class ViteManager {
104
107
  }
105
108
  invalidateModule() {
106
109
  for (const [id, mod] of this.server.moduleGraph.idToModuleMap) {
107
- if (id.startsWith(this.rootPath) || id.startsWith('virtual:live-render')) {
110
+ if ((id.startsWith(this.rootPath) && !id.includes('/node_modules/')) || id.startsWith('virtual:live-render')) {
108
111
  this.server.moduleGraph.invalidateModule(mod);
109
112
  }
110
113
  }