Skip to content

Commit

Permalink
feat: Switch to esbuild (common, api, chart)
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
  • Loading branch information
GordonSmith committed Oct 8, 2024
1 parent 88e38de commit a855017
Show file tree
Hide file tree
Showing 104 changed files with 9,587 additions and 1,394 deletions.
588 changes: 573 additions & 15 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"jsdelivr": "dist/index.umd.min.js",
"workspaces": [
"xutils/*",
"xpackages/api",
"packages/api",
"xpackages/bundle",
"xpackages/chart",
"packages/chart",
"xpackages/codemirror",
"xpackages/codemirror-shim",
"xpackages/common",
"packages/common",
"packages/comms",
"xpackages/composite",
"packages/dataflow",
Expand Down
33 changes: 33 additions & 0 deletions packages/api/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "test-browser",
"type": "msedge",
"request": "launch",
"url": "http://localhost:8888",
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "test-node",
"type": "node",
"request": "launch",
"runtimeArgs": [
"run-script",
"test-node"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
}
]
}
25 changes: 6 additions & 19 deletions packages/api/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"version": "2.0.0",
"tasks": [
{
"label": "es6 watch",
"label": "gen-types-watch",
"type": "npm",
"script": "compile-es6-watch",
"script": "gen-types-watch",
"problemMatcher": [
"$tsc-watch"
],
Expand All @@ -13,18 +13,7 @@
}
},
{
"label": "umd watch",
"type": "npm",
"script": "compile-umd-watch",
"problemMatcher": [
"$tsc-watch"
],
"presentation": {
"group": "group-build"
}
},
{
"label": "bundle watch",
"label": "bundle-watch",
"type": "npm",
"script": "bundle-watch",
"problemMatcher": [],
Expand All @@ -35,15 +24,13 @@
{
"label": "build",
"dependsOn": [
"es6 watch",
"umd watch",
"bundle watch"
"gen-types-watch",
"bundle-watch",
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
}
]
}
4 changes: 4 additions & 0 deletions packages/api/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { browserTpl } from "@hpcc-js/esbuild-plugins";

