nx 23.0.0-beta.15 → 23.0.0-beta.17
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/src/command-line/format/format.js +15 -5
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +7 -19
- package/dist/src/command-line/release/version/version-actions.js +3 -7
- package/dist/src/command-line/report/report.js +0 -1
- package/dist/src/config/schema-utils.js +11 -6
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/devkit-internals.d.ts +1 -1
- package/dist/src/devkit-internals.js +4 -1
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/utils/register.d.ts +103 -14
- package/dist/src/plugins/js/utils/register.js +434 -39
- package/dist/src/plugins/js/utils/typescript.d.ts +7 -0
- package/dist/src/plugins/js/utils/typescript.js +39 -0
- package/dist/src/project-graph/plugins/resolve-plugin.d.ts +7 -4
- package/dist/src/project-graph/plugins/resolve-plugin.js +172 -33
- package/dist/src/project-graph/plugins/transpiler.d.ts +12 -0
- package/dist/src/project-graph/plugins/transpiler.js +37 -0
- package/dist/src/tasks-runner/tasks-schedule.js +3 -3
- package/dist/src/utils/handle-import.d.ts +4 -1
- package/dist/src/utils/handle-import.js +56 -2
- package/migrations.json +1 -1
- package/package.json +11 -11
- package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +0 -7
- package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +0 -155
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +0 -16
- package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +0 -121
|
@@ -34,10 +34,15 @@ async function format(command, args) {
|
|
|
34
34
|
process.exit(1);
|
|
35
35
|
}
|
|
36
36
|
const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
|
|
37
|
-
const patterns = (await getPatterns(prettier, { ...args, ...nxArgs })).map(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const patterns = (await getPatterns(prettier, { ...args, ...nxArgs })).map((p) => {
|
|
38
|
+
// On non-Windows, escape $ to prevent shell variable interpolation
|
|
39
|
+
// (the shell consumes one \, so \\$ becomes \$ which the shell treats as literal $)
|
|
40
|
+
// On Windows (cmd.exe), $ is not a special character, so escaping it would
|
|
41
|
+
// cause prettier to look for a file with a literal \$ in the name
|
|
42
|
+
// prettier-ignore
|
|
43
|
+
const escaped = process.platform !== 'win32' ? p.replace(/\$/g, '\\\$') : p;
|
|
44
|
+
return `"${escaped}"`;
|
|
45
|
+
});
|
|
41
46
|
// Chunkify the patterns array to prevent crashing the windows terminal
|
|
42
47
|
const chunkList = (0, chunkify_1.chunkify)(patterns);
|
|
43
48
|
switch (command) {
|
|
@@ -204,7 +209,12 @@ function getPrettierPath() {
|
|
|
204
209
|
return prettierPath;
|
|
205
210
|
}
|
|
206
211
|
const { packageJson, path: packageJsonPath } = (0, package_json_1.readModulePackageJson)('prettier');
|
|
207
|
-
|
|
212
|
+
const bin = packageJson.bin;
|
|
213
|
+
const binPath = typeof bin === 'string' ? bin : bin?.['prettier'];
|
|
214
|
+
if (!binPath) {
|
|
215
|
+
throw new Error(`Could not find prettier binary in ${packageJsonPath}`);
|
|
216
|
+
}
|
|
217
|
+
prettierPath = path.resolve(path.dirname(packageJsonPath), binPath);
|
|
208
218
|
return prettierPath;
|
|
209
219
|
}
|
|
210
220
|
let useListDifferent;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveChangelogRenderer = resolveChangelogRenderer;
|
|
4
4
|
const register_1 = require("../../../plugins/js/utils/register");
|
|
5
|
-
const typescript_1 = require("../../../plugins/js/utils/typescript");
|
|
6
5
|
const utils_1 = require("../../../tasks-runner/utils");
|
|
7
6
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
8
7
|
function resolveChangelogRenderer(changelogRendererPathOrImplementation) {
|
|
@@ -13,22 +12,11 @@ function resolveChangelogRenderer(changelogRendererPathOrImplementation) {
|
|
|
13
12
|
const interpolatedChangelogRendererPath = (0, utils_1.interpolate)(changelogRendererPathOrImplementation, {
|
|
14
13
|
workspaceRoot: workspace_root_1.workspaceRoot,
|
|
15
14
|
});
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
const r = require(interpolatedChangelogRendererPath);
|
|
25
|
-
ChangelogRendererClass = r.default || r;
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
throw err;
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
cleanupTranspiler();
|
|
32
|
-
}
|
|
33
|
-
return ChangelogRendererClass;
|
|
15
|
+
// TS renderers go through loadTsFile (native-strip -> swc/ts-node + paths).
|
|
16
|
+
// JS renderers use require() with a lazy tsconfig-paths fallback so workspace
|
|
17
|
+
// alias imports still resolve, without paying registration cost up front.
|
|
18
|
+
const r = /\.[cm]?ts$/.test(interpolatedChangelogRendererPath)
|
|
19
|
+
? (0, register_1.loadTsFile)(interpolatedChangelogRendererPath)
|
|
20
|
+
: (0, register_1.requireWithTsconfigFallback)(interpolatedChangelogRendererPath);
|
|
21
|
+
return r.default || r;
|
|
34
22
|
}
|
|
@@ -4,7 +4,6 @@ exports.NOOP_VERSION_ACTIONS = exports.VersionActions = void 0;
|
|
|
4
4
|
exports.resolveVersionActionsForProject = resolveVersionActionsForProject;
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const register_1 = require("../../../plugins/js/utils/register");
|
|
7
|
-
const typescript_1 = require("../../../plugins/js/utils/typescript");
|
|
8
7
|
const utils_1 = require("../../../tasks-runner/utils");
|
|
9
8
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
10
9
|
const config_1 = require("../config/config");
|
|
@@ -52,12 +51,9 @@ async function resolveVersionActionsForProject(tree, releaseGroup, projectGraphN
|
|
|
52
51
|
afterAllProjectsVersioned = cachedData.afterAllProjectsVersioned;
|
|
53
52
|
}
|
|
54
53
|
else {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
const loaded = require(versionActionsPath);
|
|
60
|
-
cleanupTranspiler?.();
|
|
54
|
+
const loaded = /\.[cm]?ts$/.test(versionActionsPath)
|
|
55
|
+
? (0, register_1.loadTsFile)(versionActionsPath)
|
|
56
|
+
: (0, register_1.requireWithTsconfigFallback)(versionActionsPath);
|
|
61
57
|
VersionActionsClass = loaded.default ?? loaded;
|
|
62
58
|
if (!VersionActionsClass) {
|
|
63
59
|
throw new Error(`For project "${projectGraphNode.name}" it was not possible to resolve the VersionActions implementation from: "${versionActionsPath}"`);
|
|
@@ -383,7 +383,6 @@ function findRegisteredPluginsBeingUsed(nxJson) {
|
|
|
383
383
|
}
|
|
384
384
|
function findInstalledPackagesWeCareAbout() {
|
|
385
385
|
const packagesWeMayCareAbout = {};
|
|
386
|
-
// TODO (v20): Remove workaround for hiding @nrwl packages when matching @nx package is found.
|
|
387
386
|
for (const pkg of exports.packagesWeCareAbout) {
|
|
388
387
|
const v = readPackageVersion(pkg);
|
|
389
388
|
if (v) {
|
|
@@ -6,8 +6,9 @@ exports.resolveSchema = resolveSchema;
|
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const resolve_exports_1 = require("resolve.exports");
|
|
9
|
+
const register_1 = require("../plugins/js/utils/register");
|
|
9
10
|
const packages_1 = require("../plugins/js/utils/packages");
|
|
10
|
-
const
|
|
11
|
+
const typescript_1 = require("../plugins/js/utils/typescript");
|
|
11
12
|
const path_2 = require("../utils/path");
|
|
12
13
|
/**
|
|
13
14
|
* This function is used to get the implementation factory of an executor or generator.
|
|
@@ -19,10 +20,14 @@ function getImplementationFactory(implementation, directory, packageName, projec
|
|
|
19
20
|
const [implementationModulePath, implementationExportName] = implementation.split('#');
|
|
20
21
|
return () => {
|
|
21
22
|
const modulePath = resolveImplementation(implementationModulePath, directory, packageName, projects);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// Route .ts entrypoints through loadTsFile so the native-strip ->
|
|
24
|
+
// swc/ts-node fallback chain runs. Plain require() bypasses the matcher
|
|
25
|
+
// set and bubbles errors like extensionless `./schema` imports (strict
|
|
26
|
+
// ESM resolution failures) straight to the CLI. JS entrypoints use
|
|
27
|
+
// requireWithTsconfigFallback so workspace-alias imports still resolve.
|
|
28
|
+
const module = /\.[cm]?ts$/.test(modulePath)
|
|
29
|
+
? (0, register_1.loadTsFile)(modulePath)
|
|
30
|
+
: (0, register_1.requireWithTsconfigFallback)(modulePath);
|
|
26
31
|
return implementationExportName
|
|
27
32
|
? module[implementationExportName]
|
|
28
33
|
: (module.default ?? module);
|
|
@@ -92,7 +97,7 @@ function tryResolveFromSource(path, directory, packageName, projects) {
|
|
|
92
97
|
const fromExports = (0, resolve_exports_1.resolve)({
|
|
93
98
|
name: localProject.metadata.js.packageName,
|
|
94
99
|
exports: localProject.metadata.js.packageExports,
|
|
95
|
-
}, path, { conditions:
|
|
100
|
+
}, path, { conditions: (0, typescript_1.getRootTsConfigResolveExportsConditions)() });
|
|
96
101
|
if (fromExports && fromExports.length) {
|
|
97
102
|
for (const exportPath of fromExports) {
|
|
98
103
|
if ((0, fs_1.existsSync)((0, path_1.join)(directory, exportPath))) {
|