From 5e55be1d73886b2d550cf13de694b5bb2a72428b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 15:58:55 +0000 Subject: [PATCH 1/2] Restore renamed PrefetchedDocumentLoader fields as deprecated aliases Bumping @rubensworks/eslint-config renamed the public static fields CJS_MAJOR_VERSION, CONTEXT_URL and CONTEXT_PATTERN to camelCase, which breaks dependents that still use the old names. For example, componentsjs-generator 4.2.0 reads PrefetchedDocumentLoader.CONTEXT_URL, so it now generates contexts with null instead of the Components.js context URL, after which no config that uses those contexts can be loaded. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UeSuG8npLjD7EpaYC6LCWE --- lib/rdf/PrefetchedDocumentLoader.ts | 18 ++++++++++++++++++ test/unit/rdf/PrefetchedDocumentLoader-test.ts | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/lib/rdf/PrefetchedDocumentLoader.ts b/lib/rdf/PrefetchedDocumentLoader.ts index 65fb04b..169f064 100644 --- a/lib/rdf/PrefetchedDocumentLoader.ts +++ b/lib/rdf/PrefetchedDocumentLoader.ts @@ -17,6 +17,24 @@ export class PrefetchedDocumentLoader extends FetchDocumentLoader { public static readonly contextPattern: RegExp = /https:\/\/linkedsoftwaredependencies.org\/bundles\/npm\/componentsjs\/\^([0-9]+).0.0\/components\/context.jsonld/u; + /** + * @deprecated Use {@link PrefetchedDocumentLoader.cjsMajorVersion} instead. + */ + // eslint-disable-next-line ts/naming-convention + public static readonly CJS_MAJOR_VERSION: number = PrefetchedDocumentLoader.cjsMajorVersion; + + /** + * @deprecated Use {@link PrefetchedDocumentLoader.contextUrl} instead. + */ + // eslint-disable-next-line ts/naming-convention + public static readonly CONTEXT_URL: string = PrefetchedDocumentLoader.contextUrl; + + /** + * @deprecated Use {@link PrefetchedDocumentLoader.contextPattern} instead. + */ + // eslint-disable-next-line ts/naming-convention + public static readonly CONTEXT_PATTERN: RegExp = PrefetchedDocumentLoader.contextPattern; + private static readonly defaultContext: any = contextJson; private static readonly defaultContexts: Record = { diff --git a/test/unit/rdf/PrefetchedDocumentLoader-test.ts b/test/unit/rdf/PrefetchedDocumentLoader-test.ts index 5ae816f..690421e 100644 --- a/test/unit/rdf/PrefetchedDocumentLoader-test.ts +++ b/test/unit/rdf/PrefetchedDocumentLoader-test.ts @@ -20,6 +20,14 @@ describe('PrefetchedDocumentLoader', () => { }); }); + describe('deprecated static fields', () => { + it('equal their renamed fields', () => { + expect(PrefetchedDocumentLoader.CJS_MAJOR_VERSION).toBe(PrefetchedDocumentLoader.cjsMajorVersion); + expect(PrefetchedDocumentLoader.CONTEXT_URL).toBe(PrefetchedDocumentLoader.contextUrl); + expect(PrefetchedDocumentLoader.CONTEXT_PATTERN).toBe(PrefetchedDocumentLoader.contextPattern); + }); + }); + describe('load', () => { it('for a prefetched context', async() => { await expect(loader.load('http://example.org/context')).resolves From 5eb449d71ac80979175fb49917288a0ffc09a074 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 16:03:35 +0000 Subject: [PATCH 2/2] Wait for the slow import in the test of a failing import The test ended as soon as the unknown import failed, while the slow import was still being parsed, so it was parsed after the Jest environment had been torn down. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UeSuG8npLjD7EpaYC6LCWE --- test/unit/rdf/RdfParser-test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/rdf/RdfParser-test.ts b/test/unit/rdf/RdfParser-test.ts index 4cba72f..15630d9 100644 --- a/test/unit/rdf/RdfParser-test.ts +++ b/test/unit/rdf/RdfParser-test.ts @@ -423,6 +423,17 @@ describe('RdfParser', () => { }); it('for a Turtle stream with a slow import followed by an import to unknown file', async() => { + const parse = RdfParser.prototype.parse; + let resolveSlowImport: () => void; + const slowImportEnded = new Promise(resolve => resolveSlowImport = resolve); + const parseSpy = jest.spyOn(RdfParser.prototype, 'parse') + .mockImplementation(function(this: RdfParser, textStream, parseOptions) { + const stream = parse.call(this, textStream, parseOptions); + if (parseOptions.path === 'http://example.org/myfileslow.ttl') { + stream.on('end', () => resolveSlowImport()); + } + return stream; + }); const options: RdfParserOptions = { path: 'path/to/file.ttl', }; @@ -431,6 +442,10 @@ describe('RdfParser', () => { `; await expect(arrayifyStream(parser.parse(streamifyString(doc), options))).rejects .toThrow(new Error(`Error while parsing file "path/to/file.ttl": URL not found: http://example.org/myfileunknown.ttl`)); + + // The slow import is still being parsed, so it must end before this test does + await slowImportEnded; + parseSpy.mockRestore(); }); it('for a Turtle stream with imports and a blank node prefix should derive prefixes for imports', async() => {