@visulima/package 1.8.1 → 1.8.2
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/CHANGELOG.md +20 -0
- package/dist/chunk-5UU4RIJA.js +11 -0
- package/dist/chunk-5UU4RIJA.js.map +1 -0
- package/dist/chunk-BGVUNBLL.js +12 -0
- package/dist/chunk-BGVUNBLL.js.map +1 -0
- package/dist/chunk-BHDWBI3F.cjs +22 -0
- package/dist/chunk-BHDWBI3F.cjs.map +1 -0
- package/dist/chunk-C36BYRSZ.cjs +19 -0
- package/dist/chunk-C36BYRSZ.cjs.map +1 -0
- package/dist/chunk-EY5KVLRL.js +10 -0
- package/dist/chunk-EY5KVLRL.js.map +1 -0
- package/dist/chunk-HGV2BL7M.js +12 -0
- package/dist/chunk-HGV2BL7M.js.map +1 -0
- package/dist/chunk-I3EKI236.cjs +13 -0
- package/dist/chunk-I3EKI236.cjs.map +1 -0
- package/dist/chunk-J5ERILYG.cjs +9 -0
- package/dist/chunk-J5ERILYG.cjs.map +1 -0
- package/dist/chunk-KMWIKANF.js +7 -0
- package/dist/chunk-KMWIKANF.js.map +1 -0
- package/dist/chunk-RETLQXQB.cjs +13 -0
- package/dist/chunk-RETLQXQB.cjs.map +1 -0
- package/dist/chunk-W3Z24XII.js +14 -0
- package/dist/chunk-W3Z24XII.js.map +1 -0
- package/dist/chunk-W7A6C74U.cjs +27 -0
- package/dist/chunk-W7A6C74U.cjs.map +1 -0
- package/dist/error.cjs +5 -5
- package/dist/error.js +3 -3
- package/dist/index.cjs +54 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -59
- package/dist/index.js.map +1 -1
- package/dist/monorepo.cjs +5 -5
- package/dist/monorepo.js +3 -3
- package/dist/package-json.cjs +11 -11
- package/dist/package-json.js +1 -1
- package/dist/package-manager.cjs +14 -14
- package/dist/package-manager.js +2 -2
- package/dist/package.cjs +7 -7
- package/dist/package.js +3 -3
- package/dist/tsconfig.cjs +15 -15
- package/dist/tsconfig.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-5VO6NTKJ.js +0 -361
- package/dist/chunk-5VO6NTKJ.js.map +0 -1
- package/dist/chunk-7IOK6YPW.cjs +0 -52
- package/dist/chunk-7IOK6YPW.cjs.map +0 -1
- package/dist/chunk-CVVFWSMT.cjs +0 -65
- package/dist/chunk-CVVFWSMT.cjs.map +0 -1
- package/dist/chunk-E2PKJX3Q.js +0 -54
- package/dist/chunk-E2PKJX3Q.js.map +0 -1
- package/dist/chunk-EYMR7Z2I.js +0 -62
- package/dist/chunk-EYMR7Z2I.js.map +0 -1
- package/dist/chunk-G3SI24AJ.cjs +0 -88
- package/dist/chunk-G3SI24AJ.cjs.map +0 -1
- package/dist/chunk-IIYQBLPC.js +0 -119
- package/dist/chunk-IIYQBLPC.js.map +0 -1
- package/dist/chunk-IK5YSYLX.cjs +0 -126
- package/dist/chunk-IK5YSYLX.cjs.map +0 -1
- package/dist/chunk-UZ2FN6C5.js +0 -78
- package/dist/chunk-UZ2FN6C5.js.map +0 -1
- package/dist/chunk-WXFZK4G3.cjs +0 -374
- package/dist/chunk-WXFZK4G3.cjs.map +0 -1
- package/dist/chunk-YLCN7EVV.js +0 -50
- package/dist/chunk-YLCN7EVV.js.map +0 -1
- package/dist/chunk-YOQXHFU3.cjs +0 -56
- package/dist/chunk-YOQXHFU3.cjs.map +0 -1
package/dist/package.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkI3EKI236_cjs = require('./chunk-I3EKI236.cjs');
|
|
4
|
+
require('./chunk-C36BYRSZ.cjs');
|
|
5
|
+
require('./chunk-BHDWBI3F.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, 'findPackageRoot', {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkI3EKI236_cjs.a; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, 'findPackageRootSync', {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkI3EKI236_cjs.b; }
|
|
16
16
|
});
|
|
17
17
|
//# sourceMappingURL=out.js.map
|
|
18
18
|
//# sourceMappingURL=package.cjs.map
|
package/dist/package.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { findPackageRoot, findPackageRootSync } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { a as findPackageRoot, b as findPackageRootSync } from './chunk-EY5KVLRL.js';
|
|
2
|
+
import './chunk-BGVUNBLL.js';
|
|
3
|
+
import './chunk-HGV2BL7M.js';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=package.js.map
|
package/dist/tsconfig.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkW7A6C74U_cjs = require('./chunk-W7A6C74U.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, 'findTSConfig', {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkW7A6C74U_cjs.d; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, 'findTSConfigSync', {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkW7A6C74U_cjs.f; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, 'findTsConfig', {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkW7A6C74U_cjs.c; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, 'findTsConfigSync', {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkW7A6C74U_cjs.e; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, 'implicitBaseUrlSymbol', {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkW7A6C74U_cjs.a; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, 'writeTSConfig', {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkW7A6C74U_cjs.h; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, 'writeTsConfig', {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkW7A6C74U_cjs.g; }
|
|
34
34
|
});
|
|
35
35
|
//# sourceMappingURL=out.js.map
|
|
36
36
|
//# sourceMappingURL=tsconfig.cjs.map
|
package/dist/tsconfig.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, writeTSConfig, writeTsConfig } from './chunk-
|
|
1
|
+
export { d as findTSConfig, f as findTSConfigSync, c as findTsConfig, e as findTsConfigSync, a as implicitBaseUrlSymbol, h as writeTSConfig, g as writeTsConfig } from './chunk-W3Z24XII.js';
|
|
2
2
|
//# sourceMappingURL=out.js.map
|
|
3
3
|
//# sourceMappingURL=tsconfig.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/package",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "One Package to rule them all, finds your root-dir, monorepo, package manager or tsconfig.json",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -137,19 +137,20 @@
|
|
|
137
137
|
"LICENSE.md"
|
|
138
138
|
],
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@visulima/fs": "2.1.
|
|
140
|
+
"@visulima/fs": "2.1.2",
|
|
141
|
+
"@visulima/path": "1.0.1",
|
|
141
142
|
"jsonc-parser": "^3.2.1",
|
|
142
143
|
"normalize-package-data": "^6.0.1",
|
|
143
|
-
"pathe": "^1.1.2",
|
|
144
144
|
"resolve-pkg-maps": "^1.0.0",
|
|
145
145
|
"type-fest": "^4.18.2"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
148
|
"@anolilab/eslint-config": "^15.0.3",
|
|
149
149
|
"@anolilab/prettier-config": "^5.0.14",
|
|
150
|
-
"@anolilab/semantic-release-
|
|
150
|
+
"@anolilab/semantic-release-pnpm": "^1.1.0",
|
|
151
|
+
"@anolilab/semantic-release-preset": "^8.1.0",
|
|
151
152
|
"@babel/core": "^7.24.5",
|
|
152
|
-
"@pnpm/exe": "^9.1.
|
|
153
|
+
"@pnpm/exe": "^9.1.2",
|
|
153
154
|
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
154
155
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
155
156
|
"@types/node": "18.18.14",
|
|
@@ -166,11 +167,10 @@
|
|
|
166
167
|
"eslint-plugin-vitest": "^0.4.1",
|
|
167
168
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
168
169
|
"execa": "^9.1.0",
|
|
169
|
-
"npm": "^10.
|
|
170
|
+
"npm": "^10.8.0",
|
|
170
171
|
"prettier": "^3.2.5",
|
|
171
172
|
"rimraf": "^5.0.7",
|
|
172
173
|
"semantic-release": "^23.1.1",
|
|
173
|
-
"sort-package-json": "^2.10.0",
|
|
174
174
|
"strip-ansi": "^7.1.0",
|
|
175
175
|
"tempy": "^3.1.0",
|
|
176
176
|
"tsup": "^8.0.2",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"dev": "pnpm run build --watch",
|
|
220
220
|
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
221
221
|
"lint:eslint:fix": "pnpm run lint:eslint --fix",
|
|
222
|
-
"lint:
|
|
222
|
+
"lint:package-json": "publint --strict",
|
|
223
223
|
"lint:prettier": "prettier --config=.prettierrc.cjs --check .",
|
|
224
224
|
"lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
|
|
225
225
|
"lint:types": "tsc --noEmit",
|
package/dist/chunk-5VO6NTKJ.js
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { findUp, findUpSync, writeJson, readFileSync } from '@visulima/fs';
|
|
2
|
-
import { NotFoundError } from '@visulima/fs/error';
|
|
3
|
-
import { toPath } from '@visulima/fs/utils';
|
|
4
|
-
import { join, dirname, resolve, relative, normalize, toNamespacedPath } from 'pathe';
|
|
5
|
-
import { parse } from 'jsonc-parser';
|
|
6
|
-
import { existsSync, statSync } from 'node:fs';
|
|
7
|
-
import Module from 'node:module';
|
|
8
|
-
import { join as join$1, resolve as resolve$1, isAbsolute } from 'node:path';
|
|
9
|
-
import { resolveExports } from 'resolve-pkg-maps';
|
|
10
|
-
|
|
11
|
-
// src/tsconfig.ts
|
|
12
|
-
var readJsonc = (jsonPath) => parse(readFileSync(jsonPath));
|
|
13
|
-
var getPnpApi = () => {
|
|
14
|
-
const { findPnpApi } = Module;
|
|
15
|
-
return findPnpApi?.(process.cwd());
|
|
16
|
-
};
|
|
17
|
-
var resolveFromPackageJsonPath = (packageJsonPath, subpath, ignoreExports, cache) => {
|
|
18
|
-
const cacheKey = `resolveFromPackageJsonPath:${packageJsonPath}:${subpath}:${ignoreExports}`;
|
|
19
|
-
if (cache?.has(cacheKey)) {
|
|
20
|
-
return cache.get(cacheKey);
|
|
21
|
-
}
|
|
22
|
-
const packageJson = readJsonc(packageJsonPath);
|
|
23
|
-
if (!packageJson) {
|
|
24
|
-
return void 0;
|
|
25
|
-
}
|
|
26
|
-
let resolvedPath = subpath || "tsconfig.json";
|
|
27
|
-
if (!ignoreExports && packageJson.exports) {
|
|
28
|
-
try {
|
|
29
|
-
const [resolvedExport] = resolveExports(packageJson.exports, subpath, ["require", "types"]);
|
|
30
|
-
resolvedPath = resolvedExport;
|
|
31
|
-
} catch {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
} else if (!subpath && packageJson.tsconfig) {
|
|
35
|
-
resolvedPath = packageJson.tsconfig;
|
|
36
|
-
}
|
|
37
|
-
resolvedPath = join$1(packageJsonPath, "..", resolvedPath);
|
|
38
|
-
cache?.set(cacheKey, resolvedPath);
|
|
39
|
-
return resolvedPath;
|
|
40
|
-
};
|
|
41
|
-
var PACKAGE_JSON = "package.json";
|
|
42
|
-
var TS_CONFIG_JSON = "tsconfig.json";
|
|
43
|
-
var resolveExtendsPath = (requestedPath, directoryPath, cache) => {
|
|
44
|
-
let filePath = requestedPath;
|
|
45
|
-
if (requestedPath === "..") {
|
|
46
|
-
filePath = join$1(filePath, TS_CONFIG_JSON);
|
|
47
|
-
}
|
|
48
|
-
if (requestedPath.startsWith(".")) {
|
|
49
|
-
filePath = resolve$1(directoryPath, filePath);
|
|
50
|
-
}
|
|
51
|
-
if (isAbsolute(filePath)) {
|
|
52
|
-
if (existsSync(filePath)) {
|
|
53
|
-
if (statSync(filePath).isFile()) {
|
|
54
|
-
return filePath;
|
|
55
|
-
}
|
|
56
|
-
} else if (!filePath.endsWith(".json")) {
|
|
57
|
-
const jsonPath = `${filePath}.json`;
|
|
58
|
-
if (existsSync(jsonPath)) {
|
|
59
|
-
return jsonPath;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
const [orgOrName, ...remaining] = requestedPath.split("/");
|
|
65
|
-
const packageName = orgOrName.startsWith("@") ? `${orgOrName}/${remaining.shift()}` : orgOrName;
|
|
66
|
-
const subpath = remaining.join("/");
|
|
67
|
-
const pnpApi = getPnpApi();
|
|
68
|
-
if (pnpApi) {
|
|
69
|
-
const { resolveRequest: resolveWithPnp } = pnpApi;
|
|
70
|
-
try {
|
|
71
|
-
if (packageName === requestedPath) {
|
|
72
|
-
const packageJsonPath2 = resolveWithPnp(join$1(packageName, PACKAGE_JSON), directoryPath);
|
|
73
|
-
if (packageJsonPath2) {
|
|
74
|
-
const resolvedPath = resolveFromPackageJsonPath(packageJsonPath2, subpath, false, cache);
|
|
75
|
-
if (resolvedPath && existsSync(resolvedPath)) {
|
|
76
|
-
return resolvedPath;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
let resolved;
|
|
81
|
-
try {
|
|
82
|
-
resolved = resolveWithPnp(requestedPath, directoryPath, { extensions: [".json"] });
|
|
83
|
-
} catch {
|
|
84
|
-
resolved = resolveWithPnp(join$1(requestedPath, TS_CONFIG_JSON), directoryPath);
|
|
85
|
-
}
|
|
86
|
-
if (resolved) {
|
|
87
|
-
return resolved;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const packagePath = findUpSync(
|
|
94
|
-
(directory) => {
|
|
95
|
-
const path = join$1(directory, "node_modules", packageName);
|
|
96
|
-
if (existsSync(path)) {
|
|
97
|
-
return join$1("node_modules", packageName);
|
|
98
|
-
}
|
|
99
|
-
return void 0;
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
cwd: directoryPath,
|
|
103
|
-
type: "directory"
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
if (!packagePath || !statSync(packagePath).isDirectory()) {
|
|
107
|
-
return void 0;
|
|
108
|
-
}
|
|
109
|
-
const packageJsonPath = join$1(packagePath, PACKAGE_JSON);
|
|
110
|
-
if (existsSync(packageJsonPath)) {
|
|
111
|
-
const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);
|
|
112
|
-
if (resolvedPath === false) {
|
|
113
|
-
return void 0;
|
|
114
|
-
}
|
|
115
|
-
if (resolvedPath && existsSync(resolvedPath) && statSync(resolvedPath).isFile()) {
|
|
116
|
-
return resolvedPath;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const fullPackagePath = join$1(packagePath, subpath);
|
|
120
|
-
const jsonExtension = fullPackagePath.endsWith(".json");
|
|
121
|
-
if (!jsonExtension) {
|
|
122
|
-
const fullPackagePathWithJson = `${fullPackagePath}.json`;
|
|
123
|
-
if (existsSync(fullPackagePathWithJson)) {
|
|
124
|
-
return fullPackagePathWithJson;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (!existsSync(fullPackagePath)) {
|
|
128
|
-
return void 0;
|
|
129
|
-
}
|
|
130
|
-
if (statSync(fullPackagePath).isDirectory()) {
|
|
131
|
-
const fullPackageJsonPath = join$1(fullPackagePath, PACKAGE_JSON);
|
|
132
|
-
if (existsSync(fullPackageJsonPath)) {
|
|
133
|
-
const resolvedPath = resolveFromPackageJsonPath(fullPackageJsonPath, "", true, cache);
|
|
134
|
-
if (resolvedPath && existsSync(resolvedPath)) {
|
|
135
|
-
return resolvedPath;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const tsconfigPath = join$1(fullPackagePath, TS_CONFIG_JSON);
|
|
139
|
-
if (existsSync(tsconfigPath)) {
|
|
140
|
-
return tsconfigPath;
|
|
141
|
-
}
|
|
142
|
-
} else if (jsonExtension) {
|
|
143
|
-
return fullPackagePath;
|
|
144
|
-
}
|
|
145
|
-
return void 0;
|
|
146
|
-
};
|
|
147
|
-
var resolve_extends_path_default = resolveExtendsPath;
|
|
148
|
-
|
|
149
|
-
// src/read-tsconfig.ts
|
|
150
|
-
var readJsonc2 = (jsonPath) => parse(readFileSync(jsonPath));
|
|
151
|
-
var normalizePath = (path) => toNamespacedPath(/^\.{1,2}(?:\/.*)?$/.test(path) ? path : `./${path}`);
|
|
152
|
-
var resolveExtends = (extendsPath, fromDirectoryPath, circularExtendsTracker, options) => {
|
|
153
|
-
const resolvedExtendsPath = resolve_extends_path_default(extendsPath, fromDirectoryPath);
|
|
154
|
-
if (!resolvedExtendsPath) {
|
|
155
|
-
throw new NotFoundError(`No such file or directory, for '${extendsPath}' found.`);
|
|
156
|
-
}
|
|
157
|
-
if (circularExtendsTracker.has(resolvedExtendsPath)) {
|
|
158
|
-
throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);
|
|
159
|
-
}
|
|
160
|
-
circularExtendsTracker.add(resolvedExtendsPath);
|
|
161
|
-
const extendsDirectoryPath = dirname(resolvedExtendsPath);
|
|
162
|
-
const extendsConfig = internalParseTsConfig(resolvedExtendsPath, options, circularExtendsTracker);
|
|
163
|
-
delete extendsConfig.references;
|
|
164
|
-
const { compilerOptions } = extendsConfig;
|
|
165
|
-
if (compilerOptions) {
|
|
166
|
-
const resolvePaths = ["baseUrl", "outDir"];
|
|
167
|
-
for (const property of resolvePaths) {
|
|
168
|
-
const unresolvedPath = compilerOptions[property];
|
|
169
|
-
if (unresolvedPath) {
|
|
170
|
-
compilerOptions[property] = relative(fromDirectoryPath, join(extendsDirectoryPath, unresolvedPath)).replaceAll("\\", "/") || "./";
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
if (extendsConfig.files) {
|
|
175
|
-
extendsConfig.files = extendsConfig.files.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));
|
|
176
|
-
}
|
|
177
|
-
if (extendsConfig.include) {
|
|
178
|
-
extendsConfig.include = extendsConfig.include.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));
|
|
179
|
-
}
|
|
180
|
-
if (extendsConfig.exclude) {
|
|
181
|
-
extendsConfig.exclude = extendsConfig.exclude.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));
|
|
182
|
-
}
|
|
183
|
-
return extendsConfig;
|
|
184
|
-
};
|
|
185
|
-
var internalParseTsConfig = (tsconfigPath, options, circularExtendsTracker = /* @__PURE__ */ new Set()) => {
|
|
186
|
-
let config;
|
|
187
|
-
try {
|
|
188
|
-
config = readJsonc2(tsconfigPath) || {};
|
|
189
|
-
} catch {
|
|
190
|
-
throw new Error(`Cannot resolve tsconfig at path: ${tsconfigPath}`);
|
|
191
|
-
}
|
|
192
|
-
if (typeof config !== "object") {
|
|
193
|
-
throw new SyntaxError(`Failed to parse tsconfig at: ${tsconfigPath}`);
|
|
194
|
-
}
|
|
195
|
-
const directoryPath = dirname(tsconfigPath);
|
|
196
|
-
if (config.compilerOptions) {
|
|
197
|
-
const { compilerOptions } = config;
|
|
198
|
-
if (compilerOptions.paths && !compilerOptions.baseUrl) {
|
|
199
|
-
compilerOptions[implicitBaseUrlSymbol] = directoryPath;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (config.extends) {
|
|
203
|
-
const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];
|
|
204
|
-
delete config.extends;
|
|
205
|
-
for (const extendsPath of extendsPathList.reverse()) {
|
|
206
|
-
const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);
|
|
207
|
-
const merged = {
|
|
208
|
-
...extendsConfig,
|
|
209
|
-
...config,
|
|
210
|
-
compilerOptions: {
|
|
211
|
-
...extendsConfig.compilerOptions,
|
|
212
|
-
...config.compilerOptions
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
if (extendsConfig.watchOptions) {
|
|
216
|
-
merged.watchOptions = {
|
|
217
|
-
...extendsConfig.watchOptions,
|
|
218
|
-
...config.watchOptions
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
config = merged;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (config.compilerOptions) {
|
|
225
|
-
const { compilerOptions } = config;
|
|
226
|
-
const normalizedPaths = ["baseUrl", "rootDir"];
|
|
227
|
-
for (const property of normalizedPaths) {
|
|
228
|
-
const unresolvedPath = compilerOptions[property];
|
|
229
|
-
if (unresolvedPath) {
|
|
230
|
-
const resolvedBaseUrl = resolve(directoryPath, unresolvedPath);
|
|
231
|
-
const relativeBaseUrl = relative(directoryPath, resolvedBaseUrl);
|
|
232
|
-
compilerOptions[property] = normalizePath(relativeBaseUrl);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
const { outDir } = compilerOptions;
|
|
236
|
-
if (outDir) {
|
|
237
|
-
if (!Array.isArray(config.exclude)) {
|
|
238
|
-
config.exclude = [];
|
|
239
|
-
}
|
|
240
|
-
if (!config.exclude.includes(outDir)) {
|
|
241
|
-
config.exclude.push(outDir);
|
|
242
|
-
}
|
|
243
|
-
compilerOptions.outDir = normalizePath(outDir);
|
|
244
|
-
}
|
|
245
|
-
if (options?.tscCompatible && compilerOptions.module === "node16") {
|
|
246
|
-
compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;
|
|
247
|
-
compilerOptions.esModuleInterop = compilerOptions.esModuleInterop ?? true;
|
|
248
|
-
compilerOptions.moduleDetection = compilerOptions.moduleDetection ?? "force";
|
|
249
|
-
compilerOptions.moduleResolution = compilerOptions.moduleResolution ?? "node16";
|
|
250
|
-
compilerOptions.target = compilerOptions.target ?? "es2022";
|
|
251
|
-
compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;
|
|
252
|
-
}
|
|
253
|
-
if (options?.tscCompatible && compilerOptions.strict) {
|
|
254
|
-
compilerOptions.noImplicitAny = compilerOptions.noImplicitAny ?? true;
|
|
255
|
-
compilerOptions.noImplicitThis = compilerOptions.noImplicitThis ?? true;
|
|
256
|
-
compilerOptions.strictNullChecks = compilerOptions.strictNullChecks ?? true;
|
|
257
|
-
compilerOptions.strictFunctionTypes = compilerOptions.strictFunctionTypes ?? true;
|
|
258
|
-
compilerOptions.strictBindCallApply = compilerOptions.strictBindCallApply ?? true;
|
|
259
|
-
compilerOptions.strictPropertyInitialization = compilerOptions.strictPropertyInitialization ?? true;
|
|
260
|
-
compilerOptions.alwaysStrict = compilerOptions.alwaysStrict ?? true;
|
|
261
|
-
compilerOptions.useUnknownInCatchVariables = compilerOptions.useUnknownInCatchVariables ?? true;
|
|
262
|
-
}
|
|
263
|
-
if (options?.tscCompatible && compilerOptions.isolatedModules) {
|
|
264
|
-
compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;
|
|
265
|
-
}
|
|
266
|
-
if (options?.tscCompatible && compilerOptions.esModuleInterop) {
|
|
267
|
-
compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;
|
|
268
|
-
}
|
|
269
|
-
if (options?.tscCompatible && compilerOptions.target === "esnext") {
|
|
270
|
-
compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
config.compilerOptions = {};
|
|
274
|
-
}
|
|
275
|
-
if (config.files) {
|
|
276
|
-
config.files = config.files.map((element) => normalizePath(element));
|
|
277
|
-
}
|
|
278
|
-
if (config.include) {
|
|
279
|
-
config.include = config.include.map((element) => normalize(element));
|
|
280
|
-
}
|
|
281
|
-
if (config.watchOptions) {
|
|
282
|
-
const { watchOptions } = config;
|
|
283
|
-
if (watchOptions.excludeDirectories) {
|
|
284
|
-
watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return config;
|
|
288
|
-
};
|
|
289
|
-
var implicitBaseUrlSymbol = Symbol("implicitBaseUrl");
|
|
290
|
-
var readTsConfig = (tsconfigPath, options) => internalParseTsConfig(tsconfigPath, options);
|
|
291
|
-
|
|
292
|
-
// src/tsconfig.ts
|
|
293
|
-
var TsConfigFileCache = /* @__PURE__ */ new Map();
|
|
294
|
-
var findTsConfig = async (cwd, options = {}) => {
|
|
295
|
-
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
296
|
-
let filePath = await findUp(configFileName, {
|
|
297
|
-
...cwd && { cwd },
|
|
298
|
-
type: "file"
|
|
299
|
-
});
|
|
300
|
-
if (!filePath) {
|
|
301
|
-
filePath = await findUp("jsconfig.json", {
|
|
302
|
-
...cwd && { cwd },
|
|
303
|
-
type: "file"
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
if (!filePath) {
|
|
307
|
-
throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
308
|
-
}
|
|
309
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
310
|
-
if (options.cache && cache.has(filePath)) {
|
|
311
|
-
return cache.get(filePath);
|
|
312
|
-
}
|
|
313
|
-
const output = {
|
|
314
|
-
config: readTsConfig(filePath),
|
|
315
|
-
path: filePath
|
|
316
|
-
};
|
|
317
|
-
if (options.cache) {
|
|
318
|
-
cache.set(filePath, output);
|
|
319
|
-
}
|
|
320
|
-
return output;
|
|
321
|
-
};
|
|
322
|
-
var findTSConfig = findTsConfig;
|
|
323
|
-
var findTsConfigSync = (cwd, options = {}) => {
|
|
324
|
-
const configFileName = options.configFileName ?? "tsconfig.json";
|
|
325
|
-
let filePath = findUpSync(configFileName, {
|
|
326
|
-
...cwd && { cwd },
|
|
327
|
-
type: "file"
|
|
328
|
-
});
|
|
329
|
-
if (!filePath) {
|
|
330
|
-
filePath = findUpSync("jsconfig.json", {
|
|
331
|
-
...cwd && { cwd },
|
|
332
|
-
type: "file"
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
if (!filePath) {
|
|
336
|
-
throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);
|
|
337
|
-
}
|
|
338
|
-
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : TsConfigFileCache;
|
|
339
|
-
if (options.cache && cache.has(filePath)) {
|
|
340
|
-
return cache.get(filePath);
|
|
341
|
-
}
|
|
342
|
-
const output = {
|
|
343
|
-
config: readTsConfig(filePath),
|
|
344
|
-
path: filePath
|
|
345
|
-
};
|
|
346
|
-
if (options.cache) {
|
|
347
|
-
cache.set(filePath, output);
|
|
348
|
-
}
|
|
349
|
-
return output;
|
|
350
|
-
};
|
|
351
|
-
var findTSConfigSync = findTsConfigSync;
|
|
352
|
-
var writeTsConfig = async (data, options = {}) => {
|
|
353
|
-
const { cwd, ...writeOptions } = options;
|
|
354
|
-
const directory = toPath(options.cwd ?? process.cwd());
|
|
355
|
-
await writeJson(join(directory, "tsconfig.json"), data, writeOptions);
|
|
356
|
-
};
|
|
357
|
-
var writeTSConfig = writeTsConfig;
|
|
358
|
-
|
|
359
|
-
export { findTSConfig, findTSConfigSync, findTsConfig, findTsConfigSync, implicitBaseUrlSymbol, readTsConfig, writeTSConfig, writeTsConfig };
|
|
360
|
-
//# sourceMappingURL=out.js.map
|
|
361
|
-
//# sourceMappingURL=chunk-5VO6NTKJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tsconfig.ts","../src/read-tsconfig.ts","../src/utils/resolve-extends-path.ts"],"names":["findUpSync","NotFoundError","join","readFileSync","parse","resolve","packageJsonPath","readJsonc"],"mappings":";AACA,SAAS,QAAQ,cAAAA,aAAY,iBAAiB;AAC9C,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,QAAAC,aAAY;;;ACErB,SAAS,gBAAAC,qBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,SAAAC,cAAa;AACtB,SAAS,SAAS,QAAAF,OAAM,WAAW,UAAU,WAAAG,UAAS,wBAAwB;;;ACH9E,SAAS,YAAY,gBAAgB;AACrC,OAAO,YAAY;AACnB,SAAS,YAAY,MAAM,eAAe;AAE1C,SAAS,YAAY,oBAAoB;AACzC,SAAS,aAAa;AAEtB,SAAS,sBAAsB;AAK/B,IAAM,YAAY,CAAC,aAAqB,MAAM,aAAa,QAAQ,CAAW;AAE9E,IAAM,YAAY,MAAM;AACpB,QAAM,EAAE,WAAW,IAAI;AAGvB,SAAO,aAAa,QAAQ,IAAI,CAAC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mBAAmB,CAAC,KAAoB,UAAmB,CAAC,MAAsB;AAC3F,QAAM,iBAAiB,QAAQ,kBAAkB;AAEjD,MAAI,WAAWD,YAAW,gBAAgB;AAAA,IACtC,GAAI,OAAO,EAAE,IAAI;AAAA,IACjB,MAAM;AAAA,EACV,CAAC;AAED,MAAI,CAAC,UAAU;AACX,eAAWA,YAAW,iBAAiB;AAAA,MACnC,GAAI,OAAO,EAAE,IAAI;AAAA,MACjB,MAAM;AAAA,IACV,CAAC;AAAA,EACL;AAEA,MAAI,CAAC,UAAU;AACX,UAAM,IAAIC,eAAc,kCAAkC,cAAc,0BAA0B;AAAA,EACtG;AAEA,QAAM,QAAQ,QAAQ,SAAS,OAAO,QAAQ,UAAU,YAAY,QAAQ,QAAQ;AAEpF,MAAI,QAAQ,SAAS,MAAM,IAAI,QAAQ,GAAG;AACtC,WAAO,MAAM,IAAI,QAAQ;AAAA,EAC7B;AAEA,QAAM,SAAS;AAAA,IACX,QAAQ,aAAa,QAAQ;AAAA,IAC7B,MAAM;AAAA,EACV;AAEA,MAAI,QAAQ,OAAO;AACf,UAAM,IAAI,UAAU,MAAM;AAAA,EAC9B;AAEA,SAAO;AACX;AAGO,IAAM,mBAAmB;AAWzB,IAAM,gBAAgB,OAAO,MAAoB,UAAqD,CAAC,MAAqB;AAC/H,QAAM,EAAE,KAAK,GAAG,aAAa,IAAI;AAEjC,QAAM,YAAY,OAAO,QAAQ,OAAO,QAAQ,IAAI,CAAC;AAErD,QAAM,UAAUC,MAAK,WAAW,eAAe,GAAG,MAAM,YAAY;AACxE;AAGO,IAAM,gBAAgB","sourcesContent":["import type { WriteJsonOptions } from \"@visulima/fs\";\nimport { findUp, findUpSync, writeJson } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { toPath } from \"@visulima/fs/utils\";\nimport { join } from \"pathe\";\nimport type { TsConfigJson } from \"type-fest\";\n\nimport { readTsConfig } from \"./read-tsconfig\";\nimport type { TsConfigJsonResolved } from \"./types\";\n\ntype Options = {\n cache?: Map<string, TsConfigJsonResolved> | boolean;\n configFileName?: string;\n};\n\nconst TsConfigFileCache = new Map<string, TsConfigResult>();\n\nexport type TsConfigResult = {\n config: TsConfigJsonResolved;\n path: string;\n};\n\n/**\n * An asynchronous function that retrieves the TSConfig by searching for the \"tsconfig.json\" first,\n * second attempt is to look for the \"jsconfig.json\" file from a given current working directory.\n *\n * @param cwd - Optional. The current working directory from which to search for the \"tsconfig.json\" file.\n * The type of `cwd` is `string`.\n * @returns A `Promise` that resolves to the TSConfig result object.\n * The return type of the function is `Promise<TsConfigResult>`.\n * @throws An `Error` when the \"tsconfig.json\" file is not found.\n */\nexport const findTsConfig = async (cwd?: URL | string, options: Options = {}): Promise<TsConfigResult> => {\n const configFileName = options.configFileName ?? \"tsconfig.json\";\n\n let filePath = await findUp(configFileName, {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n\n if (!filePath) {\n filePath = await findUp(\"jsconfig.json\", {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n }\n\n if (!filePath) {\n throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);\n }\n\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : TsConfigFileCache;\n\n if (options.cache && cache.has(filePath)) {\n return cache.get(filePath) as TsConfigResult;\n }\n\n const output = {\n config: readTsConfig(filePath),\n path: filePath,\n };\n\n if (options.cache) {\n cache.set(filePath, output);\n }\n\n return output;\n};\n\n// @deprecate Please use `findTsConfig` instead.\nexport const findTSConfig = findTsConfig;\n\nexport const findTsConfigSync = (cwd?: URL | string, options: Options = {}): TsConfigResult => {\n const configFileName = options.configFileName ?? \"tsconfig.json\";\n\n let filePath = findUpSync(configFileName, {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n\n if (!filePath) {\n filePath = findUpSync(\"jsconfig.json\", {\n ...(cwd && { cwd }),\n type: \"file\",\n });\n }\n\n if (!filePath) {\n throw new NotFoundError(`No such file or directory, for ${configFileName} or jsconfig.json found.`);\n }\n\n const cache = options.cache && typeof options.cache !== \"boolean\" ? options.cache : TsConfigFileCache;\n\n if (options.cache && cache.has(filePath)) {\n return cache.get(filePath) as TsConfigResult;\n }\n\n const output = {\n config: readTsConfig(filePath),\n path: filePath,\n };\n\n if (options.cache) {\n cache.set(filePath, output);\n }\n\n return output;\n};\n\n// @deprecate Please use `findTsConfigSync` instead.\nexport const findTSConfigSync = findTsConfigSync;\n\n/**\n * An asynchronous function that writes the provided TypeScript configuration object to a tsconfig.json file.\n *\n * @param tsConfig - The TypeScript configuration object to write. The type of `tsConfig` is `TsConfigJson`.\n * @param options - Optional. The write options and the current working directory. The type of `options` is an\n * intersection type of `WriteOptions` and a Record type with an optional `cwd` key of type `string`.\n * @returns A `Promise` that resolves when the tsconfig.json file has been written.\n * The return type of function is `Promise<void>`.\n */\nexport const writeTsConfig = async (data: TsConfigJson, options: WriteJsonOptions & { cwd?: URL | string } = {}): Promise<void> => {\n const { cwd, ...writeOptions } = options;\n\n const directory = toPath(options.cwd ?? process.cwd());\n\n await writeJson(join(directory, \"tsconfig.json\"), data, writeOptions);\n};\n\n// @deprecate Please use `writeTsconfig` instead.\nexport const writeTSConfig = writeTsConfig;\n// eslint-disable-next-line import/no-unused-modules\nexport { implicitBaseUrlSymbol } from \"./read-tsconfig\";\n","/**\n * A modified version of `readTsconfig` from `https://github.com/privatenumber/get-tsconfig/blob/develop/src/parse-tsconfig/index.ts`\n *\n * MIT License\n * Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>\n */\nimport { readFileSync } from \"@visulima/fs\";\nimport { NotFoundError } from \"@visulima/fs/error\";\nimport { parse } from \"jsonc-parser\";\nimport { dirname, join, normalize, relative, resolve, toNamespacedPath } from \"pathe\";\nimport type { TsConfigJson } from \"type-fest\";\n\nimport type { TsConfigJsonResolved } from \"./types\";\nimport resolveExtendsPath from \"./utils/resolve-extends-path\";\n\ntype Options = {\n tscCompatible?: boolean;\n};\n\nconst readJsonc = (jsonPath: string) => parse(readFileSync(jsonPath) as string) as unknown;\n// eslint-disable-next-line security/detect-unsafe-regex\nconst normalizePath = (path: string): string => toNamespacedPath(/^\\.{1,2}(?:\\/.*)?$/.test(path) ? path : `./${path}`);\n\nconst resolveExtends = (extendsPath: string, fromDirectoryPath: string, circularExtendsTracker: Set<string>, options?: Options) => {\n const resolvedExtendsPath = resolveExtendsPath(extendsPath, fromDirectoryPath);\n\n if (!resolvedExtendsPath) {\n throw new NotFoundError(`No such file or directory, for '${extendsPath}' found.`);\n }\n\n if (circularExtendsTracker.has(resolvedExtendsPath)) {\n throw new Error(`Circularity detected while resolving configuration: ${resolvedExtendsPath}`);\n }\n\n circularExtendsTracker.add(resolvedExtendsPath);\n\n const extendsDirectoryPath = dirname(resolvedExtendsPath);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n const extendsConfig = internalParseTsConfig(resolvedExtendsPath, options, circularExtendsTracker);\n\n delete extendsConfig.references;\n\n const { compilerOptions } = extendsConfig;\n\n if (compilerOptions) {\n const resolvePaths = [\"baseUrl\", \"outDir\"] as const;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of resolvePaths) {\n // eslint-disable-next-line security/detect-object-injection\n const unresolvedPath = compilerOptions[property];\n\n if (unresolvedPath) {\n // eslint-disable-next-line security/detect-object-injection\n compilerOptions[property] = relative(fromDirectoryPath, join(extendsDirectoryPath, unresolvedPath)).replaceAll(\"\\\\\", \"/\") || \"./\";\n }\n }\n }\n\n if (extendsConfig.files) {\n extendsConfig.files = extendsConfig.files.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n if (extendsConfig.include) {\n extendsConfig.include = extendsConfig.include.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n if (extendsConfig.exclude) {\n extendsConfig.exclude = extendsConfig.exclude.map((file) => relative(fromDirectoryPath, join(extendsDirectoryPath, file)));\n }\n\n return extendsConfig;\n};\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst internalParseTsConfig = (tsconfigPath: string, options?: Options, circularExtendsTracker = new Set<string>()): TsConfigJsonResolved => {\n /**\n * Decided not to cache the TsConfigJsonResolved object because it's\n * mutable.\n *\n * Note how `resolveExtends` can call `readTsconfig` rescursively\n * and actually mutates the object. It can also be mutated in\n * user-land.\n *\n * By only caching fs results, we can avoid serving mutated objects\n */\n let config: TsConfigJson;\n\n try {\n config = readJsonc(tsconfigPath) || {};\n } catch {\n throw new Error(`Cannot resolve tsconfig at path: ${tsconfigPath}`);\n }\n\n if (typeof config !== \"object\") {\n throw new SyntaxError(`Failed to parse tsconfig at: ${tsconfigPath}`);\n }\n\n const directoryPath = dirname(tsconfigPath);\n\n if (config.compilerOptions) {\n const { compilerOptions } = config;\n if (compilerOptions.paths && !compilerOptions.baseUrl) {\n type WithImplicitBaseUrl = TsConfigJson.CompilerOptions & {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [implicitBaseUrlSymbol]: string;\n };\n // eslint-disable-next-line security/detect-object-injection,@typescript-eslint/no-use-before-define\n (compilerOptions as WithImplicitBaseUrl)[implicitBaseUrlSymbol] = directoryPath;\n }\n }\n\n if (config.extends) {\n const extendsPathList = Array.isArray(config.extends) ? config.extends : [config.extends];\n\n delete config.extends;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax,etc/no-assign-mutated-array\n for (const extendsPath of extendsPathList.reverse()) {\n const extendsConfig = resolveExtends(extendsPath, directoryPath, new Set(circularExtendsTracker), options);\n const merged = {\n ...extendsConfig,\n ...config,\n\n compilerOptions: {\n ...extendsConfig.compilerOptions,\n ...config.compilerOptions,\n },\n };\n\n if (extendsConfig.watchOptions) {\n merged.watchOptions = {\n ...extendsConfig.watchOptions,\n ...config.watchOptions,\n };\n }\n\n config = merged;\n }\n }\n\n if (config.compilerOptions) {\n const { compilerOptions } = config;\n const normalizedPaths = [\"baseUrl\", \"rootDir\"] as const;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of normalizedPaths) {\n // eslint-disable-next-line security/detect-object-injection\n const unresolvedPath = compilerOptions[property];\n\n if (unresolvedPath) {\n const resolvedBaseUrl = resolve(directoryPath, unresolvedPath);\n const relativeBaseUrl = relative(directoryPath, resolvedBaseUrl);\n\n // eslint-disable-next-line security/detect-object-injection\n compilerOptions[property] = normalizePath(relativeBaseUrl);\n }\n }\n\n const { outDir } = compilerOptions;\n\n if (outDir) {\n if (!Array.isArray(config.exclude)) {\n config.exclude = [];\n }\n\n if (!config.exclude.includes(outDir)) {\n config.exclude.push(outDir);\n }\n\n compilerOptions.outDir = normalizePath(outDir);\n }\n\n if (options?.tscCompatible && compilerOptions.module === \"node16\") {\n compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;\n compilerOptions.esModuleInterop = compilerOptions.esModuleInterop ?? true;\n compilerOptions.moduleDetection = compilerOptions.moduleDetection ?? \"force\";\n compilerOptions.moduleResolution = compilerOptions.moduleResolution ?? \"node16\";\n compilerOptions.target = compilerOptions.target ?? \"es2022\";\n compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.strict) {\n compilerOptions.noImplicitAny = compilerOptions.noImplicitAny ?? true;\n compilerOptions.noImplicitThis = compilerOptions.noImplicitThis ?? true;\n compilerOptions.strictNullChecks = compilerOptions.strictNullChecks ?? true;\n compilerOptions.strictFunctionTypes = compilerOptions.strictFunctionTypes ?? true;\n compilerOptions.strictBindCallApply = compilerOptions.strictBindCallApply ?? true;\n compilerOptions.strictPropertyInitialization = compilerOptions.strictPropertyInitialization ?? true;\n compilerOptions.alwaysStrict = compilerOptions.alwaysStrict ?? true;\n compilerOptions.useUnknownInCatchVariables = compilerOptions.useUnknownInCatchVariables ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.isolatedModules) {\n compilerOptions.preserveConstEnums = compilerOptions.preserveConstEnums ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.esModuleInterop) {\n compilerOptions.allowSyntheticDefaultImports = compilerOptions.allowSyntheticDefaultImports ?? true;\n }\n\n if (options?.tscCompatible && compilerOptions.target === \"esnext\") {\n compilerOptions.useDefineForClassFields = compilerOptions.useDefineForClassFields ?? true;\n }\n } else {\n config.compilerOptions = {};\n }\n\n if (config.files) {\n config.files = config.files.map((element) => normalizePath(element));\n }\n\n if (config.include) {\n config.include = config.include.map((element) => normalize(element));\n }\n\n if (config.watchOptions) {\n const { watchOptions } = config;\n\n if (watchOptions.excludeDirectories) {\n watchOptions.excludeDirectories = watchOptions.excludeDirectories.map((excludePath) => resolve(directoryPath, excludePath));\n }\n }\n\n return config;\n};\n\nexport const implicitBaseUrlSymbol = Symbol(\"implicitBaseUrl\");\nexport const readTsConfig = (tsconfigPath: string, options?: Options): TsConfigJsonResolved => internalParseTsConfig(tsconfigPath, options);\n","/**\n * A modified version of `resolveExtendsPath` from `https://github.com/privatenumber/get-tsconfig/blob/develop/src/parse-tsconfig/resolve-extends-path.ts`\n *\n * MIT License\n * Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>\n */\nimport { existsSync, statSync } from \"node:fs\";\nimport Module from \"node:module\";\nimport { isAbsolute, join, resolve } from \"node:path\";\n\nimport { findUpSync, readFileSync } from \"@visulima/fs\";\nimport { parse } from \"jsonc-parser\";\nimport type { PathConditions } from \"resolve-pkg-maps\";\nimport { resolveExports } from \"resolve-pkg-maps\";\nimport type { PackageJson } from \"type-fest\";\n\nimport type { Cache } from \"../types\";\n\nconst readJsonc = (jsonPath: string) => parse(readFileSync(jsonPath) as string) as unknown;\n\nconst getPnpApi = () => {\n const { findPnpApi } = Module;\n\n // https://yarnpkg.com/advanced/pnpapi/#requirepnpapi\n return findPnpApi?.(process.cwd());\n};\n\nconst resolveFromPackageJsonPath = (packageJsonPath: string, subpath: string, ignoreExports?: boolean, cache?: Cache<string>) => {\n const cacheKey = `resolveFromPackageJsonPath:${packageJsonPath}:${subpath}:${ignoreExports}`;\n\n if (cache?.has(cacheKey)) {\n return cache.get(cacheKey);\n }\n\n const packageJson = readJsonc(packageJsonPath);\n\n if (!packageJson) {\n return undefined;\n }\n\n let resolvedPath = subpath || \"tsconfig.json\";\n\n if (!ignoreExports && (packageJson as PackageJson).exports) {\n try {\n const [resolvedExport] = resolveExports((packageJson as PackageJson).exports as PathConditions, subpath, [\"require\", \"types\"]);\n\n resolvedPath = resolvedExport as string;\n } catch {\n // Block\n return false;\n }\n } else if (!subpath && (packageJson as PackageJson).tsconfig) {\n resolvedPath = (packageJson as PackageJson).tsconfig as string;\n }\n\n resolvedPath = join(packageJsonPath, \"..\", resolvedPath);\n\n cache?.set(cacheKey, resolvedPath);\n\n return resolvedPath;\n};\n\nconst PACKAGE_JSON = \"package.json\";\nconst TS_CONFIG_JSON = \"tsconfig.json\";\n\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst resolveExtendsPath = (requestedPath: string, directoryPath: string, cache?: Cache<string>): string | undefined => {\n let filePath = requestedPath;\n\n if (requestedPath === \"..\") {\n filePath = join(filePath, TS_CONFIG_JSON);\n }\n\n if (requestedPath.startsWith(\".\")) {\n filePath = resolve(directoryPath, filePath);\n }\n\n if (isAbsolute(filePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(filePath)) {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (statSync(filePath).isFile()) {\n return filePath;\n }\n } else if (!filePath.endsWith(\".json\")) {\n const jsonPath = `${filePath}.json`;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(jsonPath)) {\n return jsonPath;\n }\n }\n\n return undefined;\n }\n\n const [orgOrName, ...remaining] = requestedPath.split(\"/\");\n const packageName = ((orgOrName as string).startsWith(\"@\") ? `${orgOrName}/${remaining.shift()}` : orgOrName) as string;\n const subpath = remaining.join(\"/\");\n\n const pnpApi = getPnpApi();\n\n if (pnpApi) {\n const { resolveRequest: resolveWithPnp } = pnpApi;\n\n try {\n if (packageName === requestedPath) {\n const packageJsonPath = resolveWithPnp(join(packageName, PACKAGE_JSON), directoryPath);\n\n if (packageJsonPath) {\n const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath)) {\n return resolvedPath;\n }\n }\n } else {\n let resolved: string | null;\n\n try {\n resolved = resolveWithPnp(requestedPath, directoryPath, { extensions: [\".json\"] });\n } catch {\n resolved = resolveWithPnp(join(requestedPath, TS_CONFIG_JSON), directoryPath);\n }\n\n if (resolved) {\n return resolved;\n }\n }\n } catch {\n /* empty */\n }\n }\n\n const packagePath = findUpSync(\n (directory) => {\n const path = join(directory, \"node_modules\", packageName);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(path)) {\n return join(\"node_modules\", packageName);\n }\n\n return undefined;\n },\n {\n cwd: directoryPath,\n type: \"directory\",\n },\n );\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!packagePath || !statSync(packagePath).isDirectory()) {\n return undefined;\n }\n\n const packageJsonPath = join(packagePath, PACKAGE_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(packageJsonPath)) {\n const resolvedPath = resolveFromPackageJsonPath(packageJsonPath, subpath, false, cache);\n\n // Blocked\n if (resolvedPath === false) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath) && statSync(resolvedPath).isFile()) {\n return resolvedPath;\n }\n }\n\n const fullPackagePath = join(packagePath, subpath);\n const jsonExtension = fullPackagePath.endsWith(\".json\");\n\n if (!jsonExtension) {\n const fullPackagePathWithJson = `${fullPackagePath}.json`;\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(fullPackagePathWithJson)) {\n return fullPackagePathWithJson;\n }\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(fullPackagePath)) {\n return undefined;\n }\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (statSync(fullPackagePath).isDirectory()) {\n const fullPackageJsonPath = join(fullPackagePath, PACKAGE_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(fullPackageJsonPath)) {\n const resolvedPath = resolveFromPackageJsonPath(fullPackageJsonPath, \"\", true, cache);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (resolvedPath && existsSync(resolvedPath)) {\n return resolvedPath;\n }\n }\n\n const tsconfigPath = join(fullPackagePath, TS_CONFIG_JSON);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(tsconfigPath)) {\n return tsconfigPath;\n }\n } else if (jsonExtension) {\n return fullPackagePath;\n }\n\n return undefined;\n};\n\nexport default resolveExtendsPath;\n"]}
|
package/dist/chunk-7IOK6YPW.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkIK5YSYLX_cjs = require('./chunk-IK5YSYLX.cjs');
|
|
4
|
-
|
|
5
|
-
// src/error/package-not-found-error.ts
|
|
6
|
-
var PackageNotFoundError = class extends Error {
|
|
7
|
-
/**
|
|
8
|
-
* @param {string} packageName - The name of the package that was not found.
|
|
9
|
-
* @param {string} packageManager - The package manager used to install the package.
|
|
10
|
-
*/
|
|
11
|
-
constructor(packageName, packageManager) {
|
|
12
|
-
if (typeof packageName === "string") {
|
|
13
|
-
packageName = [packageName];
|
|
14
|
-
}
|
|
15
|
-
if (packageName.length === 0) {
|
|
16
|
-
super("Package was not found.");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (packageManager === void 0) {
|
|
20
|
-
try {
|
|
21
|
-
const foundManager = chunkIK5YSYLX_cjs.findPackageManagerSync();
|
|
22
|
-
packageManager = foundManager.packageManager;
|
|
23
|
-
} catch {
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (packageManager === void 0) {
|
|
27
|
-
packageManager = "npm";
|
|
28
|
-
}
|
|
29
|
-
super(`Package '${packageName.join(" ")}' was not found. Please install it using '${packageManager} install ${packageName.join(" ")}'`);
|
|
30
|
-
}
|
|
31
|
-
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style
|
|
32
|
-
get code() {
|
|
33
|
-
return "PACKAGE_NOT_FOUND";
|
|
34
|
-
}
|
|
35
|
-
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
|
|
36
|
-
set code(_name) {
|
|
37
|
-
throw new Error("Cannot overwrite code PACKAGE_NOT_FOUND");
|
|
38
|
-
}
|
|
39
|
-
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style
|
|
40
|
-
get name() {
|
|
41
|
-
return "PackageNotFoundError";
|
|
42
|
-
}
|
|
43
|
-
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
|
|
44
|
-
set name(_name) {
|
|
45
|
-
throw new Error("Cannot overwrite name of PackageNotFoundError");
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var package_not_found_error_default = PackageNotFoundError;
|
|
49
|
-
|
|
50
|
-
exports.package_not_found_error_default = package_not_found_error_default;
|
|
51
|
-
//# sourceMappingURL=out.js.map
|
|
52
|
-
//# sourceMappingURL=chunk-7IOK6YPW.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/error/package-not-found-error.ts"],"names":[],"mappings":";;;;;AAKA,IAAM,uBAAN,cAAmC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAK9B,YAAY,aAAgC,gBAAyB;AACxE,QAAI,OAAO,gBAAgB,UAAU;AAEjC,oBAAc,CAAC,WAAW;AAAA,IAC9B;AAEA,QAAI,YAAY,WAAW,GAAG;AAC1B,YAAM,wBAAwB;AAC9B;AAAA,IACJ;AAEA,QAAI,mBAAmB,QAAW;AAC9B,UAAI;AACA,cAAM,eAAe,uBAAuB;AAG5C,yBAAiB,aAAa;AAAA,MAClC,QAAQ;AAAA,MAER;AAAA,IACJ;AAEA,QAAI,mBAAmB,QAAW;AAE9B,uBAAiB;AAAA,IACrB;AAEA,UAAM,YAAY,YAAY,KAAK,GAAG,CAAC,6CAA6C,cAAc,YAAY,YAAY,KAAK,GAAG,CAAC,GAAG;AAAA,EAC1I;AAAA;AAAA,EAGA,IAAW,OAAe;AACtB,WAAO;AAAA,EACX;AAAA;AAAA,EAGA,IAAW,KAAK,OAAO;AACnB,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC7D;AAAA;AAAA,EAGA,IAAoB,OAAe;AAC/B,WAAO;AAAA,EACX;AAAA;AAAA,EAGA,IAAoB,KAAK,OAAO;AAC5B,UAAM,IAAI,MAAM,+CAA+C;AAAA,EACnE;AACJ;AAEA,IAAO,kCAAQ","sourcesContent":["import { findPackageManagerSync } from \"../package-manager\";\n\n/**\n * Error thrown when a package was not found.\n */\nclass PackageNotFoundError extends Error {\n /**\n * @param {string} packageName - The name of the package that was not found.\n * @param {string} packageManager - The package manager used to install the package.\n */\n public constructor(packageName: string[] | string, packageManager?: string) {\n if (typeof packageName === \"string\") {\n // eslint-disable-next-line no-param-reassign\n packageName = [packageName];\n }\n\n if (packageName.length === 0) {\n super(\"Package was not found.\");\n return;\n }\n\n if (packageManager === undefined) {\n try {\n const foundManager = findPackageManagerSync();\n\n // eslint-disable-next-line no-param-reassign\n packageManager = foundManager.packageManager;\n } catch {\n // Empty\n }\n }\n\n if (packageManager === undefined) {\n // eslint-disable-next-line no-param-reassign\n packageManager = \"npm\";\n }\n\n super(`Package '${packageName.join(\" \")}' was not found. Please install it using '${packageManager} install ${packageName.join(\" \")}'`);\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public get code(): string {\n return \"PACKAGE_NOT_FOUND\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public set code(_name) {\n throw new Error(\"Cannot overwrite code PACKAGE_NOT_FOUND\");\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/class-literal-property-style\n public override get name(): string {\n return \"PackageNotFoundError\";\n }\n\n // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types\n public override set name(_name) {\n throw new Error(\"Cannot overwrite name of PackageNotFoundError\");\n }\n}\n\nexport default PackageNotFoundError;\n"]}
|