@modern-js/server-utils 1.0.0-rc.15 → 1.0.0-rc.16

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,19 @@
1
1
  # @modern-js/server-utils
2
2
 
3
+ ## 1.0.0-rc.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 224f7fe: fix server route match
8
+ - 30ac27c: feat: add generator package description
9
+ - 204c626: feat: initial
10
+ - Updated dependencies [224f7fe]
11
+ - Updated dependencies [30ac27c]
12
+ - Updated dependencies [204c626]
13
+ - @modern-js/babel-preset-lib@1.0.0-rc.16
14
+ - @modern-js/plugin@1.0.0-rc.16
15
+ - @modern-js/utils@1.0.0-rc.16
16
+
3
17
  ## 1.0.0-rc.15
4
18
 
5
19
  ### Patch Changes
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import { getBabelChain } from '@modern-js/babel-preset-lib';
8
- import { applyOptionsChain, fs, getAlias } from '@modern-js/utils';
8
+ import { applyOptionsChain, fs, getAlias, upath } from '@modern-js/utils';
9
9
  import json5 from 'json5';
10
10
  export * from '@babel/core';
11
11
  export const readTsConfig = (tsconfigPath, noExistReturn = null) => {
@@ -65,14 +65,14 @@ export const resolveBabelConfig = (appDirectory, modernConfig, option // FIXME:
65
65
  syntax: option.syntax
66
66
  });
67
67
  const envOptions = babelChain.preset('@babel/preset-env').options();
