| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.build = build; | ||
| const chalk_1 = __importDefault(require("chalk")); | ||
| const config_1 = require("../config/config"); | ||
| const package_1 = require("../package"); | ||
| const saveSnippetsConfig_1 = require("../saveSnippetsConfig"); | ||
| const fs_1 = require("../utils/fs"); | ||
| const parseLocalPackage_1 = require("../parseLocalPackage"); | ||
| const snippet_1 = require("../snippet"); | ||
| const snippetsAPI_1 = require("../http/snippetsAPI"); | ||
| const apiSnippets_1 = require("../http/apiSnippets"); | ||
| const getRepository_1 = require("../http/getRepository"); | ||
| function build(list_1) { | ||
| return __awaiter(this, arguments, void 0, function* (list, force = false, install = false) { | ||
| var _a; | ||
| let config = (0, config_1.getConfig)(); | ||
| config.dependent = config.dependent || []; | ||
| config.installRecord = config.installRecord || {}; | ||
| let buildItems = (list.length > 0 | ||
| ? config.dependent.filter((_) => list.findIndex((__) => (0, package_1.comparePackageStr)(_.package, __)) != -1) | ||
| : config.dependent) | ||
| .map((_) => { | ||
| let info = (0, package_1.parsePackageNameStr)(_.package); | ||
| if (!info) { | ||
| return; | ||
| } | ||
| return Object.assign(Object.assign({}, _), { info }); | ||
| }) | ||
| .filter(Boolean); | ||
| for (let { info, prefix } of buildItems.filter((_) => _.info.type == 'file')) { | ||
| let packageDirPath = info.op.file.path; | ||
| if ((_a = (0, fs_1.statSync)(packageDirPath)) === null || _a === void 0 ? void 0 : _a.isDirectory()) { | ||
| yield (0, parseLocalPackage_1.parseLocalPackage)(packageDirPath, prefix) | ||
| .then((snippets) => { | ||
| (0, saveSnippetsConfig_1.saveSnippetsConfig)(JSON.stringify((0, snippet_1.toSnippetConfig)(snippets), undefined, 4), info.package, 'file'); | ||
| console.log(packageDirPath, chalk_1.default.blue('Built')); | ||
| }) | ||
| .catch((e) => { | ||
| console.log(packageDirPath, chalk_1.default.red('There is an installation error: ')); | ||
| console.log(e); | ||
| }); | ||
| } | ||
| else { | ||
| console.log(chalk_1.default.red(`Directory ${packageDirPath} cannot be found.`)); | ||
| } | ||
| } | ||
| yield snippetsAPI_1.SnippetsAPI.getList(buildItems | ||
| .filter((_) => _.info.type == 'web') | ||
| .map((_) => { | ||
| let on = config.installRecord[_.info.op.web.name]; | ||
| return Object.assign({ name: _.info.op.web.name, version: _.info.op.web.version }, (force | ||
| ? {} | ||
| : { | ||
| onVersion: on === null || on === void 0 ? void 0 : on.version, | ||
| iterationNumber: on === null || on === void 0 ? void 0 : on.iterationNumber, | ||
| prefix: _.prefix || '', | ||
| onPrefix: on === null || on === void 0 ? void 0 : on.prefix, | ||
| })); | ||
| })) | ||
| .then((list) => __awaiter(this, void 0, void 0, function* () { | ||
| for (let _ of list) { | ||
| let onBuildItem = buildItems.find((__) => { | ||
| return __.info.type == 'web' && __.info.op.web.name == _.name; | ||
| }); | ||
| let dependentItem = config.dependent.find((_) => (0, package_1.comparePackageStr)(_.package, onBuildItem.package)); | ||
| if (install && _.type != 'null') { | ||
| dependentItem.prefix = _.prefix || ''; | ||
| onBuildItem.prefix = dependentItem.prefix; | ||
| } | ||
| if (!_.type) { | ||
| config.installRecord[_.name] = { | ||
| home: _.home, | ||
| description: _.description, | ||
| version: _.version, | ||
| repository: _.repository || undefined, | ||
| iterationNumber: _.repository ? undefined : _.iterationNumber, | ||
| prefix: onBuildItem.prefix || '', | ||
| }; | ||
| let snippets = (0, apiSnippets_1.parseApiSnippets)(_.snippets || []); | ||
| if (_.repository) { | ||
| let repConfig = (0, package_1.parsePackageNameStr)(_.repository); | ||
| if (!repConfig || repConfig.type != 'github') { | ||
| console.log(chalk_1.default.red(`${_.name}: repository "${_.repository}" is unrecognized`)); | ||
| } | ||
| else { | ||
| snippets.push(...(yield (0, getRepository_1.getRepoSnippets)(repConfig.op.repository, repConfig.type).catch((e) => { | ||
| console.log(_.name, chalk_1.default.red(`"${_.repository}" download error`)); | ||
| console.log(e); | ||
| return []; | ||
| }))); | ||
| } | ||
| } | ||
| (0, saveSnippetsConfig_1.saveSnippetsConfig)(JSON.stringify((0, snippet_1.toSnippetConfig)(snippets, onBuildItem.prefix || ''), undefined, 4), onBuildItem.package, 'web'); | ||
| console.log(`${_.name}@${_.version}`, chalk_1.default.blue('Built')); | ||
| } | ||
| else if (_.type == 'null') { | ||
| console.log(_.name, chalk_1.default.red('cannot find')); | ||
| } | ||
| else if (_.type == 'latest') { | ||
| console.log(`${_.name}@${_.version}`, chalk_1.default.blue('is the latest')); | ||
| } | ||
| } | ||
| })) | ||
| .catch((e) => { | ||
| console.log(chalk_1.default.red('Error downloading package:')); | ||
| console.log(e); | ||
| }); | ||
| for (let { info, prefix } of buildItems.filter((_) => _.info.type == 'github')) { | ||
| yield (0, getRepository_1.getRepoSnippets)(info.op.repository, info.type) | ||
| .then((snippets) => { | ||
| (0, saveSnippetsConfig_1.saveSnippetsConfig)(JSON.stringify((0, snippet_1.toSnippetConfig)(snippets, prefix || ''), undefined, 4), info.package, 'github'); | ||
| console.log(info.package, chalk_1.default.blue('Built')); | ||
| }) | ||
| .catch((e) => { | ||
| let op = info.op.repository; | ||
| console.log(chalk_1.default.red(`"${`https://github.com/${op.owner}/${op.repo}/tree/${op.ref}${op.path}`}" download error`)); | ||
| console.log(e); | ||
| }); | ||
| } | ||
| (0, config_1.setConfig)(config); | ||
| (0, saveSnippetsConfig_1.saveDefSnippets)(); | ||
| (0, saveSnippetsConfig_1.clearSnippets)(config.dependent.map((_) => (0, package_1.parsePackageNameStr)(_.package)).filter(Boolean)); | ||
| }); | ||
| } |
+17
-3
@@ -30,2 +30,3 @@ #!/usr/bin/env node | ||
| const toLocal_1 = require("./toLocal"); | ||
| const build_1 = require("./build"); | ||
| (() => __awaiter(void 0, void 0, void 0, function* () { | ||
@@ -62,3 +63,3 @@ let actionFT = []; | ||
| .description('install one or more packages') | ||
| .argument('[lists...]', 'Packet list, If empty, Update the installed packages') | ||
| .argument('[lists...]', 'Packet list, If empty, Reinstall the installed packages') | ||
| .action(getActionF((res) => { | ||
@@ -71,7 +72,20 @@ (0, install_1.install)(ArrayUtils_1.ArrayUtils.arraify(res || [])).catch((e) => { | ||
| program | ||
| .command('build') | ||
| .alias('b') | ||
| .description('building vscode config through packages') | ||
| .argument('[lists...]', 'Packet list, If empty, Build the installed packages') | ||
| .option('-f, --fouce', 'fouce build') | ||
| .action(getActionF((res, { fouce }) => { | ||
| (0, build_1.build)(ArrayUtils_1.ArrayUtils.arraify(res || []), Boolean(fouce)).catch((e) => { | ||
| console.log(chalk_1.default.red('Build error:\n')); | ||
| console.log(e); | ||
| }); | ||
| })); | ||
| program | ||
| .command('uninstall') | ||
| .alias('uni') | ||
| .description('uninstall package') | ||
| .action(getActionF(() => { | ||
| (0, uninstall_1.uninstall)().catch((e) => { | ||
| .argument('[lists...]', 'Packet list, If empty, Build the installed packages') | ||
| .action(getActionF((res) => { | ||
| (0, uninstall_1.uninstall)(ArrayUtils_1.ArrayUtils.arraify(res || [])).catch((e) => { | ||
| console.log(chalk_1.default.red('Ininstall error:\n')); | ||
@@ -78,0 +92,0 @@ console.log(e); |
@@ -15,3 +15,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.init = void 0; | ||
| exports.init = init; | ||
| const path_1 = __importDefault(require("path")); | ||
@@ -51,2 +51,1 @@ const config_1 = require("../config/config"); | ||
| } | ||
| exports.init = init; |
+20
-150
@@ -15,3 +15,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.install = void 0; | ||
| exports.install = install; | ||
| const chalk_1 = __importDefault(require("chalk")); | ||
@@ -21,9 +21,3 @@ const config_1 = require("../config/config"); | ||
| const package_1 = require("../package"); | ||
| const fs_1 = require("../utils/fs"); | ||
| const parseLocalPackage_1 = require("../parseLocalPackage"); | ||
| const saveSnippetsConfig_1 = require("../saveSnippetsConfig"); | ||
| const snippet_1 = require("../snippet"); | ||
| const apiSnippets_1 = require("../http/apiSnippets"); | ||
| const getRepository_1 = require("../http/getRepository"); | ||
| const snippetsAPI_1 = require("../http/snippetsAPI"); | ||
| const build_1 = require("./build"); | ||
| function inputPrefix(packageName, def) { | ||
@@ -53,5 +47,4 @@ return __awaiter(this, void 0, void 0, function* () { | ||
| } | ||
| function install(list, alertPrefix = '') { | ||
| var _a; | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| function install(list_1) { | ||
| return __awaiter(this, arguments, void 0, function* (list, alertPrefix = '') { | ||
| let config = (0, config_1.getConfig)(); | ||
@@ -65,5 +58,4 @@ config.dependent = config.dependent || []; | ||
| list = config.dependent.map((_) => _.package); | ||
| list.length > 0 && console.log(list.map((_) => chalk_1.default.blue(_)).join('\n'), '\nwill be Updated:'); | ||
| } | ||
| let packageConfigs = list | ||
| let installItems = list | ||
| .map((_) => { | ||
@@ -78,147 +70,25 @@ let __ = (0, package_1.parsePackageNameStr)(_); | ||
| .filter(Boolean); | ||
| for (let packageConfig of packageConfigs.filter((_) => _.type == 'file')) { | ||
| let packageDirPath = packageConfig.op.file.path; | ||
| let packageStr = packageConfig.package; | ||
| let onItem = config.dependent.find((_) => { | ||
| let __ = (0, package_1.parsePackageNameStr)(_.package); | ||
| return (__ === null || __ === void 0 ? void 0 : __.type) == 'file' && __.package == packageStr; | ||
| }); | ||
| let had = !!onItem; | ||
| onItem = onItem || { | ||
| package: packageStr, | ||
| prefix: '', | ||
| }; | ||
| if ((_a = (0, fs_1.statSync)(packageDirPath)) === null || _a === void 0 ? void 0 : _a.isDirectory()) { | ||
| for (let itemInfo of installItems) { | ||
| let dependentItem = config.dependent.find((_) => (0, package_1.comparePackageStr)(_.package, itemInfo.package)); | ||
| if (!dependentItem) { | ||
| dependentItem = { | ||
| package: itemInfo.package, | ||
| prefix: '', | ||
| }; | ||
| config.dependent.push(dependentItem); | ||
| } | ||
| if (itemInfo.type == 'file') { | ||
| if (!installAll) { | ||
| onItem.prefix = yield inputPrefix(onItem.package, onItem.prefix || alertPrefix || ''); | ||
| dependentItem.prefix = yield inputPrefix(dependentItem.package, dependentItem.prefix || alertPrefix || ''); | ||
| } | ||
| yield (0, parseLocalPackage_1.parseLocalPackage)(packageDirPath, onItem.prefix) | ||
| .then((snippets) => { | ||
| (0, saveSnippetsConfig_1.saveSnippetsConfig)(JSON.stringify((0, snippet_1.toSnippetConfig)(snippets), undefined, 4), onItem.package, 'file'); | ||
| if (!had) { | ||
| config.dependent.push(onItem); | ||
| console.log(packageDirPath, chalk_1.default.green('Installed')); | ||
| } | ||
| else { | ||
| console.log(packageDirPath, chalk_1.default.blue('Updated')); | ||
| } | ||
| }) | ||
| .catch((e) => { | ||
| console.log(packageDirPath, chalk_1.default.red('There is an installation error: ')); | ||
| console.log(e); | ||
| }); | ||
| } | ||
| else { | ||
| console.log(chalk_1.default.red(`Directory ${packageDirPath} cannot be found.`)); | ||
| else if (itemInfo.type == 'web') { | ||
| dependentItem.package = itemInfo.package; | ||
| } | ||
| } | ||
| yield snippetsAPI_1.SnippetsAPI.getList(packageConfigs | ||
| .filter((_) => _.type == 'web') | ||
| .map((_) => { | ||
| let on = config.installRecord[_.op.web.name]; | ||
| return { | ||
| name: _.op.web.name, | ||
| version: _.op.web.version, | ||
| onVersion: on === null || on === void 0 ? void 0 : on.version, | ||
| updateDate: on === null || on === void 0 ? void 0 : on.updateDate, | ||
| }; | ||
| })) | ||
| .then((list) => __awaiter(this, void 0, void 0, function* () { | ||
| for (let _ of list) { | ||
| let onPakcageConfig = packageConfigs.find((__) => { | ||
| return __.type == 'web' && __.op.web.name == _.name; | ||
| }); | ||
| if (!_.type) { | ||
| let onItem = config.dependent.find((__) => { | ||
| let ___ = (0, package_1.parsePackageNameStr)(__.package); | ||
| return (___ === null || ___ === void 0 ? void 0 : ___.type) == 'web' && _.name == ___.op.web.name; | ||
| }); | ||
| let had = !!onItem; | ||
| if (!onItem) { | ||
| onItem = { | ||
| package: onPakcageConfig.package, | ||
| prefix: _.prefix, | ||
| }; | ||
| config.dependent.push(onItem); | ||
| } | ||
| else { | ||
| onItem.package = onPakcageConfig.package; | ||
| } | ||
| config.installRecord[_.name] = { | ||
| home: _.home, | ||
| description: _.description, | ||
| version: _.version, | ||
| repository: _.repository || undefined, | ||
| updateDate: _.repository ? undefined : _.updateDate, | ||
| }; | ||
| let snippets = (0, apiSnippets_1.parseApiSnippets)(_.snippets || []); | ||
| if (_.repository) { | ||
| let repConfig = (0, package_1.parsePackageNameStr)(_.repository); | ||
| if (!repConfig || repConfig.type != 'github') { | ||
| console.log(chalk_1.default.red(`${_.name}: repository "${_.repository}" is unrecognized`)); | ||
| } | ||
| else { | ||
| snippets.push(...(yield (0, getRepository_1.getRepoSnippets)(repConfig.op.repository, repConfig.type).catch((e) => { | ||
| console.log(_.name, chalk_1.default.red(`"${_.repository}" download error`)); | ||
| console.log(e); | ||
| return []; | ||
| }))); | ||
| } | ||
| } | ||
| (0, saveSnippetsConfig_1.saveSnippetsConfig)(JSON.stringify((0, snippet_1.toSnippetConfig)(snippets, onItem.prefix || ''), undefined, 4), onItem.package, 'web'); | ||
| if (!had) { | ||
| console.log(`${_.name}@${_.version}`, chalk_1.default.green('Installed')); | ||
| } | ||
| else { | ||
| console.log(`${_.name}@${_.version}`, chalk_1.default.blue('Updated')); | ||
| } | ||
| } | ||
| else if (_.type == 'null') { | ||
| console.log(onPakcageConfig.package, chalk_1.default.red('cannot find')); | ||
| } | ||
| else if (_.type == 'latest') { | ||
| console.log(`${_.name}@${_.version}`, chalk_1.default.blue('is the latest')); | ||
| } | ||
| else if (itemInfo.type == 'github') { | ||
| } | ||
| })) | ||
| .catch((e) => { | ||
| console.log(chalk_1.default.red('Error downloading package:')); | ||
| console.log(e); | ||
| }); | ||
| for (let packageConfig of packageConfigs.filter((_) => _.type == 'github')) { | ||
| let packageStr = packageConfig.package; | ||
| let onItem = config.dependent.find((_) => { | ||
| let __ = (0, package_1.parsePackageNameStr)(_.package); | ||
| return (__ === null || __ === void 0 ? void 0 : __.type) == 'github' && __.package == packageStr; | ||
| }); | ||
| let had = !!onItem; | ||
| onItem = onItem || { | ||
| package: packageStr, | ||
| prefix: '', | ||
| }; | ||
| if (!installAll) { | ||
| onItem.prefix = yield inputPrefix(onItem.package, onItem.prefix || alertPrefix || ''); | ||
| } | ||
| yield (0, getRepository_1.getRepoSnippets)(packageConfig.op.repository, packageConfig.type) | ||
| .then((snippets) => { | ||
| (0, saveSnippetsConfig_1.saveSnippetsConfig)(JSON.stringify((0, snippet_1.toSnippetConfig)(snippets, onItem.prefix || ''), undefined, 4), onItem.package, packageConfig.type); | ||
| if (!had) { | ||
| config.dependent.push(onItem); | ||
| console.log(packageStr, chalk_1.default.green('Installed')); | ||
| } | ||
| else { | ||
| console.log(packageStr, chalk_1.default.blue('Updated')); | ||
| } | ||
| }) | ||
| .catch((e) => { | ||
| let op = packageConfig.op.repository; | ||
| console.log(chalk_1.default.red(`"${`https://${packageConfig.type}.com/${op.owner}/${op.repo}/tree/${op.ref}${op.path}`}" download error`)); | ||
| console.log(e); | ||
| }); | ||
| } | ||
| (0, config_1.setConfig)(config); | ||
| (0, saveSnippetsConfig_1.saveDefSnippets)(); | ||
| (0, saveSnippetsConfig_1.clearSnippets)(config.dependent.map((_) => (0, package_1.parsePackageNameStr)(_.package)).filter(Boolean)); | ||
| yield (0, build_1.build)(installItems.map((_) => _.package), true, true); | ||
| }); | ||
| } | ||
| exports.install = install; |
@@ -15,3 +15,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.search = void 0; | ||
| exports.search = search; | ||
| const chalk_1 = __importDefault(require("chalk")); | ||
@@ -69,3 +69,3 @@ const inquirer_1 = __importDefault(require("inquirer")); | ||
| console.log(`There are ${Object.keys(jsonSnippets).length} snippets in this package`); | ||
| let filter = (prefix, ls = '') => __awaiter(this, void 0, void 0, function* () { | ||
| let filter = (prefix_1, ...args_1) => __awaiter(this, [prefix_1, ...args_1], void 0, function* (prefix, ls = '') { | ||
| let ls_ = ls | ||
@@ -158,2 +158,1 @@ .split(',') | ||
| } | ||
| exports.search = search; |
@@ -15,3 +15,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.toLocal = void 0; | ||
| exports.toLocal = toLocal; | ||
| const chalk_1 = __importDefault(require("chalk")); | ||
@@ -27,4 +27,4 @@ const fs_1 = require("fs"); | ||
| const fs_2 = require("../utils/fs"); | ||
| function toLocal(packageStr, packagePath = '') { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| function toLocal(packageStr_1) { | ||
| return __awaiter(this, arguments, void 0, function* (packageStr, packagePath = '') { | ||
| let packageConfig = (0, package_1.parsePackageNameStr)(packageStr); | ||
@@ -51,3 +51,3 @@ if (!packageConfig || packageConfig.type != 'web') { | ||
| }; | ||
| let vdir = (dir, defaultDir = '') => __awaiter(this, void 0, void 0, function* () { | ||
| let vdir = (dir_1, ...args_1) => __awaiter(this, [dir_1, ...args_1], void 0, function* (dir, defaultDir = '') { | ||
| var _a; | ||
@@ -112,3 +112,3 @@ if (dir) { | ||
| }; | ||
| let f = (items = [], dirPath) => __awaiter(this, void 0, void 0, function* () { | ||
| let f = (...args_1) => __awaiter(this, [...args_1], void 0, function* (items = [], dirPath) { | ||
| for (let item of items) { | ||
@@ -163,2 +163,1 @@ let name = item.name; | ||
| } | ||
| exports.toLocal = toLocal; |
+27
-24
@@ -15,3 +15,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.uninstall = void 0; | ||
| exports.uninstall = uninstall; | ||
| const chalk_1 = __importDefault(require("chalk")); | ||
@@ -23,3 +23,3 @@ const inquirer_1 = __importDefault(require("inquirer")); | ||
| const ArrayUtils_1 = require("../yayaluoya-tool/ArrayUtils"); | ||
| function uninstall() { | ||
| function uninstall(list) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
@@ -31,20 +31,24 @@ (0, saveSnippetsConfig_1.saveDefSnippets)(); | ||
| if (config.dependent.length > 0) { | ||
| let lists = ArrayUtils_1.ArrayUtils.arraify(yield inquirer_1.default | ||
| .prompt({ | ||
| type: 'checkbox', | ||
| name: 'checkbox', | ||
| message: 'Select the package to uninstall', | ||
| choices: config.dependent.map((_) => { | ||
| return { | ||
| name: _.package, | ||
| value: _.package, | ||
| }; | ||
| }), | ||
| pageSize: config.dependent.length, | ||
| loop: true, | ||
| }) | ||
| .then(({ checkbox }) => checkbox) | ||
| .catch(() => { | ||
| return []; | ||
| })); | ||
| let lists = list.length > 0 | ||
| ? config.dependent | ||
| .filter((_) => list.findIndex((__) => (0, package_1.comparePackageStr)(_.package, __)) != -1) | ||
| .map((_) => _.package) | ||
| : ArrayUtils_1.ArrayUtils.arraify(yield inquirer_1.default | ||
| .prompt({ | ||
| type: 'checkbox', | ||
| name: 'checkbox', | ||
| message: 'Select the package to uninstall', | ||
| choices: config.dependent.map((_) => { | ||
| return { | ||
| name: _.package, | ||
| value: _.package, | ||
| }; | ||
| }), | ||
| pageSize: config.dependent.length, | ||
| loop: true, | ||
| }) | ||
| .then(({ checkbox }) => checkbox) | ||
| .catch(() => { | ||
| return []; | ||
| })); | ||
| if (lists.length <= 0) { | ||
@@ -54,5 +58,5 @@ } | ||
| lists.forEach((_) => { | ||
| (0, package_1.parsePackageNameStr)(_) && (0, saveSnippetsConfig_1.saveSnippetsConfig)('', _, (0, package_1.parsePackageNameStr)(_).type); | ||
| (0, package_1.parsePackageNameStr)(_).type == 'web' && | ||
| (config.installRecord[(0, package_1.parsePackageNameStr)(_).op.web.name] = undefined); | ||
| let c = (0, package_1.parsePackageNameStr)(_); | ||
| c && (0, saveSnippetsConfig_1.saveSnippetsConfig)('', _, c.type); | ||
| c.type == 'web' && (config.installRecord[c.op.web.name] = undefined); | ||
| }); | ||
@@ -72,2 +76,1 @@ ArrayUtils_1.ArrayUtils.eliminate(config.dependent, (_) => lists.includes(_.package)); | ||
| } | ||
| exports.uninstall = uninstall; |
@@ -6,3 +6,6 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.setConfig = exports.getConfig = exports.getNullConfig = exports.configName = void 0; | ||
| exports.configName = void 0; | ||
| exports.getNullConfig = getNullConfig; | ||
| exports.getConfig = getConfig; | ||
| exports.setConfig = setConfig; | ||
| const path_1 = __importDefault(require("path")); | ||
@@ -22,3 +25,2 @@ const fs_1 = __importDefault(require("fs")); | ||
| } | ||
| exports.getNullConfig = getNullConfig; | ||
| function getConfig() { | ||
@@ -51,6 +53,4 @@ var _a; | ||
| } | ||
| exports.getConfig = getConfig; | ||
| function setConfig(config) { | ||
| fs_1.default.writeFileSync(path_1.default.join(process.cwd(), exports.configName), JSON.stringify(config, undefined, 4)); | ||
| } | ||
| exports.setConfig = setConfig; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.packageJSON = void 0; | ||
| exports.packageJSON = require('../../package.json'); | ||
| exports.packageJSON = (() => { | ||
| try { | ||
| return require('../../package.json'); | ||
| } | ||
| catch (_a) { | ||
| return { | ||
| name: '', | ||
| version: '', | ||
| description: '', | ||
| }; | ||
| } | ||
| })(); |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.suffixToScope = exports.getExts = exports.languageIds = exports.languages = void 0; | ||
| exports.languages = void 0; | ||
| exports.languageIds = languageIds; | ||
| exports.getExts = getExts; | ||
| exports.suffixToScope = suffixToScope; | ||
| exports.languages = [ | ||
@@ -610,3 +613,2 @@ { | ||
| } | ||
| exports.languageIds = languageIds; | ||
| let exts; | ||
@@ -624,3 +626,2 @@ function getExts() { | ||
| } | ||
| exports.getExts = getExts; | ||
| let suffixToScopeCache = new Map(); | ||
@@ -642,2 +643,1 @@ function suffixToScope(suffix = '') { | ||
| } | ||
| exports.suffixToScope = suffixToScope; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parseApiSnippets = exports.apiSnippetsToTree = void 0; | ||
| exports.apiSnippetsToTree = apiSnippetsToTree; | ||
| exports.parseApiSnippets = parseApiSnippets; | ||
| const snippet_1 = require("../snippet"); | ||
@@ -17,3 +18,2 @@ function apiSnippetsToTree(snippets) { | ||
| } | ||
| exports.apiSnippetsToTree = apiSnippetsToTree; | ||
| function parseApiSnippets(items = []) { | ||
@@ -40,2 +40,1 @@ let s = []; | ||
| } | ||
| exports.parseApiSnippets = parseApiSnippets; |
@@ -15,3 +15,4 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.requestRepo = exports.getRepoSnippets = void 0; | ||
| exports.getRepoSnippets = getRepoSnippets; | ||
| exports.requestRepo = requestRepo; | ||
| const path_1 = __importDefault(require("path")); | ||
@@ -44,3 +45,2 @@ const fs_1 = __importDefault(require("fs")); | ||
| } | ||
| exports.getRepoSnippets = getRepoSnippets; | ||
| function requestRepo(owner, repo, ref, type, progress) { | ||
@@ -89,2 +89,1 @@ let url_ = { | ||
| } | ||
| exports.requestRepo = requestRepo; |
@@ -6,3 +6,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.byJsonGenSnippts = void 0; | ||
| exports.byJsonGenSnippts = byJsonGenSnippts; | ||
| const fs_1 = __importDefault(require("fs")); | ||
@@ -66,2 +66,1 @@ const is_1 = require("../yayaluoya-tool/is"); | ||
| } | ||
| exports.byJsonGenSnippts = byJsonGenSnippts; |
+17
-2
@@ -6,3 +6,4 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parsePackageNameStr = void 0; | ||
| exports.parsePackageNameStr = parsePackageNameStr; | ||
| exports.comparePackageStr = comparePackageStr; | ||
| const path_1 = __importDefault(require("path")); | ||
@@ -70,2 +71,16 @@ const getAbsolute_1 = require("./utils/getAbsolute"); | ||
| } | ||
| exports.parsePackageNameStr = parsePackageNameStr; | ||
| function comparePackageStr(a, b) { | ||
| let ac = parsePackageNameStr(a); | ||
| let bc = parsePackageNameStr(b); | ||
| if ((ac === null || ac === void 0 ? void 0 : ac.type) && (bc === null || bc === void 0 ? void 0 : bc.type) && ac.type == bc.type) { | ||
| switch (ac.type) { | ||
| case 'file': | ||
| return ac.op.file.path == bc.op.file.path; | ||
| case 'github': | ||
| return ac.package == bc.package; | ||
| case 'web': | ||
| return ac.op.web.name == bc.op.web.name; | ||
| } | ||
| } | ||
| return false; | ||
| } |
@@ -15,3 +15,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parseLocalPackage = void 0; | ||
| exports.parseLocalPackage = parseLocalPackage; | ||
| const path_1 = __importDefault(require("path")); | ||
@@ -23,4 +23,4 @@ const fs_1 = require("./utils/fs"); | ||
| const fileBlacklist = ['README.md', 'LICENSE']; | ||
| function parseLocalPackage(dirPath, prefix = undefined) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| function parseLocalPackage(dirPath_1) { | ||
| return __awaiter(this, arguments, void 0, function* (dirPath, prefix = undefined) { | ||
| let f = (itemPath) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -41,3 +41,3 @@ let itemPathStat = yield (0, fs_1.fs_stat_p)(itemPath); | ||
| let p = path_1.default.parse(itemPath); | ||
| if (!(0, scopeConfig_1.getExts)().includes(p.ext)) { | ||
| if (p.ext && !(0, scopeConfig_1.getExts)().includes(p.ext)) { | ||
| return []; | ||
@@ -65,2 +65,1 @@ } | ||
| } | ||
| exports.parseLocalPackage = parseLocalPackage; |
@@ -6,3 +6,6 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getSnippetsSaveName = exports.saveSnippetsConfig = exports.clearSnippets = exports.saveDefSnippets = void 0; | ||
| exports.saveDefSnippets = saveDefSnippets; | ||
| exports.clearSnippets = clearSnippets; | ||
| exports.saveSnippetsConfig = saveSnippetsConfig; | ||
| exports.getSnippetsSaveName = getSnippetsSaveName; | ||
| const fs_1 = __importDefault(require("fs")); | ||
@@ -42,3 +45,2 @@ const path_1 = __importDefault(require("path")); | ||
| } | ||
| exports.saveDefSnippets = saveDefSnippets; | ||
| function clearSnippets(packageIgnores = []) { | ||
@@ -67,3 +69,2 @@ var _a; | ||
| } | ||
| exports.clearSnippets = clearSnippets; | ||
| function saveSnippetsConfig(str, packageName, type) { | ||
@@ -92,3 +93,2 @@ let vscodePath = path_1.default.join(process.cwd(), './.vscode/'); | ||
| } | ||
| exports.saveSnippetsConfig = saveSnippetsConfig; | ||
| function getSnippetsSaveName(packageName, type) { | ||
@@ -109,2 +109,1 @@ let str = ''; | ||
| } | ||
| exports.getSnippetsSaveName = getSnippetsSaveName; |
+18
-7
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parseSnippet = exports.handleBody = exports.toSnippetConfig = void 0; | ||
| exports.toSnippetConfig = toSnippetConfig; | ||
| exports.handleBody = handleBody; | ||
| exports.parseSnippet = parseSnippet; | ||
| const ArrayUtils_1 = require("./yayaluoya-tool/ArrayUtils"); | ||
@@ -38,4 +40,4 @@ const scopeConfig_1 = require("./config/scopeConfig"); | ||
| f(ArrayUtils_1.ArrayUtils.arraify(snippets), [prefixs].filter(Boolean)); | ||
| return jsonSnippets.reduce((a, b, i) => { | ||
| let key = b.name; | ||
| let jsonSnippets_ = jsonSnippets.map((item, i) => { | ||
| let key = item.name; | ||
| let count = jsonSnippets.filter((_, i1) => { | ||
@@ -47,11 +49,21 @@ return i1 < i && _.name == key; | ||
| } | ||
| a[key] = Object.assign(Object.assign({}, b), { name: undefined }); | ||
| return Object.assign(Object.assign({}, item), { key, name: undefined }); | ||
| }); | ||
| jsonSnippets_.sort((a, b) => { | ||
| if (a.key > b.key) { | ||
| return 1; | ||
| } | ||
| if (a.key < b.key) { | ||
| return -1; | ||
| } | ||
| return 0; | ||
| }); | ||
| return jsonSnippets_.reduce((a, b, i) => { | ||
| a[b.key] = Object.assign(Object.assign({}, b), { key: undefined }); | ||
| return a; | ||
| }, {}); | ||
| } | ||
| exports.toSnippetConfig = toSnippetConfig; | ||
| function handleBody(body) { | ||
| return body.split(/\n\r|\r\n|\n|\r/g); | ||
| } | ||
| exports.handleBody = handleBody; | ||
| const prefixReg = /#{1,2}\s+(.*)/; | ||
@@ -141,2 +153,1 @@ const nameReg = /#{3,}\s+(.*)/; | ||
| } | ||
| exports.parseSnippet = parseSnippet; |
+5
-6
@@ -6,3 +6,7 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.statSync = exports.rmSync = exports.fs_readFile_p = exports.fs_readdir_p = exports.fs_stat_p = void 0; | ||
| exports.fs_stat_p = fs_stat_p; | ||
| exports.fs_readdir_p = fs_readdir_p; | ||
| exports.fs_readFile_p = fs_readFile_p; | ||
| exports.rmSync = rmSync; | ||
| exports.statSync = statSync; | ||
| const fs_1 = __importDefault(require("fs")); | ||
@@ -22,3 +26,2 @@ const path_1 = __importDefault(require("path")); | ||
| } | ||
| exports.fs_stat_p = fs_stat_p; | ||
| function fs_readdir_p(path) { | ||
@@ -36,3 +39,2 @@ return new Promise((res, rej) => { | ||
| } | ||
| exports.fs_readdir_p = fs_readdir_p; | ||
| function fs_readFile_p(path) { | ||
@@ -50,3 +52,2 @@ return new Promise((res, rej) => { | ||
| } | ||
| exports.fs_readFile_p = fs_readFile_p; | ||
| function rmSync(file) { | ||
@@ -64,3 +65,2 @@ var _a; | ||
| } | ||
| exports.rmSync = rmSync; | ||
| function statSync(path) { | ||
@@ -74,2 +74,1 @@ try { | ||
| } | ||
| exports.statSync = statSync; |
@@ -6,3 +6,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getAbsolute = void 0; | ||
| exports.getAbsolute = getAbsolute; | ||
| const path_1 = __importDefault(require("path")); | ||
@@ -17,2 +17,1 @@ function getAbsolute(_path, p = process.cwd()) { | ||
| } | ||
| exports.getAbsolute = getAbsolute; |
@@ -6,3 +6,4 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.request = exports.HttpP = void 0; | ||
| exports.HttpP = void 0; | ||
| exports.request = request; | ||
| const https_1 = __importDefault(require("https")); | ||
@@ -67,2 +68,1 @@ const http_1 = __importDefault(require("http")); | ||
| } | ||
| exports.request = request; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.restoreresetReservedName = exports.resetReservedName = exports.reservedName = void 0; | ||
| exports.reservedName = reservedName; | ||
| exports.resetReservedName = resetReservedName; | ||
| exports.restoreresetReservedName = restoreresetReservedName; | ||
| const reservedNames = [/^CON$/i, /^PRN$/i, /^AUX$/i, /^NUL$/i, /^COM[1-9]$/i, /^LPT[1-9]$/i]; | ||
@@ -8,7 +10,5 @@ function reservedName(str) { | ||
| } | ||
| exports.reservedName = reservedName; | ||
| function resetReservedName(str) { | ||
| return str + '_'; | ||
| } | ||
| exports.resetReservedName = resetReservedName; | ||
| function restoreresetReservedName(str) { | ||
@@ -20,2 +20,1 @@ if (/_$/.test(str) && reservedName(str.replace(/_$/, ''))) { | ||
| } | ||
| exports.restoreresetReservedName = restoreresetReservedName; |
@@ -26,3 +26,14 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.fuzzyScore = exports.FuzzyScoreOptions = exports.FuzzyScore = exports.isPatternInWord = exports.createMatches = exports.anyScore = exports.matchesFuzzy2 = exports.matchesFuzzy = exports.matchesCamelCase = exports.isUpper = exports.matchesSubString = exports.matchesContiguousSubString = exports.matchesPrefix = exports.matchesStrictPrefix = exports.or = void 0; | ||
| exports.FuzzyScoreOptions = exports.FuzzyScore = exports.matchesPrefix = exports.matchesStrictPrefix = void 0; | ||
| exports.or = or; | ||
| exports.matchesContiguousSubString = matchesContiguousSubString; | ||
| exports.matchesSubString = matchesSubString; | ||
| exports.isUpper = isUpper; | ||
| exports.matchesCamelCase = matchesCamelCase; | ||
| exports.matchesFuzzy = matchesFuzzy; | ||
| exports.matchesFuzzy2 = matchesFuzzy2; | ||
| exports.anyScore = anyScore; | ||
| exports.createMatches = createMatches; | ||
| exports.isPatternInWord = isPatternInWord; | ||
| exports.fuzzyScore = fuzzyScore; | ||
| const map_1 = require("./map"); | ||
@@ -41,3 +52,2 @@ const strings = __importStar(require("./strings")); | ||
| } | ||
| exports.or = or; | ||
| exports.matchesStrictPrefix = _matchesPrefix.bind(undefined, false); | ||
@@ -68,7 +78,5 @@ exports.matchesPrefix = _matchesPrefix.bind(undefined, true); | ||
| } | ||
| exports.matchesContiguousSubString = matchesContiguousSubString; | ||
| function matchesSubString(word, wordToMatchAgainst) { | ||
| return _matchesSubString(word.toLowerCase(), wordToMatchAgainst.toLowerCase(), 0, 0); | ||
| } | ||
| exports.matchesSubString = matchesSubString; | ||
| function _matchesSubString(word, wordToMatchAgainst, i, j) { | ||
@@ -98,3 +106,2 @@ if (i === word.length) { | ||
| } | ||
| exports.isUpper = isUpper; | ||
| function isNumber(code) { | ||
@@ -239,3 +246,2 @@ return 48 <= code && code <= 57; | ||
| } | ||
| exports.matchesCamelCase = matchesCamelCase; | ||
| const fuzzyContiguousFilter = or(exports.matchesPrefix, matchesCamelCase, matchesContiguousSubString); | ||
@@ -261,3 +267,2 @@ const fuzzySeparateFilter = or(exports.matchesPrefix, matchesCamelCase, matchesSubString); | ||
| } | ||
| exports.matchesFuzzy = matchesFuzzy; | ||
| function matchesFuzzy2(pattern, word) { | ||
@@ -270,3 +275,2 @@ const score = fuzzyScore(pattern, pattern.toLowerCase(), 0, word, word.toLowerCase(), 0, { | ||
| } | ||
| exports.matchesFuzzy2 = matchesFuzzy2; | ||
| function anyScore(pattern, lowPattern, patternPos, word, lowWord, wordPos) { | ||
@@ -285,3 +289,2 @@ const max = Math.min(13, pattern.length); | ||
| } | ||
| exports.anyScore = anyScore; | ||
| function createMatches(score) { | ||
@@ -305,3 +308,2 @@ if (typeof score === 'undefined') { | ||
| } | ||
| exports.createMatches = createMatches; | ||
| const _maxLen = 128; | ||
@@ -427,3 +429,2 @@ function initTable() { | ||
| } | ||
| exports.isPatternInWord = isPatternInWord; | ||
| var FuzzyScore; | ||
@@ -436,3 +437,3 @@ (function (FuzzyScore) { | ||
| FuzzyScore.isDefault = isDefault; | ||
| })(FuzzyScore = exports.FuzzyScore || (exports.FuzzyScore = {})); | ||
| })(FuzzyScore || (exports.FuzzyScore = FuzzyScore = {})); | ||
| class FuzzyScoreOptions { | ||
@@ -559,3 +560,2 @@ constructor(firstMatchCanBeWeak, boostFullMatch) { | ||
| } | ||
| exports.fuzzyScore = fuzzyScore; | ||
| function _fillInMaxWordMatchPos(patternLen, wordLen, patternStart, wordStart, patternLow, wordLow) { | ||
@@ -562,0 +562,0 @@ let patternPos = patternLen - 1; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.isEmojiImprecise = exports.isLowerAsciiLetter = exports.compareSubstring = exports.compareSubstringIgnoreCase = exports.startsWithIgnoreCase = exports.convertSimple2RegExpPattern = void 0; | ||
| exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern; | ||
| exports.startsWithIgnoreCase = startsWithIgnoreCase; | ||
| exports.compareSubstringIgnoreCase = compareSubstringIgnoreCase; | ||
| exports.compareSubstring = compareSubstring; | ||
| exports.isLowerAsciiLetter = isLowerAsciiLetter; | ||
| exports.isEmojiImprecise = isEmojiImprecise; | ||
| function convertSimple2RegExpPattern(pattern) { | ||
| return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*'); | ||
| } | ||
| exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern; | ||
| function startsWithIgnoreCase(str, candidate) { | ||
@@ -15,3 +19,2 @@ const candidateLength = candidate.length; | ||
| } | ||
| exports.startsWithIgnoreCase = startsWithIgnoreCase; | ||
| function compareSubstringIgnoreCase(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) { | ||
@@ -49,3 +52,2 @@ for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) { | ||
| } | ||
| exports.compareSubstringIgnoreCase = compareSubstringIgnoreCase; | ||
| function compareSubstring(a, b, aStart = 0, aEnd = a.length, bStart = 0, bEnd = b.length) { | ||
@@ -72,7 +74,5 @@ for (; aStart < aEnd && bStart < bEnd; aStart++, bStart++) { | ||
| } | ||
| exports.compareSubstring = compareSubstring; | ||
| function isLowerAsciiLetter(code) { | ||
| return code >= 97 && code <= 122; | ||
| } | ||
| exports.isLowerAsciiLetter = isLowerAsciiLetter; | ||
| function isEmojiImprecise(x) { | ||
@@ -93,2 +93,1 @@ return ((x >= 0x1f1e6 && x <= 0x1f1ff) || | ||
| } | ||
| exports.isEmojiImprecise = isEmojiImprecise; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.compareFileNames = exports.compareByPrefix = exports.compareAnything = exports.filterSnippets = void 0; | ||
| exports.filterSnippets = filterSnippets; | ||
| exports.compareAnything = compareAnything; | ||
| exports.compareByPrefix = compareByPrefix; | ||
| exports.compareFileNames = compareFileNames; | ||
| const matchesFuzzy_1 = require("../vscode/matchesFuzzy"); | ||
@@ -36,3 +39,2 @@ const lazy_1 = require("../vscode/lazy"); | ||
| } | ||
| exports.filterSnippets = filterSnippets; | ||
| function compareEntries(itemA, itemB, lookFor) { | ||
@@ -70,3 +72,2 @@ const labelHighlightsA = itemA.labelHighlights || []; | ||
| } | ||
| exports.compareAnything = compareAnything; | ||
| function compareByPrefix(one, other, lookFor) { | ||
@@ -90,3 +91,2 @@ const elementAName = one.toLowerCase(); | ||
| } | ||
| exports.compareByPrefix = compareByPrefix; | ||
| const intlFileNameCollatorBaseNumeric = new lazy_1.Lazy(() => { | ||
@@ -108,2 +108,1 @@ const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); | ||
| } | ||
| exports.compareFileNames = compareFileNames; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.getSnippetConfig = void 0; | ||
| exports.getSnippetConfig = getSnippetConfig; | ||
| const apiSnippets_1 = require("../http/apiSnippets"); | ||
@@ -9,2 +9,1 @@ const snippet_1 = require("../snippet"); | ||
| } | ||
| exports.getSnippetConfig = getSnippetConfig; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.filterSnippets = exports.getSnippetConfig = exports.languageIds = exports.matchesFuzzy = exports.parseSnippet = void 0; | ||
| exports.toSnippetConfig = exports.filterSnippets = exports.getSnippetConfig = exports.languageIds = exports.matchesFuzzy = exports.parseSnippet = void 0; | ||
| exports.byPackageNameGetSnippetsConfigFileName = byPackageNameGetSnippetsConfigFileName; | ||
| var parseSnippet_1 = require("./parseSnippet"); | ||
@@ -14,1 +15,6 @@ Object.defineProperty(exports, "parseSnippet", { enumerable: true, get: function () { return parseSnippet_1.parseSnippet; } }); | ||
| Object.defineProperty(exports, "filterSnippets", { enumerable: true, get: function () { return filterSnippets_1.filterSnippets; } }); | ||
| var snippet_1 = require("../snippet"); | ||
| Object.defineProperty(exports, "toSnippetConfig", { enumerable: true, get: function () { return snippet_1.toSnippetConfig; } }); | ||
| function byPackageNameGetSnippetsConfigFileName(packageName) { | ||
| return `${packageName}.code-snippets`; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parseSnippet = void 0; | ||
| exports.parseSnippet = parseSnippet; | ||
| const snippet_1 = require("../snippet"); | ||
@@ -18,2 +18,1 @@ function parseSnippet(prefix, str) { | ||
| } | ||
| exports.parseSnippet = parseSnippet; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.isUrl = exports.isClient = exports.isServer = exports.isMap = exports.isElement = exports.isWindow = exports.isArray = exports.isRegExp = exports.isBoolean = exports.isFunction = exports.isString = exports.isPromise = exports.isNumber = exports.isNullOrUnDef = exports.isNullAndUnDef = exports.isNull = exports.isDate = exports.isEmpty = exports.isObject = exports.isUnDef = exports.isDef = exports.is = void 0; | ||
| exports.isClient = exports.isServer = void 0; | ||
| exports.is = is; | ||
| exports.isDef = isDef; | ||
| exports.isUnDef = isUnDef; | ||
| exports.isObject = isObject; | ||
| exports.isEmpty = isEmpty; | ||
| exports.isDate = isDate; | ||
| exports.isNull = isNull; | ||
| exports.isNullAndUnDef = isNullAndUnDef; | ||
| exports.isNullOrUnDef = isNullOrUnDef; | ||
| exports.isNumber = isNumber; | ||
| exports.isPromise = isPromise; | ||
| exports.isString = isString; | ||
| exports.isFunction = isFunction; | ||
| exports.isBoolean = isBoolean; | ||
| exports.isRegExp = isRegExp; | ||
| exports.isArray = isArray; | ||
| exports.isWindow = isWindow; | ||
| exports.isElement = isElement; | ||
| exports.isMap = isMap; | ||
| exports.isUrl = isUrl; | ||
| const toString = Object.prototype.toString; | ||
@@ -8,15 +28,11 @@ function is(val, type) { | ||
| } | ||
| exports.is = is; | ||
| function isDef(val) { | ||
| return typeof val !== 'undefined'; | ||
| } | ||
| exports.isDef = isDef; | ||
| function isUnDef(val) { | ||
| return !isDef(val); | ||
| } | ||
| exports.isUnDef = isUnDef; | ||
| function isObject(val) { | ||
| return val !== null && is(val, 'Object'); | ||
| } | ||
| exports.isObject = isObject; | ||
| function isEmpty(val) { | ||
@@ -34,59 +50,44 @@ if (isArray(val) || isString(val)) { | ||
| } | ||
| exports.isEmpty = isEmpty; | ||
| function isDate(val) { | ||
| return is(val, 'Date'); | ||
| } | ||
| exports.isDate = isDate; | ||
| function isNull(val) { | ||
| return val === null; | ||
| } | ||
| exports.isNull = isNull; | ||
| function isNullAndUnDef(val) { | ||
| return isUnDef(val) && isNull(val); | ||
| } | ||
| exports.isNullAndUnDef = isNullAndUnDef; | ||
| function isNullOrUnDef(val) { | ||
| return isUnDef(val) || isNull(val); | ||
| } | ||
| exports.isNullOrUnDef = isNullOrUnDef; | ||
| function isNumber(val) { | ||
| return is(val, 'Number'); | ||
| } | ||
| exports.isNumber = isNumber; | ||
| function isPromise(val) { | ||
| return (is(val, 'Promise') && isObject(val) && isFunction(val.then) && isFunction(val.catch)); | ||
| } | ||
| exports.isPromise = isPromise; | ||
| function isString(val) { | ||
| return is(val, 'String'); | ||
| } | ||
| exports.isString = isString; | ||
| function isFunction(val) { | ||
| return typeof val === 'function'; | ||
| } | ||
| exports.isFunction = isFunction; | ||
| function isBoolean(val) { | ||
| return is(val, 'Boolean'); | ||
| } | ||
| exports.isBoolean = isBoolean; | ||
| function isRegExp(val) { | ||
| return is(val, 'RegExp'); | ||
| } | ||
| exports.isRegExp = isRegExp; | ||
| function isArray(val) { | ||
| return val && Array.isArray(val); | ||
| } | ||
| exports.isArray = isArray; | ||
| function isWindow(val) { | ||
| return typeof window !== 'undefined' && is(val, 'Window'); | ||
| } | ||
| exports.isWindow = isWindow; | ||
| function isElement(val) { | ||
| return isObject(val) && !!val.tagName; | ||
| } | ||
| exports.isElement = isElement; | ||
| function isMap(val) { | ||
| return is(val, 'Map'); | ||
| } | ||
| exports.isMap = isMap; | ||
| exports.isServer = typeof window === 'undefined'; | ||
@@ -98,2 +99,1 @@ exports.isClient = !exports.isServer; | ||
| } | ||
| exports.isUrl = isUrl; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.JSONPar = void 0; | ||
| exports.JSONPar = JSONPar; | ||
| function JSONPar(str, def, reviver) { | ||
@@ -12,2 +12,1 @@ try { | ||
| } | ||
| exports.JSONPar = JSONPar; |
+1
-1
| { | ||
| "name": "codess", | ||
| "version": "1.1.4", | ||
| "version": "1.1.5", | ||
| "description": "vscode代码片段管理器,通过 本地包(本地某个文件夹) 或官网的 远程包(代码片段集合) 生成本地项目的 vscode 代码片段配置。", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+6
-3
@@ -76,5 +76,8 @@ # codess <img src="https://img.shields.io/npm/v/codess"/> | ||
| - `uninstall` | `uni` | ||
| - 显示一个选择界面让开发者选择卸载哪些包 | ||
| - `build [lists...]` | `b [lists...]` | ||
| - 构建vscode配置文件到项目的.vscode文件夹中 | ||
| - `uninstall [lists...]` | `uni [lists...]` | ||
| - 卸载某个包,如果为空的话会显示一个选择界面让开发者选择卸载哪些包 | ||
| - `search <name> [prefix] [languages]` | `s <name> [prefix] [languages]` | ||
@@ -133,3 +136,3 @@ - 搜索远程包,查看有没有自己想要的包,也能在官网去搜索,`[prefix]` 参数能查看某个触发词下的代码片段,`[languages]`则指定要筛选的代码语言,多种语言用`,`分隔 | ||
| "version": "3", | ||
| "updateDate": "1720860843371" | ||
| "iterationNumber": "1" | ||
| } | ||
@@ -136,0 +139,0 @@ }, |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
43
2.38%4161
1.19%285
1.06%156457
-1.79%