Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wasm-fmt/clang-format
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v19.1.0
Choose a base ref
...
head repository: wasm-fmt/clang-format
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v19.1.1
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Sep 20, 2024

  1. fix: cmake CACHE

    magic-akari committed Sep 20, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e12e366 View commit details

Commits on Sep 21, 2024

  1. fix: add shebang

    magic-akari committed Sep 21, 2024
    Copy the full SHA
    b457670 View commit details
  2. 19.1.1

    magic-akari committed Sep 21, 2024
    Copy the full SHA
    07782a1 View commit details
Showing with 50 additions and 8 deletions.
  1. +37 −0 .clang-format
  2. +6 −6 CMakeLists.txt
  3. +1 −1 package.json
  4. +6 −1 scripts/build.sh
37 changes: 37 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
BasedOnStyle: Chromium
IndentWidth: 4
---
Language: JavaScript
AccessModifierOffset: 2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakStringLiterals: false
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentWidth: 4
TabWidth: 4
UseTab: Never
...
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -4,14 +4,14 @@ message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")

include(FetchContent)

set(LLVM_ENABLE_PROJECTS clang CACHE STRING "")
set(LLVM_ENABLE_PROJECTS clang CACHE STRING "LLVM projects to build")

set(LLVM_INCLUDE_UTILS OFF)
set(LLVM_INCLUDE_EXAMPLES OFF)
set(LLVM_INCLUDE_TESTS OFF)
set(LLVM_INCLUDE_BENCHMARKS OFF)
set(LLVM_INCLUDE_UTILS OFF CACHE BOOL "Include LLVM utils")
set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "Include LLVM examples")
set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "Include LLVM tests")
set(LLVM_INCLUDE_BENCHMARKS OFF CACHE BOOL "Include LLVM benchmarks")

set(NO_RTTI "-fno-rtti")
set(NO_RTTI "-fno-rtti" CACHE STRING "Disable RTTI")
add_definitions(${NO_RTTI})

if(NOT CMAKE_BUILD_TYPE)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wasm-fmt/clang-format",
"author": "magic-akari <akari.ccino@gamil.com>",
"version": "19.1.0",
"version": "19.1.1",
"description": "A wasm based clang-format",
"main": "clang-format.js",
"types": "clang-format.d.ts",
7 changes: 6 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -25,8 +25,13 @@ SMALLEST_WASM=$(ls -Sr build/*.wasm | head -1)
cp $SMALLEST_WASM pkg/clang-format.wasm
npm exec terser -- src/template.js build/clang-format-esm.js --config-file .terser.json --output pkg/clang-format.js

# format cli script itself
echo '{"type": "commonjs"}' > build/package.json
node ./build/clang-format-cli.js -i ./build/clang-format-cli.js

# add shebang
echo '#!/usr/bin/env node' | cat - ./build/clang-format-cli.js > ./pkg/clang-format-cli.cjs
cp ./build/clang-format-cli.wasm ./pkg/
cp ./build/clang-format-cli.js ./pkg/clang-format-cli.cjs

cp ./src/clang-format.d.ts src/clang-format-*.js ./pkg/
cp ./package.json LICENSE README.md .npmignore ./pkg/