@edgeros/fs 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_require.d.ts +1 -0
- package/_require.js +26 -0
- package/fs.d.ts +24 -0
- package/fs.js +28 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/package.json +1 -1
- package/Makefile +0 -22
- package/eslint.config.js +0 -45
- package/src/_require.ts +0 -21
- package/src/fs.ts +0 -40
- package/src/index.ts +0 -1
- package/src/jsre/fs.js +0 -44
- package/src/node/fs.ts +0 -20
- package/tsconfig.json +0 -19
package/_require.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export default function <T = any>(moduleName: string): T;
|
package/_require.js
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
4
|
+
// eslint-disable @typescript-eslint/no-unnecessary-type-parameters -- ignore
|
5
|
+
const isJSRE = () => {
|
6
|
+
try {
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
|
8
|
+
require('iosched');
|
9
|
+
}
|
10
|
+
catch (e) {
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
return true;
|
14
|
+
};
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- ignore
|
16
|
+
function default_1(moduleName) {
|
17
|
+
if (isJSRE()) {
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- require is needed for dynamic imports
|
19
|
+
return require(`./jsre/${moduleName}`);
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-member-access -- require is needed for dynamic imports and accessing default export
|
23
|
+
return require(`./node/${moduleName}`).default;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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AgICByZXR1cm4gZmFsc2VcclxuICB9XHJcblxyXG4gIHJldHVybiB0cnVlXHJcbn1cclxuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bm5lY2Vzc2FyeS10eXBlLXBhcmFtZXRlcnMgIC0tIGlnbm9yZVxyXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbjxUID0gYW55PiAobW9kdWxlTmFtZTogc3RyaW5nKTogVCB7XHJcbiAgaWYgKGlzSlNSRSgpKSB7XHJcbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXJlcXVpcmUtaW1wb3J0cyAtLSByZXF1aXJlIGlzIG5lZWRlZCBmb3IgZHluYW1pYyBpbXBvcnRzXHJcbiAgICByZXR1cm4gcmVxdWlyZShgLi9qc3JlLyR7bW9kdWxlTmFtZX1gKVxyXG4gIH0gZWxzZSB7XHJcbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXJlcXVpcmUtaW1wb3J0cywgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1tZW1iZXItYWNjZXNzIC0tIHJlcXVpcmUgaXMgbmVlZGVkIGZvciBkeW5hbWljIGltcG9ydHMgYW5kIGFjY2Vzc2luZyBkZWZhdWx0IGV4cG9ydFxyXG4gICAgcmV0dXJuIHJlcXVpcmUoYC4vbm9kZS8ke21vZHVsZU5hbWV9YCkuZGVmYXVsdFxyXG4gIH1cclxufVxyXG4iXX0=
|
package/fs.d.ts
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { PathLike, WriteStream, Stats } from 'fs';
|
2
|
+
declare const _default: IFs;
|
3
|
+
export default _default;
|
4
|
+
export type { WriteStream } from 'fs';
|
5
|
+
export interface IFs {
|
6
|
+
WriteStream: WriteStream;
|
7
|
+
createWriteStream: (path: PathLike, options?: StreamOptions) => WriteStream;
|
8
|
+
stat: (path: PathLike) => Promise<Stats>;
|
9
|
+
rename: (oldPath: PathLike, newPath: PathLike) => Promise<void>;
|
10
|
+
mkdir: (path: PathLike, options?: any) => Promise<void>;
|
11
|
+
mkdirSync: (path: PathLike, options: any) => void;
|
12
|
+
}
|
13
|
+
export declare function createWriteStream(path: PathLike, options?: StreamOptions): WriteStream;
|
14
|
+
export declare function stat(path: PathLike): Promise<Stats>;
|
15
|
+
export declare function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
16
|
+
export declare function mkdir(path: PathLike, options?: any): Promise<void>;
|
17
|
+
export declare function mkdirSync(path: PathLike, options: any): void;
|
18
|
+
interface StreamOptions {
|
19
|
+
flags?: string | undefined;
|
20
|
+
mode?: string | undefined;
|
21
|
+
start?: number | undefined;
|
22
|
+
autoClose?: boolean | undefined;
|
23
|
+
emitClose?: boolean | undefined;
|
24
|
+
}
|
package/fs.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.createWriteStream = createWriteStream;
|
7
|
+
exports.stat = stat;
|
8
|
+
exports.rename = rename;
|
9
|
+
exports.mkdir = mkdir;
|
10
|
+
exports.mkdirSync = mkdirSync;
|
11
|
+
const _require_1 = __importDefault(require("./_require"));
|
12
|
+
exports.default = (0, _require_1.default)('fs');
|
13
|
+
function createWriteStream(path, options) {
|
14
|
+
return (0, _require_1.default)('fs').createWriteStream(path, options);
|
15
|
+
}
|
16
|
+
async function stat(path) {
|
17
|
+
return await (0, _require_1.default)('fs').stat(path);
|
18
|
+
}
|
19
|
+
async function rename(oldPath, newPath) {
|
20
|
+
await (0, _require_1.default)('fs').rename(oldPath, newPath);
|
21
|
+
}
|
22
|
+
async function mkdir(path, options) {
|
23
|
+
await (0, _require_1.default)('fs').mkdir(path, options);
|
24
|
+
}
|
25
|
+
function mkdirSync(path, options) {
|
26
|
+
(0, _require_1.default)('fs').mkdirSync(path, options);
|
27
|
+
}
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFhQSw4Q0FFQztBQUVELG9CQUVDO0FBRUQsd0JBRUM7QUFFRCxzQkFFQztBQUVELDhCQUVDO0FBL0JELDBEQUFpQztBQUVqQyxrQkFBZSxJQUFBLGtCQUFRLEVBQU0sSUFBSSxDQUFDLENBQUE7QUFXbEMsU0FBZ0IsaUJBQWlCLENBQUMsSUFBYyxFQUFFLE9BQXVCO0lBQ3ZFLE9BQU8sSUFBQSxrQkFBUSxFQUFNLElBQUksQ0FBQyxDQUFDLGlCQUFpQixDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQTtBQUM3RCxDQUFDO0FBRU0sS0FBSyxVQUFVLElBQUksQ0FBQyxJQUFjO0lBQ3ZDLE9BQU8sTUFBTSxJQUFBLGtCQUFRLEVBQU0sSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO0FBQzdDLENBQUM7QUFFTSxLQUFLLFVBQVUsTUFBTSxDQUFDLE9BQWlCLEVBQUUsT0FBaUI7SUFDL0QsTUFBTSxJQUFBLGtCQUFRLEVBQU0sSUFBSSxDQUFDLENBQUMsTUFBTSxDQUFDLE9BQU8sRUFBRSxPQUFPLENBQUMsQ0FBQTtBQUNwRCxDQUFDO0FBRU0sS0FBSyxVQUFVLEtBQUssQ0FBQyxJQUFjLEVBQUUsT0FBYTtJQUN2RCxNQUFNLElBQUEsa0JBQVEsRUFBTSxJQUFJLENBQUMsQ0FBQyxLQUFLLENBQUMsSUFBSSxFQUFFLE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W5lZFxyXG59XHJcbiJdfQ==
|
package/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './fs';
|
package/index.js
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./fs"), exports);
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHVDQUFvQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vZnMnXHJcbiJdfQ==
|
package/package.json
CHANGED
package/Makefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
.PHONY: compile install clean publish ts-clean
|
2
|
-
|
3
|
-
TS_OUTDIR= ./dist
|
4
|
-
|
5
|
-
install:
|
6
|
-
npm i
|
7
|
-
|
8
|
-
ts-clean:
|
9
|
-
rm -rf $(TS_OUTDIR)
|
10
|
-
|
11
|
-
compile: ts-clean
|
12
|
-
tsc
|
13
|
-
|
14
|
-
clean:
|
15
|
-
rm -rf ./dist
|
16
|
-
rm -rf ./node_modules
|
17
|
-
|
18
|
-
publish: compile
|
19
|
-
cp .npmrc $(TS_OUTDIR)/
|
20
|
-
cp package.json $(TS_OUTDIR)/
|
21
|
-
cp README.md $(TS_OUTDIR)/
|
22
|
-
cd $(TS_OUTDIR) && npm publish
|
package/eslint.config.js
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
const { parse } = require('@typescript-eslint/parser')
|
2
|
-
const stylistic = require('@stylistic/eslint-plugin')
|
3
|
-
|
4
|
-
const files = [
|
5
|
-
'src/**/*.ts',
|
6
|
-
'src/**/*.js',
|
7
|
-
]
|
8
|
-
|
9
|
-
module.exports = (async () => {
|
10
|
-
const { default: love} = await import('eslint-config-love')
|
11
|
-
|
12
|
-
return [
|
13
|
-
{
|
14
|
-
ignores: [
|
15
|
-
'coverage/**',
|
16
|
-
'src/deps/jsre/**',
|
17
|
-
],
|
18
|
-
},
|
19
|
-
{
|
20
|
-
files,
|
21
|
-
languageOptions: {
|
22
|
-
parser: parse,
|
23
|
-
},
|
24
|
-
...love,
|
25
|
-
}, {
|
26
|
-
files,
|
27
|
-
...stylistic.configs.customize({
|
28
|
-
braceStyle: '1tbs'
|
29
|
-
}),
|
30
|
-
}, {
|
31
|
-
rules: {
|
32
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
33
|
-
'@typescript-eslint/no-magic-numbers': 'off',
|
34
|
-
'@typescript-eslint/no-invalid-void-type': 'off',
|
35
|
-
'@typescript-eslint/no-unsafe-type-assertion': 'off',
|
36
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
37
|
-
'@typescript-eslint/strict-boolean-expressions': 'off',
|
38
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
39
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
40
|
-
'@typescript-eslint/prefer-destructuring': 'off',
|
41
|
-
'promise/avoid-new': 'off',
|
42
|
-
},
|
43
|
-
},
|
44
|
-
]
|
45
|
-
})()
|
package/src/_require.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
// eslint-disable @typescript-eslint/no-unnecessary-type-parameters -- ignore
|
2
|
-
const isJSRE = () => {
|
3
|
-
try {
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
|
5
|
-
require('iosched')
|
6
|
-
} catch (e) {
|
7
|
-
return false
|
8
|
-
}
|
9
|
-
|
10
|
-
return true
|
11
|
-
}
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- ignore
|
13
|
-
export default function<T = any> (moduleName: string): T {
|
14
|
-
if (isJSRE()) {
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports -- require is needed for dynamic imports
|
16
|
-
return require(`./jsre/${moduleName}`)
|
17
|
-
} else {
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-member-access -- require is needed for dynamic imports and accessing default export
|
19
|
-
return require(`./node/${moduleName}`).default
|
20
|
-
}
|
21
|
-
}
|
package/src/fs.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
import _require from './_require'
|
2
|
-
import type { PathLike, WriteStream, Stats } from 'fs'
|
3
|
-
export default _require<IFs>('fs')
|
4
|
-
export type { WriteStream } from 'fs'
|
5
|
-
export interface IFs {
|
6
|
-
WriteStream: WriteStream
|
7
|
-
createWriteStream: (path: PathLike, options?: StreamOptions) => WriteStream
|
8
|
-
stat: (path: PathLike) => Promise<Stats>
|
9
|
-
rename: (oldPath: PathLike, newPath: PathLike) => Promise<void>
|
10
|
-
mkdir: (path: PathLike, options?: any) => Promise<void>
|
11
|
-
mkdirSync: (path: PathLike, options: any) => void
|
12
|
-
}
|
13
|
-
|
14
|
-
export function createWriteStream(path: PathLike, options?: StreamOptions): WriteStream {
|
15
|
-
return _require<IFs>('fs').createWriteStream(path, options)
|
16
|
-
}
|
17
|
-
|
18
|
-
export async function stat(path: PathLike): Promise<Stats> {
|
19
|
-
return await _require<IFs>('fs').stat(path)
|
20
|
-
}
|
21
|
-
|
22
|
-
export async function rename(oldPath: PathLike, newPath: PathLike): Promise<void> {
|
23
|
-
await _require<IFs>('fs').rename(oldPath, newPath)
|
24
|
-
}
|
25
|
-
|
26
|
-
export async function mkdir(path: PathLike, options?: any): Promise<void> {
|
27
|
-
await _require<IFs>('fs').mkdir(path, options)
|
28
|
-
}
|
29
|
-
|
30
|
-
export function mkdirSync(path: PathLike, options: any): void {
|
31
|
-
_require<IFs>('fs').mkdirSync(path, options)
|
32
|
-
}
|
33
|
-
|
34
|
-
interface StreamOptions {
|
35
|
-
flags?: string | undefined
|
36
|
-
mode?: string | undefined
|
37
|
-
start?: number | undefined
|
38
|
-
autoClose?: boolean | undefined
|
39
|
-
emitClose?: boolean | undefined
|
40
|
-
}
|
package/src/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './fs'
|
package/src/jsre/fs.js
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
const fs = require('fs')
|
2
|
-
|
3
|
-
const brokerFs = {
|
4
|
-
|
5
|
-
createWriteStream: (path, options) => fs.createWriteStream(path, options),
|
6
|
-
|
7
|
-
stat: async (path) => await new Promise((resolve, reject) => {
|
8
|
-
try {
|
9
|
-
const stats = fs.statSync(path)
|
10
|
-
resolve(stats)
|
11
|
-
} catch (error) {
|
12
|
-
reject(new Error((error).message))
|
13
|
-
}
|
14
|
-
}),
|
15
|
-
|
16
|
-
rename: async (oldPath, newPath) => {
|
17
|
-
await new Promise((resolve, reject) => {
|
18
|
-
fs.rename(oldPath, newPath, (err) => {
|
19
|
-
if (err) {
|
20
|
-
reject(err)
|
21
|
-
} else {
|
22
|
-
resolve(undefined)
|
23
|
-
}
|
24
|
-
})
|
25
|
-
})
|
26
|
-
},
|
27
|
-
|
28
|
-
mkdir: async (path, options) => {
|
29
|
-
await new Promise((resolve, reject) => {
|
30
|
-
fs.mkdir(path, options, (err) => {
|
31
|
-
if (err) {
|
32
|
-
reject(err)
|
33
|
-
} else {
|
34
|
-
resolve(undefined)
|
35
|
-
}
|
36
|
-
})
|
37
|
-
})
|
38
|
-
},
|
39
|
-
mkdirSync: (path, options) => {
|
40
|
-
fs.mkdir(path, options.mode, !!options.recursive)
|
41
|
-
},
|
42
|
-
}
|
43
|
-
|
44
|
-
module.exports = brokerFs
|
package/src/node/fs.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import * as fs from 'fs/promises'
|
2
|
-
import { type PathLike, type WriteStream, createWriteStream, mkdirSync } from 'fs'
|
3
|
-
|
4
|
-
export interface BrokerFs {
|
5
|
-
createWriteStream: (options?: any) => WriteStream
|
6
|
-
stat: (path: PathLike) => Promise<any>
|
7
|
-
rename: (oldPath: PathLike, newPath: any) => Promise<void>
|
8
|
-
mkdir: (path: PathLike, options?: string | number) => Promise<void>
|
9
|
-
mkdirSync: (path: PathLike, options: string | number) => void
|
10
|
-
}
|
11
|
-
const brokerFs: BrokerFs = {
|
12
|
-
...fs,
|
13
|
-
createWriteStream,
|
14
|
-
stat: fs.stat,
|
15
|
-
rename: fs.rename,
|
16
|
-
mkdir: fs.mkdir,
|
17
|
-
mkdirSync,
|
18
|
-
}
|
19
|
-
|
20
|
-
export default brokerFs
|
package/tsconfig.json
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": "@tsconfig/node20/tsconfig.json",
|
3
|
-
"compilerOptions": {
|
4
|
-
"declaration": true,
|
5
|
-
"outDir": "dist",
|
6
|
-
"inlineSourceMap": true,
|
7
|
-
"inlineSources": true,
|
8
|
-
"experimentalDecorators": true,
|
9
|
-
"emitDecoratorMetadata": true,
|
10
|
-
"allowJs": true,
|
11
|
-
"checkJs": false,
|
12
|
-
"strictNullChecks": true,
|
13
|
-
"module": "commonjs",
|
14
|
-
"moduleResolution": "node"
|
15
|
-
},
|
16
|
-
"include": [
|
17
|
-
"src/*",
|
18
|
-
]
|
19
|
-
}
|