chore: update package version to 0.0.69; modify import statements in loadTS function

This commit is contained in:
2026-02-03 01:12:23 +08:00
parent 48de44587a
commit 08696dedd8
3 changed files with 8 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router",
"version": "0.0.68",
"version": "0.0.69",
"description": "",
"type": "module",
"main": "./dist/router.js",

View File

@@ -17,9 +17,11 @@ export const getMatchFiles = async (match: string = './*.ts', { cwd = process.cw
}
if (runtime.isBun) {
// Bun 环境下
const bunPkgs = 'bun';
const pathPkgs = 'node:path';
// @ts-ignore
const { Glob } = await import('bun');
const path = await import('path');
const { Glob } = await import(/*---*/bunPkgs);
const path = await import(/*---*/pathPkgs);
// @ts-ignore
const glob = new Glob(match, { cwd, absolute: true, onlyFiles: true });
const files: string[] = [];
@@ -32,7 +34,7 @@ export const getMatchFiles = async (match: string = './*.ts', { cwd = process.cw
return [];
};
export const loadTS = async (match: string = './*.ts', { cwd = process.cwd(), load }: GlobOptions = {}): Promise<any[]> => {
export const loadTS = async (match: string = './*.ts', { cwd = process?.cwd?.(), load }: GlobOptions = {}): Promise<any[]> => {
const files = await getMatchFiles(match, { cwd });
return Promise.all(files.map((file) => (load ? load(file) : import(file))));
return Promise.all(files.map((file) => (load ? load(file) : import(/*---*/file))));
};

View File

@@ -34,4 +34,4 @@ export type {
OnListener,
} from './server/server-type.ts';
export { loadTS } from './auto/load-ts.ts';
// export { loadTS } from './auto/load-ts.ts';