chore(ci): Configure publish pipeline for html binding (#9458)

**Related issue:**

 - https://github.com/swc-project/swc/issues/9457
This commit is contained in:
Donny/강동윤 2024-08-20 09:49:19 +09:00 committed by GitHub
parent 3ecee9fc1b
commit 868be56a25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 3243 additions and 973 deletions

View File

@ -0,0 +1,41 @@
name: "Git tag release"
description: "Tags a release"
inputs:
version:
description: "The version"
required: true
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "main"
- uses: ./.github/actions/setup-node
- name: Install git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff@1.3.1
- name: Install cargo-edit
uses: taiki-e/install-action@v2
with:
tool: cargo-edit@0.12.2
- name: "Setup jq"
uses: dcarbone/install-jq-action@v2
with:
version: "1.7"
force: true
- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
- name: Create git tag commit
shell: bash
run: |
./scripts/publish.sh ${{ inputs.version }}

View File

@ -56,50 +56,10 @@ jobs:
run: |
echo "need-build=true" >> $GITHUB_OUTPUT
create-git-tag-commit:
name: Create git tag commit
runs-on: ubuntu-latest
needs:
- check-if-build-required
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "main"
- uses: ./.github/actions/setup-node
- name: Install git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff@1.3.1
- name: Install cargo-edit
uses: taiki-e/install-action@v2
with:
tool: cargo-edit@0.12.2
- name: "Setup jq"
uses: dcarbone/install-jq-action@v2
with:
version: "1.7"
force: true
- uses: webfactory/ssh-agent@v0.9.0
if: needs.check-if-build-required.outputs.need-build == 'true' && !inputs.skipPublishing
with:
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
- name: Create git tag commit
if: needs.check-if-build-required.outputs.need-build == 'true' && !inputs.skipPublishing
run: |
./scripts/publish.sh ${{ inputs.version }}
build:
if: needs.check-if-build-required.outputs.need-build == 'true'
needs:
- check-if-build-required
- create-git-tag-commit
strategy:
fail-fast: false
matrix:

View File

@ -13,6 +13,9 @@ env:
SKIP_YARN_COREPACK_CHECK: 1
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
version:
@ -47,27 +50,33 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
if: github.event_name == 'workflow_dispatch'
with:
profile: minimal
- name: Install cargo-edit
if: github.event_name == 'workflow_dispatch'
uses: taiki-e/install-action@v2
with:
tool: cargo-edit@0.12.2
- name: Install cargo-edit
- name: Install cargo-mono
if: github.event_name == 'workflow_dispatch'
uses: taiki-e/install-action@v2
with:
tool: cargo-mono@0.4.1
- run: cargo bump
if: github.event_name == 'workflow_dispatch'
continue-on-error: true
- uses: webfactory/ssh-agent@v0.9.0
if: github.event_name == 'workflow_dispatch'
with:
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
- name: Push bump commit
if: github.event_name == 'workflow_dispatch'
run: |
git push git@github.com:swc-project/swc.git --no-verify
@ -80,26 +89,30 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
if: github.event_name == 'workflow_dispatch'
- uses: actions-rs/toolchain@v1
if: github.event_name == 'workflow_dispatch'
with:
profile: minimal
- name: Install cargo-edit
if: github.event_name == 'workflow_dispatch'
uses: taiki-e/install-action@v2
with:
tool: cargo-edit@0.12.2
- name: Install cargo-edit
if: github.event_name == 'workflow_dispatch'
uses: taiki-e/install-action@v2
with:
tool: cargo-mono@0.4.1
- name: Update constant of swc_core
if: github.event_name == 'workflow_dispatch'
run: npx ts-node .github/bot/src/cargo/update-constants.ts
- name: Publish crates
# Skip on pull requests
if: github.event_name == 'workflow_dispatch'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
@ -120,11 +133,26 @@ jobs:
run: |
npx ts-node .github/bot/src/nightly-version.ts ${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
publish-npm-nightly:
name: "Publish ${{ needs.determine-nightly-version.outputs.version }}"
git-tag-nightly:
name: "Git tag nightly"
runs-on: ubuntu-latest
needs:
- publish-cargo
- determine-nightly-version
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/tag-git-release
with:
version: ${{ needs.determine-nightly-version.outputs.version }}
publish-core-nightly:
if: github.event_name == 'workflow_dispatch'
name: "Publish ${{ needs.determine-nightly-version.outputs.version }}"
needs:
- git-tag-nightly
- publish-cargo
- determine-nightly-version
uses: ./.github/workflows/publish-npm-package.yml
secrets: inherit
with:
@ -132,13 +160,30 @@ jobs:
version: ${{ needs.determine-nightly-version.outputs.version }}
buildCli: true
skipBuild: ${{ inputs.skipBuild || false }}
skipPublishing: false
skipPublishing: ${{ github.event_name == 'pull_request' }}
publish-html-nightly:
name: "Publish html@${{ needs.determine-nightly-version.outputs.version }}"
needs:
- git-tag-nightly
- publish-cargo
- determine-nightly-version
uses: ./.github/workflows/publish-npm-package.yml
secrets: inherit
with:
package: "html"
version: ${{ needs.determine-nightly-version.outputs.version }}
buildCli: false
skipBuild: ${{ inputs.skipBuild || false }}
skipPublishing: ${{ github.event_name == 'pull_request' }}
run-ecosystem-ci-with-nightly:
name: "Test nightly using ecosystem CI"
needs:
- determine-nightly-version
- publish-npm-nightly
- publish-core-nightly
uses: ./.github/workflows/ecosystem-ci.yml
with:
version: ${{ needs.determine-nightly-version.outputs.version }}
@ -146,8 +191,21 @@ jobs:
suites: '["_"]'
allowBreakingWasm: ${{ inputs.allowBreakingWasm || false }}
publish-npm-stable:
git-tag-stable:
name: "Git tag stable"
runs-on: ubuntu-latest
needs:
- publish-cargo
- run-ecosystem-ci-with-nightly
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/tag-git-release
with:
version: ${{ inputs.version }}
publish-core-stable:
name: "Publish ${{ inputs.version || 'stable' }} to npm"
needs:
- publish-cargo
- run-ecosystem-ci-with-nightly
@ -159,5 +217,4 @@ jobs:
version: ${{ inputs.version }}
buildCli: true
skipBuild: ${{ inputs.skipBuild || inputs.onlyNightly || false }}
# Skip on pull requests
skipPublishing: ${{ inputs.onlyNightly }}
skipPublishing: ${{ github.event_name == 'pull_request' }}

485
bindings/Cargo.lock generated
View File

@ -102,9 +102,9 @@ checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a"
[[package]]
name = "arrayvec"
version = "0.7.4"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "ast_node"
@ -115,7 +115,7 @@ dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -126,7 +126,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -157,7 +157,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -248,6 +248,28 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "binding_html_node"
version = "0.1.0"
dependencies = [
"anyhow",
"napi",
"napi-build",
"napi-derive",
"serde",
"serde_json",
"swc_atoms",
"swc_cached",
"swc_common",
"swc_error_reporters",
"swc_html",
"swc_html_ast",
"swc_html_minifier",
"swc_nodejs_common",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "binding_macros"
version = "0.76.0"
@ -380,7 +402,7 @@ dependencies = [
"ahash 0.8.11",
"chrono",
"either",
"indexmap 2.2.6",
"indexmap 2.4.0",
"itertools",
"nom",
"once_cell",
@ -438,9 +460,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.6.1"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952"
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
dependencies = [
"serde",
]
@ -488,9 +510,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.1.6"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f"
checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292"
[[package]]
name = "cfg-if"
@ -782,7 +804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
dependencies = [
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -829,7 +851,7 @@ dependencies = [
"ident_case",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -851,7 +873,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
"darling_core 0.20.10",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1009,7 +1031,7 @@ dependencies = [
"darling 0.20.10",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1091,7 +1113,7 @@ checksum = "32016f1242eb82af5474752d00fd8ebcd9004bd69b462b1c91de833972d08ed4"
dependencies = [
"proc-macro2",
"swc_macros_common",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1162,7 +1184,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1357,9 +1379,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hstr"
version = "0.2.10"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96274be293b8877e61974a607105d09c84caebe9620b47774aa8a6b942042dd4"
checksum = "dae404c0c5d4e95d4858876ab02eecd6a196bb8caa42050dfa809938833fc412"
dependencies = [
"hashbrown 0.14.5",
"new_debug_unreachable",
@ -1460,9 +1482,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.2.6"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
dependencies = [
"equivalent",
"hashbrown 0.14.5",
@ -1483,14 +1505,14 @@ dependencies = [
[[package]]
name = "is-macro"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a85abdc13717906baccb5a1e435556ce0df215f242892f721dff62bf25288f"
checksum = "2069faacbe981460232f880d26bf3c7634e322d49053aa48c27e3ae642f728f1"
dependencies = [
"Inflector",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1544,6 +1566,49 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
[[package]]
name = "lexical"
version = "6.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6"
dependencies = [
"lexical-core",
]
[[package]]
name = "lexical-core"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46"
dependencies = [
"lexical-parse-float",
"lexical-parse-integer",
"lexical-util",
"lexical-write-float",
"lexical-write-integer",
]
[[package]]
name = "lexical-parse-float"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f"
dependencies = [
"lexical-parse-integer",
"lexical-util",
"static_assertions",
]
[[package]]
name = "lexical-parse-integer"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9"
dependencies = [
"lexical-util",
"static_assertions",
]
[[package]]
name = "lexical-sort"
version = "0.3.1"
@ -1554,10 +1619,40 @@ dependencies = [
]
[[package]]
name = "libc"
version = "0.2.155"
name = "lexical-util"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc"
dependencies = [
"static_assertions",
]
[[package]]
name = "lexical-write-float"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862"
dependencies = [
"lexical-util",
"lexical-write-integer",
"static_assertions",
]
[[package]]
name = "lexical-write-integer"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446"
dependencies = [
"lexical-util",
"static_assertions",
]
[[package]]
name = "libc"
version = "0.2.157"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "374af5f94e54fa97cf75e945cce8a6b201e88a1a07e688b47dfd2a59c66dbd86"
[[package]]
name = "libloading"
@ -1566,7 +1661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"windows-targets 0.52.6",
"windows-targets 0.48.5",
]
[[package]]
@ -1725,7 +1820,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1802,7 +1897,7 @@ dependencies = [
"napi-derive-backend",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -1817,7 +1912,7 @@ dependencies = [
"quote",
"regex",
"semver 1.0.23",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2048,7 +2143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
dependencies = [
"fixedbitset",
"indexmap 2.2.6",
"indexmap 2.4.0",
]
[[package]]
@ -2081,7 +2176,7 @@ dependencies = [
"phf_shared",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2110,7 +2205,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2133,9 +2228,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
]
[[package]]
name = "preset_env_base"
@ -2341,9 +2439,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.5"
version = "1.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
@ -2565,7 +2663,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2618,9 +2716,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.204"
version = "1.0.208"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2"
dependencies = [
"serde_derive",
]
@ -2659,13 +2757,13 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.204"
version = "1.0.208"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2676,16 +2774,17 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
name = "serde_json"
version = "1.0.120"
version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
@ -2705,7 +2804,7 @@ version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap 2.2.6",
"indexmap 2.4.0",
"itoa",
"ryu",
"serde",
@ -2917,7 +3016,7 @@ checksum = "9cf483ea7e0e3a03d1b91687895814425149ad77facd3e2b6839dde26da98454"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2935,7 +3034,7 @@ dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -2954,7 +3053,7 @@ dependencies = [
"base64",
"dashmap",
"either",
"indexmap 2.2.6",
"indexmap 2.4.0",
"jsonc-parser",
"lru",
"napi",
@ -3035,7 +3134,7 @@ dependencies = [
"anyhow",
"crc",
"dashmap",
"indexmap 2.2.6",
"indexmap 2.4.0",
"is-macro",
"once_cell",
"parking_lot",
@ -3170,7 +3269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4740e53eaf68b101203c1df0937d5161a29f3c13bceed0836ddfe245b72dd000"
dependencies = [
"anyhow",
"indexmap 2.2.6",
"indexmap 2.4.0",
"serde",
"serde_json",
"sourcemap 9.0.0",
@ -3187,7 +3286,7 @@ dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -3218,6 +3317,102 @@ dependencies = [
"vergen",
]
[[package]]
name = "swc_css_ast"
version = "0.144.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "931a3c25a6bae42537783eab131b34d8fd2913d14f975106ceb3287716072ee0"
dependencies = [
"is-macro",
"string_enum",
"swc_atoms",
"swc_common",
]
[[package]]
name = "swc_css_codegen"
version = "0.155.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09080a69fd9c07d76141f02c9d2826e46f08ffab5fdb8942cd8a95f38712f038"
dependencies = [
"auto_impl",
"bitflags 2.6.0",
"rustc-hash",
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
"swc_css_codegen_macros",
"swc_css_utils",
]
[[package]]
name = "swc_css_codegen_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de2ece8c7dbdde85aa1bcc9764c5f41f7450d8bf1312eac2375b8dc0ecbc13d7"
dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.75",
]
[[package]]
name = "swc_css_minifier"
version = "0.120.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3db2730dce248bf3ebab2d39885e7494b14a74279f93afcef4054c19aca61d17"
dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
"swc_css_utils",
"swc_css_visit",
]
[[package]]
name = "swc_css_parser"
version = "0.154.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02babeae8d3a1dad9858e6ade577b27cc463f8eb60139df0d05d58605e6c0554"
dependencies = [
"lexical",
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
]
[[package]]
name = "swc_css_utils"
version = "0.141.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28e930b27b85b95329f29b1fa36be032fb9bd04f20b0a7180c9c0fc19a368979"
dependencies = [
"once_cell",
"serde",
"serde_json",
"swc_atoms",
"swc_common",
"swc_css_ast",
"swc_css_visit",
]
[[package]]
name = "swc_css_visit"
version = "0.143.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7de0c51931641e580a68dab2c7f04940475d396b23f403062e6064abfac5020"
dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_css_ast",
"swc_visit",
]
[[package]]
name = "swc_ecma_ast"
version = "0.118.2"
@ -3266,7 +3461,7 @@ dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -3306,7 +3501,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dade6e0c6e8ddb61281fee2331c3775a920c31535b91e8cace2e0c4eed6158d3"
dependencies = [
"arrayvec",
"indexmap 2.2.6",
"indexmap 2.4.0",
"is-macro",
"serde",
"serde_derive",
@ -3526,7 +3721,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13ee1a0975dc79d2cb23456bf45c7862b61f9a8890ade3025af8dc728e730db"
dependencies = [
"arrayvec",
"indexmap 2.2.6",
"indexmap 2.4.0",
"num-bigint",
"num_cpus",
"once_cell",
@ -3585,7 +3780,7 @@ checksum = "e5c01c4097d54b6992d926474546472f10f1f94799a6eb9b70176fc33e778573"
dependencies = [
"anyhow",
"dashmap",
"indexmap 2.2.6",
"indexmap 2.4.0",
"once_cell",
"preset_env_base",
"rustc-hash",
@ -3630,7 +3825,7 @@ checksum = "7c0a71579d030e12fd3cfbfc8712c4ce21afc526f2a759903c77d8df61950f5e"
dependencies = [
"better_scoped_tls",
"bitflags 2.6.0",
"indexmap 2.2.6",
"indexmap 2.4.0",
"once_cell",
"phf",
"rayon",
@ -3667,7 +3862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bb500b65423646da940e289ad37e7c88332d7194248c33fc63a9e768e104fe5"
dependencies = [
"arrayvec",
"indexmap 2.2.6",
"indexmap 2.4.0",
"is-macro",
"num-bigint",
"rayon",
@ -3706,7 +3901,7 @@ dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -3718,7 +3913,7 @@ dependencies = [
"Inflector",
"anyhow",
"bitflags 2.6.0",
"indexmap 2.2.6",
"indexmap 2.4.0",
"is-macro",
"path-clean 1.0.1",
"pathdiff",
@ -3743,7 +3938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc9b6dcb79ac6f396988c13ce2f782116aeb92e8ee77656072d1146697f66022"
dependencies = [
"dashmap",
"indexmap 2.2.6",
"indexmap 2.4.0",
"once_cell",
"petgraph",
"rayon",
@ -3789,7 +3984,7 @@ checksum = "c3e54a8c87d90812bf69b0f07931bb629111a3f24efe83b9190c3a40a5ebc25e"
dependencies = [
"base64",
"dashmap",
"indexmap 2.2.6",
"indexmap 2.4.0",
"once_cell",
"rayon",
"serde",
@ -3830,7 +4025,7 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b04b74fc4525b03d1402018ca00855c10421631e4bbda4e202fc877d801acfa"
dependencies = [
"indexmap 2.2.6",
"indexmap 2.4.0",
"rustc-hash",
"swc_atoms",
"swc_common",
@ -3847,7 +4042,7 @@ version = "0.134.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde8f1ef3f7bd53340c7bd679f1ec563a45225ac8fb63f22d6de1ff4b345475d"
dependencies = [
"indexmap 2.2.6",
"indexmap 2.4.0",
"num_cpus",
"once_cell",
"rayon",
@ -3885,7 +4080,7 @@ checksum = "63db0adcff29d220c3d151c5b25c0eabe7e32dd936212b84cdaa1392e3130497"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -3907,7 +4102,7 @@ version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "357e2c97bb51431d65080f25b436bc4e2fc1a7f64a643bc21a8353e478dc799f"
dependencies = [
"indexmap 2.2.6",
"indexmap 2.4.0",
"petgraph",
"rustc-hash",
"swc_common",
@ -3945,6 +4140,127 @@ dependencies = [
"tracing",
]
[[package]]
name = "swc_html"
version = "0.148.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "706509020207c5e4dc17e9c6c3adcec901ec5e0d06314050643c3efce8be7fb7"
dependencies = [
"swc_html_ast",
"swc_html_codegen",
"swc_html_minifier",
"swc_html_parser",
"swc_html_visit",
]
[[package]]
name = "swc_html_ast"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c425a3a19e94bd40f94da719691e19be6187a65e1fe6b294fd4d065e841c8e9"
dependencies = [
"is-macro",
"serde",
"string_enum",
"swc_atoms",
"swc_common",
]
[[package]]
name = "swc_html_codegen"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ade76d2999f98677284d1a961b41cf8f9405cfe492531164ead3d1c6796c768"
dependencies = [
"auto_impl",
"bitflags 2.6.0",
"rustc-hash",
"swc_atoms",
"swc_common",
"swc_html_ast",
"swc_html_codegen_macros",
"swc_html_utils",
]
[[package]]
name = "swc_html_codegen_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e593a6cbb3a49230fbab3171d4493f7d0fb1e20a34d9a9f9e972550690408ba8"
dependencies = [
"proc-macro2",
"quote",
"swc_macros_common",
"syn 2.0.75",
]
[[package]]
name = "swc_html_minifier"
version = "0.145.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f944d0cf2352767ddee5f65a02c73dadcd2050a75eab8bee45a30f80b318199f"
dependencies = [
"once_cell",
"serde",
"serde_json",
"swc_atoms",
"swc_cached",
"swc_common",
"swc_css_ast",
"swc_css_codegen",
"swc_css_minifier",
"swc_css_parser",
"swc_ecma_ast",
"swc_ecma_codegen",
"swc_ecma_minifier",
"swc_ecma_parser",
"swc_ecma_transforms_base",
"swc_ecma_visit",
"swc_html_ast",
"swc_html_codegen",
"swc_html_parser",
"swc_html_utils",
"swc_html_visit",
]
[[package]]
name = "swc_html_parser"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34cff1743fcfe3f83df6c4f65fa769f991d18372b38b578dc1192560f4b2037"
dependencies = [
"swc_atoms",
"swc_common",
"swc_html_ast",
"swc_html_utils",
]
[[package]]
name = "swc_html_utils"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5153f5769f3425ecb6ec5f9d26166b5a9e837732450e07db8c4fd9a2c809456f"
dependencies = [
"once_cell",
"serde",
"serde_json",
"swc_atoms",
"swc_common",
]
[[package]]
name = "swc_html_visit"
version = "0.37.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07c70421acb2813335cba6c6c99b0013a8d60e8e1e6b74b8b67132c795150f5f"
dependencies = [
"serde",
"swc_atoms",
"swc_common",
"swc_html_ast",
"swc_visit",
]
[[package]]
name = "swc_macros_common"
version = "0.3.13"
@ -3953,7 +4269,7 @@ checksum = "f486687bfb7b5c560868f69ed2d458b880cebc9babebcb67e49f31b55c5bf847"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -4075,7 +4391,7 @@ checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -4126,9 +4442,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.71"
version = "2.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462"
checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9"
dependencies = [
"proc-macro2",
"quote",
@ -4237,7 +4553,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -4337,7 +4653,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -4404,7 +4720,7 @@ version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.2.6",
"indexmap 2.4.0",
"serde",
"serde_spanned",
"toml_datetime",
@ -4417,7 +4733,7 @@ version = "0.22.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788"
dependencies = [
"indexmap 2.2.6",
"indexmap 2.4.0",
"serde",
"serde_spanned",
"toml_datetime",
@ -4444,7 +4760,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]
[[package]]
@ -4666,9 +4982,9 @@ dependencies = [
[[package]]
name = "version_check"
version = "0.9.4"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "virtual-fs"
@ -4871,7 +5187,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
"wasm-bindgen-shared",
]
@ -4905,7 +5221,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -5024,7 +5340,7 @@ dependencies = [
"bytesize",
"derive_builder",
"hex",
"indexmap 2.2.6",
"indexmap 2.4.0",
"schemars",
"semver 1.0.23",
"serde",
@ -5046,7 +5362,7 @@ dependencies = [
"bytesize",
"derive_builder",
"hex",
"indexmap 2.2.6",
"indexmap 2.4.0",
"schemars",
"semver 1.0.23",
"serde",
@ -5243,7 +5559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab"
dependencies = [
"bitflags 2.6.0",
"indexmap 2.2.6",
"indexmap 2.4.0",
"semver 1.0.23",
]
@ -5590,6 +5906,7 @@ version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
]
@ -5601,5 +5918,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.71",
"syn 2.0.75",
]

View File

@ -2,6 +2,7 @@
members = [
"binding_core_node",
"binding_core_wasm",
"binding_html_node",
"binding_minifier_node",
"binding_minifier_wasm",
"binding_typescript_wasm",
@ -22,6 +23,8 @@ resolver = "2"
serde-wasm-bindgen = "0.6.5"
serde_json = "1.0.120"
sourcemap = "8.0.1"
swc_atoms = "0.6.5"
swc_cached = "0.3.18"
swc_cli_impl = "0.19.0"
swc_common = "0.37.4"
swc_compiler_base = "0.18.1"
@ -29,6 +32,9 @@ resolver = "2"
swc_core = "0.101.3"
swc_error_reporters = "0.21.0"
swc_fast_ts_strip = "0.6.1"
swc_html = "0.148.0"
swc_html_ast = "0.37.0"
swc_html_minifier = "0.145.0"
swc_malloc = "0.5.11"
swc_nodejs_common = "0.0.8"
tracing = "0.1.40"

View File

@ -0,0 +1,35 @@
[package]
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
build = "build.rs"
edition = "2021"
exclude = ["artifacts.json", "index.node"]
license = "Apache-2.0"
name = "binding_html_node"
publish = false
version = "0.1.0"
[lib]
bench = false
crate-type = ["cdylib"]
[features]
[build-dependencies]
napi-build = { workspace = true }
[dependencies]
anyhow = { workspace = true }
napi = { workspace = true, features = ["napi3", "serde-json"] }
napi-derive = { workspace = true, features = ["type-def"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
swc_atoms = { workspace = true }
swc_cached = { workspace = true }
swc_common = { workspace = true, features = ["diagnostic-serde"] }
swc_error_reporters = { workspace = true }
swc_html = { workspace = true, features = ["minifier"] }
swc_html_ast = { workspace = true, features = ["serde"] }
swc_html_minifier = { workspace = true }
swc_nodejs_common = { workspace = true }
tracing = { workspace = true, features = ["release_max_level_info"] }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

View File

@ -0,0 +1,23 @@
use std::{
env,
fs::File,
io::{BufWriter, Write},
path::Path,
};
extern crate napi_build;
fn main() {
let out_dir = env::var("OUT_DIR").expect("Out dir should exist");
let dest_path = Path::new(&out_dir).join("triple.txt");
let mut f =
BufWriter::new(File::create(dest_path).expect("Failed to create target triple text"));
write!(
f,
"{}",
env::var("TARGET").expect("Target should be specified")
)
.expect("Failed to write target triple text");
napi_build::setup();
}

View File

@ -0,0 +1,510 @@
#[macro_use]
extern crate napi_derive;
mod util;
use std::{backtrace::Backtrace, env, panic::set_hook};
use anyhow::{bail, Context};
use napi::{bindgen_prelude::*, Task};
use serde::{Deserialize, Serialize};
use swc_atoms::js_word;
use swc_cached::regex::CachedRegex;
use swc_common::{FileName, DUMMY_SP};
use swc_html::{
ast::{DocumentMode, Namespace},
codegen::{
writer::basic::{BasicHtmlWriter, BasicHtmlWriterConfig},
CodeGenerator, CodegenConfig, Emit,
},
parser::{parse_file_as_document, parse_file_as_document_fragment},
};
use swc_html_ast::{Document, DocumentFragment};
use swc_html_minifier::{
minify_document, minify_document_fragment,
option::{
CollapseWhitespaces, MinifierType, MinifyCssOption, MinifyJsOption, MinifyJsonOption,
RemoveRedundantAttributes,
},
};
use swc_nodejs_common::{deserialize_json, get_deserialized, MapErr};
use crate::util::try_with;
#[napi::module_init]
fn init() {
if cfg!(debug_assertions) || env::var("SWC_DEBUG").unwrap_or_default() == "1" {
set_hook(Box::new(|panic_info| {
let backtrace = Backtrace::force_capture();
println!("Panic: {:?}\nBacktrace: {:?}", panic_info, backtrace);
}));
}
}
#[napi_derive::napi(object)]
#[derive(Debug, Serialize)]
pub struct Diagnostic {
pub level: String,
pub message: String,
pub span: serde_json::Value,
}
#[napi_derive::napi(object)]
#[derive(Debug, Serialize)]
pub struct TransformOutput {
pub code: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub errors: Option<Vec<Diagnostic>>,
}
struct MinifyTask {
code: String,
options: String,
is_fragment: bool,
}
#[napi_derive::napi(object)]
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Attribute {
#[serde(default)]
pub namespace: Option<String>,
#[serde(default)]
pub prefix: Option<String>,
pub name: String,
#[serde(default)]
pub value: Option<String>,
}
#[napi_derive::napi(object)]
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Element {
pub tag_name: String,
pub namespace: String,
pub attributes: Vec<Attribute>,
pub is_self_closing: bool,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MinifyOptions {
#[serde(default)]
filename: Option<String>,
// Parser options
#[serde(default)]
iframe_srcdoc: bool,
#[serde(default)]
scripting_enabled: bool,
/// Used only for Document Fragment
/// Default: NoQuirks
#[serde(default)]
mode: Option<DocumentMode>,
/// Used only for Document Fragment
/// Default: `template` in HTML namespace
#[serde(default)]
context_element: Option<Element>,
/// Used only for Document Fragment
/// Default: None
#[serde(default)]
form_element: Option<Element>,
// Minification options
#[serde(default)]
force_set_html5_doctype: bool,
#[serde(default = "default_collapse_whitespaces")]
collapse_whitespaces: CollapseWhitespaces,
// Remove safe empty elements with metadata content, i.e. the `script` and `style` element
// without content and attributes, `meta` and `link` elements without attributes and etc
#[serde(default = "true_by_default")]
remove_empty_metadata_elements: bool,
#[serde(default = "true_by_default")]
remove_comments: bool,
#[serde(default = "default_preserve_comments")]
preserve_comments: Option<Vec<CachedRegex>>,
#[serde(default = "true_by_default")]
minify_conditional_comments: bool,
#[serde(default = "true_by_default")]
remove_empty_attributes: bool,
#[serde(default)]
remove_redundant_attributes: RemoveRedundantAttributes,
#[serde(default = "true_by_default")]
collapse_boolean_attributes: bool,
#[serde(default = "true_by_default")]
normalize_attributes: bool,
#[serde(default = "minify_json_by_default")]
minify_json: MinifyJsonOption,
#[serde(default = "minify_js_by_default")]
minify_js: MinifyJsOption,
#[serde(default = "minify_css_by_default")]
minify_css: MinifyCssOption,
#[serde(default)]
minify_additional_scripts_content: Option<Vec<(CachedRegex, MinifierType)>>,
#[serde(default)]
minify_additional_attributes: Option<Vec<(CachedRegex, MinifierType)>>,
#[serde(default = "true_by_default")]
sort_space_separated_attribute_values: bool,
#[serde(default)]
sort_attributes: bool,
#[serde(default = "true_by_default")]
merge_metadata_elements: bool,
// Codegen options
#[serde(default)]
tag_omission: Option<bool>,
#[serde(default)]
self_closing_void_elements: Option<bool>,
#[serde(default)]
quotes: Option<bool>,
}
const fn true_by_default() -> bool {
true
}
const fn minify_json_by_default() -> MinifyJsonOption {
MinifyJsonOption::Bool(true)
}
const fn minify_js_by_default() -> MinifyJsOption {
MinifyJsOption::Bool(true)
}
const fn minify_css_by_default() -> MinifyCssOption {
MinifyCssOption::Bool(true)
}
fn default_preserve_comments() -> Option<Vec<CachedRegex>> {
Some(vec![
// License comments
CachedRegex::new("@preserve").unwrap(),
CachedRegex::new("@copyright").unwrap(),
CachedRegex::new("@lic").unwrap(),
CachedRegex::new("@cc_on").unwrap(),
// Allow to keep custom comments
CachedRegex::new("^!").unwrap(),
// Server-side comments
CachedRegex::new("^\\s*#").unwrap(),
// Conditional IE comments
CachedRegex::new("^\\[if\\s[^\\]+]").unwrap(),
CachedRegex::new("\\[endif]").unwrap(),
])
}
const fn default_collapse_whitespaces() -> CollapseWhitespaces {
CollapseWhitespaces::OnlyMetadata
}
#[napi]
impl Task for MinifyTask {
type JsValue = TransformOutput;
type Output = TransformOutput;
fn compute(&mut self) -> napi::Result<Self::Output> {
let opts = deserialize_json(&self.options)
.context("failed to deserialize minifier options")
.convert_err()?;
minify_inner(&self.code, opts, self.is_fragment).convert_err()
}
fn resolve(&mut self, _env: napi::Env, output: Self::Output) -> napi::Result<Self::JsValue> {
Ok(output)
}
}
enum DocumentOrDocumentFragment {
Document(Document),
DocumentFragment(DocumentFragment),
}
fn create_namespace(namespace: &str) -> anyhow::Result<Namespace> {
match &*namespace.to_lowercase() {
"http://www.w3.org/1999/xhtml" => Ok(Namespace::HTML),
"http://www.w3.org/1998/math/mathml" => Ok(Namespace::MATHML),
"http://www.w3.org/2000/svg" => Ok(Namespace::SVG),
"http://www.w3.org/1999/xlink" => Ok(Namespace::XLINK),
"http://www.w3.org/xml/1998/namespace" => Ok(Namespace::XML),
"http://www.w3.org/2000/xmlns/" => Ok(Namespace::XMLNS),
_ => {
bail!("failed to parse namespace of context element")
}
}
}
fn create_element(context_element: Element) -> anyhow::Result<swc_html_ast::Element> {
let mut attributes = Vec::with_capacity(context_element.attributes.len());
for attribute in context_element.attributes.into_iter() {
let namespace = match attribute.namespace {
Some(namespace) => Some(create_namespace(&namespace)?),
_ => None,
};
attributes.push(swc_html_ast::Attribute {
span: DUMMY_SP,
namespace,
prefix: attribute.prefix.map(|value| value.into()),
name: attribute.name.into(),
raw_name: None,
value: attribute.value.map(|value| value.into()),
raw_value: None,
})
}
Ok(swc_html_ast::Element {
span: DUMMY_SP,
tag_name: context_element.tag_name.into(),
namespace: create_namespace(&context_element.namespace)?,
attributes,
children: vec![],
content: None,
is_self_closing: context_element.is_self_closing,
})
}
fn minify_inner(
code: &str,
opts: MinifyOptions,
is_fragment: bool,
) -> anyhow::Result<TransformOutput> {
swc_common::GLOBALS.set(&swc_common::Globals::new(), || {
try_with(|cm, handler| {
let filename = match opts.filename {
Some(v) => FileName::Real(v.into()),
None => FileName::Anon,
};
let fm = cm.new_source_file(filename, code.into());
let scripting_enabled = opts.scripting_enabled;
let mut errors = vec![];
let (mut document_or_document_fragment, context_element) = if is_fragment {
let context_element = match opts.context_element {
Some(context_element) => create_element(context_element)?,
_ => swc_html_ast::Element {
span: DUMMY_SP,
tag_name: js_word!("template"),
namespace: Namespace::HTML,
attributes: vec![],
children: vec![],
content: None,
is_self_closing: false,
},
};
let mode = match opts.mode {
Some(mode) => mode,
_ => DocumentMode::NoQuirks,
};
let form_element = match opts.form_element {
Some(form_element) => Some(create_element(form_element)?),
_ => None,
};
let document_fragment = parse_file_as_document_fragment(
&fm,
&context_element,
mode,
form_element.as_ref(),
swc_html::parser::parser::ParserConfig {
scripting_enabled,
iframe_srcdoc: opts.iframe_srcdoc,
..Default::default()
},
&mut errors,
);
let document_fragment = match document_fragment {
Ok(v) => v,
Err(err) => {
err.to_diagnostics(handler).emit();
for err in errors {
err.to_diagnostics(handler).emit();
}
bail!("failed to parse input as document fragment")
}
};
(
DocumentOrDocumentFragment::DocumentFragment(document_fragment),
Some(context_element),
)
} else {
let document = parse_file_as_document(
&fm,
swc_html::parser::parser::ParserConfig {
scripting_enabled,
iframe_srcdoc: opts.iframe_srcdoc,
..Default::default()
},
&mut errors,
);
let document = match document {
Ok(v) => v,
Err(err) => {
err.to_diagnostics(handler).emit();
for err in errors {
err.to_diagnostics(handler).emit();
}
bail!("failed to parse input as document")
}
};
(DocumentOrDocumentFragment::Document(document), None)
};
let mut returned_errors = None;
if !errors.is_empty() {
returned_errors = Some(Vec::with_capacity(errors.len()));
for err in errors {
let mut buf = vec![];
err.to_diagnostics(handler).buffer(&mut buf);
for i in buf {
returned_errors.as_mut().unwrap().push(Diagnostic {
level: i.level.to_string(),
message: i.message(),
span: serde_json::to_value(&i.span)?,
});
}
}
}
let options = swc_html_minifier::option::MinifyOptions {
force_set_html5_doctype: opts.force_set_html5_doctype,
collapse_whitespaces: opts.collapse_whitespaces,
remove_empty_metadata_elements: opts.remove_empty_metadata_elements,
remove_comments: opts.remove_comments,
preserve_comments: opts.preserve_comments,
minify_conditional_comments: opts.minify_conditional_comments,
remove_empty_attributes: opts.remove_empty_attributes,
remove_redundant_attributes: opts.remove_redundant_attributes,
collapse_boolean_attributes: opts.collapse_boolean_attributes,
normalize_attributes: opts.normalize_attributes,
minify_json: opts.minify_json,
minify_js: opts.minify_js,
minify_css: opts.minify_css,
minify_additional_scripts_content: opts.minify_additional_scripts_content,
minify_additional_attributes: opts.minify_additional_attributes,
sort_space_separated_attribute_values: opts.sort_space_separated_attribute_values,
sort_attributes: opts.sort_attributes,
merge_metadata_elements: opts.merge_metadata_elements,
};
match document_or_document_fragment {
DocumentOrDocumentFragment::Document(ref mut document) => {
minify_document(document, &options);
}
DocumentOrDocumentFragment::DocumentFragment(ref mut document_fragment) => {
minify_document_fragment(
document_fragment,
context_element.as_ref().unwrap(),
&options,
);
}
}
let code = {
let mut buf = String::new();
{
let mut wr = BasicHtmlWriter::new(
&mut buf,
None,
BasicHtmlWriterConfig {
..Default::default()
},
);
let mut gen = CodeGenerator::new(
&mut wr,
CodegenConfig {
minify: true,
scripting_enabled,
context_element: context_element.as_ref(),
tag_omission: opts.tag_omission,
self_closing_void_elements: opts.self_closing_void_elements,
quotes: opts.quotes,
},
);
match document_or_document_fragment {
DocumentOrDocumentFragment::Document(document) => {
gen.emit(&document).context("failed to emit")?;
}
DocumentOrDocumentFragment::DocumentFragment(document_fragment) => {
gen.emit(&document_fragment).context("failed to emit")?;
}
}
}
buf
};
Ok(TransformOutput {
code,
errors: returned_errors,
})
})
})
}
#[allow(unused)]
#[napi]
fn minify(code: Buffer, opts: Buffer, signal: Option<AbortSignal>) -> AsyncTask<MinifyTask> {
let code = String::from_utf8_lossy(code.as_ref()).to_string();
let options = String::from_utf8_lossy(opts.as_ref()).to_string();
let task = MinifyTask {
code,
options,
is_fragment: false,
};
AsyncTask::with_optional_signal(task, signal)
}
#[allow(unused)]
#[napi]
fn minify_fragment(
code: Buffer,
opts: Buffer,
signal: Option<AbortSignal>,
) -> AsyncTask<MinifyTask> {
let code = String::from_utf8_lossy(code.as_ref()).to_string();
let options = String::from_utf8_lossy(opts.as_ref()).to_string();
let task = MinifyTask {
code,
options,
is_fragment: true,
};
AsyncTask::with_optional_signal(task, signal)
}
#[allow(unused)]
#[napi]
pub fn minify_sync(code: Buffer, opts: Buffer) -> napi::Result<TransformOutput> {
let code = String::from_utf8_lossy(code.as_ref());
let options = get_deserialized(opts)?;
minify_inner(&code, options, false).convert_err()
}
#[allow(unused)]
#[napi]
pub fn minify_fragment_sync(code: Buffer, opts: Buffer) -> napi::Result<TransformOutput> {
let code = String::from_utf8_lossy(code.as_ref());
let options = get_deserialized(opts)?;
minify_inner(&code, options, true).convert_err()
}

View File

@ -0,0 +1,35 @@
use anyhow::{anyhow, Error};
use swc_common::{errors::Handler, sync::Lrc, FilePathMapping, SourceMap};
use swc_error_reporters::handler::{try_with_handler, HandlerOpts};
pub fn try_with<F, Ret>(op: F) -> Result<Ret, Error>
where
F: FnOnce(&Lrc<SourceMap>, &Handler) -> Result<Ret, Error>,
{
let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
try_with_handler(
cm.clone(),
HandlerOpts {
skip_filename: false,
..Default::default()
},
|handler| {
//
let result =
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| op(&cm, handler)));
let p = match result {
Ok(v) => return v,
Err(v) => v,
};
if let Some(s) = p.downcast_ref::<String>() {
Err(anyhow!("failed to handle: {}", s))
} else if let Some(s) = p.downcast_ref::<&str>() {
Err(anyhow!("failed to handle: {}", s))
} else {
Err(anyhow!("failed to handle with unknown panic message"))
}
},
)
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/core-darwin-arm64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "swc.darwin-arm64.node",
"files": [
"swc.darwin-arm64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-darwin-arm64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "swc.darwin-arm64.node",
"files": [
"swc.darwin-arm64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/core-darwin-x64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "swc.darwin-x64.node",
"files": [
"swc.darwin-x64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-darwin-x64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "swc.darwin-x64.node",
"files": [
"swc.darwin-x64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/core-linux-arm-gnueabihf",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "swc.linux-arm-gnueabihf.node",
"files": [
"swc.linux-arm-gnueabihf.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-linux-arm-gnueabihf",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "swc.linux-arm-gnueabihf.node",
"files": [
"swc.linux-arm-gnueabihf.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/core-linux-arm64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "swc.linux-arm64-gnu.node",
"files": [
"swc.linux-arm64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-linux-arm64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "swc.linux-arm64-gnu.node",
"files": [
"swc.linux-arm64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/core-linux-arm64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "swc.linux-arm64-musl.node",
"files": [
"swc.linux-arm64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-linux-arm64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "swc.linux-arm64-musl.node",
"files": [
"swc.linux-arm64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/core-linux-x64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "swc.linux-x64-gnu.node",
"files": [
"swc.linux-x64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-linux-x64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "swc.linux-x64-gnu.node",
"files": [
"swc.linux-x64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/core-linux-x64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "swc.linux-x64-musl.node",
"files": [
"swc.linux-x64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-linux-x64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "swc.linux-x64-musl.node",
"files": [
"swc.linux-x64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/core-win32-arm64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "swc.win32-arm64-msvc.node",
"files": [
"swc.win32-arm64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-win32-arm64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "swc.win32-arm64-msvc.node",
"files": [
"swc.win32-arm64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/core-win32-ia32-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "swc.win32-ia32-msvc.node",
"files": [
"swc.win32-ia32-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-win32-ia32-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "swc.win32-ia32-msvc.node",
"files": [
"swc.win32-ia32-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/core-win32-x64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "swc.win32-x64-msvc.node",
"files": [
"swc.win32-x64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/core-win32-x64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "swc.win32-x64-msvc.node",
"files": [
"swc.win32-x64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

2
packages/html/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/*.js
!binding.js

71
packages/html/.npmignore Normal file
View File

@ -0,0 +1,71 @@
target/
native/index.node
native/artifacts.json
**/*~
**/node_modules
**/.DS_Store
artifacts/
pkg/
yarn.lock
package-lock.json
*.log
.idea/
docs/
wasm/
# Reduce package size
**/tests.rs
**/tests/
**/benches/
**/target/
*.svg
# napi is cool
*.rs
/scripts/npm
/native/
/src
/.vscode
/ecmascript/transforms/src/helpers
/node-swc/__tests__/
/*.node
atoms
bundler
Cargo.lock
Cargo.toml
common
CONTRIBUTING.md
ecmascript
macros
node
node-swc
examples
scripts
spack
testing
ARCHITECTURE.md
tsconfig.json
rust-toolchain
.github
.cargo
.gitmodules
.rustfmt.toml
.gitattributes
.travis.yml
.husky/
.prettierrc
crates/
packages/
cspell.json
deny.toml
.mocha.setup.js
.mocharc.js
jest.config.js
cliff.toml
.kodiak.toml
clippy.toml
.tsbuildinfo

71
packages/html/binding.d.ts vendored Normal file
View File

@ -0,0 +1,71 @@
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface Diagnostic {
level: string;
message: string;
span: any;
}
export interface TransformOutput {
code: string;
errors?: Array<Diagnostic>;
}
export interface Attribute {
namespace?: string;
prefix?: string;
name: string;
value?: string;
}
export interface Element {
tagName: string;
namespace: string;
attributes: Array<Attribute>;
isSelfClosing: boolean;
}
export function minify(
code: Buffer,
opts: Buffer,
signal?: AbortSignal | undefined | null
): Promise<TransformOutput>;
export function minifyFragment(
code: Buffer,
opts: Buffer,
signal?: AbortSignal | undefined | null
): Promise<TransformOutput>;
export function minifySync(code: Buffer, opts: Buffer): TransformOutput;
export function minifyFragmentSync(code: Buffer, opts: Buffer): TransformOutput;
export interface Diagnostic {
level: string;
message: string;
span: any;
}
export interface TransformOutput {
code: string;
errors?: Array<Diagnostic>;
}
export interface Attribute {
namespace?: string;
prefix?: string;
name: string;
value?: string;
}
export interface Element {
tagName: string;
namespace: string;
attributes: Array<Attribute>;
isSelfClosing: boolean;
}
export function minify(
code: Buffer,
opts: Buffer,
signal?: AbortSignal | undefined | null
): Promise<TransformOutput>;
export function minifyFragment(
code: Buffer,
opts: Buffer,
signal?: AbortSignal | undefined | null
): Promise<TransformOutput>;
export function minifySync(code: Buffer, opts: Buffer): TransformOutput;
export function minifyFragmentSync(code: Buffer, opts: Buffer): TransformOutput;

284
packages/html/binding.js Normal file
View File

@ -0,0 +1,284 @@
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require("path");
const { platform, arch } = process;
let nativeBinding = null;
let localFileExisted = false;
let loadError = null;
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== "function") {
try {
const lddPath = require("child_process")
.execSync("which ldd")
.toString()
.trim();
return readFileSync(lddPath, "utf8").includes("musl");
} catch (e) {
return true;
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header;
return !glibcVersionRuntime;
}
}
switch (platform) {
case "android":
switch (arch) {
case "arm64":
localFileExisted = existsSync(
join(__dirname, "html.android-arm64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.android-arm64.node");
} else {
nativeBinding = require("@swc/html-android-arm64");
}
} catch (e) {
loadError = e;
}
break;
case "arm":
localFileExisted = existsSync(
join(__dirname, "html.android-arm-eabi.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.android-arm-eabi.node");
} else {
nativeBinding = require("@swc/html-android-arm-eabi");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Android ${arch}`);
}
break;
case "win32":
switch (arch) {
case "x64":
localFileExisted = existsSync(
join(__dirname, "html.win32-x64-msvc.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.win32-x64-msvc.node");
} else {
nativeBinding = require("@swc/html-win32-x64-msvc");
}
} catch (e) {
loadError = e;
}
break;
case "ia32":
localFileExisted = existsSync(
join(__dirname, "html.win32-ia32-msvc.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.win32-ia32-msvc.node");
} else {
nativeBinding = require("@swc/html-win32-ia32-msvc");
}
} catch (e) {
loadError = e;
}
break;
case "arm64":
localFileExisted = existsSync(
join(__dirname, "html.win32-arm64-msvc.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.win32-arm64-msvc.node");
} else {
nativeBinding = require("@swc/html-win32-arm64-msvc");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`);
}
break;
case "darwin":
localFileExisted = existsSync(
join(__dirname, "html.darwin-universal.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.darwin-universal.node");
} else {
nativeBinding = require("@swc/html-darwin-universal");
}
break;
} catch {}
switch (arch) {
case "x64":
localFileExisted = existsSync(
join(__dirname, "html.darwin-x64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.darwin-x64.node");
} else {
nativeBinding = require("@swc/html-darwin-x64");
}
} catch (e) {
loadError = e;
}
break;
case "arm64":
localFileExisted = existsSync(
join(__dirname, "html.darwin-arm64.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.darwin-arm64.node");
} else {
nativeBinding = require("@swc/html-darwin-arm64");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`);
}
break;
case "freebsd":
if (arch !== "x64") {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
}
localFileExisted = existsSync(join(__dirname, "html.freebsd-x64.node"));
try {
if (localFileExisted) {
nativeBinding = require("./html.freebsd-x64.node");
} else {
nativeBinding = require("@swc/html-freebsd-x64");
}
} catch (e) {
loadError = e;
}
break;
case "linux":
switch (arch) {
case "x64":
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, "html.linux-x64-musl.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.linux-x64-musl.node");
} else {
nativeBinding = require("@swc/html-linux-x64-musl");
}
} catch (e) {
loadError = e;
}
} else {
localFileExisted = existsSync(
join(__dirname, "html.linux-x64-gnu.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.linux-x64-gnu.node");
} else {
nativeBinding = require("@swc/html-linux-x64-gnu");
}
} catch (e) {
loadError = e;
}
}
break;
case "arm64":
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, "html.linux-arm64-musl.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.linux-arm64-musl.node");
} else {
nativeBinding = require("@swc/html-linux-arm64-musl");
}
} catch (e) {
loadError = e;
}
} else {
localFileExisted = existsSync(
join(__dirname, "html.linux-arm64-gnu.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.linux-arm64-gnu.node");
} else {
nativeBinding = require("@swc/html-linux-arm64-gnu");
}
} catch (e) {
loadError = e;
}
}
break;
case "arm":
localFileExisted = existsSync(
join(__dirname, "html.linux-arm-gnueabihf.node")
);
try {
if (localFileExisted) {
nativeBinding = require("./html.linux-arm-gnueabihf.node");
} else {
nativeBinding = require("@swc/html-linux-arm-gnueabihf");
}
} catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`);
}
break;
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
}
if (!nativeBinding) {
if (loadError) {
throw loadError;
}
throw new Error(`Failed to load native binding`);
}
const {
minify,
minifyFragment,
minifySync,
minifyFragmentSync,
minify,
minifyFragment,
minifySync,
minifyFragmentSync,
} = nativeBinding;
module.exports.minify = minify;
module.exports.minifyFragment = minifyFragment;
module.exports.minifySync = minifySync;
module.exports.minifyFragmentSync = minifyFragmentSync;
module.exports.minify = minify;
module.exports.minifyFragment = minifyFragment;
module.exports.minifySync = minifySync;
module.exports.minifyFragmentSync = minifyFragmentSync;

74
packages/html/index.ts Normal file
View File

@ -0,0 +1,74 @@
import * as binding from "./binding";
export type MinifierType = "js-module" | "js-script" | "json" | "css" | "html";
export type Options = {
filename?: string;
iframeSrcdoc?: boolean;
scriptingEnabled?: boolean;
forceSetHtml5Doctype?: boolean;
collapseWhitespaces?:
| "none"
| "all"
| "smart"
| "conservative"
| "advanced-conservative"
| "only-metadata";
removeEmptyMetadataElements?: boolean;
removeComments?: boolean;
preserveComments: string[];
minifyConditionalComments?: boolean;
removeEmptyAttributes?: boolean;
removeRedundantAttributes?: boolean;
collapseBooleanAttributes?: boolean;
normalizeAttributes?: boolean;
minifyJson?: boolean | { pretty?: boolean };
// TODO improve me after typing `@swc/css`
minifyJs?: boolean | { parser?: any; minifier?: any; codegen?: any };
minifyCss?: boolean | { parser?: any; minifier?: any; codegen?: any };
minifyAdditionalScriptsContent?: [string, MinifierType][];
minifyAdditionalAttributes?: [string, MinifierType][];
sortSpaceSeparatedAttributeValues?: boolean;
sortAttributes?: boolean;
tagOmission?: boolean;
selfClosingVoidElements?: boolean;
quotes?: boolean;
};
export type FragmentOptions = Options & {
mode?: "no-quirks" | "limited-quirks" | "quirks";
context_element?: binding.Element;
form_element?: binding.Element;
};
export async function minify(
content: Buffer,
options?: Options
): Promise<binding.TransformOutput> {
return binding.minify(content, toBuffer(options ?? {}));
}
export async function minifyFragment(
content: Buffer,
options?: FragmentOptions
): Promise<binding.TransformOutput> {
return binding.minifyFragment(content, toBuffer(options ?? {}));
}
export function minifySync(
content: Buffer,
options?: Options
): binding.TransformOutput {
return binding.minifySync(content, toBuffer(options ?? {}));
}
export async function minifyFragmentSync(
content: Buffer,
options?: FragmentOptions
): Promise<binding.TransformOutput> {
return binding.minifyFragmentSync(content, toBuffer(options ?? {}));
}
function toBuffer(t: any): Buffer {
return Buffer.from(JSON.stringify(t));
}

View File

@ -0,0 +1,59 @@
{
"name": "@swc/html",
"version": "0.0.29",
"description": "Super-fast alternative for posthtml",
"homepage": "https://swc.rs",
"main": "./index.js",
"author": "강동윤 <kdy1997.dev@gmail.com>",
"license": "Apache-2.0",
"keywords": [
"swc",
"html"
],
"engines": {
"node": ">=14"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"napi": {
"name": "html",
"triples": {
"defaults": true,
"additional": [
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
"aarch64-apple-darwin",
"aarch64-linux-android",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-linux-androideabi"
]
}
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"scripts": {
"artifacts": "napi artifacts --dist scripts/npm",
"prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm",
"pack": "wasm-pack",
"build:ts": "tsc -d",
"build:wasm": "npm-run-all \"pack -- build ./crates/wasm --scope swc {1} -t {2} \" --",
"build": "tsc -d && napi build --platform --cargo-name html_node --js ./binding.js --dts binding.d.ts -p html_node --release --cargo-cwd ../..",
"build:dev": "tsc -d && napi build --platform --cargo-name html_node --js ./binding.js --dts binding.d.ts -p html_node --cargo-cwd ../..",
"test": "echo 'done!'",
"version": "napi version -p scripts/npm"
},
"devDependencies": {
"@napi-rs/cli": "^2.16.1",
"typescript": "^5.1.6"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-android-arm-eabi`
This is the **armv7-linux-androideabi** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-android-arm-eabi",
"version": "1.2.122",
"os": [
"android"
],
"cpu": [
"arm"
],
"main": "html.android-arm-eabi.node",
"files": [
"html.android-arm-eabi.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-android-arm64`
This is the **aarch64-linux-android** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-android-arm64",
"version": "0.0.1",
"os": [
"android"
],
"cpu": [
"arm64"
],
"main": "html.android-arm64.node",
"files": [
"html.android-arm64.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-darwin-arm64",
"version": "0.0.1",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "html.darwin-arm64.node",
"files": [
"html.darwin-arm64.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-darwin-x64`
This is the **x86_64-apple-darwin** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-darwin-x64",
"version": "0.0.1",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "html.darwin-x64.node",
"files": [
"html.darwin-x64.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-freebsd-x64`
This is the **x86_64-unknown-freebsd** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-freebsd-x64",
"version": "0.0.1",
"os": [
"freebsd"
],
"cpu": [
"x64"
],
"main": "html.freebsd-x64.node",
"files": [
"html.freebsd-x64.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-linux-arm-gnueabihf",
"version": "0.0.1",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "html.linux-arm-gnueabihf.node",
"files": [
"html.linux-arm-gnueabihf.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `@swc/html`

View File

@ -0,0 +1,44 @@
{
"name": "@swc/html-linux-arm64-gnu",
"version": "0.0.1",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "html.linux-arm64-gnu.node",
"files": [
"html.linux-arm64-gnu.node"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `@swc/html`

View File

@ -0,0 +1,44 @@
{
"name": "@swc/html-linux-arm64-musl",
"version": "0.0.1",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "html.linux-arm64-musl.node",
"files": [
"html.linux-arm64-musl.node"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `@swc/html`

View File

@ -0,0 +1,44 @@
{
"name": "@swc/html-linux-x64-gnu",
"version": "0.0.1",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "html.linux-x64-gnu.node",
"files": [
"html.linux-x64-gnu.node"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `@swc/html`

View File

@ -0,0 +1,44 @@
{
"name": "@swc/html-linux-x64-musl",
"version": "0.0.1",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "html.linux-x64-musl.node",
"files": [
"html.linux-x64-musl.node"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-win32-arm64-msvc",
"version": "0.0.1",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "html.win32-arm64-msvc.node",
"files": [
"html.win32-arm64-msvc.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-win32-ia32-msvc",
"version": "0.0.1",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "html.win32-ia32-msvc.node",
"files": [
"html.win32-ia32-msvc.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -0,0 +1,3 @@
# `@swc/html-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `@swc/html`

View File

@ -0,0 +1,41 @@
{
"name": "@swc/html-win32-x64-msvc",
"version": "0.0.1",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "html.win32-x64-msvc.node",
"files": [
"html.win32-x64-msvc.node"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

103
packages/html/tsconfig.json Normal file
View File

@ -0,0 +1,103 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2019" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs" /* Specify what module code is generated. */,
// "rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* Type Checking */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/minifier-darwin-arm64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "minifier.darwin-arm64.node",
"files": [
"minifier.darwin-arm64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-darwin-arm64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "minifier.darwin-arm64.node",
"files": [
"minifier.darwin-arm64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/minifier-darwin-x64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "minifier.darwin-x64.node",
"files": [
"minifier.darwin-x64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-darwin-x64",
"version": "1.7.14",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "minifier.darwin-x64.node",
"files": [
"minifier.darwin-x64.node",
"swc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,38 +1,38 @@
{
"name": "@swc/minifier-linux-arm-gnueabihf",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "minifier.linux-arm-gnueabihf.node",
"files": [
"minifier.linux-arm-gnueabihf.node",
"swc"
],
"description": "Super-fast alternative for terser",
"keywords": [
"swc",
"terser",
"minifier"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0",
"engines": {
"node": ">=12"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-linux-arm-gnueabihf",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "minifier.linux-arm-gnueabihf.node",
"files": [
"minifier.linux-arm-gnueabihf.node",
"swc"
],
"description": "Super-fast alternative for terser",
"keywords": [
"swc",
"terser",
"minifier"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0",
"engines": {
"node": ">=12"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/minifier-linux-arm64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "minifier.linux-arm64-gnu.node",
"files": [
"minifier.linux-arm64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-linux-arm64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "minifier.linux-arm64-gnu.node",
"files": [
"minifier.linux-arm64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/minifier-linux-arm64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "minifier.linux-arm64-musl.node",
"files": [
"minifier.linux-arm64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-linux-arm64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "minifier.linux-arm64-musl.node",
"files": [
"minifier.linux-arm64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/minifier-linux-x64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "minifier.linux-x64-gnu.node",
"files": [
"minifier.linux-x64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-linux-x64-gnu",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "minifier.linux-x64-gnu.node",
"files": [
"minifier.linux-x64-gnu.node",
"swc"
],
"libc": [
"glibc"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,45 +1,45 @@
{
"name": "@swc/minifier-linux-x64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "minifier.linux-x64-musl.node",
"files": [
"minifier.linux-x64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-linux-x64-musl",
"version": "1.7.14",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "minifier.linux-x64-musl.node",
"files": [
"minifier.linux-x64-musl.node",
"swc"
],
"libc": [
"musl"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/minifier-win32-arm64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "minifier.win32-arm64-msvc.node",
"files": [
"minifier.win32-arm64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-win32-arm64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "minifier.win32-arm64-msvc.node",
"files": [
"minifier.win32-arm64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/minifier-win32-ia32-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "minifier.win32-ia32-msvc.node",
"files": [
"minifier.win32-ia32-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-win32-ia32-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "minifier.win32-ia32-msvc.node",
"files": [
"minifier.win32-ia32-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -1,42 +1,42 @@
{
"name": "@swc/minifier-win32-x64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "minifier.win32-x64-msvc.node",
"files": [
"minifier.win32-x64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}
"name": "@swc/minifier-win32-x64-msvc",
"version": "1.7.14",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "minifier.win32-x64-msvc.node",
"files": [
"minifier.win32-x64-msvc.node",
"swc.exe"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": ">=10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
}
}

View File

@ -3032,6 +3032,15 @@ __metadata:
languageName: node
linkType: hard
"@napi-rs/cli@npm:^2.16.1":
version: 2.18.4
resolution: "@napi-rs/cli@npm:2.18.4"
bin:
napi: scripts/index.js
checksum: b9bdb0e0f96328315a5ad7846df5c72f5f00c707aa58bf2e8b753ad419c4a45989ba6967c8a27acf1552051d2693ae43a9be9ab2c173671040c1861e6d920ac6
languageName: node
linkType: hard
"@napi-rs/cli@npm:^3.0.0-alpha.22":
version: 3.0.0-alpha.55
resolution: "@napi-rs/cli@npm:3.0.0-alpha.55"
@ -4644,6 +4653,15 @@ __metadata:
languageName: unknown
linkType: soft
"@swc/html@workspace:packages/html":
version: 0.0.0-use.local
resolution: "@swc/html@workspace:packages/html"
dependencies:
"@napi-rs/cli": "npm:^2.16.1"
typescript: "npm:^5.1.6"
languageName: unknown
linkType: soft
"@swc/minifier-darwin-arm64@workspace:packages/minifier/scripts/npm/darwin-arm64":
version: 0.0.0-use.local
resolution: "@swc/minifier-darwin-arm64@workspace:packages/minifier/scripts/npm/darwin-arm64"
@ -16973,6 +16991,16 @@ __metadata:
languageName: node
linkType: hard
"typescript@npm:^5.1.6":
version: 5.5.4
resolution: "typescript@npm:5.5.4"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 1689ccafef894825481fc3d856b4834ba3cc185a9c2878f3c76a9a1ef81af04194849840f3c69e7961e2312771471bb3b460ca92561e1d87599b26c37d0ffb6f
languageName: node
linkType: hard
"typescript@npm:^5.2.2":
version: 5.4.5
resolution: "typescript@npm:5.4.5"
@ -17003,6 +17031,16 @@ __metadata:
languageName: node
linkType: hard
"typescript@patch:typescript@npm%3A^5.1.6#optional!builtin<compat/typescript>":
version: 5.5.4
resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin<compat/typescript>::version=5.5.4&hash=e012d7"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 2c065f0ef81855eac25c9b658a3c9da65ffc005260c12854c2286f40f3667e1b1ecf8bdbdd37b59aa0397920378ce7900bff8cb32e0f1c7af6fd86efc676718c
languageName: node
linkType: hard
"typescript@patch:typescript@npm%3A^5.2.2#optional!builtin<compat/typescript>":
version: 5.4.5
resolution: "typescript@patch:typescript@npm%3A5.4.5#optional!builtin<compat/typescript>::version=5.4.5&hash=e012d7"