@modern-js/server-utils 1.21.3 → 2.0.0-beta.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,13 +1,37 @@
1
1
  # @modern-js/server-utils
2
2
 
3
- ## 1.21.3
3
+ ## 2.0.0-beta.0
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9: chore: v2
4
8
 
5
9
  ### Patch Changes
6
10
 
7
- - @modern-js/babel-preset-lib@1.21.3
8
- - @modern-js/babel-compiler@1.21.3
9
- - @modern-js/plugin@1.21.3
10
- - @modern-js/utils@1.21.3
11
+ - 9b915e0c1: fix: tsconfig-paths plugin's new node use old node flag
12
+ fix: tsconfig-paths 插件转换的新节点使用旧节点的 flag
13
+ - a8642da: fix(server-utils): incorrect babel-compiler version
14
+
15
+ fix(server-utils): 修复引用错误的 babel-compiler 版本的问题
16
+
17
+ - 14b712d: fix: use consistent alias type and default value across packages
18
+
19
+ fix: 在各个包中使用一致的 alias 类型定义和默认值
20
+
21
+ - Updated dependencies [edd1cfb1a]
22
+ - Updated dependencies [cc971eabf]
23
+ - Updated dependencies [5b9049f]
24
+ - Updated dependencies [b8bbe036c]
25
+ - Updated dependencies [d5a31df78]
26
+ - Updated dependencies [dda38c9]
27
+ - Updated dependencies [3bbea92b2]
28
+ - Updated dependencies [abf3421]
29
+ - Updated dependencies [543be95]
30
+ - Updated dependencies [14b712d]
31
+ - @modern-js/utils@2.0.0-beta.0
32
+ - @modern-js/plugin@2.0.0-beta.0
33
+ - @modern-js/babel-preset-lib@2.0.0-beta.0
34
+ - @modern-js/babel-compiler@2.0.0-beta.0
11
35
 
12
36
  ## 1.21.2
13
37
 
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import * as path from 'path';
8
8
  import { getBabelChain, applyUserBabelConfig } from '@modern-js/babel-preset-lib';
9
- import { fs, json5, getAlias } from '@modern-js/utils';
9
+ import { fs, json5, getAliasConfig } from '@modern-js/utils';
10
10
  import { compiler } from '@modern-js/babel-compiler';
11
11
  import { FILE_EXTENSIONS } from "../../common";
12
12
  export * from '@babel/core';
@@ -38,7 +38,7 @@ export const resolveBabelConfig = (appDirectory, config, option // FIXME: babel
38
38
  babelConfig
39
39
  } = config; // alias config
40
40
 
