Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
feat: rewrite from shiki
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 10, 2023
1 parent fdedd19 commit c14edb1
Show file tree
Hide file tree
Showing 22 changed files with 1,596 additions and 71 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/vendor/languages
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ lib-cov
logs
node_modules
temp
src/vendor/languages
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# shikijo
# Shikiji 式辞

[![NPM version](https://img.shields.io/npm/v/shikijo?color=a1b858&label=)](https://www.npmjs.com/package/shikijo)
[![NPM version](https://img.shields.io/npm/v/shikiji?color=a1b858&label=)](https://www.npmjs.com/package/shikiji)

An ESM focused rewrites of [shiki](https://github.com/shikijs/shiki), a beautiful syntax highlighter based on TextMate grammar.

## Changes

- All assets served as ESM, no more assets, no more CDN
- Drop CJS and IIFE build, ESM-only
- Minimal custom bundles
- API simplified

## License

Expand Down
12 changes: 0 additions & 12 deletions build.config.ts

This file was deleted.

12 changes: 12 additions & 0 deletions build/wasm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fs from 'node:fs/promises'

export const wasmPlugin = {
name: 'wasm',
async load(id) {
if (!id.endsWith('.wasm'))
return
const binary = await fs.readFile(id)
const base64 = binary.toString('base64')
return `export default Uint8Array.from(atob(${JSON.stringify(base64)}), c => c.charCodeAt(0))`
},
}
31 changes: 20 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"name": "shikijo",
"name": "shikiji",
"type": "module",
"version": "0.0.0",
"packageManager": "pnpm@8.6.12",
"description": "",
"description": "An ESM focused rewrites of shiki",
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"homepage": "https://github.com/antfu/shikijo#readme",
"homepage": "https://github.com/antfu/shikiji#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/antfu/shikijo.git"
"url": "git+https://github.com/antfu/shikiji.git"
},
"bugs": "https://github.com/antfu/shikijo/issues",
"keywords": [],
"bugs": "https://github.com/antfu/shikiji/issues",
"keywords": [
"shiki"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
}
},
"./dist/*": "./dist/*",
"./*": "./dist/*"
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
Expand All @@ -36,12 +39,11 @@
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub",
"build": "rimraf dist && rollup -c",
"dev": "rollup -cw",
"lint": "eslint .",
"prepublishOnly": "nr build",
"release": "bumpp && npm publish",
"start": "esno src/index.ts",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
Expand All @@ -54,16 +56,23 @@
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@types/fs-extra": "^11.0.1",
"@types/node": "^20.4.9",
"rollup-plugin-esbuild": "^5.0.0",
"ansi-sequence-parser": "^1.1.1",
"bumpp": "^9.1.1",
"eslint": "^8.46.0",
"esno": "^0.17.0",
"fast-glob": "^3.3.1",
"fs-extra": "^11.1.1",
"jsonc-parser": "^3.2.0",
"lint-staged": "^13.2.3",
"pnpm": "^8.6.12",
"prettier": "^3.0.1",
"rimraf": "^5.0.1",
"rollup": "^3.28.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-dts": "^5.3.1",
"shiki": "^0.14.3",
"simple-git-hooks": "^2.9.0",
"typescript": "^5.1.6",
Expand Down
Loading

0 comments on commit c14edb1

Please sign in to comment.