@gjsify/vite-plugin-gjsify 0.64.11 → 0.64.12-next.280
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/nativescript-dedupe.d.ts +7 -4
- package/lib/nativescript-dedupe.js +37 -11
- package/package.json +10 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Names of the
|
|
3
|
-
*
|
|
2
|
+
* Names of the packages in `<root>/node_modules` or in any ancestor's that
|
|
3
|
+
* must resolve to ONE instance, for `resolve.dedupe`: every `@gjsify/*`
|
|
4
|
+
* package, plus every workspace-linked package (scoped or not).
|
|
4
5
|
*
|
|
5
6
|
* `gjsify install` links every workspace dep into the requester's own
|
|
6
7
|
* `node_modules/` (`<pkg>/node_modules/@gjsify/<dep>`). Under `gjsify link`
|
|
@@ -8,8 +9,10 @@
|
|
|
8
9
|
* `@nativescript/vite` sets `resolve.preserveSymlinks: true`, so the nested link
|
|
9
10
|
* keeps its own path spelling: one package becomes TWO modules in the bundle
|
|
10
11
|
* (`@gjsify/adwaita-core` twice, then "'gtk:Box' resolves to class GtkBox$1").
|
|
11
|
-
* Deduping resolves every
|
|
12
|
-
*
|
|
12
|
+
* Deduping resolves every such import through the consumer instead, so its
|
|
13
|
+
* copy is the only one. Learn6502 hit the same with its own workspace packages
|
|
14
|
+
* (`@learn6502/common-ui` twice, so two `EditorController` singletons), hence
|
|
15
|
+
* the symlink check: a regular installed package is not linked per requester.
|
|
13
16
|
*
|
|
14
17
|
* Walks UP, merging every level: in a workspace the app dir usually has no
|
|
15
18
|
* `node_modules` of its own because deps are hoisted to the workspace root, and
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { existsSync, readdirSync } from 'node:fs';
|
|
2
|
-
import { dirname, join, resolve } from 'node:path';
|
|
1
|
+
import { existsSync, lstatSync, readdirSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve, sep } from 'node:path';
|
|
3
|
+
/** A workspace link: a symlink whose target lies outside any `node_modules`. */
|
|
4
|
+
function isWorkspaceLink(path) {
|
|
5
|
+
try {
|
|
6
|
+
if (!lstatSync(path).isSymbolicLink())
|
|
7
|
+
return false;
|
|
8
|
+
return !`${sep}${realpathSync(path)}${sep}`.includes(`${sep}node_modules${sep}`);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false; // dangling link
|
|
12
|
+
}
|
|
13
|
+
}
|
|
3
14
|
/**
|
|
4
|
-
* Names of the
|
|
5
|
-
*
|
|
15
|
+
* Names of the packages in `<root>/node_modules` or in any ancestor's that
|
|
16
|
+
* must resolve to ONE instance, for `resolve.dedupe`: every `@gjsify/*`
|
|
17
|
+
* package, plus every workspace-linked package (scoped or not).
|
|
6
18
|
*
|
|
7
19
|
* `gjsify install` links every workspace dep into the requester's own
|
|
8
20
|
* `node_modules/` (`<pkg>/node_modules/@gjsify/<dep>`). Under `gjsify link`
|
|
@@ -10,8 +22,10 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
10
22
|
* `@nativescript/vite` sets `resolve.preserveSymlinks: true`, so the nested link
|
|
11
23
|
* keeps its own path spelling: one package becomes TWO modules in the bundle
|
|
12
24
|
* (`@gjsify/adwaita-core` twice, then "'gtk:Box' resolves to class GtkBox$1").
|
|
13
|
-
* Deduping resolves every
|
|
14
|
-
*
|
|
25
|
+
* Deduping resolves every such import through the consumer instead, so its
|
|
26
|
+
* copy is the only one. Learn6502 hit the same with its own workspace packages
|
|
27
|
+
* (`@learn6502/common-ui` twice, so two `EditorController` singletons), hence
|
|
28
|
+
* the symlink check: a regular installed package is not linked per requester.
|
|
15
29
|
*
|
|
16
30
|
* Walks UP, merging every level: in a workspace the app dir usually has no
|
|
17
31
|
* `node_modules` of its own because deps are hoisted to the workspace root, and
|
|
@@ -21,11 +35,23 @@ export function installedGjsifyPackages(root) {
|
|
|
21
35
|
const names = new Set();
|
|
22
36
|
let dir = resolve(root);
|
|
23
37
|
while (true) {
|
|
24
|
-
const
|
|
25
|
-
if (existsSync(
|
|
26
|
-
for (const
|
|
27
|
-
if (
|
|
28
|
-
|
|
38
|
+
const modules = join(dir, 'node_modules');
|
|
39
|
+
if (existsSync(modules)) {
|
|
40
|
+
for (const entry of readdirSync(modules)) {
|
|
41
|
+
if (entry.startsWith('.'))
|
|
42
|
+
continue;
|
|
43
|
+
if (entry.startsWith('@')) {
|
|
44
|
+
for (const name of readdirSync(join(modules, entry))) {
|
|
45
|
+
if (name.startsWith('.'))
|
|
46
|
+
continue;
|
|
47
|
+
if (entry === '@gjsify' || isWorkspaceLink(join(modules, entry, name))) {
|
|
48
|
+
names.add(`${entry}/${name}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (isWorkspaceLink(join(modules, entry))) {
|
|
53
|
+
names.add(entry);
|
|
54
|
+
}
|
|
29
55
|
}
|
|
30
56
|
}
|
|
31
57
|
const parent = dirname(dir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/vite-plugin-gjsify",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.12-next.280",
|
|
4
4
|
"description": "Vite plugin presets mirroring `gjsify build --app browser` / `--app nativescript` — dev (Vite/HMR) parity with the gjsify CLI targets.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
],
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@gjsify/empty": "
|
|
47
|
-
"@gjsify/resolve-npm": "
|
|
48
|
-
"@gjsify/rolldown-plugin-deepkit": "
|
|
49
|
-
"@gjsify/rolldown-plugin-gjsify": "
|
|
50
|
-
"@gjsify/vite-plugin-blueprint": "
|
|
46
|
+
"@gjsify/empty": "0.64.12-next.280",
|
|
47
|
+
"@gjsify/resolve-npm": "0.64.12-next.280",
|
|
48
|
+
"@gjsify/rolldown-plugin-deepkit": "0.64.12-next.280",
|
|
49
|
+
"@gjsify/rolldown-plugin-gjsify": "0.64.12-next.280",
|
|
50
|
+
"@gjsify/vite-plugin-blueprint": "0.64.12-next.280"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"vite": "^8.1.3"
|
|
@@ -58,13 +58,14 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@gjsify/cli": "
|
|
62
|
-
"@gjsify/unit": "
|
|
61
|
+
"@gjsify/cli": "0.64.12-next.280",
|
|
62
|
+
"@gjsify/unit": "0.64.12-next.280",
|
|
63
63
|
"@types/node": "^25.9.2",
|
|
64
64
|
"typescript": "^6.0.3",
|
|
65
65
|
"vite": "^8.1.3"
|
|
66
66
|
},
|
|
67
67
|
"gjsify": {
|
|
68
68
|
"tier": 1
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"gitHead": "0a9185d91127072fce6aa54dc126e87e6ecd0c3d"
|
|
70
71
|
}
|