Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Command Line Interface for MIP 2.0.
Prerequisites: Node.js (>=8.x), npm version 3+ and Git.
$ npm install -g mip2
创建项目
$ mip2 init
新增一个组件
在项目根目录运行 mip2 add
命令,即可快速添加一个新组件
# 快速添加名为 mip-new 的组件
$ mip2 add mip-new
# 使用 -f 或 --force 参数强制覆盖同名组件
$ mip2 add mip-new -f
启动调试服务器,在项目根目录运行
$ mip2 dev
Example:
# 可使用 ——port 指定端口
$ mip2 dev --port 8888
组件和页面校验
$ mip2 validate
Example:
# 组件校验
$ mip2 validate components
$ mip2 validate -c components
# 页面校验
$ mip2 validate -p page.html
构建组件,在项目根目录运行
$ mip2 build
生成 Service Worker
mip2 CLI 提供了 sw
命令,帮助开发者更简单快速地生成 Service Worker,支持离线可用等特性。
# 在项目根目录运行
$ mip2 sw
默认情况下,将导出 Service Worker 文件到 dist/sw.js
,并对静态资源(如 js,css)及 html 文档进行缓存,实现页面的离线可用。
mip2 sw
命令提供了选项:
-o, --output // 指定 sw 导出路径,如 mip2 -o output/service-worker.js
-c, --config // 指定配置文件路径,默认使用项目根目录 mip.config.js
除此之外,我们可以在 mip.config.js
中增加 serviceWorker
配置项,对 Service Worker 进行进一步的配置,如预缓存列表、动态缓存策略、skipWaiting
、clientsClaim
等。
module.exports = {
dev: {/*...*/},
serviceWorker: {
cacheId: 'mipuser',
skipWaiting: true,
clientsClaim: true,
runtimeCaching: [],
globPatterns: [],
globIgnores: []
}
}
更多的配置选项可以参考 Workbox 配置项
1.1.4
build
配置项1.1.2
1.0.13
import()
和 require.ensure
异步加载模块FAQs
CLI for mip 2.0
The npm package mip2 receives a total of 76 weekly downloads. As such, mip2 popularity was classified as not popular.
We found that mip2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.