Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Commit 20fede3

Browse files
committed
refactor(deps): move all npm:, jsr:, https://deno.land and https://esm.sh imports to deps/
1 parent bc5e8ad commit 20fede3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+126
-107
lines changed

deno.jsonc

+22-30
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"exclude": [
3-
"_fresh/",
4-
"**/_fresh/*"
5-
],
2+
"exclude": ["**/_fresh/*"],
63
"lock": false,
74
"tasks": {
85
"cache:deps": "deno cache **/deps/**/*.ts",
@@ -14,34 +11,30 @@
1411
"release": "deno run --allow-run --allow-read tasks/release.ts",
1512
"cov": "deno coverage ./cov/ --lcov --exclude='test.ts|testdata' > cov.lcov"
1613
},
17-
"unstable": [
18-
"cron",
19-
"kv"
20-
],
14+
"unstable": ["cron", "kv", "temporal"],
2115
"lint": {
22-
"exclude": [
23-
"./lib/deps/"
24-
],
25-
"rules": {
26-
"tags": [
27-
"fresh",
28-
"recommended"
29-
]
30-
}
31-
},
32-
"test": {
33-
"exclude": [
34-
"./templates"
35-
]
16+
"exclude": ["./lib/deps/"],
17+
"rules": { "tags": ["fresh", "recommended"] }
3618
},
19+
"test": { "exclude": ["./templates"] },
3720
"fmt": { "lineWidth": 100 },
3821
"compilerOptions": {
39-
"jsx": "react-jsx",
40-
// NOTE: alias "preact" is not being resolved for deno.json(c) of monorepo
41-
// therefore we use react here (this is not needed withing the individual
42-
// projects e.g. under templates/crm/deno.json, since "preact" resolves properly)
43-
// see https://github.com/denoland/deno/issues/20582#issuecomment-1751454928
44-
"jsxImportSource": "https://esm.sh/[email protected]"
22+
"lib": ["dom", "dom.asynciterable", "deno.ns"],
23+
"jsx": "precompile",
24+
"jsxImportSource": "preact",
25+
"jsxImportSourceTypes": "preact/compat",
26+
"jsxPrecompileSkipElements": [
27+
"a",
28+
"img",
29+
"source",
30+
"body",
31+
"html",
32+
"head",
33+
"title",
34+
"link",
35+
"style",
36+
"meta"
37+
]
4538
},
4639
"imports": {
4740
"@/": "./",
@@ -51,7 +44,6 @@
5144
"react": "npm:[email protected]/compat",
5245
"react-dom": "npm:[email protected]/compat",
5346
"@preact/signals": "npm:@preact/[email protected]",
54-
"@preact/signals-core": "npm:@preact/[email protected]",
55-
"std/": "https://deno.land/[email protected]/"
47+
"@preact/signals-core": "npm:@preact/[email protected]"
5648
}
5749
}

lib/apis/create-api/mod.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// TODO: implement tests from https://github.com/johannschopplich/unrested/blob/main/test/index.test.ts
2-
import { assertEquals, assertExists } from "../../deps/std/assert.ts";
2+
import { assertEquals, assertExists } from "../../deps/@std/assert.ts";
33
import { auth } from "./auth/mod.ts";
44
import { createApi } from "./mod.ts";
55

lib/apis/jsonplaceholder.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals, assertExists } from "../deps/std/assert.ts";
1+
import { assertEquals, assertExists } from "../deps/@std/assert.ts";
22
import { jsonplaceholder } from "./jsonplaceholder.ts";
33

