@hyext/builder-revues 1.2.1-alpha.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +32 -10
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -559,11 +559,16 @@ function render(content, data, opts) {
|
|
559
559
|
});
|
560
560
|
return temp(data, opts);
|
561
561
|
}
|
562
|
+
const cache = {};
|
562
563
|
function renderTemplate(input, output, data) {
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
564
|
+
let renderResult = cache[input];
|
565
|
+
if (!renderResult) {
|
566
|
+
const templ = fs__default["default"]
|
567
|
+
.readFileSync(input)
|
568
|
+
.toString();
|
569
|
+
renderResult = render(templ, data);
|
570
|
+
}
|
571
|
+
fs__default["default"].outputFileSync(output, renderResult);
|
567
572
|
}
|
568
573
|
|
569
574
|
function objectToParamsStr(obj) {
|
@@ -705,7 +710,7 @@ function genEntrys(props) {
|
|
705
710
|
});
|
706
711
|
}
|
707
712
|
|
708
|
-
const libVersion = "1.0.
|
713
|
+
const libVersion = "1.0.2" ;
|
709
714
|
const libCdn = '//a.msstatic.com/huya/hd/h5/static-source/revue/lib';
|
710
715
|
|
711
716
|
function getLibVersion(builderConfig) {
|
@@ -717,7 +722,7 @@ function getCdnLibUrl(version) {
|
|
717
722
|
function isLibDevVerion(builderConfig) {
|
718
723
|
return getLibVersion(builderConfig) === 'dev';
|
719
724
|
}
|
720
|
-
function getLibUrl(builderConfig, localPath) {
|
725
|
+
function getLibUrl(builderConfig, localPath, check = true) {
|
721
726
|
return __awaiter(this, void 0, void 0, function* () {
|
722
727
|
const version = getLibVersion(builderConfig);
|
723
728
|
if (version == null) {
|
@@ -727,7 +732,7 @@ function getLibUrl(builderConfig, localPath) {
|
|
727
732
|
return localPath;
|
728
733
|
}
|
729
734
|
const res = getCdnLibUrl(version);
|
730
|
-
yield checkCdnSourceExist(res);
|
735
|
+
check && (yield checkCdnSourceExist(res));
|
731
736
|
return res;
|
732
737
|
});
|
733
738
|
}
|
@@ -877,7 +882,12 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
877
882
|
}
|
878
883
|
function renderMiniProgram(opts) {
|
879
884
|
return __awaiter(this, void 0, void 0, function* () {
|
880
|
-
yield renderMiniprogramTemplate(opts);
|
885
|
+
return yield renderMiniprogramTemplate(opts);
|
886
|
+
});
|
887
|
+
}
|
888
|
+
function rerenderHTML(opts) {
|
889
|
+
opts.htmlRenderConfigList.forEach(config => {
|
890
|
+
renderTemplate(config.input, config.output, config.data);
|
881
891
|
});
|
882
892
|
}
|
883
893
|
function renderMiniprogramTemplate(opts) {
|
@@ -886,7 +896,7 @@ function renderMiniprogramTemplate(opts) {
|
|
886
896
|
const extConfig = getPackageExtConfig(packagePath);
|
887
897
|
const sourcePathPrefix = yield getLibUrl(builderConfig, path__default["default"].relative(mainPath, releasePath));
|
888
898
|
const packageExtConfigStr = JSON.stringify(extConfig);
|
889
|
-
const
|
899
|
+
const htmlRenderConfigList = [
|
890
900
|
{
|
891
901
|
input: path__default["default"].join(mainPath, 'view.html'),
|
892
902
|
output: path__default["default"].join(mainPath, 'view.html'),
|
@@ -902,6 +912,9 @@ function renderMiniprogramTemplate(opts) {
|
|
902
912
|
}
|
903
913
|
}
|
904
914
|
];
|
915
|
+
const renderConfigList = [
|
916
|
+
...htmlRenderConfigList
|
917
|
+
];
|
905
918
|
if (dev) {
|
906
919
|
renderConfigList.push({
|
907
920
|
input: path__default["default"].join(templatePath, 'remote-debugger.hbs'),
|
@@ -933,6 +946,9 @@ function renderMiniprogramTemplate(opts) {
|
|
933
946
|
entryRenderConfList.concat(renderConfigList).forEach(config => {
|
934
947
|
renderTemplate(config.input, config.output, config.data);
|
935
948
|
});
|
949
|
+
return {
|
950
|
+
htmlRenderConfigList
|
951
|
+
};
|
936
952
|
});
|
937
953
|
}
|
938
954
|
|
@@ -948,6 +964,7 @@ function mergePackages(projectConfig, outputPath, opts) {
|
|
948
964
|
dev: opts.dev,
|
949
965
|
builderConfig: opts.builderConfig
|
950
966
|
};
|
967
|
+
let renderResult;
|
951
968
|
const implement = (watch) => __awaiter(this, void 0, void 0, function* () {
|
952
969
|
logger.log('正在合并分包...');
|
953
970
|
let mergeResult;
|
@@ -960,7 +977,12 @@ function mergePackages(projectConfig, outputPath, opts) {
|
|
960
977
|
}
|
961
978
|
else {
|
962
979
|
mergeResult = mergeMiniprogramPackage(outputPath, opts);
|
963
|
-
!watch
|
980
|
+
if (!watch) {
|
981
|
+
renderResult = yield renderMiniProgram(Object.assign(Object.assign({}, baseRenderOpts), mergeResult));
|
982
|
+
}
|
983
|
+
else if (renderResult != null) {
|
984
|
+
rerenderHTML(renderResult);
|
985
|
+
}
|
964
986
|
}
|
965
987
|
logger.success('合并分包完成');
|
966
988
|
return mergeResult;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hyext/builder-revues",
|
3
|
-
"version": "1.2.1
|
3
|
+
"version": "1.2.1",
|
4
4
|
"description": "> TODO: description",
|
5
5
|
"author": "loler",
|
6
6
|
"homepage": "",
|
@@ -21,9 +21,9 @@
|
|
21
21
|
"url": "https://git.huya.com/exc/web/revue.git"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@revues/cocos-web-adapter": "1.2.1
|
25
|
-
"@revues/code-compiler": "1.2.1
|
26
|
-
"@revues/web-sdk-core": "1.2.1
|
24
|
+
"@revues/cocos-web-adapter": "1.2.1",
|
25
|
+
"@revues/code-compiler": "1.2.1",
|
26
|
+
"@revues/web-sdk-core": "1.2.1",
|
27
27
|
"archiver": "^7.0.1",
|
28
28
|
"axios": "^1.7.3",
|
29
29
|
"chalk": "^2.4.2",
|
@@ -43,5 +43,5 @@
|
|
43
43
|
"@types/ramda": "^0.29.11",
|
44
44
|
"terser": "^5.31.0"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "79614066d1dd187eeb95513903dfd0d350710c80"
|
47
47
|
}
|