|
5 | 5 |
|
6 | 6 | // Imports |
7 | 7 | import * as JSONC from "@std/jsonc" |
8 | | -import type { Arg, Optional, record } from "@libs/typing" |
| 8 | +import type { Arg, Optional } from "@libs/typing" |
9 | 9 | import { assertMatch } from "@std/assert" |
10 | 10 | import { Logger } from "@libs/logger" |
11 | 11 | import { bundle } from "../bundle.ts" |
12 | 12 | import { dirname, resolve, toFileUrl } from "@std/path" |
13 | 13 | import { command } from "@libs/run/command" |
14 | | -export type { Arg, Logger, record } |
| 14 | +export type { Arg, Logger } |
15 | 15 |
|
16 | 16 | /** Transform a `deno.jsonc` file into a `package.json` and bundle exported entrypoints to make package publishable on json. */ |
17 | 17 | export async function packaged(path = "deno.jsonc", { logger: log = new Logger(), scope = undefined as Optional<string>, name = undefined as Optional<string> } = {}): Promise<package_output> { |
18 | 18 | path = resolve(path) |
19 | 19 | log.debug(`processing: ${path}`) |
20 | | - const mod = JSONC.parse(await Deno.readTextFile(path)) as record<string> & { exports?: record<string> } |
| 20 | + const mod = JSONC.parse(await Deno.readTextFile(path)) as Record<PropertyKey, string> & { exports?: Record<PropertyKey, string> } |
21 | 21 | // Validate package name |
22 | 22 | assertMatch(mod.name, /^@[a-z0-9-]+\/[a-z0-9-]+$/) |
23 | 23 | const [_scope, _name] = mod.name.split("/") |
@@ -47,7 +47,7 @@ export async function packaged(path = "deno.jsonc", { logger: log = new Logger() |
47 | 47 | } |
48 | 48 |
|
49 | 49 | // Copy exports |
50 | | - const exports = {} as record<string> |
| 50 | + const exports = {} as Record<PropertyKey, string> |
51 | 51 | if (mod.exports) { |
52 | 52 | json.exports = {} |
53 | 53 | for (const [key, value] of Object.entries(mod.exports) as [string, string][]) { |
@@ -114,20 +114,20 @@ export type package_output = { |
114 | 114 | name: string |
115 | 115 | version: string |
116 | 116 | type: "module" |
117 | | - scripts: record<string> |
118 | | - exports?: record<string> |
| 117 | + scripts: Record<PropertyKey, string> |
| 118 | + exports?: Record<PropertyKey, string> |
119 | 119 | description?: string |
120 | 120 | keywords?: string | string[] |
121 | 121 | license?: string |
122 | 122 | author?: string |
123 | 123 | homepage?: string |
124 | 124 | repository?: string |
125 | 125 | funding?: string |
126 | | - dependencies: record<string> |
127 | | - devDependencies?: record<string> |
| 126 | + dependencies: Record<PropertyKey, string> |
| 127 | + devDependencies?: Record<PropertyKey, string> |
128 | 128 | } |
129 | 129 | /** Exported entrypoints. */ |
130 | | - exports: record<string> |
| 130 | + exports: Record<PropertyKey, string> |
131 | 131 | } |
132 | 132 |
|
133 | 133 | /** Registry configuration. */ |
|
0 commit comments