diff --git a/.gitignore b/.gitignore index c6bba59..5b2b068 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ yarn-debug.log* yarn-error.log* lerna-debug.log* .pnpm-debug.log* - +.DS_Store # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json @@ -89,7 +89,6 @@ out # Nuxt.js build / generate output .nuxt -dist # Gatsby files .cache/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b4ae9f0 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "printWidth": 300, + "singleQuote": true, + "trailingComma": "all", + "tabWidth": 4 +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..decad20 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Ruto + +Ruto is a lightweight(4KB), fast and easy-to-use JS library that streamlines the communication between parent and child window(iframe/popup). + +It uses client-server design pattern to communicate between parent and child window. Any window can become the client or the server depending on who wants to send. It abstracts out the complications of postMessage API and provides a simple API to send and receive messages. + + +## Scenarios where it can be used + +1. Parent window wants to send a message to child window and wants to wait for the response from the child window. +2. Parent window wants to send a message to child window and expects a reply within x seconds. + +## Demo +- [Parent to Iframe](https://ruto-demo.netlify.app/) +- [Parent to Popup](https://ruto-demo.netlify.app/) + +## Installation + +To be added + +## Usage + +To be added + diff --git a/dist/ruto.cjs.js b/dist/ruto.cjs.js new file mode 100644 index 0000000..99e56c3 --- /dev/null +++ b/dist/ruto.cjs.js @@ -0,0 +1,240 @@ +'use strict'; + +//create a function that takes any url and returns the origin +function GetOrigin(url) { + if (url.startsWith('*')) { + return '*'; + } + if (url.startsWith('/')) { + return ''; + } + const a = document.createElement('a'); + a.href = url; + return a.origin; +} +function GetFromType(url) { + const origin = GetOrigin(url); + const cleanedUrl = url.replace(origin, ''); + const splittedUrl = cleanedUrl.split('/'); + const toDestination = splittedUrl[1]; + if (toDestination.startsWith('parent')) { + return 'parent'; + } + else if (toDestination.startsWith('iframe')) { + return 'iframe'; + } + else if (toDestination.startsWith('window')) { + return 'window'; + } + return 'parent'; +} +function GetToType(url) { + const origin = GetOrigin(url); + const cleanedUrl = url.replace(origin, ''); + const splittedUrl = cleanedUrl.split('/'); + const toDestination = splittedUrl[1]; + if (toDestination.endsWith('parent')) { + return 'parent'; + } + else if (toDestination.endsWith('iframe')) { + return 'iframe'; + } + else if (toDestination.endsWith('window')) { + return 'window'; + } + return 'iframe'; +} +function GetUUID() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); +} +function ValidatePath(url) { + const origin = GetOrigin(url); + const cleanedUrl = url.replace(origin, ''); + if (!cleanedUrl.startsWith('/')) { + return false; + } + const splittedUrl = cleanedUrl.split('/'); + if (splittedUrl.length != 3) { + return false; + } + const toDestination = splittedUrl[1]; + if (!toDestination.startsWith('parent') && !toDestination.startsWith('iframe') && !toDestination.startsWith('window')) { + return false; + } + if (toDestination.startsWith('parent')) { + if (!toDestination.endsWith('iframe') && !toDestination.endsWith('window')) { + return false; + } + } + if (toDestination.startsWith('iframe') || toDestination.startsWith('window')) { + if (!toDestination.endsWith('parent')) { + return false; + } + } + return true; +} + +class SenderImpl { + constructor(route, node, options) { + this.send = (message) => { + return new Promise((resolve, reject) => { + var _a; + this.resolver = resolve; + this.rejecter = reject; + if (this.client.node == null || this.client.node == undefined) { + return reject('Client Unhealthy'); + } + try { + const messageId = GetUUID(); + const payload = { + message: message, + subpath: this.client.subpath, + id: messageId, + fromOrigin: this.client.fromOrigin, + toOrigin: this.client.toOrigin, + nodeTypeTo: this.client.nodeTypeTo, + nodeTypeFrom: this.client.nodeTypeFrom, + }; + if (this.client.nodeTypeTo == 'iframe') { + const iframe = this.client.node; + (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(payload, this.client.toOrigin); + } + else if (this.client.nodeTypeTo == 'parent') { + const win = this.client.node; + win.postMessage(payload, this.client.toOrigin); + } + else if (this.client.nodeTypeTo == 'window') { + const win = this.client.node; + win.postMessage(payload, this.client.toOrigin); + } + const timer = setTimeout(() => { + this.rejecter('Timeout'); + window.removeEventListener('message', messageListener); + }, this.timeout); + const messageListener = (event) => { + var _a; + if (event.data.fromOrigin != '*' && event.origin !== event.data.fromOrigin) { + return; + } + if (((_a = event.data) === null || _a === void 0 ? void 0 : _a.subpath) !== this.client.subpath) { + return; + } + if (event.data.id !== messageId) { + return; + } + this.resolver(event.data.message); + window.removeEventListener('message', messageListener); + clearTimeout(timer); + }; + window.addEventListener('message', messageListener); + } + catch (error) { + this.rejecter(error); + } + }); + }; + const toOrigin = GetOrigin(route); + this.client = { + node: node, + nodeTypeTo: GetToType(route), + nodeTypeFrom: GetFromType(route), + toOrigin: toOrigin, + fromOrigin: GetOrigin(window.location.href), + subpath: route.replace(toOrigin, ''), + }; + this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 3000; + this.resolver = (value) => { }; + this.rejecter = (reason) => { }; + } +} + +class ResponseImpl { + //add constructor + constructor(messageId, client) { + this.send = (message) => { + var _a; + const payload = { + id: this.messageId, + message: message, + fromOrigin: this.client.fromOrigin, + toOrigin: this.client.toOrigin, + nodeTypeTo: this.client.nodeTypeTo, + nodeTypeFrom: this.client.nodeTypeFrom, + subpath: this.client.subpath, + }; + let fromType = this.client.nodeTypeFrom; + let toType = this.client.nodeTypeTo; + if (fromType == 'iframe' && toType == 'parent') { + let win = this.client.node; + win.postMessage(payload, this.client.toOrigin); + } + else if (fromType == 'parent' && toType == 'iframe') { + let iframe = this.client.node; + (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(payload, this.client.toOrigin); + } + else if (fromType == 'window' && toType == 'parent') { + let win = this.client.node; + win.postMessage(payload, this.client.toOrigin); + } + else if (fromType == 'parent' && toType == 'window') { + let win = this.client.node; + win.postMessage(payload, this.client.toOrigin); + } + }; + this.messageId = messageId; + this.client = client; + } +} +class ReceiverImpl { + constructor() { + this.receive = (subpath, node, callback) => { + window.addEventListener('message', (event) => { + var _a; + if (event.origin !== event.data.fromOrigin) { + return; + } + if (((_a = event.data) === null || _a === void 0 ? void 0 : _a.subpath) !== subpath) { + return; + } + //if this message from parent to window check source also + if (event.data.nodeTypeFrom == 'parent' && event.data.nodeTypeTo == 'window') { + if (event.source != node) { + return; + } + } + const client = { + node: node, + nodeTypeTo: event.data.nodeTypeFrom, + nodeTypeFrom: event.data.nodeTypeTo, + toOrigin: event.data.fromOrigin, + fromOrigin: event.data.toOrigin, + subpath: subpath, + }; + const resp = new ResponseImpl(event.data.id, client); + callback(resp, event.data.message); + }); + }; + } +} + +function send(route, node, message, options) { + if (!ValidatePath(route)) { + throw new Error('Invalid Path'); + } + const pipe = new SenderImpl(route, node, options); + return pipe.send(message); +} +function receive(subpath, node, callback) { + if (!ValidatePath(subpath)) { + throw new Error('Invalid Path'); + } + const receiver = new ReceiverImpl(); + receiver.receive(subpath, node, callback); +} + +exports.receive = receive; +exports.send = send; +//# sourceMappingURL=ruto.cjs.js.map diff --git a/dist/ruto.cjs.js.map b/dist/ruto.cjs.js.map new file mode 100644 index 0000000..601afa3 --- /dev/null +++ b/dist/ruto.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ruto.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/ruto.min.js b/dist/ruto.min.js new file mode 100644 index 0000000..f05622b --- /dev/null +++ b/dist/ruto.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ruto={})}(this,(function(e){"use strict";function t(e){if(e.startsWith("*"))return"*";if(e.startsWith("/"))return"";const t=document.createElement("a");return t.href=e,t.origin}function i(e){const i=t(e),n=e.replace(i,"").split("/")[1];return n.startsWith("parent")?"parent":n.startsWith("iframe")?"iframe":n.startsWith("window")?"window":"parent"}function n(e){const i=t(e),n=e.replace(i,"").split("/")[1];return n.endsWith("parent")?"parent":n.endsWith("iframe")?"iframe":n.endsWith("window")?"window":"iframe"}function s(e){const i=t(e),n=e.replace(i,"");if(!n.startsWith("/"))return!1;const s=n.split("/");if(3!=s.length)return!1;const o=s[1];return!!(o.startsWith("parent")||o.startsWith("iframe")||o.startsWith("window"))&&(!(o.startsWith("parent")&&!o.endsWith("iframe")&&!o.endsWith("window"))&&!((o.startsWith("iframe")||o.startsWith("window"))&&!o.endsWith("parent")))}class o{constructor(e,s,o){this.send=e=>new Promise(((t,i)=>{var n;if(this.resolver=t,this.rejecter=i,null==this.client.node||null==this.client.node)return i("Client Unhealthy");try{const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),i={message:e,subpath:this.client.subpath,id:t,fromOrigin:this.client.fromOrigin,toOrigin:this.client.toOrigin,nodeTypeTo:this.client.nodeTypeTo,nodeTypeFrom:this.client.nodeTypeFrom};if("iframe"==this.client.nodeTypeTo){null===(n=this.client.node.contentWindow)||void 0===n||n.postMessage(i,this.client.toOrigin)}else if("parent"==this.client.nodeTypeTo){this.client.node.postMessage(i,this.client.toOrigin)}else if("window"==this.client.nodeTypeTo){this.client.node.postMessage(i,this.client.toOrigin)}const s=setTimeout((()=>{this.rejecter("Timeout"),window.removeEventListener("message",o)}),this.timeout),o=e=>{var i;"*"!=e.data.fromOrigin&&e.origin!==e.data.fromOrigin||(null===(i=e.data)||void 0===i?void 0:i.subpath)===this.client.subpath&&e.data.id===t&&(this.resolver(e.data.message),window.removeEventListener("message",o),clearTimeout(s))};window.addEventListener("message",o)}catch(e){this.rejecter(e)}}));const r=t(e);this.client={node:s,nodeTypeTo:n(e),nodeTypeFrom:i(e),toOrigin:r,fromOrigin:t(window.location.href),subpath:e.replace(r,"")},this.timeout=(null==o?void 0:o.timeout)||3e3,this.resolver=e=>{},this.rejecter=e=>{}}}class r{constructor(e,t){this.send=e=>{var t;const i={id:this.messageId,message:e,fromOrigin:this.client.fromOrigin,toOrigin:this.client.toOrigin,nodeTypeTo:this.client.nodeTypeTo,nodeTypeFrom:this.client.nodeTypeFrom,subpath:this.client.subpath};let n=this.client.nodeTypeFrom,s=this.client.nodeTypeTo;if("iframe"==n&&"parent"==s){this.client.node.postMessage(i,this.client.toOrigin)}else if("parent"==n&&"iframe"==s){null===(t=this.client.node.contentWindow)||void 0===t||t.postMessage(i,this.client.toOrigin)}else if("window"==n&&"parent"==s){this.client.node.postMessage(i,this.client.toOrigin)}else if("parent"==n&&"window"==s){this.client.node.postMessage(i,this.client.toOrigin)}},this.messageId=e,this.client=t}}class a{constructor(){this.receive=(e,t,i)=>{window.addEventListener("message",(n=>{var s;if(n.origin!==n.data.fromOrigin)return;if((null===(s=n.data)||void 0===s?void 0:s.subpath)!==e)return;if("parent"==n.data.nodeTypeFrom&&"window"==n.data.nodeTypeTo&&n.source!=t)return;const o={node:t,nodeTypeTo:n.data.nodeTypeFrom,nodeTypeFrom:n.data.nodeTypeTo,toOrigin:n.data.fromOrigin,fromOrigin:n.data.toOrigin,subpath:e},a=new r(n.data.id,o);i(a,n.data.message)}))}}}e.receive=function(e,t,i){if(!s(e))throw new Error("Invalid Path");(new a).receive(e,t,i)},e.send=function(e,t,i,n){if(!s(e))throw new Error("Invalid Path");return new o(e,t,n).send(i)}})); +//# sourceMappingURL=ruto.min.js.map diff --git a/dist/ruto.min.js.map b/dist/ruto.min.js.map new file mode 100644 index 0000000..c8149e5 --- /dev/null +++ b/dist/ruto.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ruto.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""} \ No newline at end of file diff --git a/iframe.html b/iframe.html new file mode 100644 index 0000000..32637de --- /dev/null +++ b/iframe.html @@ -0,0 +1,121 @@ + + + + + + Ruto + + + + + + + + +
+
+
+
+
+
+

