@next-core/brick-container 3.20.4 → 3.20.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/brick-container",
3
- "version": "3.20.4",
3
+ "version": "3.20.6",
4
4
  "description": "Brick Container Server",
5
5
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/brick-container",
6
6
  "license": "GPL-3.0",
@@ -35,7 +35,7 @@
35
35
  "test:ci": "cross-env NODE_ENV='test' CI=true test-next"
36
36
  },
37
37
  "dependencies": {
38
- "@next-core/serve-helpers": "^1.2.4",
38
+ "@next-core/serve-helpers": "^1.2.5",
39
39
  "body-parser": "^1.20.3",
40
40
  "chalk": "^4.1.2",
41
41
  "chokidar": "^4.0.1",
@@ -75,5 +75,5 @@
75
75
  "@next-core/runtime": "*",
76
76
  "@next-core/utils": "*"
77
77
  },
78
- "gitHead": "61f029536164a0fbe519efee18d21dfefee9f3ae"
78
+ "gitHead": "9c89b57fe85a45fd95b1a280576f062f0d082f70"
79
79
  }
package/serve/getProxy.js CHANGED
@@ -103,6 +103,7 @@ export default function getProxy(env, getRawIndexHtml) {
103
103
  return responseBuffer;
104
104
  }
105
105
 
