Comparing version 1.0.1 to 1.0.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Modules = void 0; | ||
/* eslint import/no-dynamic-require: 0 */ | ||
/* eslint global-require: 0 */ | ||
const tools_1 = require("@kotori-bot/tools"); | ||
const tokens_1 = require("./tokens"); | ||
@@ -13,5 +10,28 @@ const service_1 = require("./service"); | ||
function handleConstructor(Class, ctx, config) { | ||
(0, tools_1.none)(new Class(ctx, config)); | ||
/* eslint-disable-next-line no-new */ | ||
new Class(ctx, config); | ||
} | ||
const DEFAULT_MODULE_CONFIG = { filter: {} }; | ||
function isClass(obj, strict = true) { | ||
if (typeof obj !== 'function') | ||
return false; | ||
const str = obj.toString(); | ||
if (obj.prototype === undefined) | ||
return false; | ||
if (obj.prototype.constructor !== obj) | ||
return false; | ||
if (str.slice(0, 5) === 'class') | ||
return true; | ||
if (Object.getOwnPropertyNames(obj.prototype).length >= 2) | ||
return true; | ||
if (/^function\s+\(|^function\s+anonymous\(/.test(str)) | ||
return false; | ||
if (strict && /^function\s+[A-Z]/.test(str)) | ||
return true; | ||
if (!/\b\(this\b|\bthis[.[]\b/.test(str)) | ||
return false; | ||
if (!strict || /classCallCheck\(this/.test(str)) | ||
return true; | ||
return /^function\sdefault_\d+\s*\(/.test(str); | ||
} | ||
class Modules { | ||
@@ -32,3 +52,3 @@ ctx; | ||
if (instance instanceof Function) { | ||
if ((0, tools_1.isClass)(instance)) | ||
if (isClass(instance)) | ||
handleConstructor(instance, ctx, DEFAULT_MODULE_CONFIG); | ||
@@ -43,3 +63,3 @@ else | ||
injected(inject); | ||
if (defaults && (0, tools_1.isClass)(defaults)) { | ||
if (defaults && isClass(defaults)) { | ||
const { inject: inject1 } = defaults; | ||
@@ -50,3 +70,3 @@ if (inject1) | ||
} | ||
else if (defaults && !(0, tools_1.isClass)(defaults)) { | ||
else if (defaults && !isClass(defaults)) { | ||
handleFunction(defaults, ctx, config ?? DEFAULT_MODULE_CONFIG); | ||
@@ -53,0 +73,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Service = void 0; | ||
const tools_1 = require("@kotori-bot/tools"); | ||
class Service { | ||
@@ -14,10 +13,8 @@ ctx; | ||
} | ||
start() { | ||
return (0, tools_1.none)(this); | ||
} | ||
stop() { | ||
return (0, tools_1.none)(this); | ||
} | ||
/* eslint-disable-next-line class-methods-use-this */ | ||
start() { } | ||
/* eslint-disable-next-line class-methods-use-this */ | ||
stop() { } | ||
} | ||
exports.Service = Service; | ||
exports.default = Service; |
{ | ||
"name": "fluoro", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A Meta-Framework", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "tsc" | ||
}, | ||
"license": "GPL-3.0", | ||
"author": "Hotaru <biyuehuya@gmail.com>", | ||
"bin": { | ||
"kotori": "./bin.js" | ||
}, | ||
"keywords": [ | ||
@@ -26,12 +26,9 @@ "meta-framework", | ||
"bugs": { | ||
"url": "https://github.com/kotorijs/kotori/issues" | ||
"url": "https://github.com/biyuehu/fluoro/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/kotorijs/kotori.git" | ||
"url": "git+https://github.com/biyuehu/fluoro.git" | ||
}, | ||
"homepage": "https://kotori.js.org", | ||
"dependencies": { | ||
"@kotori-bot/tools": "^1.3.0" | ||
} | ||
} | ||
"homepage": "https://kotori.js.org" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57297
0
477
- Removed@kotori-bot/tools@^1.3.0
- Removed@iarna/toml@2.2.5(transitive)
- Removed@kotori-bot/tools@1.5.1(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaxios@1.7.8(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedform-data@4.0.1(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedproxy-from-env@1.1.0(transitive)
- Removedyaml@2.6.1(transitive)