@nx/js 22.6.0-pr.34728.66566c0 → 22.6.0-pr.34764.868a863
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/js",
|
|
3
|
-
"version": "22.6.0-pr.
|
|
3
|
+
"version": "22.6.0-pr.34764.868a863",
|
|
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": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "22.6.0-pr.
|
|
43
|
-
"@nx/workspace": "22.6.0-pr.
|
|
42
|
+
"@nx/devkit": "22.6.0-pr.34764.868a863",
|
|
43
|
+
"@nx/workspace": "22.6.0-pr.34764.868a863",
|
|
44
44
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
45
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
46
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"tslib": "^2.3.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"nx": "22.6.0-pr.
|
|
63
|
+
"nx": "22.6.0-pr.34764.868a863"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"verdaccio": "^6.0.5"
|
|
@@ -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;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;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;
|
|
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;AA2KD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA0FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
|
|
@@ -166,7 +166,8 @@ async function resolveValidConfigFilesAndHashes(configFilePaths, options, option
|
|
|
166
166
|
const absolutePath = (0, node_path_1.join)(context.workspaceRoot, configFilePath);
|
|
167
167
|
const configContext = getConfigContext(absolutePath, context.workspaceRoot, cache);
|
|
168
168
|
// Skip configs that can't produce any targets based on plugin options
|
|
169
|
-
const isTypecheckConfig = configContext.basename ===
|
|
169
|
+
const isTypecheckConfig = configContext.basename ===
|
|
170
|
+
(options.typecheck ? options.typecheck.configName : 'tsconfig.json');
|
|
170
171
|
const isBuildConfig = options.build && configContext.basename === options.build.configName;
|
|
171
172
|
if (!isTypecheckConfig && !isBuildConfig) {
|
|
172
173
|
continue;
|
|
@@ -248,8 +249,8 @@ function buildTscTargets(config, options, context, configFiles, cache) {
|
|
|
248
249
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(config.project.root, context);
|
|
249
250
|
const tsConfig = retrieveTsConfigFromCache(config.absolutePath, context.workspaceRoot, cache);
|
|
250
251
|
let internalProjectReferences;
|
|
251
|
-
if (
|
|
252
|
-
options.typecheck &&
|
|
252
|
+
if (options.typecheck &&
|
|
253
|
+
config.basename === options.typecheck.configName &&
|
|
253
254
|
tsConfig.raw?.['nx']?.addTypecheckTarget !== false) {
|
|
254
255
|
internalProjectReferences = resolveInternalProjectReferences(tsConfig, context.workspaceRoot, config.project, cache);
|
|
255
256
|
const externalProjectReferences = resolveShallowExternalProjectReferences(tsConfig, context.workspaceRoot, config.project, cache);
|
|
@@ -456,9 +457,11 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
|
|
|
456
457
|
inputs.push(...Array.from(excludePaths).map((p) => `!${pathToInputOrOutput((0, devkit_1.joinPathFragments)(config.project.root, p), workspaceRoot, config.project)}`));
|
|
457
458
|
}
|
|
458
459
|
if (hasExternalProjectReferences(config.originalPath, tsConfig, workspaceRoot, config.project, cache)) {
|
|
459
|
-
//
|
|
460
|
+
// tsc --build reads .d.ts and .tsbuildinfo files from referenced projects
|
|
460
461
|
// https://www.typescriptlang.org/docs/handbook/project-references.html#what-is-a-project-reference
|
|
461
|
-
inputs.push({
|
|
462
|
+
inputs.push({
|
|
463
|
+
dependentTasksOutputFiles: '**/*.{d.ts,tsbuildinfo}',
|
|
464
|
+
});
|
|
462
465
|
}
|
|
463
466
|
else {
|
|
464
467
|
inputs.push('production' in namedInputs ? '^production' : '^default');
|
|
@@ -466,17 +469,23 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
|
|
|
466
469
|
// inputs.push({ externalDependencies });
|
|
467
470
|
return inputs;
|
|
468
471
|
}
|
|
469
|
-
function getOutputs(config,
|
|
472
|
+
function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRoot, emitDeclarationOnly) {
|
|
470
473
|
const outputs = new Set();
|
|
471
474
|
// We could have more surgical outputs based on the tsconfig options, but the
|
|
472
475
|
// user could override them through the command line and that wouldn't be
|
|
473
476
|
// reflected in the outputs. So, we just include everything that could be
|
|
474
477
|
// produced by the tsc command.
|
|
475
|
-
[
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
[
|
|
479
|
+
{ configBaseNameNoExt: config.basenameNoExt, tsConfig: rootTsConfig },
|
|
480
|
+
...Object.entries(internalProjectReferences).map(([internalConfigPath, internalConfig]) => ({
|
|
481
|
+
configBaseNameNoExt: (0, node_path_1.basename)(internalConfigPath, '.json'),
|
|
482
|
+
tsConfig: internalConfig,
|
|
483
|
+
})),
|
|
484
|
+
].forEach(({ configBaseNameNoExt, tsConfig }) => {
|
|
485
|
+
if (tsConfig.options.outFile) {
|
|
486
|
+
const outFileName = (0, node_path_1.basename)(tsConfig.options.outFile, '.js');
|
|
487
|
+
const outFileDir = (0, node_path_1.dirname)(tsConfig.options.outFile);
|
|
488
|
+
outputs.add(pathToInputOrOutput(tsConfig.options.outFile, workspaceRoot, config.project));
|
|
480
489
|
// outFile is not be used with .cjs, .mjs, .jsx, so the list is simpler
|
|
481
490
|
const outDir = (0, node_path_1.relative)(workspaceRoot, outFileDir);
|
|
482
491
|
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.js.map`), workspaceRoot, config.project));
|
|
@@ -487,38 +496,36 @@ function getOutputs(config, tsConfig, internalProjectReferences, workspaceRoot,
|
|
|
487
496
|
? pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project)
|
|
488
497
|
: pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.tsbuildinfo`), workspaceRoot, config.project));
|
|
489
498
|
}
|
|
490
|
-
else if (
|
|
499
|
+
else if (tsConfig.options.outDir) {
|
|
491
500
|
if (emitDeclarationOnly) {
|
|
492
|
-
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(
|
|
501
|
+
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.d.ts'), workspaceRoot, config.project));
|
|
493
502
|
if (tsConfig.options.declarationMap) {
|
|
494
|
-
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(
|
|
503
|
+
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.d.ts.map'), workspaceRoot, config.project));
|
|
495
504
|
}
|
|
496
505
|
}
|
|
497
506
|
else {
|
|
498
|
-
outputs.add(pathToInputOrOutput(
|
|
507
|
+
outputs.add(pathToInputOrOutput(tsConfig.options.outDir, workspaceRoot, config.project));
|
|
499
508
|
}
|
|
500
|
-
if (
|
|
509
|
+
if (tsConfig.options.tsBuildInfoFile) {
|
|
501
510
|
if (emitDeclarationOnly ||
|
|
502
|
-
!(0, node_path_1.normalize)(
|
|
511
|
+
!(0, node_path_1.normalize)(tsConfig.options.tsBuildInfoFile).startsWith(`${(0, node_path_1.normalize)(tsConfig.options.outDir)}${node_path_1.sep}`)) {
|
|
503
512
|
// https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
|
|
504
|
-
outputs.add(pathToInputOrOutput(
|
|
513
|
+
outputs.add(pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project));
|
|
505
514
|
}
|
|
506
515
|
}
|
|
507
|
-
else if (
|
|
508
|
-
tsconfig.options.rootDir !== '.') {
|
|
516
|
+
else if (tsConfig.options.rootDir && tsConfig.options.rootDir !== '.') {
|
|
509
517
|
// If rootDir is set, then the tsbuildinfo file will be outside the outDir so we need to add it.
|
|
510
|
-
const relativeRootDir = (0, node_path_1.relative)(
|
|
511
|
-
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(
|
|
518
|
+
const relativeRootDir = (0, node_path_1.relative)(tsConfig.options.rootDir, (0, node_path_1.join)(workspaceRoot, config.project.root));
|
|
519
|
+
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, relativeRootDir, `*.tsbuildinfo`), workspaceRoot, config.project));
|
|
512
520
|
}
|
|
513
521
|
else if (emitDeclarationOnly) {
|
|
514
522
|
// https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
|
|
515
|
-
|
|
516
|
-
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsconfig.options.outDir, `${name}.tsbuildinfo`), workspaceRoot, config.project));
|
|
523
|
+
outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, `${configBaseNameNoExt}.tsbuildinfo`), workspaceRoot, config.project));
|
|
517
524
|
}
|
|
518
525
|
}
|
|
519
|
-
else if (
|
|
520
|
-
|
|
521
|
-
(!
|
|
526
|
+
else if (tsConfig.raw?.include?.length ||
|
|
527
|
+
tsConfig.raw?.files?.length ||
|
|
528
|
+
(!tsConfig.raw?.include && !tsConfig.raw?.files)) {
|
|
522
529
|
// tsc produce files in place when no outDir or outFile is set
|
|
523
530
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.js'));
|
|
524
531
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.cjs'));
|
|
@@ -533,10 +540,9 @@ function getOutputs(config, tsConfig, internalProjectReferences, workspaceRoot,
|
|
|
533
540
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.cts.map'));
|
|
534
541
|
outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.mts.map'));
|
|
535
542
|
// https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
|
|
536
|
-
const name = config.basenameNoExt;
|
|
537
543
|
outputs.add(tsConfig.options.tsBuildInfoFile
|
|
538
544
|
? pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project)
|
|
539
|
-
: (0, devkit_1.joinPathFragments)('{projectRoot}', `${
|
|
545
|
+
: (0, devkit_1.joinPathFragments)('{projectRoot}', `${configBaseNameNoExt}.tsbuildinfo`));
|
|
540
546
|
}
|
|
541
547
|
});
|
|
542
548
|
return Array.from(outputs);
|
|
@@ -765,7 +771,9 @@ function normalizePluginOptions(pluginOptions = {}) {
|
|
|
765
771
|
const defaultCompiler = 'tsc';
|
|
766
772
|
const compiler = pluginOptions.compiler ?? defaultCompiler;
|
|
767
773
|
const defaultTypecheckTargetName = 'typecheck';
|
|
774
|
+
const defaultTypecheckConfigName = 'tsconfig.json';
|
|
768
775
|
let typecheck = {
|
|
776
|
+
configName: defaultTypecheckConfigName,
|
|
769
777
|
targetName: defaultTypecheckTargetName,
|
|
770
778
|
};
|
|
771
779
|
if (pluginOptions.typecheck === false) {
|
|
@@ -774,6 +782,7 @@ function normalizePluginOptions(pluginOptions = {}) {
|
|
|
774
782
|
else if (pluginOptions.typecheck &&
|
|
775
783
|
typeof pluginOptions.typecheck !== 'boolean') {
|
|
776
784
|
typecheck = {
|
|
785
|
+
configName: pluginOptions.typecheck.configName ?? defaultTypecheckConfigName,
|
|
777
786
|
targetName: pluginOptions.typecheck.targetName ?? defaultTypecheckTargetName,
|
|
778
787
|
};
|
|
779
788
|
}
|