41
- const aliasConfig = getAlias(alias, _objectSpread({
41
+ const aliasConfig = getAliasConfig(alias, _objectSpread({
42
42
  appDirectory
43
43
  }, option)); // babel config
44
44
 
@@ -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 path from 'path';
8
- import { logger, getAlias, fs } from '@modern-js/utils';
8
+ import { logger, getAliasConfig, fs } from '@modern-js/utils';
9
9
  import ts from 'typescript';
10
10
  import { TypescriptLoader } from "./typescript-loader";
11
11
  import { tsconfigPathsBeforeHookFactory } from "./tsconfig-paths-plugin";
@@ -54,7 +54,7 @@ export const compileByTs = async (appDirectory, config, compileOptions) => {
54
54
  const {
55
55
  alias
56
56
  } = config;
57
- const aliasOption = getAlias(alias || {}, {
57
+ const aliasOption = getAliasConfig(alias, {
58
58
  appDirectory,
59
59
  tsconfigPath
60
60
  });
@@ -117,12 +117,16 @@ export function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
117
117
 
118
118
  const moduleSpecifier = tsBinary.factory.createStringLiteral(result);
119
119
  moduleSpecifier.parent = node.moduleSpecifier.parent;
120
+ let newNode;
120
121
 
121
122
  if (tsBinary.isImportDeclaration(node)) {
122
- return tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
123
+ newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
123
124
  } else {
124
- return tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
125
+ newNode = tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
125
126
  }
127
+
128
+ newNode.flags = node.flags;
129
+ return newNode;
126
130
  } catch (_unused) {
127
131
  return node;
128
132
  }
@@ -84,7 +84,7 @@ const resolveBabelConfig = (appDirectory, config, option // FIXME: babel type ca
84
84
  babelConfig
85
85
  } = config; // alias config
86
86
 
87
- const aliasConfig = (0, _utils.getAlias)(alias, _objectSpread({
87
+ const aliasConfig = (0, _utils.getAliasConfig)(alias, _objectSpread({
88
88
  appDirectory
89
89
  }, option)); // babel config
90
90
 
@@ -71,7 +71,7 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
71
71
  const {
72
72
  alias
73
73
  } = config;
74
- const aliasOption = (0, _utils.getAlias)(alias || {}, {
74
+ const aliasOption = (0, _utils.getAliasConfig)(alias, {
75
75
  appDirectory,
76
76
  tsconfigPath
77
77
  });
@@ -131,12 +131,16 @@ function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
131
131
 
132
132
  const moduleSpecifier = tsBinary.factory.createStringLiteral(result);
133
133
  moduleSpecifier.parent = node.moduleSpecifier.parent;
134
+ let newNode;
134
135
 
135
136
  if (tsBinary.isImportDeclaration(node)) {
136
- return tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
137
+ newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
137
138
  } else {
138
- return tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
139
+ newNode = tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
139
140
  }
141
+
142
+ newNode.flags = node.flags;
143
+ return newNode;
140
144
  } catch (_unused) {
141
145
  return node;
142
146
  }
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import * as path from 'path';
5
5
  import { getBabelChain, applyUserBabelConfig } from '@modern-js/babel-preset-lib';
6
- import { fs, json5, getAlias } from '@modern-js/utils';
6
+ import { fs, json5, getAliasConfig } from '@modern-js/utils';
7
7
  import { compiler } from '@modern-js/babel-compiler';
8
8
  import { FILE_EXTENSIONS } from "../../common";
9
9
  export * from '@babel/core';
@@ -35,7 +35,7 @@ export var resolveBabelConfig = function resolveBabelConfig(appDirectory, config
35
35
  alias = config.alias,
36
36
  babelConfig = config.babelConfig; // alias config
37
37
 
38
- var aliasConfig = getAlias(alias, _objectSpread({
38
+ var aliasConfig = getAliasConfig(alias, _objectSpread({
39
39
  appDirectory: appDirectory
40
40
  }, option)); // babel config
41
41
 
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
5
  import path from 'path';
6
- import { logger, getAlias, fs } from '@modern-js/utils';
6
+ import { logger, getAliasConfig, fs } from '@modern-js/utils';
7
7
  import ts from 'typescript';
8
8
  import { TypescriptLoader } from "./typescript-loader";
9
9
  import { tsconfigPathsBeforeHookFactory } from "./tsconfig-paths-plugin";
@@ -84,7 +84,7 @@ export var compileByTs = /*#__PURE__*/function () {
84
84
  createProgram = ts.createIncrementalProgram || ts.createProgram;
85
85
  formatHost = getFormatHost(ts);
86
86
  alias = config.alias;
87
- aliasOption = getAlias(alias || {}, {
87
+ aliasOption = getAliasConfig(alias, {
88
88
  appDirectory: appDirectory,
89
89
  tsconfigPath: tsconfigPath
90
90
  });
@@ -135,12 +135,16 @@ export function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
135
135
 
136
136
  var moduleSpecifier = tsBinary.factory.createStringLiteral(_result);
137
137
  moduleSpecifier.parent = node.moduleSpecifier.parent;
138
+ var newNode;
138
139
 
139
140
  if (tsBinary.isImportDeclaration(node)) {
140
- return tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
141
+ newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
141
142
  } else {
142
- return tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
143
+ newNode = tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
143
144
  }
145
+
146
+ newNode.flags = node.flags;
147
+ return newNode;
144
148
  } catch (_unused) {
145
149
  return node;
146
150
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.21.3",
14
+ "version": "2.0.0-beta.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -35,18 +35,18 @@
35
35
  "@babel/preset-env": "^7.18.0",
36
36
  "@babel/preset-typescript": "^7.17.12",
37
37
  "@babel/runtime": "^7.18.0",
38
- "@modern-js/babel-compiler": "^1.21.3",
39
- "@modern-js/babel-preset-lib": "1.21.3",
40
- "@modern-js/plugin": "1.21.3",
41
- "@modern-js/utils": "1.21.3",
38
+ "@modern-js/babel-compiler": "2.0.0-beta.0",
39
+ "@modern-js/babel-preset-lib": "2.0.0-beta.0",
40
+ "@modern-js/plugin": "2.0.0-beta.0",
41
+ "@modern-js/utils": "2.0.0-beta.0",
42
42
  "babel-plugin-module-resolver": "^4.1.0",
43
43
  "babel-plugin-transform-typescript-metadata": "^0.3.2",
44
44
  "tsconfig-paths": "3.14.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@modern-js/core": "1.21.3",
48
- "@scripts/build": "1.21.3",
49
- "@scripts/jest-config": "1.21.3",
47
+ "@modern-js/core": "2.0.0-beta.0",
48
+ "@scripts/build": "2.0.0-beta.0",
49
+ "@scripts/jest-config": "2.0.0-beta.0",
50
50
  "@types/babel__core": "^7.1.15",
51
51
  "@types/jest": "^27",
52
52
  "@types/node": "^14",
@@ -59,33 +59,10 @@
59
59
  "registry": "https://registry.npmjs.org/",
60
60
  "access": "public"
61
61
  },
62
- "wireit": {
63
- "build": {
64
- "command": "modern build",
65
- "files": [
66
- "src/**/*",
67
- "tsconfig.json",
68
- "package.json"
69
- ],
70
- "output": [
71
- "dist/**/*"
72
- ]
73
- },
74
- "test": {
75
- "command": "jest --passWithNoTests",
76
- "files": [
77
- "src/**/*",
78
- "tsconfig.json",
79
- "package.json",
80
- "tests/**/*"
81
- ],
82
- "output": []
83
- }
84
- },
85
62
  "scripts": {
86
63
  "new": "modern new",
87
64
  "dev": "modern build --watch",
88
- "build": "wireit",
89
- "test": "wireit"
65
+ "build": "modern build",
66
+ "test": "jest --passWithNoTests"
90
67
  }
91
68
  }