Skip to content

Commit 6294afa

Browse files
author
v1rtl
committed
replace esm.sh with skypack bc it died
1 parent a4f86c2 commit 6294afa

File tree

11 files changed

+45
-37
lines changed

11 files changed

+45
-37
lines changed

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"deno.enable": true
2+
"deno.enable": true,
3+
"deno.suggest.imports.hosts": {
4+
"https://deno.land/x/": true,
5+
"https://x.nest.land/": true
6+
}
37
}

deps.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { default as parseRange, Options } from 'https://esm.sh/[email protected]'
1+
import { default as parseRange, Options } from 'https://cdn.skypack.dev/[email protected]?dts'
22
export { parseRange }
33
export type { Options as ParseRangeOptions }
44
export { Sha1 } from 'https://deno.land/[email protected]/hash/sha1.ts'
@@ -11,7 +11,7 @@ export { parse as rg } from 'https://deno.land/x/[email protected]/src/index.js'
1111
export { forwarded } from 'https://deno.land/x/[email protected]/mod.ts'
1212
export * from 'https://deno.land/x/[email protected]/mod.ts'
1313
import type { ServerRequest as Req, Response as ServerResponse } from 'https://deno.land/[email protected]/http/server.ts'
14-
export { default as ipaddr, IPv4, IPv6 } from 'https://cdn.skypack.dev/ipaddr.js'
14+
export { default as ipaddr, IPv4, IPv6 } from 'https://cdn.skypack.dev/ipaddr.js?dts'
1515
interface Res extends ServerResponse {
1616
headers: Headers
1717
}
@@ -22,5 +22,11 @@ export type { Req, Res }
2222

2323
export { serve, Server } from 'https://deno.land/[email protected]/http/server.ts'
2424

25-
export { Router, pushMiddleware } from 'https://esm.sh/@tinyhttp/[email protected]'
26-
export type { NextFunction, Handler, Middleware, UseMethodParams, Method } from 'https://esm.sh/@tinyhttp/[email protected]'
25+
export { Router, pushMiddleware } from 'https://cdn.skypack.dev/@tinyhttp/[email protected]?dts'
26+
export type {
27+
NextFunction,
28+
Handler,
29+
Middleware,
30+
UseMethodParams,
31+
Method
32+
} from 'https://cdn.skypack.dev/@tinyhttp/[email protected]?dts'

extensions/res/download.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { contentDisposition } from 'https://cdn.skypack.dev/@tinyhttp/content-disposition@2.0.0'
1+
import { contentDisposition } from 'https://cdn.skypack.dev/@tinyhttp/content-disposition@2'
22
import { SendFileOptions, sendFile } from './send/sendFile.ts'
33
import { extname } from 'https://deno.land/[email protected]/path/mod.ts'
44
import { setContentType, setHeader } from './headers.ts'

extensions/res/format.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Handler, NextFunction } from 'https://esm.sh/@tinyhttp/router'
1+
import { Handler, NextFunction } from '../../deps.ts'
22
import { normalizeType, normalizeTypes } from './utils.ts'
33
import { setVaryHeader } from './headers.ts'
44
import { getAccepts } from '../req/mod.ts'
@@ -8,34 +8,32 @@ export type FormatProps = {
88
default?: () => void
99
} & Record<string, Handler>
1010

11-
export const formatResponse = <Request extends Req = Req, Response extends Res = Res>(
12-
req: Request,
13-
res: Response,
14-
next: NextFunction
15-
) => (obj: FormatProps) => {
16-
const fn = obj.default
11+
export const formatResponse =
12+
<Request extends Req = Req, Response extends Res = Res>(req: Request, res: Response, next: NextFunction) =>
13+
(obj: FormatProps) => {
14+
const fn = obj.default
1715

18-
if (fn) delete obj.default
16+
if (fn) delete obj.default
1917

20-
const keys = Object.keys(obj)
18+
const keys = Object.keys(obj)
2119

22-
const key = keys.length > 0 ? (getAccepts(req)(...keys) as string) : false
20+
const key = keys.length > 0 ? (getAccepts(req)(...keys) as string) : false
2321

24-
setVaryHeader(res)('Accept')
22+
setVaryHeader(res)('Accept')
2523

26-
if (key) {
27-
res.headers?.set('Content-Type', normalizeType(key).value || '')
24+
if (key) {
25+
res.headers?.set('Content-Type', normalizeType(key).value || '')
2826

29-
obj[key](req, res, next)
30-
} else if (fn) {
31-
fn()
32-
} else {
33-
const err = new Error('Not Acceptable') as any
34-
err.status = err.statusCode = 406
35-
err.types = normalizeTypes(keys).map((o) => o.value)
27+
obj[key](req, res, next)
28+
} else if (fn) {
29+
fn()
30+
} else {
31+
const err = new Error('Not Acceptable') as any
32+
err.status = err.statusCode = 406
33+
err.types = normalizeTypes(keys).map((o) => o.value)
3634

37-
next(err)
38-
}
35+
next(err)
36+
}
3937

40-
return res
41-
}
38+
return res
39+
}

tests/core/app.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].1/mod.ts'
1+
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].2/mod.ts'
22
import { App } from '../../app.ts'
33
import { BindToSuperDeno, InitAppAndTest } from '../util.ts'
44
import { renderFile as eta } from 'https://deno.land/x/[email protected]/mod.ts'

tests/core/request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, run } from 'https://deno.land/x/[email protected].1/mod.ts'
1+
import { describe, it, run } from 'https://deno.land/x/[email protected].2/mod.ts'
22
import { App } from '../../app.ts'
33

44
import { BindToSuperDeno, InitAppAndTest } from '../util.ts'

tests/modules/etag.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { etag } from '../../utils/etag.ts'
2-
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].1/mod.ts'
2+
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].2/mod.ts'
33

44
describe('etag(body)', function () {
55
it('should support strings', function () {

tests/modules/parseUrl.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].1/mod.ts'
1+
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].2/mod.ts'
22
import { getPathname, getQueryParams, getURLParams } from '../../utils/parseUrl.ts'
33
import { rg } from '../../deps.ts'
44

tests/modules/req.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].1/mod.ts'
1+
import { describe, it, expect, run } from 'https://deno.land/x/[email protected].2/mod.ts'
22
import { InitAppAndTest, runServer } from '../util.ts'
33
import { Ranges } from '../../types.ts'
44
import {

tests/modules/res.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, run, expect } from 'https://deno.land/x/[email protected].1/mod.ts'
1+
import { describe, it, run, expect } from 'https://deno.land/x/[email protected].2/mod.ts'
22
import { InitAppAndTest, runServer } from '../util.ts'
33
import {
44
setHeader,

tests/modules/send.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, run, beforeAll, afterAll, expect } from 'https://deno.land/x/[email protected].1/mod.ts'
1+
import { describe, it, run, beforeAll, afterAll, expect } from 'https://deno.land/x/[email protected].2/mod.ts'
22
import * as path from 'https://deno.land/[email protected]/path/mod.ts'
33
import * as fs from 'https://deno.land/[email protected]/node/fs.ts'
44
import { runServer } from '../util.ts'

0 commit comments

Comments
 (0)