@hirarijs/loader-ts 1.0.6 → 1.0.8

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 CHANGED
@@ -213381,6 +213381,13 @@ var import_path = __toESM(require("path"), 1);
213381
213381
  var import_typescript = __toESM(require_typescript(), 1);
213382
213382
  var resolverCache = /* @__PURE__ */ new Map();
213383
213383
  var nearestConfigCache = /* @__PURE__ */ new Map();
213384
+ var rootConfigPath = null;
213385
+ function findRootTsconfig() {
213386
+ if (rootConfigPath !== null) return rootConfigPath;
213387
+ const candidate = import_path.default.join(process.cwd(), "tsconfig.json");
213388
+ rootConfigPath = import_typescript.default.sys.fileExists(candidate) ? candidate : null;
213389
+ return rootConfigPath;
213390
+ }
213384
213391
  function findNearestTsconfig(start) {
213385
213392
  if (nearestConfigCache.has(start)) return nearestConfigCache.get(start);
213386
213393
  let dir = start;
@@ -213435,7 +213442,8 @@ function createTsResolveForConfig(tsconfigPath, debug = false) {
213435
213442
  return resolver;
213436
213443
  }
213437
213444
  function createTsResolve(importer, debug = false) {
213438
- const tsconfigPath = findNearestTsconfig(import_path.default.dirname(importer));
213445
+ const root = findRootTsconfig();
213446
+ const tsconfigPath = root ?? findNearestTsconfig(import_path.default.dirname(importer));
213439
213447
  if (!tsconfigPath) return null;
213440
213448
  return createTsResolveForConfig(tsconfigPath, debug);
213441
213449
  }
package/dist/index.js CHANGED
@@ -213378,6 +213378,13 @@ import {
213378
213378
  import path from "path";
213379
213379
  var resolverCache = /* @__PURE__ */ new Map();
213380
213380
  var nearestConfigCache = /* @__PURE__ */ new Map();
213381
+ var rootConfigPath = null;
213382
+ function findRootTsconfig() {
213383
+ if (rootConfigPath !== null) return rootConfigPath;
213384
+ const candidate = path.join(process.cwd(), "tsconfig.json");
213385
+ rootConfigPath = import_typescript.default.sys.fileExists(candidate) ? candidate : null;
213386
+ return rootConfigPath;
213387
+ }
213381
213388
  function findNearestTsconfig(start) {
213382
213389
  if (nearestConfigCache.has(start)) return nearestConfigCache.get(start);
213383
213390
  let dir = start;
@@ -213432,7 +213439,8 @@ function createTsResolveForConfig(tsconfigPath, debug = false) {
213432
213439
  return resolver;
213433
213440
  }
213434
213441
  function createTsResolve(importer, debug = false) {
213435
- const tsconfigPath = findNearestTsconfig(path.dirname(importer));
213442
+ const root = findRootTsconfig();
213443
+ const tsconfigPath = root ?? findNearestTsconfig(path.dirname(importer));
213436
213444
  if (!tsconfigPath) return null;
213437
213445
  return createTsResolveForConfig(tsconfigPath, debug);
213438
213446
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hirarijs/loader-ts",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "TypeScript loader plugin for HirariJS loader",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",