refactor(bindings): Remove bindings for experimental packages (#8600)

**Description:**

These packages do not have the same versioning strategy as the main package.
This commit is contained in:
Donny/강동윤 2024-02-05 17:52:22 +09:00 committed by GitHub
parent 096ae4abdd
commit 6c50ff1bec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
67 changed files with 23 additions and 1987 deletions

View File

@ -23,8 +23,8 @@ on:
description: Package name to publish
options:
- minifier
- html
- xml
# - html
# - xml
jobs:
build-node:

View File

@ -169,7 +169,7 @@
],
"packageManager": "yarn@4.0.2",
"dependencies": {
"@swc/counter": "^0.1.1",
"@swc/counter": "^0.1.2",
"@swc/types": "^0.1.5"
}
}

View File

@ -1,7 +0,0 @@
# @swc/couter
Download counter for swc packages.
This package does not contain any code. It is used solely to track number of downloads of npm packages like `@swc/core` and `@next/swc`. If you are building a huge project using SWC, please consider depending on this package. It will not add any code to your bundle, but it will help us determine the number of users of SWC.
Counting is done by npm, just like other packages.

View File

@ -1 +0,0 @@
console.log('download-counter/index.js');

View File

@ -1,27 +0,0 @@
{
"name": "@swc/counter",
"packageManager": "yarn@4.0.2",
"main": "index.js",
"version": "0.1.2",
"description": "Downloade counter for the swc project",
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"keywords": [
"swc",
"download",
"counter"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"homepage": "https://swc.rs"
}

View File

@ -1,7 +1,7 @@
{
"name": "@swc/helpers",
"packageManager": "yarn@4.0.2",
"version": "0.5.4",
"version": "0.5.5",
"description": "External helpers for the swc project.",
"module": "esm/index.js",
"main": "cjs/index.cjs",
@ -36,6 +36,7 @@
"zx": "^7.2.1"
},
"dependencies": {
"@swc/counter": "^0.1.3",
"tslib": "^2.4.0"
},
"exports": {

View File

@ -1,4 +0,0 @@
*.js
*.d.ts
!binding.js
!binding.d.ts

View File

@ -1,18 +0,0 @@
native/target
native/index.node
native/artifacts.json
**/*~
**/node_modules
**/.DS_Store
yarn.lock
package-lock.json
*.log
.idea/
wasm/
# Built files
*.node
.tsbuildinfo
artifacts/
scripts/npm/

View File

@ -1,68 +0,0 @@
{
"name": "@swc-lab/html",
"version": "0.1.0",
"description": "Super-fast alternative for terser",
"homepage": "https://swc.rs",
"main": "./index.js",
"author": "강동윤 <kdy1997.dev@gmail.com>",
"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": {
"binaryName": "html",
"targets": [
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"aarch64-unknown-linux-gnu",
"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 --npm-dir 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 --js ./src/binding.js --dts ./src/binding.d.ts --manifest-path ../../bindings/Cargo.toml -p binding_html_node --output-dir . --release",
"build:dev": "tsc -d && napi build --platform --js ./src/binding.js --dts ./src/binding.d.ts --manifest-path ../../bindings/Cargo.toml -p binding_html_node --output-dir .",
"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"
},
"dependencies": {
"@swc/counter": "^0.1.1",
"@swc/types": "workspace:^"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.22",
"@types/node": "^20.7.1",
"cross-env": "^7.0.3",
"typescript": "^5.2.2"
}
}

View File

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

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-darwin-x64`
This is the **x86_64-apple-darwin** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `@swc/html`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/html-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `@swc/html`

View File

@ -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": "강동윤 <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,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<TransformOutput>
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
}

View File

@ -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

View File

@ -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))
}

View File

@ -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"
]
}

View File

@ -57,7 +57,7 @@
"url": "https://opencollective.com/swc"
},
"dependencies": {
"@swc/counter": "workspace:^",
"@swc/counter": "^0.1.3",
"@swc/types": "workspace:^"
},
"devDependencies": {

View File

@ -1,8 +0,0 @@
yarn.lock
node_modules
_/
*.tgz
lib/*.js
tests/*.js
*.d.ts
*.map

View File

@ -1,10 +0,0 @@
examples/
node_modules/
package-lock.json
*.log
.swcrc
.yarn
*.tgz
.dprint.json
out/
tests/

View File

@ -1,9 +0,0 @@
# swc-info
## Usage
```sh
npx -y swc-info@latest
```
then copy the output to the issue;.

View File

@ -1,2 +0,0 @@
#!/usr/bin/env node
require("../lib/index.js");

View File

@ -1,74 +0,0 @@
import os from "node:os";
import process from "node:process";
import childProcess from "child_process";
import { createRequire } from "node:module";
const localRequire = createRequire(`${process.cwd()}/[eval]`);
function getUniqueCpuNames(): string {
return os
.cpus()
.map((cpu) => cpu.model)
.filter((model, index, models) => models.indexOf(model) === index)
.join(", ");
}
function getBinaryVersion(binaryName: string): string {
try {
return childProcess
.execFileSync(binaryName, ["--version"])
.toString()
.trim();
} catch {
return "N/A";
}
}
function getPackageVersion(packageName: string) {
try {
return localRequire(`${packageName}/package.json`).version;
} catch {
return null;
}
}
function interestingPackage(name: string): string | null {
const version = getPackageVersion(name);
if (version) {
return `${name}: ${version}`;
} else {
return null;
}
}
function interestingPackages(names: string[]): string {
return names.map(interestingPackage).filter(Boolean).join("\n ");
}
console.log(`
Operating System:
Platform: ${os.platform()}
Arch: ${os.arch()}
Machine Type: ${os.machine()}
Version: ${os.version()}
CPU: (${os.cpus().length} cores)
Models: ${getUniqueCpuNames()}
Binaries:
Node: ${process.versions.node}
npm: ${getBinaryVersion("npm")}
Yarn: ${getBinaryVersion("yarn")}
pnpm: ${getBinaryVersion("pnpm")}
Relevant Packages:
@swc/core: ${getPackageVersion("@swc/core") ?? "N/A"}
@swc/helpers: ${getPackageVersion("@swc/helpers") ?? "N/A"}
@swc/types: ${getPackageVersion("@swc/types") ?? "N/A"}
${interestingPackages(["typescript", "next"])}
SWC Config:
output: N/A
.swcrc path: N/A
Next.js info:
output: N/A
`);

View File

@ -1,35 +0,0 @@
{
"name": "swc-info",
"packageManager": "yarn@4.0.2",
"version": "0.1.15",
"description": "CLI tool to help issue reporting for swc",
"sideEffects": false,
"scripts": {
"build": "tsc",
"prepublishOnly": "yarn build",
"prepack": "yarn build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"keywords": [
"swc",
"info",
"cli"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"homepage": "https://swc.rs",
"devDependencies": {
"typescript": "^5.2.2"
},
"bin": "bin/swc-info.js"
}

View File

@ -1,20 +0,0 @@
{
"compilerOptions": {
"target": "es2019",
"useDefineForClassFields": true,
"module": "commonjs",
"baseUrl": "./",
"paths": {},
"resolveJsonModule": true,
"declaration": true,
"sourceMap": true,
"downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"rootDir": "."
},
"include": ["lib", "tests"],
"exclude": ["examples"]
}

View File

@ -29,5 +29,8 @@
"homepage": "https://swc.rs",
"devDependencies": {
"typescript": "^5.2.2"
},
"dependencies": {
"@swc/counter": "^0.1.3"
}
}

View File

@ -1,4 +0,0 @@
*.js
*.d.ts
!binding.js
!binding.d.ts

View File

@ -1,18 +0,0 @@
native/target
native/index.node
native/artifacts.json
**/*~
**/node_modules
**/.DS_Store
yarn.lock
package-lock.json
*.log
.idea/
wasm/
# Built files
*.node
.tsbuildinfo
artifacts/
scripts/npm/

View File

@ -1,68 +0,0 @@
{
"name": "@swc-lab/xml",
"version": "0.1.0",
"description": "Super-fast alternative for terser",
"homepage": "https://swc.rs",
"main": "./index.js",
"author": "강동윤 <kdy1997.dev@gmail.com>",
"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": {
"binaryName": "xml",
"targets": [
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"aarch64-unknown-linux-gnu",
"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 --npm-dir 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 --js ./src/binding.js --dts ./src/binding.d.ts --manifest-path ../../bindings/Cargo.toml -p binding_xml_node --output-dir . --release",
"build:dev": "tsc -d && napi build --platform --js ./src/binding.js --dts ./src/binding.d.ts --manifest-path ../../bindings/Cargo.toml -p binding_xml_node --output-dir .",
"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"
},
"dependencies": {
"@swc/counter": "^0.1.1",
"@swc/types": "workspace:^"
},
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.22",
"@types/node": "^20.7.1",
"cross-env": "^7.0.3",
"typescript": "^5.2.2"
}
}

View File

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

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-darwin-x64`
This is the **x86_64-apple-darwin** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,3 +0,0 @@
# `@swc/xml-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `@swc/xml`

View File

@ -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": "강동윤 <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,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<TransformOutput>
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
}

View File

@ -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

View File

@ -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))
}

