📦 添加虚拟环境和启动脚本

新增:
- backend/venv/ - Python 虚拟环境
- backend/start.sh - 启动脚本(使用虚拟环境)
- backend/requirements.txt - 依赖列表
- .gitignore - 忽略虚拟环境和缓存文件

说明:
- 每个项目使用独立虚拟环境
- 避免依赖冲突
- 启动脚本自动创建和激活虚拟环境
This commit is contained in:
2026-04-04 18:28:31 +08:00
parent 9ab279e1fe
commit 96f6318101
32058 changed files with 3949495 additions and 22 deletions

View File

@@ -0,0 +1,22 @@
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,46 @@
# [postcss][postcss]-normalize-unicode
> Normalize unicode with PostCSS.
## Install
With [npm](https://npmjs.org/package/postcss-normalize-unicode) do:
```
npm install postcss-normalize-unicode --save
```
## Example
### Input
```css
@font-face{
font-family: test;
unicode-range: u+2b00-2bff
}
```
### Output
```css
@font-face{
font-family: test;
unicode-range: u+2b??
}
```
## Usage
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
examples for your environment.
## Contributors
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
## License
MIT © [Ben Briggs](http://beneb.info)
[postcss]: https://github.com/postcss/postcss

View File

@@ -0,0 +1,41 @@
{
"name": "postcss-normalize-unicode",
"version": "5.1.1",
"description": "Normalize unicode-range descriptors, and can convert to wildcard ranges.",
"main": "src/index.js",
"types": "types/index.d.ts",
"files": [
"src",
"LICENSE-MIT",
"types"
],
"keywords": [
"css",
"postcss",
"postcss-plugin"
],
"license": "MIT",
"homepage": "https://github.com/cssnano/cssnano",
"author": {
"name": "Ben Briggs",
"email": "beneb.info@gmail.com",
"url": "http://beneb.info"
},
"repository": "cssnano/cssnano",
"dependencies": {
"browserslist": "^4.21.4",
"postcss-value-parser": "^4.2.0"
},
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
},
"devDependencies": {
"postcss": "^8.2.15"
},
"peerDependencies": {
"postcss": "^8.2.15"
}
}

View File

@@ -0,0 +1,132 @@
'use strict';
const browserslist = require('browserslist');
const valueParser = require('postcss-value-parser');
const regexLowerCaseUPrefix = /^u(?=\+)/;
/**
* @param {string} range
* @return {string}
*/
function unicode(range) {
const values = range.slice(2).split('-');
if (values.length < 2) {
return range;
}
const left = values[0].split('');
const right = values[1].split('');
if (left.length !== right.length) {
return range;
}
const merged = mergeRangeBounds(left, right);
if (merged) {
return merged;
}
return range;
}
/**
* @param {string[]} left
* @param {string[]} right
* @return {false|string}
*/
function mergeRangeBounds(left, right) {
let questionCounter = 0;
let group = 'u+';
for (const [index, value] of left.entries()) {
if (value === right[index] && questionCounter === 0) {
group = group + value;
} else if (value === '0' && right[index] === 'f') {
questionCounter++;
group = group + '?';
} else {
return false;
}
}
// The maximum number of wildcard characters (?) for ranges is 5.
if (questionCounter < 6) {
return group;
} else {
return false;
}
}
/**
* IE and Edge before 16 version ignore the unicode-range if the 'U' is lowercase
*
* https://caniuse.com/#search=unicode-range
*
* @param {string} browser
* @return {boolean}
*/
function hasLowerCaseUPrefixBug(browser) {
return browserslist('ie <=11, edge <= 15').includes(browser);
}
/**
* @param {string} value
* @return {string}
*/
function transform(value, isLegacy = false) {
return valueParser(value)
.walk((child) => {
if (child.type === 'unicode-range') {
const transformed = unicode(child.value.toLowerCase());
child.value = isLegacy
? transformed.replace(regexLowerCaseUPrefix, 'U')
: transformed;
}
return false;
})
.toString();
}
/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
function pluginCreator() {
return {
postcssPlugin: 'postcss-normalize-unicode',
/** @param {import('postcss').Result & {opts: browserslist.Options}} result*/
prepare(result) {
const cache = new Map();
const resultOpts = result.opts || {};
const browsers = browserslist(null, {
stats: resultOpts.stats,
path: __dirname,
env: resultOpts.env,
});
const isLegacy = browsers.some(hasLowerCaseUPrefixBug);
return {
OnceExit(css) {
css.walkDecls(/^unicode-range$/i, (decl) => {
const value = decl.value;
if (cache.has(value)) {
decl.value = cache.get(value);
return;
}
const newValue = transform(value, isLegacy);
decl.value = newValue;
cache.set(value, newValue);
});
},
};
},
};
}
pluginCreator.postcss = true;
module.exports = pluginCreator;

View File

@@ -0,0 +1,9 @@
export = pluginCreator;
/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
declare function pluginCreator(): import('postcss').Plugin;
declare namespace pluginCreator {
const postcss: true;
}