clickgo 3.0.6-dev7 → 3.1.0-dev9
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 +1 -1
- package/dist/app/demo/app.js +93 -0
- package/dist/app/demo/form/control/form/form.js +21 -20
- package/dist/app/demo/form/control/form/form.xml +3 -3
- package/dist/app/demo/form/main.js +20 -10
- package/dist/app/demo/form/main.xml +1 -1
- package/dist/app/task/app.js +46 -0
- package/dist/app/task/form/bar/bar.js +85 -86
- package/dist/app/task/form/bar/bar.xml +5 -6
- package/dist/clickgo.js +1 -10
- package/dist/clickgo.ts +0 -8
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +105 -56
- package/dist/index.ts +164 -59
- package/dist/lib/control.js +363 -240
- package/dist/lib/control.ts +497 -284
- package/dist/lib/core.js +331 -217
- package/dist/lib/core.ts +418 -244
- package/dist/lib/dom.js +6 -3
- package/dist/lib/dom.ts +7 -6
- package/dist/lib/form.js +635 -980
- package/dist/lib/form.ts +817 -1072
- package/dist/lib/fs.js +42 -39
- package/dist/lib/fs.ts +45 -41
- package/dist/lib/native.js +8 -148
- package/dist/lib/native.ts +9 -211
- package/dist/lib/task.js +707 -191
- package/dist/lib/task.ts +778 -210
- package/dist/lib/theme.ts +2 -2
- package/dist/lib/tool.js +58 -48
- package/dist/lib/tool.ts +79 -64
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +5 -7
- package/types/index.d.ts +286 -324
- package/dist/app/demo/config.json +0 -106
- package/dist/app/task/config.json +0 -32
package/dist/lib/fs.js
CHANGED
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.copyFile = exports.copyFolder = exports.readDir = exports.rename = exports.chmod = exports.rmdirDeep = exports.rmdir = exports.mkdir = exports.isFile = exports.isDir = exports.stats = exports.unlink = exports.symlink = exports.readLink = exports.putContent = exports.getContent = void 0;
|
|
13
13
|
const tool = require("./tool");
|
|
14
|
-
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/
|
|
14
|
+
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/app.js', '/app/demo/form/', '/app/demo/form/control/', '/app/demo/form/control/block/', '/app/demo/form/control/block/block.css', '/app/demo/form/control/block/block.xml', '/app/demo/form/control/button/', '/app/demo/form/control/button/button.css', '/app/demo/form/control/button/button.js', '/app/demo/form/control/button/button.xml', '/app/demo/form/control/check/', '/app/demo/form/control/check/check.js', '/app/demo/form/control/check/check.xml', '/app/demo/form/control/dialog/', '/app/demo/form/control/dialog/dialog.js', '/app/demo/form/control/dialog/dialog.xml', '/app/demo/form/control/file/', '/app/demo/form/control/file/file.js', '/app/demo/form/control/file/file.xml', '/app/demo/form/control/form/', '/app/demo/form/control/form/form.css', '/app/demo/form/control/form/form.js', '/app/demo/form/control/form/form.xml', '/app/demo/form/control/greatview/', '/app/demo/form/control/greatview/greatview.css', '/app/demo/form/control/greatview/greatview.js', '/app/demo/form/control/greatview/greatview.xml', '/app/demo/form/control/img/', '/app/demo/form/control/img/img.xml', '/app/demo/form/control/label/', '/app/demo/form/control/label/label.xml', '/app/demo/form/control/list/', '/app/demo/form/control/list/list.css', '/app/demo/form/control/list/list.js', '/app/demo/form/control/list/list.xml', '/app/demo/form/control/loading/', '/app/demo/form/control/loading/loading.xml', '/app/demo/form/control/marquee/', '/app/demo/form/control/marquee/marquee.js', '/app/demo/form/control/marquee/marquee.xml', '/app/demo/form/control/menu/', '/app/demo/form/control/menu/menu.js', '/app/demo/form/control/menu/menu.xml', '/app/demo/form/control/monaco/', '/app/demo/form/control/monaco/monaco.js', '/app/demo/form/control/monaco/monaco.xml', '/app/demo/form/control/overflow/', '/app/demo/form/control/overflow/overflow.css', '/app/demo/form/control/overflow/overflow.js', '/app/demo/form/control/overflow/overflow.xml', '/app/demo/form/control/property/', '/app/demo/form/control/property/property.js', '/app/demo/form/control/property/property.xml', '/app/demo/form/control/radio/', '/app/demo/form/control/radio/radio.js', '/app/demo/form/control/radio/radio.xml', '/app/demo/form/control/scroll/', '/app/demo/form/control/scroll/scroll.js', '/app/demo/form/control/scroll/scroll.xml', '/app/demo/form/control/select/', '/app/demo/form/control/select/select.js', '/app/demo/form/control/select/select.xml', '/app/demo/form/control/tab/', '/app/demo/form/control/tab/tab.js', '/app/demo/form/control/tab/tab.xml', '/app/demo/form/control/text/', '/app/demo/form/control/text/text.js', '/app/demo/form/control/text/text.xml', '/app/demo/form/control/view/', '/app/demo/form/control/view/view.css', '/app/demo/form/control/view/view.js', '/app/demo/form/control/view/view.xml', '/app/demo/form/event/', '/app/demo/form/event/form/', '/app/demo/form/event/form/form.css', '/app/demo/form/event/form/form.js', '/app/demo/form/event/form/form.xml', '/app/demo/form/event/screen/', '/app/demo/form/event/screen/screen.js', '/app/demo/form/event/screen/screen.xml', '/app/demo/form/event/task/', '/app/demo/form/event/task/task.js', '/app/demo/form/event/task/task.xml', '/app/demo/form/main.css', '/app/demo/form/main.js', '/app/demo/form/main.xml', '/app/demo/form/method/', '/app/demo/form/method/core/', '/app/demo/form/method/core/core.js', '/app/demo/form/method/core/core.xml', '/app/demo/form/method/dom/', '/app/demo/form/method/dom/dom.css', '/app/demo/form/method/dom/dom.js', '/app/demo/form/method/dom/dom.xml', '/app/demo/form/method/form/', '/app/demo/form/method/form/form.css', '/app/demo/form/method/form/form.js', '/app/demo/form/method/form/form.xml', '/app/demo/form/method/form/test.xml', '/app/demo/form/method/fs/', '/app/demo/form/method/fs/fs.js', '/app/demo/form/method/fs/fs.xml', '/app/demo/form/method/fs/text.js', '/app/demo/form/method/fs/text.xml', '/app/demo/form/method/task/', '/app/demo/form/method/task/locale1.json', '/app/demo/form/method/task/locale2.json', '/app/demo/form/method/task/task.js', '/app/demo/form/method/task/task.xml', '/app/demo/form/method/theme/', '/app/demo/form/method/theme/theme.js', '/app/demo/form/method/theme/theme.xml', '/app/demo/form/method/tool/', '/app/demo/form/method/tool/tool.js', '/app/demo/form/method/tool/tool.xml', '/app/demo/form/method/zip/', '/app/demo/form/method/zip/zip.js', '/app/demo/form/method/zip/zip.xml', '/app/demo/global.css', '/app/demo/res/', '/app/demo/res/icon.svg', '/app/demo/res/img.jpg', '/app/demo/res/r-1.svg', '/app/demo/res/r-2.svg', '/app/demo/res/sql.svg', '/app/demo/res/txt.svg', '/app/demo/res/zip.svg', '/app/task/', '/app/task/app.js', '/app/task/form/', '/app/task/form/bar/', '/app/task/form/bar/bar.js', '/app/task/form/bar/bar.xml', '/app/task/form/desktop/', '/app/task/form/desktop/desktop.xml', '/app/task/locale/', '/app/task/locale/en.json', '/app/task/locale/ja.json', '/app/task/locale/sc.json', '/app/task/locale/tc.json', '/clickgo.js', '/clickgo.ts', '/control/', '/control/common.cgc', '/control/form.cgc', '/control/monaco.cgc', '/control/property.cgc', '/control/task.cgc', '/global.css', '/icon.png', '/index.js', '/index.ts', '/lib/', '/lib/control.js', '/lib/control.ts', '/lib/core.js', '/lib/core.ts', '/lib/dom.js', '/lib/dom.ts', '/lib/form.js', '/lib/form.ts', '/lib/fs.js', '/lib/fs.ts', '/lib/native.js', '/lib/native.ts', '/lib/task.js', '/lib/task.ts', '/lib/theme.js', '/lib/theme.ts', '/lib/tool.js', '/lib/tool.ts', '/lib/zip.js', '/lib/zip.ts', '/theme/', '/theme/familiar.cgt'];
|
|
15
15
|
function getContent(path, options) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
path = tool.urlResolve('/', path);
|
|
@@ -105,11 +105,11 @@ function getContent(path, options) {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
else if (path.startsWith('/current/')) {
|
|
108
|
-
if (!options.current
|
|
108
|
+
if (!options.current) {
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
111
|
-
options.current
|
|
112
|
-
return getContent(
|
|
111
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
112
|
+
return getContent(current + fpath, options);
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
115
|
return null;
|
|
@@ -134,11 +134,11 @@ function putContent(path, data, options = {}) {
|
|
|
134
134
|
return false;
|
|
135
135
|
}
|
|
136
136
|
else if (path.startsWith('/current/')) {
|
|
137
|
-
if (!options.current
|
|
137
|
+
if (!options.current) {
|
|
138
138
|
return false;
|
|
139
139
|
}
|
|
140
|
-
options.current
|
|
141
|
-
return putContent(
|
|
140
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
141
|
+
return putContent(current + fpath, data, options);
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
return false;
|
|
@@ -171,9 +171,12 @@ function readLink(path, options) {
|
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
173
173
|
else if (path.startsWith('/current/')) {
|
|
174
|
-
if (!options.current
|
|
174
|
+
if (!options.current) {
|
|
175
175
|
return null;
|
|
176
176
|
}
|
|
177
|
+
if (options.current.endsWith('/')) {
|
|
178
|
+
return options.current.slice(0, -1);
|
|
179
|
+
}
|
|
177
180
|
return options.current;
|
|
178
181
|
}
|
|
179
182
|
else {
|
|
@@ -199,14 +202,14 @@ function symlink(filePath, linkPath, options = {}) {
|
|
|
199
202
|
return false;
|
|
200
203
|
}
|
|
201
204
|
else if (filePath.startsWith('/current/')) {
|
|
202
|
-
if (!options.current
|
|
205
|
+
if (!options.current) {
|
|
203
206
|
return false;
|
|
204
207
|
}
|
|
205
|
-
options.current
|
|
208
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
206
209
|
if (linkPath.startsWith('/current/')) {
|
|
207
|
-
linkPath =
|
|
210
|
+
linkPath = current + linkPath.slice(8);
|
|
208
211
|
}
|
|
209
|
-
return symlink(
|
|
212
|
+
return symlink(current + filePath.slice(8), linkPath, options);
|
|
210
213
|
}
|
|
211
214
|
else {
|
|
212
215
|
return false;
|
|
@@ -231,11 +234,11 @@ function unlink(path, options = {}) {
|
|
|
231
234
|
return false;
|
|
232
235
|
}
|
|
233
236
|
else if (path.startsWith('/current/')) {
|
|
234
|
-
if (!options.current
|
|
237
|
+
if (!options.current) {
|
|
235
238
|
return false;
|
|
236
239
|
}
|
|
237
|
-
options.current
|
|
238
|
-
return unlink(
|
|
240
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
241
|
+
return unlink(current + fpath, options);
|
|
239
242
|
}
|
|
240
243
|
else {
|
|
241
244
|
return false;
|
|
@@ -408,11 +411,11 @@ function stats(path, options = {}) {
|
|
|
408
411
|
return null;
|
|
409
412
|
}
|
|
410
413
|
else if (path.startsWith('/current/')) {
|
|
411
|
-
if (!options.current
|
|
414
|
+
if (!options.current) {
|
|
412
415
|
return null;
|
|
413
416
|
}
|
|
414
|
-
options.current
|
|
415
|
-
return stats(
|
|
417
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
418
|
+
return stats(current + fpath, options);
|
|
416
419
|
}
|
|
417
420
|
else {
|
|
418
421
|
return null;
|
|
@@ -460,11 +463,11 @@ function mkdir(path, mode = 0o755, options = {}) {
|
|
|
460
463
|
return false;
|
|
461
464
|
}
|
|
462
465
|
else if (path.startsWith('/current/')) {
|
|
463
|
-
if (!options.current
|
|
466
|
+
if (!options.current) {
|
|
464
467
|
return false;
|
|
465
468
|
}
|
|
466
|
-
options.current
|
|
467
|
-
return mkdir(
|
|
469
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
470
|
+
return mkdir(current + fpath, mode, options);
|
|
468
471
|
}
|
|
469
472
|
else {
|
|
470
473
|
return false;
|
|
@@ -489,11 +492,11 @@ function rmdir(path, options = {}) {
|
|
|
489
492
|
return false;
|
|
490
493
|
}
|
|
491
494
|
else if (path.startsWith('/current/')) {
|
|
492
|
-
if (!options.current
|
|
495
|
+
if (!options.current) {
|
|
493
496
|
return false;
|
|
494
497
|
}
|
|
495
|
-
options.current
|
|
496
|
-
return rmdir(
|
|
498
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
499
|
+
return rmdir(current + fpath, options);
|
|
497
500
|
}
|
|
498
501
|
else {
|
|
499
502
|
return false;
|
|
@@ -547,11 +550,11 @@ function chmod(path, mod, options = {}) {
|
|
|
547
550
|
return false;
|
|
548
551
|
}
|
|
549
552
|
else if (path.startsWith('/current/')) {
|
|
550
|
-
if (!options.current
|
|
553
|
+
if (!options.current) {
|
|
551
554
|
return false;
|
|
552
555
|
}
|
|
553
|
-
options.current
|
|
554
|
-
return chmod(
|
|
556
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
557
|
+
return chmod(current + fpath, mod, options);
|
|
555
558
|
}
|
|
556
559
|
else {
|
|
557
560
|
return false;
|
|
@@ -581,11 +584,11 @@ function rename(oldPath, newPath, options = {}) {
|
|
|
581
584
|
return false;
|
|
582
585
|
}
|
|
583
586
|
else if (oldPath.startsWith('/current/')) {
|
|
584
|
-
if (!options.current
|
|
587
|
+
if (!options.current) {
|
|
585
588
|
return false;
|
|
586
589
|
}
|
|
587
|
-
options.current
|
|
588
|
-
return rename(
|
|
590
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
591
|
+
return rename(current + ofpath, current + nfpath, options);
|
|
589
592
|
}
|
|
590
593
|
else {
|
|
591
594
|
return false;
|
|
@@ -767,11 +770,11 @@ function readDir(path, options = {}) {
|
|
|
767
770
|
return list;
|
|
768
771
|
}
|
|
769
772
|
else if (path.startsWith('/current/')) {
|
|
770
|
-
if (!options.current
|
|
773
|
+
if (!options.current) {
|
|
771
774
|
return [];
|
|
772
775
|
}
|
|
773
|
-
options.current
|
|
774
|
-
return readDir(
|
|
776
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
777
|
+
return readDir(current + fpath, options);
|
|
775
778
|
}
|
|
776
779
|
else {
|
|
777
780
|
return [];
|
|
@@ -801,11 +804,11 @@ function copyFolder(from, to, options = {}) {
|
|
|
801
804
|
return 0;
|
|
802
805
|
}
|
|
803
806
|
else if (from.startsWith('/current/')) {
|
|
804
|
-
if (!options.current
|
|
807
|
+
if (!options.current) {
|
|
805
808
|
return 0;
|
|
806
809
|
}
|
|
807
|
-
options.current
|
|
808
|
-
return copyFolder(
|
|
810
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
811
|
+
return copyFolder(current + ffpath, current + tfpath, options);
|
|
809
812
|
}
|
|
810
813
|
else {
|
|
811
814
|
return 0;
|
|
@@ -835,11 +838,11 @@ function copyFile(src, dest, options = {}) {
|
|
|
835
838
|
return false;
|
|
836
839
|
}
|
|
837
840
|
else if (src.startsWith('/current/')) {
|
|
838
|
-
if (!options.current
|
|
841
|
+
if (!options.current) {
|
|
839
842
|
return false;
|
|
840
843
|
}
|
|
841
|
-
options.current
|
|
842
|
-
return copyFile(
|
|
844
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
845
|
+
return copyFile(current + sfpath, current + dfpath, options);
|
|
843
846
|
}
|
|
844
847
|
else {
|
|
845
848
|
return false;
|
package/dist/lib/fs.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as types from '../../types';
|
|
9
9
|
import * as tool from './tool';
|
|
10
10
|
|
|
11
|
-
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/
|
|
11
|
+
const clickgoFiles = ['/app/', '/app/demo/', '/app/demo/app.js', '/app/demo/form/', '/app/demo/form/control/', '/app/demo/form/control/block/', '/app/demo/form/control/block/block.css', '/app/demo/form/control/block/block.xml', '/app/demo/form/control/button/', '/app/demo/form/control/button/button.css', '/app/demo/form/control/button/button.js', '/app/demo/form/control/button/button.xml', '/app/demo/form/control/check/', '/app/demo/form/control/check/check.js', '/app/demo/form/control/check/check.xml', '/app/demo/form/control/dialog/', '/app/demo/form/control/dialog/dialog.js', '/app/demo/form/control/dialog/dialog.xml', '/app/demo/form/control/file/', '/app/demo/form/control/file/file.js', '/app/demo/form/control/file/file.xml', '/app/demo/form/control/form/', '/app/demo/form/control/form/form.css', '/app/demo/form/control/form/form.js', '/app/demo/form/control/form/form.xml', '/app/demo/form/control/greatview/', '/app/demo/form/control/greatview/greatview.css', '/app/demo/form/control/greatview/greatview.js', '/app/demo/form/control/greatview/greatview.xml', '/app/demo/form/control/img/', '/app/demo/form/control/img/img.xml', '/app/demo/form/control/label/', '/app/demo/form/control/label/label.xml', '/app/demo/form/control/list/', '/app/demo/form/control/list/list.css', '/app/demo/form/control/list/list.js', '/app/demo/form/control/list/list.xml', '/app/demo/form/control/loading/', '/app/demo/form/control/loading/loading.xml', '/app/demo/form/control/marquee/', '/app/demo/form/control/marquee/marquee.js', '/app/demo/form/control/marquee/marquee.xml', '/app/demo/form/control/menu/', '/app/demo/form/control/menu/menu.js', '/app/demo/form/control/menu/menu.xml', '/app/demo/form/control/monaco/', '/app/demo/form/control/monaco/monaco.js', '/app/demo/form/control/monaco/monaco.xml', '/app/demo/form/control/overflow/', '/app/demo/form/control/overflow/overflow.css', '/app/demo/form/control/overflow/overflow.js', '/app/demo/form/control/overflow/overflow.xml', '/app/demo/form/control/property/', '/app/demo/form/control/property/property.js', '/app/demo/form/control/property/property.xml', '/app/demo/form/control/radio/', '/app/demo/form/control/radio/radio.js', '/app/demo/form/control/radio/radio.xml', '/app/demo/form/control/scroll/', '/app/demo/form/control/scroll/scroll.js', '/app/demo/form/control/scroll/scroll.xml', '/app/demo/form/control/select/', '/app/demo/form/control/select/select.js', '/app/demo/form/control/select/select.xml', '/app/demo/form/control/tab/', '/app/demo/form/control/tab/tab.js', '/app/demo/form/control/tab/tab.xml', '/app/demo/form/control/text/', '/app/demo/form/control/text/text.js', '/app/demo/form/control/text/text.xml', '/app/demo/form/control/view/', '/app/demo/form/control/view/view.css', '/app/demo/form/control/view/view.js', '/app/demo/form/control/view/view.xml', '/app/demo/form/event/', '/app/demo/form/event/form/', '/app/demo/form/event/form/form.css', '/app/demo/form/event/form/form.js', '/app/demo/form/event/form/form.xml', '/app/demo/form/event/screen/', '/app/demo/form/event/screen/screen.js', '/app/demo/form/event/screen/screen.xml', '/app/demo/form/event/task/', '/app/demo/form/event/task/task.js', '/app/demo/form/event/task/task.xml', '/app/demo/form/main.css', '/app/demo/form/main.js', '/app/demo/form/main.xml', '/app/demo/form/method/', '/app/demo/form/method/core/', '/app/demo/form/method/core/core.js', '/app/demo/form/method/core/core.xml', '/app/demo/form/method/dom/', '/app/demo/form/method/dom/dom.css', '/app/demo/form/method/dom/dom.js', '/app/demo/form/method/dom/dom.xml', '/app/demo/form/method/form/', '/app/demo/form/method/form/form.css', '/app/demo/form/method/form/form.js', '/app/demo/form/method/form/form.xml', '/app/demo/form/method/form/test.xml', '/app/demo/form/method/fs/', '/app/demo/form/method/fs/fs.js', '/app/demo/form/method/fs/fs.xml', '/app/demo/form/method/fs/text.js', '/app/demo/form/method/fs/text.xml', '/app/demo/form/method/task/', '/app/demo/form/method/task/locale1.json', '/app/demo/form/method/task/locale2.json', '/app/demo/form/method/task/task.js', '/app/demo/form/method/task/task.xml', '/app/demo/form/method/theme/', '/app/demo/form/method/theme/theme.js', '/app/demo/form/method/theme/theme.xml', '/app/demo/form/method/tool/', '/app/demo/form/method/tool/tool.js', '/app/demo/form/method/tool/tool.xml', '/app/demo/form/method/zip/', '/app/demo/form/method/zip/zip.js', '/app/demo/form/method/zip/zip.xml', '/app/demo/global.css', '/app/demo/res/', '/app/demo/res/icon.svg', '/app/demo/res/img.jpg', '/app/demo/res/r-1.svg', '/app/demo/res/r-2.svg', '/app/demo/res/sql.svg', '/app/demo/res/txt.svg', '/app/demo/res/zip.svg', '/app/task/', '/app/task/app.js', '/app/task/form/', '/app/task/form/bar/', '/app/task/form/bar/bar.js', '/app/task/form/bar/bar.xml', '/app/task/form/desktop/', '/app/task/form/desktop/desktop.xml', '/app/task/locale/', '/app/task/locale/en.json', '/app/task/locale/ja.json', '/app/task/locale/sc.json', '/app/task/locale/tc.json', '/clickgo.js', '/clickgo.ts', '/control/', '/control/common.cgc', '/control/form.cgc', '/control/monaco.cgc', '/control/property.cgc', '/control/task.cgc', '/global.css', '/icon.png', '/index.js', '/index.ts', '/lib/', '/lib/control.js', '/lib/control.ts', '/lib/core.js', '/lib/core.ts', '/lib/dom.js', '/lib/dom.ts', '/lib/form.js', '/lib/form.ts', '/lib/fs.js', '/lib/fs.ts', '/lib/native.js', '/lib/native.ts', '/lib/task.js', '/lib/task.ts', '/lib/theme.js', '/lib/theme.ts', '/lib/tool.js', '/lib/tool.ts', '/lib/zip.js', '/lib/zip.ts', '/theme/', '/theme/familiar.cgt'];
|
|
12
12
|
|
|
13
13
|
export async function getContent(path: string, options?: {
|
|
14
14
|
'start'?: number;
|
|
@@ -133,11 +133,11 @@ export async function getContent(path: string, options?: BufferEncoding | {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
else if (path.startsWith('/current/')) {
|
|
136
|
-
if (!options.current
|
|
136
|
+
if (!options.current) {
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
options.current
|
|
140
|
-
return getContent(
|
|
139
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
140
|
+
return getContent(current + fpath, options);
|
|
141
141
|
}
|
|
142
142
|
else {
|
|
143
143
|
return null;
|
|
@@ -173,11 +173,11 @@ export async function putContent(path: string, data: string | Buffer, options: {
|
|
|
173
173
|
return false;
|
|
174
174
|
}
|
|
175
175
|
else if (path.startsWith('/current/')) {
|
|
176
|
-
if (!options.current
|
|
176
|
+
if (!options.current) {
|
|
177
177
|
return false;
|
|
178
178
|
}
|
|
179
|
-
options.current
|
|
180
|
-
return putContent(
|
|
179
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
180
|
+
return putContent(current + fpath, data, options);
|
|
181
181
|
}
|
|
182
182
|
else {
|
|
183
183
|
return false;
|
|
@@ -187,10 +187,11 @@ export async function putContent(path: string, data: string | Buffer, options: {
|
|
|
187
187
|
/**
|
|
188
188
|
* --- 读取链接的 target ---
|
|
189
189
|
* @param path 要读取的路径
|
|
190
|
-
* @param
|
|
190
|
+
* @param options 选项
|
|
191
191
|
*/
|
|
192
192
|
export async function readLink(path: string, options?: BufferEncoding | {
|
|
193
193
|
'encoding'?: BufferEncoding;
|
|
194
|
+
/** --- 不以 / 结尾的路径 --- */
|
|
194
195
|
'current'?: string;
|
|
195
196
|
}): Promise<string | null> {
|
|
196
197
|
path = tool.urlResolve('/', path);
|
|
@@ -218,9 +219,12 @@ export async function readLink(path: string, options?: BufferEncoding | {
|
|
|
218
219
|
return null;
|
|
219
220
|
}
|
|
220
221
|
else if (path.startsWith('/current/')) {
|
|
221
|
-
if (!options.current
|
|
222
|
+
if (!options.current) {
|
|
222
223
|
return null;
|
|
223
224
|
}
|
|
225
|
+
if (options.current.endsWith('/')) {
|
|
226
|
+
return options.current.slice(0, -1);
|
|
227
|
+
}
|
|
224
228
|
return options.current;
|
|
225
229
|
}
|
|
226
230
|
else {
|
|
@@ -232,7 +236,7 @@ export async function readLink(path: string, options?: BufferEncoding | {
|
|
|
232
236
|
* --- 把源文件创建一个 link ---
|
|
233
237
|
* @param filePath 源文件
|
|
234
238
|
* @param linkPath 连接路径
|
|
235
|
-
* @param
|
|
239
|
+
* @param options 选项
|
|
236
240
|
*/
|
|
237
241
|
export async function symlink(filePath: string, linkPath: string, options: {
|
|
238
242
|
'type'?: 'dir' | 'file' | 'junction';
|
|
@@ -255,14 +259,14 @@ export async function symlink(filePath: string, linkPath: string, options: {
|
|
|
255
259
|
return false;
|
|
256
260
|
}
|
|
257
261
|
else if (filePath.startsWith('/current/')) {
|
|
258
|
-
if (!options.current
|
|
262
|
+
if (!options.current) {
|
|
259
263
|
return false;
|
|
260
264
|
}
|
|
261
|
-
options.current
|
|
265
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
262
266
|
if (linkPath.startsWith('/current/')) {
|
|
263
|
-
linkPath =
|
|
267
|
+
linkPath = current + linkPath.slice(8);
|
|
264
268
|
}
|
|
265
|
-
return symlink(
|
|
269
|
+
return symlink(current + filePath.slice(8), linkPath, options);
|
|
266
270
|
}
|
|
267
271
|
else {
|
|
268
272
|
return false;
|
|
@@ -293,11 +297,11 @@ export async function unlink(path: string, options: {
|
|
|
293
297
|
return false;
|
|
294
298
|
}
|
|
295
299
|
else if (path.startsWith('/current/')) {
|
|
296
|
-
if (!options.current
|
|
300
|
+
if (!options.current) {
|
|
297
301
|
return false;
|
|
298
302
|
}
|
|
299
|
-
options.current
|
|
300
|
-
return unlink(
|
|
303
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
304
|
+
return unlink(current + fpath, options);
|
|
301
305
|
}
|
|
302
306
|
else {
|
|
303
307
|
return false;
|
|
@@ -482,11 +486,11 @@ export async function stats(path: string, options: {
|
|
|
482
486
|
return null;
|
|
483
487
|
}
|
|
484
488
|
else if (path.startsWith('/current/')) {
|
|
485
|
-
if (!options.current
|
|
489
|
+
if (!options.current) {
|
|
486
490
|
return null;
|
|
487
491
|
}
|
|
488
|
-
options.current
|
|
489
|
-
return stats(
|
|
492
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
493
|
+
return stats(current + fpath, options);
|
|
490
494
|
}
|
|
491
495
|
else {
|
|
492
496
|
return null;
|
|
@@ -552,11 +556,11 @@ export async function mkdir(path: string, mode: number = 0o755, options: {
|
|
|
552
556
|
return false;
|
|
553
557
|
}
|
|
554
558
|
else if (path.startsWith('/current/')) {
|
|
555
|
-
if (!options.current
|
|
559
|
+
if (!options.current) {
|
|
556
560
|
return false;
|
|
557
561
|
}
|
|
558
|
-
options.current
|
|
559
|
-
return mkdir(
|
|
562
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
563
|
+
return mkdir(current + fpath, mode, options);
|
|
560
564
|
}
|
|
561
565
|
else {
|
|
562
566
|
return false;
|
|
@@ -587,11 +591,11 @@ export async function rmdir(path: string, options: {
|
|
|
587
591
|
return false;
|
|
588
592
|
}
|
|
589
593
|
else if (path.startsWith('/current/')) {
|
|
590
|
-
if (!options.current
|
|
594
|
+
if (!options.current) {
|
|
591
595
|
return false;
|
|
592
596
|
}
|
|
593
|
-
options.current
|
|
594
|
-
return rmdir(
|
|
597
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
598
|
+
return rmdir(current + fpath, options);
|
|
595
599
|
}
|
|
596
600
|
else {
|
|
597
601
|
return false;
|
|
@@ -657,11 +661,11 @@ export async function chmod(path: string, mod: string | number, options: {
|
|
|
657
661
|
return false;
|
|
658
662
|
}
|
|
659
663
|
else if (path.startsWith('/current/')) {
|
|
660
|
-
if (!options.current
|
|
664
|
+
if (!options.current) {
|
|
661
665
|
return false;
|
|
662
666
|
}
|
|
663
|
-
options.current
|
|
664
|
-
return chmod(
|
|
667
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
668
|
+
return chmod(current + fpath, mod, options);
|
|
665
669
|
}
|
|
666
670
|
else {
|
|
667
671
|
return false;
|
|
@@ -698,11 +702,11 @@ export async function rename(oldPath: string, newPath: string, options: {
|
|
|
698
702
|
return false;
|
|
699
703
|
}
|
|
700
704
|
else if (oldPath.startsWith('/current/')) {
|
|
701
|
-
if (!options.current
|
|
705
|
+
if (!options.current) {
|
|
702
706
|
return false;
|
|
703
707
|
}
|
|
704
|
-
options.current
|
|
705
|
-
return rename(
|
|
708
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
709
|
+
return rename(current + ofpath, current + nfpath, options);
|
|
706
710
|
}
|
|
707
711
|
else {
|
|
708
712
|
return false;
|
|
@@ -899,11 +903,11 @@ export async function readDir(path: string, options: {
|
|
|
899
903
|
return list;
|
|
900
904
|
}
|
|
901
905
|
else if (path.startsWith('/current/')) {
|
|
902
|
-
if (!options.current
|
|
906
|
+
if (!options.current) {
|
|
903
907
|
return [];
|
|
904
908
|
}
|
|
905
|
-
options.current
|
|
906
|
-
return readDir(
|
|
909
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
910
|
+
return readDir(current + fpath, options);
|
|
907
911
|
}
|
|
908
912
|
else {
|
|
909
913
|
return [];
|
|
@@ -942,11 +946,11 @@ export async function copyFolder(from: string, to: string, options: {
|
|
|
942
946
|
return 0;
|
|
943
947
|
}
|
|
944
948
|
else if (from.startsWith('/current/')) {
|
|
945
|
-
if (!options.current
|
|
949
|
+
if (!options.current) {
|
|
946
950
|
return 0;
|
|
947
951
|
}
|
|
948
|
-
options.current
|
|
949
|
-
return copyFolder(
|
|
952
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
953
|
+
return copyFolder(current + ffpath, current + tfpath, options);
|
|
950
954
|
}
|
|
951
955
|
else {
|
|
952
956
|
return 0;
|
|
@@ -983,11 +987,11 @@ export async function copyFile(src: string, dest: string, options: {
|
|
|
983
987
|
return false;
|
|
984
988
|
}
|
|
985
989
|
else if (src.startsWith('/current/')) {
|
|
986
|
-
if (!options.current
|
|
990
|
+
if (!options.current) {
|
|
987
991
|
return false;
|
|
988
992
|
}
|
|
989
|
-
options.current
|
|
990
|
-
return copyFile(
|
|
993
|
+
const current = options.current.endsWith('/') ? options.current.slice(0, -1) : options.current;
|
|
994
|
+
return copyFile(current + sfpath, current + dfpath, options);
|
|
991
995
|
}
|
|
992
996
|
else {
|
|
993
997
|
return false;
|