@cloudbase/framework-plugin-low-code 0.6.55 → 0.6.58-alpha.0
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.d.ts.map +1 -1
- package/lib/builder/core/generate.js +18 -14
- 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.d.ts.map +1 -1
- package/lib/builder/mp/index.js +54 -50
- 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.d.ts.map +1 -1
- package/lib/builder/service/builder/generate.js +58 -60
- 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 +23 -24
- package/lib/builder/types/common.js +0 -1
- package/lib/builder/util/common.js +6 -8
- 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 +2 -4
- 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 +34 -36
- package/lib/generator/core/index.js +4 -4
- package/lib/generator/core/material.js +14 -14
- package/lib/generator/types/common.js +3 -6
- package/lib/generator/util/index.js +1 -1
- package/lib/generator/util/style.js +2 -2
- package/lib/index.js +53 -58
- 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 +3 -6
- package/lib/weapps-core/utils/common.js +2 -3
- 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 +6 -3
- package/template/mp/common/weapp-page.js +23 -11
- package/template/mp/component/index.js +2 -2
- package/template/mp/page/index.js +2 -2
- package/template/package.json +1 -0
- package/template/src/pages/app.tpl +53 -11
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.
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.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 =
|
|
45
|
+
exports.plugin = exports.PERSISTENT_DEPENDIENCES_MAP = exports.DIST_PATH = 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 =
|
|
125
|
+
this._resolvedInputs.mainAppSerializeData = 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 =
|
|
155
|
+
this._resolvedInputs.mainAppSerializeData = 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 (
|
|
161
|
+
if (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 =
|
|
167
|
+
window.basename = 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
|
-
:
|
|
171
|
+
: 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 (
|
|
255
|
+
else if (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
|
-
?
|
|
313
|
-
:
|
|
312
|
+
? common_1.processPkgUrlCals2WeappData(item)
|
|
313
|
+
: cals_1.deserializePlatformApp(item, { dependencies });
|
|
314
314
|
}
|
|
315
315
|
return item;
|
|
316
316
|
});
|
|
317
|
-
const nodeModulesPath =
|
|
317
|
+
const nodeModulesPath = 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 (
|
|
336
|
+
if (common_2.buildAsWebByBuildType(buildTypeList)) {
|
|
337
337
|
let { appConfig = {} } = mainAppSerializeData;
|
|
338
338
|
let { window = {} } = appConfig;
|
|
339
|
-
if (
|
|
339
|
+
if (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 (!
|
|
361
|
+
if (!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
|
|
385
|
+
yield core_1.default({
|
|
386
386
|
mainAppSerializeData,
|
|
387
387
|
subAppSerializeDataList,
|
|
388
388
|
dependencies,
|
|
@@ -399,8 +399,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
399
399
|
isCleanDistDir: false,
|
|
400
400
|
plugins,
|
|
401
401
|
extraData,
|
|
402
|
-
isCrossAccount: this._resolvedInputs.mpAppId !==
|
|
403
|
-
((_h = this._resolvedInputs.deployOptions) === null || _h === void 0 ? void 0 : _h.targetMpAppId),
|
|
402
|
+
isCrossAccount: this._resolvedInputs.mpAppId !== ((_h = this._resolvedInputs.deployOptions) === null || _h === void 0 ? void 0 : _h.targetMpAppId),
|
|
404
403
|
resourceAppid: this._resolvedInputs.mpAppId,
|
|
405
404
|
domain,
|
|
406
405
|
}, (err, result) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -413,27 +412,27 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
413
412
|
if (buildTypeList.includes("mp")) {
|
|
414
413
|
miniAppDir = outDir;
|
|
415
414
|
}
|
|
416
|
-
if (
|
|
415
|
+
if (common_2.buildAsWebByBuildType(buildTypeList)) {
|
|
417
416
|
webAppDir = path_1.default.resolve(outDir, 'preview');
|
|
418
417
|
}
|
|
419
418
|
logger.debug(`=== Compilation finished at ${outDir}, elapsed time: ${timeElapsed / 1000}s.===\n`);
|
|
420
419
|
if (buildTypeList.includes("mp") && miniAppDir) {
|
|
421
420
|
let projectJsonPath = path_1.default.resolve(miniAppDir, 'project.config.json');
|
|
422
|
-
yield
|
|
421
|
+
yield postProcess_1.postprocessProjectConfig(projectJsonPath, {
|
|
423
422
|
appid: this._resolvedInputs.deployOptions.mpAppId,
|
|
424
423
|
cloudfunctionRoot: undefined,
|
|
425
424
|
});
|
|
426
|
-
yield
|
|
425
|
+
yield postProcess_1.postprocessDeployExtraJson(miniAppDir, this._resolvedInputs.deployOptions);
|
|
427
426
|
if (generateMpType === "app") {
|
|
428
427
|
fs_extra_1.default.removeSync(path_1.default.resolve(miniAppDir, 'miniprogram_npm'));
|
|
429
428
|
}
|
|
430
429
|
if (outDir) {
|
|
431
430
|
if (plugins) {
|
|
432
|
-
yield
|
|
431
|
+
yield generate_1.handleMpPlugins(plugins, outDir);
|
|
433
432
|
}
|
|
434
433
|
}
|
|
435
434
|
}
|
|
436
|
-
else if (
|
|
435
|
+
else if (common_2.buildAsWebByBuildType(buildTypeList) && webAppDir) {
|
|
437
436
|
const staticAppDir = path_1.default.join(staticDir, publicPath);
|
|
438
437
|
fs_extra_1.default.ensureDirSync(staticAppDir);
|
|
439
438
|
}
|
|
@@ -443,8 +442,8 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
443
442
|
}
|
|
444
443
|
else if (webAppDir) {
|
|
445
444
|
fs_extra_1.default.copySync(webAppDir, distPath);
|
|
446
|
-
if (
|
|
447
|
-
!
|
|
445
|
+
if (common_2.buildAsWebByBuildType(buildTypeList) &&
|
|
446
|
+
!common_2.buildAsAdminPortalByBuildType(buildTypeList) &&
|
|
448
447
|
this._checkBroswerHisroty()) {
|
|
449
448
|
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'))));
|
|
450
449
|
}
|
|
@@ -543,9 +542,9 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
543
542
|
this.api.logger.error('设置登录配置失败', e);
|
|
544
543
|
}
|
|
545
544
|
if (this._miniprogramePlugin) {
|
|
546
|
-
res =
|
|
545
|
+
res = lodash_1.merge(res, yield this._miniprogramePlugin.compile());
|
|
547
546
|
}
|
|
548
|
-
else if (
|
|
547
|
+
else if (common_2.buildAsWebByBuildType(this._resolvedInputs.buildTypeList) &&
|
|
549
548
|
this._webPlugin) {
|
|
550
549
|
try {
|
|
551
550
|
const HostingProvider = (_a = this.api.resourceProviders) === null || _a === void 0 ? void 0 : _a.hosting;
|
|
@@ -605,7 +604,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
605
604
|
}
|
|
606
605
|
else if (this._webPlugin) {
|
|
607
606
|
yield this._webPlugin.deploy();
|
|
608
|
-
if (
|
|
607
|
+
if (common_2.buildAsAdminPortalByBuildType(this._resolvedInputs.buildTypeList)) {
|
|
609
608
|
yield this._postProcessAdminPortal();
|
|
610
609
|
}
|
|
611
610
|
else {
|
|
@@ -614,7 +613,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
614
613
|
try {
|
|
615
614
|
const { deployOptions, appId } = this._resolvedInputs;
|
|
616
615
|
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
|
|
617
|
-
const link =
|
|
616
|
+
const link = common_2.buildAsAdminPortalByBuildType(this._resolvedInputs.buildTypeList)
|
|
618
617
|
? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preview' : 'prod'}`
|
|
619
618
|
: this._gatewayConfig
|
|
620
619
|
? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
|
|
@@ -694,8 +693,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
694
693
|
.filter((f) => {
|
|
695
694
|
var _a, _b;
|
|
696
695
|
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/'))) {
|
|
696
|
+
!f.moduleId && ((_b = (_a = f.path) === null || _a === void 0 ? void 0 : _a.startsWith) === null || _b === void 0 ? void 0 : _b.call(_a, 'materials/'))) {
|
|
699
697
|
return true;
|
|
700
698
|
}
|
|
701
699
|
return false;
|
|
@@ -761,18 +759,17 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
761
759
|
const zipPath = path_1.default.resolve(this.api.projectPath, `${this._resolvedInputs.appId}.zip`);
|
|
762
760
|
yield this._zipDir(path_1.default.resolve(this.api.projectPath, exports.DIST_PATH), zipPath);
|
|
763
761
|
let { credential, storage } = this._resolvedInputs;
|
|
764
|
-
let cos = (credential === null || credential === void 0 ? void 0 : credential.token)
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
})
|
|
762
|
+
let cos = (credential === null || credential === void 0 ? void 0 : credential.token) ? new cos_nodejs_sdk_v5_1.default({
|
|
763
|
+
getAuthorization: function (options, callback) {
|
|
764
|
+
callback({
|
|
765
|
+
TmpSecretId: (credential === null || credential === void 0 ? void 0 : credential.secretId) || '',
|
|
766
|
+
TmpSecretKey: (credential === null || credential === void 0 ? void 0 : credential.secretKey) || '',
|
|
767
|
+
XCosSecurityToken: (credential === null || credential === void 0 ? void 0 : credential.token) || '',
|
|
768
|
+
ExpiredTime: Math.floor(Date.now() / 1000) + 600,
|
|
769
|
+
StartTime: Math.floor(Date.now() / 1000),
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
})
|
|
776
773
|
: new cos_nodejs_sdk_v5_1.default({
|
|
777
774
|
SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
|
|
778
775
|
SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
|
|
@@ -858,18 +855,17 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
858
855
|
return __awaiter(this, void 0, void 0, function* () {
|
|
859
856
|
let promises = [];
|
|
860
857
|
let { credential } = this._resolvedInputs;
|
|
861
|
-
let cos = (credential === null || credential === void 0 ? void 0 : credential.token)
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
})
|
|
858
|
+
let cos = (credential === null || credential === void 0 ? void 0 : credential.token) ? new cos_nodejs_sdk_v5_1.default({
|
|
859
|
+
getAuthorization: function (options, callback) {
|
|
860
|
+
callback({
|
|
861
|
+
TmpSecretId: (credential === null || credential === void 0 ? void 0 : credential.secretId) || '',
|
|
862
|
+
TmpSecretKey: (credential === null || credential === void 0 ? void 0 : credential.secretKey) || '',
|
|
863
|
+
XCosSecurityToken: (credential === null || credential === void 0 ? void 0 : credential.token) || '',
|
|
864
|
+
ExpiredTime: Math.floor(Date.now() / 1000) + 600,
|
|
865
|
+
StartTime: Math.floor(Date.now() / 1000),
|
|
866
|
+
});
|
|
867
|
+
},
|
|
868
|
+
})
|
|
873
869
|
: new cos_nodejs_sdk_v5_1.default({
|
|
874
870
|
SecretId: credential === null || credential === void 0 ? void 0 : credential.secretId,
|
|
875
871
|
SecretKey: credential === null || credential === void 0 ? void 0 : credential.secretKey,
|
|
@@ -924,7 +920,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
924
920
|
return __awaiter(this, void 0, void 0, function* () {
|
|
925
921
|
return new Promise((resolve, reject) => {
|
|
926
922
|
var output = fs_extra_1.default.createWriteStream(dist);
|
|
927
|
-
var archive =
|
|
923
|
+
var archive = archiver_1.default('zip', {
|
|
928
924
|
zlib: { level: 9 },
|
|
929
925
|
});
|
|
930
926
|
output.on('close', resolve);
|
|
@@ -938,7 +934,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
938
934
|
_postProcessAdminPortal() {
|
|
939
935
|
return __awaiter(this, void 0, void 0, function* () {
|
|
940
936
|
const { appId, buildTypeList, mainAppSerializeData, deployOptions, } = this._resolvedInputs;
|
|
941
|
-
if (
|
|
937
|
+
if (common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
942
938
|
try {
|
|
943
939
|
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
|
|
944
940
|
const id = isPreview ? `${appId}-preview` : appId;
|
|
@@ -1058,8 +1054,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
1058
1054
|
}
|
|
1059
1055
|
_checkBroswerHisroty() {
|
|
1060
1056
|
var _a;
|
|
1061
|
-
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType)
|
|
1062
|
-
? types_1.HISTORY_TYPE.HASH
|
|
1057
|
+
let historyType = ((_a = this._resolvedInputs.mainAppSerializeData) === null || _a === void 0 ? void 0 : _a.historyType) ? types_1.HISTORY_TYPE.HASH
|
|
1063
1058
|
: '';
|
|
1064
1059
|
return !historyType || historyType === types_1.HISTORY_TYPE.BROWSER;
|
|
1065
1060
|
}
|
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): any;
|
|
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,OAoB3E;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
|
-
|
|
82
|
+
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 =
|
|
118
|
+
const process = 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 =
|
|
42
|
+
const merged = 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 =
|
|
150
|
+
let jsExp = 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" && !exports.hasOwnProperty(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.
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.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,
|
|
31
|
+
fs_extra_1.default.writeJsonSync(projectJsonPath, 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) ?
|
|
40
|
+
const extJson = Object.assign(Object.assign({}, (fs_extra_1.default.existsSync(extPaht) ? 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" && !exports.hasOwnProperty(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" && !exports.hasOwnProperty(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.
|
|
20
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.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" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./material"), exports);
|
|
@@ -3,11 +3,10 @@ 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
|
+
exports.checkVersion = (value) => {
|
|
7
7
|
return /^\d+\.\d+(\.\d+){0,2}$/.test(value);
|
|
8
8
|
};
|
|
9
|
-
exports.
|
|
10
|
-
const biggerThanVersion = (value = '', lastVersion = '') => {
|
|
9
|
+
exports.biggerThanVersion = (value = '', lastVersion = '') => {
|
|
11
10
|
const nowVersions = value
|
|
12
11
|
.split('.')
|
|
13
12
|
.map((item) => (Number.isNaN(parseInt(item)) ? 0 : parseInt(item)));
|
|
@@ -29,12 +28,10 @@ const biggerThanVersion = (value = '', lastVersion = '') => {
|
|
|
29
28
|
}
|
|
30
29
|
return false;
|
|
31
30
|
};
|
|
32
|
-
exports.
|
|
33
|
-
const getPublishAppId = (codingPublishType, outputs) => {
|
|
31
|
+
exports.getPublishAppId = (codingPublishType, outputs) => {
|
|
34
32
|
return codingPublishType === appbuild_1.CodingPublishType.Android
|
|
35
33
|
? outputs.appid
|
|
36
34
|
: codingPublishType === appbuild_1.CodingPublishType.iOS
|
|
37
35
|
? outputs.iOSappId
|
|
38
36
|
: 'main';
|
|
39
37
|
};
|
|
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
|
+
exports.isEmptyObj = (obj) => {
|
|
40
40
|
if (!isPlainObject(obj)) {
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
@@ -47,7 +47,6 @@ const isEmptyObj = (obj) => {
|
|
|
47
47
|
}
|
|
48
48
|
return true;
|
|
49
49
|
};
|
|
50
|
-
exports.isEmptyObj = isEmptyObj;
|
|
51
50
|
function setValidValue(target, key, value) {
|
|
52
51
|
if (value === undefined || value === null) {
|
|
53
52
|
return;
|
|
@@ -55,7 +54,7 @@ function setValidValue(target, key, value) {
|
|
|
55
54
|
if (isArray(value) && value.length === 0) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
|
-
if (isPlainObject(value) &&
|
|
57
|
+
if (isPlainObject(value) && exports.isEmptyObj(value)) {
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
60
|
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): ".less" | ".js" | ".json";
|
|
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
|