From 4abbda6c11e5b93648130901dae8a4310a404794 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:01:11 +0900 Subject: [PATCH 1/6] feat: add `jsr:` specifier --- src/deps.ts | 10 +++++----- src/dev_deps.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/deps.ts b/src/deps.ts index ca282aa..7f926a3 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -1,6 +1,6 @@ -export * as path from 'https://deno.land/std@0.177.0/path/mod.ts'; -export { walk } from 'https://deno.land/std@0.177.0/fs/walk.ts'; +export * as path from 'jsr:@std/path@0.217.0'; +export { walk } from 'jsr:@std/fs@0.217.0'; export { default as ts } from 'npm:typescript@5.0.3'; -export * as cli from 'https://deno.land/std@0.177.0/flags/mod.ts'; -export * as io from 'https://deno.land/std@0.177.0/io/mod.ts'; -export * as fs from 'https://deno.land/std@0.177.0/fs/mod.ts'; +export * as cli from 'jsr:@std/flags@0.217.0'; +export * as io from 'jsr:@std/io@0.217.0'; +export * as fs from 'jsr:@std/fs@0.217.0'; diff --git a/src/dev_deps.ts b/src/dev_deps.ts index 71dce28..c31f39e 100644 --- a/src/dev_deps.ts +++ b/src/dev_deps.ts @@ -1 +1 @@ -export * as asserts from 'https://deno.land/std@0.177.0/testing/asserts.ts'; +export * as asserts from 'jsr:@std/assert@0.217.0'; From d6dab2fe9e4141547d461e48c12c0596127ed3b0 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:01:59 +0900 Subject: [PATCH 2/6] fix code --- bin.ts | 1 - src/resolve_util_test.ts | 2 +- src/str.ts | 10 ++-------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/bin.ts b/bin.ts index f65481f..28dc4ec 100644 --- a/bin.ts +++ b/bin.ts @@ -86,7 +86,6 @@ const main = async (args: { tsConfigObject, printer, }), - tsConfigObject.options.newLine, ); transformedList.push({ path: targetFileAbsPath, diff --git a/src/resolve_util_test.ts b/src/resolve_util_test.ts index 8e578f3..2047cf1 100644 --- a/src/resolve_util_test.ts +++ b/src/resolve_util_test.ts @@ -132,7 +132,7 @@ Deno.test('getResolvedStringLiteral', async (t) => { await t.step('node_module', () => { assertEquals( getResolvedStringLiteral({ - originalText: '\'react\'', + originalText: "'react'", imports: [], }), 'react', diff --git a/src/str.ts b/src/str.ts index 04654c0..0245324 100644 --- a/src/str.ts +++ b/src/str.ts @@ -30,16 +30,10 @@ export const preserveNewLine = (str: string) => { * @param str * @returns */ -export const restoreNewLine = (str: string, newLineConfig?: ts.NewLineKind) => { - const newLineStr = newLineConfig - // Prioritize tsconfig newLine option, otherwise it belongs to os. - ? newLineConfig === ts.NewLineKind.LineFeed ? fs.EOL.LF : fs.EOL.CRLF - : Deno.build.os === 'windows' - ? fs.EOL.CRLF - : fs.EOL.LF; +export const restoreNewLine = (str: string) => { return str // with newline - .replace(/\/\/_PRESERVE_NEWLINE_\/\/\n/g, newLineStr) + .replace(/\/\/_PRESERVE_NEWLINE_\/\/\n/g, fs.EOL) // without newline .replace(/\/\/_PRESERVE_NEWLINE_\/\//g, ''); }; From bd819af6ef9a943b8a902605750d8d9d3e2294b4 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:02:11 +0900 Subject: [PATCH 3/6] chore: update lock --- deno.lock | 112 +++++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/deno.lock b/deno.lock index ea0fca4..47f55e9 100644 --- a/deno.lock +++ b/deno.lock @@ -1,66 +1,64 @@ { - "version": "2", - "remote": { - "https://deno.land/std@0.177.0/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462", - "https://deno.land/std@0.177.0/_util/os.ts": "d932f56d41e4f6a6093d56044e29ce637f8dcc43c5a90af43504a889cf1775e3", - "https://deno.land/std@0.177.0/bytes/bytes_list.ts": "b4cbdfd2c263a13e8a904b12d082f6177ea97d9297274a4be134e989450dfa6a", - "https://deno.land/std@0.177.0/bytes/concat.ts": "d26d6f3d7922e6d663dacfcd357563b7bf4a380ce5b9c2bbe0c8586662f25ce2", - "https://deno.land/std@0.177.0/bytes/copy.ts": "939d89e302a9761dcf1d9c937c7711174ed74c59eef40a1e4569a05c9de88219", - "https://deno.land/std@0.177.0/flags/mod.ts": "d1cdefa18472ef69858a17df5cf7c98445ed27ac10e1460183081303b0ebc270", - "https://deno.land/std@0.177.0/fmt/colors.ts": "938c5d44d889fb82eff6c358bea8baa7e85950a16c9f6dae3ec3a7a729164471", - "https://deno.land/std@0.177.0/fs/_util.ts": "65381f341af1ff7f40198cee15c20f59951ac26e51ddc651c5293e24f9ce6f32", - "https://deno.land/std@0.177.0/fs/copy.ts": "14214efd94fc3aa6db1e4af2b4b9578e50f7362b7f3725d5a14ad259a5df26c8", - "https://deno.land/std@0.177.0/fs/empty_dir.ts": "c3d2da4c7352fab1cf144a1ecfef58090769e8af633678e0f3fabaef98594688", - "https://deno.land/std@0.177.0/fs/ensure_dir.ts": "724209875497a6b4628dfb256116e5651c4f7816741368d6c44aab2531a1e603", - "https://deno.land/std@0.177.0/fs/ensure_file.ts": "c38602670bfaf259d86ca824a94e6cb9e5eb73757fefa4ebf43a90dd017d53d9", - "https://deno.land/std@0.177.0/fs/ensure_link.ts": "c0f5b2f0ec094ed52b9128eccb1ee23362a617457aa0f699b145d4883f5b2fb4", - "https://deno.land/std@0.177.0/fs/ensure_symlink.ts": "2955cc8332aeca9bdfefd05d8d3976b94e282b0f353392a71684808ed2ffdd41", - "https://deno.land/std@0.177.0/fs/eol.ts": "f1f2eb348a750c34500741987b21d65607f352cf7205f48f4319d417fff42842", - "https://deno.land/std@0.177.0/fs/exists.ts": "b8c8a457b71e9d7f29b9d2f87aad8dba2739cbe637e8926d6ba6e92567875f8e", - "https://deno.land/std@0.177.0/fs/expand_glob.ts": "45d17e89796a24bd6002e4354eda67b4301bb8ba67d2cac8453cdabccf1d9ab0", - "https://deno.land/std@0.177.0/fs/mod.ts": "bc3d0acd488cc7b42627044caf47d72019846d459279544e1934418955ba4898", - "https://deno.land/std@0.177.0/fs/move.ts": "4cb47f880e3f0582c55e71c9f8b1e5e8cfaacb5e84f7390781dd563b7298ec19", - "https://deno.land/std@0.177.0/fs/walk.ts": "ea95ffa6500c1eda6b365be488c056edc7c883a1db41ef46ec3bf057b1c0fe32", - "https://deno.land/std@0.177.0/io/buf_reader.ts": "90a7adcb3638d8e1361695cdf844d58bcd97c41711dc6f9f8acc0626ebe097f5", - "https://deno.land/std@0.177.0/io/buf_writer.ts": "759c69d304b04d2909976f2a03a24a107276fbd81ed13593c5c2d43d104b52f3", - "https://deno.land/std@0.177.0/io/buffer.ts": "e2b7564f684dad625cab08f5106f33572d325705d19a36822b3272fbdfb8f726", - "https://deno.land/std@0.177.0/io/copy_n.ts": "c498021ce291576a68b5bae9f9d3a27f97644f4af6c1047fb1cff054af19e436", - "https://deno.land/std@0.177.0/io/limited_reader.ts": "d709b5b3113d4cbf934415ba242596e0ecb130e8868fb47197217e09dbb59558", - "https://deno.land/std@0.177.0/io/mod.ts": "2665bcccc1fd6e8627cca167c3e92aaecbd9897556b6f69e6d258070ef63fd9b", - "https://deno.land/std@0.177.0/io/multi_reader.ts": "5f7ef6e987486322b38c72e206b8fbc8916d55a87fbcdc97a8b2596386c28d44", - "https://deno.land/std@0.177.0/io/read_delim.ts": "7e102c66f00a118fa1e1ccd4abb080496f43766686907fd8b9522fdf85443586", - "https://deno.land/std@0.177.0/io/read_int.ts": "7cb8bcdfaf1107586c3bacc583d11c64c060196cb070bb13ae8c2061404f911f", - "https://deno.land/std@0.177.0/io/read_lines.ts": "baee9e35034f2fdfccf63bc24b7e3cb45aa1c1c5de26d178f7bcbc572e87772f", - "https://deno.land/std@0.177.0/io/read_long.ts": "f0aaa420e3da1261c5d33c5e729f09922f3d9fa49f046258d4ff7a00d800c71e", - "https://deno.land/std@0.177.0/io/read_range.ts": "28152daf32e43dd9f7d41d8466852b0d18ad766cd5c4334c91fef6e1b3a74eb5", - "https://deno.land/std@0.177.0/io/read_short.ts": "805cb329574b850b84bf14a92c052c59b5977a492cd780c41df8ad40826c1a20", - "https://deno.land/std@0.177.0/io/read_string_delim.ts": "46eb0c9db3547caf8c759631effa200bbe48924f9b34f41edc627bde36cee52d", - "https://deno.land/std@0.177.0/io/slice_long_to_bytes.ts": "b096472afa3a0dd90fa84584dde7706ed29fc16d48009a581c49368f09fe70f4", - "https://deno.land/std@0.177.0/io/string_reader.ts": "ad9cbecb8509732afcf3d73bb72fa551ec0ccc34f9b8127826247f0190753a65", - "https://deno.land/std@0.177.0/io/string_writer.ts": "8a03c5858c24965a54c6538bed15f32a7c72f5704a12bda56f83a40e28e5433e", - "https://deno.land/std@0.177.0/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0", - "https://deno.land/std@0.177.0/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b", - "https://deno.land/std@0.177.0/path/_util.ts": "d7abb1e0dea065f427b89156e28cdeb32b045870acdf865833ba808a73b576d0", - "https://deno.land/std@0.177.0/path/common.ts": "ee7505ab01fd22de3963b64e46cff31f40de34f9f8de1fff6a1bd2fe79380000", - "https://deno.land/std@0.177.0/path/glob.ts": "d479e0a695621c94d3fd7fe7abd4f9499caf32a8de13f25073451c6ef420a4e1", - "https://deno.land/std@0.177.0/path/mod.ts": "4b83694ac500d7d31b0cdafc927080a53dc0c3027eb2895790fb155082b0d232", - "https://deno.land/std@0.177.0/path/posix.ts": "8b7c67ac338714b30c816079303d0285dd24af6b284f7ad63da5b27372a2c94d", - "https://deno.land/std@0.177.0/path/separator.ts": "0fb679739d0d1d7bf45b68dacfb4ec7563597a902edbaf3c59b50d5bcadd93b1", - "https://deno.land/std@0.177.0/path/win32.ts": "d186344e5583bcbf8b18af416d13d82b35a317116e6460a5a3953508c3de5bba", - "https://deno.land/std@0.177.0/testing/_diff.ts": "1a3c044aedf77647d6cac86b798c6417603361b66b54c53331b312caeb447aea", - "https://deno.land/std@0.177.0/testing/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", - "https://deno.land/std@0.177.0/testing/asserts.ts": "984ab0bfb3faeed92ffaa3a6b06536c66811185328c5dd146257c702c41b01ab", - "https://deno.land/std@0.177.0/types.d.ts": "220ed56662a0bd393ba5d124aa6ae2ad36a00d2fcbc0e8666a65f4606aaa9784" - }, - "npm": { + "version": "3", + "packages": { "specifiers": { - "typescript@5.0.3": "typescript@5.0.3" + "jsr:@std/assert@0.217.0": "jsr:@std/assert@0.217.0", + "jsr:@std/assert@^0.217.0": "jsr:@std/assert@0.217.0", + "jsr:@std/bytes@^0.217.0": "jsr:@std/bytes@0.217.0", + "jsr:@std/flags@0.217.0": "jsr:@std/flags@0.217.0", + "jsr:@std/fmt@^0.217.0": "jsr:@std/fmt@0.217.0", + "jsr:@std/fs@0.217.0": "jsr:@std/fs@0.217.0", + "jsr:@std/io@0.217.0": "jsr:@std/io@0.217.0", + "jsr:@std/path@0.217.0": "jsr:@std/path@0.217.0", + "jsr:@std/path@^0.217.0": "jsr:@std/path@0.217.0", + "npm:typescript@5.0.3": "npm:typescript@5.0.3" + }, + "jsr": { + "@std/assert@0.217.0": { + "integrity": "c98e279362ca6982d5285c3b89517b757c1e3477ee9f14eb2fdf80a45aaa9642", + "dependencies": [ + "jsr:@std/fmt@^0.217.0" + ] + }, + "@std/bytes@0.217.0": { + "integrity": "58209975707478fe12423d0b3270f4d400fd135a4edb1f50eeca8f92e34e6580" + }, + "@std/flags@0.217.0": { + "integrity": "2d67502692d76cfe37fba1c4a92d0a5fe0a6f9601900fd7c510936b0e4e0242e", + "dependencies": [ + "jsr:@std/assert@^0.217.0" + ] + }, + "@std/fmt@0.217.0": { + "integrity": "cb99f82500b8da20202fedfa8bb94dd0222e81f0494ed9087de20ee3d8a39a8d" + }, + "@std/fs@0.217.0": { + "integrity": "0bfff5f3618d68c385b28b4ffbf3a15c98293a0f1186444458b62e0111ce77b2", + "dependencies": [ + "jsr:@std/assert@^0.217.0", + "jsr:@std/path@^0.217.0" + ] + }, + "@std/io@0.217.0": { + "integrity": "08d3dd7c10956d1433be95306ec15179cdebe49a0ce5a74238fabf140bb74382", + "dependencies": [ + "jsr:@std/assert@^0.217.0", + "jsr:@std/bytes@^0.217.0" + ] + }, + "@std/path@0.217.0": { + "integrity": "1217cc25534bca9a2f672d7fe7c6f356e4027df400c0e85c0ef3e4343bc67d11", + "dependencies": [ + "jsr:@std/assert@^0.217.0" + ] + } }, - "packages": { + "npm": { "typescript@5.0.3": { "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", "dependencies": {} } } - } + }, + "remote": {} } From 6cfd8bcfac203bbaea4336ac96f9c897c3368f47 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:02:22 +0900 Subject: [PATCH 4/6] fix: update deno.jsonc --- deno.jsonc | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 9c61a35..8668a73 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -11,19 +11,13 @@ "lib": ["deno.ns", "ESNext", "deno.window"] }, "fmt": { - "options": { - "indentWidth": 2, - "useTabs": false, - "singleQuote": true - }, - "files": { - "include": ["src", "examples/repo"], - "exclude": ["node_modules"] - } + "indentWidth": 2, + "useTabs": false, + "singleQuote": true, + "include": ["src", "examples/repo", "deno.jsonc"], + "exclude": ["node_modules"] }, "test": { - "files": { - "include": ["src"] - } + "include": ["src"] } } From 9cee4de78f8b224d9487872c8699894135bfc187 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:04:15 +0900 Subject: [PATCH 5/6] feat: add set-up task --- deno.jsonc | 1 + 1 file changed, 1 insertion(+) diff --git a/deno.jsonc b/deno.jsonc index 8668a73..52c8310 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -3,6 +3,7 @@ "version": "1.0.21", "exports": "./bin.ts", "tasks": { + "set-up": "cd examples/repo && npm ci", "run-dry": "deno run --allow-env --allow-read --allow-write bin.ts -b=./examples/repo/src -c=./examples/repo/tsconfig.json -d", "run": "deno run --allow-env --allow-read --allow-write bin.ts -b=./examples/repo/src -c=./examples/repo/tsconfig.json -r", "test": "deno test --allow-read" From 1dc2f69f9daeb386d8e017b6dc2161e42b323ab2 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:05:33 +0900 Subject: [PATCH 6/6] feat: to `1.0.22` --- README.md | 4 ++-- deno.jsonc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 22a07ee..47c962e 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.21/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.22/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.21/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.22/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 52c8310..613daf0 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "name": "@hajime-san/specifier-resolver", - "version": "1.0.21", + "version": "1.0.22", "exports": "./bin.ts", "tasks": { "set-up": "cd examples/repo && npm ci",