@modern-js/plugin-bff 2.15.0 → 2.17.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @modern-js/plugin-bff
2
2
 
3
+ ## 2.17.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/bff-core@2.17.0
8
+ - @modern-js/create-request@2.17.0
9
+ - @modern-js/server-utils@2.17.0
10
+ - @modern-js/utils@2.17.0
11
+
12
+ ## 2.16.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 4e876ab: chore: package.json include the monorepo-relative directory
17
+
18
+ chore: 在 package.json 中声明 monorepo 的子路径
19
+
20
+ - Updated dependencies [5954330]
21
+ - Updated dependencies [7596520]
22
+ - Updated dependencies [4e876ab]
23
+ - @modern-js/utils@2.16.0
24
+ - @modern-js/create-request@2.16.0
25
+ - @modern-js/bff-core@2.16.0
26
+ - @modern-js/server-utils@2.16.0
27
+
3
28
  ## 2.15.0
4
29
 
5
30
  ### Patch Changes
package/dist/cjs/cli.js CHANGED
@@ -1,168 +1,150 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var cli_exports = {};
29
- __export(cli_exports, {
30
- default: () => cli_default
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: () => _default
31
8
  });
32
- module.exports = __toCommonJS(cli_exports);
33
- var import_path = __toESM(require("path"));
34
- var import_utils = require("@modern-js/utils");
35
- var import_server_utils = require("@modern-js/server-utils");
36
- var import_bff_core = require("@modern-js/bff-core");
37
- var import_helper = require("./helper");
9
+ const _path = /* @__PURE__ */ _interop_require_default(require("path"));
10
+ const _utils = require("@modern-js/utils");
11
+ const _serverutils = require("@modern-js/server-utils");
12
+ const _bffcore = require("@modern-js/bff-core");
13
+ const _helper = require("./helper");
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
38
19
  const DEFAULT_API_PREFIX = "/api";
39
20
  const TS_CONFIG_FILENAME = "tsconfig.json";
