diff --git a/.github/actions/build-node/action.yml b/.github/actions/build-node/action.yml deleted file mode 100644 index 16b26a1a2774..000000000000 --- a/.github/actions/build-node/action.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: "Build node.js binding" -description: "Build a binding for node.js by using `settings` matrix" - -inputs: - package: - description: "Package name" - required: true - -runs: - using: "composite" - - steps: - - name: Setup node x64 - uses: actions/setup-node@v3 - if: matrix.settings.target != 'i686-pc-windows-msvc' - with: - node-version: 18 - architecture: x64 - - - name: Setup node x86 - uses: actions/setup-node@v3 - if: matrix.settings.target == 'i686-pc-windows-msvc' - with: - node-version: 18 - architecture: x86 - - - name: Install - uses: actions-rs/toolchain@v1 - if: ${{ !matrix.settings.docker }} - with: - profile: minimal - override: true - target: ${{ matrix.settings.target }} - - - uses: goto-bus-stop/setup-zig@v2 - if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} - with: - version: 0.10.1 - - - shell: bash - run: corepack enable - - - name: Install node dependencies - shell: bash - working-directory: "./packages/minifier" - run: corepack yarn - - - name: Setup toolchain - run: ${{ matrix.settings.setup }} - if: ${{ matrix.settings.setup }} - shell: bash - - - name: Install dependencies - shell: bash - working-directory: "./packages" - run: | - # curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - echo '/usr/local/cargo/bin' >> $GITHUB_PATH - - name: Build in docker - uses: addnab/docker-run-action@v3 - if: ${{ matrix.settings.docker }} - with: - image: ${{ matrix.settings.docker }} - options: -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build - run: >- - yarn global add wasm-pack && - ${{ matrix.settings.build }} - - name: Build - if: ${{ !matrix.settings.docker }} - run: ${{ matrix.settings.build }} - shell: bash - - - run: ls -al ./packages/minifier - shell: bash - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: | - minifier-${{ matrix.settings.target }} - path: | - ./packages/minifier/minifier* - if-no-files-found: error diff --git a/.github/workflows/publish-extra-bindings.yml b/.github/workflows/publish-extra-bindings.yml index 25848d7406b6..6e5c24257559 100644 --- a/.github/workflows/publish-extra-bindings.yml +++ b/.github/workflows/publish-extra-bindings.yml @@ -14,21 +14,17 @@ permissions: id-token: write on: - workflow_dispatch: - inputs: - package: - type: choice - description: Package name to publish - options: - - minifier - - html - - xml - version: - description: Must be a valid semver version, and should not start with `v`. - required: true + push: + branches: + - ci + - ci* + - main + tags: + - v* jobs: build-node: + if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci') }} strategy: fail-fast: false matrix: @@ -36,14 +32,14 @@ jobs: - host: macos-latest target: x86_64-apple-darwin build: | - (cd packages/${{ github.event.inputs.package }} && corepack yarn build && strip -x *.node) + (cd packages/minifier && corepack yarn build && strip -x *.node) - host: windows-latest build: | - (cd packages/${{ github.event.inputs.package }} && yarn build) + (cd packages/minifier && yarn build) target: x86_64-pc-windows-msvc - host: windows-latest build: | - (cd packages/${{ github.event.inputs.package }} && corepack yarn build --target i686-pc-windows-msvc) + (cd packages/minifier && corepack yarn build --target i686-pc-windows-msvc) target: i686-pc-windows-msvc - host: ubuntu-latest target: x86_64-unknown-linux-gnu @@ -51,7 +47,7 @@ jobs: build: >- set -e && unset CC_x86_64_unknown_linux_gnu && unset CC && - (cd packages/${{ github.event.inputs.package }} && corepack yarn build --target x86_64-unknown-linux-gnu && strip ${{ github.event.inputs.package }}.linux-x64-gnu.node) + (cd packages/minifier && corepack yarn build --target x86_64-unknown-linux-gnu && strip minifier.linux-x64-gnu.node) - host: ubuntu-latest target: x86_64-unknown-linux-musl # musl build is slow, let's disable the LTO @@ -59,8 +55,8 @@ jobs: build: >- set -e && export CARGO_PROFILE_RELEASE_LTO=false && - (cd packages/${{ github.event.inputs.package }} && RUSTFLAGS='-C target-feature=+sse2 -C target-feature=-crt-static' corepack yarn build && - llvm-strip -x ${{ github.event.inputs.package }}.linux-x64-musl.node) + (cd packages/minifier && RUSTFLAGS='-C target-feature=+sse2 -C target-feature=-crt-static' corepack yarn build && + llvm-strip -x minifier.linux-x64-musl.node) - host: macos-latest target: aarch64-apple-darwin build: | @@ -69,7 +65,7 @@ jobs: export CXX=$(xcrun -f clang++); SYSROOT=$(xcrun --sdk macosx --show-sdk-path); export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; - (cd packages/${{ github.event.inputs.package }} && corepack yarn build --target=aarch64-apple-darwin && strip -x *.node) + (cd packages/minifier && corepack yarn build --target=aarch64-apple-darwin && strip -x *.node) - host: ubuntu-latest target: aarch64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 @@ -78,8 +74,8 @@ jobs: export JEMALLOC_SYS_WITH_LG_PAGE=16 && rustup target add aarch64-unknown-linux-gnu && export CC_aarch64_unknown_linux_gnu=/usr/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc && - (cd packages/${{ github.event.inputs.package }} && corepack yarn build --target aarch64-unknown-linux-gnu && - llvm-strip -x ${{ github.event.inputs.package }}.linux-arm64-gnu.node) + (cd packages/minifier && corepack yarn build --target aarch64-unknown-linux-gnu && + llvm-strip -x minifier.linux-arm64-gnu.node) - host: ubuntu-latest target: armv7-unknown-linux-gnueabihf setup: | @@ -87,7 +83,7 @@ jobs: sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y # Use napi to build cli binary here to use zig as linker build: | - (cd packages/${{ github.event.inputs.package }} && corepack yarn build --target armv7-unknown-linux-gnueabihf && arm-linux-gnueabihf-strip ${{ github.event.inputs.package }}.linux-arm-gnueabihf.node) + (cd packages/minifier && corepack yarn build --target armv7-unknown-linux-gnueabihf && arm-linux-gnueabihf-strip minifier.linux-arm-gnueabihf.node) - host: ubuntu-latest target: aarch64-unknown-linux-musl downloadTarget: aarch64-unknown-linux-musl @@ -96,15 +92,15 @@ jobs: export JEMALLOC_SYS_WITH_LG_PAGE=16 && rustup toolchain install $(cat ./rust-toolchain) && rustup target add aarch64-unknown-linux-musl && - (cd packages/${{ github.event.inputs.package }} && env RUSTFLAGS='-C target-feature=-crt-static' corepack yarn build --target=aarch64-unknown-linux-musl && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip ${{ github.event.inputs.package }}.linux-arm64-musl.node) + (cd packages/minifier && env RUSTFLAGS='-C target-feature=-crt-static' corepack yarn build --target=aarch64-unknown-linux-musl && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip minifier.linux-arm64-musl.node) - host: windows-latest target: aarch64-pc-windows-msvc # Disable `LTO` and increase `codegen-units` to avoid llvm `OOM` on GitHub Actions. build: | export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=256 export CARGO_PROFILE_RELEASE_LTO=false - (cd packages/${{ github.event.inputs.package }} && corepack yarn build --target aarch64-pc-windows-msvc) - name: "Build: ${{ matrix.package }} - ${{ matrix.settings.target }}" + (cd packages/minifier && corepack yarn build --target aarch64-pc-windows-msvc) + name: stable - ${{ matrix.settings.target }} - node@18 runs-on: ${{ matrix.settings.host }} steps: - uses: actions/checkout@v3 @@ -141,7 +137,7 @@ jobs: - name: Install node dependencies shell: bash - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Setup toolchain @@ -168,16 +164,16 @@ jobs: run: ${{ matrix.settings.build }} shell: bash - - run: ls -al ./packages/${{ github.event.inputs.package }} + - run: ls -al ./packages/minifier shell: bash - name: Upload artifact uses: actions/upload-artifact@v3 with: name: | - ${{ github.event.inputs.package }}-${{ matrix.settings.target }} + minifier-${{ matrix.settings.target }} path: | - ./packages/${{ github.event.inputs.package }}/${{ github.event.inputs.package }}* + ./packages/minifier/minifier* if-no-files-found: error test-macOS-windows-binding: @@ -203,21 +199,21 @@ jobs: with: node-version: ${{ matrix.node }} - name: Install dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ github.event.inputs.package }}-${{ matrix.settings.target }} - path: "./packages/${{ github.event.inputs.package }}" + name: minifier-${{ matrix.settings.target }} + path: "./packages/minifier" - name: List packages - run: ls -R ./packages/${{ github.event.inputs.package }} + run: ls -R ./packages/minifier shell: bash - name: Build TypeScript - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn build:ts - name: Test bindings - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn test test-linux-x64-gnu-binding: if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci') }} @@ -240,23 +236,23 @@ jobs: node-version: ${{ matrix.node }} - name: Install dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ github.event.inputs.package }}-x86_64-unknown-linux-gnu - path: "./packages/${{ github.event.inputs.package }}" + name: minifier-x86_64-unknown-linux-gnu + path: "./packages/minifier" - name: List packages - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: ls -R . shell: bash - name: Build TypeScript - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn build:ts - name: Test bindings - run: docker run --rm -v $(pwd):/swc -w /swc/packages/${{ github.event.inputs.package }} node:${{ matrix.node }}-slim env DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test + run: docker run --rm -v $(pwd):/swc -w /swc/packages/minifier node:${{ matrix.node }}-slim env DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test test-linux-x64-musl-binding: if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci') }} name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} @@ -277,22 +273,22 @@ jobs: with: node-version: ${{ matrix.node }} - name: Install dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ github.event.inputs.package }}-x86_64-unknown-linux-musl - path: "./packages/${{ github.event.inputs.package }}" + name: minifier-x86_64-unknown-linux-musl + path: "./packages/minifier" - name: List packages - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: ls -R . shell: bash - name: Build TypeScript - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn build:ts - name: Test bindings - run: docker run --rm -v $(pwd):/swc -w /swc/packages/${{ github.event.inputs.package }} node:${{ matrix.node }}-alpine env DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test + run: docker run --rm -v $(pwd):/swc -w /swc/packages/minifier node:${{ matrix.node }}-alpine env DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test test-linux-aarch64-musl-binding: if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci') }} name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }} @@ -304,17 +300,17 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ github.event.inputs.package }}-aarch64-unknown-linux-musl - path: "./packages/${{ github.event.inputs.package }}" + name: minifier-aarch64-unknown-linux-musl + path: "./packages/minifier" - name: List packages - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: ls -R . shell: bash - name: Install dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Build TypeScript - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn build:ts - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -328,7 +324,7 @@ jobs: options: "--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build" run: >- set -e && - (cd "./packages/${{ github.event.inputs.package }}" && DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test) + (cd "./packages/minifier" && DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test) test-linux-arm-gnueabihf-binding: if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/ci') }} name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }} @@ -347,17 +343,17 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ github.event.inputs.package }}-armv7-unknown-linux-gnueabihf - path: "./packages/${{ github.event.inputs.package }}" + name: minifier-armv7-unknown-linux-gnueabihf + path: "./packages/minifier" - name: List packages - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: ls -R . shell: bash - name: Install dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Build TypeScript - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn build:ts - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -371,7 +367,7 @@ jobs: options: "--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build" run: >- set -e && - (cd "./packages/${{ github.event.inputs.package }}" && DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test && + (cd "./packages/minifier" && DISABLE_PLUGIN_E2E_TESTS=true corepack yarn test && ls -la) publish: if: ${{ startsWith(github.ref, 'refs/tags/v') }} @@ -393,35 +389,35 @@ jobs: node-version: 18 - name: Set release name - run: echo "RELEASE_VERSION=${{ github.event.inputs.package }}@v${{ github.event.inputs.version }}" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Install dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: corepack yarn - name: Download all artifacts uses: actions/download-artifact@v3 with: - path: ./packages/${{ github.event.inputs.package }}/artifacts + path: ./packages/minifier/artifacts - name: List binaries - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: ls -R artifacts shell: bash - name: Move binaries - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" shell: bash run: | npm run artifacts - name: List npm - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" run: ls -R ./scripts/npm shell: bash - name: Set fallback dependencies - working-directory: "./packages/${{ github.event.inputs.package }}" + working-directory: "./packages/minifier" shell: bash run: | node ./scripts/update_fallback_dependencies.js @@ -430,7 +426,7 @@ jobs: run: | npm config set provenance true echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - (cd ./packages/${{ github.event.inputs.package }} && npm publish --access public) + (cd ./packages/minifier && npm publish --access public) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/packages/html/.gitignore b/packages/html/.gitignore deleted file mode 100644 index b0b5c8183704..000000000000 --- a/packages/html/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.js -*.d.ts -!binding.js -!binding.d.ts \ No newline at end of file diff --git a/packages/html/.npmignore b/packages/html/.npmignore deleted file mode 100644 index f1a308f015f7..000000000000 --- a/packages/html/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -native/target -native/index.node -native/artifacts.json -**/*~ -**/node_modules -**/.DS_Store - -yarn.lock -package-lock.json -*.log -.idea/ -wasm/ \ No newline at end of file diff --git a/packages/html/npm/darwin-arm64/README.md b/packages/html/npm/darwin-arm64/README.md deleted file mode 100644 index 30abda33d9df..000000000000 --- a/packages/html/npm/darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-darwin-arm64` - -This is the **aarch64-apple-darwin** binary for `@swc/html` diff --git a/packages/html/npm/darwin-arm64/package.json b/packages/html/npm/darwin-arm64/package.json deleted file mode 100644 index 0dab08a5fe5f..000000000000 --- a/packages/html/npm/darwin-arm64/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/html-darwin-arm64", - "version": "1.2.130", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "main": "html.darwin-arm64.node", - "files": [ - "html.darwin-arm64.node", - "swc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/darwin-x64/README.md b/packages/html/npm/darwin-x64/README.md deleted file mode 100644 index cda9612ccd24..000000000000 --- a/packages/html/npm/darwin-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-darwin-x64` - -This is the **x86_64-apple-darwin** binary for `@swc/html` diff --git a/packages/html/npm/darwin-x64/package.json b/packages/html/npm/darwin-x64/package.json deleted file mode 100644 index 9a8446581065..000000000000 --- a/packages/html/npm/darwin-x64/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/html-darwin-x64", - "version": "1.2.130", - "os": [ - "darwin" - ], - "cpu": [ - "x64" - ], - "main": "html.darwin-x64.node", - "files": [ - "html.darwin-x64.node", - "swc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/linux-arm-gnueabihf/README.md b/packages/html/npm/linux-arm-gnueabihf/README.md deleted file mode 100644 index 50b6b52fe3c4..000000000000 --- a/packages/html/npm/linux-arm-gnueabihf/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-linux-arm-gnueabihf` - -This is the **armv7-unknown-linux-gnueabihf** binary for `@swc/html` diff --git a/packages/html/npm/linux-arm-gnueabihf/package.json b/packages/html/npm/linux-arm-gnueabihf/package.json deleted file mode 100644 index e972980a483e..000000000000 --- a/packages/html/npm/linux-arm-gnueabihf/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/html-linux-arm-gnueabihf", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "arm" - ], - "main": "html.linux-arm-gnueabihf.node", - "files": [ - "html.linux-arm-gnueabihf.node", - "swc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/linux-arm64-gnu/README.md b/packages/html/npm/linux-arm64-gnu/README.md deleted file mode 100644 index eb06be100b02..000000000000 --- a/packages/html/npm/linux-arm64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-linux-arm64-gnu` - -This is the **aarch64-unknown-linux-gnu** binary for `@swc/html` diff --git a/packages/html/npm/linux-arm64-gnu/package.json b/packages/html/npm/linux-arm64-gnu/package.json deleted file mode 100644 index 8ee636b6cd68..000000000000 --- a/packages/html/npm/linux-arm64-gnu/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/html-linux-arm64-gnu", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "main": "html.linux-arm64-gnu.node", - "files": [ - "html.linux-arm64-gnu.node", - "swc" - ], - "libc": [ - "glibc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/linux-arm64-musl/README.md b/packages/html/npm/linux-arm64-musl/README.md deleted file mode 100644 index 59a3a4dc0d8e..000000000000 --- a/packages/html/npm/linux-arm64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-linux-arm64-musl` - -This is the **aarch64-unknown-linux-musl** binary for `@swc/html` diff --git a/packages/html/npm/linux-arm64-musl/package.json b/packages/html/npm/linux-arm64-musl/package.json deleted file mode 100644 index fa22899c2c58..000000000000 --- a/packages/html/npm/linux-arm64-musl/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/html-linux-arm64-musl", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "main": "html.linux-arm64-musl.node", - "files": [ - "html.linux-arm64-musl.node", - "swc" - ], - "libc": [ - "musl" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/linux-x64-gnu/README.md b/packages/html/npm/linux-x64-gnu/README.md deleted file mode 100644 index 2f08c21b8996..000000000000 --- a/packages/html/npm/linux-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-linux-x64-gnu` - -This is the **x86_64-unknown-linux-gnu** binary for `@swc/html` diff --git a/packages/html/npm/linux-x64-gnu/package.json b/packages/html/npm/linux-x64-gnu/package.json deleted file mode 100644 index 3dec05cf74f1..000000000000 --- a/packages/html/npm/linux-x64-gnu/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/html-linux-x64-gnu", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "html.linux-x64-gnu.node", - "files": [ - "html.linux-x64-gnu.node", - "swc" - ], - "libc": [ - "glibc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/linux-x64-musl/README.md b/packages/html/npm/linux-x64-musl/README.md deleted file mode 100644 index b603ac65f1c0..000000000000 --- a/packages/html/npm/linux-x64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-linux-x64-musl` - -This is the **x86_64-unknown-linux-musl** binary for `@swc/html` diff --git a/packages/html/npm/linux-x64-musl/package.json b/packages/html/npm/linux-x64-musl/package.json deleted file mode 100644 index 8d64154cf612..000000000000 --- a/packages/html/npm/linux-x64-musl/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/html-linux-x64-musl", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "html.linux-x64-musl.node", - "files": [ - "html.linux-x64-musl.node", - "swc" - ], - "libc": [ - "musl" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/win32-arm64-msvc/README.md b/packages/html/npm/win32-arm64-msvc/README.md deleted file mode 100644 index 470550054c98..000000000000 --- a/packages/html/npm/win32-arm64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-win32-arm64-msvc` - -This is the **aarch64-pc-windows-msvc** binary for `@swc/html` diff --git a/packages/html/npm/win32-arm64-msvc/package.json b/packages/html/npm/win32-arm64-msvc/package.json deleted file mode 100644 index 606fb8d8858e..000000000000 --- a/packages/html/npm/win32-arm64-msvc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/html-win32-arm64-msvc", - "version": "1.2.130", - "os": [ - "win32" - ], - "cpu": [ - "arm64" - ], - "main": "html.win32-arm64-msvc.node", - "files": [ - "html.win32-arm64-msvc.node", - "swc.exe" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/win32-ia32-msvc/README.md b/packages/html/npm/win32-ia32-msvc/README.md deleted file mode 100644 index 17122d1e55c9..000000000000 --- a/packages/html/npm/win32-ia32-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-win32-ia32-msvc` - -This is the **i686-pc-windows-msvc** binary for `@swc/html` diff --git a/packages/html/npm/win32-ia32-msvc/package.json b/packages/html/npm/win32-ia32-msvc/package.json deleted file mode 100644 index 887c799c162a..000000000000 --- a/packages/html/npm/win32-ia32-msvc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/html-win32-ia32-msvc", - "version": "1.2.130", - "os": [ - "win32" - ], - "cpu": [ - "ia32" - ], - "main": "html.win32-ia32-msvc.node", - "files": [ - "html.win32-ia32-msvc.node", - "swc.exe" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/npm/win32-x64-msvc/README.md b/packages/html/npm/win32-x64-msvc/README.md deleted file mode 100644 index b1b72cf1857c..000000000000 --- a/packages/html/npm/win32-x64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/html-win32-x64-msvc` - -This is the **x86_64-pc-windows-msvc** binary for `@swc/html` diff --git a/packages/html/npm/win32-x64-msvc/package.json b/packages/html/npm/win32-x64-msvc/package.json deleted file mode 100644 index a66fcc2de904..000000000000 --- a/packages/html/npm/win32-x64-msvc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/html-win32-x64-msvc", - "version": "1.2.130", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "main": "html.win32-x64-msvc.node", - "files": [ - "html.win32-x64-msvc.node", - "swc.exe" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/html/package.json b/packages/html/package.json deleted file mode 100644 index 579f6333c048..000000000000 --- a/packages/html/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@swc-lab/html", - "version": "0.1.0", - "description": "Super-fast alternative for terser", - "homepage": "https://swc.rs", - "main": "./index.js", - "author": "강동윤 ", - "license": "Apache-2.0", - "keywords": [ - "swc", - "html" - ], - "engines": { - "node": ">=12" - }, - "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-unknown-linux-musl", - "aarch64-pc-windows-msvc" - ] - } - }, - "publishConfig": { - "registry": "https://registry.npmjs.org/", - "access": "public" - }, - "types": "./index.d.ts", - "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 ../../bindings/binding_html_wasm --scope swc {1} -t {2}\" --", - "build": "tsc -d && napi build --platform --cargo-name binding_html_node --js ./src/binding.js --dts ./src/binding.d.ts --cargo-cwd ../../bindings -p binding_html_node --release", - "build:dev": "tsc -d && napi build --platform --cargo-name binding_html_node --js ./src/binding.js --dts ./src/binding.d.ts --cargo-cwd ../../bindings -p binding_html_node", - "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' echo 'no test'", - "version": "napi version -p scripts/npm" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/swc" - }, - "packageManager": "yarn@3.5.0", - "dependencies": { - "@swc/counter": "^0.1.1", - "@swc/types": "workspace:^" - }, - "devDependencies": { - "@napi-rs/cli": "^2.16.3", - "@types/node": "^20.7.1", - "cross-env": "^7.0.3", - "typescript": "^5.2.2" - } -} diff --git a/packages/html/src/binding.d.ts b/packages/html/src/binding.d.ts deleted file mode 100644 index dc47750e15f3..000000000000 --- a/packages/html/src/binding.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -/* auto-generated by NAPI-RS */ - -export interface TransformOutput { - code: string - map?: string -} -export function minify(code: Buffer, opts: Buffer, signal?: AbortSignal | undefined | null): Promise -export function minifySync(code: Buffer, opts: Buffer): TransformOutput -export function getTargetTriple(): string -export function initCustomTraceSubscriber(traceOutFilePath?: string | undefined | null): void -/** Hack for `Type Generation` */ -export interface TransformOutput { - code: string - map?: string -} diff --git a/packages/html/src/binding.js b/packages/html/src/binding.js deleted file mode 100644 index 3c88bb96cfcc..000000000000 --- a/packages/html/src/binding.js +++ /dev/null @@ -1,260 +0,0 @@ -/* 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, minifySync, getTargetTriple, initCustomTraceSubscriber } = nativeBinding - -module.exports.minify = minify -module.exports.minifySync = minifySync -module.exports.getTargetTriple = getTargetTriple -module.exports.initCustomTraceSubscriber = initCustomTraceSubscriber diff --git a/packages/html/src/index.ts b/packages/html/src/index.ts deleted file mode 100644 index 49d7b27f03d7..000000000000 --- a/packages/html/src/index.ts +++ /dev/null @@ -1,23 +0,0 @@ - -import { JsMinifyOptions } from '@swc/types'; -import * as binding from './binding' - -/** - * TODO - */ -export async function minify(code: Buffer, options: JsMinifyOptions) { - return await binding.minify(code, toBuffer(options)) -} - - -/** - * TODO - */ -export function minifySync(code: Buffer, options: JsMinifyOptions): binding.TransformOutput { - return binding.minifySync(code, toBuffer(options)) -} - - -function toBuffer(t: any): Buffer { - return Buffer.from(JSON.stringify(t)) -} diff --git a/packages/html/tsconfig.json b/packages/html/tsconfig.json deleted file mode 100644 index 48e67eaed7c3..000000000000 --- a/packages/html/tsconfig.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - // "lib": [], /* Specify library files to be included in the compilation. */ - "allowJs": true /* Allow javascript files to be compiled. */, - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true /* Generates corresponding '.d.ts' file. */, - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": false /* Generates corresponding '.map' file. */, - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./" /* Redirect output structure to the directory. */, - "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, - // "composite": true, /* Enable project compilation */ - "removeComments": false /* Do not emit comments to output. */, - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - /* Strict Type-Checking Options */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */, - "tsBuildInfoFile": ".tsbuildinfo" - }, - "include": [ - "src/" - ], - "exclude": [ - "*.js" - ] -} \ No newline at end of file diff --git a/packages/xml/.gitignore b/packages/xml/.gitignore deleted file mode 100644 index b0b5c8183704..000000000000 --- a/packages/xml/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.js -*.d.ts -!binding.js -!binding.d.ts \ No newline at end of file diff --git a/packages/xml/.npmignore b/packages/xml/.npmignore deleted file mode 100644 index f1a308f015f7..000000000000 --- a/packages/xml/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -native/target -native/index.node -native/artifacts.json -**/*~ -**/node_modules -**/.DS_Store - -yarn.lock -package-lock.json -*.log -.idea/ -wasm/ \ No newline at end of file diff --git a/packages/xml/npm/darwin-arm64/README.md b/packages/xml/npm/darwin-arm64/README.md deleted file mode 100644 index 08f36a3d6905..000000000000 --- a/packages/xml/npm/darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-darwin-arm64` - -This is the **aarch64-apple-darwin** binary for `@swc/xml` diff --git a/packages/xml/npm/darwin-arm64/package.json b/packages/xml/npm/darwin-arm64/package.json deleted file mode 100644 index 9611c2711495..000000000000 --- a/packages/xml/npm/darwin-arm64/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/xml-darwin-arm64", - "version": "1.2.130", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "main": "xml.darwin-arm64.node", - "files": [ - "xml.darwin-arm64.node", - "swc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/darwin-x64/README.md b/packages/xml/npm/darwin-x64/README.md deleted file mode 100644 index 7b9352b5fdf7..000000000000 --- a/packages/xml/npm/darwin-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-darwin-x64` - -This is the **x86_64-apple-darwin** binary for `@swc/xml` diff --git a/packages/xml/npm/darwin-x64/package.json b/packages/xml/npm/darwin-x64/package.json deleted file mode 100644 index 7d6d71eec44b..000000000000 --- a/packages/xml/npm/darwin-x64/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/xml-darwin-x64", - "version": "1.2.130", - "os": [ - "darwin" - ], - "cpu": [ - "x64" - ], - "main": "xml.darwin-x64.node", - "files": [ - "xml.darwin-x64.node", - "swc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/linux-arm-gnueabihf/README.md b/packages/xml/npm/linux-arm-gnueabihf/README.md deleted file mode 100644 index 34858ce479cb..000000000000 --- a/packages/xml/npm/linux-arm-gnueabihf/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-linux-arm-gnueabihf` - -This is the **armv7-unknown-linux-gnueabihf** binary for `@swc/xml` diff --git a/packages/xml/npm/linux-arm-gnueabihf/package.json b/packages/xml/npm/linux-arm-gnueabihf/package.json deleted file mode 100644 index ba83336760d5..000000000000 --- a/packages/xml/npm/linux-arm-gnueabihf/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/xml-linux-arm-gnueabihf", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "arm" - ], - "main": "xml.linux-arm-gnueabihf.node", - "files": [ - "xml.linux-arm-gnueabihf.node", - "swc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/linux-arm64-gnu/README.md b/packages/xml/npm/linux-arm64-gnu/README.md deleted file mode 100644 index d9669cd69111..000000000000 --- a/packages/xml/npm/linux-arm64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-linux-arm64-gnu` - -This is the **aarch64-unknown-linux-gnu** binary for `@swc/xml` diff --git a/packages/xml/npm/linux-arm64-gnu/package.json b/packages/xml/npm/linux-arm64-gnu/package.json deleted file mode 100644 index 47c783218c7f..000000000000 --- a/packages/xml/npm/linux-arm64-gnu/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/xml-linux-arm64-gnu", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "main": "xml.linux-arm64-gnu.node", - "files": [ - "xml.linux-arm64-gnu.node", - "swc" - ], - "libc": [ - "glibc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/linux-arm64-musl/README.md b/packages/xml/npm/linux-arm64-musl/README.md deleted file mode 100644 index 34c7c1a961d3..000000000000 --- a/packages/xml/npm/linux-arm64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-linux-arm64-musl` - -This is the **aarch64-unknown-linux-musl** binary for `@swc/xml` diff --git a/packages/xml/npm/linux-arm64-musl/package.json b/packages/xml/npm/linux-arm64-musl/package.json deleted file mode 100644 index 82012ac7244a..000000000000 --- a/packages/xml/npm/linux-arm64-musl/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/xml-linux-arm64-musl", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "main": "xml.linux-arm64-musl.node", - "files": [ - "xml.linux-arm64-musl.node", - "swc" - ], - "libc": [ - "musl" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/linux-x64-gnu/README.md b/packages/xml/npm/linux-x64-gnu/README.md deleted file mode 100644 index ebed55ee16ab..000000000000 --- a/packages/xml/npm/linux-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-linux-x64-gnu` - -This is the **x86_64-unknown-linux-gnu** binary for `@swc/xml` diff --git a/packages/xml/npm/linux-x64-gnu/package.json b/packages/xml/npm/linux-x64-gnu/package.json deleted file mode 100644 index 79eb5fa3d2e0..000000000000 --- a/packages/xml/npm/linux-x64-gnu/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/xml-linux-x64-gnu", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "xml.linux-x64-gnu.node", - "files": [ - "xml.linux-x64-gnu.node", - "swc" - ], - "libc": [ - "glibc" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/linux-x64-musl/README.md b/packages/xml/npm/linux-x64-musl/README.md deleted file mode 100644 index 567c6e115d67..000000000000 --- a/packages/xml/npm/linux-x64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-linux-x64-musl` - -This is the **x86_64-unknown-linux-musl** binary for `@swc/xml` diff --git a/packages/xml/npm/linux-x64-musl/package.json b/packages/xml/npm/linux-x64-musl/package.json deleted file mode 100644 index 5bdebebd6194..000000000000 --- a/packages/xml/npm/linux-x64-musl/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@swc/xml-linux-x64-musl", - "version": "1.2.130", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "xml.linux-x64-musl.node", - "files": [ - "xml.linux-x64-musl.node", - "swc" - ], - "libc": [ - "musl" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/win32-arm64-msvc/README.md b/packages/xml/npm/win32-arm64-msvc/README.md deleted file mode 100644 index b44bbe2e575e..000000000000 --- a/packages/xml/npm/win32-arm64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-win32-arm64-msvc` - -This is the **aarch64-pc-windows-msvc** binary for `@swc/xml` diff --git a/packages/xml/npm/win32-arm64-msvc/package.json b/packages/xml/npm/win32-arm64-msvc/package.json deleted file mode 100644 index d8d69c63c3ca..000000000000 --- a/packages/xml/npm/win32-arm64-msvc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/xml-win32-arm64-msvc", - "version": "1.2.130", - "os": [ - "win32" - ], - "cpu": [ - "arm64" - ], - "main": "xml.win32-arm64-msvc.node", - "files": [ - "xml.win32-arm64-msvc.node", - "swc.exe" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/win32-ia32-msvc/README.md b/packages/xml/npm/win32-ia32-msvc/README.md deleted file mode 100644 index 250b9f2a9523..000000000000 --- a/packages/xml/npm/win32-ia32-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-win32-ia32-msvc` - -This is the **i686-pc-windows-msvc** binary for `@swc/xml` diff --git a/packages/xml/npm/win32-ia32-msvc/package.json b/packages/xml/npm/win32-ia32-msvc/package.json deleted file mode 100644 index abcbeb38e9f6..000000000000 --- a/packages/xml/npm/win32-ia32-msvc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/xml-win32-ia32-msvc", - "version": "1.2.130", - "os": [ - "win32" - ], - "cpu": [ - "ia32" - ], - "main": "xml.win32-ia32-msvc.node", - "files": [ - "xml.win32-ia32-msvc.node", - "swc.exe" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/npm/win32-x64-msvc/README.md b/packages/xml/npm/win32-x64-msvc/README.md deleted file mode 100644 index 5f8bacb9e4a1..000000000000 --- a/packages/xml/npm/win32-x64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@swc/xml-win32-x64-msvc` - -This is the **x86_64-pc-windows-msvc** binary for `@swc/xml` diff --git a/packages/xml/npm/win32-x64-msvc/package.json b/packages/xml/npm/win32-x64-msvc/package.json deleted file mode 100644 index 0c6ad2f47c4f..000000000000 --- a/packages/xml/npm/win32-x64-msvc/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@swc/xml-win32-x64-msvc", - "version": "1.2.130", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "main": "xml.win32-x64-msvc.node", - "files": [ - "xml.win32-x64-msvc.node", - "swc.exe" - ], - "description": "Super-fast alternative for babel", - "keywords": [ - "swc", - "swcpack", - "babel", - "typescript", - "rust", - "webpack", - "tsc" - ], - "author": "강동윤 ", - "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" - } -} diff --git a/packages/xml/package.json b/packages/xml/package.json deleted file mode 100644 index 0b36fad77981..000000000000 --- a/packages/xml/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@swc-lab/xml", - "version": "0.1.0", - "description": "Super-fast alternative for terser", - "homepage": "https://swc.rs", - "main": "./index.js", - "author": "강동윤 ", - "license": "Apache-2.0", - "keywords": [ - "swc", - "xml" - ], - "engines": { - "node": ">=12" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/swc-project/swc.git" - }, - "bugs": { - "url": "https://github.com/swc-project/swc/issues" - }, - "napi": { - "name": "xml", - "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-unknown-linux-musl", - "aarch64-pc-windows-msvc" - ] - } - }, - "publishConfig": { - "registry": "https://registry.npmjs.org/", - "access": "public" - }, - "types": "./index.d.ts", - "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 ../../bindings/binding_xml_wasm --scope swc {1} -t {2}\" --", - "build": "tsc -d && napi build --platform --cargo-name binding_xml_node --js ./src/binding.js --dts ./src/binding.d.ts --cargo-cwd ../../bindings -p binding_xml_node --release", - "build:dev": "tsc -d && napi build --platform --cargo-name binding_xml_node --js ./src/binding.js --dts ./src/binding.d.ts --cargo-cwd ../../bindings -p binding_xml_node", - "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' echo 'no test'", - "version": "napi version -p scripts/npm" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/swc" - }, - "packageManager": "yarn@3.5.0", - "dependencies": { - "@swc/counter": "^0.1.1", - "@swc/types": "workspace:^" - }, - "devDependencies": { - "@napi-rs/cli": "^2.16.3", - "@types/node": "^20.7.1", - "cross-env": "^7.0.3", - "typescript": "^5.2.2" - } -} diff --git a/packages/xml/src/binding.d.ts b/packages/xml/src/binding.d.ts deleted file mode 100644 index dc47750e15f3..000000000000 --- a/packages/xml/src/binding.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -/* auto-generated by NAPI-RS */ - -export interface TransformOutput { - code: string - map?: string -} -export function minify(code: Buffer, opts: Buffer, signal?: AbortSignal | undefined | null): Promise -export function minifySync(code: Buffer, opts: Buffer): TransformOutput -export function getTargetTriple(): string -export function initCustomTraceSubscriber(traceOutFilePath?: string | undefined | null): void -/** Hack for `Type Generation` */ -export interface TransformOutput { - code: string - map?: string -} diff --git a/packages/xml/src/binding.js b/packages/xml/src/binding.js deleted file mode 100644 index d29f81d144eb..000000000000 --- a/packages/xml/src/binding.js +++ /dev/null @@ -1,260 +0,0 @@ -/* 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, 'xml.android-arm64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./xml.android-arm64.node') - } else { - nativeBinding = require('@swc/xml-android-arm64') - } - } catch (e) { - loadError = e - } - break - case 'arm': - localFileExisted = existsSync(join(__dirname, 'xml.android-arm-eabi.node')) - try { - if (localFileExisted) { - nativeBinding = require('./xml.android-arm-eabi.node') - } else { - nativeBinding = require('@swc/xml-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, 'xml.win32-x64-msvc.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.win32-x64-msvc.node') - } else { - nativeBinding = require('@swc/xml-win32-x64-msvc') - } - } catch (e) { - loadError = e - } - break - case 'ia32': - localFileExisted = existsSync( - join(__dirname, 'xml.win32-ia32-msvc.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.win32-ia32-msvc.node') - } else { - nativeBinding = require('@swc/xml-win32-ia32-msvc') - } - } catch (e) { - loadError = e - } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'xml.win32-arm64-msvc.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.win32-arm64-msvc.node') - } else { - nativeBinding = require('@swc/xml-win32-arm64-msvc') - } - } catch (e) { - loadError = e - } - break - default: - throw new Error(`Unsupported architecture on Windows: ${arch}`) - } - break - case 'darwin': - localFileExisted = existsSync(join(__dirname, 'xml.darwin-universal.node')) - try { - if (localFileExisted) { - nativeBinding = require('./xml.darwin-universal.node') - } else { - nativeBinding = require('@swc/xml-darwin-universal') - } - break - } catch { } - switch (arch) { - case 'x64': - localFileExisted = existsSync(join(__dirname, 'xml.darwin-x64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./xml.darwin-x64.node') - } else { - nativeBinding = require('@swc/xml-darwin-x64') - } - } catch (e) { - loadError = e - } - break - case 'arm64': - localFileExisted = existsSync( - join(__dirname, 'xml.darwin-arm64.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.darwin-arm64.node') - } else { - nativeBinding = require('@swc/xml-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, 'xml.freebsd-x64.node')) - try { - if (localFileExisted) { - nativeBinding = require('./xml.freebsd-x64.node') - } else { - nativeBinding = require('@swc/xml-freebsd-x64') - } - } catch (e) { - loadError = e - } - break - case 'linux': - switch (arch) { - case 'x64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'xml.linux-x64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.linux-x64-musl.node') - } else { - nativeBinding = require('@swc/xml-linux-x64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'xml.linux-x64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.linux-x64-gnu.node') - } else { - nativeBinding = require('@swc/xml-linux-x64-gnu') - } - } catch (e) { - loadError = e - } - } - break - case 'arm64': - if (isMusl()) { - localFileExisted = existsSync( - join(__dirname, 'xml.linux-arm64-musl.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.linux-arm64-musl.node') - } else { - nativeBinding = require('@swc/xml-linux-arm64-musl') - } - } catch (e) { - loadError = e - } - } else { - localFileExisted = existsSync( - join(__dirname, 'xml.linux-arm64-gnu.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.linux-arm64-gnu.node') - } else { - nativeBinding = require('@swc/xml-linux-arm64-gnu') - } - } catch (e) { - loadError = e - } - } - break - case 'arm': - localFileExisted = existsSync( - join(__dirname, 'xml.linux-arm-gnueabihf.node') - ) - try { - if (localFileExisted) { - nativeBinding = require('./xml.linux-arm-gnueabihf.node') - } else { - nativeBinding = require('@swc/xml-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, minifySync, getTargetTriple, initCustomTraceSubscriber } = nativeBinding - -module.exports.minify = minify -module.exports.minifySync = minifySync -module.exports.getTargetTriple = getTargetTriple -module.exports.initCustomTraceSubscriber = initCustomTraceSubscriber diff --git a/packages/xml/src/index.ts b/packages/xml/src/index.ts deleted file mode 100644 index 49d7b27f03d7..000000000000 --- a/packages/xml/src/index.ts +++ /dev/null @@ -1,23 +0,0 @@ - -import { JsMinifyOptions } from '@swc/types'; -import * as binding from './binding' - -/** - * TODO - */ -export async function minify(code: Buffer, options: JsMinifyOptions) { - return await binding.minify(code, toBuffer(options)) -} - - -/** - * TODO - */ -export function minifySync(code: Buffer, options: JsMinifyOptions): binding.TransformOutput { - return binding.minifySync(code, toBuffer(options)) -} - - -function toBuffer(t: any): Buffer { - return Buffer.from(JSON.stringify(t)) -} diff --git a/packages/xml/tsconfig.json b/packages/xml/tsconfig.json deleted file mode 100644 index 48e67eaed7c3..000000000000 --- a/packages/xml/tsconfig.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - // "lib": [], /* Specify library files to be included in the compilation. */ - "allowJs": true /* Allow javascript files to be compiled. */, - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true /* Generates corresponding '.d.ts' file. */, - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": false /* Generates corresponding '.map' file. */, - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./" /* Redirect output structure to the directory. */, - "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, - // "composite": true, /* Enable project compilation */ - "removeComments": false /* Do not emit comments to output. */, - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - /* Strict Type-Checking Options */ - "strict": true /* Enable all strict type-checking options. */, - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */, - "tsBuildInfoFile": ".tsbuildinfo" - }, - "include": [ - "src/" - ], - "exclude": [ - "*.js" - ] -} \ No newline at end of file diff --git a/packages/yarn.lock b/packages/yarn.lock index b619139a6d5f..6f43cc6d2c44 100644 --- a/packages/yarn.lock +++ b/packages/yarn.lock @@ -774,7 +774,7 @@ __metadata: "typescript@patch:typescript@^5.2.2#~builtin": version: 5.2.2 - resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=a1c5e5" + resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=85af82" bin: tsc: bin/tsc tsserver: bin/tsserver