BREAKING CHANGE(core): switch to esm
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartfile',
|
||||
version: '9.0.7',
|
||||
version: '10.0.0',
|
||||
description: 'offers smart ways to work with files in nodejs'
|
||||
}
|
||||
|
14
ts/index.ts
14
ts/index.ts
@ -1,11 +1,11 @@
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import * as fsMod from './smartfile.fs';
|
||||
import * as fsStreamMod from './smartfile.fsstream';
|
||||
import * as interpreterMod from './smartfile.interpreter';
|
||||
import * as memoryMod from './smartfile.memory';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
import * as fsMod from './smartfile.fs.js';
|
||||
import * as fsStreamMod from './smartfile.fsstream.js';
|
||||
import * as interpreterMod from './smartfile.interpreter.js';
|
||||
import * as memoryMod from './smartfile.memory.js';
|
||||
|
||||
export { Smartfile, ISmartfileConstructorOptions } from './smartfile.classes.smartfile';
|
||||
export { VirtualDirectory } from './smartfile.classes.virtualdirectory';
|
||||
export * from './smartfile.classes.smartfile.js';
|
||||
export * from './smartfile.classes.virtualdirectory.js';
|
||||
|
||||
export const fs = fsMod;
|
||||
export const fsStream = fsStreamMod;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import * as fs from './smartfile.fs';
|
||||
import * as memory from './smartfile.memory';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
import * as fs from './smartfile.fs.js';
|
||||
import * as memory from './smartfile.memory.js';
|
||||
|
||||
export interface ISmartfileConstructorOptions {
|
||||
path: string;
|
||||
@ -158,7 +158,7 @@ export class Smartfile extends plugins.smartjson.Smartjson {
|
||||
* @returns
|
||||
*/
|
||||
public async writeToDir(dirPathArg: string) {
|
||||
dirPathArg = plugins.smartpath.transform.toAbsolute(dirPathArg);
|
||||
dirPathArg = plugins.smartpath.transform.toAbsolute(dirPathArg) as string;
|
||||
const filePath = plugins.path.join(dirPathArg, this.path);
|
||||
await memory.toFs(this.contentBuffer, filePath);
|
||||
return filePath;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Smartfile } from './smartfile.classes.smartfile';
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import * as fs from './smartfile.fs';
|
||||
import { Smartfile } from './smartfile.classes.smartfile.js';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
import * as fs from './smartfile.fs.js';
|
||||
|
||||
/**
|
||||
* a virtual directory exposes a fs api
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import * as interpreter from './smartfile.interpreter';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
import * as interpreter from './smartfile.interpreter.js';
|
||||
|
||||
import { Smartfile } from './smartfile.classes.smartfile';
|
||||
import { Smartfile } from './smartfile.classes.smartfile.js';
|
||||
|
||||
import * as memory from './smartfile.memory';
|
||||
import * as memory from './smartfile.memory.js';
|
||||
/*===============================================================
|
||||
============================ Checks =============================
|
||||
===============================================================*/
|
||||
@ -231,7 +231,7 @@ export const fileTreeToObject = async (dirPathArg: string, miniMatchFilter: stri
|
||||
if (plugins.path.isAbsolute(miniMatchFilter)) {
|
||||
dirPath = '/';
|
||||
} else {
|
||||
dirPath = plugins.smartpath.transform.toAbsolute(dirPathArg);
|
||||
dirPath = plugins.smartpath.transform.toAbsolute(dirPathArg) as string;
|
||||
}
|
||||
|
||||
const fileTree = await listFileTree(dirPath, miniMatchFilter);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file contains logic for streaming things from and to the filesystem
|
||||
*/
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
|
||||
export const createReadStream = (pathArg: string) => {
|
||||
return plugins.fs.createReadStream(pathArg);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
|
||||
export let filetype = (pathArg: string): string => {
|
||||
const extName = plugins.path.extname(pathArg);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as plugins from './smartfile.plugins';
|
||||
import { Smartfile } from './smartfile.classes.smartfile';
|
||||
import * as smartfileFs from './smartfile.fs';
|
||||
import * as interpreter from './smartfile.interpreter';
|
||||
import * as plugins from './smartfile.plugins.js';
|
||||
import { Smartfile } from './smartfile.classes.smartfile.js';
|
||||
import * as smartfileFs from './smartfile.fs.js';
|
||||
import * as interpreter from './smartfile.interpreter.js';
|
||||
|
||||
/**
|
||||
* converts file to Object
|
||||
|
@ -30,7 +30,7 @@ export {
|
||||
};
|
||||
|
||||
// third party scope
|
||||
import * as fsExtra from 'fs-extra';
|
||||
import fsExtra from 'fs-extra';
|
||||
import glob from 'glob';
|
||||
import yaml from 'js-yaml';
|
||||
|
||||
|
Reference in New Issue
Block a user