@xyo-network/plugins 3.5.3 → 3.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +30 -23
- package/scripts/deplint.mjs +123 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/plugins",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"build-typedoc-site": "typedoc",
|
|
38
38
|
"compile": "./scripts/clear-scrollback-buffer.sh && yarn xy compile",
|
|
39
39
|
"coverage": "yarn vitest --coverage --forceExit",
|
|
40
|
+
"deplint": "node ./scripts/deplint.mjs",
|
|
40
41
|
"deploy": "xy deploy",
|
|
41
42
|
"lint-pkg": "npmPkgJsonLint .",
|
|
42
43
|
"test": "vitest run"
|
|
@@ -45,50 +46,56 @@
|
|
|
45
46
|
"axios": "^1",
|
|
46
47
|
"ethers": "^6",
|
|
47
48
|
"jsbi": "^3",
|
|
48
|
-
"
|
|
49
|
+
"unrs-resolver": "1.7.1",
|
|
50
|
+
"vitest": "3.1.1"
|
|
49
51
|
},
|
|
50
52
|
"dependencies": {
|
|
51
|
-
"@xyo-network/payload-plugins": "^3.5.
|
|
52
|
-
"@xyo-network/payloadset-plugins": "^3.5.
|
|
53
|
+
"@xyo-network/payload-plugins": "^3.5.5",
|
|
54
|
+
"@xyo-network/payloadset-plugins": "^3.5.5"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"@ethersproject/address": "^5.8.0",
|
|
56
58
|
"@ethersproject/bignumber": "^5.8.0",
|
|
57
59
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
58
60
|
"@types/supertest": "^6.0.3",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
60
|
-
"@typescript-eslint/parser": "^8.
|
|
61
|
-
"@vitest/coverage-v8": "^3.1.
|
|
62
|
-
"@xylabs/eslint-config-flat": "^6.3.
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^8.31.0",
|
|
62
|
+
"@typescript-eslint/parser": "^8.31.0",
|
|
63
|
+
"@vitest/coverage-v8": "^3.1.2",
|
|
64
|
+
"@xylabs/eslint-config-flat": "^6.3.5",
|
|
63
65
|
"@xylabs/express": "^4.8.7",
|
|
64
66
|
"@xylabs/forget": "^4.8.7",
|
|
65
67
|
"@xylabs/platform": "^4.8.7",
|
|
66
|
-
"@xylabs/ts-scripts-yarn3": "^6.3.
|
|
67
|
-
"@xylabs/tsconfig": "^6.3.
|
|
68
|
+
"@xylabs/ts-scripts-yarn3": "^6.3.5",
|
|
69
|
+
"@xylabs/tsconfig": "^6.3.5",
|
|
68
70
|
"@xylabs/vitest-extended": "^4.8.7",
|
|
69
|
-
"@xyo-network/account": "^3.
|
|
70
|
-
"@xyo-network/archivist-memory": "^3.
|
|
71
|
-
"@xyo-network/boundwitness-builder": "^3.
|
|
72
|
-
"@xyo-network/hash": "^3.
|
|
73
|
-
"@xyo-network/manifest": "^3.
|
|
74
|
-
"@xyo-network/manifest-wrapper": "^3.
|
|
75
|
-
"@xyo-network/
|
|
76
|
-
"@xyo-network/
|
|
71
|
+
"@xyo-network/account": "^3.14.12",
|
|
72
|
+
"@xyo-network/archivist-memory": "^3.14.12",
|
|
73
|
+
"@xyo-network/boundwitness-builder": "^3.14.12",
|
|
74
|
+
"@xyo-network/hash": "^3.14.12",
|
|
75
|
+
"@xyo-network/manifest": "^3.14.12",
|
|
76
|
+
"@xyo-network/manifest-wrapper": "^3.14.12",
|
|
77
|
+
"@xyo-network/module-factory-locator": "^3.14.12",
|
|
78
|
+
"@xyo-network/node-memory": "^3.14.12",
|
|
79
|
+
"@xyo-network/payload-builder": "^3.14.12",
|
|
80
|
+
"@xyo-network/wallet": "^3.14.12",
|
|
81
|
+
"chalk": "^5.4.1",
|
|
77
82
|
"dotenv": "^16.5.0",
|
|
78
|
-
"eslint": "^9.25.
|
|
79
|
-
"eslint-import-resolver-typescript": "^4.3.
|
|
83
|
+
"eslint": "^9.25.1",
|
|
84
|
+
"eslint-import-resolver-typescript": "^4.3.4",
|
|
80
85
|
"eslint-plugin-import": "^2.31.0",
|
|
81
86
|
"eslint-plugin-sonarjs": "^3.0.2",
|
|
87
|
+
"glob": "^11.0.2",
|
|
82
88
|
"jsbi": "^4.3.2",
|
|
83
89
|
"jsdom": "^26.1.0",
|
|
84
90
|
"knip": "^5.50.5",
|
|
85
|
-
"nodemon": "^3.1.
|
|
91
|
+
"nodemon": "^3.1.10",
|
|
86
92
|
"reflect-metadata": "^0.2.2",
|
|
93
|
+
"rimraf": "^6.0.1",
|
|
87
94
|
"supertest": "^7.1.0",
|
|
88
95
|
"tslib": "^2.8.1",
|
|
89
|
-
"typedoc": "^0.28.
|
|
96
|
+
"typedoc": "^0.28.3",
|
|
90
97
|
"typescript": "^5.8.3",
|
|
91
|
-
"vitest": "^3.1.
|
|
98
|
+
"vitest": "^3.1.2"
|
|
92
99
|
},
|
|
93
100
|
"packageManager": "yarn@4.9.1",
|
|
94
101
|
"volta": {
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import ts from 'typescript'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import fs from 'node:fs'
|
|
6
|
+
import { globSync } from 'glob'
|
|
7
|
+
import { yarnWorkspaces } from '@xylabs/ts-scripts-yarn3'
|
|
8
|
+
import chalk from 'chalk'
|
|
9
|
+
|
|
10
|
+
function getDependenciesFromPackageJson(packageJsonPath) {
|
|
11
|
+
const packageJsonFullPath = path.resolve(packageJsonPath)
|
|
12
|
+
const rawContent = fs.readFileSync(packageJsonFullPath, 'utf8')
|
|
13
|
+
const packageJson = JSON.parse(rawContent)
|
|
14
|
+
|
|
15
|
+
const dependencies = packageJson.dependencies
|
|
16
|
+
? Object.keys(packageJson.dependencies)
|
|
17
|
+
: []
|
|
18
|
+
|
|
19
|
+
const devDependencies = packageJson.devDependencies
|
|
20
|
+
? Object.keys(packageJson.devDependencies)
|
|
21
|
+
: []
|
|
22
|
+
|
|
23
|
+
return { dependencies, devDependencies }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getBasePackageName(importName) {
|
|
27
|
+
if (importName.startsWith('@')) {
|
|
28
|
+
const parts = importName.split('/')
|
|
29
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : importName
|
|
30
|
+
}
|
|
31
|
+
return importName.split('/')[0]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getImportsFromFile(filePath, importPaths) {
|
|
35
|
+
const sourceCode = fs.readFileSync(filePath, 'utf8')
|
|
36
|
+
|
|
37
|
+
const sourceFile = ts.createSourceFile(
|
|
38
|
+
path.basename(filePath),
|
|
39
|
+
sourceCode,
|
|
40
|
+
ts.ScriptTarget.Latest,
|
|
41
|
+
true,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const imports = []
|
|
45
|
+
|
|
46
|
+
function visit(node) {
|
|
47
|
+
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
48
|
+
const moduleSpecifier = (node.moduleSpecifier)?.text
|
|
49
|
+
if (moduleSpecifier) {
|
|
50
|
+
imports.push(moduleSpecifier)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
ts.forEachChild(node, visit)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
visit(sourceFile)
|
|
57
|
+
|
|
58
|
+
const cleanedImports = imports.filter(imp => !imp.startsWith('.') && !imp.startsWith('#') && !imp.startsWith('node:')).map(getBasePackageName)
|
|
59
|
+
|
|
60
|
+
for (const imp of cleanedImports) {
|
|
61
|
+
importPaths[imp] = importPaths[imp] || []
|
|
62
|
+
importPaths[imp].push(filePath)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return cleanedImports
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function findFilesByGlob(cwd, pattern) {
|
|
69
|
+
return globSync(pattern, { cwd, absolute: true })
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function run({
|
|
73
|
+
name, location, devDeps = false,
|
|
74
|
+
}) {
|
|
75
|
+
const allFiles = findFilesByGlob(location, './src/**/*.{ts,tsx}')
|
|
76
|
+
const prodFiles = allFiles.filter(file => !file.endsWith('.spec.ts') && !file.endsWith('.stories.tsx') && !file.includes('/spec/'))
|
|
77
|
+
const devFiles = allFiles.filter(file => file.endsWith('.spec.ts') || file.endsWith('.stories.tsx') || file.includes('/spec/'))
|
|
78
|
+
// console.log('Production files:', prodFiles)
|
|
79
|
+
// console.log('Development files:', devFiles)
|
|
80
|
+
const prodImportPaths = {}
|
|
81
|
+
const prodImports = prodFiles.flatMap(path => getImportsFromFile(path, prodImportPaths))
|
|
82
|
+
const devImportPaths = {}
|
|
83
|
+
const devImports = devFiles.flatMap(path => getImportsFromFile(path, devImportPaths))
|
|
84
|
+
const externalProdImports = prodImports.filter(imp => !imp.startsWith('.') && !imp.startsWith('#') && !imp.startsWith('node:'))
|
|
85
|
+
const externalDevImports = devImports.filter(imp => !imp.startsWith('.') && !imp.startsWith('#') && !imp.startsWith('node:'))
|
|
86
|
+
|
|
87
|
+
// console.log('externalProdImports:', externalProdImports)
|
|
88
|
+
// console.log('externalDevImports:', externalDevImports)
|
|
89
|
+
|
|
90
|
+
const deps = getDependenciesFromPackageJson(`${location}/package.json`)
|
|
91
|
+
// console.log('Project.Dependencies:', deps.dependencies)
|
|
92
|
+
// console.log('Project.DevDependencies:', deps.devDependencies)
|
|
93
|
+
|
|
94
|
+
for (const imp of externalProdImports) {
|
|
95
|
+
if (!deps.dependencies.includes(imp)) {
|
|
96
|
+
console.log(`[${chalk.blue(name)}] Missing dependency in package.json: ${chalk.red(imp)}`)
|
|
97
|
+
console.log(` ${prodImportPaths[imp].join('\n')}`)
|
|
98
|
+
console.log('')
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (devDeps) {
|
|
103
|
+
for (const imp of externalDevImports) {
|
|
104
|
+
if (!deps.devDependencies.includes(imp)) {
|
|
105
|
+
console.log(`[${chalk.blue(name)}] Missing devDependency in package.json: ${chalk.red(imp)}`)
|
|
106
|
+
console.log(` Found in: ${devImportPaths[imp].join(', ')}`)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return prodImports.length
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const workspaces = yarnWorkspaces()
|
|
114
|
+
|
|
115
|
+
console.log('Deplint Started...')
|
|
116
|
+
|
|
117
|
+
let totalImportsChecked = 0
|
|
118
|
+
|
|
119
|
+
for (const workspace of workspaces) {
|
|
120
|
+
totalImportsChecked += run(workspace)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
console.log('Deplint Finished. Total imports checked:', totalImportsChecked)
|