@vuedx/projectconfig
Advanced tools
Comparing version 0.7.2-insiders-1630604709.0 to 0.7.2-next-1646032139.0
@@ -61,3 +61,10 @@ var version = "0.7.1"; | ||
private readonly watchers; | ||
private _vueVersion; | ||
private _projectVersion; | ||
readonly runtimeFile: string; | ||
get vueVersion(): string; | ||
get projectVersion(): number; | ||
private constructor(); | ||
private onProjectFileChange; | ||
private onPackageFileChange; | ||
private loadDependencies; | ||
@@ -64,0 +71,0 @@ dispose(): void; |
@@ -86,6 +86,7 @@ 'use strict'; | ||
} | ||
else | ||
else { | ||
Object.entries(resource).forEach(([key, value]) => { | ||
add(key, shared.isString(value) ? { moduleName: resolve(value) } : value); | ||
}); | ||
} | ||
} | ||
@@ -135,35 +136,20 @@ return components; | ||
this.watchers = []; | ||
this._projectVersion = 1; | ||
this._dependencies = {}; | ||
this._config = DEFAULT_PROJECT_CONFIG; | ||
if (projectFile != null) { | ||
this.watchers.push(fs.watchFile(projectFile, (fileName, event) => { | ||
this._vueVersion = '3.2.0'; | ||
this.runtimeFile = Path__default['default'].resolve(rootDir, 'project.vuedx_project_runtime.d.ts'); | ||
this.onPackageFileChange(); | ||
this.onProjectFileChange(); | ||
if (packageFile != null) { | ||
this.watchers.push(fs.watchFile(packageFile, (_fileName, event) => { | ||
if (event === FileWatcherEventKind.Changed) { | ||
const content = fs.readFile(fileName); | ||
if (content != null) { | ||
try { | ||
this.setConfig(JSON5__default['default'].parse(content)); | ||
} | ||
catch (error) { | ||
// FIXME: Store error for diagnostics usage. | ||
} | ||
} | ||
this.onPackageFileChange(); | ||
} | ||
})); | ||
} | ||
if (packageFile != null) { | ||
this.watchers.push(fs.watchFile(packageFile, (fileName, event) => { | ||
if (projectFile != null) { | ||
this.watchers.push(fs.watchFile(projectFile, (_fileName, event) => { | ||
if (event === FileWatcherEventKind.Changed) { | ||
const content = fs.readFile(fileName); | ||
if (content != null) { | ||
try { | ||
const pkg = JSON.parse(content); | ||
this.loadDependencies({ | ||
...pkg.devDependencies, | ||
...pkg.dependencies, | ||
}); | ||
} | ||
catch (error) { | ||
// FIXME: Store error for diagnostics usage. | ||
} | ||
} | ||
this.onProjectFileChange(); | ||
} | ||
@@ -178,2 +164,44 @@ })); | ||
} | ||
get vueVersion() { | ||
return this._vueVersion; | ||
} | ||
get projectVersion() { | ||
return this._projectVersion; | ||
} | ||
onProjectFileChange() { | ||
if (this.projectFile == null) | ||
return; | ||
const content = this.fs.readFile(this.projectFile); | ||
if (content != null) { | ||
try { | ||
this.setConfig(JSON5__default['default'].parse(content)); | ||
} | ||
catch (error) { | ||
console.error(error); | ||
// FIXME: Store error for diagnostics usage. | ||
} | ||
} | ||
} | ||
onPackageFileChange() { | ||
if (this.packageFile == null) | ||
return; | ||
const content = this.fs.readFile(this.packageFile); | ||
if (content != null) { | ||
try { | ||
const pkg = JSON.parse(content); | ||
this.loadDependencies({ | ||
...pkg.devDependencies, | ||
...pkg.dependencies, | ||
}); | ||
} | ||
catch (error) { | ||
console.error(error); | ||
// FIXME: Store error for diagnostics usage. | ||
} | ||
const vueVersion = this._dependencies['vue']; | ||
if (vueVersion != null) { | ||
this._vueVersion = vueVersion; | ||
} | ||
} | ||
} | ||
loadDependencies(dependencies) { | ||
@@ -212,2 +240,3 @@ if (this.packageFile == null) | ||
} | ||
this._projectVersion += 1; | ||
} | ||
@@ -214,0 +243,0 @@ get kind() { |
{ | ||
"name": "@vuedx/projectconfig", | ||
"version": "0.7.2-insiders-1630604709.0", | ||
"version": "0.7.2-next-1646032139.0", | ||
"description": "TypeScript plugin for Vue", | ||
@@ -36,5 +36,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@vuedx/shared": "0.7.4-insiders-1630604709.0", | ||
"@vuedx/shared": "0.7.4-next-1646032139.0", | ||
"json5": "^2.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38962
643
+ Added@vuedx/shared@0.7.4-next-1646032139.0(transitive)
- Removed@vuedx/shared@0.7.4-insiders-1630604709.0(transitive)