@kosko/require
Advanced tools
Comparing version 0.0.0-20240324064444 to 0.0.0-20240324074257
/** | ||
* Imports and resolves modules. | ||
* Returns file extensions which can be imported. | ||
* | ||
* @packageDocumentation | ||
* @defaultValue Node.js | ||
* ```js | ||
* [".cjs", ".mjs", ".js", ".json", ".node"] | ||
* ``` | ||
* | ||
* @public | ||
*/ | ||
export * from "./extensions"; | ||
export * from "./resolve"; | ||
export * from "./import"; | ||
declare function getRequireExtensions(): string[]; | ||
/** | ||
* @public | ||
*/ | ||
interface ResolveOptions { | ||
/** | ||
* The directory to resolve from. | ||
* | ||
* @defaultValue `process.cwd()` | ||
*/ | ||
baseDir?: string; | ||
/** | ||
* File extensions to resolve. | ||
* | ||
* @defaultValue `getRequireExtensions()` | ||
*/ | ||
extensions?: readonly string[]; | ||
} | ||
/** | ||
* Returns full file path of the given path. This function only supports | ||
* relative or absolute paths of files or directories. | ||
* | ||
* @public | ||
*/ | ||
declare function resolvePath(path: string, options?: ResolveOptions): Promise<string | undefined>; | ||
/** | ||
* Returns full file path of the given module id. | ||
* | ||
* @param id - A relative or absolute path to a file or directory, or a module name. | ||
* @public | ||
*/ | ||
declare function resolveModule(id: string, options?: Pick<ResolveOptions, "baseDir">): Promise<string | undefined>; | ||
/** | ||
* Imports a module from the given `path`. | ||
* | ||
* @param path - Absolute path to a module. It must not be a file URL or a relative path. | ||
* @public | ||
*/ | ||
declare function importPath(path: string): Promise<any>; | ||
export { type ResolveOptions, getRequireExtensions, importPath, resolveModule, resolvePath }; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@kosko/require", | ||
"version": "0.0.0-20240324064444", | ||
"version": "0.0.0-20240324074257", | ||
"description": "Import and resolve modules.", | ||
@@ -48,3 +48,3 @@ "homepage": "https://kosko.dev", | ||
"resolve-from": "^5.0.0", | ||
"@kosko/common-utils": "^0.0.0-20240324064444" | ||
"@kosko/common-utils": "^0.0.0-20240324074257" | ||
}, | ||
@@ -56,5 +56,5 @@ "devDependencies": { | ||
"typescript": "^5.3.3", | ||
"@kosko/jest-preset": "^0.0.0", | ||
"@kosko/build-scripts": "^0.0.0", | ||
"@kosko/test-utils": "^0.0.0", | ||
"@kosko/build-scripts": "^0.0.0" | ||
"@kosko/jest-preset": "^0.0.0" | ||
}, | ||
@@ -61,0 +61,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35360
12
254