@eventvisor/module-uuid 0.2.0
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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/jest.config.js +5 -0
- package/lib/index.d.ts +7 -0
- package/package.json +45 -0
- package/src/index.ts +62 -0
- package/tsconfig.cjs.json +8 -0
- package/tsconfig.esm.json +8 -0
- package/webpack.config.js +80 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [0.2.0](https://github.com/eventvisor/eventvisor/compare/v0.1.0...v0.2.0) (2025-10-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* module-uuid ([#3](https://github.com/eventvisor/eventvisor/issues/3)) ([7c5d5d1](https://github.com/eventvisor/eventvisor/commit/7c5d5d166fd519a484b0f146a666cb40bac1180a))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Fahad Heylaal (https://fahad19.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.EventvisorUUIDModule=t():e.EventvisorUUIDModule=t()}(this,()=>(()=>{"use strict";var e={};return{166:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,u){function i(e){try{c(r.next(e))}catch(e){u(e)}}function a(e){try{c(r.throw(e))}catch(e){u(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,a)}c((r=r.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,r,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};function o(){if("undefined"!=typeof crypto)return crypto.randomUUID();try{return Object(function(){var e=new Error("Cannot find module 'crypto'");throw e.code="MODULE_NOT_FOUND",e}())()}catch(e){}return function(){for(var e="0123456789abcdef",t="",n=0;n<32;n++){var r=Math.floor(16*Math.random());8!==n&&12!==n&&16!==n&&20!==n||(t+="-"),t+=12===n?"4":16===n?e[3&r|8]:e[r]}return t}()}Object.defineProperty(t,"__esModule",{value:!0}),t.generateUUID=o,t.createUUIDModule=function(e){var t=this;void 0===e&&(e={});var u=e.name;return{name:void 0===u?"uuid":u,lookup:function(){return n(t,void 0,void 0,function(){return r(this,function(e){return[2,o()]})})}}}}}[166](0,e),e})());
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA8B,qBAAID,IAElCD,EAA2B,qBAAIC,GAChC,CATD,CASGK,KAAM,I,uBCNLC,EAAsB,CAAC,E,k/CC4B3B,SAAgBC,IACd,GAAsB,oBAAXC,OACT,OAAOA,OAAOC,aAId,IAGE,OAFa,wGAKf,CAAE,MAAOC,GAET,CAGF,OAzCF,WAKE,IAJA,IAAMC,EAAY,mBACdC,EAAO,GAGFC,EAAI,EAAGA,EAAI,GAAIA,IAAK,CAC3B,IAAMC,EAAaC,KAAKC,MAAsB,GAAhBD,KAAKE,UAEzB,IAANJ,GAAiB,KAANA,GAAkB,KAANA,GAAkB,KAANA,IACrCD,GAAQ,KAIRA,GADQ,KAANC,EACM,IACO,KAANA,EACDF,EAAwB,EAAbG,EAAoB,GAE/BH,EAAUG,EAEtB,CAEA,OAAOF,CACT,CAmBSM,EACT,C,iDAlBA,iBAoBA,4BAAiCC,GAAjC,gBAAiC,IAAAA,IAAAA,EAAA,IACvB,MAAkBA,EAAO,KAEjC,MAAO,CACLC,UAHU,IAAG,SAAM,EAKnBC,OAAQ,+C,0BACN,MAAO,CAAP,EAAOd,I,MAGb,C,GDzDoB,KAAK,EAAGD,G","sources":["webpack://EventvisorUUIDModule/webpack/universalModuleDefinition","webpack://EventvisorUUIDModule/webpack/startup","webpack://EventvisorUUIDModule/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"EventvisorUUIDModule\"] = factory();\n\telse\n\t\troot[\"EventvisorUUIDModule\"] = factory();\n})(this, () => {\nreturn ","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = {};\n__webpack_modules__[166](0, __webpack_exports__);\n","import { Module } from \"@eventvisor/sdk\";\n\nexport type UUIDModuleOptions = {\n name?: string;\n prefix?: string;\n};\n\nfunction generateCustomUUID(): string {\n const hexDigits = \"0123456789abcdef\";\n let uuid = \"\";\n\n // Generate 32 hex digits and format as UUID\n for (let i = 0; i < 32; i++) {\n const randomByte = Math.floor(Math.random() * 16);\n // Insert dashes according to UUID format (8-4-4-4-12)\n if (i === 8 || i === 12 || i === 16 || i === 20) {\n uuid += \"-\";\n }\n // Set version 4 and variant bits\n if (i === 12) {\n uuid += \"4\"; // Version 4\n } else if (i === 16) {\n uuid += hexDigits[(randomByte & 0x3) | 0x8]; // Variant bits\n } else {\n uuid += hexDigits[randomByte];\n }\n }\n\n return uuid;\n}\n\nexport function generateUUID(): string {\n if (typeof crypto !== \"undefined\") {\n return crypto.randomUUID();\n }\n\n if (typeof require !== \"undefined\") {\n try {\n const uuid = require(\"crypto\").randomUUID();\n\n return uuid;\n\n // eslint-disable-next-line\n } catch (e) {\n // do nothing\n }\n }\n\n return generateCustomUUID();\n}\n\nexport function createUUIDModule(options: UUIDModuleOptions = {}): Module {\n const { name = \"uuid\" } = options;\n\n return {\n name,\n\n lookup: async () => {\n return generateUUID();\n },\n };\n}\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_exports__","generateUUID","crypto","randomUUID","e","hexDigits","uuid","i","randomByte","Math","floor","random","generateCustomUUID","options","name","lookup"],"sourceRoot":""}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var n={d:(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},o:(n,t)=>Object.prototype.hasOwnProperty.call(n,t)},t={};n.d(t,{Y:()=>r,l:()=>o});var e=function(n,t,e,o){return new(e||(e=Promise))(function(r,c){function a(n){try{i(o.next(n))}catch(n){c(n)}}function u(n){try{i(o.throw(n))}catch(n){c(n)}}function i(n){var t;n.done?r(n.value):(t=n.value,t instanceof e?t:new e(function(n){n(t)})).then(a,u)}i((o=o.apply(n,t||[])).next())})};function o(){if("undefined"!=typeof crypto)return crypto.randomUUID();try{return Object(function(){var n=new Error("Cannot find module 'crypto'");throw n.code="MODULE_NOT_FOUND",n}())()}catch(n){}return function(){const n="0123456789abcdef";let t="";for(let e=0;e<32;e++){const o=Math.floor(16*Math.random());8!==e&&12!==e&&16!==e&&20!==e||(t+="-"),t+=12===e?"4":16===e?n[3&o|8]:n[o]}return t}()}function r(n={}){const{name:t="uuid"}=n;return{name:t,lookup:()=>e(this,void 0,void 0,function*(){return o()})}}const c=t.Y,a=t.l;export{c as createUUIDModule,a as generateUUID};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","mappings":"AACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,oUC+B3E,SAASI,IACd,GAAsB,oBAAXC,OACT,OAAOA,OAAOC,aAId,IAGE,OAFa,wGAKf,CAAE,MAAOC,GAET,CAGF,OAzCF,WACE,MAAMC,EAAY,mBAClB,IAAIC,EAAO,GAGX,IAAK,IAAIC,EAAI,EAAGA,EAAI,GAAIA,IAAK,CAC3B,MAAMC,EAAaC,KAAKC,MAAsB,GAAhBD,KAAKE,UAEzB,IAANJ,GAAiB,KAANA,GAAkB,KAANA,GAAkB,KAANA,IACrCD,GAAQ,KAIRA,GADQ,KAANC,EACM,IACO,KAANA,EACDF,EAAwB,EAAbG,EAAoB,GAE/BH,EAAUG,EAEtB,CAEA,OAAOF,CACT,CAmBSM,EACT,CAEO,SAASC,EAAiBC,EAA6B,CAAC,GAC7D,MAAM,KAAEC,EAAO,QAAWD,EAE1B,MAAO,CACLC,OAEAC,OAAQ,IAAY,EAAD,+BACjB,OAAOf,GACT,GAEJ,C","sources":["webpack://@eventvisor/module-uuid/webpack/bootstrap","webpack://@eventvisor/module-uuid/webpack/runtime/define property getters","webpack://@eventvisor/module-uuid/webpack/runtime/hasOwnProperty shorthand","webpack://@eventvisor/module-uuid/./src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { Module } from \"@eventvisor/sdk\";\n\nexport type UUIDModuleOptions = {\n name?: string;\n prefix?: string;\n};\n\nfunction generateCustomUUID(): string {\n const hexDigits = \"0123456789abcdef\";\n let uuid = \"\";\n\n // Generate 32 hex digits and format as UUID\n for (let i = 0; i < 32; i++) {\n const randomByte = Math.floor(Math.random() * 16);\n // Insert dashes according to UUID format (8-4-4-4-12)\n if (i === 8 || i === 12 || i === 16 || i === 20) {\n uuid += \"-\";\n }\n // Set version 4 and variant bits\n if (i === 12) {\n uuid += \"4\"; // Version 4\n } else if (i === 16) {\n uuid += hexDigits[(randomByte & 0x3) | 0x8]; // Variant bits\n } else {\n uuid += hexDigits[randomByte];\n }\n }\n\n return uuid;\n}\n\nexport function generateUUID(): string {\n if (typeof crypto !== \"undefined\") {\n return crypto.randomUUID();\n }\n\n if (typeof require !== \"undefined\") {\n try {\n const uuid = require(\"crypto\").randomUUID();\n\n return uuid;\n\n // eslint-disable-next-line\n } catch (e) {\n // do nothing\n }\n }\n\n return generateCustomUUID();\n}\n\nexport function createUUIDModule(options: UUIDModuleOptions = {}): Module {\n const { name = \"uuid\" } = options;\n\n return {\n name,\n\n lookup: async () => {\n return generateUUID();\n },\n };\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","generateUUID","crypto","randomUUID","e","hexDigits","uuid","i","randomByte","Math","floor","random","generateCustomUUID","createUUIDModule","options","name","lookup"],"sourceRoot":""}
|
package/jest.config.js
ADDED
package/lib/index.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@eventvisor/module-uuid",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Eventvisor UUID module",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"transpile": "echo 'Nothing to transpile'",
|
|
18
|
+
"dist": "webpack --config ./webpack.config.js && tsc --project tsconfig.esm.json --declaration --emitDeclarationOnly --declarationDir dist",
|
|
19
|
+
"build": "npm run transpile && npm run dist",
|
|
20
|
+
"testJest": "jest --config jest.config.js --verbose --coverage",
|
|
21
|
+
"test": "echo 'Nothing to test'"
|
|
22
|
+
},
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "Fahad Heylaal",
|
|
25
|
+
"url": "https://fahad19.com"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://eventvisor.org",
|
|
28
|
+
"keywords": [],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/eventvisor/eventvisor.git"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org/"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/eventvisor/eventvisor/issues"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@eventvisor/sdk": "0.2.0"
|
|
42
|
+
},
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"gitHead": "fb101cf9e3461ef5755d9ed34e0adb9cffac1191"
|
|
45
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Module } from "@eventvisor/sdk";
|
|
2
|
+
|
|
3
|
+
export type UUIDModuleOptions = {
|
|
4
|
+
name?: string;
|
|
5
|
+
prefix?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function generateCustomUUID(): string {
|
|
9
|
+
const hexDigits = "0123456789abcdef";
|
|
10
|
+
let uuid = "";
|
|
11
|
+
|
|
12
|
+
// Generate 32 hex digits and format as UUID
|
|
13
|
+
for (let i = 0; i < 32; i++) {
|
|
14
|
+
const randomByte = Math.floor(Math.random() * 16);
|
|
15
|
+
// Insert dashes according to UUID format (8-4-4-4-12)
|
|
16
|
+
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
17
|
+
uuid += "-";
|
|
18
|
+
}
|
|
19
|
+
// Set version 4 and variant bits
|
|
20
|
+
if (i === 12) {
|
|
21
|
+
uuid += "4"; // Version 4
|
|
22
|
+
} else if (i === 16) {
|
|
23
|
+
uuid += hexDigits[(randomByte & 0x3) | 0x8]; // Variant bits
|
|
24
|
+
} else {
|
|
25
|
+
uuid += hexDigits[randomByte];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return uuid;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function generateUUID(): string {
|
|
33
|
+
if (typeof crypto !== "undefined") {
|
|
34
|
+
return crypto.randomUUID();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof require !== "undefined") {
|
|
38
|
+
try {
|
|
39
|
+
const uuid = require("crypto").randomUUID();
|
|
40
|
+
|
|
41
|
+
return uuid;
|
|
42
|
+
|
|
43
|
+
// eslint-disable-next-line
|
|
44
|
+
} catch (e) {
|
|
45
|
+
// do nothing
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return generateCustomUUID();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function createUUIDModule(options: UUIDModuleOptions = {}): Module {
|
|
53
|
+
const { name = "uuid" } = options;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
name,
|
|
57
|
+
|
|
58
|
+
lookup: async () => {
|
|
59
|
+
return generateUUID();
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
// cjs
|
|
5
|
+
{
|
|
6
|
+
entry: {
|
|
7
|
+
"index.cjs": path.join(__dirname, "src", "index.ts"),
|
|
8
|
+
},
|
|
9
|
+
output: {
|
|
10
|
+
path: path.join(__dirname, "dist"),
|
|
11
|
+
filename: "index.js",
|
|
12
|
+
library: "EventvisorUUIDModule",
|
|
13
|
+
libraryTarget: "umd",
|
|
14
|
+
globalObject: "this",
|
|
15
|
+
},
|
|
16
|
+
mode: "production",
|
|
17
|
+
devtool: "source-map",
|
|
18
|
+
resolve: {
|
|
19
|
+
extensions: [".ts", ".tsx", ".js"],
|
|
20
|
+
},
|
|
21
|
+
module: {
|
|
22
|
+
rules: [
|
|
23
|
+
{
|
|
24
|
+
test: /\.(ts|tsx)$/,
|
|
25
|
+
exclude: /(node_modules)/,
|
|
26
|
+
use: [
|
|
27
|
+
{
|
|
28
|
+
loader: "ts-loader",
|
|
29
|
+
options: {
|
|
30
|
+
configFile: path.join(__dirname, "tsconfig.cjs.json"),
|
|
31
|
+
transpileOnly: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
performance: {
|
|
39
|
+
hints: false,
|
|
40
|
+
},
|
|
41
|
+
optimization: {
|
|
42
|
+
minimize: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// esm
|
|
47
|
+
{
|
|
48
|
+
entry: path.join(__dirname, "src", "index.ts"),
|
|
49
|
+
output: {
|
|
50
|
+
path: path.join(__dirname, "dist"),
|
|
51
|
+
filename: "index.mjs",
|
|
52
|
+
library: {
|
|
53
|
+
type: "module",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
experiments: {
|
|
57
|
+
outputModule: true,
|
|
58
|
+
},
|
|
59
|
+
mode: "production",
|
|
60
|
+
devtool: "source-map",
|
|
61
|
+
resolve: {
|
|
62
|
+
extensions: [".ts", ".tsx", ".js"],
|
|
63
|
+
},
|
|
64
|
+
module: {
|
|
65
|
+
rules: [
|
|
66
|
+
{
|
|
67
|
+
test: /\.(ts|tsx)$/,
|
|
68
|
+
exclude: /(node_modules)/,
|
|
69
|
+
loader: "ts-loader",
|
|
70
|
+
options: {
|
|
71
|
+
configFile: path.join(__dirname, "tsconfig.esm.json"),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
performance: {
|
|
77
|
+
hints: false,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
];
|