Skip to content

Commit b3160e5

Browse files
committed
Remove deprecation warning on old CJS context URLs
1 parent fb353e1 commit b3160e5

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

lib/rdf/PrefetchedDocumentLoader.ts

-7
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ export class PrefetchedDocumentLoader extends FetchDocumentLoader {
4545
}
4646

4747
public async load(url: string): Promise<IJsonLdContext> {
48-
// Warn on deprecated context usage
49-
// eslint-disable-next-line max-len
50-
const match = PrefetchedDocumentLoader.CONTEXT_PATTERN.exec(url);
51-
if (this.logger && match && Number.parseInt(match[1], 10) < PrefetchedDocumentLoader.CJS_MAJOR_VERSION) {
52-
this.logger.warn(`Detected deprecated context URL '${url}'${this.path ? ` in ${this.path}` : ''}. Prefer using version '^${PrefetchedDocumentLoader.CJS_MAJOR_VERSION}.0.0' instead.`);
53-
}
54-
5548
// Load prefetched contexts
5649
if (url in this.contexts) {
5750
return this.contexts[url];

test/unit/rdf/PrefetchedDocumentLoader-test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('PrefetchedDocumentLoader', () => {
4646
});
4747
expect(await loader.load(`https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld`))
4848
.toEqual(JSON.parse(fs.readFileSync(`${__dirname}/../../../components/context.jsonld`, 'utf8')));
49-
expect(logger.warn).toHaveBeenCalledWith(`Detected deprecated context URL 'https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld' in PATH. Prefer using version '^${PrefetchedDocumentLoader.CJS_MAJOR_VERSION}.0.0' instead.`);
49+
expect(logger.warn).not.toHaveBeenCalled();
5050
});
5151

5252
it('for the built-in prefetched 4.0.0 context that is deprecated with a logger', async() => {
@@ -60,7 +60,7 @@ describe('PrefetchedDocumentLoader', () => {
6060
});
6161
expect(await loader.load(`https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld`))
6262
.toEqual(JSON.parse(fs.readFileSync(`${__dirname}/../../../components/context.jsonld`, 'utf8')));
63-
expect(logger.warn).toHaveBeenCalledWith(`Detected deprecated context URL 'https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld' in PATH. Prefer using version '^${PrefetchedDocumentLoader.CJS_MAJOR_VERSION}.0.0' instead.`);
63+
expect(logger.warn).not.toHaveBeenCalled();
6464
});
6565

6666
it('for the built-in prefetched latest context that is not deprecated with a logger', async() => {
@@ -87,7 +87,7 @@ describe('PrefetchedDocumentLoader', () => {
8787
});
8888
expect(await loader.load(`https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld`))
8989
.toEqual(JSON.parse(fs.readFileSync(`${__dirname}/../../../components/context.jsonld`, 'utf8')));
90-
expect(logger.warn).toHaveBeenCalledWith(`Detected deprecated context URL 'https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld'. Prefer using version '^${PrefetchedDocumentLoader.CJS_MAJOR_VERSION}.0.0' instead.`);
90+
expect(logger.warn).not.toHaveBeenCalled();
9191
});
9292

9393
it('for a non-prefetched context', async() => {

0 commit comments

Comments
 (0)