mirror of
https://github.com/mastodon/mastodon.git
synced 2026-02-22 00:58:30 +00:00
changes entrypoints and tweaks manifest augmenter
This commit is contained in:
parent
fa4243c28c
commit
f72699db08
|
|
@ -1,8 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script type="module" src="./application.ts"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mastodon"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -13,13 +13,6 @@ export interface Options {
|
|||
* @default ['sha384']
|
||||
*/
|
||||
algorithms?: Algorithm[];
|
||||
|
||||
/**
|
||||
* Path of the manifest files that should be read and augmented with the
|
||||
* integrity hash, relative to `outDir`.
|
||||
* @default ['manifest.json', 'manifest-assets.json']
|
||||
*/
|
||||
manifestPaths?: string[];
|
||||
}
|
||||
|
||||
declare module 'vite' {
|
||||
|
|
@ -29,26 +22,14 @@ declare module 'vite' {
|
|||
}
|
||||
|
||||
export function manifestSRI(options: Options = {}): Plugin {
|
||||
const {
|
||||
algorithms = ['sha384'],
|
||||
manifestPaths = [
|
||||
'.vite/manifest.json',
|
||||
'.vite/manifest-assets.json',
|
||||
'manifest.json',
|
||||
'manifest-assets.json',
|
||||
],
|
||||
} = options;
|
||||
const { algorithms = ['sha384'] } = options;
|
||||
|
||||
return {
|
||||
name: 'vite-plugin-manifest-sri',
|
||||
apply: 'build',
|
||||
enforce: 'post',
|
||||
async writeBundle({ dir }) {
|
||||
await Promise.all(
|
||||
manifestPaths.map((path) =>
|
||||
augmentManifest(path, algorithms, dir ?? ''),
|
||||
),
|
||||
);
|
||||
await augmentManifest('manifest.json', algorithms, dir ?? '');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,17 @@ export default defineConfig({
|
|||
emptyOutDir: true,
|
||||
manifest: 'manifest.json',
|
||||
rollupOptions: {
|
||||
input: {
|
||||
admin: path.resolve(__dirname, 'app/javascript/entrypoints/admin.tsx'),
|
||||
application: path.resolve(
|
||||
__dirname,
|
||||
'app/javascript/entrypoints/application.ts',
|
||||
),
|
||||
twoFactor: path.resolve(
|
||||
__dirname,
|
||||
'app/javascript/entrypoints/two_factor_authentication.ts',
|
||||
),
|
||||
},
|
||||
output: {
|
||||
chunkFileNames: (chunkInfo) => {
|
||||
if (
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user