From cb3defc1fcbcb52665b6148703a9e7f127a259dc Mon Sep 17 00:00:00 2001 From: antoniopresto Date: Mon, 11 Mar 2024 06:23:42 -0300 Subject: [PATCH] add utils --- .idea/powership.iml | 1 + package.json | 2 +- packages/accounts/package.json | 52 +- packages/babel-plugins/package.json | 27 +- packages/boilerplate/package.json | 33 +- packages/deepstate/package.json | 47 +- packages/entity/package.json | 49 +- packages/entity/src/EntityResolversChain.ts | 32 - packages/logstorm/package.json | 45 +- packages/logstorm/src/index.ts | 8 +- packages/mongo/package.json | 50 +- packages/plugin-engine/package.json | 51 +- packages/powership/bin/bin.cjs | 1 + packages/powership/bin/echopm.cjs | 19 + packages/powership/bin/pm.cjs | 50 + packages/powership/bin/root.cjs | 50 + packages/powership/bin/run.cjs | 23 + packages/powership/package.json | 87 +- packages/powership/server-utils/index.cjs | 1 + packages/powership/server-utils/index.d.ts | 1 + packages/powership/server-utils/index.js | 1 + packages/powership/server-utils/index.mjs | 1 + packages/powership/src/nodeutils.ts | 2 - packages/powership/tsconfig.json | 3 +- packages/runmate/package.json | 47 +- .../runmate/src/commands/executeInPackages.ts | 8 +- packages/runmate/src/commands/export-deps.ts | 2 +- packages/runmate/src/commands/getSetJSON.ts | 2 +- packages/schema/package.json | 45 +- packages/server/package.json | 51 +- packages/transporter/package.json | 48 +- packages/utils/.gitignore | 1 - packages/utils/package.json | 80 +- packages/utils/server-utils/index.cjs | 1 + packages/utils/server-utils/index.d.ts | 1 + packages/utils/server-utils/index.js | 1 + packages/utils/server-utils/index.mjs | 1 + packages/utils/src/node.ts | 64 - packages/utils/src/server-utils/index.ts | 189 +++ packages/utils/src/zz/index.ts | 129 ++ pnpm-lock.yaml | 1297 +---------------- 41 files changed, 615 insertions(+), 1988 deletions(-) delete mode 100644 packages/entity/src/EntityResolversChain.ts create mode 100755 packages/powership/bin/bin.cjs create mode 100755 packages/powership/bin/echopm.cjs create mode 100755 packages/powership/bin/pm.cjs create mode 100755 packages/powership/bin/root.cjs create mode 100644 packages/powership/bin/run.cjs create mode 100644 packages/powership/server-utils/index.cjs create mode 100644 packages/powership/server-utils/index.d.ts create mode 100644 packages/powership/server-utils/index.js create mode 100644 packages/powership/server-utils/index.mjs delete mode 100644 packages/powership/src/nodeutils.ts create mode 100644 packages/utils/server-utils/index.cjs create mode 100644 packages/utils/server-utils/index.d.ts create mode 100644 packages/utils/server-utils/index.js create mode 100644 packages/utils/server-utils/index.mjs delete mode 100644 packages/utils/src/node.ts create mode 100644 packages/utils/src/server-utils/index.ts create mode 100644 packages/utils/src/zz/index.ts diff --git a/.idea/powership.iml b/.idea/powership.iml index d24b63c1..242c9a50 100644 --- a/.idea/powership.iml +++ b/.idea/powership.iml @@ -7,6 +7,7 @@ + diff --git a/package.json b/package.json index dda589b7..aca669c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powership", - "version": "3.3.13", + "version": "3.3.22", "private": true, "scripts": { "pack": "run-s pack:*", diff --git a/packages/accounts/package.json b/packages/accounts/package.json index e64906c2..87fbcca7 100644 --- a/packages/accounts/package.json +++ b/packages/accounts/package.json @@ -1,6 +1,6 @@ { "name": "@powership/accounts", - "version": "3.3.13", + "version": "3.3.22", "description": "Powership accounts", "type": "module", "main": "./out/index.cjs", @@ -88,53 +88,5 @@ "displayName": "Accounts System.", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "scrypt-kdf": "*", - "jsonwebtoken": "*", - "@powership/schema": "3.3.13", - "@powership/utils": "3.3.13", - "dataloader": "*", - "plugin-hooks": "*", - "sift": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/transporter": "3.3.13", - "@powership/entity": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/babel-plugins/package.json b/packages/babel-plugins/package.json index 89be36b0..94be4510 100644 --- a/packages/babel-plugins/package.json +++ b/packages/babel-plugins/package.json @@ -1,6 +1,6 @@ { "name": "@powership/babel-plugins", - "version": "3.3.13", + "version": "3.3.22", "main": "./out/index.js", "sideEffects": false, "typings": "./out/index.d.ts", @@ -55,28 +55,5 @@ "displayName": "Babel Plugins", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "typescript": "*", - "typedoc": "*", - "ts-jest": "*", - "rimraf": "*", - "prettier-plugin-multiline-arrays": "*", - "prettier": "*", - "npm-run-all": "*", - "jest": "*", - "eslint-plugin-typescript-sort-keys": "*", - "eslint-plugin-sort-keys-fix": "*", - "eslint-plugin-import": "*", - "eslint-plugin-eslint-comments": "*", - "eslint-config-prettier": "*", - "eslint": "*", - "esbuild": "*", - "babel-plugin-replace-import-extension": "*", - "babel-plugin-add-import-extension": "*", - "@typescript-eslint/parser": "*", - "@typescript-eslint/eslint-plugin": "*", - "@types/babel__core": "*", - "@babel/types": "*", - "@babel/core": "*" - } + "peerDependencies": {} } diff --git a/packages/boilerplate/package.json b/packages/boilerplate/package.json index 4905ad58..2843eacd 100644 --- a/packages/boilerplate/package.json +++ b/packages/boilerplate/package.json @@ -1,6 +1,6 @@ { "name": "@powership/boilerplate", - "version": "3.3.13", + "version": "3.3.22", "author": "antoniopresto ", "sideEffects": false, "type": "module", @@ -37,34 +37,5 @@ "babel-config.cjs", "README.md" ], - "peerDependencies": { - "eslint-plugin-typescript-sort-keys": "*", - "eslint-plugin-sort-keys-fix": "*", - "eslint-plugin-import": "*", - "eslint-plugin-eslint-comments": "*", - "eslint-config-prettier": "*", - "eslint": "*", - "babel-preset-minify": "*", - "@typescript-eslint/parser": "*", - "@typescript-eslint/eslint-plugin": "*", - "@babel/core": "*", - "@babel/types": "*", - "@types/babel__core": "*", - "babel-plugin-add-import-extension": "*", - "babel-plugin-replace-import-extension": "*", - "esbuild": "*", - "jest": "*", - "npm-run-all": "*", - "prettier": "*", - "prettier-plugin-multiline-arrays": "*", - "rimraf": "*", - "ts-jest": "*", - "typedoc": "*", - "typescript": "*", - "@powership/babel-plugins": "3.3.13", - "@babel/preset-typescript": "*", - "@babel/preset-env": "*", - "@babel/plugin-transform-typescript": "*", - "@babel/cli": "*" - } + "peerDependencies": {} } diff --git a/packages/deepstate/package.json b/packages/deepstate/package.json index d6c9a89e..0453232b 100644 --- a/packages/deepstate/package.json +++ b/packages/deepstate/package.json @@ -1,6 +1,6 @@ { "name": "@powership/deepstate", - "version": "3.3.13", + "version": "3.3.22", "main": "out/index.cjs", "module": "out/index.mjs", "sideEffects": false, @@ -78,48 +78,5 @@ "out/*", "README.md" ], - "peerDependencies": { - "immer": "*", - "yjs": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "plugin-hooks": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13", - "@powership/schema": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/entity/package.json b/packages/entity/package.json index 9b9feef2..f7332fed 100644 --- a/packages/entity/package.json +++ b/packages/entity/package.json @@ -1,6 +1,6 @@ { "name": "@powership/entity", - "version": "3.3.13", + "version": "3.3.22", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", @@ -95,50 +95,5 @@ "displayName": "Entity", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "sift": "*", - "plugin-hooks": "*", - "dataloader": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13", - "@powership/schema": "3.3.13", - "@powership/transporter": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/entity/src/EntityResolversChain.ts b/packages/entity/src/EntityResolversChain.ts deleted file mode 100644 index 3affe95f..00000000 --- a/packages/entity/src/EntityResolversChain.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { createResolver } from '@powership/schema'; - -import { AnyEntity } from './EntityInterfaces'; - -export class EntityResolversChain { - private entity: TEntity; - - constructor(entity: TEntity) { - this.entity = entity; - } - - create = (name: Name) => { - const { - type, - edgeType, - databaseType, - inputType, - paginationType, - originType, - indexGraphTypes, - } = this.entity; - - const current = { - name, - } as const; - }; -} - - - - -const x = diff --git a/packages/logstorm/package.json b/packages/logstorm/package.json index 22412525..18cd0a4e 100644 --- a/packages/logstorm/package.json +++ b/packages/logstorm/package.json @@ -1,6 +1,6 @@ { "name": "logstorm", - "version": "3.3.13", + "version": "3.3.22", "typings": "out", "author": "antoniopresto ", "type": "module", @@ -82,46 +82,5 @@ "displayName": "LogStorm - A simple and super extensive logger.", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "plugin-hooks": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/logstorm/src/index.ts b/packages/logstorm/src/index.ts index 21449666..bce5c08a 100644 --- a/packages/logstorm/src/index.ts +++ b/packages/logstorm/src/index.ts @@ -63,7 +63,7 @@ export interface LogStorm extends LogMethods { export function createLogger( name: string, level = _getDefaultLogLevel(), - options: LogstormOptions = {} + options: LogstormOptions = {}, ): LogStorm { // @@ -147,7 +147,7 @@ export function createLogger( const changed = await self.hooks.willPrint.dispatch( { values: args, method: methodName }, - {} + {}, ); return handler.apply(this, changed.values); @@ -233,7 +233,7 @@ export function checkLogLevel(level: any): LogLevel { if (!valid) { console.warn( - `Logstorm: "${level}" is not a valid log level. "silent" will be used as level.` + `Logstorm: "${level}" is not a valid log level. "silent" will be used as level.`, ); return 'silent'; } @@ -261,7 +261,7 @@ function _getDefaultLogLevel(): LogLevel { console.warn( `Logstorm: value "${ LOGSTORM_LEVEL || LOG_LEVEL - }" from process.env is not a valid log level.` + }" from process.env is not a valid log level.`, ); } diff --git a/packages/mongo/package.json b/packages/mongo/package.json index a220328a..8231749c 100644 --- a/packages/mongo/package.json +++ b/packages/mongo/package.json @@ -1,6 +1,6 @@ { "name": "@powership/mongo", - "version": "3.3.13", + "version": "3.3.22", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", @@ -87,53 +87,7 @@ "typedoc": "0.25.11", "typescript": "5.4.2" }, - "peerDependencies": { - "sift": "*", - "plugin-hooks": "*", - "dataloader": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13", - "@powership/schema": "3.3.13", - "@powership/transporter": "3.3.13", - "mongodb": "*" - }, + "peerDependencies": {}, "files": [ "package.json", "out/*", diff --git a/packages/plugin-engine/package.json b/packages/plugin-engine/package.json index 0ca70ee3..3472aa01 100644 --- a/packages/plugin-engine/package.json +++ b/packages/plugin-engine/package.json @@ -1,6 +1,6 @@ { "name": "plugin-engine", - "version": "3.3.13", + "version": "3.3.22", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", @@ -94,52 +94,5 @@ "displayName": ".", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "highlight.js": "*", - "@powership/schema": "3.3.13", - "@powership/transporter": "3.3.13", - "@powership/utils": "3.3.13", - "dataloader": "*", - "plugin-hooks": "*", - "sift": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/entity": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/powership/bin/bin.cjs b/packages/powership/bin/bin.cjs new file mode 100755 index 00000000..b57e3ca0 --- /dev/null +++ b/packages/powership/bin/bin.cjs @@ -0,0 +1 @@ +require('@powership/utils/out/zz'); diff --git a/packages/powership/bin/echopm.cjs b/packages/powership/bin/echopm.cjs new file mode 100755 index 00000000..72c95831 --- /dev/null +++ b/packages/powership/bin/echopm.cjs @@ -0,0 +1,19 @@ +const child_process = require('child_process'); + +const functions = ` +echopm(){ + local dir=\${1:-$(pwd)} + + if [[ -f "$dir/package-lock.json" ]]; then + echo "npm" + elif [[ -f "$dir/bun.lockb" ]]; then + echo "bun" + elif [[ -f "$dir/yarn.lock" ]]; then + echo "yarn" + elif [[ -f "$dir/pnpm-lock.yaml" ]]; then + echo "pnpm" + fi +} +`; + +child_process.execSync(`${functions} echopm;`, { stdio: 'inherit' }); diff --git a/packages/powership/bin/pm.cjs b/packages/powership/bin/pm.cjs new file mode 100755 index 00000000..c65d96b5 --- /dev/null +++ b/packages/powership/bin/pm.cjs @@ -0,0 +1,50 @@ +const child_process = require('child_process'); +const path = require('path'); + +const params = process.argv.slice(2).join(' '); + +const functions = ` +echoPm(){ + local dir=\${1:-$(pwd)} + + if [[ -f "$dir/package-lock.json" ]]; then + echo "npm" + elif [[ -f "$dir/bun.lockb" ]]; then + echo "bun" + elif [[ -f "$dir/yarn.lock" ]]; then + echo "yarn" + elif [[ -f "$dir/pnpm-lock.yaml" ]]; then + echo "pnpm" + fi +} + +pm() { + local pmResult="" + local pmPath=$(pwd) + local pmNextPath=$pmPath + + for i in {0..7}; do + pmResult=$(echoPm "$pmNextPath") + + if [[ $pmResult != "" ]]; then + echo "$pmResult##$pmNextPath" + return 0; + fi + + pmNextPath=$(dirname "$pmNextPath") + done + + return 1 +} +`; + +const [pm, root] = child_process + .execSync(functions + ' pm') + .toString() + .trim() + .split('##'); + +const command = [pm, params].join(' '); +process.stdout.write(`➜ ${path.relative(process.cwd(), root)}/ ${command}\n`); + +require('./run.cjs').run(command); diff --git a/packages/powership/bin/root.cjs b/packages/powership/bin/root.cjs new file mode 100755 index 00000000..11e01281 --- /dev/null +++ b/packages/powership/bin/root.cjs @@ -0,0 +1,50 @@ +const child_process = require('child_process'); +const path = require('path'); + +const functions = ` +echopm(){ + local dir=\${1:-$(pwd)} + + if [[ -f "$dir/package-lock.json" ]]; then + echo "npm" + elif [[ -f "$dir/bun.lockb" ]]; then + echo "bun" + elif [[ -f "$dir/yarn.lock" ]]; then + echo "yarn" + elif [[ -f "$dir/pnpm-lock.yaml" ]]; then + echo "pnpm" + fi +} + +root() { + local pmResult="" + local pmPath=$(pwd) + local pmNextPath=$pmPath + + for i in {0..7}; do + pmResult=$(echopm "$pmNextPath") + if [[ $pmResult != "" ]]; then + echo $pmNextPath + return 0 + fi + pmNextPath=$(dirname "$pmNextPath") + done + + return 1 +} +`; + +const [root] = child_process + .execSync(functions + ' root') + .toString() + .trim() + .split('##'); + +const args = process.argv.slice(2); + +if (args.length) { + const dest = path.resolve(root, args[0]); + console.log(path.relative(process.cwd(), dest)); +} else { + console.log(root); +} diff --git a/packages/powership/bin/run.cjs b/packages/powership/bin/run.cjs new file mode 100644 index 00000000..d79c84b5 --- /dev/null +++ b/packages/powership/bin/run.cjs @@ -0,0 +1,23 @@ +const child_process = require('child_process'); + +module.exports = { + run: function run(command) { + try { + const child = child_process.spawn(command, { + stdio: 'inherit', + shell: true, + }); + + if (child.stdout && child.stderr) { + child.stdout.on('data', (data) => process.stdout.write(data)); + child.stderr.on('data', (data) => process.stderr.write(data)); + } + + child.on('close', async (code) => { + process.exit(code); + }); + } catch (e) { + process.exit(1); + } + }, +}; diff --git a/packages/powership/package.json b/packages/powership/package.json index ec2c0f98..d5992b47 100644 --- a/packages/powership/package.json +++ b/packages/powership/package.json @@ -1,6 +1,6 @@ { "name": "powership", - "version": "3.3.13", + "version": "3.3.22", "author": "antoniopresto ", "type": "module", "main": "./out/index.cjs", @@ -12,16 +12,35 @@ "import": "./out/index.mjs", "require": "./out/index.cjs" }, - "./nodeutils": { - "types": "./out/nodeutils.d.ts", - "import": "./out/nodeutils.mjs", - "require": "./out/nodeutils.cjs" + "./server-utils": { + "types": "./server-utils/index.d.ts", + "import": "./server-utils/index.mjs", + "require": "./server-utils/index.cjs" } }, "browser": { "out/index.mjs": "./out/browser/index.mjs", "out/index.cjs": "./out/browser/index.cjs" }, + "typesVersions": { + "*": { + ".": [ + "./out/index.d.ts" + ], + "server-utils": [ + "./server-utils/index.d.ts" + ] + } + }, + "bin": { + "zz": "./bin/bin.cjs", + "tsx": "./bin/bin.cjs", + "powership": "./bin/bin.cjs", + "echopm": "./bin/echopm.cjs", + "pm": "./bin/pm.cjs", + "root": "./bin/root.cjs", + "cdr": "./bin/root.cjs" + }, "sideEffects": false, "license": "MIT", "scripts": { @@ -54,6 +73,7 @@ "@powership/server": "workspace:*", "@powership/transporter": "workspace:*", "@powership/utils": "workspace:*", + "@types/bun": "1.0.10", "plugin-engine": "workspace:*" }, "devDependencies": { @@ -96,6 +116,7 @@ "files": [ "package.json", "out/*", + "server-utils/*", "README.md" ], "typedoc": { @@ -104,59 +125,5 @@ "displayName": "Powership", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "@powership/utils": "3.3.13", - "@powership/schema": "3.3.13", - "@powership/entity": "3.3.13", - "highlight.js": "*", - "@powership/transporter": "3.3.13", - "dataloader": "*", - "plugin-hooks": "*", - "sift": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "plugin-engine": "3.3.13", - "body-parser": "*", - "graphql-playground-html": "*", - "http-errors": "*", - "http-status-codes": "*", - "logstorm": "3.3.13", - "@powership/server": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/powership/server-utils/index.cjs b/packages/powership/server-utils/index.cjs new file mode 100644 index 00000000..9f77d6ed --- /dev/null +++ b/packages/powership/server-utils/index.cjs @@ -0,0 +1 @@ +module.exports = require('@powership/utils/server-utils'); diff --git a/packages/powership/server-utils/index.d.ts b/packages/powership/server-utils/index.d.ts new file mode 100644 index 00000000..3ce5628d --- /dev/null +++ b/packages/powership/server-utils/index.d.ts @@ -0,0 +1 @@ +export * from '@powership/utils/server-utils'; diff --git a/packages/powership/server-utils/index.js b/packages/powership/server-utils/index.js new file mode 100644 index 00000000..9f77d6ed --- /dev/null +++ b/packages/powership/server-utils/index.js @@ -0,0 +1 @@ +module.exports = require('@powership/utils/server-utils'); diff --git a/packages/powership/server-utils/index.mjs b/packages/powership/server-utils/index.mjs new file mode 100644 index 00000000..3ce5628d --- /dev/null +++ b/packages/powership/server-utils/index.mjs @@ -0,0 +1 @@ +export * from '@powership/utils/server-utils'; diff --git a/packages/powership/src/nodeutils.ts b/packages/powership/src/nodeutils.ts deleted file mode 100644 index c293cbeb..00000000 --- a/packages/powership/src/nodeutils.ts +++ /dev/null @@ -1,2 +0,0 @@ -// @only-server -export * from '@powership/utils/node'; diff --git a/packages/powership/tsconfig.json b/packages/powership/tsconfig.json index 905664b6..bf7bf765 100644 --- a/packages/powership/tsconfig.json +++ b/packages/powership/tsconfig.json @@ -7,13 +7,14 @@ "lib": ["es5", "es6", "es7", "esnext", "dom"], "declaration": true, "target": "es5", + "module": "ESNext", "removeComments": false, "esModuleInterop": true, "moduleResolution": "node", "resolveJsonModule": true, "strict": true, "skipLibCheck": true, - "strictPropertyInitialization": true, + "strictPropertyInitialization": true, "forceConsistentCasingInFileNames": true, "noUnusedLocals": false, "noUnusedParameters": false, diff --git a/packages/runmate/package.json b/packages/runmate/package.json index 22cbeb40..aff0476f 100644 --- a/packages/runmate/package.json +++ b/packages/runmate/package.json @@ -1,6 +1,6 @@ { "name": "runmate", - "version": "3.3.13", + "version": "3.3.22", "typings": "out", "author": "antoniopresto ", "license": "MIT", @@ -98,48 +98,5 @@ "displayName": "RunMate - A command line utility to run scripts in multiple files.", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "tsx": "*", - "semver": "*", - "plugin-hooks": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "slugify": "*", - "ts-toolbelt": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13", - "@types/vorpal": "*", - "@types/glob": "*" - } + "peerDependencies": {} } diff --git a/packages/runmate/src/commands/executeInPackages.ts b/packages/runmate/src/commands/executeInPackages.ts index f1ce566d..ca91d80c 100644 --- a/packages/runmate/src/commands/executeInPackages.ts +++ b/packages/runmate/src/commands/executeInPackages.ts @@ -1,5 +1,5 @@ import { AnyFunction, filterNull, hey } from '@powership/utils'; -import { CWD, glob, nodePath } from '@powership/utils/out/node'; +import { CWD, glob, nodePath } from '@powership/utils/server-utils'; import { Command } from 'commander'; import { packageRunner, PackageRunnerExecInput } from '../packageRunner'; @@ -80,10 +80,14 @@ function _executeInPackages( includeRoot = true, } = options || {}; - if (commands?.[0]?.startsWith('./')) { + if (commands?.[0]?.startsWith('.')) { kind = 'runfile'; } + if (commands.length > 1) { + kind = 'command'; + } + const ignoreList = ignore?.split(/, ?/); const packagesExclusiveList = packages?.split(/, ?/); diff --git a/packages/runmate/src/commands/export-deps.ts b/packages/runmate/src/commands/export-deps.ts index ebfa5a31..015dcc9b 100644 --- a/packages/runmate/src/commands/export-deps.ts +++ b/packages/runmate/src/commands/export-deps.ts @@ -1,5 +1,5 @@ import { PackageJson, sortObject } from '@powership/utils'; -import { CWD, fsExtra, glob, nodePath } from '@powership/utils/out/node'; +import { CWD, fsExtra, glob, nodePath } from '@powership/utils/server-utils'; export type ExportDepsOptions = { cwd?: string; diff --git a/packages/runmate/src/commands/getSetJSON.ts b/packages/runmate/src/commands/getSetJSON.ts index 203d93af..bd7da9c5 100644 --- a/packages/runmate/src/commands/getSetJSON.ts +++ b/packages/runmate/src/commands/getSetJSON.ts @@ -1,5 +1,5 @@ import { hey, jsonParse, pick, setByPath } from '@powership/utils'; -import { CWD, nodePath } from '@powership/utils/out/node'; +import { CWD, nodePath } from '@powership/utils/server-utils'; import { Command } from 'commander'; import { diff --git a/packages/schema/package.json b/packages/schema/package.json index 54eea3bf..424e6f98 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -1,6 +1,6 @@ { "name": "@powership/schema", - "version": "3.3.13", + "version": "3.3.22", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", @@ -103,46 +103,5 @@ "displayName": "Powership Schema - A Super Portable TypeScript validation library", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "plugin-hooks": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/server/package.json b/packages/server/package.json index 52c6ba5d..1e3500e4 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@powership/server", - "version": "3.3.13", + "version": "3.3.22", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", @@ -110,52 +110,5 @@ "displayName": "Powership Schema - A Super Portable TypeScript validation library", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "plugin-hooks": "*", - "url-pattern": "*", - "qs": "*", - "@powership/utils": "3.3.13", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "logstorm": "3.3.13", - "http-status-codes": "*", - "http-errors": "*", - "graphql-playground-html": "*", - "@powership/schema": "3.3.13", - "body-parser": "*" - } + "peerDependencies": {} } diff --git a/packages/transporter/package.json b/packages/transporter/package.json index 11656e78..d7e3069d 100644 --- a/packages/transporter/package.json +++ b/packages/transporter/package.json @@ -1,6 +1,6 @@ { "name": "@powership/transporter", - "version": "3.3.13", + "version": "3.3.22", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", @@ -97,49 +97,5 @@ "displayName": "Transporter - Base to connect any Database to Powership.", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "sift": "*", - "plugin-hooks": "*", - "dataloader": "*", - "@types/dateformat": "*", - "@types/fs-extra": "*", - "@types/lodash": "*", - "@types/lodash-es": "*", - "@types/semver": "*", - "aggio": "*", - "awesome-phonenumber": "*", - "big.js": "*", - "bun-safe": "*", - "bun-types": "*", - "commander": "*", - "dateformat": "*", - "dayjs": "*", - "deep-diff": "*", - "deep-object-diff": "*", - "ejson": "*", - "fast-copy": "*", - "fast-deep-equal": "*", - "fs-extra": "*", - "glob": "*", - "graphql": "*", - "graphql-parse-resolve-info": "*", - "hoper": "*", - "immer": "*", - "json-schema-to-typescript": "*", - "jsondiffpatch": "*", - "lodash": "*", - "lodash-es": "*", - "mitt": "*", - "object-hash": "*", - "prettier": "*", - "qs": "*", - "semver": "*", - "slugify": "*", - "ts-toolbelt": "*", - "tsx": "*", - "ulid": "*", - "url-pattern": "*", - "@powership/utils": "3.3.13", - "@powership/schema": "3.3.13" - } + "peerDependencies": {} } diff --git a/packages/utils/.gitignore b/packages/utils/.gitignore index 63525a2e..b133a266 100644 --- a/packages/utils/.gitignore +++ b/packages/utils/.gitignore @@ -2,7 +2,6 @@ .idea /lib - # VisualStudioCode.gitignore # See https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore .vscode/* diff --git a/packages/utils/package.json b/packages/utils/package.json index e3182793..e1c24aad 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,10 +1,13 @@ { "name": "@powership/utils", - "version": "3.3.13", + "version": "3.3.22", "typings": "out", "author": "antoniopresto ", "license": "MIT", "type": "module", + "bin": { + "zz": "./out/zz/index.cjs" + }, "scripts": { "test": "jest", "build": "run-s clear && run-p declarations build:*", @@ -29,8 +32,11 @@ ".": [ "./out/index.d.ts" ], - "node": [ - "./out/node.d.ts" + "server-utils": [ + "./server-utils" + ], + "zz": [ + "./out/zz/index.d.ts" ] } }, @@ -41,15 +47,20 @@ "import": "./out/index.mjs", "require": "./out/index.cjs" }, - "./node": { - "types": "./out/node.d.ts", - "import": "./out/node.mjs", - "require": "./out/node.cjs" + "./server-utils": { + "types": "./server-utils/index.d.ts", + "import": "./server-utils/index.mjs", + "require": "./server-utils/index.cjs" + }, + "./out/zz": { + "types": "./out/zz/index.d.ts", + "import": "./out/zz/index.mjs", + "require": "./out/zz/index.cjs" }, - "./out/node": { - "types": "./out/node.d.ts", - "import": "./out/node.mjs", - "require": "./out/node.cjs" + "./zz": { + "types": "./out/zz/index.d.ts", + "import": "./out/zz/index.mjs", + "require": "./out/zz/index.cjs" } }, "browser": { @@ -59,11 +70,13 @@ "description": "powership utils and helper functions", "keywords": [], "dependencies": { + "@types/bun": "1.0.10", "@types/dateformat": "5.0.2", "@types/fs-extra": "9.0.13", "@types/lodash": "4.14.191", "@types/lodash-es": "4.17.12", "@types/semver": "7.5.8", + "add": "2.0.6", "aggio": "0.2.0", "awesome-phonenumber": "6.2.0", "big.js": "6.2.1", @@ -87,10 +100,12 @@ "jsondiffpatch": "^0.4.1", "lodash": "4.17.21", "lodash-es": "4.17.21", + "minimatch": "9.0.3", "mitt": "3.0.0", "object-hash": "3.0.0", "plugin-hooks": "2.0.0", "prettier": "2.8.8", + "pretty-format": "29.7.0", "qs": "6.11.2", "semver": "7.6.0", "slugify": "1.6.5", @@ -138,6 +153,7 @@ "files": [ "package.json", "out/*", + "server-utils/*", "README.md" ], "prettier": { @@ -149,45 +165,5 @@ "displayName": "Utils - A collection of common utilities. Internal or from other libraries", "tsconfig": "./tsconfig.module.json" }, - "peerDependencies": { - "url-pattern": "*", - "ulid": "*", - "tsx": "*", - "ts-toolbelt": "*", - "slugify": "*", - "semver": "*", - "qs": "*", - "prettier": "*", - "plugin-hooks": "*", - "object-hash": "*", - "mitt": "*", - "lodash-es": "*", - "lodash": "*", - "jsondiffpatch": "*", - "json-schema-to-typescript": "*", - "immer": "*", - "hoper": "*", - "graphql-parse-resolve-info": "*", - "graphql": "*", - "glob": "*", - "fs-extra": "*", - "fast-deep-equal": "*", - "fast-copy": "*", - "ejson": "*", - "deep-object-diff": "*", - "deep-diff": "*", - "dayjs": "*", - "dateformat": "*", - "commander": "*", - "bun-types": "*", - "bun-safe": "*", - "big.js": "*", - "awesome-phonenumber": "*", - "aggio": "*", - "@types/semver": "*", - "@types/lodash-es": "*", - "@types/lodash": "*", - "@types/fs-extra": "*", - "@types/dateformat": "*" - } + "peerDependencies": {} } diff --git a/packages/utils/server-utils/index.cjs b/packages/utils/server-utils/index.cjs new file mode 100644 index 00000000..9ef0fa99 --- /dev/null +++ b/packages/utils/server-utils/index.cjs @@ -0,0 +1 @@ +module.exports = require('../out/server-utils/index.cjs'); diff --git a/packages/utils/server-utils/index.d.ts b/packages/utils/server-utils/index.d.ts new file mode 100644 index 00000000..4b35b602 --- /dev/null +++ b/packages/utils/server-utils/index.d.ts @@ -0,0 +1 @@ +export * from '../out/server-utils'; diff --git a/packages/utils/server-utils/index.js b/packages/utils/server-utils/index.js new file mode 100644 index 00000000..c874a500 --- /dev/null +++ b/packages/utils/server-utils/index.js @@ -0,0 +1 @@ +module.exports = require('../out/server-utils/index.js'); diff --git a/packages/utils/server-utils/index.mjs b/packages/utils/server-utils/index.mjs new file mode 100644 index 00000000..503d6c3b --- /dev/null +++ b/packages/utils/server-utils/index.mjs @@ -0,0 +1 @@ +export * from '../out/server-utils/index.mjs'; diff --git a/packages/utils/src/node.ts b/packages/utils/src/node.ts deleted file mode 100644 index 50f36174..00000000 --- a/packages/utils/src/node.ts +++ /dev/null @@ -1,64 +0,0 @@ -import nodePath from 'path'; -import nodeURL from 'url'; - -import * as commander from 'commander'; -import fsExtra from 'fs-extra'; -import { glob, Glob, globIterate, globIterateSync, globSync } from 'glob'; -import * as semver from 'semver'; -import urlPattern from 'url-pattern'; - -import { devAssert } from './devAssert'; - -export function CWD(): string { - const errors: any[] = []; - - try { - return process.cwd() || devAssert('process.cwd() is empty.'); - } catch (e) { - errors.push(e); - } - - try { - return ( - require('process').cwd() || - devAssert("require('process').cwd() is empty.") - ); - } catch (e) { - errors.push(e); - } - - throw errors; -} - -export function resolveCWD(...parts: string[]) { - return nodePath.resolve(CWD(), ...parts); -} - -export const relativePath = resolveCWD; - -export function __dirnameGet(meta: { url: string }) { - if (typeof meta?.url !== 'string' || !meta.url) { - throw new Error( - `expected meta.url to be a valid string from import.meta.url` - ); - } - - return nodePath.dirname(nodeURL.fileURLToPath(meta.url)); -} - -export * from 'bun-safe'; - -export { - fsExtra, - fsExtra as fs, - nodePath, - nodeURL, - semver, - urlPattern, - commander, - glob, - Glob, - globIterate, - globIterateSync, - globSync, -}; diff --git a/packages/utils/src/server-utils/index.ts b/packages/utils/src/server-utils/index.ts new file mode 100644 index 00000000..ace82269 --- /dev/null +++ b/packages/utils/src/server-utils/index.ts @@ -0,0 +1,189 @@ +import path from 'node:path'; +import nodePath from 'path'; +import process, { cwd } from 'process'; +import nodeURL from 'url'; + +import { bunSafe } from 'bun-safe'; +import * as commander from 'commander'; +import fsExtra from 'fs-extra'; +import { glob, Glob, globIterate, globIterateSync, globSync } from 'glob'; +import { match, minimatch, MinimatchOptions } from 'minimatch'; +import prettyFormat from 'pretty-format'; +import * as semver from 'semver'; +import urlPattern from 'url-pattern'; + +import { devAssert } from '../devAssert'; +import { hey } from '../hey'; + +function CWD(): string { + const errors: any[] = []; + + try { + return process.cwd() || devAssert('process.cwd() is empty.'); + } catch (e) { + errors.push(e); + } + + try { + return ( + require('process').cwd() || + devAssert("require('process').cwd() is empty.") + ); + } catch (e) { + errors.push(e); + } + + throw errors; +} + +function resolveCWD(...parts: string[]) { + return nodePath.resolve(CWD(), ...parts); +} + +const FILENAME = overrideToString(function FILENAME(meta?: _META_) { + if (!meta && process.argv[1]) return process.argv[1]; + const url = meta ? meta.url! : devAssert('import.meta is required'); + return nodeURL.fileURLToPath(url); +}); + +const DIRNAME = overrideToString(function DIRNAME(meta?: _META_) { + return nodePath.dirname(FILENAME(meta)); +}); + +const BASENAME = function BASENAME(meta?: _META_) { + return nodePath.basename(FILENAME(meta)); +}; + +function format(values: unknown[]) { + return values.map((v) => pretty(v)).join(' '); +} + +const log = Object.assign( + function log(args: unknown[]) { + return hey`${format(args)}`; + }, + { + error: (...args: unknown[]) => hey.red`${format(args)}`, + warn: (...args: unknown[]) => hey.yellow`${format(args)}`, + info: (...args: unknown[]) => hey.blue`${format(args)}`, + } +); + +function parseArgv(argv?: string | string[]) { + const [input, ...params] = (() => { + if (typeof argv === 'string') { + return [argv]; + } + return argv || process.argv.slice(2); + })(); + + if (!input) return null; + + const JS_TS_REGEX = /\.[mc]?[jt]sx?$/; + + if (JS_TS_REGEX.test(input)) { + const scriptRelative = path.resolve(cwd(), input); + + return { + input, + params: params.join(' '), + script: input, + scriptRelative, + } as const; + } + + return { + input, + params: params.join(' '), + script: null, + scriptRelative: null, + } as const; +} + +function pretty(value: unknown) { + if (typeof value === 'string') return value; + return prettyFormat(value); +} + +const UTILS = { + parseArgv, + match, + minimatch, + fsExtra, + nodePath, + nodeURL, + semver, + commander, + glob, + globIterate, + globIterateSync, + pretty, + FILENAME, + DIRNAME, + BASENAME, + resolveCWD, + globSync, + bunSafe, + CWD, + log, +}; + +export { + parseArgv, + UTILS, + match, + minimatch, + fsExtra, + nodePath, + nodeURL, + semver, + urlPattern, + commander, + glob, + Glob, + globIterate, + globIterateSync, + pretty, + FILENAME, + DIRNAME, + BASENAME, + resolveCWD, + globSync, + bunSafe, + CWD, + log, +}; + +export type { MinimatchOptions }; +export type ServerUtils = typeof UTILS; + +declare global { + const serverUtils: ServerUtils; + interface Window extends ServerUtils {} +} + +export function assignGlobalUtils() { + const source = { ...UTILS, UTILS: UTILS }; + Object.assign(globalThis, source); +} + +function overrideToString(fn: (meta?: _META_) => string) { + if ('__OTS_PATCHED__' in fn) return fn; + + const original = fn.toString; + + return Object.assign(fn, { + __OTS_PATCHED__: true, + toString: function toString(): string { + try { + return fn(); + } catch (e) { + return original(); + } + }, + }); +} + +export type _META_ = { + url?: string; +}; diff --git a/packages/utils/src/zz/index.ts b/packages/utils/src/zz/index.ts new file mode 100644 index 00000000..adc4dc4f --- /dev/null +++ b/packages/utils/src/zz/index.ts @@ -0,0 +1,129 @@ +/// + +/** + * Executes typescript or js files using bun.js + */ + +import * as child_process from 'child_process'; +import path from 'node:path'; +import * as process from 'process'; + +import { DIRNAME, parseArgv } from '../server-utils'; + +export function isBunJsAvailable() { + try { + child_process.execSync('bun --version', { stdio: 'ignore' }); + return true; + } catch (e) { + return false; + } +} + +export function installBunJs() { + if (isBunJsAvailable()) return; + + try { + const script = child_process.execSync('curl https://bun.sh/install', { + encoding: 'utf8', + }); + + child_process.execSync(script, { + stdio: 'inherit', + }); + } catch (e: any) { + console.error(`\n> failed to install bun.js:\n${e.toString()}`); + process.exit(1); + } +} + +export type ZZOptions = { + encoding?: 'utf8' | 'buffer'; + stdio?: 'overlapped' | 'pipe' | 'ignore' | 'inherit'; +}; + +export function zz( + args?: string[] | string, + options?: Options +) { + const input = parseArgv(args); + if (!input) return; + + // @ts-ignore + options = { + encoding: 'utf8', + stdio: options?.encoding ? 'ignore' : 'inherit', + ...options, + }; + + const script = (() => { + if (input.input === '-') { + return `bun ${input.params}`; + } + + const { body, header, append } = (() => { + if (input.scriptRelative) { + return { + header: `import '${input.scriptRelative}';`, + body: '', + append: input.params, + }; + } + + return { + header: '', + body: [input.input, input.params].join(' '), + append: '', + }; + })(); + + const content = [ + `import { assignGlobalUtils } from '${path.resolve( + '../', + DIRNAME.toString(), + '../server-utils' + )}';`, + 'assignGlobalUtils();', + header, + '', + body + ? `process.stdout.write(pretty(\n\n\n/* ▼ YOUR CODE ▼ */\n${body}\n\n)+'\\n');` + : '', + '', + ] + .filter(Boolean) + .join('\n') + .replace(/"/g, (part) => `\\${part}`); + + return ['bun --eval', `"${content}"`, append].join(' '); + })(); + + return child_process.execSync(`${script}`, options); +} + +export function awaitUntil() { + const exit = (() => { + let FINISHED = false; + function wait() { + if (!FINISHED) setTimeout(wait); + } + wait(); + return (code: 1 | 0) => { + FINISHED = true; + process.exit(code); + }; + })(); + + return { exit }; +} + +const hasArguments = process.argv[2]; +if (hasArguments) { + const { exit } = awaitUntil(); + + try { + zz(); + exit(0); + } catch (e) { + exit(1); + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ee703736..149e6640 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,132 +119,12 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dataloader: - specifier: '*' - version: 2.2.2 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql: - specifier: '*' - version: 16.8.1 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 jsonwebtoken: specifier: 8.5.1 version: 8.5.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 - plugin-hooks: - specifier: '*' - version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 scrypt-kdf: specifier: 2.0.1 version: 2.0.1 - semver: - specifier: '*' - version: 7.6.0 - sift: - specifier: '*' - version: 17.0.1 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -405,9 +285,6 @@ importers: '@babel/cli': specifier: 7.23.9 version: 7.23.9(@babel/core@7.23.7) - '@babel/core': - specifier: '*' - version: 7.23.7 '@babel/plugin-transform-typescript': specifier: 7.23.6 version: 7.23.6(@babel/core@7.23.7) @@ -417,33 +294,18 @@ importers: '@babel/preset-typescript': specifier: 7.23.3 version: 7.23.3(@babel/core@7.23.7) - '@babel/types': - specifier: '*' - version: 7.23.6 '@powership/babel-plugins': specifier: workspace:* version: link:../babel-plugins - '@types/babel__core': - specifier: '*' - version: 7.20.5 '@typescript-eslint/eslint-plugin': specifier: 7.1.1 version: 7.1.1(@typescript-eslint/parser@7.1.1)(eslint@8.57.0)(typescript@5.4.2) '@typescript-eslint/parser': specifier: 7.1.1 version: 7.1.1(eslint@8.57.0)(typescript@5.4.2) - babel-plugin-add-import-extension: - specifier: '*' - version: 1.6.0(@babel/core@7.23.7) - babel-plugin-replace-import-extension: - specifier: '*' - version: 1.1.3 babel-preset-minify: specifier: 0.5.2 version: 0.5.2 - esbuild: - specifier: '*' - version: 0.20.1 eslint: specifier: 8.57.0 version: 8.57.0 @@ -462,30 +324,9 @@ importers: eslint-plugin-typescript-sort-keys: specifier: 3.2.0 version: 3.2.0(@typescript-eslint/parser@7.1.1)(eslint@8.57.0)(typescript@5.4.2) - jest: - specifier: '*' - version: 29.7.0(@types/node@16.18.3)(ts-node@10.9.1) - npm-run-all: - specifier: '*' - version: 4.1.5 prettier: specifier: 2.8.8 version: 2.8.8 - prettier-plugin-multiline-arrays: - specifier: '*' - version: 1.1.4 - rimraf: - specifier: '*' - version: 5.0.5 - ts-jest: - specifier: '*' - version: 29.1.2(@babel/core@7.23.7)(esbuild@0.20.1)(jest@29.7.0)(typescript@5.4.2) - typedoc: - specifier: '*' - version: 0.25.11(typescript@5.4.2) - typescript: - specifier: '*' - version: 5.4.2 packages/deepstate: dependencies: @@ -495,111 +336,9 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 immer: specifier: 10.0.2 version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 - plugin-hooks: - specifier: '*' - version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 yjs: specifier: 13.6.0 version: 13.6.0 @@ -730,123 +469,15 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 dataloader: specifier: 2.2.2 version: 2.2.2 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 plugin-hooks: specifier: 2.0.0 version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 sift: specifier: 17.0.1 version: 17.0.1 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -944,123 +575,9 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql: - specifier: '*' - version: 16.8.1 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 plugin-hooks: specifier: 2.0.0 version: 2.0.0 - prettier: - specifier: '*' - version: 2.8.8 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -1121,7 +638,7 @@ importers: version: 4.1.5 prettier-plugin-multiline-arrays: specifier: 3.0.4 - version: 3.0.4(prettier@2.8.8) + version: 3.0.4(prettier@3.2.5) rimraf: specifier: 5.0.5 version: 5.0.5 @@ -1146,123 +663,15 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 dataloader: specifier: 2.2.2 version: 2.2.2 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 plugin-hooks: specifier: 2.0.0 version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 sift: specifier: 17.0.1 version: 17.0.1 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -1360,132 +769,12 @@ importers: '@powership/schema': specifier: workspace:* version: link:../schema - '@powership/transporter': - specifier: 3.3.11 - version: link:../transporter '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dataloader: - specifier: '*' - version: 2.2.2 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) highlight.js: specifier: 11.7.0 version: 11.7.0 - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 - plugin-hooks: - specifier: '*' - version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 - sift: - specifier: '*' - version: 17.0.1 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -1586,144 +875,12 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - body-parser: - specifier: '*' - version: 1.20.2 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dataloader: - specifier: '*' - version: 2.2.2 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - graphql-playground-html: - specifier: '*' - version: 1.6.30 - highlight.js: - specifier: '*' - version: 11.7.0 - hoper: - specifier: '*' - version: 1.0.8 - http-errors: - specifier: '*' - version: 2.0.0 - http-status-codes: - specifier: '*' - version: 2.3.0 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - logstorm: - specifier: 3.3.11 - version: link:../logstorm - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 + '@types/bun': + specifier: 1.0.10 + version: 1.0.10 plugin-engine: specifier: workspace:* version: link:../plugin-engine - plugin-hooks: - specifier: '*' - version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 - sift: - specifier: '*' - version: 17.0.1 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -1836,12 +993,6 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 '@types/glob': specifier: ^8.1.0 version: 8.1.0 @@ -1854,108 +1005,33 @@ importers: '@types/semver': specifier: 7.5.8 version: 7.5.8 - '@types/vorpal': - specifier: 1.12.2 - version: 1.12.2 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: 10.0.0 - version: 10.0.0 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 + '@types/vorpal': + specifier: 1.12.2 + version: 1.12.2 + commander: + specifier: 10.0.0 + version: 10.0.0 fs-extra: specifier: 10.1.0 version: 10.1.0 glob: specifier: 10.3.10 version: 10.3.10 - graphql: - specifier: '*' - version: 16.8.1 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 lodash: specifier: 4.17.21 version: 4.17.21 lodash-es: specifier: 4.17.21 version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 plugin-hooks: specifier: 2.0.0 version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 semver: specifier: 7.6.0 version: 7.6.0 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 tsx: specifier: 4.7.1 version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -2041,111 +1117,6 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 - plugin-hooks: - specifier: '*' - version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -2270,123 +1241,27 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 body-parser: specifier: 1.20.2 version: 1.20.2 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) graphql-playground-html: specifier: ^1.6.30 version: 1.6.30 - hoper: - specifier: '*' - version: 1.0.8 http-errors: specifier: ^2.0.0 version: 2.0.0 http-status-codes: specifier: ^2.2.0 version: 2.3.0 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 logstorm: specifier: workspace:* version: link:../logstorm - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 plugin-hooks: specifier: 2.0.0 version: 2.0.0 qs: specifier: 6.11.2 version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 url-pattern: specifier: 1.0.3 version: 1.0.3 @@ -2511,123 +1386,15 @@ importers: '@powership/utils': specifier: workspace:* version: link:../utils - '@types/dateformat': - specifier: '*' - version: 5.0.2 - '@types/fs-extra': - specifier: '*' - version: 9.0.13 - '@types/lodash': - specifier: '*' - version: 4.14.191 - '@types/lodash-es': - specifier: '*' - version: 4.17.12 - '@types/semver': - specifier: '*' - version: 7.5.8 - aggio: - specifier: '*' - version: 0.2.0 - awesome-phonenumber: - specifier: '*' - version: 6.2.0 - big.js: - specifier: '*' - version: 6.2.1 - bun-safe: - specifier: '*' - version: 1.0.7 - bun-types: - specifier: '*' - version: 1.0.29 - commander: - specifier: '*' - version: 10.0.0 dataloader: specifier: 2.2.2 version: 2.2.2 - dateformat: - specifier: '*' - version: 5.0.3 - dayjs: - specifier: '*' - version: 1.11.6 - deep-diff: - specifier: '*' - version: 1.0.2 - deep-object-diff: - specifier: '*' - version: 1.1.9 - ejson: - specifier: '*' - version: 2.2.3 - fast-copy: - specifier: '*' - version: 3.0.0 - fast-deep-equal: - specifier: '*' - version: 3.1.3 - fs-extra: - specifier: '*' - version: 10.1.0 - glob: - specifier: '*' - version: 10.3.10 - graphql-parse-resolve-info: - specifier: '*' - version: 4.13.0(graphql@16.8.1) - hoper: - specifier: '*' - version: 1.0.8 - immer: - specifier: '*' - version: 10.0.2 - json-schema-to-typescript: - specifier: '*' - version: 11.0.2 - jsondiffpatch: - specifier: '*' - version: 0.4.1 - lodash: - specifier: '*' - version: 4.17.21 - lodash-es: - specifier: '*' - version: 4.17.21 - mitt: - specifier: '*' - version: 3.0.0 - object-hash: - specifier: '*' - version: 3.0.0 plugin-hooks: specifier: 2.0.0 version: 2.0.0 - qs: - specifier: '*' - version: 6.11.2 - semver: - specifier: '*' - version: 7.6.0 sift: specifier: 17.0.1 version: 17.0.1 - slugify: - specifier: '*' - version: 1.6.5 - ts-toolbelt: - specifier: '*' - version: 9.6.0 - tsx: - specifier: '*' - version: 4.7.1 - ulid: - specifier: '*' - version: 2.3.0 - url-pattern: - specifier: '*' - version: 1.0.3 devDependencies: '@babel/cli': specifier: 7.23.9 @@ -2719,6 +1486,9 @@ importers: packages/utils: dependencies: + '@types/bun': + specifier: 1.0.10 + version: 1.0.10 '@types/dateformat': specifier: 5.0.2 version: 5.0.2 @@ -2734,6 +1504,9 @@ importers: '@types/semver': specifier: 7.5.8 version: 7.5.8 + add: + specifier: 2.0.6 + version: 2.0.6 aggio: specifier: 0.2.0 version: 0.2.0 @@ -2803,6 +1576,9 @@ importers: lodash-es: specifier: 4.17.21 version: 4.17.21 + minimatch: + specifier: 9.0.3 + version: 9.0.3 mitt: specifier: 3.0.0 version: 3.0.0 @@ -2815,6 +1591,9 @@ importers: prettier: specifier: 2.8.8 version: 2.8.8 + pretty-format: + specifier: 29.7.0 + version: 29.7.0 qs: specifier: 6.11.2 version: 6.11.2 @@ -5022,6 +3801,12 @@ packages: '@types/node': 20.11.25 dev: true + /@types/bun@1.0.10: + resolution: {integrity: sha512-Jaz6YYAdm1u3NVlgSyEK+qGmrlLQ20sbWeEoXD64b9w6z/YKYNWlfaphu+xF2Kiy5Tpykm5Q9jIquLegwXx4ng==} + dependencies: + bun-types: 1.0.33 + dev: false + /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: @@ -5684,6 +4469,10 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + /add@2.0.6: + resolution: {integrity: sha512-j5QzrmsokwWWp6kUcJQySpbG+xfOBqqKnup3OIk1pz+kB/80SLorZ9V8zHFLO92Lcd+hbvq8bT+zOGoPkmBV0Q==} + dev: false + /agent-base@7.1.0: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} @@ -6279,7 +5068,7 @@ packages: resolution: {integrity: sha512-vKAtLM2NlBfLGqe8H54SxRP8Obz/yZNiFBLZmE4s/iz2lqgocHe9ok5UXIp8M8+VXmClVOccEk4XGW479dHyGg==} hasBin: true dependencies: - bun-types: 1.0.30 + bun-types: 1.0.33 dev: false /bun-types@1.0.26: @@ -6296,8 +5085,8 @@ packages: '@types/ws': 8.5.10 dev: false - /bun-types@1.0.30: - resolution: {integrity: sha512-z3366LC0kdSpBCNFvc38+NOSiwQaokKfi66fBr+jw+yd9lrYtaoLs4ERCuq3iW/g9h6xKielQRgvE01PN/uUog==} + /bun-types@1.0.33: + resolution: {integrity: sha512-L5tBIf9g6rBBkvshqysi5NoLQ9NnhSPU1pfJ9FzqoSfofYdyac3WLUnOIuQ+M5za/sooVUOP2ko+E6Tco0OLIA==} dependencies: '@types/node': 20.11.25 '@types/ws': 8.5.10 @@ -9884,6 +8673,16 @@ packages: prettier: 2.8.8 proxy-vir: 1.0.0 + /prettier-plugin-multiline-arrays@3.0.4(prettier@3.2.5): + resolution: {integrity: sha512-Oj9ZfEisLOF0did1CGXXQLTA0WEChT2pfI06pNA1PbvWqbys9a5xoys6DoZlDL+Uio0uW1XwKZkeKMAkG1EEfQ==} + peerDependencies: + prettier: '>=3.0.0' + dependencies: + '@augment-vir/common': 23.4.0 + prettier: 3.2.5 + proxy-vir: 1.0.0 + dev: true + /prettier@2.4.0: resolution: {integrity: sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ==} engines: {node: '>=10.13.0'} @@ -9895,6 +8694,12 @@ packages: engines: {node: '>=10.13.0'} hasBin: true + /prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-format@29.7.0: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}