@modern-js/plugin-bff 3.0.0-alpha.0 → 3.0.0-alpha.2

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
@@ -66,13 +66,11 @@ const bffPlugin = ()=>({
66
66
  const { server } = modernConfig;
67
67
  const { alias } = modernConfig.source;
68
68
  const { alias: resolveAlias } = modernConfig.resolve;
69
- const { babel } = modernConfig.tools;
70
69
  if (sourceDirs.length > 0) {
71
70
  const combinedAlias = [].concat(alias ?? []).concat(resolveAlias ?? []);
72
71
  await (0, server_utils_namespaceObject.compile)(appDirectory, {
73
72
  server,
74
- alias: combinedAlias,
75
- babelConfig: babel
73
+ alias: combinedAlias
76
74
  }, {
77
75
  sourceDirs,
78
76
  distDir,
@@ -177,7 +175,8 @@ const bffPlugin = ()=>({
177
175
  const existLambda = apiRouter.isExistLambda();
178
176
  const apiRegexp = new RegExp((0, utils_namespaceObject.normalizeOutputPath)(`${apiDirectory}${external_path_default().sep}.*(.[tj]s)$`));
179
177
  const name = isServer ? 'server' : 'client';
180
- const loaderPath = require.resolve('./loader');
178
+ const sourceExt = 'js';
179
+ const loaderPath = external_path_default().join(__dirname, `loader.${sourceExt}`);
181
180
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
182
181
  chain.module.rule('js-bff-api').test(apiRegexp).use('custom-loader').loader(loaderPath.replace(/\\/g, '/')).options({
183
182
  prefix,
@@ -71,6 +71,7 @@ class HonoAdapter {
71
71
  this.registerApiRoutes = async ()=>{
72
72
  if (!this.isHono) return;
73
73
  this.apiServer = new server_core_namespaceObject.Hono();
74
+ this.apiServer.use('*', server_core_namespaceObject.run);
74
75
  this.apiMiddleware.forEach(({ path = '*', method = 'all', handler })=>{
75
76
  const handlers = this.wrapInArray(handler);
76
77
  if (0 === handlers.length) return;
@@ -39,7 +39,6 @@ const external_path_namespaceObject = require("path");
39
39
  var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
40
40
  const bff_core_namespaceObject = require("@modern-js/bff-core");
41
41
  const utils_namespaceObject = require("@modern-js/utils");
42
- const external_constants_js_namespaceObject = require("./constants.js");
43
42
  const adapter_js_namespaceObject = require("./runtime/hono/adapter.js");
44
43
  class Storage {
45
44
  reset() {
@@ -49,27 +48,15 @@ class Storage {
49
48
  this.middlewares = [];
50
49
  }
51
50
  }
52
- const createTransformAPI = (storage)=>({
53
- addMiddleware (fn) {
54
- storage.middlewares.push(fn);
55
- }
56
- });
57
51
  const server = ()=>({
58
52
  name: '@modern-js/plugin-bff',
59
53
  setup: (api)=>{
60
54
  const storage = new Storage();
61
- const transformAPI = createTransformAPI(storage);
62
- let apiAppPath = '';
63
55
  let apiRouter;
64
56
  const honoAdapter = new adapter_js_namespaceObject.HonoAdapter(api);
65
57
  api.onPrepare(async ()=>{
66
58
  const appContext = api.getServerContext();
67
- const { appDirectory, distDirectory, render } = appContext;
68
- const root = (0, utils_namespaceObject.isProd)() ? distDirectory : appDirectory;
69
- const apiPath = external_path_default().resolve(root || process.cwd(), utils_namespaceObject.API_DIR);
70
- apiAppPath = external_path_default().resolve(apiPath, external_constants_js_namespaceObject.API_APP_NAME);
71
- const apiMod = await (0, utils_namespaceObject.requireExistModule)(apiAppPath);
72
- if (apiMod && 'function' == typeof apiMod) apiMod(transformAPI);
59
+ const { render } = appContext;
73
60
  const { middlewares } = storage;
74
61
  api.updateServerContext({
75
62
  ...appContext,
@@ -117,8 +104,6 @@ const server = ()=>({
117
104
  api.onReset(async ({ event })=>{
118
105
  storage.reset();
119
106
  const appContext = api.getServerContext();
120
- const newApiModule = await (0, utils_namespaceObject.requireExistModule)(apiAppPath);
121
- if (newApiModule && 'function' == typeof newApiModule) newApiModule(transformAPI);
122
107
  const { middlewares } = storage;
123
108
  api.updateServerContext({
124
109
  ...appContext,
@@ -37,7 +37,7 @@ __webpack_require__.d(__webpack_exports__, {
37
37
  createHonoHandler: ()=>createHonoHandler
38
38
  });
39
39
  const bff_core_namespaceObject = require("@modern-js/bff-core");
40
- const qs_namespaceObject = require("@modern-js/create-request/qs");
40
+ const external_qs_namespaceObject = require("qs");
41
41
  const external_type_is_namespaceObject = require("type-is");
42
42
  var external_type_is_default = /*#__PURE__*/ __webpack_require__.n(external_type_is_namespaceObject);
43
43
  const createHonoRoutes = (handlerInfos = [])=>handlerInfos.map(({ routePath, handler, httpMethod })=>{
@@ -105,7 +105,7 @@ const createHonoHandler = (handler)=>async (c)=>{
105
105
  const getHonoInput = async (c)=>{
106
106
  const draft = {
107
107
  params: c.req.param(),
108
- query: (0, qs_namespaceObject.parse)(c.req.query()),
108
+ query: (0, external_qs_namespaceObject.parse)(c.req.query()),
109
109
  headers: c.req.header(),
110
110
  cookies: c.req.header('cookie')
111
111
  };
package/dist/esm/cli.mjs CHANGED
@@ -2,9 +2,9 @@ import path from "path";
2
2
  import { ApiRouter } from "@modern-js/bff-core";
3
3
  import { compile } from "@modern-js/server-utils";
4
4
  import { API_DIR, DEFAULT_API_PREFIX, SHARED_DIR, fs, normalizeOutputPath } from "@modern-js/utils";
5
- import clientGenerator from "./utils/clientGenerator";
6
- import pluginGenerator from "./utils/pluginGenerator";
7
- import runtimeGenerator from "./utils/runtimeGenerator";
5
+ import clientGenerator from "./utils/clientGenerator.mjs";
6
+ import pluginGenerator from "./utils/pluginGenerator.mjs";
7
+ import runtimeGenerator from "./utils/runtimeGenerator.mjs";
8
8
  const TS_CONFIG_FILENAME = 'tsconfig.json';
9
9
  const RUNTIME_CREATE_REQUEST = '@modern-js/plugin-bff/client';
10
10
  const RUNTIME_HONO = '@modern-js/plugin-bff/server';
@@ -24,13 +24,11 @@ const bffPlugin = ()=>({
24
24
  const { server } = modernConfig;
25
25
  const { alias } = modernConfig.source;
26
26
  const { alias: resolveAlias } = modernConfig.resolve;
27
- const { babel } = modernConfig.tools;
28
27
  if (sourceDirs.length > 0) {
29
28
  const combinedAlias = [].concat(alias ?? []).concat(resolveAlias ?? []);
30
29
  await compile(appDirectory, {
31
30
  server,
32
- alias: combinedAlias,
33
- babelConfig: babel
31
+ alias: combinedAlias
34
32
  }, {
35
33
  sourceDirs,
36
34
  distDir,
@@ -135,7 +133,8 @@ const bffPlugin = ()=>({
135
133
  const existLambda = apiRouter.isExistLambda();
136
134
  const apiRegexp = new RegExp(normalizeOutputPath(`${apiDirectory}${path.sep}.*(.[tj]s)$`));
137
135
  const name = isServer ? 'server' : 'client';
138
- const loaderPath = require.resolve('./loader');
136
+ const sourceExt = 'mjs';
137
+ const loaderPath = path.join(__dirname, `loader.${sourceExt}`);
139
138
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
140
139
  chain.module.rule('js-bff-api').test(apiRegexp).use('custom-loader').loader(loaderPath.replace(/\\/g, '/')).options({
141
140
  prefix,
@@ -1 +1 @@
1
- export * from "./constants";
1
+ export * from "./constants.mjs";
@@ -1,6 +1,6 @@
1
- import { Hono } from "@modern-js/server-core";
1
+ import { Hono, run } from "@modern-js/server-core";
2
2
  import { isProd, logger } from "@modern-js/utils";
3
- import createHonoRoutes from "../../utils/createHonoRoutes";
3
+ import createHonoRoutes from "../../utils/createHonoRoutes.mjs";
4
4
  const before = [
5
5
  'custom-server-hook',
6
6
  'custom-server-middleware',
@@ -33,6 +33,7 @@ class HonoAdapter {
33
33
  this.registerApiRoutes = async ()=>{
34
34
  if (!this.isHono) return;
35
35
  this.apiServer = new Hono();
36
+ this.apiServer.use('*', run);
36
37
  this.apiMiddleware.forEach(({ path = '*', method = 'all', handler })=>{
37
38
  const handlers = this.wrapInArray(handler);
38
39
  if (0 === handlers.length) return;
@@ -1,4 +1,4 @@
1
1
  import { useHonoContext } from "@modern-js/server-core";
2
2
  export * from "@modern-js/bff-core";
3
- export * from "./operators";
3
+ export * from "./operators.mjs";
4
4
  export { useHonoContext };
@@ -1,8 +1,7 @@
1
1
  import path from "path";
2
2
  import { ApiRouter } from "@modern-js/bff-core";
3
- import { API_DIR, isFunction, isProd, isWebOnly, requireExistModule } from "@modern-js/utils";
4
- import { API_APP_NAME } from "./constants";
5
- import { HonoAdapter } from "./runtime/hono/adapter";
3
+ import { API_DIR, isFunction, isWebOnly } from "@modern-js/utils";
4
+ import { HonoAdapter } from "./runtime/hono/adapter.mjs";
6
5
  class Storage {
7
6
  reset() {
8
7
  this.middlewares = [];
@@ -11,27 +10,15 @@ class Storage {
11
10
  this.middlewares = [];
12
11
  }
13
12
  }
14
- const createTransformAPI = (storage)=>({
15
- addMiddleware (fn) {
16
- storage.middlewares.push(fn);
17
- }
18
- });
19
13
  const server = ()=>({
20
14
  name: '@modern-js/plugin-bff',
21
15
  setup: (api)=>{
22
16
  const storage = new Storage();
23
- const transformAPI = createTransformAPI(storage);
24
- let apiAppPath = '';
25
17
  let apiRouter;
26
18
  const honoAdapter = new HonoAdapter(api);
27
19
  api.onPrepare(async ()=>{
28
20
  const appContext = api.getServerContext();
29
- const { appDirectory, distDirectory, render } = appContext;
30
- const root = isProd() ? distDirectory : appDirectory;
31
- const apiPath = path.resolve(root || process.cwd(), API_DIR);
32
- apiAppPath = path.resolve(apiPath, API_APP_NAME);
33
- const apiMod = await requireExistModule(apiAppPath);
34
- if (apiMod && 'function' == typeof apiMod) apiMod(transformAPI);
21
+ const { render } = appContext;
35
22
  const { middlewares } = storage;
36
23
  api.updateServerContext({
37
24
  ...appContext,
@@ -79,8 +66,6 @@ const server = ()=>({
79
66
  api.onReset(async ({ event })=>{
80
67
  storage.reset();
81
68
  const appContext = api.getServerContext();
82
- const newApiModule = await requireExistModule(apiAppPath);
83
- if (newApiModule && 'function' == typeof newApiModule) newApiModule(transformAPI);
84
69
  const { middlewares } = storage;
85
70
  api.updateServerContext({
86
71
  ...appContext,
@@ -1,5 +1,5 @@
1
1
  import { HttpMetadata, ResponseMetaType, ValidationError, isWithMetaHandler } from "@modern-js/bff-core";
2
- import { parse } from "@modern-js/create-request/qs";
2
+ import { parse } from "qs";
3
3
  import type_is from "type-is";
4
4
  const createHonoRoutes = (handlerInfos = [])=>handlerInfos.map(({ routePath, handler, httpMethod })=>{
5
5
  const routeMiddlwares = Reflect.getMetadata('middleware', handler) || [];
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import { fs, logger, normalizeToPosixPath } from "@modern-js/utils";
3
- import { API_DIR, DIST_DIR, LAMBDA_DIR, PACKAGE_NAME, PREFIX } from "./crossProjectApiPlugin";
3
+ import { API_DIR, DIST_DIR, LAMBDA_DIR, PACKAGE_NAME, PREFIX } from "./crossProjectApiPlugin.mjs";
4
4
  function replaceContent(source, packageName, prefix, relativeDistPath, relativeApiPath, relativeLambdaPath) {
5
5
  const updatedSource = source.replace(new RegExp(PACKAGE_NAME, 'g'), packageName).replace(new RegExp(PREFIX, 'g'), prefix).replace(new RegExp(DIST_DIR, 'g'), normalizeToPosixPath(relativeDistPath)).replace(new RegExp(API_DIR, 'g'), normalizeToPosixPath(relativeApiPath)).replace(new RegExp(LAMBDA_DIR, 'g'), normalizeToPosixPath(relativeLambdaPath));
6
6
  return updatedSource;
@@ -1,3 +1,7 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
4
+ import { dirname as __rspack_dirname } from "node:path";
1
5
  import path from "path";
2
6
  import { ApiRouter } from "@modern-js/bff-core";
3
7
  import { compile } from "@modern-js/server-utils";
@@ -5,6 +9,7 @@ import { API_DIR, DEFAULT_API_PREFIX, SHARED_DIR, fs, normalizeOutputPath } from
5
9
  import clientGenerator from "./utils/clientGenerator.mjs";
6
10
  import pluginGenerator from "./utils/pluginGenerator.mjs";
7
11
  import runtimeGenerator from "./utils/runtimeGenerator.mjs";
12
+ var cli_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
8
13
  const TS_CONFIG_FILENAME = 'tsconfig.json';
9
14
  const RUNTIME_CREATE_REQUEST = '@modern-js/plugin-bff/client';
10
15
  const RUNTIME_HONO = '@modern-js/plugin-bff/server';
@@ -24,13 +29,11 @@ const bffPlugin = ()=>({
24
29
  const { server } = modernConfig;
25
30
  const { alias } = modernConfig.source;
26
31
  const { alias: resolveAlias } = modernConfig.resolve;
27
- const { babel } = modernConfig.tools;
28
32
  if (sourceDirs.length > 0) {
29
33
  const combinedAlias = [].concat(alias ?? []).concat(resolveAlias ?? []);
30
34
  await compile(appDirectory, {
31
35
  server,
32
- alias: combinedAlias,
33
- babelConfig: babel
36
+ alias: combinedAlias
34
37
  }, {
35
38
  sourceDirs,
36
39
  distDir,
@@ -135,7 +138,8 @@ const bffPlugin = ()=>({
135
138
  const existLambda = apiRouter.isExistLambda();
136
139
  const apiRegexp = new RegExp(normalizeOutputPath(`${apiDirectory}${path.sep}.*(.[tj]s)$`));
137
140
  const name = isServer ? 'server' : 'client';
138
- const loaderPath = require.resolve('./loader');
141
+ const sourceExt = 'mjs';
142
+ const loaderPath = path.join(cli_dirname, `loader.${sourceExt}`);
139
143
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(apiRegexp);
140
144
  chain.module.rule('js-bff-api').test(apiRegexp).use('custom-loader').loader(loaderPath.replace(/\\/g, '/')).options({
141
145
  prefix,
@@ -1,3 +1,5 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  const API_APP_NAME = '_app';
2
4
  const BUILD_FILES = [
3
5
  '**/*.[tj]sx?',
@@ -1 +1,3 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  export * from "./constants.mjs";
@@ -1,3 +1,5 @@
1
+ import __rslib_shim_module__ from "node:module";
2
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
1
3
  import { generateClient } from "@modern-js/bff-core";
2
4
  import { logger } from "@modern-js/utils";
3
5
  async function loader(source) {
@@ -1,2 +1,4 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import { configure, createRequest, createUploader } from "@modern-js/create-request";
2
4
  export { configure, createRequest, createUploader };
@@ -1,4 +1,6 @@
1
- import { Hono } from "@modern-js/server-core";
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { Hono, run } from "@modern-js/server-core";
2
4
  import { isProd, logger } from "@modern-js/utils";
3
5
  import createHonoRoutes from "../../utils/createHonoRoutes.mjs";
4
6
  const before = [
@@ -33,6 +35,7 @@ class HonoAdapter {
33
35
  this.registerApiRoutes = async ()=>{
34
36
  if (!this.isHono) return;
35
37
  this.apiServer = new Hono();
38
+ this.apiServer.use('*', run);
36
39
  this.apiMiddleware.forEach(({ path = '*', method = 'all', handler })=>{
37
40
  const handlers = this.wrapInArray(handler);
38
41
  if (0 === handlers.length) return;
@@ -1,3 +1,5 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import { useHonoContext } from "@modern-js/server-core";
2
4
  export * from "@modern-js/bff-core";
3
5
  export * from "./operators.mjs";
@@ -1,3 +1,5 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import { useHonoContext } from "@modern-js/server-core";
2
4
  const Pipe = (func)=>({
3
5
  name: 'pipe',
@@ -1,7 +1,8 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import path from "path";
2
4
  import { ApiRouter } from "@modern-js/bff-core";
3
- import { API_DIR, isFunction, isProd, isWebOnly, requireExistModule } from "@modern-js/utils";
4
- import { API_APP_NAME } from "./constants.mjs";
5
+ import { API_DIR, isFunction, isWebOnly } from "@modern-js/utils";
5
6
  import { HonoAdapter } from "./runtime/hono/adapter.mjs";
6
7
  class Storage {
7
8
  reset() {
@@ -11,27 +12,15 @@ class Storage {
11
12
  this.middlewares = [];
12
13
  }
13
14
  }
14
- const createTransformAPI = (storage)=>({
15
- addMiddleware (fn) {
16
- storage.middlewares.push(fn);
17
- }
18
- });
19
15
  const server = ()=>({
20
16
  name: '@modern-js/plugin-bff',
21
17
  setup: (api)=>{
22
18
  const storage = new Storage();
23
- const transformAPI = createTransformAPI(storage);
24
- let apiAppPath = '';
25
19
  let apiRouter;
26
20
  const honoAdapter = new HonoAdapter(api);
27
21
  api.onPrepare(async ()=>{
28
22
  const appContext = api.getServerContext();
29
- const { appDirectory, distDirectory, render } = appContext;
30
- const root = isProd() ? distDirectory : appDirectory;
31
- const apiPath = path.resolve(root || process.cwd(), API_DIR);
32
- apiAppPath = path.resolve(apiPath, API_APP_NAME);
33
- const apiMod = await requireExistModule(apiAppPath);
34
- if (apiMod && 'function' == typeof apiMod) apiMod(transformAPI);
23
+ const { render } = appContext;
35
24
  const { middlewares } = storage;
36
25
  api.updateServerContext({
37
26
  ...appContext,
@@ -79,8 +68,6 @@ const server = ()=>({
79
68
  api.onReset(async ({ event })=>{
80
69
  storage.reset();
81
70
  const appContext = api.getServerContext();
82
- const newApiModule = await requireExistModule(apiAppPath);
83
- if (newApiModule && 'function' == typeof newApiModule) newApiModule(transformAPI);
84
71
  const { middlewares } = storage;
85
72
  api.updateServerContext({
86
73
  ...appContext,
@@ -1,3 +1,5 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import path from "path";
2
4
  import { generateClient } from "@modern-js/bff-core";
3
5
  import { fs, logger } from "@modern-js/utils";
@@ -1,5 +1,7 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import { HttpMetadata, ResponseMetaType, ValidationError, isWithMetaHandler } from "@modern-js/bff-core";
2
- import { parse } from "@modern-js/create-request/qs";
4
+ import { parse } from "qs";
3
5
  import type_is from "type-is";
4
6
  const createHonoRoutes = (handlerInfos = [])=>handlerInfos.map(({ routePath, handler, httpMethod })=>{
5
7
  const routeMiddlwares = Reflect.getMetadata('middleware', handler) || [];
@@ -1,3 +1,5 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
1
3
  import path from "path";
2
4
  const PACKAGE_NAME = '{packageName}';
3
5
  const PREFIX = '{prefix}';
@@ -1,6 +1,11 @@
1
+ import "node:module";
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
4
+ import { dirname as __rspack_dirname } from "node:path";
1
5
  import path from "path";
2
6
  import { fs, logger, normalizeToPosixPath } from "@modern-js/utils";
3
7
  import { API_DIR, DIST_DIR, LAMBDA_DIR, PACKAGE_NAME, PREFIX } from "./crossProjectApiPlugin.mjs";
8
+ var pluginGenerator_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
4
9
  function replaceContent(source, packageName, prefix, relativeDistPath, relativeApiPath, relativeLambdaPath) {
5
10
  const updatedSource = source.replace(new RegExp(PACKAGE_NAME, 'g'), packageName).replace(new RegExp(PREFIX, 'g'), prefix).replace(new RegExp(DIST_DIR, 'g'), normalizeToPosixPath(relativeDistPath)).replace(new RegExp(API_DIR, 'g'), normalizeToPosixPath(relativeApiPath)).replace(new RegExp(LAMBDA_DIR, 'g'), normalizeToPosixPath(relativeLambdaPath));
6
11
  return updatedSource;
@@ -11,7 +16,7 @@ async function pluginGenerator({ prefix, appDirectory, relativeDistPath, relativ
11
16
  const packageJson = JSON.parse(packageContent);
12
17
  const pluginDir = path.resolve(appDirectory, `./${relativeDistPath}`, 'plugin');
13
18
  const pluginPath = path.join(pluginDir, 'index.js');
14
- const pluginTemplate = await fs.readFile(path.resolve(__dirname, 'crossProjectApiPlugin.js'), 'utf8');
19
+ const pluginTemplate = await fs.readFile(path.resolve(pluginGenerator_dirname, 'crossProjectApiPlugin.js'), 'utf8');
15
20
  const updatedPlugin = replaceContent(pluginTemplate, packageJson.name, prefix, relativeDistPath, relativeApiPath, relativeLambdaPath);
16
21
  await fs.ensureFile(pluginPath);
17
22
  await fs.writeFile(pluginPath, updatedPlugin);
@@ -1,3 +1,5 @@
1
+ import __rslib_shim_module__ from "node:module";
2
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
1
3
  import path from "path";
2
4
  import { fs } from "@modern-js/utils";
3
5
  const getPackageName = (appDirectory)=>{
package/package.json CHANGED
@@ -15,15 +15,12 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.0.0-alpha.0",
19
- "jsnext:source": "./src/cli.ts",
18
+ "version": "3.0.0-alpha.2",
20
19
  "types": "./dist/types/cli.d.ts",
21
20
  "main": "./dist/cjs/cli.js",
22
- "module": "./dist/esm-node/cli.mjs",
23
21
  "exports": {
24
22
  ".": {
25
23
  "types": "./dist/types/cli.d.ts",
26
- "jsnext:source": "./src/cli.ts",
27
24
  "node": {
28
25
  "import": "./dist/esm-node/cli.mjs",
29
26
  "require": "./dist/cjs/cli.js"
@@ -32,7 +29,6 @@
32
29
  },
33
30
  "./cli": {
34
31
  "types": "./dist/types/cli.d.ts",
35
- "jsnext:source": "./src/cli.ts",
36
32
  "node": {
37
33
  "import": "./dist/esm-node/cli.mjs",
38
34
  "require": "./dist/cjs/cli.js"
@@ -41,25 +37,14 @@
41
37
  },
42
38
  "./server-plugin": {
43
39
  "types": "./dist/types/server.d.ts",
44
- "jsnext:source": "./src/server.ts",
45
40
  "node": {
46
41
  "import": "./dist/esm-node/server.mjs",
47
42
  "require": "./dist/cjs/server.js"
48
43
  },
49
44
  "default": "./dist/cjs/server.js"
50
45
  },
51
- "./loader": {
52
- "types": "./dist/types/loader.d.ts",
53
- "jsnext:source": "./src/loader.ts",
54
- "node": {
55
- "import": "./dist/esm-node/loader.mjs",
56
- "require": "./dist/cjs/loader.js"
57
- },
58
- "default": "./dist/cjs/loader.js"
59
- },
60
46
  "./server": {
61
47
  "types": "./dist/types/runtime/hono/index.d.ts",
62
- "jsnext:source": "./src/runtime/hono/index.ts",
63
48
  "node": {
64
49
  "import": "./dist/esm-node/runtime/hono/index.mjs",
65
50
  "require": "./dist/cjs/runtime/hono/index.js"
@@ -67,13 +52,8 @@
67
52
  "default": "./dist/cjs/runtime/hono/index.js"
68
53
  },
69
54
  "./client": {
70
- "types": "./dist/types/create-request/index.d.ts",
71
- "jsnext:source": "./src/runtime/create-request/index.ts",
72
- "node": {
73
- "import": "./dist/esm-node/runtime/create-request/index.mjs",
74
- "require": "./dist/cjs/runtime/create-request/index.js"
75
- },
76
- "default": "./dist/cjs/runtime/create-request/index.js"
55
+ "types": "./dist/types/runtime/create-request/index.d.ts",
56
+ "default": "./dist/esm/runtime/create-request/index.mjs"
77
57
  }
78
58
  },
79
59
  "typesVersions": {
@@ -96,35 +76,32 @@
96
76
  }
97
77
  },
98
78
  "dependencies": {
99
- "@babel/core": "^7.28.5",
100
79
  "@swc/helpers": "^0.5.17",
80
+ "qs": "^6.14.1",
101
81
  "type-is": "^1.6.18",
102
- "@modern-js/bff-core": "3.0.0-alpha.0",
103
- "@modern-js/create-request": "3.0.0-alpha.0",
104
- "@modern-js/server-core": "3.0.0-alpha.0",
105
- "@modern-js/builder": "3.0.0-alpha.0",
106
- "@modern-js/server-utils": "3.0.0-alpha.0",
107
- "@modern-js/utils": "3.0.0-alpha.0"
82
+ "@modern-js/bff-core": "3.0.0-alpha.2",
83
+ "@modern-js/builder": "3.0.0-alpha.2",
84
+ "@modern-js/create-request": "3.0.0-alpha.2",
85
+ "@modern-js/server-core": "3.0.0-alpha.2",
86
+ "@modern-js/server-utils": "3.0.0-alpha.2",
87
+ "@modern-js/utils": "3.0.0-alpha.2"
108
88
  },
109
89
  "devDependencies": {
110
- "@rsbuild/core": "1.6.15",
111
- "@rslib/core": "0.18.5",
112
- "@types/babel__core": "^7.20.5",
113
- "@types/jest": "^29.5.14",
90
+ "@rsbuild/core": "2.0.0-beta.0",
91
+ "@rslib/core": "0.19.3",
114
92
  "@types/node": "^20",
93
+ "@types/qs": "^6.14.0",
115
94
  "@types/type-is": "^1.6.7",
116
- "jest": "^29.7.0",
117
95
  "memfs": "^3.5.3",
118
- "ts-jest": "^29.4.6",
119
96
  "typescript": "^5",
120
- "zod": "^3.22.3",
121
- "@modern-js/app-tools": "3.0.0-alpha.0",
122
- "@modern-js/bff-runtime": "3.0.0-alpha.0",
123
- "@modern-js/plugin": "3.0.0-alpha.0",
124
- "@modern-js/runtime": "3.0.0-alpha.0",
125
- "@modern-js/types": "3.0.0-alpha.0",
97
+ "zod": "^3.25.76",
98
+ "@modern-js/app-tools": "3.0.0-alpha.2",
99
+ "@modern-js/bff-runtime": "3.0.0-alpha.2",
100
+ "@modern-js/plugin": "3.0.0-alpha.2",
126
101
  "@modern-js/rslib": "2.68.10",
127
- "@scripts/jest-config": "2.66.0"
102
+ "@modern-js/runtime": "3.0.0-alpha.2",
103
+ "@modern-js/types": "3.0.0-alpha.2",
104
+ "@scripts/rstest-config": "2.66.0"
128
105
  },
129
106
  "sideEffects": false,
130
107
  "publishConfig": {
@@ -134,6 +111,6 @@
134
111
  "scripts": {
135
112
  "build": "rslib build",
136
113
  "dev": "rslib build --watch",
137
- "test": "jest --passWithNoTests"
114
+ "test": "rstest --passWithNoTests"
138
115
  }
139
116
  }
@@ -0,0 +1,10 @@
1
+ import { withTestPreset } from '@scripts/rstest-config';
2
+
3
+ export default withTestPreset({
4
+ setupFiles: ['@scripts/rstest-config/setup.ts'],
5
+ root: __dirname,
6
+ globals: true,
7
+ env: {
8
+ npm_package_name: 'tests',
9
+ },
10
+ });