@modern-js/plugin-bff 2.68.3 → 2.68.4

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/dist/cjs/cli.js CHANGED
@@ -141,22 +141,36 @@ const bffPlugin = () => ({
141
141
  };
142
142
  return {
143
143
  config() {
144
+ var _api_useConfigContext_tools, _api_useConfigContext, _api_useConfigContext_bff, _api_useConfigContext1;
144
145
  const honoRuntimePath = isHono() ? {
145
146
  [RUNTIME_HONO]: RUNTIME_HONO
146
147
  } : void 0;
148
+ const devServer = (_api_useConfigContext = api.useConfigContext()) === null || _api_useConfigContext === void 0 ? void 0 : (_api_useConfigContext_tools = _api_useConfigContext.tools) === null || _api_useConfigContext_tools === void 0 ? void 0 : _api_useConfigContext_tools.devServer;
149
+ const prefix = ((_api_useConfigContext1 = api.useConfigContext()) === null || _api_useConfigContext1 === void 0 ? void 0 : (_api_useConfigContext_bff = _api_useConfigContext1.bff) === null || _api_useConfigContext_bff === void 0 ? void 0 : _api_useConfigContext_bff.prefix) || DEFAULT_API_PREFIX;
150
+ if (typeof devServer === "object" && devServer !== null && !Array.isArray(devServer)) {
151
+ const compress = devServer.compress;
152
+ if (typeof compress === "undefined" || compress === true) {
153
+ devServer.compress = {
154
+ filter: (req) => {
155
+ var _req_url;
156
+ return !((_req_url = req.url) === null || _req_url === void 0 ? void 0 : _req_url.includes(prefix));
157
+ }
158
+ };
159
+ }
160
+ }
147
161
  return {
148
162
  tools: {
149
163
  bundlerChain: (chain, { CHAIN_ID, isServer }) => {
150
164
  const { port, appDirectory, apiDirectory, lambdaDirectory } = api.useAppContext();
151
165
  const modernConfig = api.useResolvedConfigContext();
152
166
  const { bff } = modernConfig || {};
153
- const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
167
+ const prefix2 = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
154
168
  const httpMethodDecider = bff === null || bff === void 0 ? void 0 : bff.httpMethodDecider;
155
169
  const apiRouter = new import_bff_core.ApiRouter({
156
170
  apiDir: apiDirectory,
157
171
  appDir: appDirectory,
158
172
  lambdaDir: lambdaDirectory,
159
- prefix,
173
+ prefix: prefix2,
160
174
  httpMethodDecider,
161
175
  isBuild: true
162
176
  });
@@ -166,7 +180,7 @@ const bffPlugin = () => ({
166
180
  const name = isServer ? "server" : "client";
167
181
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
168
182
  chain.module.rule("js-bff-api").test(apiRegexp).use("custom-loader").loader(require.resolve("./loader").replace(/\\/g, "/")).options({
169
- prefix,
183
+ prefix: prefix2,
170
184
  appDir: appDirectory,
171
185
  apiDir: apiDirectory,
172
186
  lambdaDir,
package/dist/esm/cli.js CHANGED
@@ -3,6 +3,7 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
3
3
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
4
4
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
5
5
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
6
+ import { _ as _type_of } from "@swc/helpers/_/_type_of";
6
7
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
8
  import path from "path";
8
9
  import { ApiRouter } from "@modern-js/bff-core";
@@ -209,7 +210,21 @@ var bffPlugin = function() {
209
210
  };
210
211
  return {
211
212
  config: function config() {
213
+ var _api_useConfigContext_tools, _api_useConfigContext, _api_useConfigContext_bff, _api_useConfigContext1;
212
214
  var honoRuntimePath = isHono() ? _define_property({}, RUNTIME_HONO, RUNTIME_HONO) : void 0;
215
+ var devServer = (_api_useConfigContext = api.useConfigContext()) === null || _api_useConfigContext === void 0 ? void 0 : (_api_useConfigContext_tools = _api_useConfigContext.tools) === null || _api_useConfigContext_tools === void 0 ? void 0 : _api_useConfigContext_tools.devServer;
216
+ var prefix = ((_api_useConfigContext1 = api.useConfigContext()) === null || _api_useConfigContext1 === void 0 ? void 0 : (_api_useConfigContext_bff = _api_useConfigContext1.bff) === null || _api_useConfigContext_bff === void 0 ? void 0 : _api_useConfigContext_bff.prefix) || DEFAULT_API_PREFIX;
217
+ if ((typeof devServer === "undefined" ? "undefined" : _type_of(devServer)) === "object" && devServer !== null && !Array.isArray(devServer)) {
218
+ var compress = devServer.compress;
219
+ if (typeof compress === "undefined" || compress === true) {
220
+ devServer.compress = {
221
+ filter: function(req) {
222
+ var _req_url;
223
+ return !((_req_url = req.url) === null || _req_url === void 0 ? void 0 : _req_url.includes(prefix));
224
+ }
225
+ };
226
+ }
227
+ }
213
228
  return {
214
229
  tools: {
215
230
  bundlerChain: function(chain, param) {
@@ -217,13 +232,13 @@ var bffPlugin = function() {
217
232
  var _api_useAppContext = api.useAppContext(), port = _api_useAppContext.port, appDirectory = _api_useAppContext.appDirectory, apiDirectory = _api_useAppContext.apiDirectory, lambdaDirectory = _api_useAppContext.lambdaDirectory;
218
233
  var modernConfig = api.useResolvedConfigContext();
219
234
  var bff = (modernConfig || {}).bff;
220
- var prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
235
+ var prefix2 = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
221
236
  var httpMethodDecider = bff === null || bff === void 0 ? void 0 : bff.httpMethodDecider;
222
237
  var apiRouter = new ApiRouter({
223
238
  apiDir: apiDirectory,
224
239
  appDir: appDirectory,
225
240
  lambdaDir: lambdaDirectory,
226
- prefix,
241
+ prefix: prefix2,
227
242
  httpMethodDecider,
228
243
  isBuild: true
229
244
  });
@@ -233,7 +248,7 @@ var bffPlugin = function() {
233
248
  var name = isServer ? "server" : "client";
234
249
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
235
250
  chain.module.rule("js-bff-api").test(apiRegexp).use("custom-loader").loader(require.resolve("./loader").replace(/\\/g, "/")).options({
236
- prefix,
251
+ prefix: prefix2,
237
252
  appDir: appDirectory,
238
253
  apiDir: apiDirectory,
239
254
  lambdaDir,
@@ -107,22 +107,36 @@ const bffPlugin = () => ({
107
107
  };
108
108
  return {
109
109
  config() {
110
+ var _api_useConfigContext_tools, _api_useConfigContext, _api_useConfigContext_bff, _api_useConfigContext1;
110
111
  const honoRuntimePath = isHono() ? {
111
112
  [RUNTIME_HONO]: RUNTIME_HONO
112
113
  } : void 0;
114
+ const devServer = (_api_useConfigContext = api.useConfigContext()) === null || _api_useConfigContext === void 0 ? void 0 : (_api_useConfigContext_tools = _api_useConfigContext.tools) === null || _api_useConfigContext_tools === void 0 ? void 0 : _api_useConfigContext_tools.devServer;
115
+ const prefix = ((_api_useConfigContext1 = api.useConfigContext()) === null || _api_useConfigContext1 === void 0 ? void 0 : (_api_useConfigContext_bff = _api_useConfigContext1.bff) === null || _api_useConfigContext_bff === void 0 ? void 0 : _api_useConfigContext_bff.prefix) || DEFAULT_API_PREFIX;
116
+ if (typeof devServer === "object" && devServer !== null && !Array.isArray(devServer)) {
117
+ const compress = devServer.compress;
118
+ if (typeof compress === "undefined" || compress === true) {
119
+ devServer.compress = {
120
+ filter: (req) => {
121
+ var _req_url;
122
+ return !((_req_url = req.url) === null || _req_url === void 0 ? void 0 : _req_url.includes(prefix));
123
+ }
124
+ };
125
+ }
126
+ }
113
127
  return {
114
128
  tools: {
115
129
  bundlerChain: (chain, { CHAIN_ID, isServer }) => {
116
130
  const { port, appDirectory, apiDirectory, lambdaDirectory } = api.useAppContext();
117
131
  const modernConfig = api.useResolvedConfigContext();
118
132
  const { bff } = modernConfig || {};
119
- const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
133
+ const prefix2 = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
120
134
  const httpMethodDecider = bff === null || bff === void 0 ? void 0 : bff.httpMethodDecider;
121
135
  const apiRouter = new ApiRouter({
122
136
  apiDir: apiDirectory,
123
137
  appDir: appDirectory,
124
138
  lambdaDir: lambdaDirectory,
125
- prefix,
139
+ prefix: prefix2,
126
140
  httpMethodDecider,
127
141
  isBuild: true
128
142
  });
@@ -132,7 +146,7 @@ const bffPlugin = () => ({
132
146
  const name = isServer ? "server" : "client";
133
147
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
134
148
  chain.module.rule("js-bff-api").test(apiRegexp).use("custom-loader").loader(require.resolve("./loader").replace(/\\/g, "/")).options({
135
- prefix,
149
+ prefix: prefix2,
136
150
  appDir: appDirectory,
137
151
  apiDir: apiDirectory,
138
152
  lambdaDir,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.68.3",
18
+ "version": "2.68.4",
19
19
  "jsnext:source": "./src/cli.ts",
20
20
  "types": "./dist/types/cli.d.ts",
21
21
  "main": "./dist/cjs/cli.js",
@@ -76,11 +76,11 @@
76
76
  "@babel/core": "^7.26.0",
77
77
  "@swc/helpers": "^0.5.17",
78
78
  "type-is": "^1.6.18",
79
- "@modern-js/bff-core": "2.68.3",
80
- "@modern-js/create-request": "2.68.3",
81
- "@modern-js/server-core": "2.68.3",
82
- "@modern-js/server-utils": "2.68.3",
83
- "@modern-js/utils": "2.68.3"
79
+ "@modern-js/bff-core": "2.68.4",
80
+ "@modern-js/create-request": "2.68.4",
81
+ "@modern-js/server-core": "2.68.4",
82
+ "@modern-js/server-utils": "2.68.4",
83
+ "@modern-js/utils": "2.68.4"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@types/babel__core": "^7.20.5",
@@ -93,13 +93,13 @@
93
93
  "typescript": "^5",
94
94
  "webpack": "^5.99.8",
95
95
  "zod": "^3.22.3",
96
- "@modern-js/app-tools": "2.68.3",
97
- "@modern-js/bff-runtime": "2.68.3",
98
- "@modern-js/core": "2.68.3",
99
- "@modern-js/plugin-v2": "2.68.3",
100
- "@modern-js/runtime": "2.68.3",
96
+ "@modern-js/app-tools": "2.68.4",
97
+ "@modern-js/bff-runtime": "2.68.4",
98
+ "@modern-js/core": "2.68.4",
99
+ "@modern-js/plugin-v2": "2.68.4",
100
+ "@modern-js/runtime": "2.68.4",
101
+ "@modern-js/types": "2.68.4",
101
102
  "@scripts/build": "2.66.0",
102
- "@modern-js/types": "2.68.3",
103
103
  "@scripts/jest-config": "2.66.0"
104
104
  },
105
105
  "sideEffects": false,