@nx/webpack 23.0.0-beta.17 → 23.0.0-beta.19

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/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { configurationGenerator } from './src/generators/configuration/configuration';
2
2
  import { NxAppWebpackPlugin } from './src/plugins/nx-webpack-plugin/nx-app-webpack-plugin';
3
- import { NxTsconfigPathsWebpackPlugin as _NxTsconfigPathsWebpackPlugin } from './src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin';
4
3
  import { useLegacyNxPlugin } from './src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin';
5
4
  export declare function convertConfigToWebpackPluginGenerator(...args: Parameters<typeof import('./src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin').convertConfigToWebpackPluginGenerator>): any;
6
5
  export { configurationGenerator, useLegacyNxPlugin };
@@ -8,8 +7,6 @@ export { configurationGenerator, useLegacyNxPlugin };
8
7
  export declare const webpackProjectGenerator: typeof configurationGenerator;
9
8
  /** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead, which can improve graph creation by 150-200ms per file. */
10
9
  export declare const NxWebpackPlugin: typeof NxAppWebpackPlugin;
11
- /** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
12
- export declare const NxTsconfigPathsWebpackPlugin: typeof _NxTsconfigPathsWebpackPlugin;
13
10
  export * from './src/utils/create-copy-plugin';
14
11
  export * from './src/utils/config';
15
12
  export { webpackInitGenerator } from './src/generators/init/init';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/webpack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,4BAA4B,IAAI,6BAA6B,EAAE,MAAM,6EAA6E,CAAC;AAC5J,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAM5F,wBAAgB,qCAAqC,CACnD,GAAG,IAAI,EAAE,UAAU,CACjB,cAAc,oFAAoF,EAAE,qCAAqC,CAC1I,OAKF;AAED,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAC;AAGrD,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,+BAAyB,CAAC;AAE9D,wIAAwI;AACxI,eAAO,MAAM,eAAe,2BAAqB,CAAC;AAClD,qGAAqG;AACrG,eAAO,MAAM,4BAA4B,sCAAgC,CAAC;AAE1E,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAC9D,YAAY,EACV,sBAAsB,EACtB,gCAAgC,EAChC,gBAAgB,EAChB,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/webpack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAM5F,wBAAgB,qCAAqC,CACnD,GAAG,IAAI,EAAE,UAAU,CACjB,cAAc,oFAAoF,EAAE,qCAAqC,CAC1I,OAKF;AAED,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,CAAC;AAGrD,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,+BAAyB,CAAC;AAE9D,wIAAwI;AACxI,eAAO,MAAM,eAAe,2BAAqB,CAAC;AAElD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAC9D,YAAY,EACV,sBAAsB,EACtB,gCAAgC,EAChC,gBAAgB,EAChB,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uCAAuC,CAAC"}
package/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.webpackInitGenerator = exports.NxTsconfigPathsWebpackPlugin = exports.NxWebpackPlugin = exports.webpackProjectGenerator = exports.useLegacyNxPlugin = exports.configurationGenerator = void 0;
3
+ exports.webpackInitGenerator = exports.NxWebpackPlugin = exports.webpackProjectGenerator = exports.useLegacyNxPlugin = exports.configurationGenerator = void 0;
4
4
  exports.convertConfigToWebpackPluginGenerator = convertConfigToWebpackPluginGenerator;
5
5
  const tslib_1 = require("tslib");
6
6
  const configuration_1 = require("./src/generators/configuration/configuration");
7
7
  Object.defineProperty(exports, "configurationGenerator", { enumerable: true, get: function () { return configuration_1.configurationGenerator; } });
8
8
  const nx_app_webpack_plugin_1 = require("./src/plugins/nx-webpack-plugin/nx-app-webpack-plugin");
9
- const nx_tsconfig_paths_webpack_plugin_1 = require("./src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin");
10
9
  const use_legacy_nx_plugin_1 = require("./src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin");
11
10
  Object.defineProperty(exports, "useLegacyNxPlugin", { enumerable: true, get: function () { return use_legacy_nx_plugin_1.useLegacyNxPlugin; } });
12
11
  // Lazy-loaded to avoid requiring typescript before it's installed.
@@ -21,8 +20,6 @@ function convertConfigToWebpackPluginGenerator(...args) {
21
20
  exports.webpackProjectGenerator = configuration_1.configurationGenerator;
22
21
  /** @deprecated Use NxAppWebpackPlugin from `@nx/webpack/app-plugin` instead, which can improve graph creation by 150-200ms per file. */