40
- var cli_default = () => ({
41
- name: "@modern-js/plugin-bff",
42
- setup: (api) => {
43
- let unRegisterResolveRuntimePath = null;
44
- return {
45
- validateSchema() {
46
- return import_utils.PLUGIN_SCHEMAS["@modern-js/plugin-bff"];
47
- },
48
- config() {
49
- return {
50
- tools: {
51
- bundlerChain: (chain, { CHAIN_ID, isServer }) => {
52
- const { port, apiDirectory, lambdaDirectory } = api.useAppContext();
53
- const modernConfig = api.useResolvedConfigContext();
54
- const { bff } = modernConfig || {};
55
- const prefix = (bff == null ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
56
- const httpMethodDecider = bff == null ? void 0 : bff.httpMethodDecider;
57
- chain.resolve.alias.set("@api", apiDirectory);
58
- const apiRouter = new import_bff_core.ApiRouter({
59
- apiDir: apiDirectory,
60
- lambdaDir: lambdaDirectory,
61
- prefix,
62
- httpMethodDecider
63
- });
64
- const lambdaDir = apiRouter.getLambdaDir();
65
- const existLambda = apiRouter.isExistLambda();
66
- const apiRegexp = new RegExp(
67
- (0, import_utils.normalizeOutputPath)(`${apiDirectory}${import_path.default.sep}.*(.[tj]s)$`)
68
- );
69
- const name = isServer ? "server" : "client";
70
- chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
71
- chain.module.rule(CHAIN_ID.RULE.JS_BFF_API).test(apiRegexp).use("custom-loader").loader(require.resolve("./loader").replace(/\\/g, "/")).options({
72
- prefix,
73
- apiDir: apiDirectory,
74
- lambdaDir,
75
- existLambda,
76
- port,
77
- target: name,
78
- httpMethodDecider
79
- });
21
+ const _default = () => {
22
+ return {
23
+ name: "@modern-js/plugin-bff",
24
+ setup: (api) => {
25
+ let unRegisterResolveRuntimePath = null;
26
+ return {
27
+ validateSchema() {
28
+ return _utils.PLUGIN_SCHEMAS["@modern-js/plugin-bff"];
29
+ },
30
+ config() {
31
+ return {
32
+ tools: {
33
+ bundlerChain: (chain, { CHAIN_ID, isServer }) => {
34
+ const { port, apiDirectory, lambdaDirectory } = api.useAppContext();
35
+ const modernConfig = api.useResolvedConfigContext();
36
+ const { bff } = modernConfig || {};
37
+ const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
38
+ const httpMethodDecider = bff === null || bff === void 0 ? void 0 : bff.httpMethodDecider;
39
+ chain.resolve.alias.set("@api", apiDirectory);
40
+ const apiRouter = new _bffcore.ApiRouter({
41
+ apiDir: apiDirectory,
42
+ lambdaDir: lambdaDirectory,
43
+ prefix,
44
+ httpMethodDecider
45
+ });
46
+ const lambdaDir = apiRouter.getLambdaDir();
47
+ const existLambda = apiRouter.isExistLambda();
48
+ const apiRegexp = new RegExp((0, _utils.normalizeOutputPath)(`${apiDirectory}${_path.default.sep}.*(.[tj]s)$`));
49
+ const name = isServer ? "server" : "client";
50
+ chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
51
+ chain.module.rule(CHAIN_ID.RULE.JS_BFF_API).test(apiRegexp).use("custom-loader").loader(require.resolve("./loader").replace(/\\/g, "/")).options({
52
+ prefix,
53
+ apiDir: apiDirectory,
54
+ lambdaDir,
55
+ existLambda,
56
+ port,
57
+ target: name,
58
+ httpMethodDecider
59
+ });
60
+ }
61
+ },
62
+ source: {
63
+ moduleScopes: [
64
+ `./${_utils.API_DIR}`,
65
+ /create-request/
66
+ ]
80
67
  }
81
- },
82
- source: {
83
- moduleScopes: [`./${import_utils.API_DIR}`, /create-request/]
68
+ };
69
+ },
70
+ modifyServerRoutes({ routes }) {
71
+ const modernConfig = api.useResolvedConfigContext();
72
+ const { bff } = modernConfig || {};
73
+ const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || "/api";
74
+ const prefixList = [];
75
+ if (Array.isArray(prefix)) {
76
+ prefixList.push(...prefix);
77
+ } else {
78
+ prefixList.push(prefix);
79
+ }
80
+ const apiServerRoutes = prefixList.map((pre) => ({
81
+ urlPath: pre,
82
+ isApi: true,
83
+ entryPath: "",
84
+ isSPA: false,
85
+ isSSR: false
86
+ }));
87
+ if (bff === null || bff === void 0 ? void 0 : bff.enableHandleWeb) {
88
+ return {
89
+ routes: routes.map((route) => {
90
+ return {
91
+ ...route,
92
+ isApi: true
93
+ };
94
+ }).concat(apiServerRoutes)
95
+ };
84
96
  }
85
- };
86
- },
87
- modifyServerRoutes({ routes }) {
88
- const modernConfig = api.useResolvedConfigContext();
89
- const { bff } = modernConfig || {};
90
- const prefix = (bff == null ? void 0 : bff.prefix) || "/api";
91
- const prefixList = [];
92
- if (Array.isArray(prefix)) {
93
- prefixList.push(...prefix);
94
- } else {
95
- prefixList.push(prefix);
96
- }
97
- const apiServerRoutes = prefixList.map((pre) => ({
98
- urlPath: pre,
99
- isApi: true,
100
- entryPath: "",
101
- isSPA: false,
102
- isSSR: false
103
- }));
104
- if (bff == null ? void 0 : bff.enableHandleWeb) {
105
97
  return {
106
- routes: routes.map((route) => {
107
- return {
108
- ...route,
109
- isApi: true
110
- };
111
- }).concat(apiServerRoutes)
98
+ routes: routes.concat(apiServerRoutes)
112
99
  };
113
- }
114
- return { routes: routes.concat(apiServerRoutes) };
115
- },
116
- collectServerPlugins({ plugins }) {
117
- plugins.push({
118
- "@modern-js/plugin-bff": "@modern-js/plugin-bff/server"
119
- });
120
- return { plugins };
121
- },
122
- async beforeBuild() {
123
- if ((0, import_utils.isProd)()) {
124
- const { internalDirectory } = api.useAppContext();
125
- unRegisterResolveRuntimePath = (0, import_helper.registerModernRuntimePath)(internalDirectory);
126
- }
127
- },
128
- async afterBuild() {
129
- if (unRegisterResolveRuntimePath) {
130
- unRegisterResolveRuntimePath();
131
- }
132
- const { appDirectory, distDirectory, apiDirectory, sharedDirectory } = api.useAppContext();
133
- const modernConfig = api.useResolvedConfigContext();
134
- const distDir = import_path.default.resolve(distDirectory);
135
- const apiDir = apiDirectory || import_path.default.resolve(appDirectory, import_utils.API_DIR);
136
- const sharedDir = sharedDirectory || import_path.default.resolve(appDirectory, import_utils.SHARED_DIR);
137
- const tsconfigPath = import_path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
138
- const sourceDirs = [];
139
- if (import_utils.fs.existsSync(apiDir)) {
140
- sourceDirs.push(apiDir);
141
- }
142
- if (import_utils.fs.existsSync(sharedDir)) {
143
- sourceDirs.push(sharedDir);
144
- }
145
- const { server } = modernConfig;
146
- const { alias } = modernConfig.source;
147
- const { babel } = modernConfig.tools;
148
- if (sourceDirs.length > 0) {
149
- await (0, import_server_utils.compile)(
150
- appDirectory,
151
- {
100
+ },
101
+ collectServerPlugins({ plugins }) {
102
+ plugins.push({
103
+ "@modern-js/plugin-bff": "@modern-js/plugin-bff/server"
104
+ });
105
+ return {
106
+ plugins
107
+ };
108
+ },
109
+ async beforeBuild() {
110
+ if ((0, _utils.isProd)()) {
111
+ const { internalDirectory } = api.useAppContext();
112
+ unRegisterResolveRuntimePath = (0, _helper.registerModernRuntimePath)(internalDirectory);
113
+ }
114
+ },
115
+ async afterBuild() {
116
+ if (unRegisterResolveRuntimePath) {
117
+ unRegisterResolveRuntimePath();
118
+ }
119
+ const { appDirectory, distDirectory, apiDirectory, sharedDirectory } = api.useAppContext();
120
+ const modernConfig = api.useResolvedConfigContext();
121
+ const distDir = _path.default.resolve(distDirectory);
122
+ const apiDir = apiDirectory || _path.default.resolve(appDirectory, _utils.API_DIR);
123
+ const sharedDir = sharedDirectory || _path.default.resolve(appDirectory, _utils.SHARED_DIR);
124
+ const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
125
+ const sourceDirs = [];
126
+ if (_utils.fs.existsSync(apiDir)) {
127
+ sourceDirs.push(apiDir);
128
+ }
129
+ if (_utils.fs.existsSync(sharedDir)) {
130
+ sourceDirs.push(sharedDir);
131
+ }
132
+ const { server } = modernConfig;
133
+ const { alias } = modernConfig.source;
134
+ const { babel } = modernConfig.tools;
135
+ if (sourceDirs.length > 0) {
136
+ await (0, _serverutils.compile)(appDirectory, {
152
137
  server,
153
138
  alias,
154
139
  babelConfig: babel
155
- },
156
- {
140
+ }, {
157
141
  sourceDirs,
158
142
  distDir,
159
143
  tsconfigPath
160
- }
161
- );
144
+ });
145
+ }
162
146
  }
163
- }
164
- };
165
- }
166
- });
167
- // Annotate the CommonJS export names for ESM import in node:
168
- 0 && (module.exports = {});
147
+ };
148
+ }
149
+ };
150
+ };
@@ -1,26 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
6
  for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var constants_exports = {};
19
- __export(constants_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
20
13
  API_APP_NAME: () => API_APP_NAME,
21
14
  BUILD_FILES: () => BUILD_FILES
22
15
  });
23
- module.exports = __toCommonJS(constants_exports);
24
16
  const API_APP_NAME = "_app";
25
17
  const BUILD_FILES = [
26
18
  "**/*.[tj]sx?",
@@ -31,8 +23,3 @@ const BUILD_FILES = [
31
23
  "!__tests__/*.tsx?",
32
24
  "!__tests__/*.jsx?"
33
25
  ];
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- API_APP_NAME,
37
- BUILD_FILES
38
- });
@@ -1,47 +1,59 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var helper_exports = {};
29
- __export(helper_exports, {
30
- registerModernRuntimePath: () => registerModernRuntimePath
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
31
4
  });
32
- module.exports = __toCommonJS(helper_exports);
33
- var path = __toESM(require("path"));
34
- var import_bff_core = require("@modern-js/bff-core");
5
+ Object.defineProperty(exports, "registerModernRuntimePath", {
6
+ enumerable: true,
7
+ get: () => registerModernRuntimePath
8
+ });
9
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
10
+ const _bffcore = require("@modern-js/bff-core");
11
+ function _getRequireWildcardCache(nodeInterop) {
12
+ if (typeof WeakMap !== "function")
13
+ return null;
14
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
15
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
16
+ return (_getRequireWildcardCache = function(nodeInterop2) {
17
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
18
+ })(nodeInterop);
19
+ }
20
+ function _interop_require_wildcard(obj, nodeInterop) {
21
+ if (!nodeInterop && obj && obj.__esModule) {
22
+ return obj;
23
+ }
24
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
25
+ return {
26
+ default: obj
27
+ };
28
+ }
29
+ var cache = _getRequireWildcardCache(nodeInterop);
30
+ if (cache && cache.has(obj)) {
31
+ return cache.get(obj);
32
+ }
33
+ var newObj = {};
34
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
35
+ for (var key in obj) {
36
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
37
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
38
+ if (desc && (desc.get || desc.set)) {
39
+ Object.defineProperty(newObj, key, desc);
40
+ } else {
41
+ newObj[key] = obj[key];
42
+ }
43
+ }
44
+ }
45
+ newObj.default = obj;
46
+ if (cache) {
47
+ cache.set(obj, newObj);
48
+ }
49
+ return newObj;
50
+ }
35
51
  const serverRuntimeAlias = "@modern-js/runtime/server";
