chore: remove debug trace logs (#2545)
This commit is contained in:
@@ -78,6 +78,6 @@
|
|||||||
"jsxPrecompileSkipElements": ["a", "img", "source", "body", "html", "head"]
|
"jsxPrecompileSkipElements": ["a", "img", "source", "body", "html", "head"]
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"rules": { "exclude": ["no-window"] }
|
"rules": { "exclude": ["no-window"], "include": ["no-console"] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,11 @@ const realTTY: MockTTY = {
|
|||||||
return confirm(message);
|
return confirm(message);
|
||||||
},
|
},
|
||||||
log(...args) {
|
log(...args) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(...args);
|
console.log(...args);
|
||||||
},
|
},
|
||||||
logError(...args) {
|
logError(...args) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(...args);
|
console.error(...args);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -216,11 +216,13 @@ export class App<State> {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof HttpError) {
|
if (err instanceof HttpError) {
|
||||||
if (err.status >= 500) {
|
if (err.status >= 500) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
return new Response(err.message, { status: err.status });
|
return new Response(err.message, { status: err.status });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return new Response("Internal server error", { status: 500 });
|
return new Response("Internal server error", { status: 500 });
|
||||||
}
|
}
|
||||||
@@ -243,16 +245,20 @@ export class App<State> {
|
|||||||
|
|
||||||
// Don't spam logs with this on live deployments
|
// Don't spam logs with this on live deployments
|
||||||
if (!DENO_DEPLOYMENT_ID) {
|
if (!DENO_DEPLOYMENT_ID) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log();
|
console.log();
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
|
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
|
||||||
);
|
);
|
||||||
const sep = options.remoteAddress ? "" : "\n";
|
const sep = options.remoteAddress ? "" : "\n";
|
||||||
const space = options.remoteAddress ? " " : "";
|
const space = options.remoteAddress ? " " : "";
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(` ${localLabel} ${space}${address}${sep}`);
|
console.log(` ${localLabel} ${space}${address}${sep}`);
|
||||||
if (options.remoteAddress) {
|
if (options.remoteAddress) {
|
||||||
const remoteLabel = colors.bold("Remote:");
|
const remoteLabel = colors.bold("Remote:");
|
||||||
const remoteAddress = colors.cyan(options.remoteAddress);
|
const remoteAddress = colors.cyan(options.remoteAddress);
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(` ${remoteLabel} ${remoteAddress}\n`);
|
console.log(` ${remoteLabel} ${remoteAddress}\n`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -199,10 +199,10 @@ export class Builder implements FreshBuilder {
|
|||||||
buildCache.islands.set(island.name, `/${chunk}`);
|
buildCache.islands.set(island.name, `/${chunk}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.trace("FLUSH");
|
|
||||||
await buildCache.flush();
|
await buildCache.flush();
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
`Assets written to: ${colors.cyan(build.outDir)}`,
|
`Assets written to: ${colors.cyan(build.outDir)}`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,21 +11,18 @@ Deno.test({
|
|||||||
builder.onTransformStaticFile(
|
builder.onTransformStaticFile(
|
||||||
{ pluginName: "A", filter: /\.css$/ },
|
{ pluginName: "A", filter: /\.css$/ },
|
||||||
() => {
|
() => {
|
||||||
console.trace();
|
|
||||||
logs.push("A");
|
logs.push("A");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
builder.onTransformStaticFile(
|
builder.onTransformStaticFile(
|
||||||
{ pluginName: "B", filter: /\.css$/ },
|
{ pluginName: "B", filter: /\.css$/ },
|
||||||
() => {
|
() => {
|
||||||
console.trace();
|
|
||||||
logs.push("B");
|
logs.push("B");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
builder.onTransformStaticFile(
|
builder.onTransformStaticFile(
|
||||||
{ pluginName: "C", filter: /\.css$/ },
|
{ pluginName: "C", filter: /\.css$/ },
|
||||||
() => {
|
() => {
|
||||||
console.trace();
|
|
||||||
logs.push("C");
|
logs.push("C");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ export class MemoryBuildCache implements DevBuildCache {
|
|||||||
|
|
||||||
// deno-lint-ignore require-await
|
// deno-lint-ignore require-await
|
||||||
async flush(): Promise<void> {
|
async flush(): Promise<void> {
|
||||||
console.log("FLUSH MEMORY CACHE");
|
|
||||||
this.#ready.resolve();
|
this.#ready.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export function devErrorOverlay<T>(): MiddlewareFn<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// At this point we're pretty sure to have a server error
|
// At this point we're pretty sure to have a server error
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
return ctx.render(<FreshScripts />, init);
|
return ctx.render(<FreshScripts />, init);
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export async function updateCheck(
|
|||||||
checkFile.last_checked = new Date().toISOString();
|
checkFile.last_checked = new Date().toISOString();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Update check is optional and shouldn't abort the program.
|
// Update check is optional and shouldn't abort the program.
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(
|
console.error(
|
||||||
colors.red(` Update check failed: `) + err.message,
|
colors.red(` Update check failed: `) + err.message,
|
||||||
);
|
);
|
||||||
@@ -125,12 +126,15 @@ export async function updateCheck(
|
|||||||
|
|
||||||
const current = colors.bold(colors.rgb8(checkFile.current_version, 208));
|
const current = colors.bold(colors.rgb8(checkFile.current_version, 208));
|
||||||
const latest = colors.bold(colors.rgb8(checkFile.latest_version, 121));
|
const latest = colors.bold(colors.rgb8(checkFile.latest_version, 121));
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
` Fresh ${latest} is available. You're on ${current}`,
|
` Fresh ${latest} is available. You're on ${current}`,
|
||||||
);
|
);
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
` To upgrade, run: deno run -A -r https://fresh.deno.dev/update`,
|
` To upgrade, run: deno run -A -r https://fresh.deno.dev/update`,
|
||||||
);
|
);
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log();
|
console.log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ function reconnect() {
|
|||||||
|
|
||||||
reconnectTimer = setTimeout(() => {
|
reconnectTimer = setTimeout(() => {
|
||||||
if (backoffIdx === 0) {
|
if (backoffIdx === 0) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
`%c Fresh %c Connection closed. Trying to reconnect...`,
|
`%c Fresh %c Connection closed. Trying to reconnect...`,
|
||||||
"background-color: #86efac; color: black",
|
"background-color: #86efac; color: black",
|
||||||
@@ -84,6 +85,7 @@ function handleMessage(e: MessageEvent) {
|
|||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case "initial-state": {
|
case "initial-state": {
|
||||||
if (revision === 0) {
|
if (revision === 0) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
`%c Fresh %c Connected to development server.`,
|
`%c Fresh %c Connected to development server.`,
|
||||||
"background-color: #86efac; color: black",
|
"background-color: #86efac; color: black",
|
||||||
|
|||||||
@@ -481,6 +481,7 @@ function revivePartials(
|
|||||||
|
|
||||||
const instance = ACTIVE_PARTIALS.get(partialName);
|
const instance = ACTIVE_PARTIALS.get(partialName);
|
||||||
if (instance === undefined) {
|
if (instance === undefined) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.warn(`Partial "${partialName}" not found. Skipping...`);
|
console.warn(`Partial "${partialName}" not found. Skipping...`);
|
||||||
// Partial doesn't exist on the current page
|
// Partial doesn't exist on the current page
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export function assetInternal(path: string, buildId: string): string {
|
|||||||
url.searchParams.set(ASSET_CACHE_BUST_KEY, buildId);
|
url.searchParams.set(ASSET_CACHE_BUST_KEY, buildId);
|
||||||
return url.pathname + url.search + url.hash;
|
return url.pathname + url.search + url.hash;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.warn(
|
console.warn(
|
||||||
`Failed to create asset() URL, falling back to regular path ('${path}'):`,
|
`Failed to create asset() URL, falling back to regular path ('${path}'):`,
|
||||||
err,
|
err,
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ const app = new App({ staticDir: "./static" }).get(
|
|||||||
|
|
||||||
const handler = await app.handler();
|
const handler = await app.handler();
|
||||||
const res = await handler(new Request("http://localhost/"));
|
const res = await handler(new Request("http://localhost/"));
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(await res.text());
|
console.log(await res.text());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { DAY } from "@std/datetime";
|
|||||||
|
|
||||||
// deno-lint-ignore require-await
|
// deno-lint-ignore require-await
|
||||||
async function getLatestVersion() {
|
async function getLatestVersion() {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log("fetching latest version");
|
console.log("fetching latest version");
|
||||||
return Deno.env.get("LATEST_VERSION") ?? "99.99.999";
|
return Deno.env.get("LATEST_VERSION") ?? "99.99.999";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ export function parseHtml(input: string): TestDocument {
|
|||||||
// deno-lint-ignore no-explicit-any
|
// deno-lint-ignore no-explicit-any
|
||||||
const doc = new DOMParser().parseFromString(input, "text/html") as any;
|
const doc = new DOMParser().parseFromString(input, "text/html") as any;
|
||||||
Object.defineProperty(doc, "debug", {
|
Object.defineProperty(doc, "debug", {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
value: () => console.log(prettyDom(doc)),
|
value: () => console.log(prettyDom(doc)),
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
});
|
});
|
||||||
@@ -284,6 +285,7 @@ export function assertMetaContent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (el === null) {
|
if (el === null) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(prettyDom(doc));
|
console.log(prettyDom(doc));
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No <meta>-tag found with content "${expected}"`,
|
`No <meta>-tag found with content "${expected}"`,
|
||||||
@@ -312,6 +314,7 @@ export async function waitForText(
|
|||||||
// deno-lint-ignore no-explicit-any
|
// deno-lint-ignore no-explicit-any
|
||||||
const pretty = prettyDom(parseHtml(body) as any);
|
const pretty = prettyDom(parseHtml(body) as any);
|
||||||
|
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
`Text "${text}" not found on selector "${selector}" in html:\n\n${pretty}`,
|
`Text "${text}" not found on selector "${selector}" in html:\n\n${pretty}`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import type { DenoJson } from "../update/src/update.ts";
|
|||||||
import * as semver from "@std/semver";
|
import * as semver from "@std/semver";
|
||||||
|
|
||||||
function showHelp() {
|
function showHelp() {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(`
|
console.log(`
|
||||||
Usage: deno run -A release.ts <major|minor|patch|...>
|
Usage: deno run -A release.ts <major|minor|patch|...>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exitError(msg: string): never {
|
function exitError(msg: string): never {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(cl.red(msg));
|
console.error(cl.red(msg));
|
||||||
showHelp();
|
showHelp();
|
||||||
Deno.exit(1);
|
Deno.exit(1);
|
||||||
@@ -71,8 +73,11 @@ function formatUpgradeMsg(
|
|||||||
return ` ${nameMsg}: ${fromMsg} -> ${toMsg}`;
|
return ` ${nameMsg}: ${fromMsg} -> ${toMsg}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(formatUpgradeMsg(denoJson.name!, current, next));
|
console.log(formatUpgradeMsg(denoJson.name!, current, next));
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(formatUpgradeMsg(initJson.name!, currentInit, next));
|
console.log(formatUpgradeMsg(initJson.name!, currentInit, next));
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(formatUpgradeMsg(updateJson.name!, currentUpdate, next));
|
console.log(formatUpgradeMsg(updateJson.name!, currentUpdate, next));
|
||||||
|
|
||||||
if (!confirm("Proceed with update?")) {
|
if (!confirm("Proceed with update?")) {
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import * as tsmorph from "ts-morph";
|
||||||
|
import { type ImportState, SyntaxKind } from "./update.ts";
|
||||||
|
|
||||||
|
export function maybePrependReqVar(
|
||||||
|
method:
|
||||||
|
| tsmorph.MethodDeclaration
|
||||||
|
| tsmorph.FunctionDeclaration
|
||||||
|
| tsmorph.FunctionExpression
|
||||||
|
| tsmorph.ArrowFunction,
|
||||||
|
newImports: ImportState,
|
||||||
|
hasInferredTypes: boolean,
|
||||||
|
) {
|
||||||
|
let hasRequestVar = false;
|
||||||
|
const params = method.getParameters();
|
||||||
|
if (params.length > 0) {
|
||||||
|
const paramName = params[0].getName();
|
||||||
|
|
||||||
|
// Add explicit types if the user did that
|
||||||
|
if (hasInferredTypes && params[0].getTypeNode()) {
|
||||||
|
hasInferredTypes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasRequestVar = params.length > 1 || paramName === "req";
|
||||||
|
if (hasRequestVar || paramName === "_req") {
|
||||||
|
if (hasRequestVar && params.length === 1) {
|
||||||
|
params[0].replaceWithText("ctx");
|
||||||
|
if (!hasInferredTypes) {
|
||||||
|
newImports.core.add("FreshContext");
|
||||||
|
params[0].setType("FreshContext");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
params[0].remove();
|
||||||
|
|
||||||
|
// Use proper type
|
||||||
|
if (params.length > 1) {
|
||||||
|
const initType = params[1].getTypeNode()?.getText();
|
||||||
|
if (initType !== undefined && initType === "RouteContext") {
|
||||||
|
newImports.core.add("FreshContext");
|
||||||
|
params[1].setType("FreshContext");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const maybeObjBinding = params.length > 1
|
||||||
|
? params[1].getNameNode()
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
if (method.isKind(SyntaxKind.ArrowFunction)) {
|
||||||
|
const body = method.getBody();
|
||||||
|
if (body !== undefined && !body.isKind(SyntaxKind.Block)) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
|
console.warn(`Cannot transform arrow function`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(maybeObjBinding === undefined ||
|
||||||
|
!maybeObjBinding.isKind(SyntaxKind.ObjectBindingPattern)) &&
|
||||||
|
hasRequestVar &&
|
||||||
|
!paramName.startsWith("_")
|
||||||
|
) {
|
||||||
|
method.insertVariableStatement(0, {
|
||||||
|
declarationKind: tsmorph.VariableDeclarationKind.Const,
|
||||||
|
declarations: [{
|
||||||
|
name: paramName,
|
||||||
|
initializer: "ctx.req",
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
maybeObjBinding !== undefined &&
|
||||||
|
maybeObjBinding.isKind(SyntaxKind.ObjectBindingPattern)
|
||||||
|
) {
|
||||||
|
const objBinding = maybeObjBinding as tsmorph.ObjectBindingPattern;
|
||||||
|
const bindings = objBinding.getElements();
|
||||||
|
if (bindings.length > 0) {
|
||||||
|
let needsRemoteAddr = false;
|
||||||
|
for (let i = 0; i < bindings.length; i++) {
|
||||||
|
const binding = bindings[i];
|
||||||
|
const name = binding.getName();
|
||||||
|
if (name === "remoteAddr") {
|
||||||
|
binding.replaceWithText("info");
|
||||||
|
needsRemoteAddr = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasRequestVar && !paramName.startsWith("_")) {
|
||||||
|
const txt = maybeObjBinding.getFullText().slice(0, -2);
|
||||||
|
maybeObjBinding.replaceWithText(txt + ", req }");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsRemoteAddr) {
|
||||||
|
method.insertVariableStatement(0, {
|
||||||
|
declarationKind: tsmorph.VariableDeclarationKind.Const,
|
||||||
|
declarations: [{
|
||||||
|
name: "remoteAddr",
|
||||||
|
initializer: "info.remoteAddr",
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,16 +22,20 @@ ensureMinDenoVersion(MIN_DENO_VERSION);
|
|||||||
|
|
||||||
const flags = parseArgs(Deno.args, {});
|
const flags = parseArgs(Deno.args, {});
|
||||||
|
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(colors.bgRgb8(
|
console.log(colors.bgRgb8(
|
||||||
colors.rgb8(" 🍋 Fresh Updater ", 0),
|
colors.rgb8(" 🍋 Fresh Updater ", 0),
|
||||||
121,
|
121,
|
||||||
));
|
));
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log();
|
console.log();
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log(
|
console.log(
|
||||||
colors.italic(
|
colors.italic(
|
||||||
"Note: Breaking changes may require additional manual updates.",
|
"Note: Breaking changes may require additional manual updates.",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
let unresolvedDirectory = Deno.args[0];
|
let unresolvedDirectory = Deno.args[0];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as path from "@std/path";
|
|||||||
import * as JSONC from "@std/jsonc";
|
import * as JSONC from "@std/jsonc";
|
||||||
import * as tsmorph from "ts-morph";
|
import * as tsmorph from "ts-morph";
|
||||||
|
|
||||||
const SyntaxKind = tsmorph.ts.SyntaxKind;
|
export const SyntaxKind = tsmorph.ts.SyntaxKind;
|
||||||
|
|
||||||
export const FRESH_VERSION = "2.0.0-alpha.16";
|
export const FRESH_VERSION = "2.0.0-alpha.16";
|
||||||
export const PREACT_VERSION = "10.22.0";
|
export const PREACT_VERSION = "10.22.0";
|
||||||
@@ -57,7 +57,7 @@ async function updateDenoJson(
|
|||||||
throw new Error(`Could not find deno.json or deno.jsonc in: ${dir}`);
|
throw new Error(`Could not find deno.json or deno.jsonc in: ${dir}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportState {
|
export interface ImportState {
|
||||||
core: Set<string>;
|
core: Set<string>;
|
||||||
runtime: Set<string>;
|
runtime: Set<string>;
|
||||||
compat: Set<string>;
|
compat: Set<string>;
|
||||||
@@ -101,6 +101,7 @@ export async function updateProject(dir: string) {
|
|||||||
try {
|
try {
|
||||||
return await updateFile(sourceFile);
|
return await updateFile(sourceFile);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(`Could not process ${sourceFile.getFilePath()}`);
|
console.error(`Could not process ${sourceFile.getFilePath()}`);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -348,6 +349,7 @@ function maybePrependReqVar(
|
|||||||
if (method.isKind(SyntaxKind.ArrowFunction)) {
|
if (method.isKind(SyntaxKind.ArrowFunction)) {
|
||||||
const body = method.getBody();
|
const body = method.getBody();
|
||||||
if (!body.isKind(SyntaxKind.Block)) {
|
if (!body.isKind(SyntaxKind.Block)) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.warn(`Cannot transform arrow function`);
|
console.warn(`Cannot transform arrow function`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export function ensureMinDenoVersion(minVersion: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function error(message: string): never {
|
export function error(message: string): never {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(`%cerror%c: ${message}`, "color: red; font-weight: bold", "");
|
console.error(`%cerror%c: ${message}`, "color: red; font-weight: bold", "");
|
||||||
Deno.exit(1);
|
Deno.exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export default function CopyArea(props: { code: string }) {
|
|||||||
copied.value = true;
|
copied.value = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
copied.value = false;
|
copied.value = false;
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error((error && error.message) || "Copy failed");
|
console.error((error && error.message) || "Copy failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ function ga4(
|
|||||||
if (GA4_MEASUREMENT_ID === undefined) {
|
if (GA4_MEASUREMENT_ID === undefined) {
|
||||||
if (!showedMissingEnvWarning) {
|
if (!showedMissingEnvWarning) {
|
||||||
showedMissingEnvWarning = true;
|
showedMissingEnvWarning = true;
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.warn(
|
console.warn(
|
||||||
"GA4_MEASUREMENT_ID environment variable not set. Google Analytics reporting disabled.",
|
"GA4_MEASUREMENT_ID environment variable not set. Google Analytics reporting disabled.",
|
||||||
);
|
);
|
||||||
@@ -81,6 +82,7 @@ function ga4(
|
|||||||
|
|
||||||
await report.send();
|
await report.send();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,19 @@ const url = Deno.args[0];
|
|||||||
const id = Deno.args[1];
|
const id = Deno.args[1];
|
||||||
|
|
||||||
if (Deno.args.length == 0) {
|
if (Deno.args.length == 0) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log("Usage: screenshot <url> <id>");
|
console.log("Usage: screenshot <url> <id>");
|
||||||
Deno.exit(0);
|
Deno.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(url.match(/^http[s]?:\/\//)) || !url) {
|
if (!(url.match(/^http[s]?:\/\//)) || !url) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log("Provided URL is Broken or Wrong");
|
console.log("Provided URL is Broken or Wrong");
|
||||||
Deno.exit(0);
|
Deno.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log("Provide id to Process");
|
console.log("Provide id to Process");
|
||||||
Deno.exit(0);
|
Deno.exit(0);
|
||||||
}
|
}
|
||||||
@@ -31,6 +34,7 @@ const raw = await page.screenshot();
|
|||||||
await browser.close();
|
await browser.close();
|
||||||
|
|
||||||
if (!(raw instanceof Uint8Array)) {
|
if (!(raw instanceof Uint8Array)) {
|
||||||
|
// deno-lint-ignore no-console
|
||||||
console.log("Invalid Image");
|
console.log("Invalid Image");
|
||||||
Deno.exit(0);
|
Deno.exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user