{"dist":{"shasum":"0b41a29cff340c1ff67802814545d5ab18c6af82","tarball":"https://registry.npmjs.org/@builder/swc/-/swc-0.1.4-beta.5.tgz","fileCount":6,"integrity":"sha512-njjUNsFVYu2zcydMuFVIKQeHQpoxYbZ2YD85i7dOAF8Ebfzb6dDYoSvhGGyF1EFm7e/iFSQ5ywMxcB0YS66zoQ==","signatures":[{"sig":"MEUCIQCosPUu+W7EaM77m2yiuhxX4r9ByY6j/gwLBfFCNqD/BwIgdG7qrlNloLVhSMhtSakhuWuUmqnSu5UzSe0Z1Rt7ntQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJilJdQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgAQ//VJx9Zrnc8XbsbiBWNV1GohytUGc9LirNgyAvW3u8OGMswYFM\r\nhq+tu943GV6gokDLnWRHWLHK565xXcNcwXOGjR8uaORHwpxJBlJIuQv71BZD\r\nXLCe8RxzOT6h5wUf8By0+imHQhrR/aUE0AnAO0fAR1D3va6XCYh8RUOs9bDK\r\noZ5lWKs0CRFOERbAAFM+6qYOnL/k+WQ01F23qB/RidXZfYJMN7uZ8Qr5K2Vj\r\nwtUV+fSeG8+7f/wJzbYU8ztIDyJwXaMqwEUl9Z9MjBRvKmXB8utqPlpuSwhO\r\nzfm41TLq+8/T4IGsRpnamFDzu9j2lR1j2HhBaJgoVb5g8nw0Ox6YmtTg4ldL\r\nyc71tYEs5sIopFhw9HNqFW7hfx/tWlDvLxfY7vmJ+LD6qqkdnOCeCn7Xi/QP\r\nAtOBp8/ZbCqKaGN7vsCIXhpsbSoa9IOCfsYQqE1ncD1mZQ9+TJh+Ae+dzyqo\r\n1OCi61RGqcayQy3AP/ICyiEnac13E/Mz7BQKPwpeC8+NWtBm0o7JlAe0tZ2w\r\nIjk8pW3IXjtSGSGI7NeWgSALdGrL0FbivLt/Lrl+2h11ysZiCZddqAcNppCN\r\n75rhsYh2a/KwgEziuYiQt5OXjyd6LJBvGksWhVuneqqsUkdR6f8e9CaWVSX6\r\nrp97nGyeSGUZNaB1YHrHTUd60YVaq436tqo=\r\n=Elyi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","name":"@builder/swc","napi":{"name":"builder-swc","triples":{"defaults":true,"additional":["x86_64-unknown-linux-musl","i686-pc-windows-msvc","aarch64-unknown-linux-gnu","aarch64-apple-darwin","aarch64-unknown-linux-musl","aarch64-pc-windows-msvc"]}},"husky":{"hooks":{"pre-push":"npm run lint","commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"types":"./lib/index.d.ts","readme":"## @builder/swc\n\n>swc version is 0.180.0\n\n<img src=\"https://img.shields.io/npm/v/@builder/swc.svg\" alt=\"npm package\" />\n<img src=\"https://img.shields.io/npm/dm/@builder/swc.svg\" alt=\"npm downloads\" />\n\nCustom swc for [ice.js](https://github.com/alibaba/ice) and [rax-app](https://github.com/raxjs/rax-app).\n\n<i>Customization is achieved through the pass hook of swc.</i>\n\n### Platform Support\n\n- Windows x64\n- Windows aarch64\n- Window ia32\n- macOS x64\n- macOS aarch64\n- Linux aarch64 gnu\n- Linux aarch64 musl\n- Linux x64 gnu\n- Linux x64 musl\n\n### API\n\n#### transformSync(code: string, options)\n\n> Return { code: string, map?: string }\n\nSynchronous transform code. You can pass [@swc/core options](https://swc.rs/docs/configuration/compilation) directly.\n\n```js\nimport { transformSync } from '@builder/swc';\n\nconst { code, map } = transformSync('var a = 1;', {\n  jsc: {\n    parser: {\n      syntax: \"ecmascript\",\n    },\n    transform: {},\n  },\n});\n```\n\n**options.keepPlatform**\n\nTransform the variables which exported by `universal-env` to bool. The output code will remove other platform code by compressor.\n\n```js\nimport { transformSync } from '@builder/swc';\n\n// Case 1: import specifier\n// Input\nvar input = `\nimport { isWeb, isWeex } from 'universal-env';\n\nif (isWeb) {\n  console.log('This is web code');\n} else {\n  console.log('This is weex code');\n}\n`;\n\nvar { code, map } = transformSync(input, {\n  jsc: {\n    parser: {\n      syntax: \"ecmascript\",\n    },\n    transform: {},\n  },\n  keepPlatform: 'web',\n});\n\nconsole.log(code);\n/* The output code is:\nvar isWeb = true;\nvar isWeex = false;\n\nif (isWeb) {\n  console.log('This is web code');\n} else {\n  console.log('This is weex code');\n}\n*/\n\n// Case 2: import namespace specifier\n// Input\nvar input = `\nimport * as env from 'universal-env';\n\nif (env.isWeb) {\n  console.log('This is web code');\n} else {\n  console.log('This is weex code');\n}\n`;\n\nvar { code, map } = transformSync(input, {\n  jsc: {\n    parser: {\n      syntax: \"ecmascript\",\n    },\n    transform: {},\n  },\n  keepPlatform: 'web',\n});\n\nconsole.log(code);\n/* The output code is:\nvar env = {\n  isWeb: true\n};\n\nif (env.isWeb) {\n  console.log('This is web code');\n} else {\n  console.log('This is weex code');\n}\n*/\n```\n\n#### transform(code: string, options)\n\n> Return Promise<{ code: string, map?: string }>\n\nAsynchronous transform code. The options is the same as `transformSync`.\n\n```js\nimport { transformSync } from '@builder/swc';\n\nconst { code, map } = await transformSync(input, {\n  jsc: {\n    parser: {\n      syntax: \"ecmascript\",\n    },\n    transform: {},\n  },\n  keepPlatform: 'web',\n});\n```\n\n\n#### minify\n\n> Return Promise<{ code: string, map?: string }>\n\nIt is the same as [@swc/core](https://swc.rs/docs/configuration/minification).\n\nThis API is asynchronous and all of parsing, minification, and code generation will be done in background thread.\n\n```js\nimport { minify } from \"@builder/swc\";\n\nconst { code, map } = await minify(\n  \"import foo from '@src/app'; console.log(foo)\",\n  {\n    compress: false,\n    mangle: true,\n  }\n);\n\nexpect(code).toMatchInlineSnapshot(`\"import a from'@src/app';console.log(a);\"`);\n```\n\n#### minifySync\n\n> { code: string, map?: string }\n\nIt is the same as [@swc/core](https://swc.rs/docs/configuration/minification).\n\n```js\nimport { minifySync } from \"@builder/swc\";\n\nconst { code, map } = minifySync(\n  \"import foo from '@src/app'; console.log(foo)\",\n  {\n    compress: false,\n    mangle: true,\n  }\n);\n\nexpect(code).toMatchInlineSnapshot(`\"import a from'@src/app';console.log(a);\"`);\n```\n","engines":{"node":">= 12"},"gitHead":"19ca53c144ca2d71678961fca10911e7ab57280b","license":"MIT","scripts":{"ci":"npm run lint && npm run test","lint":"eslint --cache --ext .js,.jsx,.ts,.tsx ./","test":"jest --forceExit --ci","build":"npm run clean && npx tsc --build ./tsconfig.json","clean":"rimraf ./lib","setup":"rm -rf node_modules && yarn install && npm run build","watch":"npm run clean && npx tsc --build ./tsconfig.json -w","publish":"npm run version && npm run copy:swc && ts-node ./scripts/publish-package.ts","version":"napi version -p ./npm -c ./package.json","copy:swc":"ts-node ./scripts/copySwcBinaries.ts","lint:fix":"npm run lint -- --fix","build:swc":"napi build --platform --release --cargo-cwd ./ ./native --js=false","clean:swc":"rimraf ./native","test:watch":"jest --watch","clean:binary":"rimraf","publish:beta":"npm run copy:swc && PUBLISH_TYPE=beta ts-node ./scripts/publishPackageWithDistTag.ts"},"_npmUser":{"name":"rax-publisher","email":"rax-public@alibaba-inc.com"},"_npmVersion":"8.11.0","description":">swc version is 0.180.0","directories":{},"maintainers":[{"name":"maoxiaoke","email":"thebigyellowbee@qq.com"},{"name":"solojiang","email":"feifeishen1996@gmail.com"},{"name":"chriscindy","email":"yxy0919@foxmail.com"},{"name":"rax-publisher","email":"rax-public@alibaba-inc.com"},{"name":"sobear","email":"sobear.me@gmail.com"},{"name":"clarkxia","email":"xiawenwu41@gmail.com"},{"name":"luhengchang228","email":"luhengchang228@126.com"}],"_nodeVersion":"16.15.0","dependencies":{"@napi-rs/triples":"^1.0.3","@builder/swc-darwin-x64":"0.1.4-beta.5","@builder/swc-darwin-arm64":"0.1.4-beta.5","@builder/swc-linux-x64-gnu":"0.1.4-beta.5","@builder/swc-linux-x64-musl":"0.1.4-beta.1","@builder/swc-win32-x64-msvc":"0.1.4-beta.5","@builder/swc-linux-arm64-gnu":"0.1.4-beta.5","@builder/swc-win32-ia32-msvc":"0.1.4-beta.1","@builder/swc-linux-arm64-musl":"0.1.4-beta.1","@builder/swc-win32-arm64-msvc":"0.1.4-beta.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^27.4.5","husky":"^4.1.0","eslint":"^7.0.0","rimraf":"^3.0.2","semver":"^7.3.5","ts-jest":"^27.1.2","ts-node":"^8.6.1","fs-extra":"^10.0.0","typescript":"^4.0.0","@types/jest":"^27.4.0","@types/node":"^14.17.15","@napi-rs/cli":"^2.0.0","@applint/spec":"^1.0.0","ice-npm-utils":"^3.0.1","@commitlint/cli":"^11.0.0"},"optionalDependencies":{"@builder/swc-darwin-x64":"0.1.4-beta.5","@builder/swc-darwin-arm64":"0.1.4-beta.5","@builder/swc-linux-x64-gnu":"0.1.4-beta.5","@builder/swc-linux-x64-musl":"0.1.4-beta.1","@builder/swc-win32-x64-msvc":"0.1.4-beta.5","@builder/swc-linux-arm64-gnu":"0.1.4-beta.5","@builder/swc-win32-ia32-msvc":"0.1.4-beta.1","@builder/swc-linux-arm64-musl":"0.1.4-beta.1","@builder/swc-win32-arm64-msvc":"0.1.4-beta.1"},"_npmOperationalInternal":{"tmp":"tmp/swc_0.1.4-beta.5_1653905232006_0.7882772453038063","host":"s3://npm-registry-packages"},"_id":"@builder/swc@0.1.4-beta.5","version":"0.1.4-beta.5"}