@hyext/builder-revues 1.4.7 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +17 -6
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -592,7 +592,7 @@ const PluginDriver = {
592
592
  class InjectWebviewUrlParamsPlugin {
593
593
  apply(pluginDriver) {
594
594
  pluginDriver.hooks.onMergedMainPackge.tap('InjectWebviewUrlParamsPlugin', opts => {
595
- const { compileType, mainPath, extInfo } = opts;
595
+ const { compileType, mainPath, extInfo, builderConfig } = opts;
596
596
  const isGame = compileType === COMPILE_TYPE.miniGame;
597
597
  if (isGame) {
598
598
  const gameJson = fs__default["default"].readJsonSync(path__default["default"].join(mainPath, 'game.json'));
@@ -601,7 +601,7 @@ class InjectWebviewUrlParamsPlugin {
601
601
  pluginDriver.context.deviceOrientation = 'landscape';
602
602
  }
603
603
  }
604
- const webviewUrlParams = pluginDriver.context.webviewUrlParams = {
604
+ const webviewUrlParams = {
605
605
  isLandscape: 0,
606
606
  disablePopGesture: 1,
607
607
  hideStatusBar: isGame ? extInfo.hideNavigationBarTools ? 0 : 1 : 0,
@@ -612,12 +612,22 @@ class InjectWebviewUrlParamsPlugin {
612
612
  if (extInfo.forceUsePatchApi) {
613
613
  webviewUrlParams.forceUsePatchApi = 1;
614
614
  }
615
+ const extraMap = builderConfig.webviewUrlParamsMap;
616
+ pluginDriver.context.webviewUrlParams = webviewUrlParams;
617
+ pluginDriver.context.webviewUrlParamsMap = builderConfig.supportExtTypes.reduce((urlConfig, type) => {
618
+ urlConfig[type] = extraMap && extraMap[type] ? Object.assign({}, webviewUrlParams, extraMap[type]) : webviewUrlParams;
619
+ return urlConfig;
620
+ }, {});
615
621
  });
616
622
  }
617
623
  }
618
624
  function makeWebviewUrlParamsStr() {
619
625
  const params = PluginDriver.context.webviewUrlParams;
620
626
  return params ? objectToParamsStr(params) : '';
627
+ }
628
+ function makeWebviewUrlParamsStrByExtType(extType) {
629
+ const map = PluginDriver.context.webviewUrlParamsMap;
630
+ return map && map[extType] ? objectToParamsStr(map[extType]) : '';
621
631
  }
622
632
 
623
633
  const HOST = {
@@ -797,7 +807,8 @@ function mergeGamePackage(releasePath, opts) {
797
807
  mainConf: mainPakConf,
798
808
  mainPath,
799
809
  compileType: COMPILE_TYPE.miniGame,
800
- extInfo: opts.extInfo
810
+ extInfo: opts.extInfo,
811
+ builderConfig,
801
812
  });
802
813
  return {
803
814
  packagePath,
@@ -907,7 +918,8 @@ function mergeMiniprogramPackage(releasePath, opts) {
907
918
  mainConf: mainPakConf,
908
919
  mainPath,
909
920
  compileType: COMPILE_TYPE.miniProgram,
910
- extInfo: opts.extInfo
921
+ extInfo: opts.extInfo,
922
+ builderConfig,
911
923
  });
912
924
  return {
913
925
  entrys,
@@ -1103,14 +1115,13 @@ function makeBuildResults(mode, opts) {
1103
1115
  const { baseURI, entrys, outputPath } = opts;
1104
1116
  const releasePath = path__default["default"].join(outputPath, 'build-result');
1105
1117
  const buildResultMap = {};
1106
- const paramsStr = makeWebviewUrlParamsStr();
1107
1118
  const buildResultList = entrys.map(info => {
1108
1119
  const result = {
1109
1120
  type: 'HTML',
1110
1121
  content: {
1111
1122
  pages: [
1112
1123
  {
1113
- path: getPagePath(info, paramsStr)
1124
+ path: getPagePath(info, makeWebviewUrlParamsStrByExtType(info.extType))
1114
1125
  }
1115
1126
  ],
1116
1127
  baseURI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyext/builder-revues",
3
- "version": "1.4.7",
3
+ "version": "1.5.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "loler",
6
6
  "homepage": "",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@hyext/preload": "^1.1.3",
28
- "@revues/cocos-web-adapter": "1.4.7",
29
- "@revues/code-compiler": "1.4.7",
30
- "@revues/web-sdk-core": "1.4.7",
28
+ "@revues/cocos-web-adapter": "1.5.0",
29
+ "@revues/code-compiler": "1.5.0",
30
+ "@revues/web-sdk-core": "1.5.0",
31
31
  "archiver": "^7.0.1",
32
32
  "axios": "^1.7.3",
33
33
  "chalk": "^2.4.2",
@@ -47,5 +47,5 @@
47
47
  "@types/ramda": "^0.29.11",
48
48
  "terser": "^5.31.0"
49
49
  },
50
- "gitHead": "e094a51297bd184436117b97bcd4f1c80018b2ac"
50
+ "gitHead": "68ef8e9303ed293684ae127538af3dc5b7989055"
51
51
  }