Skip to content

Commit

Permalink
Add workaround for Shiki being a DOM project
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed May 2, 2024
1 parent aa613ca commit f4811e5
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Install
run: npm ci --legacy-peer-deps
run: npm ci
- name: Build
run: npm run build
- name: Test
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Upgrade npm
run: npm i -g npm@latest
- name: Install
run: npm ci --legacy-peer-deps
run: npm ci
- name: Build
run: npm run build
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-beta.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
run: npm i -g npm@latest
- name: Install
if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta')
run: npm ci --legacy-peer-deps
run: npm ci
- name: Setup publish token
if: steps.check.outputs.changed == 'true' && contains(steps.check.outputs.version, 'beta')
run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-lts.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
run: npm i -g npm@latest
- name: Install
if: steps.check.outputs.changed == 'true'
run: npm ci --legacy-peer-deps
run: npm ci
- name: Setup publish token
if: steps.check.outputs.changed == 'true'
run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
node-version: "18"
- name: Install
if: steps.check.outputs.changed == 'true'
run: npm ci --legacy-peer-deps
run: npm ci
- name: Setup publish token
if: steps.check.outputs.changed == 'true'
run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/visual-regression.yml
Expand Up @@ -16,15 +16,15 @@ jobs:
run: |
git fetch
git checkout origin/$GITHUB_BASE_REF
npm ci --legacy-peer-deps
npm ci
npm run build
node dist/test/capture-screenshots.js
npm run test:visual:accept
- name: Get current screenshots
run: |
git checkout $GITHUB_SHA
npm ci --legacy-peer-deps
npm ci
npm run build
node dist/test/capture-screenshots.js
- name: Test
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Expand Up @@ -3,3 +3,6 @@
# an install, so just turn it off. We can still check for findings
# with npm audit --production.
audit = false

# While we're on the TS beta, need this flag.
legacy-peer-deps = true
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -27,7 +27,7 @@
"lunr": "^2.3.9",
"markdown-it": "^14.1.0",
"minimatch": "^9.0.4",
"shiki": "^1.3.0"
"shiki": "^1.4.0"
},
"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 || 5.4.x || 5.5.x"
Expand Down
19 changes: 19 additions & 0 deletions src/lib/types/shiki/shiki.d.ts
@@ -0,0 +1,19 @@
// Shiki 1.x declares a `loadWasm` function which takes these types as input.
// They are declared in the DOM library, but since TypeDoc doesn't use that library,
// we have to declare some shims, intentionally crafted to not be accidentally
// constructed.

declare namespace WebAssembly {
interface Instance {
__shikiHack: never;
exports: unknown;
}
interface WebAssemblyInstantiatedSource {
__shikiHack: never;
}
type ImportValue = unknown;
}

interface Response {
__shikiHack: never;
}
3 changes: 1 addition & 2 deletions tsconfig.json
Expand Up @@ -10,8 +10,7 @@
// Speed up dev compilation time
"incremental": true,
"tsBuildInfoFile": "dist/.tsbuildinfo",
// Shiki's types are broken again, https://github.com/shikijs/shiki/issues/665
"skipLibCheck": true,
"skipLibCheck": false,

"strict": true,
"alwaysStrict": true,
Expand Down

0 comments on commit f4811e5

Please sign in to comment.