Skip to content

Commit

Permalink
feat: Bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed May 23, 2024
1 parent 099f80c commit aacb540
Show file tree
Hide file tree
Showing 5 changed files with 1,075 additions and 1,056 deletions.
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"@rollup/plugin-typescript": "^11.1.6",
"magic-string": "^0.30.10",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"rollup": "^4.16.4",
"tsc-alias": "^1.8.8",
"rimraf": "^5.0.7",
"rollup": "^4.18.0",
"tsc-alias": "^1.8.10",
"typescript": "^5.4.5"
}
}
30 changes: 15 additions & 15 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,48 @@
"format": "prettier --write . --ignore-path .prettierignore"
},
"dependencies": {
"@ant-design/icons": "^5.3.6",
"@ant-design/icons": "^5.3.7",
"@nuintun/qrcode": "workspace:*",
"@swc/helpers": "^0.5.11",
"antd": "^5.16.4",
"antd": "^5.17.3",
"browser-fs-access": "^0.35.0",
"chardet": "^2.0.0",
"copy-to-clipboard": "^3.3.3",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13"
},
"devDependencies": {
"@nuintun/svgo-loader": "^0.2.5",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@swc/core": "^1.5.0",
"@types/react": "^18.3.0",
"@nuintun/svgo-loader": "^0.2.7",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
"@swc/core": "^1.5.7",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.19",
"bufferutil": "^4.0.8",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^7.1.1",
"css-minimizer-webpack-plugin": "6.0.0",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "7.0.0",
"css-modules-types-loader": "^0.5.3",
"find-free-ports": "^3.1.1",
"html-webpack-plugin": "^5.6.0",
"koa": "^2.15.3",
"koa-compress": "^5.1.1",
"memfs": "^4.8.2",
"memfs": "^4.9.2",
"mini-css-extract-plugin": "^2.9.0",
"nodemon": "^3.1.0",
"postcss": "^8.4.38",
"postcss-loader": "^8.1.1",
"prettier": "^3.2.5",
"sass": "^1.75.0",
"sass": "^1.77.2",
"sass-loader": "^14.2.1",
"svgc-loader": "^0.2.5",
"svgc-loader": "^0.2.7",
"swc-loader": "^0.2.6",
"terser-webpack-plugin": "^5.3.10",
"typescript": "^5.4.5",
"utf-8-validate": "^6.0.3",
"utf-8-validate": "^6.0.4",
"webpack": "^5.91.0",
"webpack-dev-service": "^0.11.2"
"webpack-dev-service": "^0.11.3"
}
}
40 changes: 35 additions & 5 deletions packages/examples/tools/lib/ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,52 @@

import os from 'os';

const IPV4_RE = /^\d{1,3}(?:\.\d{1,3}){3}$/;
/**
* @function isLinkLocal
* @param {string} address
* @returns {boolean}
*/
function isLinkLocal(address) {
return /^fe80:/i.test(address);
}

/**
* @function isIPv4
* @param {string} family
* @returns {boolean}
*/
function isIPv4(family) {
return family === 'IPv4' || family === 4;
}

/**
* @function isIPv6
* @param {string} family
* @returns {boolean}
*/
function isIPv6(family) {
return family === 'IPv6' || family === 6;
}

/**
* @function resolveIp
* @param {boolean} ipv4
* @param {boolean} ipv6
* @return {Promise<string>}
*/
export default async (ipv4 = true) => {
export default (ipv6 = false) => {
const isMatchFamily = ipv6 ? isIPv6 : isIPv4;
const networkInterfaces = os.networkInterfaces();
const interfaces = Object.keys(networkInterfaces);

for (const face of interfaces) {
const networkInterface = networkInterfaces[face];

for (const { address, internal } of networkInterface) {
if (!internal && ipv4 && IPV4_RE.test(address)) {
for (const { family, address, internal } of networkInterface) {
if (!internal && isMatchFamily(family)) {
if (ipv6 && isLinkLocal(address)) {
continue;
}

return address;
}
}
Expand Down
27 changes: 10 additions & 17 deletions packages/examples/tools/lib/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,23 @@
* @description 解析 browserslist 配置
*/

import { readFile } from 'fs';
import { resolve } from 'path';
import { readFile } from 'fs/promises';

// 默认配置
const defaultConfig = resolve('.browserslistrc');

/**
* @function parse
* @param {string} path
* @return {Array}
* @return {Promise<Array>}
*/
export default (path = defaultConfig) => {
return new Promise((resolve, reject) => {
readFile(path, { encoding: 'utf-8' }, async (error, code) => {
if (error) {
reject(error);
} else {
resolve(
code
.replace(/#[^\r\n]*/g, '')
.split(/\s*[\r\n,]+\s*/)
.filter(query => query)
);
}
});
});
export default async (path = defaultConfig) => {
const code = await readFile(path);

return code
.toString()
.replace(/#[^\r\n]*/g, '')
.split(/\s*[\r\n,]+\s*/)
.filter(query => query);
};
Loading

0 comments on commit aacb540

Please sign in to comment.