Iframe

+
+
+
+
+
+
+
+ + +
+
+ +
+
+
+
+
+
+
+
+ + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..c093abd --- /dev/null +++ b/index.html @@ -0,0 +1,147 @@ + + + + + + Ruto + + + + + + + + + + +
+

Parent + Iframe

+

Parent sends a message, iframe uppercases it and sends it back with a forced delay of 1sec. iframe sends a message, parent reverses it and sends it back

+
+
+
+
+
+

Parent Window

+
+
+
+
+
+
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+
+
+ + + + + + + diff --git a/index2.html b/index2.html new file mode 100644 index 0000000..f0c7268 --- /dev/null +++ b/index2.html @@ -0,0 +1,167 @@ + + + + + + Ruto + + + + + + + + + + +
+

Parent + Iframe

+

Parent sends a message, popup. popup sends a message and sends it back

+
+
+
+
+
+

Parent Window

+
+
+
+ +
+
+
+
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+
+
+ + + + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..01f24a3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,826 @@ +{ + "name": "ruto", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ruto", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "axios": "^1.6.8" + }, + "devDependencies": { + "@rollup/plugin-terser": "^0.4.4", + "prettier": "^3.2.5", + "rollup": "^4.18.0", + "rollup-plugin-typescript2": "^0.36.0", + "tslib": "^2.6.2", + "typescript": "^5.4.5" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "dependencies": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "dev": true, + "dependencies": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", + "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", + "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", + "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", + "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", + "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", + "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", + "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", + "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", + "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", + "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", + "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", + "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", + "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", + "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", + "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rollup": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", + "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", + "dev": true, + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.18.0", + "@rollup/rollup-android-arm64": "4.18.0", + "@rollup/rollup-darwin-arm64": "4.18.0", + "@rollup/rollup-darwin-x64": "4.18.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", + "@rollup/rollup-linux-arm-musleabihf": "4.18.0", + "@rollup/rollup-linux-arm64-gnu": "4.18.0", + "@rollup/rollup-linux-arm64-musl": "4.18.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", + "@rollup/rollup-linux-riscv64-gnu": "4.18.0", + "@rollup/rollup-linux-s390x-gnu": "4.18.0", + "@rollup/rollup-linux-x64-gnu": "4.18.0", + "@rollup/rollup-linux-x64-musl": "4.18.0", + "@rollup/rollup-win32-arm64-msvc": "4.18.0", + "@rollup/rollup-win32-ia32-msvc": "4.18.0", + "@rollup/rollup-win32-x64-msvc": "4.18.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-typescript2": { + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.36.0.tgz", + "integrity": "sha512-NB2CSQDxSe9+Oe2ahZbf+B4bh7pHwjV5L+RSYpCu7Q5ROuN94F9b6ioWwKfz3ueL3KTtmX4o2MUH2cgHDIEUsw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^4.1.2", + "find-cache-dir": "^3.3.2", + "fs-extra": "^10.0.0", + "semver": "^7.5.4", + "tslib": "^2.6.2" + }, + "peerDependencies": { + "rollup": ">=1.26.3", + "typescript": ">=2.4.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/smob": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/terser": { + "version": "5.31.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.31.0.tgz", + "integrity": "sha512-Q1JFAoUKE5IMfI4Z/lkE/E6+SwgzO+x4tq4v1AyBLRj8VSYvRO6A/rQrPg1yud4g0En9EKI1TvFRF2tQFcoUkg==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fd6b55d --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "ruto", + "version": "1.0.0", + "description": "", + "type": "module", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "rollup --bundleConfigAsCjs -c rollup.config.js", + "prettify": "prettier --write ." + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@rollup/plugin-terser": "^0.4.4", + "prettier": "^3.2.5", + "rollup": "^4.18.0", + "rollup-plugin-typescript2": "^0.36.0", + "tslib": "^2.6.2", + "typescript": "^5.4.5" + }, + "dependencies": { + "axios": "^1.6.8" + } +} diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..0f58ae1 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,25 @@ +import typescript from 'rollup-plugin-typescript2'; +import terser from '@rollup/plugin-terser'; + +export default { + input: 'src/index.ts', + output: [ + { + file: 'dist/ruto.min.js', + name: 'ruto', + format: 'umd', + sourcemap: true, + plugins: [terser()], + }, + { + file: 'dist/ruto.cjs.js', + format: 'cjs', + sourcemap: true, + }, + ], + plugins: [ + typescript({ + tsconfig: './tsconfig.json', + }), + ], +}; diff --git a/ruto.png b/ruto.png new file mode 100644 index 0000000..1a9b6e0 Binary files /dev/null and b/ruto.png differ diff --git a/src/common.ts b/src/common.ts new file mode 100644 index 0000000..228af5a --- /dev/null +++ b/src/common.ts @@ -0,0 +1,23 @@ + + +export interface WindowMQOptions { + timeout: number; +} +export interface WindowClient { + node: Window | HTMLIFrameElement | null; + nodeTypeTo: string; + nodeTypeFrom: string; + toOrigin: string; + fromOrigin: string; + subpath: string; +} + +export interface Payload { + message: string | null; + subpath: string; + id: string; + fromOrigin: string; + toOrigin: string; + nodeTypeTo: string; + nodeTypeFrom: string; +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..12c7b71 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,21 @@ +import { WindowMQOptions } from './common'; +import { ValidatePath } from './utils'; +import { SenderImpl } from './send'; +import { ReceiverImpl, Response } from './receive'; + +export function send(route: string, node: Window | HTMLIFrameElement, message: string, options: WindowMQOptions): Promise { + if (!ValidatePath(route)) { + throw new Error('Invalid Path'); + } + const pipe = new SenderImpl(route, node, options); + + return pipe.send(message); +} + +export function receive(subpath: string, node: Window | HTMLIFrameElement, callback: (res: Response, message: string) => void) { + if (!ValidatePath(subpath)) { + throw new Error('Invalid Path'); + } + const receiver = new ReceiverImpl(); + receiver.receive(subpath, node, callback); +} diff --git a/src/receive.ts b/src/receive.ts new file mode 100644 index 0000000..c5f37cd --- /dev/null +++ b/src/receive.ts @@ -0,0 +1,80 @@ +import { Payload, WindowClient } from './common'; +import { GetOrigin } from './utils'; +export interface Response { + send: (message: string) => void; +} + +export class ResponseImpl implements Response { + messageId: string; + client: WindowClient; + //add constructor + constructor(messageId: string, client: WindowClient) { + this.messageId = messageId; + this.client = client; + } + + send: (message: string) => void = (message: string) => { + const payload: Payload = { + id: this.messageId, + message: message, + fromOrigin: this.client.fromOrigin, + toOrigin: this.client.toOrigin, + nodeTypeTo: this.client.nodeTypeTo, + nodeTypeFrom: this.client.nodeTypeFrom, + subpath: this.client.subpath, + }; + + let fromType = this.client.nodeTypeFrom; + let toType = this.client.nodeTypeTo; + + if (fromType == 'iframe' && toType == 'parent') { + let win: Window = this.client.node as Window; + win.postMessage(payload, this.client.toOrigin); + } else if (fromType == 'parent' && toType == 'iframe') { + let iframe: HTMLIFrameElement = this.client.node as HTMLIFrameElement; + iframe.contentWindow?.postMessage(payload, this.client.toOrigin); + } else if (fromType == 'window' && toType == 'parent') { + let win: Window = this.client.node as Window; + win.postMessage(payload, this.client.toOrigin); + } else if (fromType == 'parent' && toType == 'window') { + let win: Window = this.client.node as Window; + win.postMessage(payload, this.client.toOrigin); + } + }; +} + +export interface Receiver { + receive: (route: string, node: Window | HTMLIFrameElement, callback: (res: Response, message: string) => void) => void; +} + +export class ReceiverImpl implements Receiver { + receive: (subpath: string, node: Window | HTMLIFrameElement, callback: (res: Response, message: string) => void) => void = (subpath: string, node: Window | HTMLIFrameElement, callback: (res: Response, message: string) => void) => { + window.addEventListener('message', (event) => { + if (event.origin !== event.data.fromOrigin) { + return; + } + if (event.data?.subpath !== subpath) { + return; + } + + //if this message from parent to window check source also + if (event.data.nodeTypeFrom == 'parent' && event.data.nodeTypeTo == 'window') { + if (event.source != node) { + return; + } + } + + const client: WindowClient = { + node: node, + nodeTypeTo: event.data.nodeTypeFrom, + nodeTypeFrom: event.data.nodeTypeTo, + toOrigin: event.data.fromOrigin, + fromOrigin: event.data.toOrigin, + subpath: subpath, + }; + + const resp = new ResponseImpl(event.data.id, client); + callback(resp, event.data.message); + }); + }; +} diff --git a/src/send.ts b/src/send.ts new file mode 100644 index 0000000..3c0262b --- /dev/null +++ b/src/send.ts @@ -0,0 +1,83 @@ +import { WindowMQOptions, WindowClient, Payload } from './common'; +import { GetOrigin, GetFromType, GetToType, GetUUID } from './utils'; +export interface Sender { + send: (message: string) => Promise; +} + +export class SenderImpl implements Sender { + client: WindowClient; + timeout: number; + + resolver: (value: string | PromiseLike) => void; + rejecter: (reason?: any) => void; + + constructor(route: string, node: Window | HTMLIFrameElement, options: WindowMQOptions) { + const toOrigin = GetOrigin(route); + this.client = { + node: node, + nodeTypeTo: GetToType(route), + nodeTypeFrom: GetFromType(route), + toOrigin: toOrigin, + fromOrigin: GetOrigin(window.location.href), + subpath: route.replace(toOrigin, ''), + }; + this.timeout = options?.timeout || 3000; + this.resolver = (value: string | PromiseLike) => {}; + this.rejecter = (reason?: any) => {}; + } + + send: (message: string) => Promise = (message: string) => { + return new Promise((resolve, reject) => { + this.resolver = resolve; + this.rejecter = reject; + if (this.client.node == null || this.client.node == undefined) { + return reject('Client Unhealthy'); + } + try { + const messageId = GetUUID(); + const payload: Payload = { + message: message, + subpath: this.client.subpath, + id: messageId, + fromOrigin: this.client.fromOrigin, + toOrigin: this.client.toOrigin, + nodeTypeTo: this.client.nodeTypeTo, + nodeTypeFrom: this.client.nodeTypeFrom, + }; + if (this.client.nodeTypeTo == 'iframe') { + const iframe = this.client.node as HTMLIFrameElement; + iframe.contentWindow?.postMessage(payload, this.client.toOrigin); + } else if (this.client.nodeTypeTo == 'parent') { + const win = this.client.node as Window; + win.postMessage(payload, this.client.toOrigin); + } else if (this.client.nodeTypeTo == 'window') { + const win = this.client.node as Window; + win.postMessage(payload, this.client.toOrigin); + } + const timer = setTimeout(() => { + this.rejecter('Timeout'); + window.removeEventListener('message', messageListener); + }, this.timeout); + const messageListener = (event: MessageEvent) => { + if (event.data.fromOrigin != '*' && event.origin !== event.data.fromOrigin) { + return; + } + if (event.data?.subpath !== this.client.subpath) { + return; + } + + if (event.data.id !== messageId) { + return; + } + this.resolver(event.data.message); + window.removeEventListener('message', messageListener); + clearTimeout(timer); + }; + + window.addEventListener('message', messageListener); + } catch (error) { + this.rejecter(error); + } + }); + }; +} diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..3c7481b --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,82 @@ +//create a function that takes any url and returns the origin +export function GetOrigin(url: string): string { + if (url.startsWith('*')) { + return '*'; + } + if (url.startsWith('/')) { + return ''; + } + const a = document.createElement('a'); + a.href = url; + return a.origin; +} + +export function GetFromType(url: string): string { + const origin = GetOrigin(url); + const cleanedUrl = url.replace(origin, ''); + const splittedUrl = cleanedUrl.split('/'); + const toDestination = splittedUrl[1]; + + if (toDestination.startsWith('parent')) { + return 'parent'; + } else if (toDestination.startsWith('iframe')) { + return 'iframe'; + } else if (toDestination.startsWith('window')) { + return 'window'; + } + return 'parent'; +} + +export function GetToType(url: string): string { + const origin = GetOrigin(url); + const cleanedUrl = url.replace(origin, ''); + const splittedUrl = cleanedUrl.split('/'); + const toDestination = splittedUrl[1]; + + if (toDestination.endsWith('parent')) { + return 'parent'; + } else if (toDestination.endsWith('iframe')) { + return 'iframe'; + } else if (toDestination.endsWith('window')) { + return 'window'; + } + return 'iframe'; +} + +export function GetUUID(): string { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + const r = (Math.random() * 16) | 0, + v = c == 'x' ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); +} + +export function ValidatePath(url: string): boolean { + const origin = GetOrigin(url); + const cleanedUrl = url.replace(origin, ''); + + if (!cleanedUrl.startsWith('/')) { + return false; + } + const splittedUrl = cleanedUrl.split('/'); + if (splittedUrl.length != 3) { + return false; + } + const toDestination = splittedUrl[1]; + + if (!toDestination.startsWith('parent') && !toDestination.startsWith('iframe') && !toDestination.startsWith('window')) { + return false; + } + if (toDestination.startsWith('parent')) { + if (!toDestination.endsWith('iframe') && !toDestination.endsWith('window')) { + return false; + } + } + if (toDestination.startsWith('iframe') || toDestination.startsWith('window')) { + if (!toDestination.endsWith('parent')) { + return false; + } + } + + return true; +} diff --git a/style.css b/style.css new file mode 100644 index 0000000..a41c3e1 --- /dev/null +++ b/style.css @@ -0,0 +1,51 @@ +.chat { + height: 400px; + overflow-y: auto; +} +.chat-content { + border: 1px solid #ccc; + border-radius: 5px; + padding-top: 10px; +} +.chat-root { + padding: 20px; +} +.bubble { + padding: 5px 10px; + margin: 5px; + border-radius: 8px; + display: inline-block; + font-size: 12px; +} +.mine { + text-align: right; +} +.mine.sent .bubble { + background-color: #c3ed7d; +} +.mine.received .bubble { + background-color: #73a233; +} +.his.sent .bubble { + background-color: #87e1f6; +} +.his.received .bubble { + background-color: #418faf; +} +.message { + padding: 5px; + background-color: #faf8f3; + border-top: 1px solid #ccc; +} +.chat .message:last-child { + border-bottom: 1px solid #ccc; +} +.nav-link { + font-size: 14px; + text-transform: uppercase; + color: #111; + font-weight: 600; +} +.nav-link.active { + color: #63b485 !important; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..25ef0fb --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2015" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "ESNext" /* Specify what module code is generated. */, + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "dist" /* Specify an output folder for all emitted files. */, + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true /* Allow importing helper functions from tslib once per project, instead of including them per-file. */, + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/window.html b/window.html new file mode 100644 index 0000000..a0074ff --- /dev/null +++ b/window.html @@ -0,0 +1,118 @@ + + + + + + Ruto + + + + + + + + +
+
+
+
+
+
+

Window

+
+
+
+
+
+
+
+ + +
+
+ +
+
+
+
+
+
+
+
+ + + + + + +