From b3160e5b9043efc826cce807d7c5c7cb86e67a4a Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Tue, 5 Mar 2024 11:02:54 +0100 Subject: [PATCH] Remove deprecation warning on old CJS context URLs --- lib/rdf/PrefetchedDocumentLoader.ts | 7 ------- test/unit/rdf/PrefetchedDocumentLoader-test.ts | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/rdf/PrefetchedDocumentLoader.ts b/lib/rdf/PrefetchedDocumentLoader.ts index b08ab4a..187cf18 100644 --- a/lib/rdf/PrefetchedDocumentLoader.ts +++ b/lib/rdf/PrefetchedDocumentLoader.ts @@ -45,13 +45,6 @@ export class PrefetchedDocumentLoader extends FetchDocumentLoader { } public async load(url: string): Promise { - // Warn on deprecated context usage - // eslint-disable-next-line max-len - const match = PrefetchedDocumentLoader.CONTEXT_PATTERN.exec(url); - if (this.logger && match && Number.parseInt(match[1], 10) < PrefetchedDocumentLoader.CJS_MAJOR_VERSION) { - this.logger.warn(`Detected deprecated context URL '${url}'${this.path ? ` in ${this.path}` : ''}. Prefer using version '^${PrefetchedDocumentLoader.CJS_MAJOR_VERSION}.0.0' instead.`); - } - // Load prefetched contexts if (url in this.contexts) { return this.contexts[url]; diff --git a/test/unit/rdf/PrefetchedDocumentLoader-test.ts b/test/unit/rdf/PrefetchedDocumentLoader-test.ts index 8afd909..4fc50c1 100644 --- a/test/unit/rdf/PrefetchedDocumentLoader-test.ts +++ b/test/unit/rdf/PrefetchedDocumentLoader-test.ts @@ -46,7 +46,7 @@ describe('PrefetchedDocumentLoader', () => { }); expect(await loader.load(`https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld`)) .toEqual(JSON.parse(fs.readFileSync(`${__dirname}/../../../components/context.jsonld`, 'utf8'))); - 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.`); + expect(logger.warn).not.toHaveBeenCalled(); }); it('for the built-in prefetched 4.0.0 context that is deprecated with a logger', async() => { @@ -60,7 +60,7 @@ describe('PrefetchedDocumentLoader', () => { }); expect(await loader.load(`https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld`)) .toEqual(JSON.parse(fs.readFileSync(`${__dirname}/../../../components/context.jsonld`, 'utf8'))); - 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.`); + expect(logger.warn).not.toHaveBeenCalled(); }); it('for the built-in prefetched latest context that is not deprecated with a logger', async() => { @@ -87,7 +87,7 @@ describe('PrefetchedDocumentLoader', () => { }); expect(await loader.load(`https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^3.0.0/components/context.jsonld`)) .toEqual(JSON.parse(fs.readFileSync(`${__dirname}/../../../components/context.jsonld`, 'utf8'))); - 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.`); + expect(logger.warn).not.toHaveBeenCalled(); }); it('for a non-prefetched context', async() => {