Move package to TS 2.0.x
This commit is contained in:
Родитель
6ddfbb3472
Коммит
b5c8c41a01
|
@ -0,0 +1,4 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
||||
}
|
|
@ -6,5 +6,8 @@ language servers written in TS and JS.
|
|||
[![NPM Version](https://img.shields.io/npm/v/vscode-nls-dev.svg)](https://npmjs.org/package/vscode-nls-dev)
|
||||
[![NPM Downloads](https://img.shields.io/npm/dm/vscode-nls-dev.svg)](https://npmjs.org/package/vscode-nls-dev)
|
||||
|
||||
* 2.0.0: based on TypeScritp 2.0. Since TS changed the shape of the d.ts files for 2.0.x a major version number got introduce to not
|
||||
break existing clients using TypeScript 1.8.x.
|
||||
|
||||
## LICENSE
|
||||
[MIT](LICENSE)
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "vscode-nls-dev",
|
||||
"version": "1.1.0",
|
||||
"version": "2.0.0-beta.1",
|
||||
"description": "Development time npm module to generate strings bundles from Javascript files",
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
|
@ -25,7 +25,7 @@
|
|||
"glob": "^6.0.4",
|
||||
"gulp-util": "^3.0.7",
|
||||
"source-map": "^0.5.3",
|
||||
"typescript": "^1.7.5",
|
||||
"typescript": "^2.0.2",
|
||||
"vinyl": "^1.1.1",
|
||||
"yargs": "^3.32.0"
|
||||
},
|
||||
|
|
|
@ -479,7 +479,7 @@ function analyze(contents: string, options: ts.CompilerOptions = {}): AnalysisRe
|
|||
const filename = 'file.js';
|
||||
const serviceHost = new SingleFileServiceHost(options, filename, contents);
|
||||
const service = ts.createLanguageService(serviceHost);
|
||||
const sourceFile = service.getSourceFile(filename);
|
||||
const sourceFile = service.getProgram().getSourceFile(filename);
|
||||
|
||||
const patches: Patch[] = [];
|
||||
const errors: string[] = [];
|
||||
|
|
|
@ -31,7 +31,8 @@ export function rewriteLocalizeCalls(): ThroughStream {
|
|||
if (!file.isBuffer()) {
|
||||
this.emit('error', `Failed to read file: ${file.relative}`);
|
||||
}
|
||||
let content = file.contents.toString('utf8');
|
||||
let buffer: Buffer = file.contents as Buffer;
|
||||
let content = buffer.toString('utf8');
|
||||
let sourceMap = file.sourceMap;
|
||||
|
||||
let result = processFile(content, sourceMap);
|
||||
|
@ -96,7 +97,8 @@ export function createAdditionalLanguageFiles(languages: string[], i18nBaseDir:
|
|||
let filename = file.relative.substr(0, file.relative.length - NLS_JSON.length);
|
||||
let json;
|
||||
if (file.isBuffer()) {
|
||||
json = JSON.parse(file.contents.toString('utf8'));
|
||||
let buffer: Buffer = file.contents as Buffer;
|
||||
json = JSON.parse(buffer.toString('utf8'));
|
||||
let resolvedBundle = resolveMessageBundle(json);
|
||||
languages.forEach((language) => {
|
||||
let result = createLocalizedMessages(filename, resolvedBundle, language, i18nBaseDir, baseDir);
|
||||
|
@ -135,7 +137,8 @@ export function createKeyValuePairFile(commentSeparator: string = undefined): Th
|
|||
let kvpFile;
|
||||
let filename = file.relative.substr(0, file.relative.length - NLS_JSON.length);
|
||||
if (file.isBuffer()) {
|
||||
json = JSON.parse(file.contents.toString('utf8'));
|
||||
let buffer: Buffer = file.contents as Buffer;
|
||||
json = JSON.parse(buffer.toString('utf8'));
|
||||
if (JavaScriptMessageBundle.is(json)) {
|
||||
let resolvedBundle = json as JavaScriptMessageBundle;
|
||||
if (resolvedBundle.messages.length !== resolvedBundle.keys.length) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче