-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support types without enabling
esModuleInterop
in TypeScript (#118)
- Loading branch information
Showing
16 changed files
with
113 additions
and
42 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
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,2 @@ | ||
import svgPathBbox from "./index.js"; | ||
export default svgPathBbox; |
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,7 +1,9 @@ | ||
export type BBox = [minX: number, minY: number, maxX: number, maxY: number]; | ||
|
||
/** | ||
* Compute bounding boxes of SVG paths. | ||
* @param {String} d SVG path for which their bounding box will be computed. | ||
* @returns {BBox} | ||
*/ | ||
export default function svgPathBbox(d: string): BBox; | ||
declare function svgPathBbox(d: string): BBox; | ||
export = svgPathBbox; |
This file was deleted.
Oops, something went wrong.
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,5 +1,5 @@ | ||
const util = require("util") | ||
const svgPathBbox = require("../dist/wrapper.js"); | ||
const svgPathBbox = require("../dist/index.js"); | ||
|
||
const bbox = svgPathBbox("M0 0H3V6Z"); | ||
process.stdout.write(`${util.inspect(bbox)}\n`) |
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,5 +1,5 @@ | ||
import { inspect } from "node:util"; | ||
import svgPathBbox from "../dist/wrapper.js"; | ||
import svgPathBbox from "../dist/index.mjs"; | ||
|
||
const bbox = svgPathBbox("M0 0H3V6Z"); | ||
process.stdout.write(`${inspect(bbox)}\n`) |
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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
import * as fs from "node:fs"; | ||
|
||
fs.copyFileSync("src/types.d.ts", "dist/types.d.ts"); |
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,8 @@ | ||
import * as fs from "node:fs"; | ||
|
||
fs.writeFileSync( | ||
"dist/index.mjs", | ||
`import svgPathBbox from "./index.js"; | ||
export default svgPathBbox; | ||
` | ||
); |
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,11 @@ | ||
import * as fs from "node:fs"; | ||
|
||
fs.writeFileSync( | ||
"dist/index.js", | ||
fs | ||
.readFileSync("dist/index.js", "utf8") | ||
.replace( | ||
'exports.default = svgPathBbox;', | ||
'module.exports = svgPathBbox;' | ||
) | ||
); |
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,9 @@ | ||
export type BBox = [minX: number, minY: number, maxX: number, maxY: number]; | ||
|
||
/** | ||
* Compute bounding boxes of SVG paths. | ||
* @param {String} d SVG path for which their bounding box will be computed. | ||
* @returns {BBox} | ||
*/ | ||
declare function svgPathBbox(d: string): BBox; | ||
export = svgPathBbox; |
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