@cloudbase/cals 1.0.50 → 1.0.51
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/lib/parser/cals/utils/block/index.js +151 -0
- package/lib/parser/cals/utils/code/index.js +393 -0
- package/lib/parser/cals/utils/common.js +268 -0
- package/lib/parser/cals/utils/getUsedResources.d.ts +10 -0
- package/lib/parser/cals/utils/getUsedResources.d.ts.map +1 -0
- package/lib/parser/cals/utils/getUsedResources.js +128 -0
- package/lib/parser/cals/utils/runtime.js +268 -0
- package/lib/parser/cals/utils/style.js +472 -0
- package/lib/parser/cals/utils/version/common.js +385 -0
- package/lib/parser/cals/utils/version/config.d.ts +16 -0
- package/lib/parser/cals/utils/version/config.d.ts.map +1 -0
- package/lib/parser/cals/utils/version/config.js +244 -0
- package/lib/parser/cals/utils/version/index.js +96 -0
- package/lib/parser/cals/utils/version/parses.js +581 -0
- package/lib/parser/cals/utils/version/utils.d.ts +14 -0
- package/lib/parser/cals/utils/version/utils.d.ts.map +1 -0
- package/lib/parser/cals/utils/version/utils.js +148 -0
- package/lib/parser/expression/index.d.ts +123 -0
- package/lib/parser/expression/index.d.ts.map +1 -0
- package/lib/parser/expression/index.js +301 -0
- package/lib/parser/plugins/postcss-rpx2clac.d.ts +18 -0
- package/lib/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
- package/lib/parser/plugins/postcss-rpx2clac.js +68 -0
- package/lib/types/basic/app.d.ts +73 -0
- package/lib/types/basic/app.d.ts.map +1 -0
- package/lib/types/basic/app.js +2 -0
- package/lib/types/basic/common.d.ts +93 -0
- package/lib/types/basic/common.d.ts.map +1 -0
- package/lib/types/basic/common.js +2 -0
- package/lib/types/basic/component.d.ts +211 -0
- package/lib/types/basic/component.d.ts.map +1 -0
- package/lib/types/basic/component.js +2 -0
- package/lib/types/basic/datasource.d.ts +50 -0
- package/lib/types/basic/datasource.d.ts.map +1 -0
- package/lib/types/basic/datasource.js +2 -0
- package/lib/types/index.js +42 -0
- package/lib/types/lcds.js +25 -0
- package/lib/types/platform/app.js +11 -0
- package/lib/types/platform/common.d.ts +181 -0
- package/lib/types/platform/common.d.ts.map +1 -0
- package/lib/types/platform/common.js +87 -0
- package/lib/types/platform/component.d.ts +139 -0
- package/lib/types/platform/component.d.ts.map +1 -0
- package/lib/types/platform/component.js +11 -0
- package/lib/types/platform/datasource.d.ts +467 -0
- package/lib/types/platform/datasource.d.ts.map +1 -0
- package/lib/types/platform/datasource.js +2 -0
- package/lib/types/platform/eventFlow.d.ts +20 -0
- package/lib/types/platform/eventFlow.d.ts.map +1 -0
- package/lib/types/platform/eventFlow.js +2 -0
- package/lib/types/platform/query.d.ts +67 -0
- package/lib/types/platform/query.d.ts.map +1 -0
- package/lib/types/platform/query.js +2 -0
- package/lib/types/platform/theme.js +2 -0
- package/lib/types/platform/widget/form.d.ts +5 -0
- package/lib/types/platform/widget/form.d.ts.map +1 -0
- package/lib/types/platform/widget/form.js +5 -0
- package/lib/types/platform/widget/meta.d.ts +60 -0
- package/lib/types/platform/widget/meta.d.ts.map +1 -0
- package/lib/types/platform/widget/meta.js +6 -0
- package/lib/utils/CSSProperty.d.ts +64 -0
- package/lib/utils/CSSProperty.d.ts.map +1 -0
- package/lib/utils/CSSProperty.js +89 -0
- package/lib/utils/build.d.ts +2 -0
- package/lib/utils/build.d.ts.map +1 -0
- package/lib/utils/build.js +75 -0
- package/lib/utils/dts/auto-generated.d.ts +2 -0
- package/lib/utils/dts/auto-generated.d.ts.map +1 -0
- package/lib/utils/dts/auto-generated.js +1796 -0
- package/lib/utils/dts/build.d.ts +2 -0
- package/lib/utils/dts/build.d.ts.map +1 -0
- package/lib/utils/dts/build.js +136 -0
- package/lib/utils/dts/index.js +1008 -0
- package/lib/utils/index.js +27 -0
- package/lib/utils/version/common.d.ts +3 -0
- package/lib/utils/version/common.d.ts.map +1 -0
- package/lib/utils/version/common.js +27 -0
- package/lib/utils/version/featureChecker.js +35 -0
- package/lib/utils/version/migrations/version4.js +199 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/build.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const child_process_1 = __importDefault(require("child_process"));
|
|
18
|
+
const os_1 = __importDefault(require("os"));
|
|
19
|
+
const node_watch_1 = __importDefault(require("node-watch"));
|
|
20
|
+
/**
|
|
21
|
+
* 生成函数公式的 dts
|
|
22
|
+
* 已包含的函数公式:packages/weda-client/src/common/<calculation|logic|text|time>
|
|
23
|
+
*/
|
|
24
|
+
function buildFormulaDTS() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
// 确保在 packages/cals 目录执行该脚本
|
|
27
|
+
const baseDirPath = path_1.default.resolve('..', 'weda-client', 'src', 'common');
|
|
28
|
+
const formulaDirs = ['calculation', 'logic', 'text', 'time'];
|
|
29
|
+
const dtsList = yield Promise.all(formulaDirs.map((fDir) => {
|
|
30
|
+
return genDTS(fDir);
|
|
31
|
+
}));
|
|
32
|
+
return dtsList.join('\n');
|
|
33
|
+
function genDTS(fDir) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const randomId = Math.random().toString(36).substring(2, 6);
|
|
36
|
+
const tempDtsPath = path_1.default.resolve(os_1.default.tmpdir(), `weda-temp-${randomId}.d.ts`);
|
|
37
|
+
yield new Promise((resolve) => {
|
|
38
|
+
child_process_1.default.exec(`tsc ${path_1.default.resolve(baseDirPath, fDir, 'index.ts')} --declaration --emitDeclarationOnly --allowSyntheticDefaultImports true --out ${tempDtsPath}`, () => {
|
|
39
|
+
resolve('done');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
const dts = yield fs_extra_1.default.readFile(tempDtsPath, 'utf8');
|
|
43
|
+
yield fs_extra_1.default.remove(tempDtsPath);
|
|
44
|
+
// 去掉最外层的模块声明
|
|
45
|
+
return dts
|
|
46
|
+
.replace(/^declare module.*$/m, '')
|
|
47
|
+
.replace(/^\}$/m, '')
|
|
48
|
+
.replace(/^\s+/gm, '');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function genWeDaAPPDTS() {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
console.log('genWeDaAPPDTS processing...');
|
|
56
|
+
/**
|
|
57
|
+
* 获取所有的 DTS
|
|
58
|
+
*/
|
|
59
|
+
const wedaFrameworkDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-framework.d.ts'), 'utf8'); // 低码框架
|
|
60
|
+
const wedaAppDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-app.d.ts'), 'utf-8'); // app对象
|
|
61
|
+
const wedaPageDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-page.d.ts'), 'utf-8'); // page对象
|
|
62
|
+
const wedaAuthDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-auth.d.ts'), 'utf8'); // auth对象
|
|
63
|
+
const wedaCloudDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-cloud.d.ts'), 'utf-8'); // cloud对象
|
|
64
|
+
const wedaUtilsDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-utils.d.ts'), 'utf-8'); // page对象
|
|
65
|
+
const wedaDeviceDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-device.d.ts'), 'utf8'); // device对象
|
|
66
|
+
const wedaEnvDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-env.d.ts'), 'utf8'); // env对象
|
|
67
|
+
const wedaWedaContextDTS = yield fs_extra_1.default.readFile(path_1.default.resolve(__dirname, 'framework', 'weda-wedaContext.d.ts'), 'utf8'); // wedaContext对象
|
|
68
|
+
const formulaDTS = yield buildFormulaDTS(); // 函数公式
|
|
69
|
+
/**
|
|
70
|
+
* 聚合 DTS
|
|
71
|
+
*/
|
|
72
|
+
const wedaDTS = groupDTSs({
|
|
73
|
+
wedaFrameworkDTS,
|
|
74
|
+
wedaAppDTS,
|
|
75
|
+
wedaPageDTS,
|
|
76
|
+
wedaAuthDTS,
|
|
77
|
+
wedaCloudDTS,
|
|
78
|
+
wedaUtilsDTS,
|
|
79
|
+
wedaDeviceDTS,
|
|
80
|
+
wedaEnvDTS,
|
|
81
|
+
wedaWedaContextDTS,
|
|
82
|
+
formulaDTS,
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* 将聚合结果保存在 auto-generated.ts
|
|
86
|
+
*/
|
|
87
|
+
yield fs_extra_1.default.writeFile(path_1.default.resolve(__dirname, 'auto-generated.ts'), `export const wedaDTS = \`${wedaDTS}\``, 'utf8');
|
|
88
|
+
console.log('genWeDaAPPDTS done!');
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 聚合所有的 DTS(不包括动态生成的)
|
|
93
|
+
*/
|
|
94
|
+
function groupDTSs({ wedaFrameworkDTS = '', wedaAppDTS = '', wedaPageDTS = '', wedaAuthDTS = '', wedaCloudDTS = '', wedaUtilsDTS = '', wedaDeviceDTS = '', wedaEnvDTS = '', wedaWedaContextDTS = '', formulaDTS = '', }) {
|
|
95
|
+
let resultDts = wedaFrameworkDTS;
|
|
96
|
+
// $app
|
|
97
|
+
resultDts = resultDts.replaceAll("// $app - Don't touch me", wedaAppDTS);
|
|
98
|
+
// $page
|
|
99
|
+
resultDts = resultDts.replaceAll("// $page - Don't touch me", wedaPageDTS);
|
|
100
|
+
// $w.auth
|
|
101
|
+
resultDts = resultDts.replaceAll("// $w.auth - Don't touch me", wedaAuthDTS.replace(/declare/g, ''));
|
|
102
|
+
// $w.cloud
|
|
103
|
+
resultDts = resultDts.replaceAll("// $w.cloud - Don't touch me", wedaCloudDTS.replace(/declare/g, ''));
|
|
104
|
+
// $w.device
|
|
105
|
+
resultDts = resultDts.replaceAll("// $w.device - Don't touch me", wedaDeviceDTS.replace(/declare/g, ''));
|
|
106
|
+
// $w.env
|
|
107
|
+
resultDts = resultDts.replaceAll("// $w.env - Don't touch me", wedaEnvDTS.replace(/declare/g, ''));
|
|
108
|
+
// $w.wedaContext
|
|
109
|
+
resultDts = resultDts.replaceAll("// $w.wedaContext - Don't touch me", wedaWedaContextDTS.replace(/declare/g, ''));
|
|
110
|
+
// $w.utils
|
|
111
|
+
resultDts = resultDts.replaceAll("// $w.utils - Don't touch me", wedaUtilsDTS.replace(/declare/g, ''));
|
|
112
|
+
// 函数公式:$w.xxx
|
|
113
|
+
resultDts = resultDts.replaceAll("// Formula 函数公式 - Don't touch me", formulaDTS.replace(/export/g, ''));
|
|
114
|
+
// 函数公式:全局变量提示
|
|
115
|
+
resultDts = resultDts.replace("// Global Formula 全局函数公式- Don't touch me", formulaDTS.replace(/export/g, 'declare'));
|
|
116
|
+
return resultDts;
|
|
117
|
+
}
|
|
118
|
+
function main() {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
yield genWeDaAPPDTS();
|
|
121
|
+
const [, , watchArgv] = process.argv;
|
|
122
|
+
if (watchArgv === '--watch') {
|
|
123
|
+
console.log('Start watching mode');
|
|
124
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-framework.d.ts'), genWeDaAPPDTS);
|
|
125
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-app.d.ts'), genWeDaAPPDTS);
|
|
126
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-page.d.ts'), genWeDaAPPDTS);
|
|
127
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-auth.d.ts'), genWeDaAPPDTS);
|
|
128
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-cloud.d.ts'), genWeDaAPPDTS);
|
|
129
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-device.d.ts'), genWeDaAPPDTS);
|
|
130
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-env.d.ts'), genWeDaAPPDTS);
|
|
131
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-wedaContext.d.ts'), genWeDaAPPDTS);
|
|
132
|
+
(0, node_watch_1.default)(path_1.default.resolve(__dirname, 'framework', 'weda-utils.d.ts'), genWeDaAPPDTS);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
main();
|