@@ -89,7 +89,7 @@ describe('FileReaderProcessor', () => {
|
||||
type: 'file',
|
||||
target: expect.stringMatching(/^[^*]*$/),
|
||||
});
|
||||
expect(emit.mock.calls[1][0].key).toContain('file:');
|
||||
expect(emit.mock.calls[1][0].key).toContain('file://');
|
||||
expect(emit.mock.calls[1][0].key).toContain(
|
||||
'fileReaderProcessor/component.yaml',
|
||||
);
|
||||
|
||||
@@ -52,6 +52,7 @@ export class FileReaderProcessor implements CatalogProcessor {
|
||||
if (fileMatches.length > 0) {
|
||||
for (const fileMatch of fileMatches) {
|
||||
const data = await fs.readFile(fileMatch);
|
||||
const normalizedFilePath = path.normalize(fileMatch);
|
||||
|
||||
// The normalize converts to native slashes; the glob library returns
|
||||
// forward slashes even on windows
|
||||
@@ -59,13 +60,13 @@ export class FileReaderProcessor implements CatalogProcessor {
|
||||
data: data,
|
||||
location: {
|
||||
type: LOCATION_TYPE,
|
||||
target: path.normalize(fileMatch),
|
||||
target: normalizedFilePath,
|
||||
},
|
||||
})) {
|
||||
emit(parseResult);
|
||||
emit(
|
||||
processingResult.refresh(
|
||||
`${LOCATION_TYPE}:${path.normalize(fileMatch)}`,
|
||||
`${LOCATION_TYPE}://${normalizedFilePath}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ describe('PlaceholderProcessor', () => {
|
||||
console.log(emitted);
|
||||
expect(emitted[0]).toEqual({
|
||||
type: 'refresh',
|
||||
key: 'url:./path-to-file.json',
|
||||
key: 'url:http://example.com/path-to-file.json',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -134,7 +134,17 @@ export class PlaceholderProcessor implements CatalogProcessor {
|
||||
base,
|
||||
});
|
||||
|
||||
emit(processingResult.refresh(`url:${resolverValue}`));
|
||||
emit(
|
||||
processingResult.refresh(
|
||||
`url:${relativeUrl({
|
||||
key: resolverKey,
|
||||
value: resolverValue,
|
||||
baseUrl: location.target,
|
||||
read,
|
||||
resolveUrl,
|
||||
})}`,
|
||||
),
|
||||
);
|
||||
|
||||
return [
|
||||
await resolver({
|
||||
|
||||
Reference in New Issue
Block a user