@modern-js/server-utils 2.0.0-beta.2 → 2.0.0-beta.3

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,53 @@
1
1
  # @modern-js/server-utils
2
2
 
3
+ ## 2.0.0-beta.3
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9c3e: chore: v2
8
+
9
+ ### Patch Changes
10
+
11
+ - 9b915e0c10: fix: tsconfig-paths plugin's new node use old node flag
12
+ fix: tsconfig-paths 插件转换的新节点使用旧节点的 flag
13
+ - d4e8e6f: fix: modernjs dev server can't start normaly
14
+ fix: modernjs dev 服务端不能正常启动
15
+ - a8642da58f: fix(server-utils): incorrect babel-compiler version
16
+
17
+ fix(server-utils): 修复引用错误的 babel-compiler 版本的问题
18
+
19
+ - c2bb0f1: chore(server-utils): using pre-bundled tsconfig-paths
20
+
21
+ chore(server-utils): 使用预打包的 tsconfig-paths 依赖
22
+
23
+ - 14b712da84: fix: use consistent alias type and default value across packages
24
+
25
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
26
+
27
+ - Updated dependencies [6aca875]
28
+ - Updated dependencies [2e60319]
29
+ - Updated dependencies [92f0eade39]
30
+ - Updated dependencies [edd1cfb1af]
31
+ - Updated dependencies [cc971eabfc]
32
+ - Updated dependencies [5b9049f2e9]
33
+ - Updated dependencies [92004d1906]
34
+ - Updated dependencies [b8bbe036c7]
35
+ - Updated dependencies [d5a31df781]
36
+ - Updated dependencies [dda38c9c3e]
37
+ - Updated dependencies [3bbea92b2a]
38
+ - Updated dependencies [b710adb]
39
+ - Updated dependencies [f179749375]
40
+ - Updated dependencies [ea7cf06]
41
+ - Updated dependencies [bbe4c4a]
42
+ - Updated dependencies [e4558a0]
43
+ - Updated dependencies [abf3421a75]
44
+ - Updated dependencies [543be9558e]
45
+ - Updated dependencies [14b712da84]
46
+ - @modern-js/utils@2.0.0-beta.3
47
+ - @modern-js/plugin@2.0.0-beta.3
48
+ - @modern-js/babel-preset-lib@2.0.0-beta.3
49
+ - @modern-js/babel-compiler@2.0.0-beta.3
50
+
3
51
  ## 2.0.0-beta.2
4
52
 
5
53
  ### Major Changes
@@ -25,16 +25,17 @@ export const getBabelConfig = (libPresetOption, syntaxOption) => {
25
25
  sourceType: 'unambiguous'
26
26
  }, chain.toJSON());
27
27
  };
