@modern-js/server-utils 1.21.2 → 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 +33 -0
- package/dist/js/modern/compilers/babel/index.js +2 -2
- package/dist/js/modern/compilers/typescript/index.js +2 -2
- package/dist/js/modern/compilers/typescript/tsconfig-paths-plugin.js +6 -2
- package/dist/js/node/compilers/babel/index.js +1 -1
- package/dist/js/node/compilers/typescript/index.js +1 -1
- package/dist/js/node/compilers/typescript/tsconfig-paths-plugin.js +6 -2
- package/dist/js/treeshaking/compilers/babel/index.js +2 -2
- package/dist/js/treeshaking/compilers/typescript/index.js +2 -2
- package/dist/js/treeshaking/compilers/typescript/tsconfig-paths-plugin.js +6 -2
- package/package.json +10 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @modern-js/server-utils
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dda38c9: chore: v2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
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
|
|
35
|
+
|
|
3
36
|
## 1.21.2
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -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,
|
|
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 =
|
|
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,
|
|
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 =
|
|
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
|
-
|
|
123
|
+
newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
|
|
123
124
|
} else {
|
|
124
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
137
|
+
newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
|
|
137
138
|
} else {
|
|
138
|
-
|
|
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,
|
|
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 =
|
|
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,
|
|
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 =
|
|
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
|
-
|
|
141
|
+
newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
|
|
141
142
|
} else {
|
|
142
|
-
|
|
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": "
|
|
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": "
|
|
39
|
-
"@modern-js/babel-preset-lib": "
|
|
40
|
-
"@modern-js/plugin": "
|
|
41
|
-
"@modern-js/utils": "
|
|
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": "
|
|
48
|
-
"@scripts/build": "
|
|
49
|
-
"@scripts/jest-config": "
|
|
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": "
|
|
89
|
-
"test": "
|
|
65
|
+
"build": "modern build",
|
|
66
|
+
"test": "jest --passWithNoTests"
|
|
90
67
|
}
|
|
91
68
|
}
|