yakuza0 2.23.14 → 2.23.16-beta.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/inclusive.js +53 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yakuza0",
3
- "version": "2.23.14",
3
+ "version": "2.23.16-beta.0",
4
4
  "description": "yakuza0 with nuxt",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -207,7 +207,7 @@ var render = function () {
207
207
  ykPkg = _ref.pkg,
208
208
  dkyModeDef = _ref.dkyModeDef;
209
209
 
210
- var _ykConfig, ykConf, processEnv, imageKeyOrigin, aliasDir, yk0EnvStr, conf, cspLoop, setConfValue, setConfCSP, setConf, client, content, acmConf, hostname, port, ykServer, orbAddr, directives, tip, serverConfStr;
210
+ var _ykConfig, ykConf, processEnv, imageKeyOrigin, aliasDir, yk0EnvStr, conf, cspLoop, setConfValue, setConfCSP, setConf, cspMerge, envBase, envMerge, client, content, acmConf, hostname, port, ykServer, orbAddr, directives, tip, serverConfStr;
211
211
 
212
212
  return _regenerator2.default.wrap(function _callee2$(_context2) {
213
213
  while (1) {
@@ -347,7 +347,9 @@ var render = function () {
347
347
  decoration: undefined,
348
348
  corsCheck: true,
349
349
  policies: {},
350
- directives: {}
350
+ directives: {},
351
+ envType: "def",
352
+ env: {}
351
353
  },
352
354
  sri: {
353
355
  enabled: false,
@@ -786,63 +788,87 @@ var render = function () {
786
788
  }
787
789
  });
788
790
 
791
+ cspMerge = function cspMerge(m1, m2) {
792
+ var envMerge = (0, _extends3.default)({}, m1);
793
+
794
+ _yakuza._.forEach(m2, function (v, key) {
795
+ envMerge[key] = _yakuza._.uniq(_yakuza._.compact(_yakuza._.concat(envMerge[key], v)));
796
+ });
797
+
798
+ return envMerge;
799
+ };
800
+
801
+ if (conf.server.csp.envType !== "def") {
802
+ envBase = conf.server.csp.env['base'] || {};
803
+
804
+ delete conf.server.csp.env['base'];
805
+ envMerge = cspMerge(conf.server.csp.policies, envBase);
806
+
807
+ _yakuza._.forEach(conf.server.csp.env, function (v, key) {
808
+ if (key === conf.server.csp.envType) {
809
+ envMerge = cspMerge(envMerge, conf.server.csp.env[key] || {});
810
+ }
811
+ });
812
+ conf.server.csp.policies = _yakuza._.cloneDeep(envMerge);
813
+ }
814
+
789
815
  if (!conf.server.edas.enabled) {
790
- _context2.next = 28;
816
+ _context2.next = 30;
791
817
  break;
792
818
  }
793
819
 
794
- _context2.prev = 16;
820
+ _context2.prev = 18;
795
821
  client = new _acmSdk2.default(conf.server.edas.options);
796
- _context2.next = 20;
822
+ _context2.next = 22;
797
823
  return client.getConfig(conf.server.edas.dataId, conf.server.edas.group);
798
824
 
799
- case 20:
825
+ case 22:
800
826
  content = _context2.sent;
801
827
  acmConf = JSON.parse(content);
802
828
 
803
829
  setConf(acmConf);
804
- _context2.next = 28;
830
+ _context2.next = 30;
805
831
  break;
806
832
 
807
- case 25:
808
- _context2.prev = 25;
809
- _context2.t0 = _context2['catch'](16);
833
+ case 27:
834
+ _context2.prev = 27;
835
+ _context2.t0 = _context2['catch'](18);
810
836
 
811
837
  console.log(_context2.t0);
812
838
 
813
- case 28:
839
+ case 30:
814
840
  _context2.t1 = conf.dkyMode;
815
- _context2.next = _context2.t1 === "dev" ? 31 : _context2.t1 === "normal" ? 35 : _context2.t1 === "prod" ? 39 : _context2.t1 === "stupid" ? 46 : _context2.t1 === "tire" ? 56 : 63;
841
+ _context2.next = _context2.t1 === "dev" ? 33 : _context2.t1 === "normal" ? 37 : _context2.t1 === "prod" ? 41 : _context2.t1 === "stupid" ? 48 : _context2.t1 === "tire" ? 58 : 65;
816
842
  break;
817
843
 
818
- case 31:
844
+ case 33:
819
845
  // conf.security.encrypt = "none";
820
846
  // conf.security.stupid = false;
821
847
  // conf.security.helmet = true;
822
848
  conf.server.f5Offline = checkBoolSingle(conf.server.f5Offline, false);
823
849
  conf.security.isDev = true;
824
850
  conf.dev = true;
825
- return _context2.abrupt('break', 63);
851
+ return _context2.abrupt('break', 65);
826
852
 
827
- case 35:
853
+ case 37:
828
854
  // conf.security.encrypt = "none";
829
855
  // conf.security.stupid = false;
830
856
  // conf.security.helmet = true;
831
857
  conf.server.f5Offline = checkBoolSingle(conf.server.f5Offline, false);
832
858
  conf.security.isNormal = true;
833
859
  conf.dev = false;
834
- return _context2.abrupt('break', 63);
860
+ return _context2.abrupt('break', 65);
835
861
 
836
- case 39:
862
+ case 41:
837
863
  conf.security.encrypt = "sm";
838
864
  conf.security.stupid = false;
839
865
  conf.security.helmet = true;
840
866
  conf.server.f5Offline = checkBoolSingle(conf.server.f5Offline, false);
841
867
  conf.security.isProd = true;
842
868
  conf.dev = false;
843
- return _context2.abrupt('break', 63);
869
+ return _context2.abrupt('break', 65);
844
870
 
845
- case 46:
871
+ case 48:
846
872
  conf.security.encrypt = "sm";
847
873
  conf.security.stupid = true;
848
874
  conf.security.helmet = true;
@@ -853,9 +879,9 @@ var render = function () {
853
879
  conf.server.csp.decoration = checkBoolSingle(conf.server.csp.decoration, true);
854
880
  conf.server.sri.enabled = true;
855
881
  // conf.dev = false;
856
- return _context2.abrupt('break', 63);
882
+ return _context2.abrupt('break', 65);
857
883
 
858
- case 56:
884
+ case 58:
859
885
  conf.security.encrypt = "none";
860
886
  conf.security.stupid = false;
861
887
  conf.security.helmet = false;
@@ -864,9 +890,9 @@ var render = function () {
864
890
  // conf.server.heartbeat.enabled = checkBoolSingle(conf.server.heartbeat.enabled, false);
865
891
  conf.server.heartbeat.enabled = false;
866
892
  // conf.dev = false;
867
- return _context2.abrupt('break', 63);
893
+ return _context2.abrupt('break', 65);
868
894
 
869
- case 63:
895
+ case 65:
870
896
 
871
897
  conf.server.stupid.v23.enabled = conf.server.stupid.standard === 'v23';
872
898
  // conf.router.config['app.examples'].enabled = true;
@@ -969,7 +995,7 @@ var render = function () {
969
995
  conf.server.csp.directives = directives;
970
996
 
971
997
  // const appPortUsed = [];
972
- _context2.next = 85;
998
+ _context2.next = 87;
973
999
  return _yakuza._.asyncMap(conf.router.config, function () {
974
1000
  var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(v, key) {
975
1001
  var name, arr, length, num;
@@ -1156,7 +1182,7 @@ var render = function () {
1156
1182
  };
1157
1183
  }());
1158
1184
 
1159
- case 85:
1185
+ case 87:
1160
1186
  // console.log(conf.router.config);
1161
1187
 
1162
1188
  conf.shareRule.app = conf.shareRule.app.map(function (ap) {
@@ -1278,12 +1304,12 @@ var render = function () {
1278
1304
 
1279
1305
  return _context2.abrupt('return', { conf: conf });
1280
1306
 
1281
- case 96:
1307
+ case 98:
1282
1308
  case 'end':
1283
1309
  return _context2.stop();
1284
1310
  }
1285
1311
  }
1286
- }, _callee2, undefined, [[16, 25]]);
1312
+ }, _callee2, undefined, [[18, 27]]);
1287
1313
  }));
1288
1314
 
1289
1315
  return function render(_x) {