Skip to content

Commit

Permalink
chore: remove __snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Oct 23, 2023
1 parent 7c7f374 commit 03cf10f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/vue-language-core/src/virtualFile/vueFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,30 @@ import { computedFiles } from './computedFiles';
import { computedMappings } from './computedMappings';
import { computedSfc } from './computedSfc';
import { computedVueSfc } from './computedVueSfc';
import { Signal, computed, signal } from 'computeds';
import { Signal, signal } from 'computeds';

const jsxReg = /^\.(js|ts)x?$/;

export class VueFile implements VirtualFile {

// sources

__snapshot: Signal<ts.IScriptSnapshot>;
_snapshot: Signal<ts.IScriptSnapshot>;

// computeds

_snapshot = computed(() => this.__snapshot());
vueSfc = computedVueSfc(this.plugins, this.fileName, this._snapshot);
sfc = computedSfc(this.ts, this.plugins, this.fileName, this._snapshot, this.vueSfc);
_mappings = computedMappings(this._snapshot, this.sfc);
_embeddedFiles = computedFiles(this.plugins, this.fileName, this.sfc, this.codegenStack);
getVueSfc = computedVueSfc(this.plugins, this.fileName, () => this._snapshot());
sfc = computedSfc(this.ts, this.plugins, this.fileName, () => this._snapshot(), this.getVueSfc);
getMappings = computedMappings(() => this._snapshot(), this.sfc);
getMmbeddedFiles = computedFiles(this.plugins, this.fileName, this.sfc, this.codegenStack);

// others

capabilities = FileCapabilities.full;
kind = FileKind.TextFile;
codegenStacks: Stack[] = [];
get embeddedFiles() {
return this._embeddedFiles();
return this.getMmbeddedFiles();
}
get mainScriptName() {
let res: string = '';
Expand All @@ -45,7 +44,7 @@ export class VueFile implements VirtualFile {
return this._snapshot();
}
get mappings() {
return this._mappings();
return this.getMappings();
}

constructor(
Expand All @@ -56,10 +55,10 @@ export class VueFile implements VirtualFile {
public ts: typeof import('typescript/lib/tsserverlibrary'),
public codegenStack: boolean,
) {
this.__snapshot = signal(initSnapshot);
this._snapshot = signal(initSnapshot);
}

update(newSnapshot: ts.IScriptSnapshot) {
this.__snapshot.set(newSnapshot);
this._snapshot.set(newSnapshot);
}
}

0 comments on commit 03cf10f

Please sign in to comment.