
Security News
/Research
Fake Corepack Site Distributes Infostealer and Proxyware to Developers
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.
@didid1/d1-core
Advanced tools
D1 工程套件或插件核心功能封装。
| 功能模块 | 状态 | 介绍 |
|---|---|---|
| auth | 【待开发】 | 实现对 SSO 登录的封装 |
| camel | 【待开发】 | 提供对 camel 的对接支持 |
| ESLint | 【待开发】 | 提供 ESLint 接入、检查、格式化 支持 |
| logger | 部分👌 | 提供 D1 统一的日志封装 |
| notifier | 【待开发】 | 提供 D1 统一的对外通知 |
| userConfig | 👌 | 提供统一的 D1 用户配置的读写功能 |
| d1ProjectConfig | 👌 | 提供统一的 D1 工程配置的读写功能 |
| gitUtil | 部分👌 | 提供 git 操作封装 |
| formatUtil | 👌 | 格式化工具 |
| cliPromptUtil | 👌 | CLI 交互封装 |
| yamlUtil | 👌 | yaml 类型文件读写封装 |
| packageJsonUtil | 👌 | package.json 读写封装 |
该模块实现对 SSO 登录的封装,使用方式如下
const { auth } = require('@didid1/d1-core');
auth.login().then((result) => {
// result: {
// }
//
}).catch(err => {
// ...
});;
auth.getUserInfo().then((result) => {
// result: {
// }
}).catch(err => {
// ...
});
实现 ESLint 接入、检查、格式化 等相关的功能
const { eslint } = reuqire('@didid1/d1-core');
eslint.init({
type: 'react',
silent: false,
supportTypeScript: false,
autoInstallDeps: false,
});
// eslintUtil.check(); 待开发
// eslintUtil.fix(); 待开发
该模块提供 D1 统一的日志封装。
该模块提供 D1 统一的对外通知。
const notify = require('@didid1/d1-core');
notify(information, DChartID);
该模块提供统一的 发布 功能封装。
该模块提供统一的 D1 用户配置的读写功能。
const { userConfig } = require('@didid1/d1-core');
userConfig.get('key');
userConfig.set('key', 'value');
工程目录目前采用 d1.json 和 d1.js 双配置方案,其中 json 文件中提供工程基础配置,js 文件提供更灵活的自定义和逻辑处理能力。
此外,d1.js 的优先级更好,会覆盖 d1.json 中的同名配置。
同时,自动化写入的配置,都会写入到 d1.json 中。
const { projectConfig } = require('@didid1/d1-core');
projectConfig.getProjectConfig();
projectConfig.getProjectConfigItem('key');
projectConfig.setProjectConfig('key', 'value');
该模块提供 D1 统一分析工具,用于提供统一的监控分析方案。
该模块提供对本地 Git 仓库及 remote 仓库的操作。
const { gitUtil } = require('@didid1/d1-core');
// 获取当前工程的 git origin 地址
const gitOrigin = await gitUtil.getGit();
// 非 git 工程或未设置 origin,return ''
console.log(gitOrigin);
const { formatUtil } = require('@didid1/d1-core');
// format { Stirng } 时间格式
// date { Date } 时间对象
formatUtil('format', new Date());
const { cliPromptUtil } = require('@didid1/d1-core');
// true or false 型询问
const { answer } = await cliPromptUtil.askIfORNot('question', true);
// 文本输入型询问
const { answer } = await cliPromptUtil.askForAnswer('question');
// 密码输入型询问
const { answer } = await cliPromptUtil.askForPassword('question');
// 基于正则校验的循环询问
const { answer } = await cliPromptUtil.askForAnswerValidated('question', /^test$/g, '输入不合法,请重试');
const { yamlUtil } = require('@didid1/d1-core');
// 解析 yaml 文件
yamlUtil.parseYaml('path-to-file');
// 覆写 yaml 文件
yamlUtil.safeDump(obj, 'path-to-file');
const { packageJsonUtil } = require('@didid1/d1-core');
// 首先执行初始化,再获取相关内容
console.log(packageJsonUtil.init().getJSON());
console.log(packageJsonUtil.init().getItem('name'));
// 需要提前传一些参数
const tracker = new Tracker({
// 应用名称
appName: '',
// 登陆用户
ID: '',
// 当前版本
version: '1.0,0',
});
//
/**
* 统计命令次数
* @param {String} cmdName 命令名称
* @param {Object} args 扩展参数,原样传递到 data 字段中
*/
async cmdTimes(cmdName, args = {})
/**
* 统计安装信息
* @param {Object} params 安装信息
* {
* // 当前 Node.js 版本
* nodeVersion: ''
* // 命令参数
* argv: ''
* // 是否全局安装,默认: false
* isGlobal: true / false
* // 其他自定义参数
* ...
* }
*/
async installInfo(obj = {})
/**
* 统计日志信息(含错误)
* @param {Object} err 经过 D1 包装过后的对象
* 格式
* { name: 'd1',
msg: 'this is warin',
time: 2018-12-17T08:19:12.318Z,
levelName: 'WARN ' }
*/
async log(errObj)
FAQs
provide core functions for d1 kits and plugins
We found that @didid1/d1-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.

Research
/Security News
A large-scale campaign abused GitHub Actions in compromised repositories to exploit CVE-2026-41940 in cPanel and WHM and steal server credentials.

Security News
Five frontier LLMs generated the same nonexistent package names, leaving 53 available for potential slopsquatting across PyPI and npm.