Skip to content

Commit 2201fc7

Browse files
committed
fix:minor issues
1 parent c659f42 commit 2201fc7

File tree

9 files changed

+14
-21
lines changed

9 files changed

+14
-21
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"root": true,
33
"extends": ["zmi/typescript"],
44
"rules": {
5-
"no-restricted-syntax": "off"
5+
"no-restricted-syntax": "off",
6+
"global-require": "off",
7+
"import/no-dynamic-require": "off"
68
}
79
}

lib/Build.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
205205

206206
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; }
207207

208-
const vinylSourcemapsApply = require('vinyl-sourcemaps-apply');
209-
210208
const modeType = {
211209
cjs: 'Commonjs',
212210
esm: 'ES Modules'
@@ -375,7 +373,8 @@ class Build {
375373
}
376374

377375
res.map.file = replaceExtname(chunk.relative);
378-
vinylSourcemapsApply(chunk, res.map);
376+
377+
require('vinyl-sourcemaps-apply')(chunk, res.map);
379378
}
380379

381380
chunk.contents = Buffer.from(res.code);

lib/config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ function _default(cwd) {
4040

4141
const isTest = process.env.NODE_ENV !== 'test';
4242
const configFile = CONFIG_FILES.map(configName => _path().default.join(cwd, configName));
43-
const userConfig = (_configFile$find = configFile.find(configCwd => {
44-
return _fs().default.existsSync(configCwd);
45-
})) !== null && _configFile$find !== void 0 ? _configFile$find : '';
43+
const userConfig = (_configFile$find = configFile.find(configCwd => _fs().default.existsSync(configCwd))) !== null && _configFile$find !== void 0 ? _configFile$find : '';
4644
let config = {};
4745

4846
if (userConfig) {

lib/test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ function _ref() {
7474
process.env.NODE_ENV = 'test';
7575
const cwd = (_args$cwd = args.cwd) !== null && _args$cwd !== void 0 ? _args$cwd : process.cwd();
7676
const userJestConfigFiles = jestConfig.map(configName => _path().default.join(cwd, configName));
77-
const userJestConfig = userJestConfigFiles.find(configCwd => {
78-
return _fs().default.existsSync(configCwd);
79-
});
77+
const userJestConfig = userJestConfigFiles.find(configCwd => _fs().default.existsSync(configCwd));
8078

8179
if (userJestConfig) {
8280
(0, _utils.registerBabel)(userJestConfig);

lib/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export declare type AnyConfig<T extends Record<string, any>, U extends Record<st
5959
export declare type CalculatedConfig<T extends Record<string, any>, U extends Record<string, any>> = T & {
6060
[V in keyof U]: V extends keyof T ? T[V] : U[V];
6161
};
62-
export declare type handleConfig<T> = T extends object ? {
62+
export declare type handleConfig<T> = T extends Record<string, any> ? {
6363
[key in keyof T]: T[key] | ((value: T[key]) => T[key]);
6464
} : T;
6565
export declare type jestConfig = handleConfig<Config.InitialOptions>;

src/Build.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import getTSConfig from './getTsConifg'
2525
import replaceAll from './replaceAll'
2626
import config from './config'
2727

28-
const vinylSourcemapsApply = require('vinyl-sourcemaps-apply')
29-
3028
interface IBuild {
3129
cwd?: string
3230
watch?: boolean
@@ -238,7 +236,7 @@ export default class Build {
238236
}
239237

240238
res.map.file = replaceExtname(chunk.relative)
241-
vinylSourcemapsApply(chunk, res.map)
239+
require('vinyl-sourcemaps-apply')(chunk, res.map)
242240
}
243241

244242
chunk.contents = Buffer.from(res.code)

src/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ export default function (cwd: string): IBundleOptions {
1515
)
1616

1717
const userConfig =
18-
configFile.find((configCwd) => {
19-
return fs.existsSync(configCwd)
20-
}) ?? ''
18+
configFile.find((configCwd) => fs.existsSync(configCwd)) ?? ''
2119

2220
let config = {}
2321

src/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export default async function (args: yargsParser.Arguments) {
1717
path.join(cwd, configName)
1818
)
1919

20-
const userJestConfig = userJestConfigFiles.find((configCwd) => {
21-
return fs.existsSync(configCwd)
22-
})
20+
const userJestConfig = userJestConfigFiles.find((configCwd) =>
21+
fs.existsSync(configCwd)
22+
)
2323

2424
if (userJestConfig) {
2525
registerBabel(userJestConfig)

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export type CalculatedConfig<
8080
[V in keyof U]: V extends keyof T ? T[V] : U[V]
8181
}
8282

83-
export type handleConfig<T> = T extends object
83+
export type handleConfig<T> = T extends Record<string, any>
8484
? { [key in keyof T]: T[key] | ((value: T[key]) => T[key]) }
8585
: T
8686

0 commit comments

Comments
 (0)