Skip to content

Commit cc04a10

Browse files
committed
chore: try tsgo
1 parent b164499 commit cc04a10

File tree

10 files changed

+137
-49
lines changed

10 files changed

+137
-49
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"dbaeumer.vscode-eslint",
99
"aaron-bond.better-comments",
1010
"davidanson.vscode-markdownlint",
11-
"christian-kohler.path-intellisense"
11+
"christian-kohler.path-intellisense",
12+
"TypeScriptTeam.native-preview"
1213
],
1314
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
1415
"unwantedRecommendations": []

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
33
"typescript.preferences.importModuleSpecifierEnding": "js",
4+
"typescript.experimental.useTsgo": true,
45
"js/ts.implicitProjectConfig.module": "NodeNext",
56
"js/ts.implicitProjectConfig.target": "ESNext",
67
"editor.formatOnSave": true,

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@swc/core": "1.13.3",
7777
"@tanstack/eslint-plugin-query": "^5.83.1",
7878
"@types/lodash-es": "^4.17.12",
79+
"@typescript/native-preview": "7.0.0-dev.20251211.1",
7980
"@vitest/ui": "^3.0.7",
8081
"cspell": "^8.17.5",
8182
"eslint": "9.32.0",
@@ -120,8 +121,15 @@
120121
"catalogs": [
121122
{
122123
"path": "./packages/shared-base-ui/src/locale/{locale}",
123-
"include": ["<rootDir>"],
124-
"exclude": ["**/node_modules/**", "**/*.d.ts", "**/dist/**", "**/build/**"]
124+
"include": [
125+
"<rootDir>"
126+
],
127+
"exclude": [
128+
"**/node_modules/**",
129+
"**/*.d.ts",
130+
"**/dist/**",
131+
"**/build/**"
132+
]
125133
}
126134
]
127135
}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
declare function __mask__module__define__(
2-
id: string,
3-
module: import('../../sandboxed-plugin-runtime/node_modules/@masknet/compartment').VirtualModuleRecord,
4-
): void
1+
declare function __mask__module__define__(id: string, module: import('@masknet/compartment').VirtualModuleRecord): void
52
declare function __mask__module__reflection__(
63
specifier: string,
7-
): Promise<import('../../sandboxed-plugin-runtime/node_modules/@masknet/compartment').VirtualModuleRecord>
4+
): Promise<import('@masknet/compartment').VirtualModuleRecord>

packages/sandboxed-plugin-runtime/src/runtime/runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class PluginRuntime {
7979
throw new SyntaxError('Import from other plugin is not supported. Try to import: ' + normalizedURL)
8080
}
8181

82-
const source: VirtualModuleRecord = await __mask__module__reflection__(normalizedURL)
82+
const source = await __mask__module__reflection__(normalizedURL)
8383

8484
return { normalizedURL, source }
8585
}

packages/scripts/src/codegen/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { typescriptWatch } from './typescript.ts'
44
import { iconCodegen, iconCodegenWatch } from './icon-codegen.ts'
55

66
// typescript is explicitly eliminated from this task.
7-
// our build process does not rely on tsc to give output, we have an extra check for tsc.
7+
// our build process does not rely on tsgo to give output, we have an extra check for tsgo.
88
export const codegen: TaskFunction = series(iconCodegen)
99
export const codegenWatch: TaskFunction = markTaskNeedCleanup(
1010
series(getProcessLock.bind(null, 'codegen'), parallel(typescriptWatch, iconCodegenWatch)),
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { watchTask, shell, cleanupWhenExit } from '../utils/index.ts'
22

33
export function typescript() {
4-
return shell`pnpm exec tsc -b`
4+
return shell`pnpm exec tsgo -b`
55
}
66
export function typescriptWatch() {
77
cleanupWhenExit()
8-
return shell`pnpm exec tsc -b -w`
8+
return shell`pnpm exec tsgo -b -w`
99
}
1010
watchTask(typescript, typescriptWatch, 'typescript', 'Build TypeScript project reference')

packages/scripts/src/commands/changeset-release.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const packages = [
1313
new URL('../../../config/', import.meta.url),
1414
]
1515
export async function changesetRelease() {
16-
const tsc = awaitChildProcess(shell.cwd(ROOT_PATH)`pnpm exec tsc -b ./tsconfig.npm.json`)
16+
const tsgo = awaitChildProcess(shell.cwd(ROOT_PATH)`pnpm exec tsgo -b ./tsconfig.npm.json`)
1717
const buildTask: Array<Promise<any>> = packages.map((path) =>
1818
readFile(new URL('./package.json', path), 'utf-8')
1919
.then(JSON.parse)
@@ -22,7 +22,7 @@ export async function changesetRelease() {
2222
return undefined
2323
}),
2424
)
25-
await Promise.all(buildTask.concat(tsc))
25+
await Promise.all(buildTask.concat(tsgo))
2626
await awaitChildProcess(shell.cwd(ROOT_PATH)`pnpm exec changeset publish`)
2727
}
2828
task(changesetRelease, 'changeset-release', 'Release script run by changeset')

packages/web3-providers/src/Web3/EVM/providers/CustomEvent.ts

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,32 @@ export class EVMCustomEventProvider extends BaseEVMWalletProvider {
1212
setup() {
1313
if (getSiteType() !== EnhanceableSite.Firefly) return
1414

15-
// @ts-expect-error TODO: define the custom event
16-
document.addEventListener(
17-
'mask_custom_event_provider_event',
18-
(
19-
event: CustomEvent<{
15+
document.addEventListener('mask_custom_event_provider_event', (event) => {
16+
const { type, payload } = (
17+
event as CustomEvent<{
2018
type: 'accountsChanged' | 'chainChanged' | 'disconnect' | 'connect'
2119
payload?: unknown
22-
}>,
23-
) => {
24-
const { type, payload } = event.detail
20+
}>
21+
).detail
2522

26-
switch (type) {
27-
case 'accountsChanged':
28-
this.emitter.emit('accounts', payload as string[])
29-
break
30-
case 'chainChanged':
31-
this.emitter.emit('chainId', payload as string)
32-
break
33-
case 'disconnect':
34-
this.emitter.emit('disconnect', this.providerType)
35-
break
36-
case 'connect':
37-
this.emitter.emit('connect', payload as Account<ChainId>)
38-
break
39-
default:
40-
safeUnreachable(type)
41-
break
42-
}
43-
},
44-
)
23+
switch (type) {
24+
case 'accountsChanged':
25+
this.emitter.emit('accounts', payload as string[])
26+
break
27+
case 'chainChanged':
28+
this.emitter.emit('chainId', payload as string)
29+
break
30+
case 'disconnect':
31+
this.emitter.emit('disconnect', this.providerType)
32+
break
33+
case 'connect':
34+
this.emitter.emit('connect', payload as Account<ChainId>)
35+
break
36+
default:
37+
safeUnreachable(type)
38+
break
39+
}
40+
})
4541
}
4642

4743
override async request<T>(requestArguments: RequestArguments): Promise<T> {

0 commit comments

Comments
 (0)