diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1a2e643..bb47893 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,10 @@ jobs: test: runs-on: ubuntu-latest timeout-minutes: 10 + permissions: + contents: read # need for checkout + id-token: write # The OIDC ID token is used for authentication with JSR. + steps: - uses: actions/checkout@v4 @@ -51,3 +55,6 @@ jobs: - name: test run: deno task test + + - name: publish test + run: deno publish --dry-run diff --git a/README.md b/README.md index f9b24a4..7c039dc 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ Please install [Deno](https://deno.land/manual@v1.30.3/getting_started/installat ## command ### remote - dry run - - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.23/bin.ts -b=./src -c=./tsconfig.json -d` + - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.24/bin.ts -b=./src -c=./tsconfig.json -d` - transform - - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.23/bin.ts -b=./src -c=./tsconfig.json -r` + - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.24/bin.ts -b=./src -c=./tsconfig.json -r` ### local - `deno task run-dry` - `deno task run` diff --git a/deno.jsonc b/deno.jsonc index 07e5950..97fe8ed 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "name": "@hajime-san/specifier-resolver", - "version": "1.0.23", + "version": "1.0.24", "exports": "./bin.ts", "tasks": { "set-up": "cd examples/repo && npm ci", diff --git a/src/resolve_util.ts b/src/resolve_util.ts index 303b411..e7d28ce 100644 --- a/src/resolve_util.ts +++ b/src/resolve_util.ts @@ -5,7 +5,7 @@ export const resolveModuleName = (args: { fileName: string; targetFileAbsPath: string; tsConfigObject: ts.ParsedCommandLine; -}) => { +}): ts.ResolvedModuleWithFailedLookupLocations => { const { fileName, targetFileAbsPath, tsConfigObject } = args; return ts.resolveModuleName( fileName, diff --git a/src/str.ts b/src/str.ts index 0245324..50e76ba 100644 --- a/src/str.ts +++ b/src/str.ts @@ -21,7 +21,7 @@ export const NEW_LINE = '\n//_PRESERVE_NEWLINE_//\n'; * @param str * @returns */ -export const preserveNewLine = (str: string) => { +export const preserveNewLine = (str: string): string => { return str.replace(/(\r|\n)\n/g, NEW_LINE); }; @@ -30,7 +30,7 @@ export const preserveNewLine = (str: string) => { * @param str * @returns */ -export const restoreNewLine = (str: string) => { +export const restoreNewLine = (str: string): string => { return str // with newline .replace(/\/\/_PRESERVE_NEWLINE_\/\/\n/g, fs.EOL) diff --git a/src/transform.ts b/src/transform.ts index 46c93e6..ad0bcc9 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -8,7 +8,7 @@ import { hasUnicodeStr, unescapeUnicodeStr } from './str.ts'; const transformModuleSpecifier = ( sourceFile: ts.SourceFile, imports: Array, -) => { +): (context: ts.TransformationContext) => (rootNode: ts.Node) => ts.Node => { return (context: ts.TransformationContext) => (rootNode: ts.Node) => { const visit = (node: ts.Node): ts.Node => { const newNode = ts.visitEachChild(node, visit, context);