Skip to content

Commit

Permalink
Upgrade to slang 0.19
Browse files Browse the repository at this point in the history
  • Loading branch information
antico5 committed Feb 6, 2025
1 parent a22fd00 commit 712e2d1
Show file tree
Hide file tree
Showing 45 changed files with 396 additions and 336 deletions.
9 changes: 0 additions & 9 deletions client/scripts/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,6 @@ async function main() {
solidityAnalyzerVersion,

"@nomicfoundation/slang": slangVersion,
"@nomicfoundation/slang-darwin-arm64": slangVersion,
"@nomicfoundation/slang-win32-arm64-msvc": slangVersion,
"@nomicfoundation/slang-linux-arm64-gnu": slangVersion,
"@nomicfoundation/slang-linux-arm64-musl": slangVersion,
"@nomicfoundation/slang-win32-ia32-msvc": slangVersion,
"@nomicfoundation/slang-darwin-x64": slangVersion,
"@nomicfoundation/slang-win32-x64-msvc": slangVersion,
"@nomicfoundation/slang-linux-x64-gnu": slangVersion,
"@nomicfoundation/slang-linux-x64-musl": slangVersion,
},
})
);
Expand Down
150 changes: 41 additions & 109 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"test:coverage": "cross-env TS_NODE_FILES=true nyc mocha",
"lint": "npm run prettier -- --check && npm run eslint",
"lint:fix": "npm run prettier -- --write && npm run eslint -- --fix",
"prettier": "node scripts/prettier3.js",
"eslint": "eslint --max-warnings 0 \"./src/**/*.ts\" \"./test/**/*.ts\"",
"prettier": "prettier \"*.json\" \"src/**/*.{ts,js,md,json,yml}\" \"test/**/*.{ts,js,md,json,yml}\"",
"clean": "rimraf out .nyc_output coverage *.tsbuildinfo",
"test:codecov": "cross-env TS_NODE_FILES=true nyc --reporter=lcov mocha"
},
Expand Down Expand Up @@ -68,8 +68,9 @@
"mocha": "9.1.3",
"module-alias": "^2.2.2",
"nyc": "15.1.0",
"prettier": "2.5.1",
"prettier-plugin-solidity": "1.1.2",
"prettier": "2.5.1",
"prettier3": "npm:[email protected]",
"qs": "^6.10.1",
"rimraf": "3.0.2",
"semver": "^7.3.7",
Expand All @@ -85,7 +86,7 @@
"yaml": "^2.2.1"
},
"dependencies": {
"@nomicfoundation/slang": "0.16.0",
"@nomicfoundation/slang": "0.19.0",
"@nomicfoundation/solidity-analyzer": "0.1.1"
}
}
31 changes: 31 additions & 0 deletions server/scripts/prettier3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { execSync } = require("child_process");
const path = require("path");

try {
// Get extra flags e.g. --check, --write
const prettierFlags = process.argv.slice(2);

// Find prettier3 (aliased) package path
const lsOutput = execSync("npm ls prettier3 --parseable").toString().trim();
const packageRoot = lsOutput.split("\n")[0];

console.log(`Found prettier at ${packageRoot}`);

const binaryPath = path.join(packageRoot, "bin", "prettier.cjs");

const spawnArgs = [
binaryPath,
...prettierFlags,
"*.json",
"src/**/*.{ts,js,md,json,yml}",
"test/**/*.{ts,js,md,json,yml}",
];

// Execute the prettier3 binary
require("child_process").spawn("node", spawnArgs, {
stdio: "inherit",
});
} catch (error) {
console.error("Error running prettier:", error.message);
process.exit(1);
}
4 changes: 3 additions & 1 deletion server/src/frameworks/Hardhat/worker/WorkerProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export class WorkerProcess {
this.hre = require(`${hardhatBase}/internal/lib/hardhat-lib.js`);

// Load local cache through require
const cacheModule = require(`${hardhatBase}/builtin-tasks/utils/solidity-files-cache`);
const cacheModule = require(

Check warning on line 105 in server/src/frameworks/Hardhat/worker/WorkerProcess.ts

View check run for this annotation

Codecov / codecov/patch

server/src/frameworks/Hardhat/worker/WorkerProcess.ts#L105

Added line #L105 was not covered by tests
`${hardhatBase}/builtin-tasks/utils/solidity-files-cache`
);

this.solidityFilesCachePath = cacheModule.getSolidityFilesCachePath(
this.hre.config.paths
Expand Down
25 changes: 20 additions & 5 deletions server/src/frameworks/Hardhat/worker/WorkerProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export abstract class ResponseMessage extends Message {
export class ErrorResponseMessage extends ResponseMessage {
public type = MessageType.ERROR_RESPONSE;

constructor(requestId: number, public error: any) {
constructor(
requestId: number,
public error: any

Check warning on line 42 in server/src/frameworks/Hardhat/worker/WorkerProtocol.ts

View check run for this annotation

Codecov / codecov/patch

server/src/frameworks/Hardhat/worker/WorkerProtocol.ts#L42

Added line #L42 was not covered by tests
) {
super(requestId);
}
}
Expand All @@ -49,22 +52,31 @@ export class InitializedMessage extends Message {
export class LogMessage extends Message {
public type = MessageType.LOG;

constructor(public logMessage: string, public level: LogLevel) {
constructor(
public logMessage: string,
public level: LogLevel

Check warning on line 57 in server/src/frameworks/Hardhat/worker/WorkerProtocol.ts

View check run for this annotation

Codecov / codecov/patch

server/src/frameworks/Hardhat/worker/WorkerProtocol.ts#L56-L57

Added lines #L56 - L57 were not covered by tests
) {
super();
}
}

export class FileBelongsRequest extends RequestMessage {
public type = MessageType.FILE_BELONGS_REQUEST;

constructor(requestId: number, public uri: string) {
constructor(
requestId: number,
public uri: string
) {
super(requestId);
}
}

export class FileBelongsResponse extends ResponseMessage {
public type = MessageType.FILE_BELONGS_RESPONSE;
constructor(requestId: number, public result: FileBelongsResult) {
constructor(
requestId: number,
public result: FileBelongsResult

Check warning on line 78 in server/src/frameworks/Hardhat/worker/WorkerProtocol.ts

View check run for this annotation

Codecov / codecov/patch

server/src/frameworks/Hardhat/worker/WorkerProtocol.ts#L78

Added line #L78 was not covered by tests
) {
super(requestId);
}
}
Expand All @@ -84,7 +96,10 @@ export class ResolveImportRequest extends RequestMessage {

export class ResolveImportResponse extends ResponseMessage {
public type = MessageType.RESOLVE_IMPORT_RESPONSE;
constructor(requestId: number, public path: string | undefined) {
constructor(
requestId: number,
public path: string | undefined

Check warning on line 101 in server/src/frameworks/Hardhat/worker/WorkerProtocol.ts

View check run for this annotation

Codecov / codecov/patch

server/src/frameworks/Hardhat/worker/WorkerProtocol.ts#L101

Added line #L101 was not covered by tests
) {
super(requestId);
}
}
Expand Down
5 changes: 4 additions & 1 deletion server/src/frameworks/base/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export interface FileBelongsResult {
}

export abstract class Project {
constructor(public serverState: ServerState, public basePath: string) {}
constructor(
public serverState: ServerState,
public basePath: string
) {}

public abstract configPath?: string;

Expand Down
Loading

0 comments on commit 712e2d1

Please sign in to comment.