Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .eslintrc.js
Empty file.
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on: ["pull_request"]
jobs:
benchmark:
name: Run JavaScript benchmark
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
node: [18, 20, 22]
node: [20, 22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: General Validity
on: ["push"]

jobs:
lint:
runs-on: ubuntu-20.04
static-code-validation:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -15,17 +15,15 @@ jobs:

- name: yarn install
run: yarn --immutable
shell: bash

- name: Lint
run: yarn lint
shell: bash
- name: Static code validation
run: yarn static-code-validation

test:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
node: [18, 20, 22]
node: [20, 22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -50,8 +48,8 @@ jobs:
github-token: ${{ secrets.github_token }}

build:
runs-on: ubuntu-20.04
needs: [lint, test]
runs-on: ubuntu-24.04
needs: [static-code-validation, test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/iron
lts/jod
21 changes: 21 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["oxc", "typescript", "jest"],
"env": {
"es6": true
},
"globals": {
"SharedArrayBuffer": "readonly",
"BigInt": "readonly",
"BigInt64Array": "readonly",
"BigUint64Array": "readonly"
},
"rules": {
"vitest/expect-expect": [
"error",
{
"assertFunctionNames": ["expect", "assert"]
}
]
}
}
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
trailingComma: "es5"
"trailingComma": "es5"
}
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"recommendations": [
"orta.vscode-jest",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint"
"davidanson.vscode-markdownlint",
"oxc.oxc-vscode"
]
}
53 changes: 25 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
],
"scripts": {
"prepare": "husky",
"lint": "concurrently \"eslint src --ext .js,.jsx,.ts,.tsx\" \"tsc --noEmit --emitDeclarationOnly false\"",
"lint": "yarn oxlint --deny-warnings src",
"type-check": "tsc --noEmit --emitDeclarationOnly false",
"static-code-validation": "concurrently \"yarn lint\" \"yarn type-check\" \"yarn prettier-check\"",
"test": "jest",
"test-coverage": "jest --coverage",
"build-declarations": "tsc -p tsconfig.build.json --isolatedModules false --declaration true --declarationMap true --noEmit false --emitDeclarationOnly true",
Expand All @@ -44,49 +46,44 @@
"as:test": "node tests",
"deoptigate-benchmarks": "npx deoptigate benchmarks/main-register-ts-node.js",
"v8-deopt-viewer-benchmarks": "npx v8-deopt-viewer benchmarks/main-register-ts-node.js --open",
"benchmark": "node benchmarks/main-register-ts-node.js"
"benchmark": "node benchmarks/main-register-ts-node.js",
"prettier-check": "prettier --check src"
},
"devDependencies": {
"@babel/cli": "^7.24.5",
"@babel/core": "^7.24.5",
"@babel/node": "^7.23.9",
"@babel/preset-env": "^7.24.5",
"@babel/preset-typescript": "^7.24.1",
"@changesets/cli": "^2.27.1",
"@babel/cli": "^7.27.2",
"@babel/core": "^7.27.1",
"@babel/node": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-typescript": "^7.27.1",
"@changesets/cli": "^2.29.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-node-resolve": "^16.0.1",
"@types/benchmark": "^2.1.5",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.11",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.15.17",
"assemblyscript": "^0.27.27",
"babel-loader": "^9.1.3",
"benchmark": "^2.1.4",
"concurrently": "^8.2.2",
"concurrently": "^9.1.2",
"core-js": "^3.37.0",
"dts-bundle-generator": "^9.5.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"expose-gc": "^1.0.0",
"gh-pages": "^6.1.1",
"html-webpack-plugin": "^5.6.0",
"husky": "^9.0.11",
"husky": "^9.1.7",
"jest": "^29.7.0",
"kind-of": "^6.0.3",
"prettier": "^3.2.5",
"prettier-eslint": "^16.3.0",
"rimraf": "^5.0.7",
"rollup": "^4.17.2",
"oxlint": "^0.16.9",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"rollup": "^4.40.2",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "^10.9.2",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^4.0.1",
"typescript": "^5.4.5",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack": "^5.99.8",
"webpack-cli": "^6.0.1",
"webpack-dev-server": "^5.2.1",
"worker-loader": "^3.0.8"
},
"files": [
Expand All @@ -95,5 +92,5 @@
"COMMIT",
"LICENSE"
],
"packageManager": "yarn@4.1.1"
}
"packageManager": "yarn@4.9.1"
}
2 changes: 1 addition & 1 deletion src/allocator/after-refactor-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe("next gen", () => {
]
`);
const statsBeforeFree = stats(allocatorState);
expect(statsBeforeFree);
expect(statsBeforeFree).toBeDefined();

free(allocatorState, allocatedPointer1);
expect(listFreeBlocks(allocatorState)).toHaveLength(1);
Expand Down
2 changes: 2 additions & 0 deletions src/allocator/functional-variant-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ describe("malloc functional", () => {
});

// We have tests in the other file
// eslint-disable-next-line no-disabled-tests
it.skip("realloc", () => {
const a = malloc(allocatorState, 8);
allocatorState.u8.fill(0xff, a, a + 8);
Expand Down Expand Up @@ -307,6 +308,7 @@ describe("malloc functional", () => {
// });

// We now have merge on by default
// eslint-disable-next-line no-disabled-tests
it.skip("no compact", () => {
allocatorState = allocatorInit({
size: 0x100,
Expand Down
1 change: 1 addition & 0 deletions src/apiTests/Map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ describe("Map", () => {
});

// bug with deletion during iteration
// eslint-disable-next-line no-disabled-tests
test.skip("iterate + delete compare", () => {
const nativeMap = new Map([
[1, "a"],
Expand Down
1 change: 1 addition & 0 deletions src/apiTests/Set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe("Set tests", () => {
});

// bug with deletion during iteration
// eslint-disable-next-line no-disabled-tests
test.skip("iterate + delete compare", () => {
const nativeMap = new Set(["a", "b"]);
for (const [key] of nativeMap) {
Expand Down
4 changes: 2 additions & 2 deletions src/apiTests/replaceArrayBufferFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { arrayBufferCopyTo } from "../internal/utils";

describe("replaceArrayBufferFlow", () => {
test("test unstable_replaceUnderlyingArrayBuffer works", () => {
test("unstable_replaceUnderlyingArrayBuffer works", () => {
const objectBuffer = createObjectBuffer<any>(512, {
a: 1,
});
Expand All @@ -33,7 +33,7 @@ describe("replaceArrayBufferFlow", () => {
`);
});

