Comparing version 0.2.4 to 0.3.0
@@ -7,4 +7,55 @@ import * as bundle_require from 'bundle-require'; | ||
type SupportedLoader = 'tsx' | 'jiti' | 'bundle-require' | 'native'; | ||
interface ImportxOptions { | ||
interface FeaturesOptions { | ||
/** | ||
* Whether to cache the imported module. | ||
* | ||
* Setting to `null` means it doesn't matter for you. | ||
* | ||
* By the spec of ESM, modules are always cached. | ||
* | ||
* Meaning that if you want to re-import a module without cache, | ||
* you can't use native ESM import. | ||
* | ||
* `cache: false` does not compatible with following loaders: | ||
* - `native` | ||
* | ||
* `cache: true` does not compatible with following loaders: | ||
* - `bundle-require` | ||
* | ||
* Affects `auto` resolution: | ||
* - When set to `false`, `native` will be fallback to `tsx` or `jiti` | ||
* | ||
* @default null | ||
*/ | ||
cache?: boolean | null; | ||
/** | ||
* List dependencies of the module. | ||
* | ||
* Only available for `tsx` and `bundle-require` loader. | ||
* | ||
* Affects `auto` resolution: | ||
* - When set to `true`, `jiti` will be fallback to `bundle-require` | ||
* | ||
* Setting to `null` means it doesn't matter for you. | ||
* | ||
* @default null | ||
*/ | ||
listDependencies?: boolean | null; | ||
/** | ||
* Whether module resolution and evaluation type | ||
* | ||
* Setting to `null` means it doesn't matter for you. | ||
* | ||
* @default null | ||
*/ | ||
type?: 'module' | 'commonjs' | null; | ||
/** | ||
* Exclude loaders from being used. | ||
* | ||
* Only affects `auto` resolution. | ||
*/ | ||
excludeLoaders?: SupportedLoader[]; | ||
} | ||
interface ImportxOptions extends FeaturesOptions { | ||
/** | ||
* Loader to use for importing the file. | ||
@@ -41,35 +92,2 @@ * @default 'auto' | ||
/** | ||
* Whether to cache the imported module. | ||
* | ||
* Setting to `null` means it doesn't matter for you. | ||
* | ||
* By the spec of ESM, modules are always cached. | ||
* | ||
* Meaning that if you want to re-import a module without cache, | ||
* you can't use native ESM import. | ||
* | ||
* `cache: false` does not compatible with following loaders: | ||
* - `native` | ||
* | ||
* `cache: true` does not compatible with following loaders: | ||
* - `bundle-require` | ||
* | ||
* Affects `auto` resolution: | ||
* - When set to `false`, `native` will be fallback to `tsx` or `jiti` | ||
* | ||
* @default null | ||
*/ | ||
cache?: boolean | null; | ||
/** | ||
* List dependencies of the module. | ||
* | ||
* Only available for `tsx` and `bundle-require` loader. | ||
* | ||
* Affects `auto` resolution: | ||
* - When set to `true`, `jiti` will be fallback to `bundle-require` | ||
* | ||
* @default false | ||
*/ | ||
listDependencies?: boolean; | ||
/** | ||
* Bypass the `importx` options validation and import anyway. | ||
@@ -168,2 +186,2 @@ * | ||
export { type ImportxModuleInfo, type ImportxOptions, type SupportedLoader, getModuleInfo, importx as import, importx, isNativeTsImportSupported, isTypeScriptFile }; | ||
export { type FeaturesOptions, type ImportxModuleInfo, type ImportxOptions, type SupportedLoader, getModuleInfo, importx as import, importx, isNativeTsImportSupported, isTypeScriptFile }; |
{ | ||
"name": "importx", | ||
"type": "module", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"packageManager": "pnpm@9.1.1", | ||
@@ -6,0 +6,0 @@ "description": "Unified tool for importing TypeScript modules at runtime", |
@@ -241,3 +241,6 @@ # importx | ||
| Runtimes other than Node.js | ✅ | ❌ | ✅ | ✅ | | ||
| Runtime module type* | ESM | ESM | CJS | ESM/CJS | | ||
> *This indicates what's the module type for each loader to evaluate the modules. For `CJS`, it means the laoder transpiles the module to CJS and executes it in CJS mode, which may have some limitations like top-level await. | ||
## Sponsors | ||
@@ -244,0 +247,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
32611
396
269