Skip to content

Commit 7846ca9

Browse files
committed
fix: update dependencies to latest versions
- Updated @hpcc-js/esbuild-plugins from 1.8.9 to 1.8.10 - Updated @hpcc-js/observablehq-compiler from 3.7.11 to 3.7.12 - Updated @hpcc-js/util from 3.5.7 to 3.5.8 - Updated @observablehq/notebook-kit from 1.7.3 to 1.9.1 - Updated mocha from 11.7.5 to 11.7.6 - Updated typescript-eslint from 8.59.3 to 8.60.0 - Updated vitest from 4.1.6 to 4.1.7 Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
1 parent 70cf356 commit 7846ca9

3 files changed

Lines changed: 854 additions & 817 deletions

File tree

esbuild.mjs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,50 @@ import * as esbuild from "esbuild";
22
import process from "node:process";
33
import console from "node:console";
44

5-
import { problemMatcher, inlineCSS } from "@hpcc-js/esbuild-plugins";
65
import { readFileSync, copyFileSync, mkdirSync } from "node:fs";
6+
import { readFile } from "node:fs/promises";
77
import path from "node:path";
8+
import crypto from "node:crypto";
9+
10+
function problemMatcher() {
11+
return {
12+
name: "problem-matcher",
13+
setup(build) {
14+
build.onStart(() => { console.log("[watch] build started"); });
15+
build.onEnd((result) => {
16+
result.errors.forEach(({ text, location }) => {
17+
console.error(`\u2718 [ERROR] ${text}`);
18+
console.error(` ${location?.file}:${location?.line}:${location?.column}:`);
19+
});
20+
console.log("[watch] build finished");
21+
});
22+
}
23+
};
24+
}
25+
26+
function inlineCSS() {
27+
return {
28+
name: "inline-css",
29+
setup(build) {
30+
build.onLoad({ filter: /\.(css)$/ }, async (args) => {
31+
if (build.initialOptions.platform === "browser") {
32+
const sourcePath = path.resolve(args.path);
33+
const hash = crypto.createHash("sha256").update(sourcePath).digest("hex").slice(0, 8);
34+
const sourceCSS = await readFile(sourcePath, { encoding: "utf8" });
35+
const sourceJS = `(function(){
36+
if (!document.getElementById('${hash}')) {
37+
var e = document.createElement('style');
38+
e.id = '${hash}';
39+
e.textContent = \`${sourceCSS.split("\\x25").join("\\x15")}\`;
40+
document.head.appendChild(e);
41+
}
42+
})();`;
43+
return { contents: sourceJS, loader: "js" };
44+
}
45+
});
46+
}
47+
};
48+
}
849

950
const tsconfigNode = JSON.parse(readFileSync("./tsconfig.json", "utf8"));
1051
const tsconfigBrowser = JSON.parse(readFileSync("./tsconfig.webview.json", "utf8"));

0 commit comments

Comments
 (0)