23
22
  exports.NxWebpackPlugin = nx_app_webpack_plugin_1.NxAppWebpackPlugin;
24
- /** @deprecated Use NxTsconfigPathsWebpackPlugin from `@nx/webpack/tsconfig-paths-plugin` instead. */
25
- exports.NxTsconfigPathsWebpackPlugin = nx_tsconfig_paths_webpack_plugin_1.NxTsconfigPathsWebpackPlugin;
26
23
  tslib_1.__exportStar(require("./src/utils/create-copy-plugin"), exports);
27
24
  tslib_1.__exportStar(require("./src/utils/config"), exports);
28
25
  var init_1 = require("./src/generators/init/init");
package/migrations.json CHANGED
@@ -11,6 +11,12 @@
11
11
  "version": "22.0.0-beta.0",
12
12
  "description": "Remove deprecated deleteOutputPath and sassImplementation options from @nx/webpack:webpack",
13
13
  "implementation": "./src/migrations/update-22-0-0/remove-deprecated-options"
14
+ },
15
+ "update-23-0-0-remove-nx-tsconfig-paths-webpack-plugin-import": {
16
+ "cli": "nx",
17
+ "version": "23.0.0-beta.10",
18
+ "description": "Rewrites imports of NxTsconfigPathsWebpackPlugin from '@nx/webpack' to the sub-path '@nx/webpack/tsconfig-paths-plugin'.",
19
+ "factory": "./src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import"
14
20
  }
15
21
  },
16
22
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "23.0.0-beta.17",
3
+ "version": "23.0.0-beta.19",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
6
6
  "repository": {
@@ -65,11 +65,11 @@
65
65
  "webpack-dev-server": "^5.2.1",
66
66
  "webpack-node-externals": "^3.0.0",
67
67
  "webpack-subresource-integrity": "^5.1.0",
68
- "@nx/devkit": "23.0.0-beta.17",
69
- "@nx/js": "23.0.0-beta.17"
68
+ "@nx/devkit": "23.0.0-beta.19",
69
+ "@nx/js": "23.0.0-beta.19"
70
70
  },
71
71
  "devDependencies": {
72
- "nx": "23.0.0-beta.17"
72
+ "nx": "23.0.0-beta.19"
73
73
  },
