@nx/devkit 21.3.0-canary.20250626-8b6ad42 → 21.3.0-canary.20250628-7430238
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/devkit",
|
3
|
-
"version": "21.3.0-canary.
|
3
|
+
"version": "21.3.0-canary.20250628-7430238",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
6
6
|
"repository": {
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"enquirer": "~2.3.6"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
|
-
"nx": "21.3.0-canary.
|
41
|
+
"nx": "21.3.0-canary.20250628-7430238"
|
42
42
|
},
|
43
43
|
"publishConfig": {
|
44
44
|
"access": "public"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export declare let dynamicImport: Function;
|
2
|
-
export declare function loadConfigFile<T extends object = any>(configFilePath: string): Promise<T>;
|
2
|
+
export declare function loadConfigFile<T extends object = any>(configFilePath: string, tsconfigFileNames?: string[]): Promise<T>;
|
3
3
|
export declare function getRootTsConfigPath(): string | null;
|
4
4
|
export declare function getRootTsConfigFileName(): string | null;
|
5
5
|
export declare function clearRequireCache(): void;
|
@@ -11,22 +11,22 @@ const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
11
11
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
12
12
|
const path_1 = require("path");
|
13
13
|
exports.dynamicImport = new Function('modulePath', 'return import(modulePath);');
|
14
|
-
async function loadConfigFile(configFilePath) {
|
14
|
+
async function loadConfigFile(configFilePath, tsconfigFileNames) {
|
15
15
|
const extension = (0, path_1.extname)(configFilePath);
|
16
|
-
const module = await loadModule(configFilePath, extension);
|
16
|
+
const module = await loadModule(configFilePath, extension, tsconfigFileNames);
|
17
17
|
return module.default ?? module;
|
18
18
|
}
|
19
|
-
async function loadModule(path, extension) {
|
19
|
+
async function loadModule(path, extension, tsconfigFileNames) {
|
20
20
|
if (isTypeScriptFile(extension)) {
|
21
|
-
return await loadTypeScriptModule(path, extension);
|
21
|
+
return await loadTypeScriptModule(path, extension, tsconfigFileNames);
|
22
22
|
}
|
23
23
|
return await loadJavaScriptModule(path, extension);
|
24
24
|
}
|
25
25
|
function isTypeScriptFile(extension) {
|
26
26
|
return extension.endsWith('ts');
|
27
27
|
}
|
28
|
-
async function loadTypeScriptModule(path, extension) {
|
29
|
-
const tsConfigPath = getTypeScriptConfigPath(path);
|
28
|
+
async function loadTypeScriptModule(path, extension, tsconfigFileNames) {
|
29
|
+
const tsConfigPath = getTypeScriptConfigPath(path, tsconfigFileNames);
|
30
30
|
if (tsConfigPath) {
|
31
31
|
const unregisterTsProject = (0, devkit_internals_1.registerTsProject)(tsConfigPath);
|
32
32
|
try {
|
@@ -38,10 +38,11 @@ async function loadTypeScriptModule(path, extension) {
|
|
38
38
|
}
|
39
39
|
return await loadModuleByExtension(path, extension);
|
40
40
|
}
|
41
|
-
function getTypeScriptConfigPath(path) {
|
41
|
+
function getTypeScriptConfigPath(path, tsconfigFileNames) {
|
42
42
|
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.dirname)(path));
|
43
|
-
|
44
|
-
|
43
|
+
const tsConfigFileName = (tsconfigFileNames ?? ['tsconfig.json']).find((name) => siblingFiles.includes(name));
|
44
|
+
return tsConfigFileName
|
45
|
+
? (0, path_1.join)((0, path_1.dirname)(path), tsConfigFileName)
|
45
46
|
: getRootTsConfigPath();
|
46
47
|
}
|
47
48
|
async function loadJavaScriptModule(path, extension) {
|