28
- export const resolveBabelConfig = (appDirectory, config, option
29
- // FIXME: babel type can't pass type checking
30
- ) => {
28
+ export const resolveBabelConfig = (appDirectory, config, option) => {
31
29
  const {
32
- define,
33
30
  globalVars,
34
31
  alias,
35
- babelConfig
32
+ babelConfig,
33
+ define
36
34
  } = config;
37
-
35
+ const globalDefineVars = define && Object.entries(define).reduce((object, [key, value]) => {
36
+ object[key] = JSON.stringify(value);
37
+ return object;
38
+ }, {});
38
39
  // alias config
39
40
  const aliasConfig = getAliasConfig(alias, _objectSpread({
40
41
  appDirectory
@@ -46,9 +47,8 @@ export const resolveBabelConfig = (appDirectory, config, option
46
47
  enableReactPreset: true,
47
48
  enableTypescriptPreset: true,
48
49
  alias: aliasConfig,
49
- // FIXME: handle the define envVars
50
- envVars: define,
51
- globalVars: globalVars
50
+ envVars: [],
51
+ globalVars: _objectSpread(_objectSpread({}, globalVars), globalDefineVars)
52
52
  }, {
53
53
  type: option.type,
54
54
  syntax: option.syntax
@@ -54,16 +54,17 @@ const getBabelConfig = (libPresetOption, syntaxOption) => {
54
54
  }, chain.toJSON());
55
55
  };
56
56
  exports.getBabelConfig = getBabelConfig;
57
- const resolveBabelConfig = (appDirectory, config, option
58
- // FIXME: babel type can't pass type checking
59
- ) => {
57
+ const resolveBabelConfig = (appDirectory, config, option) => {
60
58
  const {
61
- define,
62
59
  globalVars,
63
60
  alias,
64
- babelConfig
61
+ babelConfig,
62
+ define
65
63
  } = config;
66
-
64
+ const globalDefineVars = define && Object.entries(define).reduce((object, [key, value]) => {
65
+ object[key] = JSON.stringify(value);
66
+ return object;
67
+ }, {});
67
68
  // alias config
68
69
  const aliasConfig = (0, _utils.getAliasConfig)(alias, _objectSpread({
69
70
  appDirectory
@@ -75,9 +76,8 @@ const resolveBabelConfig = (appDirectory, config, option
75
76
  enableReactPreset: true,
76
77
  enableTypescriptPreset: true,
77
78
  alias: aliasConfig,
78
- // FIXME: handle the define envVars
79
- envVars: define,
80
- globalVars: globalVars
79
+ envVars: [],
80
+ globalVars: _objectSpread(_objectSpread({}, globalVars), globalDefineVars)
81
81
  }, {
82
82
  type: option.type,
83
83
  syntax: option.syntax
@@ -1,5 +1,6 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
5
  import * as path from 'path';
5
6
  import { getBabelChain, applyUserBabelConfig } from '@modern-js/babel-preset-lib';
@@ -26,14 +27,18 @@ export var getBabelConfig = function getBabelConfig(libPresetOption, syntaxOptio
26
27
  sourceType: 'unambiguous'
27
28
  }, chain.toJSON());
28
29
  };
29
- export var resolveBabelConfig = function resolveBabelConfig(appDirectory, config, option
30
- // FIXME: babel type can't pass type checking
31
- ) {
32
- var define = config.define,
33
- globalVars = config.globalVars,
30
+ export var resolveBabelConfig = function resolveBabelConfig(appDirectory, config, option) {
31
+ var globalVars = config.globalVars,
34
32
  alias = config.alias,
35
- babelConfig = config.babelConfig;
36
-
33
+ babelConfig = config.babelConfig,
34
+ define = config.define;
35
+ var globalDefineVars = define && Object.entries(define).reduce(function (object, _ref) {
36
+ var _ref2 = _slicedToArray(_ref, 2),
37
+ key = _ref2[0],
38
+ value = _ref2[1];
39
+ object[key] = JSON.stringify(value);
40
+ return object;
41
+ }, {});
37
42
  // alias config
38
43
  var aliasConfig = getAliasConfig(alias, _objectSpread({
39
44
  appDirectory: appDirectory
@@ -45,9 +50,8 @@ export var resolveBabelConfig = function resolveBabelConfig(appDirectory, config
45
50
  enableReactPreset: true,
46
51
  enableTypescriptPreset: true,
47
52
  alias: aliasConfig,
48
- // FIXME: handle the define envVars
49
- envVars: define,
50
- globalVars: globalVars
53
+ envVars: [],
54
+ globalVars: _objectSpread(_objectSpread({}, globalVars), globalDefineVars)
51
55
  }, {
52
56
  type: option.type,
53
57
  syntax: option.syntax
@@ -69,7 +73,7 @@ export var resolveBabelConfig = function resolveBabelConfig(appDirectory, config
69
73
  return applyUserBabelConfig(internalBabelConfig, babelConfig);
70
74
  };
71
75
  export var compileByBabel = /*#__PURE__*/function () {
72
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appDirectory, config, compileOptions) {
76
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appDirectory, config, compileOptions) {
73
77
  var sourceDirs, distDir, tsconfigPath, results;
74
78
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
75
79
  while (1) {
@@ -78,7 +82,7 @@ export var compileByBabel = /*#__PURE__*/function () {
78
82
  sourceDirs = compileOptions.sourceDirs, distDir = compileOptions.distDir, tsconfigPath = compileOptions.tsconfigPath;
79
83
  _context2.next = 3;
80
84
  return Promise.all(sourceDirs.map( /*#__PURE__*/function () {
81
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sourceDir) {
85
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sourceDir) {
82
86
  var babelConfig, basename, targetDir;
83
87
  return _regeneratorRuntime().wrap(function _callee$(_context) {
84
88
  while (1) {
@@ -119,7 +123,7 @@ export var compileByBabel = /*#__PURE__*/function () {
119
123
  }, _callee);
120
124
  }));
121
125
  return function (_x4) {
122
- return _ref2.apply(this, arguments);
126
+ return _ref4.apply(this, arguments);
123
127
  };
124
128
  }()));
125
129
  case 3:
@@ -137,6 +141,6 @@ export var compileByBabel = /*#__PURE__*/function () {
137
141
  }, _callee2);
138
142
  }));
139
143
  return function compileByBabel(_x, _x2, _x3) {
140
- return _ref.apply(this, arguments);
144
+ return _ref3.apply(this, arguments);
141
145
  };
142
146
  }();
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.0.0-beta.2",
14
+ "version": "2.0.0-beta.3",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -37,10 +37,10 @@
37
37
  "@babel/runtime": "^7.18.0",
38
38
  "babel-plugin-module-resolver": "^4.1.0",
39
39
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
40
- "@modern-js/babel-compiler": "2.0.0-beta.2",
41
- "@modern-js/babel-preset-lib": "2.0.0-beta.2",
42
- "@modern-js/plugin": "2.0.0-beta.2",
43
- "@modern-js/utils": "2.0.0-beta.2"
40
+ "@modern-js/babel-compiler": "2.0.0-beta.3",
41
+ "@modern-js/babel-preset-lib": "2.0.0-beta.3",
42
+ "@modern-js/plugin": "2.0.0-beta.3",
43
+ "@modern-js/utils": "2.0.0-beta.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/babel__core": "^7.1.15",
@@ -49,9 +49,9 @@
49
49
  "jest": "^27",
50
50
  "ts-jest": "^27.0.4",
51
51
  "typescript": "^4",
52
- "@modern-js/server-core": "2.0.0-beta.2",
53
- "@scripts/build": "2.0.0-beta.2",
54
- "@scripts/jest-config": "2.0.0-beta.2"
52
+ "@modern-js/server-core": "2.0.0-beta.3",
53
+ "@scripts/build": "2.0.0-beta.3",
54
+ "@scripts/jest-config": "2.0.0-beta.3"
55
55
  },
56
56
  "sideEffects": false,
57
57
  "publishConfig": {