topsyde-utils 1.0.142 → 1.0.143
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.
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { Plugin } from
|
1
|
+
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
5
|
*/
|
6
|
-
|
6
|
+
declare function topsydeUtilsVitePlugin(): Plugin[];
|
7
7
|
export default topsydeUtilsVitePlugin;
|
@@ -2,31 +2,31 @@
|
|
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
4
|
*/
|
5
|
-
|
5
|
+
function topsydeUtilsVitePlugin() {
|
6
6
|
return [
|
7
7
|
// Plugin to disable sourcemaps for node_modules
|
8
8
|
{
|
9
|
-
name:
|
9
|
+
name: "topsyde-utils:disable-sourcemaps",
|
10
10
|
transform(code, id) {
|
11
|
-
if (id.includes(
|
11
|
+
if (id.includes("node_modules/topsyde-utils")) {
|
12
12
|
return {
|
13
13
|
code,
|
14
|
-
map: { mappings:
|
14
|
+
map: { mappings: "" }, // Return empty sourcemap
|
15
15
|
};
|
16
16
|
}
|
17
|
-
}
|
17
|
+
},
|
18
18
|
},
|
19
19
|
// Plugin to provide virtual modules for Node.js built-ins
|
20
20
|
{
|
21
|
-
name:
|
21
|
+
name: "topsyde-utils:node-polyfills",
|
22
22
|
resolveId(id) {
|
23
|
-
if (id ===
|
23
|
+
if (id === "virtual:path" || id === "virtual:fs") {
|
24
24
|
return id;
|
25
25
|
}
|
26
26
|
return null;
|
27
27
|
},
|
28
28
|
load(id) {
|
29
|
-
if (id ===
|
29
|
+
if (id === "virtual:path") {
|
30
30
|
return `
|
31
31
|
export function join() { return ''; }
|
32
32
|
export function resolve() { return ''; }
|
@@ -36,7 +36,7 @@ export function topsydeUtilsVitePlugin() {
|
|
36
36
|
export default { join, resolve, dirname, basename, extname };
|
37
37
|
`;
|
38
38
|
}
|
39
|
-
if (id ===
|
39
|
+
if (id === "virtual:fs") {
|
40
40
|
return `
|
41
41
|
export function readFileSync() { return ''; }
|
42
42
|
export function existsSync() { return false; }
|
@@ -52,26 +52,26 @@ export function topsydeUtilsVitePlugin() {
|
|
52
52
|
`;
|
53
53
|
}
|
54
54
|
return null;
|
55
|
-
}
|
55
|
+
},
|
56
56
|
},
|
57
57
|
// Plugin to configure aliases for Node.js modules
|
58
58
|
{
|
59
|
-
name:
|
59
|
+
name: "topsyde-utils:aliases",
|
60
60
|
config() {
|
61
61
|
return {
|
62
62
|
resolve: {
|
63
63
|
alias: {
|
64
64
|
// Alias Node.js built-ins to virtual modules
|
65
|
-
path:
|
66
|
-
fs:
|
67
|
-
}
|
65
|
+
path: "virtual:path",
|
66
|
+
fs: "virtual:fs",
|
67
|
+
},
|
68
68
|
},
|
69
69
|
optimizeDeps: {
|
70
|
-
exclude: [
|
71
|
-
}
|
70
|
+
exclude: ["topsyde-utils"],
|
71
|
+
},
|
72
72
|
};
|
73
|
-
}
|
74
|
-
}
|
73
|
+
},
|
74
|
+
},
|
75
75
|
];
|
76
76
|
}
|
77
77
|
export default topsydeUtilsVitePlugin;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"topsydeUtilsVitePlugin.js","sourceRoot":"","sources":["../../../../src/client/vite/plugins/topsydeUtilsVitePlugin.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,
|
1
|
+
{"version":3,"file":"topsydeUtilsVitePlugin.js","sourceRoot":"","sources":["../../../../src/client/vite/plugins/topsydeUtilsVitePlugin.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,SAAS,sBAAsB;IAC9B,OAAO;QACN,gDAAgD;QAChD;YACC,IAAI,EAAE,kCAAkC;YACxC,SAAS,CAAC,IAAI,EAAE,EAAE;gBACjB,IAAI,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;oBAC/C,OAAO;wBACN,IAAI;wBACJ,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,yBAAyB;qBAChD,CAAC;gBACH,CAAC;YACF,CAAC;SACD;QACD,0DAA0D;QAC1D;YACC,IAAI,EAAE,8BAA8B;YACpC,SAAS,CAAC,EAAE;gBACX,IAAI,EAAE,KAAK,cAAc,IAAI,EAAE,KAAK,YAAY,EAAE,CAAC;oBAClD,OAAO,EAAE,CAAC;gBACX,CAAC;gBACD,OAAO,IAAI,CAAC;YACb,CAAC;YACD,IAAI,CAAC,EAAE;gBACN,IAAI,EAAE,KAAK,cAAc,EAAE,CAAC;oBAC3B,OAAO;;;;;;;WAOD,CAAC;gBACR,CAAC;gBACD,IAAI,EAAE,KAAK,YAAY,EAAE,CAAC;oBACzB,OAAO;;;;;;;;;;;;WAYD,CAAC;gBACR,CAAC;gBACD,OAAO,IAAI,CAAC;YACb,CAAC;SACD;QACD,kDAAkD;QAClD;YACC,IAAI,EAAE,uBAAuB;YAC7B,MAAM;gBACL,OAAO;oBACN,OAAO,EAAE;wBACR,KAAK,EAAE;4BACN,6CAA6C;4BAC7C,IAAI,EAAE,cAAc;4BACpB,EAAE,EAAE,YAAY;yBAChB;qBACD;oBACD,YAAY,EAAE;wBACb,OAAO,EAAE,CAAC,eAAe,CAAC;qBAC1B;iBACD,CAAC;YACH,CAAC;SACD;KACD,CAAC;AACH,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|