topsyde-utils 1.0.147 → 1.0.148

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 "vite";
1
+ import { 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
- export declare function TopsydeUtilsVitePlugin(): Plugin[];
6
+ export declare function TopsydeUtilsVitePlugin(): Plugin;
7
7
  export default TopsydeUtilsVitePlugin;
@@ -3,76 +3,69 @@
3
3
  * by disabling sourcemaps and providing mock implementations of Node.js modules.
4
4
  */
5
5
  export function TopsydeUtilsVitePlugin() {
6
- return [
7
- // Plugin to disable sourcemaps for node_modules
8
- {
9
- name: "topsyde-utils:disable-sourcemaps",
10
- transform(code, id) {
11
- if (id.includes("node_modules/topsyde-utils")) {
12
- return {
13
- code,
14
- map: { mappings: "" }, // Return empty sourcemap
15
- };
16
- }
17
- },
6
+ return {
7
+ name: "topsyde-utils-compatibility",
8
+ // Disable sourcemaps for topsyde-utils
9
+ transform(code, id) {
10
+ if (id.includes("node_modules/topsyde-utils")) {
11
+ return {
12
+ code,
13
+ map: { mappings: "" }, // Return empty sourcemap
14
+ };
15
+ }
18
16
  },
19
- // Plugin to provide virtual modules for Node.js built-ins
20
- {
21
- name: "topsyde-utils:node-polyfills",
22
- resolveId(id) {
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
- };
17
+ // Handle virtual modules for Node.js built-ins
18
+ resolveId(id) {
19
+ if (id === "virtual:path" || id === "virtual:fs") {
20
+ return id;
50
21
  }
51
- export default { readFileSync, existsSync, writeFileSync, readdirSync, statSync };
52
- `;
53
- }
54
- return null;
55
- },
22
+ return null;
56
23
  },
57
- // Plugin to configure aliases for Node.js modules
58
- {
59
- name: "topsyde-utils:aliases",
60
- config() {
61
- return {
62
- resolve: {
63
- alias: {
64
- // Alias Node.js built-ins to virtual modules
65
- path: "virtual:path",
66
- fs: "virtual:fs",
67
- },
68
- },
69
- optimizeDeps: {
70
- exclude: ["topsyde-utils"],
24
+ // Provide mock implementations for Node.js modules
25
+ load(id) {
26
+ if (id === "virtual:path") {
27
+ return `
28
+ export function join() { return ''; }
29
+ export function resolve() { return ''; }
30
+ export function dirname() { return ''; }
31
+ export function basename() { return ''; }
32
+ export function extname() { return ''; }
33
+ export default { join, resolve, dirname, basename, extname };
34
+ `;
35
+ }
36
+ if (id === "virtual:fs") {
37
+ return `
38
+ export function readFileSync() { return ''; }
39
+ export function existsSync() { return false; }
40
+ export function writeFileSync() { return null; }
41
+ export function readdirSync() { return []; }
42
+ export function statSync() {
43
+ return {
44
+ isDirectory: () => false,
45
+ isFile: () => true
46
+ };
47
+ }
48
+ export default { readFileSync, existsSync, writeFileSync, readdirSync, statSync };
49
+ `;
50
+ }
51
+ return null;
52
+ },
53
+ // Configure aliases and optimizeDeps
54
+ config() {
55
+ return {
56
+ resolve: {
57
+ alias: {
58
+ // Alias Node.js built-ins to virtual modules
59
+ path: "virtual:path",
60
+ fs: "virtual:fs",
71
61
  },
72
- };
73
- },
62
+ },
63
+ optimizeDeps: {
64
+ exclude: ["topsyde-utils"],
65
+ },
66
+ };
74
67
  },
75
- ];
68
+ };
76
69
  }
77
70
  // Add default export to match what generate-indexes expects
78
71
  export default TopsydeUtilsVitePlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"topsydeUtilsVitePlugin.js","sourceRoot":"","sources":["../../../../src/client/vite/plugins/topsydeUtilsVitePlugin.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACrC,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,4DAA4D;AAC5D,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"topsydeUtilsVitePlugin.js","sourceRoot":"","sources":["../../../../src/client/vite/plugins/topsydeUtilsVitePlugin.ts"],"names":[],"mappings":"AAEA;;;GAGG;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,mDAAmD;QACnD,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,4DAA4D;AAC5D,eAAe,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "topsyde-utils",
3
- "version": "1.0.147",
3
+ "version": "1.0.148",
4
4
  "description": "A bundle of TypeScript utility classes and functions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",