Skip to content

Commit

Permalink
refactor(bindingins): Create @swc/counter (#7991)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Sep 22, 2023
1 parent 276be28 commit 0acbb5f
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 155 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
"*.rs": [
"rustfmt --"
],
"*.json": [
"prettier --write"
],
"!(**/tests/**/*)*.js": [
"prettier --write"
],
Expand Down Expand Up @@ -178,6 +181,7 @@
],
"packageManager": "[email protected]",
"dependencies": {
"@swc/types": "^0.1.4"
"@swc/counter": "^0.1.1",
"@swc/types": "^0.1.5"
}
}
3 changes: 3 additions & 0 deletions packages/download-counter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @swc/couter

Download counter for swc packages.
1 change: 1 addition & 0 deletions packages/download-counter/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('download-counter/index.js');
28 changes: 28 additions & 0 deletions packages/download-counter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@swc/counter",
"packageManager": "[email protected]",
"main": "index.js",
"version": "0.1.1",
"description": "Downloade counter for the swc project",
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"scripts": {},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"keywords": [
"swc",
"download",
"counter"
],
"author": "강동윤 <[email protected]>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"homepage": "https://swc.rs"
}
10 changes: 2 additions & 8 deletions packages/helpers/.dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
"json": {
"indentWidth": 4
},
"includes": [
"{esm,cjs,src}/*.{js,mjs,cjs}",
"**/*.json"
],
"excludes": [
"**/node_modules",
"**/*-lock.json"
],
"includes": ["{esm,cjs,src}/*.{js,mjs,cjs}", "**/*.json"],
"excludes": ["**/node_modules", "**/*-lock.json"],
"plugins": [
"https://plugins.dprint.dev/typescript-0.84.0.wasm",
"https://plugins.dprint.dev/json-0.17.1.wasm"
Expand Down
1 change: 1 addition & 0 deletions packages/helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@swc/helpers",
"packageManager": "[email protected]",
"version": "0.5.2",
"description": "External helpers for the swc project.",
"module": "esm/index.js",
Expand Down
12 changes: 3 additions & 9 deletions packages/helpers/scripts/.dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
"binaryExpression.linePerExpression": true,
"memberExpression.linePerExpression": true
},
"includes": [
"*.js"
],
"excludes": [
"**/node_modules"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.84.0.wasm"
]
"includes": ["*.js"],
"excludes": ["**/node_modules"],
"plugins": ["https://plugins.dprint.dev/typescript-0.84.0.wasm"]
}
5 changes: 4 additions & 1 deletion packages/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "@swc/workspace",
"packageManager": "[email protected]",
"private": true,
"workspaces": [
"./*"
],
"packageManager": "[email protected]"
"devDependencies": {
"prettier": "^3.0.3"
}
}
43 changes: 19 additions & 24 deletions packages/swc-info/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{
"compilerOptions": {
"target": "es2019",
"useDefineForClassFields": true,
"module": "commonjs",
"baseUrl": "./",
"paths": {},
"resolveJsonModule": true,
"declaration": true,
"sourceMap": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"rootDir": "."
},
"include": [
"lib",
"tests"
],
"exclude": [
"examples"
]
}
"compilerOptions": {
"target": "es2019",
"useDefineForClassFields": true,
"module": "commonjs",
"baseUrl": "./",
"paths": {},
"resolveJsonModule": true,
"declaration": true,
"sourceMap": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"rootDir": "."
},
"include": ["lib", "tests"],
"exclude": ["examples"]
}
8 changes: 3 additions & 5 deletions packages/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export interface TerserMangleOptions {
reserved?: string[];
}

export interface TerserManglePropertiesOptions { }
export interface TerserManglePropertiesOptions {}

/**
* Programmatic options.
Expand Down Expand Up @@ -602,14 +602,12 @@ export interface JscConfig {
*/
keepImportAttributes?: boolean;