// config ---
browserTpl("src/index.ts", "dist/index");
52 changes: 24 additions & 28 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,47 @@
"name": "@hpcc-js/api",
"version": "2.13.0",
"description": "hpcc-js - Viz api",
"main": "dist/index.js",
"module": "dist/index.es6",
"unpkg": "dist/index.min.js",
"jsdelivr": "dist/index.min.js",
"types": "types/index.d.ts",
"typesVersions": {
"<3.8": {
"*": [
"types-3.4/index.d.ts"
]
"type": "module",
"exports": {
".": {
"types": "./types/index.d.ts",
"default": "./dist/index.js"
}
},
"module": "./dist/index.js",
"browser": "./dist/index.js",
"types": "./types/index.d.ts",
"files": [
"dist/*",
"types/*",
"types-3.4/*",
"src/*"
"src/*",
"types/*"
],
"scripts": {
"clean": "rimraf --glob lib* types dist *.tsbuildinfo",
"compile-es6": "tsc --module es6 --outDir ./lib-es6",
"compile-es6-watch": "npm run compile-es6 -- -w",
"compile-umd": "tsc --module umd --outDir ./lib-umd",
"compile-umd-watch": "npm run compile-umd -- -w",
"bundle": "rollup -c",
"bundle-watch": "npm run bundle -- -w",
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
"gen-legacy-types": "downlevel-dts ./types ./types-3.4",
"build": "npm run compile-es6 && npm run bundle",
"watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
"clean": "rimraf --glob lib* types dist *.tsbuildinfo .turbo",
"bundle": "node esbuild.js",
"bundle-watch": "npm run bundle -- --development --watch",
"gen-types": "tsc --project tsconfig.json",
"gen-types-watch": "npm run gen-types -- --watch",
"build": "run-p gen-types bundle",
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
"lint": "eslint ./src",
"lint-fix": "eslint --fix src/**/*.ts",
"docs": "typedoc --options tdoptions.json .",
"update": "npx --yes npm-check-updates -u -t minor"
"test-browser": "vitest run --project browser",
"test": "vitest run",
"coverage": "vitest run --coverage",
"update": "npx -y npm-check-updates -u -t minor"
},
"dependencies": {
"@hpcc-js/common": "^2.72.0"
},
"devDependencies": {
"@hpcc-js/bundle": "^2.12.0",
"@hpcc-js/esbuild-plugins": "^1.1.2",
"d3-collection": "^1",
"d3-color": "3.1.0",
"d3-format": "^1",
"d3-selection": "^1",
"tslib": "2.6.3"
"tslib": "2.7.0"
},
"repository": {
"type": "git",
Expand All @@ -59,4 +55,4 @@
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
58 changes: 0 additions & 58 deletions packages/api/rollup.config.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions packages/api/src/ITooltip.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Widget } from "@hpcc-js/common";
import { format as d3Format } from "d3-format";
import { tip } from "./Tooltip";
import { tip } from "./Tooltip.ts";

import "../src/ITooltip.css";

declare const event: object;

// Use old school class declaration as this is a mixin ---
export function ITooltip() {
export function ITooltip(this: any) {
this.tooltip = tip();

if (this.tooltipLabelFormat_exists()) {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/Tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function tip() {
// Returns a tip
tip.show = function (d, idx, arr) {
target = arr[idx];
const args = Array.prototype.slice.call(arguments);
const args = Array.prototype.slice.call(arguments) as [];
const content = html.apply(this, args);
if (content === null) {
return tip;
Expand Down Expand Up @@ -74,7 +74,7 @@ export function tip() {
}
}

function _placement_attempt(_dir, _top_offset?, _left_offset?) {
function _placement_attempt(this: any, _dir, _top_offset?, _left_offset?) {
_top_offset = _top_offset ? _top_offset : 0;
_left_offset = _left_offset ? _left_offset : 0;
nodel.style("white-space", "nowrap");
Expand Down
20 changes: 10 additions & 10 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export * from "./__package__";
export * from "./I1DChart";
export * from "./I2DChart";
export * from "./I2DAggrChart";
export * from "./IGraph";
export * from "./IHighlight";
export * from "./IInput";
export * from "./INDChart";
export * from "./ITooltip";
export * from "./ITree";
export * from "./__package__.ts";
export * from "./I1DChart.ts";
export * from "./I2DChart.ts";
export * from "./I2DAggrChart.ts";
export * from "./IGraph.ts";
export * from "./IHighlight.ts";
export * from "./IInput.ts";
export * from "./INDChart.ts";
export * from "./ITooltip.ts";
export * from "./ITree.ts";
9 changes: 9 additions & 0 deletions packages/api/tests/simple.browser.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { describe, it, expect } from "vitest";

import { BUILD_VERSION } from "@hpcc-js/api";

describe("Result", function () {
it("basic", function () {
expect(BUILD_VERSION).to.be.a("string");
});
});
28 changes: 18 additions & 10 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
{
"extends": "../tsconfig.settings.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./lib-umd",
"declarationDir": "./types",
"rootDir": "src",
"module": "NodeNext",
"target": "ESNext",
"resolveJsonModule": true,
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "types",
"strict": true,
"noImplicitAny": false,
"strictNullChecks": false,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"lib": [
"DOM",
"ESNext",
"ES2020"
]
},
"include": [
"./src/**/*"
],
"references": [
{
"path": "../common"
}
"./src/index.ts"
]
}
6 changes: 6 additions & 0 deletions packages/api/vitest.workspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineWorkspace } from 'vitest/config';
import baseWorkspace from '../../vitest.workspace.ts';

export default defineWorkspace([
...baseWorkspace
])
Loading

0 comments on commit a855017

Please sign in to comment.