-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First pass * chore: fixes to imports etc * chore: format * readme --------- Co-authored-by: ascorbic <[email protected]>
- Loading branch information
Showing
35 changed files
with
273 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"./scripts", | ||
"./mod.ts", | ||
"./deps.ts", | ||
"./e2e.test.ts", | ||
"*/*.json", | ||
"./example" | ||
], | ||
|
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,33 @@ | ||
{ | ||
"name": "@unpic/lib", | ||
"version": "3.18.0", | ||
"exports": "./mod.ts", | ||
"tasks": { | ||
"build:npm": "deno run --allow-all scripts/build_npm.ts" | ||
}, | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "https://esm.sh/[email protected]" | ||
}, | ||
"fmt": { | ||
"useTabs": true | ||
}, | ||
"imports": { | ||
"@deno/dnt": "jsr:@deno/[email protected]", | ||
"@std/path": "jsr:@std/[email protected]", | ||
"@std/fs": "jsr:@std/[email protected]", | ||
"@std/testing": "jsr:@std/[email protected]" | ||
}, | ||
"publish": { | ||
"include": [ | ||
"src", | ||
"mod.ts", | ||
"README.md", | ||
"data" | ||
], | ||
"exclude": [ | ||
"**/*.test.ts" | ||
] | ||
}, | ||
"license": "MIT" | ||
} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,12 +1,8 @@ | ||
import { | ||
assertAlmostEquals, | ||
assertEquals, | ||
assertExists, | ||
} from "jsr:@std/assert"; | ||
import examples from "../demo/src/examples.json" with { type: "json" }; | ||
import { getPixels } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { transformUrl } from "./transform.ts"; | ||
import type { ImageCdn } from "./types.ts"; | ||
import { assertAlmostEquals, assertExists } from "jsr:@std/assert"; | ||
import examples from "./demo/src/examples.json" with { type: "json" }; | ||
import { getPixels } from "jsr:@unpic/pixels"; | ||
import { transformUrl } from "./src/transform.ts"; | ||
import type { ImageCdn } from "./src/types.ts"; | ||
|
||
Deno.test("E2E tests", async (t) => { | ||
for (const [cdn, example] of Object.entries(examples)) { | ||
|
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,16 +1,16 @@ | ||
import { build, emptyDir } from "https://deno.land/x/dnt@0.37.0/mod.ts"; | ||
import { basename } from "https://deno.land/[email protected]/path/mod.ts"; | ||
import { walk } from "https://deno.land/[email protected]/fs/mod.ts"; | ||
import { build, emptyDir } from "jsr:@deno/dnt"; | ||
import { basename } from "jsr:@std/path"; | ||
import { walk } from "jsr:@std/fs"; | ||
|
||
await emptyDir("./npm"); | ||
|
||
const trans = await Array.fromAsync(walk("./src/transformers", { | ||
const transformers = await Array.fromAsync(walk("./src/transformers", { | ||
match: [/^(?!.*test\.ts$).*\.ts$/], | ||
})); | ||
|
||
const entry = trans.map((t) => ({ | ||
path: t.path, | ||
name: `./transformers/${basename(t.path, ".ts")}`, | ||
const entry = transformers.map((entry) => ({ | ||
path: entry.path, | ||
name: `./transformers/${basename(entry.path, ".ts")}`, | ||
})); | ||
|
||
await build({ | ||
|
@@ -51,9 +51,6 @@ await build({ | |
"@unpic/pixels": "latest", | ||
}, | ||
}, | ||
mappings: { | ||
"https://deno.land/x/[email protected]/mod.ts": "@unpic/pixels", | ||
}, | ||
}); | ||
|
||
// post build steps | ||
|
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,4 @@ | ||
import { | ||
assertEquals, | ||
assertExists, | ||
} from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals, assertExists } from "jsr:@std/assert"; | ||
import { getCanonicalCdnForUrl } from "./canonical.ts"; | ||
|
||
const nextImgLocal = | ||
|
@@ -43,8 +40,10 @@ Deno.test("Canonical", async (t) => { | |
await t.step( | ||
"should fall back to the default CDN for unrecognized image domains - vercel", | ||
() => { | ||
const result = | ||
getCanonicalCdnForUrl("https://placekitten.com/100", "vercel") || | ||
const result = getCanonicalCdnForUrl( | ||
"https://placekitten.com/100", | ||
"vercel", | ||
) || | ||
undefined; | ||
assertExists(result); | ||
assertEquals( | ||
|
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,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { getImageCdnForUrl } from "./detect.ts"; | ||
import { transformUrl } from "./transform.ts"; | ||
|
||
|
@@ -142,7 +142,9 @@ Deno.test("delegation", async (t) => { | |
|
||
Deno.test("detection", async (t) => { | ||
await t.step("should detect by path with a relative URL", () => { | ||
const cdn = getImageCdnForUrl("/_next/image?url=%2Fprofile.png&w=200&q=75"); | ||
const cdn = getImageCdnForUrl( | ||
"/_next/image?url=%2Fprofile.png&w=200&q=75", | ||
); | ||
assertEquals(cdn, "nextjs"); | ||
}); | ||
}); |
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,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
|
||
import { ParsedUrl } from "../types.ts"; | ||
import { AstroParams, parse, transform } from "./astro.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
|
||
import { transform } from "./builder.io.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { ParsedUrl } from "../types.ts"; | ||
import { CloudflareParams, parse, transform } from "./cloudflare.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { ParsedUrl } from "../types.ts"; | ||
import { | ||
CloudflareImagesParams, | ||
|
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,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { ParsedUrl } from "../types.ts"; | ||
import { CloudimageParams, parse, transform } from "./cloudimage.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
import { ParsedUrl } from "../types.ts"; | ||
import { CloudinaryParams, parse, transform } from "./cloudinary.ts"; | ||
|
||
|
Oops, something went wrong.