feat!: switch to native ESM with NodeNext module resolution and .js import paths
BREAKING CHANGE: Consumers must use ESM-compatible environments. All import paths now include .js extensions. CommonJS (require) is no longer supported.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/* istanbul ignore file */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Inject } from 'src/decorators/Inject';
|
||||
import { DependencyResolutionError } from 'src/interfaces/Exceptions';
|
||||
import { ForceConstructor } from 'src/types/GenericContructor';
|
||||
import { ITSinjex_, ITSinjex } from '../interfaces/ITSinjex';
|
||||
import { Inject } from 'src/decorators/Inject.js';
|
||||
import { DependencyResolutionError } from 'src/interfaces/Exceptions.js';
|
||||
import { ForceConstructor } from 'src/types/GenericContructor.js';
|
||||
import { ITSinjex_, ITSinjex } from '../interfaces/ITSinjex.js';
|
||||
|
||||
/**
|
||||
* Test the Inject decorator.
|
||||
|
@@ -1,13 +1,13 @@
|
||||
/* eslint-disable deprecation/deprecation */
|
||||
import { TSinjex } from 'src/classes/TSinjex';
|
||||
import { Inject } from 'src/decorators/Inject';
|
||||
import { Register } from 'src/decorators/Register';
|
||||
import { RegisterInstance } from 'src/decorators/RegisterInstance';
|
||||
import { TSinjex } from 'src/classes/TSinjex.js';
|
||||
import { Inject } from 'src/decorators/Inject.js';
|
||||
import { Register } from 'src/decorators/Register.js';
|
||||
import { RegisterInstance } from 'src/decorators/RegisterInstance.js';
|
||||
import {
|
||||
test_InjectDecorator,
|
||||
test_RegisterDecorator,
|
||||
test_RegisterInstanceDecorator,
|
||||
} from './Decorators.spec';
|
||||
} from './Decorators.spec.js';
|
||||
|
||||
test_InjectDecorator(TSinjex, Inject);
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* istanbul ignore file */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { ITSinjex, ITSinjex_ } from 'src/interfaces/ITSinjex';
|
||||
import { ITSinjex, ITSinjex_ } from 'src/interfaces/ITSinjex.js';
|
||||
|
||||
export function test_RegisterFunction(
|
||||
Container: ITSinjex_,
|
||||
|
@@ -1,7 +1,10 @@
|
||||
import { TSinjex } from 'src/classes/TSinjex';
|
||||
import { register } from 'src/functions/register';
|
||||
import { resolve } from 'src/functions/resolve';
|
||||
import { test_RegisterFunction, test_ResolveFunction } from './Functions.spec';
|
||||
import { TSinjex } from 'src/classes/TSinjex.js';
|
||||
import { register } from 'src/functions/register.js';
|
||||
import { resolve } from 'src/functions/resolve.js';
|
||||
import {
|
||||
test_RegisterFunction,
|
||||
test_ResolveFunction,
|
||||
} from './Functions.spec.js';
|
||||
|
||||
test_RegisterFunction(TSinjex, register);
|
||||
test_ResolveFunction(TSinjex, resolve);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* istanbul ignore file */
|
||||
import { ITSinjex_, ITSinjex } from '../interfaces/ITSinjex';
|
||||
import { ITSinjex_, ITSinjex } from '../interfaces/ITSinjex.js';
|
||||
|
||||
/**
|
||||
* Test the implementation of the `ITSinjex` interface.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { test_ITSinjex } from './ITSinjex.spec';
|
||||
import { TSinjex } from '../classes/TSinjex';
|
||||
import { test_ITSinjex } from './ITSinjex.spec.js';
|
||||
import { TSinjex } from '../classes/TSinjex.js';
|
||||
|
||||
test_ITSinjex(TSinjex);
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import type { Inject } from '../decorators/Inject';
|
||||
import type { Register } from '../decorators/Register';
|
||||
import type { RegisterInstance } from '../decorators/RegisterInstance';
|
||||
import type { register } from '../functions/register';
|
||||
import type { resolve } from '../functions/resolve';
|
||||
import { ImplementsStatic } from '../helper/ImplementsStatic';
|
||||
import { DependencyResolutionError } from '../interfaces/Exceptions';
|
||||
import { IDependency } from '../interfaces/IDependency';
|
||||
import { ITSinjex, ITSinjex_ } from '../interfaces/ITSinjex';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import type { Inject } from '../decorators/Inject.js';
|
||||
import type { Register } from '../decorators/Register.js';
|
||||
import type { RegisterInstance } from '../decorators/RegisterInstance.js';
|
||||
import type { register } from '../functions/register.js';
|
||||
import type { resolve } from '../functions/resolve.js';
|
||||
import { ImplementsStatic } from '../helper/ImplementsStatic.js';
|
||||
import { DependencyResolutionError } from '../interfaces/Exceptions.js';
|
||||
import { IDependency } from '../interfaces/IDependency.js';
|
||||
import { ITSinjex, ITSinjex_ } from '../interfaces/ITSinjex.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
|
||||
/**
|
||||
* # TSinjex
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { TSinjex } from '../classes/TSinjex.js';
|
||||
import {
|
||||
DependencyResolutionError,
|
||||
InitializationError,
|
||||
InjectorError,
|
||||
NoInstantiationMethodError,
|
||||
} from 'src/interfaces/Exceptions';
|
||||
import { TSinjex } from '../classes/TSinjex';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import { InitDelegate } from '../types/InitDelegate';
|
||||
} from '../interfaces/Exceptions.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
import { InitDelegate } from '../types/InitDelegate.js';
|
||||
|
||||
/**
|
||||
* A decorator to inject a dependency from a DI (Dependency Injection) container into a class property.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { InitDelegate } from 'src/types/InitDelegate';
|
||||
import { TSinjex } from '../classes/TSinjex';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import { InitDelegate } from 'src/types/InitDelegate.js';
|
||||
import { TSinjex } from '../classes/TSinjex.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
|
||||
//#region Overloads
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Register } from './Register';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import { InitDelegate } from '../types/InitDelegate';
|
||||
import { Register } from './Register.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
import { InitDelegate } from '../types/InitDelegate.js';
|
||||
|
||||
/**
|
||||
* A decorator to register an instance of a class in the DI (Dependency Injection) container.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { TSinjex } from '../classes/TSinjex';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import { TSinjex } from '../classes/TSinjex.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
|
||||
/**
|
||||
* Register a dependency.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { TSinjex } from '../classes/TSinjex';
|
||||
import { DependencyResolutionError } from '../interfaces/Exceptions';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import { TSinjex } from '../classes/TSinjex.js';
|
||||
import { DependencyResolutionError } from '../interfaces/Exceptions.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
|
||||
/**
|
||||
* Resolve a dependency.
|
||||
|
20
src/index.ts
20
src/index.ts
@@ -1,21 +1,21 @@
|
||||
/* istanbul ignore file */
|
||||
|
||||
// Main
|
||||
export * from './classes/TSinjex';
|
||||
export * from './classes/TSinjex.js';
|
||||
|
||||
// Decorators
|
||||
export * from './decorators/Inject';
|
||||
export * from './decorators/Register';
|
||||
export * from './decorators/RegisterInstance';
|
||||
export * from './decorators/Inject.js';
|
||||
export * from './decorators/Register.js';
|
||||
export * from './decorators/RegisterInstance.js';
|
||||
|
||||
// Helper
|
||||
export * from './helper/ImplementsStatic';
|
||||
export * from './helper/ImplementsStatic.js';
|
||||
|
||||
// Functions
|
||||
export * from './functions/resolve';
|
||||
export * from './functions/register';
|
||||
export * from './functions/resolve.js';
|
||||
export * from './functions/register.js';
|
||||
|
||||
// Interfaces & Types
|
||||
export type * from './interfaces/ITSinjex';
|
||||
export type * from './types/InitDelegate';
|
||||
export type * from './types/GenericContructor';
|
||||
export type * from './interfaces/ITSinjex.js';
|
||||
export type * from './types/InitDelegate.js';
|
||||
export type * from './types/GenericContructor.js';
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Identifier } from 'src/types/Identifier';
|
||||
import { ITSinjex } from './ITSinjex';
|
||||
import { Identifier } from 'src/types/Identifier.js';
|
||||
import { ITSinjex } from './ITSinjex.js';
|
||||
|
||||
/**
|
||||
* General error class for {@link ITSinjex} interface.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { DependencyResolutionError } from './Exceptions';
|
||||
import { Identifier } from '../types/Identifier';
|
||||
import { DependencyResolutionError } from './Exceptions.js';
|
||||
import { Identifier } from '../types/Identifier.js';
|
||||
|
||||
/**
|
||||
* Static TSInjex Interface
|
||||
|
@@ -7,13 +7,13 @@
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"outDir": "./dist",
|
||||
"module": "ESNext",
|
||||
"target": "ES6",
|
||||
"module": "NodeNext",
|
||||
"target": "ES2020",
|
||||
"allowJs": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "NodeNext",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"importHelpers": true,
|
||||
"isolatedModules": true,
|
||||
|
Reference in New Issue
Block a user