@cloudbase/framework-plugin-low-code 0.7.10-beta.2 → 0.7.11-beta.3
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/builder/core/generate.d.ts.map +1 -1
- package/lib/builder/core/generate.js +6 -6
- package/lib/builder/core/index.d.ts.map +1 -1
- package/lib/builder/service/builder/webpack.d.ts +1 -1
- package/lib/builder/service/builder/webpack.d.ts.map +1 -1
- package/lib/builder/service/builder/webpack.js +17 -28
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -73
- package/package.json +1 -1
- package/template/html/index.html.ejs +31 -19
- package/template/mp/app/weapps-api.js +27 -95
- package/template/mp/app.js +60 -76
- package/template/mp/common/util.js +3 -312
- package/template/mp/datasources/index.js +16 -5
- package/template/mp/package.json +2 -2
- package/template/package.json +1 -1
- package/template/src/app/global-api.js +41 -154
- package/template/src/datasources/index.js.tpl +14 -2
- package/template/src/handlers/FieldMiddleware/renderer.jsx +25 -85
- package/template/src/handlers/actionHandler/utils.js +10 -31
- package/template/src/handlers/lifecycle.js +10 -21
- package/template/src/handlers/render.jsx +6 -17
- package/template/src/handlers/utils/common.js +2 -6
- package/template/src/handlers/utils/widgets.js +8 -37
- package/template/src/index.jsx +3 -3
- package/template/src/pages/app.tpl +2 -0
- package/template/src/utils/formatEnum.js +1 -1
- package/template/src/utils/index.js +0 -14
- package/template/src/utils/ScanCodeComponent.js +0 -345
- package/template/src/utils/date.js +0 -324
- package/template/src/utils/scan-code-action.js +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/builder/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/builder/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgBnD,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,EAC3B,cAAc,kCAA2B,EACzC,YAAY,6BAAsB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,SAAS,EAAE,EAC1B,UAAU,EAAE,WAAW,EACvB,OAAO,qBAAwB,EAC/B,aAAa,qBAAQ,EACrB,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,MAAM,EAAE,MAAM,iBAuEf;AACD,wBAAsB,mBAAmB,CAAC,YAAY,oBAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAA,iBAM/F"}
|
|
@@ -42,12 +42,12 @@ function runGenerateCore(appBuildDir, appData, subAppDataList = [], dependencies
|
|
|
42
42
|
console.time(timeTag);
|
|
43
43
|
const allAppDataList = subAppDataList.concat(appData);
|
|
44
44
|
const deps = {};
|
|
45
|
-
allAppDataList.
|
|
45
|
+
allAppDataList.forEach((app) => {
|
|
46
46
|
Object.entries(app.npmDependencies).forEach(([name, version]) => {
|
|
47
47
|
deps[name] = version;
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
dependencies.
|
|
50
|
+
dependencies.forEach((compLb) => {
|
|
51
51
|
if (compLb.isComposite && compLb.compLibCommonResource) {
|
|
52
52
|
Object.assign(deps, compLb.compLibCommonResource.npm);
|
|
53
53
|
}
|
|
@@ -55,8 +55,8 @@ function runGenerateCore(appBuildDir, appData, subAppDataList = [], dependencies
|
|
|
55
55
|
yield Promise.all(allAppDataList.map((data) => __awaiter(this, void 0, void 0, function* () {
|
|
56
56
|
var _a;
|
|
57
57
|
const { pageInstanceList, rootPath = '' } = data;
|
|
58
|
-
const appName = rootPath ?
|
|
59
|
-
console.log(chalk_1.default.blue.bold(
|
|
58
|
+
const appName = rootPath ? `Sub app ${rootPath}` : 'Main app';
|
|
59
|
+
console.log(chalk_1.default.blue.bold(`Generating files for ${appName}`));
|
|
60
60
|
const dstDir = path_1.default.join(appBuildDir, 'src', rootPath ? `${rootPath}` : '');
|
|
61
61
|
yield copy(['app/mountMpApis.js', 'app/mountAppApis.js', 'datasources'], dstDir);
|
|
62
62
|
const tplStr = yield fs_extra_1.default.readFile(path_1.default.join(config_1.appTemplateDir, 'src/app/global-api.js'), {
|
|
@@ -65,7 +65,7 @@ function runGenerateCore(appBuildDir, appData, subAppDataList = [], dependencies
|
|
|
65
65
|
const globalApiContent = (0, lodash_template_1.default)(tplStr, { interpolate: /<%=([\s\S]+?)%>/g })({
|
|
66
66
|
appId: appKey,
|
|
67
67
|
subPackageName: rootPath,
|
|
68
|
-
domain
|
|
68
|
+
domain,
|
|
69
69
|
appConfig: (0, util_1.JsonToStringWithVariableName)({
|
|
70
70
|
id: appKey,
|
|
71
71
|
envId: appData.envId,
|
|
@@ -110,7 +110,7 @@ function generatePackageJSON(dependencies = {}, appBuildDir, appKey) {
|
|
|
110
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
const packageInfo = fs_extra_1.default.readJSONSync(path_1.default.join(config_1.appTemplateDir, 'package.json'));
|
|
112
112
|
packageInfo.dependencies = Object.assign(Object.assign({}, packageInfo.dependencies), dependencies);
|
|
113
|
-
packageInfo.name =
|
|
113
|
+
packageInfo.name = `WeDa-${appKey}`;
|
|
114
114
|
const dstFilePath = path_1.default.join(appBuildDir, 'package.json');
|
|
115
115
|
yield fs_extra_1.default.writeFile(dstFilePath, JSON.stringify(packageInfo, null, '\t'));
|
|
116
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/core/index.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/core/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAe,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAQnG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAInD,oBAAY,aAAa,GAAG;IAC1B,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,uBAAuB,CAAC,EAAE,UAAU,EAAE,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE;QACV,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,EAAE,GAAG,CAAC;KAChB,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,WAAW,CAC/B,EACE,oBAAoB,EACpB,uBAA4B,EAC5B,YAAY,EACZ,MAAe,EACf,eAAe,EACf,OAAsB,EACtB,aAAqB,EACrB,aAA+B,EAC/B,IAAiC,EACjC,UAAgC,EAChC,KAAa,EACb,cAAmC,EACnC,cAAmB,EACnB,cAAsB,EACtB,OAAY,EACZ,SAGC,EACD,cAAsB,EACtB,aAAyB,EACzB,MAAW,GACZ,EAAE,aAAa,GAAG;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,EACD,EAAE,CAAC,EAAE,oBAAoB,+BA0J1B;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -83,7 +83,7 @@ export interface IInstallOpts {
|
|
|
83
83
|
}
|
|
84
84
|
export declare function installDependencies(targetDir: string, options?: IInstallOpts): Promise<void>;
|
|
85
85
|
export declare function getMaterialNodeModulesPathList(dependencies: IMaterialItem[] | undefined, materialsDir: string): string[];
|
|
86
|
-
export declare function generateWebpackWebDevServerFile({ appBuildDir, buildTypeList
|
|
86
|
+
export declare function generateWebpackWebDevServerFile({ appBuildDir, buildTypeList }: {
|
|
87
87
|
appBuildDir: any;
|
|
88
88
|
buildTypeList: any;
|
|
89
89
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/webpack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/webpack.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAiB,kBAAkB,EAAE,OAAO,EAAkB,MAAM,sBAAsB,CAAC;AAKjH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAiC,MAAM,oBAAoB,CAAC;AAErH,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAOvD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA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M,CAAC;KACrB,CAAC;CACH;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,iBAyDtF;AAED,wBAAgB,8BAA8B,CAAC,YAAY,6BAAsB,EAAE,YAAY,EAAE,MAAM,YAUtG;AAGD,wBAAsB,+BAA+B,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE;;;CAAA,iBAanF;AAGD,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAkCvE"}
|
|
@@ -28,7 +28,6 @@ const plugin_1 = require("./plugin");
|
|
|
28
28
|
const command_exists_1 = require("command-exists");
|
|
29
29
|
const common_1 = require("../../util/common");
|
|
30
30
|
const common_2 = require("../../types/common");
|
|
31
|
-
const config_2 = require("../../config");
|
|
32
31
|
const console_1 = require("../../util/console");
|
|
33
32
|
const types_1 = require("../../../types");
|
|
34
33
|
const index_1 = require("../../../index");
|
|
@@ -42,7 +41,7 @@ function startCompile(options, cb) {
|
|
|
42
41
|
console.log(`Compiling ${options.configPath} already running`);
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
console.log(
|
|
44
|
+
console.log(`Running webpack by ${options.configPath}`);
|
|
46
45
|
(0, util_1.removeRequireUncached)(path_1.default.resolve(options.configPath, '../miniprogram.config.js'));
|
|
47
46
|
const watching = (0, webpack_1.default)((0, util_1.requireUncached)(options.configPath), (err, stats) => __awaiter(this, void 0, void 0, function* () {
|
|
48
47
|
if (err) {
|
|
@@ -319,10 +318,7 @@ function getWebpackWebBuildParams(appId, appBuildDir, materialsDir, dependencies
|
|
|
319
318
|
jsApis = jsApis.concat(assets);
|
|
320
319
|
}
|
|
321
320
|
}
|
|
322
|
-
const getPublicPath = () => buildTypeList.includes("app") ||
|
|
323
|
-
buildTypeList.includes("adminPortal")
|
|
324
|
-
? ''
|
|
325
|
-
: publicPath;
|
|
321
|
+
const getPublicPath = () => buildTypeList.includes("app") || buildTypeList.includes("adminPortal") ? '' : publicPath;
|
|
326
322
|
return {
|
|
327
323
|
context: appBuildDir,
|
|
328
324
|
mode: mode !== "production" ? 'development' : mode,
|
|
@@ -345,10 +341,14 @@ function getWebpackWebBuildParams(appId, appBuildDir, materialsDir, dependencies
|
|
|
345
341
|
isAdminPortal: buildTypeList.includes("adminPortal"),
|
|
346
342
|
},
|
|
347
343
|
externals: {
|
|
344
|
+
react: 'window.React',
|
|
345
|
+
'react-dom': 'window.ReactDOM',
|
|
348
346
|
mobx: 'window.mobx',
|
|
349
347
|
'@cloudbase/js-sdk': 'window.cloudbase',
|
|
350
348
|
'@cloudbase/weda-cloud-sdk/dist/h5': 'window.CloudSDK',
|
|
349
|
+
'@cloudbase/weda-cloud-sdk': 'window.CloudSDK',
|
|
351
350
|
'@zxing/library': 'window.ZXing',
|
|
351
|
+
'@cloudbase/weda-client': 'window.WedaClientSDK',
|
|
352
352
|
},
|
|
353
353
|
resolveModules: [
|
|
354
354
|
path_1.default.resolve(appBuildDir, 'node_modules'),
|
|
@@ -400,9 +400,7 @@ function getAllPageMpEntryPath(allAppDataList, appBuildDir, options = { generate
|
|
|
400
400
|
const { pageInstanceList, rootPath } = app;
|
|
401
401
|
const packagePathStr = rootPath ? `packages/${rootPath}` : '';
|
|
402
402
|
(0, weapps_core_1.loopDealWithFn)(pageInstanceList, (pageInstance) => {
|
|
403
|
-
const pageName = rootPath
|
|
404
|
-
? `${rootPath}_${pageInstance.id}`
|
|
405
|
-
: pageInstance.id;
|
|
403
|
+
const pageName = rootPath ? `${rootPath}_${pageInstance.id}` : pageInstance.id;
|
|
406
404
|
entry[pageName] = path_1.default.resolve(appBuildDir, path_1.default.join('src', packagePathStr, `pages/${getPageName(pageInstance.id)}/main.mp.jsx`));
|
|
407
405
|
});
|
|
408
406
|
});
|
|
@@ -426,9 +424,7 @@ function downloadAndInstallDependencies(dependencies = [], materialsDir, install
|
|
|
426
424
|
}
|
|
427
425
|
const matched = srcZipUrl.match(/\/(cg-.*?)\//);
|
|
428
426
|
const { appBuildDir } = (0, index_2.getCompileDirs)('app');
|
|
429
|
-
if (matched &&
|
|
430
|
-
matched[1] &&
|
|
431
|
-
fs_extra_1.default.existsSync(path_1.default.resolve(appBuildDir, `.component_cache/web/${matched[1]}@${version}`))) {
|
|
427
|
+
if ((matched === null || matched === void 0 ? void 0 : matched[1]) && fs_extra_1.default.existsSync(path_1.default.resolve(appBuildDir, `.component_cache/web/${matched[1]}@${version}`))) {
|
|
432
428
|
console.log(`link ${name}@${version} ...`);
|
|
433
429
|
yield fs_extra_1.default.symlink(path_1.default.resolve(appBuildDir, `.component_cache/web/${matched[1]}@${version}`), targetDir, 'dir');
|
|
434
430
|
}
|
|
@@ -437,8 +433,7 @@ function downloadAndInstallDependencies(dependencies = [], materialsDir, install
|
|
|
437
433
|
yield downloadDependencies(targetDir, srcZipUrl);
|
|
438
434
|
}
|
|
439
435
|
console.log(`处理${name}@${version}依赖 ...`);
|
|
440
|
-
yield installDependencies(targetDir, Object.assign(Object.assign({}, installOptions), { ignoreInstall: (0, common_1.isOfficialComponentLib)(name, version) ||
|
|
441
|
-
(installOptions === null || installOptions === void 0 ? void 0 : installOptions.ignoreInstall), dependenceMeta: {
|
|
436
|
+
yield installDependencies(targetDir, Object.assign(Object.assign({}, installOptions), { ignoreInstall: (0, common_1.isOfficialComponentLib)(name, version) || (installOptions === null || installOptions === void 0 ? void 0 : installOptions.ignoreInstall), dependenceMeta: {
|
|
442
437
|
name,
|
|
443
438
|
version,
|
|
444
439
|
downloadUrl: srcZipUrl,
|
|
@@ -466,7 +461,7 @@ function downloadDependencies(targetDir, srcZipUrl) {
|
|
|
466
461
|
console.timeEnd(tag);
|
|
467
462
|
}
|
|
468
463
|
catch (e) {
|
|
469
|
-
console.error(
|
|
464
|
+
console.error(`Fail to download weapps material package ${srcZipUrl}`, e);
|
|
470
465
|
throw e;
|
|
471
466
|
}
|
|
472
467
|
});
|
|
@@ -474,25 +469,19 @@ function downloadDependencies(targetDir, srcZipUrl) {
|
|
|
474
469
|
exports.downloadDependencies = downloadDependencies;
|
|
475
470
|
function installDependencies(targetDir, options = {}) {
|
|
476
471
|
return __awaiter(this, void 0, void 0, function* () {
|
|
477
|
-
if ((options === null || options === void 0 ? void 0 : options.ignoreInstall) &&
|
|
478
|
-
|
|
479
|
-
console.log('ignore install dependencies in ' + targetDir);
|
|
472
|
+
if ((options === null || options === void 0 ? void 0 : options.ignoreInstall) && fs_extra_1.default.existsSync(path_1.default.join(targetDir, 'node_modules'))) {
|
|
473
|
+
console.log(`ignore install dependencies in ${targetDir}`);
|
|
480
474
|
return;
|
|
481
475
|
}
|
|
482
476
|
let packageName = options.packageName || '';
|
|
483
477
|
if (packageName && options.latest) {
|
|
484
478
|
packageName = `${packageName}@latest`;
|
|
485
479
|
}
|
|
486
|
-
console.log(
|
|
480
|
+
console.log(`Installing dependencies in ${targetDir}`);
|
|
487
481
|
const operationTag = '---------------- Install npm dependencies';
|
|
488
482
|
console.time(operationTag);
|
|
489
483
|
const registry = `--registry=${config_1.npmRegistry}`;
|
|
490
|
-
const npmOptions = [
|
|
491
|
-
'--prefer-offline',
|
|
492
|
-
'--no-audit',
|
|
493
|
-
'--progress=false',
|
|
494
|
-
registry,
|
|
495
|
-
];
|
|
484
|
+
const npmOptions = ['--prefer-offline', '--no-audit', '--progress=false', registry];
|
|
496
485
|
if (options === null || options === void 0 ? void 0 : options.dependenceMeta) {
|
|
497
486
|
npmOptions.push('--production');
|
|
498
487
|
const { name, version } = options.dependenceMeta;
|
|
@@ -538,10 +527,10 @@ function getMaterialNodeModulesPathList(dependencies = [], materialsDir) {
|
|
|
538
527
|
});
|
|
539
528
|
}
|
|
540
529
|
exports.getMaterialNodeModulesPathList = getMaterialNodeModulesPathList;
|
|
541
|
-
function generateWebpackWebDevServerFile({ appBuildDir, buildTypeList
|
|
530
|
+
function generateWebpackWebDevServerFile({ appBuildDir, buildTypeList }) {
|
|
542
531
|
return __awaiter(this, void 0, void 0, function* () {
|
|
543
532
|
const dest = path_1.default.resolve(appBuildDir, `./webpack/devServer.js`);
|
|
544
|
-
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(
|
|
533
|
+
const template = yield fs_extra_1.default.readFile(path_1.default.resolve(config_1.appTemplateDir, './webpack/devServer.js'), {
|
|
545
534
|
encoding: 'utf8',
|
|
546
535
|
});
|
|
547
536
|
const jsContent = (0, lodash_template_1.default)(template, {
|
|
@@ -566,7 +555,7 @@ function downloadAssets(targetDir, assetUrl) {
|
|
|
566
555
|
responseType: 'stream',
|
|
567
556
|
}));
|
|
568
557
|
if (err) {
|
|
569
|
-
console.error(
|
|
558
|
+
console.error(`Fail to download weapps material package ${assetUrl}`, err);
|
|
570
559
|
throw err;
|
|
571
560
|
}
|
|
572
561
|
yield fs_extra_1.default.ensureDir(targetDir);
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAOrE,OAAO,EACL,SAAS,EAET,cAAc,EAIf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAE7D,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAKpD,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,2BAA2B,IAAK,CAAC;AAiB9C,QAAA,M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KAAK,KAAA,EAAE,KAAK,UAAQ;IAgBxC,eAAe,CAAC,KAAK,KAAA,EAAE,KAAK,UAAQ;IAqB1C,eAAe,CAAC,OAAO,KAAA;IAIjB,gBAAgB;IA8GhB,2BAA2B;IA6D3B,UAAU;IAoBV,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;IAejB,uBAAuB;IAoBvB,yBAAyB;IA0F/B,oBAAoB;CAKrB;AA4BD,eAAO,MAAM,MAAM,sBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -102,9 +102,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
102
102
|
this._timeMap = {};
|
|
103
103
|
this._domain = [];
|
|
104
104
|
let inputJSONPath = path_1.default.resolve(this.api.projectPath, inputs._inputFile || DEFAULT_INPUTS._inputFile);
|
|
105
|
-
let params = fs_extra_1.default.existsSync(inputJSONPath)
|
|
106
|
-
? fs_extra_1.default.readJsonSync(inputJSONPath)
|
|
107
|
-
: {};
|
|
105
|
+
let params = fs_extra_1.default.existsSync(inputJSONPath) ? fs_extra_1.default.readJsonSync(inputJSONPath) : {};
|
|
108
106
|
this._resolvedInputs = resolveInputs(inputs, resolveInputs(params, DEFAULT_INPUTS));
|
|
109
107
|
this._appPath = '';
|
|
110
108
|
this._productBasePath = `lca/${this._resolvedInputs.appId}/${process.env.CLOUDBASE_CIID ? `/${process.env.CLOUDBASE_CIID}` : ''}`;
|
|
@@ -150,8 +148,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
150
148
|
if (this._resolvedInputs.buildTypeList.includes("app") ||
|
|
151
149
|
this._resolvedInputs.buildTypeList.includes("xPagePC") ||
|
|
152
150
|
this._resolvedInputs.buildTypeList.includes("adminPortal")) {
|
|
153
|
-
this._resolvedInputs.mainAppSerializeData.historyType =
|
|
154
|
-
types_1.HISTORY_TYPE.HASH;
|
|
151
|
+
this._resolvedInputs.mainAppSerializeData.historyType = types_1.HISTORY_TYPE.HASH;
|
|
155
152
|
}
|
|
156
153
|
}
|
|
157
154
|
else {
|
|
@@ -168,9 +165,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
168
165
|
let path = this._getWebRootPath();
|
|
169
166
|
window.publicPath = path;
|
|
170
167
|
window.basename = (0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
|
|
171
|
-
? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !== types_1.DEPLOY_MODE.UPLOAD
|
|
172
|
-
? '-preview'
|
|
173
|
-
: ''}`
|
|
168
|
+
? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !== types_1.DEPLOY_MODE.UPLOAD ? '-preview' : ''}`
|
|
174
169
|
: (0, common_2.buildAsXPageByBuildType)(this._resolvedInputs.buildTypeList)
|
|
175
170
|
? '/'
|
|
176
171
|
: path;
|
|
@@ -182,7 +177,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
182
177
|
}
|
|
183
178
|
}
|
|
184
179
|
else {
|
|
185
|
-
const { mpAppId, mpDeployPrivateKey, deployOptions
|
|
180
|
+
const { mpAppId, mpDeployPrivateKey, deployOptions } = this._resolvedInputs;
|
|
186
181
|
if (deployOptions.mpAppId === undefined) {
|
|
187
182
|
deployOptions.mpAppId = mpAppId;
|
|
188
183
|
}
|
|
@@ -240,9 +235,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
240
235
|
privateKeyPath: `./private.${deployOptions.mpAppId}.key`,
|
|
241
236
|
localPath: exports.DIST_PATH,
|
|
242
237
|
ignores: ['node_modules/**/*', LOG_FILE].concat(cloudfunctionRoot ? [path_1.default.join(cloudfunctionRoot, '**/*')] : []),
|
|
243
|
-
deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId
|
|
244
|
-
? deployOptions.mode
|
|
245
|
-
: types_1.DEPLOY_MODE.UPLOAD,
|
|
238
|
+
deployMode: deployOptions.mpAppId === deployOptions.targetMpAppId ? deployOptions.mode : types_1.DEPLOY_MODE.UPLOAD,
|
|
246
239
|
uploadOptions: {
|
|
247
240
|
version: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.version) || '1.0.0',
|
|
248
241
|
desc: (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.description) || '',
|
|
@@ -259,22 +252,13 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
259
252
|
this._webPlugin = new framework_plugin_website_1.plugin('web', this.api, {
|
|
260
253
|
outputPath: exports.DIST_PATH,
|
|
261
254
|
cloudPath: this._getWebRootPath(),
|
|
262
|
-
ignore: [
|
|
263
|
-
'.git',
|
|
264
|
-
'.github',
|
|
265
|
-
'node_modules',
|
|
266
|
-
'cloudbaserc.js',
|
|
267
|
-
LOG_FILE,
|
|
268
|
-
DEFAULT_CLOUDFUNCTION_ROOT_NAME,
|
|
269
|
-
],
|
|
255
|
+
ignore: ['.git', '.github', 'node_modules', 'cloudbaserc.js', LOG_FILE, DEFAULT_CLOUDFUNCTION_ROOT_NAME],
|
|
270
256
|
});
|
|
271
257
|
}
|
|
272
258
|
}
|
|
273
259
|
_getWebRootPath() {
|
|
274
260
|
let { appId, deployOptions } = this._resolvedInputs;
|
|
275
|
-
return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW
|
|
276
|
-
? `/${appId}/preview/`
|
|
277
|
-
: `/${appId}/production/`;
|
|
261
|
+
return (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW ? `/${appId}/preview/` : `/${appId}/production/`;
|
|
278
262
|
}
|
|
279
263
|
_time(label) {
|
|
280
264
|
if (!this._timeMap[label]) {
|
|
@@ -311,9 +295,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
311
295
|
: "";
|
|
312
296
|
subAppSerializeDataList = subAppSerializeDataList === null || subAppSerializeDataList === void 0 ? void 0 : subAppSerializeDataList.map((item) => {
|
|
313
297
|
if (this._checkIsVersion(calsVersion)) {
|
|
314
|
-
return item.mpPkgUrl
|
|
315
|
-
? (0, common_1.processPkgUrlCals2WeappData)(item)
|
|
316
|
-
: (0, cals_1.deserializePlatformApp)(item, { dependencies });
|
|
298
|
+
return item.mpPkgUrl ? (0, common_1.processPkgUrlCals2WeappData)(item) : (0, cals_1.deserializePlatformApp)(item, { dependencies });
|
|
317
299
|
}
|
|
318
300
|
return item;
|
|
319
301
|
});
|
|
@@ -341,14 +323,11 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
341
323
|
let { window = {} } = appConfig;
|
|
342
324
|
if ((0, common_2.buildAsXPageByBuildType)(buildTypeList)) {
|
|
343
325
|
window.publicPath =
|
|
344
|
-
((_d = this._resolvedInputs.deployOptions) === null || _d === void 0 ? void 0 : _d.publicPath) ||
|
|
345
|
-
`https://${domain}${this._getWebRootPath()}`;
|
|
326
|
+
((_d = this._resolvedInputs.deployOptions) === null || _d === void 0 ? void 0 : _d.publicPath) || `https://${domain}${this._getWebRootPath()}`;
|
|
346
327
|
}
|
|
347
328
|
else if (this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD) {
|
|
348
329
|
try {
|
|
349
|
-
const { Data = {} } = yield this.api.cloudbaseManager
|
|
350
|
-
.commonService('lowcode', '2021-01-08')
|
|
351
|
-
.call({
|
|
330
|
+
const { Data = {} } = yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
|
|
352
331
|
Action: 'DescribeAppCustomUrls',
|
|
353
332
|
Param: {
|
|
354
333
|
EnvId: this.api.envId,
|
|
@@ -402,8 +381,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
402
381
|
isCleanDistDir: false,
|
|
403
382
|
plugins,
|
|
404
383
|
extraData,
|
|
405
|
-
isCrossAccount: this._resolvedInputs.mpAppId !==
|
|
406
|
-
((_b = this._resolvedInputs.deployOptions) === null || _b === void 0 ? void 0 : _b.targetMpAppId),
|
|
384
|
+
isCrossAccount: this._resolvedInputs.mpAppId !== ((_b = this._resolvedInputs.deployOptions) === null || _b === void 0 ? void 0 : _b.targetMpAppId),
|
|
407
385
|
resourceAppid: this._resolvedInputs.mpAppId,
|
|
408
386
|
domain,
|
|
409
387
|
}, (err, result) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -534,9 +512,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
534
512
|
this._time("compile");
|
|
535
513
|
let res = {};
|
|
536
514
|
try {
|
|
537
|
-
yield this.api.cloudbaseManager
|
|
538
|
-
.commonService('lowcode', '2021-01-08')
|
|
539
|
-
.call({
|
|
515
|
+
yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
|
|
540
516
|
Action: 'UpdateLoginConfig',
|
|
541
517
|
Param: { EnvId: this.api.envId },
|
|
542
518
|
});
|
|
@@ -548,16 +524,14 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
548
524
|
if (this._miniprogramePlugin) {
|
|
549
525
|
res = (0, lodash_1.merge)(res, yield this._miniprogramePlugin.compile());
|
|
550
526
|
}
|
|
551
|
-
else if ((0, common_2.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList) &&
|
|
552
|
-
this._webPlugin) {
|
|
527
|
+
else if ((0, common_2.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList) && this._webPlugin) {
|
|
553
528
|
try {
|
|
554
529
|
const HostingProvider = (_a = this.api.resourceProviders) === null || _a === void 0 ? void 0 : _a.hosting;
|
|
555
530
|
const { envId } = this.api;
|
|
556
531
|
let [website, hostingDatas] = yield this._getHostingInfoTask(envId, false);
|
|
557
532
|
if (HostingProvider) {
|
|
558
533
|
if (!hostingDatas) {
|
|
559
|
-
hostingDatas = (yield HostingProvider.getHostingInfo({ envId }))
|
|
560
|
-
.data;
|
|
534
|
+
hostingDatas = (yield HostingProvider.getHostingInfo({ envId })).data;
|
|
561
535
|
}
|
|
562
536
|
let domains = hostingDatas.map((item) => item.cdnDomain);
|
|
563
537
|
this._domain = domains;
|
|
@@ -596,8 +570,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
596
570
|
ignore: this._webPlugin.resolvedInputs.ignore,
|
|
597
571
|
})));
|
|
598
572
|
}
|
|
599
|
-
if (!Object.keys(res.Resources || {}).length &&
|
|
600
|
-
!Object.keys(res.Config || {}).length) {
|
|
573
|
+
if (!Object.keys(res.Resources || {}).length && !Object.keys(res.Config || {}).length) {
|
|
601
574
|
this._skipInstallExt = true;
|
|
602
575
|
}
|
|
603
576
|
this.api.logger.info(`compile end, cost ${this._timeEnd("compile")}s: `, res);
|
|
@@ -631,16 +604,12 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
631
604
|
yield this._postProcessWebsiteConfig();
|
|
632
605
|
}
|
|
633
606
|
try {
|
|
634
|
-
let publishAppCustomNavRes = yield this.api.cloudbaseManager
|
|
635
|
-
.commonService('lowcode', '2021-01-08')
|
|
636
|
-
.call({
|
|
607
|
+
let publishAppCustomNavRes = yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
|
|
637
608
|
Action: 'PublishAppCustomNav',
|
|
638
609
|
Param: {
|
|
639
610
|
WeAppId: this._resolvedInputs.appId,
|
|
640
611
|
EnvId: this.api.envId,
|
|
641
|
-
PublishType: this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD
|
|
642
|
-
? 'product'
|
|
643
|
-
: 'preview',
|
|
612
|
+
PublishType: this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD ? 'product' : 'preview',
|
|
644
613
|
},
|
|
645
614
|
});
|
|
646
615
|
this.api.logger.info(`${this.api.emoji('🚀')} custom publish success: ${JSON.stringify(publishAppCustomNavRes)}`);
|
|
@@ -658,8 +627,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
658
627
|
? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preview' : 'prod'}`
|
|
659
628
|
: this._gatewayConfig
|
|
660
629
|
? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
|
|
661
|
-
: `https://${this._website.cdnDomain +
|
|
662
|
-
this._webPlugin.resolvedInputs.cloudPath}`;
|
|
630
|
+
: `https://${this._website.cdnDomain + this._webPlugin.resolvedInputs.cloudPath}`;
|
|
663
631
|
const qrcodeOutputPath = path_1.default.resolve(this.api.projectPath, QRCODE_PATH);
|
|
664
632
|
yield qrcode_1.default.toFile(path_1.default.resolve(this.api.projectPath, QRCODE_PATH), link, {
|
|
665
633
|
errorCorrectionLevel: 'M',
|
|
@@ -720,22 +688,12 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
720
688
|
});
|
|
721
689
|
const analyseRes = yield mpci.analyseCode(project);
|
|
722
690
|
if (analyseRes) {
|
|
723
|
-
const codeExtensions = new Set([
|
|
724
|
-
'.wxml',
|
|
725
|
-
'.wxss',
|
|
726
|
-
'.wxs',
|
|
727
|
-
'.js',
|
|
728
|
-
'.json',
|
|
729
|
-
'.json',
|
|
730
|
-
'.ts',
|
|
731
|
-
]);
|
|
691
|
+
const codeExtensions = new Set(['.wxml', '.wxss', '.wxs', '.js', '.json', '.json', '.ts']);
|
|
732
692
|
const { files } = analyseRes;
|
|
733
693
|
const filesToDelete = files
|
|
734
694
|
.filter((f) => {
|
|
735
695
|
var _a, _b;
|
|
736
|
-
if (codeExtensions.has(f.ext) &&
|
|
737
|
-
!f.moduleId &&
|
|
738
|
-
((_b = (_a = f.path) === null || _a === void 0 ? void 0 : _a.startsWith) === null || _b === void 0 ? void 0 : _b.call(_a, 'materials/'))) {
|
|
696
|
+
if (codeExtensions.has(f.ext) && !f.moduleId && ((_b = (_a = f.path) === null || _a === void 0 ? void 0 : _a.startsWith) === null || _b === void 0 ? void 0 : _b.call(_a, 'materials/'))) {
|
|
739
697
|
return true;
|
|
740
698
|
}
|
|
741
699
|
return false;
|
|
@@ -867,8 +825,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
867
825
|
});
|
|
868
826
|
});
|
|
869
827
|
}
|
|
870
|
-
if (fs_extra_1.default.existsSync(path_1.default.resolve(this.api.projectPath, DEBUG_PATH)) &&
|
|
871
|
-
this._resolvedInputs.debug) {
|
|
828
|
+
if (fs_extra_1.default.existsSync(path_1.default.resolve(this.api.projectPath, DEBUG_PATH)) && this._resolvedInputs.debug) {
|
|
872
829
|
const zipPath = path_1.default.resolve(this.api.projectPath, `debug.zip`);
|
|
873
830
|
yield this._zipDir(path_1.default.resolve(this.api.projectPath, DEBUG_PATH), zipPath);
|
|
874
831
|
yield new Promise((resolve, reject) => {
|
|
@@ -978,13 +935,11 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
978
935
|
_postProcessAdminPortal() {
|
|
979
936
|
var _a, _b;
|
|
980
937
|
return __awaiter(this, void 0, void 0, function* () {
|
|
981
|
-
const { appId, buildTypeList, mainAppSerializeData, deployOptions
|
|
938
|
+
const { appId, buildTypeList, mainAppSerializeData, deployOptions } = this._resolvedInputs;
|
|
982
939
|
if ((0, common_2.buildAsAdminPortalByBuildType)(buildTypeList)) {
|
|
983
940
|
try {
|
|
984
941
|
if (((_b = (_a = this._resolvedInputs) === null || _a === void 0 ? void 0 : _a.deployOptions) === null || _b === void 0 ? void 0 : _b.mode) === types_1.DEPLOY_MODE.UPLOAD) {
|
|
985
|
-
yield this.api.cloudbaseManager
|
|
986
|
-
.commonService('lowcode', '2021-01-08')
|
|
987
|
-
.call({
|
|
942
|
+
yield this.api.cloudbaseManager.commonService('lowcode', '2021-01-08').call({
|
|
988
943
|
Action: 'PublishAppCustomUrl',
|
|
989
944
|
Param: {
|
|
990
945
|
EnvId: this.api.envId,
|
|
@@ -1019,8 +974,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
1019
974
|
let meta = {};
|
|
1020
975
|
let { Condition, Redirect } = rule;
|
|
1021
976
|
if (Condition.HttpErrorCodeReturnedEquals) {
|
|
1022
|
-
meta.httpErrorCodeReturnedEquals =
|
|
1023
|
-
Condition.HttpErrorCodeReturnedEquals;
|
|
977
|
+
meta.httpErrorCodeReturnedEquals = Condition.HttpErrorCodeReturnedEquals;
|
|
1024
978
|
}
|
|
1025
979
|
if (Condition.KeyPrefixEquals) {
|
|
1026
980
|
meta.keyPrefixEquals = Condition.KeyPrefixEquals;
|
|
@@ -1090,9 +1044,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
1090
1044
|
}
|
|
1091
1045
|
_checkBroswerHisroty() {
|
|
1092
1046
|
var _a;
|
|
1093
|
-
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType)
|
|
1094
|
-
? types_1.HISTORY_TYPE.HASH
|
|
1095
|
-
: '';
|
|
1047
|
+
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType) ? types_1.HISTORY_TYPE.HASH : '';
|
|
1096
1048
|
return !historyType || historyType === types_1.HISTORY_TYPE.BROWSER;
|
|
1097
1049
|
}
|
|
1098
1050
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.11-beta.3",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -65,8 +65,7 @@
|
|
|
65
65
|
body {
|
|
66
66
|
margin: 0;
|
|
67
67
|
font-size: 14px;
|
|
68
|
-
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi,
|
|
69
|
-
Arial, sans-serif;
|
|
68
|
+
font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
|
|
70
69
|
line-height: 1.5;
|
|
71
70
|
color: #333;
|
|
72
71
|
background-color: #fff;
|
|
@@ -418,31 +417,42 @@
|
|
|
418
417
|
.catch(function (e) {
|
|
419
418
|
try {
|
|
420
419
|
_aegis.report({
|
|
421
|
-
msg:
|
|
422
|
-
'[' +
|
|
423
|
-
name +
|
|
424
|
-
':' +
|
|
425
|
-
data.methodName +
|
|
426
|
-
']: ' +
|
|
427
|
-
(e.message || '函数调用失败'),
|
|
420
|
+
msg: '[' + name + ':' + data.methodName + ']: ' + (res.result.message || '函数调用失败'),
|
|
428
421
|
level: '16',
|
|
429
422
|
ext2: e.code,
|
|
430
423
|
ext3: e.requestId,
|
|
431
424
|
trace: 'trace',
|
|
432
425
|
});
|
|
433
|
-
}
|
|
434
|
-
|
|
426
|
+
}
|
|
427
|
+
} catch (e) { }
|
|
428
|
+
return res;
|
|
429
|
+
})
|
|
430
|
+
.catch (function (e) {
|
|
431
|
+
try {
|
|
432
|
+
_aegis.report({
|
|
433
|
+
msg: '[' + name + ':' + data.methodName + ']: ' + (e.message || '函数调用失败'),
|
|
434
|
+
level: '16',
|
|
435
|
+
ext2: e.code,
|
|
436
|
+
ext3: e.requestId,
|
|
437
|
+
trace: 'trace',
|
|
435
438
|
});
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
439
|
+
} catch (e) { }
|
|
440
|
+
throw e;
|
|
441
|
+
});
|
|
442
|
+
} else {
|
|
443
|
+
return promise;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
441
447
|
</script>
|
|
442
|
-
<script
|
|
448
|
+
<script crossorigin
|
|
449
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react@16.14.0/umd/react.production.min.js"></script>
|
|
450
|
+
<script crossorigin
|
|
451
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react-dom@16.14.0/umd/react-dom.production.min.js"></script>
|
|
452
|
+
<script src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
|
|
443
453
|
crossorigin="anonymous"></script>
|
|
444
454
|
<script crossorigin="anonymous"
|
|
445
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.10/dist/h5.browser.js
|
|
455
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.10/dist/h5.browser.js"></script>
|
|
446
456
|
<script>
|
|
447
457
|
// zxing polifill
|
|
448
458
|
if (!this.globalThis) {
|
|
@@ -450,7 +460,9 @@
|
|
|
450
460
|
}
|
|
451
461
|
</script>
|
|
452
462
|
<script crossorigin="anonymous"
|
|
453
|
-
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js
|
|
463
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"></script>
|
|
464
|
+
<script crossorigin="anonymous"
|
|
465
|
+
src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-client@0.2.8/dist/web.browser.js"></script>
|
|
454
466
|
</body>
|
|
455
467
|
|
|
456
468
|
</html>
|