Skip to content

Commit

Permalink
upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
zuisong committed Feb 3, 2024
1 parent ccb887b commit e2851bb
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
test:
name: Test on deno ${{ matrix.node_version }} and ${{ matrix.os }}
name: Test on deno and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.2/schema.json",
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
Expand Down
7 changes: 4 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json",
"imports": {
"esm.sh/": "https://esm.sh/v135/",
"deno_std/": "https://deno.land/[email protected]/",
"rollup": "npm:@rollup/[email protected]",
"@happy-dom/global-registrator": "npm:@happy-dom/global-registrator@13"
"deno_std/": "https://deno.land/[email protected]/",
"rollup": "npm:@rollup/[email protected]",
"swc": "npm:@swc/[email protected]",
"@happy-dom/global-registrator": "npm:@happy-dom/[email protected]"
},
"scopes": {},
"nodeModulesDir": false,
Expand Down
74 changes: 29 additions & 45 deletions deno.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"version": "3",
"packages": {
"specifiers": {
"npm:@happy-dom/global-registrator@13": "npm:@happy-dom/global-registrator@13.1.4",
"npm:@rollup/[email protected].5": "npm:@rollup/[email protected].5",
"npm:@swc/[email protected].100": "npm:@swc/[email protected].100",
"npm:@happy-dom/global-registrator@13.2.1": "npm:@happy-dom/global-registrator@13.2.1",
"npm:@rollup/[email protected].6": "npm:@rollup/[email protected].6",
"npm:@swc/[email protected].107": "npm:@swc/[email protected].107",
"npm:@types/node": "npm:@types/[email protected]"
},
"npm": {
"@happy-dom/global-registrator@13.1.4": {
"integrity": "sha512-J61SsMEy0OEXDc2K14O5lttXKdQHJTGlp/fHZMrBRm74hlOaH+IHg+LygtjlX6D2UTeqJnIjFGInoZuctNEe3g==",
"@happy-dom/global-registrator@13.2.1": {
"integrity": "sha512-chlSKfScUBS++OtcZ8z6LbP+ihEWwRYwtFM+eB8bUiJ1nM9AS4AQ96/CCrFjKXLK29XedQY3szGUkYNJCHFpnA==",
"dependencies": {
"happy-dom": "happy-dom@13.1.4"
"happy-dom": "happy-dom@13.2.1"
}
},
"@rollup/[email protected].5": {
"integrity": "sha512-Xhabb9BwobkC3NFnI9spB+AvHt+iXruRAtBZRlrCDaBnkT7hWUcSF+J+T/nW/qqqGKtYJ/1RzBRv6vCCxEIgpg==",
"@rollup/[email protected].6": {
"integrity": "sha512-B3FpAkroTE6q+MRHzv8XLBgPbxdjJiy5UnduZNQ/4lxeF1JT2O/OAr0JPpXeRG/7zpKm/kdqU/4m6AULhmnSqw==",
"dependencies": {
"@types/estree": "@types/[email protected]",
"fsevents": "[email protected]"
}
},
"@swc/[email protected].100": {
"integrity": "sha512-rCi5+dUBta1jgrT5xGeAIY8yeJ/o/8PSFmcpsTVe2I2aSXkcHX2c1G1/tS86O65rMlwEiBmGvm1txEMG89me6Q==",
"@swc/[email protected].107": {
"integrity": "sha512-mfe9FszpVT+5JA5brGQ5PwkLoDXsZeh8tyO2/rKqMjKQW0tqZP/npkVgD9yUMC/eXLM2TmnjeYZAPpTreSPBBQ==",
"dependencies": {}
},
"@types/[email protected]": {
Expand All @@ -33,10 +33,6 @@
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",
"dependencies": {}
},
"[email protected]": {
"integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==",
"dependencies": {}
},
"[email protected]": {
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"dependencies": {}
Expand All @@ -45,54 +41,35 @@
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dependencies": {}
},
"happy-dom@13.1.4": {
"integrity": "sha512-f8STa4iuJcpXn7YjgqBEemzinyPAdjlHMxlCNbIERdRIjJO9Z9Cj3XW5LuiEhsURFfl0AOWqj0hQitme4gq+Gg==",
"happy-dom@13.2.1": {
"integrity": "sha512-AwSV0OPsLxOu1nsKsw+1aakYGiCgLcYed/BPLMGe4lOxAZY14UWGAw8nB7SSnHRltBPwcM6Rf+5hcMXcU7qxaQ==",
"dependencies": {
"css.escape": "[email protected]",
"entities": "[email protected]",
"iconv-lite": "[email protected]",
"webidl-conversions": "[email protected]",
"whatwg-encoding": "[email protected]",
"whatwg-mimetype": "[email protected]"
}
},
"[email protected]": {
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dependencies": {
"safer-buffer": "[email protected]"
}
},
"[email protected]": {
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dependencies": {}
},
"[email protected]": {
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"dependencies": {}
},
"[email protected]": {
"integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
"dependencies": {
"iconv-lite": "[email protected]"
}
},
"[email protected]": {
"integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
"dependencies": {}
}
}
},
"remote": {
"https://deno.land/std@0.212.0/assert/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975",
"https://deno.land/std@0.212.0/assert/_diff.ts": "dcc63d94ca289aec80644030cf88ccbf7acaa6fbd7b0f22add93616b36593840",
"https://deno.land/std@0.212.0/assert/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4",
"https://deno.land/std@0.212.0/assert/assert_equals.ts": "4497c56fe7d2993b0d447926702802fc0becb44e319079e8eca39b482ee01b4e",
"https://deno.land/std@0.212.0/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8",
"https://deno.land/std@0.212.0/assert/equal.ts": "fae5e8a52a11d3ac694bbe1a53e13a7969e3f60791262312e91a3e741ae519e2",
"https://deno.land/std@0.212.0/async/delay.ts": "eab3187eee39ccc8cc76d411fb21fb1801250ddb1090e486d5aec2ace5403391",
"https://deno.land/std@0.212.0/fmt/colors.ts": "71e2d7d9911cf3f4f8cceaabe588fd9a4c0228102f4233da62ffd3e421201de7",
"https://deno.land/std@0.212.0/testing/_test_suite.ts": "f10a8a6338b60c403f07a76f3f46bdc9f1e1a820c0a1decddeb2949f7a8a0546",
"https://deno.land/std@0.212.0/testing/bdd.ts": "3cbd17bd35f629a76ce63446238dfb4632240dd46b3b205027c45fa3dd67e554",
"https://deno.land/std@0.214.0/assert/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975",
"https://deno.land/std@0.214.0/assert/_diff.ts": "dcc63d94ca289aec80644030cf88ccbf7acaa6fbd7b0f22add93616b36593840",
"https://deno.land/std@0.214.0/assert/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4",
"https://deno.land/std@0.214.0/assert/assert_equals.ts": "4497c56fe7d2993b0d447926702802fc0becb44e319079e8eca39b482ee01b4e",
"https://deno.land/std@0.214.0/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8",
"https://deno.land/std@0.214.0/assert/equal.ts": "fae5e8a52a11d3ac694bbe1a53e13a7969e3f60791262312e91a3e741ae519e2",
"https://deno.land/std@0.214.0/async/delay.ts": "8e1d18fe8b28ff95885e2bc54eccec1713f57f756053576d8228e6ca110793ad",
"https://deno.land/std@0.214.0/fmt/colors.ts": "aeaee795471b56fc62a3cb2e174ed33e91551b535f44677f6320336aabb54fbb",
"https://deno.land/std@0.214.0/testing/_test_suite.ts": "f10a8a6338b60c403f07a76f3f46bdc9f1e1a820c0a1decddeb2949f7a8a0546",
"https://deno.land/std@0.214.0/testing/bdd.ts": "a7a9f691c6531166e4afa9d91bd5750c7418407bb310473b27eda59fd2d1f609",
"https://esm.sh/v135/@jridgewell/[email protected]": "1cece3c73bc8b5c594f8fbf00fb83b7ac29a16a1a991caa2dd3c67f3e9d70212",
"https://esm.sh/v135/@jridgewell/[email protected]/denonext/resolve-uri.mjs": "239f11fbc4483ded7e3bc97eeaf942760d5e83d2e15cb8199e48ea61b6b49948",
"https://esm.sh/v135/[email protected]/denonext/esm/client.js": "71c42552497d42d0762e5feaef0f905a8fa098c961f1af63efb71a4b4942e150",
Expand All @@ -101,5 +78,12 @@
"https://esm.sh/v135/[email protected]?target=es2022": "fb461e015d18bb5498b62fd5dd80a5fa2d901e3a1053c6177ab6964f5404c9cf",
"https://esm.sh/v135/[email protected]/denonext/terser.bundle.mjs": "9ef20854b2cf5dfc63a53eb2ca90b30c6c1848b948100a0192b63202637f358a",
"https://esm.sh/v135/[email protected]?bundle": "ceff160b2a2d6b6635fa7dce9fee74ec8f06e6a8fcde86d78e3ad895662e7c30"
},
"workspace": {
"dependencies": [
"npm:@happy-dom/[email protected]",
"npm:@rollup/[email protected]",
"npm:@swc/[email protected]"
]
}
}
21 changes: 9 additions & 12 deletions rollup-deno-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ function shouldResolveUri(str: string) {
}
interface ModuleInfo {
modules: Module[];
roots: string[];
}

interface Module {
root: string[];
emit: string | null;
local: string;
specifier: string;
}
Expand All @@ -29,36 +26,36 @@ export default function denoResolve(baseUrl: string): rollup.Plugin {
async load(id: string) {
const url = new URL(id, baseUrl);
if (url.protocol === "file:") {
return;
return Deno.readTextFile(url);
}
return await resolver.resolve(url.toString());
return await resolver.resolve(url);
},
};
}

class DenoResolve {
private moduleCache = new Map<string, Module>();
async resolve(url: string): Promise<string> {
async resolve(url: URL): Promise<string> {
const module = await this.module(url);
if (!module) {
throw new Error(`invariant: ${url} not found`);
}
return await Deno.readTextFile(module.emit || module.local);
return await Deno.readTextFile(module.local);
}
private async module(nameStr: string): Promise<Module | undefined> {
const foundModule = this.moduleCache.get(nameStr);
private async module(nameStr: URL): Promise<Module | undefined> {
const foundModule = this.moduleCache.get(nameStr.toString());
if (foundModule) {
return foundModule;
}
const moduleInfo = await this.info(nameStr);
for (const module of moduleInfo.modules) {
this.moduleCache.set(module.specifier, module);
}
return this.moduleCache.get(nameStr);
return this.moduleCache.get(nameStr.toString());
}
private async info(nameStr: string, cwd?: string) {
private async info(nameStr: URL, cwd?: string) {
const p = new Deno.Command(Deno.execPath(), {
args: ["info", nameStr, "--json"],
args: ["info", nameStr.toString(), "--json"],
cwd: cwd,
});
const output = await p.output();
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as swc from "npm:/@swc/[email protected]";
import * as swc from "swc";
import { rollup, terser } from "./deps.ts";
import packageJson from "./package.json" with { type: "json" };
import denoResolve from "./rollup-deno-plugin.ts";
Expand Down

0 comments on commit e2851bb

Please sign in to comment.