@k8slens/typescript 8.1.0 → 8.1.1
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 +2 -0
- package/bin/build-types +4 -2
- package/lib/tsconfig-include.js +44 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
## [8.1.1](https://github.com/lensapp/lens-desktop-monorepo/compare/@k8slens/typescript@8.1.0...@k8slens/typescript@8.1.1) (2026-10-26)
|
|
2
|
+
|
|
1
3
|
## [8.1.0](https://github.com/lensapp/lens-desktop-monorepo/compare/@k8slens/typescript@8.0.0...@k8slens/typescript@8.1.0) (2026-10-16)
|
|
2
4
|
|
|
3
5
|
|
package/bin/build-types
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
const child_process = require("child_process");
|
|
4
4
|
const util = require("util");
|
|
5
5
|
const { readFile } = require("fs/promises");
|
|
6
|
+
const path = require("path");
|
|
6
7
|
const { exists: existsWithCallback } = require("fs");
|
|
7
8
|
const json5 = require("json5");
|
|
8
9
|
const assert = require("assert");
|
|
9
|
-
const { flatMap, map, filter, values, reject, endsWith
|
|
10
|
+
const { flatMap, map, filter, values, reject, endsWith } = require("lodash/fp");
|
|
10
11
|
|
|
11
12
|
// Local async-aware pipeline (applies fns left-to-right, awaiting between steps).
|
|
12
13
|
// Deliberately not @k8slens/fp: the vendored ogre-tools packages build with this
|
|
@@ -22,6 +23,7 @@ const pipeline = async (value, ...fns) => {
|
|
|
22
23
|
};
|
|
23
24
|
const yargs = require("yargs");
|
|
24
25
|
const { generateCssModuleTypes } = require("../lib/css-module-types");
|
|
26
|
+
const { includeOf } = require("../lib/tsconfig-include");
|
|
25
27
|
|
|
26
28
|
const exec = util.promisify(child_process.exec);
|
|
27
29
|
const exists = util.promisify(existsWithCallback);
|
|
@@ -70,7 +72,7 @@ const checkThatAllExportedTypesGotCompiled = async (packageJson) => {
|
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
const checkTsconfig = async (args) => {
|
|
73
|
-
const tsconfig = await
|
|
75
|
+
const tsconfig = { include: await includeOf(path.resolve(args.tsconfig)) };
|
|
74
76
|
|
|
75
77
|
assert(Array.isArray(tsconfig.include), "include MUST be an array in " + process.cwd());
|
|
76
78
|
assert(tsconfig.include.length > 0, "include MUST NOT be empty in " + process.cwd());
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const { readFile } = require("fs/promises");
|
|
2
|
+
const { createRequire } = require("module");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const json5 = require("json5");
|
|
5
|
+
|
|
6
|
+
const resolveExtended = (extended, fromDirectory) => {
|
|
7
|
+
const withExtension = extended.endsWith(".json") ? extended : `${extended}.json`;
|
|
8
|
+
|
|
9
|
+
return extended.startsWith(".") || path.isAbsolute(extended)
|
|
10
|
+
? path.resolve(fromDirectory, withExtension)
|
|
11
|
+
: createRequire(path.join(fromDirectory, "tsconfig.json")).resolve(withExtension);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const ownOrExtendedIncludeOf = async (tsconfigPath) => {
|
|
15
|
+
const tsconfig = json5.parse(await readFile(tsconfigPath, "utf-8"));
|
|
16
|
+
|
|
17
|
+
if (tsconfig.include !== undefined) {
|
|
18
|
+
return tsconfig.include;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Later entries of an "extends" array override earlier ones, so the last one with an "include" wins.
|
|
22
|
+
for (const extended of [tsconfig.extends ?? []].flat().reverse()) {
|
|
23
|
+
const include = await ownOrExtendedIncludeOf(resolveExtended(extended, path.dirname(tsconfigPath)));
|
|
24
|
+
|
|
25
|
+
if (include !== undefined) {
|
|
26
|
+
return include;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The "include" a tsconfig ends up with: its own, or else the nearest one it extends, with
|
|
35
|
+
* "${configDir}" as the directory of the tsconfig itself, wherever the "include" comes from. Read
|
|
36
|
+
* here rather than asked of "tsc --showConfig": tsrs has no --showConfig, and a compiler process per
|
|
37
|
+
* package only to read a json file cost a third of a second per package.
|
|
38
|
+
*/
|
|
39
|
+
const includeOf = async (tsconfigPath) =>
|
|
40
|
+
(await ownOrExtendedIncludeOf(tsconfigPath))?.map((item) =>
|
|
41
|
+
typeof item === "string" ? item.replaceAll("${configDir}", ".") : item,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
module.exports = { includeOf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8slens/typescript",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"lens": {
|
|
5
5
|
"env": "agnostic",
|
|
6
6
|
"layer": "infrastructure",
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"bin",
|
|
27
27
|
"lib",
|
|
28
|
+
"!lib/**/*.test.js",
|
|
28
29
|
"config",
|
|
29
30
|
"CHANGELOG.md"
|
|
30
31
|
],
|
|
31
32
|
"scripts": {
|
|
32
|
-
"clean": ""
|
|
33
|
+
"clean": "",
|
|
34
|
+
"test:unit": "jest"
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"json5": "^2.2.3",
|