Skip to content

Commit ee9cfb8

Browse files
committed
[INTERNAL] AbstractReader: Remove obsolete filter and flatten methods
They have been moved to resourceFactory in #438 All known consumers have been updated accordingly.
1 parent fab0090 commit ee9cfb8

File tree

2 files changed

+0
-70
lines changed

2 files changed

+0
-70
lines changed

lib/AbstractReader.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -82,46 +82,6 @@ class AbstractReader {
8282
});
8383
}
8484

85-
/**
86-
* Create a [Filter-Reader]{@link @ui5/fs/readers/Filter} from the current reader.
87-
*
88-
* @public
89-
* @param {@ui5/fs/readers/Filter~callback} callback
90-
* Filter function. Will be called for every resource passed through this reader.
91-
* @returns {Promise<@ui5/fs/readers/Filter>} Promise resolving with filter instance
92-
*/
93-
async filter(callback) {
94-
console.warn("DEPRECATED CALL TO AbstractReader#filter - THIS FUNCTION WILL BE REMOVED IN THE NEXT RELEASE");
95-
const {default: Filter} = await import("./readers/Filter.js");
96-
return new Filter({
97-
reader: this,
98-
callback
99-
});
100-
}
101-
102-
/**
103-
* Create a [Link-Reader]{@link @ui5/fs/readers/Link} where all requests are prefixed with
104-
* <code>/resources/<namespace></code>.
105-
*
106-
* This simulates "flat" resource access, which is for example common for projects of type
107-
* "application".
108-
*
109-
* @public
110-
* @param {string} namespace Project namespace
111-
* @returns {Promise<@ui5/fs/readers/Link>} Promise resolving with reader instance
112-
*/
113-
async flatten(namespace) {
114-
console.warn("DEPRECATED CALL TO AbstractReader#flatten - THIS FUNCTION WILL BE REMOVED IN THE NEXT RELEASE");
115-
const {default: Link} = await import("./readers/Link.js");
116-
return new Link({
117-
reader: this,
118-
pathMapping: {
119-
linkPath: `/`,
120-
targetPath: `/resources/${namespace}/`
121-
}
122-
});
123-
}
124-
12585
/**
12686
* Locates resources by one or more glob patterns.
12787
*

test/lib/resources.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,6 @@ test("Get resource from application.a (/index.html) and write it to /dest/ using
3737
});
3838
});
3939

40-
test("Legacy: Filter resources", async (t) => {
41-
const source = createAdapter({
42-
fsBasePath: "./test/fixtures/application.a/webapp",
43-
virBasePath: "/app/"
44-
});
45-
const filteredSource = await source.filter((resource) => {
46-
return resource.getPath().endsWith(".js");
47-
});
48-
const sourceResources = await source.byGlob("**");
49-
t.is(sourceResources.length, 2, "Found two resources in source");
50-
51-
const resources = await filteredSource.byGlob("**");
52-
53-
t.is(resources.length, 1, "Found exactly one resource via filter");
54-
t.is(resources[0].getPath(), "/app/test.js", "Found correct resource");
55-
});
56-
57-
test("Legacy: Flatten resources", async (t) => {
58-
const source = createAdapter({
59-
fsBasePath: "./test/fixtures/application.a/webapp",
60-
virBasePath: "/resources/app/"
61-
});
62-
const transformedSource = await source.flatten("app");
63-
64-
const resources = await transformedSource.byGlob("**/*.js");
65-
t.is(resources.length, 1, "Found one resource via transformer");
66-
t.is(resources[0].getPath(), "/test.js", "Found correct resource");
67-
});
68-
69-
7040
test("Filter resources", async (t) => {
7141
const source = createAdapter({
7242
fsBasePath: "./test/fixtures/application.a/webapp",

0 commit comments

Comments
 (0)