diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..ae30595 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,41 @@ +name: deploy-pages +on: + push: + branches: "main" + paths-ignore: + - README.md + - CONTRIBUTING.md + - LICENSE + - .gitignore + - .github/** + - "!.github/workflows/deploy-pages.yml" + workflow_dispatch: +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true +jobs: + deploy-pages: + environment: + name: github-pages + url: ${{ steps.deploy-pages.outputs.page_url }} + permissions: + pages: write + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: "20" + cache: npm + - run: npm ci + - id: configure-pages + uses: actions/configure-pages@v4 + - run: npm run build:docs + env: + BASE_URL: ${{ steps.configure-pages.outputs.base_url }}/ + - uses: actions/upload-pages-artifact@v2 + with: + path: docs + - id: deploy-pages + uses: actions/deploy-pages@v3 diff --git a/.gitignore b/.gitignore index 2c39677..009b485 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Ignore Typst PDF outputs test/*.pdf +# https://typedoc.org/ +docs + #region https://github.com/github/gitignore/blob/main/Node.gitignore # Logs logs @@ -132,4 +135,4 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* -#endregion \ No newline at end of file +#endregion diff --git a/README.md b/README.md index 63b7317..c91855f 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,110 @@ -

- Typst -

- -

- - Documentation - - Typst App - - Discord Server - - Apache-2 License - - Jobs at Typst -

+# Typst.js + +πŸ“¦ Typst for JavaScript -Typst is a new markup-based typesetting system that is designed to be as powerful -as LaTeX while being much easier to learn and use. Typst has: +
-- Built-in markup for the most common formatting tasks -- Flexible functions for everything else -- A tightly integrated scripting system -- Math typesetting, bibliography management, and more -- Fast compile times thanks to incremental compilation -- Friendly error messages in case something goes wrong +```sh +# ✨ Use Typst right away through the power of npx! πŸš€ +npx typst --help +npx typst compile example.typ example.pdf +npx typst query example.typ "" +#=> [ { "func": "metadata", "value": "This is a note" } ] +``` -This repository contains the Typst compiler and its CLI, which is everything you -need to compile Typst documents locally. For the best writing experience, -consider signing up to our [collaborative online editor][app] for free. It is -currently in public beta. +
-## Example +```js +// πŸ‘¨β€πŸ’» Or use the JavaScript API (with types!) +import * as typst from "typst"; +await typst.compile("example.typ", "example.pdf"); +console.log(await typst.query("example.typ", "")); +//=> [ { func: 'metadata', value: 'This is a note' } ] +``` -A [gentle introduction][tutorial] to Typst is available in our documentation. -However, if you want to see the power of Typst encapsulated in one image, here -it is: +
-

- Example +

+ Docs + | GitHub + | Typst

-Let's dissect what's going on: - -- We use _set rules_ to configure element properties like the size of pages or - the numbering of headings. By setting the page height to `auto`, it scales to - fit the content. Set rules accommodate the most common configurations. If you - need full control, you can also use [show rules][show] to completely redefine - the appearance of an element. - -- We insert a heading with the `= Heading` syntax. One equals sign creates a top - level heading, two create a subheading and so on. Typst has more lightweight - markup like this, see the [syntax] reference for a full list. - -- [Mathematical equations][math] are enclosed in dollar signs. By adding extra - spaces around the contents of a equation, we can put it into a separate block. - Multi-letter identifiers are interpreted as Typst definitions and functions - unless put into quotes. This way, we don't need backslashes for things like - `floor` and `sqrt`. And `phi.alt` applies the `alt` modifier to the `phi` to - select a particular symbol variant. - -- Now, we get to some [scripting]. To input code into a Typst document, we can - write a hash followed by an expression. We define two variables and a - recursive function to compute the n-th fibonacci number. Then, we display the - results in a center-aligned table. The table function takes its cells - row-by-row. Therefore, we first pass the formulas `$F_1$` to `$F_8$` and then - the computed fibonacci numbers. We apply the spreading operator (`..`) to both - because they are arrays and we want to pass the arrays' items as individual - arguments. - -
- Text version of the code example. +πŸ‘¨β€πŸ’» Includes the Typst CLI so you can `npx typst` \ +πŸ’» Provides a typed JavaScript API so you can `typst.compile()` \ +πŸ“‘ Install it locally with `npm install --save` as a project-level dependency \ +🌎 Or install it globally with `npm install --global` + +[**πŸ“‘ Make sure you check out the official Typst website!**](https://typst.app/) + +## Installation + +```sh +npm install typst +``` + +```js +import * as typst from "npm:typst"; +``` + +πŸ›‘ Typst does not yet work in the browser. WASM support is planned. + +## Usage + +This package provides both the Typst CLI as well as a JavaScript API. To use the +CLI, just run `npx typst --help`. + +``` +The Typst compiler + +Usage: typst [OPTIONS] + +Commands: + compile Compiles an input file into a supported output format [aliases: c] + watch Watches an input file and recompiles on changes [aliases: w] + query Processes an input file to extract provided metadata + fonts Lists all discovered fonts in system and custom font paths + update Self update the Typst CLI + help Print this message or the help of the given subcommand(s) + +Options: + -v, --verbosity... Sets the level of logging verbosity: -v = warning & error, -vv = info, -vvv = debug, -vvvv = trace + --cert Path to a custom CA certificate to use when making network requests [env: TYPST_CERT=] + -h, --help Print help + -V, --version Print version +``` + +β„Ή The `typst update` command will fail. Use `npm install typst@latest` to update it through npm. + +All of the major Typst CLI commands are also exposed for use in JavaScript: + +```js +import * as typst from "typst"; +await typst.query("example.typ", ""); //=> object[] +await typst.compile("example.typ", "example.pdf"); +await typst.watch("example.typ", "example.pdf"); +await typst.fonts(); //=> string[] +await typst.help(); //=> string +await typst.version(); //=> string +``` + +[πŸ“š Check out the Typst.js documentation website for more details!](https://typst.community/typst.js/) + +### Example + + ```typst #set page(width: 10cm, height: auto) #set heading(numbering: "1.") = Fibonacci sequence -The Fibonacci sequence is defined through the -recurrence relation $F_n = F_(n-1) + F_(n-2)$. +The Fibonacci sequence is defined through +the recurrence relation $F_n = F_(n-1) + F_(n-2)$. It can also be expressed in _closed form:_ $ F_n = round(1 / sqrt(5) phi.alt^n), quad - phi.alt = (1 + sqrt(5)) / 2 $ + phi.alt = (l + sqrt(5)) / 2 $ #let count = 8 #let nums = range(1, count + 1) @@ -104,165 +122,26 @@ The first #count numbers of the sequence are: )) ``` -
- -## Installation - -Typst's CLI is available from different sources: - -- You can get sources and pre-built binaries for the latest release of Typst - from the [releases page][releases]. Download the archive for your platform and - place it in a directory that is in your `PATH`. To stay up to date with future - releases, you can simply run `typst update`. - -- You can install Typst through different package managers. Note that the - versions in the package managers might lag behind the latest release. - - - Linux: View [Typst on Repology][repology] - - macOS: `brew install typst` - - Windows: `winget install --id Typst.Typst` - -- If you have a [Rust][rust] toolchain installed, you can also install the - latest development version with - `cargo install --git https://github.com/typst/typst typst-cli`. Note that this - will be a "nightly" version that may be broken or not yet properly documented. - -- Nix users can use the `typst` package with `nix-shell -p typst` or build and - run the bleeding edge version with `nix run github:typst/typst -- --version`. - -- Docker users can run a prebuilt image with - `docker run -it ghcr.io/typst/typst:latest`. - -## Usage - -Once you have installed Typst, you can use it like this: - ```sh -# Creates `file.pdf` in working directory. -typst compile file.typ - -# Creates PDF file at the desired path. -typst compile path/to/source.typ path/to/output.pdf -``` - -You can also watch source files and automatically recompile on changes. This is -faster than compiling from scratch each time because Typst has incremental -compilation. - -```sh -# Watches source files and recompiles on changes. -typst watch file.typ +typst compile example.typ +$BROWSER example.pdf ``` -Typst further allows you to add custom font paths for your project and list all -of the fonts it discovered: - -```sh -# Adds additional directories to search for fonts. -typst compile --font-path path/to/fonts file.typ +## Development -# Lists all of the discovered fonts in the system and the given directory. -typst fonts --font-path path/to/fonts +This package contains two primary parts: a binary redistribution setup using a +bunch of `optionalDependencies` and a bunch of pretty `typst ...` CLI wrapper +functions. -# Or via environment variable (Linux syntax). -TYPST_FONT_PATHS=path/to/fonts typst fonts -``` +When you clone this repository and run `npm install`, it auto runs the +`tools/generate-dist-package` script with your current `$OS-$ARCH` tuple and +uses `npm link` to link that to the current workspace. This is for debugging. -For other CLI subcommands and options, see below: +To bump the version, use `npm version --no-git-tag-version $NEW_VERSION` so that +the `tools/postversion.js` script gets run to realign the `optionalDependencies` +with the new `version` field. You can do this manually if you prefer. πŸ€·β€β™‚οΈ -```sh -# Prints available subcommands and options. -typst help - -# Prints detailed usage of a subcommand. -typst help watch -``` - -If you prefer an integrated IDE-like experience with autocompletion and instant -preview, you can also check out the [Typst web app][app], which is currently in -public beta. - -## Community - -The main place where the community gathers is our [Discord server][discord]. -Feel free to join there to ask questions, help out others, share cool things -you created with Typst, or just to chat. - -Aside from that there are a few places where you can find things built by -the community: - -- The official [package list](https://typst.app/docs/packages) -- The [Awesome Typst](https://github.com/qjcg/awesome-typst) repository - -If you had a bad experience in our community, please [reach out to us][contact]. - -## Contributing - -We would love to see contributions from the community. If you experience bugs, -feel free to open an issue. If you would like to implement a new feature or bug -fix, please follow the steps outlined in the [contribution guide][contributing]. - -To build Typst yourself, first ensure that you have the -[latest stable Rust][rust] installed. Then, clone this repository and build the -CLI with the following commands: - -```sh -git clone https://github.com/typst/typst -cd typst -cargo build --release -``` +Then, when you want to create a new release, remember to run `npm run build` +_after_ the `version` field has been updated (it gets used in the build step). This will generate a bunch of `out/$OS-$ARCH/` folders, each of which is a targeted distribution of a native binary that only works on that platform. -The optimized binary will be stored in `target/release/`. - -Another good way to contribute is by [sharing packages][packages] with the -community. - -## Pronunciation and Spelling - -IPA: /taΙͺpst/. "Ty" like in **Ty**pesetting and "pst" like in Hi**pst**er. When -writing about Typst, capitalize its name as a proper noun, with a capital "T". - -## Design Principles - -All of Typst has been designed with three key goals in mind: Power, -simplicity, and performance. We think it's time for a system that matches the -power of LaTeX, is easy to learn and use, all while being fast enough to realize -instant preview. To achieve these goals, we follow three core design principles: - -- **Simplicity through Consistency:** - If you know how to do one thing in Typst, you should be able to transfer that - knowledge to other things. If there are multiple ways to do the same thing, - one of them should be at a different level of abstraction than the other. E.g. - it's okay that `= Introduction` and `#heading[Introduction]` do the same thing - because the former is just syntax sugar for the latter. - -- **Power through Composability:** - There are two ways to make something flexible: Have a knob for everything or - have a few knobs that you can combine in many ways. Typst is designed with the - second way in mind. We provide systems that you can compose in ways we've - never even thought of. TeX is also in the second category, but it's a bit - low-level and therefore people use LaTeX instead. But there, we don't really - have that much composability. Instead, there's a package for everything - (`\usepackage{knob}`). - -- **Performance through Incrementality:** - All Typst language features must accommodate for incremental compilation. - Luckily we have [`comemo`], a system for incremental compilation which does - most of the hard work in the background. - -[docs]: https://typst.app/docs/ -[app]: https://typst.app/ -[discord]: https://discord.gg/2uDybryKPe -[tutorial]: https://typst.app/docs/tutorial/ -[show]: https://typst.app/docs/reference/styling/#show-rules -[math]: https://typst.app/docs/reference/math/ -[syntax]: https://typst.app/docs/reference/syntax/ -[scripting]: https://typst.app/docs/reference/scripting/ -[rust]: https://rustup.rs/ -[releases]: https://github.com/typst/typst/releases/ -[repology]: https://repology.org/project/typst/versions -[contact]: https://typst.app/contact -[architecture]: https://github.com/typst/typst/blob/main/docs/dev/architecture.md -[contributing]: https://github.com/typst/typst/blob/main/CONTRIBUTING.md -[packages]: https://github.com/typst/packages/ -[`comemo`]: https://github.com/typst/comemo/ +Then finally when you run `npm publish`, there's a hook to publish all the `out/$OS-$ARCH/` packages (`@typst-community/typst-$OS-$ARCH`) _before_ finally publishing the root `typst` package. diff --git a/package-lock.json b/package-lock.json index 3876726..edbb196 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "typst", - "version": "0.10.0-6", + "version": "0.10.0-8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "typst", - "version": "0.10.0-6", + "version": "0.10.0-8", "license": "Apache-2.0", "dependencies": { "execa": "^8.0.1" @@ -17,15 +17,16 @@ "devDependencies": { "@types/node": "^20.10.4", "prettier": "^3.1.1", + "typedoc": "^0.25.4", "typescript": "^5.3.3", "vitest": "^1.0.4" }, "optionalDependencies": { - "@typst-community/typst-darwin-arm64": "0.10.0-6", - "@typst-community/typst-darwin-x64": "0.10.0-6", - "@typst-community/typst-linux-arm64": "0.10.0-6", - "@typst-community/typst-linux-x64": "0.10.0-6", - "@typst-community/typst-win32-x64": "0.10.0-6" + "@typst-community/typst-darwin-arm64": "0.10.0-8", + "@typst-community/typst-darwin-x64": "0.10.0-8", + "@typst-community/typst-linux-arm64": "0.10.0-8", + "@typst-community/typst-linux-x64": "0.10.0-8", + "@typst-community/typst-win32-x64": "0.10.0-8" } }, "node_modules/@esbuild/android-arm": { @@ -583,24 +584,49 @@ } }, "node_modules/@typst-community/typst-darwin-arm64": { - "resolved": "packages/typst-community+typst-darwin-arm64", - "link": true + "version": "0.10.0-8", + "resolved": "https://registry.npmjs.org/@typst-community/typst-darwin-arm64/-/typst-darwin-arm64-0.10.0-8.tgz", + "integrity": "sha512-y4aQzzBTcFYM8mbpOP6RpHFtsRN9wHBIPCJeP6i0XA75FqbeRhes7SLVX16Yck8BYy4Tfv8sW3dK2iZ1+USxJA==", + "optional": true, + "os": [ + "darwin" + ] }, "node_modules/@typst-community/typst-darwin-x64": { - "resolved": "packages/typst-community+typst-darwin-x64", - "link": true + "version": "0.10.0-8", + "resolved": "https://registry.npmjs.org/@typst-community/typst-darwin-x64/-/typst-darwin-x64-0.10.0-8.tgz", + "integrity": "sha512-IPkSawdzBQhXv23zqfNsgX/L8WdHSqRsytmBSx7AhWWVl9vDe4S73G0Epl8NlUTrx2rf/vjnp8ayh4vA8EAQVg==", + "optional": true, + "os": [ + "darwin" + ] }, "node_modules/@typst-community/typst-linux-arm64": { - "resolved": "packages/typst-community+typst-linux-arm64", - "link": true + "version": "0.10.0-8", + "resolved": "https://registry.npmjs.org/@typst-community/typst-linux-arm64/-/typst-linux-arm64-0.10.0-8.tgz", + "integrity": "sha512-XDBqA7TjJ0DtV1dvX8iYRIdE0QADl8D1EyBJQUaII+JOgDeRajVDZB58KNpY9eIgiL9lTw2nnybGsW3Frts4CQ==", + "optional": true, + "os": [ + "linux" + ] }, "node_modules/@typst-community/typst-linux-x64": { - "resolved": "packages/typst-community+typst-linux-x64", - "link": true + "version": "0.10.0-8", + "resolved": "https://registry.npmjs.org/@typst-community/typst-linux-x64/-/typst-linux-x64-0.10.0-8.tgz", + "integrity": "sha512-HL2N92Xgao9slbW8pq1cu6SpCQ67ExLw7L0o/SKlHJ9ZkjtJlHJq8bRhOlHnenqU/tYyyJy73+nc0r+rQjX3RQ==", + "optional": true, + "os": [ + "linux" + ] }, "node_modules/@typst-community/typst-win32-x64": { - "resolved": "packages/typst-community+typst-win32-x64", - "link": true + "version": "0.10.0-8", + "resolved": "https://registry.npmjs.org/@typst-community/typst-win32-x64/-/typst-win32-x64-0.10.0-8.tgz", + "integrity": "sha512-qPMG+h8mqrKoq66vtT6bIJFUQ/xmRyVbnDIgcFw26ZucJzDak3s3b7LuiVgghZw1TJkGPzYO6Yzi47AWB146cA==", + "optional": true, + "os": [ + "win32" + ] }, "node_modules/@vitest/expect": { "version": "1.0.4", @@ -691,6 +717,12 @@ "node": ">=0.4.0" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "node_modules/ansi-styles": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", @@ -712,6 +744,21 @@ "node": "*" } }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -950,6 +997,12 @@ "get-func-name": "^2.0.1" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/magic-string": { "version": "0.30.5", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", @@ -962,6 +1015,18 @@ "node": ">=12" } }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -978,6 +1043,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/mlly": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", @@ -1219,6 +1299,18 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", + "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", @@ -1313,6 +1405,27 @@ "node": ">=4" } }, + "node_modules/typedoc": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.4.tgz", + "integrity": "sha512-Du9ImmpBCw54bX275yJrxPVnjdIyJO/84co0/L9mwe0R3G4FSR6rQ09AlXVRvZEGMUg09+z/usc8mgygQ1aidA==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x" + } + }, "node_modules/typescript": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", @@ -1481,6 +1594,18 @@ } } }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1522,66 +1647,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "packages/typst-community+typst-darwin-arm64": { - "name": "@typst-community/typst-darwin-arm64", - "version": "0.10.0-6", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ] - }, - "packages/typst-community+typst-darwin-x64": { - "name": "@typst-community/typst-darwin-x64", - "version": "0.10.0-6", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ] - }, - "packages/typst-community+typst-linux-arm64": { - "name": "@typst-community/typst-linux-arm64", - "version": "0.10.0-6", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ] - }, - "packages/typst-community+typst-linux-x64": { - "name": "@typst-community/typst-linux-x64", - "version": "0.10.0-6", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ] - }, - "packages/typst-community+typst-win32-x64": { - "name": "@typst-community/typst-win32-x64", - "version": "0.10.0-6", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "win32" - ] } } } diff --git a/package.json b/package.json index aa295a1..6824468 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typst", - "version": "0.10.0-6", + "version": "0.10.0-8", "description": "A new markup-based typesetting system that is powerful and easy to learn.", "keywords": [ "typesetting", @@ -12,7 +12,7 @@ "markdown", "pdf" ], - "homepage": "https://typst.app", + "homepage": "https://typst.community/typst.js/", "bugs": "https://github.com/typst-community/typst.js/issues", "repository": "github:typst-community/typst.js", "license": "Apache-2.0", @@ -30,11 +30,12 @@ "test": "node --test", "prepare": "bash tools/prepare.sh", "build": "tsc", + "postbuild": "bash tools/generate-dist-package.sh --all", "format": "prettier -w .", "lint": "tsc --noEmit", - "postversion": "node tools/postversion.js", - "generate-dist-packages": "node tools/generate-dist-packages.js", - "prepublishOnly": "bash tools/prepublishOnly.sh" + "prepublishOnly": "bash tools/prepublishOnly.sh", + "build:docs": "typedoc", + "postversion": "node tools/postversion.js" }, "dependencies": { "execa": "^8.0.1" @@ -42,14 +43,15 @@ "devDependencies": { "@types/node": "^20.10.4", "prettier": "^3.1.1", + "typedoc": "^0.25.4", "typescript": "^5.3.3", "vitest": "^1.0.4" }, "optionalDependencies": { - "@typst-community/typst-win32-x64": "0.10.0-6", - "@typst-community/typst-darwin-x64": "0.10.0-6", - "@typst-community/typst-darwin-arm64": "0.10.0-6", - "@typst-community/typst-linux-arm64": "0.10.0-6", - "@typst-community/typst-linux-x64": "0.10.0-6" + "@typst-community/typst-darwin-arm64": "0.10.0-8", + "@typst-community/typst-darwin-x64": "0.10.0-8", + "@typst-community/typst-linux-arm64": "0.10.0-8", + "@typst-community/typst-linux-x64": "0.10.0-8", + "@typst-community/typst-win32-x64": "0.10.0-8" } } diff --git a/packages/typst-community+typst-darwin-arm64/.gitignore b/packages/typst-community+typst-darwin-arm64/.gitignore deleted file mode 100644 index 4db03c2..0000000 --- a/packages/typst-community+typst-darwin-arm64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.typst \ No newline at end of file diff --git a/packages/typst-community+typst-darwin-arm64/LICENSE b/packages/typst-community+typst-darwin-arm64/LICENSE deleted file mode 100644 index a7e77cb..0000000 --- a/packages/typst-community+typst-darwin-arm64/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/packages/typst-community+typst-darwin-arm64/README.md b/packages/typst-community+typst-darwin-arm64/README.md deleted file mode 100644 index d67545b..0000000 --- a/packages/typst-community+typst-darwin-arm64/README.md +++ /dev/null @@ -1 +0,0 @@ -https://typst.app diff --git a/packages/typst-community+typst-darwin-arm64/package.json b/packages/typst-community+typst-darwin-arm64/package.json deleted file mode 100644 index d4aa7e4..0000000 --- a/packages/typst-community+typst-darwin-arm64/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@typst-community/typst-darwin-arm64", - "version": "0.10.0-6", - "exports": "./.typst/bin/typst", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "homepage": "https://typst.app", - "files": [ - ".typst" - ] -} diff --git a/packages/typst-community+typst-darwin-x64/.gitignore b/packages/typst-community+typst-darwin-x64/.gitignore deleted file mode 100644 index 4db03c2..0000000 --- a/packages/typst-community+typst-darwin-x64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.typst \ No newline at end of file diff --git a/packages/typst-community+typst-darwin-x64/LICENSE b/packages/typst-community+typst-darwin-x64/LICENSE deleted file mode 100644 index a7e77cb..0000000 --- a/packages/typst-community+typst-darwin-x64/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/packages/typst-community+typst-darwin-x64/README.md b/packages/typst-community+typst-darwin-x64/README.md deleted file mode 100644 index d67545b..0000000 --- a/packages/typst-community+typst-darwin-x64/README.md +++ /dev/null @@ -1 +0,0 @@ -https://typst.app diff --git a/packages/typst-community+typst-darwin-x64/package.json b/packages/typst-community+typst-darwin-x64/package.json deleted file mode 100644 index 53a2000..0000000 --- a/packages/typst-community+typst-darwin-x64/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@typst-community/typst-darwin-x64", - "version": "0.10.0-6", - "exports": "./.typst/bin/typst", - "os": [ - "darwin" - ], - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "homepage": "https://typst.app", - "files": [ - ".typst" - ] -} diff --git a/packages/typst-community+typst-linux-arm64/.gitignore b/packages/typst-community+typst-linux-arm64/.gitignore deleted file mode 100644 index 4db03c2..0000000 --- a/packages/typst-community+typst-linux-arm64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.typst \ No newline at end of file diff --git a/packages/typst-community+typst-linux-arm64/LICENSE b/packages/typst-community+typst-linux-arm64/LICENSE deleted file mode 100644 index a7e77cb..0000000 --- a/packages/typst-community+typst-linux-arm64/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/packages/typst-community+typst-linux-arm64/README.md b/packages/typst-community+typst-linux-arm64/README.md deleted file mode 100644 index d67545b..0000000 --- a/packages/typst-community+typst-linux-arm64/README.md +++ /dev/null @@ -1 +0,0 @@ -https://typst.app diff --git a/packages/typst-community+typst-linux-arm64/package.json b/packages/typst-community+typst-linux-arm64/package.json deleted file mode 100644 index 4dd7937..0000000 --- a/packages/typst-community+typst-linux-arm64/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@typst-community/typst-linux-arm64", - "version": "0.10.0-6", - "exports": "./.typst/bin/typst", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "homepage": "https://typst.app", - "files": [ - ".typst" - ] -} diff --git a/packages/typst-community+typst-linux-x64/.gitignore b/packages/typst-community+typst-linux-x64/.gitignore deleted file mode 100644 index 4db03c2..0000000 --- a/packages/typst-community+typst-linux-x64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.typst \ No newline at end of file diff --git a/packages/typst-community+typst-linux-x64/LICENSE b/packages/typst-community+typst-linux-x64/LICENSE deleted file mode 100644 index a7e77cb..0000000 --- a/packages/typst-community+typst-linux-x64/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/packages/typst-community+typst-linux-x64/README.md b/packages/typst-community+typst-linux-x64/README.md deleted file mode 100644 index d67545b..0000000 --- a/packages/typst-community+typst-linux-x64/README.md +++ /dev/null @@ -1 +0,0 @@ -https://typst.app diff --git a/packages/typst-community+typst-linux-x64/package.json b/packages/typst-community+typst-linux-x64/package.json deleted file mode 100644 index 3db695f..0000000 --- a/packages/typst-community+typst-linux-x64/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@typst-community/typst-linux-x64", - "version": "0.10.0-6", - "exports": "./.typst/bin/typst", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "homepage": "https://typst.app", - "files": [ - ".typst" - ] -} diff --git a/packages/typst-community+typst-win32-x64/.gitignore b/packages/typst-community+typst-win32-x64/.gitignore deleted file mode 100644 index 4db03c2..0000000 --- a/packages/typst-community+typst-win32-x64/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.typst \ No newline at end of file diff --git a/packages/typst-community+typst-win32-x64/LICENSE b/packages/typst-community+typst-win32-x64/LICENSE deleted file mode 100644 index a7e77cb..0000000 --- a/packages/typst-community+typst-win32-x64/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/packages/typst-community+typst-win32-x64/README.md b/packages/typst-community+typst-win32-x64/README.md deleted file mode 100644 index d67545b..0000000 --- a/packages/typst-community+typst-win32-x64/README.md +++ /dev/null @@ -1 +0,0 @@ -https://typst.app diff --git a/packages/typst-community+typst-win32-x64/package.json b/packages/typst-community+typst-win32-x64/package.json deleted file mode 100644 index 13bbedc..0000000 --- a/packages/typst-community+typst-win32-x64/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@typst-community/typst-win32-x64", - "version": "0.10.0-6", - "exports": "./.typst/bin/typst", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "homepage": "https://typst.app", - "files": [ - ".typst" - ] -} diff --git a/src/lib/abexec.ts b/src/lib/abexec.ts index 57c661b..114f88f 100644 --- a/src/lib/abexec.ts +++ b/src/lib/abexec.ts @@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process"; /** * "Absorbs" the subprocess into the current process. Sort of like - * how `exec othercomomand "$@"` works in Bash. Synchronous. Always + * how `exec othercmd "$@"` works in Bash. Synchronous. Always * triggers `process.exit()`. */ export default function abexec(argv0: string, argv: string[]) { diff --git a/tools/generate-dist-package.sh b/tools/generate-dist-package.sh new file mode 100644 index 0000000..919e115 --- /dev/null +++ b/tools/generate-dist-package.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env node +set -e +script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) + +[[ -n $npm_package_version ]] || npm_package_version=$(npm pkg get version | jq -r) +[[ -n $npm_package_homepage ]] || npm_package_homepage=$(npm pkg get homepage | jq -r) +[[ -n $npm_package_license ]] || npm_package_license=$(npm pkg get license | jq -r) + +version=$(echo "$npm_package_version" | grep -Eo '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}') + +generate_dist_package() ( + rm -rf "./out/$1" + mkdir -p "./out/$1" + + os=$(echo "$1" | cut -d'-' -f1) + arch=$(echo "$1" | cut -d'-' -f2) + + if [[ $os == win32 ]]; then + exe_ext='.exe' + fi + + cat < "./out/$1/package.json" +{ + "name": "@typst-community/typst-$1", + "version": "$npm_package_version", + "exports": "./.typst/bin/typst$exe_ext", + "os": ["$os"], + "arch": ["$arch"], + "license": "$npm_package_license", + "homepage": "$npm_package_homepage" +} +EOF + cp LICENSE "./out/$1/LICENSE" + cat < "./out/$1/README.md" +This is a distribution package for $1. +See $npm_package_homepage for more information. +EOF + + export TYPST_INSTALL="./out/$1/.typst" + bash "$script_dir/typst_install_target.sh" "$version" "$1" +) + + +if [[ -z $1 || $1 == '--all' ]]; then + for tuple in win32-x64 darwin-x64 darwin-arm64 linux-arm64 linux-x64; do + generate_dist_package "$tuple" + done +else + generate_dist_package "$1" +fi diff --git a/tools/generate-dist-packages.js b/tools/generate-dist-packages.js deleted file mode 100644 index d44cd6c..0000000 --- a/tools/generate-dist-packages.js +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env node -import { readFile, writeFile, mkdir, copyFile } from "node:fs/promises"; -import { basename, join, resolve } from "node:path"; -import { existsSync } from "node:fs"; -import { $ } from "execa"; -import { fileURLToPath, pathToFileURL } from "node:url"; - -const processCWDFileURL = pathToFileURL(process.cwd()); -processCWDFileURL.pathname += "/"; - -const packageFile = new URL("./package.json", processCWDFileURL); -let text = await readFile(packageFile, "utf8"); -let package_ = JSON.parse(text); - -const tuples = [ - "win32-x64", - "darwin-x64", - "darwin-arm64", - "linux-arm64", - "linux-x64", -]; - -for (const tuple of tuples) { - const rootDir = new URL( - `./packages/typst-community%2Btypst-${tuple}/`, - processCWDFileURL, - ); - await mkdir(rootDir, { recursive: true }); - - const [os, arch] = tuple.split("-"); - const distPackage = { - name: `@typst-community/typst-${tuple}`, - version: package_.version, - // type: "commonjs", - // type: "module", - exports: "./.typst/bin/typst", - os: [os], - cpu: [arch], - license: package_.license, - homepage: package_.homepage, - files: [".typst"], - }; - const distText = JSON.stringify(distPackage, null, 2); - await writeFile(new URL("./package.json", rootDir), distText); - - const gitignore = ".typst"; - await writeFile(new URL("./.gitignore", rootDir), gitignore); - - await copyFile( - new URL("./LICENSE", processCWDFileURL), - new URL("./LICENSE", rootDir), - ); - - const readme = package_.homepage; - await writeFile(new URL("./README.md", rootDir), readme); - - const typstInstallTargetPath = fileURLToPath( - new URL("./typst_install_target.sh", import.meta.url), - ); - const version = package_.version.match(/^\d+\.\d+\.\d+/)[0]; - const env = { - ...process.env, - TYPST_INSTALL: fileURLToPath(new URL("./.typst/", rootDir)).replace( - /[/\\]$/, - "", - ), - }; - await $({ - stdio: "inherit", - env, - })`bash ${typstInstallTargetPath} ${version} ${tuple}`; -} diff --git a/tools/postversion.js b/tools/postversion.js index 4c9f79d..994f512 100644 --- a/tools/postversion.js +++ b/tools/postversion.js @@ -1,13 +1,9 @@ #!/usr/bin/env node import { readFile, writeFile } from "node:fs/promises"; -import { pathToFileURL } from "node:url"; +import { $ } from "execa"; -const processCWDFileURL = pathToFileURL(process.cwd()); -processCWDFileURL.pathname += "/"; - -const packageFile = new URL("./package.json", processCWDFileURL); -let text = await readFile(packageFile, "utf8"); -let package_ = JSON.parse(text); +let text = await readFile("./package.json", "utf8"); +const package_ = JSON.parse(text); const tuples = [ "win32-x64", @@ -16,25 +12,10 @@ const tuples = [ "linux-arm64", "linux-x64", ]; - -for (const tuple of tuples) { - const distPackageFile = new URL( - `./packages/typst-community%2Btypst-${tuple}/package.json`, - processCWDFileURL, - ); - let distText = await readFile(distPackageFile); - let distPackage = JSON.parse(distText); - - distPackage.version = package_.version; - - distText = JSON.stringify(distPackage, null, 2); - await writeFile(distPackageFile, distText); -} - for (const tuple of tuples) { - package_.optionalDependencies[`@typst-community/typst-${tuple}`] = - package_.version; + const name = `@typst-community/typst-${tuple}`; + package_.optionalDependencies[name] = package_.version; } text = JSON.stringify(package_, null, 2); -await writeFile(packageFile, text); +await writeFile("./package.json", text); diff --git a/tools/prepare.sh b/tools/prepare.sh index a09d675..5fe89e8 100644 --- a/tools/prepare.sh +++ b/tools/prepare.sh @@ -1,4 +1,9 @@ #!/bin/bash -set -ex +set -e +script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) tuple=$(node -p '`${process.platform}-${process.arch}`') -npm link "./packages/typst-community+typst-$tuple" +bash "$script_dir/generate-dist-package.sh" "$tuple" +if ! o=$(npm link "./out/$tuple" 2>&1); then + echo "$o" >&2 + exit 1 +fi diff --git a/tools/prepublishOnly.sh b/tools/prepublishOnly.sh index ab848ea..4534ba5 100644 --- a/tools/prepublishOnly.sh +++ b/tools/prepublishOnly.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -ex +set -e for tuple in win32-x64 darwin-x64 darwin-arm64 linux-arm64 linux-x64; do - pushd "./packages/typst-community+typst-$tuple" - npm publish - popd + (cd "./out/$tuple" && npm publish) done diff --git a/tools/typst_install_target.sh b/tools/typst_install_target.sh index ec6a5c8..5f1bb92 100644 --- a/tools/typst_install_target.sh +++ b/tools/typst_install_target.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ex +set -e case $2 in "win32-x64") target="x86_64-pc-windows-msvc";; diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 0000000..1dbb796 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,7 @@ +{ + "entryPoints": ["src/index.ts"], + "skipErrorChecking": true, + "navigationLinks": { + "GitHub": "https://github.com/typst-community/typst.js" + } +}