Skip to content
Open
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
18 changes: 9 additions & 9 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint
Tests:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
Expand All @@ -30,7 +41,7 @@ jobs:
os: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v3
with:
Expand All @@ -46,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v3
with:
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
pnpm-lock.yaml

test/samples/*/*.js
test/sandbox/_input.js
test/sandbox/_output.js

expected.ts
expected.jsx
115 changes: 59 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,61 @@
{
"name": "esrap",
"version": "2.1.0",
"description": "Parse in reverse",
"repository": {
"type": "git",
"url": "git+https://github.com/sveltejs/esrap.git"
},
"type": "module",
"files": [
"src",
"types"
],
"exports": {
".": {
"types": "./types/index.d.ts",
"default": "./src/index.js"
},
"./languages/ts": {
"types": "./types/index.d.ts",
"default": "./src/languages/ts/index.js"
},
"./languages/tsx": {
"types": "./types/index.d.ts",
"default": "./src/languages/tsx/index.js"
}
},
"types": "./types/index.d.ts",
"devDependencies": {
"@changesets/cli": "^2.27.11",
"@sveltejs/acorn-typescript": "^1.0.5",
"@typescript-eslint/types": "^8.2.0",
"@vitest/ui": "^2.1.1",
"acorn": "^8.15.0",
"dts-buddy": "^0.6.2",
"prettier": "^3.0.3",
"typescript": "^5.7.2",
"vitest": "^2.1.1",
"zimmerframe": "^1.0.0"
},
"scripts": {
"changeset:version": "changeset version",
"changeset:publish": "changeset publish",
"check": "tsc",
"prepublishOnly": "pnpm test && dts-buddy -m esrap:./src/public.d.ts -m esrap/languages/ts:./src/languages/ts/public.d.ts -m esrap/languages/tsx:./src/languages/tsx/public.d.ts",
"sandbox": "node test/sandbox/index.js",
"test": "vitest --run",
"test:ui": "vitest --ui"
},
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
"name": "esrap",
"version": "2.1.0",
"description": "Parse in reverse",
"repository": {
"type": "git",
"url": "git+https://github.com/sveltejs/esrap.git"
},
"type": "module",
"files": [
"src",
"types"
],
"exports": {
".": {
"types": "./types/index.d.ts",
"default": "./src/index.js"
},
"./languages/ts": {
"types": "./types/index.d.ts",
"default": "./src/languages/ts/index.js"
},
"./languages/tsx": {
"types": "./types/index.d.ts",
"default": "./src/languages/tsx/index.js"
}
},
"types": "./types/index.d.ts",
"devDependencies": {
"@changesets/cli": "^2.27.11",
"@jridgewell/sourcemap-codec": "^1.5.0",
"@sveltejs/acorn-typescript": "^1.0.5",
"@typescript-eslint/types": "^8.2.0",
"@vitest/ui": "^2.1.1",
"acorn": "^8.15.0",
"dts-buddy": "^0.6.2",
"prettier": "^3.0.3",
"typescript": "^5.7.2",
"vitest": "^2.1.1",
"zimmerframe": "^1.0.0"
},
"scripts": {
"changeset:version": "changeset version",
"changeset:publish": "changeset publish",
"check": "tsc",
"prepublishOnly": "pnpm test && dts-buddy -m esrap:./src/public.d.ts -m esrap/languages/ts:./src/languages/ts/public.d.ts -m esrap/languages/tsx:./src/languages/tsx/public.d.ts",
"sandbox": "node test/sandbox/index.js",
"test": "vitest --run",
"test:ui": "vitest --ui",
"format": "pnpm lint --write",
"lint": "prettier --check . --ignore-path .gitignore --ignore-path .prettierignore"
},
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public"
}
}
10 changes: 5 additions & 5 deletions test/samples/jsx-basic/expected.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
console.log(<>
<div>
<img src="cat.png" alt={"An image of a flying cat"} />
Time since last cat incident: {"5 days"}
</div>
</>);
<div>
<img src="cat.png" alt={'An image of a flying cat'} />
Time since last cat incident: {'5 days'}
</div>
</>);
4 changes: 2 additions & 2 deletions test/samples/jsx-basic/expected.jsx.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"input.js"
],
"sourcesContent": [
"console.log(<>\n <div>\n <img src=\"cat.png\" alt={\"An image of a flying cat\"} />\n Time since last cat incident: {\"5 days\"}\n </div>\n</>)"
"console.log(\n\t<>\n\t\t<div>\n\t\t\t<img src=\"cat.png\" alt={'An image of a flying cat'} />\n\t\t\tTime since last cat incident: {'5 days'}\n\t\t</div>\n\t</>\n);\n"
],
"mappings": "AAAA,OAAO,CAAC,GAAG,GAAG;IACV,CAAC,GAAG,CAAC;QACD,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,0BAA0B,IAAI;sCACxB,CAAC,QAAQ,CAAC;IAC5C,EAAE,GAAG,CAAC;AACV"
"mappings": "AAAA,OAAO,CAAC,GAAG,GACR;EACD,CAAC,GAAG,CAAC;GACJ,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,0BAA0B,IAAI;iCACxB,CAAC,QAAQ,CAAC;EACzC,EAAE,GAAG,CAAC;CACP"
}
14 changes: 8 additions & 6 deletions test/samples/jsx-basic/input.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
console.log(<>
<div>
<img src="cat.png" alt={"An image of a flying cat"} />
Time since last cat incident: {"5 days"}
</div>
</>)
console.log(
<>
<div>
<img src="cat.png" alt={'An image of a flying cat'} />
Time since last cat incident: {'5 days'}
</div>
</>
);
2 changes: 1 addition & 1 deletion test/samples/ts-null-keyword/expected.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"input.js"
],
"sourcesContent": [
"let a: string | null = null"
"let a: string | null = null;\n"
],
"mappings": "IAAI,CAAgB,EAAb,MAAM,GAAG,IAAI,GAAG,IAAI"
}
2 changes: 1 addition & 1 deletion test/samples/ts-null-keyword/input.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let a: string | null = null
let a: string | null = null;
2 changes: 1 addition & 1 deletion test/samples/ts-return-type/expected.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"input.js"
],
"sourcesContent": [
"class Fields {\n\tstatic cuid(): string {\n\t\treturn 'random cuid...'\n\t}\n}\n"
"class Fields {\n\tstatic cuid(): string {\n\t\treturn 'random cuid...';\n\t}\n}\n"
],
"mappings": "MAAM,MAAM,CAAC,CAAC;QACN,IAAI,IAAI,MAAM,CAAC,CAAC;SACf,gBAAgB;CACxB,CAAC;AACF,CAAC"
}
2 changes: 1 addition & 1 deletion test/samples/ts-return-type/input.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Fields {
static cuid(): string {
return 'random cuid...'
return 'random cuid...';
}
}
2 changes: 1 addition & 1 deletion test/samples/ts-undefined-keyword/expected.ts.map
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"input.js"
],
"sourcesContent": [
"let a: number | undefined\na = 2"
"let a: number | undefined;\na = 2;\n"
],
"mappings": "IAAI,CAAqB,EAAlB,MAAM,GAAG,SAAS;;AACzB,CAAC,GAAG,CAAC"
}
4 changes: 2 additions & 2 deletions test/samples/ts-undefined-keyword/input.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
let a: number | undefined
a = 2
let a: number | undefined;
a = 2;
2 changes: 1 addition & 1 deletion test/samples/with/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
}
],
"sourceType": "script"
}
}
Loading