44
Deno.test("[apis] jsonplaceholder", async (t) => {

lib/cli/dev/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// adapted from https://github.com/denoland/fresh/blob/main/src/dev/cli.ts
22
import { type FreshConfig } from "fresh/server.ts";
33
import { manifest } from "fresh/src/dev/mod.ts";
4-
import { join, toFileUrl } from "../../deps/std/path.ts";
4+
import { join, toFileUrl } from "../../deps/@std/path.ts";
55

66
const [cmd, configURL] = Deno.args;
77

lib/cli/netzo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run
22

3+
import { load } from "../deps/@std/dotenv.ts";
34
import { parse, semverGreaterThanOrEquals } from "../deps/semver/mod.ts";
4-
import { load } from "../deps/std/dotenv.ts";
55
import { error } from "../plugins/utils.ts";
66
import { parseArgs } from "./src/args.ts";
77
import deploySubcommand from "./src/subcommands/deploy.ts";

lib/cli/src/args.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parse } from "../../deps/std/flags.ts";
1+
import { parse } from "../../deps/@std/flags.ts";
22

33
export function parseArgs(args: string[]) {
44
const parsed = parse(args, {

lib/cli/src/subcommands/deploy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import type {
55
Paginated,
66
Project,
77
} from "../../../deps/@netzo/api/mod.ts";
8-
import { exists } from "../../../deps/std/fs.ts";
9-
import { fromFileUrl, globToRegExp, isGlob, normalize } from "../../../deps/std/path.ts";
8+
import { exists } from "../../../deps/@std/fs.ts";
9+
import { fromFileUrl, globToRegExp, isGlob, normalize } from "../../../deps/@std/path.ts";
1010
import { Spinner, wait } from "../../../deps/wait/mod.ts";
1111
// vendored x/[email protected] to silence deprecated API warnings (Deno>=1.4)
1212
import { question } from "../../../deps/question/mod.ts";

lib/cli/src/utils/entrypoint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve, toFileUrl } from "../../../deps/std/path.ts";
1+
import { resolve, toFileUrl } from "../../../deps/@std/path.ts";
22

33
/**
44
* Parses the entrypoint to a URL.

lib/cli/src/utils/info.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from "../../../deps/std/path.ts";
1+
import { join } from "../../../deps/@std/path.ts";
22
import { getVersions } from "../subcommands/upgrade.ts";
33

44
export function getConfigPaths() {

lib/cli/src/utils/mod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { fromFileUrl, resolve } from "../../../deps/std/path.ts";
1+
export { fromFileUrl, resolve } from "../../../deps/@std/path.ts";
22
export { APIError } from "./api.ts";
33
export { parseEntrypoint } from "./entrypoint.ts";
44
export { walk } from "./walk.ts";

lib/cli/src/utils/netzo.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { isBinary } from "npm:[email protected]";
21
import { feathers } from "../../../deps/@feathersjs/feathers.ts";
32
import { socketio } from "../../../deps/@feathersjs/socketio-client.ts";
43
import { Project, ProjectAssetsFile } from "../../../deps/@netzo/api/mod.ts";
4+
import { encodeBase64 } from "../../../deps/@std/encoding.ts";
5+
import { isBinary } from "../../../deps/istextorbinary.ts";
56
import { io } from "../../../deps/socket.io-client.ts";
6-
import { encodeBase64 } from "../../../deps/std/encoding.ts";
77

88
export const createClient = async ({
99
apiKey = Deno.env.get("NETZO_API_KEY")!,

lib/cli/src/utils/walk.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join, normalize } from "../../../deps/std/path.ts";
1+
import { join, normalize } from "../../../deps/@std/path.ts";
22
import type { ManifestEntry, ManifestEntryDirectory } from "./netzo.ts";
33

44
/** Calculate git object hash, like `git hash-object` does. */

lib/cli/tests/help.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assert, assertEquals, assertStringIncludes } from "../../deps/std/assert.ts";
1+
import { assert, assertEquals, assertStringIncludes } from "../../deps/@std/assert.ts";
22
import { netzo, output } from "./utils.ts";
33

44
Deno.test("help command list", async () => {

lib/database/mod.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertExists } from "../deps/std/assert.ts";
1+
import { assertExists } from "../deps/@std/assert.ts";
22
import { database } from "./mod.ts";
33

44
const db = database({ url: "http://localhost:8080" });

lib/database/mod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// IMPORTANT: requires importing createClient from /web and not from root nor /node
22
// see https://github.com/tursodatabase/libsql-client-ts/issues/138#issuecomment-1921954374
33
import { IS_BROWSER } from "fresh/runtime.ts";
4-
import { createClient } from "npm:/@libsql/client@0.6.0";
4+
import { createClient } from "../deps/@libsql/client.ts";
55
import { drizzle } from "../deps/drizzle-orm/libsql.ts";
66
import { drizzle as drizzleSqliteProxy } from "../deps/drizzle-orm/sqlite-proxy.ts";
77
import type { DrizzleConfig } from "../deps/drizzle-orm/utils.ts";

lib/datastore/mod.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertExists } from "../deps/std/assert.ts";
1+
import { assertExists } from "../deps/@std/assert.ts";
22
import { datastore } from "./mod.ts";
33

44
const ds = datastore({ kv: await Deno.openKv(":memory:") });

lib/datastore/mod.utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mingo from "npm:[email protected]";
1+
import { mingo } from "../deps/mingo.ts";
22
import { monotonicFactory } from "../deps/ulid.ts";
33

44
export const ulid = monotonicFactory();

lib/deps/@libsql/client.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:/@libsql/[email protected]";

lib/deps/@mdx-js/mdx.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:@mdx-js/[email protected]";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/deps/@std/fmt/colors.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "jsr:@std/[email protected]/colors";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/deps/@types/hast.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:@types/[email protected]";

lib/deps/deep-parse-json.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:[email protected]";

lib/deps/flat.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:[email protected]";

lib/deps/istextorbinary.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:[email protected]";

lib/deps/mdast-util-mdxjs-esm.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:[email protected]";

lib/deps/mingo.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as mingo } from "npm:[email protected]";

lib/deps/remark-frontmatter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as remarkFrontmatter } from "npm:[email protected]";

