Skip to content

Commit

Permalink
fix: expose performance constructor (#772)
Browse files Browse the repository at this point in the history
* fix: expose `performance` constructor

* build: downgrade tsup

* fix: export for edge

* Create thirty-turkeys-tap.md
  • Loading branch information
Kikobeats committed Jan 23, 2024
1 parent 06565ad commit c313a3c
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 91 deletions.
12 changes: 12 additions & 0 deletions .changeset/thirty-turkeys-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@edge-runtime/cookies": patch
"@edge-runtime/format": patch
"@edge-runtime/integration-tests": patch
"@edge-runtime/node-utils": patch
"@edge-runtime/ponyfill": patch
"@edge-runtime/primitives": patch
"@edge-runtime/user-agent": patch
"@edge-runtime/vm": patch
---

fix: expose `performance` constructor
2 changes: 1 addition & 1 deletion packages/cookies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@edge-runtime/format": "workspace:*",
"@edge-runtime/jest-environment": "workspace:*",
"@types/cookie": "0.6.0",
"tsup": "7"
"tsup": "6"
},
"engines": {
"node": ">=16"
Expand Down
2 changes: 1 addition & 1 deletion packages/format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"web"
],
"devDependencies": {
"tsup": "7"
"tsup": "6"
},
"engines": {
"node": ">=16"
Expand Down
3 changes: 3 additions & 0 deletions packages/integration-tests/test/global.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('performance', () => {
expect(performance.now()).toBeGreaterThan(0)
})
2 changes: 1 addition & 1 deletion packages/node-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@edge-runtime/primitives": "workspace:*",
"@types/test-listen": "1.1.2",
"test-listen": "1.1.0",
"tsup": "7"
"tsup": "6"
},
"engines": {
"node": ">=16"
Expand Down
1 change: 1 addition & 0 deletions packages/ponyfill/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function edge() {
File,
FormData,
Headers,
performance,
PromiseRejectionEvent,
ReadableStream,
ReadableStreamBYOBReader,
Expand Down
2 changes: 1 addition & 1 deletion packages/primitives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"blob-polyfill": "7.0.20220408",
"esbuild-plugin-alias": "latest",
"event-target-shim": "6.0.2",
"tsup": "7",
"tsup": "6",
"undici": "5.23.0",
"urlpattern-polyfill": "9.0.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/primitives/src/primitives/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function load(scopedContext = {}) {
TextDecoderStream,
atob,
btoa,
performance,
})

/** @type {import('../../type-definitions/console')} */
Expand Down
1 change: 1 addition & 0 deletions packages/primitives/type-definitions/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from './text-encoding-streams'
export * from './structured-clone'
export * from './url'
export * from './timers'
export * from './performance'
2 changes: 2 additions & 0 deletions packages/primitives/type-definitions/performance.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const performanceConstructor: typeof performance
export { performanceConstructor as performance }
2 changes: 1 addition & 1 deletion packages/user-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@edge-runtime/jest-environment": "workspace:*",
"@types/ua-parser-js": "0.7.39",
"tsup": "7",
"tsup": "6",
"ua-parser-js": "1.0.37"
},
"engines": {
Expand Down
3 changes: 3 additions & 0 deletions packages/vm/src/edge-vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ function addPrimitives(context: VMContext) {
// Console
'console',

// Performance
'performance',

// Timers
'setTimeout',
'setInterval',
Expand Down

1 comment on commit c313a3c

@vercel
Copy link

@vercel vercel bot commented on c313a3c Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

edge-runtime – ./

edge-runtime.vercel.sh
edge-runtime.vercel.app
edge-runtime-git-main.vercel.sh

Please sign in to comment.