@ga-components/logger 1.0.43 → 1.0.45

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/dist/index.js CHANGED
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
23
  LoggerErrorBoundary: () => LoggerErrorBoundary,
24
24
  logger: () => logger
25
25
  });
26
- module.exports = __toCommonJS(index_exports);
26
+ module.exports = __toCommonJS(src_exports);
27
27
 
28
28
  // src/core/logger.ts
29
29
  var import_firestore2 = require("firebase/firestore");
@@ -0,0 +1,9 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ interface MoveSourcemapOptions {
4
+ outDir: string;
5
+ targetDir?: string;
6
+ }
7
+ declare function LoggerMoveSourcemapPlugin(options: MoveSourcemapOptions): Plugin;
8
+
9
+ export { LoggerMoveSourcemapPlugin };
@@ -0,0 +1,9 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ interface MoveSourcemapOptions {
4
+ outDir: string;
5
+ targetDir?: string;
6
+ }
7
+ declare function LoggerMoveSourcemapPlugin(options: MoveSourcemapOptions): Plugin;
8
+
9
+ export { LoggerMoveSourcemapPlugin };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/logger-plugin-move-sourcemap.ts
31
+ var logger_plugin_move_sourcemap_exports = {};
32
+ __export(logger_plugin_move_sourcemap_exports, {
33
+ LoggerMoveSourcemapPlugin: () => LoggerMoveSourcemapPlugin
34
+ });
35
+ module.exports = __toCommonJS(logger_plugin_move_sourcemap_exports);
36
+ var import_promises = require("fs/promises");
37
+ var import_path = __toESM(require("path"));
38
+ function LoggerMoveSourcemapPlugin(options) {
39
+ const { outDir, targetDir = "sourcemaps" } = options;
40
+ return {
41
+ name: "logger-plugin-move-sourcemap",
42
+ apply: "build",
43
+ async closeBundle() {
44
+ const assetsDir = import_path.default.resolve(outDir, "assets");
45
+ const destDir = import_path.default.resolve(outDir, targetDir);
46
+ let files;
47
+ try {
48
+ files = await (0, import_promises.readdir)(assetsDir);
49
+ } catch (e) {
50
+ console.warn(`[logger-move-sourcemap] cannot read ${assetsDir}:`, e);
51
+ return;
52
+ }
53
+ const mapFiles = files.filter((f) => f.endsWith(".map"));
54
+ if (mapFiles.length === 0) {
55
+ console.log("[logger-move-sourcemap] no .map files found, skip.");
56
+ return;
57
+ }
58
+ await (0, import_promises.mkdir)(destDir, { recursive: true });
59
+ for (const fileName of mapFiles) {
60
+ const from = import_path.default.join(assetsDir, fileName);
61
+ const to = import_path.default.join(destDir, fileName);
62
+ try {
63
+ await (0, import_promises.rename)(from, to);
64
+ console.log(`[logger-move-sourcemap] moved: ${fileName} -> ${targetDir}/`);
65
+ } catch (e) {
66
+ console.error(`[logger-move-sourcemap] failed to move ${fileName}:`, e);
67
+ }
68
+ }
69
+ }
70
+ };
71
+ }
72
+ // Annotate the CommonJS export names for ESM import in node:
73
+ 0 && (module.exports = {
74
+ LoggerMoveSourcemapPlugin
75
+ });
76
+ //# sourceMappingURL=vite-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger-plugin-move-sourcemap.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\r\nimport { readdir, rename, mkdir } from \"fs/promises\";\r\nimport path from \"path\";\r\n\r\ninterface MoveSourcemapOptions {\r\n outDir: string;\r\n targetDir?: string;\r\n}\r\n\r\nexport function LoggerMoveSourcemapPlugin(options: MoveSourcemapOptions): Plugin {\r\n const { outDir, targetDir = \"sourcemaps\" } = options;\r\n\r\n return {\r\n name: \"logger-plugin-move-sourcemap\",\r\n apply: \"build\",\r\n\r\n async closeBundle() {\r\n const assetsDir = path.resolve(outDir, \"assets\");\r\n const destDir = path.resolve(outDir, targetDir);\r\n\r\n let files: string[];\r\n try {\r\n files = await readdir(assetsDir);\r\n } catch (e) {\r\n console.warn(`[logger-move-sourcemap] cannot read ${assetsDir}:`, e);\r\n return;\r\n }\r\n\r\n const mapFiles = files.filter((f) => f.endsWith(\".map\"));\r\n if (mapFiles.length === 0) {\r\n console.log(\"[logger-move-sourcemap] no .map files found, skip.\");\r\n return;\r\n }\r\n\r\n await mkdir(destDir, { recursive: true });\r\n\r\n for (const fileName of mapFiles) {\r\n const from = path.join(assetsDir, fileName);\r\n const to = path.join(destDir, fileName);\r\n\r\n try {\r\n await rename(from, to);\r\n console.log(`[logger-move-sourcemap] moved: ${fileName} -> ${targetDir}/`);\r\n } catch (e) {\r\n console.error(`[logger-move-sourcemap] failed to move ${fileName}:`, e);\r\n }\r\n }\r\n },\r\n };\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAuC;AACvC,kBAAiB;AAOV,SAAS,0BAA0B,SAAuC;AAC7E,QAAM,EAAE,QAAQ,YAAY,aAAa,IAAI;AAE7C,SAAO;AAAA,IACH,MAAM;AAAA,IACN,OAAO;AAAA,IAEP,MAAM,cAAc;AAChB,YAAM,YAAY,YAAAA,QAAK,QAAQ,QAAQ,QAAQ;AAC/C,YAAM,UAAU,YAAAA,QAAK,QAAQ,QAAQ,SAAS;AAE9C,UAAI;AACJ,UAAI;AACA,gBAAQ,UAAM,yBAAQ,SAAS;AAAA,MACnC,SAAS,GAAG;AACR,gBAAQ,KAAK,uCAAuC,SAAS,KAAK,CAAC;AACnE;AAAA,MACJ;AAEA,YAAM,WAAW,MAAM,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC;AACvD,UAAI,SAAS,WAAW,GAAG;AACvB,gBAAQ,IAAI,oDAAoD;AAChE;AAAA,MACJ;AAEA,gBAAM,uBAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AAExC,iBAAW,YAAY,UAAU;AAC7B,cAAM,OAAO,YAAAA,QAAK,KAAK,WAAW,QAAQ;AAC1C,cAAM,KAAK,YAAAA,QAAK,KAAK,SAAS,QAAQ;AAEtC,YAAI;AACA,oBAAM,wBAAO,MAAM,EAAE;AACrB,kBAAQ,IAAI,kCAAkC,QAAQ,OAAO,SAAS,GAAG;AAAA,QAC7E,SAAS,GAAG;AACR,kBAAQ,MAAM,0CAA0C,QAAQ,KAAK,CAAC;AAAA,QAC1E;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["path"]}
@@ -0,0 +1,41 @@
1
+ // src/logger-plugin-move-sourcemap.ts
2
+ import { readdir, rename, mkdir } from "fs/promises";
3
+ import path from "path";
4
+ function LoggerMoveSourcemapPlugin(options) {
5
+ const { outDir, targetDir = "sourcemaps" } = options;
6
+ return {
7
+ name: "logger-plugin-move-sourcemap",
8
+ apply: "build",
9
+ async closeBundle() {
10
+ const assetsDir = path.resolve(outDir, "assets");
11
+ const destDir = path.resolve(outDir, targetDir);
12
+ let files;
13
+ try {
14
+ files = await readdir(assetsDir);
15
+ } catch (e) {
16
+ console.warn(`[logger-move-sourcemap] cannot read ${assetsDir}:`, e);
17
+ return;
18
+ }
19
+ const mapFiles = files.filter((f) => f.endsWith(".map"));
20
+ if (mapFiles.length === 0) {
21
+ console.log("[logger-move-sourcemap] no .map files found, skip.");
22
+ return;
23
+ }
24
+ await mkdir(destDir, { recursive: true });
25
+ for (const fileName of mapFiles) {
26
+ const from = path.join(assetsDir, fileName);
27
+ const to = path.join(destDir, fileName);
28
+ try {
29
+ await rename(from, to);
30
+ console.log(`[logger-move-sourcemap] moved: ${fileName} -> ${targetDir}/`);
31
+ } catch (e) {
32
+ console.error(`[logger-move-sourcemap] failed to move ${fileName}:`, e);
33
+ }
34
+ }
35
+ }
36
+ };
37
+ }
38
+ export {
39
+ LoggerMoveSourcemapPlugin
40
+ };
41
+ //# sourceMappingURL=vite-plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger-plugin-move-sourcemap.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\r\nimport { readdir, rename, mkdir } from \"fs/promises\";\r\nimport path from \"path\";\r\n\r\ninterface MoveSourcemapOptions {\r\n outDir: string;\r\n targetDir?: string;\r\n}\r\n\r\nexport function LoggerMoveSourcemapPlugin(options: MoveSourcemapOptions): Plugin {\r\n const { outDir, targetDir = \"sourcemaps\" } = options;\r\n\r\n return {\r\n name: \"logger-plugin-move-sourcemap\",\r\n apply: \"build\",\r\n\r\n async closeBundle() {\r\n const assetsDir = path.resolve(outDir, \"assets\");\r\n const destDir = path.resolve(outDir, targetDir);\r\n\r\n let files: string[];\r\n try {\r\n files = await readdir(assetsDir);\r\n } catch (e) {\r\n console.warn(`[logger-move-sourcemap] cannot read ${assetsDir}:`, e);\r\n return;\r\n }\r\n\r\n const mapFiles = files.filter((f) => f.endsWith(\".map\"));\r\n if (mapFiles.length === 0) {\r\n console.log(\"[logger-move-sourcemap] no .map files found, skip.\");\r\n return;\r\n }\r\n\r\n await mkdir(destDir, { recursive: true });\r\n\r\n for (const fileName of mapFiles) {\r\n const from = path.join(assetsDir, fileName);\r\n const to = path.join(destDir, fileName);\r\n\r\n try {\r\n await rename(from, to);\r\n console.log(`[logger-move-sourcemap] moved: ${fileName} -> ${targetDir}/`);\r\n } catch (e) {\r\n console.error(`[logger-move-sourcemap] failed to move ${fileName}:`, e);\r\n }\r\n }\r\n },\r\n };\r\n}\r\n"],"mappings":";AACA,SAAS,SAAS,QAAQ,aAAa;AACvC,OAAO,UAAU;AAOV,SAAS,0BAA0B,SAAuC;AAC7E,QAAM,EAAE,QAAQ,YAAY,aAAa,IAAI;AAE7C,SAAO;AAAA,IACH,MAAM;AAAA,IACN,OAAO;AAAA,IAEP,MAAM,cAAc;AAChB,YAAM,YAAY,KAAK,QAAQ,QAAQ,QAAQ;AAC/C,YAAM,UAAU,KAAK,QAAQ,QAAQ,SAAS;AAE9C,UAAI;AACJ,UAAI;AACA,gBAAQ,MAAM,QAAQ,SAAS;AAAA,MACnC,SAAS,GAAG;AACR,gBAAQ,KAAK,uCAAuC,SAAS,KAAK,CAAC;AACnE;AAAA,MACJ;AAEA,YAAM,WAAW,MAAM,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC;AACvD,UAAI,SAAS,WAAW,GAAG;AACvB,gBAAQ,IAAI,oDAAoD;AAChE;AAAA,MACJ;AAEA,YAAM,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AAExC,iBAAW,YAAY,UAAU;AAC7B,cAAM,OAAO,KAAK,KAAK,WAAW,QAAQ;AAC1C,cAAM,KAAK,KAAK,KAAK,SAAS,QAAQ;AAEtC,YAAI;AACA,gBAAM,OAAO,MAAM,EAAE;AACrB,kBAAQ,IAAI,kCAAkC,QAAQ,OAAO,SAAS,GAAG;AAAA,QAC7E,SAAS,GAAG;AACR,kBAAQ,MAAM,0CAA0C,QAAQ,KAAK,CAAC;AAAA,QAC1E;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ga-components/logger",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,22 +19,42 @@
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": "^18.2.0",
22
- "react-dom": "^18.2.0"
22
+ "react-dom": "^18.2.0",
23
+ "vite": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
24
+ },
25
+ "peerDependenciesMeta": {
26
+ "vite": {
27
+ "optional": true
28
+ }
23
29
  },
24
30
  "devDependencies": {
31
+ "@types/node": "^26.1.0",
25
32
  "@types/react": "^18.2.0",
26
33
  "@types/react-dom": "^18.2.0",
27
34
  "react": "^18.2.0",
28
35
  "react-dom": "^18.2.0",
29
36
  "tsup": "^8.0.2",
30
37
  "typescript": "^5.0.0",
38
+ "vite": "^8.1.3",
31
39
  "vite-plugin-dts": "^5.0.2"
32
40
  },
33
41
  "exports": {
34
42
  ".": {
35
43
  "types": "./dist/index.d.ts",
36
- "import": "./dist/index.js",
37
- "require": "./dist/index.cjs"
44
+ "import": "./dist/index.mjs",
45
+ "require": "./dist/index.js"
46
+ },
47
+ "./vite-plugin": {
48
+ "types": "./dist/vite-plugin.d.ts",
49
+ "import": "./dist/vite-plugin.mjs",
50
+ "require": "./dist/vite-plugin.js"
51
+ }
52
+ },
53
+ "typesVersions": {
54
+ "*": {
55
+ "vite-plugin": [
56
+ "./dist/vite-plugin.d.ts"
57
+ ]
38
58
  }
39
59
  }
40
60
  }