lib/deps/remark-gfm.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as remarkGfm } from "npm:[email protected]";

lib/deps/ts-morph.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:[email protected]";

lib/deps/unist-util-visit.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "npm:[email protected]";

lib/plugins/database/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// deno-lint-ignore-file no-explicit-any
22
import type { Plugin, PluginRoute } from "fresh/server.ts";
3-
import { createClient } from "npm:@libsql/[email protected]";
43
import { database as createDatabase } from "../../database/mod.ts";
4+
import { createClient } from "../../deps/@libsql/client.ts";
55
import { eq, getTableColumns, SQL, sql } from "../../deps/drizzle-orm/mod.ts";
66
import { SQLiteTable } from "../../deps/drizzle-orm/sqlite-core.ts";
77
import { DrizzleConfig } from "../../deps/drizzle-orm/utils.ts";

lib/plugins/datastore/plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Plugin, PluginRoute } from "fresh/server.ts";
2-
import { deepParseJson } from "npm:[email protected]";
3-
import { unflatten } from "npm:[email protected]";
42
import { datastore as createDatastore } from "../../datastore/mod.ts";
3+
import { deepParseJson } from "../../deps/deep-parse-json.ts";
4+
import { unflatten } from "../../deps/flat.ts";
55
import { apiKeyAuthentication, cors } from "../middleware.ts";
66
import { parseRequestBody, RESPONSES } from "../utils.ts";
77

lib/plugins/environments/mod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// deno-lint-ignore-file no-explicit-any
2-
import { load } from "jsr:@std/dotenv";
32
import { netzo } from "../../apis/netzo.ts";
3+
import { load } from "../../deps/@std/dotenv.ts";
44
import type { Project } from "../types.ts";
55
import { logInfo, LOGS } from "../utils.ts";
66

lib/plugins/mdx/utils.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { type PluginRoute } from "fresh/server.ts";
2-
import { compile } from "npm:@mdx-js/mdx";
3-
import { Root } from "npm:@types/[email protected]";
4-
import { type MdxjsEsm } from "npm:[email protected]";
5-
import { default as remarkFrontmatter } from "npm:[email protected]";
6-
import { default as remarkGfm } from "npm:[email protected]";
7-
import { Project } from "npm:[email protected]";
8-
import { visit } from "npm:[email protected]";
9-
import { walk } from "../../deps/std/fs.ts";
10-
import { join, toFileUrl } from "../../deps/std/path.ts";
2+
import { compile } from "../../deps/@mdx-js/mdx.ts";
3+
import { walk } from "../../deps/@std/fs.ts";
4+
import { join, toFileUrl } from "../../deps/@std/path.ts";
5+
import { Root } from "../../deps/@types/hast.ts";
6+
import { type MdxjsEsm } from "../../deps/mdast-util-mdxjs-esm.ts";
7+
import { remarkFrontmatter } from "../../deps/remark-frontmatter.ts";
8+
import { remarkGfm } from "../../deps/remark-gfm.ts";
9+
import { Project } from "../../deps/ts-morph.ts";
10+
import { visit } from "../../deps/unist-util-visit.ts";
1111

