@modern-js/babel-compiler 1.1.4 → 1.2.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 +15 -0
- package/dist/types/getFinalOption.d.ts +1 -1
- package/jest.config.js +8 -0
- package/modern.config.js +0 -12
- package/package.json +10 -7
- package/tests/build.test.ts +0 -2
- package/tests/buildWatch.test.ts +24 -6
- package/tests/tsconfig.json +1 -3
- package/tsconfig.json +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @modern-js/babel-compiler
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- cfe11628: Make Modern.js self bootstraping
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 146dcd85: fix test case in babel compiler
|
|
12
|
+
- 1ebc7ee2: fix: @babel/core version
|
|
13
|
+
- Updated dependencies [2da09c69]
|
|
14
|
+
- Updated dependencies [c3d46ee4]
|
|
15
|
+
- Updated dependencies [cfe11628]
|
|
16
|
+
- @modern-js/utils@1.2.0
|
|
17
|
+
|
|
3
18
|
## 1.1.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IOptions } from 'glob';
|
|
2
2
|
import { Extensions, ExtensionsFunc, ICompilerOptions, IFinaleCompilerOptions } from './type';
|
|
3
3
|
export declare const getGlobPattern: (dir: string, extensions: Extensions) => string;
|
|
4
|
-
export declare const getFinalExtensions: (extensions: Extensions | ExtensionsFunc | undefined) =>
|
|
4
|
+
export declare const getFinalExtensions: (extensions: Extensions | ExtensionsFunc | undefined) => string[];
|
|
5
5
|
export declare const getFilesFromDir: ({
|
|
6
6
|
dir,
|
|
7
7
|
finalExt,
|
package/jest.config.js
ADDED
package/modern.config.js
CHANGED
|
@@ -4,16 +4,4 @@ module.exports = {
|
|
|
4
4
|
// enableTsChecker: true,
|
|
5
5
|
disableSourceMap: true,
|
|
6
6
|
},
|
|
7
|
-
testing: {
|
|
8
|
-
jest: {
|
|
9
|
-
// Reasons for setting up testRunner:
|
|
10
|
-
// https://github.com/facebook/jest/issues/10529
|
|
11
|
-
// https://jestjs.io/blog/2020/05/05/jest-26
|
|
12
|
-
testRunner: 'jest-jasmine2',
|
|
13
|
-
testEnvironment: 'node',
|
|
14
|
-
collectCoverage: true,
|
|
15
|
-
collectCoverageFrom: ['./src/**/*.ts'],
|
|
16
|
-
coveragePathIgnorePatterns: ['/node_modules/', '/tests'],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
7
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.2.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"node": {
|
|
23
|
+
"jsnext:source": "./src/index.ts",
|
|
23
24
|
"import": "./dist/js/modern/index.js",
|
|
24
25
|
"require": "./dist/js/node/index.js"
|
|
25
26
|
},
|
|
@@ -27,9 +28,9 @@
|
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@babel/core": "
|
|
31
|
+
"@babel/core": "7.16.7",
|
|
31
32
|
"@babel/runtime": "^7",
|
|
32
|
-
"@modern-js/utils": "^1.
|
|
33
|
+
"@modern-js/utils": "^1.2.0",
|
|
33
34
|
"chokidar": "^3.5.2",
|
|
34
35
|
"glob": "^7.1.6"
|
|
35
36
|
},
|
|
@@ -42,8 +43,9 @@
|
|
|
42
43
|
"@types/node": "^14",
|
|
43
44
|
"jest-jasmine2": "^27.2.2",
|
|
44
45
|
"typescript": "^4",
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
46
|
+
"@scripts/build": "0.0.0",
|
|
47
|
+
"jest": "^27",
|
|
48
|
+
"@scripts/jest-config": "0.0.0"
|
|
47
49
|
},
|
|
48
50
|
"sideEffects": false,
|
|
49
51
|
"modernConfig": {
|
|
@@ -53,12 +55,13 @@
|
|
|
53
55
|
},
|
|
54
56
|
"publishConfig": {
|
|
55
57
|
"registry": "https://registry.npmjs.org/",
|
|
56
|
-
"access": "public"
|
|
58
|
+
"access": "public",
|
|
59
|
+
"types": "./dist/types/index.d.ts"
|
|
57
60
|
},
|
|
58
61
|
"scripts": {
|
|
59
62
|
"new": "modern new",
|
|
60
63
|
"build": "modern build",
|
|
61
|
-
"test": "
|
|
64
|
+
"test": "jest --passWithNoTests"
|
|
62
65
|
},
|
|
63
66
|
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
|
64
67
|
}
|
package/tests/build.test.ts
CHANGED
|
@@ -24,7 +24,6 @@ describe('test build', () => {
|
|
|
24
24
|
await build({ rootDir: srcDir, filenames, distDir });
|
|
25
25
|
const globFindFiles = glob.sync(`${distDir}/**/*.js`);
|
|
26
26
|
expect(globFindFiles.length).toBe(1);
|
|
27
|
-
fs.removeSync(distDir);
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
it('build with enableVirtualDist and success', async () => {
|
|
@@ -80,7 +79,6 @@ describe('test build', () => {
|
|
|
80
79
|
});
|
|
81
80
|
const globFindFiles = glob.sync(`${distDir}/**/*.js`);
|
|
82
81
|
expect(globFindFiles.length).toBe(1);
|
|
83
|
-
fs.removeSync(distDir);
|
|
84
82
|
});
|
|
85
83
|
|
|
86
84
|
it('build multiple files and success', async () => {
|
package/tests/buildWatch.test.ts
CHANGED
|
@@ -39,7 +39,9 @@ describe('test build watch', () => {
|
|
|
39
39
|
expect(ret).toBe(null);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it('runBuildWatch and success', async
|
|
42
|
+
it('runBuildWatch and success', async () => {
|
|
43
|
+
let done: any;
|
|
44
|
+
const promise = new Promise(resolve => (done = resolve));
|
|
43
45
|
let compiling = false;
|
|
44
46
|
const emitter = new BuildWatchEmitter();
|
|
45
47
|
emitter.on(BuildWatchEvent.firstCompiler, (result: ICompilerResult) => {
|
|
@@ -65,9 +67,12 @@ describe('test build watch', () => {
|
|
|
65
67
|
fs.ensureFileSync(path.join(srcDir, 'far.js'));
|
|
66
68
|
compiling = true;
|
|
67
69
|
});
|
|
70
|
+
return promise;
|
|
68
71
|
});
|
|
69
72
|
|
|
70
|
-
it('runBuildWatch and fail', async
|
|
73
|
+
it('runBuildWatch and fail', async () => {
|
|
74
|
+
let done: any;
|
|
75
|
+
const promise = new Promise(resolve => (done = resolve));
|
|
71
76
|
const emitter = new BuildWatchEmitter();
|
|
72
77
|
emitter.on(BuildWatchEvent.firstCompiler, (result: ICompilerResult) => {
|
|
73
78
|
expect(result.code).toBe(1);
|
|
@@ -89,9 +94,12 @@ describe('test build watch', () => {
|
|
|
89
94
|
fs.ensureFileSync(path.join(srcDir, 'error1.js'));
|
|
90
95
|
fs.writeFileSync(path.join(srcDir, 'error1.js'), 'conta a = 1');
|
|
91
96
|
});
|
|
97
|
+
return promise;
|
|
92
98
|
});
|
|
93
99
|
|
|
94
|
-
it('buildWatch and success', async
|
|
100
|
+
it('buildWatch and success', async () => {
|
|
101
|
+
let done: any;
|
|
102
|
+
const promise = new Promise(resolve => (done = resolve));
|
|
95
103
|
const emitter = buildWatch({
|
|
96
104
|
rootDir: srcDir,
|
|
97
105
|
watchDir: srcDir,
|
|
@@ -125,9 +133,12 @@ describe('test build watch', () => {
|
|
|
125
133
|
compiling = true;
|
|
126
134
|
});
|
|
127
135
|
}
|
|
136
|
+
return promise;
|
|
128
137
|
});
|
|
129
138
|
|
|
130
|
-
it('buildWatch and fail', async
|
|
139
|
+
it('buildWatch and fail', async () => {
|
|
140
|
+
let done: any;
|
|
141
|
+
const promise = new Promise(resolve => (done = resolve));
|
|
131
142
|
const emitter = buildWatch({
|
|
132
143
|
rootDir: srcDir,
|
|
133
144
|
watchDir: srcDir,
|
|
@@ -161,9 +172,12 @@ describe('test build watch', () => {
|
|
|
161
172
|
compiling = true;
|
|
162
173
|
});
|
|
163
174
|
}
|
|
175
|
+
return promise;
|
|
164
176
|
});
|
|
165
177
|
|
|
166
|
-
it('buildWatch and remove file', async
|
|
178
|
+
it('buildWatch and remove file', async () => {
|
|
179
|
+
let done: any;
|
|
180
|
+
const promise = new Promise(resolve => (done = resolve));
|
|
167
181
|
const emitter = buildWatch({
|
|
168
182
|
rootDir: srcDir,
|
|
169
183
|
watchDir: srcDir,
|
|
@@ -190,9 +204,12 @@ describe('test build watch', () => {
|
|
|
190
204
|
fs.removeSync(path.join(srcDir, 'far.js'));
|
|
191
205
|
});
|
|
192
206
|
}
|
|
207
|
+
return promise;
|
|
193
208
|
});
|
|
194
209
|
|
|
195
|
-
it('buildWatch and reRight file', async
|
|
210
|
+
it('buildWatch and reRight file', async () => {
|
|
211
|
+
let done: any;
|
|
212
|
+
const promise = new Promise(resolve => (done = resolve));
|
|
196
213
|
fs.ensureFileSync(path.join(srcDir, 'error1.js'));
|
|
197
214
|
fs.writeFileSync(path.join(srcDir, 'error1.js'), 'cast a = 1;');
|
|
198
215
|
const emitter = buildWatch({
|
|
@@ -221,6 +238,7 @@ describe('test build watch', () => {
|
|
|
221
238
|
fs.writeFileSync(path.join(srcDir, 'error1.js'), 'const a = 1;');
|
|
222
239
|
});
|
|
223
240
|
}
|
|
241
|
+
return promise;
|
|
224
242
|
});
|
|
225
243
|
|
|
226
244
|
afterEach(() => {
|
package/tests/tsconfig.json
CHANGED