Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 9be318c
_commit: 9232d1f
_src_path: https://github.com/python-project-templates/base.git
add_docs: false
add_extension: js
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Makefile linguist-documentation
*.html text=auto eol=lf
*.js text=auto eol=lf
*.json text=auto eol=lf
*.less text=auto eol=lf
*.md text=auto eol=lf
*.py text=auto eol=lf
*.toml text=auto eol=lf
Expand Down
34 changes: 33 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
<<<<<<< before updating
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
=======
name: Bug Report
about: Report a bug to help us improve
title: '[BUG] '
labels: 'type: bug'
>>>>>>> after updating
assignees: ''

---

<<<<<<< before updating
<!--
Thank you for taking the time to file a bug report. Before creating a
new issue, please take a few minutes to search the issue tracker for an
Expand Down Expand Up @@ -47,3 +54,28 @@ the issue.
<!-- Explain how this issue affects your work or why it should be
prioritized. If there are additional details that don't fit elsewhere,
include them here. -->
=======
**Description**
A clear and concise description of the bug.

**Steps to Reproduce**
1.
2.
3.

**Expected Behavior**
What you expected to happen.

**Actual Behavior**
What actually happened. Include full error messages or tracebacks if available.

**Environment**
- OS: [e.g. Ubuntu 22.04, macOS 14.0, Windows 11]
- Python version: [e.g. 3.11.5] (`python --version`)
- Node.js version: [e.g. 22.0.0] (`node --version`)
- pnpm version: [e.g. 9.0.0] (`pnpm --version`)
- Package version: (`pip show csp-gateway | grep Version`)

**Additional Context**
Add any other relevant context, logs, or screenshots.
>>>>>>> after updating
25 changes: 12 additions & 13 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
name: Feature Request
about: Suggest a new feature or improvement
title: '[FEATURE] '
labels: 'type: enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Problem Statement**
A clear description of the problem this feature would solve. Ex. "I'm always frustrated when [...]"

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Proposed Solution**
A clear description of the desired behavior or feature.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Alternatives Considered**
Any alternative solutions or workarounds you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
**Additional Context**
Add any other context, mockups, or examples.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Question
about: Ask a question about usage or behavior
title: '[QUESTION] '
labels: 'tag: question'
assignees: ''
---

**Question**
A clear and concise description of your question.

**Context**
What are you trying to accomplish? Include relevant code snippets, configuration, or links to documentation you've already consulted.

**Environment**
If relevant, include your environment details (OS, language versions, package version).
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Description

Brief description of the changes in this PR.

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactor / code cleanup
- [ ] CI / build configuration
- [ ] Other (describe below)

## Checklist

- [ ] Linting passes (`make lint`)
- [ ] Tests pass (`make test`)
- [ ] New tests added for new functionality
- [ ] Documentation updated (if applicable)
- [ ] Changelog / version bump (if applicable)
18 changes: 18 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,26 @@ jobs:
matrix:
wheel: ["", "client"]

<<<<<<< before updating
steps:
- uses: actions/checkout@v6
=======
- uses: actions-ext/python/test-wheel@main
with:
module: csp_gateway
if: matrix.os == 'ubuntu-latest'

- uses: actions-ext/python/test-sdist@main
with:
module: csp_gateway
if: matrix.os == 'ubuntu-latest'

- uses: actions/upload-artifact@v7
with:
name: dist-${{matrix.os}}
path: dist
if: matrix.os == 'ubuntu-latest'
>>>>>>> after updating

- name: Set up Python
uses: actions-ext/python/setup@main
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ dmypy.json
/site
index.md
docs/_build/
docs/src/_build/
docs/api
docs/index.md
docs/html
docs/index.md
docs/jupyter_execute
docs/src/_build/
docs/superpowers
index.md

# JS
Expand Down
44 changes: 42 additions & 2 deletions js/build.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< before updating
import { NodeModulesExternal } from "@finos/perspective-esbuild-plugin/external.js";
import { build } from "@finos/perspective-esbuild-plugin/build.js";
import { BuildCss } from "@prospective.co/procss/target/cjs/procss.js";
Expand All @@ -16,9 +17,18 @@ const REACT_ALIAS = {
"react-dom": path.dirname(require.resolve("react-dom/package.json")),
"react/jsx-runtime": require.resolve("react/jsx-runtime"),
};
=======
import { bundle } from "./tools/bundle.mjs";
import { bundle_css } from "./tools/css.mjs";
import { node_modules_external } from "./tools/externals.mjs";

