保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 26fa49f4b0aa658d65a21fffe828f39e78302573
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const semver = __importStar(require("semver"));
const fs_extra_1 = __importDefault(require("fs-extra"));
const os_1 = __importDefault(require("os"));
const TypeScriptVueExtensionSupport_1 = require("./extension/vue/TypeScriptVueExtensionSupport");
function assertTypeScriptSupport(configuration) {
    let typescriptVersion;
    try {
        typescriptVersion = require(configuration.typescriptPath).version;
    }
    catch (error) { }
    if (!typescriptVersion) {
        throw new Error('When you use ForkTsCheckerWebpackPlugin with typescript reporter enabled, you must install `typescript` package.');
    }
    if (semver.lt(typescriptVersion, '2.7.0')) {
        throw new Error([
            `ForkTsCheckerWebpackPlugin cannot use the current typescript version of ${typescriptVersion}.`,
            'The minimum required version is 2.7.0.',
        ].join(os_1.default.EOL));
    }
    if (configuration.build && semver.lt(typescriptVersion, '3.6.0')) {
        throw new Error([
            `ForkTsCheckerWebpackPlugin cannot use the current typescript version of ${typescriptVersion} because of the "build" option enabled.`,
            'The minimum version that supports "build" option is 3.6.0.',
            'Consider upgrading `typescript` or disabling "build" option.',
        ].join(os_1.default.EOL));
    }
    if (!fs_extra_1.default.existsSync(configuration.configFile)) {
        throw new Error([
            `Cannot find the "${configuration.configFile}" file.`,
            `Please check webpack and ForkTsCheckerWebpackPlugin configuration.`,
            `Possible errors:`,
            '  - wrong `context` directory in webpack configuration (if `configFile` is not set or is a relative path in the fork plugin configuration)',
            '  - wrong `typescript.configFile` path in the plugin configuration (should be a relative or absolute path)',
        ].join(os_1.default.EOL));
    }
    if (configuration.extensions.vue.enabled) {
        TypeScriptVueExtensionSupport_1.assertTypeScriptVueExtensionSupport(configuration.extensions.vue);
    }
}
exports.assertTypeScriptSupport = assertTypeScriptSupport;