@cloudbase/cals 0.5.10 → 0.5.11-alpha.1
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/index.d.ts +0 -0
- package/lib/parser/cals/index.d.ts.map +0 -0
- package/lib/parser/cals/index.js +0 -0
- package/lib/parser/cals/utils/block/index.d.ts +0 -0
- package/lib/parser/cals/utils/block/index.d.ts.map +0 -0
- package/lib/parser/cals/utils/block/index.js +0 -0
- package/lib/parser/cals/utils/code/index.d.ts +0 -0
- package/lib/parser/cals/utils/code/index.d.ts.map +0 -0
- package/lib/parser/cals/utils/code/index.js +0 -0
- package/lib/parser/cals/utils/common.d.ts +0 -0
- package/lib/parser/cals/utils/common.d.ts.map +0 -0
- package/lib/parser/cals/utils/common.js +0 -0
- package/lib/parser/cals/utils/runtime.d.ts +0 -0
- package/lib/parser/cals/utils/runtime.d.ts.map +0 -0
- package/lib/parser/cals/utils/runtime.js +0 -0
- package/lib/parser/cals/utils/spinoff/index.d.ts +0 -0
- package/lib/parser/cals/utils/spinoff/index.d.ts.map +0 -0
- package/lib/parser/cals/utils/spinoff/index.js +0 -0
- package/lib/parser/cals/utils/style.d.ts +0 -0
- package/lib/parser/cals/utils/style.d.ts.map +0 -0
- package/lib/parser/cals/utils/style.js +0 -0
- package/lib/parser/cals/utils/template.d.ts +0 -0
- package/lib/parser/cals/utils/template.d.ts.map +0 -0
- package/lib/parser/cals/utils/template.js +0 -0
- package/lib/parser/cals/utils/version/common.d.ts +0 -0
- package/lib/parser/cals/utils/version/common.d.ts.map +0 -0
- package/lib/parser/cals/utils/version/common.js +0 -0
- package/lib/parser/cals/utils/version/config.d.ts +0 -0
- package/lib/parser/cals/utils/version/config.d.ts.map +0 -0
- package/lib/parser/cals/utils/version/config.js +0 -0
- package/lib/parser/cals/utils/version/index.d.ts +0 -0
- package/lib/parser/cals/utils/version/index.d.ts.map +0 -0
- package/lib/parser/cals/utils/version/index.js +0 -0
- package/lib/parser/cals/utils/version/parses.d.ts +0 -0
- package/lib/parser/cals/utils/version/parses.d.ts.map +0 -0
- package/lib/parser/cals/utils/version/parses.js +0 -0
- package/lib/parser/cals/utils/version/utils.d.ts +0 -0
- package/lib/parser/cals/utils/version/utils.d.ts.map +0 -0
- package/lib/parser/cals/utils/version/utils.js +0 -0
- package/lib/parser/expression/index.d.ts +0 -0
- package/lib/parser/expression/index.d.ts.map +0 -0
- package/lib/parser/expression/index.js +0 -0
- package/lib/parser/index.d.ts +0 -0
- package/lib/parser/index.d.ts.map +0 -0
- package/lib/parser/index.js +0 -0
- package/lib/types/basic/app.d.ts +0 -0
- package/lib/types/basic/app.d.ts.map +0 -0
- package/lib/types/basic/app.js +0 -0
- package/lib/types/basic/common.d.ts +0 -0
- package/lib/types/basic/common.d.ts.map +0 -0
- package/lib/types/basic/common.js +0 -0
- package/lib/types/basic/component.d.ts +0 -0
- package/lib/types/basic/component.d.ts.map +0 -0
- package/lib/types/basic/component.js +0 -0
- package/lib/types/basic/datasource.d.ts +0 -0
- package/lib/types/basic/datasource.d.ts.map +0 -0
- package/lib/types/basic/datasource.js +0 -0
- package/lib/types/index.d.ts +0 -0
- package/lib/types/index.d.ts.map +0 -0
- package/lib/types/index.js +0 -0
- package/lib/types/lcds.d.ts +0 -0
- package/lib/types/lcds.d.ts.map +0 -0
- package/lib/types/lcds.js +0 -0
- package/lib/types/platform/app.d.ts +0 -0
- package/lib/types/platform/app.d.ts.map +0 -0
- package/lib/types/platform/app.js +0 -0
- package/lib/types/platform/common.d.ts +0 -0
- package/lib/types/platform/common.d.ts.map +0 -0
- package/lib/types/platform/common.js +0 -0
- package/lib/types/platform/component.d.ts +0 -0
- package/lib/types/platform/component.d.ts.map +0 -0
- package/lib/types/platform/component.js +0 -0
- package/lib/types/platform/datasource.d.ts +0 -0
- package/lib/types/platform/datasource.d.ts.map +0 -0
- package/lib/types/platform/datasource.js +0 -0
- package/lib/types/platform/widget/form.d.ts +0 -0
- package/lib/types/platform/widget/form.d.ts.map +0 -0
- package/lib/types/platform/widget/form.js +0 -0
- package/lib/types/platform/widget/meta.d.ts +0 -0
- package/lib/types/platform/widget/meta.d.ts.map +0 -0
- package/lib/types/platform/widget/meta.js +0 -0
- package/lib/utils/CSSProperty.d.ts +0 -0
- package/lib/utils/CSSProperty.d.ts.map +0 -0
- package/lib/utils/CSSProperty.js +0 -0
- package/lib/utils/build.d.ts +0 -0
- package/lib/utils/build.d.ts.map +0 -0
- package/lib/utils/build.js +0 -0
- package/lib/utils/constant.d.ts +0 -0
- package/lib/utils/constant.d.ts.map +0 -0
- package/lib/utils/constant.js +0 -0
- package/lib/utils/dts/index.d.ts +5 -0
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +53 -33
- package/lib/utils/index.d.ts +0 -0
- package/lib/utils/index.d.ts.map +0 -0
- package/lib/utils/index.js +0 -0
- package/package.json +1 -1
|
File without changes
|
|
File without changes
|
package/lib/parser/cals/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parser/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/parser/index.js
CHANGED
|
File without changes
|
package/lib/types/basic/app.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/types/basic/app.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/types/index.d.ts
CHANGED
|
File without changes
|
package/lib/types/index.d.ts.map
CHANGED
|
File without changes
|
package/lib/types/index.js
CHANGED
|
File without changes
|
package/lib/types/lcds.d.ts
CHANGED
|
File without changes
|
package/lib/types/lcds.d.ts.map
CHANGED
|
File without changes
|
package/lib/types/lcds.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/CSSProperty.js
CHANGED
|
File without changes
|
package/lib/utils/build.d.ts
CHANGED
|
File without changes
|
package/lib/utils/build.d.ts.map
CHANGED
|
File without changes
|
package/lib/utils/build.js
CHANGED
|
File without changes
|
package/lib/utils/constant.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/utils/constant.js
CHANGED
|
File without changes
|
package/lib/utils/dts/index.d.ts
CHANGED
|
@@ -86,4 +86,9 @@ export declare const workerCode = "\nimportScripts('https://qbase.cdn-go.cn/lcap
|
|
|
86
86
|
* 通过 js/ts 代码生成 dts
|
|
87
87
|
*/
|
|
88
88
|
export declare function transpileToDTS(code: string): Promise<string>;
|
|
89
|
+
export declare const jsonToDTSWorkerCode = "\nimportScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/json-schema-to-typescript-for-browser.min.js');\n\nfunction transpile(jsonschema) {\n return jstt.compile(jsonschema, 'IWeDa', { additionalProperties: false, bannerComment: '', format: false })\n}\n\naddEventListener('message', (message) => {\n const {action, data: {id, jsonschema}} = message.data\n switch(action) {\n case 'dts':\n transpile(jsonschema).then(dts => {\n postMessage({action: 'dts_back', data: {id, dts}})\n }).catch(err => postMessage({action: 'dts_back', data: {id, dts: 'Parse error:' + err.message}}))\n break\n default:\n break\n }\n})\n";
|
|
90
|
+
/**
|
|
91
|
+
* Webworker 版本的 JSON to DTS
|
|
92
|
+
*/
|
|
93
|
+
export declare function compileJSONToDTS(jsonschema: any): Promise<string>;
|
|
89
94
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"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"}
|
package/lib/utils/dts/index.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,10 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
9
|
});
|
|
33
10
|
};
|
|
34
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.transpileToDTS = exports.workerCode = exports.generateWeDaAppDTS = exports.WeDaDTS = exports.IInputDataType = void 0;
|
|
36
|
-
const jstt = __importStar(require("json-schema-to-typescript-for-browser/dist/bundle.js"));
|
|
12
|
+
exports.compileJSONToDTS = exports.jsonToDTSWorkerCode = exports.transpileToDTS = exports.workerCode = exports.generateWeDaAppDTS = exports.WeDaDTS = exports.IInputDataType = void 0;
|
|
37
13
|
const auto_generated_1 = require("./auto-generated");
|
|
38
|
-
const compile = jstt.compile;
|
|
39
14
|
var IInputDataType;
|
|
40
15
|
(function (IInputDataType) {
|
|
41
16
|
IInputDataType["globalState"] = "globalState";
|
|
@@ -312,7 +287,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
312
287
|
}
|
|
313
288
|
function _compile(jsonschema, isObjNeedWrapper = false) {
|
|
314
289
|
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
-
let dts = yield
|
|
290
|
+
let dts = yield compileJSONToDTS(jsonschema);
|
|
316
291
|
if (dts.search(/^export interface IWeDa/) >= 0) {
|
|
317
292
|
dts = dts.replace(/^export interface.*$/m, '');
|
|
318
293
|
dts = dts.substring(0, dts.length - 2);
|
|
@@ -392,13 +367,17 @@ addEventListener('message', (message) => {
|
|
|
392
367
|
}
|
|
393
368
|
})
|
|
394
369
|
`;
|
|
395
|
-
function TypescriptWorker() {
|
|
396
|
-
let
|
|
397
|
-
let sendMessageCallbackFn = {};
|
|
370
|
+
function TypescriptWorker(workerId, workerCode) {
|
|
371
|
+
let typescriptWorkerMap = {};
|
|
398
372
|
return function getInstance() {
|
|
373
|
+
var _a;
|
|
374
|
+
let typescriptWorker = (_a = typescriptWorkerMap[workerId]) === null || _a === void 0 ? void 0 : _a.typescriptWorker;
|
|
399
375
|
if (!typescriptWorker) {
|
|
400
|
-
const
|
|
401
|
-
|
|
376
|
+
const sendMessageCallbackFn = {};
|
|
377
|
+
const workerURL = URL.createObjectURL(new Blob([workerCode]));
|
|
378
|
+
// 在 node 环境 unittest 时增加 name 参数用于辨别是哪个 worker
|
|
379
|
+
console.log('>>> workerURL', workerURL);
|
|
380
|
+
typescriptWorker = new Worker(workerURL + (workerURL.search('blob:http://localhost') === 0 ? '?name=' + workerId : ''));
|
|
402
381
|
typescriptWorker.onmessage = function (event) {
|
|
403
382
|
const { action } = event.data;
|
|
404
383
|
if (action === 'dts_back') {
|
|
@@ -406,8 +385,13 @@ function TypescriptWorker() {
|
|
|
406
385
|
sendMessageCallbackFn[id] && sendMessageCallbackFn[id](dts);
|
|
407
386
|
}
|
|
408
387
|
};
|
|
388
|
+
typescriptWorkerMap[workerId] = {
|
|
389
|
+
typescriptWorker,
|
|
390
|
+
sendMessageCallbackFn
|
|
391
|
+
};
|
|
409
392
|
}
|
|
410
393
|
function sendMessage(msgData, callbackFn) {
|
|
394
|
+
const { typescriptWorker, sendMessageCallbackFn } = typescriptWorkerMap[workerId];
|
|
411
395
|
const id = Math.random()
|
|
412
396
|
.toString(36)
|
|
413
397
|
.substring(2, 5);
|
|
@@ -429,7 +413,7 @@ function TypescriptWorker() {
|
|
|
429
413
|
*
|
|
430
414
|
* })
|
|
431
415
|
*/
|
|
432
|
-
const getTypescriptWorker = TypescriptWorker();
|
|
416
|
+
const getTypescriptWorker = TypescriptWorker('transpileToDTS', exports.workerCode);
|
|
433
417
|
/**
|
|
434
418
|
* 通过 js/ts 代码生成 dts
|
|
435
419
|
*/
|
|
@@ -442,3 +426,39 @@ function transpileToDTS(code) {
|
|
|
442
426
|
});
|
|
443
427
|
}
|
|
444
428
|
exports.transpileToDTS = transpileToDTS;
|
|
429
|
+
exports.jsonToDTSWorkerCode = `
|
|
430
|
+
importScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/json-schema-to-typescript-for-browser.min.js');
|
|
431
|
+
|
|
432
|
+
function transpile(jsonschema) {
|
|
433
|
+
return jstt.compile(jsonschema, 'IWeDa', { additionalProperties: false, bannerComment: '', format: false })
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
addEventListener('message', (message) => {
|
|
437
|
+
const {action, data: {id, jsonschema}} = message.data
|
|
438
|
+
switch(action) {
|
|
439
|
+
case 'dts':
|
|
440
|
+
transpile(jsonschema).then(dts => {
|
|
441
|
+
postMessage({action: 'dts_back', data: {id, dts}})
|
|
442
|
+
}).catch(err => postMessage({action: 'dts_back', data: {id, dts: 'Parse error:' + err.message}}))
|
|
443
|
+
break
|
|
444
|
+
default:
|
|
445
|
+
break
|
|
446
|
+
}
|
|
447
|
+
})
|
|
448
|
+
`;
|
|
449
|
+
const getCompileJSONToDTSWorker = TypescriptWorker('compileJSONToDTS', exports.jsonToDTSWorkerCode);
|
|
450
|
+
/**
|
|
451
|
+
* Webworker 版本的 JSON to DTS
|
|
452
|
+
*/
|
|
453
|
+
function compileJSONToDTS(jsonschema) {
|
|
454
|
+
return new Promise((resolve, reject) => {
|
|
455
|
+
const worker = getCompileJSONToDTSWorker();
|
|
456
|
+
worker.sendMessage({ action: 'dts', data: { jsonschema } }, (dts) => {
|
|
457
|
+
if (dts.search('Parse error:') === 0)
|
|
458
|
+
reject(dts);
|
|
459
|
+
else
|
|
460
|
+
resolve(dts);
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
exports.compileJSONToDTS = compileJSONToDTS;
|
package/lib/utils/index.d.ts
CHANGED
|
File without changes
|
package/lib/utils/index.d.ts.map
CHANGED
|
File without changes
|
package/lib/utils/index.js
CHANGED
|
File without changes
|