/**
* Use `assert` instead of `with` for imports and exports.
* This option only works when `keepImportAttributes` is `true`.
*/
emitAssertForImportAttributes?: boolean;


/**
* Specify the location where SWC stores its intermediate cache files.
* Currently only transform plugin uses this. If not specified, SWC will
Expand Down Expand Up @@ -1087,7 +1085,7 @@ export interface Output {
map?: string;
}

export interface MatchPattern { }
export interface MatchPattern {}

// -------------------------------
// ---------- Ast nodes ----------
Expand Down Expand Up @@ -1319,7 +1317,7 @@ export type Expression =
| OptionalChainingExpression
| Invalid;

interface ExpressionBase extends Node, HasSpan { }
interface ExpressionBase extends Node, HasSpan {}

export interface Identifier extends ExpressionBase {
type: "Identifier";
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@swc/types",
"packageManager": "[email protected]",
"version": "0.1.5",
"description": "Typings for the swc project.",
"sideEffects": false,
Expand All @@ -26,7 +27,6 @@
"url": "https://github.com/swc-project/swc/issues"
},
"homepage": "https://swc.rs",
"packageManager": "[email protected]",
"devDependencies": {
"typescript": "^5.2.2"
}
Expand Down
Loading

1 comment on commit 0acbb5f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 0acbb5f Previous: 5050f58 Ratio
es/full/bugs-1 297607 ns/iter (± 8541) 283714 ns/iter (± 3147) 1.05
es/full/minify/libraries/antd 1283896678 ns/iter (± 4594032) 1339585321 ns/iter (± 11383027) 0.96
es/full/minify/libraries/d3 274417339 ns/iter (± 2726438) 279454536 ns/iter (± 5681672) 0.98
es/full/minify/libraries/echarts 1029627309 ns/iter (± 2813423) 1078354084 ns/iter (± 11615394) 0.95
es/full/minify/libraries/jquery 83825385 ns/iter (± 176378) 84235991 ns/iter (± 206634) 1.00
es/full/minify/libraries/lodash 96655034 ns/iter (± 518171) 97253450 ns/iter (± 247738) 0.99
es/full/minify/libraries/moment 49633868 ns/iter (± 171645) 49808170 ns/iter (± 127334) 1.00
es/full/minify/libraries/react 17970240 ns/iter (± 52560) 17995463 ns/iter (± 49165) 1.00
es/full/minify/libraries/terser 215533657 ns/iter (± 443593) 220093650 ns/iter (± 883206) 0.98
es/full/minify/libraries/three 381557056 ns/iter (± 1048138) 387572718 ns/iter (± 2131838) 0.98
es/full/minify/libraries/typescript 2615778577 ns/iter (± 10439416) 2671877831 ns/iter (± 9556131) 0.98
es/full/minify/libraries/victory 554696831 ns/iter (± 2742219) 574715486 ns/iter (± 11529932) 0.97
es/full/minify/libraries/vue 118846659 ns/iter (± 171917) 119572445 ns/iter (± 188057) 0.99
es/full/codegen/es3 34024 ns/iter (± 92) 33556 ns/iter (± 80) 1.01
es/full/codegen/es5 33979 ns/iter (± 48) 33576 ns/iter (± 74) 1.01
es/full/codegen/es2015 34045 ns/iter (± 196) 33537 ns/iter (± 82) 1.02
es/full/codegen/es2016 34000 ns/iter (± 67) 33599 ns/iter (± 96) 1.01
es/full/codegen/es2017 34111 ns/iter (± 167) 33570 ns/iter (± 134) 1.02
es/full/codegen/es2018 34010 ns/iter (± 89) 33609 ns/iter (± 37) 1.01
es/full/codegen/es2019 34058 ns/iter (± 66) 33701 ns/iter (± 104) 1.01
es/full/codegen/es2020 33937 ns/iter (± 100) 33609 ns/iter (± 74) 1.01
es/full/all/es3 166978566 ns/iter (± 666042) 171124151 ns/iter (± 1433263) 0.98
es/full/all/es5 159012941 ns/iter (± 970484) 162472324 ns/iter (± 1268656) 0.98
es/full/all/es2015 119122138 ns/iter (± 711059) 121403413 ns/iter (± 991019) 0.98
es/full/all/es2016 117911983 ns/iter (± 317688) 120724861 ns/iter (± 634791) 0.98
es/full/all/es2017 117627730 ns/iter (± 516064) 119360188 ns/iter (± 532385) 0.99
es/full/all/es2018 116040373 ns/iter (± 855054) 117673215 ns/iter (± 1052584) 0.99
es/full/all/es2019 114897776 ns/iter (± 577638) 117012255 ns/iter (± 470754) 0.98
es/full/all/es2020 111262511 ns/iter (± 835463) 112481717 ns/iter (± 525771) 0.99
es/full/parser 489766 ns/iter (± 5675) 498471 ns/iter (± 4840) 0.98
es/full/base/fixer 17246 ns/iter (± 90) 19065 ns/iter (± 121) 0.90
es/full/base/resolver_and_hygiene 80893 ns/iter (± 194) 83879 ns/iter (± 233) 0.96
serialization of serde 281 ns/iter (± 5) 294 ns/iter (± 3) 0.96
css/minify/libraries/bootstrap 28594055 ns/iter (± 113718) 28543529 ns/iter (± 59200) 1.00
css/visitor/compare/clone 1678181 ns/iter (± 3846) 1670900 ns/iter (± 3879) 1.00
css/visitor/compare/visit_mut_span 1810458 ns/iter (± 6767) 1783365 ns/iter (± 7578) 1.02
css/visitor/compare/visit_mut_span_panic 1853377 ns/iter (± 8012) 1871447 ns/iter (± 4963) 0.99
css/visitor/compare/fold_span 2557621 ns/iter (± 6513) 2578113 ns/iter (± 26427) 0.99
css/visitor/compare/fold_span_panic 2757814 ns/iter (± 10065) 2755681 ns/iter (± 7226) 1.00
css/lexer/bootstrap_5_1_3 4390570 ns/iter (± 3026) 4592245 ns/iter (± 4657) 0.96
css/lexer/foundation_6_7_4 3698518 ns/iter (± 1701) 3858189 ns/iter (± 2459) 0.96
css/lexer/tailwind_3_1_1 704555 ns/iter (± 673) 730625 ns/iter (± 682) 0.96
css/parser/bootstrap_5_1_3 19038527 ns/iter (± 61870) 19660285 ns/iter (± 24063) 0.97
css/parser/foundation_6_7_4 15328075 ns/iter (± 19321) 15640681 ns/iter (± 35093) 0.98
css/parser/tailwind_3_1_1 2998017 ns/iter (± 8495) 2980627 ns/iter (± 8009) 1.01
es/codegen/colors 733587 ns/iter (± 398671) 726969 ns/iter (± 397178) 1.01
es/codegen/large 3120948 ns/iter (± 1643783) 3134067 ns/iter (± 1668549) 1.00
es/codegen/with-parser/colors 45218 ns/iter (± 498) 45123 ns/iter (± 88) 1.00
es/codegen/with-parser/large 490148 ns/iter (± 1680) 491276 ns/iter (± 1048) 1.00
es/minify/libraries/antd 1126214268 ns/iter (± 5520519) 1167072647 ns/iter (± 12143288) 0.96
es/minify/libraries/d3 237276772 ns/iter (± 182268) 240079099 ns/iter (± 1884336) 0.99
es/minify/libraries/echarts 886446876 ns/iter (± 2526154) 924386910 ns/iter (± 5354545) 0.96
es/minify/libraries/jquery 73079015 ns/iter (± 189367) 73050637 ns/iter (± 99037) 1.00
es/minify/libraries/lodash 86857909 ns/iter (± 449507) 88160460 ns/iter (± 811005) 0.99
es/minify/libraries/moment 43460577 ns/iter (± 44601) 43332589 ns/iter (± 83845) 1.00
es/minify/libraries/react 16053523 ns/iter (± 37702) 15946865 ns/iter (± 72952) 1.01
es/minify/libraries/terser 185316046 ns/iter (± 511675) 186807801 ns/iter (± 501357) 0.99
es/minify/libraries/three 318208819 ns/iter (± 997911) 325962335 ns/iter (± 1188976) 0.98
es/minify/libraries/typescript 2210895606 ns/iter (± 7098106) 2259686884 ns/iter (± 18073596) 0.98
es/minify/libraries/victory 473703488 ns/iter (± 1357807) 480438900 ns/iter (± 2799588) 0.99
es/minify/libraries/vue 105926932 ns/iter (± 220188) 105990924 ns/iter (± 407263) 1.00
es/visitor/compare/clone 1947651 ns/iter (± 4497) 1945641 ns/iter (± 4025) 1.00
es/visitor/compare/visit_mut_span 2287648 ns/iter (± 2497) 2291278 ns/iter (± 8153) 1.00
es/visitor/compare/visit_mut_span_panic 2328482 ns/iter (± 3404) 2326980 ns/iter (± 2549) 1.00
es/visitor/compare/fold_span 3374126 ns/iter (± 5366) 3380129 ns/iter (± 10781) 1.00
es/visitor/compare/fold_span_panic 3524103 ns/iter (± 6734) 3522108 ns/iter (± 7555) 1.00
es/lexer/colors 12987 ns/iter (± 29) 13130 ns/iter (± 33) 0.99
es/lexer/angular 6048882 ns/iter (± 4899) 6092427 ns/iter (± 9770) 0.99
es/lexer/backbone 783688 ns/iter (± 1587) 795706 ns/iter (± 3666) 0.98
es/lexer/jquery 4457157 ns/iter (± 7582) 4538298 ns/iter (± 17388) 0.98
es/lexer/jquery mobile 6799878 ns/iter (± 3546) 6868191 ns/iter (± 6058) 0.99
es/lexer/mootools 3552536 ns/iter (± 3605) 3555397 ns/iter (± 9782) 1.00
es/lexer/underscore 657814 ns/iter (± 584) 664989 ns/iter (± 746) 0.99
es/lexer/three 21234086 ns/iter (± 22684) 21381642 ns/iter (± 51681) 0.99
es/lexer/yui 3811984 ns/iter (± 3565) 3821121 ns/iter (± 2670) 1.00
es/parser/colors 27183 ns/iter (± 306) 27746 ns/iter (± 111) 0.98
es/parser/angular 13464198 ns/iter (± 62492) 13621588 ns/iter (± 64911) 0.99
es/parser/backbone 1978158 ns/iter (± 6890) 1994639 ns/iter (± 8330) 0.99
es/parser/jquery 10804561 ns/iter (± 32622) 10905732 ns/iter (± 27780) 0.99
es/parser/jquery mobile 16563899 ns/iter (± 38647) 16714245 ns/iter (± 158354) 0.99
es/parser/mootools 8293186 ns/iter (± 22110) 8414553 ns/iter (± 25501) 0.99
es/parser/underscore 1703983 ns/iter (± 9088) 1728652 ns/iter (± 11247) 0.99
es/parser/three 46269613 ns/iter (± 184271) 47507538 ns/iter (± 447506) 0.97
es/parser/yui 8242486 ns/iter (± 43097) 8330368 ns/iter (± 47254) 0.99
es/preset-env/usage/builtin_type 137214 ns/iter (± 32344) 135187 ns/iter (± 31756) 1.01
es/preset-env/usage/property 17750 ns/iter (± 76) 16568 ns/iter (± 63) 1.07
es/resolver/typescript 90003999 ns/iter (± 933630) 91118366 ns/iter (± 764997) 0.99
es/fixer/typescript 63726236 ns/iter (± 338585) 64377332 ns/iter (± 487149) 0.99
es/hygiene/typescript 129647575 ns/iter (± 853641) 131656206 ns/iter (± 535625) 0.98
es/resolver_with_hygiene/typescript 241726141 ns/iter (± 1133580) 244507106 ns/iter (± 1459174) 0.99
es/visitor/base-perf/module_clone 58654 ns/iter (± 335) 59391 ns/iter (± 384) 0.99
es/visitor/base-perf/fold_empty 62449 ns/iter (± 318) 63455 ns/iter (± 374) 0.98
es/visitor/base-perf/fold_noop_impl_all 63030 ns/iter (± 298) 63232 ns/iter (± 422) 1.00
es/visitor/base-perf/fold_noop_impl_vec 63594 ns/iter (± 378) 63557 ns/iter (± 286) 1.00
es/visitor/base-perf/boxing_boxed_clone 55 ns/iter (± 0) 56 ns/iter (± 0) 0.98
es/visitor/base-perf/boxing_unboxed_clone 39 ns/iter (± 0) 40 ns/iter (± 0) 0.97
es/visitor/base-perf/boxing_boxed 108 ns/iter (± 0) 109 ns/iter (± 0) 0.99
es/visitor/base-perf/boxing_unboxed 77 ns/iter (± 0) 78 ns/iter (± 0) 0.99
es/visitor/base-perf/visit_empty 0 ns/iter (± 0) 0 ns/iter (± 0) NaN
es/visitor/base-perf/visit_contains_this 2498 ns/iter (± 10) 2534 ns/iter (± 6) 0.99
es/base/parallel/resolver/typescript 3638941708 ns/iter (± 300674919) 3769292673 ns/iter (± 288136507) 0.97
es/base/parallel/hygiene/typescript 1459946319 ns/iter (± 13387235) 1434206475 ns/iter (± 17977738) 1.02
misc/visitors/time-complexity/time 5 150 ns/iter (± 0) 154 ns/iter (± 1) 0.97
misc/visitors/time-complexity/time 10 438 ns/iter (± 0) 453 ns/iter (± 4) 0.97
misc/visitors/time-complexity/time 15 797 ns/iter (± 2) 871 ns/iter (± 35) 0.92
misc/visitors/time-complexity/time 20 1459 ns/iter (± 73) 1284 ns/iter (± 1) 1.14
misc/visitors/time-complexity/time 40 4396 ns/iter (± 23) 4421 ns/iter (± 39) 0.99
misc/visitors/time-complexity/time 60 9129 ns/iter (± 18) 9016 ns/iter (± 12) 1.01
es/full-target/es2016 237026 ns/iter (± 1344) 235142 ns/iter (± 632) 1.01
es/full-target/es2017 221679 ns/iter (± 1051) 222979 ns/iter (± 505) 0.99
es/full-target/es2018 210171 ns/iter (± 658) 212081 ns/iter (± 800) 0.99
es2020_nullish_coalescing 72170 ns/iter (± 380) 71219 ns/iter (± 366) 1.01
es2020_optional_chaining 77487 ns/iter (± 348) 79692 ns/iter (± 303) 0.97
es2022_class_properties 115808 ns/iter (± 519) 115508 ns/iter (± 378) 1.00
es2018_object_rest_spread 75249 ns/iter (± 170) 75322 ns/iter (± 219) 1.00
es2019_optional_catch_binding 65121 ns/iter (± 257) 65051 ns/iter (± 228) 1.00
es2017_async_to_generator 64291 ns/iter (± 155) 65092 ns/iter (± 180) 0.99
es2016_exponentiation 67827 ns/iter (± 949) 69371 ns/iter (± 261) 0.98
es2015_arrow 70239 ns/iter (± 226) 72457 ns/iter (± 280) 0.97
es2015_block_scoped_fn 66914 ns/iter (± 173) 68815 ns/iter (± 262) 0.97
es2015_block_scoping 121331 ns/iter (± 333) 123393 ns/iter (± 414) 0.98

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.