test("test unstable_resizeObjectBuffer works", () => {
test("unstable_resizeObjectBuffer works", () => {
const objectBuffer = createObjectBuffer<any>(4096, {
obj1: { a: 1 },
});
Expand Down
7 changes: 4 additions & 3 deletions src/externalPerspectiveTests/primitivesMemoryReuse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { memoryStats } from "../internal/api";

/* eslint-env jest */

// eslint-disable-next-line no-disabled-tests
describe.skip("primitivesMemoryReuse", () => {
test("test number / bigint reuse", () => {
test("number / bigint reuse", () => {
const objectBuffer = createObjectBuffer(128, {
num: 1 as number | bigint,
});
Expand Down Expand Up @@ -39,7 +40,7 @@ describe.skip("primitivesMemoryReuse", () => {
`);
});

test("test null/undefined reuse", () => {
test("null/undefined reuse", () => {
const objectBuffer = createObjectBuffer(128, {
nullContainer: null as null | undefined,
});
Expand Down Expand Up @@ -67,7 +68,7 @@ describe.skip("primitivesMemoryReuse", () => {
`);
});

test("test boolean reuse", () => {
test("boolean reuse", () => {
const objectBuffer = createObjectBuffer(128, {
booleanContainer: false,
});
Expand Down
20 changes: 4 additions & 16 deletions src/internal/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,15 @@ export function createObjectBuffer<T = any>(
}

const allocator = new TransactionalAllocator(
{
start: MEM_POOL_START,
size,
},
{ start: MEM_POOL_START, size },
arrayBufferKind === "shared"
);

const arrayBuffer = allocator.getArrayBuffer();

initializeArrayBuffer(arrayBuffer);

const carrier: GlobalCarrier = {
allocator,
heap: allocator.getHeap(),
};
const carrier: GlobalCarrier = { allocator, heap: allocator.getHeap() };

const referencedPointers: number[] = [];

Expand Down Expand Up @@ -149,10 +143,7 @@ export function loadObjectBuffer<T = any>(
): T {
const allocator = TransactionalAllocator.load(arrayBuffer);

const carrier: GlobalCarrier = {
allocator,
heap: allocator.getHeap(),
};
const carrier: GlobalCarrier = { allocator, heap: allocator.getHeap() };

const dv = new DataView(arrayBuffer);
// endianness flag is always saved in little endian so we can read in every system endianness
Expand Down Expand Up @@ -191,10 +182,7 @@ export function unstable_replaceUnderlyingArrayBuffer(
newArrayBuffer: ArrayBuffer | SharedArrayBuffer
) {
const allocator = TransactionalAllocator.load(newArrayBuffer);
const carrier: GlobalCarrier = {
allocator,
heap: allocator.getHeap(),
};
const carrier: GlobalCarrier = { allocator, heap: allocator.getHeap() };

const dv = new DataView(newArrayBuffer);
// endianness flag is always saved in little endian so we can read in every system endianness
Expand Down
3 changes: 3 additions & 0 deletions src/internal/linkedList/linkedList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ describe("LinkedList", () => {
expect(carrier.allocator.stats().top).toMatchInlineSnapshot(`168`);
});

// eslint-disable-next-line no-disabled-tests
test.skip("linkedList linkedListLowLevelIterator - delete while iteration - delete current value", () => {
const linkedListPointer = initLinkedList(carrier);

Expand Down Expand Up @@ -308,6 +309,7 @@ describe("LinkedList", () => {
const { allocations } = recordAllocations(() => {
linkedListPointer = initLinkedList(carrier);

// eslint-disable-next-line no-standalone-expect
expect(carrier.allocator.stats().top).toMatchInlineSnapshot(`96`);

let toAdd: undefined | number = 0;
Expand Down Expand Up @@ -350,6 +352,7 @@ describe("LinkedList", () => {
const { allocations } = recordAllocations(() => {
linkedListPointer = initLinkedList(carrier);

// eslint-disable-next-line no-standalone-expect
expect(carrier.allocator.stats().top).toMatchInlineSnapshot(`96`);

let toAdd: undefined | number = 0;
Expand Down
Loading
Loading