|
5 | 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
6 | 6 | */
|
7 | 7 | import { basename, dirname, sep } from 'node:path';
|
8 |
| -import { Messages, SfError } from '@salesforce/core'; |
| 8 | +import { Lifecycle, Messages, SfError } from '@salesforce/core'; |
9 | 9 | import { ensureString } from '@salesforce/ts-types';
|
10 | 10 | import { MetadataXml } from '../types';
|
11 | 11 | import { parseMetadataXml, parseNestedFullName } from '../../utils/path';
|
12 | 12 | import { SourceComponent } from '../sourceComponent';
|
13 | 13 | import { SourcePath } from '../../common/types';
|
14 | 14 | import { MetadataType } from '../../registry/types';
|
15 | 15 | import { RegistryAccess, typeAllowsMetadataWithContent } from '../../registry/registryAccess';
|
16 |
| -import { FindRootMetadata, GetComponent } from './types'; |
| 16 | +import { FindRootMetadata, MaybeGetComponent } from './types'; |
17 | 17 |
|
18 | 18 | Messages.importMessagesDirectory(__dirname);
|
19 | 19 | const messages = Messages.loadMessages('@salesforce/source-deploy-retrieve', 'sdr');
|
@@ -76,17 +76,16 @@ export const trimPathToContent =
|
76 | 76 | return pathParts.slice(0, typeFolderIndex + offset).join(sep);
|
77 | 77 | };
|
78 | 78 |
|
79 |
| -export const getComponent: GetComponent = |
| 79 | +export const getComponent: MaybeGetComponent = |
80 | 80 | (context) =>
|
81 | 81 | ({ type, path, metadataXml: findRootMetadata = defaultFindRootMetadata }) => {
|
82 | 82 | // find rootMetadata
|
83 | 83 | const metadataXml = typeof findRootMetadata === 'function' ? findRootMetadata(type, path) : findRootMetadata;
|
84 | 84 | if (!metadataXml) {
|
85 |
| - throw SfError.create({ |
86 |
| - message: messages.getMessage('error_parsing_xml', [path, type.name]), |
87 |
| - name: 'MissingXml', |
88 |
| - }); |
| 85 | + void Lifecycle.getInstance().emitWarning(messages.getMessage('error_parsing_xml', [path, type.name])); |
| 86 | + return; |
89 | 87 | }
|
| 88 | + |
90 | 89 | if (context.forceIgnore?.denies(metadataXml.path)) {
|
91 | 90 | throw SfError.create({
|
92 | 91 | message: messages.getMessage('error_no_metadata_xml_ignore', [metadataXml.path, path]),
|
|
0 commit comments