-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into AdityaAtulTewari/enable-dynamic-typescript-o…
…verrides
- Loading branch information
Showing
596 changed files
with
51,254 additions
and
47,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,107 @@ | ||
Language: Cpp | ||
Standard: c++20 | ||
ColumnLimit: 100 | ||
|
||
WhitespaceSensitiveMacros: | ||
# clang format doesn't understand TypeScript, so make sure it doesn't mangle | ||
# overrides and additional definitions | ||
- JSG_TS_OVERRIDE | ||
- JSG_TS_DEFINE | ||
- JSG_STRUCT_TS_OVERRIDE | ||
- JSG_STRUCT_TS_DEFINE | ||
PointerAlignment: Left | ||
ColumnLimit: 100 | ||
AllowShortFunctionsOnASingleLine: Empty | ||
|
||
# We should have "true" here but adding an include header would result in too many changed lines. | ||
# Once we turn this on we should use IncludeCategories so that things are consistently sorted. | ||
# For example, to protect against brittle headers (a header not including everything its using | ||
# because existing users happened to include a dependency for it), one could use the following | ||
# order: | ||
# local folder files | ||
# project files | ||
# 3p dependency includes | ||
# standard language headers (put kj/ here?) | ||
# system headers | ||
# While this would be ideal it's also important to note that this isn't the (non-documented) style | ||
# that KJ uses, so it may be worth documenting the style & making it consistent. | ||
SortIncludes: false | ||
|
||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
|
||
IndentWidth: 2 | ||
IndentCaseBlocks: false | ||
IndentCaseLabels: true | ||
PointerAlignment: Left | ||
DerivePointerAlignment: true | ||
|
||
# Really "Attach" but empty braces aren't split. | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
|
||
Cpp11BracedListStyle: true | ||
|
||
AlignAfterOpenBracket: DontAlign | ||
AlignOperands: DontAlign | ||
AlignTrailingComments: | ||
Kind: Always | ||
OverEmptyLines: 0 | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BreakStringLiterals: false | ||
BinPackArguments: true | ||
BinPackParameters: false | ||
BracedInitializerIndentWidth: 2 | ||
BreakInheritanceList: BeforeColon | ||
ContinuationIndentWidth: 4 | ||
IfMacros: | ||
[ | ||
"KJ_SWITCH_ONEOF", | ||
"KJ_CASE_ONEOF", | ||
"KJ_IF_MAYBE", | ||
"KJ_IF_SOME", | ||
"CFJS_RESOURCE_TYPE", | ||
] | ||
LambdaBodyIndentation: OuterScope | ||
Macros: | ||
- "KJ_MAP(x,y)=[y](auto x)" | ||
- "JSG_VISITABLE_LAMBDA(x,y,z)=[x,y](z)" | ||
# The WhitespaceSensitiveMacros solution is flaky, adding the following ensures no formatting: | ||
- "JSG_TS_OVERRIDE(x)=enum class" | ||
- "JSG_TS_DEFINE(x)=enum class" | ||
- "JSG_STRUCT_TS_OVERRIDE(x)=enum class" | ||
- "JSG_STRUCT_TS_DEFINE(x)=enum class" | ||
PenaltyReturnTypeOnItsOwnLine: 1000 | ||
PackConstructorInitializers: CurrentLine | ||
ReflowComments: false | ||
SpaceBeforeCtorInitializerColon: false | ||
SpaceBeforeInheritanceColon: false | ||
SpaceBeforeParens: ControlStatementsExceptControlMacros | ||
SpaceBeforeRangeBasedForLoopColon: false | ||
SpacesBeforeTrailingComments: 2 | ||
--- | ||
# Some files with embedded typescript are incorrectly recognized by clang-format as Objective-C | ||
# This is because the C/C++ macro expansion step happens after the language recognition step, so | ||
# when trying to parse the file, the c++ parser fails with incorrect syntax and a fallback to | ||
# the Objective-C parser is used. | ||
# This is a workaround to hide the warning. | ||
# TODO: Remove this once we have a better solution. | ||
Language: ObjC | ||
DisableFormat: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Apply prettier to the project | ||
0523bf8b36a937348f1bb79eceda2463a5c220b5 | ||
|
||
# Apply clang-format to the project. | ||
5e8537a77e760c160ace3dfe23ee8c76ee5aeeb3 | ||
|
||
# Apply ruff format to the project | ||
d6d0607a845e6f71084ce272a1c1e8c50e244bdd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- name: Setup Linux | ||
run: | | ||
export DEBIAN_FRONTEND=noninteractive | ||
wget https://apt.llvm.org/llvm.sh | ||
sed -i '/apt-get install/d' llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh 18 | ||
sudo apt-get install -y --no-install-recommends clang-format-18 | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
# The pnpm version will be determined by the `packageManager` field in `.npmrc` | ||
- name: Install project deps with pnpm | ||
run: | | ||
pnpm i | ||
- name: Install Ruff | ||
run: | | ||
pip install ruff | ||
- name: Lint | ||
run: | | ||
python3 ./tools/cross/format.py --check | ||
env: | ||
CLANG_FORMAT: clang-format-18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ref: https://pnpm.io/npmrc#manage-package-manager-versions | ||
# When enabled, pnpm will automatically download and run the version of pnpm | ||
# specified in the packageManager field of package.json. | ||
manage-package-manager-versions = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
samples/nodejs-compat-streams-split2/split2.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ workspace(name = "workerd") | |
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") | ||
|
||
NODE_VERSION = "20.14.0" | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
sha256 = "9f38886a40548c6e96c106b752f242130ee11aaa068a56ba7e56f4511f33e4f2", | ||
|
@@ -141,7 +143,7 @@ http_archive( | |
urls = ["https://github.com/dom96/pyodide_packages/releases/download/just-stdlib/pyodide_packages.tar.zip"], | ||
) | ||
|
||
load("//:build/pyodide_bucket.bzl", "PYODIDE_LOCK_SHA256", "PYODIDE_GITHUB_RELEASE_URL", "PYODIDE_ALL_WHEELS_ZIP_SHA256") | ||
load("//:build/pyodide_bucket.bzl", "PYODIDE_ALL_WHEELS_ZIP_SHA256", "PYODIDE_GITHUB_RELEASE_URL", "PYODIDE_LOCK_SHA256") | ||
|
||
http_file( | ||
name = "pyodide-lock.json", | ||
|
@@ -151,15 +153,15 @@ http_file( | |
|
||
http_archive( | ||
name = "all_pyodide_wheels", | ||
sha256 = PYODIDE_ALL_WHEELS_ZIP_SHA256, | ||
urls = [PYODIDE_GITHUB_RELEASE_URL + "all_wheels.zip"], | ||
build_file_content = """ | ||
filegroup( | ||
name = "whls", | ||
srcs = glob(["*"]), | ||
visibility = ["//visibility:public"] | ||
) | ||
""" | ||
""", | ||
sha256 = PYODIDE_ALL_WHEELS_ZIP_SHA256, | ||
urls = [PYODIDE_GITHUB_RELEASE_URL + "all_wheels.zip"], | ||
) | ||
|
||
# ======================================================================================== | ||
|
@@ -220,9 +222,9 @@ git_repository( | |
|
||
git_repository( | ||
name = "fp16", | ||
commit = "0a92994d729ff76a58f692d3028ca1b64b145d91", | ||
build_file_content = "exports_files(glob([\"**\"]))", | ||
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git" | ||
commit = "0a92994d729ff76a58f692d3028ca1b64b145d91", | ||
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git", | ||
) | ||
|
||
# Bindings for abseil libraries used by V8 | ||
|
@@ -373,9 +375,9 @@ rules_rust_dependencies() | |
|
||
rust_register_toolchains( | ||
edition = "2021", | ||
versions = ["1.77.0"], # LLVM 17 | ||
# Rust registers wasm targets by default which we don't need, workerd is only built for its native platform. | ||
extra_target_triples = [], | ||
versions = ["1.77.0"], # LLVM 17 | ||
) | ||
|
||
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") | ||
|
@@ -395,52 +397,44 @@ rust_analyzer_dependencies() | |
# | ||
# workerd uses Node.js scripts for generating TypeScript types. | ||
|
||
# Fetch rules_nodejs before aspect_rules_js, otherwise we'll get an outdated rules_nodejs version. | ||
http_archive( | ||
name = "rules_nodejs", | ||
integrity = "sha256-h8YXHFvntpU41Gldne0priYmxe12qa3u3ON7Y8c772c=", | ||
strip_prefix = "rules_nodejs-6.2.0", | ||
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.2.0/rules_nodejs-v6.2.0.tar.gz", | ||
) | ||
|
||
http_archive( | ||
name = "aspect_rules_js", | ||
integrity = "sha256-/GiHCR7jJDZh+1Mv0yRCMLbhk8IlZqA4yf10jKaPuIA=", | ||
strip_prefix = "rules_js-1.42.3", | ||
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.42.3.tar.gz", | ||
sha256 = "6b7e73c35b97615a09281090da3645d9f03b2a09e8caa791377ad9022c88e2e6", | ||
strip_prefix = "rules_js-2.0.0", | ||
url = "https://github.com/aspect-build/rules_js/releases/download/v2.0.0/rules_js-v2.0.0.tar.gz", | ||
) | ||
|
||
http_archive( | ||
name = "aspect_rules_ts", | ||
integrity = "sha256-9ppkUrEp052bBfPf+LEFcYW7GVtNrwz/QZmI3nV8bDE=", | ||
strip_prefix = "rules_ts-2.4.2", | ||
url = "https://github.com/aspect-build/rules_ts/archive/refs/tags/v2.4.2.tar.gz", | ||
sha256 = "ee7dcc35faef98f3050df9cf26f2a72ef356cab8ad927efb1c4dc119ac082a19", | ||
strip_prefix = "rules_ts-3.0.0", | ||
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.0.0/rules_ts-v3.0.0.tar.gz", | ||
) | ||
|
||
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies") | ||
|
||
rules_js_dependencies() | ||
|
||
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains") | ||
load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains") | ||
|
||
nodejs_register_toolchains( | ||
name = "nodejs", | ||
rules_js_register_toolchains( | ||
node_urls = [ | ||
# github workflows may substitute a mirror URL here to avoid fetch failures. | ||
# "WORKERS_MIRROR_URL/https://nodejs.org/dist/v{version}/{filename}", | ||
"https://nodejs.org/dist/v{version}/{filename}", | ||
], | ||
node_version = "20.14.0", | ||
node_version = NODE_VERSION, | ||
) | ||
|
||
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies", TS_LATEST_VERSION = "LATEST_TYPESCRIPT_VERSION") | ||
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies") | ||
|
||
rules_ts_dependencies(ts_version = TS_LATEST_VERSION) | ||
rules_ts_dependencies(ts_version_from = "//:package.json") | ||
|
||
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock") | ||
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") | ||
|
||
npm_translate_lock( | ||
name = "npm", | ||
npmrc = "//:.npmrc", | ||
patch_args = { | ||
"[email protected]": ["-p1"], | ||
}, | ||
|
@@ -472,6 +466,7 @@ npm_repositories() | |
|
||
http_archive( | ||
name = "v8", | ||
integrity = "sha256-yoLczQj1XEZL4EHVRjAwpVjgr9/q0YlRGnNX47Ke2ws=", | ||
patch_args = ["-p1"], | ||
patches = [ | ||
"//:patches/v8/0001-Allow-manually-setting-ValueDeserializer-format-vers.patch", | ||
|
@@ -498,7 +493,6 @@ http_archive( | |
"//:patches/v8/0019-wasm-Fix-more-code-logging-races.patch", | ||
"//:patches/v8/0020-wasm-Remove-destructor-of-LogCodesTask.patch", | ||
], | ||
integrity = "sha256-yoLczQj1XEZL4EHVRjAwpVjgr9/q0YlRGnNX47Ke2ws=", | ||
strip_prefix = "v8-12.8.374.10", | ||
url = "https://github.com/v8/v8/archive/refs/tags/12.8.374.10.tar.gz", | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.