@modern-js/plugin-bff 1.0.0-rc.13 → 1.0.0-rc.17

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,81 @@
1
1
  # @modern-js/plugin-bff
2
2
 
3
+ ## 1.0.0-rc.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 224f7fe: fix server route match
8
+ - 30ac27c: feat: add generator package description
9
+ - 204c626: feat: initial
10
+ - fix: #118 #104
11
+ - Updated dependencies [224f7fe]
12
+ - Updated dependencies [30ac27c]
13
+ - Updated dependencies [204c626]
14
+ - Updated dependencies [undefined]
15
+ - @modern-js/babel-preset-lib@1.0.0-rc.17
16
+ - @modern-js/core@1.0.0-rc.17
17
+ - @modern-js/bff-utils@1.0.0-rc.17
18
+ - @modern-js/server-plugin@1.0.0-rc.17
19
+ - @modern-js/server-utils@1.0.0-rc.17
20
+ - @modern-js/babel-chain@1.0.0-rc.17
21
+ - @modern-js/babel-compiler@1.0.0-rc.17
22
+ - @modern-js/utils@1.0.0-rc.17
23
+
24
+ ## 1.0.0-rc.16
25
+
26
+ ### Patch Changes
27
+
28
+ - 224f7fe: fix server route match
29
+ - 30ac27c: feat: add generator package description
30
+ - 204c626: feat: initial
31
+ - Updated dependencies [224f7fe]
32
+ - Updated dependencies [30ac27c]
33
+ - Updated dependencies [204c626]
34
+ - @modern-js/babel-preset-lib@1.0.0-rc.16
35
+ - @modern-js/core@1.0.0-rc.16
36
+ - @modern-js/bff-utils@1.0.0-rc.16
37
+ - @modern-js/server-plugin@1.0.0-rc.16
38
+ - @modern-js/server-utils@1.0.0-rc.16
39
+ - @modern-js/babel-chain@1.0.0-rc.16
40
+ - @modern-js/babel-compiler@1.0.0-rc.16
41
+ - @modern-js/utils@1.0.0-rc.16
42
+
43
+ ## 1.0.0-rc.15
44
+
45
+ ### Patch Changes
46
+
47
+ - 224f7fe: fix server route match
48
+ - 30ac27c: feat: add generator package description
49
+ - 204c626: feat: initial
50
+ - Updated dependencies [224f7fe]
51
+ - Updated dependencies [30ac27c]
52
+ - Updated dependencies [204c626]
53
+ - @modern-js/babel-preset-lib@1.0.0-rc.15
54
+ - @modern-js/core@1.0.0-rc.15
55
+ - @modern-js/bff-utils@1.0.0-rc.15
56
+ - @modern-js/server-plugin@1.0.0-rc.15
57
+ - @modern-js/server-utils@1.0.0-rc.15
58
+ - @modern-js/babel-chain@1.0.0-rc.15
59
+ - @modern-js/babel-compiler@1.0.0-rc.15
60
+ - @modern-js/utils@1.0.0-rc.15
61
+
62
+ ## 1.0.0-rc.14
63
+
64
+ ### Patch Changes
65
+
66
+ - 224f7fe: fix server route match
67
+ - 204c626: feat: initial
68
+ - Updated dependencies [224f7fe]
69
+ - Updated dependencies [204c626]
70
+ - @modern-js/babel-preset-lib@1.0.0-rc.14
71
+ - @modern-js/core@1.0.0-rc.14
72
+ - @modern-js/bff-utils@1.0.0-rc.14
73
+ - @modern-js/server-plugin@1.0.0-rc.14
74
+ - @modern-js/server-utils@1.0.0-rc.14
75
+ - @modern-js/babel-chain@1.0.0-rc.14
76
+ - @modern-js/babel-compiler@1.0.0-rc.14
77
+ - @modern-js/utils@1.0.0-rc.14
78
+
3
79
  ## 1.0.0-rc.13
4
80
 
5
81
  ### Patch Changes
@@ -1,7 +1,6 @@
1
- import path from 'path';
2
1
  import { createPlugin, useAppContext, useResolvedConfigContext } from '@modern-js/core';
3
2
  import { compiler } from '@modern-js/babel-compiler';
4
- import { PLUGIN_SCHEMAS, fs } from '@modern-js/utils';
3
+ import { PLUGIN_SCHEMAS, path, fs, upath } from '@modern-js/utils';
5
4
  import { resolveBabelConfig } from '@modern-js/server-utils';
6
5
  import { API_DIR } from "./constants";
7
6
  const DEFAULT_API_PREFIX = '/api';
