typescript-strict-plugin
Advanced tools
Comparing version 2.2.2-beta.2 to 2.2.2-beta.4
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const InMemoryProgram_1 = require("./InMemoryProgram"); | ||
const PluginStrictFileChecker_1 = require("./PluginStrictFileChecker"); | ||
const utils_1 = require("./utils"); | ||
const init = (mod) => { | ||
const ts = mod.typescript; | ||
const init = ({ typescript }) => { | ||
function create(info) { | ||
const inMemoryProgram = new InMemoryProgram_1.InMemoryProgram(ts, info); | ||
const proxy = (0, utils_1.setupProxy)(info); | ||
const proxy = (0, utils_1.setupLanguageServiceProxy)(info); | ||
const strictLanguageServiceHost = (0, utils_1.setupStrictLanguageServiceHostProxy)(info); | ||
const strictLanguageService = typescript.createLanguageService(strictLanguageServiceHost); | ||
(0, utils_1.log)(info, 'Plugin initialized'); | ||
@@ -15,3 +14,3 @@ proxy.getSemanticDiagnostics = function (filePath) { | ||
if (strictFile) { | ||
return inMemoryProgram.getSemanticDiagnostics(filePath); | ||
return strictLanguageService.getSemanticDiagnostics(filePath); | ||
} | ||
@@ -22,2 +21,10 @@ else { | ||
}; | ||
proxy.cleanupSemanticCache = function () { | ||
strictLanguageService.cleanupSemanticCache(); | ||
info.languageService.cleanupSemanticCache(); | ||
}; | ||
proxy.dispose = function () { | ||
strictLanguageService.dispose(); | ||
info.languageService.dispose(); | ||
}; | ||
return proxy; | ||
@@ -24,0 +31,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.log = exports.setupProxy = exports.turnOffStrictMode = exports.turnOnStrictMode = void 0; | ||
exports.log = exports.setupStrictLanguageServiceHostProxy = exports.setupLanguageServiceProxy = void 0; | ||
const constants_1 = require("../common/constants"); | ||
function turnOnStrictMode(info) { | ||
info.project['compilerOptions'].strict = true; | ||
} | ||
exports.turnOnStrictMode = turnOnStrictMode; | ||
function turnOffStrictMode(info) { | ||
info.project['compilerOptions'].strict = false; | ||
} | ||
exports.turnOffStrictMode = turnOffStrictMode; | ||
function setupProxy(info) { | ||
function setupLanguageServiceProxy(info) { | ||
const proxy = Object.create(null); | ||
@@ -22,3 +14,20 @@ for (const k of Object.keys(info.languageService)) { | ||
} | ||
exports.setupProxy = setupProxy; | ||
exports.setupLanguageServiceProxy = setupLanguageServiceProxy; | ||
function setupStrictLanguageServiceHostProxy(info) { | ||
const host = info.languageServiceHost; | ||
const strictGetCompilationSettings = () => { | ||
const settings = info.languageServiceHost.getCompilationSettings(); | ||
return { ...settings, strict: true }; | ||
}; | ||
const proxy = new Proxy(host, { | ||
get(target, prop, receiver) { | ||
if (prop === 'getCompilationSettings') { | ||
return strictGetCompilationSettings; | ||
} | ||
return Reflect.get(target, prop, receiver); | ||
}, | ||
}); | ||
return proxy; | ||
} | ||
exports.setupStrictLanguageServiceHostProxy = setupStrictLanguageServiceHostProxy; | ||
function log(info, message) { | ||
@@ -25,0 +34,0 @@ info.project.projectService.logger.info(`[${constants_1.PLUGIN_NAME}]: ` + message); |
{ | ||
"name": "typescript-strict-plugin", | ||
"version": "2.2.2-beta.2", | ||
"version": "2.2.2-beta.4", | ||
"description": "Typescript tools that help with migration to the strict mode", | ||
@@ -5,0 +5,0 @@ "author": "Allegro", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58786
36
1162