Skip to content

Slang 0.18.3 #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
82b16e6
cleaning extra new lines
Janther Oct 9, 2024
5ce0db0
updating dependencies
Janther Oct 9, 2024
8b43d3a
updating slang-nodes.
Janther Oct 10, 2024
430a85d
Update import statements for slang-comments
Janther Oct 10, 2024
b1a2d9d
Update import statements for slang-printers
Janther Oct 10, 2024
fd25110
Update import statements for slang-utils
Janther Oct 10, 2024
0bec1b3
Udate remaining logic
Janther Oct 10, 2024
81e45dc
updating webpack config and dependencies
Janther Oct 16, 2024
64785ca
updating ts
Janther Oct 18, 2024
6d500e4
using strip-comments
Janther Oct 18, 2024
22a22d7
cleaned up infer-language based on Omar's feedback
Janther Oct 21, 2024
5c698b5
webpack configuration for 'es'
Janther Oct 21, 2024
f6223bd
standalone tests
Janther Oct 21, 2024
970494c
updating dependencies
Janther Oct 21, 2024
9b5cdbf
removing export: 'default' from configuration
Janther Oct 21, 2024
209064d
solc tests
Janther Oct 21, 2024
a7e0dcb
avoid using the `ast` more than once since we can't ensure the pointe…
Janther Oct 22, 2024
e800d69
pre-load plugins in standalone
Janther Oct 22, 2024
98e151a
since we moved to esm we no longer need proxyquire
Janther Oct 22, 2024
7fc3f84
dropping umd for integration testing
Janther Oct 22, 2024
e20dc6c
enablig CI standalone testing
Janther Oct 23, 2024
368c18f
add esmock to standalone testing
Janther Oct 23, 2024
977a284
supporting prettier/standalone for old versions of prettier in test app
Janther Oct 23, 2024
d9bafa3
using prettier in the bundle and passing the responsibility to use pr…
Janther Oct 23, 2024
ba684a1
loading prettier/standalone.js directly in tests when we can't know p…
Janther Oct 23, 2024
7208bf1
using the last version of slang
Janther Oct 27, 2024
0694945
dropping support for prettier v2
Janther Oct 28, 2024
550d147
node 16 doesn't finish jest properly in CI
Janther Oct 28, 2024
bf03386
removing unnecessary else-if
Janther Oct 29, 2024
f6c9016
updating dependencies
Janther Oct 29, 2024
8333c24
addressing suggestions by Omar
Janther Oct 29, 2024
a173756
not using sandbox anymore
Janther Oct 29, 2024
643439e
rename `index.d.ts` to `types.d.ts`
Janther Oct 30, 2024
6f112bc
dropping support for prettier v2 parser function signature
Janther Oct 30, 2024
5f2e2e2
strip-comments must be a dependency
Janther Oct 30, 2024
a0316e5
loading properly in the browser
Janther Nov 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 10 additions & 30 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,8 @@ jobs:
- name: lint
run: npm run lint

# test_bundle:
# name: Test production
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# cache: 'npm'
# - name: Install
# run: npm install
# - name: Build
# run: npm run build
# - name: Build test app
# run: npm run build:test
# - name: Run tests
# run: npm run test:standalone

test_prettier_v2:
name: Prettier V2
test_bundle:
name: Test production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -52,14 +34,12 @@ jobs:
cache: 'npm'
- name: Install
run: npm install
- name: Build with Prettier V3
- name: Build
run: npm run build
- name: Downgrade Prettier to V2
run: npm install [email protected]
# - name: Build test app
# run: npm run build:test
# - name: Run standalone tests
# run: npm run test:standalone
- name: Build test app
run: npm run build:test
- name: Run tests
run: npm run test:standalone -- --runInBand

test_linux:
name: Test on Linux with Node ${{ matrix.node }}
Expand All @@ -76,7 +56,7 @@ jobs:
- name: Install
run: npm install
- name: Run tests
run: npm run test:all
run: npm run test:all -- --runInBand

test_macos:
name: Test on MacOS with Node 16
Expand All @@ -90,7 +70,7 @@ jobs:
- name: Install
run: npm install
- name: Run tests
run: npm run test:all
run: npm run test:all -- --runInBand

test_windows:
name: Test on Windows with Node 16
Expand All @@ -104,4 +84,4 @@ jobs:
- name: Install
run: npm install
- name: Run tests
run: npm run test:all
run: npm run test:all -- --runInBand
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Install both `prettier` and `prettier-plugin-solidity`:
npm install --save-dev prettier prettier-plugin-solidity
```

> :package: ** Make sure `prettier`'s version is at least `3.0.0`**

Run prettier in your contracts:

```Bash
Expand All @@ -46,25 +48,27 @@ Or you can use it as part of your linting to check that all your code is prettif

> Prettier Solidity only works with valid code. If there is a syntax error, nothing will be done and a parser error will be thrown.

### ~~Using in the Browser~~ _Disabled during v2.0.0-beta_
### Using in the Browser

_Added in v1.1.0_

To use this package in the browser, you need to load Prettier's standalone bundle before loading the build provided in this package.

```html
<script src="https://unpkg.com/prettier@latest"></script>
<script src="https://unpkg.com/prettier-plugin-solidity@latest"></script>
```

Prettier's unpkg field points to `https://unpkg.com/prettier/standalone.js`, in a similar way this plugin points to `https://unpkg.com/prettier-plugin-solidity/dist/standalone.js`.

Once the scripts are loaded you will have access the globals `prettier` and `prettierPlugins`.

We follow Prettier's strategy for populating their plugins in the object `prettierPlugins`, you can load other plugins like `https://unpkg.com/[email protected]/parser-markdown.js` and Prettier will have access to multiple parsers.

```html
<script>
<script type="module">
const prettier = await import(
'https://unpkg.com/prettier-plugin-solidity@latest'
);
const prettierSolidity = await import(
'https://unpkg.com/prettier-plugin-solidity@latest'
);

async function format(code) {
return await prettier.format(code, {
parser: 'slang-solidity',
Expand All @@ -79,7 +83,7 @@ We follow Prettier's strategy for populating their plugins in the object `pretti

For more details and please have a look at [Prettier's documentation](https://prettier.io/docs/en/browser.html).

### ~~Creating a package for the Browser~~ _Disabled during v2.0.0-beta_
### Creating a package for the Browser

_Added in v1.2.0_

Expand Down
Loading
Loading