![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
nanachi-webpack
Advanced tools
以React方式高效开发小程序
这只是anu的一个扩展,通过实现不同的render,以支持在微信小程序,百度小程序,支付宝小程,快应用,H5, hybird上运行。
npm
npm install nanachi-cli -g
yarn
yarn global add nanachi-cli
<project-name>
创建工程cd <project-name> && npm i
安装依赖nanachi watch:[wx|bu|ali|quick]
监听构建小程序nanachi build:[wx|bu|ali|quick]
构建小程序注意:快应用下构建结束后,需要执行以下三步骤
详见 https://rubylouvre.github.io/nanachi/index.html 或 https://github.com/RubyLouvre/anu/tree/master/packages/render/miniapp
const nanachi = require('nanachi-cli');
nanachi({
/**
* @Boolean
* 是否使用watch模式,默认值:false
*/
watch,
/**
* @Enum ['wx', 'ali', 'bu', 'tt', 'quick']
* 平台,默认值:wx
*/
platform,
/**
* @Boolean
* 是否使用线上beta核心库,默认值:false
*/
beta,
/**
* @Boolean
* 是否使用最新schnee-ui,默认值:false
*/
betaUi,
/**
* @Boolean
* 是否使用压缩模式,默认值:false
*/
compress,
/**
* @Object
* 压缩图片参数(压缩率等)
*/
compressOption,
/**
* @Boolean
* 是否是huawei平台,默认值:false
*/
huawei,
/**
* @Array
* 自定义预处理loaders,默认值:[]
*/
prevLoaders,
/**
* @Array
* 自定义后处理loaders,默认值:[]
*/
postloaders,
/**
* @Array
* 自定义添加webpack module.rules规则,默认值:[]
*/
rules,
/**
* @Array
* 自定义webpack插件,默认值:[]
*/
plugins,
/**
* @function complete
* 解析完成回调
* (err, result) => { }
* err: 错误
* result: webpack打包信息
*/
complete
});
/**
* compressOption:
* {
* jpg: {} // 具体参考 https://github.com/imagemin/imagemin-mozjpeg/blob/master/readme.md
* png: {} // 具体参考 https://github.com/imagemin/imagemin-optipng/blob/master/readme.md
* gif: {} // 具体参考 https://github.com/imagemin/imagemin-gifsicle/blob/master/readme.md
* svg: {} // 具体参考 https://github.com/imagemin/imagemin-svgo/blob/master/readme.md
* }
*/
用户可以使用nanachi api编译nanachi应用,同时支持自定义预处理loader和后处理loader。
compress压缩模式就是使用后处理loader实现的,链接:https://www.npmjs.com/package/nanachi-compress-loader
我们规定了loader的输入和输出格式
{
queues: // 需要生成的文件数组,如nanachi中的js文件在微信转义中会同时生成wxml和js文件还有可能生成json文件
[{
code, // 生成文件内容
type, // 生成文件类型
path // 生成文件相对路径
}],
exportCode // 标准js代码,包含了文件的依赖信息,用于webpack解析文件依赖
}
自定义loader应用到项目中,有两种方式供选择:
// nanachi.config.js
module.exports = {
postLoaders: ['nanachi-compress-loader']
}
正常运行nanachi命令,即可将自定义配置应用到项目中
npm install nanachi-compress-loader --save-dev
nanachi build
// build.js
const nanachi = require('nanachi-cli');
nanachi({
platform: 'ali',
postLoaders: ['nanachi-compress-loader']
});
node build.js
FAQs
cli tool for nanachi
The npm package nanachi-webpack receives a total of 4 weekly downloads. As such, nanachi-webpack popularity was classified as not popular.
We found that nanachi-webpack 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.