@hyext/builder-revues 1.4.6 → 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 +19 -7
  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
@@ -1136,9 +1147,10 @@ function makeBuildResults(mode, opts) {
1136
1147
  function getPagePath(entryInfo, extraParams) {
1137
1148
  const extType = entryInfo.extType;
1138
1149
  let entry = entryInfo.entryPath;
1150
+ const module = /^zs_/.test(extType) ? 'live-ExtSDK' : 'kiwi-ExtSDK';
1139
1151
  // 移动端需要补 __module_busi__
1140
1152
  if (extType.endsWith('_h5')) {
1141
- entry += '?__module_busi__=kiwi-ExtSDK' + extraParams;
1153
+ entry += `?__module_busi__=${module}` + extraParams;
1142
1154
  }
1143
1155
  return entry;
1144
1156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyext/builder-revues",
3
- "version": "1.4.6",
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.6",
29
- "@revues/code-compiler": "1.4.6",
30
- "@revues/web-sdk-core": "1.4.6",
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": "0db6d8ee088a778fc88cb29d4335f8b9f45a2944"
50
+ "gitHead": "68ef8e9303ed293684ae127538af3dc5b7989055"
51
51
  }