@nx/js 22.7.0-beta.5 → 22.7.0-beta.7
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/migrations.json +9 -0
- package/package.json +7 -8
- package/src/plugins/typescript/plugin.js +7 -2
- package/src/utils/assets/copy-assets-handler.d.ts +3 -1
- package/src/utils/assets/copy-assets-handler.d.ts.map +1 -1
- package/src/utils/assets/copy-assets-handler.js +6 -38
- package/src/utils/assets/normalize-assets.d.ts +26 -0
- package/src/utils/assets/normalize-assets.d.ts.map +1 -0
- package/src/utils/assets/normalize-assets.js +47 -0
- package/src/utils/find-npm-dependencies.js +1 -1
- package/src/utils/test-fixtures/tsconfig.json +5 -0
- package/src/utils/typescript/test-fixtures/tsconfig.json +11 -0
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"Backend"
|
|
20
20
|
],
|
|
21
21
|
"main": "src/index.js",
|
|
22
|
-
"
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"types": "src/index.d.ts",
|
|
23
24
|
"license": "MIT",
|
|
24
25
|
"bugs": {
|
|
25
26
|
"url": "https://github.com/nrwl/nx/issues"
|
|
@@ -39,8 +40,8 @@
|
|
|
39
40
|
"@babel/preset-env": "^7.23.2",
|
|
40
41
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
42
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "22.7.0-beta.
|
|
43
|
-
"@nx/workspace": "22.7.0-beta.
|
|
43
|
+
"@nx/devkit": "22.7.0-beta.7",
|
|
44
|
+
"@nx/workspace": "22.7.0-beta.7",
|
|
44
45
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
47
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"tslib": "^2.3.0"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"nx": "22.7.0-beta.
|
|
64
|
+
"nx": "22.7.0-beta.7"
|
|
64
65
|
},
|
|
65
66
|
"peerDependencies": {
|
|
66
67
|
"verdaccio": "^6.0.5"
|
|
@@ -72,7 +73,5 @@
|
|
|
72
73
|
},
|
|
73
74
|
"publishConfig": {
|
|
74
75
|
"access": "public"
|
|
75
|
-
}
|
|
76
|
-
"types": "src/index.d.ts",
|
|
77
|
-
"type": "commonjs"
|
|
76
|
+
}
|
|
78
77
|
}
|
|
@@ -466,7 +466,7 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
|
|
|
466
466
|
transitive: true,
|
|
467
467
|
});
|
|
468
468
|
inputs.push({
|
|
469
|
-
fileset: '
|
|
469
|
+
fileset: '{projectRoot}/**/*.d.ts',
|
|
470
470
|
dependencies: true,
|
|
471
471
|
});
|
|
472
472
|
const externalRefPatterns = getExternalProjectReferenceTsconfigPatterns(tsConfig, internalProjectReferences, workspaceRoot, config.project, cache);
|
|
@@ -509,7 +509,12 @@ function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRo
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
else {
|
|
512
|
-
|
|
512
|
+
// List specific tsc output extensions instead of claiming the
|
|
513
|
+
// entire outDir, so other tasks that write into the same
|
|
514
|
+
// directory (e.g. copy-assets for .node/.wasm files) don't
|
|
515
|
+
// have their outputs captured by the tsc build cache.
|
|
516
|
+
const jsonExt = tsConfig.options.resolveJsonModule ? ',json' : '';
|
|
517
|
+
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, `**/*.{js,cjs,mjs,jsx${jsonExt},d.ts,d.cts,d.mts}{,.map}`), workspaceRoot, config.project));
|
|
513
518
|
}
|
|
514
519
|
if (tsConfig.options.tsBuildInfoFile) {
|
|
515
520
|
if (emitDeclarationOnly ||
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { AssetGlob } from './assets';
|
|
2
|
+
import { normalizeAssets, getAssetOutputPath, NormalizedAssetEntry as AssetEntry } from './normalize-assets';
|
|
2
3
|
import { ChangedFile } from 'nx/src/daemon/client/client';
|
|
4
|
+
export type { AssetEntry };
|
|
5
|
+
export { normalizeAssets, getAssetOutputPath };
|
|
3
6
|
export type FileEventType = 'create' | 'update' | 'delete';
|
|
4
7
|
export interface FileEvent {
|
|
5
8
|
type: FileEventType;
|
|
@@ -32,5 +35,4 @@ export declare class CopyAssetsHandler {
|
|
|
32
35
|
private filesToEvent;
|
|
33
36
|
private normalizeAssetPattern;
|
|
34
37
|
}
|
|
35
|
-
export {};
|
|
36
38
|
//# sourceMappingURL=copy-assets-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,oBAAoB,IAAI,UAAU,EACnC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AAGxE,YAAY,EAAE,UAAU,EAAE,CAAC;AAC3B,O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qBAAqB;CAG9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CopyAssetsHandler = exports.defaultFileEventHandler = void 0;
|
|
3
|
+
exports.CopyAssetsHandler = exports.defaultFileEventHandler = exports.getAssetOutputPath = exports.normalizeAssets = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const picomatch = require("picomatch");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
@@ -8,6 +8,9 @@ const pathPosix = tslib_1.__importStar(require("node:path/posix"));
|
|
|
8
8
|
const path = tslib_1.__importStar(require("node:path"));
|
|
9
9
|
const ignore_1 = tslib_1.__importDefault(require("ignore"));
|
|
10
10
|
const tinyglobby_1 = require("tinyglobby");
|
|
11
|
+
const normalize_assets_1 = require("./normalize-assets");
|
|
12
|
+
Object.defineProperty(exports, "normalizeAssets", { enumerable: true, get: function () { return normalize_assets_1.normalizeAssets; } });
|
|
13
|
+
Object.defineProperty(exports, "getAssetOutputPath", { enumerable: true, get: function () { return normalize_assets_1.getAssetOutputPath; } });
|
|
11
14
|
const devkit_1 = require("@nx/devkit");
|
|
12
15
|
const client_1 = require("nx/src/daemon/client/client");
|
|
13
16
|
const picocolors_1 = require("picocolors");
|
|
@@ -49,40 +52,7 @@ class CopyAssetsHandler {
|
|
|
49
52
|
if ((0, node_fs_1.existsSync)(nxignore)) {
|
|
50
53
|
this.ignore.add((0, node_fs_1.readFileSync)(nxignore).toString());
|
|
51
54
|
}
|
|
52
|
-
this.assetGlobs = opts.assets.
|
|
53
|
-
let isGlob = false;
|
|
54
|
-
let pattern;
|
|
55
|
-
// Input and output directories are normalized to be relative to root
|
|
56
|
-
let input;
|
|
57
|
-
let output;
|
|
58
|
-
let ignore = null;
|
|
59
|
-
let includeIgnoredFiles = undefined;
|
|
60
|
-
const resolvedOutputDir = path.isAbsolute(opts.outputDir)
|
|
61
|
-
? opts.outputDir
|
|
62
|
-
: path.resolve(opts.rootDir, opts.outputDir);
|
|
63
|
-
if (typeof f === 'string') {
|
|
64
|
-
pattern = f;
|
|
65
|
-
input = path.relative(opts.rootDir, opts.projectDir);
|
|
66
|
-
output = path.relative(opts.rootDir, resolvedOutputDir);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
isGlob = true;
|
|
70
|
-
pattern = pathPosix.join(f.input, f.glob);
|
|
71
|
-
input = f.input;
|
|
72
|
-
output = pathPosix.join(path.relative(opts.rootDir, resolvedOutputDir), f.output);
|
|
73
|
-
if (f.ignore)
|
|
74
|
-
ignore = f.ignore.map((ig) => pathPosix.join(f.input, ig));
|
|
75
|
-
includeIgnoredFiles = f.includeIgnoredFiles;
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
isGlob,
|
|
79
|
-
input,
|
|
80
|
-
pattern,
|
|
81
|
-
ignore,
|
|
82
|
-
output,
|
|
83
|
-
includeIgnoredFiles,
|
|
84
|
-
};
|
|
85
|
-
});
|
|
55
|
+
this.assetGlobs = (0, normalize_assets_1.normalizeAssets)(opts.assets, opts.rootDir, opts.projectDir, opts.outputDir);
|
|
86
56
|
}
|
|
87
57
|
async processAllAssetsOnce() {
|
|
88
58
|
await Promise.all(this.assetGlobs.map(async (ag) => {
|
|
@@ -181,12 +151,10 @@ class CopyAssetsHandler {
|
|
|
181
151
|
if (!assetGlob.ignore?.some((ig) => picomatch(ig)(src)) &&
|
|
182
152
|
((assetGlob.includeIgnoredFiles ?? this.includeIgnoredFiles) ||
|
|
183
153
|
!this.ignore.ignores(src))) {
|
|
184
|
-
const relPath = path.relative(assetGlob.input, src);
|
|
185
|
-
const dest = relPath.startsWith('..') ? src : relPath;
|
|
186
154
|
acc.push({
|
|
187
155
|
type: 'create',
|
|
188
156
|
src: path.join(this.rootDir, src),
|
|
189
|
-
dest: path.join(this.rootDir,
|
|
157
|
+
dest: path.join(this.rootDir, (0, normalize_assets_1.getAssetOutputPath)(src, assetGlob)),
|
|
190
158
|
});
|
|
191
159
|
}
|
|
192
160
|
return acc;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface AssetGlobInput {
|
|
2
|
+
input: string;
|
|
3
|
+
output: string;
|
|
4
|
+
glob: string;
|
|
5
|
+
ignore?: string[];
|
|
6
|
+
includeIgnoredFiles?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface NormalizedAssetEntry {
|
|
9
|
+
isGlob: boolean;
|
|
10
|
+
pattern: string;
|
|
11
|
+
ignore: string[] | null;
|
|
12
|
+
input: string;
|
|
13
|
+
output: string;
|
|
14
|
+
includeIgnoredFiles?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Normalize raw asset definitions (strings or objects) into resolved
|
|
18
|
+
* entries with computed input, output, and pattern fields.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeAssets(assets: (string | AssetGlobInput)[], rootDir: string, projectDir: string, outputDir: string): NormalizedAssetEntry[];
|
|
21
|
+
/**
|
|
22
|
+
* Compute the output path for a file given its asset entry,
|
|
23
|
+
* matching the dest logic used during file copying.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAssetOutputPath(src: string, assetEntry: NormalizedAssetEntry): string;
|
|
26
|
+
//# sourceMappingURL=normalize-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-assets.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/normalize-assets.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,EACnC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,oBAAoB,EAAE,CA8BxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,oBAAoB,GAC/B,MAAM,CAIR"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeAssets = normalizeAssets;
|
|
4
|
+
exports.getAssetOutputPath = getAssetOutputPath;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
+
const pathPosix = tslib_1.__importStar(require("node:path/posix"));
|
|
8
|
+
/**
|
|
9
|
+
* Normalize raw asset definitions (strings or objects) into resolved
|
|
10
|
+
* entries with computed input, output, and pattern fields.
|
|
11
|
+
*/
|
|
12
|
+
function normalizeAssets(assets, rootDir, projectDir, outputDir) {
|
|
13
|
+
const resolvedOutputDir = path.isAbsolute(outputDir)
|
|
14
|
+
? outputDir
|
|
15
|
+
: path.resolve(rootDir, outputDir);
|
|
16
|
+
return assets.map((f) => {
|
|
17
|
+
if (typeof f === 'string') {
|
|
18
|
+
return {
|
|
19
|
+
isGlob: false,
|
|
20
|
+
pattern: f,
|
|
21
|
+
input: path.relative(rootDir, projectDir),
|
|
22
|
+
output: path.relative(rootDir, resolvedOutputDir),
|
|
23
|
+
ignore: null,
|
|
24
|
+
includeIgnoredFiles: undefined,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
isGlob: true,
|
|
29
|
+
pattern: pathPosix.join(f.input, f.glob),
|
|
30
|
+
input: f.input,
|
|
31
|
+
output: pathPosix.join(path.relative(rootDir, resolvedOutputDir), f.output),
|
|
32
|
+
ignore: f.ignore
|
|
33
|
+
? f.ignore.map((ig) => pathPosix.join(f.input, ig))
|
|
34
|
+
: null,
|
|
35
|
+
includeIgnoredFiles: f.includeIgnoredFiles,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compute the output path for a file given its asset entry,
|
|
41
|
+
* matching the dest logic used during file copying.
|
|
42
|
+
*/
|
|
43
|
+
function getAssetOutputPath(src, assetEntry) {
|
|
44
|
+
const relPath = path.relative(assetEntry.input, src);
|
|
45
|
+
const dest = relPath.startsWith('..') ? src : relPath;
|
|
46
|
+
return pathPosix.join(assetEntry.output, dest);
|
|
47
|
+
}
|
|
@@ -150,7 +150,7 @@ function collectHelperDependencies(workspaceRoot, sourceProject, projectGraph, b
|
|
|
150
150
|
}
|
|
151
151
|
// For inferred targets or manually added run-commands, check if user is using `tsc` in build target.
|
|
152
152
|
if (target.executor === 'nx:run-commands' &&
|
|
153
|
-
/\
|
|
153
|
+
/\b(tsc|tsgo)\b/.test(target.options.command)) {
|
|
154
154
|
const tsConfigFileName = (0, ts_config_1.getRootTsConfigFileName)();
|
|
155
155
|
if (tsConfigFileName) {
|
|
156
156
|
const tsConfig = (0, ts_config_1.readTsConfig)((0, path_1.join)(workspaceRoot, tsConfigFileName));
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const swcHelpersVersion = "~0.5.18";
|
|
|
7
7
|
export declare const swcNodeVersion = "~1.11.1";
|
|
8
8
|
export declare const tsLibVersion = "^2.3.0";
|
|
9
9
|
export declare const typesNodeVersion = "20.19.9";
|
|
10
|
-
export declare const verdaccioVersion = "^6.
|
|
10
|
+
export declare const verdaccioVersion = "^6.3.2";
|
|
11
11
|
export declare const typescriptVersion = "~5.9.2";
|
|
12
12
|
/**
|
|
13
13
|
* The minimum version is currently determined from the lowest version
|
package/src/utils/versions.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.swcHelpersVersion = '~0.5.18';
|
|
|
10
10
|
exports.swcNodeVersion = '~1.11.1';
|
|
11
11
|
exports.tsLibVersion = '^2.3.0';
|
|
12
12
|
exports.typesNodeVersion = '20.19.9';
|
|
13
|
-
exports.verdaccioVersion = '^6.
|
|
13
|
+
exports.verdaccioVersion = '^6.3.2';
|
|
14
14
|
// Typescript
|
|
15
15
|
exports.typescriptVersion = '~5.9.2';
|
|
16
16
|
/**
|