topsyde-utils 1.0.147 → 1.0.149
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.
@@ -2,6 +2,8 @@ import type { Plugin } from "vite";
|
|
2
2
|
/**
|
3
3
|
* Creates a Vite plugin that provides compatibility for topsyde-utils in browser environments
|
4
4
|
* by disabling sourcemaps and providing mock implementations of Node.js modules.
|
5
|
+
*
|
6
|
+
* @returns A single Vite plugin with all necessary functionality
|
5
7
|
*/
|
6
|
-
export declare function TopsydeUtilsVitePlugin(): Plugin
|
8
|
+
export declare function TopsydeUtilsVitePlugin(): Plugin;
|
7
9
|
export default TopsydeUtilsVitePlugin;
|
@@ -1,79 +1,74 @@
|
|
1
1
|
/**
|
2
2
|
* Creates a Vite plugin that provides compatibility for topsyde-utils in browser environments
|
3
3
|
* by disabling sourcemaps and providing mock implementations of Node.js modules.
|
4
|
+
*
|
5
|
+
* @returns A single Vite plugin with all necessary functionality
|
4
6
|
*/
|
5
7
|
export function TopsydeUtilsVitePlugin() {
|
6
|
-
return
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}
|
17
|
-
},
|
8
|
+
return {
|
9
|
+
name: "topsyde-utils-compatibility",
|
10
|
+
// Disable sourcemaps for topsyde-utils
|
11
|
+
transform(code, id) {
|
12
|
+
if (id.includes("node_modules/topsyde-utils")) {
|
13
|
+
return {
|
14
|
+
code,
|
15
|
+
map: { mappings: "" }, // Return empty sourcemap
|
16
|
+
};
|
17
|
+
}
|
18
18
|
},
|
19
|
-
//
|
20
|
-
{
|
21
|
-
|
22
|
-
|
23
|
-
if (id === "virtual:path" || id === "virtual:fs") {
|
24
|
-
return id;
|
25
|
-
}
|
26
|
-
return null;
|
27
|
-
},
|
28
|
-
load(id) {
|
29
|
-
if (id === "virtual:path") {
|
30
|
-
return `
|
31
|
-
export function join() { return ''; }
|
32
|
-
export function resolve() { return ''; }
|
33
|
-
export function dirname() { return ''; }
|
34
|
-
export function basename() { return ''; }
|
35
|
-
export function extname() { return ''; }
|
36
|
-
export default { join, resolve, dirname, basename, extname };
|
37
|
-
`;
|
38
|
-
}
|
39
|
-
if (id === "virtual:fs") {
|
40
|
-
return `
|
41
|
-
export function readFileSync() { return ''; }
|
42
|
-
export function existsSync() { return false; }
|
43
|
-
export function writeFileSync() { return null; }
|
44
|
-
export function readdirSync() { return []; }
|
45
|
-
export function statSync() {
|
46
|
-
return {
|
47
|
-
isDirectory: () => false,
|
48
|
-
isFile: () => true
|
49
|
-
};
|
19
|
+
// Handle virtual modules for Node.js built-ins
|
20
|
+
resolveId(id) {
|
21
|
+
if (id === "virtual:path" || id === "virtual:fs") {
|
22
|
+
return id;
|
50
23
|
}
|
51
|
-
|
52
|
-
`;
|
53
|
-
}
|
54
|
-
return null;
|
55
|
-
},
|
24
|
+
return null;
|
56
25
|
},
|
57
|
-
//
|
58
|
-
{
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
26
|
+
// Provide virtual module implementations
|
27
|
+
load(id) {
|
28
|
+
if (id === "virtual:path") {
|
29
|
+
return `
|
30
|
+
export function join() { return ''; }
|
31
|
+
export function resolve() { return ''; }
|
32
|
+
export function dirname() { return ''; }
|
33
|
+
export function basename() { return ''; }
|
34
|
+
export function extname() { return ''; }
|
35
|
+
export default { join, resolve, dirname, basename, extname };
|
36
|
+
`;
|
37
|
+
}
|
38
|
+
if (id === "virtual:fs") {
|
39
|
+
return `
|
40
|
+
export function readFileSync() { return ''; }
|
41
|
+
export function existsSync() { return false; }
|
42
|
+
export function writeFileSync() { return null; }
|
43
|
+
export function readdirSync() { return []; }
|
44
|
+
export function statSync() {
|
45
|
+
return {
|
46
|
+
isDirectory: () => false,
|
47
|
+
isFile: () => true
|
48
|
+
};
|
49
|
+
}
|
50
|
+
export default { readFileSync, existsSync, writeFileSync, readdirSync, statSync };
|
51
|
+
`;
|
52
|
+
}
|
53
|
+
return null;
|
54
|
+
},
|
55
|
+
// Configure aliases and optimization
|
56
|
+
config() {
|
57
|
+
return {
|
58
|
+
resolve: {
|
59
|
+
alias: {
|
60
|
+
// Alias Node.js built-ins to virtual modules
|
61
|
+
path: "virtual:path",
|
62
|
+
fs: "virtual:fs",
|
71
63
|
},
|
72
|
-
}
|
73
|
-
|
64
|
+
},
|
65
|
+
optimizeDeps: {
|
66
|
+
exclude: ["topsyde-utils"],
|
67
|
+
},
|
68
|
+
};
|
74
69
|
},
|
75
|
-
|
70
|
+
};
|
76
71
|
}
|
77
|
-
//
|
72
|
+
// Export as default for compatibility with different import styles
|
78
73
|
export default TopsydeUtilsVitePlugin;
|
79
74
|
//# sourceMappingURL=topsydeUtilsVitePlugin.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"topsydeUtilsVitePlugin.js","sourceRoot":"","sources":["../../../../src/client/vite/plugins/topsydeUtilsVitePlugin.ts"],"names":[],"mappings":"AAEA
|
1
|
+
{"version":3,"file":"topsydeUtilsVitePlugin.js","sourceRoot":"","sources":["../../../../src/client/vite/plugins/topsydeUtilsVitePlugin.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB;IACrC,OAAO;QACN,IAAI,EAAE,6BAA6B;QAEnC,uCAAuC;QACvC,SAAS,CAAC,IAAI,EAAE,EAAE;YACjB,IAAI,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;gBAC/C,OAAO;oBACN,IAAI;oBACJ,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,yBAAyB;iBAChD,CAAC;YACH,CAAC;QACF,CAAC;QAED,+CAA+C;QAC/C,SAAS,CAAC,EAAE;YACX,IAAI,EAAE,KAAK,cAAc,IAAI,EAAE,KAAK,YAAY,EAAE,CAAC;gBAClD,OAAO,EAAE,CAAC;YACX,CAAC;YACD,OAAO,IAAI,CAAC;QACb,CAAC;QAED,yCAAyC;QACzC,IAAI,CAAC,EAAE;YACN,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;gBAC3B,OAAO;;;;;;;SAOF,CAAC;YACP,CAAC;YACD,IAAI,EAAE,KAAK,YAAY,EAAE,CAAC;gBACzB,OAAO;;;;;;;;;;;;SAYF,CAAC;YACP,CAAC;YACD,OAAO,IAAI,CAAC;QACb,CAAC;QAED,qCAAqC;QACrC,MAAM;YACL,OAAO;gBACN,OAAO,EAAE;oBACR,KAAK,EAAE;wBACN,6CAA6C;wBAC7C,IAAI,EAAE,cAAc;wBACpB,EAAE,EAAE,YAAY;qBAChB;iBACD;gBACD,YAAY,EAAE;oBACb,OAAO,EAAE,CAAC,eAAe,CAAC;iBAC1B;aACD,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC;AAED,mEAAmE;AACnE,eAAe,sBAAsB,CAAC"}
|