-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use pre-bundled versions of
@jsr/std__path
- Loading branch information
Showing
4 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
package-lock = false | ||
@jsr:registry=https://npm.jsr.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Replace import specifiers in "dist" modules to use the bundled versions of "@jsr/std__path". | ||
* | ||
* In "dist/cjs/index.cjs": | ||
* - '@jsr/std__path/posix' → './std__path/posix.cjs' | ||
* - '@jsr/std__path/windows' → './std__path/windows.cjs' | ||
* | ||
* In "dist/esm/index.js": | ||
* - '@jsr/std__path/posix' → './std__path/posix.js' | ||
* - '@jsr/std__path/windows' → './std__path/windows.js' | ||
*/ | ||
|
||
import { readFile, writeFile } from "node:fs/promises"; | ||
|
||
async function replaceInFile(file, search, replacement) { | ||
let text = await readFile(file, "utf-8"); | ||
text = text.replace(search, replacement); | ||
await writeFile(file, text); | ||
} | ||
|
||
const SEARCH_REGEXP = /'@jsr\/std__path\/(.+?)'/gu; | ||
|
||
await Promise.all([ | ||
replaceInFile("dist/cjs/index.cjs", SEARCH_REGEXP, "'./std__path/$1.cjs'"), | ||
replaceInFile("dist/esm/index.js", SEARCH_REGEXP, "'./std__path/$1.js'"), | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export default [ | ||
{ | ||
input: "../../node_modules/@jsr/std__path/posix/mod.js", | ||
output: [ | ||
{ | ||
file: "./dist/cjs/std__path/posix.cjs", | ||
format: "cjs", | ||
}, | ||
{ | ||
file: "./dist/esm/std__path/posix.js", | ||
format: "esm", | ||
}, | ||
], | ||
}, | ||
{ | ||
input: "../../node_modules/@jsr/std__path/windows/mod.js", | ||
output: [ | ||
{ | ||
file: "./dist/cjs/std__path/windows.cjs", | ||
format: "cjs", | ||
}, | ||
{ | ||
file: "./dist/esm/std__path/windows.js", | ||
format: "esm", | ||
}, | ||
], | ||
}, | ||
]; |