@sapphire/framework
Advanced tools
Comparing version 2.0.0-next.4539b7d1.0 to 2.0.0-next.49b463e8.0
@@ -1,2 +0,2 @@ | ||
/* Version: 2.0.0-next.4539b7d1.0 - July 3, 2021 21:02:16 */ | ||
/* Version: 2.0.0-next.49b463e8.0 - July 5, 2021 22:09:32 */ | ||
'use strict'; | ||
@@ -47,2 +47,2 @@ | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/PreconditionContainerSingle"), exports); | ||
exports.version = '2.0.0-next.4539b7d1.0'; | ||
exports.version = '2.0.0-next.49b463e8.0'; |
@@ -65,3 +65,3 @@ "use strict"; | ||
constructor(options = {}) { | ||
var _a, _b, _c, _d, _e, _f; | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
super(options); | ||
@@ -80,5 +80,8 @@ /** | ||
pieces_1.container.logger = this.logger; | ||
if ((_e = options.enableLoaderTraceLoggings) !== null && _e !== void 0 ? _e : pieces_1.container.logger.has(10 /* Trace */)) { | ||
pieces_1.Store.logger = pieces_1.container.logger.trace.bind(pieces_1.container.logger); | ||
} | ||
this.stores = new StoreRegistry_1.StoreRegistry(); | ||
pieces_1.container.stores = this.stores; | ||
this.fetchPrefix = (_e = options.fetchPrefix) !== null && _e !== void 0 ? _e : (() => { var _a; return (_a = this.options.defaultPrefix) !== null && _a !== void 0 ? _a : null; }); | ||
this.fetchPrefix = (_f = options.fetchPrefix) !== null && _f !== void 0 ? _f : (() => { var _a; return (_a = this.options.defaultPrefix) !== null && _a !== void 0 ? _a : null; }); | ||
for (const plugin of SapphireClient.plugins.values("preInitialization" /* PreInitialization */)) { | ||
@@ -88,3 +91,3 @@ plugin.hook.call(this, options); | ||
} | ||
this.id = (_f = options.id) !== null && _f !== void 0 ? _f : null; | ||
this.id = (_g = options.id) !== null && _g !== void 0 ? _g : null; | ||
this.stores | ||
@@ -91,0 +94,0 @@ .register(new ArgumentStore_1.ArgumentStore().registerPath(path_1.join(__dirname, '..', 'arguments'))) // |
@@ -28,3 +28,3 @@ "use strict"; | ||
this.detailedDescription = (_b = options.detailedDescription) !== null && _b !== void 0 ? _b : ''; | ||
this.strategy = new FlagUnorderedStrategy_1.FlagUnorderedStrategy(options.strategyOptions); | ||
this.strategy = new FlagUnorderedStrategy_1.FlagUnorderedStrategy(options); | ||
this.lexer.setQuotes((_c = options.quotes) !== null && _c !== void 0 ? _c : [ | ||
@@ -31,0 +31,0 @@ ['"', '"'], |
@@ -9,2 +9,5 @@ "use strict"; | ||
} | ||
has(level) { | ||
return level >= this.level; | ||
} | ||
trace(...values) { | ||
@@ -29,3 +32,3 @@ this.write(10 /* Trace */, ...values); | ||
write(level, ...values) { | ||
if (level < this.level) | ||
if (!this.has(level)) | ||
return; | ||
@@ -32,0 +35,0 @@ const method = Logger.levels.get(level); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FlagUnorderedStrategy = void 0; | ||
const never = () => null; | ||
const always = () => true; | ||
class FlagUnorderedStrategy { | ||
constructor({ flags = [], options = [], prefixes = ['--', '-', '—'], separators = ['=', ':'] } = {}) { | ||
this.flags = flags; | ||
this.options = options; | ||
constructor({ flags, options, prefixes = ['--', '-', '—'], separators = ['=', ':'] } = {}) { | ||
this.flags = flags || []; | ||
this.options = options || []; | ||
this.prefixes = prefixes; | ||
this.separators = separators; | ||
if (this.flags === true) | ||
this.allowedFlag = always; | ||
else if (this.flags.length === 0) | ||
this.matchFlag = never; | ||
if (this.options === true) { | ||
this.allowedOption = always; | ||
} | ||
else if (this.options.length === 0) { | ||
this.matchOption = never; | ||
this.matchCompactOption = never; | ||
} | ||
} | ||
@@ -20,3 +33,3 @@ matchFlag(s) { | ||
// The flag must be an allowed one. | ||
if (this.flags.includes(s)) | ||
if (this.allowedFlag(s)) | ||
return s; | ||
@@ -35,3 +48,3 @@ // If it did not match a flag, return null. | ||
s = s.slice(0, -separator.length); | ||
if (this.options.includes(s)) | ||
if (this.allowedOption(s)) | ||
return s; | ||
@@ -52,3 +65,3 @@ return null; | ||
const k = s.slice(0, i); | ||
if (!this.options.includes(k)) | ||
if (!this.allowedOption(k)) | ||
return null; | ||
@@ -58,4 +71,10 @@ const v = s.slice(i + sep.length); | ||
} | ||
allowedFlag(s) { | ||
return this.flags.includes(s); | ||
} | ||
allowedOption(s) { | ||
return this.options.includes(s); | ||
} | ||
} | ||
exports.FlagUnorderedStrategy = FlagUnorderedStrategy; | ||
//# sourceMappingURL=FlagUnorderedStrategy.js.map |
{ | ||
"name": "@sapphire/framework", | ||
"version": "2.0.0-next.4539b7d1.0", | ||
"version": "2.0.0-next.49b463e8.0", | ||
"description": "Discord bot framework built on top of @sapphire/lib for advanced and amazing bots.", | ||
@@ -23,3 +23,3 @@ "main": "dist/index.js", | ||
"cz": "git-cz", | ||
"prepublishOnly": "rtb -e url events", | ||
"prepublishOnly": "rollup-type-bundler -e url events", | ||
"prepare": "husky install .github/husky" | ||
@@ -39,3 +39,3 @@ }, | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@favware/rollup-type-bundler": "^1.0.1", | ||
"@favware/rollup-type-bundler": "^1.0.2", | ||
"@sapphire/eslint-config": "^3.2.1", | ||
@@ -105,3 +105,3 @@ "@sapphire/prettier-config": "^1.1.6", | ||
"resolutions": { | ||
"acorn": "^8.4.0", | ||
"acorn": "^8.4.1", | ||
"minimist": "^1.2.5", | ||
@@ -113,3 +113,3 @@ "kind-of": "^6.0.3", | ||
"lodash": "^4.17.21", | ||
"marked": "^2.1.1", | ||
"marked": "^2.1.3", | ||
"merge": "^2.1.1", | ||
@@ -116,0 +116,0 @@ "trim": "^1.0.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
276591
4933