View File

@ -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"
]
}

View File

@ -585,43 +585,19 @@ __metadata:
languageName: node
linkType: hard
"@swc-lab/html@workspace:html":
version: 0.0.0-use.local
resolution: "@swc-lab/html@workspace:html"
dependencies:
"@napi-rs/cli": "npm:^3.0.0-alpha.22"
"@swc/counter": "npm:^0.1.1"
"@swc/types": "workspace:^"
"@types/node": "npm:^20.7.1"
cross-env: "npm:^7.0.3"
typescript: "npm:^5.2.2"
languageName: unknown
linkType: soft
"@swc-lab/xml@workspace:xml":
version: 0.0.0-use.local
resolution: "@swc-lab/xml@workspace:xml"
dependencies:
"@napi-rs/cli": "npm:^3.0.0-alpha.22"
"@swc/counter": "npm:^0.1.1"
"@swc/types": "workspace:^"
"@types/node": "npm:^20.7.1"
cross-env: "npm:^7.0.3"
typescript: "npm:^5.2.2"
languageName: unknown
linkType: soft
"@swc/counter@npm:^0.1.1, @swc/counter@workspace:^, @swc/counter@workspace:counter":
version: 0.0.0-use.local
resolution: "@swc/counter@workspace:counter"
languageName: unknown
linkType: soft
"@swc/counter@npm:^0.1.3":
version: 0.1.3
resolution: "@swc/counter@npm:0.1.3"
checksum: df8f9cfba9904d3d60f511664c70d23bb323b3a0803ec9890f60133954173047ba9bdeabce28cd70ba89ccd3fd6c71c7b0bd58be85f611e1ffbe5d5c18616598
languageName: node
linkType: hard
"@swc/helpers@workspace:helpers":
version: 0.0.0-use.local
resolution: "@swc/helpers@workspace:helpers"
dependencies:
"@ast-grep/napi": "npm:^0.3.1"
"@swc/counter": "npm:^0.1.3"
dprint: "npm:^0.35.3"
magic-string: "npm:^0.30.0"
tslib: "npm:^2.4.0"
@ -634,7 +610,7 @@ __metadata:
resolution: "@swc/minifier@workspace:minifier"
dependencies:
"@napi-rs/cli": "npm:^3.0.0-alpha.22"
"@swc/counter": "workspace:^"
"@swc/counter": "npm:^0.1.3"
"@swc/types": "workspace:^"
"@types/node": "npm:^20.7.1"
cross-env: "npm:^7.0.3"
@ -646,6 +622,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@swc/types@workspace:types"
dependencies:
"@swc/counter": "npm:^0.1.3"
typescript: "npm:^5.2.2"
languageName: unknown
linkType: soft
@ -1779,16 +1756,6 @@ __metadata:
languageName: node
linkType: hard
"swc-info@workspace:swc-info":
version: 0.0.0-use.local
resolution: "swc-info@workspace:swc-info"
dependencies:
typescript: "npm:^5.2.2"
bin:
swc-info: bin/swc-info.js
languageName: unknown
linkType: soft
"through@npm:2, through@npm:~2.3, through@npm:~2.3.1":
version: 2.3.8
resolution: "through@npm:2.3.8"