106
+ // Add or clear secure related cookie flags
106
107
  const secureCookieFlags = [
107
108
  "SameSite=None",
108
109
  "Secure",
@@ -115,12 +116,19 @@ export default function getProxy(env, getRawIndexHtml) {
115
116
  req.path === "/next/api/auth/login/v2" &&
116
117
  Array.isArray(setCookies)
117
118
  ) {
119
+ // - If the server is https, but the local is http, clear the secure cookie flags;
120
+ // - Otherwise, if the local is localhost and cookieSameSiteNone is enabled (default),
121
+ // add the secure cookie flags;
122
+ // - Otherwise, if the local is https, do nothing;
123
+ // - Otherwise, clear the secure cookie flags;
118
124
  const strategy =
119
- env.cookieSameSiteNone && env.host === "localhost"
120
- ? "add"
121
- : env.https
122
- ? null
123
- : "clear";
125
+ env.server.startsWith("https:") && !env.https
126
+ ? "clear"
127
+ : env.cookieSameSiteNone && env.host === "localhost"
128
+ ? "add"
129
+ : env.https
130
+ ? null
131
+ : "clear";
124
132
  if (strategy) {
125
133
  // Note: it seems that now Chrome (v107) requires `SameSite=None` even for localhost.
126
134
  // However, `Secure` can use used with non-http for localhost.
@@ -1,10 +1,10 @@
1
- import express from "express";
2
1
  import jsYaml from "js-yaml";
3
2
  import bootstrapJson from "./bootstrapJson.js";
4
3
  import mockAuth from "./mockAuth.js";
5
4
  import singleAppBootstrapJson from "./singleAppBootstrapJson.js";
6
5
  import standaloneBootstrapJson from "./standaloneBootstrapJson.js";
7
6
  import serveBricksWithVersions from "./serveBricksWithVersions.js";
7
+ import { serveBricks } from "@next-core/serve-helpers";
8
8
 
9
9
  const { safeDump, JSON_SCHEMA } = jsYaml;
10
10
 
@@ -34,7 +34,7 @@ export function getMiddlewares(env) {
34
34
  });
35
35
  middlewares.push({
36
36
  path: `${baseHref}api/v1/runtime_standalone`,
37
- middleware(req, res) {
37
+ middleware(_req, res) {
38
38
  res.send({
39
39
  code: 0,
40
40
  data: {
@@ -45,7 +45,7 @@ export function getMiddlewares(env) {
45
45
  });
46
46
  middlewares.push({
47
47
  path: `${baseHref}api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/:appId`,
48
- middleware(req, res) {
48
+ middleware(_req, res) {
49
49
  res.send({
50
50
  code: 0,
51
51
  data: null,
@@ -54,7 +54,7 @@ export function getMiddlewares(env) {
54
54
  });
55
55
  middlewares.push({
56
56
  path: `${baseHref}api/gateway/data_exchange.store.ClickHouseInsertData/api/v1/data_exchange/frontend_stat`,
57
- middleware(req, res) {
57
+ middleware(_req, res) {
58
58
  res.send({
59
59
  code: 0,
60
60
  data: null,
@@ -67,7 +67,7 @@ export function getMiddlewares(env) {
67
67
  }
68
68
 
69
69
  export function getPreMiddlewares(env) {
70
- const { baseHref, localMicroApps, localBrickFolders, userConfigByApps } = env;
70
+ const { baseHref, localMicroApps, userConfigByApps } = env;
71
71
 
72
72
  /**
73
73
  * @type {import("webpack-dev-server").Middleware[]}
@@ -81,7 +81,7 @@ export function getPreMiddlewares(env) {
81
81
  });
82
82
  middlewares.push({
83
83
  path: `${baseHref}sa-static/${appId}/versions/0.0.0/webroot/conf.yaml`,
84
- middleware(req, res) {
84
+ middleware(_req, res) {
85
85
  if (userConfigByApps) {
86
86
  const conf = {
87
87
  user_config_by_apps: userConfigByApps,
@@ -108,12 +108,10 @@ export function getPreMiddlewares(env) {
108
108
  middleware: serveBricksWithVersions(env),
109
109
  });
110
110
 
111
- for (const dir of localBrickFolders) {
112
- middlewares.push({
113
- path: `${baseHref}bricks/`,
114
- middleware: express.static(dir),
115
- });
116
- }
111
+ middlewares.push({
112
+ path: `${baseHref}bricks/`,
113
+ middleware: serveBricks(env),
114
+ });
117
115
 
118
116
  return middlewares;
119
117
  }
@@ -1,2 +0,0 @@
1
- (globalThis.webpackChunk_next_core_brick_container=globalThis.webpackChunk_next_core_brick_container||[]).push([[844],{9844:(n,e,r)=>{var s={"./en-au":4073,"./en-au.js":4073,"./en-ca":1387,"./en-ca.js":1387,"./en-gb":1386,"./en-gb.js":1386,"./en-ie":3537,"./en-ie.js":3537,"./en-il":7050,"./en-il.js":7050,"./en-in":627,"./en-in.js":627,"./en-nz":6963,"./en-nz.js":6963,"./en-sg":4865,"./en-sg.js":4865,"./zh-cn":1329,"./zh-cn.js":1329,"./zh-hk":3005,"./zh-hk.js":3005,"./zh-mo":7696,"./zh-mo.js":7696,"./zh-tw":5861,"./zh-tw.js":5861};function o(n){var e=i(n);return r(e)}function i(n){if(!r.o(s,n)){var e=new Error("Cannot find module '"+n+"'");throw e.code="MODULE_NOT_FOUND",e}return s[n]}o.keys=function(){return Object.keys(s)},o.resolve=i,n.exports=o,o.id=9844}}]);
2
- //# sourceMappingURL=844.053079f5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"844.053079f5.js","mappings":"sIAAA,IAAIA,EAAM,CACT,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,IACX,aAAc,IACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,KACd,UAAW,KACX,aAAc,MAIf,SAASC,EAAeC,GACvB,IAAIC,EAAKC,EAAsBF,GAC/B,OAAOG,EAAoBF,EAC5B,CACA,SAASC,EAAsBF,GAC9B,IAAIG,EAAoBC,EAAEN,EAAKE,GAAM,CACpC,IAAIK,EAAI,IAAIC,MAAM,uBAAyBN,EAAM,KAEjD,MADAK,EAAEE,KAAO,mBACHF,CACP,CACA,OAAOP,EAAIE,EACZ,CACAD,EAAeS,KAAO,WACrB,OAAOC,OAAOD,KAAKV,EACpB,EACAC,EAAeW,QAAUR,EACzBS,EAAOC,QAAUb,EACjBA,EAAeE,GAAK,I","sources":["webpack:///../../node_modules/moment/locale/ sync zh%7Cen"],"sourcesContent":["var map = {\n\t\"./en-au\": 4073,\n\t\"./en-au.js\": 4073,\n\t\"./en-ca\": 1387,\n\t\"./en-ca.js\": 1387,\n\t\"./en-gb\": 1386,\n\t\"./en-gb.js\": 1386,\n\t\"./en-ie\": 3537,\n\t\"./en-ie.js\": 3537,\n\t\"./en-il\": 7050,\n\t\"./en-il.js\": 7050,\n\t\"./en-in\": 627,\n\t\"./en-in.js\": 627,\n\t\"./en-nz\": 6963,\n\t\"./en-nz.js\": 6963,\n\t\"./en-sg\": 4865,\n\t\"./en-sg.js\": 4865,\n\t\"./zh-cn\": 1329,\n\t\"./zh-cn.js\": 1329,\n\t\"./zh-hk\": 3005,\n\t\"./zh-hk.js\": 3005,\n\t\"./zh-mo\": 7696,\n\t\"./zh-mo.js\": 7696,\n\t\"./zh-tw\": 5861,\n\t\"./zh-tw.js\": 5861\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 9844;"],"names":["map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports"],"sourceRoot":""}
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_core_brick_container=globalThis.webpackChunk_next_core_brick_container||[]).push([[90],{90:(c,e,n)=>{n.r(e)}}]);