36
52
  const serverRuntimePath = ".runtime-exports/server";
37
53
  const registerModernRuntimePath = (internalDirectory) => {
38
54
  const paths = {
39
- [serverRuntimeAlias]: path.join(internalDirectory, serverRuntimePath)
55
+ [serverRuntimeAlias]: _path.join(internalDirectory, serverRuntimePath)
40
56
  };
41
- const unRegister = (0, import_bff_core.registerPaths)(paths);
57
+ const unRegister = (0, _bffcore.registerPaths)(paths);
42
58
  return unRegister;
43
59
  };
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- registerModernRuntimePath
47
- });
package/dist/cjs/index.js CHANGED
@@ -1,17 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var src_exports = {};
16
- module.exports = __toCommonJS(src_exports);
17
- __reExport(src_exports, require("./constants"), module.exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./constants"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
@@ -1,27 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var loader_exports = {};
19
- __export(loader_exports, {
20
- default: () => loader_default
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: () => _default
21
8
  });
22
- module.exports = __toCommonJS(loader_exports);
23
- var import_bff_core = require("@modern-js/bff-core");
24
- var import_utils = require("@modern-js/utils");
9
+ const _bffcore = require("@modern-js/bff-core");
10
+ const _utils = require("@modern-js/utils");
25
11
  async function loader(source) {
26
12
  this.cacheable();
27
13
  const { resourcePath } = this;
@@ -30,7 +16,7 @@ async function loader(source) {
30
16
  const draftOptions = this.getOptions();
31
17
  const warning = `The file ${resourcePath} is not allowd to be imported in src directory, only API definition files are allowed.`;
32
18
  if (!draftOptions.existLambda) {
33
- import_utils.logger.warn(warning);
19
+ _utils.logger.warn(warning);
34
20
  callback(null, `throw new Error('${warning}')`);
35
21
  return;
36
22
  }
@@ -46,7 +32,7 @@ async function loader(source) {
46
32
  };
47
33
  const { lambdaDir } = draftOptions;
48
34
  if (!resourcePath.startsWith(lambdaDir)) {
49
- import_utils.logger.warn(warning);
35
+ _utils.logger.warn(warning);
50
36
  callback(null, `throw new Error('${warning}')`);
51
37
  return;
52
38
  }
@@ -57,13 +43,11 @@ async function loader(source) {
57
43
  options.requestCreator = draftOptions.requestCreator;
58
44
  }
59
45
  options.requireResolve = require.resolve;
60
- const result = await (0, import_bff_core.generateClient)(options);
46
+ const result = await (0, _bffcore.generateClient)(options);
61
47
  if (result.isOk) {
62
48
  callback(void 0, result.value);
63
49
  } else {
64
50
  callback(void 0, `throw new Error('${result.value}')`);
65
51
  }
66
52
  }
67
- var loader_default = loader;
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {});
53
+ const _default = loader;