Skip to content

Commit

Permalink
feat: upgrade to deno_ast 0.28 (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Aug 17, 2023
1 parent 7a8cd8c commit bddeade
Show file tree
Hide file tree
Showing 42 changed files with 5,170 additions and 5,251 deletions.
311 changes: 115 additions & 196 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
type CacheSetting,
createCache,
type FetchCacher,
} from "https://deno.land/x/deno_cache@0.4.1/mod.ts";
} from "https://deno.land/x/deno_cache@0.5.2/mod.ts";

/** The output of the {@linkcode bundle} function. */
export interface BundleEmit {
Expand Down
4 changes: 2 additions & 2 deletions rs-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ license = "MIT"
[dependencies]
anyhow = "1.0.44"
base64 = "0.13.0"
deno_ast = { version = "0.27.0", features = ["bundler", "codegen", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "visit", "transpiling"] }
deno_graph = "0.50.0"
deno_ast = { version = "0.28.0", features = ["bundler", "codegen", "module_specifier", "proposal", "react", "sourcemap", "transforms", "typescript", "visit", "transpiling"] }
deno_graph = "0.52.0"
escape8259 = "0.5.2"
futures = "0.3.17"
import_map = "0.15.0"
Expand Down
8 changes: 4 additions & 4 deletions tests/__snapshots__/common/exports/transpile/local/mod1.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { printHello2, returnsFoo } from "./subdir/mod2.ts";
export function returnsHi() {
return "Hi";
return "Hi";
}
export function returnsFoo2() {
return returnsFoo();
return returnsFoo();
}
export function printHello3() {
printHello2();
printHello2();
}
export function throwsError() {
throw Error("exception from mod1");
throw Error("exception from mod1");
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { printHello } from "./print_hello.ts";
export function returnsFoo() {
return "Foo";
return "Foo";
}
export function printHello2() {
printHello();
printHello();
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function printHello() {
console.log("Hello");
console.log("Hello");
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const React = {
createElement () {}
createElement () {}
};
export default function app() {
return /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("h2", null, "asdf"));
return /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("h2", null, "asdf"));
}
16 changes: 8 additions & 8 deletions tests/__snapshots__/common/remote_url_as_object/bundle.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const osType = (()=>{
const { Deno: Deno1 } = globalThis;
const { Deno: Deno1 } = globalThis;
if (typeof Deno1?.build?.os === "string") {
return Deno1.build.os;
}
const { navigator } = globalThis;
const { navigator } = globalThis;
if (navigator?.appVersion?.includes?.("Win")) {
return "windows";
}
Expand Down Expand Up @@ -117,7 +117,7 @@ function resolve(...pathSegments) {
let resolvedAbsolute = false;
for(let i = pathSegments.length - 1; i >= -1; i--){
let path;
const { Deno: Deno1 } = globalThis;
const { Deno: Deno1 } = globalThis;
if (i >= 0) {
path = pathSegments[i];
} else if (!resolvedDevice) {
Expand Down Expand Up @@ -755,7 +755,7 @@ function resolve1(...pathSegments) {
let path;
if (i >= 0) path = pathSegments[i];
else {
const { Deno: Deno1 } = globalThis;
const { Deno: Deno1 } = globalThis;
if (typeof Deno1?.cwd !== "function") {
throw new TypeError("Resolved a relative path without a CWD.");
}
Expand Down Expand Up @@ -1078,14 +1078,14 @@ const mod1 = {
toFileUrl: toFileUrl1
};
const path = isWindows ? mod : mod1;
const { join: join2 , normalize: normalize2 } = path;
const { join: join2, normalize: normalize2 } = path;
const path1 = isWindows ? mod : mod1;
const { basename: basename2 , delimiter: delimiter2 , dirname: dirname2 , extname: extname2 , format: format2 , fromFileUrl: fromFileUrl2 , isAbsolute: isAbsolute2 , join: join3 , normalize: normalize3 , parse: parse2 , relative: relative2 , resolve: resolve2 , sep: sep2 , toFileUrl: toFileUrl2 , toNamespacedPath: toNamespacedPath2 } = path1;
const { basename: basename2, delimiter: delimiter2, dirname: dirname2, extname: extname2, format: format2, fromFileUrl: fromFileUrl2, isAbsolute: isAbsolute2, join: join3, normalize: normalize3, parse: parse2, relative: relative2, resolve: resolve2, sep: sep2, toFileUrl: toFileUrl2, toNamespacedPath: toNamespacedPath2 } = path1;
function isCloser(value) {
return typeof value === "object" && value != null && "close" in value && typeof value["close"] === "function";
}
function readableStreamFromReader(reader, options = {}) {
const { autoClose =true , chunkSize =16_640 , strategy } = options;
const { autoClose = true, chunkSize = 16_640, strategy } = options;
return new ReadableStream({
async pull (controller) {
const chunk = new Uint8Array(chunkSize);
Expand Down Expand Up @@ -1165,7 +1165,7 @@ async function requestHandler(req) {
} else if (req.request.method === "GET" && pathname === "/favicon.ico") {
req.respondWith(Response.redirect("https://deno.land/favicon.ico", 302));
} else if (req.request.method === "GET" && pathname === "/ws") {
const { socket , response } = Deno.upgradeWebSocket(req.request);
const { socket, response } = Deno.upgradeWebSocket(req.request);
wsHandler(socket);
req.respondWith(response);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
export class DenoStdInternalError extends Error {
constructor(message){
super(message);
this.name = "DenoStdInternalError";
}
constructor(message){
super(message);
this.name = "DenoStdInternalError";
}
}
/** Make an assertion, if not `true`, then throw. */ export function assert(expr, msg = "") {
if (!expr) {
throw new DenoStdInternalError(msg);
}
if (!expr) {
throw new DenoStdInternalError(msg);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
export const osType = (()=>{
// deno-lint-ignore no-explicit-any
const { Deno } = globalThis;
if (typeof Deno?.build?.os === "string") {
return Deno.build.os;
}
// deno-lint-ignore no-explicit-any
const { navigator } = globalThis;
if (navigator?.appVersion?.includes?.("Win")) {
return "windows";
}
return "linux";
// deno-lint-ignore no-explicit-any
const { Deno } = globalThis;
if (typeof Deno?.build?.os === "string") {
return Deno.build.os;
}
// deno-lint-ignore no-explicit-any
const { navigator } = globalThis;
if (navigator?.appVersion?.includes?.("Win")) {
return "windows";
}
return "linux";
})();
export const isWindows = osType === "windows";
export const isLinux = osType === "linux";
Loading

0 comments on commit bddeade

Please sign in to comment.