First commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npm run check
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"printWidth": 100,
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"pluginSearchDirs": false
|
||||||
|
}
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
const t = 1;
|
||||||
|
export {
|
||||||
|
t as stuff
|
||||||
|
};
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.paravel={}))})(this,function(e){"use strict";e.stuff=1,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export type EventBusListener = {
|
||||||
|
id: string
|
||||||
|
handler: (...args: any[]) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export class EventBus {
|
||||||
|
listeners: Record<string, Array<EventBusListener>> = {}
|
||||||
|
on(name, handler) {
|
||||||
|
const id = Math.random().toString().slice(2)
|
||||||
|
|
||||||
|
this.listeners[name] = this.listeners[name] || ([] as Array<EventBusListener>)
|
||||||
|
this.listeners[name].push({id, handler})
|
||||||
|
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
off(name, id) {
|
||||||
|
this.listeners[name] = this.listeners[name].filter(l => l.id !== id)
|
||||||
|
}
|
||||||
|
handle(k, ...payload) {
|
||||||
|
for (const {handler} of this.listeners[k] || []) {
|
||||||
|
handler(...payload)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './EventBus'
|
||||||
Generated
+4852
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "paravel",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Yet another toolkit for nostr",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"main": "./dist/paravel.umd.js",
|
||||||
|
"module": "./dist/paravel.es.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/paravel.es.js",
|
||||||
|
"require": "./dist/paravel.umd.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"check:ts": "tsc --lib esnext lib/*.ts --noEmit",
|
||||||
|
"check:fmt": "prettier --check lib/*",
|
||||||
|
"check": "run-p check:*",
|
||||||
|
"format": "prettier --write lib/*"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@tsconfig/recommended": "^1.0.2",
|
||||||
|
"prettier": "^2.8.7",
|
||||||
|
"vite": "^4.2.1",
|
||||||
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"husky": "^8.0.3",
|
||||||
|
"npm-run-all": "^4.1.5",
|
||||||
|
"typescript": "^5.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/recommended/tsconfig.json"
|
||||||
|
"compilerOptions": {
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": false,
|
||||||
|
"importsNotUsedAsValues": "preserve"
|
||||||
|
},
|
||||||
|
"include": ["lib/**/*.d.ts", "lib/**/*.ts"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import path from 'path'
|
||||||
|
import {defineConfig} from 'vite'
|
||||||
|
import eslint from 'vite-plugin-eslint'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [eslint()],
|
||||||
|
build: {
|
||||||
|
lib: {
|
||||||
|
entry: path.resolve(__dirname, 'lib/main.ts'),
|
||||||
|
name: 'paravel',
|
||||||
|
fileName: (format) => `paravel.${format}.js`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user