View File

@ -2923,7 +2923,7 @@ __metadata:
"@babel/types": "npm:^7.14.0"
"@napi-rs/cli": "npm:^3.0.0-alpha.22"
"@swc/core": "npm:=1.2.220"
"@swc/counter": "npm:^0.1.1"
"@swc/counter": "npm:^0.1.2"
"@swc/helpers": "npm:^0.5.0"
"@swc/plugin-jest": "npm:^1.5.113"
"@swc/types": "npm:^0.1.5"
@ -2972,10 +2972,10 @@ __metadata:
languageName: unknown
linkType: soft
"@swc/counter@npm:^0.1.1":
version: 0.1.1
resolution: "@swc/counter@npm:0.1.1"
checksum: bb974babd493ba01c0d4a95ab610c3fc15fbf609c08cb0342798e485f57ecc0950abbf84e07124e63c5fe610b492d9a8dd03701d3b9ef7329d9e8bf3cc44980f
"@swc/counter@npm:^0.1.2":
version: 0.1.2
resolution: "@swc/counter@npm:0.1.2"
checksum: 8427c594f1f0cf44b83885e9c8fe1e370c9db44ae96e07a37c117a6260ee97797d0709483efbcc244e77bac578690215f45b23254c4cd8a70fb25ddbb50bf33e
languageName: node
linkType: hard