diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml index daefa90..e9e8b29 100644 --- a/.github/workflows/auto-merge.yaml +++ b/.github/workflows/auto-merge.yaml @@ -15,7 +15,7 @@ jobs: id: metadata uses: dependabot/fetch-metadata@v2 with: - github-token: "${{ secrets.GITHUB_TOKEN }}" + github-token: '${{ secrets.GITHUB_TOKEN }}' - name: Approve a PR run: gh pr review --approve "$PR_URL" env: diff --git a/src/index.ts b/src/index.ts index 9f809fb..951ee50 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,17 +1,16 @@ import pluginUtils from '@rollup/pluginutils'; import fs from 'fs'; -import { ExistingRawSourceMap, Plugin } from 'rollup'; +import { ExistingRawSourceMap, Plugin, PluginContext } from 'rollup'; import { promisify } from 'util'; import { resolveSourceMap, resolveSources } from './source-map-resolve'; import { SourcemapsPluginOptions } from './types'; const { createFilter } = pluginUtils; -export default function sourcemaps({ - include, - exclude, - readFile = fs.readFile, -}: SourcemapsPluginOptions = {}): Plugin { +export default function sourcemaps( + // eslint-disable-next-line @typescript-eslint/unbound-method + { include, exclude, readFile = fs.readFile }: SourcemapsPluginOptions = {}, +): Plugin { // Create a filter function based on the include and exclude options const filter = createFilter(include, exclude); @@ -21,7 +20,7 @@ export default function sourcemaps({ return { name: 'sourcemaps', - async load(id: string) { + load: async function (this: PluginContext, id: string) { let code: string; // If the id does not pass the filter, return null if (!filter(id)) { @@ -66,7 +65,7 @@ export default function sourcemaps({ const { sourcesContent } = await resolveSources(map, id, promisifiedReadFile); // If all sources are strings, assign them to map.sourcesContent if (sourcesContent.every(item => typeof item === 'string')) { - map.sourcesContent = sourcesContent as string[]; + map.sourcesContent = sourcesContent; } } catch { // If resolving the sources fails, warn