"scripts": {
"build": "rm -rf dist && tsc && node esbuild.mjs"
},
- "imports": {
- "#classes": "./src/classes/index.js",
- "#shaders": "./src/shaders/index.js"
- },
"devDependencies": {
"@types/node": "^22.10.5",
"@webgpu/types": "^0.1.52",
// SPDX-FileContributor: Ben Green <ben@latenightsketches.com>
// SPDX-License-Identifier: GPL-3.0-or-later AND MIT
-import { NanoPowGlFragmentShader, NanoPowGlVertexShader } from '#shaders'
+import { NanoPowGlFragmentShader, NanoPowGlVertexShader } from '../shaders'
export class NanoPowGl {
/** Used to set canvas size. Must be a multiple of 256. */
])
/** Compile */
- static async init() {
+ static async init () {
this.#gl = new OffscreenCanvas(this.#WORKLOAD, this.#WORKLOAD).getContext('webgl2')
if (this.#gl == null) throw new Error('WebGL 2 is required')
this.#gl.clearColor(0, 0, 0, 1)
// SPDX-License-Identifier: GPL-3.0-or-later
/// <reference types="@webgpu/types" />
-import { NanoPowGpuComputeShader } from '#shaders'
+import { NanoPowGpuComputeShader } from '../shaders'
/**
* Nano proof-of-work using WebGPU.
// Reset `nonce` and `found` to 0u in WORK before each calculation
this.#device.queue.writeBuffer(this.#gpuBuffer, 0, new Uint32Array([0, 0, 0]))
- // Bind UBO read and GPU write buffers
+ // Bind UBO read and GPU write buffers
const bindGroup = this.#device.createBindGroup({
layout: this.#bindGroupLayout,
entries: [
// SPDX-FileCopyrightText: 2025 Chris Duncan <chris@zoso.dev>
// SPDX-License-Identifier: GPL-3.0-or-later
-import { NanoPow, NanoPowGl, NanoPowGpu } from "#classes"
+import { NanoPow, NanoPowGl, NanoPowGpu } from "./classes"
export { NanoPow, NanoPowGl, NanoPowGpu }
export default NanoPow