@@ -35,7 +34,7 @@ export default createPlugin(() => ({
35
34
  const rootDir = path.resolve(appDirectory, API_DIR);
36
35
  chain.resolve.alias.set('@api', rootDir);
37
36
  const apiRegexp = new RegExp(`${appDirectory}/api/.*(.[tj]s)$`);
38
- chain.module.rule('loaders').oneOf('bff-client').before('fallback').test(apiRegexp).use('custom-loader').loader(require.resolve("./loader")).options({
37
+ chain.module.rule('loaders').oneOf('bff-client').before('fallback').test(apiRegexp).use('custom-loader').loader(upath.normalizeSafe(require.resolve("./loader"))).options({
39
38
  prefix,
40
39
  apiDir: rootDir,
41
40
  port,
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { createPlugin } from '@modern-js/server-plugin';
3
3
  import { injectAPIHandlerInfos } from '@modern-js/bff-utils';
4
4
  import { API_DIR } from "./constants";
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _core = require("@modern-js/core");
11
9
 
12
10
  var _babelCompiler = require("@modern-js/babel-compiler");
@@ -17,8 +15,6 @@ var _serverUtils = require("@modern-js/server-utils");
17
15
 
18
16
  var _constants = require("./constants");
19
17
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
18
  const DEFAULT_API_PREFIX = '/api';
23
19
  const TS_CONFIG_FILENAME = 'tsconfig.json';
24
20
  const FILE_EXTENSIONS = ['.js', '.ts', '.mjs', '.ejs'];
@@ -49,11 +45,11 @@ var _default = (0, _core.createPlugin)(() => ({
49
45
  } = bff || {};
50
46
  const prefix = (bff === null || bff === void 0 ? void 0 : bff.prefix) || DEFAULT_API_PREFIX;
51
47
 
52
- const rootDir = _path.default.resolve(appDirectory, _constants.API_DIR);
48
+ const rootDir = _utils.path.resolve(appDirectory, _constants.API_DIR);
53
49
 
54
50
  chain.resolve.alias.set('@api', rootDir);
55
51
  const apiRegexp = new RegExp(`${appDirectory}/api/.*(.[tj]s)$`);
56
- chain.module.rule('loaders').oneOf('bff-client').before('fallback').test(apiRegexp).use('custom-loader').loader(require.resolve("./loader")).options({
52
+ chain.module.rule('loaders').oneOf('bff-client').before('fallback').test(apiRegexp).use('custom-loader').loader(_utils.upath.normalizeSafe(require.resolve("./loader"))).options({
57
53
  prefix,
58
54
  apiDir: rootDir,
59
55
  port,
@@ -107,13 +103,13 @@ var _default = (0, _core.createPlugin)(() => ({
107
103
 
108
104
  const modernConfig = (0, _core.useResolvedConfigContext)();
109
105
 
110
- const rootDir = _path.default.resolve(appDirectory, _constants.API_DIR);
106
+ const rootDir = _utils.path.resolve(appDirectory, _constants.API_DIR);
111
107
 
112
- const distDir = _path.default.resolve(distDirectory, _constants.API_DIR);
108
+ const distDir = _utils.path.resolve(distDirectory, _constants.API_DIR);
113
109
 
114
- const sourceAbsDir = _path.default.resolve(appDirectory, _constants.API_DIR);
110
+ const sourceAbsDir = _utils.path.resolve(appDirectory, _constants.API_DIR);
115
111
 
116
- const tsconfigPath = _path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
112
+ const tsconfigPath = _utils.path.resolve(appDirectory, TS_CONFIG_FILENAME);
117
113
 
118
114
  const babelConfig = (0, _serverUtils.resolveBabelConfig)(appDirectory, modernConfig, {
119
115
  tsconfigPath,
@@ -130,7 +126,7 @@ var _default = (0, _core.createPlugin)(() => ({
130
126
 
131
127
  if (await _utils.fs.pathExists(rootDir)) {
132
128
  await _utils.fs.copy(rootDir, distDir, {
133
- filter: src => !['.ts', '.js'].includes(_path.default.extname(src)) && src !== tsconfigPath
129
+ filter: src => !['.ts', '.js'].includes(_utils.path.extname(src)) && src !== tsconfigPath
134
130
  });
135
131
  }
136
132
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
8
+ var _utils = require("@modern-js/utils");
9
9
 
10
10
  var _serverPlugin = require("@modern-js/server-plugin");
11
11
 
@@ -13,8 +13,6 @@ var _bffUtils = require("@modern-js/bff-utils");
13
13
 
14
14
  var _constants = require("./constants");
15
15
 
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
16
  var _default = (0, _serverPlugin.createPlugin)(() => ({
19
17
  prepareApiServer(props, next) {
20
18
  const {
@@ -22,7 +20,7 @@ var _default = (0, _serverPlugin.createPlugin)(() => ({
22
20
  prefix
23
21
  } = props;
24
22
 
25
- const apiDir = _path.default.resolve(pwd, _constants.API_DIR);
23
+ const apiDir = _utils.path.resolve(pwd, _constants.API_DIR);
26
24
 
27
25
  (0, _bffUtils.injectAPIHandlerInfos)(apiDir, prefix);
28
26
  return next(props);
package/package.json CHANGED
@@ -1,84 +1,83 @@
1
1
  {
2
- "name": "@modern-js/plugin-bff",
3
- "version": "1.0.0-rc.13",
4
- "jsnext:source": "./src/index.ts",
5
- "types": "./dist/types/index.d.ts",
6
- "main": "./dist/js/node/index.js",
7
- "module": "./dist/js/treeshaking/index.js",
8
- "jsnext:modern": "./dist/js/modern/index.js",
9
- "exports": {
10
- ".": {
11
- "node": {
12
- "import": "./dist/js/modern/index.js",
13
- "require": "./dist/js/node/index.js"
14
- },
15
- "default": "./dist/js/treeshaking/index.js"
16
- },
17
- "./cli": "./dist/js/node/cli.js",
18
- "./server": "./dist/js/node/server.js"
19
- },
20
- "typesVersions": {
21
- "*": {
22
- ".": [
23
- "./dist/types/index.d.ts"
24
- ],
25
- "cli": [
26
- "./dist/types/cli.d.ts"
27
- ],
28
- "server": [
29
- "./dist/types/server.d.ts"
30
- ]
31
- }
32
- },
33
- "dependencies": {
34
- "@babel/core": "^7.15.5",
35
- "@babel/runtime": "^7",
36
- "@modern-js/babel-chain": "^1.0.0-rc.13",
37
- "@modern-js/babel-compiler": "^1.0.0-rc.13",
38
- "@modern-js/babel-preset-lib": "^1.0.0-rc.13",
39
- "@modern-js/bff-utils": "^1.0.0-rc.13",
40
- "@modern-js/server-utils": "^1.0.0-rc.13",
41
- "@modern-js/utils": "^1.0.0-rc.13",
42
- "loader-utils": "^2.0.0"
43
- },
44
- "devDependencies": {
45
- "@modern-js/core": "^1.0.0-rc.13",
46
- "@modern-js/server-plugin": "^1.0.0-rc.13",
47
- "@modern-js/plugin-testing": "^1.0.0-rc.13",
48
- "@modern-js/plugin-analyze": "^1.0.0-rc.13",
49
- "@modern-js/bff-utils": "^1.0.0-rc.13",
50
- "@modern-js/create-request": "^1.0.0-rc.13",
51
- "@modern-js/runtime": "^1.0.0-rc.13",
52
- "@modern-js/types": "^1.0.0-rc.13",
53
- "@types/babel__core": "^7.1.15",
54
- "@types/jest": "^26",
55
- "@types/loader-utils": "^2.0.3",
56
- "@types/node": "^14",
57
- "memfs": "^3.3.0",
58
- "ts-jest": "^27.0.5",
59
- "typescript": "^4",
60
- "webpack": "^5.54.0",
61
- "webpack-chain": "^6.5.1",
62
- "@modern-js/module-tools": "^1.0.0-rc.13"
63
- },
64
- "peerDependencies": {
65
- "@modern-js/core": "^1.0.0-rc.13",
66
- "@modern-js/server-plugin": "^1.0.0-rc.13"
67
- },
68
- "modernConfig": {
69
- "output": {
70
- "packageMode": "node-js"
71
- }
72
- },
73
- "sideEffects": false,
74
- "publishConfig": {
75
- "registry": "https://registry.npmjs.org/",
76
- "access": "public"
77
- },
78
- "scripts": {
79
- "new": "modern new",
80
- "build": "modern build",
81
- "dev": "modern build --watch",
82
- "test": "modern test"
83
- }
84
- }
2
+ "name": "@modern-js/plugin-bff",
3
+ "version": "1.0.0-rc.17",
4
+ "jsnext:source": "./src/index.ts",
5
+ "types": "./dist/types/index.d.ts",
6
+ "main": "./dist/js/node/index.js",
7
+ "module": "./dist/js/treeshaking/index.js",
8
+ "jsnext:modern": "./dist/js/modern/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "node": {
12
+ "import": "./dist/js/modern/index.js",
13
+ "require": "./dist/js/node/index.js"
14
+ },
15
+ "default": "./dist/js/treeshaking/index.js"
16
+ },
17
+ "./cli": "./dist/js/node/cli.js",
18
+ "./server": "./dist/js/node/server.js"
19
+ },
20
+ "typesVersions": {
21
+ "*": {
22
+ ".": [
23
+ "./dist/types/index.d.ts"
24
+ ],
25
+ "cli": [
26
+ "./dist/types/cli.d.ts"
27
+ ],
28
+ "server": [
29
+ "./dist/types/server.d.ts"
30
+ ]
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "@babel/core": "^7.15.5",
35
+ "@babel/runtime": "^7",
36
+ "@modern-js/babel-chain": "^1.0.0-rc.17",
37
+ "@modern-js/babel-compiler": "^1.0.0-rc.17",
38
+ "@modern-js/babel-preset-lib": "^1.0.0-rc.17",
39
+ "@modern-js/bff-utils": "^1.0.0-rc.17",
40
+ "@modern-js/server-utils": "^1.0.0-rc.17",
41
+ "@modern-js/utils": "^1.0.0-rc.17",
42
+ "loader-utils": "^2.0.0"
43
+ },
44
+ "devDependencies": {
45
+ "@modern-js/core": "^1.0.0-rc.17",
46
+ "@modern-js/server-plugin": "^1.0.0-rc.17",
47
+ "@modern-js/plugin-testing": "^1.0.0-rc.17",
48
+ "@modern-js/plugin-analyze": "^1.0.0-rc.17",
49
+ "@modern-js/create-request": "^1.0.0-rc.17",
50
+ "@modern-js/runtime": "^1.0.0-rc.17",
51
+ "@modern-js/types": "^1.0.0-rc.17",
52
+ "@types/babel__core": "^7.1.15",
53
+ "@types/jest": "^26",
54
+ "@types/loader-utils": "^2.0.3",
55
+ "@types/node": "^14",
56
+ "memfs": "^3.3.0",
57
+ "ts-jest": "^27.0.5",
58
+ "typescript": "^4",
59
+ "webpack": "^5.54.0",
60
+ "webpack-chain": "^6.5.1",
61
+ "@modern-js/module-tools": "^1.0.0-rc.17"
62
+ },
63
+ "peerDependencies": {
64
+ "@modern-js/core": "^1.0.0-rc.17",
65
+ "@modern-js/server-plugin": "^1.0.0-rc.17"
66
+ },
67
+ "modernConfig": {
68
+ "output": {
69
+ "packageMode": "node-js"
70
+ }
71
+ },
72
+ "sideEffects": false,
73
+ "publishConfig": {
74
+ "registry": "https://registry.npmjs.org/",
75
+ "access": "public"
76
+ },
77
+ "scripts": {
78
+ "new": "modern new",
79
+ "build": "modern build",
80
+ "dev": "modern build --watch",
81
+ "test": "modern test"
82
+ }
83
+ }
package/src/cli.ts CHANGED
@@ -1,16 +1,15 @@
1
- import path from 'path';
2
1
  import {
3
2
  createPlugin,
4
3
  useAppContext,
5
4
  useResolvedConfigContext,
6
5
  } from '@modern-js/core';
7
6
  import { compiler } from '@modern-js/babel-compiler';
8
- import { PLUGIN_SCHEMAS, fs } from '@modern-js/utils';
7
+ import { PLUGIN_SCHEMAS, path, fs, upath } from '@modern-js/utils';
8
+ import { resolveBabelConfig } from '@modern-js/server-utils';
9
9
 
10
10
  import type { Configuration } from 'webpack';
11
11
  import type Chain from 'webpack-chain';
12
12
  import type { ServerRoute } from '@modern-js/types';
13
- import { resolveBabelConfig } from '@modern-js/server-utils';
14
13
  import { API_DIR } from './constants';
15
14
 
16
15
  declare module '@modern-js/core' {
@@ -57,7 +56,7 @@ export default createPlugin(
57
56
  .before('fallback')
58
57
  .test(apiRegexp)
59
58
  .use('custom-loader')
60
- .loader(require.resolve('./loader'))
59
+ .loader(upath.normalizeSafe(require.resolve('./loader')))
61
60
  .options({
62
61
  prefix,
63
62
  apiDir: rootDir,
package/src/server.ts CHANGED
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { createPlugin } from '@modern-js/server-plugin';
3
3
  import { injectAPIHandlerInfos } from '@modern-js/bff-utils';
4
4
  import { API_DIR } from './constants';
package/tests/cli.test.ts CHANGED
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { manager, AppContext } from '@modern-js/core';
3
3
  import { modifyServerRoutes } from '@modern-js/plugin-analyze';
4
4
  import Chain from 'webpack-chain';
package/tests/compiler.ts CHANGED
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import webpack from 'webpack';
3
3
  import { createFsFromVolume, Volume } from 'memfs';
4
4
  import { APILoaderOptions } from '../src/loader';
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { compiler } from './compiler';
3
3
 
4
4
  const apiDir = path.resolve(__dirname, './fixtures/function/api');
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { serverManager } from '@modern-js/server-plugin';
3
3
  import { useAPIHandlerInfos } from '@modern-js/bff-utils';
4
4
  import plugin from '../src/server';