perf(输入法): 降低查词与候选内存开销并放大等尺寸26键
这个提交包含在:
1 父节点
100757f684
当前提交
7cd1ab906c
33 个文件已更改
+513
-126
没有与搜索条件相匹配的文件
@@ -14,7 +14,7 @@ function dictionaryReady(source){
|
||||
if(fs.existsSync(path.join(source,'src/assets/.ime-dict.generating')))throw Error('Dictionary generation is running; retry after it completes')
|
||||
const converter=path.join(source,'scripts/convert-dictionary.py'),metaFile=path.join(source,'src/assets/ime-dict/meta.json')
|
||||
if(!fs.existsSync(converter))return fs.existsSync(metaFile)
|
||||
if(!fs.existsSync(metaFile))return false
|
||||
if(!fs.existsSync(metaFile)||!fs.existsSync(path.join(source,'src/assets/ime-dict/runtime.json')))return false
|
||||
const meta=readJson(metaFile)
|
||||
const seeds=path.join(source,'src/common/association-seeds.json')
|
||||
if(fs.existsSync(seeds)&&meta.association_seed_sha256!==digest(fs.readFileSync(seeds)))return false
|
||||
@@ -54,6 +54,8 @@ export function snapshot(source=APP,includeRoute=true){
|
||||
for(const file of fs.readdirSync(path.join(source,'src/common')).filter(name=>/^ime-[a-z0-9-]+\.js$/.test(name)))add('src/common/'+file,path.join(source,'src/common',file))
|
||||
const meta=readJson(path.join(source,'src/assets/ime-dict/meta.json'))
|
||||
if(!Array.isArray(meta.shards)||!meta.shards.length||new Set(meta.shards).size!==meta.shards.length)throw Error('Dictionary is not generated or has invalid metadata')
|
||||
const runtime=path.join(source,'src/assets/ime-dict/runtime.json')
|
||||
if(fs.existsSync(runtime))add('src/assets/ime-dict/runtime.json',runtime)
|
||||
for(const name of ['meta',...meta.shards,...(meta.association_shards||[]),...(meta.completion_shards||[])]){
|
||||
if(name!=='meta'&&!/^(short|s?[0-9]+|ds?[0-9a-d]+|[ac][0-9a-f]{2})$/.test(name))throw Error('Invalid generated shard name')
|
||||
add('src/assets/ime-dict/'+name+'.json',path.join(source,'src/assets/ime-dict',name+'.json'))
|
||||
|
||||
在新工单中引用
屏蔽一个用户