const BUILD = [
import fs from "fs";
import cpy from "cpy";
>>>>>>> after updating

const BUNDLES = [
{
<<<<<<< before updating
define: {
global: "window",
},
Expand Down Expand Up @@ -148,6 +158,36 @@ async function build_all() {

/* Compile and copy css */
await compile_css();
=======
entryPoints: ["src/ts/index.ts"],
plugins: [node_modules_external()],
outfile: "dist/esm/index.js",
},
{
entryPoints: ["src/ts/index.ts"],
outfile: "dist/cdn/index.js",
},
];

async function build() {
// Bundle css
await bundle_css();

// Copy HTML
cpy("src/html/*", "dist/");

// Copy images
fs.mkdirSync("dist/img", { recursive: true });
cpy("src/img/*", "dist/img");

await Promise.all(BUNDLES.map(bundle)).catch(() => process.exit(1));

// Copy servable assets to python extension (exclude esm/)
fs.mkdirSync("../csp_gateway/extension", { recursive: true });
cpy("dist/**/*", "../csp_gateway/extension", {
filter: (file) => !file.relativePath.startsWith("esm"),
});
>>>>>>> after updating
}

build_all();
build();
25 changes: 25 additions & 0 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"main": "./lib/index.js",
"scripts": {
"build": "node build.mjs",
<<<<<<< before updating
"clean": "rimraf dist",
"lint": "prettier --check \"src/**/*.js\" \"src/**/*.jsx\" \"src/style/*.css\" \"src/html/*.html\" \"*.mjs\" \"*.json\"",
"fix": "prettier --write \"src/**/*.js\" \"src/**/*.jsx\" \"src/style/*.css\" \"src/html/*.html\" \"*.mjs\" \"*.json\"",
Expand All @@ -29,13 +30,37 @@
"react-dom": "^19.2.4",
"react-icons": "^5.6.0",
"react-modern-drawer": "^1.4.0"
=======
"clean": "rm -rf dist playwright-report ../csp_gateway/extension",
"dev": "npm-run-all -p start watch",
"lint": "prettier --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"",
"fix": "prettier --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"",
"preinstall": "npx only-allow pnpm",
"prepack": "npm run build",
"start": "http-server -p 3000 -o examples/",
"start:tests": "http-server -p 3000 ",
"test": "TZ=UTC playwright test",
"watch": "nodemon --watch src -e ts,css,html --exec \"pnpm build:debug\""
>>>>>>> after updating
},
"devDependencies": {
<<<<<<< before updating
"@finos/perspective-esbuild-plugin": "3.2.1",
"@prospective.co/procss": "^0.1.18",
"cpy": "^13.2.1",
"esbuild": "^0.27.3",
"npm-run-all": "^4.1.5",
"prettier": "^3.8.1"
=======
"@playwright/test": "^1.59.1",
"cpy": "^13.2.1",
"esbuild": "^0.27.4",
"lightningcss": "^1.29.3",
"http-server": "^14.1.1",
"nodemon": "^3.1.10",
"npm-run-all": "^4.1.5",
"prettier": "^3.8.1",
"typescript": "^6.0.2"
>>>>>>> after updating
}
}
Empty file added js/src/css/index.css
Empty file.
59 changes: 59 additions & 0 deletions js/tools/bundle.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { getarg } from "./getarg.mjs";
import esbuild from "esbuild";

const DEBUG = getarg("--debug");

const CUTOFF_PERCENT = 0.02;

const COMMON_DEFINE = {
global: "window",
"process.env.DEBUG": `${DEBUG}`,
};

const COMMON_LOADER = {
".css": "text",
".html": "text",
".jsx": "jsx",
".png": "file",
".ttf": "file",
".wasm": "file",
};

const DEFAULT_BUILD = {
target: ["es2022"],
bundle: true,
format: "esm",
minify: DEBUG,
sourcemap: true,
metafile: true,
entryNames: "[name]",
chunkNames: "[name]",
assetNames: "[name]",
define: COMMON_DEFINE,
loader: COMMON_LOADER,
plugins: [],
};

export const bundle = async (config) => {
const result = await esbuild.build({
...DEFAULT_BUILD,
...config,
});

if (result.metafile) {
for (const output of Object.keys(result.metafile.outputs)) {
const { inputs, bytes } = result.metafile.outputs[output];
for (const input of Object.keys(inputs)) {
if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) {
delete inputs[input];
}
}
}

const text = await esbuild.analyzeMetafile(result.metafile, {
color: true,
});

console.log(text);
}
};
52 changes: 52 additions & 0 deletions js/tools/css.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { getarg } from "./getarg.mjs";

import { bundleAsync } from "lightningcss";
import fs from "fs";
import path from "path";

const DEBUG = getarg("--debug");

const DEFAULT_RESOLVER = {
resolve(specifier, originatingFile) {
if (/^https?:\/\//.test(specifier)) {
return specifier;
}

if (specifier.startsWith("perspective-viewer-")) {
const viewerCssDir = path.resolve(
"node_modules/@perspective-dev/viewer/dist/css",
);
const normalized = specifier.replace(/^perspective-viewer-/, "");
const normalizedPath = path.join(viewerCssDir, normalized);
if (fs.existsSync(normalizedPath)) {
return normalizedPath;
}
return path.join(viewerCssDir, specifier);
}
return path.resolve(path.dirname(originatingFile), specifier);
},
};

const bundle_one = async (file, resolver) => {
const { code } = await bundleAsync({
filename: path.resolve(file),
minify: !DEBUG,
sourceMap: false,
resolver: resolver || DEFAULT_RESOLVER,
});
const outName = path.basename(file);
fs.mkdirSync("./dist/css", { recursive: true });
fs.writeFileSync(path.join("./dist/css", outName), code);
};

export const bundle_css = async (root = "src/css/index.css", resolver = null) => {
const resolved = path.resolve(root);
if (fs.statSync(resolved).isDirectory()) {
const files = fs.readdirSync(resolved).filter((f) => f.endsWith(".css"));
for (const file of files) {
await bundle_one(path.join(root, file), resolver);
}
} else {
await bundle_one(root, resolver);
}
}
Loading