@modern-js/server-utils 2.6.0 → 2.8.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 +36 -0
- package/README.md +2 -2
- package/dist/cjs/compilers/typescript/index.js +8 -8
- package/dist/cjs/compilers/typescript/{tsconfig-paths-plugin.js → tsconfigPathsPlugin.js} +3 -3
- package/dist/cjs/compilers/typescript/{typescript-loader.js → typescriptLoader.js} +3 -3
- package/dist/esm/compilers/typescript/index.js +8 -8
- package/dist/esm-node/compilers/typescript/index.js +6 -6
- package/package.json +9 -9
- /package/dist/esm/compilers/typescript/{tsconfig-paths-plugin.js → tsconfigPathsPlugin.js} +0 -0
- /package/dist/esm/compilers/typescript/{typescript-loader.js → typescriptLoader.js} +0 -0
- /package/dist/esm-node/compilers/typescript/{tsconfig-paths-plugin.js → tsconfigPathsPlugin.js} +0 -0
- /package/dist/esm-node/compilers/typescript/{typescript-loader.js → typescriptLoader.js} +0 -0
- /package/dist/types/compilers/typescript/{tsconfig-paths-plugin.d.ts → tsconfigPathsPlugin.d.ts} +0 -0
- /package/dist/types/compilers/typescript/{typescript-loader.d.ts → typescriptLoader.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @modern-js/server-utils
|
|
2
2
|
|
|
3
|
+
## 2.8.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2c1151271d: fix(builder): fix incorrect browserslist config
|
|
8
|
+
|
|
9
|
+
fix(builder): 修复错误的 browserslist 配置
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [1104a9f18b]
|
|
12
|
+
- Updated dependencies [1f6ca2c7fb]
|
|
13
|
+
- @modern-js/utils@2.8.0
|
|
14
|
+
- @modern-js/babel-preset-lib@2.8.0
|
|
15
|
+
- @modern-js/babel-compiler@2.8.0
|
|
16
|
+
|
|
17
|
+
## 2.7.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 84bfb439b8: feat: support custom apiDir, lambdaDir and style of writing for bff
|
|
22
|
+
feat: 支持定制 api 目录,lambda 目录,bff 的写法
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 7fff9020e1: chore: make file naming consistent
|
|
27
|
+
|
|
28
|
+
chore: 统一文件命名为小驼峰格式
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [0f15fc597c]
|
|
31
|
+
- Updated dependencies [dcad887024]
|
|
32
|
+
- Updated dependencies [a4672f7c16]
|
|
33
|
+
- Updated dependencies [7fff9020e1]
|
|
34
|
+
- Updated dependencies [84bfb439b8]
|
|
35
|
+
- @modern-js/utils@2.7.0
|
|
36
|
+
- @modern-js/babel-preset-lib@2.7.0
|
|
37
|
+
- @modern-js/babel-compiler@2.7.0
|
|
38
|
+
|
|
3
39
|
## 2.6.0
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-sta
|
|
|
19
19
|
|
|
20
20
|
## Contributing
|
|
21
21
|
|
|
22
|
-
Please read the [Contributing Guide](https://github.com/
|
|
22
|
+
Please read the [Contributing Guide](https://github.com/web-infra-dev/modern.js/blob/main/CONTRIBUTING.md).
|
|
23
23
|
|
|
24
24
|
## License
|
|
25
25
|
|
|
26
|
-
Modern.js is [MIT licensed](https://github.com/
|
|
26
|
+
Modern.js is [MIT licensed](https://github.com/web-infra-dev/modern.js/blob/main/LICENSE).
|
|
@@ -33,8 +33,8 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
33
33
|
var import_path = __toESM(require("path"));
|
|
34
34
|
var import_utils = require("@modern-js/utils");
|
|
35
35
|
var import_typescript = __toESM(require("typescript"));
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var import_typescriptLoader = require("./typescriptLoader");
|
|
37
|
+
var import_tsconfigPathsPlugin = require("./tsconfigPathsPlugin");
|
|
38
38
|
const readTsConfigByFile = (tsConfigFile) => {
|
|
39
39
|
const parsedCmd = import_typescript.default.getParsedCommandLineOfConfigFile(
|
|
40
40
|
tsConfigFile,
|
|
@@ -44,10 +44,10 @@ const readTsConfigByFile = (tsConfigFile) => {
|
|
|
44
44
|
const { options, fileNames, projectReferences } = parsedCmd;
|
|
45
45
|
return { options, fileNames, projectReferences };
|
|
46
46
|
};
|
|
47
|
-
const copyFiles = async (from, to, tsconfigPath) => {
|
|
47
|
+
const copyFiles = async (from, to, appDirectory, tsconfigPath) => {
|
|
48
48
|
if (await import_utils.fs.pathExists(from)) {
|
|
49
|
-
const
|
|
50
|
-
const targetDir = import_path.default.join(to,
|
|
49
|
+
const relativePath = import_path.default.relative(appDirectory, from);
|
|
50
|
+
const targetDir = import_path.default.join(to, relativePath);
|
|
51
51
|
await import_utils.fs.copy(from, targetDir, {
|
|
52
52
|
filter: (src) => ![".ts"].includes(import_path.default.extname(src)) && src !== tsconfigPath
|
|
53
53
|
});
|
|
@@ -59,7 +59,7 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
|
|
|
59
59
|
if (!tsconfigPath) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
const ts2 = new
|
|
62
|
+
const ts2 = new import_typescriptLoader.TypescriptLoader({
|
|
63
63
|
appDirectory
|
|
64
64
|
}).load();
|
|
65
65
|
const createProgram = ts2.createIncrementalProgram || ts2.createProgram;
|
|
@@ -88,7 +88,7 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
|
|
|
88
88
|
...options
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
const tsconfigPathsPlugin = (0,
|
|
91
|
+
const tsconfigPathsPlugin = (0, import_tsconfigPathsPlugin.tsconfigPathsBeforeHookFactory)(
|
|
92
92
|
ts2,
|
|
93
93
|
absoluteBaseUrl,
|
|
94
94
|
paths
|
|
@@ -104,7 +104,7 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
|
|
|
104
104
|
process.exit(1);
|
|
105
105
|
}
|
|
106
106
|
for (const source of sourceDirs) {
|
|
107
|
-
await copyFiles(source, distDir, tsconfigPath);
|
|
107
|
+
await copyFiles(source, distDir, appDirectory, tsconfigPath);
|
|
108
108
|
}
|
|
109
109
|
import_utils.logger.info(`Ts compile succeed`);
|
|
110
110
|
};
|
|
@@ -25,11 +25,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var
|
|
29
|
-
__export(
|
|
28
|
+
var tsconfigPathsPlugin_exports = {};
|
|
29
|
+
__export(tsconfigPathsPlugin_exports, {
|
|
30
30
|
tsconfigPathsBeforeHookFactory: () => tsconfigPathsBeforeHookFactory
|
|
31
31
|
});
|
|
32
|
-
module.exports = __toCommonJS(
|
|
32
|
+
module.exports = __toCommonJS(tsconfigPathsPlugin_exports);
|
|
33
33
|
var os = __toESM(require("os"));
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
35
|
var ts = __toESM(require("typescript"));
|
|
@@ -15,11 +15,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var
|
|
19
|
-
__export(
|
|
18
|
+
var typescriptLoader_exports = {};
|
|
19
|
+
__export(typescriptLoader_exports, {
|
|
20
20
|
TypescriptLoader: () => TypescriptLoader
|
|
21
21
|
});
|
|
22
|
-
module.exports = __toCommonJS(
|
|
22
|
+
module.exports = __toCommonJS(typescriptLoader_exports);
|
|
23
23
|
class TypescriptLoader {
|
|
24
24
|
constructor({ appDirectory }) {
|
|
25
25
|
this.appDirectory = appDirectory;
|
|
@@ -153,8 +153,8 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
153
153
|
import path from "path";
|
|
154
154
|
import { logger, getAliasConfig, fs } from "@modern-js/utils";
|
|
155
155
|
import ts from "typescript";
|
|
156
|
-
import { TypescriptLoader } from "./
|
|
157
|
-
import { tsconfigPathsBeforeHookFactory } from "./
|
|
156
|
+
import { TypescriptLoader } from "./typescriptLoader";
|
|
157
|
+
import { tsconfigPathsBeforeHookFactory } from "./tsconfigPathsPlugin";
|
|
158
158
|
var readTsConfigByFile = function(tsConfigFile) {
|
|
159
159
|
var parsedCmd = ts.getParsedCommandLineOfConfigFile(tsConfigFile, void 0, ts.sys);
|
|
160
160
|
var options = parsedCmd.options, fileNames = parsedCmd.fileNames, projectReferences = parsedCmd.projectReferences;
|
|
@@ -165,8 +165,8 @@ var readTsConfigByFile = function(tsConfigFile) {
|
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
167
|
var copyFiles = function() {
|
|
168
|
-
var _ref = _asyncToGenerator(function(from, to, tsconfigPath) {
|
|
169
|
-
var
|
|
168
|
+
var _ref = _asyncToGenerator(function(from, to, appDirectory, tsconfigPath) {
|
|
169
|
+
var relativePath, targetDir;
|
|
170
170
|
return __generator(this, function(_state) {
|
|
171
171
|
switch(_state.label){
|
|
172
172
|
case 0:
|
|
@@ -179,8 +179,8 @@ var copyFiles = function() {
|
|
|
179
179
|
3,
|
|
180
180
|
3
|
|
181
181
|
];
|
|
182
|
-
|
|
183
|
-
targetDir = path.join(to,
|
|
182
|
+
relativePath = path.relative(appDirectory, from);
|
|
183
|
+
targetDir = path.join(to, relativePath);
|
|
184
184
|
return [
|
|
185
185
|
4,
|
|
186
186
|
fs.copy(from, targetDir, {
|
|
@@ -201,7 +201,7 @@ var copyFiles = function() {
|
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
|
-
return function copyFiles(from, to, tsconfigPath) {
|
|
204
|
+
return function copyFiles(from, to, appDirectory, tsconfigPath) {
|
|
205
205
|
return _ref.apply(this, arguments);
|
|
206
206
|
};
|
|
207
207
|
}();
|
|
@@ -276,7 +276,7 @@ var compileByTs = function() {
|
|
|
276
276
|
source = _step.value;
|
|
277
277
|
return [
|
|
278
278
|
4,
|
|
279
|
-
copyFiles(source, distDir, tsconfigPath)
|
|
279
|
+
copyFiles(source, distDir, appDirectory, tsconfigPath)
|
|
280
280
|
];
|
|
281
281
|
case 3:
|
|
282
282
|
_state.sent();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { logger, getAliasConfig, fs } from "@modern-js/utils";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
-
import { TypescriptLoader } from "./
|
|
5
|
-
import { tsconfigPathsBeforeHookFactory } from "./
|
|
4
|
+
import { TypescriptLoader } from "./typescriptLoader";
|
|
5
|
+
import { tsconfigPathsBeforeHookFactory } from "./tsconfigPathsPlugin";
|
|
6
6
|
const readTsConfigByFile = (tsConfigFile) => {
|
|
7
7
|
const parsedCmd = ts.getParsedCommandLineOfConfigFile(
|
|
8
8
|
tsConfigFile,
|
|
@@ -12,10 +12,10 @@ const readTsConfigByFile = (tsConfigFile) => {
|
|
|
12
12
|
const { options, fileNames, projectReferences } = parsedCmd;
|
|
13
13
|
return { options, fileNames, projectReferences };
|
|
14
14
|
};
|
|
15
|
-
const copyFiles = async (from, to, tsconfigPath) => {
|
|
15
|
+
const copyFiles = async (from, to, appDirectory, tsconfigPath) => {
|
|
16
16
|
if (await fs.pathExists(from)) {
|
|
17
|
-
const
|
|
18
|
-
const targetDir = path.join(to,
|
|
17
|
+
const relativePath = path.relative(appDirectory, from);
|
|
18
|
+
const targetDir = path.join(to, relativePath);
|
|
19
19
|
await fs.copy(from, targetDir, {
|
|
20
20
|
filter: (src) => ![".ts"].includes(path.extname(src)) && src !== tsconfigPath
|
|
21
21
|
});
|
|
@@ -72,7 +72,7 @@ const compileByTs = async (appDirectory, config, compileOptions) => {
|
|
|
72
72
|
process.exit(1);
|
|
73
73
|
}
|
|
74
74
|
for (const source of sourceDirs) {
|
|
75
|
-
await copyFiles(source, distDir, tsconfigPath);
|
|
75
|
+
await copyFiles(source, distDir, appDirectory, tsconfigPath);
|
|
76
76
|
}
|
|
77
77
|
logger.info(`Ts compile succeed`);
|
|
78
78
|
};
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@modern-js/server-utils",
|
|
3
3
|
"description": "A Progressive React Framework for modern web development.",
|
|
4
4
|
"homepage": "https://modernjs.dev",
|
|
5
|
-
"bugs": "https://github.com/
|
|
6
|
-
"repository": "
|
|
5
|
+
"bugs": "https://github.com/web-infra-dev/modern.js/issues",
|
|
6
|
+
"repository": "web-infra-dev/modern.js",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.8.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.
|
|
39
|
-
"@modern-js/babel-preset-lib": "2.
|
|
40
|
-
"@modern-js/utils": "2.
|
|
38
|
+
"@modern-js/babel-compiler": "2.8.0",
|
|
39
|
+
"@modern-js/babel-preset-lib": "2.8.0",
|
|
40
|
+
"@modern-js/utils": "2.8.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/babel__core": "^7.1.15",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"jest": "^27",
|
|
47
47
|
"ts-jest": "^27.0.4",
|
|
48
48
|
"typescript": "^4",
|
|
49
|
-
"@modern-js/server-core": "2.
|
|
50
|
-
"@scripts/build": "2.
|
|
51
|
-
"@scripts/jest-config": "2.
|
|
49
|
+
"@modern-js/server-core": "2.8.0",
|
|
50
|
+
"@scripts/build": "2.8.0",
|
|
51
|
+
"@scripts/jest-config": "2.8.0"
|
|
52
52
|
},
|
|
53
53
|
"sideEffects": false,
|
|
54
54
|
"publishConfig": {
|
|
File without changes
|
|
File without changes
|
/package/dist/esm-node/compilers/typescript/{tsconfig-paths-plugin.js → tsconfigPathsPlugin.js}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/types/compilers/typescript/{tsconfig-paths-plugin.d.ts → tsconfigPathsPlugin.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|