datafolder 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +1 -1
- package/sample.js +9 -0
- package/scripts/fastify.js +1 -0
- package/scripts/flights2.js +3 -3
- package/scripts/hnsw.js +39 -0
- package/src/QyAcl.js +56 -57
- package/src/QyBatch.d.ts +4 -2
- package/src/QyBatch.js +227 -156
- package/src/QyBinWriter.d.ts +5 -9
- package/src/QyBinWriter.js +36 -45
- package/src/QyCD.d.ts +1 -1
- package/src/QyCD.js +66 -64
- package/src/QyCache.d.ts +11 -9
- package/src/QyCache.js +125 -121
- package/src/QyDB.js +1 -4
- package/src/QyDefaultOptions.js +8 -0
- package/src/QyDir.d.ts +3 -3
- package/src/QyDir.js +33 -39
- package/src/QyEmbeddingWriter.d.ts +12 -0
- package/src/QyEmbeddingWriter.js +55 -0
- package/src/QyEmbeddings.d.ts +15 -0
- package/src/QyEmbeddings.js +128 -0
- package/src/QyFileContentUtils.js +123 -111
- package/src/QyHNSW.d.ts +5 -8
- package/src/QyHNSW.js +36 -44
- package/src/QyIndex.d.ts +1 -1
- package/src/QyIndex.js +79 -78
- package/src/QyIntersectNode.js +3 -3
- package/src/QySnapshots.js +177 -184
- package/src/QyUnionNode.d.ts +3 -3
- package/src/QyUnionNode.js +36 -36
- package/src/QyUtils.d.ts +5 -3
- package/src/QyUtils.js +130 -114
- package/static/codemirror.bundle/editor.bundle.js +16 -9
package/src/QyUnionNode.js
CHANGED
|
@@ -16,9 +16,9 @@ class i {
|
|
|
16
16
|
encounterOne(i) {
|
|
17
17
|
var {
|
|
18
18
|
encounteredMap: e,
|
|
19
|
-
isFull:
|
|
19
|
+
isFull: t
|
|
20
20
|
} = this;
|
|
21
|
-
if (!(
|
|
21
|
+
if (!(t || i in e)) return e[i] = 1, this.countOne();
|
|
22
22
|
}
|
|
23
23
|
countOne() {
|
|
24
24
|
if (this.count++ >= this.cursor) return ++this.added, !0;
|
|
@@ -29,67 +29,67 @@ class e {
|
|
|
29
29
|
fileCount = 0;
|
|
30
30
|
nodeList = [];
|
|
31
31
|
constructor() {}
|
|
32
|
-
encounterOne(i, e,
|
|
33
|
-
if (!
|
|
32
|
+
encounterOne(i, e, t) {
|
|
33
|
+
if (!t || t.encounterOne(e)) return i[e] = 1, !0;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
class o extends e {
|
|
38
|
-
|
|
38
|
+
fileMap = {};
|
|
39
39
|
checkedDirMap = {};
|
|
40
40
|
constructor(i = void 0) {
|
|
41
|
-
super(), i && this.
|
|
41
|
+
super(), i && this.addItem(i);
|
|
42
42
|
}
|
|
43
|
-
containsFile(
|
|
43
|
+
containsFile(i) {
|
|
44
44
|
var {
|
|
45
|
-
fileCount:
|
|
46
|
-
|
|
47
|
-
nodeList:
|
|
45
|
+
fileCount: e,
|
|
46
|
+
fileMap: t,
|
|
47
|
+
nodeList: n
|
|
48
48
|
} = this;
|
|
49
|
-
if (0 <
|
|
50
|
-
for (var
|
|
51
|
-
|
|
49
|
+
if (0 < e) {
|
|
50
|
+
for (var r in t) {
|
|
51
|
+
r = t[r].fileContent;
|
|
52
|
+
if (r && Object.hasOwn(r, i)) return !0;
|
|
53
|
+
}
|
|
54
|
+
for (var s of n) if (s.containsFile(i)) return !0;
|
|
52
55
|
}
|
|
53
56
|
return !1;
|
|
54
57
|
}
|
|
55
58
|
*getFiles(i = void 0, e = {}) {
|
|
56
|
-
var
|
|
57
|
-
|
|
59
|
+
var t, n, {
|
|
60
|
+
fileMap: r,
|
|
58
61
|
nodeList: s
|
|
59
62
|
} = this;
|
|
60
|
-
for (r in
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
i?.isFull)) return;
|
|
64
|
-
}
|
|
65
|
-
for (t of s) if (yield* t.getFiles(i, e), i?.isFull) return;
|
|
63
|
+
for (t in r) for (var o in r[t].fileContent) if (!(o in e) && this.encounterOne(e, o, i) && (yield o,
|
|
64
|
+
i?.isFull)) return;
|
|
65
|
+
for (n of s) if (yield* n.getFiles(i, e), i?.isFull) return;
|
|
66
66
|
}
|
|
67
67
|
addNode(i) {
|
|
68
68
|
if (i) {
|
|
69
69
|
var {
|
|
70
|
-
|
|
71
|
-
checkedDirMap:
|
|
72
|
-
nodeList:
|
|
70
|
+
fileMap: e,
|
|
71
|
+
checkedDirMap: t,
|
|
72
|
+
nodeList: n
|
|
73
73
|
} = this;
|
|
74
74
|
if (i instanceof o) {
|
|
75
|
-
for (var
|
|
76
|
-
for (var s in
|
|
77
|
-
} else
|
|
75
|
+
for (var r in i.fileMap) e[r] = i.fileMap[r];
|
|
76
|
+
for (var s in n.push(...i.nodeList), i.checkedDirMap) t[s] = 1;
|
|
77
|
+
} else n.push(i);
|
|
78
78
|
this.fileCount += i.fileCount;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
addItem(i) {
|
|
82
82
|
var {
|
|
83
|
-
|
|
84
|
-
checkedDirMap:
|
|
83
|
+
fileMap: e,
|
|
84
|
+
checkedDirMap: t
|
|
85
85
|
} = this, {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
fullPathHash: s
|
|
86
|
+
isFile: n,
|
|
87
|
+
fullPathHash: r
|
|
89
88
|
} = i;
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
if (n) e[r] = i, ++this.fileCount; else if (!(r in t)) {
|
|
90
|
+
for (var s of i.subdirList) this.addItem(s);
|
|
91
|
+
for (var o of i.fileList) this.addItem(o);
|
|
92
|
+
t[r] = 1;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
package/src/QyUtils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import util from "node:util";
|
|
2
2
|
export declare const isArray: (arg: any) => arg is any[];
|
|
3
|
-
export declare const isDate: typeof util.types.isDate, isFloat32Array: typeof util.types.isFloat32Array;
|
|
3
|
+
export declare const isDate: typeof util.types.isDate, isFloat32Array: typeof util.types.isFloat32Array, isUint8Array: typeof util.types.isUint8Array;
|
|
4
4
|
export declare const __dirname: string;
|
|
5
5
|
export declare const SpecialOperators: {
|
|
6
6
|
[k: string]: string;
|
|
@@ -11,8 +11,9 @@ export declare const SpecialFilePaths: {
|
|
|
11
11
|
RpcDirPath: string[];
|
|
12
12
|
IndexDirPath: string[];
|
|
13
13
|
ExpireDirPath: string[];
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
HNSWDirPath: string[];
|
|
15
|
+
InfoDirPath: string[];
|
|
16
|
+
RecycleDirPath: string[];
|
|
16
17
|
MetaFilePath: string[];
|
|
17
18
|
IndexPropPathsFileName: string;
|
|
18
19
|
};
|
|
@@ -58,4 +59,5 @@ export declare function loadFileList(fileList: any, preloadCount?: number): Asyn
|
|
|
58
59
|
}, void, unknown>;
|
|
59
60
|
export declare function getNowTime(now?: Date): number;
|
|
60
61
|
export declare function getNowRounded(now?: Date): number;
|
|
62
|
+
export declare function readBufferFromFD(fd: any, filePath: any, start: any, length: any): Buffer<ArrayBuffer> | undefined;
|
|
61
63
|
export * as default from "./QyUtils.ts";
|
package/src/QyUtils.js
CHANGED
|
@@ -6,7 +6,9 @@ import e from "node:process";
|
|
|
6
6
|
|
|
7
7
|
import l from "node:fs/promises";
|
|
8
8
|
|
|
9
|
-
import i
|
|
9
|
+
import i, {
|
|
10
|
+
readSync as u
|
|
11
|
+
} from "node:fs";
|
|
10
12
|
|
|
11
13
|
import o from "node:timers/promises";
|
|
12
14
|
|
|
@@ -17,122 +19,124 @@ import {
|
|
|
17
19
|
import a from "node:util";
|
|
18
20
|
|
|
19
21
|
import {
|
|
20
|
-
logger as
|
|
22
|
+
logger as f
|
|
21
23
|
} from "../src/QyLogger.js";
|
|
22
24
|
|
|
23
|
-
let
|
|
25
|
+
let c = Array.isArray, {
|
|
24
26
|
isDate: s,
|
|
25
|
-
isFloat32Array:
|
|
27
|
+
isFloat32Array: d,
|
|
28
|
+
isUint8Array: m
|
|
26
29
|
} = a.types;
|
|
27
30
|
|
|
28
|
-
var
|
|
29
|
-
HiddenFolderName:
|
|
30
|
-
TriggerDirPath: [
|
|
31
|
-
RpcDirPath: [
|
|
32
|
-
IndexDirPath: [
|
|
33
|
-
ExpireDirPath: [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
var p = t.dirname(r(import.meta.url)), h = Object.fromEntries([ "$del", "$link", "$rpl", "$spec", "$raw", "$all", "$clone", "$ext", "$pop", "$or", "$and", "$gt", "$lt", "$gte", "$lte", "$u8" ].map(r => [ r, r ])), y = "%", y = {
|
|
32
|
+
HiddenFolderName: y,
|
|
33
|
+
TriggerDirPath: [ y, "trigger" ],
|
|
34
|
+
RpcDirPath: [ y, "rpc" ],
|
|
35
|
+
IndexDirPath: [ y, "index" ],
|
|
36
|
+
ExpireDirPath: [ y, "expire" ],
|
|
37
|
+
HNSWDirPath: [ y, "hnsw" ],
|
|
38
|
+
InfoDirPath: [ y, "info" ],
|
|
39
|
+
RecycleDirPath: [ y, "recycle" ],
|
|
40
|
+
MetaFilePath: [ y, "meta" ],
|
|
37
41
|
IndexPropPathsFileName: "propPaths"
|
|
38
42
|
};
|
|
39
43
|
|
|
40
|
-
function
|
|
44
|
+
function g(r) {
|
|
41
45
|
return r.startsWith("{") && r.endsWith("}");
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
function
|
|
45
|
-
return
|
|
48
|
+
function v(r) {
|
|
49
|
+
return g(r) && r.substring(1, r.length - 1);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
function
|
|
52
|
+
function b(r) {
|
|
49
53
|
return 1e12 < r ? Math.round(100 * r / 1e12) / 100 + "TB" : 1e9 < r ? Math.round(100 * r / 1e9) / 100 + "GB" : 1e6 < r ? Math.round(100 * r / 1e6) / 100 + "MB" : 1e3 < r ? Math.round(100 * r / 1e3) / 100 + "KB" : r.toString();
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
function
|
|
56
|
+
function $(r, t = 10) {
|
|
53
57
|
return n.createHash("sha256").update(r, "utf8").digest("base64url").slice(0, t);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
var
|
|
60
|
+
var w = 11;
|
|
57
61
|
|
|
58
|
-
function
|
|
62
|
+
function P(r) {
|
|
59
63
|
return "d" + r;
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
function
|
|
66
|
+
function S(r) {
|
|
63
67
|
return "f" + r;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
function
|
|
70
|
+
function x(r) {
|
|
67
71
|
return "c" + r;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
function
|
|
74
|
+
function D(r = 8) {
|
|
71
75
|
return n.randomBytes(r).toString("hex");
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
function
|
|
78
|
+
function j(r) {
|
|
75
79
|
if (null != r) for (var t in r) if (null != r[t]) return !1;
|
|
76
80
|
return !0;
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
function
|
|
83
|
+
function B(r) {
|
|
80
84
|
return null != r && "object" == typeof r && !s(r);
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
function
|
|
87
|
+
function M(r) {
|
|
84
88
|
return "string" == typeof r;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
function
|
|
91
|
+
function T(r) {
|
|
88
92
|
return "number" == typeof r;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
function
|
|
95
|
+
function N(r) {
|
|
92
96
|
return "boolean" == typeof r;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
function
|
|
99
|
+
function W(r) {
|
|
96
100
|
return "function" == typeof r;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
function
|
|
103
|
+
function E(r) {
|
|
100
104
|
var t = typeof r;
|
|
101
|
-
return "string" == t || "number" == t || "boolean" == t ||
|
|
105
|
+
return "string" == t || "number" == t || "boolean" == t || m(r) || s(r);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
function
|
|
108
|
+
function R(r) {
|
|
105
109
|
let t = r.length;
|
|
106
110
|
for (;null == r[t - 1] && 0 < t; ) --t;
|
|
107
111
|
return r.length = t, r;
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
function
|
|
114
|
+
function H(n) {
|
|
111
115
|
return n.promise || (n.promise = new Promise((r, t) => Object.assign(n, {
|
|
112
116
|
resolve: r,
|
|
113
117
|
reject: t
|
|
114
118
|
}))), n;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
function
|
|
121
|
+
function L(r) {
|
|
118
122
|
return Buffer.isBuffer(r) ? r : Buffer.from(r);
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
function
|
|
125
|
+
function G(r) {
|
|
122
126
|
return 1 < r ? "s" : "";
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
function
|
|
129
|
+
function F(r) {
|
|
126
130
|
return l.mkdir(r, {
|
|
127
131
|
recursive: !0
|
|
128
132
|
});
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
function
|
|
132
|
-
return
|
|
135
|
+
function I(r) {
|
|
136
|
+
return F(t.dirname(r));
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
async function
|
|
139
|
+
async function O(r) {
|
|
136
140
|
try {
|
|
137
141
|
return (await l.stat(r)).size;
|
|
138
142
|
} catch (r) {
|
|
@@ -140,111 +144,111 @@ async function k(r) {
|
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
async function
|
|
144
|
-
return !1 !== await
|
|
147
|
+
async function J(r) {
|
|
148
|
+
return !1 !== await O(r);
|
|
145
149
|
}
|
|
146
150
|
|
|
147
|
-
function
|
|
151
|
+
function Q(r, t = void 0) {
|
|
148
152
|
r *= 1e3;
|
|
149
153
|
return t ? o.setTimeout(r, !0, {
|
|
150
154
|
signal: t
|
|
151
155
|
}) : o.setTimeout(r);
|
|
152
156
|
}
|
|
153
157
|
|
|
154
|
-
let
|
|
158
|
+
let U;
|
|
155
159
|
|
|
156
|
-
async function
|
|
160
|
+
async function z(t) {
|
|
157
161
|
try {
|
|
158
|
-
await
|
|
162
|
+
await I(t);
|
|
159
163
|
var r = new Date().toISOString() + ": " + e.argv.join(" ");
|
|
160
164
|
function n() {
|
|
161
|
-
for (var r of Object.keys(
|
|
165
|
+
for (var r of Object.keys(U)) k(r);
|
|
162
166
|
}
|
|
163
167
|
await l.writeFile(t, r, {
|
|
164
168
|
flag: "wx",
|
|
165
169
|
flush: !0
|
|
166
|
-
}),
|
|
170
|
+
}), f.info("Locked " + t), U ? U[t] = 1 : (U = {
|
|
167
171
|
[t]: 1
|
|
168
172
|
}, e.on("exit", n), e.on("SIGINT", n));
|
|
169
173
|
} catch (r) {
|
|
170
|
-
throw "EEXIST" == r.code &&
|
|
174
|
+
throw "EEXIST" == r.code && f.error(`Already started by ${(await l.readFile(t)).toString()}:`, r),
|
|
171
175
|
r;
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
|
|
175
|
-
function
|
|
179
|
+
function k(r) {
|
|
176
180
|
try {
|
|
177
|
-
i.unlinkSync(r),
|
|
181
|
+
i.unlinkSync(r), f.info("Unlocked " + r);
|
|
178
182
|
} catch (r) {}
|
|
179
183
|
}
|
|
180
184
|
|
|
181
|
-
function
|
|
185
|
+
function K(r) {
|
|
182
186
|
return r.startsWith("[") && r.endsWith("]") ? JSON.parse(r) : r;
|
|
183
187
|
}
|
|
184
188
|
|
|
185
|
-
function
|
|
186
|
-
return
|
|
189
|
+
function X(r) {
|
|
190
|
+
return c(r) ? 1 == r.length ? r[0] : JSON.stringify(r) : r;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
|
-
function
|
|
193
|
+
function q(r) {
|
|
190
194
|
r = r.split("/");
|
|
191
195
|
return r[0] || (r[0] = "/"), r;
|
|
192
196
|
}
|
|
193
197
|
|
|
194
|
-
function
|
|
198
|
+
function A(r) {
|
|
195
199
|
return r.split(".");
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
function
|
|
199
|
-
return
|
|
202
|
+
function C(r) {
|
|
203
|
+
return M(r) ? [ A(r) ] : c(r) ? r.map(r => M(r) ? A(r) : r) : void 0;
|
|
200
204
|
}
|
|
201
205
|
|
|
202
|
-
function
|
|
206
|
+
function V(r) {
|
|
203
207
|
return r.join(".");
|
|
204
208
|
}
|
|
205
209
|
|
|
206
|
-
function
|
|
210
|
+
function Y(r, t = 0) {
|
|
207
211
|
return Math.floor(Math.random() * (r - t)) + t;
|
|
208
212
|
}
|
|
209
213
|
|
|
210
|
-
function
|
|
214
|
+
function Z(r) {
|
|
211
215
|
var t, n = {};
|
|
212
216
|
for (t of r) n[t] = 1;
|
|
213
217
|
return n;
|
|
214
218
|
}
|
|
215
219
|
|
|
216
|
-
async function
|
|
220
|
+
async function _(t, n, e, i) {
|
|
217
221
|
var o = Buffer.allocUnsafe(i);
|
|
218
222
|
for (let r = 0; r < i; ) {
|
|
219
223
|
var a = (await n.read(o, r, i - r, e + r)).bytesRead;
|
|
220
|
-
if (0 == a) return void
|
|
224
|
+
if (0 == a) return void f.error(`read ${t} at ${e + r} returning 0 byte`);
|
|
221
225
|
r += a;
|
|
222
226
|
}
|
|
223
227
|
return o;
|
|
224
228
|
}
|
|
225
229
|
|
|
226
|
-
function
|
|
230
|
+
function rr() {
|
|
227
231
|
var r = e.availableMemory();
|
|
228
232
|
return Math.round(r / (e.memoryUsage.rss() + r) * 100);
|
|
229
233
|
}
|
|
230
234
|
|
|
231
|
-
async function*
|
|
235
|
+
async function* tr(e, t = 3) {
|
|
232
236
|
var n = e.length, i = (n < t && (t = n), new Array(n));
|
|
233
237
|
for (let r = 0; r < t; ++r) {
|
|
234
238
|
var o = i[r] = {};
|
|
235
|
-
|
|
239
|
+
s(r, o);
|
|
236
240
|
}
|
|
237
241
|
for (let r = 0; r < n; ++r) {
|
|
238
242
|
var a = i[r % t], {
|
|
239
243
|
filePath: u,
|
|
240
244
|
bin: f
|
|
241
|
-
} = (a.bin || await a.promise, a),
|
|
242
|
-
|
|
245
|
+
} = (a.bin || await a.promise, a), c = r + t;
|
|
246
|
+
c < n && s(c, a), yield {
|
|
243
247
|
filePath: u,
|
|
244
248
|
bin: f
|
|
245
249
|
};
|
|
246
250
|
}
|
|
247
|
-
async function
|
|
251
|
+
async function s(r, t) {
|
|
248
252
|
var r = e[r], n = l.readFile(r);
|
|
249
253
|
Object.assign(t, {
|
|
250
254
|
filePath: r,
|
|
@@ -254,61 +258,73 @@ async function* _(e, t = 3) {
|
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
260
|
|
|
257
|
-
function
|
|
261
|
+
function nr(r = new Date()) {
|
|
258
262
|
return r.getTime();
|
|
259
263
|
}
|
|
260
264
|
|
|
261
|
-
function
|
|
265
|
+
function er(r = new Date()) {
|
|
262
266
|
r = r.getTime();
|
|
263
267
|
return r - r % 1e3;
|
|
264
268
|
}
|
|
265
269
|
|
|
270
|
+
function ir(t, n, e, i) {
|
|
271
|
+
var o = Buffer.allocUnsafe(i);
|
|
272
|
+
for (let r = 0; r < i; ) {
|
|
273
|
+
var a = u(t, o, r, i - r, e + r);
|
|
274
|
+
if (0 == a) return void f.error(`readSync ${n} at ${e + r} returning 0 byte`);
|
|
275
|
+
r += a;
|
|
276
|
+
}
|
|
277
|
+
return o;
|
|
278
|
+
}
|
|
279
|
+
|
|
266
280
|
export * as default from "./QyUtils.js";
|
|
267
281
|
|
|
268
282
|
export {
|
|
269
|
-
|
|
283
|
+
c as isArray,
|
|
270
284
|
s as isDate,
|
|
271
|
-
|
|
272
|
-
m as
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
g as
|
|
277
|
-
|
|
278
|
-
b as
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
x as
|
|
284
|
-
|
|
285
|
-
j as
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
H as
|
|
294
|
-
L as
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
285
|
+
d as isFloat32Array,
|
|
286
|
+
m as isUint8Array,
|
|
287
|
+
p as __dirname,
|
|
288
|
+
h as SpecialOperators,
|
|
289
|
+
y as SpecialFilePaths,
|
|
290
|
+
g as isMatchName,
|
|
291
|
+
v as getMatchParam,
|
|
292
|
+
b as getSizeStr,
|
|
293
|
+
$ as calHash,
|
|
294
|
+
w as Hash_Key_Length,
|
|
295
|
+
P as getSubdirMapKey,
|
|
296
|
+
S as getFileMapKey,
|
|
297
|
+
x as getContentKey,
|
|
298
|
+
D as getRandomStr,
|
|
299
|
+
j as isEmptyObj,
|
|
300
|
+
B as isNotNullObj,
|
|
301
|
+
M as isString,
|
|
302
|
+
T as isNumber,
|
|
303
|
+
N as isBoolean,
|
|
304
|
+
W as isFunction,
|
|
305
|
+
E as isSimpleType,
|
|
306
|
+
R as trimArrayTail,
|
|
307
|
+
H as setPromise,
|
|
308
|
+
L as toBuffer,
|
|
309
|
+
G as getSuffix,
|
|
310
|
+
F as ensureDir,
|
|
311
|
+
I as ensureParentDir,
|
|
312
|
+
O as getSize,
|
|
313
|
+
J as folderOrFileExists,
|
|
314
|
+
Q as sleep,
|
|
315
|
+
z as lockExclusiveFilePath,
|
|
316
|
+
k as unlockExclusiveFilePath,
|
|
317
|
+
K as fromSingleName,
|
|
318
|
+
X as toSingleName,
|
|
319
|
+
q as pathSplit,
|
|
320
|
+
C as ensurePropNamePathList,
|
|
321
|
+
V as propNameJoin,
|
|
322
|
+
Y as randomInt,
|
|
323
|
+
Z as listToMap,
|
|
324
|
+
_ as readBufferAsync,
|
|
325
|
+
rr as memoryPercent,
|
|
326
|
+
tr as loadFileList,
|
|
327
|
+
nr as getNowTime,
|
|
328
|
+
er as getNowRounded,
|
|
329
|
+
ir as readBufferFromFD
|
|
314
330
|
};
|
|
@@ -6916,6 +6916,7 @@
|
|
|
6916
6916
|
if (composition && next.fromA <= composition.range.fromA && next.toA >= composition.range.toA) {
|
|
6917
6917
|
this.forward(next.fromA, composition.range.fromA, composition.range.fromA < composition.range.toA ? 1 : -1);
|
|
6918
6918
|
this.emit(posB, composition.range.fromB);
|
|
6919
|
+
this.builder.flushBuffer();
|
|
6919
6920
|
this.cache.clear(); // Must not reuse DOM across composition
|
|
6920
6921
|
this.builder.addComposition(composition, compositionContext);
|
|
6921
6922
|
this.text.skip(composition.range.toB - composition.range.fromB);
|
|
@@ -8129,12 +8130,11 @@
|
|
|
8129
8130
|
}
|
|
8130
8131
|
// Scan through the rectangles for the content of a tile with inline
|
|
8131
8132
|
// content, looking for one that overlaps the queried position
|
|
8132
|
-
// vertically
|
|
8133
|
-
//
|
|
8134
|
-
//
|
|
8135
|
-
//
|
|
8136
|
-
// these will be
|
|
8137
|
-
// will be child tiles.
|
|
8133
|
+
// vertically and is closest horizontally. The caller is responsible
|
|
8134
|
+
// for dividing its content into N pieces, and pass an array with
|
|
8135
|
+
// N+1 positions (including the position after the last piece). For
|
|
8136
|
+
// a text tile, these will be character clusters, for a composite
|
|
8137
|
+
// tile, these will be child tiles.
|
|
8138
8138
|
scan(positions, getRects, recursed = false) {
|
|
8139
8139
|
let lo = 0, hi = positions.length - 1, seen = new Set();
|
|
8140
8140
|
let bidi = this.bidiIn(positions[0], positions[hi]);
|
|
@@ -8206,6 +8206,8 @@
|
|
|
8206
8206
|
// If no element with y overlap is found, find the nearest element
|
|
8207
8207
|
// on the y axis, move this.y into it, and retry the scan.
|
|
8208
8208
|
if (!closestRect) {
|
|
8209
|
+
if (!below && !above)
|
|
8210
|
+
return { i: positions[0], after: false };
|
|
8209
8211
|
let side = above && (!below || (this.y - above.bottom < below.top - this.y)) ? above : below;
|
|
8210
8212
|
this.y = (side.top + side.bottom) / 2;
|
|
8211
8213
|
return this.scan(positions, getRects, true);
|
|
@@ -11098,6 +11100,7 @@
|
|
|
11098
11100
|
padding: "0 2px 0 6px"
|
|
11099
11101
|
},
|
|
11100
11102
|
".cm-layer": {
|
|
11103
|
+
userSelect: "none", // #1708
|
|
11101
11104
|
position: "absolute",
|
|
11102
11105
|
left: 0,
|
|
11103
11106
|
top: 0,
|
|
@@ -24116,7 +24119,7 @@
|
|
|
24116
24119
|
let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
|
|
24117
24120
|
if (!result)
|
|
24118
24121
|
return new ActiveSource(this.source, 0 /* State.Inactive */);
|
|
24119
|
-
return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit),
|
|
24122
|
+
return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
|
|
24120
24123
|
}
|
|
24121
24124
|
touches(tr) {
|
|
24122
24125
|
return tr.changes.touchesRange(this.from, this.to);
|
|
@@ -24568,6 +24571,9 @@
|
|
|
24568
24571
|
for (let line of template.split(/\r\n?|\n/)) {
|
|
24569
24572
|
while (m = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(line)) {
|
|
24570
24573
|
let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
|
|
24574
|
+
// `${0}` is the cursor's final position, after every other tab stop.
|
|
24575
|
+
if (seq === 0)
|
|
24576
|
+
seq = 1e9;
|
|
24571
24577
|
let name = rawName.replace(/\\[{}]/g, m => m[1]);
|
|
24572
24578
|
for (let i = 0; i < fields.length; i++) {
|
|
24573
24579
|
if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false)
|
|
@@ -24682,7 +24688,8 @@
|
|
|
24682
24688
|
|
|
24683
24689
|
The order of fields defaults to textual order, but you can add
|
|
24684
24690
|
numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
|
|
24685
|
-
a custom order.
|
|
24691
|
+
a custom order. `${0}` is special—it is always the last stop, where
|
|
24692
|
+
the cursor ends up after tabbing through the other fields.
|
|
24686
24693
|
|
|
24687
24694
|
To include a literal `{` or `}` in your template, put a backslash
|
|
24688
24695
|
in front of it. This will be removed and the brace will not be
|
|
@@ -25248,7 +25255,7 @@
|
|
|
25248
25255
|
return {
|
|
25249
25256
|
pos: start,
|
|
25250
25257
|
end: end,
|
|
25251
|
-
above:
|
|
25258
|
+
above: true,
|
|
25252
25259
|
create() {
|
|
25253
25260
|
return { dom: diagnosticsTooltip(view, found) };
|
|
25254
25261
|
}
|