74
74
  "publishConfig": {
75
75
  "access": "public"
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function removeNxTsconfigPathsWebpackPluginImport(tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=remove-nx-tsconfig-paths-webpack-plugin-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-nx-tsconfig-paths-webpack-plugin-import.d.ts","sourceRoot":"","sources":["../../../../../../packages/webpack/src/migrations/update-23-0-0/remove-nx-tsconfig-paths-webpack-plugin-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAwB,MAAM,YAAY,CAAC;AA8BrE,wBAA8B,wCAAwC,CACpE,IAAI,EAAE,IAAI,iBAwHX"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = removeNxTsconfigPathsWebpackPluginImport;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
6
+ const DEPRECATED_SYMBOL = 'NxTsconfigPathsWebpackPlugin';
7
+ const DEPRECATED_PACKAGE = '@nx/webpack';
8
+ const NEW_PACKAGE = '@nx/webpack/tsconfig-paths-plugin';
9
+ // ES module import: import { NxTsconfigPathsWebpackPlugin[, ...] } from '@nx/webpack'
10
+ const ES_IMPORT_SELECTOR = `ImportDeclaration:has(StringLiteral[value=${DEPRECATED_PACKAGE}]):has(ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}])`;
11
+ const IMPORT_SPECIFIERS_SELECTOR = `ImportClause ImportSpecifier`;
12
+ const TARGET_IMPORT_SPECIFIER_SELECTOR = `ImportClause ImportSpecifier > Identifier[name=${DEPRECATED_SYMBOL}]`;
13
+ const ES_MODULE_PATH_SELECTOR = `StringLiteral[value=${DEPRECATED_PACKAGE}]`;
14
+ // CJS require: const { NxTsconfigPathsWebpackPlugin[, ...] } = require('@nx/webpack')
15
+ const CJS_REQUIRE_STMT_SELECTOR = `VariableStatement:has(ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]):has(CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}])`;
16
+ const CJS_BINDING_ELEMENTS_SELECTOR = `ObjectBindingPattern > BindingElement`;
17
+ const CJS_TARGET_BINDING_SELECTOR = `ObjectBindingPattern > BindingElement > Identifier[name=${DEPRECATED_SYMBOL}]`;
18
+ const CJS_REQUIRE_PATH_SELECTOR = `CallExpression:has(Identifier[name=require]) > StringLiteral[value=${DEPRECATED_PACKAGE}]`;
19
+ // Walk past whitespace from `fromIndex` to find a trailing comma. Returns the
20
+ // position AFTER the comma if found, otherwise the original index. Handles
21
+ // the `Foo , withReact` shape where the user wrote whitespace before the
22
+ // comma — `node.getEnd()` stops at the identifier and the comma sits one
23
+ // character past the whitespace.
24
+ function endAfterTrailingComma(text, fromIndex) {
25
+ let i = fromIndex;
26
+ while (i < text.length && /\s/.test(text.charAt(i)))
27
+ i++;
28
+ return text.charAt(i) === ',' ? i + 1 : fromIndex;
29
+ }
30
+ async function removeNxTsconfigPathsWebpackPluginImport(tree) {
31
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '', (filePath) => {
32
+ if (!filePath.endsWith('.ts') &&
33
+ !filePath.endsWith('.tsx') &&
34
+ !filePath.endsWith('.js') &&
35
+ !filePath.endsWith('.jsx') &&
36
+ !filePath.endsWith('.cjs') &&
37
+ !filePath.endsWith('.mjs')) {
38
+ return;
39
+ }
40
+ let contents = tree.read(filePath, 'utf-8');
41
+ if (!contents)
42
+ return;
43
+ // Quick check: must contain the deprecated symbol and the deprecated package path
44
+ if (!contents.includes(DEPRECATED_SYMBOL) ||
45
+ (!contents.includes(`'${DEPRECATED_PACKAGE}'`) &&
46
+ !contents.includes(`"${DEPRECATED_PACKAGE}"`))) {
47
+ return;
48
+ }
49
+ let changed = false;
50
+ // Re-parse on every iteration so multiple matches in the same file work
51
+ // correctly. The multi-specifier branch prepends a new declaration which
52
+ // shifts every offset; collected AST positions go stale after one rewrite,
53
+ // so process one match at a time.
54
+ let didRewrite = true;
55
+ while (didRewrite) {
56
+ didRewrite = false;
57
+ const sourceFile = (0, tsquery_1.ast)(contents);
58
+ const importNode = (0, tsquery_1.query)(sourceFile, ES_IMPORT_SELECTOR)[0];
59
+ if (importNode) {
60
+ const specifiers = (0, tsquery_1.query)(importNode, IMPORT_SPECIFIERS_SELECTOR);
61
+ const targetIdentifier = (0, tsquery_1.query)(importNode, TARGET_IMPORT_SPECIFIER_SELECTOR)[0];
62
+ if (targetIdentifier) {
63
+ // Walk to the ImportSpecifier to cover `Foo` and `Foo as Bar`.
64
+ const targetSpec = targetIdentifier.parent;
65
+ if (specifiers.length === 1) {
66
+ const modulePathNode = (0, tsquery_1.query)(importNode, ES_MODULE_PATH_SELECTOR)[0];
67
+ if (modulePathNode) {
68
+ contents =
69
+ contents.slice(0, modulePathNode.getStart()) +
70
+ `'${NEW_PACKAGE}'` +
71
+ contents.slice(modulePathNode.getEnd());
72
+ changed = true;
73
+ didRewrite = true;
74
+ continue;
75
+ }
76
+ }
77
+ else {
78
+ // Extract target spec verbatim (preserves alias)
79
+ const end = endAfterTrailingComma(contents, targetSpec.getEnd());
80
+ contents =
81
+ `import { ${targetSpec.getText()} } from '${NEW_PACKAGE}';\n` +
82
+ contents.slice(0, targetSpec.getStart()) +
83
+ contents.slice(end);
84
+ changed = true;
85
+ didRewrite = true;
86
+ continue;
87
+ }
88
+ }
89
+ }
90
+ const stmtNode = (0, tsquery_1.query)(sourceFile, CJS_REQUIRE_STMT_SELECTOR)[0];
91
+ if (stmtNode) {
92
+ const bindingElements = (0, tsquery_1.query)(stmtNode, CJS_BINDING_ELEMENTS_SELECTOR);
93
+ const targetIdentifier = (0, tsquery_1.query)(stmtNode, CJS_TARGET_BINDING_SELECTOR)[0];
94
+ if (targetIdentifier) {
95
+ // Walk to the BindingElement to cover `Foo` and `Foo: Bar`.
96
+ const targetBinding = targetIdentifier.parent;
97
+ if (bindingElements.length === 1) {
98
+ const requirePathNode = (0, tsquery_1.query)(stmtNode, CJS_REQUIRE_PATH_SELECTOR)[0];
99
+ if (requirePathNode) {
100
+ contents =
101
+ contents.slice(0, requirePathNode.getStart()) +
102
+ `'${NEW_PACKAGE}'` +
103
+ contents.slice(requirePathNode.getEnd());
104
+ changed = true;
105
+ didRewrite = true;
106
+ continue;
107
+ }
108
+ }
109
+ else {
110
+ // Extract target binding verbatim (preserves alias)
111
+ const end = endAfterTrailingComma(contents, targetBinding.getEnd());
112
+ contents =
113
+ `const { ${targetBinding.getText()} } = require('${NEW_PACKAGE}');\n` +
114
+ contents.slice(0, targetBinding.getStart()) +
115
+ contents.slice(end);
116
+ changed = true;
117
+ didRewrite = true;
118
+ continue;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ if (changed) {
124
+ tree.write(filePath, contents);
125
+ }
126
+ });
127
+ await (0, devkit_1.formatFiles)(tree);
128
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/webpack/src/plugins/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAIlB,aAAa,EAOd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,oBAAoB,CAkC3D,CAAC;AAEF,eAAO,MAAM,aAAa,qCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/webpack/src/plugins/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,kBAAkB,EAKlB,aAAa,EAOd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,oBAAoB,CAgE3D,CAAC;AAEF,eAAO,MAAM,aAAa,qCAAc,CAAC"}
@@ -31,7 +31,27 @@ exports.createNodes = [
31
31
  const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
32
32
  const lockFileName = (0, js_1.getLockFileName)(packageManager);
33
33
  try {
34
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup, pmc, lockFileName), configFilePaths, normalizedOptions, context);
34
+ const { entries, preErrors } = await filterWebpackConfigs(configFilePaths, context);
35
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
36
+ let results = [];
37
+ let nodeErrors = [];
38
+ try {
39
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, opts, ctx, idx) => createNodesInternal(configFile, opts, ctx, targetsCache, isTsSolutionSetup, pmc, projectHashes[idx]), entries.map((e) => e.configFile), normalizedOptions, context);
40
+ }
41
+ catch (e) {
42
+ if (e instanceof devkit_1.AggregateCreateNodesError) {
43
+ results = e.partialResults ?? [];
44
+ nodeErrors = e.errors;
45
+ }
46
+ else {
47
+ throw e;
48
+ }
49
+ }
50
+ const allErrors = [...preErrors, ...nodeErrors];
51
+ if (allErrors.length > 0) {
52
+ throw new devkit_1.AggregateCreateNodesError(allErrors, results);
53
+ }
54
+ return results;
35
55
  }
36
56
  finally {
37
57
  targetsCache.writeToDisk();
@@ -39,15 +59,8 @@ exports.createNodes = [
39
59
  },
40
60
  ];
41
61
  exports.createNodesV2 = exports.createNodes;
42
- async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, lockFileName) {
62
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc, hash) {
43
63
  const projectRoot = (0, path_1.dirname)(configFilePath);
44
- // Do not create a project if package.json and project.json isn't there.
45
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
46
- if (!siblingFiles.includes('package.json') &&
47
- !siblingFiles.includes('project.json')) {
48
- return {};
49
- }
50
- const hash = await (0, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [lockFileName]);
51
64
  if (!targetsCache.has(hash)) {
52
65
  targetsCache.set(hash, await createWebpackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc));
53
66
  }
@@ -209,6 +222,28 @@ function normalizeOutputPath(outputPath, projectRoot) {
209
222
  }
210
223
  }
211
224
  }
225
+ async function filterWebpackConfigs(configFiles, context) {
226
+ const preErrors = [];
227
+ const candidates = await Promise.all(configFiles.map(async (configFile) => {
228
+ try {
229
+ const projectRoot = (0, path_1.dirname)(configFile);
230
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
231
+ if (!siblingFiles.includes('package.json') &&
232
+ !siblingFiles.includes('project.json')) {
233
+ return null;
234
+ }
235
+ return { configFile, projectRoot };
236
+ }
237
+ catch (e) {
238
+ preErrors.push([configFile, e]);
239
+ return null;
240
+ }
241
+ }));
242
+ return {
243
+ entries: candidates.filter((c) => c !== null),
244
+ preErrors,
245
+ };
246
+ }
212
247
  function normalizeOptions(options) {
213
248
  return {
214
249
  buildTargetName: options?.buildTargetName ?? 'build',