68
- babelChain.preset('@babel/preset-env').use(require.resolve('@babel/preset-env'), [_objectSpread(_objectSpread({}, envOptions[0]), {}, {
68
+ babelChain.preset('@babel/preset-env').use(upath.normalizeSafe(require.resolve('@babel/preset-env')), [_objectSpread(_objectSpread({}, envOptions[0]), {}, {
69
69
  loose: true
70
70
  })]);
71
- babelChain.plugin('babel-plugin-transform-typescript-metadata').use(require.resolve('babel-plugin-transform-typescript-metadata'), []);
72
- babelChain.plugin('@babel/plugin-proposal-decorators').use(require.resolve('@babel/plugin-proposal-decorators'), [{
71
+ babelChain.plugin('babel-plugin-transform-typescript-metadata').use(upath.normalizeSafe(require.resolve('babel-plugin-transform-typescript-metadata')), []);
72
+ babelChain.plugin('@babel/plugin-proposal-decorators').use(upath.normalizeSafe(require.resolve('@babel/plugin-proposal-decorators')), [{
73
73
  legacy: true
74
74
  }]);
75
- babelChain.plugin('@babel/plugin-proposal-class-properties').use(require.resolve('@babel/plugin-proposal-class-properties'), [{
75
+ babelChain.plugin('@babel/plugin-proposal-class-properties').use(upath.normalizeSafe(require.resolve('@babel/plugin-proposal-class-properties')), [{
76
76
  loose: true
77
77
  }]);
78
78
 
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { createMiddlewareCollecter } from "./middleware";
3
3
  import { requireModule } from "./requireModule";
4
4
  const API_DIR_PATH = 'api';
@@ -106,14 +106,14 @@ const resolveBabelConfig = (appDirectory, modernConfig, option // FIXME: babel t
106
106
  syntax: option.syntax
107
107
  });
108
108
  const envOptions = babelChain.preset('@babel/preset-env').options();
109
- babelChain.preset('@babel/preset-env').use(require.resolve('@babel/preset-env'), [_objectSpread(_objectSpread({}, envOptions[0]), {}, {
109
+ babelChain.preset('@babel/preset-env').use(_utils.upath.normalizeSafe(require.resolve('@babel/preset-env')), [_objectSpread(_objectSpread({}, envOptions[0]), {}, {
110
110
  loose: true
111
111
  })]);
112
- babelChain.plugin('babel-plugin-transform-typescript-metadata').use(require.resolve('babel-plugin-transform-typescript-metadata'), []);
113
- babelChain.plugin('@babel/plugin-proposal-decorators').use(require.resolve('@babel/plugin-proposal-decorators'), [{
112
+ babelChain.plugin('babel-plugin-transform-typescript-metadata').use(_utils.upath.normalizeSafe(require.resolve('babel-plugin-transform-typescript-metadata')), []);
113
+ babelChain.plugin('@babel/plugin-proposal-decorators').use(_utils.upath.normalizeSafe(require.resolve('@babel/plugin-proposal-decorators')), [{
114
114
  legacy: true
115
115
  }]);
116
- babelChain.plugin('@babel/plugin-proposal-class-properties').use(require.resolve('@babel/plugin-proposal-class-properties'), [{
116
+ babelChain.plugin('@babel/plugin-proposal-class-properties').use(_utils.upath.normalizeSafe(require.resolve('@babel/plugin-proposal-class-properties')), [{
117
117
  loose: true
118
118
  }]);
119
119
 
@@ -5,14 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.gather = void 0;
7
7
 
8
- var _path = _interopRequireDefault(require("path"));
8
+ var _utils = require("@modern-js/utils");
9
9
 
10
10
  var _middleware = require("./middleware");
11
11
 
12
12
  var _requireModule = require("./requireModule");
13
13
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
14
  const API_DIR_PATH = 'api';
17
15
  const API_APP_NAME = '_app';
18
16
  const SERVER_DIR_PATH = 'server';
@@ -25,13 +23,13 @@ const gather = pwd => {
25
23
  addWebMiddleware
26
24
  } = (0, _middleware.createMiddlewareCollecter)();
27
25
 
28
- const apiPath = _path.default.resolve(pwd, API_DIR_PATH);
26
+ const apiPath = _utils.path.resolve(pwd, API_DIR_PATH);
29
27
 
30
- const apiAppPath = _path.default.resolve(apiPath, API_APP_NAME);
28
+ const apiAppPath = _utils.path.resolve(apiPath, API_APP_NAME);
31
29
 
32
- const serverPath = _path.default.resolve(pwd, SERVER_DIR_PATH);
30
+ const serverPath = _utils.path.resolve(pwd, SERVER_DIR_PATH);
33
31
 
34
- const webAppPath = _path.default.resolve(serverPath, WEB_APP_NAME);
32
+ const webAppPath = _utils.path.resolve(serverPath, WEB_APP_NAME);
35
33
 
36
34
  const apiAttacher = (0, _requireModule.requireModule)(apiAppPath);
37
35
 
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import { getBabelChain } from '@modern-js/babel-preset-lib';
8
- import { applyOptionsChain, fs, getAlias } from '@modern-js/utils';
8
+ import { applyOptionsChain, fs, getAlias, upath } from '@modern-js/utils';
9
9
  import json5 from 'json5';
10
10
  export * from '@babel/core';
11
11
  export var readTsConfig = function readTsConfig(tsconfigPath) {
@@ -61,14 +61,14 @@ export var resolveBabelConfig = function resolveBabelConfig(appDirectory, modern
61
61
  syntax: option.syntax
62
62
  });
63
63
  var envOptions = babelChain.preset('@babel/preset-env').options();
64
- babelChain.preset('@babel/preset-env').use(require.resolve('@babel/preset-env'), [_objectSpread(_objectSpread({}, envOptions[0]), {}, {
64
+ babelChain.preset('@babel/preset-env').use(upath.normalizeSafe(require.resolve('@babel/preset-env')), [_objectSpread(_objectSpread({}, envOptions[0]), {}, {
65
65
  loose: true
66
66
  })]);
67
- babelChain.plugin('babel-plugin-transform-typescript-metadata').use(require.resolve('babel-plugin-transform-typescript-metadata'), []);
68
- babelChain.plugin('@babel/plugin-proposal-decorators').use(require.resolve('@babel/plugin-proposal-decorators'), [{
67
+ babelChain.plugin('babel-plugin-transform-typescript-metadata').use(upath.normalizeSafe(require.resolve('babel-plugin-transform-typescript-metadata')), []);
68
+ babelChain.plugin('@babel/plugin-proposal-decorators').use(upath.normalizeSafe(require.resolve('@babel/plugin-proposal-decorators')), [{
69
69
  legacy: true
70
70
  }]);
71
- babelChain.plugin('@babel/plugin-proposal-class-properties').use(require.resolve('@babel/plugin-proposal-class-properties'), [{
71
+ babelChain.plugin('@babel/plugin-proposal-class-properties').use(upath.normalizeSafe(require.resolve('@babel/plugin-proposal-class-properties')), [{
72
72
  loose: true
73
73
  }]);
74
74
 
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { createMiddlewareCollecter } from "./middleware";
3
3
  import { requireModule } from "./requireModule";
4
4
  var API_DIR_PATH = 'api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/server-utils",
3
- "version": "1.0.0-rc.15",
3
+ "version": "1.0.0-rc.16",
4
4
  "jsnext:source": "./src/index.ts",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "main": "./dist/js/node/index.js",
@@ -23,15 +23,15 @@
23
23
  "@babel/preset-env": "^7.15.0",
24
24
  "@babel/preset-typescript": "^7.15.0",
25
25
  "@babel/runtime": "^7",
26
- "@modern-js/babel-preset-lib": "^1.0.0-rc.15",
27
- "@modern-js/plugin": "^1.0.0-rc.15",
28
- "@modern-js/utils": "^1.0.0-rc.15",
26
+ "@modern-js/babel-preset-lib": "^1.0.0-rc.16",
27
+ "@modern-js/plugin": "^1.0.0-rc.16",
28
+ "@modern-js/utils": "^1.0.0-rc.16",
29
29
  "babel-plugin-module-resolver": "^4.1.0",
30
30
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
31
31
  "json5": "^2.2.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@modern-js/core": "^1.0.0-rc.15",
34
+ "@modern-js/core": "^1.0.0-rc.16",
35
35
  "@types/babel__core": "^7.1.15",
36
36
  "@types/jest": "^26",
37
37
  "@types/node": "^14",
@@ -39,8 +39,8 @@
39
39
  "@types/react-dom": "^17",
40
40
  "ts-jest": "^27.0.4",
41
41
  "typescript": "^4",
42
- "@modern-js/plugin-testing": "^1.0.0-rc.15",
43
- "@modern-js/module-tools": "^1.0.0-rc.15"
42
+ "@modern-js/plugin-testing": "^1.0.0-rc.16",
43
+ "@modern-js/module-tools": "^1.0.0-rc.16"
44
44
  },
45
45
  "sideEffects": false,
46
46
  "publishConfig": {
package/src/babel.ts CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ISyntaxOption,
5
5
  } from '@modern-js/babel-preset-lib';
6
6
  import { TransformOptions } from '@babel/core';
7
- import { applyOptionsChain, fs, getAlias } from '@modern-js/utils';
7
+ import { applyOptionsChain, fs, getAlias, upath } from '@modern-js/utils';
8
8
  import type { NormalizedConfig } from '@modern-js/core';
9
9
  import json5 from 'json5';
10
10
 
@@ -112,7 +112,7 @@ export const resolveBabelConfig = (
112
112
  const envOptions = babelChain.preset('@babel/preset-env').options();
113
113
  babelChain
114
114
  .preset('@babel/preset-env')
115
- .use(require.resolve('@babel/preset-env'), [
115
+ .use(upath.normalizeSafe(require.resolve('@babel/preset-env')), [
116
116
  {
117
117
  ...envOptions[0],
118
118
  loose: true,
@@ -121,17 +121,17 @@ export const resolveBabelConfig = (
121
121
 
122
122
  babelChain
123
123
  .plugin('babel-plugin-transform-typescript-metadata')
124
- .use(require.resolve('babel-plugin-transform-typescript-metadata'), []);
124
+ .use(upath.normalizeSafe(require.resolve('babel-plugin-transform-typescript-metadata')), []);
125
125
 
126
126
  babelChain
127
127
  .plugin('@babel/plugin-proposal-decorators')
128
- .use(require.resolve('@babel/plugin-proposal-decorators'), [
128
+ .use(upath.normalizeSafe(require.resolve('@babel/plugin-proposal-decorators')), [
129
129
  { legacy: true },
130
130
  ]);
131
131
 
132
132
  babelChain
133
133
  .plugin('@babel/plugin-proposal-class-properties')
134
- .use(require.resolve('@babel/plugin-proposal-class-properties'), [
134
+ .use(upath.normalizeSafe(require.resolve('@babel/plugin-proposal-class-properties')), [
135
135
  { loose: true },
136
136
  ]);
137
137
 
package/src/gather.ts CHANGED
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { createMiddlewareCollecter } from './middleware';
3
3
  import { requireModule } from './requireModule';
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { defaults } from './helpers';
3
3
  import { resolveBabelConfig } from '@/index';
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import { path } from '@modern-js/utils';
2
2
  import { gather } from '@/index';
3
3
 
4
4
  describe('@modern-js/server-utils', () => {