@hirarijs/loader-ts 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +24 -2
- package/dist/index.js +24 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -213426,8 +213426,30 @@ function createTsResolveForConfig(tsconfigPath, debug = false) {
|
|
|
213426
213426
|
};
|
|
213427
213427
|
const resolver = (specifier, importer) => {
|
|
213428
213428
|
const result = import_typescript.default.resolveModuleName(specifier, importer, options, host);
|
|
213429
|
-
|
|
213430
|
-
if (resolved &&
|
|
213429
|
+
let resolved = result.resolvedModule?.resolvedFileName;
|
|
213430
|
+
if (resolved && resolved.endsWith(".d.ts")) {
|
|
213431
|
+
const candidates = [
|
|
213432
|
+
resolved.replace(/\.d\.ts$/, ".ts"),
|
|
213433
|
+
resolved.replace(/\.d\.ts$/, ".tsx"),
|
|
213434
|
+
resolved.replace(/\.d\.ts$/, ".js"),
|
|
213435
|
+
resolved.replace(/\.d\.ts$/, ".mjs"),
|
|
213436
|
+
resolved.replace(/\.d\.ts$/, ".cts"),
|
|
213437
|
+
resolved.replace(/\.d\.ts$/, ".cjs")
|
|
213438
|
+
];
|
|
213439
|
+
if (resolved.includes(`${import_path.default.sep}dist${import_path.default.sep}`)) {
|
|
213440
|
+
const srcBase = resolved.replace(`${import_path.default.sep}dist${import_path.default.sep}`, `${import_path.default.sep}src${import_path.default.sep}`);
|
|
213441
|
+
candidates.unshift(
|
|
213442
|
+
srcBase.replace(/\.d\.ts$/, ".ts"),
|
|
213443
|
+
srcBase.replace(/\.d\.ts$/, ".tsx"),
|
|
213444
|
+
srcBase.replace(/\.d\.ts$/, ".js"),
|
|
213445
|
+
srcBase.replace(/\.d\.ts$/, ".mjs"),
|
|
213446
|
+
srcBase.replace(/\.d\.ts$/, ".cts"),
|
|
213447
|
+
srcBase.replace(/\.d\.ts$/, ".cjs")
|
|
213448
|
+
);
|
|
213449
|
+
}
|
|
213450
|
+
resolved = candidates.find((f) => import_typescript.default.sys.fileExists(f)) || resolved;
|
|
213451
|
+
}
|
|
213452
|
+
if (resolved) {
|
|
213431
213453
|
if (debug) {
|
|
213432
213454
|
console.log(`[loader-ts] resolved ${specifier} -> ${resolved}`);
|
|
213433
213455
|
}
|
package/dist/index.js
CHANGED
|
@@ -213423,8 +213423,30 @@ function createTsResolveForConfig(tsconfigPath, debug = false) {
|
|
|
213423
213423
|
};
|
|
213424
213424
|
const resolver = (specifier, importer) => {
|
|
213425
213425
|
const result = import_typescript.default.resolveModuleName(specifier, importer, options, host);
|
|
213426
|
-
|
|
213427
|
-
if (resolved &&
|
|
213426
|
+
let resolved = result.resolvedModule?.resolvedFileName;
|
|
213427
|
+
if (resolved && resolved.endsWith(".d.ts")) {
|
|
213428
|
+
const candidates = [
|
|
213429
|
+
resolved.replace(/\.d\.ts$/, ".ts"),
|
|
213430
|
+
resolved.replace(/\.d\.ts$/, ".tsx"),
|
|
213431
|
+
resolved.replace(/\.d\.ts$/, ".js"),
|
|
213432
|
+
resolved.replace(/\.d\.ts$/, ".mjs"),
|
|
213433
|
+
resolved.replace(/\.d\.ts$/, ".cts"),
|
|
213434
|
+
resolved.replace(/\.d\.ts$/, ".cjs")
|
|
213435
|
+
];
|
|
213436
|
+
if (resolved.includes(`${path.sep}dist${path.sep}`)) {
|
|
213437
|
+
const srcBase = resolved.replace(`${path.sep}dist${path.sep}`, `${path.sep}src${path.sep}`);
|
|
213438
|
+
candidates.unshift(
|
|
213439
|
+
srcBase.replace(/\.d\.ts$/, ".ts"),
|
|
213440
|
+
srcBase.replace(/\.d\.ts$/, ".tsx"),
|
|
213441
|
+
srcBase.replace(/\.d\.ts$/, ".js"),
|
|
213442
|
+
srcBase.replace(/\.d\.ts$/, ".mjs"),
|
|
213443
|
+
srcBase.replace(/\.d\.ts$/, ".cts"),
|
|
213444
|
+
srcBase.replace(/\.d\.ts$/, ".cjs")
|
|
213445
|
+
);
|
|
213446
|
+
}
|
|
213447
|
+
resolved = candidates.find((f) => import_typescript.default.sys.fileExists(f)) || resolved;
|
|
213448
|
+
}
|
|
213449
|
+
if (resolved) {
|
|
213428
213450
|
if (debug) {
|
|
213429
213451
|
console.log(`[loader-ts] resolved ${specifier} -> ${resolved}`);
|
|
213430
213452
|
}
|