fix(config): migrate project config and harden SmartFile and StreamFile defaults for updated toolchain compatibility

This commit is contained in:
2026-04-30 07:29:24 +00:00
parent 66c8de91ee
commit 8a9c4175dc
8 changed files with 2697 additions and 3938 deletions
+13 -10
View File
@@ -23,7 +23,7 @@ export class SmartFile extends plugins.smartjson.Smartjson {
* the relative path of the file
*/
@plugins.smartjson.foldDec()
public path: string;
public accessor path: string = '';
/**
* a parsed path
@@ -43,20 +43,20 @@ export class SmartFile extends plugins.smartjson.Smartjson {
* the content of the file as Buffer
*/
@plugins.smartjson.foldDec()
public contentBuffer: Buffer;
public accessor contentBuffer: Buffer = Buffer.alloc(0);
/**
* The current working directory of the file
* Note:this is similar to gulp and different from native node path base
*/
@plugins.smartjson.foldDec()
public base: string;
public accessor base: string = process.cwd();
/**
* sync the file with disk
*/
@plugins.smartjson.foldDec()
public sync: boolean;
public accessor sync: boolean = false;
/**
* the constructor of Smartfile
@@ -64,13 +64,16 @@ export class SmartFile extends plugins.smartjson.Smartjson {
* @param smartFs optional SmartFs instance for filesystem operations
*/
constructor(optionsArg: ISmartfileConstructorOptions, smartFs?: any) {
constructor(
optionsArg: ISmartfileConstructorOptions = {
path: '',
contentBuffer: Buffer.alloc(0),
base: process.cwd(),
},
smartFs?: any,
) {
super();
if (optionsArg.contentBuffer) {
this.contentBuffer = optionsArg.contentBuffer;
} else {
console.log('created empty Smartfile?');
}
this.contentBuffer = optionsArg.contentBuffer || Buffer.alloc(0);
this.path = optionsArg.path;
this.base = optionsArg.base;
this.smartFs = smartFs;