1 | "use strict";
|
2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3 | if (k2 === undefined) k2 = k;
|
4 | var desc = Object.getOwnPropertyDescriptor(m, k);
|
5 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6 | desc = { enumerable: true, get: function() { return m[k]; } };
|
7 | }
|
8 | Object.defineProperty(o, k2, desc);
|
9 | }) : (function(o, m, k, k2) {
|
10 | if (k2 === undefined) k2 = k;
|
11 | o[k2] = m[k];
|
12 | }));
|
13 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15 | }) : function(o, v) {
|
16 | o["default"] = v;
|
17 | });
|
18 | var __importStar = (this && this.__importStar) || function (mod) {
|
19 | if (mod && mod.__esModule) return mod;
|
20 | var result = {};
|
21 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22 | __setModuleDefault(result, mod);
|
23 | return result;
|
24 | };
|
25 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
26 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
27 | };
|
28 | Object.defineProperty(exports, "__esModule", { value: true });
|
29 | exports.defOptions = void 0;
|
30 |
|
31 | const typescript_1 = __importStar(require("typescript"));
|
32 | const path_1 = __importDefault(require("path"));
|
33 | const os_1 = __importDefault(require("os"));
|
34 | const versionContainer_1 = require("./versionContainer");
|
35 | function defineTarget() {
|
36 | if (versionContainer_1.nodeJsVer.major >= 10) {
|
37 | return typescript_1.default.ScriptTarget.ES2017;
|
38 | }
|
39 | if (versionContainer_1.nodeJsVer.major >= 6) {
|
40 | return typescript_1.default.ScriptTarget.ES5;
|
41 | }
|
42 | return typescript_1.default.ScriptTarget.ES3;
|
43 | }
|
44 | const outDir = path_1.default.join(os_1.default.tmpdir(), "webpack-mock-server", new Date().getTime().toString());
|
45 | class MockServerOptions {
|
46 | constructor() {
|
47 |
|
48 | this.verbose = false;
|
49 |
|
50 | this.port = 8079;
|
51 |
|
52 | this.logRequests = false;
|
53 |
|
54 | this.logResponses = false;
|
55 |
|
56 | this.compilerOptions = {
|
57 | strictNullChecks: false,
|
58 | noImplicitAny: false,
|
59 | noUnusedLocals: false,
|
60 | noUnusedParameters: false,
|
61 | skipLibCheck: true,
|
62 | resolveJsonModule: true,
|
63 |
|
64 | };
|
65 |
|
66 | this.tsConfigFileName = "tsconfig.json";
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 | this.entry = ["webpack.mock.ts"];
|
73 | }
|
74 |
|
75 | get strictCompilerOptions() {
|
76 | return {
|
77 | outDir,
|
78 | rootDir: process.cwd(),
|
79 | noEmit: false,
|
80 | noEmitHelpers: false,
|
81 | esModuleInterop: true,
|
82 | module: typescript_1.default.ModuleKind.CommonJS,
|
83 | declaration: false,
|
84 | moduelResolution: typescript_1.ModuleResolutionKind.NodeJs,
|
85 | target: defineTarget(),
|
86 | };
|
87 | }
|
88 | }
|
89 | exports.default = MockServerOptions;
|
90 | exports.defOptions = new MockServerOptions();
|