@lobb-js/studio 0.28.4 → 0.28.6
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobb-js/studio",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "0.28.
|
|
4
|
+
"version": "0.28.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"storybook": "^10.0.1",
|
|
65
65
|
"svelte": "^5.49.1",
|
|
66
66
|
"svelte-check": "^4.3.4",
|
|
67
|
-
"tailwindcss": "4.
|
|
67
|
+
"tailwindcss": "4.3.0",
|
|
68
68
|
"tailwindcss-animate": "^1.0.7",
|
|
69
69
|
"tw-animate-css": "^1.4.0",
|
|
70
70
|
"typescript": "~5.9.3",
|
|
71
|
-
"vite": "^
|
|
71
|
+
"vite": "^8.0.13",
|
|
72
72
|
"vitest": "^4.0.5",
|
|
73
73
|
"@types/lodash-es": "^4.17.12"
|
|
74
74
|
},
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@internationalized/date": "^3.12.0",
|
|
90
90
|
"@lobb-js/sdk": "^0.1.6",
|
|
91
91
|
"@lucide/svelte": "^0.563.1",
|
|
92
|
-
"@tailwindcss/vite": "^4.
|
|
92
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
93
93
|
"@tiptap/core": "^3.0.0",
|
|
94
94
|
"@tiptap/extension-link": "^3.0.0",
|
|
95
95
|
"@tiptap/extension-underline": "^3.0.0",
|
|
@@ -13,14 +13,15 @@ export function lobbExtensionsPlugin() {
|
|
|
13
13
|
|
|
14
14
|
return {
|
|
15
15
|
name: "lobb-studio-extensions",
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
16
|
+
// The dep optimizer's bundler doesn't run our resolveId/load hooks, so any
|
|
17
|
+
// package whose prebundled output references this virtual module would
|
|
18
|
+
// crash with "Failed to resolve". Excluding the bare virtual ID tells the
|
|
19
|
+
// optimizer to leave the import statement untouched, so the browser asks
|
|
20
|
+
// the dev server for it at runtime — where the hooks below actually fire.
|
|
20
21
|
config() {
|
|
21
22
|
return {
|
|
22
23
|
optimizeDeps: {
|
|
23
|
-
exclude: [
|
|
24
|
+
exclude: [virtualModuleId],
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
},
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* In monorepo dev, workspace packages are symlinked into node_modules.
|
|
6
|
+
* Vite's default `server.fs.allow` only covers the project root, so requests
|
|
7
|
+
* for files inside those symlinked packages (source maps, HMR updates, etc.)
|
|
8
|
+
* are denied. This plugin walks up from cwd to find the monorepo root and
|
|
9
|
+
* allows Vite to serve from there.
|
|
8
10
|
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
* - entries: Tells Vite to crawl workspace packages at startup so
|
|
12
|
-
* all their deps are discovered and pre-bundled upfront
|
|
13
|
-
* (avoids 504 timeouts on first browser load).
|
|
14
|
-
* - holdUntilCrawlEnd: Blocks the first response until optimization is done.
|
|
15
|
-
* - server.fs.allow: Allows Vite to serve files from the monorepo root
|
|
16
|
-
* (needed to follow symlinks into workspace packages).
|
|
17
|
-
*
|
|
18
|
-
* For standalone users (real npm install, no symlinks) all lists are empty and
|
|
19
|
-
* the config has no effect.
|
|
11
|
+
* For standalone npm-installed users there's no workspaces field above them,
|
|
12
|
+
* the plugin does nothing, and the config has no effect.
|
|
20
13
|
*
|
|
21
14
|
* @returns {import('vite').Plugin}
|
|
22
15
|
*/
|
|
@@ -26,18 +19,13 @@ export function lobbWorkspaceOptimize() {
|
|
|
26
19
|
config(_, { command }) {
|
|
27
20
|
if (command !== "serve") return;
|
|
28
21
|
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
22
|
+
const monorepoRoot = findMonorepoRoot();
|
|
23
|
+
if (!monorepoRoot) return;
|
|
31
24
|
|
|
32
25
|
return {
|
|
33
|
-
optimizeDeps: {
|
|
34
|
-
holdUntilCrawlEnd: true,
|
|
35
|
-
entries: getWorkspaceEntries(workspacePkgs),
|
|
36
|
-
exclude: workspacePkgs,
|
|
37
|
-
},
|
|
38
26
|
server: {
|
|
39
27
|
fs: {
|
|
40
|
-
allow: [
|
|
28
|
+
allow: [monorepoRoot],
|
|
41
29
|
},
|
|
42
30
|
},
|
|
43
31
|
};
|
|
@@ -45,62 +33,15 @@ export function lobbWorkspaceOptimize() {
|
|
|
45
33
|
};
|
|
46
34
|
}
|
|
47
35
|
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return readdirSync(dir)
|
|
52
|
-
.filter((pkg) => lstatSync(join(dir, pkg)).isSymbolicLink())
|
|
53
|
-
.map((pkg) => `@lobb-js/${pkg}`);
|
|
54
|
-
} catch {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function getMonorepoRoot(pkgNames) {
|
|
61
|
-
for (const name of pkgNames) {
|
|
62
|
-
try {
|
|
63
|
-
const realPath = realpathSync(resolve(`node_modules/${name}`));
|
|
64
|
-
// realPath is e.g. /root/lobb/packages/studio — go up to find the monorepo root
|
|
65
|
-
let dir = realPath;
|
|
66
|
-
for (let i = 0; i < 5; i++) {
|
|
67
|
-
const parent = dirname(dir);
|
|
68
|
-
if (parent === dir) break;
|
|
69
|
-
const pkgJson = tryReadJson(join(parent, "package.json"));
|
|
70
|
-
if (pkgJson?.workspaces) return parent;
|
|
71
|
-
dir = parent;
|
|
72
|
-
}
|
|
73
|
-
} catch { /* skip */ }
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function getWorkspaceEntries(pkgNames) {
|
|
79
|
-
const entries = [];
|
|
80
|
-
for (const name of pkgNames) {
|
|
36
|
+
function findMonorepoRoot() {
|
|
37
|
+
let dir = process.cwd();
|
|
38
|
+
while (true) {
|
|
81
39
|
try {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
pkg.module ??
|
|
89
|
-
pkg.main ??
|
|
90
|
-
(typeof exportsField?.["."] === "string"
|
|
91
|
-
? exportsField["."]
|
|
92
|
-
: exportsField?.["."]?.default);
|
|
93
|
-
if (typeof entry === "string") entries.push(join(realPath, entry));
|
|
94
|
-
} catch { /* skip */ }
|
|
95
|
-
}
|
|
96
|
-
return entries;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
function tryReadJson(filePath) {
|
|
101
|
-
try {
|
|
102
|
-
return JSON.parse(readFileSync(filePath, "utf-8"));
|
|
103
|
-
} catch {
|
|
104
|
-
return null;
|
|
40
|
+
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
|
|
41
|
+
if (pkg?.workspaces) return dir;
|
|
42
|
+
} catch { /* no package.json here, keep walking */ }
|
|
43
|
+
const parent = dirname(dir);
|
|
44
|
+
if (parent === dir) return null;
|
|
45
|
+
dir = parent;
|
|
105
46
|
}
|
|
106
47
|
}
|