@cloudbase/framework-plugin-low-code 0.6.52 → 0.6.55
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/config/common.js +1 -1
- package/lib/builder/config/index.js +2 -2
- package/lib/builder/config/mp.js +1 -1
- package/lib/builder/core/copy.js +3 -3
- package/lib/builder/core/generate.js +11 -11
- package/lib/builder/core/index.js +13 -13
- package/lib/builder/core/material.js +6 -6
- package/lib/builder/core/plugin.js +3 -3
- package/lib/builder/core/prepare.js +2 -2
- package/lib/builder/core/webpack.js +5 -5
- package/lib/builder/mp/index.js +47 -47
- package/lib/builder/mp/lowcode.js +4 -4
- package/lib/builder/mp/materials.js +16 -16
- package/lib/builder/mp/mixMode.js +12 -12
- package/lib/builder/mp/mp_config.js +11 -11
- package/lib/builder/mp/util.js +6 -6
- package/lib/builder/mp/wxml.js +4 -4
- package/lib/builder/service/builder/copy.js +11 -11
- package/lib/builder/service/builder/generate.js +56 -52
- package/lib/builder/service/builder/index.js +2 -2
- package/lib/builder/service/builder/plugin.js +2 -2
- package/lib/builder/service/builder/webpack.js +24 -23
- package/lib/builder/types/common.js +1 -0
- package/lib/builder/util/common.js +8 -6
- package/lib/builder/util/console.js +1 -1
- package/lib/builder/util/generateFiles.js +2 -2
- package/lib/builder/util/index.js +1 -1
- package/lib/builder/util/junk.js +4 -2
- package/lib/builder/util/mp.js +1 -1
- package/lib/builder/util/net.js +1 -1
- package/lib/builder/util/style.js +1 -1
- package/lib/builder/util/weapp.js +1 -1
- package/lib/generate.js +2 -2
- package/lib/generator/config/index.js +2 -2
- package/lib/generator/core/generate.js +36 -34
- package/lib/generator/core/index.js +4 -4
- package/lib/generator/core/material.js +14 -14
- package/lib/generator/types/common.js +6 -3
- package/lib/generator/util/index.js +1 -1
- package/lib/generator/util/style.js +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +81 -76
- package/lib/utils/common.d.ts +1 -1
- package/lib/utils/common.d.ts.map +1 -1
- package/lib/utils/common.js +2 -2
- package/lib/utils/dataSource.js +2 -2
- package/lib/utils/index.js +1 -1
- package/lib/utils/postProcess.js +3 -3
- package/lib/weapps-core/config/index.js +1 -1
- package/lib/weapps-core/index.js +2 -2
- package/lib/weapps-core/types/index.js +1 -1
- package/lib/weapps-core/utils/appbuild.js +6 -3
- package/lib/weapps-core/utils/common.js +3 -2
- package/lib/weapps-core/utils/file.d.ts +1 -1
- package/lib/weapps-core/utils/formily.js +37 -37
- package/lib/weapps-core/utils/index.js +1 -1
- package/lib/weapps-core/utils/style.js +15 -15
- package/package.json +1 -1
- package/template/html/index.html.ejs +8 -2
- package/template/mp/app/weapps-api.js +9 -0
- package/template/mp/common/weapp-page.js +11 -0
- package/template/mp/common/weapp-sdk.js +35 -0
- package/template/src/app/global-api.js +3 -0
- package/template/webpack/web.prod.js +6 -2
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -42,7 +42,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
42
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.plugin = exports.PERSISTENT_DEPENDIENCES_MAP = exports.DIST_PATH = void 0;
|
|
45
|
+
exports.plugin = exports.PERSISTENT_DEPENDIENCES_MAP = exports.DIST_PATH = exports.generator = void 0;
|
|
46
46
|
exports.generator = __importStar(require("./generator/core/index"));
|
|
47
47
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
48
48
|
const path_1 = __importDefault(require("path"));
|
|
@@ -122,7 +122,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
122
122
|
if (this._checkIsVersion(this._resolvedInputs.calsVersion)) {
|
|
123
123
|
const cals = this._resolvedInputs.mainAppSerializeData;
|
|
124
124
|
if (!this._resolvedInputs.mainAppSerializeData.mpPkgUrl) {
|
|
125
|
-
this._resolvedInputs.mainAppSerializeData = cals_1.deserializePlatformApp(cals, { dependencies: this._resolvedInputs.dependencies });
|
|
125
|
+
this._resolvedInputs.mainAppSerializeData = (0, cals_1.deserializePlatformApp)(cals, { dependencies: this._resolvedInputs.dependencies });
|
|
126
126
|
if ((_a = cals.extra) === null || _a === void 0 ? void 0 : _a.miniprogramPlugins) {
|
|
127
127
|
this._resolvedInputs.mainAppSerializeData.miniprogramPlugins = cals.extra.miniprogramPlugins.map((plugin) => {
|
|
128
128
|
var _a;
|
|
@@ -152,23 +152,23 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
|
-
this._resolvedInputs.mainAppSerializeData = common_1.processPkgUrlCals2WeappData(cals);
|
|
155
|
+
this._resolvedInputs.mainAppSerializeData = (0, common_1.processPkgUrlCals2WeappData)(cals);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
if (!((_b = this._resolvedInputs.mainAppSerializeData) === null || _b === void 0 ? void 0 : _b.envId)) {
|
|
159
159
|
this._resolvedInputs.mainAppSerializeData.envId = envId;
|
|
160
160
|
}
|
|
161
|
-
if (common_2.buildAsWebByBuildType(this._resolvedInputs.buildTypeList)) {
|
|
161
|
+
if ((0, common_2.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList)) {
|
|
162
162
|
const { appId, mainAppSerializeData } = this._resolvedInputs;
|
|
163
163
|
let { appConfig = {} } = mainAppSerializeData;
|
|
164
164
|
let { window = {} } = appConfig;
|
|
165
165
|
let path = this._getWebRootPath();
|
|
166
166
|
window.publicPath = path;
|
|
167
|
-
window.basename = common_2.buildAsAdminPortalByBuildType(this._resolvedInputs.buildTypeList)
|
|
167
|
+
window.basename = (0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
|
|
168
168
|
? `app/${appId}${((_c = this._resolvedInputs.deployOptions) === null || _c === void 0 ? void 0 : _c.mode) !== types_1.DEPLOY_MODE.UPLOAD
|
|
169
169
|
? '-preview'
|
|
170
170
|
: ''}`
|
|
171
|
-
: common_2.buildAsXPageByBuildType(this._resolvedInputs.buildTypeList)
|
|
171
|
+
: (0, common_2.buildAsXPageByBuildType)(this._resolvedInputs.buildTypeList)
|
|
172
172
|
? '/'
|
|
173
173
|
: path;
|
|
174
174
|
appConfig.window = window;
|
|
@@ -252,7 +252,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
252
252
|
},
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
else if (common_2.buildAsWebByBuildType(buildTypeList)) {
|
|
255
|
+
else if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
|
|
256
256
|
this._webPlugin = new framework_plugin_website_1.plugin('web', this.api, {
|
|
257
257
|
outputPath: exports.DIST_PATH,
|
|
258
258
|
cloudPath: this._getWebRootPath(),
|
|
@@ -309,12 +309,12 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
309
309
|
subAppSerializeDataList = subAppSerializeDataList === null || subAppSerializeDataList === void 0 ? void 0 : subAppSerializeDataList.map((item) => {
|
|
310
310
|
if (this._checkIsVersion(calsVersion)) {
|
|
311
311
|
return item.mpPkgUrl
|
|
312
|
-
? common_1.processPkgUrlCals2WeappData(item)
|
|
313
|
-
: cals_1.deserializePlatformApp(item, { dependencies });
|
|
312
|
+
? (0, common_1.processPkgUrlCals2WeappData)(item)
|
|
313
|
+
: (0, cals_1.deserializePlatformApp)(item, { dependencies });
|
|
314
314
|
}
|
|
315
315
|
return item;
|
|
316
316
|
});
|
|
317
|
-
const nodeModulesPath = common_1.getValidNodeModulesPath();
|
|
317
|
+
const nodeModulesPath = (0, common_1.getValidNodeModulesPath)();
|
|
318
318
|
let miniAppDir = '';
|
|
319
319
|
let webAppDir = '';
|
|
320
320
|
const h5url = `./${appId}/index.html`;
|
|
@@ -333,10 +333,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
333
333
|
throw e;
|
|
334
334
|
}
|
|
335
335
|
const domain = ((_b = this._website) === null || _b === void 0 ? void 0 : _b.cdnDomain) || ((_c = mainAppSerializeData.extra) === null || _c === void 0 ? void 0 : _c.domain);
|
|
336
|
-
if (common_2.buildAsWebByBuildType(buildTypeList)) {
|
|
336
|
+
if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
|
|
337
337
|
let { appConfig = {} } = mainAppSerializeData;
|
|
338
338
|
let { window = {} } = appConfig;
|
|
339
|
-
if (common_2.buildAsXPageByBuildType(buildTypeList)) {
|
|
339
|
+
if ((0, common_2.buildAsXPageByBuildType)(buildTypeList)) {
|
|
340
340
|
window.publicPath =
|
|
341
341
|
((_d = this._resolvedInputs.deployOptions) === null || _d === void 0 ? void 0 : _d.publicPath) ||
|
|
342
342
|
`https://${domain}${this._getWebRootPath()}`;
|
|
@@ -358,7 +358,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
358
358
|
if (this._gatewayConfig) {
|
|
359
359
|
const path = this._gatewayConfig.Path;
|
|
360
360
|
window.publicPath = `https://${domain}${this._getWebRootPath()}`;
|
|
361
|
-
if (!common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
361
|
+
if (!(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList)) {
|
|
362
362
|
window.basename = path;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -382,7 +382,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
382
382
|
this._appPath = yield new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
383
383
|
var _g, _h;
|
|
384
384
|
try {
|
|
385
|
-
yield core_1.default({
|
|
385
|
+
yield (0, core_1.default)({
|
|
386
386
|
mainAppSerializeData,
|
|
387
387
|
subAppSerializeDataList,
|
|
388
388
|
dependencies,
|
|
@@ -399,7 +399,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
399
399
|
isCleanDistDir: false,
|
|
400
400
|
plugins,
|
|
401
401
|
extraData,
|
|
402
|
-
isCrossAccount: this._resolvedInputs.mpAppId !==
|
|
402
|
+
isCrossAccount: this._resolvedInputs.mpAppId !==
|
|
403
|
+
((_h = this._resolvedInputs.deployOptions) === null || _h === void 0 ? void 0 : _h.targetMpAppId),
|
|
403
404
|
resourceAppid: this._resolvedInputs.mpAppId,
|
|
404
405
|
domain,
|
|
405
406
|
}, (err, result) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -412,27 +413,27 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
412
413
|
if (buildTypeList.includes("mp")) {
|
|
413
414
|
miniAppDir = outDir;
|
|
414
415
|
}
|
|
415
|
-
if (common_2.buildAsWebByBuildType(buildTypeList)) {
|
|
416
|
+
if ((0, common_2.buildAsWebByBuildType)(buildTypeList)) {
|
|
416
417
|
webAppDir = path_1.default.resolve(outDir, 'preview');
|
|
417
418
|
}
|
|
418
419
|
logger.debug(`=== Compilation finished at ${outDir}, elapsed time: ${timeElapsed / 1000}s.===\n`);
|
|
419
420
|
if (buildTypeList.includes("mp") && miniAppDir) {
|
|
420
421
|
let projectJsonPath = path_1.default.resolve(miniAppDir, 'project.config.json');
|
|
421
|
-
yield postProcess_1.postprocessProjectConfig(projectJsonPath, {
|
|
422
|
+
yield (0, postProcess_1.postprocessProjectConfig)(projectJsonPath, {
|
|
422
423
|
appid: this._resolvedInputs.deployOptions.mpAppId,
|
|
423
424
|
cloudfunctionRoot: undefined,
|
|
424
425
|
});
|
|
425
|
-
yield postProcess_1.postprocessDeployExtraJson(miniAppDir, this._resolvedInputs.deployOptions);
|
|
426
|
+
yield (0, postProcess_1.postprocessDeployExtraJson)(miniAppDir, this._resolvedInputs.deployOptions);
|
|
426
427
|
if (generateMpType === "app") {
|
|
427
428
|
fs_extra_1.default.removeSync(path_1.default.resolve(miniAppDir, 'miniprogram_npm'));
|
|
428
429
|
}
|
|
429
430
|
if (outDir) {
|
|
430
431
|
if (plugins) {
|
|
431
|
-
yield generate_1.handleMpPlugins(plugins, outDir);
|
|
432
|
+
yield (0, generate_1.handleMpPlugins)(plugins, outDir);
|
|
432
433
|
}
|
|
433
434
|
}
|
|
434
435
|
}
|
|
435
|
-
else if (common_2.buildAsWebByBuildType(buildTypeList) && webAppDir) {
|
|
436
|
+
else if ((0, common_2.buildAsWebByBuildType)(buildTypeList) && webAppDir) {
|
|
436
437
|
const staticAppDir = path_1.default.join(staticDir, publicPath);
|
|
437
438
|
fs_extra_1.default.ensureDirSync(staticAppDir);
|
|
438
439
|
}
|
|
@@ -442,8 +443,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
442
443
|
}
|
|
443
444
|
else if (webAppDir) {
|
|
444
445
|
fs_extra_1.default.copySync(webAppDir, distPath);
|
|
445
|
-
if (common_2.buildAsWebByBuildType(buildTypeList) &&
|
|
446
|
-
!common_2.buildAsAdminPortalByBuildType(buildTypeList) &&
|
|
446
|
+
if ((0, common_2.buildAsWebByBuildType)(buildTypeList) &&
|
|
447
|
+
!(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList) &&
|
|
447
448
|
this._checkBroswerHisroty()) {
|
|
448
449
|
yield Promise.all((((_j = this._resolvedInputs.mainAppSerializeData) === null || _j === void 0 ? void 0 : _j.pageInstanceList) || []).map((page) => fs_extra_1.default.copy(path_1.default.join(distPath, 'index.html'), path_1.default.join(distPath, page.id, 'index.html'))));
|
|
449
450
|
}
|
|
@@ -542,9 +543,9 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
542
543
|
this.api.logger.error('设置登录配置失败', e);
|
|
543
544
|
}
|
|
544
545
|
if (this._miniprogramePlugin) {
|
|
545
|
-
res = lodash_1.merge(res, yield this._miniprogramePlugin.compile());
|
|
546
|
+
res = (0, lodash_1.merge)(res, yield this._miniprogramePlugin.compile());
|
|
546
547
|
}
|
|
547
|
-
else if (common_2.buildAsWebByBuildType(this._resolvedInputs.buildTypeList) &&
|
|
548
|
+
else if ((0, common_2.buildAsWebByBuildType)(this._resolvedInputs.buildTypeList) &&
|
|
548
549
|
this._webPlugin) {
|
|
549
550
|
try {
|
|
550
551
|
const HostingProvider = (_a = this.api.resourceProviders) === null || _a === void 0 ? void 0 : _a.hosting;
|
|
@@ -604,7 +605,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
604
605
|
}
|
|
605
606
|
else if (this._webPlugin) {
|
|
606
607
|
yield this._webPlugin.deploy();
|
|
607
|
-
if (common_2.buildAsAdminPortalByBuildType(this._resolvedInputs.buildTypeList)) {
|
|
608
|
+
if ((0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)) {
|
|
608
609
|
yield this._postProcessAdminPortal();
|
|
609
610
|
}
|
|
610
611
|
else {
|
|
@@ -613,7 +614,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
613
614
|
try {
|
|
614
615
|
const { deployOptions, appId } = this._resolvedInputs;
|
|
615
616
|
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
|
|
616
|
-
const link = common_2.buildAsAdminPortalByBuildType(this._resolvedInputs.buildTypeList)
|
|
617
|
+
const link = (0, common_2.buildAsAdminPortalByBuildType)(this._resolvedInputs.buildTypeList)
|
|
617
618
|
? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preview' : 'prod'}`
|
|
618
619
|
: this._gatewayConfig
|
|
619
620
|
? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
|
|
@@ -679,30 +680,31 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
679
680
|
});
|
|
680
681
|
const analyseRes = yield mpci.analyseCode(project);
|
|
681
682
|
if (analyseRes) {
|
|
682
|
-
const
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
683
|
+
const codeExtensions = new Set([
|
|
684
|
+
'.wxml',
|
|
685
|
+
'.wxss',
|
|
686
|
+
'.wxs',
|
|
687
|
+
'.js',
|
|
688
|
+
'.json',
|
|
689
|
+
'.json',
|
|
690
|
+
'.ts',
|
|
691
|
+
]);
|
|
692
|
+
const { files } = analyseRes;
|
|
693
|
+
const filesToDelete = files
|
|
694
|
+
.filter((f) => {
|
|
695
|
+
var _a, _b;
|
|
696
|
+
if (codeExtensions.has(f.ext) &&
|
|
697
|
+
!f.moduleId &&
|
|
698
|
+
((_b = (_a = f.path) === null || _a === void 0 ? void 0 : _a.startsWith) === null || _b === void 0 ? void 0 : _b.call(_a, 'materials/'))) {
|
|
699
|
+
return true;
|
|
700
|
+
}
|
|
701
|
+
return false;
|
|
702
|
+
})
|
|
703
|
+
.map((f) => f.path);
|
|
704
|
+
this.api.logger.warn('-------------------filesToDelete', filesToDelete.join('\n'));
|
|
705
|
+
yield Promise.all(filesToDelete.map((f) => __awaiter(this, void 0, void 0, function* () {
|
|
706
|
+
yield fs_extra_1.default.remove(path_1.default.join(distDir, f));
|
|
707
|
+
})));
|
|
706
708
|
}
|
|
707
709
|
else {
|
|
708
710
|
this.api.logger.warn('小程序代码静态分析失败');
|
|
@@ -759,17 +761,18 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
759
761
|
const zipPath = path_1.default.resolve(this.api.projectPath, `${this._resolvedInputs.appId}.zip`);
|
|
760
762
|
yield this._zipDir(path_1.default.resolve(this.api.projectPath, exports.DIST_PATH), zipPath);
|
|
761
763
|
let { credential, storage } = this._resolvedInputs;
|
|
762
|
-
let cos = (credential === null || credential === void 0 ? void 0 : credential.token)
|
|
763
|
-
|
|
764
|
-
callback
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
764
|
+
let cos = (credential === null || credential === void 0 ? void 0 : credential.token)
|
|
765
|
+
? new cos_nodejs_sdk_v5_1.default({
|
|
766
|
+
getAuthorization: function (options, callback) {
|
|
767
|
+
callback({
|
|
768
|
+
TmpSecretId: (credential === null || credential === void 0 ? void 0 : credential.secretId) || '',
|
|
769
|
+
TmpSecretKey: (credential === null || credential === void 0 ? void 0 : credential.secretKey) || '',
|
|
770
|
+
XCosSecurityToken: (credential === null || credential === void 0 ? void 0 : credential.token) || '',
|
|
771
|
+
ExpiredTime: Math.floor(Date.now() / 1000) + 600,
|
|
772
|
+
StartTime: Math.floor(Date.now() / 1000),
|
|
773
|
+
});
|
|
774
|
+
},
|
|
775
|
+
})
|
|
773
776
|
: new cos_nodejs_sdk_v5_1.default({
|
|
774
777
|
SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
|
|
775
778
|
SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
|
|
@@ -855,17 +858,18 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
855
858
|
return __awaiter(this, void 0, void 0, function* () {
|
|
856
859
|
let promises = [];
|
|
857
860
|
let { credential } = this._resolvedInputs;
|
|
858
|
-
let cos = (credential === null || credential === void 0 ? void 0 : credential.token)
|
|
859
|
-
|
|
860
|
-
callback
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
861
|
+
let cos = (credential === null || credential === void 0 ? void 0 : credential.token)
|
|
862
|
+
? new cos_nodejs_sdk_v5_1.default({
|
|
863
|
+
getAuthorization: function (options, callback) {
|
|
864
|
+
callback({
|
|
865
|
+
TmpSecretId: (credential === null || credential === void 0 ? void 0 : credential.secretId) || '',
|
|
866
|
+
TmpSecretKey: (credential === null || credential === void 0 ? void 0 : credential.secretKey) || '',
|
|
867
|
+
XCosSecurityToken: (credential === null || credential === void 0 ? void 0 : credential.token) || '',
|
|
868
|
+
ExpiredTime: Math.floor(Date.now() / 1000) + 600,
|
|
869
|
+
StartTime: Math.floor(Date.now() / 1000),
|
|
870
|
+
});
|
|
871
|
+
},
|
|
872
|
+
})
|
|
869
873
|
: new cos_nodejs_sdk_v5_1.default({
|
|
870
874
|
SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
|
|
871
875
|
SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
|
|
@@ -920,7 +924,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
920
924
|
return __awaiter(this, void 0, void 0, function* () {
|
|
921
925
|
return new Promise((resolve, reject) => {
|
|
922
926
|
var output = fs_extra_1.default.createWriteStream(dist);
|
|
923
|
-
var archive = archiver_1.default('zip', {
|
|
927
|
+
var archive = (0, archiver_1.default)('zip', {
|
|
924
928
|
zlib: { level: 9 },
|
|
925
929
|
});
|
|
926
930
|
output.on('close', resolve);
|
|
@@ -934,7 +938,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
934
938
|
_postProcessAdminPortal() {
|
|
935
939
|
return __awaiter(this, void 0, void 0, function* () {
|
|
936
940
|
const { appId, buildTypeList, mainAppSerializeData, deployOptions, } = this._resolvedInputs;
|
|
937
|
-
if (common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
941
|
+
if ((0, common_2.buildAsAdminPortalByBuildType)(buildTypeList)) {
|
|
938
942
|
try {
|
|
939
943
|
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
|
|
940
944
|
const id = isPreview ? `${appId}-preview` : appId;
|
|
@@ -1054,7 +1058,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
1054
1058
|
}
|
|
1055
1059
|
_checkBroswerHisroty() {
|
|
1056
1060
|
var _a;
|
|
1057
|
-
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType)
|
|
1061
|
+
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType)
|
|
1062
|
+
? types_1.HISTORY_TYPE.HASH
|
|
1058
1063
|
: '';
|
|
1059
1064
|
return !historyType || historyType === types_1.HISTORY_TYPE.BROWSER;
|
|
1060
1065
|
}
|
package/lib/utils/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as childProcess from 'child_process';
|
|
3
|
-
export declare function setReadOnly(target: object, key: string, v: any, deep?: boolean):
|
|
3
|
+
export declare function setReadOnly(target: object, key: string, v: any, deep?: boolean): object;
|
|
4
4
|
export declare type PromiseResult<T> = Promise<[null, T] | [Error, null]>;
|
|
5
5
|
export declare function promiseWrapper<T>(p: Promise<T>): PromiseResult<T>;
|
|
6
6
|
export declare const isWindows: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":";AAMA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAU9C,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,UAAO,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":";AAMA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAU9C,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,UAAO,UAoB3E;AAED,oBAAY,aAAa,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAClE,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAQjE;AAED,eAAO,MAAM,SAAS,SAA+B,CAAC;AACtD,eAAO,MAAM,KAAK,SAAgC,CAAC;AACnD,eAAO,MAAM,OAAO,SAA+B,CAAC;AAEpD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,KAAK,oBAgBV;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE;QACZ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AACD,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAEvE;AAED,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,iBAEvC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrD;AAKD,wBAAgB,aAAa,YAE5B;AAED,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,EAC5B,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,oBA2BpC;AAED,wBAAgB,uBAAuB,WAOtC;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAI,UAE7C;AAED,wBAAgB,WAAW,uBAe1B;AAED,wBAAgB,2BAA2B,CAAC,IAAI,KAAA,OAO/C"}
|
package/lib/utils/common.js
CHANGED
|
@@ -79,7 +79,7 @@ function compressingZip(entryList, distPath, opts = {}) {
|
|
|
79
79
|
zipStream.addEntry(entry, opts);
|
|
80
80
|
});
|
|
81
81
|
const destStream = fs_extra_1.default.createWriteStream(distPath);
|
|
82
|
-
pump_1.default(zipStream, destStream, (err) => {
|
|
82
|
+
(0, pump_1.default)(zipStream, destStream, (err) => {
|
|
83
83
|
if (err) {
|
|
84
84
|
console.error(err);
|
|
85
85
|
reject(err);
|
|
@@ -115,7 +115,7 @@ exports.isWinPlatform = isWinPlatform;
|
|
|
115
115
|
function spawnPro(command, args, options) {
|
|
116
116
|
return new Promise((resolve, reject) => {
|
|
117
117
|
var _a, _b;
|
|
118
|
-
const process = cross_spawn_1.default(command, args, options);
|
|
118
|
+
const process = (0, cross_spawn_1.default)(command, args, options);
|
|
119
119
|
let strOut = '';
|
|
120
120
|
let strErr = '';
|
|
121
121
|
(_a = process.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
package/lib/utils/dataSource.js
CHANGED
|
@@ -39,7 +39,7 @@ function mergeDependencies(...pkgs) {
|
|
|
39
39
|
? 'latest'
|
|
40
40
|
: formated.dependencies[key];
|
|
41
41
|
}
|
|
42
|
-
const merged = merge_package_json_1.default(formated, acc);
|
|
42
|
+
const merged = (0, merge_package_json_1.default)(formated, acc);
|
|
43
43
|
return JSON.parse(merged);
|
|
44
44
|
}, result);
|
|
45
45
|
return result.dependencies;
|
|
@@ -147,7 +147,7 @@ function _generateDynamicDataset(dataset) {
|
|
|
147
147
|
processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (${typeof value === 'string' ? `'${value}'` : JSON.stringify(value)})${config_1.REPLACE_SIGN}`;
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
|
-
let jsExp = util_1.generateDataBind(bind);
|
|
150
|
+
let jsExp = (0, util_1.generateDataBind)(bind);
|
|
151
151
|
processed[paramKey] = `${config_1.REPLACE_SIGN}(app, $page) => (\n${jsExp}\n)${config_1.REPLACE_SIGN}`;
|
|
152
152
|
}
|
|
153
153
|
}
|
package/lib/utils/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./common"), exports);
|
package/lib/utils/postProcess.js
CHANGED
|
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
15
|
if (mod && mod.__esModule) return mod;
|
|
16
16
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
@@ -28,7 +28,7 @@ const lodash_1 = require("lodash");
|
|
|
28
28
|
const path_1 = __importDefault(require("path"));
|
|
29
29
|
function postprocessProjectConfig(projectJsonPath, data) {
|
|
30
30
|
let projectJson = fs_extra_1.default.readJsonSync(projectJsonPath);
|
|
31
|
-
fs_extra_1.default.writeJsonSync(projectJsonPath, lodash_1.merge(projectJson, data), { spaces: 2 });
|
|
31
|
+
fs_extra_1.default.writeJsonSync(projectJsonPath, (0, lodash_1.merge)(projectJson, data), { spaces: 2 });
|
|
32
32
|
}
|
|
33
33
|
exports.postprocessProjectConfig = postprocessProjectConfig;
|
|
34
34
|
function postprocessDeployExtraJson(projectPath, deployOptions) {
|
|
@@ -37,7 +37,7 @@ function postprocessDeployExtraJson(projectPath, deployOptions) {
|
|
|
37
37
|
let projectJson = fs_extra_1.default.readJsonSync(path_1.default.resolve(projectPath, 'project.config.json'));
|
|
38
38
|
const miniprogramRoot = (projectJson === null || projectJson === void 0 ? void 0 : projectJson.miniprogramRoot) || './';
|
|
39
39
|
const extPaht = path_1.default.resolve(projectPath, miniprogramRoot, 'ext.json');
|
|
40
|
-
const extJson = Object.assign(Object.assign({}, (fs_extra_1.default.existsSync(extPaht) ? fs_extra_1.readJsonSync(extPaht) : {})), { extEnable: true, extAppid: targetMpAppId, directCommit: true });
|
|
40
|
+
const extJson = Object.assign(Object.assign({}, (fs_extra_1.default.existsSync(extPaht) ? (0, fs_extra_1.readJsonSync)(extPaht) : {})), { extEnable: true, extAppid: targetMpAppId, directCommit: true });
|
|
41
41
|
fs_extra_1.default.writeFileSync(extPaht, JSON.stringify(extJson, null, 2));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./style"), exports);
|
package/lib/weapps-core/index.js
CHANGED
|
@@ -12,12 +12,12 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
12
12
|
o["default"] = v;
|
|
13
13
|
});
|
|
14
14
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
18
|
if (mod && mod.__esModule) return mod;
|
|
19
19
|
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
20
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
21
|
__setModuleDefault(result, mod);
|
|
22
22
|
return result;
|
|
23
23
|
};
|
|
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./material"), exports);
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPublishAppId = exports.biggerThanVersion = exports.checkVersion = exports.INIT_VERSION = void 0;
|
|
4
4
|
const appbuild_1 = require("../types/appbuild");
|
|
5
5
|
exports.INIT_VERSION = '0.0.0';
|
|
6
|
-
|
|
6
|
+
const checkVersion = (value) => {
|
|
7
7
|
return /^\d+\.\d+(\.\d+){0,2}$/.test(value);
|
|
8
8
|
};
|
|
9
|
-
exports.
|
|
9
|
+
exports.checkVersion = checkVersion;
|
|
10
|
+
const biggerThanVersion = (value = '', lastVersion = '') => {
|
|
10
11
|
const nowVersions = value
|
|
11
12
|
.split('.')
|
|
12
13
|
.map((item) => (Number.isNaN(parseInt(item)) ? 0 : parseInt(item)));
|
|
@@ -28,10 +29,12 @@ exports.biggerThanVersion = (value = '', lastVersion = '') => {
|
|
|
28
29
|
}
|
|
29
30
|
return false;
|
|
30
31
|
};
|
|
31
|
-
exports.
|
|
32
|
+
exports.biggerThanVersion = biggerThanVersion;
|
|
33
|
+
const getPublishAppId = (codingPublishType, outputs) => {
|
|
32
34
|
return codingPublishType === appbuild_1.CodingPublishType.Android
|
|
33
35
|
? outputs.appid
|
|
34
36
|
: codingPublishType === appbuild_1.CodingPublishType.iOS
|
|
35
37
|
? outputs.iOSappId
|
|
36
38
|
: 'main';
|
|
37
39
|
};
|
|
40
|
+
exports.getPublishAppId = getPublishAppId;
|
|
@@ -36,7 +36,7 @@ function isPlainObject(src) {
|
|
|
36
36
|
return Object.prototype.toString.call(src) === '[object Object]';
|
|
37
37
|
}
|
|
38
38
|
exports.isPlainObject = isPlainObject;
|
|
39
|
-
|
|
39
|
+
const isEmptyObj = (obj) => {
|
|
40
40
|
if (!isPlainObject(obj)) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
@@ -47,6 +47,7 @@ exports.isEmptyObj = (obj) => {
|
|
|
47
47
|
}
|
|
48
48
|
return true;
|
|
49
49
|
};
|
|
50
|
+
exports.isEmptyObj = isEmptyObj;
|
|
50
51
|
function setValidValue(target, key, value) {
|
|
51
52
|
if (value === undefined || value === null) {
|
|
52
53
|
return;
|
|
@@ -54,7 +55,7 @@ function setValidValue(target, key, value) {
|
|
|
54
55
|
if (isArray(value) && value.length === 0) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
if (isPlainObject(value) && exports.isEmptyObj(value)) {
|
|
58
|
+
if (isPlainObject(value) && (0, exports.isEmptyObj)(value)) {
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
if (!target) {
|
|
@@ -6,7 +6,7 @@ export declare function originJsonToFileList(appData: IWeAppData): (import("../t
|
|
|
6
6
|
code: string;
|
|
7
7
|
pageId: string;
|
|
8
8
|
})[];
|
|
9
|
-
export declare function getExtByType(type: CodeType): ".
|
|
9
|
+
export declare function getExtByType(type: CodeType): ".js" | ".json" | ".less";
|
|
10
10
|
export declare function HACK_FIX_LOWCODE_IN(code?: string): string;
|
|
11
11
|
export declare function HACK_FIX_LOWCODE_OUT(code?: string): string;
|
|
12
12
|
//# sourceMappingURL=file.d.ts.map
|