@gitlab/svgs 3.130.0 → 3.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/svgs",
3
- "version": "3.130.0",
3
+ "version": "3.131.0",
4
4
  "description": "SVG Assets for GitLab",
5
5
  "main": "./index.js",
6
6
  "repository": "git@gitlab.com:gitlab-org/gitlab-svgs.git",
@@ -339,6 +339,16 @@ const fileExtensionIcons = {
339
339
  cu: 'cuda',
340
340
  cuh: 'cuda',
341
341
  log: 'log',
342
+ 'code-workplace': 'vscode',
343
+ '7z': 'zip',
344
+ 'c++': 'cpp',
345
+ 'vbox-prev': 'virtual',
346
+ 'ng-template': 'angular',
347
+ 'YAML-tmLanguage': 'yaml',
348
+ };
349
+
350
+ const threeFileExtensionIcons = {
351
+ 'sln.dotsettings.user': 'settings',
342
352
  };
343
353
 
344
354
  const twoFileExtensionIcons = {
@@ -348,16 +358,10 @@ const twoFileExtensionIcons = {
348
358
  'mdown.rendered': 'markdown',
349
359
  'mkd.rendered': 'markdown',
350
360
  'mkdn.rendered': 'markdown',
351
- 'YAML-tmLanguage': 'yaml',
352
361
  'sln.dotsettings': 'settings',
353
- 'sln.dotsettings.user': 'settings',
354
362
  'd.dts': 'typescript-def',
355
363
  'd.mts': 'typescript-def',
356
364
  'd.ts': 'typescript-def',
357
- 'code-workplace': 'vscode',
358
- '7z': 'zip',
359
- 'c++': 'cpp',
360
- 'vbox-prev': 'virtual',
361
365
  'js.map': 'javascript-map',
362
366
  'css.map': 'css-map',
363
367
  'spec.ts': 'test-ts',
@@ -372,11 +376,8 @@ const twoFileExtensionIcons = {
372
376
  'spec.js': 'test-js',
373
377
  'test.js': 'test-js',
374
378
  'js.snap': 'test-js',
375
- // 'routing.ts': 'angular-routing',
376
- // 'routing.js': 'angular-routing',
377
379
  'module.ts': 'angular',
378
380
  'module.js': 'angular',
379
- 'ng-template': 'angular',
380
381
  'component.ts': 'angular-component',
381
382
  'component.js': 'angular-component',
382
383
  'guard.ts': 'angular-guard',
@@ -602,18 +603,35 @@ const fileNameIcons = {
602
603
  '.prettierrc.yml': 'prettier',
603
604
  '.prettierignore': 'prettier',
604
605
  'nodemon.json': 'nodemon',
605
- // '.sonarrc': 'sonar',
606
606
  browserslist: 'browserlist',
607
607
  '.browserslistrc': 'browserlist',
608
608
  '.snyk': 'snyk',
609
609
  '.drone.yml': 'drone',
610
610
  };
611
611
 
612
- function getIconForFile(name) {
612
+ const getPosition = (array, depth) => {
613
+ const index = array.length - depth;
614
+ if (!(index in array)) return undefined;
615
+ // + 1 skips the dot character
616
+ return array[index] + 1;
617
+ };
618
+
619
+ const getDeepExtensionIcon = (table, name, position) => {
620
+ if (!position) return undefined;
621
+ return table[name.substring(position)];
622
+ };
623
+
624
+ function getIconForFile(name = '') {
625
+ const directMatch = fileNameIcons[name];
626
+ if (directMatch) return directMatch;
627
+
628
+ const dotPositions = [...name.matchAll(/\./g)].map((match) => match.index);
629
+ if (dotPositions.length === 0) return '';
630
+
613
631
  return (
614
- fileNameIcons[name] ||
615
- twoFileExtensionIcons[name ? name.split('.').slice(-2).join('.') : ''] ||
616
- fileExtensionIcons[name ? name.split('.').pop().toLowerCase() : ''] ||
632
+ getDeepExtensionIcon(threeFileExtensionIcons, name, getPosition(dotPositions, 3)) ||
633
+ getDeepExtensionIcon(twoFileExtensionIcons, name, getPosition(dotPositions, 2)) ||
634
+ fileExtensionIcons[name.substring(getPosition(dotPositions, 1)).toLowerCase()] ||
617
635
  ''
618
636
  );
619
637
  }