Webpack: convert git-loader to TypeScript

merge-requests/1838/head
Alex Gleason 2022-10-14 15:52:02 -05:00
rodzic b770cbb175
commit 239ccb807a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 15 dodań i 9 usunięć

Wyświetl plik

@ -1,8 +0,0 @@
const { resolve } = require('path');
// Forces recompile whenever the current commit changes
// Useful for generating the version hash in the UI
module.exports = function(source, map) {
this.addDependency(resolve(__dirname, '../../.git/logs/HEAD'));
this.callback(null, source, map);
};

Wyświetl plik

@ -0,0 +1,14 @@
import { resolve } from 'path';
import { LoaderContext } from 'webpack';
/**
* Forces recompile whenever the current commit changes.
* Useful for generating the version hash in the UI.
*/
function loader(this: LoaderContext<{}>, content: string) {
this.addDependency(resolve(__dirname, '../../.git/logs/HEAD'));
this.callback(undefined, content);
}
export default loader;

Wyświetl plik

@ -6,7 +6,7 @@ import type { RuleSetRule } from 'webpack';
const rule: RuleSetRule = {
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
use: {
loader: resolve(__dirname, '../loaders/git-loader.js'),
loader: resolve(__dirname, '../loaders/git-loader.ts'),
},
};