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", "$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router", "name": "@kevisual/router",
"version": "0.0.68", "version": "0.0.69",
"description": "", "description": "",
"type": "module", "type": "module",
"main": "./dist/router.js", "main": "./dist/router.js",

View File

@@ -17,9 +17,11 @@ export const getMatchFiles = async (match: string = './*.ts', { cwd = process.cw
} }
if (runtime.isBun) { if (runtime.isBun) {
// Bun 环境下 // Bun 环境下
const bunPkgs = 'bun';
const pathPkgs = 'node:path';
// @ts-ignore // @ts-ignore
const { Glob } = await import('bun'); const { Glob } = await import(/*---*/bunPkgs);
const path = await import('path'); const path = await import(/*---*/pathPkgs);
// @ts-ignore // @ts-ignore
const glob = new Glob(match, { cwd, absolute: true, onlyFiles: true }); const glob = new Glob(match, { cwd, absolute: true, onlyFiles: true });
const files: string[] = []; const files: string[] = [];
@@ -32,7 +34,7 @@ export const getMatchFiles = async (match: string = './*.ts', { cwd = process.cw
return []; 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 }); 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, OnListener,
} from './server/server-type.ts'; } from './server/server-type.ts';
export { loadTS } from './auto/load-ts.ts'; // export { loadTS } from './auto/load-ts.ts';