@modern-js/server-utils 2.13.4 → 2.15.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,32 @@
1
1
  # @modern-js/server-utils
2
2
 
3
+ ## 2.15.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @modern-js/babel-preset-lib@2.15.0
8
+ - @modern-js/babel-compiler@2.15.0
9
+ - @modern-js/utils@2.15.0
10
+
11
+ ## 2.14.0
12
+
13
+ ### Patch Changes
14
+
15
+ - 8a3c693: chore(server): no longer replace globalVars when compiler is babel
16
+
17
+ chore(server): 进行 babel compile 时不再替换 globalVars
18
+
19
+ - Updated dependencies [4779152]
20
+ - Updated dependencies [9321bef]
21
+ - Updated dependencies [9b45c58]
22
+ - Updated dependencies [52d0cb1]
23
+ - Updated dependencies [60a81d0]
24
+ - Updated dependencies [dacef96]
25
+ - Updated dependencies [16399fd]
26
+ - @modern-js/utils@2.14.0
27
+ - @modern-js/babel-preset-lib@2.14.0
28
+ - @modern-js/babel-compiler@2.14.0
29
+
3
30
  ## 2.13.4
4
31
 
5
32
  ### Patch Changes
@@ -60,11 +60,7 @@ const getBabelConfig = (libPresetOption, syntaxOption) => {
60
60
  };
61
61
  };
