@nx/js 22.7.1 → 22.7.3
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 +6 -6
- package/src/executors/copy-workspace-modules/copy-workspace-modules.d.ts.map +1 -1
- package/src/executors/copy-workspace-modules/copy-workspace-modules.js +2 -0
- package/src/executors/node/node.impl.d.ts.map +1 -1
- package/src/executors/node/node.impl.js +3 -11
- package/src/executors/prune-lockfile/prune-lockfile.d.ts.map +1 -1
- package/src/executors/prune-lockfile/prune-lockfile.js +2 -0
- package/src/executors/release-publish/release-publish.impl.d.ts.map +1 -1
- package/src/executors/release-publish/release-publish.impl.js +28 -2
- package/src/generators/library/library.d.ts.map +1 -1
- package/src/generators/library/library.js +6 -1
- package/src/plugins/typescript/plugin.d.ts.map +1 -1
- package/src/plugins/typescript/plugin.js +14 -2
- package/src/utils/buildable-libs-utils.d.ts.map +1 -1
- package/src/utils/buildable-libs-utils.js +3 -2
- package/src/utils/package-json/update-package-json.d.ts.map +1 -1
- package/src/utils/package-json/update-package-json.js +2 -1
- package/src/utils/strip-glob-to-base-dir.d.ts +2 -0
- package/src/utils/strip-glob-to-base-dir.d.ts.map +1 -0
- package/src/utils/strip-glob-to-base-dir.js +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "22.7.
|
|
3
|
+
"version": "22.7.3",
|
|
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": {
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@babel/preset-env": "^7.23.2",
|
|
41
41
|
"@babel/preset-typescript": "^7.22.5",
|
|
42
42
|
"@babel/runtime": "^7.22.6",
|
|
43
|
-
"@nx/devkit": "22.7.
|
|
44
|
-
"@nx/workspace": "22.7.
|
|
43
|
+
"@nx/devkit": "22.7.3",
|
|
44
|
+
"@nx/workspace": "22.7.3",
|
|
45
45
|
"@zkochan/js-yaml": "0.0.7",
|
|
46
46
|
"babel-plugin-const-enum": "^1.0.1",
|
|
47
47
|
"babel-plugin-macros": "^3.1.0",
|
|
48
48
|
"babel-plugin-transform-typescript-metadata": "^0.3.1",
|
|
49
49
|
"chalk": "^4.1.0",
|
|
50
50
|
"columnify": "^1.6.0",
|
|
51
|
-
"detect-port": "^1.
|
|
52
|
-
"ignore": "^
|
|
51
|
+
"detect-port": "^2.1.0",
|
|
52
|
+
"ignore": "^7.0.5",
|
|
53
53
|
"js-tokens": "^4.0.0",
|
|
54
54
|
"jsonc-parser": "3.2.0",
|
|
55
55
|
"npm-run-path": "^4.0.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tslib": "^2.3.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"nx": "22.7.
|
|
64
|
+
"nx": "22.7.3"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"verdaccio": "^6.0.5"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-workspace-modules.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/copy-workspace-modules/copy-workspace-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAMrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"copy-workspace-modules.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/copy-workspace-modules/copy-workspace-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAMrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAc5D,wBAA8B,oBAAoB,CAChD,MAAM,EAAE,2BAA2B,EACnC,OAAO,EAAE,eAAe;;GASzB"}
|
|
@@ -8,6 +8,7 @@ const path_1 = require("path");
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
10
10
|
const get_workspace_packages_from_graph_1 = require("nx/src/plugins/js/utils/get-workspace-packages-from-graph");
|
|
11
|
+
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
11
12
|
async function copyWorkspaceModules(schema, context) {
|
|
12
13
|
devkit_1.logger.log('Copying Workspace Modules to Build Directory...');
|
|
13
14
|
const outputDirectory = getOutputDir(schema, context);
|
|
@@ -128,6 +129,7 @@ function getOutputDir(schema, context) {
|
|
|
128
129
|
return outputDir;
|
|
129
130
|
}
|
|
130
131
|
function normalizeOutputPath(outputPath) {
|
|
132
|
+
outputPath = (0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(outputPath);
|
|
131
133
|
if (!outputPath.startsWith(devkit_1.workspaceRoot)) {
|
|
132
134
|
outputPath = (0, path_1.join)(devkit_1.workspaceRoot, outputPath);
|
|
133
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAQhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"node.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAQhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsB5D,wBAAuB,YAAY,CACjC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,eAAe;aAgEb,OAAO;cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;cA6QhC;AAmID,eAAe,YAAY,CAAC"}
|
|
@@ -18,6 +18,7 @@ const fileutils_1 = require("nx/src/utils/fileutils");
|
|
|
18
18
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
19
19
|
const detect_module_format_1 = require("./lib/detect-module-format");
|
|
20
20
|
const output_file_1 = require("./lib/output-file");
|
|
21
|
+
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
21
22
|
const globalLineAwareWriter = new line_aware_writer_1.LineAwareWriter();
|
|
22
23
|
async function* nodeExecutor(options, context) {
|
|
23
24
|
process.env.NODE_ENV ??= context?.configurationName ?? 'development';
|
|
@@ -298,7 +299,7 @@ function calculateResolveMappings(context, options) {
|
|
|
298
299
|
// `outputs` are cache patterns and may contain globs (e.g. from the
|
|
299
300
|
// inferred `@nx/js/typescript` build target). Strip the glob portion
|
|
300
301
|
// so the runtime require overrides resolve to the actual output dir.
|
|
301
|
-
const outputDir = stripGlobToBaseDir(c.outputs[0]);
|
|
302
|
+
const outputDir = (0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(c.outputs[0]);
|
|
302
303
|
m[c.name] = (0, devkit_1.joinPathFragments)(context.root, outputDir);
|
|
303
304
|
}
|
|
304
305
|
return m;
|
|
@@ -338,7 +339,7 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
338
339
|
// `{projectRoot}/dist/**/*.{js,...}` to avoid caching non-tsc files).
|
|
339
340
|
// Strip the glob portion back to the last path separator before it to
|
|
340
341
|
// recover the base output directory.
|
|
341
|
-
const outputDir = stripGlobToBaseDir(outputFilePath);
|
|
342
|
+
const outputDir = (0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(outputFilePath);
|
|
342
343
|
return path.join(outputDir, 'main.js');
|
|
343
344
|
}
|
|
344
345
|
const fallbackFile = path.join('dist', project.data.root, 'main.js');
|
|
@@ -356,15 +357,6 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
|
|
|
356
357
|
}
|
|
357
358
|
return (0, path_1.join)(context.root, buildOptions.outputPath, outputFileName);
|
|
358
359
|
}
|
|
359
|
-
function stripGlobToBaseDir(pathWithGlob) {
|
|
360
|
-
const globIdx = pathWithGlob.search(/[*?[{(]/);
|
|
361
|
-
if (globIdx === -1) {
|
|
362
|
-
return pathWithGlob.replace(/[\\/]+$/, '');
|
|
363
|
-
}
|
|
364
|
-
const prefix = pathWithGlob.slice(0, globIdx);
|
|
365
|
-
const lastSep = Math.max(prefix.lastIndexOf('/'), prefix.lastIndexOf('\\'));
|
|
366
|
-
return lastSep === -1 ? '' : prefix.slice(0, lastSep);
|
|
367
|
-
}
|
|
368
360
|
function fileToRunCorrectPath(fileToRun) {
|
|
369
361
|
if ((0, fileutils_1.fileExists)(fileToRun))
|
|
370
362
|
return fileToRun;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune-lockfile.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/prune-lockfile/prune-lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAMrB,MAAM,YAAY,CAAC;AAYpB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"prune-lockfile.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/prune-lockfile/prune-lockfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAMrB,MAAM,YAAY,CAAC;AAYpB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD,wBAA8B,qBAAqB,CACjD,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,eAAe;;GAgCzB"}
|
|
@@ -9,6 +9,7 @@ const utils_1 = require("nx/src/tasks-runner/utils");
|
|
|
9
9
|
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
11
|
const get_workspace_packages_from_graph_1 = require("nx/src/plugins/js/utils/get-workspace-packages-from-graph");
|
|
12
|
+
const strip_glob_to_base_dir_1 = require("../../utils/strip-glob-to-base-dir");
|
|
12
13
|
async function pruneLockfileExecutor(schema, context) {
|
|
13
14
|
devkit_1.logger.log('Pruning lockfile...');
|
|
14
15
|
const outputDirectory = getOutputDir(schema, context);
|
|
@@ -89,6 +90,7 @@ function getOutputDir(schema, context) {
|
|
|
89
90
|
return outputDir;
|
|
90
91
|
}
|
|
91
92
|
function normalizeOutputPath(outputPath) {
|
|
93
|
+
outputPath = (0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(outputPath);
|
|
92
94
|
if (!outputPath.startsWith(devkit_1.workspaceRoot)) {
|
|
93
95
|
outputPath = (0, path_1.join)(devkit_1.workspaceRoot, outputPath);
|
|
94
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiBjD,wBAA8B,WAAW,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;
|
|
1
|
+
{"version":3,"file":"release-publish.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/release-publish/release-publish.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEhB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAiBjD,wBAA8B,WAAW,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,eAAe;;GA0UzB"}
|
|
@@ -267,6 +267,21 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
267
267
|
* to running from the package root directly), then special attention should be paid to the fact that npm/pnpm publish will nest its
|
|
268
268
|
* JSON output under the name of the package in that case (and it would need to be handled below).
|
|
269
269
|
*/
|
|
270
|
+
return runPublish({
|
|
271
|
+
pm,
|
|
272
|
+
options,
|
|
273
|
+
context,
|
|
274
|
+
packageRoot,
|
|
275
|
+
packageJson,
|
|
276
|
+
registry,
|
|
277
|
+
registryConfigKey,
|
|
278
|
+
tag,
|
|
279
|
+
isDryRun,
|
|
280
|
+
isNpmInstalled,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function runPublish(ctx) {
|
|
284
|
+
const { pm, options, context, packageRoot, packageJson, registry, registryConfigKey, tag, isDryRun, isNpmInstalled, } = ctx;
|
|
270
285
|
const pmCommand = (0, devkit_1.getPackageManagerCommand)(pm);
|
|
271
286
|
const publishCommandSegments = [
|
|
272
287
|
pmCommand.publish(packageRoot, registry, registryConfigKey, tag),
|
|
@@ -342,9 +357,20 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|
|
342
357
|
try {
|
|
343
358
|
// bun publish does not support outputting JSON, so we cannot perform any further processing
|
|
344
359
|
if (pm === 'bun') {
|
|
360
|
+
const bunStderr = err.stderr?.toString() || '';
|
|
361
|
+
const bunStdout = err.stdout?.toString() || '';
|
|
362
|
+
// bun publish does not yet support npm's OIDC trusted publishing flow. If the failure
|
|
363
|
+
// looks like an authentication error and npm is available, retry via npm to recover.
|
|
364
|
+
// Other failures (e.g. version conflict, 403) would produce the same error from npm,
|
|
365
|
+
// so we surface bun's error directly instead.
|
|
366
|
+
const looksLikeAuthError = /missing authentication|bunx npm login|unauthorized|\b401\b/i.test(bunStderr + bunStdout);
|
|
367
|
+
if (isNpmInstalled && looksLikeAuthError) {
|
|
368
|
+
console.warn(`bun publish failed with an authentication error; falling back to npm publish (bun does not support npm OIDC trusted publishing).`);
|
|
369
|
+
return runPublish({ ...ctx, pm: 'npm' });
|
|
370
|
+
}
|
|
345
371
|
console.error(`bun publish error:`);
|
|
346
|
-
console.error(
|
|
347
|
-
console.error(
|
|
372
|
+
console.error(bunStderr);
|
|
373
|
+
console.error(bunStdout);
|
|
348
374
|
return {
|
|
349
375
|
success: false,
|
|
350
376
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EAWjB,IAAI,EAKL,MAAM,YAAY,CAAC;AAyCpB,OAAO,KAAK,EAEV,sBAAsB,EACtB,iCAAiC,EAClC,MAAM,UAAU,CAAC;AASlB,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAO/B;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAqK/B;AA2HD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,iCAAiC,EAC/B,MAAM,GACN,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,IAAI,GACJ,yBAAyB,GACzB,aAAa,GACb,SAAS,GACT,WAAW,GACX,yBAAyB,CAC5B,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EAWjB,IAAI,EAKL,MAAM,YAAY,CAAC;AAyCpB,OAAO,KAAK,EAEV,sBAAsB,EACtB,iCAAiC,EAClC,MAAM,UAAU,CAAC;AASlB,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAO/B;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,sBAAsB,8BAqK/B;AA2HD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,iCAAiC,EAC/B,MAAM,GACN,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,IAAI,GACJ,yBAAyB,GACzB,aAAa,GACb,SAAS,GACT,WAAW,GACX,yBAAyB,CAC5B,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAmH5B;AA+uBD,eAAe,gBAAgB,CAAC"}
|
|
@@ -318,7 +318,12 @@ async function addLint(tree, options) {
|
|
|
318
318
|
ignoredFiles.add('{projectRoot}/esbuild.config.{js,ts,mjs,mts}');
|
|
319
319
|
}
|
|
320
320
|
if (options.unitTestRunner === 'vitest') {
|
|
321
|
-
|
|
321
|
+
// When bundler is 'vite', vite.config holds both build and test config
|
|
322
|
+
// (added above). Otherwise, @nx/vitest:configuration generates a
|
|
323
|
+
// dedicated vitest.config file for non-framework JS libraries.
|
|
324
|
+
ignoredFiles.add(options.bundler === 'vite'
|
|
325
|
+
? '{projectRoot}/vite.config.{js,ts,mjs,mts}'
|
|
326
|
+
: '{projectRoot}/vitest.config.{js,ts,mjs,mts}');
|
|
322
327
|
}
|
|
323
328
|
if (ignoredFiles.size) {
|
|
324
329
|
ruleOptions.ignoredFiles = Array.from(ignoredFiles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AA+BpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAyLD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA8FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
|
|
@@ -10,8 +10,20 @@ const picomatch = require("picomatch");
|
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
11
|
const lock_file_1 = require("nx/src/plugins/js/lock-file/lock-file");
|
|
12
12
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
|
+
const installation_directory_1 = require("nx/src/utils/installation-directory");
|
|
13
14
|
const util_1 = require("./util");
|
|
14
15
|
let ts;
|
|
16
|
+
const resolvedTypescriptPaths = {};
|
|
17
|
+
function resolveTypescriptPath(projectRoot, workspaceRoot) {
|
|
18
|
+
// Resolve from projectRoot first, then workspace paths, with __dirname as a
|
|
19
|
+
// last resort. Required so the lookup works under layouts where @nx/js's real
|
|
20
|
+
// path is outside the workspace tree (e.g. pnpm's enableGlobalVirtualStore),
|
|
21
|
+
// since typescript is not a declared dep.
|
|
22
|
+
resolvedTypescriptPaths[projectRoot] ??= require.resolve('typescript', {
|
|
23
|
+
paths: [projectRoot, ...(0, installation_directory_1.getNxRequirePaths)(workspaceRoot), __dirname],
|
|
24
|
+
});
|
|
25
|
+
return resolvedTypescriptPaths[projectRoot];
|
|
26
|
+
}
|
|
15
27
|
const TSCONFIG_CACHE_VERSION = 2;
|
|
16
28
|
const TS_CONFIG_CACHE_PATH = (0, node_path_1.join)(cache_directory_1.workspaceDataDirectory, 'tsconfig-files.hash');
|
|
17
29
|
// Module-level cache store — each invocation gets a unique Symbol key
|
|
@@ -354,7 +366,7 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
|
|
|
354
366
|
];
|
|
355
367
|
const absoluteProjectRoot = config.project.absolute;
|
|
356
368
|
if (!ts) {
|
|
357
|
-
ts = require(
|
|
369
|
+
ts = require(resolveTypescriptPath(absoluteProjectRoot, workspaceRoot));
|
|
358
370
|
}
|
|
359
371
|
// https://github.com/microsoft/TypeScript/blob/19b777260b26aac5707b1efd34202054164d4a9d/src/compiler/utilities.ts#L9869
|
|
360
372
|
const supportedTSExtensions = [
|
|
@@ -819,7 +831,7 @@ function getExtendedFilesHash(extendedConfigFiles, workspaceRoot, cache) {
|
|
|
819
831
|
}
|
|
820
832
|
function readTsConfig(tsConfigPath, workspaceRoot, cache) {
|
|
821
833
|
if (!ts) {
|
|
822
|
-
ts = require(
|
|
834
|
+
ts = require(resolveTypescriptPath(workspaceRoot, workspaceRoot));
|
|
823
835
|
}
|
|
824
836
|
// Normalize to forward slashes for TypeScript compatibility on Windows.
|
|
825
837
|
// TypeScript's parser normalizes paths inconsistently — diagnostics use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildable-libs-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/js/src/utils/buildable-libs-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,SAAS,EACV,MAAM,YAAY,CAAC;AAYpB,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"buildable-libs-utils.d.ts","sourceRoot":"","sources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iBAAiB,EAAE,MAAM,EACzB,OAAO,CAAC,EAAE,OAAO,GAChB;IACD,MAAM,EAAE,uBAAuB,CAAC;IAChC,YAAY,EAAE,6BAA6B,EAAE,CAAC;IAC9C,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,oBAAoB,EAAE,6BAA6B,EAAE,CAAC;CACvD,CA8EA;AAkGD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,EAAE,CAAC,iBAAiB,EACvC,YAAY,EAAE,6BAA6B,EAAE,wBAK9C;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,6BAA6B,EAAE,EAC7C,qBAAqB,GAAE,OAAe,UAsBvC;AAUD,wBAAgB,WAAW,CACzB,YAAY,EAAE,6BAA6B,EAAE,EAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,QA6DhC;AAED;;;GAGG;AACH,wBAAgB,6CAA6C,CAC3D,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,EACzB,IAAI,EAAE,uBAAuB,EAC7B,YAAY,EAAE,6BAA6B,EAAE,EAC7C,gBAAgB,GAAE,cAAc,GAAG,kBAAmC,QAsFvE"}
|
|
@@ -14,6 +14,7 @@ const fileutils_1 = require("nx/src/utils/fileutils");
|
|
|
14
14
|
const output_1 = require("nx/src/utils/output");
|
|
15
15
|
const path_1 = require("path");
|
|
16
16
|
const ts_config_1 = require("./typescript/ts-config");
|
|
17
|
+
const strip_glob_to_base_dir_1 = require("./strip-glob-to-base-dir");
|
|
17
18
|
const crypto_1 = require("crypto");
|
|
18
19
|
const project_graph_1 = require("nx/src/config/project-graph");
|
|
19
20
|
function isBuildable(target, node) {
|
|
@@ -311,7 +312,7 @@ function updateBuildableProjectPackageJsonDependencies(root, projectName, target
|
|
|
311
312
|
target: targetName,
|
|
312
313
|
configuration: configurationName,
|
|
313
314
|
}, {}, node);
|
|
314
|
-
const packageJsonPath = `${outputs[0]}/package.json`;
|
|
315
|
+
const packageJsonPath = `${(0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(outputs[0])}/package.json`;
|
|
315
316
|
let packageJson;
|
|
316
317
|
let workspacePackageJson;
|
|
317
318
|
try {
|
|
@@ -341,7 +342,7 @@ function updateBuildableProjectPackageJsonDependencies(root, projectName, target
|
|
|
341
342
|
target: targetName,
|
|
342
343
|
configuration: configurationName,
|
|
343
344
|
}, {}, entry.node);
|
|
344
|
-
const depPackageJsonPath = (0, path_1.join)(root, outputs[0], 'package.json');
|
|
345
|
+
const depPackageJsonPath = (0, path_1.join)(root, (0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(outputs[0]), 'package.json');
|
|
345
346
|
depVersion = (0, devkit_1.readJsonFile)(depPackageJsonPath).version;
|
|
346
347
|
packageJson[typeOfDependency][packageName] = depVersion;
|
|
347
348
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-package-json.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/package-json/update-package-json.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EAIf,cAAc,EAGd,uBAAuB,EAIxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAIxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"update-package-json.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/package-json/update-package-json.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EAIf,cAAc,EAGd,uBAAuB,EAIxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAIxE,OAAO,KAAK,EAAE,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B,CACpB,GAAG;IACF,OAAO,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAgCT;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,uBAAuB,GAC/B,WAAW,CAuGb;AA2CD,wBAAgB,YAAY,CAC1B,OAAO,EAAE,IAAI,CACX,uBAAuB,EACrB,MAAM,GACN,SAAS,GACT,aAAa,GACb,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,CACpB,GACA,MAAM,CAWR"}
|
|
@@ -14,6 +14,7 @@ const path_1 = require("path");
|
|
|
14
14
|
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
15
15
|
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
|
16
16
|
const get_main_file_dir_1 = require("../get-main-file-dir");
|
|
17
|
+
const strip_glob_to_base_dir_1 = require("../strip-glob-to-base-dir");
|
|
17
18
|
function updatePackageJson(options, context, target, dependencies, fileMap = null) {
|
|
18
19
|
let packageJson;
|
|
19
20
|
if (fileMap == null) {
|
|
@@ -101,7 +102,7 @@ function addMissingDependencies(packageJson, { projectName, targetName, configur
|
|
|
101
102
|
target: targetName,
|
|
102
103
|
configuration: configurationName,
|
|
103
104
|
}, {}, entry.node);
|
|
104
|
-
const depPackageJsonPath = (0, path_1.join)(root, outputs[0], 'package.json');
|
|
105
|
+
const depPackageJsonPath = (0, path_1.join)(root, (0, strip_glob_to_base_dir_1.stripGlobToBaseDir)(outputs[0]), 'package.json');
|
|
105
106
|
if ((0, node_fs_1.existsSync)(depPackageJsonPath)) {
|
|
106
107
|
const version = (0, devkit_1.readJsonFile)(depPackageJsonPath).version;
|
|
107
108
|
packageJson[propType] ??= {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-glob-to-base-dir.d.ts","sourceRoot":"","sources":["../../../../../packages/js/src/utils/strip-glob-to-base-dir.ts"],"names":[],"mappings":"AAIA,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAQ/D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripGlobToBaseDir = stripGlobToBaseDir;
|
|
4
|
+
// `outputs` entries on inferred targets (e.g. from `@nx/js/typescript`) are
|
|
5
|
+
// cache-match patterns and may contain globs. Strip the glob portion back to
|
|
6
|
+
// the last path separator to recover the base output directory. Returns the
|
|
7
|
+
// input with trailing separators stripped when there is no glob.
|
|
8
|
+
function stripGlobToBaseDir(pathWithGlob) {
|
|
9
|
+
const globIdx = pathWithGlob.search(/[*?[{(]/);
|
|
10
|
+
if (globIdx === -1) {
|
|
11
|
+
return pathWithGlob.replace(/[\\/]+$/, '');
|
|
12
|
+
}
|
|
13
|
+
const prefix = pathWithGlob.slice(0, globIdx);
|
|
14
|
+
const lastSep = Math.max(prefix.lastIndexOf('/'), prefix.lastIndexOf('\\'));
|
|
15
|
+
return lastSep === -1 ? '' : prefix.slice(0, lastSep);
|
|
16
|
+
}
|