Skip to content

Commit

Permalink
🐛 [plaoc] fix relative import path "zod" error
Browse files Browse the repository at this point in the history
  • Loading branch information
waterbang committed Jul 4, 2023
1 parent 3a25327 commit 5ca9aab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion desktop-dev/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"node-forge": "https://esm.sh/v124/[email protected]",
"source-map-support": "https://esm.sh/v124/[email protected]",
"source-map-support/register": "https://esm.sh/v124/[email protected]/register.js",
"zod": "https://esm.sh/v124/[email protected]",
"tar": "https://esm.sh/v124/[email protected]"
},
"scopes": {}
Expand Down
8 changes: 5 additions & 3 deletions desktop-dev/src/helper/zodHelper.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { RefinementCtx, z } from "zod";
//! use zod error: Relative import path "zod" not prefixed with / or ./ or ../ only remote
//! https://github.com/denoland/deno/issues/17598
import { RefinementCtx, z } from "https://deno.land/x/[email protected]/mod.ts";
import { $MMID } from "../core/types.ts";
// const z_mmid = z.string().endsWith(".dweb");
export const mmidType = z.custom<$MMID>((val) => {
return typeof val === "string" && val.endsWith(".dweb");
});
export * from "zod";
export * from "https://deno.land/x/zod@v3.21.4/mod.ts";
export { mmidType as mmid };

import type {
Expand All @@ -13,7 +15,7 @@ import type {
ZodObject,
ZodRawShape,
ZodTypeAny,
} from "zod";
} from "https://deno.land/x/zod@v3.21.4/mod.ts";

/// 以下代码来自 https://github.com/rileytomasek/zodix (MIT license)
/// 因为源码有点问题,并且引入了一些不该引入的包,所以这里只提取了部分有需要的,并修复了一些问题
Expand Down
2 changes: 1 addition & 1 deletion plaoc/scripts/npm.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"mainExports": ".",
"buildToRootDir": "./build/client",
"name": "@dweb-browser/plaoc",
"version": "0.0.9",
"version": "0.1.0",
"lib": [
"es2021",
"dom"
Expand Down

0 comments on commit 5ca9aab

Please sign in to comment.