62
62
  const resolveBabelConfig = (appDirectory, config, option) => {
63
- const { globalVars, alias, babelConfig, define } = config;
64
- const globalDefineVars = define && Object.entries(define).reduce((object, [key, value]) => {
65
- object[key] = JSON.stringify(value);
66
- return object;
67
- }, {});
63
+ const { alias, babelConfig } = config;
68
64
  const aliasConfig = (0, import_utils.getAliasConfig)(alias, {
69
65
  appDirectory,
70
66
  ...option
@@ -75,11 +71,7 @@ const resolveBabelConfig = (appDirectory, config, option) => {
75
71
  enableReactPreset: true,
76
72
  enableTypescriptPreset: true,
77
73
  alias: aliasConfig,
78
- envVars: [],
79
- globalVars: {
80
- ...globalVars,
81
- ...globalDefineVars
82
- }
74
+ envVars: []
83
75
  },
84
76
  {
85
77
  type: option.type,
@@ -1,11 +1,3 @@
1
- function _arrayLikeToArray(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _arrayWithHoles(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
1
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
2
  try {
11
3
  var info = gen[key](arg);
@@ -48,33 +40,6 @@ function _defineProperty(obj, key, value) {
48
40
  }
49
41
  return obj;
50
42
  }
51
- function _iterableToArrayLimit(arr, i) {
52
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
53
- if (_i == null) return;
54
- var _arr = [];
55
- var _n = true;
56
- var _d = false;
57
- var _s, _e;
58
- try {
59
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
60
- _arr.push(_s.value);
61
- if (i && _arr.length === i) break;
62
- }
63
- } catch (err) {
64
- _d = true;
65
- _e = err;
66
- } finally{
67
- try {
68
- if (!_n && _i["return"] != null) _i["return"]();
69
- } finally{
70
- if (_d) throw _e;
71
- }
72
- }
73
- return _arr;
74
- }
75
- function _nonIterableRest() {
76
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
77
- }
78
43
  function _objectSpread(target) {
79
44
  for(var i = 1; i < arguments.length; i++){
80
45
  var source = arguments[i] != null ? arguments[i] : {};
@@ -114,17 +79,6 @@ function _objectSpreadProps(target, source) {
114
79
  }
115
80
  return target;
116
81
  }
117
- function _slicedToArray(arr, i) {
118
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
119
- }
120
- function _unsupportedIterableToArray(o, minLen) {
121
- if (!o) return;
122
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
123
- var n = Object.prototype.toString.call(o).slice(8, -1);
124
- if (n === "Object" && o.constructor) n = o.constructor.name;
125
- if (n === "Map" || n === "Set") return Array.from(n);
126
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
127
- }
128
82
  var __generator = this && this.__generator || function(thisArg, body) {
129
83
  var f, y, t, g, _ = {
130
84
  label: 0,
@@ -245,12 +199,7 @@ var getBabelConfig = function(libPresetOption, syntaxOption) {
245
199
  }, chain.toJSON());
246
200
  };
247
201
  var resolveBabelConfig = function(appDirectory, config, option) {
248
- var globalVars = config.globalVars, alias = config.alias, babelConfig = config.babelConfig, define = config.define;
249
- var globalDefineVars = define && Object.entries(define).reduce(function(object, param) {
250
- var _param = _slicedToArray(param, 2), key = _param[0], value = _param[1];
251
- object[key] = JSON.stringify(value);
252
- return object;
253
- }, {});
202
+ var alias = config.alias, babelConfig = config.babelConfig;
254
203
  var aliasConfig = getAliasConfig(alias, _objectSpread({
255
204
  appDirectory: appDirectory
256
205
  }, option));
@@ -259,8 +208,7 @@ var resolveBabelConfig = function(appDirectory, config, option) {
259
208
  enableReactPreset: true,
260
209
  enableTypescriptPreset: true,
261
210
  alias: aliasConfig,
262
- envVars: [],
263
- globalVars: _objectSpread({}, globalVars, globalDefineVars)
211
+ envVars: []
264
212
  }, {
265
213
  type: option.type,
266
214
  syntax: option.syntax
@@ -26,11 +26,7 @@ const getBabelConfig = (libPresetOption, syntaxOption) => {
26
26
  };
27
27
  };
28
28
  const resolveBabelConfig = (appDirectory, config, option) => {
29
- const { globalVars, alias, babelConfig, define } = config;
30
- const globalDefineVars = define && Object.entries(define).reduce((object, [key, value]) => {
31
- object[key] = JSON.stringify(value);
32
- return object;
33
- }, {});
29
+ const { alias, babelConfig } = config;
34
30
  const aliasConfig = getAliasConfig(alias, {
35
31
  appDirectory,
36
32
  ...option
@@ -41,11 +37,7 @@ const resolveBabelConfig = (appDirectory, config, option) => {
41
37
  enableReactPreset: true,
42
38
  enableTypescriptPreset: true,
43
39
  alias: aliasConfig,
44
- envVars: [],
45
- globalVars: {
46
- ...globalVars,
47
- ...globalDefineVars
48
- }
40
+ envVars: []
49
41
  },
50
42
  {
51
43
  type: option.type,
@@ -6,8 +6,6 @@ export interface Pattern {
6
6
  }
7
7
  export interface IConfig {
8
8
  alias?: SourceNormalizedConfig['alias'];
9
- define?: SourceNormalizedConfig['define'];
10
- globalVars?: SourceNormalizedConfig['globalVars'];
11
9
  babelConfig?: ToolsNormalizedConfig['babel'];
12
10
  server: {
13
11
  compiler?: 'babel' | 'typescript';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.13.4",
14
+ "version": "2.15.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/cjs/index.js",
@@ -35,9 +35,9 @@
35
35
  "@babel/runtime": "^7.18.0",
36
36
  "babel-plugin-module-resolver": "^4.1.0",
37
37
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
38
- "@modern-js/babel-compiler": "2.13.4",
39
- "@modern-js/babel-preset-lib": "2.13.4",
40
- "@modern-js/utils": "2.13.4"
38
+ "@modern-js/babel-compiler": "2.15.0",
39
+ "@modern-js/babel-preset-lib": "2.15.0",
40
+ "@modern-js/utils": "2.15.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/babel__core": "^7.1.15",
@@ -46,9 +46,9 @@
46
46
  "jest": "^29",
47
47
  "ts-jest": "^29.0.5",
48
48
  "typescript": "^4",
49
- "@modern-js/server-core": "2.13.4",
50
- "@scripts/build": "2.13.4",
51
- "@scripts/jest-config": "2.13.4"
49
+ "@modern-js/server-core": "2.15.0",
50
+ "@scripts/build": "2.15.0",
51
+ "@scripts/jest-config": "2.15.0"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "publishConfig": {