Giter Club home page Giter Club logo

quantum-platinum-cloud / types Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gpuweb/types

1.0 1.0 0.0 532 KB

TypeScript type definitions for WebGPU https://gpuweb.github.io/types/ (NOTE: the WebGPU API itself is still unstable! These types do not directly reflect the implementation status of any browser! https://webgpu.io/)

Home Page: https://www.npmjs.com/package/@webgpu/types

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

types's Introduction

Typescript Type Definitions for WebGPU

This package defines Typescript types (.d.ts) for the upcoming WebGPU standard.

This package matches the work-in-progress WebGPU API, which is currently unstable!

Use this package to augment the ambient "dom" type definitions with the new definitions for WebGPU.

API style docs

This repo also generates typedoc docs here: https://gpuweb.github.io/types

What are declaration files?

See the TypeScript handbook.

How can I use them?

Install

  • npm: npm install --save @webgpu/types
  • yarn: yarn add @webgpu/types

Configure

TypeScript tsc and tsc-based bundlers

In tsconfig.json:

{
  // ...
  "compilerOptions": {
    // ...
    "typeRoots": [ "./node_modules/@webgpu/types", "./node_modules/@types"]
  }
}

Webpack

In webpack.config.js add:

"types": ["@webgpu/types"]

(may not be necessary with tsc config above - untested)

Inline in TypeScript

/// <reference types="@webgpu/types" />

Others?

Please contribute a PR to add instructions for other setups or improve existing instructions. :)

How to update these types

  • Make sure the submodule is checked out: git submodule update --init
  • Pull gpuweb changes: pushd gpuweb && git checkout main && git pull && popd
  • Install dependencies: npm ci
  • Generate generated/index.d.ts: npm run generate
  • Open a diff between generated/index.d.ts and dist/index.d.ts. The generated file is tracked by Git so you can see what has changed. Update the latter according to changes from the former. Note the generated/ and dist/ files are not the same. See below for intentional differences.
  • Format the result: npm run format

Intentional differences between generator output and final result

Most or all of these should be fixed in the generator over time.

  • Array changed to Iterable for WebIDL sequences in argument positions.
  • any changed to object for WebIDL object.
  • | SharedArrayBuffer added for [AllowShared] BufferSource.

The following differences are TODO: should be changed in the final result.

  • Deprecated items should be removed.

The following differences will remain.

  • onuncapturederror strongly typed.
  • getContext definitions.
  • GPUExtent3DStrict and GPUOrigin2DStrict.

Publish a new npm package version

(only for people who have npm publish access)

  • One line cmd to copy-n-paste (for ssh git user, and you'd better know what you are doing, if it failed at certain steps, you might need to clean up git tags before trying again)
    • git checkout main && git pull [email protected]:gpuweb/types.git main && git submodule update --init && npm version patch && git push [email protected]:gpuweb/types.git main --tags && npm publish
  • Separate steps (better for publishing for the first time)
    • Make sure you are in the upstream repo, not your forked one. And make sure you are synced to latest commit intended for publish
      • git checkout main
      • git pull https://github.com/gpuweb/types.git main
        • (If you are using HTTPS regularly. You can use remote names like origin, just make sure you are referring to the right repo)
      • git submodule update --init
    • Create the version tag and commit, and push
      • npm version patch
      • git push https://github.com/gpuweb/types.git main --tags
    • publish the package
      • npm publish --otp=<code>
        • Replace <code> with the one-time password from your authenticator, since two-factors authentication is required to publish.
        • If you are doing for the first time, you will do npm adduser first and it will guide you through adding the npm account.

types's People

Contributors

kainino0x avatar toji avatar austineng avatar kangz avatar shrekshao avatar greggman avatar lokokung avatar richard-yunchao avatar darionco avatar egalli avatar jiawei-shao avatar takahirox avatar beaufortfrancois avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 avatar ottoville avatar dependabot[bot] avatar shaoboyan avatar wawa27 avatar wrightwriter avatar romandev avatar jespertheend avatar magcius avatar hypnosnova avatar haoxli avatar codyjasonbennett avatar chetan-parthiban avatar andrewvarga avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.