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
- // 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
- },
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
- // 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
- };
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
- export default { readFileSync, existsSync, writeFileSync, readdirSync, statSync };
52
- `;
53
- }
54
- return null;
55
- },
24
+ return null;
56
25
  },
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"],
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
- // Add default export to match what generate-indexes expects
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;;;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;;;;;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "topsyde-utils",
3
- "version": "1.0.147",
3
+ "version": "1.0.149",
4
4
  "description": "A bundle of TypeScript utility classes and functions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",