{"analyzedAt":"2022-07-05T06:12:44.576Z","collected":{"metadata":{"name":"@tybys/jweixin","scope":"tybys","version":"1.6.10007","description":"Weixin JS SDK UMD with typescript typings","keywords":["weixin","wechat","jweixin","wx","sdk","typings"],"date":"2021-06-20T16:18:01.732Z","author":{"name":"toyobayashi"},"publisher":{"username":"toyobayashi","email":"lifenglin314@outlook.com"},"maintainers":[{"username":"toyobayashi","email":"lifenglin314@outlook.com"}],"repository":{"type":"git","url":"git+https://github.com/toyobayashi/jweixin.git"},"links":{"npm":"https://www.npmjs.com/package/%40tybys%2Fjweixin"},"license":"MIT","devDependencies":{"@koa/router":"^9.0.1","@tybys/denostd":"^0.58.10000","@types/node":"^12.12.47","js-beautify":"^1.11.0","koa":"^2.12.1","koa-bodyparser":"^4.3.0","koa-static":"^5.0.0","koa2-cors":"^2.0.6","mocha":"^8.0.1","node-fetch":"^2.6.0","terser":"^4.7.0","ts-loader":"^7.0.5","typescript":"^3.9.5","webpack":"^4.43.0"},"releases":[{"from":"2022-06-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":0},{"from":"2022-04-06T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":1},{"from":"2022-01-06T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":1},{"from":"2021-07-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":1},{"from":"2020-07-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":3}],"hasTestScript":true,"readme":"# jweixin\r\n\r\n[微信 JSSDK](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html) UMD 版本，并且附带 TypeScript 声明文件，提供 API 智能补全及类型提示。\r\n\r\n官方提供的版本不能在 Webpack 里使用，改成 UMD 可以方便模块化开发。\r\n\r\n版本号说明：\r\n\r\n主版本号和次版本号跟随官方，修订号长度为 5 位，第一位固定是 1， 第二第三位是官方修订号，第四第五位是这个包的修订号，例如：\r\n\r\n如果官方 sdk 版本是 1.6.0，这个包对应的版本是 1.6.100xx\r\n\r\n如果官方 sdk 版本是 1.6.12，这个包对应的版本是 1.6.112xx\r\n\r\n## 截图\r\n\r\n![tip1.png](screenshot/tip1.png)\r\n![tip2.png](screenshot/tip2.png)\r\n![tip3.png](screenshot/tip3.png)\r\n\r\n## 安装\r\n\r\n### 用 NPM：\r\n\r\n``` bash\r\n$ npm install @tybys/jweixin\r\n```\r\n\r\n### 从仓库源码构建：\r\n\r\n``` bash\r\n$ git clone https://github.com/toyobayashi/jweixin.git\r\n$ cd jweixin\r\n$ npm install\r\n$ npm run build\r\n```\r\n\r\n输出在 `dist` 目录。\r\n\r\n如果构建失败，请到文档中找他的地址下载一份 jweixin-x.x.x.js 手动放到 `src/jweixin.min.js` 后重新执行 `npm run build`。\r\n\r\n## 用法\r\n\r\n### 在全局从 CDN 引入\r\n\r\n``` html\r\n<script src=\"https://cdn.jsdelivr.net/npm/@tybys/jweixin/dist/jweixin.min.js\"></script>\r\n<!-- 也可以直接引用官方的 -->\r\n<!-- <script src=\"http://res.wx.qq.com/open/js/jweixin-1.6.0.js\"></script> -->\r\n<script src=\"your-script.js\"></script>\r\n```\r\n\r\n``` js\r\n// your-script.js\r\n\r\n// 三斜线指令引用声明文件，可在 VSCode 中看到智能提示\r\n/// <reference path=\"node_modules/@tybys/jweixin/typings/jweixin.d.ts\" />\r\n\r\nconsole.log(wx);\r\nconsole.log(jWeixin);\r\n```\r\n\r\n在纯 JS 项目中要获取 TS 类型智能提示，除了可以使用三斜线指令，也可以配置 `jsconfig.json`，类似 `tsconfig.json`，在 `include` 或 `files` 数组中加入声明文件，VS Code 能认识 `jsconfig.json`：\r\n\r\n``` jsonc\r\n{\r\n  \"compilerOptions\": {\r\n    // ...\r\n  },\r\n  \"include\": [\r\n    \"path/to/your-script.js\",\r\n    \"node_modules/@tybys/jweixin/typings/jweixin.d.ts\",\r\n    // ...\r\n  ]\r\n}\r\n```\r\n\r\n### Webpack\r\n\r\nCommonJS:\r\n\r\n``` js\r\nconst wx = require('@tybys/jweixin')\r\n```\r\n\r\nES Module:\r\n\r\n``` js\r\n// 下面两种都可以\r\nimport * as wx from '@tybys/jweixin'\r\nimport wx from '@tybys/jweixin'\r\n```\r\n\r\n### TypeScript\r\n\r\n全局引入 SDK，只需要配置 `tsconfig.json`：\r\n\r\n``` jsonc\r\n{\r\n  \"compilerOptions\": {\r\n    // ...\r\n  },\r\n  \"include\": [\r\n    \"node_modules/@tybys/jweixin/typings/jweixin.d.ts\",\r\n    // ...\r\n  ]\r\n}\r\n```\r\n\r\nCommonJS:\r\n\r\n``` jsonc\r\n{\r\n  \"compilerOptions\": {\r\n    // ...\r\n    \"moduleResolution\": \"node\",\r\n    \"module\": \"CommonJS\",\r\n    // \"esModuleInterop\": true\r\n  }\r\n}\r\n```\r\n\r\n``` ts\r\n// 当 module 为 CommonJS 时\r\nimport wx = require('@tybys/jweixin') // ok\r\nimport * as wx from '@tybys/jweixin' // ok\r\nimport wx from '@tybys/jweixin' // compilerOptions.esModuleInterop = true\r\n```\r\n\r\nES Module:\r\n\r\n``` jsonc\r\n{\r\n  \"compilerOptions\": {\r\n    // ...\r\n    \"moduleResolution\": \"node\",\r\n    \"module\": \"ESNext\",\r\n    // \"allowSyntheticDefaultImports\": true\r\n  }\r\n}\r\n```\r\n\r\n``` ts\r\n// 当 module 为 ES 模块时，不能使用 import x = require()\r\nimport * as wx from '@tybys/jweixin' // ok\r\nimport wx from '@tybys/jweixin' // compilerOptions.allowSyntheticDefaultImports = true\r\n```"},"npm":{"downloads":[{"from":"2022-07-04T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":15},{"from":"2022-06-28T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":97},{"from":"2022-06-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":513},{"from":"2022-04-06T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":4273},{"from":"2022-01-06T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":5230},{"from":"2021-07-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":5549}],"starsCount":0},"github":{"starsCount":8,"forksCount":2,"subscribersCount":1,"issues":{"count":2,"openCount":1,"distribution":{"3600":0,"10800":0,"32400":1,"97200":0,"291600":0,"874800":0,"2624400":0,"7873200":0,"23619600":0,"70858800":1,"212576400":0},"isDisabled":false},"contributors":[{"username":"toyobayashi","commitsCount":27}],"commits":[{"from":"2022-06-28T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":0},{"from":"2022-06-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":0},{"from":"2022-04-06T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":0},{"from":"2022-01-06T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":0},{"from":"2021-07-05T00:00:00.000Z","to":"2022-07-05T00:00:00.000Z","count":0}]},"source":{"files":{"readmeSize":3222,"testsSize":14936,"hasNpmIgnore":true}}},"evaluation":{"quality":{"carefulness":0.7899999999999999,"tests":0.6,"health":1,"branding":0},"popularity":{"communityInterest":12,"downloadsCount":1424.3333333333333,"downloadsAcceleration":3.937519025875191,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":0.9,"issuesDistribution":0.9}},"score":{"final":0.6167427557253695,"detail":{"quality":0.8196964067285537,"popularity":0.05964440520462682,"maintenance":0.9998808339576686}}}