Skip to content

Commit

Permalink
Merge pull request #20 from Hajime-san/fix-slow-types
Browse files Browse the repository at this point in the history
fix slow types
  • Loading branch information
Hajime-san authored Feb 26, 2024
2 parents 3735b16 + a4a1b0b commit 29210ac
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -51,3 +55,6 @@ jobs:
- name: test
run: deno task test

- name: publish test
run: deno publish --dry-run
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Please install [Deno](https://deno.land/[email protected]/getting_started/installat
## command
### remote
- dry run
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].23/bin.ts -b=./src -c=./tsconfig.json -d`
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].24/bin.ts -b=./src -c=./tsconfig.json -d`
- transform
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].23/bin.ts -b=./src -c=./tsconfig.json -r`
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].24/bin.ts -b=./src -c=./tsconfig.json -r`
### local
- `deno task run-dry`
- `deno task run`
Expand Down
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/resolve_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/str.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { hasUnicodeStr, unescapeUnicodeStr } from './str.ts';
const transformModuleSpecifier = (
sourceFile: ts.SourceFile,
imports: Array<ResolvedModuleImport>,
) => {
): (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);
Expand Down

0 comments on commit 29210ac

Please sign in to comment.