1212
export async function scanForMDXFiles(directory: string): Promise<string[]> {
1313
const files: string[] = [];

lib/plugins/unocss/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { JSX, options as preactOptions, VNode } from "preact";
44
import { UnoGenerator, type UserConfig } from "../../deps/@unocss/core.ts";
55
import type { Theme } from "../../deps/@unocss/preset-uno.ts";
66
// IMPORTANT: import from @std/fs/exists directly to avoid Deno leaking to client
7+
import { existsSync } from "../../deps/@std/fs/exists.ts";
78
import { minify } from "../../deps/csso.ts";
8-
import { existsSync } from "../../deps/std/fs/exists.ts";
99
import type { NetzoState } from "../../mod.ts";
1010
import { logInfo } from "../utils.ts";
1111

lib/plugins/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// adapted from https://github.com/oaarnikoivu/shadcn-virtualized-combobox
22
// @deno-types="npm:@types/[email protected]"
33

4-
import { blue, bold, green, red, white, yellow } from "https://deno.land/[email protected]/fmt/colors.ts";
4+
import { blue, bold, green, red, white, yellow } from "../deps/@std/fmt/colors.ts";
55
import type { Project } from "./types.ts";
66

77
/**

lib/storage/mod.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertExists } from "../deps/std/assert.ts";
1+
import { assertExists } from "../deps/@std/assert.ts";
22
import { storage } from "./mod.ts";
33

44
const db = storage();

tests/fixture-plugins-mdx/deno.json

+28-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"exclude": ["**/_fresh/*"],
23
"lock": false,
34
"tasks": {
45
"check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
@@ -9,38 +10,36 @@
910
"preview": "deno run -A main.ts",
1011
"update": "deno run -A -r https://fresh.deno.dev/update ."
1112
},
12-
"lint": {
13-
"rules": {
14-
"tags": [
15-
"fresh",
16-
"recommended"
17-
]
18-
}
13+
"unstable": ["cron", "kv", "temporal"],
14+
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
15+
"fmt": { "lineWidth": 100 },
16+
"compilerOptions": {
17+
"lib": ["dom", "dom.asynciterable", "deno.ns"],
18+
"jsx": "precompile",
19+
"jsxImportSource": "preact",
20+
"jsxImportSourceTypes": "preact/compat",
21+
"jsxPrecompileSkipElements": [
22+
"a",
23+
"img",
24+
"source",
25+
"body",
26+
"html",
27+
"head",
28+
"title",
29+
"link",
30+
"style",
31+
"meta"
32+
]
1933
},
20-
"exclude": [
21-
"**/_fresh/*"
22-
],
2334
"imports": {
2435
"@/": "./",
2536
"netzo/": "../../lib/",
2637
"fresh/": "https://deno.land/x/[email protected]/",
27-
"preact": "https://esm.sh/[email protected]",
28-
"preact/": "https://esm.sh/[email protected]/",
29-
"preact-render-to-string": "https://esm.sh/*[email protected]",
30-
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
31-
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
32-
"react": "https://esm.sh/[email protected]/compat",
33-
"react-dom": "https://esm.sh/[email protected]/compat",
34-
"std/": "https://deno.land/[email protected]/",
35-
"react/jsx-runtime": "https://esm.sh/[email protected]/compat",
36-
"tailwindcss": "npm:[email protected]",
37-
"tailwindcss/": "npm:/[email protected]/",
38-
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
39-
"$std/": "https://deno.land/[email protected]/"
40-
},
41-
"compilerOptions": {
42-
"jsx": "react-jsx",
43-
"jsxImportSource": "preact"
44-
},
45-
"nodeModulesDir": true
38+
"preact": "npm:[email protected]",
39+
"react": "npm:[email protected]/compat",
40+
"react-dom": "npm:[email protected]/compat",
41+
"@preact/signals": "npm:@preact/[email protected]",
42+
"@preact/signals-core": "npm:@preact/[email protected]",
43+
"@std/dotenv": "jsr:@std/[email protected]"
44+
}
4645
}

tests/fixture-plugins-mdx/dev.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
import dev from "fresh/dev.ts";
44
import config from "./fresh.config.ts";
55

6-
import "$std/dotenv/load.ts";
6+
import "@std/dotenv/load";
77

88
await dev(import.meta.url, "./main.ts", config);

tests/fixture-plugins-mdx/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// <reference lib="dom.asynciterable" />
55
/// <reference lib="deno.ns" />
66

7-
import "$std/dotenv/load.ts";
7+
import "@std/dotenv/load";
88

99
import { start } from "fresh/server.ts";
1010
import config from "./fresh.config.ts";

0 commit comments

Comments
 (0)