bump chokidar and fix Jasons comments

This commit is contained in:
Jonathan Jogenfors
2026-03-25 22:35:53 +01:00
parent 3e43da5d8d
commit fa9baad116
3 changed files with 67 additions and 15 deletions
+49 -3
View File
@@ -431,8 +431,8 @@ importers:
specifier: ^5.51.0
version: 5.70.4
chokidar:
specifier: ^4.0.3
version: 4.0.3
specifier: ^5.0.0
version: 5.0.0
class-transformer:
specifier: ^0.5.1
version: 0.5.1
@@ -592,7 +592,7 @@ importers:
version: 11.0.16(@swc/core@1.15.18(@swc/helpers@0.5.17))(@types/node@24.12.0)(esbuild@0.27.3)
'@nestjs/schematics':
specifier: ^11.0.0
version: 11.0.9(chokidar@4.0.3)(typescript@5.9.3)
version: 11.0.9(chokidar@5.0.0)(typescript@5.9.3)
'@nestjs/testing':
specifier: ^11.0.4
version: 11.1.16(@nestjs/common@11.1.16(class-transformer@0.5.1)(class-validator@0.15.1)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.16)(@nestjs/platform-express@11.1.16)
@@ -6050,6 +6050,10 @@ packages:
resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}
engines: {node: '>= 14.16.0'}
chokidar@5.0.0:
resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}
engines: {node: '>= 20.19.0'}
chownr@1.1.4:
resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
@@ -10540,6 +10544,10 @@ packages:
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
engines: {node: '>= 14.18.0'}
readdirp@5.0.0:
resolution: {integrity: sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==}
engines: {node: '>= 20.19.0'}
recma-build-jsx@1.0.0:
resolution: {integrity: sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==}
@@ -12602,6 +12610,17 @@ snapshots:
optionalDependencies:
chokidar: 4.0.3
'@angular-devkit/core@19.2.17(chokidar@5.0.0)':
dependencies:
ajv: 8.17.1
ajv-formats: 3.0.1(ajv@8.17.1)
jsonc-parser: 3.3.1
picomatch: 4.0.2
rxjs: 7.8.1
source-map: 0.7.4
optionalDependencies:
chokidar: 5.0.0
'@angular-devkit/core@19.2.19(chokidar@4.0.3)':
dependencies:
ajv: 8.17.1
@@ -12635,6 +12654,16 @@ snapshots:
transitivePeerDependencies:
- chokidar
'@angular-devkit/schematics@19.2.17(chokidar@5.0.0)':
dependencies:
'@angular-devkit/core': 19.2.17(chokidar@5.0.0)
jsonc-parser: 3.3.1
magic-string: 0.30.17
ora: 5.4.1
rxjs: 7.8.1
transitivePeerDependencies:
- chokidar
'@angular-devkit/schematics@19.2.19(chokidar@4.0.3)':
dependencies:
'@angular-devkit/core': 19.2.19(chokidar@4.0.3)
@@ -15720,6 +15749,17 @@ snapshots:
transitivePeerDependencies:
- chokidar
'@nestjs/schematics@11.0.9(chokidar@5.0.0)(typescript@5.9.3)':
dependencies:
'@angular-devkit/core': 19.2.17(chokidar@5.0.0)
'@angular-devkit/schematics': 19.2.17(chokidar@5.0.0)
comment-json: 4.4.1
jsonc-parser: 3.3.1
pluralize: 8.0.0
typescript: 5.9.3
transitivePeerDependencies:
- chokidar
'@nestjs/swagger@11.2.6(@nestjs/common@11.1.16(class-transformer@0.5.1)(class-validator@0.15.1)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@11.1.16)(class-transformer@0.5.1)(class-validator@0.15.1)(reflect-metadata@0.2.2)':
dependencies:
'@microsoft/tsdoc': 0.16.0
@@ -18441,6 +18481,10 @@ snapshots:
dependencies:
readdirp: 4.1.2
chokidar@5.0.0:
dependencies:
readdirp: 5.0.0
chownr@1.1.4: {}
chownr@2.0.0: {}
@@ -23672,6 +23716,8 @@ snapshots:
readdirp@4.1.2: {}
readdirp@5.0.0: {}
recma-build-jsx@1.0.0:
dependencies:
'@types/estree': 1.0.8
+1 -1
View File
@@ -64,7 +64,7 @@
"bcrypt": "^6.0.0",
"body-parser": "^2.2.0",
"bullmq": "^5.51.0",
"chokidar": "^4.0.3",
"chokidar": "^5.0.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.15.0",
"compression": "^1.8.0",
+17 -11
View File
@@ -26,6 +26,21 @@ import { JobOf } from 'src/types';
import { mimeTypes } from 'src/utils/mime-types';
import { handlePromiseError } from 'src/utils/misc';
const createMatchers = (exclusionPatterns: string[]) => {
const supportedExtensions = mimeTypes.getSupportedFileExtensions().map((extension) => extension.toLowerCase());
const expandedPatterns = exclusionPatterns.flatMap((pattern) =>
pattern.endsWith('/**') ? [pattern, pattern.slice(0, -3)] : [pattern],
);
const excludeMatcher = picomatch(expandedPatterns, { nocase: true });
return {
isExcluded: (path: string) => excludeMatcher(path.replaceAll('\\', '/')),
isSupported: (path: string) => {
const normalizedPath = path.toLowerCase();
return supportedExtensions.some((extension) => normalizedPath.endsWith(extension));
},
};
};
@Injectable()
export class LibraryService extends BaseService {
private watchLibraries = false;
@@ -90,22 +105,13 @@ export class LibraryService extends BaseService {
this.logger.log(`Starting to watch library ${library.id} with import path(s) ${library.importPaths}`);
const supportedExtensions = mimeTypes.getSupportedFileExtensions().map((extension) => extension.toLowerCase());
const exclusionPatterns = library.exclusionPatterns.flatMap((pattern) =>
pattern.endsWith('/**') ? [pattern, pattern.slice(0, -3)] : [pattern],
);
const excludeMatcher = picomatch(exclusionPatterns, { nocase: true });
const isExcluded = (path: string) => excludeMatcher(path.replaceAll('\\', '/'));
const isSupportedFile = (path: string) => {
const normalizedPath = path.toLowerCase();
return supportedExtensions.some((extension) => normalizedPath.endsWith(extension));
};
const { isExcluded, isSupported } = createMatchers(library.exclusionPatterns);
let _resolve: () => void;
const ready$ = new Promise<void>((resolve) => (_resolve = resolve));
const handler = async (event: string, path: string) => {
const ignored = !isSupportedFile(path);
const ignored = !isSupported(path);
if (ignored) {
this.logger.verbose(`Ignoring file ${event} event for ${path} in library ${library.id}`);